QMCPACK
qmcplusplus Namespace Reference

helper functions for EinsplineSetBuilder More...

Namespaces

 C2C
 
 C2R
 
 compute
 
 Concurrency
 
 cuBLAS
 interface to cuBLAS calls for different data types S/C/D/Z
 
 cuBLAS_LU
 
 cuBLAS_MFs
 Implement selected batched BLAS1/2 calls using CUDA for different data types S/C/D/Z.
 
 CUDA
 interface to cuBLAS_inhouse calls for different data types S/C/D/Z
 
 cusolver
 interface to cusolver calls for different data types S/C/D/Z
 
 estimatorinput
 
 ewaldref
 
 hdf
 
 input
 
 MatrixOperators
 
 modernstrutil
 prevent clash with string_utils.h
 
 ompBLAS
 Implement selected batched and non-batched BLAS2 calls using OpenMP offload for different data types S/C/D/Z 1) column major like the BLAS fortran API 2) all the functions are synchronous, expected to be changed to asynchronous in the future.
 
 rocsolver
 interface to rocsolver calls for different data types S/C/D/Z
 
 simd
 
 spoinfo
 
 SYCL
 
 syclBLAS
 
 syclSolver
 
 testing
 SpaceGrid refactored for use with batched estimator design NE should be dropped when QMCHamiltonian/SpaceGrid has been deleted.
 
 Units
 

Classes

struct  A2NTransformer
 
class  ACForce
 
class  AGPDeterminant
 
class  AGPDeterminantBuilder
 An abstract class for wave function builders. More...
 
struct  AndCombine
 
class  AnotherInput
 Generic delgate input class. More...
 
class  AntiSymTensor
 
class  AntiSymTensor< T, 1 >
 
struct  ao_traits
 traits for a localized basis set; used by createBasisSet More...
 
struct  ao_traits< T, ORBT, 0, 0 >
 specialization for numerical-cartesian AO More...
 
struct  ao_traits< T, ORBT, 0, 1 >
 specialization for numerical-spherical AO More...
 
struct  ao_traits< T, ORBT, 1, 0 >
 specialization for GTO-cartesian AO More...
 
struct  ao_traits< T, ORBT, 1, 1 >
 specialization for GTO-cartesian AO More...
 
struct  ao_traits< T, ORBT, 2, 0 >
 specialization for STO-cartesian AO More...
 
struct  ao_traits< T, ORBT, 2, 1 >
 specialization for STO-spherical AO More...
 
class  AOBasisBuilder
 atomic basisset builder More...
 
struct  ApplyBConds
 Dummy template class to apply boundary conditions. More...
 
struct  ApplyBConds< ParticleAttrib< TinyVector< T, 3 > >, Tensor< T, 3 >, 3 >
 
struct  astring
 
class  AtomicOrbitals
 
class  AttribListType
 
struct  AxisGrid
 
class  Backflow_ee
 
class  Backflow_ee_kSpace
 
class  Backflow_eI
 
class  Backflow_eI_spin
 
class  BackflowBuilder
 
class  BackflowFunctionBase
 Base class for backflow transformations. More...
 
class  BackflowTransformation
 
struct  BandInfo
 
struct  BandInfoGroup
 a group of bands More...
 
struct  BareForce
 
class  BareKineticEnergy
 Evaluate the kinetic energy with a single mass. More...
 
struct  BasisSetBase
 base class for a basis set More...
 
class  BinaryNode
 
struct  BinaryReturn
 
struct  BinaryReturn< std::complex< T1 >, T1, OpMultiply >
 
struct  BinaryReturn< T1, std::complex< T1 >, OpMultiply >
 
struct  BinaryReturn< T1, T2, OpAddAssign >
 
struct  BinaryReturn< T1, T2, OpAnd >
 
struct  BinaryReturn< T1, T2, OpAssign >
 
struct  BinaryReturn< T1, T2, OpBitwiseAndAssign >
 
struct  BinaryReturn< T1, T2, OpBitwiseOrAssign >
 
struct  BinaryReturn< T1, T2, OpBitwiseXorAssign >
 
struct  BinaryReturn< T1, T2, OpDivideAssign >
 
struct  BinaryReturn< T1, T2, OpEQ >
 
struct  BinaryReturn< T1, T2, OpGE >
 
struct  BinaryReturn< T1, T2, OpGT >
 
struct  BinaryReturn< T1, T2, OpLE >
 
struct  BinaryReturn< T1, T2, OpLeftShift >
 
struct  BinaryReturn< T1, T2, OpLeftShiftAssign >
 
struct  BinaryReturn< T1, T2, OpLT >
 
struct  BinaryReturn< T1, T2, OpModAssign >
 
struct  BinaryReturn< T1, T2, OpMultiplyAssign >
 
struct  BinaryReturn< T1, T2, OpNE >
 
struct  BinaryReturn< T1, T2, OpOr >
 
struct  BinaryReturn< T1, T2, OpRightShift >
 
struct  BinaryReturn< T1, T2, OpRightShiftAssign >
 
struct  BinaryReturn< T1, T2, OpSubtractAssign >
 
class  BlasThreadingEnv
 service class for explicitly managing the threading of BLAS/LAPACK calls from OpenMP parallel region More...
 
class  BranchIO
 
struct  BsplineFunctor
 BsplineFunctor class for the Jastrows REAL is the real type used by offload target, it is the correct type for the mw data pointers and is also used to coerce/implicitly convert the Real type inherited OptimizableFunctorBase into that buffer if offload is off this happens too but is just an implementation quirk. More...
 
struct  BsplineReader
 Each SplineC2X needs a reader derived from BsplineReader. More...
 
class  BsplineSet
 BsplineSet is the base class for SplineC2C, SplineC2R, SplineR2R. More...
 
struct  CheckMatrixResult
 
class  ChiesaCorrection
 
struct  ci_configuration
 
struct  ci_configuration2
 
class  CloneManager
 Manager clones for threaded applications. More...
 
class  CollectablesEstimator
 Handle an ensemble average of Hamiltonian components. More...
 
struct  Combine1
 
struct  Combine1< A, Op, OpCombine >
 
struct  Combine1< A, Op, TreeCombine >
 
struct  Combine2
 
struct  Combine2< A, B, Op, OpCombine >
 
struct  Combine2< A, B, Op, TreeCombine >
 
struct  Combine2< bool, bool, Op, AndCombine >
 
struct  Combine2< bool, bool, Op, OrCombine >
 
struct  Combine2< int, int, Op, NullCombine >
 
struct  Combine2< int, int, Op, SumCombine >
 
struct  Combine3
 
struct  Combine3< A, B, C, Op, OpCombine >
 
struct  Combine3< A, B, C, Op, TreeCombine >
 
struct  CombinedTraceSample
 
class  ComplexExpFitClass
 
class  CompositeSPOSet
 
struct  CompositeSPOSetBuilder
 
struct  const_traits
 
struct  const_traits< double >
 
struct  const_traits< float >
 
struct  const_traits< std::complex< double > >
 
struct  const_traits< std::complex< float > >
 
class  ConstantOrbital
 
class  ConstantSizeMatrix
 Drop in replacement for OhmmsMatrix as a storage object backed by PooledMemory, does not support PETE. More...
 
class  ConstantSPOSet
 Constant SPOSet for testing purposes. More...
 
struct  container
 
struct  container_proxy
 
struct  container_proxy< Array< T, D > >
 
struct  container_proxy< Matrix< T > >
 
struct  container_proxy< PooledData< T > >
 
struct  container_proxy< std::vector< bool > >
 
struct  container_proxy< std::vector< T > >
 
struct  container_proxy< std::vector< TinyVector< T, D > > >
 
struct  container_proxy< Tensor< T, D > >
 
struct  container_proxy< TinyVector< T, D > >
 
struct  container_proxy< Vector< T > >
 
struct  container_proxy< Vector< TinyVector< T, D > > >
 
struct  container_traits
 
struct  container_traits< Array< T, D > >
 
struct  container_traits< boost::multi::array< T, D, Alloc > >
 
struct  container_traits< boost::multi::array_ref< T, D > >
 
struct  container_traits< Matrix< T, ALLOC > >
 
struct  container_traits< std::vector< T, ALLOC > >
 
struct  container_traits< Vector< T, ALLOC > >
 
class  ContextForSteps
 Thread local context for moving walkers. More...
 
struct  ConvertPosUnit
 Dummy template class to be specialized. More...
 
struct  ConvertPosUnit< ParticleAttrib< TinyVector< T, 2 > >, Tensor< T, 2 >, 2 >
 Specialized ConvertPosUnit for ParticleAttrib<T,2>, Tensor<T,2> More...
 
struct  ConvertPosUnit< ParticleAttrib< TinyVector< T, 3 > >, Tensor< T, 3 >, 3 >
 Specialized ConvertPosUnit for ParticleAttrib<T,3>, Tensor<T,3> More...
 
class  CostFunctionCrowdData
 Implements wave-function optimization. More...
 
struct  CoulombF2
 
struct  CoulombFunctor
 CoulombFunctor. More...
 
struct  CoulombPBCAA
 Calculates the AA Coulomb potential using PBCs. More...
 
class  CoulombPBCAB
 Calculates the AA Coulomb potential using PBCs. More...
 
struct  CoulombPotential
 CoulombPotential. More...
 
class  CountingGaussian
 
class  CountingGaussianRegion
 
class  CountingJastrow
 
class  CountingJastrowBuilder
 
struct  CreateLeaf
 
struct  CreateLeaf< Expression< T > >
 
struct  CreateLeaf< Matrix< T, Alloc > >
 
struct  CreateLeaf< ParticleAttrib< T > >
 
struct  CreateLeaf< Vector< T, C > >
 
class  Crowd
 Driver synchronized step context. More...
 
struct  CrystalLattice
 a class that defines a supercell in D-dimensional Euclean space. More...
 
struct  CSEnergyEstimator
 
struct  CSFData
 CSF related dataset. More...
 
class  CSLocalEnergyInput
 
class  CSUpdateBase
 
class  CSVMC
 
Implements the VMC algorithm using umbrella sampling. More...
 
class  CSVMCUpdateAll
 
Implements the VMC algorithm using umbrella sampling. More...
 
class  CSVMCUpdateAllWithDrift
 
class  CSVMCUpdatePbyP
 
Implements the VMC algorithm More...
 
class  CSVMCUpdatePbyPWithDriftFast
 
Implements the VMC algorithm with drift. More...
 
struct  CubicSplineBasisSet
 
class  CubicSplineEvaluator
 Perform One-Dimensional Cubic Spline Interpolation using M-relation. More...
 
struct  CubicSplineSingle
 A numerical functor. More...
 
class  CUDAAllocator
 allocator for CUDA device memory More...
 
class  CUDADeviceManager
 CUDA device manager. More...
 
struct  CUDAHostAllocator
 allocator for CUDA host pinned memory More...
 
struct  CUDALockedPageAllocator
 allocator locks memory pages allocated by ULPHA More...
 
struct  CUDAManagedAllocator
 allocator for CUDA unified memory More...
 
class  cuSolverInverter
 implements matrix inversion via cuSolverDN More...
 
class  CuspCorrection
 Formulas for applying the cusp correction. More...
 
class  CuspCorrectionAtomicBasis
 Handles a set of correction orbitals per atom. More...
 
struct  CuspCorrectionParameters
 Cusp correction parameters. More...
 
class  CustomizedMatrixDet
 
class  CustomizedMatrixDet< 1 >
 
class  CustomizedMatrixDet< 2 >
 
class  CustomizedMatrixDet< 3 >
 
class  CustomizedMatrixDet< 4 >
 
class  CustomizedMatrixDet< 5 >
 
class  CustomTestInput
 
struct  D2U
 
struct  DecrementLeaf
 
struct  default_type
 
class  DelayedUpdate
 implements delayed update on CPU using BLAS More...
 
class  DelayedUpdateBatched
 implements dirac matrix delayed update using OpenMP offload and CUDA. More...
 
class  DelayedUpdateCUDA
 implements delayed update on NVIDIA GPU using cuBLAS and cusolverDN More...
 
class  DelayedUpdateSYCL
 implements delayed update on Intel GPU using SYCL More...
 
class  DelegatingInput
 Generic input section delegating some inputs to other input classes. More...
 
class  DensityEstimator
 
class  DensityMatrices1B
 
struct  DeReference
 
struct  DeReference< Reference< T > >
 
struct  DereferenceLeaf
 
struct  derivEPRPABreakup
 
struct  DerivRPABreakup
 
struct  DerivYukawaBreakup
 
class  DescentEngine
 
class  DescentEngineHandle
 
struct  DetInverterSelector
 
class  DeviceManager
 orchestrate platforms (programming models) and set up the default device on each platform More...
 
struct  DiracComputeBenchmarkParameters
 
class  DiracDeterminant
 
class  DiracDeterminantBase
 
class  DiracDeterminantBatched
 
class  DiracDeterminantWithBackflow
 class to handle determinants with backflow More...
 
class  DiracMatrix
 helper class to compute matrix inversion and the log value of determinant More...
 
class  DiracMatrixComputeCUDA
 class defining a compute and memory resource to compute matrix inversion and the log determinants of a batch of DiracMatrixes. More...
 
class  DiracMatrixComputeOMPTarget
 class to compute matrix inversion and the log value of determinant of a batch of DiracMatrixes. More...
 
class  DistanceTable
 Abstract class to manage operations on pair data between two ParticleSets. More...
 
class  DistanceTableAA
 AA type of DistanceTable containing storage. More...
 
class  DistanceTableAB
 AB type of DistanceTable containing storage. More...
 
class  DMC
 DMC driver using OpenMP paragra. More...
 
class  DMCBatched
 
Implements a DMC using particle-by-particle threaded and batched moves. More...
 
class  DMCDriverInput
 Input representation for DMC driver class runtime parameters. More...
 
class  DMCFactory
 
class  DMCFactoryNew
 
class  DMCRefEnergy
 Handle updating Eref used for calculating the trial energy. More...
 
class  DMCUpdateAllWithKill
 
class  DMCUpdateAllWithRejection
 
class  DMCUpdatePbyPL2
 
class  DMCUpdatePbyPWithRejectionFast
 
struct  double_hyperslab_proxy
 class to use hyperslabs in both file and memory spaces More...
 
struct  double_tag
 
class  DriftModifierBase
 this class implements drift modification More...
 
class  DriftModifierUNR
 
struct  DriverWalkerResourceCollection
 DriverWalker multi walker resource collections It currently supports VMC and DMC only. More...
 
struct  DTD_BConds
 
struct  DTD_BConds< T, 2, PPPO >
 specialization for a periodic 2D orthorombic cell More...
 
struct  DTD_BConds< T, 2, PPPS >
 specialization for a periodic 2D general cell with wigner-seitz==simulation cell More...
 
struct  DTD_BConds< T, 2, SUPERCELL_BULK >
 specialization for a periodic 2D cell More...
 
struct  DTD_BConds< T, 2, SUPERCELL_WIRE >
 specialization for a wire in 2D More...
 
struct  DTD_BConds< T, 3, PPNG >
 specialization for a slab, general cell More...
 
struct  DTD_BConds< T, 3, PPNG+SOA_OFFSET >
 specialization for a slab, general cell More...
 
struct  DTD_BConds< T, 3, PPNO >
 specialization for a slab, orthorombic cell More...
 
struct  DTD_BConds< T, 3, PPNO+SOA_OFFSET >
 specialization for a slab, orthorombic cell More...
 
struct  DTD_BConds< T, 3, PPNS >
 
struct  DTD_BConds< T, 3, PPNS+SOA_OFFSET >
 specialization for a slab, general cell More...
 
struct  DTD_BConds< T, 3, PPNX >
 specialization for a slab, general cell More...
 
struct  DTD_BConds< T, 3, PPNX+SOA_OFFSET >
 specialization for a slab, general cell More...
 
struct  DTD_BConds< T, 3, PPPG >
 specialization for a periodic 3D general cell More...
 
struct  DTD_BConds< T, 3, PPPG+SOA_OFFSET >
 specialization for a periodic 3D general cell More...
 
struct  DTD_BConds< T, 3, PPPO >
 specialization for a periodic 3D, orthorombic cell More...
 
struct  DTD_BConds< T, 3, PPPO+SOA_OFFSET >
 specialization for a periodic 3D, orthorombic cell More...
 
struct  DTD_BConds< T, 3, PPPS >
 specialization for a periodic 3D general cell with wigner-seitz==simulation cell More...
 
struct  DTD_BConds< T, 3, PPPS+SOA_OFFSET >
 specialization for a periodic 3D general cell with wigner-seitz==simulation cell More...
 
struct  DTD_BConds< T, 3, PPPX >
 specialization for a periodic 3D general cell More...
 
struct  DTD_BConds< T, 3, PPPX+SOA_OFFSET >
 specialization for a periodic 3D general cell More...
 
struct  DTD_BConds< T, 3, SUPERCELL_OPEN+SOA_OFFSET >
 specialization for an open 3D More...
 
struct  DTD_BConds< T, 3, SUPERCELL_WIRE >
 specialization for a wire More...
 
struct  DTD_BConds< T, 3, SUPERCELL_WIRE+SOA_OFFSET >
 specialization for a wire More...
 
struct  DualAllocator
 Generalizes the DualMemorySpace allocator This provides a limited alternative to OMPallocator for testing/benchmarking without dependence of OMPTarget/ offload. More...
 
class  DummyDiracDetWithMW
 
class  DummyDiracDetWithoutMW
 
struct  DummyGrid
 dummy class for templated classes More...
 
struct  DummyLRHandler
 LRHandler without breakup. More...
 
class  DummyResource
 For the sake of generic code sometimes an dummy resource is needed to pass API. More...
 
class  DummySPOSetWithMW
 
class  DummySPOSetWithoutMW
 
class  DynamicCoordinates
 quantum variables of all the particles More...
 
struct  ECPComponentBuilder
 
struct  ECPotentialBuilder
 
class  eeI_JastrowBuilder
 
class  Eigensolver
 
class  EinsplineSetBuilder
 EinsplineSet builder. More...
 
class  EinsplineSpinorSetBuilder
 
class  EnergyDensityEstimator
 
class  EngineHandle
 
struct  EPRPABreakup
 
struct  EslerCoulomb3D
 
struct  EslerCoulomb3D_ForSRCOUL
 
class  EstimatorManagerBase
 Class to manage a set of ScalarEstimators. More...
 
class  EstimatorManagerCrowd
 Thread local estimator container/accumulator. More...
 
class  EstimatorManagerInput
 Input type for EstimatorManagerNew Parses Estimators level of input and and delegates child estimator nodes to appropriate estimator input class Will later provide access to estimator input instances for estimator construction. More...
 
class  EstimatorManagerNew
 Class to manage a set of ScalarEstimators As a manager, this class handles the aggregation of data from crowds, MPI ranks and I/O logics. More...
 
struct  EvalLeaf1
 
struct  EvalLeaf2
 
struct  EvalLeaf3
 
struct  EvalLeaf4
 
struct  EvalLeaf5
 
struct  EvalLeaf6
 
struct  EvalLeaf7
 
class  EwaldHandler2D
 
class  EwaldHandler3D
 
class  EwaldHandlerQuasi2D
 
class  ExampleHeBuilder
 
class  ExampleHeComponent
 
class  ExpFitClass
 
class  Expression
 
class  FailCustomTestInput
 
class  FakeChronoClock
 
class  FakeEstimator
 
struct  FakeFunctor
 
class  FakeOperatorEstimator
 
class  FakeOptimizableObject
 
class  FakeRandom
 
class  FakeSPO
 
class  FakeUpdate
 
struct  FillData
 
class  FiniteDifference
 
class  FiniteDiffErrData
 Information for output of relative error in wavefunction derivatives vs. More...
 
struct  float_tag
 
struct  FnArcCos
 
struct  FnArcSin
 
struct  FnArcTan
 
struct  FnArcTan2
 
struct  FnCeil
 
struct  FnCos
 
struct  FnExp
 
struct  FnFabs
 
struct  FnFloor
 
struct  FnFmod
 
struct  FnHypCos
 
struct  FnHypSin
 
struct  FnHypTan
 
struct  FnLdexp
 
struct  FnLog
 
struct  FnLog10
 
struct  FnPow
 
struct  FnSin
 
struct  FnSqrt
 
struct  FnTan
 
struct  FnWhere
 
class  ForceBase
 
struct  ForceCeperley
 
struct  ForceChiesaPBCAA
 
struct  ForEach
 
struct  ForEach< BinaryNode< Op, A, B >, FTag, CTag >
 
struct  ForEach< Expression< T >, FTag, CTag >
 
struct  ForEach< Reference< T >, FTag, CTag >
 
struct  ForEach< TrinaryNode< Op, A, B, C >, FTag, CTag >
 
struct  ForEach< UnaryNode< Op, A >, FTag, CTag >
 
class  ForwardWalking
 
class  FreeOrbital
 
class  FreeOrbitalBuilder
 
struct  GaussianCombo
 
struct  GaussianTimesRN
 
class  GradientTest
 
class  GradientTestInput
 
class  GridExternalPotential
 This class allows one to read in an arbitrary external potential. More...
 
struct  Gvectors
 
struct  h5_space_type
 default struct to define a h5 dataspace, any intrinsic type T More...
 
struct  h5_space_type< std::array< T, D >, RANK >
 specialization of h5_space_type for std::array<T,D> for any intrinsic type T More...
 
struct  h5_space_type< std::complex< T >, RANK >
 specialization of h5_space_type for std::complex<T> More...
 
struct  h5_space_type< Tensor< T, D >, RANK >
 specialization of h5_space_type for Tensor<T,D> for any intrinsic type T More...
 
struct  h5_space_type< TinyVector< T, D >, RANK >
 specialization of h5_space_type for TinyVector<T,D> for any intrinsic type T More...
 
struct  h5data_proxy
 generic h5data_proxy<T> for scalar basic datatypes defined in hdf_dataspace.h Note if the dataset to be written has const specifier, T should not carry const. More...
 
struct  h5data_proxy< accumulator_set< T > >
 
struct  h5data_proxy< Array< T, D > >
 
struct  h5data_proxy< bool >
 specialization for bool, convert to int More...
 
struct  h5data_proxy< boost::multi::array< T, 1, Alloc > >
 specialization for vector<T> More...
 
struct  h5data_proxy< boost::multi::array< T, 2, Alloc > >
 
struct  h5data_proxy< boost::multi::array_ref< T, 1, Ptr > >
 
struct  h5data_proxy< boost::multi::array_ref< T, 2, Ptr > >
 
struct  h5data_proxy< double_hyperslab_proxy< CT, MAXDIM > >
 
struct  h5data_proxy< HDFVersion >
 specialize h5data_proxy for HDFVersion More...
 
struct  h5data_proxy< hyperslab_proxy< CT, RANK > >
 
struct  h5data_proxy< Matrix< T > >
 
struct  h5data_proxy< std::bitset< N > >
 specialization for std::bitset<N> More...
 
struct  h5data_proxy< std::ostringstream >
 
struct  h5data_proxy< std::string >
 Specialization for std::string. More...
 
struct  h5data_proxy< std::vector< bool > >
 specialization for std::vector<bool> More...
 
struct  h5data_proxy< std::vector< std::string > >
 Specialization for vector of strings. More...
 
struct  h5data_proxy< std::vector< T > >
 specialization for std::vector<T> More...
 
struct  h5data_proxy< Vector< T > >
 specialization for Vector<T> More...
 
struct  H5OrbSet
 construct a name for spline SPO set More...
 
class  HamiltonianFactory
 Factory class to build a many-body wavefunction. More...
 
class  HamiltonianPool
 Manage a collection of QMCHamiltonian objects. More...
 
class  HamiltonianRef
 
struct  HarmonicExternalPotential
 
class  hdf_archive
 class to handle hdf file More...
 
class  hdf_error_suppression
 class suppressing warnings from the HDF5 library More...
 
class  hdf_path
 
struct  HDFVersion
 
struct  HDFWalkerInput_0_4
 
class  HDFWalkerInputManager
 
class  HDFWalkerOutput
 Writes a set of walker configurations to an HDF5 file. More...
 
class  Hdispatcher
 Wrappers for dispatching to QMCHamiltonian single walker APIs or mw_ APIs. More...
 
struct  HEGGrid
 
class  HybridEngine
 
class  HybridRepCenterOrbitals
 
class  HybridRepCplx
 hybrid representation orbitals combining B-spline orbitals on a grid and atomic centered orbitals. More...
 
class  HybridRepReal
 hybrid representation orbitals combining B-spline orbitals on a grid and atomic centered orbitals. More...
 
class  HybridRepSetReader
 General HybridRepSetReader to handle any unitcell. More...
 
struct  hyperslab_proxy
 class to use file space hyperslab with a serialized container More...
 
struct  IncrementLeaf
 
class  InitMolecularSystem
 
class  Input
 
class  InputSection
 Input section provides basic parsing and a uniform method of access to the raw parsed input. More...
 
struct  Int3less
 
struct  Int4less
 
struct  IsComplex_t
 
struct  IsComplex_t< std::complex< T > >
 
class  J1OrbitalSoA
 Specialization for one-body Jastrow function using multiple functors. More...
 
struct  J1OrbitalSoAMultiWalkerMem
 
struct  J1Spin
 Specialization for one-body Jastrow function using multiple functors. More...
 
class  J2KECorrection
 
class  JastrowBuilder
 Jastrow Jastrow Builder with constraints. More...
 
class  JastrowTypeHelper
 
class  JastrowTypeHelper< BsplineFunctor< RadialJastrowBuilder::RealType >, RadialJastrowBuilder::detail::OMPTARGET >
 
class  JeeIOrbitalSoA
 Specialization for three-body Jastrow function using multiple functors. More...
 
class  KContainer
 Container for k-points. More...
 
class  kSpaceCoef
 
class  kSpaceJastrow
 
class  kSpaceJastrowBuilder
 
struct  L2Potential
 Evaluate the L2 potentials around each ion. More...
 
struct  L2RadialPotential
 
struct  LatticeAnalyzer
 generic class to analyze a Lattice More...
 
struct  LatticeAnalyzer< T, 1 >
 specialization for 1D lattice More...
 
struct  LatticeAnalyzer< T, 2 >
 specialization for 2D lattice More...
 
struct  LatticeAnalyzer< T, 3 >
 specialization for 3D lattice More...
 
class  LatticeDeviationEstimator
 lattice deviation estimator More...
 
class  LatticeGaussianProduct
 A composite Orbital. More...
 
class  LatticeGaussianProductBuilder
 LatticeGaussianProduct LatticeGaussianProduct Builder with constraints. More...
 
class  LatticeParser
 
class  LatticeXMLWriter
 
class  LCAOrbitalBuilder
 SPOSetBuilder using new LCAOrbitalSet and Soa versions. More...
 
struct  LCAOrbitalSet
 class to handle linear combinations of basis orbitals used to evaluate the Dirac determinants. More...
 
class  LCAOrbitalSetWithCorrection
 class to add cusp correction to LCAOrbitalSet. More...
 
class  LCAOSpinorBuilder
 
struct  LeafFunctor
 
struct  LeafFunctor< ForwardIterator, DereferenceLeaf >
 
struct  LeafFunctor< Matrix< T, Alloc >, EvalLeaf2 >
 
struct  LeafFunctor< Matrix< T, Alloc >, SizeLeaf2 >
 
struct  LeafFunctor< ParticleAttrib< T >, EvalLeaf1 >
 
struct  LeafFunctor< ParticleAttrib< T >, SizeLeafPA >
 
struct  LeafFunctor< Scalar< T >, DecrementLeaf >
 
struct  LeafFunctor< Scalar< T >, DereferenceLeaf >
 
struct  LeafFunctor< Scalar< T >, EvalLeaf1 >
 
struct  LeafFunctor< Scalar< T >, EvalLeaf2 >
 
struct  LeafFunctor< Scalar< T >, EvalLeaf3 >
 
struct  LeafFunctor< Scalar< T >, EvalLeaf4 >
 
struct  LeafFunctor< Scalar< T >, EvalLeaf5 >
 
struct  LeafFunctor< Scalar< T >, EvalLeaf6 >
 
struct  LeafFunctor< Scalar< T >, EvalLeaf7 >
 
struct  LeafFunctor< Scalar< T >, IncrementLeaf >
 
struct  LeafFunctor< Scalar< T >, SizeLeaf >
 
struct  LeafFunctor< Scalar< T >, SizeLeaf2 >
 
struct  LeafFunctor< Scalar< T >, SizeLeafPA >
 
struct  LeafFunctor< T, DecrementLeaf >
 
struct  LeafFunctor< T, IncrementLeaf >
 
struct  LeafFunctor< Vector< T, C >, EvalLeaf1 >
 
struct  LeafFunctor< Vector< T, C >, SizeLeaf >
 
struct  LinearGrid
 One-Dimensional linear-grid. More...
 
class  LinearMethod
 
class  LinearOrbital
 
struct  ListenerOption
 Convenience container for common optional element to mw_eval.._impl. More...
 
class  ListenerVector
 An object of this type is a listener expecting a callback to the report function with a vector of values, the convention being 1 per particle, called once per walker per component. More...
 
class  LMYEngineHandle
 
struct  LocalECPotential
 Evaluate the local potentials (either pseudo or full core) around each ion. More...
 
class  LocalEnergyEstimator
 Class to accumulate the local energy and components. More...
 
class  LocalEnergyInput
 
struct  LocalEnergyOnlyEstimator
 Estimator for local energy only. More...
 
struct  LogGrid
 One-Dimensional logarithmic-grid. More...
 
struct  LogGridLight
 
struct  LogGridZero
 One-Dimensional logarithmic-grid starting at the origin (Used in Siesta). More...
 
struct  LogToValue
 evaluate psi based on log(psi) More...
 
struct  LogToValue< std::complex< T > >
 
struct  LoneElectron
 
class  LoopTimer
 
class  LPQHIBasis
 A derivative of LRBasis class to provide the functionality of the LPQHI basis. More...
 
class  LPQHISRCoulombBasis
 A derivative of LRBasis class to provide the functionality of the LPQHI basis. More...
 
struct  LRBasis
 Base-class for long-range breakups. More...
 
struct  LRBreakup
 
class  LRBreakupParameters
 
class  LRBreakupParameters< T, 3 >
 
struct  LRCoulombSingleton
 
struct  LRHandlerBase
 base class for LRHandlerTemp<FUNC,BASIS> and DummyLRHanlder<typename Func> More...
 
class  LRHandlerSRCoulomb
 
class  LRHandlerTemp
 
struct  LRRPABFeeHandlerTemp
 
struct  LRRPAHandlerTemp
 
struct  magLess
 
class  MagnetizationDensity
 Magnetization density estimator for non-collinear spin calculations. More...
 
class  MagnetizationDensityInput
 
struct  MakeReturn
 
struct  Mallocator
 
struct  maptest
 
class  Matrix
 
struct  MCCoords
 
struct  MCCoords< CoordsType::POS >
 
struct  MCCoords< CoordsType::POS_SPIN >
 
struct  MCDataType
 Monte Carlo Data of an ensemble. More...
 
class  MCPopulation
 
struct  MCSample
 store minimum Walker data More...
 
class  MCWalkerConfiguration
 A set of walkers that are to be advanced by Metropolis Monte Carlo. More...
 
class  MemoryResource
 
class  MinimalHamiltonianPool
 
class  MinimalParticlePool
 This should be the minimal ParticleSetPool for integration tests. More...
 
class  MinimalWaveFunctionPool
 
class  MinTest
 
class  MomentumDistribution
 Class that collects momentum distribution of electrons. More...
 
class  MomentumDistributionInput
 Native representation for Momentum Distribution Estimators inputs. More...
 
class  MomentumEstimator
 
class  MPC
 Calculates the Model Periodic Coulomb potential using PBCs. More...
 
class  MPIExceptionWrapper
 
class  MPIObjectBase
 Base class for any object which needs to know about a MPI communicator. More...
 
class  MultiDiracDeterminant
 
struct  MultiFunctorAdapter
 generic functor that computes a set of 1D functors More...
 
class  MultiQuinticSpline1D
 multivalue implementation for OneDimQuintic Real valued only calling any eval method with r >= r_max will throw an exception More...
 
class  MultiSlaterDetTableMethod
 An AntiSymmetric WaveFunctionComponent composed of a linear combination of SlaterDeterminants. More...
 
class  MultiWalkerDispatchers
 
class  MultiWalkerTalker
 
class  NaNguard
 
class  NativePrint
 This wrapper is to allow us to leave the user facing operator<< for classes alone. More...
 
class  NeighborLists
 
class  NEReferencePoints
 This class creates, contains, and writes both user and machine readable referencepoints. More...
 
class  NESpaceGrid
 
struct  NLPPJob
 meta data for NLPP calculation of a pair of ion and electron This is not just meta data. More...
 
struct  NonLocalData
 
class  NonLocalECPComponent
 Contains a set of radial grid potentials around a center. More...
 
class  NonLocalECPotential
 Evaluate the semi local potentials. More...
 
struct  NonLocalTOperator
 
struct  NullCombine
 
class  NullEngineHandle
 
struct  NumericalGrid
 One-Dimensional numerical grid with arbitrary grid spacings. More...
 
class  ObservableHelper
 define ObservableHelper More...
 
struct  OffloadSwitches
 
struct  OMPallocator
 OMPallocator is an allocator with fused device and dualspace allocator functionality. More...
 
class  OMPDeviceManager
 OpenMP device manager. More...
 
class  OMPThreadCountProtectorLA
 For linear algebra only. More...
 
class  OneBodyDensityMatrices
 Per crowd Estimator for OneBodyDensityMatrices aka 1RDM DensityMatrices1B. More...
 
class  OneBodyDensityMatricesInput
 Native representation for DensityMatrices1B Estimator's inputs. More...
 
class  OneDimConstFunctor
 One-dimensional grid functor that returns a constant. More...
 
class  OneDimCubicSpline
 
class  OneDimCubicSplineLinearGrid
 combined OneDimCubicSpline and LinearGrid OneDimCubicSpline contains OneDimGridBase pointer and calls its virtual function members. More...
 
struct  OneDimGridBase
 An abstract base class to implement a One-Dimensional grid. More...
 
struct  OneDimGridFactory
 Factory class using Singleton pattern. More...
 
struct  OneDimGridFunctor
 Implement One-Dimensional function on a radial grid. More...
 
class  OneDimLinearSpline
 Perform One-Dimensional linear spline Interpolation. More...
 
struct  OneDimNumGridFunctor
 adaptor class to handle a temporary OneDimCubicSpline on a numerical grid. More...
 
class  OneDimQuinticSpline
 
class  OneMolecularOrbital
 
class  OneSplineOrbData
 
struct  OnTypesEqual
 
struct  OpAdd
 
struct  OpAddAssign
 
struct  OpAnd
 
struct  OpAssign
 
struct  OpBitwiseAnd
 
struct  OpBitwiseAndAssign
 
struct  OpBitwiseNot
 
struct  OpBitwiseOr
 
struct  OpBitwiseOrAssign
 
struct  OpBitwiseXor
 
struct  OpBitwiseXorAssign
 
struct  OpCast
 
struct  OpCombine
 
struct  OpDivide
 
struct  OpDivideAssign
 
struct  OpEQ
 
class  OperatorBase
 An abstract class for Local Energy operators. More...
 
class  OperatorEstBase
 An abstract class for gridded estimators. More...
 
struct  OpGE
 
struct  OpGT
 
struct  OpIdentity
 
struct  OpLE
 
struct  OpLeftShift
 
struct  OpLeftShiftAssign
 
struct  OpLT
 
struct  OpMod
 
struct  OpModAssign
 
struct  OpMultiply
 
struct  OpMultiplyAssign
 
struct  OpNE
 
struct  OpNot
 
struct  OpOr
 
struct  OpRightShift
 
struct  OpRightShiftAssign
 
struct  OpSubtract
 
struct  OpSubtractAssign
 
struct  OptimizableFunctorBase
 Base class for any functor with optimizable parameters. More...
 
class  OptimizableObject
 
struct  OpUnaryMinus
 
struct  OpUnaryPlus
 
class  OrbitalImages
 "Estimator" to produce files for orbital plotting. More...
 
struct  OrbitalSetTraits
 trait class to handel a set of Orbitals More...
 
struct  OrCombine
 
struct  OTAssign
 
struct  OTAssign< AntiSymTensor< T1, 1 >, AntiSymTensor< T2, 1 >, OP >
 
struct  OTAssign< AntiSymTensor< T1, 1 >, T2, OP >
 
struct  OTAssign< AntiSymTensor< T1, 2 >, AntiSymTensor< T2, 2 >, OP >
 
struct  OTAssign< AntiSymTensor< T1, 2 >, T2, OP >
 
struct  OTAssign< AntiSymTensor< T1, 3 >, AntiSymTensor< T2, 3 >, OP >
 
struct  OTAssign< AntiSymTensor< T1, 3 >, T2, OP >
 
struct  OTAssign< AntiSymTensor< T1, D >, AntiSymTensor< T2, D >, OP >
 
struct  OTAssign< AntiSymTensor< T1, D >, T2, OP >
 
struct  OTAssign< SymTensor< T1, 1 >, SymTensor< T2, 1 >, OP >
 
struct  OTAssign< SymTensor< T1, 1 >, T2, OP >
 
struct  OTAssign< SymTensor< T1, 2 >, SymTensor< T2, 2 >, OP >
 
struct  OTAssign< SymTensor< T1, 2 >, T2, OP >
 
struct  OTAssign< SymTensor< T1, 3 >, SymTensor< T2, 3 >, OP >
 
struct  OTAssign< SymTensor< T1, 3 >, T2, OP >
 
struct  OTAssign< SymTensor< T1, D >, SymTensor< T2, D >, OP >
 
struct  OTAssign< SymTensor< T1, D >, T2, OP >
 
struct  OTAssign< Tensor< T1, 1 >, T2, OP >
 
struct  OTAssign< Tensor< T1, 1 >, Tensor< T2, 1 >, OP >
 
struct  OTAssign< Tensor< T1, 2 >, T2, OP >
 
struct  OTAssign< Tensor< T1, 2 >, Tensor< T2, 2 >, OP >
 
struct  OTAssign< Tensor< T1, 3 >, T2, OP >
 
struct  OTAssign< Tensor< T1, 3 >, Tensor< T2, 3 >, OP >
 
struct  OTAssign< Tensor< T1, D >, T2, OP >
 
struct  OTAssign< Tensor< T1, D >, Tensor< T2, D >, OP >
 
struct  OTAssign< TinyMatrix< T1, 1, 1 >, T2, OP >
 
struct  OTAssign< TinyMatrix< T1, 1, 1 >, TinyMatrix< T2, 1, 1 >, OP >
 
struct  OTAssign< TinyMatrix< T1, 1, 2 >, T2, OP >
 
struct  OTAssign< TinyMatrix< T1, 1, 2 >, TinyMatrix< T2, 1, 2 >, OP >
 
struct  OTAssign< TinyMatrix< T1, 1, 3 >, T2, OP >
 
struct  OTAssign< TinyMatrix< T1, 1, 3 >, TinyMatrix< T2, 1, 3 >, OP >
 
struct  OTAssign< TinyMatrix< T1, 2, 1 >, T2, OP >
 
struct  OTAssign< TinyMatrix< T1, 2, 1 >, TinyMatrix< T2, 2, 1 >, OP >
 
struct  OTAssign< TinyMatrix< T1, 2, 2 >, T2, OP >
 
struct  OTAssign< TinyMatrix< T1, 2, 2 >, TinyMatrix< T2, 2, 2 >, OP >
 
struct  OTAssign< TinyMatrix< T1, 3, 1 >, T2, OP >
 
struct  OTAssign< TinyMatrix< T1, 3, 1 >, TinyMatrix< T2, 3, 1 >, OP >
 
struct  OTAssign< TinyMatrix< T1, 3, 3 >, T2, OP >
 
struct  OTAssign< TinyMatrix< T1, 3, 3 >, TinyMatrix< T2, 3, 3 >, OP >
 
struct  OTAssign< TinyMatrix< T1, 4, 4 >, T2, OP >
 
struct  OTAssign< TinyMatrix< T1, 4, 4 >, TinyMatrix< T2, 4, 4 >, OP >
 
struct  OTAssign< TinyMatrix< T1, D1, D2 >, T2, OP >
 
struct  OTAssign< TinyMatrix< T1, D1, D2 >, TinyMatrix< T2, D1, D2 >, OP >
 
struct  OTAssign< TinyVector< std::complex< T1 >, 3 >, TinyVector< std::complex< T2 >, 3 >, OP >
 
struct  OTAssign< TinyVector< T1, 1 >, T2, OP >
 
struct  OTAssign< TinyVector< T1, 1 >, TinyVector< T2, 1 >, OP >
 
struct  OTAssign< TinyVector< T1, 2 >, T2, OP >
 
struct  OTAssign< TinyVector< T1, 2 >, TinyVector< T2, 2 >, OP >
 
struct  OTAssign< TinyVector< T1, 3 >, T2, OP >
 
struct  OTAssign< TinyVector< T1, 3 >, TinyVector< std::complex< T2 >, 3 >, OP >
 
struct  OTAssign< TinyVector< T1, 3 >, TinyVector< T2, 3 >, OP >
 
struct  OTAssign< TinyVector< T1, D >, T2, OP >
 
struct  OTAssign< TinyVector< T1, D >, TinyVector< T2, D >, OP >
 
struct  OTBinary
 
struct  OTBinary< AntiSymTensor< T1, 1 >, AntiSymTensor< T2, 1 >, OP >
 
struct  OTBinary< AntiSymTensor< T1, 1 >, T2, OP >
 
struct  OTBinary< AntiSymTensor< T1, 2 >, AntiSymTensor< T2, 2 >, OP >
 
struct  OTBinary< AntiSymTensor< T1, 2 >, T2, OP >
 
struct  OTBinary< AntiSymTensor< T1, 3 >, AntiSymTensor< T2, 3 >, OP >
 
struct  OTBinary< AntiSymTensor< T1, 3 >, T2, OP >
 
struct  OTBinary< AntiSymTensor< T1, D >, AntiSymTensor< T2, D >, OP >
 
struct  OTBinary< AntiSymTensor< T1, D >, T2, OP >
 
struct  OTBinary< SymTensor< T1, 1 >, SymTensor< T2, 1 >, OP >
 
struct  OTBinary< SymTensor< T1, 1 >, T2, OP >
 
struct  OTBinary< SymTensor< T1, 2 >, SymTensor< T2, 2 >, OP >
 
struct  OTBinary< SymTensor< T1, 2 >, T2, OP >
 
struct  OTBinary< SymTensor< T1, 3 >, SymTensor< T2, 3 >, OP >
 
struct  OTBinary< SymTensor< T1, 3 >, T2, OP >
 
struct  OTBinary< SymTensor< T1, D >, SymTensor< T2, D >, OP >
 
struct  OTBinary< SymTensor< T1, D >, T2, OP >
 
struct  OTBinary< SymTensor< T1, D >, Tensor< T2, D >, OP >
 
struct  OTBinary< T1, AntiSymTensor< T2, 1 >, OP >
 
struct  OTBinary< T1, AntiSymTensor< T2, 2 >, OP >
 
struct  OTBinary< T1, AntiSymTensor< T2, 3 >, OP >
 
struct  OTBinary< T1, AntiSymTensor< T2, D >, OP >
 
struct  OTBinary< T1, SymTensor< T2, 1 >, OP >
 
struct  OTBinary< T1, SymTensor< T2, 2 >, OP >
 
struct  OTBinary< T1, SymTensor< T2, 3 >, OP >
 
struct  OTBinary< T1, SymTensor< T2, D >, OP >
 
struct  OTBinary< T1, Tensor< T2, 1 >, OP >
 
struct  OTBinary< T1, Tensor< T2, 2 >, OP >
 
struct  OTBinary< T1, Tensor< T2, 3 >, OP >
 
struct  OTBinary< T1, Tensor< T2, D >, OP >
 
struct  OTBinary< T1, TinyMatrix< T2, 1, 1 >, OP >
 
struct  OTBinary< T1, TinyMatrix< T2, 1, 2 >, OP >
 
struct  OTBinary< T1, TinyMatrix< T2, 1, 3 >, OP >
 
struct  OTBinary< T1, TinyMatrix< T2, 2, 2 >, OP >
 
struct  OTBinary< T1, TinyMatrix< T2, 3, 3 >, OP >
 
struct  OTBinary< T1, TinyMatrix< T2, 4, 4 >, OP >
 
struct  OTBinary< T1, TinyMatrix< T2, D1, D2 >, OP >
 
struct  OTBinary< T1, TinyVector< T2, 1 >, OP >
 
struct  OTBinary< T1, TinyVector< T2, 2 >, OP >
 
struct  OTBinary< T1, TinyVector< T2, 3 >, OP >
 
struct  OTBinary< T1, TinyVector< T2, D >, OP >
 
struct  OTBinary< Tensor< T1, 1 >, T2, OP >
 
struct  OTBinary< Tensor< T1, 1 >, Tensor< T2, 1 >, OP >
 
struct  OTBinary< Tensor< T1, 2 >, T2, OP >
 
struct  OTBinary< Tensor< T1, 2 >, Tensor< T2, 2 >, OP >
 
struct  OTBinary< Tensor< T1, 3 >, T2, OP >
 
struct  OTBinary< Tensor< T1, 3 >, Tensor< T2, 3 >, OP >
 
struct  OTBinary< Tensor< T1, D >, SymTensor< T2, D >, OP >
 
struct  OTBinary< Tensor< T1, D >, T2, OP >
 
struct  OTBinary< Tensor< T1, D >, Tensor< T2, D >, OP >
 
struct  OTBinary< TinyMatrix< T1, 1, 1 >, T2, OP >
 
struct  OTBinary< TinyMatrix< T1, 1, 1 >, TinyMatrix< T2, 1, 1 >, OP >
 
struct  OTBinary< TinyMatrix< T1, 1, 2 >, T2, OP >
 
struct  OTBinary< TinyMatrix< T1, 1, 2 >, TinyMatrix< T2, 1, 2 >, OP >
 
struct  OTBinary< TinyMatrix< T1, 1, 3 >, T2, OP >
 
struct  OTBinary< TinyMatrix< T1, 1, 3 >, TinyMatrix< T2, 1, 3 >, OP >
 
struct  OTBinary< TinyMatrix< T1, 2, 2 >, T2, OP >
 
struct  OTBinary< TinyMatrix< T1, 2, 2 >, TinyMatrix< T2, 2, 2 >, OP >
 
struct  OTBinary< TinyMatrix< T1, 3, 3 >, T2, OP >
 
struct  OTBinary< TinyMatrix< T1, 3, 3 >, TinyMatrix< T2, 3, 3 >, OP >
 
struct  OTBinary< TinyMatrix< T1, 4, 4 >, T2, OP >
 
struct  OTBinary< TinyMatrix< T1, 4, 4 >, TinyMatrix< T2, 4, 4 >, OP >
 
struct  OTBinary< TinyMatrix< T1, D1, D2 >, T2, OP >
 
struct  OTBinary< TinyMatrix< T1, D1, D2 >, TinyMatrix< T2, D1, D2 >, OP >
 
struct  OTBinary< TinyVector< T1, 1 >, T2, OP >
 
struct  OTBinary< TinyVector< T1, 1 >, TinyVector< T2, 1 >, OP >
 
struct  OTBinary< TinyVector< T1, 2 >, T2, OP >
 
struct  OTBinary< TinyVector< T1, 2 >, TinyVector< T2, 2 >, OP >
 
struct  OTBinary< TinyVector< T1, 3 >, T2, OP >
 
struct  OTBinary< TinyVector< T1, 3 >, TinyVector< T2, 3 >, OP >
 
struct  OTBinary< TinyVector< T1, D >, T2, OP >
 
struct  OTBinary< TinyVector< T1, D >, TinyVector< T2, D >, OP >
 
struct  OTCDot
 
struct  OTCDot< T1, T2, 3 >
 
struct  OTCDot_CC
 
struct  OTCDot_CC< T1, T2, 3 >
 
struct  OTCross
 
struct  OTCross< TinyVector< T1, 3 >, TinyVector< T2, 3 > >
 
struct  OTCross< TinyVector< T1, D >, TinyVector< T2, D > >
 
struct  OTDot
 
struct  OTDot< AntiSymTensor< T1, 1 >, TinyVector< T2, 1 > >
 
struct  OTDot< AntiSymTensor< T1, 2 >, TinyVector< T2, 2 > >
 
struct  OTDot< AntiSymTensor< T1, 3 >, TinyVector< T2, 3 > >
 
struct  OTDot< AntiSymTensor< T1, D >, TinyVector< T2, D > >
 
struct  OTDot< SymTensor< T1, 1 >, SymTensor< T2, 1 > >
 
struct  OTDot< SymTensor< T1, 1 >, Tensor< T2, 1 > >
 
struct  OTDot< SymTensor< T1, 1 >, TinyVector< T2, 1 > >
 
struct  OTDot< SymTensor< T1, 2 >, SymTensor< T2, 2 > >
 
struct  OTDot< SymTensor< T1, 2 >, Tensor< T2, 2 > >
 
struct  OTDot< SymTensor< T1, 2 >, TinyVector< T2, 2 > >
 
struct  OTDot< SymTensor< T1, 3 >, SymTensor< T2, 3 > >
 
struct  OTDot< SymTensor< T1, 3 >, Tensor< T2, 3 > >
 
struct  OTDot< SymTensor< T1, 3 >, TinyVector< T2, 3 > >
 
struct  OTDot< SymTensor< T1, D >, SymTensor< T2, D > >
 
struct  OTDot< SymTensor< T1, D >, Tensor< T2, D > >
 
struct  OTDot< SymTensor< T1, D >, TinyVector< T2, D > >
 
struct  OTDot< Tensor< T1, 1 >, SymTensor< T2, 1 > >
 
struct  OTDot< Tensor< T1, 1 >, Tensor< T2, 1 > >
 
struct  OTDot< Tensor< T1, 1 >, TinyVector< T2, 1 > >
 
struct  OTDot< Tensor< T1, 2 >, SymTensor< T2, 2 > >
 
struct  OTDot< Tensor< T1, 2 >, Tensor< T2, 2 > >
 
struct  OTDot< Tensor< T1, 2 >, TinyVector< T2, 2 > >
 
struct  OTDot< Tensor< T1, 3 >, SymTensor< T2, 3 > >
 
struct  OTDot< Tensor< T1, 3 >, Tensor< T2, 3 > >
 
struct  OTDot< Tensor< T1, 3 >, TinyVector< T2, 3 > >
 
struct  OTDot< Tensor< T1, 4 >, TinyVector< T2, 4 > >
 
struct  OTDot< Tensor< T1, D >, SymTensor< T2, D > >
 
struct  OTDot< Tensor< T1, D >, Tensor< T2, D > >
 
struct  OTDot< Tensor< T1, D >, TinyVector< T2, D > >
 
struct  OTDot< TinyMatrix< T1, 3, 3 >, TinyMatrix< T2, 3, 3 > >
 
struct  OTDot< TinyMatrix< T1, 3, 3 >, TinyVector< T2, 3 > >
 
struct  OTDot< TinyMatrix< T1, 4, 4 >, TinyMatrix< T2, 4, 4 > >
 
struct  OTDot< TinyMatrix< T1, 4, 4 >, TinyVector< T2, 4 > >
 
struct  OTDot< TinyMatrix< T1, D1, D2 >, TinyMatrix< T2, D2, D3 > >
 
struct  OTDot< TinyMatrix< T1, D1, D2 >, TinyVector< T2, D2 > >
 
struct  OTDot< TinyVector< std::complex< T1 >, 3 >, TinyVector< std::complex< T2 >, 3 > >
 specialization for complex-complex TinyVector More...
 
struct  OTDot< TinyVector< std::complex< T1 >, 3 >, TinyVector< T2, 3 > >
 specialization for complex-real TinyVector More...
 
struct  OTDot< TinyVector< T1, 1 >, SymTensor< T2, 1 > >
 
struct  OTDot< TinyVector< T1, 1 >, Tensor< T2, 1 > >
 
struct  OTDot< TinyVector< T1, 1 >, TinyVector< T2, 1 > >
 
struct  OTDot< TinyVector< T1, 2 >, AntiSymTensor< T2, 2 > >
 
struct  OTDot< TinyVector< T1, 2 >, SymTensor< T2, 2 > >
 
struct  OTDot< TinyVector< T1, 2 >, Tensor< T2, 2 > >
 
struct  OTDot< TinyVector< T1, 2 >, TinyVector< T2, 2 > >
 
struct  OTDot< TinyVector< T1, 3 >, AntiSymTensor< T2, 3 > >
 
struct  OTDot< TinyVector< T1, 3 >, SymTensor< T2, 3 > >
 
struct  OTDot< TinyVector< T1, 3 >, Tensor< T2, 3 > >
 
struct  OTDot< TinyVector< T1, 3 >, TinyMatrix< T2, 3, 3 > >
 
struct  OTDot< TinyVector< T1, 3 >, TinyVector< std::complex< T1 >, 3 > >
 specialization for real-complex TinyVector More...
 
struct  OTDot< TinyVector< T1, 3 >, TinyVector< T2, 3 > >
 
struct  OTDot< TinyVector< T1, 4 >, Tensor< T2, 4 > >
 
struct  OTDot< TinyVector< T1, 4 >, TinyMatrix< T2, 4, 4 > >
 
struct  OTDot< TinyVector< T1, 4 >, TinyVector< T2, 4 > >
 
struct  OTDot< TinyVector< T1, D >, AntiSymTensor< T2, D > >
 
struct  OTDot< TinyVector< T1, D >, SymTensor< T2, D > >
 
struct  OTDot< TinyVector< T1, D >, Tensor< T2, D > >
 
struct  OTDot< TinyVector< T1, D >, TinyVector< T2, D > >
 
struct  OTDot< TinyVector< T1, D1 >, TinyMatrix< T2, D1, D2 > >
 
struct  OuterProduct
 
struct  OuterProduct< TinyVector< T1, 2 >, TinyVector< T2, 2 > >
 
struct  OuterProduct< TinyVector< T1, 3 >, TinyVector< T2, 3 > >
 
struct  OuterProduct< TinyVector< T1, D >, TinyVector< T2, D > >
 
class  OutputMatrix
 
struct  Pade2ndOrderFunctor
 Pade function of

\[ u(r) = \frac{a*r+c*r^2}{1+b*r} \]

. More...

 
struct  PadeFunctor
 Implements a Pade Function $u[r]=A*r/(1+B*r)$. More...
 
struct  PadeTwo2ndOrderFunctor
 Pade function of

\[ u(r) = \frac{a*r+b*r^2}{1+c*r+d*r^2} \]

. More...

 
class  PairCorrEstimator
 gofr estimator More...
 
struct  PAOps
 generic PAOps More...
 
struct  PAOps< T, 2, T1 >
 specialization for 2-dimension More...
 
struct  PAOps< T, 3, T1 >
 specialization for three-dimension More...
 
class  ParallelExecutor
 Abstraction for running concurrent tasks in parallel by an executor executor workers can be OpenMP threads, std::thread. More...
 
struct  ParseCase
 
class  ParticleAttrib
 Attaches a unit to a Vector for IO. More...
 
struct  ParticleAttribXmlNode
 
class  ParticleSet
 Specialized paritlce class for atomistic simulations. More...
 
class  ParticleSetPool
 Manage a collection of ParticleSet objects. More...
 
class  PerParticleHamiltonianLogger
 
class  PerParticleHamiltonianLoggerInput
 
class  PlatformSelector
 
struct  PolynomialFunctor3D
 
struct  PooledMemory
 
struct  PowerOfN
 
struct  PowerOfN< N, 0 >
 
class  PrefetchedRange
 helper class for the prefetched range of a vector More...
 
struct  Pressure
 Evaluate the Bare Pressure. More...
 
struct  printTinyVector
 
struct  printTinyVector< TinyVector< T, D > >
 template functor for Vector<TinyVector<T,D> streamn output 0 equivalent values are output as 0. More...
 
struct  ProfileData
 
class  ProjectData
 class ProjectData More...
 
struct  Promote
 
struct  Promote< bool, bool >
 
struct  Promote< bool, char >
 
struct  Promote< bool, double >
 
struct  Promote< bool, float >
 
struct  Promote< bool, int >
 
struct  Promote< bool, long >
 
struct  Promote< bool, short >
 
struct  Promote< char, bool >
 
struct  Promote< char, char >
 
struct  Promote< char, double >
 
struct  Promote< char, float >
 
struct  Promote< char, int >
 
struct  Promote< char, long >
 
struct  Promote< char, short >
 
struct  Promote< double, bool >
 
struct  Promote< double, char >
 
struct  Promote< double, double >
 
struct  Promote< double, float >
 
struct  Promote< double, int >
 
struct  Promote< double, long >
 
struct  Promote< double, short >
 
struct  Promote< float, bool >
 
struct  Promote< float, char >
 
struct  Promote< float, double >
 
struct  Promote< float, float >
 
struct  Promote< float, int >
 
struct  Promote< float, long >
 
struct  Promote< float, short >
 
struct  Promote< int, bool >
 
struct  Promote< int, char >
 
struct  Promote< int, double >
 
struct  Promote< int, float >
 
struct  Promote< int, int >
 
struct  Promote< int, long >
 
struct  Promote< int, short >
 
struct  Promote< long, bool >
 
struct  Promote< long, char >
 
struct  Promote< long, double >
 
struct  Promote< long, float >
 
struct  Promote< long, int >
 
struct  Promote< long, long >
 
struct  Promote< long, short >
 
struct  Promote< short, bool >
 
struct  Promote< short, char >
 
struct  Promote< short, double >
 
struct  Promote< short, float >
 
struct  Promote< short, int >
 
struct  Promote< short, long >
 
struct  Promote< short, short >
 
class  PSdispatcher
 Wrappers for dispatching to ParticleSet single walker APIs or mw_ APIs. More...
 
struct  PSetsAndRefList
 
struct  PtclOnLatticeTraits
 Particle traits to use UniformGridLayout for the ParticleLayout. More...
 
class  PWBasis
 Plane-wave basis set. More...
 
class  PWOrbitalSet
 
class  PWOrbitalSetBuilder
 OrbitalBuilder for Slater determinants in PW basis. More...
 
struct  PWParameterSet
 class to handle various name conventions for hdf5 file More...
 
class  PWRealOrbitalSet
 
struct  qmc_allocator_traits
 template class analogous to std::allocator_traits. More...
 
struct  qmc_allocator_traits< DualAllocator< T, DeviceAllocator, HostAllocator > >
 
struct  qmc_allocator_traits< OMPallocator< T, HostAllocator > >
 Specialization for OMPallocator which is a special DualAllocator with fused device and dualspace allocator functionality. More...
 
struct  qmc_allocator_traits< qmcplusplus::CUDAAllocator< T > >
 
struct  qmc_allocator_traits< qmcplusplus::SYCLAllocator< T > >
 
class  QMCAppBase
 Base class for QMC applications and utilities. More...
 
class  QMCCostFunction
 Implements wave-function optimization. More...
 
class  QMCCostFunctionBase
 Implements wave-function optimization. More...
 
class  QMCCostFunctionBatched
 
class  QMCCostFunctionTest
 
class  QMCDriver
 abstract base class for QMC engines More...
 
class  QMCDriverFactory
 
class  QMCDriverInput
 Input representation for Driver base class runtime parameters. More...
 
class  QMCDriverInterface
 Creates a common base class pointer for QMCDriver and QMCDriverNew to share. More...
 
class  QMCDriverNew
 QMCDriverNew Base class for Unified Drivers. More...
 
class  QMCFiniteSize
 Class to handle FS corrections. More...
 
class  QMCFixedSampleLinearOptimize
 Implements wave-function optimization. More...
 
class  QMCFixedSampleLinearOptimizeBatched
 
class  QMCHamiltonian
 Collection of Local Energy Operators. More...
 
class  QMCMain
 Main application to perform QMC simulations. More...
 
struct  QMCState
 class to definte global variables to keep track a run More...
 
struct  QMCTraits
 traits for QMC variables More...
 
class  QMCTypes
 
class  QMCUpdateBase
 Base class for update methods for each step. More...
 
struct  Quadrature3D
 
class  RadialJastrowBuilder
 JastrowBuilder using an analytic 1d functor Should be able to eventually handle all one and two body jastrows although spline based ones will come later. More...
 
class  RadialOrbitalSetBuilder
 Build a set of radial orbitals at the origin. More...
 
class  RadialOrbitalSetBuilder< SoaAtomicBasisSet< MultiFunctorAdapter< FN >, SH > >
 
class  RandomBase
 
class  RandomNumberControl
 class RandomNumberControl More...
 
class  ReadFileBuffer
 
struct  RealAlias_impl
 
struct  RealAlias_impl< T, IsComplex< T > >
 
struct  RealAlias_impl< T, IsReal< T > >
 
class  RealSpacePositions
 Introduced to handle virtual moves and ratio computations, e.g. More...
 
class  RealSpacePositionsOMPTarget
 Introduced to handle virtual moves and ratio computations, e.g. More...
 
class  RecordArray
 
struct  Reference
 
class  ReferencePoints
 
class  ReferencePointsInput
 
class  RefVectorWithLeader
 
class  ReportEngine
 Final class and should not be derived. More...
 
class  Reptile
 
class  Resource
 
class  ResourceCollection
 
class  ResourceCollectionTeamLock
 handles acquire/release resource by the consumer (RefVectorWithLeader type). More...
 
class  ResourceHandle
 ResourceHandle manages the temporary resource referenced from a collection. More...
 
class  RMC
 
Implements a RMC using threaded execution. More...
 
class  RMCFactory
 
class  RMCLocalEnergyEstimator
 Class to accumulate the local energy and components. More...
 
class  RMCLocalEnergyInput
 
class  RMCUpdateAllWithDrift
 
Implements the RMC algorithm using all electron moves More...
 
class  RMCUpdatePbyPWithDrift
 
Implements the RMC algorithm using all electron moves More...
 
struct  RngReferenceVector
 
struct  RngReferenceVector< double >
 
struct  RngReferenceVector< float >
 
struct  RngReferenceVector< std::complex< double > >
 
struct  RngReferenceVector< std::complex< float > >
 
class  RNGThreadSafe
 
class  rocSolverInverter
 implements matrix inversion via rocSolver More...
 
class  RotatedSPOs
 
struct  RPA0
 Functor which return $frac{Rs}{k^2 (k^2+(1/Rs)^2)}$. More...
 
struct  RPABFeeBreakup
 
struct  RPABreakup
 
class  RPAFunctor
 
class  RPAJastrow
 JastrowBuilder using RPA functor Modification of RPAJastrow. More...
 
class  RunTimeControl
 
class  RunTimeManager
 
struct  RuntimeOptions
 
class  SampleStack
 
struct  scalar_traits
 
struct  scalar_traits< std::complex< T > >
 
struct  ScalarEstimatorBase
 Abstract class for an estimator of a scalar operator. More...
 
struct  ScaledPadeFunctor
 Pade functional of

\[ u(r) = \frac{a*f(r)}{1+b*f(r)} \]

with a scale function f(r) More...

 
class  ScopedProfiler
 
class  ScopeGuard
 
class  SelfHealingOverlap
 Class that collects MSD coefficient values via the Self-Healing overlap. More...
 
class  SelfHealingOverlapInput
 Native representation for Self-Healing Overlap Estimator inputs. More...
 
class  SelfHealingOverlapLegacy
 Class that collects MSD coefficient values via the Self-Healing overlap (legacy driver version) More...
 
class  SFNBranch
 Manages the state of QMC sections and handles population control for DMCs. More...
 
struct  ShortRangeCuspFunctor
 
struct  ShortRangePartAdapter
 
struct  SHOSet
 
struct  SHOSetBuilder
 
struct  SHOState
 
struct  SimpleFixedNodeBranch
 Manages the state of QMC sections and handles population control for DMCs. More...
 
class  SimulationCell
 
class  SizeLeaf
 
class  SizeLeaf2
 
class  SizeLeafPA
 
class  SizeLimitedDataQueue
 collect data with a history limit. More...
 
class  SkAllEstimator
 SkAllEstimator evaluate the structure factor of the target particleset. More...
 
class  SkEstimator
 SkEstimator evaluate the structure factor of the target particleset. More...
 
struct  SKMultiWalkerMem
 multi walker shared memory buffer More...
 
class  SkParserASCII
 Class to handle parsing from ASCII file. More...
 
class  SkParserBase
 Base class for Sk parser. More...
 
class  SkParserHDF5
 Class to handle reading the S(k) directly from stat.h5 file. More...
 
class  SkParserScalarDat
 Class to handle Sk parsing from scalar.dat This reads a processed scalar.dat from energy.pl format. More...
 
class  SkPot
 SkPot evaluate the structure factor of the target particleset. More...
 
struct  SlaterCombo
 
class  SlaterDet
 
class  SlaterDetBuilder
 derived class from WaveFunctionComponentBuilder More...
 
class  SlaterDetWithBackflow
 
struct  SmallMatrixDetCalculator
 Function class calculates multi determinant ratio from matrix elements needs to be the size of your result matrix or larger includes manual expansions for smaller evaluations. More...
 
class  SoaAtomicBasisSet
 
struct  SoaBasisSetBase
 Base for real basis set. More...
 
class  SoaCartesianTensor
 CartesianTensor according to Gamess order. More...
 
class  SoaCuspCorrection
 A localized basis set derived from BasisSetBase<typename COT::ValueType> More...
 
struct  SoaDistanceTableAA
 A derived classe from DistacneTableData, specialized for dense case. More...
 
struct  SoaDistanceTableAAOMPTarget
 A derived classe from DistacneTableData, specialized for dense case. More...
 
struct  SoaDistanceTableAB
 A derived classe from DistacneTableData, specialized for AB using a transposed form. More...
 
class  SoaDistanceTableABOMPTarget
 A derived classe from DistacneTableData, specialized for AB using a transposed form. More...
 
class  SoaLocalizedBasisSet
 A localized basis set derived from SoaBasisSetBase<ORBT> More...
 
class  SoaSphericalTensor
 SoaSphericalTensor that evaluates the Real Spherical Harmonics. More...
 
class  SODMCUpdatePbyPWithRejectionFast
 
class  SOECPComponent
 class SOECPComponent brief Computes the nonlocal spin-orbit interaction $\Delta V_SO(r) |ljm_j><ljm_j|$. More...
 
class  SOECPotential
 
class  SOVMCUpdateAll
 
Implements the Spin VMC algorithm using particle-by-particle move. More...
 
class  SOVMCUpdatePbyP
 
Implements the VMC algorithm using particle-by-particle move, including spin-moves More...
 
class  SpaceGrid
 
class  SpaceGridInput
 
class  SpaceWarpTransformation
 This implements the differential space warp transformation for ZVZB estimators given by Sorella & Capriotti J. More...
 
class  SpeciesKineticEnergy
 SpeciesKineticEnergy evaluate the kinetic energy of each species in the target particle set separately instead of sum over every particle in the set such as BareKinetic <![CDATA][<estimator type="specieskinetic" name="skinetic">]]> By default skinetic_u, skinetic_d, etc. More...
 
class  SpeciesSet
 Custom container for set of attributes for a set of species. More...
 
class  SpinDensity
 
class  SpinDensityInput
 Native representation for Spin Density Estimators inputs. More...
 
class  SpinDensityNew
 Class that collects density per species of particle. More...
 
class  SpinorSet
 Class for Melton & Mitas style Spinors. More...
 
class  SplineC2C
 class to match std::complex<ST> spline with BsplineSet::ValueType (complex) SPOs More...
 
class  SplineC2COMPTarget
 class to match std::complex<ST> spline with BsplineSet::ValueType (complex) SPOs with OpenMP offload More...
 
class  SplineC2R
 class to match std::complex<ST> spline with BsplineSet::ValueType (real) SPOs More...
 
class  SplineC2ROMPTarget
 class to match std::complex<ST> spline with BsplineSet::ValueType (real) SPOs with OpenMP offload More...
 
struct  SplineOMPTargetMultiWalkerMem
 
class  SplineR2R
 class to match ST real spline with BsplineSet::ValueType (real) SPOs More...
 
class  SplineSetReader
 General SplineSetReader to handle any unitcell. More...
 
struct  SplineStoragePrecision
 
struct  SplineStoragePrecision< double >
 
struct  SplineStoragePrecision< float >
 
struct  SPOInfo
 base class to describe a single orbital in an SPOSet More...
 
class  SPOSet
 base class for Single-particle orbital sets More...
 
class  SPOSetBuilder
 base class for the real SPOSet builder More...
 
class  SPOSetBuilderFactory
 
class  SPOSetInfo
 collection of orbital info for SPOSet instance or builder More...
 
struct  SPOSetInfoSimple
 
struct  SPOSetInputInfo
 class to read state range information from sposet input More...
 
class  SPOSetScanner
 a scanner for all the SPO sets. More...
 
class  StackKeyParam
 
union  StackKeyParam.__unnamed__
 
class  StaticStructureFactor
 
class  StdRandom
 
struct  StressPBC
 
class  StructFact
 Calculates the structure-factor for a particle set. More...
 
struct  SumCombine
 
class  SYCLAllocator
 allocator for SYCL device memory T data type ALIGN alignment in bytes More...
 
class  syclDeviceInfo
 
class  SYCLDeviceManager
 SYCL device manager. More...
 
struct  SYCLHostAllocator
 allocator for SYCL host pinned memory T data type ALIGN alignment in bytes More...
 
struct  SYCLSharedAllocator
 allocator for SYCL shared memory T data type ALIGN alignment in bytes More...
 
class  syclSolverInverter
 implements matrix inversion via cuSolverDN More...
 
class  SymmetryBuilder
 Builds the symmetry class. More...
 
struct  SymmetryGroup
 
class  SymTensor
 
class  TakesAMovedInput
 
struct  TaskWrapper
 TaskWrapper code from https://stackoverflow.com/questions/48268322/wrap-stdthread-call-function. More...
 
struct  TauParams
 Object to encapsulate appropriate tau derived parameters for a particular CoordsType specialization. More...
 
struct  TauParams< RT, CoordsType::POS >
 
struct  TauParams< RT, CoordsType::POS_SPIN >
 
class  Tensor
 Tensor<T,D> class for D by D tensor. More...
 
struct  TensorSoaContainer
 
struct  TensorSoaContainer< T, 3 >
 SoA adaptor class for ParticleAttrib<TinyVector<T,3> > More...
 
class  TestAssignAnyEnum
 
class  TestComplexHelper
 
struct  TestFillBufferRngComplex
 
struct  TestFillBufferRngReal
 
struct  TestFillVecRngComplex
 
struct  TestFillVecRngReal
 
struct  TestGetVecRngComplex
 
struct  TestGetVecRngReal
 
class  TestInputSection
 
struct  TestMatrix1
 
class  TestQMCTypes
 
class  TestSmallMatrixDetCalculator
 
struct  Timer
 
struct  TimerIDName_t
 
class  TimerList
 
class  TimerManager
 Manager creates timers and handle reports. More...
 
class  TimerType
 Timer accumulates time and call counts. More...
 
class  TinyMatrix
 
struct  TinyVector
 Fixed-size array. More...
 
struct  TraceBuffer
 
class  TraceManager
 
struct  TraceQuantity
 
struct  TraceRequest
 
struct  TraceSample
 
struct  TraceSamples
 
struct  TransformerBase
 abstract class to defer generation of spline functors More...
 
struct  TreeCombine
 
class  TrialWaveFunction
 Class to represent a many-body trial wave function. More...
 
class  TrinaryNode
 
struct  TrinaryReturn
 
class  TWFdispatcher
 Wrappers for dispatching to TrialWaveFunction single walker APIs or mw_ APIs. More...
 
class  TWFFastDerivWrapper
 TWFFastDerivWrapper is a wrapper class for TrialWavefunction that provides separate and low level access to the Jastrow and SPOSet objects. More...
 
struct  TWFGrads
 
struct  TWFGrads< CoordsType::POS >
 
struct  TWFGrads< CoordsType::POS_SPIN >
 
class  TwoBodyJastrow
 Specialization for two-body Jastrow function using multiple functors. More...
 
struct  TwoBodyJastrowMultiWalkerMem
 
class  UnaryNode
 
struct  UnaryReturn
 
struct  UnaryReturn< T, OpNot >
 
struct  UnaryReturn< T2, OpCast< T1 > >
 
class  uniform_real_distribution_as_boost
 generating real type random numbers [min, max) in a uniform distribution. More...
 
class  UniformCommunicateError
 This a subclass for runtime errors that will occur on all ranks. More...
 
class  UniqueOptObjRefs
 
struct  UpdateEngineSelector
 
struct  UpdateEngineSelector< PlatformKind::OMPTARGET, VT >
 
struct  UserFunctor
 Implements the function f = A*r/(B*r + 1) - A/B. More...
 
struct  ValGradLap
 
struct  ValueAlias_impl
 
struct  ValueAlias_impl< TREAL, TREF, IsComplex< TREF > >
 
struct  ValueAlias_impl< TREAL, TREF, IsReal< TREF > >
 
class  Vector
 
struct  VectorSoaContainer
 SoA adaptor class for Vector<TinyVector<T,D> > More...
 
class  VirtualParticleSet
 A ParticleSet that handles virtual moves of a selected particle of a given physical ParticleSet Virtual moves are defined as moves being proposed but will never be accepted. More...
 
class  VMC
 
Implements a VMC using particle-by-particle move. More...
 
class  VMCBatched
 
Implements a VMC using particle-by-particle move. More...
 
class  VMCDriverInput
 Input representation for VMC driver class runtime parameters. More...
 
class  VMCFactory
 
class  VMCFactoryNew
 
class  VMCUpdateAll
 
Implements the VMC algorithm using particle-by-particle move. More...
 
class  VMCUpdatePbyP
 
Implements the VMC algorithm using particle-by-particle move. More...
 
struct  VPMultiWalkerMem
 
class  Walker
 A container class to represent a walker. More...
 
class  WalkerConfigurations
 A set of light weight walkers that are carried between driver sections and restart. More...
 
class  WalkerControl
 Class for controlling the walkers for DMC simulations. More...
 
class  WalkerControlBase
 Base class to control the walkers for DMC simulations. More...
 
struct  WalkerControlMPI
 Class to handle walker controls with simple global sum. More...
 
struct  WalkerElementsRef
 type for returning the walker and its elements from MCPopulation More...
 
class  WalkerLogBuffer
 Data buffer for walker log quantities. More...
 
class  WalkerLogCollector
 Crowd-level resource for walker log collection. More...
 
struct  WalkerLogInput
 Native representation for walker logs input. More...
 
class  WalkerLogManager
 Driver-level resource for walker log collection. More...
 
struct  WalkerLogState
 Helper struct holding data transferred from WalkerLogManager to WalkerLogCollector following input read. More...
 
struct  WalkerProperties
 
struct  WalkerQuantityInfo
 Record for an individual walker quantity being logd. More...
 
struct  WalkerReconfiguration
 Class to handle walker controls with simple global sum. More...
 
struct  WalkerReconfigurationMPI
 Class to handle walker controls with simple global sum. More...
 
class  WaveFunctionComponent
 An abstract class for a component of a many-body trial wave function. More...
 
class  WaveFunctionComponentBuilder
 An abstract class for wave function builders. More...
 
class  WaveFunctionFactory
 Factory class to build a many-body wavefunction. More...
 
class  WaveFunctionPool
 Manage a collection of TrialWaveFunction objects. More...
 
class  WaveFunctionTester
 Test the correctness of TrialWaveFunction for the values, gradients and laplacians. More...
 
struct  WaveFunctionTypes
 Consistent way to get the set of types used in the QMCWaveFunction module, without resorting to ifdef'd type aliases accessed through inheritance. More...
 
class  WFCResourceConsumer
 
class  WFOptDriverInput
 
struct  WLog
 Basic data types for walker log data. More...
 
class  XMLParticleParser
 
class  XMLSaveParticle
 
struct  YukawaBreakup
 RPABreakUp. More...
 

Typedefs

template<typename T >
using IsComplex = std::enable_if_t< IsComplex_t< T >::value, bool >
 
template<typename T >
using IsReal_t = std::is_floating_point< T >
 
template<typename T >
using IsReal = std::enable_if_t< std::is_floating_point< T >::value, bool >
 
template<typename T >
using RealAlias = typename RealAlias_impl< T >::value_type
 If you have a function templated on a value that can be real or complex and you need to get the base Real type if its complex or just the real. More...
 
template<typename TREAL , typename TREF , typename = std::enable_if_t<std::is_floating_point<TREAL>::value>>
using ValueAlias = typename ValueAlias_impl< TREAL, TREF >::value_type
 If you need to make a value type of a given precision based on a reference value type set the desired POD float point type as TREAL and set the reference type as TREF. More...
 
template<typename T >
using RngValueType = typename std::disjunction< OnTypesEqual< T, float, float >, OnTypesEqual< T, double, double >, OnTypesEqual< T, std::complex< float >, float >, OnTypesEqual< T, std::complex< double >, double >, default_type< void > >::type
 Get the right type for rng in case of complex T. More...
 
template<typename T >
using OffloadPinnedAllocator = OMPallocator< T, PinnedAlignedAllocator< T > >
 
using ChronoClock = std::chrono::system_clock
 
using timer_id_t = unsigned char
 
using StackKey = StackKeyParam< 2 >
 
using NewTimer = TimerType< ChronoClock >
 
using FakeTimer = TimerType< FakeChronoClock >
 
using ScopedTimer = ScopeGuard< NewTimer >
 
using ScopedFakeTimer = ScopeGuard< FakeTimer >
 
using RandomGenerator = StdRandom< OHMMS_PRECISION_FULL >
 
using ParseCaseVector_t = vector< ParseCase >
 
using FakeTimerManager = TimerManager< FakeTimer >
 
template<class T >
using TimerNameList_t = std::vector< TimerIDName_t< T > >
 
using TimerList_t = TimerList< NewTimer >
 
using real_type = OHMMS_PRECISION
 
using RealType = double
 
template<class Allocator >
using IsHostSafe = std::enable_if_t< qmc_allocator_traits< Allocator >::is_host_accessible >
 
template<class Allocator >
using IsNotHostSafe = std::enable_if_t<!qmc_allocator_traits< Allocator >::is_host_accessible >
 
template<class Allocator >
using IsDualSpace = std::enable_if_t< qmc_allocator_traits< Allocator >::is_dual_space >
 
template<class T , size_t ALIGN = QMC_SIMD_ALIGNMENT>
using aligned_allocator = Mallocator< T, ALIGN >
 
template<class T >
using aligned_vector = std::vector< T, aligned_allocator< T > >
 
template<typename T >
using CUDATypeMap = typename std::disjunction< OnTypesEqual< T, float, float >, OnTypesEqual< T, double, double >, OnTypesEqual< T, float *, float * >, OnTypesEqual< T, double *, double * >, OnTypesEqual< T, float **, float ** >, OnTypesEqual< T, double **, double ** >, OnTypesEqual< T, std::complex< double >, cuDoubleComplex >, OnTypesEqual< T, std::complex< float >, cuComplex >, OnTypesEqual< T, std::complex< double > *, cuDoubleComplex * >, OnTypesEqual< T, std::complex< float > **, cuComplex ** >, OnTypesEqual< T, std::complex< double > **, cuDoubleComplex ** >, OnTypesEqual< T, std::complex< float > *, cuComplex * >, OnTypesEqual< T, const std::complex< double > *, const cuDoubleComplex * >, OnTypesEqual< T, const std::complex< float > *, const cuComplex * >, OnTypesEqual< T, const std::complex< float > **, const cuComplex ** >, OnTypesEqual< T, const std::complex< double > **, const cuDoubleComplex ** >, OnTypesEqual< T, const std::complex< float > *const *, const cuComplex *const * >, OnTypesEqual< T, const std::complex< double > *const *, const cuDoubleComplex *const * >, default_type< void > >::type
 
template<typename T >
using UnpinnedDualAllocator = OffloadAllocator< T >
 
template<typename T >
using PinnedDualAllocator = OffloadPinnedAllocator< T >
 
template<typename T >
using DeviceAllocator = OffloadDeviceAllocator< T >
 
template<typename T >
using OffloadAllocator = OMPallocator< T, aligned_allocator< T > >
 
template<typename T >
using OffloadDeviceAllocator = aligned_allocator< T >
 
template<typename T >
using PinnedAllocator = std::allocator< T >
 The fact that the pinned allocators are not always pinned hurts readability elsewhere. More...
 
template<typename T , size_t ALIGN = QMC_SIMD_ALIGNMENT>
using PinnedAlignedAllocator = aligned_allocator< T, ALIGN >
 
using CPUOMPTargetSelector = PlatformSelector< SelectorKind::CPU_OMPTARGET >
 
using CPUOMPTargetVendorSelector = PlatformSelector< SelectorKind::CPU_OMPTARGET >
 
template<typename T >
using hipblasTypeMap = typename std::disjunction< OnTypesEqual< T, float, float >, OnTypesEqual< T, double, double >, OnTypesEqual< T, float *, float * >, OnTypesEqual< T, double *, double * >, OnTypesEqual< T, float **, float ** >, OnTypesEqual< T, double **, double ** >, OnTypesEqual< T, std::complex< double >, hipblasDoubleComplex >, OnTypesEqual< T, std::complex< float >, hipblasComplex >, OnTypesEqual< T, std::complex< double > *, hipblasDoubleComplex * >, OnTypesEqual< T, std::complex< float > **, hipblasComplex ** >, OnTypesEqual< T, std::complex< double > **, hipblasDoubleComplex ** >, OnTypesEqual< T, std::complex< float > *, hipblasComplex * >, OnTypesEqual< T, const std::complex< double > *, const hipblasDoubleComplex * >, OnTypesEqual< T, const std::complex< float > *, const hipblasComplex * >, OnTypesEqual< T, const std::complex< float > **, const hipblasComplex ** >, OnTypesEqual< T, const std::complex< double > **, const hipblasDoubleComplex ** >, OnTypesEqual< T, const std::complex< float > *const *, const hipblasComplex *const * >, OnTypesEqual< T, const std::complex< double > *const *, const hipblasDoubleComplex *const * >, default_type< void > >::type
 
using vec_t = TinyVector< double, 3 >
 
using mRealType = EwaldHandler3D::mRealType
 
using PosType = TinyVector< double, 3 >
 
using pRealType = qmcplusplus::LRHandlerBase::pRealType
 
using WP = WalkerProperties::Indexes
 
using MCPWalker = Walker< QMCTraits, PtclOnLatticeTraits >
 
using PsiValue = WaveFunctionComponent::PsiValue
 
using ValueType = LatticeGaussianProduct::ValueType
 
using GradType = LatticeGaussianProduct::GradType
 
using ValueVector = OrbitalSetTraits< ValueType >::ValueVector
 
using BasisSet_t = LCAOrbitalSet::basis_type
 
using opt_variables_type = optimize::VariableSet
 
using QuantumNumberType = TinyVector< int, 4 >
 
using SPOSetPtr = SPOSet *
 
template<typename T >
using OffloadPinnedMatrix = Matrix< T, PinnedDualAllocator< T > >
 
template<typename T >
using OffloadPinnedVector = Vector< T, PinnedDualAllocator< T > >
 
using StdComp = std::complex< double >
 
using LogValue = std::complex< double >
 
using ComplexType = QMCTraits::ComplexType
 
using LogComplexApprox = Catch::Detail::LogComplexApprox
 
using FakeJasFunctor = FakeFunctor< OHMMS_PRECISION >
 
template<typename DT >
using OffloadVector = Vector< DT, OffloadPinnedAllocator< DT > >
 
using DiracDet = DiracDeterminant< DelayedUpdate< QMCTraits::ValueType, QMCTraits::QTFull::ValueType > >
 
using Return_t = BareKineticEnergy::Return_t
 
using LRHandlerType = LRCoulombSingleton::LRHandlerType
 
using GridType = LRCoulombSingleton::GridType
 
using RadFunctorType = LRCoulombSingleton::RadFunctorType
 
using Value_t = DensityMatrices1B::Value_t
 
using Real = ForceBase::Real
 
using value_type = QMCTraits::FullPrecRealType
 
using QMCT = QMCTraits
 
using EstimatorInput = std::variant< std::monostate, MomentumDistributionInput, SpinDensityInput, OneBodyDensityMatricesInput, SelfHealingOverlapInput, MagnetizationDensityInput, PerParticleHamiltonianLoggerInput >
 
using EstimatorInputs = std::vector< EstimatorInput >
 
using ScalarEstimatorInput = std::variant< std::monostate, LocalEnergyInput, CSLocalEnergyInput, RMCLocalEnergyInput >
 
using ScalarEstimatorInputs = std::vector< ScalarEstimatorInput >
 
using SPOMap = SPOSet::SPOMap
 
using input = testing::ValidSpinDensityInput
 
using TraceInt = long
 
using TraceReal = OHMMS_PRECISION
 
using TraceComp = std::complex< TraceReal >
 
using FullPrecReal = DMCRefEnergy::FullPrecReal
 
using FullPrecValueType = qmcplusplus::QMCTraits::FullPrecValueType
 
using FullPrecRealType = HamiltonianRef::FullPrecRealType
 
using IndexType = QMCTraits::IndexType
 

Enumerations

enum  DataLocality {
  process = 0, rank, crowd, queue,
  walker
}
 data locality with respect to walker buffer More...
 
enum  Executor { OPENMP }
 
enum  timer_levels {
  timer_level_none, timer_level_coarse, timer_level_medium, timer_level_fine,
  num_timer_levels
}
 
enum  TestTimer { MyTimer1, MyTimer2 }
 
enum  smoothing_functions { LEKS2018 = 0, COSCOS, LINEAR }
 
enum  PlatformKind { CPU, OMPTARGET, CUDA, SYCL }
 
enum  SelectorKind { CPU_OMPTARGET, CPU_OMPTARGET_CUDA, CPU_OMPTARGET_SYCL }
 
enum  DTModes : uint_fast8_t {
  ALL_OFF = 0x0, NEED_FULL_TABLE_ANYTIME = 0x1, NEED_VP_FULL_TABLE_ON_HOST = 0x2, NEED_TEMP_DATA_ON_HOST = 0x4,
  MW_EVALUATE_RESULT_NO_TRANSFER_TO_HOST = 0x8, NEED_FULL_TABLE_ON_HOST_AFTER_DONEPBYP = 0x16
}
 
enum  DynamicCoordinateKind { DC_POS, DC_POS_OFFLOAD }
 enumerator for DynamicCoordinates kinds More...
 
enum  {
  SUPERCELL_OPEN = 0, SUPERCELL_WIRE = 1, SUPERCELL_SLAB = 3, SUPERCELL_BULK = 7,
  SOA_OFFSET = 32
}
 enumeration to classify a CrystalLattice More...
 
enum  {
  PPPG = SUPERCELL_BULK, PPPS = SUPERCELL_BULK + 1, PPPO = SUPERCELL_BULK + 2, PPPX = SUPERCELL_BULK + 3,
  PPNG = SUPERCELL_SLAB, PPNS = SUPERCELL_SLAB + 1, PPNO = SUPERCELL_SLAB + 2, PPNX = SUPERCELL_SLAB + 3
}
 enumeration for DTD_BConds specialization More...
 
enum  CoordsType { POS, POS_SPIN }
 
enum  PosUnit { Cartesian = 0, Lattice }
 enum class to assist copy and unit conversion operations on position vectors More...
 
enum  PSetTimers {
  PS_newpos, PS_donePbyP, PS_accept, PS_loadWalker,
  PS_update, PS_dt_move, PS_mw_copy
}
 
enum  SoAFields3D {
  VAL = 0, GRAD0, GRAD1, GRAD2,
  HESS00, HESS01, HESS02, HESS11,
  HESS12, HESS22, LAPL, NUM_FIELDS
}
 
enum  DetMatInvertor { HOST, ACCEL }
 determinant matrix inverter select More...
 
enum  { q_n = 0, q_l, q_m, q_s }
 
enum  TimerEnum {
  V_TIMER = 0, VGL_TIMER, ACCEPT_TIMER, NL_TIMER,
  RECOMPUTE_TIMER, BUFFER_TIMER, DERIVS_TIMER, PREPAREGROUP_TIMER,
  TIMER_SKIP
}
 
enum  DMTimers {
  DM_eval, DM_gen_samples, DM_gen_sample_basis, DM_gen_sample_ratios,
  DM_gen_particle_basis, DM_matrix_products, DM_accumulate
}
 
enum  { TMOVE_OFF = 0, TMOVE_V0, TMOVE_V1, TMOVE_V3 }
 Tmove options. More...
 
enum  {
  COLLECT = 0, MANAGE, RECORD, POSTIRECV,
  APPEND
}
 enumeration for EstimatorManagerBase.Options More...
 
enum  TestEnum1 { VALUE1, VALUE2 }
 
enum  TestEnum2 { VALUE1, VALUE2 }
 
enum  DMCRefEnergyScheme { UNLIMITED_HISTORY, LIMITED_HISTORY }
 DMCRefEnergy schemes. More...
 
enum  DMCTimers {
  DMC_buffer, DMC_movePbyP, DMC_hamiltonian, DMC_collectables,
  DMC_tmoves
}
 
enum  SODMCTimers {
  SODMC_buffer, SODMC_movePbyP, SODMC_hamiltonian, SODMC_collectables,
  SODMC_tmoves
}
 
enum  WC_Timers {
  WC_branch, WC_imbalance, WC_prebalance, WC_copyWalkers,
  WC_recomputing, WC_allreduce, WC_loadbalance, WC_send,
  WC_recv
}
 
enum  DMC_MPI_Timers {
  DMC_MPI_branch, DMC_MPI_imbalance, DMC_MPI_prebalance, DMC_MPI_copyWalkers,
  DMC_MPI_allreduce, DMC_MPI_loadbalance, DMC_MPI_send, DMC_MPI_recv
}
 
enum  DriverDebugChecks : uint_fast8_t { ALL_OFF = 0x0, CHECKGL_AFTER_LOAD = 0x1, CHECKGL_AFTER_MOVES = 0x2, CHECKGL_AFTER_TMOVE = 0x3 }
 
enum  QMCRunType {
  DUMMY, VMC, CSVMC, DMC,
  RMC, VMC_OPT, LINEAR_OPTIMIZE, WF_TEST,
  VMC_BATCH, DMC_BATCH, LINEAR_OPTIMIZE_BATCH
}
 
enum  QMCModeEnum {
  UPDATE_MODE, MULTIPLE_MODE, SPACEWARP_MODE, ALTERNATE_MODE,
  GPU_MODE, QMC_MODE_MAX = 8
}
 enum to set the bit to determine the QMC mode More...
 
enum  OptimizerType {
  NONE, QUARTIC, RESCALE, LINEMIN,
  ONESHIFTONLY, ADAPTIVE, DESCENT, HYBRID,
  GRADIENT_TEST
}
 
enum  { COMBOPT, USETAUOPT, MIXDMCOPT, DUMMYOPT }
 enum to yes/no options saved in sParam More...
 
enum  { COMBOPT, USETAUOPT, MIXDMCOPT, DUMMYOPT }
 enum to yes/no options saved in sParam More...
 

Functions

float real (const float &c)
 real part of a scalar. Cannot be replaced by std::real due to AFQMC specific needs. More...
 
double real (const double &c)
 
float real (const std::complex< float > &c)
 
double real (const std::complex< double > &c)
 
float imag (const float &c)
 imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs. More...
 
double imag (const double &c)
 
float imag (const std::complex< float > &c)
 
double imag (const std::complex< double > &c)
 
float conj (const float &c)
 Workaround to allow conj on scalar to return real instead of complex. More...
 
double conj (const double &c)
 
std::complex< float > conj (const std::complex< float > &c)
 
std::complex< double > conj (const std::complex< double > &c)
 
void copy_with_complex_cast (const std::complex< double > &source, std::complex< double > &dest)
 
void copy_with_complex_cast (const std::complex< double > &source, double &dest)
 
void copy_with_complex_cast (const std::complex< float > &source, std::complex< float > &dest)
 
void copy_with_complex_cast (const std::complex< float > &source, float &dest)
 
template<typename T1 , typename T2 , IsReal< T2 > = true>
void convertToReal (const T1 &in, T2 &out)
 generic conversion from type T1 to type T2 using implicit conversion More...
 
template<typename T1 , typename T2 , IsReal< T2 > = true>
void convertToReal (const std::complex< T1 > &in, T2 &out)
 specialization of conversion from complex to real More...
 
template<typename T1 , typename T2 , unsigned D>
void convertToReal (const TinyVector< T1, D > &in, TinyVector< T2, D > &out)
 
template<typename T1 , typename T2 , unsigned D>
void convertToReal (const Tensor< T1, D > &in, Tensor< T2, D > &out)
 specialization for D tensory More...
 
template<typename T1 , typename T2 >
void convertToReal (const T1 *restrict in, T2 *restrict out, std::size_t n)
 generic function to convert arrays More...
 
template<typename T1 , typename T2 >
void convertToReal (const Vector< T1 > &in, Vector< T2 > &out)
 specialization for a vector More...
 
template<typename T1 , typename T2 >
void convertToReal (const Matrix< T1 > &in, Matrix< T2 > &out)
 specialization for a vector More...
 
 TEST_CASE ("complex_helper", "[type_traits]")
 
 TEST_CASE ("QMCTypes", "[type_traits]")
 
 TEST_CASE ("makeRefVector", "[type_traits]")
 
 TEST_CASE ("convertUPtrToRefvector", "[type_traits]")
 
 TEST_CASE ("convertPtrToRefvectorSubset", "[type_traits]")
 
template<class T , class R >
constexpr bool has (const R &this_one)
 
void TestTaskOMP (const int ip, int &counter)
 Openmp generally works but is not guaranteed with std::atomic. More...
 
 TEST_CASE ("ParallelExecutor<OPENMP> function case", "[concurrency]")
 
 TEST_CASE ("ParallelExecutor<OPENMP> lambda case", "[concurrency]")
 
 TEST_CASE ("ParallelExecutor<OPENMP> nested case", "[concurrency]")
 
void TestTask (const int ip, std::atomic< int > &counter)
 
 TEST_CASE ("ParallelExecutor<STD> function case", "[concurrency]")
 
 TEST_CASE ("ParallelExecutor<STD> lambda case", "[concurrency]")
 
 TEST_CASE ("ParallelExecutor<STD> nested case", "[concurrency]")
 
 TEST_CASE ("UtilityFunctions OpenMP", "[concurrency]")
 
 TEST_CASE ("ConstantSizeMatrix basics", "[containers]")
 
 TEST_CASE ("ConstantSizeMatrix Ohmms integration", "[containers]")
 
 TEST_CASE ("RecordArray basics", "[containers]")
 
template<class T , unsigned D>
trace (const AntiSymTensor< T, D > &)
 
template<class T , unsigned D>
AntiSymTensor< T, D > transpose (const AntiSymTensor< T, D > &rhs)
 
template<class T , unsigned D>
const AntiSymTensor< T, D > & operator+ (const AntiSymTensor< T, D > &op)
 
template<class T1 , class T2 , unsigned D>
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const AntiSymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)
 
template<class T1 , class T2 , unsigned D>
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const AntiSymTensor< T1, D > &lhs, const Tensor< T2, D > &rhs)
 
template<class T1 , class T2 , unsigned D>
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const Tensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)
 
template<class T1 , class T2 , unsigned D>
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const AntiSymTensor< T1, D > &lhs, const SymTensor< T2, D > &rhs)
 
template<class T1 , class T2 , unsigned D>
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const SymTensor< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)
 
template<class T1 , class T2 , unsigned D>
TinyVector< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const TinyVector< T1, D > &lhs, const AntiSymTensor< T2, D > &rhs)
 
template<class T1 , class T2 , unsigned D>
TinyVector< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const AntiSymTensor< T1, D > &lhs, const TinyVector< T2, D > &rhs)
 
template<class T , unsigned D>
std::ostream & operator<< (std::ostream &out, const AntiSymTensor< T, D > &rhs)
 
template<class T , class Alloc >
bool operator== (const Matrix< T, Alloc > &lhs, const Matrix< T, Alloc > &rhs)
 
template<class T , class Alloc >
bool operator!= (const Matrix< T, Alloc > &lhs, const Matrix< T, Alloc > &rhs)
 
template<class T , typename Alloc >
std::ostream & operator<< (std::ostream &out, const Matrix< T, Alloc > &rhs)
 
template<class T , typename Alloc >
std::istream & operator>> (std::istream &is, Matrix< T, Alloc > &rhs)
 
template<class T , typename Alloc , class Op , class RHS >
void evaluate (Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< OpUnaryMinus, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t > >::Expression_t operator- (const Matrix< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< OpUnaryPlus, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t > >::Expression_t operator+ (const Matrix< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< OpBitwiseNot, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t > >::Expression_t operator~ (const Matrix< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< OpIdentity, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t > >::Expression_t PETE_identity (const Matrix< T1, C1 > &l)
 
template<class T1 , class T2 , class C2 >
MakeReturn< UnaryNode< OpCast< T1 >, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t peteCast (const T1 &, const Matrix< T2, C2 > &l)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator+ (const Matrix< T1, C1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator- (const Matrix< T1, C1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator* (const Matrix< T1, C1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator% (const Matrix< T1, C1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator & (const Matrix< T1, C1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator| (const Matrix< T1, C1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator^ (const Matrix< T1, C1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator+ (const Matrix< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator- (const Matrix< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator* (const Matrix< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator% (const Matrix< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator & (const Matrix< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator| (const Matrix< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator^ (const Matrix< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator+ (const Expression< T1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator- (const Expression< T1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator* (const Expression< T1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator% (const Expression< T1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator & (const Expression< T1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator| (const Expression< T1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator^ (const Expression< T1 > &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator+ (const Matrix< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator- (const Matrix< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator* (const Matrix< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator% (const Matrix< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator & (const Matrix< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator| (const Matrix< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator^ (const Matrix< T1, C1 > &l, const T2 &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator+ (const T1 &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator- (const T1 &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator* (const T1 &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator% (const T1 &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator & (const T1 &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator| (const T1 &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Matrix< T2, C2 > >::Leaf_t > >::Expression_t operator^ (const T1 &l, const Matrix< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class T3 >
MakeReturn< TrinaryNode< FnWhere, typename CreateLeaf< Matrix< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t, typename CreateLeaf< T3 >::Leaf_t > >::Expression_t where (const Matrix< T1, C1 > &c, const T2 &t, const T3 &f)
 
template<class T1 >
MakeReturn< UnaryNode< OpUnaryMinus, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t operator- (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< OpUnaryPlus, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t operator+ (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< OpBitwiseNot, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t operator~ (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< OpIdentity, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t PETE_identity (const Expression< T1 > &l)
 
template<class T1 , class T2 >
MakeReturn< UnaryNode< OpCast< T1 >, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t peteCast (const T1 &, const Expression< T2 > &l)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator+ (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator- (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator* (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator% (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator & (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator| (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator^ (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator+ (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator- (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator* (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator% (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator & (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator| (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator^ (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator+ (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator- (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator* (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator% (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator & (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator| (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator^ (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 , class T3 >
MakeReturn< TrinaryNode< FnWhere, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t, typename CreateLeaf< T3 >::Leaf_t > >::Expression_t where (const Expression< T1 > &c, const T2 &t, const T3 &f)
 
template<class T1 , class C1 , class RHS >
Matrix< T1, C1 > & assign (Matrix< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Matrix< T1, C1 > & operator+= (Matrix< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Matrix< T1, C1 > & operator-= (Matrix< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Matrix< T1, C1 > & operator*= (Matrix< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Matrix< T1, C1 > & operator%= (Matrix< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Matrix< T1, C1 > & operator|= (Matrix< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Matrix< T1, C1 > & operator &= (Matrix< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Matrix< T1, C1 > & operator^= (Matrix< T1, C1 > &lhs, const RHS &rhs)
 
template<class T , class C , class Op , class RHS >
void evaluate (Vector< T, C > &lhs, const Op &op, const Expression< RHS > &rhs)
 
template<class T , class Alloc >
bool operator== (const Vector< T, Alloc > &lhs, const Vector< T, Alloc > &rhs)
 
template<class T , class Alloc >
bool operator!= (const Vector< T, Alloc > &lhs, const Vector< T, Alloc > &rhs)
 
template<class T , class Alloc >
std::ostream & operator<< (std::ostream &out, const Vector< T, Alloc > &rhs)
 
template<class T , class Alloc >
std::istream & operator>> (std::istream &is, Vector< T, Alloc > &rhs)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnArcCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t acos (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnArcSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t asin (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnArcTan, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t atan (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnCeil, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t ceil (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnHypCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cosh (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnFloor, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t floor (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnLog10, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log10 (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnHypSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sinh (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnTan, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t tan (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< FnHypTan, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t tanh (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< OpUnaryMinus, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t operator- (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< OpUnaryPlus, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t operator+ (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< OpBitwiseNot, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t operator~ (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< OpIdentity, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t PETE_identity (const Vector< T1, C1 > &l)
 
template<class T1 , class C1 >
MakeReturn< UnaryNode< OpNot, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t operator! (const Vector< T1, C1 > &l)
 
template<class T1 , class T2 , class C2 >
MakeReturn< UnaryNode< OpCast< T1 >, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t peteCast (const T1 &, const Vector< T2, C2 > &l)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator+ (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator- (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator* (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpDivide, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator/ (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator% (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator & (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator| (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator^ (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< FnLdexp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t ldexp (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< FnFmod, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t fmod (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< FnArcTan2, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t atan2 (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpLT, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator< (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpLE, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator<= (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpGT, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator> (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpGE, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator>= (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpEQ, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator== (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpNE, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator!= (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpAnd, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator && (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpOr, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator|| (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpLeftShift, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator<< (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpRightShift, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator>> (const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator+ (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator- (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator* (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpDivide, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator/ (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator% (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator & (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator| (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator^ (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< FnLdexp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t ldexp (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t pow (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< FnFmod, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t fmod (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< FnArcTan2, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t atan2 (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpLT, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator< (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpLE, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator<= (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpGT, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator> (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpGE, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator>= (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpEQ, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator== (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpNE, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator!= (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpAnd, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator && (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpOr, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator|| (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpLeftShift, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator<< (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpRightShift, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator>> (const Vector< T1, C1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator+ (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator- (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator* (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpDivide, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator/ (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator% (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator & (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator| (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator^ (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< FnLdexp, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t ldexp (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< FnFmod, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t fmod (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< FnArcTan2, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t atan2 (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpLT, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator< (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpLE, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator<= (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpGT, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator> (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpGE, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator>= (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpEQ, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator== (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpNE, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator!= (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpAnd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator && (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpOr, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator|| (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpLeftShift, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator<< (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpRightShift, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator>> (const Expression< T1 > &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator+ (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator- (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator* (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpDivide, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator/ (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator% (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator & (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator| (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator^ (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< FnLdexp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t ldexp (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t pow (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< FnFmod, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t fmod (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< FnArcTan2, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t atan2 (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpLT, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator< (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpLE, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator<= (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpGT, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator> (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpGE, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator>= (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpEQ, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator== (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpNE, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator!= (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpAnd, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator && (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpOr, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator|| (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpLeftShift, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator<< (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class C1 , class T2 >
MakeReturn< BinaryNode< OpRightShift, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator>> (const Vector< T1, C1 > &l, const T2 &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator+ (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator- (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator* (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpDivide, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator/ (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator% (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator & (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator| (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator^ (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< FnLdexp, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t ldexp (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< FnFmod, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t fmod (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< FnArcTan2, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t atan2 (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpLT, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator< (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpLE, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator<= (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpGT, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator> (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpGE, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator>= (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpEQ, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator== (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpNE, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator!= (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpAnd, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator && (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class T2 , class C2 >
MakeReturn< BinaryNode< OpOr, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t operator|| (const T1 &l, const Vector< T2, C2 > &r)
 
template<class T1 , class C1 , class T2 , class T3 >
MakeReturn< TrinaryNode< FnWhere, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t, typename CreateLeaf< T3 >::Leaf_t > >::Expression_t where (const Vector< T1, C1 > &c, const T2 &t, const T3 &f)
 
template<class T1 >
MakeReturn< UnaryNode< FnArcCos, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t acos (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnArcSin, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t asin (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnArcTan, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t atan (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnCeil, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t ceil (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t cos (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnHypCos, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t cosh (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t exp (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t abs (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnFloor, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t floor (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t log (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnLog10, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t log10 (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t sin (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnHypSin, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t sinh (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t sqrt (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnTan, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t tan (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< FnHypTan, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t tanh (const Expression< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< OpNot, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t operator! (const Expression< T1 > &l)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpDivide, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator/ (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator & (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< FnLdexp, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t ldexp (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t pow (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< FnFmod, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t fmod (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< FnArcTan2, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t atan2 (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpLT, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator< (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpLE, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator<= (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpGT, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator> (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpGE, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator>= (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpEQ, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator== (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpNE, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator!= (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpAnd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator && (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpOr, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator|| (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpLeftShift, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator<< (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpRightShift, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator>> (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpDivide, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator/ (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator & (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< FnLdexp, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t ldexp (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t pow (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< FnFmod, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t fmod (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< FnArcTan2, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t atan2 (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpLT, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator< (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpLE, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator<= (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpGT, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator> (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpGE, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator>= (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpEQ, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator== (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpNE, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator!= (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpAnd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator && (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpOr, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator|| (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpLeftShift, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator<< (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpRightShift, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator>> (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpDivide, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator/ (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator & (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< FnLdexp, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t ldexp (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t pow (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< FnFmod, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t fmod (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< FnArcTan2, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t atan2 (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpLT, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator< (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpLE, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator<= (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpGT, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator> (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpGE, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator>= (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpEQ, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator== (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpNE, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator!= (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpAnd, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator && (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpOr, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator|| (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class C1 , class RHS >
Vector< T1, C1 > & assign (Vector< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Vector< T1, C1 > & operator+= (Vector< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Vector< T1, C1 > & operator-= (Vector< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Vector< T1, C1 > & operator*= (Vector< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Vector< T1, C1 > & operator/= (Vector< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Vector< T1, C1 > & operator%= (Vector< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Vector< T1, C1 > & operator|= (Vector< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Vector< T1, C1 > & operator &= (Vector< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Vector< T1, C1 > & operator^= (Vector< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Vector< T1, C1 > & operator<<= (Vector< T1, C1 > &lhs, const RHS &rhs)
 
template<class T1 , class C1 , class RHS >
Vector< T1, C1 > & operator>>= (Vector< T1, C1 > &lhs, const RHS &rhs)
 
template<class T , unsigned D>
trace (const SymTensor< T, D > &rhs)
 
template<class T , unsigned D>
SymTensor< T, D > transpose (const SymTensor< T, D > &rhs)
 
template<class T1 , class T2 , unsigned D>
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const SymTensor< T1, D > &lhs, const SymTensor< T2, D > &rhs)
 
template<class T1 , class T2 , unsigned D>
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const SymTensor< T1, D > &lhs, const Tensor< T2, D > &rhs)
 
template<class T1 , class T2 , unsigned D>
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const Tensor< T1, D > &lhs, const SymTensor< T2, D > &rhs)
 
template<class T1 , class T2 , unsigned D>
TinyVector< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const TinyVector< T1, D > &lhs, const SymTensor< T2, D > &rhs)
 
template<class T1 , class T2 , unsigned D>
TinyVector< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const SymTensor< T1, D > &lhs, const TinyVector< T2, D > &rhs)
 
template<class T , unsigned D>
std::ostream & operator<< (std::ostream &out, const SymTensor< T, D > &rhs)
 
template<class T , unsigned D>
trace (const Tensor< T, D > &rhs)
 trace $ result = \sum_k rhs(k,k)$ More...
 
template<class T , unsigned D>
Tensor< T, D > transpose (const Tensor< T, D > &rhs)
 transpose a tensor More...
 
template<class T1 , class T2 , unsigned D>
T1 trace (const Tensor< T1, D > &a, const Tensor< T2, D > &b)
 Tr(a*b), $ \sum_i\sum_j a(i,j)*b(j,i) $. More...
 
template<class T , unsigned D>
traceAtB (const Tensor< T, D > &a, const Tensor< T, D > &b)
 Tr(a^t *b), $ \sum_i\sum_j a(i,j)*b(i,j) $. More...
 
template<class T1 , class T2 , unsigned D>
BinaryReturn< T1, T2, OpMultiply >::Type_t traceAtB (const Tensor< T1, D > &a, const Tensor< T2, D > &b)
 Tr(a^t *b), $ \sum_i\sum_j a(i,j)*b(i,j) $. More...
 
template<class T1 , class T2 , unsigned D>
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const Tensor< T1, D > &lhs, const Tensor< T2, D > &rhs)
 Binary Operators. More...
 
template<class T1 , class T2 , unsigned D>
TinyVector< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const TinyVector< T1, D > &lhs, const Tensor< T2, D > &rhs)
 Vector-Tensor dot product $result(i)=\sum_k lhs(k)*rhs(k,i)$. More...
 
template<class T1 , class T2 , unsigned D>
TinyVector< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > dot (const Tensor< T1, D > &lhs, const TinyVector< T2, D > &rhs)
 Tensor-Vector dot product $result(i)=\sum_k lhs(i,k)*rhs(k)$. More...
 
template<class T , unsigned D>
std::ostream & operator<< (std::ostream &out, const Tensor< T, D > &rhs)
 Vector-vector outter product $ result(i,j)=v1(i)*v2(j)$. More...
 
template<class T , unsigned D>
std::istream & operator>> (std::istream &is, Tensor< T, D > &rhs)
 
template<class T , unsigned D>
bool operator== (const Tensor< T, D > &lhs, const Tensor< T, D > &rhs)
 
template<class T , unsigned D>
bool operator!= (const Tensor< T, D > &lhs, const Tensor< T, D > &rhs)
 
template<class T , unsigned D>
Tensor< T, D >::Type_t det (const Tensor< T, D > &a)
 
template<class T >
Tensor< T, 1 >::Type_t det (const Tensor< T, 1 > &a)
 
template<class T >
Tensor< T, 2 >::Type_t det (const Tensor< T, 2 > &a)
 
template<class T >
Tensor< T, 3 >::Type_t det (const Tensor< T, 3 > &a)
 
template<class T , unsigned D>
Tensor< T, D > inverse (const Tensor< T, D > &a)
 
template<class T >
Tensor< T, 1 > inverse (const Tensor< T, 1 > &a)
 
template<class T >
Tensor< T, 2 > inverse (const Tensor< T, 2 > &a)
 
template<class T >
Tensor< T, 3 > inverse (const Tensor< T, 3 > &a)
 
template<class T >
Tensor< T, 3 > cholesky (const Tensor< T, 3 > &a)
 
 TEST_CASE ("array", "[OhmmsPETE]")
 
 TEST_CASE ("array NestedContainers", "[OhmmsPETE]")
 
 TEST_CASE ("Array::data", "[OhmmsPETE]")
 
 TEST_CASE ("Array::dimension sizes constructor", "[OhmmsPETE]")
 
 TEST_CASE ("matrix", "[OhmmsPETE]")
 
 TEST_CASE ("matrix converting assignment", "[OhmmsPETE]")
 
template<unsigned int D>
void test_tiny_vector ()
 
template<unsigned int D>
void test_tiny_vector_size_two ()
 
 TEST_CASE ("tiny vector", "[OhmmsPETE]")
 
 TEST_CASE ("tiny vector operator out", "[OhmmsPETE]")
 
 TEST_CASE ("vector", "[OhmmsPETE]")
 
 TEST_CASE ("Vector simple intializer list", "[OhmmsPETE]")
 
 TEST_CASE ("Vector nested intializer list", "[OhmmsPETE]")
 
 TEST_CASE ("VectorViewer", "[OhmmsPETE]")
 
 TEST_CASE ("NestedContainers", "[OhmmsPETE]")
 
template<class T1 , unsigned D1, unsigned D2>
TinyMatrix< T1, D2, D1 > operator! (const TinyMatrix< T1, D1, D2 > &a)
 
template<class T1 >
TinyMatrix< T1, 3, 3 > operator! (const TinyMatrix< T1, 3, 3 > &a)
 
template<class T1 >
TinyMatrix< T1, 4, 4 > operator! (const TinyMatrix< T1, 4, 4 > &a)
 
template<class T1 , class T2 , unsigned D>
BinaryReturn< T1, T2, OpMultiply >::Type_t dot (const TinyVector< T1, D > &lhs, const TinyVector< T2, D > &rhs)
 
template<class T1 , class T2 , unsigned D>
TinyVector< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > cross (const TinyVector< T1, D > &lhs, const TinyVector< T2, D > &rhs)
 
template<class T1 , class T2 , unsigned D>
Tensor< typename BinaryReturn< T1, T2, OpMultiply >::Type_t, D > outerProduct (const TinyVector< T1, D > &lhs, const TinyVector< T2, D > &rhs)
 
template<class T , unsigned D>
std::ostream & operator<< (std::ostream &out, const TinyVector< T, D > &rhs)
 
template<class T , unsigned D>
std::istream & operator>> (std::istream &is, TinyVector< T, D > &rhs)
 
template<typename T >
void PosAoS2SoA (int nrows, int ncols, const T *restrict iptr, int lda, T *restrict out, int ldb)
 General conversion function from AoS[nrows][ncols] to SoA[ncols][ldb]. More...
 
template<typename T >
void PosSoA2AoS (int nrows, int ncols, const T *restrict iptr, int lda, T *restrict out, int ldb)
 General conversion function from SoA[ncols][ldb] to AoS[nrows][ncols]. More...
 
 TEST_CASE ("vector", "[OhmmsSoA]")
 
 TEST_CASE ("VectorSoaContainer copy constructor", "[OhmmsSoA]")
 
 TEST_CASE ("VectorSoaContainer move constructor", "[OhmmsSoA]")
 
 TEST_CASE ("VectorSoaContainer assignment", "[OhmmsSoA]")
 
template<class A , class Op , class Tag >
Combine1< A, Op, Tag >::Type_t peteCombine (const A &a, const Op &op, const Tag &t)
 
template<class A , class B , class Op , class Tag >
Combine2< A, B, Op, Tag >::Type_t peteCombine (const A &a, const B &b, const Op &op, const Tag &t)
 
template<class A , class B , class C , class Op , class Tag >
Combine3< A, B, C, Op, Tag >::Type_t peteCombine (const A &a, const B &b, const C &c, const Op &op, const Tag &t)
 
template<class Expr , class FTag , class CTag >
ForEach< Expr, FTag, CTag >::Type_t forEach (const Expr &e, const FTag &f, const CTag &c)
 
 TEST_CASE ("pack scalar", "[utilities]")
 
template<class OPA >
void testDualAllocator ()
 
 TEST_CASE ("OhmmsMatrix_VectorSoaContainer_View", "[Integration][Allocators]")
 
template<typename T , typename ENABLE = std::enable_if_t<!std::is_same<bool, T>::value>>
hid_t get_h5_datatype (const T &)
 map C types to hdf5 native types bool is explicit removed due to the fact that it is implementation-dependant More...
 
 BOOSTSUB_H5_DATATYPE (char, H5T_NATIVE_CHAR)
 
 BOOSTSUB_H5_DATATYPE (short, H5T_NATIVE_SHORT)
 
 BOOSTSUB_H5_DATATYPE (int, H5T_NATIVE_INT)
 
 BOOSTSUB_H5_DATATYPE (long, H5T_NATIVE_LONG)
 
 BOOSTSUB_H5_DATATYPE (long long, H5T_NATIVE_LLONG)
 
 BOOSTSUB_H5_DATATYPE (unsigned char, H5T_NATIVE_UCHAR)
 
 BOOSTSUB_H5_DATATYPE (unsigned short, H5T_NATIVE_USHORT)
 
 BOOSTSUB_H5_DATATYPE (unsigned int, H5T_NATIVE_UINT)
 
 BOOSTSUB_H5_DATATYPE (unsigned long, H5T_NATIVE_ULONG)
 
 BOOSTSUB_H5_DATATYPE (unsigned long long, H5T_NATIVE_ULLONG)
 
 BOOSTSUB_H5_DATATYPE (float, H5T_NATIVE_FLOAT)
 
 BOOSTSUB_H5_DATATYPE (double, H5T_NATIVE_DOUBLE)
 
hdf_path operator/ (const hdf_path &lhs, const hdf_path &rhs)
 concatenates two paths with a directory separator More...
 
hdf_path operator/ (const hdf_path &lhs, const std::string &rhs)
 
hdf_path operator/ (const hdf_path &lhs, const char *rhs)
 
bool operator== (const hdf_path &lhs, const hdf_path &rhs) noexcept
 Checks whether lhs and rhs are equal. More...
 
template<typename T , typename IT >
bool getDataShape (hid_t grp, const std::string &aname, std::vector< IT > &sizes_out)
 free template function to read the (user) dimension and shape of the dataset. More...
 
template<typename T >
bool checkShapeConsistency (hid_t grp, const std::string &aname, int rank, hsize_t *dims)
 free function to check dimension More...
 
template<typename T >
bool h5d_read (hid_t grp, const std::string &aname, T *first, hid_t xfer_plist)
 return true, if successful More...
 
bool h5d_check_existence (hid_t grp, const std::string &aname)
 
template<typename T >
bool h5d_check_type (hid_t grp, const std::string &aname)
 
template<typename T >
bool h5d_write (hid_t grp, const std::string &aname, hsize_t ndims, const hsize_t *dims, const T *first, hid_t xfer_plist)
 
template<typename T >
bool h5d_read (hid_t grp, const std::string &aname, hsize_t ndims, const hsize_t *gcounts, const hsize_t *counts, const hsize_t *offsets, T *first, hid_t xfer_plist)
 return true, if successful More...
 
template<typename T >
bool h5d_write (hid_t grp, const std::string &aname, hsize_t ndims, const hsize_t *gcounts, const hsize_t *counts, const hsize_t *offsets, const T *first, hid_t xfer_plist)
 
template<typename T >
bool h5d_read (hid_t grp, const std::string &aname, hsize_t ndims, const hsize_t *gcounts, const hsize_t *counts, const hsize_t *offsets, hsize_t mem_ndims, const hsize_t *mem_gcounts, const hsize_t *mem_counts, const hsize_t *mem_offsets, T *first, hid_t xfer_plist)
 return true, if successful More...
 
template<typename T >
bool h5d_write (hid_t grp, const std::string &aname, hsize_t ndims, const hsize_t *gcounts, const hsize_t *counts, const hsize_t *offsets, hsize_t mem_ndims, const hsize_t *mem_gcounts, const hsize_t *mem_counts, const hsize_t *mem_offsets, const T *first, hid_t xfer_plist)
 
template<typename T >
bool h5d_append (hid_t grp, const std::string &aname, hsize_t &current, hsize_t ndims, const hsize_t *const dims, const T *const first, hsize_t chunk_size=1, hid_t xfer_plist=H5P_DEFAULT)
 
std::ostream & operator<< (std::ostream &out, const HDFVersion &v)
 
std::istream & operator>> (std::istream &is, HDFVersion &v)
 
template bool approxEquality< float > (float val_a, float val_b, std::optional< double > eps)
 
template bool approxEquality< std::complex< float > > (std::complex< float > val_a, std::complex< float > val_b, std::optional< double > eps)
 
template bool approxEquality< double > (double val_a, double val_b, std::optional< double > eps)
 
template bool approxEquality< std::complex< double > > (std::complex< double > val_a, std::complex< double > val_b, std::optional< double > eps)
 
template<typename T , IsComplex< T > = true>
bool approxEquality (T val_a, T val_b, std::optional< double > eps)
 
template<class M1 , class M2 >
CheckMatrixResult checkMatrix (M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
 This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declared M1::value_type and have an operator(i,j) accessor. More...
 
template<class T , unsigned D>
std::ostream & operator<< (std::ostream &out, const NativePrint< TinyVector< T, D >> &np_vec)
 
template<class T >
std::ostream & operator<< (std::ostream &out, const NativePrint< std::vector< T >> &np_vec)
 
template<>
std::ostream & operator<< (std::ostream &out, const NativePrint< std::vector< bool >> &np_vec)
 
template<class T >
std::ostream & operator<< (std::ostream &out, const NativePrint< Vector< T >> &np_vec)
 
template<class IT >
void delete_iter (IT first, IT last)
 delete the pointers in [first,last) More...
 
template<typename IT1 , typename IT2 >
void accumulate_elements (IT1 first, IT1 last, IT2 res)
 
template<class T >
ReportEngineoperator<< (ReportEngine &o, const T &val)
 
template<typename T >
std::ostream & operator<< (std::ostream &out, const std::vector< T > &rhs)
 collapsed vector printout [3, 3, 2, 2] is printed as [3(x2), 2(x2)] More...
 
std::string strip (const std::string &s)
 
bool whitespace (char c)
 
std::vector< std::string > split (const std::string &s)
 
std::vector< std::string > split (const std::string &s, const std::string &pattern)
 
int string2int (const std::string &s)
 
double string2real (const std::string &s)
 
std::string int2string (const int &i)
 
std::string real2string (const double &r)
 
bool string2bool (const std::string &s)
 
template<class T >
std::vector< T > convertStrToVec (const std::string &s)
 extract the contents of a string to a vector of something. separator is white spaces. More...
 
std::istream & operator>> (std::istream &is, astring &rhs)
 
std::ostream & operator<< (std::ostream &os, const astring &rhs)
 
bool operator== (const astring &lhs, const astring &rhs)
 
 TEST_CASE ("checkMatrix_OhmmsMatrix_real", "[utilities][for_testing]")
 
 TEST_CASE ("checkMatrix_real", "[utilities][for_testing]")
 
 TEST_CASE ("RandomForTest_fillBufferRng_real", "[utilities][for_testing]")
 
 TEST_CASE ("RandomForTest_fillVectorRngReal", "[utilities][for_testing]")
 
 TEST_CASE ("RandomForTest_getVecRngReal", "[utilities][for_testing]")
 
 TEST_CASE ("RandomForTest_fillBufferRngComplex", "[utilities][for_testing]")
 
 TEST_CASE ("RandomForTest_fillVecRngComplex", "[utilities][for_testing]")
 
 TEST_CASE ("RandomForTest_getVecRngComplex", "[utilities][for_testing]")
 
 TEST_CASE ("RandomForTest_call_operator", "[utilities][for_testing]")
 
 TEST_CASE ("FakeRandom determinism", "[utilities]")
 
 TEST_CASE ("FakeRandom set_value", "[utilities]")
 
 TEST_CASE ("FakeRandom read write", "[utilities]")
 
 TEST_CASE ("FakeRandom noops", "[utilities]")
 
 TEST_CASE ("FakeRandom clone", "[utilities]")
 
 TEST_CASE ("ModernStringUtils_strToLower", "[utilities]")
 
 TEST_CASE ("ModernStringUtils_split", "[utilities]")
 
 TEST_CASE ("ModernStringUtils_string2Real", "[utilities]")
 
 TEST_CASE ("ModernStringUtils_string2Int", "[utilities]")
 
 TEST_CASE ("ModernStringUtils_strip", "[utilities]")
 
void reset_string_output ()
 
void init_string_output ()
 
 TEST_CASE ("OutputManager basic", "[utilities]")
 
 TEST_CASE ("OutputManager output", "[utilities]")
 
 TEST_CASE ("OutputManager pause", "[utilities]")
 
 TEST_CASE ("OutputManager shutoff", "[utilities]")
 
 TEST_CASE ("parsewords_empty", "[utilities]")
 
 TEST_CASE ("parsewords", "[utilities]")
 
 TEST_CASE ("readLine", "[utilities]")
 
 TEST_CASE ("getwords", "[utilities]")
 
 TEST_CASE ("getwordsWithMergedNumbers", "[utilities]")
 
void print_vector (vector< int > &out)
 
 TEST_CASE ("FairDivideLow_one", "[utilities]")
 
 TEST_CASE ("FairDivideLow_two", "[utilities]")
 
 TEST_CASE ("FairDivideLow_three", "[utilities]")
 
 TEST_CASE ("FairDivideLow_four", "[utilities]")
 
 TEST_CASE ("FairDivideAligned", "[utilities]")
 
 TEST_CASE ("fairDivide_one", "[utilities]")
 
 TEST_CASE ("fairDivide_empties", "[utilities]")
 
 TEST_CASE ("fairDivide_typical", "[utilities]")
 
 TEST_CASE ("fairDivide_even", "[utilities]")
 
 TEST_CASE ("prime number set 32 bit", "[utilities]")
 
 TEST_CASE ("prime number set 64 bit", "[utilities]")
 
 TEST_CASE ("ProjectData", "[ohmmsapp]")
 
 TEST_CASE ("ProjectData::put no series", "[ohmmsapp]")
 
 TEST_CASE ("ProjectData::put with series", "[ohmmsapp]")
 
 TEST_CASE ("ProjectData::TestDriverVersion", "[ohmmsapp]")
 
 TEST_CASE ("ProjectData::TestIsComplex", "[ohmmsapp]")
 
 TEST_CASE ("Resource", "[utilities]")
 
 TEST_CASE ("DummyResource", "[utilities]")
 
 TEST_CASE ("ResourceCollection", "[utilities]")
 
 TEST_CASE ("make_seed", "[utilities]")
 
 TEST_CASE ("RandomNumberControl make_seeds", "[ohmmsapp]")
 
 TEST_CASE ("RandomNumberControl no random in xml", "[ohmmsapp]")
 
 TEST_CASE ("RandomNumberControl random in xml", "[ohmmsapp]")
 
template<typename T >
FakeChronoClock::duration convert_to_ns (T in)
 
 TEST_CASE ("test_runtime_manager", "[utilities]")
 
 TEST_CASE ("test_loop_timer", "[utilities]")
 
 TEST_CASE ("test_loop_control", "[utilities]")
 
 TEST_CASE ("StdRandom mt19937 determinism", "[utilities]")
 
 TEST_CASE ("StdRandom save and load", "[utilities]")
 
 TEST_CASE ("StdRandom clone", "[utilities]")
 
 TEST_CASE ("StlPrettyPrint", "[utilities]")
 
 TEST_CASE ("string_utils_streamToVec", "[utilities]")
 
template<class CLOCK >
void set_total_time (TimerType< CLOCK > *timer, double total_time_input)
 
template<class CLOCK >
void set_num_calls (TimerType< CLOCK > *timer, long num_calls_input)
 
template<typename T >
double convert_to_s (T in)
 
 TEST_CASE ("test_timer_stack", "[utilities]")
 
 TEST_CASE ("test_timer_scoped", "[utilities]")
 
 TEST_CASE ("test_timer_flat_profile", "[utilities]")
 
 TEST_CASE ("test_timer_flat_profile_same_name", "[utilities]")
 
 TEST_CASE ("test_timer_nested_profile", "[utilities]")
 
 TEST_CASE ("test_timer_nested_profile_two_children", "[utilities]")
 
 TEST_CASE ("test_timer_nested_profile_alt_routes", "[utilities]")
 
 TEST_CASE ("test_timer_nested_profile_collate", "[utilities]")
 
 TEST_CASE ("test setup timers", "[utilities]")
 
TimerManager< NewTimer > & getGlobalTimerManager ()
 
NewTimercreateGlobalTimer (const std::string &myname, timer_levels mylevel)
 
int get_level (const std::string &stack_name)
 
std::string get_leaf_name (const std::string &stack_name)
 
void pad_string (const std::string &in, std::string &out, int field_len)
 
template<typename T >
void bessel_steed_array_cpu (const int lmax, const T x, T *jl)
 Compute spherical bessel function from 0 to lmax. More...
 
template<typename T >
void det_row_update (T *restrict pinv, const T *restrict tv, int m, int rowchanged, T c_ratio, T *restrict temp, T *restrict rcopy)
 
template<typename T >
void det_col_update (T *restrict pinv, const T *restrict tv, int m, int colchanged, T c_ratio, T *restrict temp, T *restrict rcopy)
 
template<typename T >
void getRatiosByRowSubstitution (const T *restrict tm_new, const T *restrict r_replaced, T *restrict ratios, int m, int howmany)
 
template<typename T , typename INDARRAY >
void getRatiosByRowSubstitution (const T *restrict tm_new, const T *restrict r_replaced, T *restrict ratios, int m, const INDARRAY &ind)
 
template<typename T >
void getRatiosByRowSubstitution_dummy (const T *restrict tm_new, const T *restrict r_replaced, T *restrict ratios, int m, int howmany)
 
template<typename T >
getRatioByColSubstitution (const T *restrict pinv, const T *restrict tc, int m, int colchanged)
 evaluate the determinant ratio with a column substitution More...
 
template<typename MAT , typename VV >
MAT::value_type getRatioByColSubstitution (const MAT &pinv, const VV &tc, int colchanged)
 
template<typename MAT , typename VV , typename IV >
MAT::value_type getRatioByColSubstitution (const MAT &refinv, const VV &tcm, VV &ratios, int m, int colchanged, int r_replaced, IV &ind)
 evaluate the ratio with a column substitution and multiple row substitutions More...
 
void LUFactorization (int n, int m, double *restrict a, int n0, int *restrict piv)
 LU factorization of double. More...
 
void LUFactorization (int n, int m, float *restrict a, const int &n0, int *restrict piv)
 LU factorization of float. More...
 
void LUFactorization (int n, int m, std::complex< double > *restrict a, int n0, int *restrict piv)
 LU factorization of std::complex<double> More...
 
void LUFactorization (int n, int m, std::complex< float > *restrict a, int n0, int *restrict piv)
 LU factorization of complex<float> More...
 
void InvertLU (int n, double *restrict a, int n0, int *restrict piv, double *restrict work, int n1)
 Inversion of a double matrix after LU factorization. More...
 
void InvertLU (const int &n, float *restrict a, const int &n0, int *restrict piv, float *restrict work, const int &n1)
 Inversion of a float matrix after LU factorization. More...
 
void InvertLU (int n, std::complex< double > *restrict a, int n0, int *restrict piv, std::complex< double > *restrict work, int n1)
 Inversion of a std::complex<double> matrix after LU factorization. More...
 
void InvertLU (int n, std::complex< float > *restrict a, int n0, int *restrict piv, std::complex< float > *restrict work, int n1)
 Inversion of a complex<float> matrix after LU factorization. More...
 
template<class T >
Invert (T *restrict x, int n, int m, T *restrict work, int *restrict pivot)
 inverse a matrix More...
 
template<class T >
Determinant (T *restrict x, int n, int m, int *restrict pivot)
 determinant of a matrix More...
 
template<class T >
Invert (T *restrict x, int n, int m)
 inverse a matrix More...
 
template<class T , class T1 >
void InvertWithLog (T *restrict x, int n, int m, T *restrict work, int *restrict pivot, std::complex< T1 > &logdet)
 
template<class MatrixA >
MatrixA::value_type invert_matrix (MatrixA &M, bool getdet=true)
 invert a matrix More...
 
template<typename MatA , typename VecB >
MatA::value_type DetRatioByRow (const MatA &Minv, const VecB &newv, int rowchanged)
 determinant ratio with a row substitution More...
 
template<typename MatA , typename VecB >
MatA::value_type DetRatioByColumn (const MatA &Minv, const VecB &newv, int colchanged)
 determinant ratio with a column substitution More...
 
template<typename T , typename ALLOC >
void InverseUpdateByRow (Matrix< T, ALLOC > &Minv, Vector< T, ALLOC > &newrow, Vector< T, ALLOC > &rvec, Vector< T, ALLOC > &rvecinv, int rowchanged, T c_ratio)
 update a inverse matrix by a row substitution More...
 
template<typename T , typename ALLOC >
void InverseUpdateByColumn (Matrix< T, ALLOC > &Minv, Vector< T, ALLOC > &newcol, Vector< T, ALLOC > &rvec, Vector< T, ALLOC > &rvecinv, int colchanged, T c_ratio)
 
template<typename T >
void LinearFit (std::vector< T > &y, Matrix< T > &A, std::vector< T > &coefs)
 
template<class T >
std::ostream & operator<< (std::ostream &out, const OneDimGridBase< T > &rhs)
 
template<typename T >
Tensor< T, 3 > generateRotationMatrix (T rng1, T rng2, T rng3)
 Create a random 3D rotation matrix from three random numbers. More...
 
template<typename T >
smoothing (smoothing_functions func_id, T x, T &dx, T &d2x)
 
template float smoothing (smoothing_functions func_id, float x, float &dx, float &d2x)
 
template double smoothing (smoothing_functions func_id, double x, double &dx, double &d2x)
 
template<typename T , typename TRESIDUAL >
void getSplineBound (const T x, const int nmax, int &ind, TRESIDUAL &dx)
 break x into the integer part and residual part and apply bounds More...
 
 TEST_CASE ("Bessel", "[numerics]")
 
 TEST_CASE ("Cartesian Tensor", "[numerics]")
 
 TEST_CASE ("Cartesian Tensor evaluateAll subset", "[numerics]")
 
 TEST_CASE ("Cartesian Tensor evaluateWithHessian subset", "[numerics]")
 
 TEST_CASE ("Cartesian Tensor evaluateWithThirdDeriv subset", "[numerics]")
 
 TEST_CASE ("Cartesian Tensor evaluateThirdDerivOnly subset", "[numerics]")
 
 TEST_CASE ("Basic Gaussian", "[numerics]")
 
 TEST_CASE ("Gaussian Combo", "[numerics]")
 
 TEST_CASE ("Gaussian Combo P", "[numerics]")
 
 TEST_CASE ("Gaussian Combo D", "[numerics]")
 
 TEST_CASE ("double_1d_grid_functor", "[numerics]")
 
 TEST_CASE ("double_1d_grid_functor_vs_n", "[numerics]")
 
 TEST_CASE ("bracket minimum", "[numerics]")
 
 TEST_CASE ("find minimum", "[numerics]")
 
 TEST_CASE ("spline_function_1", "[numerics]")
 
 TEST_CASE ("spline_function_2", "[numerics]")
 
 TEST_CASE ("spline_function_3", "[numerics]")
 
 TEST_CASE ("spline_function_4", "[numerics]")
 
 TEST_CASE ("spline_function_5", "[numerics]")
 
 TEST_CASE ("one_dim_cubic_spline_1", "[numerics]")
 
 TEST_CASE ("test oneDimCubicSplineLinearGrid", "[numerics]")
 
 TEST_CASE ("CheckSphericalIntegration", "[numerics]")
 
 TEMPLATE_TEST_CASE ("RandomRotationMatrix", "[numerics]", float, double)
 
 TEST_CASE ("SoA Cartesian Tensor", "[numerics]")
 
 TEST_CASE ("SoA Cartesian Tensor evaluateVGL subset", "[numerics]")
 
 TEST_CASE ("SoA Cartesian Tensor evaluateVGH subset", "[numerics]")
 
template<typename T >
void test_spline_bounds ()
 
 TEST_CASE ("getSplineBound double", "[numerics]")
 
 TEST_CASE ("getSplineBound float", "[numerics]")
 
 TEST_CASE ("stdlib round", "[numerics]")
 
 TEST_CASE ("transform2gridfunctor", "[numerics]")
 
 TEST_CASE ("Legendre", "[numerics]")
 
 TEST_CASE ("Spherical Harmonics", "[numerics]")
 
 TEST_CASE ("Spherical Harmonics Many", "[numerics]")
 
 TEST_CASE ("Derivatives of Spherical Harmonics", "[numerics]")
 
 TEST_CASE ("Spherical Harmonics Wrapper", "[numerics]")
 
 TEST_CASE ("Cartesian derivatives of Spherical Harmonics", "[numerics]")
 
template<typename T >
LegendrePll (int l, T x)
 
template<typename T >
LegendrePlm (int l, int m, T x)
 
template<typename T >
std::complex< T > Ylm (int l, int m, const TinyVector< T, 3 > &r)
 calculates Ylm param[in] l angular momentum param[in] m magnetic quantum number param[in] r position vector. More...
 
template<typename T >
void derivYlmSpherical (const int l, const int m, const TinyVector< T, 3 > &r, std::complex< T > &theta_deriv, std::complex< T > &phi_deriv, const bool conj)
 calculate the derivative of a Ylm with respect to theta and phi param[in] l: angular momentum param[in] m: magnetic quantum number param[in] r: cartesian position align with [z,x,y]. More...
 
template<typename T >
std::complex< T > sphericalHarmonic (const int l, const int m, const TinyVector< T, 3 > &r)
 wrapper for Ylm, which can take any normal position vector as an argument param[in] l angular momentum param[in] m magnetic quantum number param[in] r is a position vector. More...
 
template<typename T >
void sphericalHarmonicGrad (const int l, const int m, const TinyVector< T, 3 > &r, TinyVector< std::complex< T >, 3 > &grad)
 get cartesian derivatives of spherical Harmonics. More...
 
bool isnan (float)
 return true if the value is NaN. More...
 
bool isnan (double a)
 
bool isfinite (float)
 return true if the value is finite. More...
 
bool isfinite (double a)
 
bool isinf (float)
 return true if the value is Inf. More...
 
bool isinf (double a)
 
template<typename T >
void sincos (T a, T *restrict s, T *restrict c)
 sincos function wrapper More...
 
int pow (int i, int n)
 return i^n More...
 
template<typename T , typename = typename std::enable_if<std::is_floating_point<T>::value>::type>
bool iszero (T a)
 
template<class T1 , size_t ALIGN1, class T2 , size_t ALIGN2>
bool operator== (const Mallocator< T1, ALIGN1 > &, const Mallocator< T2, ALIGN2 > &)
 
template<class T1 , size_t ALIGN1, class T2 , size_t ALIGN2>
bool operator!= (const Mallocator< T1, ALIGN1 > &, const Mallocator< T2, ALIGN2 > &)
 
std::atomic< size_t > CUDAallocator_device_mem_allocated (0)
 
size_t getCUDAdeviceMemAllocated ()
 
template<class T1 , class T2 >
bool operator== (const CUDAManagedAllocator< T1 > &, const CUDAManagedAllocator< T2 > &)
 
template<class T1 , class T2 >
bool operator!= (const CUDAManagedAllocator< T1 > &, const CUDAManagedAllocator< T2 > &)
 
template<class T1 , class T2 >
bool operator== (const CUDAAllocator< T1 > &, const CUDAAllocator< T2 > &)
 
template<class T1 , class T2 >
bool operator!= (const CUDAAllocator< T1 > &, const CUDAAllocator< T2 > &)
 
template<class T1 , class T2 >
bool operator== (const CUDAHostAllocator< T1 > &, const CUDAHostAllocator< T2 > &)
 
template<class T1 , class T2 >
bool operator!= (const CUDAHostAllocator< T1 > &, const CUDAHostAllocator< T2 > &)
 
template<typename T >
void CUDAfill_n (T *ptr, size_t n, const T &value)
 fill device memory with a given value. More...
 
template void CUDAfill_n< int > (int *ptr, size_t n, const int &value)
 
template void CUDAfill_n< size_t > (size_t *ptr, size_t n, const size_t &value)
 
template void CUDAfill_n< float > (float *ptr, size_t n, const float &value)
 
template void CUDAfill_n< double > (double *ptr, size_t n, const double &value)
 
template void CUDAfill_n< std::complex< float > > (std::complex< float > *ptr, size_t n, const std::complex< float > &value)
 
template void CUDAfill_n< std::complex< double > > (std::complex< double > *ptr, size_t n, const std::complex< double > &value)
 
template<typename T >
CUDATypeMap< T > castCUDAType (T var)
 
std::atomic< size_t > dual_device_mem_allocated (0)
 
size_t getDualDeviceMemAllocated ()
 
int determineDefaultDeviceNum (int num_devices, int rank_id, int num_ranks)
 distribute MPI ranks among devices More...
 
std::ostream & app_summary ()
 
std::ostream & app_log ()
 
std::ostream & app_error ()
 
std::ostream & app_warning ()
 
std::ostream & app_debug_stream ()
 
void print_mem (const std::string &title, std::ostream &log)
 
std::atomic< size_t > OMPallocator_device_mem_allocated (0)
 
size_t getOMPdeviceMemAllocated ()
 
template<typename T >
T * getOffloadDevicePtr (T *host_ptr)
 
template<typename T >
hipblasTypeMap< T > casthipblasType (T var)
 
std::atomic< size_t > SYCLallocator_device_mem_allocated (0)
 
size_t getSYCLdeviceMemAllocated ()
 
template<class T1 , class T2 >
bool operator== (const SYCLSharedAllocator< T1 > &, const SYCLSharedAllocator< T2 > &)
 
template<class T1 , class T2 >
bool operator!= (const SYCLSharedAllocator< T1 > &, const SYCLSharedAllocator< T2 > &)
 
template<class T1 , class T2 >
bool operator== (const SYCLAllocator< T1 > &, const SYCLAllocator< T2 > &)
 
template<class T1 , class T2 >
bool operator!= (const SYCLAllocator< T1 > &, const SYCLAllocator< T2 > &)
 
template<class T1 , class T2 >
bool operator== (const SYCLHostAllocator< T1 > &, const SYCLHostAllocator< T2 > &)
 
template<class T1 , class T2 >
bool operator!= (const SYCLHostAllocator< T1 > &, const SYCLHostAllocator< T2 > &)
 
sycl::queuegetSYCLDefaultDeviceDefaultQueue ()
 return a reference to the per-device default queue More...
 
sycl::queue createSYCLInOrderQueueOnDefaultDevice ()
 create an in-order queue using the default device More...
 
sycl::queue createSYCLQueueOnDefaultDevice ()
 create a out-of-order queue using the default device More...
 
size_t getSYCLdeviceFreeMem ()
 query free memory on the default device More...
 
 TEST_CASE ("Aligned allocator", "[numerics]")
 
template<unsigned int N, typename T >
void test_e2iphi ()
 
 TEST_CASE ("e2iphi", "[numerics]")
 
template<typename T >
void test_isnan ()
 
 TEST_CASE ("isnan", "[numerics]")
 
 TEST_CASE ("CUDA_allocators", "[CUDA]")
 
 TEST_CASE ("OMPclass member", "[OMP]")
 
 TEST_CASE ("OMPdeepcopy", "[OMP]")
 
 TEST_CASE ("OMPmath", "[OMP]")
 
template<typename T >
void test_gemm (const int M, const int N, const int K, const char transa, const char transb)
 
 TEST_CASE ("ompBLAS gemm", "[OMP]")
 
template<typename T >
void test_gemv (const int M_b, const int N_b, const char trans)
 
template<typename T >
void test_gemv_batched (const int M_b, const int N_b, const char trans, const int batch_count)
 
 TEST_CASE ("ompBLAS gemv", "[OMP]")
 
 TEST_CASE ("ompBLAS gemv notrans", "[OMP]")
 
template<typename T >
void test_ger (const int M, const int N)
 
template<typename T >
void test_ger_batched (const int M, const int N, const int batch_count)
 
 TEST_CASE ("ompBLAS ger", "[OMP]")
 
 TEST_CASE ("OMP runtime memory", "[OMP]")
 
 TEST_CASE ("SYCL_allocator", "[SYCL]")
 
 TEST_CASE ("SYCL_host_allocator", "[SYCL]")
 
 TEST_CASE ("OmpBLAS gemv", "[SYCL]")
 
 TEST_CASE ("OmpBLAS gemv notrans", "[SYCL]")
 
 TEST_CASE ("OmpBLAS ger", "[SYCL]")
 
template<PlatformKind PL, typename T >
void test_one_gemm (const int M, const int N, const int K, const char transa, const char transb)
 
template<PlatformKind PL>
void test_gemm_cases ()
 
template<PlatformKind PL, typename T >
void test_one_gemv (const int M_b, const int N_b, const char trans)
 
template<PlatformKind PL>
void test_gemv_cases ()
 
template<PlatformKind PL, typename T >
void test_one_ger (const int M, const int N)
 
template<PlatformKind PL>
void test_ger_cases ()
 
 TEST_CASE ("AccelBLAS", "[BLAS]")
 
 TEST_CASE ("PlatformSelector", "[platform]")
 
template<typename CT >
void cancel (CT &r)
 
template<typename T >
void bcast (T &a, Communicate *comm)
 
 TEST_CASE ("test_communicate_split_one", "[message]")
 
 TEST_CASE ("test_communicate_split_two", "[message]")
 
 TEST_CASE ("test_communicate_split_four", "[message]")
 
void mpiTestFunctionWrapped (Communicate *comm, std::vector< double > &fake_args)
 Openmp generally works but is not guaranteed with std::atomic. More...
 
 TEST_CASE ("MPIExceptionWrapper function case", "[Utilities]")
 
 TEST_CASE ("MPIExceptionWrapper lambda case", "[Utilities]")
 
std::unique_ptr< DistanceTablecreateDistanceTableAA (ParticleSet &s, std::ostream &description)
 Class to manage multiple DistanceTable objects. More...
 
std::unique_ptr< DistanceTablecreateDistanceTableAAOMPTarget (ParticleSet &s, std::ostream &description)
 Adding SymmetricDTD to the list, e.g., el-el distance table. More...
 
std::unique_ptr< DistanceTablecreateDistanceTable (ParticleSet &s, std::ostream &description)
 
std::unique_ptr< DistanceTablecreateDistanceTableAB (const ParticleSet &s, ParticleSet &t, std::ostream &description)
 free function create a distable table of s-t More...
 
std::unique_ptr< DistanceTablecreateDistanceTableABOMPTarget (const ParticleSet &s, ParticleSet &t, std::ostream &description)
 Adding AsymmetricDTD to the list, e.g., el-el distance table. More...
 
std::unique_ptr< DistanceTablecreateDistanceTable (const ParticleSet &s, ParticleSet &t, std::ostream &description)
 
constexpr bool operator & (DTModes x, DTModes y)
 
constexpr DTModes operator| (DTModes x, DTModes y)
 
constexpr DTModes operator~ (DTModes x)
 
DTModesoperator|= (DTModes &x, DTModes y)
 
std::unique_ptr< DynamicCoordinatescreateDynamicCoordinates (const DynamicCoordinateKind kind)
 create DynamicCoordinates based on kind More...
 
template<typename T , unsigned D>
void put2box (ParticleAttrib< TinyVector< T, D >> &inout)
 inout[i]=inout[i]-floor(inout[i]) More...
 
template<typename T , unsigned D>
void put2box (const ParticleAttrib< TinyVector< T, D >> &in, ParticleAttrib< TinyVector< T, D >> &out)
 out[i]=in[i]-floor(in[i]) More...
 
template<typename T >
TinyVector< T, 3 > lower_bound (const TinyVector< T, 3 > &a, const TinyVector< T, 3 > &b)
 helper function to determine the lower bound of a domain (need to move up) More...
 
template<typename T >
TinyVector< T, 3 > upper_bound (const TinyVector< T, 3 > &a, const TinyVector< T, 3 > &b)
 helper function to determine the upper bound of a domain (need to move up) More...
 
template<class T , unsigned D>
bool operator== (const CrystalLattice< T, D > &lhs, const CrystalLattice< T, D > &rhs)
 
template<class T , unsigned D>
bool operator!= (const CrystalLattice< T, D > &lhs, const CrystalLattice< T, D > &rhs)
 
template<typename T >
bool found_shorter_base (TinyVector< TinyVector< T, 3 >, 3 > &rb)
 
template<typename T >
void find_reduced_basis (TinyVector< TinyVector< T, 3 >, 3 > &rb)
 
 TEST_CASE ("Crystal_lattice_periodic_bulk", "[lattice]")
 Lattice is defined but Open BC is also used. More...
 
 TEST_CASE ("LRBreakupParameters", "[lattice]")
 Lattice is defined but Open BC is also used. More...
 
 TEST_CASE ("open_bconds", "[lattice]")
 
 TEST_CASE ("periodic_bulk_bconds", "[lattice]")
 Lattice is defined but Open BC is also used. More...
 
 TEST_CASE ("uniform 3D Lattice layout", "[lattice]")
 
template<typename T >
std::unique_ptr< OneDimCubicSpline< T > > createSpline4RbyVs_temp (const LRHandlerBase *aLR, T rcut, const LinearGrid< T > &agrid)
 
template<typename T >
std::unique_ptr< OneDimCubicSpline< T > > createSpline4RbyVsDeriv_temp (const LRHandlerBase *aLR, T rcut, const LinearGrid< T > &agrid)
 
 TEST_CASE ("ewald3d", "[lrhandler]")
 evalaute bare Coulomb using EwaldHandler3D More...
 
 TEST_CASE ("ewald3d df", "[lrhandler]")
 evalaute bare Coulomb derivative using EwaldHandler3D More...
 
 TEST_CASE ("kcontainer at gamma in 3D", "[longrange]")
 
 TEST_CASE ("kcontainer at twist in 3D", "[longrange]")
 
 TEST_CASE ("kcontainer at gamma in 2D", "[longrange]")
 
 TEST_CASE ("kcontainer at twist in 2D", "[longrange]")
 
 TEST_CASE ("dummy", "[lrhandler]")
 evalaute bare Coulomb using DummyLRHandler More...
 
 TEST_CASE ("srcoul", "[lrhandler]")
 evalaute bare Coulomb in 3D More...
 
 TEST_CASE ("srcoul df", "[lrhandler]")
 evalaute bare Coulomb derivative in 3D More...
 
 TEST_CASE ("StructFact", "[lrhandler]")
 evalaute bare Coulomb in 3D using LRHandlerTemp More...
 
 TEST_CASE ("temp3d", "[lrhandler]")
 evalaute bare Coulomb in 3D using LRHandlerTemp More...
 
template<class T1 >
MakeReturn< UnaryNode< OpUnaryMinus, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t > >::Expression_t operator- (const ParticleAttrib< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< OpUnaryPlus, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t > >::Expression_t operator+ (const ParticleAttrib< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< OpBitwiseNot, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t > >::Expression_t operator~ (const ParticleAttrib< T1 > &l)
 
template<class T1 >
MakeReturn< UnaryNode< OpIdentity, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t > >::Expression_t PETE_identity (const ParticleAttrib< T1 > &l)
 
template<class T1 , class T2 >
MakeReturn< UnaryNode< OpCast< T1 >, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t peteCast (const T1 &, const ParticleAttrib< T2 > &l)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator+ (const ParticleAttrib< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator- (const ParticleAttrib< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator* (const ParticleAttrib< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator% (const ParticleAttrib< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator & (const ParticleAttrib< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator| (const ParticleAttrib< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator^ (const ParticleAttrib< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator+ (const ParticleAttrib< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator- (const ParticleAttrib< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator* (const ParticleAttrib< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator% (const ParticleAttrib< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator & (const ParticleAttrib< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator| (const ParticleAttrib< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator^ (const ParticleAttrib< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator+ (const Expression< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator- (const Expression< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator* (const Expression< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator% (const Expression< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator & (const Expression< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator| (const Expression< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator^ (const Expression< T1 > &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator+ (const ParticleAttrib< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator- (const ParticleAttrib< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator* (const ParticleAttrib< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator% (const ParticleAttrib< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator & (const ParticleAttrib< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator| (const ParticleAttrib< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator^ (const ParticleAttrib< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator+ (const T1 &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator- (const T1 &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator* (const T1 &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpMod, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator% (const T1 &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator & (const T1 &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator| (const T1 &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< ParticleAttrib< T2 > >::Leaf_t > >::Expression_t operator^ (const T1 &l, const ParticleAttrib< T2 > &r)
 
template<class T1 , class T2 , class T3 >
MakeReturn< TrinaryNode< FnWhere, typename CreateLeaf< ParticleAttrib< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t, typename CreateLeaf< T3 >::Leaf_t > >::Expression_t where (const ParticleAttrib< T1 > &c, const T2 &t, const T3 &f)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator & (const Expression< T1 > &l, const Expression< T2 > &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator & (const Expression< T1 > &l, const T2 &r)
 
template<class T1 , class T2 >
MakeReturn< BinaryNode< OpBitwiseAnd, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator & (const T1 &l, const Expression< T2 > &r)
 
template<class T1 , class RHS >
ParticleAttrib< T1 > & assign (ParticleAttrib< T1 > &lhs, const RHS &rhs)
 
template<class T1 , class RHS >
ParticleAttrib< T1 > & operator+= (ParticleAttrib< T1 > &lhs, const RHS &rhs)
 
template<class T1 , class RHS >
ParticleAttrib< T1 > & operator-= (ParticleAttrib< T1 > &lhs, const RHS &rhs)
 
template<class T1 , class RHS >
ParticleAttrib< T1 > & operator*= (ParticleAttrib< T1 > &lhs, const RHS &rhs)
 
template<class T1 , class RHS >
ParticleAttrib< T1 > & operator%= (ParticleAttrib< T1 > &lhs, const RHS &rhs)
 
template<class T1 , class RHS >
ParticleAttrib< T1 > & operator|= (ParticleAttrib< T1 > &lhs, const RHS &rhs)
 
template<class T1 , class RHS >
ParticleAttrib< T1 > & operator &= (ParticleAttrib< T1 > &lhs, const RHS &rhs)
 
template<class T1 , class RHS >
ParticleAttrib< T1 > & operator^= (ParticleAttrib< T1 > &lhs, const RHS &rhs)
 
template<class T , class Op , class RHS >
void evaluate (ParticleAttrib< T > &lhs, const Op &op, const Expression< RHS > &rhs)
 
template<class T >
std::ostream & operator<< (std::ostream &out, const ParticleAttrib< T > &rhs)
 
template<class T , unsigned D>
T * get_first_address (ParticleAttrib< TinyVector< T, D >> &a)
 
template<class T , unsigned D>
T * get_last_address (ParticleAttrib< TinyVector< T, D >> &a)
 
template<class T , unsigned D>
void normalize (ParticleAttrib< TinyVector< T, D >> &pa)
 
template<typename T , unsigned D>
Dot (const ParticleAttrib< TinyVector< T, D >> &pa, const ParticleAttrib< TinyVector< T, D >> &pb)
 
template<typename T , unsigned D>
Dot (const ParticleAttrib< TinyVector< std::complex< T >, D >> &pa, const ParticleAttrib< TinyVector< std::complex< T >, D >> &pb)
 
template<typename T , unsigned D>
std::complex< T > CplxDot (const ParticleAttrib< TinyVector< std::complex< T >, D >> &pa, const ParticleAttrib< TinyVector< std::complex< T >, D >> &pb)
 
template<unsigned D>
double Dot_CC (const ParticleAttrib< TinyVector< std::complex< double >, D >> &pa, const ParticleAttrib< TinyVector< std::complex< double >, D >> &pb)
 
template<typename T >
Sum (const ParticleAttrib< T > &pa)
 
template<typename T >
Sum (const ParticleAttrib< std::complex< T >> &pa)
 
template<typename T >
std::complex< T > CplxSum (const ParticleAttrib< std::complex< T >> &pa)
 
template<class T , unsigned D>
void Copy (const ParticleAttrib< TinyVector< std::complex< T >, D >> &c, ParticleAttrib< TinyVector< T, D >> &r)
 
template<class T , unsigned D>
void Copy (const ParticleAttrib< TinyVector< T, D >> &c, ParticleAttrib< TinyVector< T, D >> &r)
 
template<class PL , class PV >
void convert (const PL &lat, const PV &pin, PV &pout)
 
template<class PL , class PV >
void convert2Cart (const PL &lat, PV &pin)
 
template<class PL , class PV >
void convert2Unit (const PL &lat, PV &pin)
 
template<class PL , class PV >
void wrapAroundBox (const PL &lat, const PV &pin, PV &pout)
 
std::ostream & operator<< (std::ostream &o_stream, PosUnit pos_unit)
 write unit type in human readable format More...
 
std::istream & operator>> (std::istream &i_stream, PosUnit &pos_unit)
 Read unit type recorded in int. More...
 
template<class T , class RG >
void assignGaussRand (T *restrict a, unsigned n, RG &rng)
 
template<class T , class RG >
void assignUniformRand (T *restrict a, unsigned n, RG &rng)
 
template<typename T , unsigned D, class RG >
void makeGaussRandomWithEngine (ParticleAttrib< TinyVector< T, D >> &a, RG &rng)
 
template<typename T , unsigned D, class RG >
void makeGaussRandomWithEngine (std::vector< TinyVector< T, D >> &a, RG &rng)
 
template<typename T , class RG >
void makeGaussRandomWithEngine (std::vector< T > &a, RG &rng)
 
template<typename T , class RG >
void makeGaussRandomWithEngine (ParticleAttrib< T > &a, RG &rng)
 
template<CoordsType CT, class RG >
void makeGaussRandomWithEngine (MCCoords< CT > &a, RG &rng)
 
template<typename T , unsigned D>
void makeGaussRandom (std::vector< TinyVector< T, D >> &a)
 
template<typename T , unsigned D>
void makeGaussRandom (Matrix< TinyVector< T, D >> &a)
 specialized functions: stick to overloading More...
 
template<typename T , unsigned D>
void makeGaussRandom (ParticleAttrib< TinyVector< T, D >> &a)
 
template<typename T >
void makeGaussRandom (ParticleAttrib< T > &a)
 
template<typename T , unsigned D>
void makeUniformRandom (ParticleAttrib< TinyVector< T, D >> &a)
 
template<typename T >
void makeUniformRandom (ParticleAttrib< T > &a)
 
template<typename T >
void makeSphereRandom (ParticleAttrib< TinyVector< T, 3 >> &a)
 
template<typename T >
void makeSphereRandom (ParticleAttrib< TinyVector< T, 2 >> &a)
 
template<unsigned int D>
void double_test_case ()
 
 TEST_CASE ("particle_attrib_ops_double", "[particle_base]")
 
template<unsigned int D>
void complex_test_case ()
 
 TEST_CASE ("particle_attrib_ops_complex", "[particle_base]")
 
 TEST_CASE ("particle_attrib_scalar", "[particle_base]")
 
 TEST_CASE ("particle_attrib_vector", "[particle_base]")
 
 TEST_CASE ("gaussian random array length 1", "[particle_base]")
 
 TEST_CASE ("gaussian random array length 2", "[particle_base]")
 
 TEST_CASE ("gaussian random array length 3", "[particle_base]")
 
 TEST_CASE ("gaussian random particle attrib array length 1", "[particle_base]")
 
 TEST_CASE ("gaussian random input one", "[particle_base]")
 
 TEST_CASE ("gaussian random input zero", "[particle_base]")
 
std::vector< double > gauss_random_vals (size_test *3+(size_test *3) % 2+size_test)
 
 makeGaussRandomWithEngine (gauss_random_vals, rng)
 
 makeGaussRandomWithEngine (mc_coords_rs, rng)
 
 checkRs (mc_coords_rs.positions)
 
 makeGaussRandomWithEngine (mc_coords_rsspins, rng)
 
 checkRs (mc_coords_rsspins.positions)
 
 for (int i=0;i< size_test;++i) CHECK(Approx(gauss_random_vals[offset_for_rs+i])
 
 TEST_CASE ("read_lattice_xml", "[particle_io][xml]")
 
 TEST_CASE ("read_lattice_xml_lrhandle", "[particle_io][xml]")
 
 TEST_CASE ("read_particleset_xml", "[particle_io][xml]")
 
 TEST_CASE ("read_particleset_recorder_xml", "[particle_io][xml]")
 
 TEST_CASE ("read_dynamic_spin_eset_xml", "[particle_io][xml]")
 
 TEST_CASE ("read_particle_mass_same_xml", "[particle_io][xml]")
 
void setSpeciesProperty (SpeciesSet &tspecies, int sid, xmlNodePtr cur)
 set the property of a SpeciesSet More...
 
static const TimerNameList_t< PSetTimersgeneratePSetTimerNames (std::string &obj_name)
 
template void ParticleSet::mw_makeMove< CoordsType::POS > (const RefVectorWithLeader< ParticleSet > &p_list, Index_t iat, const MCCoords< CoordsType::POS > &displs)
 
template void ParticleSet::mw_makeMove< CoordsType::POS_SPIN > (const RefVectorWithLeader< ParticleSet > &p_list, Index_t iat, const MCCoords< CoordsType::POS_SPIN > &displs)
 
template void ParticleSet::mw_accept_rejectMove< CoordsType::POS > (const RefVectorWithLeader< ParticleSet > &p_list, Index_t iat, const std::vector< bool > &isAccepted, bool forward_mode)
 
template void ParticleSet::mw_accept_rejectMove< CoordsType::POS_SPIN > (const RefVectorWithLeader< ParticleSet > &p_list, Index_t iat, const std::vector< bool > &isAccepted, bool forward_mode)
 
template void PSdispatcher::flex_makeMove< CoordsType::POS > (const RefVectorWithLeader< ParticleSet > &p_list, int iat, const MCCoords< CoordsType::POS > &displs) const
 
template void PSdispatcher::flex_makeMove< CoordsType::POS_SPIN > (const RefVectorWithLeader< ParticleSet > &p_list, int iat, const MCCoords< CoordsType::POS_SPIN > &displs) const
 
template void PSdispatcher::flex_accept_rejectMove< CoordsType::POS > (const RefVectorWithLeader< ParticleSet > &p_list, int iat, const std::vector< bool > &isAccepted, bool forward_mode) const
 
template void PSdispatcher::flex_accept_rejectMove< CoordsType::POS_SPIN > (const RefVectorWithLeader< ParticleSet > &p_list, int iat, const std::vector< bool > &isAccepted, bool forward_mode) const
 
 TEST_CASE ("distance_open_z", "[distance_table][xml]")
 
 TEST_CASE ("distance_open_xy", "[distance_table][xml]")
 
 TEST_CASE ("distance_open_species_deviation", "[distance_table][xml]")
 
SimulationCell parse_pbc_fcc_lattice ()
 
SimulationCell parse_pbc_lattice ()
 
void parse_electron_ion_pbc_z (ParticleSet &ions, ParticleSet &electrons)
 
 TEST_CASE ("distance_pbc_z", "[distance_table][xml]")
 
void test_distance_pbc_z_batched_APIs (DynamicCoordinateKind test_kind)
 
void test_distance_fcc_pbc_z_batched_APIs (DynamicCoordinateKind test_kind)
 
 TEST_CASE ("distance_pbc_z batched APIs", "[distance_table][xml]")
 
void test_distance_pbc_z_batched_APIs_ee_NEED_TEMP_DATA_ON_HOST (DynamicCoordinateKind test_kind)
 
 TEST_CASE ("distance_pbc_z batched APIs ee NEED_TEMP_DATA_ON_HOST", "[distance_table][xml]")
 
 TEST_CASE ("test_distance_pbc_diamond", "[distance_table][xml]")
 
 TEST_CASE ("DTModes", "[particle]")
 
 TEST_CASE ("MCCoords", "[Particle]")
 
 TEST_CASE ("ParticleSetPool", "[qmcapp]")
 
 TEST_CASE ("ParticleSetPool random", "[qmcapp]")
 
 TEST_CASE ("ParticleSetPool putLattice", "[qmcapp]")
 
 TEST_CASE ("ParticleSet distance table management", "[particle]")
 
 TEST_CASE ("symmetric_distance_table OpenBC", "[particle]")
 
 TEST_CASE ("symmetric_distance_table PBC", "[particle]")
 
 TEST_CASE ("particle set lattice with vacuum", "[particle]")
 
 TEST_CASE ("SampleStack", "[particle]")
 
 TEST_CASE ("SoaDistanceTableAA compute_size", "[distance_table]")
 
 TEST_CASE ("VirtualParticleSet", "[particle]")
 
 TEST_CASE ("walker", "[particle]")
 
 TEST_CASE ("walker assumptions", "[particle]")
 Currently significant amounts of code assumes that the Walker by default has "Properties" ending with the LOCALPOTENTIAL element. More...
 
 TEST_CASE ("walker HDF read and write", "[particle]")
 
 TEST_CASE ("walker buffer add, update, restore", "[particle]")
 
template<class RealType , class PA >
std::ostream & operator<< (std::ostream &out, const Walker< RealType, PA > &rhs)
 
std::string make_bandinfo_filename (const std::string &root, int spin, int twist, const Tensor< int, 3 > &tilematrix, int gid)
 
std::string make_bandgroup_name (const std::string &root, int spin, int twist, const Tensor< int, 3 > &tilematrix, int first, int last)
 
template<typename T >
SymTrace (T h00, T h01, T h02, T h11, T h12, T h22, const T gg[6])
 compute Trace(H*G) More...
 
template<typename T >
v_m_v (T h00, T h01, T h02, T h11, T h12, T h22, T g1x, T g1y, T g1z, T g2x, T g2y, T g2z)
 compute vector[3]^T x matrix[3][3] x vector[3] More...
 
template<typename T >
t3_contract (T h000, T h001, T h002, T h011, T h012, T h022, T h111, T h112, T h122, T h222, T g1x, T g1y, T g1z, T g2x, T g2y, T g2z, T g3x, T g3y, T g3z)
 Coordinate transform for a 3rd rank symmetric tensor representing coordinate derivatives (hence t3_contract, for contraction with vectors). More...
 
template<typename ST >
std::unique_ptr< BsplineReadercreateBsplineComplex (EinsplineSetBuilder *e, bool hybrid_rep, const std::string &useGPU)
 create a reader which handles complex (double size real) splines, C2R or C2C case spline storage and computation precision is ST More...
 
std::unique_ptr< BsplineReadercreateBsplineComplex (EinsplineSetBuilder *e, bool use_single, bool hybrid_rep, const std::string &useGPU)
 create a reader which handles complex (double size real) splines, C2R or C2C case spline storage and computation precision is double More...
 
std::unique_ptr< BsplineReadercreateBsplineReal (EinsplineSetBuilder *e, bool use_single, bool hybrid_rep, const std::string &useGPU)
 create a reader which handles real splines, R2R case spline storage and computation precision is double More...
 
template<typename ST >
std::unique_ptr< BsplineReadercreateBsplineReal (EinsplineSetBuilder *e, bool hybrid_rep, const std::string &useGPU)
 create a reader which handles real splines, R2R case spline storage and computation precision is ST More...
 
template<typename T >
void unpack4fftw (const Vector< std::complex< T >> &cG, const std::vector< TinyVector< int, 3 >> &gvecs, const TinyVector< int, 3 > &maxg, Array< std::complex< T >, 3 > &fftbox)
 unpack packed cG to fftbox More...
 
template<typename T , typename T1 , typename T2 >
void fix_phase_rotate_c2r (Array< std::complex< T >, 3 > &in, Array< T1, 3 > &out, const TinyVector< T2, 3 > &twist, T &phase_r, T &phase_i)
 rotate the state after 3dfft More...
 
template<typename T , typename T1 , typename T2 >
void fix_phase_rotate_c2c (const Array< std::complex< T >, 3 > &in, Array< std::complex< T1 >, 3 > &out, const TinyVector< T2, 3 > &twist)
 
template<typename T , typename T1 , typename T2 >
void fix_phase_rotate_c2c (const Array< std::complex< T >, 3 > &in, Array< T1, 3 > &out_r, Array< T1, 3 > &out_i, const TinyVector< T2, 3 > &twist, T &phase_r, T &phase_i)
 
template<typename T , typename T1 >
void split_real_components_c2c (const Array< std::complex< T >, 3 > &in, Array< T1, 3 > &out_r, Array< T1, 3 > &out_i)
 Split FFTs into real/imaginary components. More...
 
template<typename T >
compute_norm (const Vector< std::complex< T >> &cG)
 Compute the norm of an orbital. More...
 
template<typename T , typename T2 >
void compute_phase (const Array< std::complex< T >, 3 > &in, const TinyVector< T2, 3 > &twist, T &phase_r, T &phase_i)
 Compute the phase factor for rotation. More...
 
template<typename T >
void fix_phase_rotate (const Array< std::complex< T >, 3 > &e2pi, Array< std::complex< T >, 3 > &in, Array< T, 3 > &out)
 rotate the state after 3dfft More...
 
template<typename T >
TinyVector< T, 3 > IntPart (const TinyVector< T, 3 > &twist)
 
template<typename T >
TinyVector< T, 3 > FracPart (const TinyVector< T, 3 > &twist)
 
bool sortByIndex (BandInfo leftB, BandInfo rightB)
 
template<typename T >
sycl::event applyW_stageV_sycl (sycl::queue &aq, const int *restrict delay_list_gpu, const int delay_count, T *restrict temp_gpu, const int numorbs, const int ndelay, T *restrict V_gpu, const T *restrict Ainv, const std::vector< sycl::event > &dependencies)
 
template sycl::event applyW_stageV_sycl (sycl::queue &aq, const int *restrict delay_list_gpu, const int delay_count, float *restrict temp_gpu, const int numorbs, const int ndelay, float *restrict V_gpu, const float *restrict Ainv, const std::vector< sycl::event > &dependencies)
 
template sycl::event applyW_stageV_sycl (sycl::queue &aq, const int *restrict delay_list_gpu, const int delay_count, double *restrict temp_gpu, const int numorbs, const int ndelay, double *restrict V_gpu, const double *restrict Ainv, const std::vector< sycl::event > &dependencies)
 
template sycl::event applyW_stageV_sycl (sycl::queue &aq, const int *restrict delay_list_gpu, const int delay_count, std::complex< float > *restrict temp_gpu, const int numorbs, const int ndelay, std::complex< float > *restrict V_gpu, const std::complex< float > *restrict Ainv, const std::vector< sycl::event > &dependencies)
 
template sycl::event applyW_stageV_sycl (sycl::queue &aq, const int *restrict delay_list_gpu, const int delay_count, std::complex< double > *restrict temp_gpu, const int numorbs, const int ndelay, std::complex< double > *restrict V_gpu, const std::complex< double > *restrict Ainv, const std::vector< sycl::event > &dependencies)
 
template<typename T , typename TMAT , typename INDEX >
std::complex< T > computeLogDet_sycl (sycl::queue &aq, int n, int lda, const TMAT *restrict a, const INDEX *restrict pivot, const std::vector< sycl::event > &dependencies)
 
template std::complex< double > computeLogDet_sycl (sycl::queue &aq, int n, int lda, const double *restrict a, const std::int64_t *restrict pivot, const std::vector< sycl::event > &dependencies)
 
template std::complex< double > computeLogDet_sycl (sycl::queue &aq, int n, int lda, const std::complex< double > *restrict a, const std::int64_t *restrict pivot, const std::vector< sycl::event > &dependencies)
 
template<typename T >
sycl::event applyW_stageV_sycl (sycl::queue &aq, const int *delay_list_gpu, const int delay_count, T *temp_gpu, const int numorbs, const int ndelay, T *V_gpu, const T *Ainv, const std::vector< sycl::event > &dependencies={})
 
template<typename T , typename TMAT , typename INDEX >
std::complex< T > computeLogDet_sycl (sycl::queue &aq, int n, int lda, const TMAT *a, const INDEX *pivot, const std::vector< sycl::event > &dependencies={})
 
std::ostream & operator<< (std::ostream &out, const ci_configuration &c)
 
std::ostream & operator<< (std::ostream &out, const ci_configuration2 &c)
 
int Xgetrf (int n, int m, float *restrict a, int lda, int *restrict piv)
 wrappers around xgetrf lapack routines More...
 
int Xgetrf (int n, int m, std::complex< float > *restrict a, int lda, int *restrict piv)
 
int Xgetrf (int n, int m, double *restrict a, int lda, int *restrict piv)
 
int Xgetrf (int n, int m, std::complex< double > *restrict a, int lda, int *restrict piv)
 
int Xgetri (int n, float *restrict a, int lda, int *restrict piv, float *restrict work, int &lwork)
 inversion of a float matrix after lu factorization More...
 
int Xgetri (int n, std::complex< float > *restrict a, int lda, int *restrict piv, std::complex< float > *restrict work, int &lwork)
 
int Xgetri (int n, double *restrict a, int lda, int *restrict piv, double *restrict work, int &lwork)
 
int Xgetri (int n, std::complex< double > *restrict a, int lda, int *restrict piv, std::complex< double > *restrict work, int &lwork)
 inversion of a std::complex<double> matrix after lu factorization More...
 
template<typename T , typename T_FP >
void computeLogDet (const T *restrict diag, int n, const int *restrict pivot, std::complex< T_FP > &logdet)
 
size_t flat_idx (const int i, const int a, const int n)
 
template<typename VALUE >
VALUE calcSmallDeterminant (size_t n, const VALUE *table_matrix, const int *it, const size_t nb_cols)
 
bool Include (int i, int j, int k)
 
bool Include (int i, int j)
 
template<class T >
bool putContent2 (std::vector< T > &a, xmlNodePtr cur)
 
bool readCuspInfo (const std::string &cuspInfoFile, const std::string &objectName, int OrbitalSetSize, Matrix< CuspCorrectionParameters > &info)
 Read cusp correction parameters from XML file. More...
 
void saveCusp (const std::string &filename, const Matrix< CuspCorrectionParameters > &info, const std::string &id)
 save cusp correction info to a file. More...
 
void broadcastCuspInfo (CuspCorrectionParameters &param, Communicate &Comm, int root)
 Broadcast cusp correction parameters. More...
 
void splitPhiEta (int center, const std::vector< bool > &corrCenter, LCAOrbitalSet &phi, LCAOrbitalSet &eta)
 Divide molecular orbital into atomic S-orbitals on this center (phi), and everything else (eta). More...
 
void removeSTypeOrbitals (const std::vector< bool > &corrCenter, LCAOrbitalSet &Phi)
 Remove S atomic orbitals from all molecular orbitals on all centers. More...
 
void computeRadialPhiBar (ParticleSet *targetP, ParticleSet *sourceP, int curOrb_, int curCenter_, SPOSet *Phi, Vector< QMCTraits::RealType > &xgrid, Vector< QMCTraits::RealType > &rad_orb, const CuspCorrectionParameters &data)
 Compute the radial part of the corrected wavefunction. More...
 
RealType getOneIdealLocalEnergy (RealType r, RealType Z, RealType beta0)
 Ideal local energy at one point. More...
 
void getIdealLocalEnergy (const ValueVector &pos, RealType Z, RealType Rc, RealType ELorigAtRc, ValueVector &ELideal)
 Ideal local energy at a vector of points. More...
 
void evalX (RealType valRc, GradType gradRc, ValueType lapRc, RealType Rc, RealType Z, RealType C, RealType valAtZero, RealType eta0, TinyVector< ValueType, 5 > &X)
 Evaluate various orbital quantities that enter as constraints on the correction. More...
 
void X2alpha (const TinyVector< ValueType, 5 > &X, RealType Rc, TinyVector< ValueType, 5 > &alpha)
 Convert constraints to polynomial parameters. More...
 
RealType getZeff (RealType Z, RealType etaAtZero, RealType phiBarAtZero)
 Effective nuclear charge to keep effective local energy finite at zero. More...
 
RealType phiBar (const CuspCorrection &cusp, RealType r, OneMolecularOrbital &phiMO)
 
void getCurrentLocalEnergy (const ValueVector &pos, RealType Zeff, RealType Rc, RealType originalELatRc, CuspCorrection &cusp, OneMolecularOrbital &phiMO, ValueVector &ELcurr)
 Compute effective local energy at vector of points. More...
 
RealType getOriginalLocalEnergy (const ValueVector &pos, RealType Zeff, RealType Rc, OneMolecularOrbital &phiMO, ValueVector &Elorig)
 Local energy from uncorrected orbital. More...
 
RealType getELchi2 (const ValueVector &ELcurr, const ValueVector &ELideal)
 Sum of squares difference between the current and ideal local energies This is the objective function to be minimized. More...
 
RealType evaluateForPhi0Body (RealType phi0, ValueVector &pos, ValueVector &ELcurr, ValueVector &ELideal, CuspCorrection &cusp, OneMolecularOrbital &phiMO, ValGradLap phiAtRc, RealType etaAtZero, RealType ELorigAtRc, RealType Z)
 
RealType minimizeForPhiAtZero (CuspCorrection &cusp, OneMolecularOrbital &phiMO, RealType Z, RealType eta0, ValueVector &pos, ValueVector &ELcurr, ValueVector &ELideal, RealType start_phi0)
 Minimize chi2 with respect to phi at zero for a fixed Rc. More...
 
void minimizeForRc (CuspCorrection &cusp, OneMolecularOrbital &phiMO, RealType Z, RealType Rc_init, RealType Rc_max, RealType eta0, ValueVector &pos, ValueVector &ELcurr, ValueVector &ELideal)
 Minimize chi2 with respect to Rc and phi at zero. More...
 
void applyCuspCorrection (const Matrix< CuspCorrectionParameters > &info, ParticleSet &targetPtcl, ParticleSet &sourcePtcl, LCAOrbitalSet &lcao, SoaCuspCorrection &cusp, const std::string &id)
 
void generateCuspInfo (Matrix< CuspCorrectionParameters > &info, const ParticleSet &targetPtcl, const ParticleSet &sourcePtcl, const LCAOrbitalSet &lcao, const std::string &id, Communicate &Comm)
 
bool is_same (const xmlChar *a, const char *b)
 
template<typename T , unsigned D, typename Alloc >
void Product_ABt (const VectorSoaContainer< T, D > &A, const Matrix< T, Alloc > &B, VectorSoaContainer< T, D > &C)
 Find a better place for other user classes, Matrix should be padded as well. More...
 
void print (OptimizableFunctorBase &func, std::ostream &os, double extent=-1.0)
 evaluates a functor (value and derivative) and dumps the quantities to output More...
 
std::string extractCoefficientsID (xmlNodePtr cur)
 return the id of the first coefficients. If not found, return an emtpy string More...
 
template<typename T >
std::complex< T > convertValueToLog (const std::complex< T > &logpsi)
 evaluate log(psi) as log(|psi|) and phase More...
 
template<typename T >
std::complex< T > convertValueToLog (const T logpsi)
 
 TEST_CASE ("cuSolverInverter_bench", "[wavefunction][benchmark]")
 
std::ostream & operator<< (std::ostream &out, const DiracComputeBenchmarkParameters &dcbmp)
 
 TEST_CASE ("DiracMatrixComputeCUDA_large_determinants_benchmark_legacy_1024_4", "[wavefunction][fermion][.benchmark]")
 This and other [.benchmark] benchmarks only run if "[benchmark]" is explicitly passed as tag to test. More...
 
 TEST_CASE ("benchmark_DiracMatrixComputeCUDA_vs_legacy_256_10", "[wavefunction][fermion][benchmark]")
 This test will run by default. More...
 
 TEST_CASE ("benchmark_DiracMatrixComputeCUDASingle_vs_legacy_256_10", "[wavefunction][fermion][.benchmark]")
 Only runs if [benchmark] tag is passed. More...
 
 TEST_CASE ("benchmark_DiracMatrixComputeCUDASingle_vs_legacy_1024_4", "[wavefunction][fermion][.benchmark]")
 Only runs if [benchmark] tag is passed. More...
 
 TEST_CASE ("rocSolverInverter_bench", "[wavefunction][benchmark]")
 
template<typename T >
void fillIdentityMatrix (Matrix< T > &m)
 
 TEST_CASE ("Jastrow 2D", "[wavefunction]")
 
void test_cartesian_ao ()
 
void test_dirac_ao ()
 
 TEST_CASE ("Cartesian Gaussian Ordering", "[wavefunction]")
 
 TEST_CASE ("Dirac Cartesian Gaussian Ordering", "[wavefunction]")
 
 TEST_CASE ("ci_configuration2", "[wavefunction]")
 
 TEST_CASE ("CompositeSPO::diamond_1x1x1", "[wavefunction")
 
 TEST_CASE ("ConstantSPOSet", "[wavefunction]")
 
 TEST_CASE ("Gaussian Functor", "[wavefunction]")
 
 TEST_CASE ("CountingJastrow", "[wavefunction]")
 
 TEST_CASE ("cuBLAS_LU::computeLogDet", "[wavefunction][CUDA]")
 Single double computeLogDet. More...
 
 TEST_CASE ("cuBLAS_LU::computeLogDet_complex", "[wavefunction][CUDA]")
 
 TEST_CASE ("cuBLAS_LU::computeLogDet_float", "[wavefunction][CUDA]")
 while this working is a good test, in production code its likely we want to widen the matrix M to double and thereby the LU matrix as well. More...
 
std::vector< StdComp, CUDAHostAllocator< StdComp > > dev_lu (lu.size())
 
std::vector< StdComp, CUDAHostAllocator< StdComp > > dev_lu2 (lu2.size())
 
std::vector< StdComp *, CUDAHostAllocator< StdComp * > > lus (batch_size)
 
std::vector< StdComp *, CUDAAllocator< StdComp * > > dev_lus (batch_size)
 
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values (batch_size)
 
std::vector< StdComp, CUDAAllocator< StdComp > > dev_log_values (batch_size)
 
std::vector< int, CUDAAllocator< int > > dev_pivots (pivots.size())
 
 cudaErrorCheck (cudaMemcpyAsync(dev_lu.data(), lu.data(), sizeof(decltype(lu)::value_type) *lu.size(), cudaMemcpyHostToDevice, hstream), "cudaMemcpyAsync failed copying log_values to device")
 
 cudaErrorCheck (cudaMemcpyAsync(dev_lu2.data(), lu2.data(), sizeof(decltype(lu2)::value_type) *lu2.size(), cudaMemcpyHostToDevice, hstream), "cudaMemcpyAsync failed copying log_values to device")
 
 cudaErrorCheck (cudaMemcpyAsync(dev_lus.data(), lus.data(), sizeof(decltype(lus)::value_type) *lus.size(), cudaMemcpyHostToDevice, hstream), "cudaMemcpyAsync failed copying log_values to device")
 
 cudaErrorCheck (cudaMemcpyAsync(dev_pivots.data(), pivots.data(), sizeof(int) *pivots.size(), cudaMemcpyHostToDevice, hstream), "cudaMemcpyAsync failed copying log_values to device")
 
 cudaErrorCheck (cudaMemcpyAsync(log_values.data(), dev_log_values.data(), sizeof(std::complex< double >) *2, cudaMemcpyDeviceToHost, hstream), "cudaMemcpyAsync failed copying log_values from device")
 
 cudaErrorCheck (cudaStreamSynchronize(hstream), "cudaStreamSynchronize failed!")
 
 CHECK (log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
 
 CHECK (log_values[1]==ComplexApprox(std::complex< double >{ 5.531331998282581, -8.805487075984523 }))
 
 TEST_CASE ("cuBLAS_LU::getrf_batched_complex", "[wavefunction][CUDA]")
 
std::vector< double, CUDAAllocator< double > > devM_vec (M_vec.size())
 
std::vector< double, CUDAAllocator< double > > devM2_vec (M2_vec.size())
 
std::vector< double *, CUDAAllocator< double * > > devMs (Ms.size())
 
std::vector< int, CUDAHostAllocator< int > > pivots (8, -1.0)
 
std::vector< int, CUDAHostAllocator< int > > infos (8, 1.0)
 
std::vector< int, CUDAAllocator< int > > dev_infos (pivots.size())
 
 cudaErrorCheck (cudaMemcpyAsync(devM_vec.data(), M_vec.data(), sizeof(decltype(M_vec)::value_type) *M_vec.size(), cudaMemcpyHostToDevice, hstream), "cudaMemcpyAsync failed copying M to device")
 
 cudaErrorCheck (cudaMemcpyAsync(devM2_vec.data(), M2_vec.data(), sizeof(decltype(M2_vec)::value_type) *M2_vec.size(), cudaMemcpyHostToDevice, hstream), "cudaMemcpyAsync failed copying M2 to device")
 
 cudaErrorCheck (cudaMemcpyAsync(devMs.data(), Ms.data(), sizeof(decltype(Ms)::value_type) *Ms.size(), cudaMemcpyHostToDevice, hstream), "cudaMemcpyAsync failed copying Ms to device")
 
 cudaErrorCheck (cudaMemcpyAsync(M_vec.data(), devM_vec.data(), sizeof(decltype(M_vec)::value_type) *M_vec.size(), cudaMemcpyDeviceToHost, hstream), "cudaMemcpyAsync failed copying invM from device")
 
 cudaErrorCheck (cudaMemcpyAsync(M2_vec.data(), devM2_vec.data(), sizeof(decltype(M2_vec)::value_type) *M2_vec.size(), cudaMemcpyDeviceToHost, hstream), "cudaMemcpyAsync failed copying invM from device")
 
 cudaErrorCheck (cudaMemcpyAsync(pivots.data(), dev_pivots.data(), sizeof(int) *pivots.size(), cudaMemcpyDeviceToHost, hstream), "cudaMemcpyAsync failed copying pivots from device")
 
testing::MatrixAccessor< double > M_mat (M_vec.data(), 4, 4)
 
testing::MatrixAccessor< double > lu_mat (lu.data(), 4, 4)
 
testing::MatrixAccessor< double > M2_mat (M2_vec.data(), 4, 4)
 
testing::MatrixAccessor< double > lu2_mat (lu2.data(), 4, 4)
 
 checkArray (real_pivot, pivots, 8)
 
 CHECKED_ELSE (check_matrix_result.result)
 
 TEST_CASE ("cuBLAS_LU::getri_batched", "[wavefunction][CUDA]")
 
 TEMPLATE_TEST_CASE ("cuSolverInverter", "[wavefunction][fermion]", double, float)
 
template<typename T1 , typename T2 >
void check_matrix (Matrix< T1 > &a, Matrix< T2 > &b)
 
template<typename DET >
void test_DiracDeterminant_first (const DetMatInvertor inverter_kind)
 
 TEST_CASE ("DiracDeterminant_first", "[wavefunction][fermion]")
 
template<typename DET >
void test_DiracDeterminant_second (const DetMatInvertor inverter_kind)
 
 TEST_CASE ("DiracDeterminant_second", "[wavefunction][fermion]")
 
template<typename DET >
void test_DiracDeterminant_delayed_update (const DetMatInvertor inverter_kind)
 
 TEST_CASE ("DiracDeterminant_delayed_update", "[wavefunction][fermion]")
 
template<PlatformKind PL>
void test_DiracDeterminantBatched_first ()
 
 TEST_CASE ("DiracDeterminantBatched_first", "[wavefunction][fermion]")
 
template<PlatformKind PL>
void test_DiracDeterminantBatched_second ()
 
 TEST_CASE ("DiracDeterminantBatched_second", "[wavefunction][fermion]")
 
template<PlatformKind PL>
void test_DiracDeterminantBatched_delayed_update (int delay_rank, DetMatInvertor matrix_inverter_kind)
 
 TEST_CASE ("DiracDeterminantBatched_delayed_update", "[wavefunction][fermion]")
 
 TEST_CASE ("DiracMatrix_identity", "[wavefunction][fermion]")
 
 TEST_CASE ("DiracMatrix_inverse", "[wavefunction][fermion]")
 
 TEST_CASE ("DiracMatrix_inverse_matching", "[wavefunction][fermion]")
 
 TEST_CASE ("DiracMatrix_inverse_matching_2", "[wavefunction][fermion]")
 
 TEST_CASE ("DiracMatrix_inverse_complex", "[wavefunction][fermion]")
 This test case is meant to match the cuBLAS_LU::getrf_batched_complex. More...
 
 TEST_CASE ("DiracMatrix_update_row", "[wavefunction][fermion]")
 
 TEST_CASE ("DiracMatrixComputeCUDA_cuBLAS_geam_call", "[wavefunction][fermion]")
 
 TEST_CASE ("DiracMatrixComputeCUDA_different_batch_sizes", "[wavefunction][fermion]")
 
 TEST_CASE ("DiracMatrixComputeCUDA_complex_determinants_against_legacy", "[wavefunction][fermion]")
 
 TEST_CASE ("DiracMatrixComputeCUDA_large_determinants_against_legacy", "[wavefunction][fermion]")
 
 TEST_CASE ("DiracMatrixComputeOMPTarget_different_batch_sizes", "[wavefunction][fermion]")
 
 TEST_CASE ("DiracMatrixComputeOMPTarget_large_determinants_against_legacy", "[wavefunction][fermion]")
 
 TEST_CASE ("Einspline SPO from HDF diamond_1x1x1", "[wavefunction]")
 
 TEST_CASE ("Einspline SPO from HDF diamond_2x1x1 5 electrons", "[wavefunction]")
 
 TEST_CASE ("EinsplineSetBuilder CheckLattice", "[wavefunction]")
 
 TEST_CASE ("Einspline SPO from HDF NiO a16 97 electrons", "[wavefunction]")
 
 TEST_CASE ("ExampleHe", "[wavefunction]")
 
 TEST_CASE ("Hybridrep SPO from HDF diamond_1x1x1", "[wavefunction]")
 
 TEST_CASE ("Hybridrep SPO from HDF diamond_2x1x1", "[wavefunction]")
 
 TEST_CASE ("BSpline functor zero", "[wavefunction]")
 
 TEST_CASE ("BSpline functor one", "[wavefunction]")
 
void test_J1_spline (const DynamicCoordinateKind kind_selected)
 
 TEST_CASE ("BSpline builder Jastrow J1", "[wavefunction]")
 
 TEST_CASE ("J1 evaluate derivatives Jastrow", "[wavefunction]")
 
 TEST_CASE ("J1 evaluate derivatives Jastrow with two species", "[wavefunction]")
 
 TEST_CASE ("J1 evaluate derivatives Jastrow with two species one without Jastrow", "[wavefunction]")
 
 TEST_CASE ("J1 spin evaluate derivatives Jastrow", "[wavefunction]")
 
 TEST_CASE ("J1 spin evaluate derivatives multiparticle Jastrow", "[wavefunction]")
 
 TEST_CASE ("BSpline builder Jastrow J2", "[wavefunction]")
 
 TEST_CASE ("TwoBodyJastrow simple", "[wavefunction]")
 
 TEST_CASE ("TwoBodyJastrow one species and two variables", "[wavefunction]")
 
ParticleSet get_two_species_particleset (const SimulationCell &simulation_cell)
 
 TEST_CASE ("TwoBodyJastrow two variables", "[wavefunction]")
 
 TEST_CASE ("TwoBodyJastrow variables fail", "[wavefunction]")
 
 TEST_CASE ("TwoBodyJastrow other variables", "[wavefunction]")
 
 TEST_CASE ("TwoBodyJastrow Jastrow three particles of three types", "[wavefunction]")
 
 TEST_CASE ("kspace jastrow", "[wavefunction]")
 
 TEST_CASE ("lattice gaussian", "[wavefunction]")
 
void test_LCAO_DiamondC_2x1x1_real (const bool useOffload)
 
void test_LCAO_DiamondC_2x1x1_cplx (const bool useOffload)
 
 TEST_CASE ("LCAOrbitalSet batched PBC DiamondC", "[wavefunction]")
 
 TEST_CASE ("LCAOrbitalSet batched PBC DiamondC offload", "[wavefunction]")
 
 TEST_CASE ("LCAOrbitalBuilder", "[wavefunction][LCAO]")
 
void test_He (bool transform)
 
 TEST_CASE ("ReadMolecularOrbital GTO He", "[wavefunction]")
 
 TEST_CASE ("ReadMolecularOrbital Numerical He", "[wavefunction]")
 
void test_He_mw (bool transform)
 
 TEST_CASE ("mw_evaluate Numerical He", "[wavefunction]")
 
void test_EtOH_mw (bool transform)
 
 TEST_CASE ("mw_evaluate Numerical EtOH", "[wavefunction]")
 
 TEST_CASE ("mw_evaluate GTO EtOH", "[wavefunction]")
 
void test_Ne (bool transform)
 
 TEST_CASE ("ReadMolecularOrbital GTO Ne", "[wavefunction]")
 
 TEST_CASE ("ReadMolecularOrbital Numerical Ne", "[wavefunction]")
 
 TEST_CASE ("ReadMolecularOrbital HCN", "[wavefunction]")
 
void test_HCN (bool transform)
 
 TEST_CASE ("ReadMolecularOrbital GTO HCN", "[wavefunction]")
 
 TEST_CASE ("ReadMolecularOrbital Numerical HCN", "[wavefunction]")
 
void test_lcao_spinor ()
 
void test_lcao_spinor_excited ()
 
void test_lcao_spinor_ion_derivs ()
 
 TEST_CASE ("ReadMolecularOrbital GTO spinor", "[wavefunction]")
 
 TEST_CASE ("ReadMolecularOrbital GTO spinor with excited", "[wavefunction]")
 
 TEST_CASE ("spinor ion derivatives for molecule", "[wavefunction]")
 
 TEST_CASE ("SmallMatrixDetCalculator::evaluate-Small", "[wavefunction][fermion][multidet]")
 Simple synthetic test case will trip on changes in this method. More...
 
void test_LiH_msd (const std::string &spo_xml_string, const std::string &check_sponame, int check_spo_size, int check_basisset_size, int test_nlpp_algorithm_batched, int test_batched_api)
 
 TEST_CASE ("LiH multi Slater dets table_method", "[wavefunction]")
 
 TEST_CASE ("LiH multi Slater dets precomputed_table_method", "[wavefunction]")
 
 TEST_CASE ("LogGridLight", "[wavefunction][LCAO]")
 
 TEST_CASE ("MultiQuinticSpline", "[wavefunction][LCAO]")
 
 TEST_CASE ("NaNguard", "[wavefunction]")
 
 TEST_CASE ("Test OptimizableObject", "[wavefunction]")
 
 TEST_CASE ("OptimizableObject HDF output and input", "[wavefunction]")
 
 TEST_CASE ("Pade functor", "[wavefunction]")
 
 TEST_CASE ("Pade2 functor", "[wavefunction]")
 
 TEST_CASE ("Pade Jastrow", "[wavefunction]")
 
 TEST_CASE ("Pade2 Jastrow", "[wavefunction]")
 
 TEST_CASE ("PolynomialFunctor3D functor zero", "[wavefunction]")
 
void test_J3_polynomial3D (const DynamicCoordinateKind kind_selected)
 
 TEST_CASE ("PolynomialFunctor3D Jastrow", "[wavefunction]")
 
 TEST_CASE ("PlaneWave SPO from HDF for BCC H", "[wavefunction]")
 
 TEST_CASE ("PlaneWave SPO from HDF for LiH arb", "[wavefunction]")
 
void test_C_diamond ()
 
 TEST_CASE ("ReadMolecularOrbital GTO Carbon Diamond", "[wavefunction]")
 
 TEMPLATE_TEST_CASE ("rocSolverInverter", "[wavefunction][fermion]", double, float)
 
 TEST_CASE ("RotatedSPOs via SplineR2R", "[wavefunction]")
 
 TEST_CASE ("RotatedSPOs createRotationIndices", "[wavefunction]")
 
 TEST_CASE ("RotatedSPOs constructAntiSymmetricMatrix", "[wavefunction]")
 
 TEST_CASE ("RotatedSPOs exponentiate matrix", "[wavefunction]")
 
 TEST_CASE ("RotatedSPOs log matrix", "[wavefunction]")
 
 TEST_CASE ("RotatedSPOs exp-log matrix", "[wavefunction]")
 
 TEST_CASE ("RotatedSPOs hcpBe", "[wavefunction]")
 
 TEST_CASE ("RotatedSPOs construct delta matrix", "[wavefunction]")
 
 TEST_CASE ("RotatedSPOs read and write parameters", "[wavefunction]")
 
 TEST_CASE ("RotatedSPOs read and write parameters history", "[wavefunction]")
 
 TEST_CASE ("RotatedSPOs mw_ APIs", "[wavefunction]")
 
void setupParticleSetPool (ParticleSetPool &pp)
 
void setupParticleSetPoolBe (ParticleSetPool &pp)
 
std::string setupRotationXML (const std::string &rot_angle_up, const std::string &rot_angle_down, const std::string &coeff_up, const std::string &coeff_down)
 
 TEST_CASE ("Rotated LCAO WF0 zero angle", "[qmcapp]")
 
 TEST_CASE ("Rotated LCAO WF1", "[qmcapp]")
 
 TEST_CASE ("Rotated LCAO WF2 with jastrow", "[qmcapp]")
 
 TEST_CASE ("Rotated LCAO WF1, MO coeff rotated, zero angle", "[qmcapp]")
 
 TEST_CASE ("Rotated LCAO WF1 MO coeff rotated, half angle", "[qmcapp]")
 
 TEST_CASE ("Rotated LCAO rotation consistency", "[qmcapp]")
 
 TEST_CASE ("Rotated LCAO Be single determinant", "[qmcapp]")
 
 TEST_CASE ("Rotated LCAO Be multi determinant with one determinant", "[qmcapp]")
 
 TEST_CASE ("Rotated LCAO Be two determinant", "[qmcapp]")
 
 TEST_CASE ("RPA Jastrow", "[wavefunction]")
 
 TEST_CASE ("ShortRangeCuspJastrowFunctor", "[wavefunction]")
 
 TEST_CASE ("SlaterDet mw_ APIs", "[wavefunction]")
 
 TEST_CASE ("readCuspInfo", "[wavefunction]")
 
 TEST_CASE ("applyCuspInfo", "[wavefunction]")
 
 TEST_CASE ("HCN MO with cusp", "[wavefunction]")
 
 TEST_CASE ("Ethanol MO with cusp", "[wavefunction]")
 
 TEST_CASE ("broadcastCuspInfo", "[wavefunction]")
 
 TEST_CASE ("Spline applyRotation zero rotation", "[wavefunction]")
 
 TEST_CASE ("Spline applyRotation one rotation", "[wavefunction]")
 
 TEST_CASE ("Spline applyRotation two rotations", "[wavefunction]")
 
void test_He_sto3g_xml_input (const std::string &spo_xml_string)
 
 TEST_CASE ("SPO input spline from xml He_sto3g", "[wavefunction]")
 
void test_LiH_msd_xml_input (const std::string &spo_xml_string, const std::string &check_sponame, int check_spo_size, int check_basisset_size)
 
 TEST_CASE ("SPO input spline from xml LiH_msd", "[wavefunction]")
 
void test_LiH_msd_xml_input_with_positron (const std::string &spo_xml_string, const std::string &check_sponame, int check_spo_size, int check_basisset_size)
 
 TEST_CASE ("SPO input spline from xml LiH_msd arbitrary species", "[wavefunction]")
 
 TEST_CASE ("SPO input spline from h5 LiH_msd arbitrary species", "[wavefunction]")
 
void test_diamond_2x1x1_xml_input (const std::string &spo_xml_string)
 
 TEST_CASE ("SPO input spline from HDF diamond_2x1x1", "[wavefunction]")
 
template<typename T , typename T_FP >
void test_inverse (const std::int64_t N)
 
 TEMPLATE_TEST_CASE ("syclSolverInverter", "[wavefunction][fermion]", double, float)
 
 TEST_CASE ("TrialWaveFunction_diamondC_1x1x1", "[wavefunction]")
 
template<class DiracDet , class SPO_precision >
void testTrialWaveFunction_diamondC_2x1x1 (const int ndelay, const OffloadSwitches &offload_switches)
 Templated test of TrialWF with different DiracDet flavors. More...
 
 TEST_CASE ("TrialWaveFunction_diamondC_2x1x1", "[wavefunction]")
 
std::unique_ptr< TrialWaveFunctionsetup_He_wavefunction (Communicate *c, ParticleSet &elec, ParticleSet &ions, const WaveFunctionFactory::PSetMap &particle_set_map)
 
 TEST_CASE ("TrialWaveFunction flex_evaluateParameterDerivatives", "[wavefunction]")
 
UPtrVector< ParticleSet::ParticleGradientcreate_particle_gradient (int nelec, int nentry)
 
UPtrVector< ParticleSet::ParticleLaplaciancreate_particle_laplacian (int nelec, int nentry)
 
 TEST_CASE ("TrialWaveFunction flex_evaluateDeltaLogSetup", "[wavefunction]")
 
 TEST_CASE ("TWFGrads", "[QMCWaveFunctions]")
 
 TEST_CASE ("UserJastrowFunctor", "[wavefunction]")
 
 TEST_CASE ("WaveFunctionFactory", "[wavefunction]")
 
 TEST_CASE ("WaveFunctionPool", "[qmcapp]")
 
static TimerNameList_t< TimerEnumcreate_names (std::string_view myName)
 
template void TrialWaveFunction::mw_evalGrad< CoordsType::POS > (const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, TWFGrads< CoordsType::POS > &grads)
 
template void TrialWaveFunction::mw_evalGrad< CoordsType::POS_SPIN > (const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, TWFGrads< CoordsType::POS_SPIN > &grads)
 
template void TrialWaveFunction::mw_calcRatioGrad< CoordsType::POS > (const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, TWFGrads< CoordsType::POS > &grads)
 
template void TrialWaveFunction::mw_calcRatioGrad< CoordsType::POS_SPIN > (const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, TWFGrads< CoordsType::POS_SPIN > &grads)
 
template void TWFdispatcher::flex_evalGrad< CoordsType::POS > (const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, TWFGrads< CoordsType::POS > &grads) const
 
template void TWFdispatcher::flex_evalGrad< CoordsType::POS_SPIN > (const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, TWFGrads< CoordsType::POS_SPIN > &grads) const
 
template void TWFdispatcher::flex_calcRatioGrad< CoordsType::POS > (const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, TWFGrads< CoordsType::POS > &grads) const
 
template void TWFdispatcher::flex_calcRatioGrad< CoordsType::POS_SPIN > (const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, TWFGrads< CoordsType::POS_SPIN > &grads) const
 
template void WaveFunctionComponent::mw_evalGrad< CoordsType::POS > (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, TWFGrads< CoordsType::POS > &grad_now) const
 
template void WaveFunctionComponent::mw_evalGrad< CoordsType::POS_SPIN > (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, TWFGrads< CoordsType::POS_SPIN > &grad_now) const
 
template void WaveFunctionComponent::mw_ratioGrad< CoordsType::POS > (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, TWFGrads< CoordsType::POS > &grad_new) const
 
template void WaveFunctionComponent::mw_ratioGrad< CoordsType::POS_SPIN > (const RefVectorWithLeader< WaveFunctionComponent > &wfc_list, const RefVectorWithLeader< ParticleSet > &p_list, int iat, std::vector< PsiValue > &ratios, TWFGrads< CoordsType::POS_SPIN > &grad_new) const
 
template<typename T , unsigned D>
laplacian (const TinyVector< T, D > &g, T l)
 compute real(laplacian) More...
 
template<typename T , unsigned D>
laplacian (const TinyVector< std::complex< T >, D > &g, const std::complex< T > &l)
 specialization of laplacian with complex g & l More...
 
template<typename T , unsigned D>
dlaplacian (const TinyVector< T, D > &g, const T l, const TinyVector< T, D > &gg, const T gl, const T ideriv)
 Convenience function to compute $\Re( \nabla^2_i \partial \Psi_T/\Psi_T)$. More...
 
template<typename T , unsigned D>
dlaplacian (const TinyVector< std::complex< T >, D > &g, const std::complex< T > l, const TinyVector< std::complex< T >, D > &gg, const std::complex< T > gl, const std::complex< T > ideriv)
 
RealType accum_constant (CombinedTraceSample< TraceReal > *etrace, RealType weight=1.0)
 
template<typename T >
void accum_sample (std::vector< Value_t > &E_samp, CombinedTraceSample< T > *etrace, RealType weight=1.0)
 
template<typename T >
void accum_sample (std::vector< Value_t > &E_samp, TraceSample< T > *etrace, RealType weight=1.0)
 
double extrap (int N, TinyVector< double, 3 > g_124)
 
double extrap (int N, TinyVector< double, 2 > g_12)
 
QMCTraits::TensorType generateRandomRotationMatrix (RandomBase< QMCTraits::FullPrecRealType > &rng)
 Create a random 3D rotation matrix using a random generator. More...
 
 TEST_CASE ("Bare Kinetic Energy", "[hamiltonian]")
 
 TEST_CASE ("Bare KE Pulay PBC", "[hamiltonian]")
 
void testElecCase (double mass_up, double mass_dn, std::function< void(RefVectorWithLeader< OperatorBase > &o_list, RefVectorWithLeader< TrialWaveFunction > &twf_list, RefVectorWithLeader< ParticleSet > &p_list, Matrix< Real > &kinetic_energies, std::vector< ListenerVector< Real >> &listeners, std::vector< ListenerVector< Real >> &ion_listeners)> tests)
 Provide a test scope parameterized on electron species mass that then can run a set of tests using its objects. More...
 
auto getTestCaseForWeights (Real value1, Real value2, Real value3)
 just set the values to test the electron weights More...
 
 TEST_CASE ("BareKineticEnergyListener", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A BCC H", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A elec", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A BCC", "[hamiltonian]")
 
void test_CoulombPBCAA_3p (DynamicCoordinateKind kind)
 
 TEST_CASE ("Coulomb PBC A-A BCC 3 particles", "[hamiltonian]")
 
 TEST_CASE ("CoulombAA::mw_evaluatePerParticle", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A Ewald3D", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A BCC H Ewald3D", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A elec Ewald3D", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-B", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-B BCC H", "[hamiltonian]")
 
 TEST_CASE ("CoulombAB::Listener", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-B Ewald3D", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-B BCC H Ewald3D", "[hamiltonian]")
 
 TEST_CASE ("Density Estimator", "[hamiltonian]")
 
 TEST_CASE ("Density Estimator evaluate exception", "[hamiltonian]")
 
QMCTraits::RealType getSplinedSOPot (SOECPComponent *so_comp, int l, double r)
 
 TEST_CASE ("ReadFileBuffer_no_file", "[hamiltonian]")
 
 TEST_CASE ("ReadFileBuffer_simple_serial", "[hamiltonian]")
 
 TEST_CASE ("ReadFileBuffer_simple_mpi", "[hamiltonian]")
 
 TEST_CASE ("ReadFileBuffer_ecp", "[hamiltonian]")
 
 TEST_CASE ("ReadFileBuffer_sorep", "[hamiltonian]")
 
 TEST_CASE ("ReadFileBuffer_reopen", "[hamiltonian]")
 
void copyGridUnrotatedForTest (NonLocalECPComponent &nlpp)
 
void copyGridUnrotatedForTest (SOECPComponent &sopp)
 
 TEST_CASE ("Evaluate_ecp", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A Ewald2D square", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A Ewald2D body center", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A Ewald2D triangular", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A Ewald2D honeycomb", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A Ewald2D tri. in rect.", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A Ewald Quasi2D exception", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A Ewald Quasi2D square", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A Ewald Quasi2D triangular", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A Ewald Quasi2D staggered square", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A Ewald Quasi2D staggered square 2x2", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A Ewald Quasi2D staggered triangle", "[hamiltonian]")
 
 TEST_CASE ("Coulomb PBC A-A Ewald Quasi2D staggered triangle 2x2", "[hamiltonian]")
 
 TEST_CASE ("EwaldRef", "[hamiltonian]")
 
 TEST_CASE ("Bare Force", "[hamiltonian]")
 
void check_force_copy (ForceChiesaPBCAA &force, ForceChiesaPBCAA &force2)
 
 TEST_CASE ("Chiesa Force", "[hamiltonian]")
 
 TEST_CASE ("Ceperley Force", "[hamiltonian]")
 
 TEST_CASE ("Ion-ion Force", "[hamiltonian]")
 
 TEST_CASE ("AC Force", "[hamiltonian]")
 
 TEST_CASE ("Chiesa Force BCC H Ewald3D", "[hamiltonian]")
 
 TEST_CASE ("fccz sr lr clone", "[hamiltonian]")
 
 TEST_CASE ("fccz h3", "[hamiltonian]")
 
std::unique_ptr< ParticleSetcreateElectronParticleSet (const SimulationCell &simulation_cell)
 
 TEST_CASE ("HamiltonianFactory", "[hamiltonian]")
 
 TEST_CASE ("HamiltonianFactory pseudopotential", "[hamiltonian]")
 
 TEST_CASE ("HamiltonianPool", "[qmcapp]")
 
void create_CN_particlesets (ParticleSet &elec, ParticleSet &ions)
 
void create_C_pbc_particlesets (ParticleSet &elec, ParticleSet &ions)
 
QMCHamiltoniancreate_CN_Hamiltonian (HamiltonianFactory &hf)
 
 TEST_CASE ("Eloc_Derivatives:slater_noj", "[hamiltonian]")
 
 TEST_CASE ("Eloc_Derivatives:slater_wj", "[hamiltonian]")
 
 TEST_CASE ("Eloc_Derivatives:multislater_noj", "[hamiltonian]")
 
 TEST_CASE ("Eloc_Derivatives:multislater_wj", "[hamiltonian]")
 
 TEST_CASE ("Eloc_Derivatives:proto_sd_noj", "[hamiltonian]")
 
 TEST_CASE ("Eloc_Derivatives:proto_sd_wj", "[hamiltonian]")
 
 TEST_CASE ("NonLocalECPotential", "[hamiltonian]")
 
 TEST_CASE ("NonLocalTOperator", "[hamiltonian]")
 
 CHECK (oh.lower_bound==0)
 
 TEST_CASE ("ObservableHelper::set_dimensions", "[hamiltonian]")
 
hFile create (filename)
 
oh addProperty (propertyFloat, "propertyFloat", hFile)
 
oh addProperty (propertyTensor, "propertyTensor", hFile)
 
oh addProperty (propertyMatrix, "propertyMatrix", hFile)
 
oh addProperty (propertyTensor, "propertyTinyVector", hFile)
 
oh addProperty (propertyVector, "propertyVector", hFile)
 
oh addProperty (propertyVectorTinyVector, "propertyVectorTinyVector", hFile)
 
hFile close ()
 
 REQUIRE (std::filesystem::exists(filename))
 
 REQUIRE (std::filesystem::remove(filename))
 
 TEST_CASE ("Pair Correlation", "[hamiltonian]")
 
 TEST_CASE ("Pair Correlation Pair Index", "[hamiltonian]")
 
 TEST_CASE ("QMCHamiltonian::flex_evaluate", "[hamiltonian]")
 
 TEST_CASE ("integrateListeners", "[hamiltonian]")
 QMCHamiltonian + Hamiltonians with listeners integration test. More...
 
void test_hcpBe_rotation (bool use_single_det, bool use_nlpp_batched)
 
 TEST_CASE ("RotatedSPOs SplineR2R hcpBe values", "[wavefunction]")
 
 TEST_CASE ("SkAll", "[hamiltonian]")
 
void doSOECPotentialTest (bool use_VPs)
 
 TEST_CASE ("SOECPotential", "[hamiltonian]")
 
 TEST_CASE ("SpaceWarp", "[hamiltonian]")
 
 TEST_CASE ("Stress BCC H Ewald3D", "[hamiltonian]")
 
template bool InputSection::setIfInInput< qmcplusplus::MagnetizationDensityInput::Integrator > (qmcplusplus::MagnetizationDensityInput::Integrator &var, const std::string &tag)
 
std::ostream & operator<< (std::ostream &out, const NEReferencePoints &rhs)
 
template bool InputSection::setIfInInput< qmcplusplus::OneBodyDensityMatricesInput::Integrator > (qmcplusplus::OneBodyDensityMatricesInput::Integrator &var, const std::string &tag)
 
template<typename REAL >
AxisGrid< REAL > parseGridInput (std::istringstream &grid_input_stream)
 Parses the one dimensional grid specification format originated for EnergyDensity This has be refactored from QMCHamiltonian/SpaceGrid.cpp. More...
 
template AxisGrid< double > parseGridInput< double > (std::istringstream &grid_input_stream)
 
template AxisGrid< float > parseGridInput< float > (std::istringstream &grid_input_stream)
 
template bool InputSection::setIfInInput< ReferencePointsInput::Coord > (ReferencePointsInput::Coord &var, const std::string &tag)
 
std::any makeReferencePointsInput (xmlNodePtr, std::string &value_label)
 factory function used by InputSection to make reference points Input More...
 
void readNameTypeLikeLegacy (InputSection &input_section_, std::string &name, std::string &type)
 make input class state consistent with legacy ignoring the distinction between the name and type of estimator for scalar estimators. More...
 
std::any makeSpaceGridInput (xmlNodePtr, std::string &value_label)
 factory function for a SpaceGridInput More...
 
template<typename T >
void test_real_accumulator_basic ()
 
 TEST_CASE ("accumulator basic float", "[estimators]")
 
 TEST_CASE ("accumulator basic double", "[estimators]")
 
template<typename T >
void test_real_accumulator ()
 
 TEST_CASE ("accumulator some values float", "[estimators]")
 
 TEST_CASE ("accumulator some values double", "[estimators]")
 
template<typename T >
void test_real_accumulator_weights ()
 
 TEST_CASE ("accumulator with weights float", "[estimators]")
 
 TEST_CASE ("accumulator with weights double", "[estimators]")
 
 TEST_CASE ("EstimatorManagerCrowd::EstimatorManagerCrowd", "[estimators]")
 
 TEST_CASE ("EstimatorManagerCrowd PerParticleHamiltonianLogger integration", "[estimators]")
 
 TEST_CASE ("EstimatorManagerInput::testInserts", "[estimators]")
 
 TEST_CASE ("EstimatorManagerInput::readXML", "[estimators]")
 
 TEST_CASE ("EstimatorManagerInput::moveFromEstimatorInputs", "[estimators]")
 
 TEST_CASE ("EstimatorManagerInput::moveConstructor", "[estimators]")
 
 TEST_CASE ("EstimatorManagerInput::MergeConstructor", "[estimators]")
 
 CHECK (embt.em.getNumEstimators()==0)
 
EstimatorManagerInput emi (estimators_doc.getRoot())
 
 CHECK (emi.get_estimator_inputs().size()==2)
 
 CHECK (emn.getNumEstimators()==2)
 
 CHECK (emnta.getMainEstimator().getName()=="LocalEnergyEstimator")
 
EstimatorManagerInput emi2 (estimators_doc2.getRoot())
 
 CHECK (emi2.get_estimator_inputs().size()==2)
 
 CHECK (emn2.getNumEstimators()==2)
 
 CHECK (emnta2.getMainEstimator().getName()=="RMCLocalEnergyEstimator")
 
 TEST_CASE ("EstimatorManagerNew::collectMainEstimators", "[estimators]")
 
 TEST_CASE ("EstimatorManagerNew::collectScalarEstimators", "[estimators]")
 
 TEST_CASE ("EstimatorManagerNew adhoc addVector operator", "[estimators]")
 
 TEST_CASE ("InputSection::InputSection", "[estimators]")
 
 TEST_CASE ("InputSection::assignAnyEnum", "[estimators]")
 
 TEST_CASE ("InputSection::readXML", "[estimators]")
 
 TEST_CASE ("InputSection::InvalidElement", "[estimators]")
 
 TEST_CASE ("InputSection::init", "[estimators]")
 
 TEST_CASE ("InputSection::get", "[estimators]")
 
 TEST_CASE ("InputSection::custom", "[estimators]")
 
std::any makeAnotherInput (xmlNodePtr cur, std::string &value_label)
 
 TEST_CASE ("InputSection::Delegate", "[estimators]")
 
 TEST_CASE ("LocalEnergyOnly", "[estimators]")
 
 TEST_CASE ("LocalEnergy", "[estimators]")
 
 TEST_CASE ("LocalEnergy with hdf5", "[estimators]")
 
 TEST_CASE ("MagnetizationDensityInput::from_xml", "[estimators]")
 
 TEST_CASE ("EstimatorManagerBase", "[estimators]")
 
 TEST_CASE ("Estimator adhoc addVector operator", "[estimators]")
 
testing::EstimatorManagerNewTest embt (ham, c, num_ranks)
 
embt fakeMainScalarSamples ()
 
embt testMakeBlockAverages ()
 
 if (c->rank()==0)
 
embt fakeSomeOperatorEstimatorSamples (c->rank())
 
embt testReduceOperatorEstimators ()
 
 TEST_CASE ("MomentumDistribution::MomentumDistribution", "[estimators]")
 
 TEST_CASE ("MomentumDistribution::accumulate", "[estimators]")
 
 TEST_CASE ("MomentumDistribution::spawnCrowdClone", "[estimators]")
 
 TEST_CASE ("SpaceGrid::Construction", "[estimators]")
 
 TEST_CASE ("SpaceGrid::CYLINDRICAL", "[estimators]")
 
 TEST_CASE ("SpaceGrid::SPHERICAL", "[estimators]")
 
 TEST_CASE ("SpaceGrid::Basic", "[estimators]")
 
 TEST_CASE ("SpaceGrid::Accumulate::outside", "[estimators]")
 
 TEST_CASE ("SpaceGrid::BadPeriodic", "[estimators]")
 
 TEST_CASE ("SpaceGrid::hdf5", "[estimators]")
 
 TEST_CASE ("OneBodyDensityMatrices::OneBodyDensityMatrices", "[estimators]")
 
 TEST_CASE ("OneBodyDensityMatrices::generateSamples", "[estimators]")
 
OneBodyDensityMatrices original (std::move(obdmi), pset_target.getLattice(), species_set, spomap, pset_target)
 
 REQUIRE (clone !=nullptr)
 
 REQUIRE (clone.get() !=&original)
 
 REQUIRE (dynamic_cast< decltype(&original)>(clone.get()) !=nullptr)
 
 TEST_CASE ("OneBodyDensityMatrices::accumulate", "[estimators]")
 
 TEST_CASE ("OneBodyDensityMatrices::evaluateMatrix", "[estimators]")
 
 TEST_CASE ("OneBodyDensityMatrices::registerAndWrite", "[estimators]")
 
 TEST_CASE ("OneBodyDensityMatricesInput::from_xml", "[estimators]")
 
 TEST_CASE ("OneBodyDensityMatricesInput::copy_construction", "[estimators]")
 
template<typename T >
std::ostream & operator<< (std::ostream &out, const AxisGrid< T > &rhs)
 
 TEMPLATE_TEST_CASE ("ParseGridInput::Good", "[estimators]", float, double)
 
 TEMPLATE_TEST_CASE ("ParseGridInput::Bad", "[estimators]", float, double)
 
 TEMPLATE_TEST_CASE ("ParseGridInput_constructors", "[estimators]", float, double)
 
 TEST_CASE ("PerParticleHamiltonianLogger_sum", "[estimators]")
 
std::ostream & operator<< (std::ostream &out, const testing::TestableNEReferencePoints &rhs)
 
template<typename T1 , typename T2 , unsigned D>
bool approxEquality (const TinyVector< T1, D > &val_a, const TinyVector< T2, D > &val_b)
 
ReferencePointsInput makeTestRPI ()
 
PSetsAndRefList makePsets ()
 
auto expectedReferencePoints ()
 
 TEST_CASE ("ReferencePoints::DefaultConstruction", "[estimators]")
 
 TEST_CASE ("ReferencePoints::Construction", "[estimators]")
 
 TEST_CASE ("ReferencePoints::Description", "[estimators]")
 
 TEST_CASE ("ReferencePoints::HDF5", "[estimators]")
 
 TEST_CASE ("ReferencePointsInput::parseXML::valid", "[estimators]")
 
 TEST_CASE ("ReferencePointsInput::parseXML::invalid", "[estimators]")
 
 TEST_CASE ("ReferencePointsInput::makeReferencePointsInput", "[estimators]")
 
 TEST_CASE ("Scalar Estimator Input", "[estimators]")
 
 TEST_CASE ("SizeLimitedDataQueue", "[estimators]")
 
 TEST_CASE ("SpaceGridInputs::parseXML::valid", "[estimators]")
 
 TEST_CASE ("SpaceGridInputs::parseXML::invalid", "[estimators]")
 
template<typename T >
bool checkVec (T &vec, T expected_vec)
 
 TEST_CASE ("SpaceGridInputs::parseXML::axes", "[estimators]")
 
 TEST_CASE ("SpinDensityInput::readXML", "[estimators]")
 
void accumulateFromPsets (int ncrowds, SpinDensityNew &sdn, UPtrVector< OperatorEstBase > &crowd_sdns)
 
void randomUpdateAccumulate (testing::RandomForTest< QMCT::RealType > &rft, UPtrVector< OperatorEstBase > &crowd_sdns)
 
 REQUIRE (okay)
 
 species_set (iattribute, ispecies)
 
 SpinDensityNew (std::move(sdi), species_set)
 
SpinDensityInput sdi (node)
 
sdnt testCopyConstructor (sdn)
 
 TEST_CASE ("SpinDensityNew::accumulate", "[estimators]")
 
 TEST_CASE ("TraceManager", "[estimators]")
 
 TEST_CASE ("TraceManager check_trace_build", "[estimators]")
 
template<typename T >
bool TraceSample_comp (TraceSample< T > *left, TraceSample< T > *right)
 
template void DMCBatched::advanceWalkers< CoordsType::POS > (const StateForThread &sft, Crowd &crowd, DriverTimers &timers, DMCTimers &dmc_timers, ContextForSteps &step_context, bool recompute, bool accumulate_this_step)
 
template void DMCBatched::advanceWalkers< CoordsType::POS_SPIN > (const StateForThread &sft, Crowd &crowd, DriverTimers &timers, DMCTimers &dmc_timers, ContextForSteps &step_context, bool recompute, bool accumulate_this_step)
 
std::ostream & operator<< (std::ostream &o_stream, const DMCDriverInput &dmci)
 
WalkerControlBasecreateWalkerController (int nwtot, Communicate *comm, xmlNodePtr cur, bool reconfig=false)
 function to create WalkerControlBase or its derived class More...
 
template<class T , class TG , unsigned D>
getDriftScale (T tau, const ParticleAttrib< TinyVector< TG, D >> &ga)
 
template<class Tt , class TG , class T , unsigned D>
void getScaledDrift (Tt tau, const TinyVector< TG, D > &qf, TinyVector< T, D > &drift)
 evaluate a drift with a real force More...
 
template<class Tt , class TG , class T , unsigned D>
void getScaledDriftL2 (Tt tau, const TinyVector< TG, D > &qf, const Tensor< T, D > &Dmat, TinyVector< T, D > &Kvec, TinyVector< T, D > &drift)
 evaluate a drift with a real force with rescaling for an L2 potential More...
 
template<class Tt , class TG , class T , unsigned D>
void getUnscaledDrift (Tt tau, const TinyVector< TG, D > &qf, TinyVector< T, D > &drift)
 evaluate a drift with a real force and no rescaling More...
 
template<class T , class T1 , unsigned D>
setScaledDriftPbyPandNodeCorr (T tau, const ParticleAttrib< TinyVector< T1, D >> &qf, ParticleAttrib< TinyVector< T, D >> &drift)
 scale drift More...
 
template<class T , class T1 , unsigned D>
setScaledDriftPbyPandNodeCorr (T tau_au, const std::vector< T > &massinv, const ParticleAttrib< TinyVector< T1, D >> &qf, ParticleAttrib< TinyVector< T, D >> &drift)
 scale drift More...
 
template<class T , class TG , unsigned D>
void setScaledDrift (T tau, const ParticleAttrib< TinyVector< TG, D >> &qf, ParticleAttrib< TinyVector< T, D >> &drift)
 da = scaled(tau)*ga More...
 
template<class T , unsigned D>
void setScaledDrift (T tau, ParticleAttrib< TinyVector< T, D >> &drift)
 da = scaled(tau)*ga More...
 
template<class T , class TG , unsigned D>
void setScaledDrift (T tau, const ParticleAttrib< TinyVector< std::complex< TG >, D >> &qf, ParticleAttrib< TinyVector< T, D >> &drift)
 da = scaled(tau)*ga More...
 
template<class T , class TG , unsigned D>
void assignDrift (T s, const ParticleAttrib< TinyVector< TG, D >> &ga, ParticleAttrib< TinyVector< T, D >> &da)
 
template<class T , class TG , unsigned D>
void assignDrift (T s, const ParticleAttrib< TinyVector< std::complex< TG >, D >> &ga, ParticleAttrib< TinyVector< T, D >> &da)
 
template<class T , class T1 , unsigned D>
void assignDrift (T tau_au, const std::vector< T > &massinv, const ParticleAttrib< TinyVector< T1, D >> &qf, ParticleAttrib< TinyVector< T, D >> &drift)
 
constexpr bool operator & (DriverDebugChecks x, DriverDebugChecks y)
 
constexpr DriverDebugChecks operator| (DriverDebugChecks x, DriverDebugChecks y)
 
constexpr DriverDebugChecks operator~ (DriverDebugChecks x)
 
DriverDebugChecksoperator|= (DriverDebugChecks &x, DriverDebugChecks y)
 
DriftModifierBasecreateDriftModifier (xmlNodePtr cur, const Communicate *myComm)
 create DriftModifier More...
 
DriftModifierBasecreateDriftModifier (const std::string &drift_modifier_str, QMCTraits::RealType unr_a)
 
std::ostream & operator<< (std::ostream &o_stream, const QMCDriverNew &qmcd)
 
std::ostream & operator<< (std::ostream &os, SFNBranch::VParamType &rhs)
 
std::ostream & operator<< (std::ostream &os, SimpleFixedNodeBranch::VParamType &rhs)
 
 TEST_CASE ("QMCUpdate", "[drivers]")
 
 TEST_CASE ("CloneManager", "[drivers]")
 
 TEST_CASE ("Crowd integration", "[drivers]")
 
 TEST_CASE ("Crowd redistribute walkers")
 
 TEST_CASE ("DescentEngine RMSprop update", "[drivers][descent]")
 This provides a basic test of the descent engine's parameter update algorithm. More...
 
 TEST_CASE ("DMC Particle-by-Particle advanceWalkers ConstantOrbital", "[drivers][dmc]")
 
 TEST_CASE ("DMC Particle-by-Particle advanceWalkers LinearOrbital", "[drivers][dmc]")
 
 TEST_CASE ("DMC", "[drivers][dmc]")
 
 TEST_CASE ("SODMC", "[drivers][dmc]")
 
 TEST_CASE ("drift pbyp and node correction real", "[drivers][drift]")
 
 TEST_CASE ("get scaled drift real", "[drivers][drift]")
 
 TEST_CASE ("solveGeneralizedEigenvalues", "[drivers]")
 
 TEST_CASE ("solveGeneralizedEigenvaluesInv", "[drivers]")
 
 TEST_CASE ("solveGeneralizedEigenvaluesCompare", "[drivers]")
 
 TEST_CASE ("EngineHandle construction", "[drivers]")
 This provides a basic test of constructing an EngineHandle object and checking information in it. More...
 
 TEST_CASE ("Fixed node branch", "[drivers][walker_control]")
 
 TEST_CASE ("Hybrid Engine query store","[drivers][hybrid]")
 This provides a basic test of the hybrid engine's check on whether vectors need to be stored. More...
 
 TEST_CASE ("selectEigenvalues", "[drivers]")
 
 TEST_CASE ("MCPopulation::createWalkers", "[particle][population]")
 
 TEST_CASE ("MCPopulation::createWalkers_walker_ids", "[particle][population]")
 
 TEST_CASE ("MCPopulation::redistributeWalkers", "[particle][population]")
 
 TEST_CASE ("updateXmlNodes", "[drivers]")
 
 TEST_CASE ("updateXmlNodes with existing element", "[drivers]")
 
void compute_batch_parameters (int sample_size, int batch_size, int &num_batches, int &final_batch_size)
 Compute number of batches and final batch size given the number of samples and a batch size. More...
 
 TEST_CASE ("compute_batch_parameters", "[drivers]")
 
 TEST_CASE ("fillOverlapAndHamiltonianMatrices", "[drivers]")
 
void fill_from_text (int num_opt_crowds, FillData &fd)
 
 TEST_CASE ("fillfromText", "[drivers]")
 
 TEST_CASE ("QMCDriverFactory create VMC Driver", "[qmcapp]")
 
 TEST_CASE ("QMCDriverFactory create VMCBatched driver", "[qmcapp]")
 
 TEST_CASE ("QMCDriverFactory create DMC driver", "[qmcapp]")
 
 TEST_CASE ("QMCDriverFactory create DMCBatched driver", "[qmcapp]")
 
 TEST_CASE ("QMCDriverInput Instantiation", "[drivers]")
 
 TEST_CASE ("QMCDriverInput readXML", "[drivers]")
 
 TEST_CASE ("QMCDriverNew tiny case", "[drivers]")
 
 TEST_CASE ("QMCDriverNew test driver operations", "[drivers]")
 
SetupSFNBranch setup_sfnb (pools.comm)
 
 TEST_CASE ("Taus", "[Particle]")
 
 TEST_CASE ("VMC Particle-by-Particle advanceWalkers", "[drivers][vmc]")
 
 TEST_CASE ("VMC", "[drivers][vmc]")
 
 TEST_CASE ("SOVMC", "[drivers][vmc]")
 
 TEST_CASE ("SOVMC-alle", "[drivers][vmc]")
 
 TEST_CASE ("VMCBatched::calc_default_local_walkers", "[drivers]")
 
 TEST_CASE ("VMCDriverInput readXML", "[drivers]")
 
 TEST_CASE ("VMCFactory Instantiation", "[drivers]")
 
void output_vector (const std::string &name, std::vector< int > &vec)
 
 TEST_CASE ("Walker control assign walkers", "[drivers][walker_control]")
 
 TEST_CASE ("WalkerControl round trip index conversions", "[drivers][walker_control]")
 
 TEST_CASE ("Walker control assign walkers odd ranks", "[drivers][walker_control]")
 
 TEST_CASE ("WalkerControl::determineNewWalkerPopulation", "[drivers][walker_control]")
 
 TEST_CASE ("WalkerLogCollector::collect", "[estimators]")
 
 TEST_CASE ("WFOptDriverInput Instantiation", "[drivers]")
 
 TEST_CASE ("WFOptDriverInput readXML", "[drivers]")
 
template void VMCBatched::advanceWalkers< CoordsType::POS > (const StateForThread &sft, Crowd &crowd, QMCDriverNew::DriverTimers &timers, ContextForSteps &step_context, bool recompute, bool accumulate_this_step)
 
template void VMCBatched::advanceWalkers< CoordsType::POS_SPIN > (const StateForThread &sft, Crowd &crowd, QMCDriverNew::DriverTimers &timers, ContextForSteps &step_context, bool recompute, bool accumulate_this_step)
 
std::ostream & operator<< (std::ostream &o_stream, const VMCBatched &vmc_batched)
 
std::ostream & operator<< (std::ostream &o_stream, const VMCDriverInput &vmci)
 
template<typename T , unsigned D>
void randomize (ParticleAttrib< TinyVector< T, D >> &displ, T fac)
 
std::unique_ptr< QMCFixedSampleLinearOptimizeBatchedQMCWFOptLinearFactoryNew (xmlNodePtr cur, const ProjectData &project_data, const std::optional< EstimatorManagerInput > &global_emi, WalkerConfigurations &wc, MCPopulation &&pop, SampleStack &samples, Communicate *comm)
 
void get_gridinfo_from_posgrid (const std::vector< PosType > &posgridlist, const IndexType &axis, RealType &lx, RealType &rx, RealType &dx, IndexType &Nx)
 
void getStats (const std::vector< RealType > &vals, RealType &avg, RealType &err, int start=0)
 Simpleaverage and error estimate. More...
 
int estimateEquilibration (const std::vector< RealType > &vals, RealType frac=0.75)
 estimate equilibration of block data More...
 
 TEST_CASE ("FS parse Sk file", "[tools]")
 
 TEST_CASE ("FS evaluate", "[tools]")
 
std::string lowerCase (const std::string_view s)
 ++17

More...
 
template<typename T >
string2Real (const std::string_view svalue)
 alternate to string2real calls c++ string to real conversion based on T's precision template<typename T> More...
 
template<typename T >
string2Int (const std::string_view svalue)
 alternate to string2real calls c++ string to real conversion based on T's precision template<typename T> More...
 

Variables

hdf_error_suppression hide_hdf_errors
 Suppress HDF5 warning and error messages. More...
 
bool timer_max_level_exceeded = false
 
QMCState qmc_common
 a unique QMCState during a run More...
 
RNGThreadSafe< FakeRandom< OHMMS_PRECISION_FULL > > fake_random_global
 
RNGThreadSafe< RandomGeneratorrandom_global
 
RunTimeManager< ChronoClockrun_time_manager
 
static std::ostringstream summary_out
 
static std::ostringstream app_out
 
static std::ostringstream err_out
 
static std::ostringstream debug_out
 
TimerNameList_t< TestTimerTestTimerNames = {{MyTimer1, "Timer name 1"}, {MyTimer2, "Timer name 2"}}
 
std::atomic< size_t > CUDAallocator_device_mem_allocated
 
std::atomic< size_t > dual_device_mem_allocated
 
std::atomic< size_t > OMPallocator_device_mem_allocated
 
std::atomic< size_t > SYCLallocator_device_mem_allocated
 
auto checkRs
 
MCCoords< CoordsType::POSmc_coords_rs (size_test)
 
MCCoords< CoordsType::POS_SPINmc_coords_rsspins (size_test)
 
int offset_for_rs = (3 * size_test) + (3 * size_test) % 2
 
constexpr RealType no_energy_tol = std::numeric_limits<RealType>::max()
 
constexpr int no_index = -1
 
const int inone = std::numeric_limits<int>::min()
 
const RealType rnone = std::numeric_limits<RealType>::max()
 
const std::string & snone = "none"
 
int n = 4
 
int lda = 4
 
auto & hstream = cuda_handles->hstream
 
int batch_size = 2
 
std::vector< StdComp, CUDAHostAllocator< StdComp > > lu
 
std::vector< StdComp, CUDAHostAllocator< StdComp > > lu2
 
 lus [0] = dev_lu.data()
 
std::vector< int, CUDAHostAllocator< int > > pivots = {3, 4, 3, 4, 3, 4, 4, 4}
 
std::vector< double, CUDAHostAllocator< double > > M_vec {2, 5, 7, 5, 5, 2, 5, 4, 8, 2, 6, 4, 7, 8, 6, 8}
 
std::vector< double, CUDAHostAllocator< double > > M2_vec {6, 5, 7, 5, 2, 2, 5, 4, 8, 2, 6, 4, 3, 8, 6, 8}
 
std::vector< double *, CUDAHostAllocator< double * > > Ms {devM_vec.data(), devM2_vec.data()}
 
std::vector< int > real_pivot {3, 3, 4, 4, 3, 3, 3, 4}
 
auto checkArray
 
auto check_matrix_result = checkMatrix(lu_mat, M_mat)
 
const std::string identity_coeff
 
const std::string coeff_rot_by_point1
 
const std::string coeff_rot_by_point2
 
const std::string coeff_rot_by_point05
 
static const std::vector< std::string > suffixes
 
static const TimerNameList_t< DMTimersDMTimerNames
 
hdf_archive hFile
 
ObservableHelper oh {hdf_path{"u"}}
 
std::vector< int > dims = {10, 10}
 
float propertyFloat = 10.f
 
Tensor< float, OHMMS_DIMpropertyTensor
 
Matrix< float > propertyMatrix
 
TinyVector< float, OHMMS_DIMpropertyTinyVector
 
std::vector< float > propertyVector
 
std::vector< TinyVector< float, OHMMS_DIM > > propertyVectorTinyVector
 
constexpr bool generate_test_data = false
 set to true to generate new random R for particles. More...
 
QMCHamiltonian ham = *(hamiltonian_pool.getPrimary())
 
testing::EstimatorManagerNewTest embt (ham, c, 1)
 
Communicatecomm = OHMMS::Controller
 
Libxml2Document estimators_doc = createEstimatorManagerNewVMCInputXML()
 
auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm)
 
auto wavefunction_pool
 
auto & pset = *(particle_pool.getParticleSet("e"))
 
auto hamiltonian_pool = MinimalHamiltonianPool::make_hamWithEE(comm, particle_pool, wavefunction_pool)
 
auto & twf = *(wavefunction_pool.getWaveFunction("wavefunction"))
 
EstimatorManagerNew emn (comm, std::move(emi), ham, pset, twf)
 
EstimatorManagerNewTestAccess emnta (emn)
 
Libxml2Document estimators_doc2 = createEstimatorManagerNewInputXML()
 
EstimatorManagerNew emn2 (comm, std::move(emi2), ham, pset, twf)
 
EstimatorManagerNewTestAccess emnta2 (emn2)
 
std::unordered_map< std::string, std::any > lookup_input_enum_value
 
int num_ranks = c->size()
 
std::vector< QMCTraits::RealTypegood_data = embt.generateGoodOperatorData(num_ranks)
 
constexpr bool dump_obdm = false
 
ProjectData test_project ("test", ProjectData::DriverVersion::BATCH)
 
auto & pset_target = *(particle_pool.getParticleSet("e"))
 
auto & species_set = pset_target.getSpeciesSet()
 
auto & spomap = wavefunction_pool.getWaveFunction("wavefunction")->getSPOMap()
 
Libxml2Document doc
 
bool okay = doc.parseFromString(Input::xml[Input::valid::VANILLA])
 
if(!okay) throw std xmlNodePtr node = doc.getRoot()
 
OneBodyDensityMatricesInput obdmi (node)
 
auto clone = original.spawnCrowdClone()
 
SpinDensityInput sdi (node)
 
int ispecies = species_set.addSpecies("C")
 
int iattribute = species_set.addAttribute("membersize")
 
SpinDensityInput sdi_copy = sdi
 
CrystalLattice< OHMMS_PRECISION, OHMMS_DIMlattice = testing::makeTestLattice()
 
SpinDensityNew sdn (std::move(sdi), lattice, species_set)
 
OEBAccessor oeba (sdn) = 1.0
 
SpinDensityNewTests sdnt
 
SpinDensityNew original (std::move(sdi), lattice, species_set)
 
const unsigned int DMAX = 4
 
TimerNameList_t< DMCTimersDMCTimerNames
 
const TimerNameList_t< SODMCTimersSODMCTimerNames
 
TimerNameList_t< WC_TimersWalkerControlTimerNames
 
TimerNameList_t< DMC_MPI_TimersDMCMPITimerNames
 
const std::map< std::string, OptimizerTypeOptimizerNames
 
SetupPools pools
 
std::unique_ptr< SFNBranchsfnb
 
SetupSimpleFixedNodeBranch setup_sfnb
 

Convenience templated type aliases

when feasible do not use previous aliases in following that way one line can be scanned to understand a single alias see: UPtrVector

template<typename T >
using RefVector = std::vector< std::reference_wrapper< T > >
 
template<typename T >
using UPtr = std::unique_ptr< T >
 
template<typename T >
using UPtrVector = std::vector< std::unique_ptr< T > >
 
template<class TR , class T >
static RefVector< TR > makeRefVector (std::vector< T > &vec_list)
 }@ More...
 
template<class T >
static RefVector< T > convertUPtrToRefVector (const UPtrVector< T > &ptr_list)
 convert a vector of std::unique_ptrs<T> to a refvector<T> More...
 
template<class T2 , class T >
static RefVector< T2 > convertUPtrToRefVector (const UPtrVector< T > &ptr_list)
 convert a vector of std::unique_ptrs<T> to a refvector<T2> the static assert prevents ambiguity between this function and the above when T is a derived type of T2. More...
 
template<class T >
static RefVector< T > convertPtrToRefVector (const std::vector< T *> &ptr_list)
 
template<class T >
static std::vector< T * > convert_ref_to_ptr_list (const std::vector< std::reference_wrapper< T >> &ref_list)
 
template<class T >
static std::vector< T * > convertUPtrToPtrVector (const UPtrVector< T > &uptr_list)
 
template<class T >
static RefVector< T > convertUPtrToRefVectorSubset (const UPtrVector< T > &ptr_list, int offset, int len)
 
template<class T >
static RefVector< T > convertPtrToRefVectorSubset (const std::vector< T *> &ptr_list, int offset, int len)
 
template<class T >
static RefVector< T > convertRefVectorToRefVectorSubset (const RefVector< T > &ref_list, int offset, int len)
 

Detailed Description

helper functions for EinsplineSetBuilder

If defined, use recursive method to build the basis set for each position.

performance improvement is questionable: load vs sin/cos


Class Documentation

◆ qmcplusplus::AndCombine

struct qmcplusplus::AndCombine

Definition at line 244 of file Combiners.h.

+ Collaboration diagram for AndCombine:

◆ qmcplusplus::ao_traits

struct qmcplusplus::ao_traits

template<typename T, typename ORBT, int ROT, int SH>
struct qmcplusplus::ao_traits< T, ORBT, ROT, SH >

traits for a localized basis set; used by createBasisSet

T radial function value type ORBT orbital value type, can be complex ROT {0=numuerica;, 1=gto; 2=sto} SH {0=cartesian, 1=spherical} If too confusing, inroduce enumeration.

Definition at line 52 of file LCAOrbitalBuilder.cpp.

+ Collaboration diagram for ao_traits< T, ORBT, ROT, SH >:

◆ qmcplusplus::ao_traits< T, ORBT, 0, 0 >

struct qmcplusplus::ao_traits< T, ORBT, 0, 0 >

template<typename T, typename ORBT>
struct qmcplusplus::ao_traits< T, ORBT, 0, 0 >

specialization for numerical-cartesian AO

Definition at line 57 of file LCAOrbitalBuilder.cpp.

+ Collaboration diagram for ao_traits< T, ORBT, 0, 0 >:
Class Members
typedef SoaCartesianTensor< T > angular_type
typedef SoaAtomicBasisSet< radial_type, angular_type > ao_type
typedef SoaLocalizedBasisSet< ao_type, ORBT > basis_type
typedef MultiQuinticSpline1D< T > radial_type

◆ qmcplusplus::ao_traits< T, ORBT, 0, 1 >

struct qmcplusplus::ao_traits< T, ORBT, 0, 1 >

template<typename T, typename ORBT>
struct qmcplusplus::ao_traits< T, ORBT, 0, 1 >

specialization for numerical-spherical AO

Definition at line 67 of file LCAOrbitalBuilder.cpp.

+ Collaboration diagram for ao_traits< T, ORBT, 0, 1 >:
Class Members
typedef SoaSphericalTensor< T > angular_type
typedef SoaAtomicBasisSet< radial_type, angular_type > ao_type
typedef SoaLocalizedBasisSet< ao_type, ORBT > basis_type
typedef MultiQuinticSpline1D< T > radial_type

◆ qmcplusplus::ao_traits< T, ORBT, 1, 0 >

struct qmcplusplus::ao_traits< T, ORBT, 1, 0 >

template<typename T, typename ORBT>
struct qmcplusplus::ao_traits< T, ORBT, 1, 0 >

specialization for GTO-cartesian AO

Definition at line 77 of file LCAOrbitalBuilder.cpp.

+ Collaboration diagram for ao_traits< T, ORBT, 1, 0 >:
Class Members
typedef SoaCartesianTensor< T > angular_type
typedef SoaAtomicBasisSet< radial_type, angular_type > ao_type
typedef SoaLocalizedBasisSet< ao_type, ORBT > basis_type
typedef MultiFunctorAdapter< GaussianCombo< T > > radial_type

◆ qmcplusplus::ao_traits< T, ORBT, 1, 1 >

struct qmcplusplus::ao_traits< T, ORBT, 1, 1 >

template<typename T, typename ORBT>
struct qmcplusplus::ao_traits< T, ORBT, 1, 1 >

specialization for GTO-cartesian AO

Definition at line 87 of file LCAOrbitalBuilder.cpp.

+ Collaboration diagram for ao_traits< T, ORBT, 1, 1 >:
Class Members
typedef SoaSphericalTensor< T > angular_type
typedef SoaAtomicBasisSet< radial_type, angular_type > ao_type
typedef SoaLocalizedBasisSet< ao_type, ORBT > basis_type
typedef MultiFunctorAdapter< GaussianCombo< T > > radial_type

◆ qmcplusplus::ao_traits< T, ORBT, 2, 0 >

struct qmcplusplus::ao_traits< T, ORBT, 2, 0 >

template<typename T, typename ORBT>
struct qmcplusplus::ao_traits< T, ORBT, 2, 0 >

specialization for STO-cartesian AO

Definition at line 107 of file LCAOrbitalBuilder.cpp.

+ Collaboration diagram for ao_traits< T, ORBT, 2, 0 >:
Class Members
typedef SoaCartesianTensor< T > angular_type
typedef SoaAtomicBasisSet< radial_type, angular_type > ao_type
typedef SoaLocalizedBasisSet< ao_type, ORBT > basis_type
typedef MultiFunctorAdapter< SlaterCombo< T > > radial_type

◆ qmcplusplus::ao_traits< T, ORBT, 2, 1 >

struct qmcplusplus::ao_traits< T, ORBT, 2, 1 >

template<typename T, typename ORBT>
struct qmcplusplus::ao_traits< T, ORBT, 2, 1 >

specialization for STO-spherical AO

Definition at line 97 of file LCAOrbitalBuilder.cpp.

+ Collaboration diagram for ao_traits< T, ORBT, 2, 1 >:
Class Members
typedef SoaSphericalTensor< T > angular_type
typedef SoaAtomicBasisSet< radial_type, angular_type > ao_type
typedef SoaLocalizedBasisSet< ao_type, ORBT > basis_type
typedef MultiFunctorAdapter< SlaterCombo< T > > radial_type

◆ qmcplusplus::ApplyBConds

struct qmcplusplus::ApplyBConds

template<class T1, class T2, unsigned D>
struct qmcplusplus::ApplyBConds< T1, T2, D >

Dummy template class to apply boundary conditions.

Definition at line 181 of file FastParticleOperators.h.

+ Collaboration diagram for ApplyBConds< T1, T2, D >:

◆ qmcplusplus::astring

struct qmcplusplus::astring

Definition at line 172 of file string_utils.h.

+ Collaboration diagram for astring:
Class Members
string s

◆ qmcplusplus::BinaryReturn

struct qmcplusplus::BinaryReturn

template<class T1, class T2, class Op>
struct qmcplusplus::BinaryReturn< T1, T2, Op >

Definition at line 430 of file TypeComputations.h.

+ Collaboration diagram for BinaryReturn< T1, T2, Op >:
Class Members
typedef typename Promote< T1, T2 >::Type_t Type_t

◆ qmcplusplus::BinaryReturn< std::complex< T1 >, T1, OpMultiply >

struct qmcplusplus::BinaryReturn< std::complex< T1 >, T1, OpMultiply >

template<class T1>
struct qmcplusplus::BinaryReturn< std::complex< T1 >, T1, OpMultiply >

Definition at line 26 of file TinyVectorOps.h.

+ Collaboration diagram for BinaryReturn< std::complex< T1 >, T1, OpMultiply >:
Class Members
typedef complex< T1 > Type_t

◆ qmcplusplus::BinaryReturn< T1, std::complex< T1 >, OpMultiply >

struct qmcplusplus::BinaryReturn< T1, std::complex< T1 >, OpMultiply >

template<class T1>
struct qmcplusplus::BinaryReturn< T1, std::complex< T1 >, OpMultiply >

Definition at line 20 of file TinyVectorOps.h.

+ Collaboration diagram for BinaryReturn< T1, std::complex< T1 >, OpMultiply >:
Class Members
typedef complex< T1 > Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpAddAssign >

struct qmcplusplus::BinaryReturn< T1, T2, OpAddAssign >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpAddAssign >

Definition at line 575 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpAddAssign >:
Class Members
typedef T1 & Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpAnd >

struct qmcplusplus::BinaryReturn< T1, T2, OpAnd >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpAnd >

Definition at line 510 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpAnd >:
Class Members
typedef bool Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpAssign >

struct qmcplusplus::BinaryReturn< T1, T2, OpAssign >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpAssign >

Definition at line 744 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpAssign >:
Class Members
typedef T1 & Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpBitwiseAndAssign >

struct qmcplusplus::BinaryReturn< T1, T2, OpBitwiseAndAssign >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpBitwiseAndAssign >

Definition at line 677 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpBitwiseAndAssign >:
Class Members
typedef T1 & Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpBitwiseOrAssign >

struct qmcplusplus::BinaryReturn< T1, T2, OpBitwiseOrAssign >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpBitwiseOrAssign >

Definition at line 660 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpBitwiseOrAssign >:
Class Members
typedef T1 & Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpBitwiseXorAssign >

struct qmcplusplus::BinaryReturn< T1, T2, OpBitwiseXorAssign >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpBitwiseXorAssign >

Definition at line 694 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpBitwiseXorAssign >:
Class Members
typedef T1 & Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpDivideAssign >

struct qmcplusplus::BinaryReturn< T1, T2, OpDivideAssign >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpDivideAssign >

Definition at line 626 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpDivideAssign >:
Class Members
typedef T1 & Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpEQ >

struct qmcplusplus::BinaryReturn< T1, T2, OpEQ >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpEQ >

Definition at line 478 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpEQ >:
Class Members
typedef bool Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpGE >

struct qmcplusplus::BinaryReturn< T1, T2, OpGE >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpGE >

Definition at line 462 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpGE >:
Class Members
typedef bool Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpGT >

struct qmcplusplus::BinaryReturn< T1, T2, OpGT >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpGT >

Definition at line 446 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpGT >:
Class Members
typedef bool Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpLE >

struct qmcplusplus::BinaryReturn< T1, T2, OpLE >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpLE >

Definition at line 430 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpLE >:
Class Members
typedef bool Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpLeftShift >

struct qmcplusplus::BinaryReturn< T1, T2, OpLeftShift >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpLeftShift >

Definition at line 542 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpLeftShift >:
Class Members
typedef T1 Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpLeftShiftAssign >

struct qmcplusplus::BinaryReturn< T1, T2, OpLeftShiftAssign >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpLeftShiftAssign >

Definition at line 711 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpLeftShiftAssign >:
Class Members
typedef T1 & Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpLT >

struct qmcplusplus::BinaryReturn< T1, T2, OpLT >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpLT >

Definition at line 414 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpLT >:
Class Members
typedef bool Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpModAssign >

struct qmcplusplus::BinaryReturn< T1, T2, OpModAssign >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpModAssign >

Definition at line 643 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpModAssign >:
Class Members
typedef T1 & Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpMultiplyAssign >

struct qmcplusplus::BinaryReturn< T1, T2, OpMultiplyAssign >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpMultiplyAssign >

Definition at line 609 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpMultiplyAssign >:
Class Members
typedef T1 & Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpNE >

struct qmcplusplus::BinaryReturn< T1, T2, OpNE >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpNE >

Definition at line 494 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpNE >:
Class Members
typedef bool Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpOr >

struct qmcplusplus::BinaryReturn< T1, T2, OpOr >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpOr >

Definition at line 526 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpOr >:
Class Members
typedef bool Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpRightShift >

struct qmcplusplus::BinaryReturn< T1, T2, OpRightShift >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpRightShift >

Definition at line 558 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpRightShift >:
Class Members
typedef T1 Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpRightShiftAssign >

struct qmcplusplus::BinaryReturn< T1, T2, OpRightShiftAssign >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpRightShiftAssign >

Definition at line 728 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpRightShiftAssign >:
Class Members
typedef T1 & Type_t

◆ qmcplusplus::BinaryReturn< T1, T2, OpSubtractAssign >

struct qmcplusplus::BinaryReturn< T1, T2, OpSubtractAssign >

template<class T1, class T2>
struct qmcplusplus::BinaryReturn< T1, T2, OpSubtractAssign >

Definition at line 592 of file OperatorTags.h.

+ Collaboration diagram for BinaryReturn< T1, T2, OpSubtractAssign >:
Class Members
typedef T1 & Type_t

◆ qmcplusplus::CheckMatrixResult

struct qmcplusplus::CheckMatrixResult

Definition at line 43 of file checkMatrix.hpp.

+ Collaboration diagram for CheckMatrixResult:
Class Members
bool result
string result_message

◆ qmcplusplus::Combine2

struct qmcplusplus::Combine2

template<class A, class B, class Op, class Tag>
struct qmcplusplus::Combine2< A, B, Op, Tag >

Definition at line 93 of file Combiners.h.

+ Collaboration diagram for Combine2< A, B, Op, Tag >:

◆ qmcplusplus::const_traits

struct qmcplusplus::const_traits

template<typename T>
struct qmcplusplus::const_traits< T >

Definition at line 32 of file determinant_operators.h.

+ Collaboration diagram for const_traits< T >:

◆ qmcplusplus::container

struct qmcplusplus::container

Definition at line 23 of file test_deep_copy.cpp.

+ Collaboration diagram for container:
Class Members
double * data
int size

◆ qmcplusplus::ConvertPosUnit

struct qmcplusplus::ConvertPosUnit

template<class T1, class T2, unsigned D>
struct qmcplusplus::ConvertPosUnit< T1, T2, D >

Dummy template class to be specialized.

  • T1 the datatype to be transformed
  • T2 the transformation matrix

Definition at line 31 of file FastParticleOperators.h.

+ Collaboration diagram for ConvertPosUnit< T1, T2, D >:

◆ qmcplusplus::CSFData

struct qmcplusplus::CSFData

CSF related dataset.

Definition at line 29 of file MultiSlaterDetTableMethod.h.

+ Collaboration diagram for CSFData:
Class Members
typedef RealType RealType
typedef ValueType ValueType
Class Members
vector< ValueType > coeffs
vector< size_t > dets_per_csf
vector< RealType > expansion

◆ qmcplusplus::CustomizedMatrixDet

class qmcplusplus::CustomizedMatrixDet

template<unsigned NEXCITED>
class qmcplusplus::CustomizedMatrixDet< NEXCITED >

Definition at line 151 of file SmallMatrixDetCalculator.h.

+ Collaboration diagram for CustomizedMatrixDet< NEXCITED >:

◆ qmcplusplus::DecrementLeaf

struct qmcplusplus::DecrementLeaf

Definition at line 293 of file Functors.h.

+ Collaboration diagram for DecrementLeaf:

◆ qmcplusplus::DereferenceLeaf

struct qmcplusplus::DereferenceLeaf

Definition at line 341 of file Functors.h.

+ Collaboration diagram for DereferenceLeaf:

◆ qmcplusplus::DetInverterSelector

struct qmcplusplus::DetInverterSelector

template<PlatformKind UEPL, typename FPVT>
struct qmcplusplus::DetInverterSelector< UEPL, FPVT >

Definition at line 61 of file DiracDeterminantBatched.h.

+ Collaboration diagram for DetInverterSelector< UEPL, FPVT >:
Class Members
typedef DiracMatrixComputeOMPTarget< FPVT > Inverter

◆ qmcplusplus::double_tag

struct qmcplusplus::double_tag

Definition at line 37 of file test_TrialWaveFunction_diamondC_2x1x1.cpp.

+ Collaboration diagram for double_tag:

◆ qmcplusplus::FillData

struct qmcplusplus::FillData

Definition at line 18 of file FillData.h.

+ Collaboration diagram for FillData:
Class Members
Matrix< double > derivRecords
vector< double > energy_new
Matrix< double > ham_gold
Matrix< double > HDerivRecords
int numParam
int numSamples
Matrix< double > ovlp_gold
vector< double > reweight
double sum_e_wgt
double sum_esq_wgt
double sum_wgt

◆ qmcplusplus::float_tag

struct qmcplusplus::float_tag

Definition at line 39 of file test_TrialWaveFunction_diamondC_2x1x1.cpp.

+ Collaboration diagram for float_tag:

◆ qmcplusplus::IncrementLeaf

struct qmcplusplus::IncrementLeaf

Definition at line 241 of file Functors.h.

+ Collaboration diagram for IncrementLeaf:

◆ qmcplusplus::JastrowTypeHelper

class qmcplusplus::JastrowTypeHelper

template<class RadFuncType, unsigned Implementation = RadialJastrowBuilder::detail::CPU>
class qmcplusplus::JastrowTypeHelper< RadFuncType, Implementation >

Definition at line 41 of file RadialJastrowBuilder.cpp.

+ Collaboration diagram for JastrowTypeHelper< RadFuncType, Implementation >:
Class Members
typedef J1Spin< RadFuncType > J1SpinType
typedef J1OrbitalSoA< RadFuncType > J1Type
typedef TwoBodyJastrow< RadFuncType > J2Type

◆ qmcplusplus::JastrowTypeHelper< BsplineFunctor< RadialJastrowBuilder::RealType >, RadialJastrowBuilder::detail::OMPTARGET >

class qmcplusplus::JastrowTypeHelper< BsplineFunctor< RadialJastrowBuilder::RealType >, RadialJastrowBuilder::detail::OMPTARGET >

template<>
class qmcplusplus::JastrowTypeHelper< BsplineFunctor< RadialJastrowBuilder::RealType >, RadialJastrowBuilder::detail::OMPTARGET >

Definition at line 50 of file RadialJastrowBuilder.cpp.

+ Collaboration diagram for JastrowTypeHelper< BsplineFunctor< RadialJastrowBuilder::RealType >, RadialJastrowBuilder::detail::OMPTARGET >:
Class Members
typedef TwoBodyJastrow< RadFuncType > J2Type
typedef BsplineFunctor< RealType > RadFuncType

◆ qmcplusplus::LatticeAnalyzer

struct qmcplusplus::LatticeAnalyzer

template<typename T, unsigned D>
struct qmcplusplus::LatticeAnalyzer< T, D >

generic class to analyze a Lattice

Definition at line 43 of file LatticeAnalyzer.h.

+ Collaboration diagram for LatticeAnalyzer< T, D >:

◆ qmcplusplus::LeafFunctor

struct qmcplusplus::LeafFunctor

template<class LeafType, class LeafTag>
struct qmcplusplus::LeafFunctor< LeafType, LeafTag >

Definition at line 76 of file Functors.h.

+ Collaboration diagram for LeafFunctor< LeafType, LeafTag >:

◆ qmcplusplus::MCCoords

struct qmcplusplus::MCCoords

template<CoordsType MCT>
struct qmcplusplus::MCCoords< MCT >

Definition at line 31 of file MCCoords.hpp.

+ Collaboration diagram for MCCoords< MCT >:

◆ qmcplusplus::MCDataType

struct qmcplusplus::MCDataType

template<typename T>
struct qmcplusplus::MCDataType< T >

Monte Carlo Data of an ensemble.

The quantities are shared by all the nodes in a group

  • NumSamples number of samples
  • Weight total weight of a sample
  • Energy average energy of a sample
  • Variance variance
  • LivingFraction fraction of walkers alive each step.

Definition at line 41 of file WalkerConfigurations.h.

+ Inheritance diagram for MCDataType< T >:
+ Collaboration diagram for MCDataType< T >:
Class Members
T AlternateEnergy
T Energy
T LivingFraction
T NumSamples
T R2Accepted
T R2Proposed
T RNSamples
T Variance
T Weight

◆ qmcplusplus::NullCombine

struct qmcplusplus::NullCombine

Definition at line 291 of file Combiners.h.

+ Collaboration diagram for NullCombine:

◆ qmcplusplus::OffloadSwitches

struct qmcplusplus::OffloadSwitches

Definition at line 42 of file test_TrialWaveFunction_diamondC_2x1x1.cpp.

+ Collaboration diagram for OffloadSwitches:
Class Members
bool jas
bool spo

◆ qmcplusplus::OpCombine

struct qmcplusplus::OpCombine

Definition at line 207 of file Combiners.h.

+ Collaboration diagram for OpCombine:

◆ qmcplusplus::OrCombine

struct qmcplusplus::OrCombine

Definition at line 267 of file Combiners.h.

+ Collaboration diagram for OrCombine:

◆ qmcplusplus::OTAssign

struct qmcplusplus::OTAssign

template<class T1, class T2, class OP>
struct qmcplusplus::OTAssign< T1, T2, OP >

Definition at line 42 of file OhmmsTinyMeta.h.

+ Collaboration diagram for OTAssign< T1, T2, OP >:

◆ qmcplusplus::OTBinary

struct qmcplusplus::OTBinary

template<class T1, class T2, class OP>
struct qmcplusplus::OTBinary< T1, T2, OP >

Definition at line 45 of file OhmmsTinyMeta.h.

+ Collaboration diagram for OTBinary< T1, T2, OP >:

◆ qmcplusplus::OTCross

struct qmcplusplus::OTCross

template<class T1, class T2>
struct qmcplusplus::OTCross< T1, T2 >

Definition at line 402 of file TinyVectorOps.h.

+ Collaboration diagram for OTCross< T1, T2 >:

◆ qmcplusplus::OTDot

struct qmcplusplus::OTDot

template<class T1, class T2>
struct qmcplusplus::OTDot< T1, T2 >

Definition at line 50 of file OhmmsTinyMeta.h.

+ Collaboration diagram for OTDot< T1, T2 >:

◆ qmcplusplus::OuterProduct

struct qmcplusplus::OuterProduct

template<class T1, class T2>
struct qmcplusplus::OuterProduct< T1, T2 >

Definition at line 606 of file TinyVectorTensorOps.h.

+ Collaboration diagram for OuterProduct< T1, T2 >:

◆ qmcplusplus::PAOps

struct qmcplusplus::PAOps

template<class T, unsigned D, class T1 = T>
struct qmcplusplus::PAOps< T, D, T1 >

generic PAOps

Definition at line 223 of file ParticleAttribOps.h.

+ Collaboration diagram for PAOps< T, D, T1 >:

◆ qmcplusplus::printTinyVector

struct qmcplusplus::printTinyVector

template<class T>
struct qmcplusplus::printTinyVector< T >

Definition at line 220 of file TinyVector.h.

+ Collaboration diagram for printTinyVector< T >:

◆ qmcplusplus::Promote

struct qmcplusplus::Promote

template<class T1, class T2>
struct qmcplusplus::Promote< T1, T2 >

Definition at line 83 of file TypeComputations.h.

+ Collaboration diagram for Promote< T1, T2 >:
Class Members
typedef T1 Type_t

◆ qmcplusplus::Promote< bool, bool >

struct qmcplusplus::Promote< bool, bool >

template<>
struct qmcplusplus::Promote< bool, bool >

Definition at line 91 of file TypeComputations.h.

+ Collaboration diagram for Promote< bool, bool >:
Class Members
typedef bool Type_t

◆ qmcplusplus::Promote< bool, char >

struct qmcplusplus::Promote< bool, char >

template<>
struct qmcplusplus::Promote< bool, char >

Definition at line 97 of file TypeComputations.h.

+ Collaboration diagram for Promote< bool, char >:
Class Members
typedef char Type_t

◆ qmcplusplus::Promote< bool, double >

struct qmcplusplus::Promote< bool, double >

template<>
struct qmcplusplus::Promote< bool, double >

Definition at line 127 of file TypeComputations.h.

+ Collaboration diagram for Promote< bool, double >:
Class Members
typedef double Type_t

◆ qmcplusplus::Promote< bool, float >

struct qmcplusplus::Promote< bool, float >

template<>
struct qmcplusplus::Promote< bool, float >

Definition at line 121 of file TypeComputations.h.

+ Collaboration diagram for Promote< bool, float >:
Class Members
typedef float Type_t

◆ qmcplusplus::Promote< bool, int >

struct qmcplusplus::Promote< bool, int >

template<>
struct qmcplusplus::Promote< bool, int >

Definition at line 109 of file TypeComputations.h.

+ Collaboration diagram for Promote< bool, int >:
Class Members
typedef int Type_t

◆ qmcplusplus::Promote< bool, long >

struct qmcplusplus::Promote< bool, long >

template<>
struct qmcplusplus::Promote< bool, long >

Definition at line 115 of file TypeComputations.h.

+ Collaboration diagram for Promote< bool, long >:
Class Members
typedef long Type_t

◆ qmcplusplus::Promote< bool, short >

struct qmcplusplus::Promote< bool, short >

template<>
struct qmcplusplus::Promote< bool, short >

Definition at line 103 of file TypeComputations.h.

+ Collaboration diagram for Promote< bool, short >:
Class Members
typedef short Type_t

◆ qmcplusplus::Promote< char, bool >

struct qmcplusplus::Promote< char, bool >

template<>
struct qmcplusplus::Promote< char, bool >

Definition at line 135 of file TypeComputations.h.

+ Collaboration diagram for Promote< char, bool >:
Class Members
typedef char Type_t

◆ qmcplusplus::Promote< char, char >

struct qmcplusplus::Promote< char, char >

template<>
struct qmcplusplus::Promote< char, char >

Definition at line 141 of file TypeComputations.h.

+ Collaboration diagram for Promote< char, char >:
Class Members
typedef char Type_t

◆ qmcplusplus::Promote< char, double >

struct qmcplusplus::Promote< char, double >

template<>
struct qmcplusplus::Promote< char, double >

Definition at line 171 of file TypeComputations.h.

+ Collaboration diagram for Promote< char, double >:
Class Members
typedef double Type_t

◆ qmcplusplus::Promote< char, float >

struct qmcplusplus::Promote< char, float >

template<>
struct qmcplusplus::Promote< char, float >

Definition at line 165 of file TypeComputations.h.

+ Collaboration diagram for Promote< char, float >:
Class Members
typedef float Type_t

◆ qmcplusplus::Promote< char, int >

struct qmcplusplus::Promote< char, int >

template<>
struct qmcplusplus::Promote< char, int >

Definition at line 153 of file TypeComputations.h.

+ Collaboration diagram for Promote< char, int >:
Class Members
typedef int Type_t

◆ qmcplusplus::Promote< char, long >

struct qmcplusplus::Promote< char, long >

template<>
struct qmcplusplus::Promote< char, long >

Definition at line 159 of file TypeComputations.h.

+ Collaboration diagram for Promote< char, long >:
Class Members
typedef long Type_t

◆ qmcplusplus::Promote< char, short >

struct qmcplusplus::Promote< char, short >

template<>
struct qmcplusplus::Promote< char, short >

Definition at line 147 of file TypeComputations.h.

+ Collaboration diagram for Promote< char, short >:
Class Members
typedef short Type_t

◆ qmcplusplus::Promote< double, bool >

struct qmcplusplus::Promote< double, bool >

template<>
struct qmcplusplus::Promote< double, bool >

Definition at line 355 of file TypeComputations.h.

+ Collaboration diagram for Promote< double, bool >:
Class Members
typedef double Type_t

◆ qmcplusplus::Promote< double, char >

struct qmcplusplus::Promote< double, char >

template<>
struct qmcplusplus::Promote< double, char >

Definition at line 361 of file TypeComputations.h.

+ Collaboration diagram for Promote< double, char >:
Class Members
typedef double Type_t

◆ qmcplusplus::Promote< double, double >

struct qmcplusplus::Promote< double, double >

template<>
struct qmcplusplus::Promote< double, double >

Definition at line 391 of file TypeComputations.h.

+ Collaboration diagram for Promote< double, double >:
Class Members
typedef double Type_t

◆ qmcplusplus::Promote< double, float >

struct qmcplusplus::Promote< double, float >

template<>
struct qmcplusplus::Promote< double, float >

Definition at line 385 of file TypeComputations.h.

+ Collaboration diagram for Promote< double, float >:
Class Members
typedef double Type_t

◆ qmcplusplus::Promote< double, int >

struct qmcplusplus::Promote< double, int >

template<>
struct qmcplusplus::Promote< double, int >

Definition at line 373 of file TypeComputations.h.

+ Collaboration diagram for Promote< double, int >:
Class Members
typedef double Type_t

◆ qmcplusplus::Promote< double, long >

struct qmcplusplus::Promote< double, long >

template<>
struct qmcplusplus::Promote< double, long >

Definition at line 379 of file TypeComputations.h.

+ Collaboration diagram for Promote< double, long >:
Class Members
typedef double Type_t

◆ qmcplusplus::Promote< double, short >

struct qmcplusplus::Promote< double, short >

template<>
struct qmcplusplus::Promote< double, short >

Definition at line 367 of file TypeComputations.h.

+ Collaboration diagram for Promote< double, short >:
Class Members
typedef double Type_t

◆ qmcplusplus::Promote< float, bool >

struct qmcplusplus::Promote< float, bool >

template<>
struct qmcplusplus::Promote< float, bool >

Definition at line 311 of file TypeComputations.h.

+ Collaboration diagram for Promote< float, bool >:
Class Members
typedef float Type_t

◆ qmcplusplus::Promote< float, char >

struct qmcplusplus::Promote< float, char >

template<>
struct qmcplusplus::Promote< float, char >

Definition at line 317 of file TypeComputations.h.

+ Collaboration diagram for Promote< float, char >:
Class Members
typedef float Type_t

◆ qmcplusplus::Promote< float, double >

struct qmcplusplus::Promote< float, double >

template<>
struct qmcplusplus::Promote< float, double >

Definition at line 347 of file TypeComputations.h.

+ Collaboration diagram for Promote< float, double >:
Class Members
typedef double Type_t

◆ qmcplusplus::Promote< float, float >

struct qmcplusplus::Promote< float, float >

template<>
struct qmcplusplus::Promote< float, float >

Definition at line 341 of file TypeComputations.h.

+ Collaboration diagram for Promote< float, float >:
Class Members
typedef float Type_t

◆ qmcplusplus::Promote< float, int >

struct qmcplusplus::Promote< float, int >

template<>
struct qmcplusplus::Promote< float, int >

Definition at line 329 of file TypeComputations.h.

+ Collaboration diagram for Promote< float, int >:
Class Members
typedef float Type_t

◆ qmcplusplus::Promote< float, long >

struct qmcplusplus::Promote< float, long >

template<>
struct qmcplusplus::Promote< float, long >

Definition at line 335 of file TypeComputations.h.

+ Collaboration diagram for Promote< float, long >:
Class Members
typedef float Type_t

◆ qmcplusplus::Promote< float, short >

struct qmcplusplus::Promote< float, short >

template<>
struct qmcplusplus::Promote< float, short >

Definition at line 323 of file TypeComputations.h.

+ Collaboration diagram for Promote< float, short >:
Class Members
typedef float Type_t

◆ qmcplusplus::Promote< int, bool >

struct qmcplusplus::Promote< int, bool >

template<>
struct qmcplusplus::Promote< int, bool >

Definition at line 223 of file TypeComputations.h.

+ Collaboration diagram for Promote< int, bool >:
Class Members
typedef int Type_t

◆ qmcplusplus::Promote< int, char >

struct qmcplusplus::Promote< int, char >

template<>
struct qmcplusplus::Promote< int, char >

Definition at line 229 of file TypeComputations.h.

+ Collaboration diagram for Promote< int, char >:
Class Members
typedef int Type_t

◆ qmcplusplus::Promote< int, double >

struct qmcplusplus::Promote< int, double >

template<>
struct qmcplusplus::Promote< int, double >

Definition at line 259 of file TypeComputations.h.

+ Collaboration diagram for Promote< int, double >:
Class Members
typedef double Type_t

◆ qmcplusplus::Promote< int, float >

struct qmcplusplus::Promote< int, float >

template<>
struct qmcplusplus::Promote< int, float >

Definition at line 253 of file TypeComputations.h.

+ Collaboration diagram for Promote< int, float >:
Class Members
typedef float Type_t

◆ qmcplusplus::Promote< int, int >

struct qmcplusplus::Promote< int, int >

template<>
struct qmcplusplus::Promote< int, int >

Definition at line 241 of file TypeComputations.h.

+ Collaboration diagram for Promote< int, int >:
Class Members
typedef int Type_t

◆ qmcplusplus::Promote< int, long >

struct qmcplusplus::Promote< int, long >

template<>
struct qmcplusplus::Promote< int, long >

Definition at line 247 of file TypeComputations.h.

+ Collaboration diagram for Promote< int, long >:
Class Members
typedef long Type_t

◆ qmcplusplus::Promote< int, short >

struct qmcplusplus::Promote< int, short >

template<>
struct qmcplusplus::Promote< int, short >

Definition at line 235 of file TypeComputations.h.

+ Collaboration diagram for Promote< int, short >:
Class Members
typedef int Type_t

◆ qmcplusplus::Promote< long, bool >

struct qmcplusplus::Promote< long, bool >

template<>
struct qmcplusplus::Promote< long, bool >

Definition at line 267 of file TypeComputations.h.

+ Collaboration diagram for Promote< long, bool >:
Class Members
typedef long Type_t

◆ qmcplusplus::Promote< long, char >

struct qmcplusplus::Promote< long, char >

template<>
struct qmcplusplus::Promote< long, char >

Definition at line 273 of file TypeComputations.h.

+ Collaboration diagram for Promote< long, char >:
Class Members
typedef long Type_t

◆ qmcplusplus::Promote< long, double >

struct qmcplusplus::Promote< long, double >

template<>
struct qmcplusplus::Promote< long, double >

Definition at line 303 of file TypeComputations.h.

+ Collaboration diagram for Promote< long, double >:
Class Members
typedef double Type_t

◆ qmcplusplus::Promote< long, float >

struct qmcplusplus::Promote< long, float >

template<>
struct qmcplusplus::Promote< long, float >

Definition at line 297 of file TypeComputations.h.

+ Collaboration diagram for Promote< long, float >:
Class Members
typedef float Type_t

◆ qmcplusplus::Promote< long, int >

struct qmcplusplus::Promote< long, int >

template<>
struct qmcplusplus::Promote< long, int >

Definition at line 285 of file TypeComputations.h.

+ Collaboration diagram for Promote< long, int >:
Class Members
typedef long Type_t

◆ qmcplusplus::Promote< long, long >

struct qmcplusplus::Promote< long, long >

template<>
struct qmcplusplus::Promote< long, long >

Definition at line 291 of file TypeComputations.h.

+ Collaboration diagram for Promote< long, long >:
Class Members
typedef long Type_t

◆ qmcplusplus::Promote< long, short >

struct qmcplusplus::Promote< long, short >

template<>
struct qmcplusplus::Promote< long, short >

Definition at line 279 of file TypeComputations.h.

+ Collaboration diagram for Promote< long, short >:
Class Members
typedef long Type_t

◆ qmcplusplus::Promote< short, bool >

struct qmcplusplus::Promote< short, bool >

template<>
struct qmcplusplus::Promote< short, bool >

Definition at line 179 of file TypeComputations.h.

+ Collaboration diagram for Promote< short, bool >:
Class Members
typedef short Type_t

◆ qmcplusplus::Promote< short, char >

struct qmcplusplus::Promote< short, char >

template<>
struct qmcplusplus::Promote< short, char >

Definition at line 185 of file TypeComputations.h.

+ Collaboration diagram for Promote< short, char >:
Class Members
typedef short Type_t

◆ qmcplusplus::Promote< short, double >

struct qmcplusplus::Promote< short, double >

template<>
struct qmcplusplus::Promote< short, double >

Definition at line 215 of file TypeComputations.h.

+ Collaboration diagram for Promote< short, double >:
Class Members
typedef double Type_t

◆ qmcplusplus::Promote< short, float >

struct qmcplusplus::Promote< short, float >

template<>
struct qmcplusplus::Promote< short, float >

Definition at line 209 of file TypeComputations.h.

+ Collaboration diagram for Promote< short, float >:
Class Members
typedef float Type_t

◆ qmcplusplus::Promote< short, int >

struct qmcplusplus::Promote< short, int >

template<>
struct qmcplusplus::Promote< short, int >

Definition at line 197 of file TypeComputations.h.

+ Collaboration diagram for Promote< short, int >:
Class Members
typedef int Type_t

◆ qmcplusplus::Promote< short, long >

struct qmcplusplus::Promote< short, long >

template<>
struct qmcplusplus::Promote< short, long >

Definition at line 203 of file TypeComputations.h.

+ Collaboration diagram for Promote< short, long >:
Class Members
typedef long Type_t

◆ qmcplusplus::Promote< short, short >

struct qmcplusplus::Promote< short, short >

template<>
struct qmcplusplus::Promote< short, short >

Definition at line 191 of file TypeComputations.h.

+ Collaboration diagram for Promote< short, short >:
Class Members
typedef short Type_t

◆ qmcplusplus::PSetsAndRefList

struct qmcplusplus::PSetsAndRefList

Definition at line 79 of file test_ReferencePoints.cpp.

+ Collaboration diagram for PSetsAndRefList:
Class Members
ParticleSetPool ppool
ParticleSet pset
ParticleSet pset_ions
RefVector< ParticleSet > ref_psets

◆ qmcplusplus::QMCTypes

class qmcplusplus::QMCTypes

template<typename Precision, int DIM>
class qmcplusplus::QMCTypes< Precision, DIM >

Definition at line 34 of file QMCTypes.h.

+ Collaboration diagram for QMCTypes< Precision, DIM >:
Class Members
typedef complex< Precision > ComplexType
typedef TinyVector< ValueType, DIM > GradType
typedef TinyVector< RealType, DIM > PosType
typedef Precision RealType
typedef Tensor< RealType, DIM > TensorType
typedef RealType ValueType

◆ qmcplusplus::RealAlias_impl

struct qmcplusplus::RealAlias_impl

template<typename T, typename = bool>
struct qmcplusplus::RealAlias_impl< T, typename >

Definition at line 38 of file complex_help.hpp.

+ Collaboration diagram for RealAlias_impl< T, typename >:

◆ qmcplusplus::RealAlias_impl< T, IsComplex< T > >

struct qmcplusplus::RealAlias_impl< T, IsComplex< T > >

template<typename T>
struct qmcplusplus::RealAlias_impl< T, IsComplex< T > >

Definition at line 48 of file complex_help.hpp.

+ Collaboration diagram for RealAlias_impl< T, IsComplex< T > >:
Class Members
typedef typename value_type value_type

◆ qmcplusplus::RealAlias_impl< T, IsReal< T > >

struct qmcplusplus::RealAlias_impl< T, IsReal< T > >

template<typename T>
struct qmcplusplus::RealAlias_impl< T, IsReal< T > >

Definition at line 42 of file complex_help.hpp.

+ Collaboration diagram for RealAlias_impl< T, IsReal< T > >:
Class Members
typedef T value_type

◆ qmcplusplus::RngReferenceVector< double >

struct qmcplusplus::RngReferenceVector< double >

template<>
struct qmcplusplus::RngReferenceVector< double >

Definition at line 24 of file test_RandomForTest.cpp.

+ Collaboration diagram for RngReferenceVector< double >:
Class Members
vector< double > vec

◆ qmcplusplus::RngReferenceVector< float >

struct qmcplusplus::RngReferenceVector< float >

template<>
struct qmcplusplus::RngReferenceVector< float >

Definition at line 30 of file test_RandomForTest.cpp.

+ Collaboration diagram for RngReferenceVector< float >:
Class Members
vector< float > vec

◆ qmcplusplus::RngReferenceVector< std::complex< double > >

struct qmcplusplus::RngReferenceVector< std::complex< double > >

template<>
struct qmcplusplus::RngReferenceVector< std::complex< double > >

Definition at line 36 of file test_RandomForTest.cpp.

+ Collaboration diagram for RngReferenceVector< std::complex< double > >:
Class Members
vector< complex< double > > vec

◆ qmcplusplus::RngReferenceVector< std::complex< float > >

struct qmcplusplus::RngReferenceVector< std::complex< float > >

template<>
struct qmcplusplus::RngReferenceVector< std::complex< float > >

Definition at line 42 of file test_RandomForTest.cpp.

+ Collaboration diagram for RngReferenceVector< std::complex< float > >:
Class Members
vector< complex< float > > vec

◆ qmcplusplus::RPAFunctor

class qmcplusplus::RPAFunctor

Definition at line 36 of file RadialJastrowBuilder.cpp.

+ Collaboration diagram for RPAFunctor:

◆ qmcplusplus::SplineStoragePrecision

struct qmcplusplus::SplineStoragePrecision

template<typename ST>
struct qmcplusplus::SplineStoragePrecision< ST >

Definition at line 26 of file createBsplineReader.h.

+ Collaboration diagram for SplineStoragePrecision< ST >:

◆ qmcplusplus::StackKeyParam.__unnamed__

union qmcplusplus::StackKeyParam.__unnamed__

Definition at line 70 of file NewTimer.h.

+ Collaboration diagram for StackKeyParam.__unnamed__:
Class Members
long int long_buckets[N]
timer_id_t short_buckets[sizeof(long int) *N/sizeof(timer_id_t)]

◆ qmcplusplus::SumCombine

struct qmcplusplus::SumCombine

Definition at line 314 of file Combiners.h.

+ Collaboration diagram for SumCombine:

◆ qmcplusplus::TauParams

struct qmcplusplus::TauParams

template<typename RT, CoordsType CT>
struct qmcplusplus::TauParams< RT, CT >

Object to encapsulate appropriate tau derived parameters for a particular CoordsType specialization.

Definition at line 25 of file TauParams.hpp.

+ Collaboration diagram for TauParams< RT, CT >:

◆ qmcplusplus::TensorSoaContainer

struct qmcplusplus::TensorSoaContainer

template<typename T, unsigned D>
struct qmcplusplus::TensorSoaContainer< T, D >

Definition at line 23 of file TensorSoaContainer.h.

+ Collaboration diagram for TensorSoaContainer< T, D >:

◆ qmcplusplus::TimerIDName_t

struct qmcplusplus::TimerIDName_t

template<class T>
struct qmcplusplus::TimerIDName_t< T >

Definition at line 149 of file TimerManager.h.

+ Collaboration diagram for TimerIDName_t< T >:
Class Members
T id
const string name

◆ qmcplusplus::TinyMatrix

class qmcplusplus::TinyMatrix

template<class T, unsigned D1, unsigned D2>
class qmcplusplus::TinyMatrix< T, D1, D2 >

Definition at line 38 of file OhmmsTinyMeta.h.

+ Collaboration diagram for TinyMatrix< T, D1, D2 >:

◆ qmcplusplus::TreeCombine

struct qmcplusplus::TreeCombine

Definition at line 167 of file Combiners.h.

+ Collaboration diagram for TreeCombine:

◆ qmcplusplus::TrinaryReturn

struct qmcplusplus::TrinaryReturn

template<class T1, class T2, class T3, class Op>
struct qmcplusplus::TrinaryReturn< T1, T2, T3, Op >

Definition at line 454 of file TypeComputations.h.

+ Collaboration diagram for TrinaryReturn< T1, T2, T3, Op >:
Class Members
typedef typename BinaryReturn< T2, T3, Op >::Type_t Type_t

◆ qmcplusplus::TWFGrads

struct qmcplusplus::TWFGrads

template<CoordsType CT>
struct qmcplusplus::TWFGrads< CT >

Definition at line 22 of file TWFGrads.hpp.

+ Collaboration diagram for TWFGrads< CT >:

◆ qmcplusplus::UnaryReturn

struct qmcplusplus::UnaryReturn

template<class T, class Op>
struct qmcplusplus::UnaryReturn< T, Op >

Definition at line 64 of file TypeComputations.h.

+ Collaboration diagram for UnaryReturn< T, Op >:
Class Members
typedef T Type_t

◆ qmcplusplus::UnaryReturn< T, OpNot >

struct qmcplusplus::UnaryReturn< T, OpNot >

template<class T>
struct qmcplusplus::UnaryReturn< T, OpNot >

Definition at line 261 of file OperatorTags.h.

+ Collaboration diagram for UnaryReturn< T, OpNot >:
Class Members
typedef bool Type_t

◆ qmcplusplus::UnaryReturn< T2, OpCast< T1 > >

struct qmcplusplus::UnaryReturn< T2, OpCast< T1 > >

template<class T1, class T2>
struct qmcplusplus::UnaryReturn< T2, OpCast< T1 > >

Definition at line 278 of file OperatorTags.h.

+ Collaboration diagram for UnaryReturn< T2, OpCast< T1 > >:
Class Members
typedef T1 Type_t

◆ qmcplusplus::UpdateEngineSelector

struct qmcplusplus::UpdateEngineSelector

template<PlatformKind PL, typename VT>
struct qmcplusplus::UpdateEngineSelector< PL, VT >

Definition at line 36 of file DiracDeterminantBatched.h.

+ Collaboration diagram for UpdateEngineSelector< PL, VT >:

◆ qmcplusplus::UpdateEngineSelector< PlatformKind::OMPTARGET, VT >

struct qmcplusplus::UpdateEngineSelector< PlatformKind::OMPTARGET, VT >

template<typename VT>
struct qmcplusplus::UpdateEngineSelector< PlatformKind::OMPTARGET, VT >

Definition at line 39 of file DiracDeterminantBatched.h.

+ Collaboration diagram for UpdateEngineSelector< PlatformKind::OMPTARGET, VT >:
Class Members
typedef DelayedUpdateBatched< OMPTARGET, VT > Engine

◆ qmcplusplus::ValGradLap

struct qmcplusplus::ValGradLap

Definition at line 445 of file CuspCorrectionConstruction.cpp.

+ Collaboration diagram for ValGradLap:
Class Members
GradType grad
ValueType lap
ValueType val

◆ qmcplusplus::ValueAlias_impl

struct qmcplusplus::ValueAlias_impl

template<typename TREAL, typename TREF, typename = bool>
struct qmcplusplus::ValueAlias_impl< TREAL, TREF, typename >

Definition at line 63 of file complex_help.hpp.

+ Collaboration diagram for ValueAlias_impl< TREAL, TREF, typename >:

◆ qmcplusplus::ValueAlias_impl< TREAL, TREF, IsComplex< TREF > >

struct qmcplusplus::ValueAlias_impl< TREAL, TREF, IsComplex< TREF > >

template<typename TREAL, typename TREF>
struct qmcplusplus::ValueAlias_impl< TREAL, TREF, IsComplex< TREF > >

Definition at line 73 of file complex_help.hpp.

+ Collaboration diagram for ValueAlias_impl< TREAL, TREF, IsComplex< TREF > >:
Class Members
typedef complex< TREAL > value_type

◆ qmcplusplus::ValueAlias_impl< TREAL, TREF, IsReal< TREF > >

struct qmcplusplus::ValueAlias_impl< TREAL, TREF, IsReal< TREF > >

template<typename TREAL, typename TREF>
struct qmcplusplus::ValueAlias_impl< TREAL, TREF, IsReal< TREF > >

Definition at line 67 of file complex_help.hpp.

+ Collaboration diagram for ValueAlias_impl< TREAL, TREF, IsReal< TREF > >:
Class Members
typedef TREAL value_type

◆ qmcplusplus::WalkerLogState

struct qmcplusplus::WalkerLogState

Helper struct holding data transferred from WalkerLogManager to WalkerLogCollector following input read.

Definition at line 31 of file WalkerLogCollector.h.

+ Collaboration diagram for WalkerLogState:
Class Members
bool logs_active whether logs are active in the current driver
int step_period period between MC steps for data collection
bool verbose controls verbosity of log file writes

◆ qmcplusplus::WaveFunctionTypes

struct qmcplusplus::WaveFunctionTypes

template<typename VALUE, typename FP_VALUE>
struct qmcplusplus::WaveFunctionTypes< VALUE, FP_VALUE >

Consistent way to get the set of types used in the QMCWaveFunction module, without resorting to ifdef'd type aliases accessed through inheritance.

You can at least test all flavors without tricky scoping or recompiling. Determines type set for class through composition instead of inheritance.

Its somewhat question whether it is even worth have all these shortened type aliases Defined differently in different modules of the code, but it needs further study.

I would have liked to use QMCTypes but they do something dumb with handling complex which basically bakes in multiple builds for Real and Complex.

Definition at line 34 of file WaveFunctionTypes.hpp.

+ Collaboration diagram for WaveFunctionTypes< VALUE, FP_VALUE >:
Class Members
typedef complex< Real > Complex
typedef RealAlias< FullPrecValue > FullPrecReal
typedef FP_VALUE FullPrecValue
typedef TinyVector< Value, OHMMS_DIM > Grad
typedef Tensor< Value, OHMMS_DIM > Hess
typedef complex< FullPrecReal > LogValue
typedef FP_VALUE PsiValue
typedef RealAlias< Value > Real
typedef VALUE Value

◆ qmcplusplus::WLog

struct qmcplusplus::WLog

Basic data types for walker log data.

Definition at line 29 of file WalkerLogBuffer.h.

+ Collaboration diagram for WLog:
Class Members
typedef complex< Real > Comp
typedef long Int
typedef Real PsiVal
typedef OHMMS_PRECISION_FULL Real

Typedef Documentation

◆ aligned_allocator

using aligned_allocator = Mallocator<T, ALIGN>

Definition at line 33 of file aligned_allocator.hpp.

◆ aligned_vector

using aligned_vector = std::vector<T, aligned_allocator<T> >

Definition at line 35 of file aligned_allocator.hpp.

◆ BasisSet_t

Definition at line 118 of file LCAOrbitalBuilder.cpp.

◆ ChronoClock

using ChronoClock = std::chrono::system_clock

Definition at line 24 of file Clock.h.

◆ ComplexType

Definition at line 33 of file test_DiracDeterminant.cpp.

◆ CPUOMPTargetSelector

◆ CPUOMPTargetVendorSelector

◆ CUDATypeMap

using CUDATypeMap = typename std::disjunction<OnTypesEqual<T, float, float>, OnTypesEqual<T, double, double>, OnTypesEqual<T, float*, float*>, OnTypesEqual<T, double*, double*>, OnTypesEqual<T, float**, float**>, OnTypesEqual<T, double**, double**>, OnTypesEqual<T, std::complex<double>, cuDoubleComplex>, OnTypesEqual<T, std::complex<float>, cuComplex>, OnTypesEqual<T, std::complex<double>*, cuDoubleComplex*>, OnTypesEqual<T, std::complex<float>**, cuComplex**>, OnTypesEqual<T, std::complex<double>**, cuDoubleComplex**>, OnTypesEqual<T, std::complex<float>*, cuComplex*>, OnTypesEqual<T, const std::complex<double>*, const cuDoubleComplex*>, OnTypesEqual<T, const std::complex<float>*, const cuComplex*>, OnTypesEqual<T, const std::complex<float>**, const cuComplex**>, OnTypesEqual<T, const std::complex<double>**, const cuDoubleComplex**>, OnTypesEqual<T, const std::complex<float>* const*, const cuComplex* const*>, OnTypesEqual<T, const std::complex<double>* const*, const cuDoubleComplex* const*>, default_type<void> >::type

Definition at line 50 of file CUDATypeMapping.hpp.

◆ DeviceAllocator

Definition at line 60 of file DualAllocatorAliases.hpp.

◆ DiracDet

◆ EstimatorInput

◆ EstimatorInputs

using EstimatorInputs = std::vector<EstimatorInput>

Definition at line 53 of file EstimatorManagerInput.h.

◆ FakeJasFunctor

◆ FakeTimer

Definition at line 235 of file NewTimer.h.

◆ FakeTimerManager

Definition at line 23 of file test_timer.cpp.

◆ FullPrecReal

Definition at line 18 of file DMCRefEnergy.cpp.

◆ FullPrecRealType

◆ FullPrecValueType

◆ GradType

◆ GridType

Definition at line 30 of file DensityEstimator.cpp.

◆ hipblasTypeMap

using hipblasTypeMap = typename std::disjunction<OnTypesEqual<T, float, float>, OnTypesEqual<T, double, double>, OnTypesEqual<T, float*, float*>, OnTypesEqual<T, double*, double*>, OnTypesEqual<T, float**, float**>, OnTypesEqual<T, double**, double**>, OnTypesEqual<T, std::complex<double>, hipblasDoubleComplex>, OnTypesEqual<T, std::complex<float>, hipblasComplex>, OnTypesEqual<T, std::complex<double>*, hipblasDoubleComplex*>, OnTypesEqual<T, std::complex<float>**, hipblasComplex**>, OnTypesEqual<T, std::complex<double>**, hipblasDoubleComplex**>, OnTypesEqual<T, std::complex<float>*, hipblasComplex*>, OnTypesEqual<T, const std::complex<double>*, const hipblasDoubleComplex*>, OnTypesEqual<T, const std::complex<float>*, const hipblasComplex*>, OnTypesEqual<T, const std::complex<float>**, const hipblasComplex**>, OnTypesEqual<T, const std::complex<double>**, const hipblasDoubleComplex**>, OnTypesEqual<T, const std::complex<float>* const*, const hipblasComplex* const*>, OnTypesEqual<T, const std::complex<double>* const*, const hipblasDoubleComplex* const*>, default_type<void> >::type

Definition at line 45 of file hipblasTypeMapping.hpp.

◆ IndexType

Definition at line 11 of file FSUtilities.h.

◆ input

Initial value:
{
class that handles xmlDoc
Definition: Libxml2Doc.h:76

Definition at line 131 of file test_SpinDensityNew.cpp.

◆ IsComplex

using IsComplex = std::enable_if_t<IsComplex_t<T>::value, bool>

Definition at line 28 of file complex_help.hpp.

◆ IsDualSpace

using IsDualSpace = std::enable_if_t<qmc_allocator_traits<Allocator>::is_dual_space>

Definition at line 52 of file allocator_traits.hpp.

◆ IsHostSafe

using IsHostSafe = std::enable_if_t<qmc_allocator_traits<Allocator>::is_host_accessible>

Definition at line 46 of file allocator_traits.hpp.

◆ IsNotHostSafe

using IsNotHostSafe = std::enable_if_t<!qmc_allocator_traits<Allocator>::is_host_accessible>

Definition at line 49 of file allocator_traits.hpp.

◆ IsReal

using IsReal = std::enable_if_t<std::is_floating_point<T>::value, bool>

Definition at line 35 of file complex_help.hpp.

◆ IsReal_t

using IsReal_t = std::is_floating_point<T>

Definition at line 32 of file complex_help.hpp.

◆ LogComplexApprox

using LogComplexApprox = Catch::Detail::LogComplexApprox

Definition at line 34 of file test_DiracMatrix.cpp.

◆ LogValue

◆ LRHandlerType

◆ MCPWalker

Initial value:
{
using Input = testing::ValidOneBodyDensityMatricesInput

Definition at line 31 of file test_walker.cpp.

◆ mRealType

typedef LRHandlerBase::mRealType mRealType

Definition at line 21 of file test_ewald3d.cpp.

◆ NewTimer

Definition at line 234 of file NewTimer.h.

◆ OffloadAllocator

Definition at line 23 of file OffloadAlignedAllocators.hpp.

◆ OffloadDeviceAllocator

◆ OffloadPinnedAllocator

◆ OffloadPinnedMatrix

◆ OffloadPinnedVector

◆ OffloadVector

Definition at line 35 of file test_LCAO_diamondC_2x1x1.cpp.

◆ opt_variables_type

Definition at line 24 of file OptimizableObject.h.

◆ ParseCaseVector_t

using ParseCaseVector_t = vector<ParseCase>

Definition at line 47 of file test_parser.cpp.

◆ PinnedAlignedAllocator

Definition at line 43 of file PinnedAllocator.h.

◆ PinnedAllocator

using PinnedAllocator = std::allocator<T>

The fact that the pinned allocators are not always pinned hurts readability elsewhere.

Definition at line 34 of file PinnedAllocator.h.

◆ PinnedDualAllocator

◆ PosType

Definition at line 18 of file test_kcontainer.cpp.

◆ pRealType

using pRealType = qmcplusplus::LRHandlerBase::pRealType

Definition at line 21 of file test_lrhandler.cpp.

◆ PsiValue

Definition at line 25 of file SlaterDet.cpp.

◆ QMCT

typedef QMCTraits QMCT

Definition at line 33 of file test_bare_kinetic.cpp.

◆ QuantumNumberType

using QuantumNumberType = TinyVector<int, 4>

Definition at line 37 of file OrbitalSetTraits.h.

◆ RadFunctorType

◆ RandomGenerator

using RandomGenerator = StdRandom<OHMMS_PRECISION_FULL>

Definition at line 55 of file RandomGenerator.h.

◆ Real

Definition at line 26 of file ForceBase.cpp.

◆ real_type

Definition at line 23 of file test_cartesian_tensor.cpp.

◆ RealAlias

using RealAlias = typename RealAlias_impl<T>::value_type

If you have a function templated on a value that can be real or complex and you need to get the base Real type if its complex or just the real.

If you try to do this on anything but a fp or a std::complex<fp> you will get a compilation error.

Definition at line 60 of file complex_help.hpp.

◆ RealType

Definition at line 22 of file test_min_oned.cpp.

◆ RefVector

using RefVector = std::vector<std::reference_wrapper<T> >

Definition at line 32 of file template_types.hpp.

◆ Return_t

Definition at line 29 of file BareKineticEnergy.cpp.

◆ RngValueType

using RngValueType = typename std::disjunction<OnTypesEqual<T, float, float>, OnTypesEqual<T, double, double>, OnTypesEqual<T, std::complex<float>, float>, OnTypesEqual<T, std::complex<double>, double>, default_type<void> >::type

Get the right type for rng in case of complex T.

Probably a more elegant way to do this especially in c++17

Definition at line 31 of file makeRngSpdMatrix.hpp.

◆ ScalarEstimatorInput

Definition at line 60 of file EstimatorManagerInput.h.

◆ ScalarEstimatorInputs

Definition at line 61 of file EstimatorManagerInput.h.

◆ ScopedFakeTimer

Definition at line 258 of file NewTimer.h.

◆ ScopedTimer

Definition at line 257 of file NewTimer.h.

◆ SPOMap

Definition at line 48 of file EstimatorManagerNew.cpp.

◆ SPOSetPtr

using SPOSetPtr = SPOSet*

Definition at line 573 of file SPOSet.h.

◆ StackKey

using StackKey = StackKeyParam<2>

Definition at line 129 of file NewTimer.h.

◆ StdComp

using StdComp = std::complex<double>

Definition at line 221 of file test_cuBLAS_LU.cpp.

◆ timer_id_t

using timer_id_t = unsigned char

Definition at line 56 of file NewTimer.h.

◆ TimerList_t

Definition at line 177 of file TimerManager.h.

◆ TimerNameList_t

using TimerNameList_t = std::vector<TimerIDName_t<T> >

Definition at line 156 of file TimerManager.h.

◆ TraceComp

using TraceComp = std::complex<TraceReal>

Definition at line 50 of file TraceManager.h.

◆ TraceInt

using TraceInt = long

Definition at line 48 of file TraceManager.h.

◆ TraceReal

Definition at line 49 of file TraceManager.h.

◆ UnpinnedDualAllocator

Definition at line 56 of file DualAllocatorAliases.hpp.

◆ UPtr

using UPtr = std::unique_ptr<T>

Definition at line 35 of file template_types.hpp.

◆ UPtrVector

using UPtrVector = std::vector<std::unique_ptr<T> >

Definition at line 38 of file template_types.hpp.

◆ Value_t

Definition at line 1088 of file DensityMatrices1B.cpp.

◆ value_type

Definition at line 28 of file ObservableHelper.h.

◆ ValueAlias

using ValueAlias = typename ValueAlias_impl<TREAL, TREF>::value_type

If you need to make a value type of a given precision based on a reference value type set the desired POD float point type as TREAL and set the reference type as TREF.

If TREF is real/complex, the generated Value type is real/complex.

Definition at line 83 of file complex_help.hpp.

◆ ValueType

◆ ValueVector

◆ vec_t

Definition at line 24 of file test_CrystalLattice.cpp.

◆ WP

Definition at line 34 of file ParticleSet.cpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

enumeration to classify a CrystalLattice

Use std::bitset<3> for all the dimension

Enumerator
SUPERCELL_OPEN 

nnn

SUPERCELL_WIRE 

nnp

SUPERCELL_SLAB 

npp

SUPERCELL_BULK 

ppp

SOA_OFFSET 

const to differentiate AoS and SoA

Definition at line 37 of file CrystalLattice.h.

38 {
39  SUPERCELL_OPEN = 0, /*!< nnn */
40  SUPERCELL_WIRE = 1, /*!< nnp */
41  SUPERCELL_SLAB = 3, /*!< npp */
42  SUPERCELL_BULK = 7, /*!< ppp */
43  SOA_OFFSET = 32 /*!< const to differentiate AoS and SoA */
44 };

◆ anonymous enum

anonymous enum

enumeration for DTD_BConds specialization

G = general cell with image-cell checks S = special treatment of a general cell with Wigner-cell radius == Simulation cell O = orthogonal cell X = exhaustive search (reference implementation)

Enumerator
PPPG 
PPPS 
PPPO 
PPPX 
PPNG 
PPNS 
PPNO 
PPNX 

Definition at line 28 of file LatticeAnalyzer.h.

◆ anonymous enum

anonymous enum
Enumerator
q_n 
q_l 
q_m 
q_s 

Definition at line 39 of file OrbitalSetTraits.h.

◆ anonymous enum

anonymous enum

Tmove options.

Enumerator
TMOVE_OFF 
TMOVE_V0 
TMOVE_V1 
TMOVE_V3 

Definition at line 29 of file NonLocalTOperator.h.

30 {
31  TMOVE_OFF = 0, // no Tmove
32  TMOVE_V0, // M. Casula, PRB 74, 161102(R) (2006)
33  TMOVE_V1, // version 1, M. Casula et al., JCP 132, 154113 (2010)
34  TMOVE_V3, // an approximation to version 1 but much faster.
35 };

◆ anonymous enum

anonymous enum

enumeration for EstimatorManagerBase.Options

Enumerator
COLLECT 
MANAGE 
RECORD 
POSTIRECV 
APPEND 

Definition at line 46 of file EstimatorManagerBase.cpp.

◆ anonymous enum

anonymous enum

enum to yes/no options saved in sParam

Enumerator
COMBOPT 
USETAUOPT 
MIXDMCOPT 
DUMMYOPT 

Definition at line 26 of file SFNBranch.cpp.

◆ anonymous enum

anonymous enum

enum to yes/no options saved in sParam

Enumerator
COMBOPT 
USETAUOPT 
MIXDMCOPT 
DUMMYOPT 

Definition at line 37 of file SimpleFixedNodeBranch.cpp.

◆ CoordsType

enum CoordsType
strong
Enumerator
POS 
POS_SPIN 

Definition at line 24 of file MCCoords.hpp.

◆ DataLocality

enum DataLocality
strong

data locality with respect to walker buffer

Enumerator
process 
rank 
crowd 
queue 
walker 

Definition at line 19 of file DataLocality.h.

◆ DetMatInvertor

enum DetMatInvertor
strong

determinant matrix inverter select

Enumerator
HOST 
ACCEL 

Definition at line 27 of file DiracDeterminantBase.h.

◆ DMC_MPI_Timers

◆ DMCRefEnergyScheme

enum DMCRefEnergyScheme
strong

DMCRefEnergy schemes.

Enumerator
UNLIMITED_HISTORY 
LIMITED_HISTORY 

Definition at line 19 of file DMCRefEnergyScheme.h.

◆ DMCTimers

enum DMCTimers
Enumerator
DMC_buffer 
DMC_movePbyP 
DMC_hamiltonian 
DMC_collectables 
DMC_tmoves 

Definition at line 40 of file DMCUpdatePbyP.h.

◆ DMTimers

◆ DriverDebugChecks

enum DriverDebugChecks : uint_fast8_t
strong
Enumerator
ALL_OFF 
CHECKGL_AFTER_LOAD 
CHECKGL_AFTER_MOVES 
CHECKGL_AFTER_TMOVE 

Definition at line 20 of file DriverDebugChecks.h.

◆ DTModes

enum DTModes : uint_fast8_t
strong
Enumerator
ALL_OFF 
NEED_FULL_TABLE_ANYTIME 

whether full table needs to be ready at anytime or not during PbyP Optimization can be implemented during forward PbyP move when the full table is not needed all the time.

DT consumers should know if full table is needed or not and request via addTable.

NEED_VP_FULL_TABLE_ON_HOST 

For distance tables of virtual particle (VP) sets constructed based on this table, whether full table is needed on host The corresponding DT of VP need to set MW_EVALUATE_RESULT_NO_TRANSFER_TO_HOST accordingly.

NEED_TEMP_DATA_ON_HOST 

whether temporary data set on the host is updated or not when a move is proposed.

Considering transferring data from accelerator to host is relatively expensive, only request this when data on host is needed for unoptimized code path. This flag affects three subroutines mw_move, mw_updatePartial, mw_finalizePbyP in DistanceTable.

MW_EVALUATE_RESULT_NO_TRANSFER_TO_HOST 

skip data transfer back to host after mw_evalaute full distance table.

this optimization can be used for distance table consumed directly on the device without copying back to the host.

NEED_FULL_TABLE_ON_HOST_AFTER_DONEPBYP 

whether full table needs to be ready at anytime or not after donePbyP Optimization can be implemented during forward PbyP move when the full table is not needed all the time.

DT consumers should know if full table is needed or not and request via addTable.

Definition at line 20 of file DTModes.h.

20  : uint_fast8_t
21 {
22  ALL_OFF = 0x0,
23  /** whether full table needs to be ready at anytime or not during PbyP
24  * Optimization can be implemented during forward PbyP move when the full table is not needed all the time.
25  * DT consumers should know if full table is needed or not and request via addTable.
26  */
28  /** For distance tables of virtual particle (VP) sets constructed based on this table, whether full table is needed on host
29  * The corresponding DT of VP need to set MW_EVALUATE_RESULT_NO_TRANSFER_TO_HOST accordingly.
30  */
32  /** whether temporary data set on the host is updated or not when a move is proposed.
33  * Considering transferring data from accelerator to host is relatively expensive,
34  * only request this when data on host is needed for unoptimized code path.
35  * This flag affects three subroutines mw_move, mw_updatePartial, mw_finalizePbyP in DistanceTable.
36  */
38  /** skip data transfer back to host after mw_evalaute full distance table.
39  * this optimization can be used for distance table consumed directly on the device without copying back to the host.
40  */
42  /** whether full table needs to be ready at anytime or not after donePbyP
43  * Optimization can be implemented during forward PbyP move when the full table is not needed all the time.
44  * DT consumers should know if full table is needed or not and request via addTable.
45  */
47 };
For distance tables of virtual particle (VP) sets constructed based on this table, whether full table is needed on host The corresponding DT of VP need to set MW_EVALUATE_RESULT_NO_TRANSFER_TO_HOST accordingly.
whether full table needs to be ready at anytime or not during PbyP Optimization can be implemented du...
whether full table needs to be ready at anytime or not after donePbyP Optimization can be implemented...
whether temporary data set on the host is updated or not when a move is proposed. ...
skip data transfer back to host after mw_evalaute full distance table.

◆ DynamicCoordinateKind

enum DynamicCoordinateKind
strong

enumerator for DynamicCoordinates kinds

Enumerator
DC_POS 
DC_POS_OFFLOAD 

Definition at line 29 of file DynamicCoordinates.h.

30 {
31  DC_POS, // SoA positions
32  DC_POS_OFFLOAD, // SoA positions with OpenMP offload
33 };

◆ Executor

enum Executor
strong
Enumerator
OPENMP 

Definition at line 28 of file Info.hpp.

29 {
30  OPENMP,
31 #ifdef QMC_EXP_THREADING
32  STD_THREADS
33 #endif
34 };

◆ OptimizerType

◆ PlatformKind

enum PlatformKind
strong
Enumerator
CPU 
OMPTARGET 
CUDA 
SYCL 

Definition at line 19 of file PlatformKinds.hpp.

◆ PosUnit

enum PosUnit
strong

enum class to assist copy and unit conversion operations on position vectors

Enumerator
Cartesian 

indicates that the values are in Cartesian units

Lattice 

indicates that the values are in Lattice units

Definition at line 21 of file PosUnit.h.

22 {
23  Cartesian = 0, /*!< indicates that the values are in Cartesian units*/
24  Lattice /*!< indicates that the values are in Lattice units*/
25 };
POLT::ParticleLayout Lattice

◆ PSetTimers

enum PSetTimers
Enumerator
PS_newpos 
PS_donePbyP 
PS_accept 
PS_loadWalker 
PS_update 
PS_dt_move 
PS_mw_copy 

Definition at line 36 of file ParticleSet.cpp.

◆ QMCModeEnum

enum to set the bit to determine the QMC mode

Can't be a scoped enum, unsafe out in qmcplusplus scope

Enumerator
UPDATE_MODE 

bit for move: walker or pbyp

MULTIPLE_MODE 

bit for multple configuration

SPACEWARP_MODE 

bit for space-warping

ALTERNATE_MODE 

bit for performing various analysis and weird qmc methods

GPU_MODE 

bit to use GPU driver

QMC_MODE_MAX 

Definition at line 26 of file DriverTraits.h.

27 {
28  UPDATE_MODE, /**< bit for move: walker or pbyp */
29  MULTIPLE_MODE, /**< bit for multple configuration */
30  SPACEWARP_MODE, /**< bit for space-warping */
31  ALTERNATE_MODE, /**< bit for performing various analysis and weird qmc methods */
32  GPU_MODE, /**< bit to use GPU driver */
33  QMC_MODE_MAX = 8
34 };
bit for space-warping
Definition: DriverTraits.h:30
bit for move: walker or pbyp
Definition: DriverTraits.h:28
bit to use GPU driver
Definition: DriverTraits.h:32
bit for multple configuration
Definition: DriverTraits.h:29
bit for performing various analysis and weird qmc methods
Definition: DriverTraits.h:31

◆ QMCRunType

enum QMCRunType
strong

enum for QMC Run Type

Enumerator
DUMMY 

dummy

VMC 

VMC type: vmc, vmc-ptcl, vmc-multiple, vmc-ptcl-multiple.

CSVMC 
DMC 

DMC type: dmc, dmc-ptcl.

RMC 

RMC type: rmc, rmc-ptcl.

VMC_OPT 

Optimization with vmc blocks

LINEAR_OPTIMIZE 
WF_TEST 
VMC_BATCH 
DMC_BATCH 
LINEAR_OPTIMIZE_BATCH 

Definition at line 7 of file DriverTraits.h.

8 {
9  DUMMY, /*!< dummy */
10  VMC, /**< VMC type: vmc, vmc-ptcl, vmc-multiple, vmc-ptcl-multiple */
11  CSVMC,
12  DMC, /**< DMC type: dmc, dmc-ptcl*/
13  RMC, /**< RMC type: rmc, rmc-ptcl */
14  VMC_OPT, /*!< Optimization with vmc blocks */
16  WF_TEST,
17  VMC_BATCH,
18  DMC_BATCH,
20 };
DMC type: dmc, dmc-ptcl.
RMC type: rmc, rmc-ptcl.
VMC type: vmc, vmc-ptcl, vmc-multiple, vmc-ptcl-multiple.

◆ SelectorKind

enum SelectorKind
strong
Enumerator
CPU_OMPTARGET 
CPU_OMPTARGET_CUDA 
CPU_OMPTARGET_SYCL 

Definition at line 24 of file PlatformSelector.hpp.

◆ smoothing_functions

enum smoothing_functions
strong
Enumerator
LEKS2018 
COSCOS 
LINEAR 

Definition at line 19 of file SmoothFunctions.hpp.

◆ SoAFields3D

◆ SODMCTimers

Enumerator
SODMC_buffer 
SODMC_movePbyP 
SODMC_hamiltonian 
SODMC_collectables 
SODMC_tmoves 

Definition at line 37 of file SODMCUpdatePbyP.h.

◆ TestEnum1

enum TestEnum1
strong
Enumerator
VALUE1 
VALUE2 

Definition at line 31 of file test_InputSection.cpp.

◆ TestEnum2

enum TestEnum2
strong
Enumerator
VALUE1 
VALUE2 

Definition at line 37 of file test_InputSection.cpp.

◆ TestTimer

enum TestTimer
Enumerator
MyTimer1 
MyTimer2 

Definition at line 390 of file test_timer.cpp.

◆ timer_levels

Enumerator
timer_level_none 
timer_level_coarse 
timer_level_medium 
timer_level_fine 
num_timer_levels 

Definition at line 42 of file NewTimer.h.

43 {
44  timer_level_none, // The 'none' settting is not for individual timers.
45  // It is for setting a threshold to turn all timers off.
49  num_timer_levels // this is not a timer level but to count the elements in this enum
50 };

◆ TimerEnum

◆ WC_Timers

enum WC_Timers
Enumerator
WC_branch 
WC_imbalance 
WC_prebalance 
WC_copyWalkers 
WC_recomputing 
WC_allreduce 
WC_loadbalance 
WC_send 
WC_recv 

Definition at line 34 of file WalkerControl.cpp.

Function Documentation

◆ abs() [1/2]

MakeReturn<UnaryNode<FnFabs, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::abs ( const Vector< T1, C1 > &  l)
inline

Definition at line 88 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by JeeIOrbitalSoA< FT >::acceptMove(), LRBreakup< BreakupBasis >::AddKToList(), EinsplineSetBuilder::AnalyzeTwists2(), BareKineticEnergy::BareKineticEnergy(), KContainer::BuildKLists(), ECPComponentBuilder::buildLocal(), OneBodyDensityMatrices::calcDensity(), OneBodyDensityMatrices::calcDensityDrift(), OneBodyDensityMatrices::calcDensityDriftWithSpin(), OneBodyDensityMatrices::calcDensityWithSpin(), LatticeAnalyzer< T, 3 >::calcSimulationCellRadius(), BsplineReader::check_twists(), GKIntegration< F, GKRule >::CheckError(), DiracDeterminantBase::checkG(), WaveFunctionTester::checkGradients(), EinsplineSetBuilder::CheckLattice(), QMCUpdateBase::checkLogAndGL(), QMCDriverNew::checkLogAndGL(), Quadrature3D< T >::CheckQuadratureRule(), Quadrature3D< T >::CheckQuadratureRuleReal(), WalkerLogCollector::collect(), ACForce::compute_regularizer_f(), QMCCostFunctionBase::computedCost(), DescentEngine::computeFinalizationUncertainties(), FiniteDifference::computeFiniteDiffRichardson(), QMCCostFunction::correlatedSampling(), QMCCostFunctionBatched::correlatedSampling(), CoulombPBCAA::CoulombPBCAA(), SPOSetInfo::count_degeneracies(), SlaterDetBuilder::createMSDFast(), QMCGaussianParserBase::createMultiDeterminantSet(), FreeOrbitalBuilder::createSPOSetFromXML(), ECPComponentBuilder::createVrWithBasisGroup(), DensityMatrices1B::density_drift(), DensityMatrices1B::density_only(), RPABFeeBreakup< T >::Dlindhard(), RPABFeeBreakup< T >::Dlindhardp(), kSpaceJastrow::Equivalent(), EwaldHandlerQuasi2D::evaluate_slab(), LocalECPotential::evaluate_sp(), BareKineticEnergy::evaluate_sp(), CoulombPBCAB::evaluate_sp(), CoulombPBCAA::evaluate_sp(), CoulombPotential< T >::evaluate_spAA(), CoulombPotential< T >::evaluate_spAB(), SphericalTensor< T, Point_t, Tensor_t, GGG_t >::evaluateAll(), PolynomialFunctor3D::evaluateDerivatives(), NonLocalECPotential::evaluateImpl(), NonLocalECPComponent::evaluateOneBodyOpMatrixdRContribution(), NonLocalECPComponent::evaluateOneWithForces(), SoaSphericalTensor< ST >::evaluateVGL_impl(), SphericalTensor< T, Point_t, Tensor_t, GGG_t >::evaluateWithHessian(), evalX(), qmcplusplus::ewaldref::ewaldEnergy(), qmcplusplus::ewaldref::ewaldSum(), QMCMain::executeCMCSection(), RadialOrbitalSetBuilder< COT >::find_cutoff(), find_minimum(), generateCuspInfo(), GamesAsciiParser::getCSF(), WalkerReconfiguration::getIndexPermutation(), GamesAsciiParser::getORMAS(), getScore(), GKIntegration< F, GKRule >::GKGeneral(), QMCCostFunction::GradCost(), QMCCostFunctionBatched::GradCost(), qmcplusplus::ewaldref::gridSum(), CenterGrid::Init(), MPC::init_f_G(), MPC::init_gvecs(), CoulombPBCAB::initBreakup(), SpaceGrid::initialize_rectilinear(), InitMolecularSystem::initWithVolume(), GKIntegration< F, GKRule >::Integrate(), QMCFixedSampleLinearOptimizeBatched::is_best_cost(), LatticeAnalyzer< T, 3 >::isDiagonalOnly(), LatticeAnalyzer< T, 2 >::isDiagonalOnly(), ChannelPotential::jl(), LegendrePlm(), LCAOrbitalBuilder::LoadFullCoefsFromH5(), qmcplusplus::ewaldref::madelungSum(), mag(), DensityMatrices1B::match(), NonLocalECPotential::mw_evaluateImpl(), SPOSetInputInfo::occupy_energies(), QMCFixedSampleLinearOptimizeBatched::one_shift_run(), operator!=(), EnergyOrder::operator()(), FnFabs::operator()(), kSpaceJastrow::operator()(), KPoint::operator<(), KPoint::operator==(), operator==(), operator==(), CrystalLattice< ST, 3 >::outOfBound(), GaussianFCHKParser::parse(), ECPComponentBuilder::parseCasino(), parseGridInput(), lup::permute_max_diagonal(), PolynomialFunctor3D::PolynomialFunctor3D(), QMCFixedSampleLinearOptimizeBatched::previous_linear_methods_run(), LCAOrbitalBuilder::putPBCFromH5(), Quadrature3D< T >::Quadrature3D(), QuinticSplineSolve(), SkParserScalarDat::read_sk_file(), SlaterDetBuilder::readDetList(), SlaterDetBuilder::readDetListH5(), EinsplineSetBuilder::ReadGvectors_ESHDF(), SplineSetReader< typename SA::SplineBase >::readOneOrbitalCoefs(), EinsplineSetBuilder::ReadOrbitalInfo_ESHDF(), WalkerReconfigurationMPI::recvWalkers(), CrystalLattice< ST, 3 >::reset(), PolynomialFunctor3D::reset_gamma(), PolynomialFunctor3D::resize(), CenterGrid::ReverseMap(), QMCFixedSampleLinearOptimize::run(), GradientTest::run(), WaveFunctionTester::runBasicTest(), WalkerReconfigurationMPI::sendWalkers(), SimCellRad(), NESpaceGrid< REAL >::someMoreAxisGridStuff(), WalkerReconfigurationMPI::swapWalkers(), TEST_CASE(), SHOSet::test_derivatives(), SHOSet::test_overlap(), DensityMatrices1B::test_overlap(), BackflowTransformation::testDeriv(), DiracDeterminantWithBackflow::testDerivFjj(), OneBodyDensityMatricesTests< T >::testGenerateSamplesForSpinor(), DiracDeterminantWithBackflow::testGGG(), testJastrow(), PWBasis::trimforecut(), EinsplineSetBuilder::TwistPair(), DescentEngine::updateParameters(), EnergyDensityEstimator::write_nonzero_domains(), and OrbitalImages::write_orbital_xsf().

90 {
91  using Tree_t = UnaryNode<FnFabs, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
92  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
93 }

◆ abs() [2/2]

MakeReturn<UnaryNode<FnFabs, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::abs ( const Expression< T1 > &  l)
inline

Definition at line 1435 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1437 {
1438  using Tree_t = UnaryNode<FnFabs, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1439  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1440 }

◆ accum_constant()

RealType qmcplusplus::accum_constant ( CombinedTraceSample< TraceReal > *  etrace,
RealType  weight = 1.0 
)
inline

Definition at line 1091 of file DensityMatrices1B.cpp.

References CombinedTraceSample< T >::combine(), TraceSample< T >::sample, and Vector< T, Alloc >::size().

Referenced by DensityMatrices1B::get_energies().

1092 {
1093  RealType E = 0.0;
1094  if (etrace)
1095  {
1096  etrace->combine();
1097  for (int p = 0; p < etrace->sample.size(); ++p)
1098  E += etrace->sample[p];
1099  }
1100  return weight * E;
1101 }
size_type size() const
return the current size
Definition: OhmmsVector.h:162
QMCTraits::RealType RealType

◆ accum_sample() [1/2]

void qmcplusplus::accum_sample ( std::vector< Value_t > &  E_samp,
CombinedTraceSample< T > *  etrace,
RealType  weight = 1.0 
)
inline

Definition at line 1104 of file DensityMatrices1B.cpp.

References CombinedTraceSample< T >::combine(), TraceSample< T >::sample, and Vector< T, Alloc >::size().

Referenced by DensityMatrices1B::get_energies().

1105 {
1106  if (etrace)
1107  {
1108  etrace->combine();
1109  for (int p = 0; p < etrace->sample.size(); ++p)
1110  E_samp[p] += weight * etrace->sample[p];
1111  }
1112 }

◆ accum_sample() [2/2]

void qmcplusplus::accum_sample ( std::vector< Value_t > &  E_samp,
TraceSample< T > *  etrace,
RealType  weight = 1.0 
)
inline

Definition at line 1115 of file DensityMatrices1B.cpp.

References if(), real(), TraceSample< T >::sample, and Vector< T, Alloc >::size().

1116 {
1117 #ifdef QMC_COMPLEX
1118  if (etrace)
1119  for (int p = 0; p < etrace->sample.size(); ++p)
1120  E_samp[p] += weight * etrace->sample[p];
1121 #else
1122  if (etrace)
1123  for (int p = 0; p < etrace->sample.size(); ++p)
1124  E_samp[p] += weight * real(etrace->sample[p]);
1125 #endif
1126 }
QMCTraits::RealType real
if(c->rank()==0)

◆ accumulate_elements()

void qmcplusplus::accumulate_elements ( IT1  first,
IT1  last,
IT2  res 
)
inline

Definition at line 34 of file IteratorUtility.h.

Referenced by SkEstimator::evaluate(), and SkAllEstimator::evaluate().

35 {
36  while (first != last)
37  *res++ += *first++;
38 }

◆ accumulateFromPsets()

void qmcplusplus::accumulateFromPsets ( int  ncrowds,
SpinDensityNew sdn,
UPtrVector< OperatorEstBase > &  crowd_sdns 
)

Definition at line 51 of file test_SpinDensityNew.cpp.

References SpinDensityNew::accumulate(), pset, sdn, SpinDensityNew::spawnCrowdClone(), and qmcplusplus::hdf::walkers.

52 {
53  const SimulationCell simulation_cell;
54  for (int iops = 0; iops < ncrowds; ++iops)
55  {
56  std::vector<OperatorEstBase::MCPWalker> walkers;
57  int nwalkers = 4;
58  for (int iw = 0; iw < nwalkers; ++iw)
59  walkers.emplace_back(2);
60 
61  std::vector<ParticleSet> psets;
62 
63  crowd_sdns.emplace_back(sdn.spawnCrowdClone());
64  SpinDensityNew& crowd_sdn = dynamic_cast<SpinDensityNew&>(*(crowd_sdns.back()));
65 
66  for (int iw = 0; iw < nwalkers; ++iw)
67  {
68  psets.emplace_back(simulation_cell);
69  ParticleSet& pset = psets.back();
70  pset.create({2});
71  pset.R[0] = ParticleSet::PosType(0.00000000, 0.00000000, 0.00000000);
72  pset.R[1] = ParticleSet::PosType(0.68658058, 0.68658058, 0.68658058);
73  }
74 
75  std::vector<TrialWaveFunction> wfns;
76  std::vector<QMCHamiltonian> hams;
77 
78  auto ref_walkers = makeRefVector<OperatorEstBase::MCPWalker>(walkers);
79  auto ref_psets = makeRefVector<ParticleSet>(psets);
80  auto ref_wfns = makeRefVector<TrialWaveFunction>(wfns);
81  auto ref_hams = makeRefVector<QMCHamiltonian>(hams);
82 
83  FakeRandom<OHMMS_PRECISION_FULL> rng;
84 
85  crowd_sdn.accumulate(ref_walkers, ref_psets, ref_wfns, ref_hams, rng);
86  }
87 }
const char walkers[]
Definition: HDFVersion.h:36
std::unique_ptr< OperatorEstBase > spawnCrowdClone() const override
standard interface
QMCTraits::PosType PosType
SpinDensityNew(std::move(sdi), species_set)
SpinDensityNew sdn(std::move(sdi), lattice, species_set)

◆ acos() [1/2]

MakeReturn<UnaryNode<FnArcCos, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::acos ( const Vector< T1, C1 > &  l)
inline

Definition at line 32 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by NESpaceGrid< REAL >::accumulate(), LatticeAnalyzer< T, 2 >::calcSimulationCellRadius(), LatticeAnalyzer< T, 3 >::calcSolidAngles(), LatticeAnalyzer< T, 2 >::calcSolidAngles(), cart2sph(), SpaceGrid::check_grid(), NESpaceGrid< REAL >::check_grid(), CubicFormula(), derivYlmSpherical(), SpaceGrid::evaluate(), FnArcCos::operator()(), and Quadrature3D< T >::Quadrature3D().

34 {
35  using Tree_t = UnaryNode<FnArcCos, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
36  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
37 }

◆ acos() [2/2]

MakeReturn<UnaryNode<FnArcCos, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::acos ( const Expression< T1 > &  l)
inline

Definition at line 1379 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1381 {
1382  using Tree_t = UnaryNode<FnArcCos, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1383  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1384 }

◆ addProperty() [1/6]

oh qmcplusplus::addProperty ( propertyFloat  ,
"propertyFloat"  ,
hFile   
)

◆ addProperty() [2/6]

oh qmcplusplus::addProperty ( propertyTensor  ,
"propertyTensor"  ,
hFile   
)

◆ addProperty() [3/6]

oh qmcplusplus::addProperty ( propertyMatrix  ,
"propertyMatrix"  ,
hFile   
)

◆ addProperty() [4/6]

oh qmcplusplus::addProperty ( propertyTensor  ,
"propertyTinyVector"  ,
hFile   
)

◆ addProperty() [5/6]

oh qmcplusplus::addProperty ( propertyVector  ,
"propertyVector"  ,
hFile   
)

◆ addProperty() [6/6]

oh qmcplusplus::addProperty ( propertyVectorTinyVector  ,
"propertyVectorTinyVector"  ,
hFile   
)

◆ app_debug_stream()

std::ostream& qmcplusplus::app_debug_stream ( )
inline

Definition at line 71 of file OutputManager.h.

References InfoStream::getStream(), and infoDebug.

Referenced by ResourceCollection::addResource(), VMCBatched::run(), and DMCBatched::run().

71 { return infoDebug.getStream(); }
std::ostream & getStream(const std::string &tag="")
returns current stream
Definition: InfoStream.h:37
InfoStream infoDebug

◆ app_error()

std::ostream& qmcplusplus::app_error ( )
inline

Definition at line 67 of file OutputManager.h.

References InfoStream::getStream(), and infoError.

Referenced by PWOrbitalSet::addVector(), PWRealOrbitalSet::addVector(), EinsplineSetBuilder::AnalyzeTwists2(), WalkerControlBase::applyNmaxNmin(), JastrowBuilder::build_eeI(), LatticeGaussianProductBuilder::buildComponent(), ExampleHeBuilder::buildComponent(), kSpaceJastrowBuilder::buildComponent(), RadialJastrowBuilder::buildComponent(), ECPComponentBuilder::buildL2(), ECPComponentBuilder::buildSemiLocalAndLocal(), EinsplineSetBuilder::CheckLattice(), Quadrature3D< T >::CheckQuadratureRule(), Quadrature3D< T >::CheckQuadratureRuleReal(), OneDimGridFactory::createGrid(), PWOrbitalSetBuilder::createPW(), PWOrbitalSetBuilder::createPWBasis(), WalkerControlMPI::determineNewWalkerPopulation(), WalkerControl::determineNewWalkerPopulation(), ReportEngine::error(), QMCMain::execute(), ExpFitClass< M >::Fit(), ExpFitClass< M >::FitCusp(), PWOrbitalSetBuilder::getH5(), XMLParticleParser::getPtclAttrib(), RadialJastrowBuilder::guardAgainstOBC(), RadialJastrowBuilder::guardAgainstPBC(), CSUpdateBase::initCSWalkers(), HybridRepSetReader< SA >::initialize_hybridrep_atomic_centers(), main(), EinsplineSetBuilder::OccupyBands(), ECPComponentBuilder::parseCasino(), PolynomialFunctor3D::PolynomialFunctor3D(), QMCAppBase::pushDocument(), HDFWalkerInput_0_4::put(), HDFWalkerInput_0_4::read_hdf5(), HDFWalkerInput_0_4::read_hdf5_scatter(), HDFWalkerInput_0_4::read_phdf5(), EinsplineSetBuilder::ReadOrbitalInfo(), EinsplineSetBuilder::ReadOrbitalInfo_ESHDF(), PolynomialFunctor3D::reset_gamma(), MCWalkerConfiguration::resetWalkerProperty(), BasisSetBase< T >::resize(), WalkerControlMPI::swapWalkersSimple(), TEST_CASE(), ECPotentialBuilder::useSimpleTableFormat(), and ECPotentialBuilder::useXmlFormat().

67 { return infoError.getStream() << "ERROR "; }
std::ostream & getStream(const std::string &tag="")
returns current stream
Definition: InfoStream.h:37
InfoStream infoError

◆ app_log()

std::ostream& qmcplusplus::app_log ( )
inline

Definition at line 65 of file OutputManager.h.

References InfoStream::getStream(), and infoLog.

Referenced by NESpaceGrid< REAL >::accumulate(), EstimatorManagerBase::add(), CoulombPBCAB::add(), TrialWaveFunction::addComponent(), HamiltonianFactory::addCoulombPotential(), WaveFunctionPool::addFactory(), HamiltonianFactory::addForceHam(), Backflow_eI_spin< FT >::addFunc(), RadialOrbitalSetBuilder< COT >::addGridH5(), EstimatorManagerNew::addMainEstimator(), ForwardWalking::addObservables(), QMCHamiltonian::addObservables(), BackflowBuilder::addOneBody(), SymmetryGroup::addOperator(), QMCHamiltonian::addOperator(), QMCHamiltonian::addOperatorType(), BackflowBuilder::addRPA(), ParticleSet::addTable(), BackflowBuilder::addTwoBody(), QMCDriver::addWalkers(), RMCUpdatePbyPWithDrift::advanceWalkersRMC(), RMCUpdateAllWithDrift::advanceWalkersRMC(), EinsplineSetBuilder::AnalyzeTwists2(), SPOSet::basic_report(), SimpleFixedNodeBranch::branch(), TraceManager::buffer_sample(), HamiltonianFactory::build(), BackflowBuilder::buildBackflowTransformation(), SymmetryBuilder::buildByHand(), AGPDeterminantBuilder::buildComponent(), kSpaceJastrowBuilder::buildComponent(), SlaterDetBuilder::buildComponent(), JastrowBuilder::buildkSpace(), ECPComponentBuilder::buildL2(), ECPComponentBuilder::buildLocal(), RotatedSPOs::buildOptVariables(), RPAJastrow::buildOrbital(), ECPComponentBuilder::buildSemiLocalAndLocal(), ECPComponentBuilder::buildSO(), WaveFunctionFactory::buildTWF(), TraceManager::check_clones(), JeeIOrbitalSoA< FT >::check_complete(), SpaceGrid::check_grid(), NESpaceGrid< REAL >::check_grid(), BsplineReader::check_twists(), WalkerLogCollector::checkBuffers(), WalkerLogManager::checkCollectors(), QMCCostFunction::checkConfigurations(), QMCCostFunctionBatched::checkConfigurations(), TraceSamples< std::complex< TraceReal > >::checkout_array(), SimpleFixedNodeBranch::checkParameters(), MagnetizationDensityInput::MagnetizationDensityInputSection::checkParticularValidity(), PWParameterSet::checkVersion(), TraceManager::close_file(), WalkerLogManager::closeFile(), WalkerLogManager::closeHDFFile(), SimpleFixedNodeBranch::collect(), TraceBuffer< TraceInt >::collect_sample(), DensityMatrices1B::compare(), DescentEngine::computeFinalizationUncertainties(), CoulombPBCAA::CoulombPBCAA(), CoulombPBCAB::CoulombPBCAB(), HybridRepSetReader< SA >::create_atomic_centers_Gspace(), SplineC2R< ST >::create_spline(), SplineR2R< ST >::create_spline(), SplineC2C< ST >::create_spline(), SplineC2COMPTarget< ST >::create_spline(), SplineC2ROMPTarget< ST >::create_spline(), HybridRepSetReader< SA >::create_spline_set(), SplineSetReader< typename SA::SplineBase >::create_spline_set(), AGPDeterminantBuilder::createAGP(), AOBasisBuilder< COT >::createAOSet(), AOBasisBuilder< COT >::createAOSetH5(), LCAOrbitalBuilder::createBasisSetH5(), CountingJastrowBuilder::createCJ(), MultiDiracDeterminant::createDetData(), ECPComponentBuilder::createGrid(), RadialJastrowBuilder::createJ1(), SlaterDetBuilder::createMSDFast(), QMCGaussianParserBase::createMultiDeterminantSetFromH5(), PWOrbitalSetBuilder::createPW(), PWOrbitalSetBuilder::createPWBasis(), QMCDriverFactory::createQMCDriver(), ParticleSet::createSK(), SplineSetReader< typename SA::SplineBase >::createSplineDataSpaceLookforDumpFile(), SHOSetBuilder::createSPOSet(), SPOSetBuilder::createSPOSet(), SPOSetBuilderFactory::createSPOSetBuilder(), FreeOrbitalBuilder::createSPOSetFromXML(), LCAOrbitalBuilder::createSPOSetFromXML(), LCAOSpinorBuilder::createSPOSetFromXML(), SHOSetBuilder::createSPOSetFromXML(), EinsplineSetBuilder::createSPOSetFromXML(), ECPComponentBuilder::createVrWithBasisGroup(), createWalkerController(), ECPComponentBuilder::doBreakUp(), QMCGaussianParserBase::dump(), VMCBatched::enable_sample_collection(), EstimatorManagerBaseTest::EstimatorManagerBaseTest(), EstimatorManagerNew::EstimatorManagerNew(), EstimatorManagerNewTest::EstimatorManagerNewTest(), CoulombPBCAB::evalConsts(), StressPBC::evalConsts_AA(), EnergyDensityEstimator::evaluate(), LatticeDeviationEstimator::evaluate(), SpaceGrid::evaluate(), OrbitalImages::evaluate(), SHOSet::evaluate_check(), DensityMatrices1B::evaluate_matrix(), LocalECPotential::evaluate_sp(), BareKineticEnergy::evaluate_sp(), CoulombPBCAB::evaluate_sp(), CoulombPBCAA::evaluate_sp(), CoulombPotential< T >::evaluate_spAA(), CoulombPotential< T >::evaluate_spAB(), CountingJastrow< RegionType >::evaluateDerivatives(), CountingJastrow< RegionType >::evaluateExponents(), CountingJastrow< RegionType >::evaluateExponents_print(), NonLocalECPotential::evaluateImpl(), CountingJastrow< RegionType >::evaluateTempExponents(), CountingJastrow< RegionType >::evaluateTempExponents_print(), EwaldHandler2D::EwaldHandler2D(), EwaldHandlerQuasi2D::EwaldHandlerQuasi2D(), QMCMain::execute(), QMCMain::executeCMCSection(), QMCMain::executeDebugSection(), QMCMain::executeLoop(), AOBasisBuilder< COT >::expandYlm(), EwaldHandler3D::fillFk(), RadialOrbitalSetBuilder< COT >::finalize(), QMCDriverNew::finalize(), SimpleFixedNodeBranch::finalize(), TraceManager::finalize_traces(), KContainer::findApproxMMax(), QMCFixedSampleLinearOptimize::finish(), ForceChiesaPBCAA::ForceChiesaPBCAA(), DensityMatrices1B::generate_density_samples(), DensityMatrices1B::generate_samples(), generateCuspInfo(), OneBodyDensityMatrices::generateDensitySamples(), OneBodyDensityMatrices::generateDensitySamplesWithSpin(), QMCFixedSampleLinearOptimizeBatched::generateSamples(), OneBodyDensityMatrices::generateSamples(), QMCFixedSampleLinearOptimize::generateSamples(), SkAllEstimator::get(), EnergyDensityEstimator::get_particleset(), QMCCostFunction::getConfigurations(), QMCCostFunctionBatched::getConfigurations(), LRCoulombSingleton::getDerivHandler(), LRCoulombSingleton::getHandler(), LinearMethod::getLowestEigenvector(), MPC::init_f_G(), OutputMatrix::init_file(), MPC::init_gvecs(), MPC::init_spline(), MPC::initBreakup(), EwaldHandler3D::initBreakup(), QMCFiniteSize::initBreakup(), LRRPABFeeHandlerTemp< Func, BreakupBasis >::InitBreakup(), LRRPAHandlerTemp< Func, BreakupBasis >::InitBreakup(), LRHandlerTemp< Func, BreakupBasis >::InitBreakup(), CoulombPBCAA::initBreakup(), CoulombPBCAB::initBreakup(), LRHandlerSRCoulomb< Func, BreakupBasis >::InitBreakup(), CSUpdateBase::initCSWalkersForPbyP(), BsplineFunctor< REAL >::initialize(), HybridRepSetReader< SA >::initialize_hybrid_pio_gather(), HybridRepSetReader< SA >::initialize_hybridrep_atomic_centers(), SpaceGrid::initialize_rectilinear(), SplineSetReader< typename SA::SplineBase >::initialize_spline_pio_gather(), QMCHamiltonian::initialize_traces(), TraceManager::initialize_traces(), SpaceGrid::initialize_voronoi(), TimerManager< qmcplusplus::TimerType< CLOCK > >::initializeTimer(), SFNBranch::initParam(), SimpleFixedNodeBranch::initReptile(), RadialJastrowBuilder::initTwoBodyFunctor(), ForceBase::initVarReduction(), SimpleFixedNodeBranch::initWalkerController(), QMCUpdateBase::initWalkersForPbyP(), InitMolecularSystem::initWithVolume(), QMCCostFunctionBase::isEffectiveWeightValid(), kSpaceJastrow::kSpaceJastrow(), LatticeDeviationEstimator::LatticeDeviationEstimator(), LCAOrbitalBuilder::loadBasisSetFromH5(), LCAOrbitalBuilder::loadBasisSetFromXML(), LCAOSpinorBuilder::loadMO(), LCAOrbitalBuilder::loadMO(), RotatedSPOs::log_antisym_matrix(), main(), TraceManager::make_combined_trace(), EnergyDensityEstimator::makeClone(), TraceManager::makeClone(), CloneManager::makeClones(), WalkerLogManager::makeCollector(), BackflowBuilder::makeLongRange_twoBody(), RPAJastrow::makeShortRange(), BackflowBuilder::makeShortRange_twoBody(), QMCDriverNew::measureImbalance(), MomentumDistribution::MomentumDistribution(), EinsplineSetBuilder::OccupyBands(), EinsplineSetBuilder::OccupyBands_ESHDF(), QMCFixedSampleLinearOptimizeBatched::one_shift_run(), TraceManager::open_file(), TraceManager::open_hdf_file(), WalkerLogManager::openFile(), WalkerLogManager::openHDFFile(), operator<<(), ci_configuration::operator==(), PairCorrEstimator::PairCorrEstimator(), parse_pbc_fcc_lattice(), parse_pbc_lattice(), ECPComponentBuilder::parseCasino(), DriftModifierUNR::parseXML(), QMCFixedSampleLinearOptimizeBatched::previous_linear_methods_run(), TimerManager< qmcplusplus::TimerType< CLOCK > >::print(), QMCFixedSampleLinearOptimizeBatched::print_cost_summary(), QMCFixedSampleLinearOptimizeBatched::print_cost_summary_header(), TimerManager< qmcplusplus::TimerType< CLOCK > >::print_flat(), QMCState::print_memory_change(), TimerManager< qmcplusplus::TimerType< CLOCK > >::print_stack(), WaveFunctionTester::printEloc(), QMCCostFunctionBase::printEstimates(), QMCFiniteSize::printSkRawSphAvg(), QMCFiniteSize::printSkSplineSphAvg(), Reptile::printState(), SFNBranch::printStatus(), QMCFixedSampleLinearOptimizeBatched::process(), VMCBatched::process(), DMCBatched::process(), QMCDriver::process(), QMCFixedSampleLinearOptimize::processOptXML(), QMCFixedSampleLinearOptimizeBatched::processOptXML(), QMCMain::processPWH(), HybridEngine::processXML(), DescentEngine::processXML(), LatticeParser::put(), ReferencePoints::put(), VMC::put(), GridExternalPotential::put(), SkPot::put(), InitMolecularSystem::put(), ACForce::put(), EnergyDensityEstimator::put(), CSVMC::put(), RPAJastrow::put(), SkAllEstimator::put(), SpaceGrid::put(), RMCUpdateAllWithDrift::put(), RMCUpdatePbyPWithDrift::put(), NonLocalTOperator::put(), ECPotentialBuilder::put(), RandomNumberControl::put(), ECPComponentBuilder::put(), SPOSetScanner::put(), QMCFixedSampleLinearOptimize::put(), ForceCeperley::put(), WalkerControl::put(), QMCCostFunctionBase::put(), MPC::put(), EstimatorManagerNew::put(), StressPBC::put(), ForceChiesaPBCAA::put(), EstimatorManagerBase::put(), WalkerControlBase::put(), OrbitalImages::put(), PadeFunctor< T >::put(), CountingGaussian::put(), BsplineFunctor< REAL >::put(), Pade2ndOrderFunctor< T >::put(), PadeTwo2ndOrderFunctor< T >::put(), PolynomialFunctor3D::put(), TraceManager::put(), SlaterDetBuilder::putDeterminant(), AOBasisBuilder< COT >::putH5(), eeI_JastrowBuilder::putkids(), LCAOrbitalBuilder::putPBCFromH5(), QMCDriver::putQMCInfo(), MomentumEstimator::putSpecial(), ForwardWalking::putSpecial(), QMCCostFunction::QMCCostFunction(), QMCCostFunctionBatched::QMCCostFunctionBatched(), QMCFiniteSize::QMCFiniteSize(), QMCFixedSampleLinearOptimize::QMCFixedSampleLinearOptimize(), QMCFixedSampleLinearOptimizeBatched::QMCFixedSampleLinearOptimizeBatched(), QMCMain::QMCMain(), HybridEngine::queryStore(), ParticleSetPool::randomize(), ParticleSet::randomizeFromSource(), SimpleFixedNodeBranch::read(), HDFWalkerInput_0_4::read_hdf5(), RandomNumberControl::read_parallel(), HDFWalkerInput_0_4::read_phdf5(), RandomNumberControl::read_rank_0(), PWBasis::readbasis(), SlaterDetBuilder::readCoeffs(), readCuspInfo(), SlaterDetBuilder::readDetList(), SlaterDetBuilder::readDetListH5(), EinsplineSetBuilder::ReadGvectors_ESHDF(), EinsplineSetBuilder::ReadOrbitalInfo(), EinsplineSetBuilder::ReadOrbitalInfo_ESHDF(), ParticleSetPool::readSimulationCellXML(), VMCDriverInput::readXML(), XMLParticleParser::readXML(), CompositeSPOSet::report(), SHOSetBuilder::report(), PairCorrEstimator::report(), SPOInfo::report(), FreeOrbital::report(), StaticStructureFactor::report(), SPOSetInfo::report(), SpinDensity::report(), SPOSetInputInfo::report(), SHOSet::report(), SpinDensityNew::report(), DensityMatrices1B::report(), InputSection::report(), OrbitalImages::report(), TraceRequest::report(), CountingGaussian::reportStatus(), ParticleSet::reset(), TraceManager::reset_buffers(), WalkerLogCollector::resetBuffers(), ParticleSet::resetGroups(), SimulationCell::resetLRBox(), VMC::resetRun(), CSVMC::resetRun(), RMC::resetRun(), SimpleFixedNodeBranch::resetRun(), DMC::resetUpdateEngines(), MCWalkerConfiguration::resetWalkerProperty(), AGPDeterminant::resize(), PWOrbitalSet::resize(), PWRealOrbitalSet::resize(), DensityEstimator::resize(), HybridRepCenterOrbitals< SPLINEBASE::DataType >::resizeStorage(), VMC::run(), RMC::run(), DMC::run(), CSVMC::run(), QMCFixedSampleLinearOptimize::run(), WaveFunctionTester::run(), GradientTest::run(), QMCFixedSampleLinearOptimizeBatched::run(), VMCBatched::run(), DMCBatched::run(), WaveFunctionTester::runBasicTest(), WaveFunctionTester::runCloneTest(), WaveFunctionTester::runDerivCloneTest(), WaveFunctionTester::runDerivNLPPTest(), WaveFunctionTester::runDerivTest(), WaveFunctionTester::runGradSourceTest(), WaveFunctionTester::runNodePlot(), QMCMain::runQMC(), WaveFunctionTester::runRatioTest(), WaveFunctionTester::runRatioTest2(), WaveFunctionTester::runRatioV(), WaveFunctionTester::runZeroVarianceTest(), DescentEngine::sample_finish(), saveCusp(), QMCAppBase::saveXml(), TraceSamples< std::complex< TraceReal > >::screen_writes(), BandInfoGroup::selectBands(), LinearMethod::selectEigenvalue(), EinsplineSetBuilder::set_metadata(), BsplineReader::setCommon(), ECPComponentBuilder::SetQuadratureRule(), QMCDriver::setStatus(), QMCDriverNew::setStatus(), LRBreakup< BreakupBasis >::SetupKVecs(), DescentEngine::setupUpdate(), QMCDriver::setWalkerOffsets(), SHOState::sho_report(), SHOSetBuilder::SHOSetBuilder(), NESpaceGrid< REAL >::someMoreAxisGridStuff(), SpeciesKineticEnergy::SpeciesKineticEnergy(), QMCFixedSampleLinearOptimizeBatched::start(), WalkerLogCollector::startBlock(), TraceManager::startBlock(), WalkerLogManager::startRun(), TraceManager::startRun(), TraceManager::stopBlock(), WalkerLogManager::stopRun(), TraceManager::stopRun(), DescentEngine::storeVectors(), StressPBC::StressPBC(), StructFact::StructFact(), QMCFiniteSize::summary(), SYCLDeviceManager::SYCLDeviceManager(), RandomNumberControl::test(), SpinDensity::test(), TraceBuffer< TraceInt >::test_buffer_collect(), TraceBuffer< TraceInt >::test_buffer_write(), TEST_CASE(), SHOSet::test_derivatives(), DensityMatrices1B::test_derivatives(), test_DiracDeterminant_delayed_update(), test_DiracDeterminant_second(), test_DiracDeterminantBatched_delayed_update(), test_DiracDeterminantBatched_second(), SpinDensity::test_evaluate(), test_J3_polynomial3D(), test_LCAO_DiamondC_2x1x1_cplx(), test_LCAO_DiamondC_2x1x1_real(), test_lcao_spinor(), test_lcao_spinor_excited(), test_lcao_spinor_ion_derivs(), test_LiH_msd(), SHOSet::test_overlap(), DensityMatrices1B::test_overlap(), BackflowTransformation::testDeriv(), DiracDeterminantWithBackflow::testDerivFjj(), SlaterDetWithBackflow::testDerivGL(), DiracDeterminantWithBackflow::testDerivLi(), DiracDeterminantWithBackflow::testGG(), DiracDeterminantWithBackflow::testGGG(), BackflowTransformation::testPbyP(), testTrialWaveFunction_diamondC_2x1x1(), PWBasis::trimforecut(), KContainer::updateKLists(), SFNBranch::updateParamAfterPopControl(), DescentEngine::updateParameters(), TraceSamples< std::complex< TraceReal > >::user_report(), TraceManager::user_report(), ECPotentialBuilder::useSimpleTableFormat(), ECPotentialBuilder::useXmlFormat(), QMCFiniteSize::validateXML(), QMCMain::validateXML(), QMCFixedSampleLinearOptimize::ValidCostFunction(), QMCFixedSampleLinearOptimizeBatched::ValidCostFunction(), WalkerLogManager::WalkerLogManager(), WaveFunctionTester::WaveFunctionTester(), TraceManager::write_buffers(), TraceManager::write_buffers_hdf(), EnergyDensityEstimator::write_Collectables(), EnergyDensityEstimator::write_EDValues(), TraceBuffer< TraceInt >::write_hdf(), EnergyDensityEstimator::write_nonzero_domains(), OrbitalImages::write_orbital_xsf(), TraceRequest::write_selected(), TraceSample< TraceReal >::write_summary(), TraceSamples< std::complex< TraceReal > >::write_summary(), TraceBuffer< TraceInt >::write_summary(), TraceManager::write_summary(), CombinedTraceSample< TraceReal >::write_summary_combined(), WalkerLogManager::writeBuffers(), WalkerLogManager::writeBuffersHDF(), and WalkerLogBuffer< WLog::Real >::writeSummary().

65 { return infoLog.getStream(); }
std::ostream & getStream(const std::string &tag="")
returns current stream
Definition: InfoStream.h:37
InfoStream infoLog

◆ app_summary()

◆ app_warning()

std::ostream& qmcplusplus::app_warning ( )
inline

Definition at line 69 of file OutputManager.h.

References InfoStream::getStream(), and infoLog.

Referenced by CloneManager::acceptRatio(), QMCHamiltonian::addOperator(), HamiltonianFactory::addPseudoPotential(), QMCDriverNew::adjustGlobalWalkerCount(), EinsplineSetBuilder::AnalyzeTwists2(), WalkerControlBase::applyNmaxNmin(), LatticeGaussianProductBuilder::buildComponent(), kSpaceJastrowBuilder::buildComponent(), SlaterDetBuilder::buildComponent(), JastrowBuilder::buildkSpace(), ECPComponentBuilder::buildSemiLocalAndLocal(), TwoBodyJastrow< FT >::checkSanity(), J1OrbitalSoA< FT >::checkSanity(), checkTagStatus(), SlaterDetBuilder::createMSDFast(), PWOrbitalSetBuilder::createPW(), QMCDriverFactory::createQMCDriver(), QMCDriverNew::createRngsStepContexts(), SPOSetBuilder::createSPOSet(), LCAOrbitalBuilder::createSPOSetFromXML(), EinsplineSpinorSetBuilder::createSPOSetFromXML(), EinsplineSetBuilder::createSPOSetFromXML(), CUDADeviceManager::CUDADeviceManager(), WalkerConfigurations::destroyWalkers(), DeviceManager::DeviceManager(), QMCDriverNew::endBlock(), QMCMain::executeLoop(), LCAOrbitalBuilder::LCAOrbitalBuilder(), LCAOrbitalBuilder::loadBasisSetFromXML(), RealSpacePositionsOMPTarget::mw_acceptParticlePos(), OMPDeviceManager::OMPDeviceManager(), LCAOHDFParser::parse(), TimerManager< qmcplusplus::TimerType< CLOCK > >::print_stack(), QMCFixedSampleLinearOptimizeBatched::process(), ParticleSetPool::put(), QMCFixedSampleLinearOptimize::put(), QMCCostFunctionBase::put(), SlaterDetBuilder::putDeterminant(), QMCDriver::putQMCInfo(), RotatedSPOs::readVariationalParameters(), EstimatorManagerInput::readXML(), MCWalkerConfiguration::resize(), kSpaceJastrow::setCoefficients(), MCPopulation::spawnWalker(), SYCLDeviceManager::SYCLDeviceManager(), ECPotentialBuilder::useXmlFormat(), and QMCMain::validateXML().

69 { return infoLog.getStream() << "WARNING "; }
std::ostream & getStream(const std::string &tag="")
returns current stream
Definition: InfoStream.h:37
InfoStream infoLog

◆ applyCuspCorrection()

void applyCuspCorrection ( const Matrix< CuspCorrectionParameters > &  info,
ParticleSet targetPtcl,
ParticleSet sourcePtcl,
LCAOrbitalSet lcao,
SoaCuspCorrection cusp,
const std::string &  id 
)

Definition at line 568 of file CuspCorrectionConstruction.cpp.

References SoaCuspCorrection::add(), LCAOrbitalSet::C, Matrix< T, Alloc >::cols(), computeRadialPhiBar(), createGlobalTimer(), SPOSet::getOrbitalSetSize(), OutputManagerClass::isDebugActive(), LCAOrbitalSet::isIdentity(), LCAOrbitalSet::isOMPoffload(), LCAOrbitalSet::myBasisSet, outputManager, removeSTypeOrbitals(), Vector< T, Alloc >::resize(), Matrix< T, Alloc >::rows(), Vector< T, Alloc >::size(), OneDimQuinticSpline< Td, Tg, CTd, CTg >::spline(), splitPhiEta(), and timer_level_medium.

Referenced by LCAOrbitalBuilder::createSPOSetFromXML().

574 {
575  const int num_centers = info.rows();
576  const int orbital_set_size = info.cols();
578 
579  NewTimer& cuspApplyTimer = createGlobalTimer("CuspCorrectionConstruction::applyCuspCorrection", timer_level_medium);
580 
581  ScopedTimer cuspApplyTimerWrapper(cuspApplyTimer);
582 
583  LCAOrbitalSet phi("phi", std::unique_ptr<LCAOrbitalSet::basis_type>(lcao.myBasisSet->makeClone()),
584  lcao.getOrbitalSetSize(), lcao.isIdentity(), lcao.isOMPoffload());
585 
586  LCAOrbitalSet eta("eta", std::unique_ptr<LCAOrbitalSet::basis_type>(lcao.myBasisSet->makeClone()),
587  lcao.getOrbitalSetSize(), lcao.isIdentity(), lcao.isOMPoffload());
588 
589  std::vector<bool> corrCenter(num_centers, "true");
590 
591  //What's this grid's lifespan? Why on the heap?
592  auto radial_grid = std::make_unique<LogGrid<RealType>>();
593  radial_grid->set(0.000001, 100.0, 1001);
594 
595 
596  Vector<RealType> xgrid;
597  Vector<RealType> rad_orb;
598  xgrid.resize(radial_grid->size());
599  rad_orb.resize(radial_grid->size());
600  for (int ig = 0; ig < radial_grid->size(); ig++)
601  {
602  xgrid[ig] = radial_grid->r(ig);
603  }
604 
605  for (int ic = 0; ic < num_centers; ic++)
606  {
607  *eta.C = *lcao.C;
608  *phi.C = *lcao.C;
609 
610  splitPhiEta(ic, corrCenter, phi, eta);
611 
612  // loop over MO index - cot must be an array (of len MO size)
613  // the loop is inside cot - in the multiqunitic
614  auto cot = std::make_unique<CuspCorrectionAtomicBasis<RealType>>();
615  cot->initializeRadialSet(*radial_grid, orbital_set_size);
616  //How is this useful?
617  // cot->ID.resize(orbital_set_size);
618  // for (int mo_idx = 0; mo_idx < orbital_set_size; mo_idx++) {
619  // cot->ID[mo_idx] = mo_idx;
620  // }
621 
622  for (int mo_idx = 0; mo_idx < orbital_set_size; mo_idx++)
623  {
624  computeRadialPhiBar(&targetPtcl, &sourcePtcl, mo_idx, ic, &phi, xgrid, rad_orb, info(ic, mo_idx));
625  RealType yprime_i = (rad_orb[1] - rad_orb[0]) / (radial_grid->r(1) - radial_grid->r(0));
626  OneDimQuinticSpline<RealType> radial_spline(radial_grid->makeClone(), rad_orb);
627  radial_spline.spline(0, yprime_i, rad_orb.size() - 1, 0.0);
628  cot->addSpline(mo_idx, radial_spline);
629 
631  {
632  // For testing against AoS output
633  // Output phiBar to soaOrbs.downdet.C0.MO0
634  int nElms = 500;
635  RealType dx = info(ic, mo_idx).Rc * 1.2 / nElms;
636  Vector<RealType> pos;
637  Vector<RealType> output_orb;
638  pos.resize(nElms);
639  output_orb.resize(nElms);
640  for (int i = 0; i < nElms; i++)
641  {
642  pos[i] = (i + 1.0) * dx;
643  }
644  computeRadialPhiBar(&targetPtcl, &sourcePtcl, mo_idx, ic, &phi, pos, output_orb, info(ic, mo_idx));
645  std::string filename = "soaOrbs." + id + ".C" + std::to_string(ic) + ".MO" + std::to_string(mo_idx);
646  std::cout << "Writing to " << filename << std::endl;
647  std::ofstream out(filename.c_str());
648  out << "# r phiBar(r)" << std::endl;
649  for (int i = 0; i < nElms; i++)
650  {
651  out << pos[i] << " " << output_orb[i] << std::endl;
652  }
653  out.close();
654  }
655  }
656  cusp.add(ic, std::move(cot));
657  }
658  removeSTypeOrbitals(corrCenter, lcao);
659 }
TimerType< ChronoClock > NewTimer
Definition: NewTimer.h:234
ScopeGuard< NewTimer > ScopedTimer
Definition: NewTimer.h:257
OutputManagerClass outputManager(Verbosity::HIGH)
void removeSTypeOrbitals(const std::vector< bool > &corrCenter, LCAOrbitalSet &Phi)
Remove S atomic orbitals from all molecular orbitals on all centers.
NewTimer & createGlobalTimer(const std::string &myname, timer_levels mylevel)
QMCTraits::RealType RealType
bool isDebugActive() const
Definition: OutputManager.h:45
void computeRadialPhiBar(ParticleSet *targetP, ParticleSet *sourceP, int curOrb_, int curCenter_, SPOSet *Phi, Vector< QMCTraits::RealType > &xgrid, Vector< QMCTraits::RealType > &rad_orb, const CuspCorrectionParameters &data)
Compute the radial part of the corrected wavefunction.
void splitPhiEta(int center, const std::vector< bool > &corrCenter, LCAOrbitalSet &Phi, LCAOrbitalSet &Eta)
Divide molecular orbital into atomic S-orbitals on this center (phi), and everything else (eta)...

◆ applyW_stageV_sycl() [1/6]

sycl::event qmcplusplus::applyW_stageV_sycl ( sycl::queue aq,
const int *restrict  delay_list_gpu,
const int  delay_count,
T *restrict  temp_gpu,
const int  numorbs,
const int  ndelay,
T *restrict  V_gpu,
const T *restrict  Ainv,
const std::vector< sycl::event > &  dependencies 
)

Definition at line 19 of file sycl_determinant_helper.cpp.

Referenced by DelayedUpdateSYCL< T, T_FP >::updateInvMat().

28 {
29  const size_t BS = 128;
30  const size_t NB = (numorbs + BS - 1) / BS;
31 
32  return aq.parallel_for(sycl::nd_range<1>{{BS * NB}, {BS}}, dependencies, [=](sycl::nd_item<1> item) {
33  int col = item.get_global_id(0);
34 
35  // move rows of Ainv to V
36  for (int row = 0; row < delay_count; row++)
37  {
38  const T* Ainv_row = Ainv + numorbs * delay_list_gpu[row];
39  T* V_row = V_gpu + numorbs * row;
40  if (col < numorbs)
41  V_row[col] = Ainv_row[col];
42  }
43 
44  // apply W to temp
45  if (col < delay_count)
46  temp_gpu[ndelay * delay_list_gpu[col] + col] -= T(1);
47  });
48 }

◆ applyW_stageV_sycl() [2/6]

sycl::event qmcplusplus::applyW_stageV_sycl ( sycl::queue aq,
const int *  delay_list_gpu,
const int  delay_count,
T *  temp_gpu,
const int  numorbs,
const int  ndelay,
T *  V_gpu,
const T *  Ainv,
const std::vector< sycl::event > &  dependencies = {} 
)

◆ applyW_stageV_sycl() [3/6]

template sycl::event qmcplusplus::applyW_stageV_sycl ( sycl::queue aq,
const int *restrict  delay_list_gpu,
const int  delay_count,
float *restrict  temp_gpu,
const int  numorbs,
const int  ndelay,
float *restrict  V_gpu,
const float *restrict  Ainv,
const std::vector< sycl::event > &  dependencies 
)

◆ applyW_stageV_sycl() [4/6]

template sycl::event qmcplusplus::applyW_stageV_sycl ( sycl::queue aq,
const int *restrict  delay_list_gpu,
const int  delay_count,
double *restrict  temp_gpu,
const int  numorbs,
const int  ndelay,
double *restrict  V_gpu,
const double *restrict  Ainv,
const std::vector< sycl::event > &  dependencies 
)

◆ applyW_stageV_sycl() [5/6]

template sycl::event qmcplusplus::applyW_stageV_sycl ( sycl::queue aq,
const int *restrict  delay_list_gpu,
const int  delay_count,
std::complex< float > *restrict  temp_gpu,
const int  numorbs,
const int  ndelay,
std::complex< float > *restrict  V_gpu,
const std::complex< float > *restrict  Ainv,
const std::vector< sycl::event > &  dependencies 
)

◆ applyW_stageV_sycl() [6/6]

template sycl::event qmcplusplus::applyW_stageV_sycl ( sycl::queue aq,
const int *restrict  delay_list_gpu,
const int  delay_count,
std::complex< double > *restrict  temp_gpu,
const int  numorbs,
const int  ndelay,
std::complex< double > *restrict  V_gpu,
const std::complex< double > *restrict  Ainv,
const std::vector< sycl::event > &  dependencies 
)

◆ approxEquality() [1/2]

bool approxEquality ( val_a,
val_b,
std::optional< double >  eps 
)

Definition at line 26 of file checkMatrix.hpp.

Referenced by TEST_CASE().

27 {
28  if (eps)
29  return val_a == ComplexApprox(val_b).epsilon(eps.value());
30  else
31  return val_a == ComplexApprox(val_b);
32 }

◆ approxEquality() [2/2]

bool qmcplusplus::approxEquality ( const TinyVector< T1, D > &  val_a,
const TinyVector< T2, D > &  val_b 
)

Definition at line 62 of file test_ReferencePoints.cpp.

63 {
64  for (int i = 0; i < D; ++i)
65  if (val_a[i] != Approx(val_b[i]))
66  return false;
67  return true;
68 }

◆ approxEquality< double >()

template bool approxEquality< double > ( double  val_a,
double  val_b,
std::optional< double >  eps 
)

◆ approxEquality< float >()

template bool approxEquality< float > ( float  val_a,
float  val_b,
std::optional< double >  eps 
)

◆ approxEquality< std::complex< double > >()

template bool approxEquality< std::complex< double > > ( std::complex< double >  val_a,
std::complex< double >  val_b,
std::optional< double >  eps 
)

◆ approxEquality< std::complex< float > >()

template bool approxEquality< std::complex< float > > ( std::complex< float >  val_a,
std::complex< float >  val_b,
std::optional< double >  eps 
)

◆ asin() [1/2]

MakeReturn<UnaryNode<FnArcSin, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::asin ( const Vector< T1, C1 > &  l)
inline

Definition at line 40 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by FnArcSin::operator()(), and RPABFeeBreakup< T >::Xk().

42 {
43  using Tree_t = UnaryNode<FnArcSin, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
44  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
45 }

◆ asin() [2/2]

MakeReturn<UnaryNode<FnArcSin, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::asin ( const Expression< T1 > &  l)
inline

Definition at line 1387 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1389 {
1390  using Tree_t = UnaryNode<FnArcSin, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1391  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1392 }

◆ assign() [1/3]

Matrix<T1, C1>& qmcplusplus::assign ( Matrix< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 736 of file OhmmsMatrixOperators.h.

References evaluate().

Referenced by Matrix< ST, qmcplusplus::Mallocator< ST > >::copy(), Matrix< ST, qmcplusplus::Mallocator< ST > >::Matrix(), ParticleAttrib< qmcplusplus::TinyVector >::operator=(), Vector< T, std::allocator< T > >::operator=(), Matrix< ST, qmcplusplus::Mallocator< ST > >::operator=(), and XMLNodeString::XMLNodeString().

737 {
738  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
739  evaluate(lhs, OpAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
740  return lhs;
741 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ assign() [2/3]

ParticleAttrib<T1>& qmcplusplus::assign ( ParticleAttrib< T1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 769 of file ParticleAttrib.cpp.

References evaluate().

770 {
771  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
772  evaluate(lhs, OpAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
773  return lhs;
774 }
void evaluate(ParticleAttrib< T > &lhs, const Op &op, const Expression< RHS > &rhs)

◆ assign() [3/3]

Vector<T1, C1>& qmcplusplus::assign ( Vector< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 2225 of file OhmmsVectorOperators.h.

References evaluate().

2226 {
2227  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
2228  evaluate(lhs, OpAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
2229  return lhs;
2230 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ assignDrift() [1/3]

void qmcplusplus::assignDrift ( s,
const ParticleAttrib< TinyVector< TG, D >> &  ga,
ParticleAttrib< TinyVector< T, D >> &  da 
)
inline

◆ assignDrift() [2/3]

void qmcplusplus::assignDrift ( s,
const ParticleAttrib< TinyVector< std::complex< TG >, D >> &  ga,
ParticleAttrib< TinyVector< T, D >> &  da 
)
inline

Definition at line 209 of file DriftOperators.h.

References qmcplusplus::Units::time::s.

212 {
213  //This operation does s*ga, and takes the real part.
214  PAOps<T, D, TG>::scale(s, ga, da);
215 }

◆ assignDrift() [3/3]

void qmcplusplus::assignDrift ( tau_au,
const std::vector< T > &  massinv,
const ParticleAttrib< TinyVector< T1, D >> &  qf,
ParticleAttrib< TinyVector< T, D >> &  drift 
)
inline

Definition at line 219 of file DriftOperators.h.

References getScaledDrift().

223 {
224  for (int iat = 0; iat < massinv.size(); ++iat)
225  {
226  T tau_over_mass = tau_au * massinv[iat];
227  // naive drift "tau/mass*qf" can diverge
228  getScaledDrift(tau_over_mass, qf[iat], drift[iat]);
229  }
230 }
void getScaledDrift(Tt tau, const TinyVector< TG, D > &qf, TinyVector< T, D > &drift)
evaluate a drift with a real force

◆ assignGaussRand()

void qmcplusplus::assignGaussRand ( T *restrict  a,
unsigned  n,
RG &  rng 
)
inline

Definition at line 33 of file RandomSeqGenerator.h.

References cos(), log(), n, sin(), and sqrt().

Referenced by OneBodyDensityMatrices::diffuse(), OneBodyDensityMatrices::diffuseSpin(), DensityMatrices1B::diffusion(), makeGaussRandom(), makeGaussRandomWithEngine(), and TEST_CASE().

34 {
35  OHMMS_PRECISION_FULL slightly_less_than_one = 1.0 - std::numeric_limits<OHMMS_PRECISION_FULL>::epsilon();
36  int nm1 = n - 1;
37  OHMMS_PRECISION_FULL temp1, temp2;
38  for (int i = 0; i < nm1; i += 2)
39  {
40  temp1 = std::sqrt(-2.0 * std::log(1.0 - slightly_less_than_one * rng()));
41  temp2 = 2.0 * M_PI * rng();
42  a[i] = temp1 * std::cos(temp2);
43  a[i + 1] = temp1 * std::sin(temp2);
44  }
45  if (n % 2 == 1)
46  {
47  temp1 = std::sqrt(-2.0 * std::log(1.0 - slightly_less_than_one * rng()));
48  temp2 = 2.0 * M_PI * rng();
49  a[nm1] = temp1 * std::cos(temp2);
50  }
51 }
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ assignUniformRand()

void qmcplusplus::assignUniformRand ( T *restrict  a,
unsigned  n,
RG &  rng 
)
inline

Definition at line 64 of file RandomSeqGenerator.h.

References n.

Referenced by makeUniformRandom(), and randomize().

65 {
66  for (int i = 0; i < n; i++)
67  a[i] = rng();
68 }

◆ atan() [1/2]

◆ atan() [2/2]

MakeReturn<UnaryNode<FnArcTan, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::atan ( const Expression< T1 > &  l)
inline

Definition at line 1395 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1397 {
1398  using Tree_t = UnaryNode<FnArcTan, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1399  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1400 }

◆ atan2() [1/8]

MakeReturn< BinaryNode<FnArcTan2, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::atan2 ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 338 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by NESpaceGrid< REAL >::accumulate(), cart2sph(), SpaceGrid::check_grid(), NESpaceGrid< REAL >::check_grid(), derivYlmSpherical(), SpaceGrid::evaluate(), fix_phase_rotate(), FnArcTan2::operator()(), and Ylm().

339 {
340  typedef BinaryNode<FnArcTan2, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
341  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
342  Tree_t;
343  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
344 }

◆ atan2() [2/8]

MakeReturn< BinaryNode<FnArcTan2, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::atan2 ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 588 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

589 {
590  typedef BinaryNode<FnArcTan2, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
591  typename CreateLeaf<Expression<T2>>::Leaf_t>
592  Tree_t;
593  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
594 }

◆ atan2() [3/8]

MakeReturn< BinaryNode<FnArcTan2, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::atan2 ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 838 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

839 {
840  typedef BinaryNode<FnArcTan2, typename CreateLeaf<Expression<T1>>::Leaf_t,
841  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
842  Tree_t;
843  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
844 }

◆ atan2() [4/8]

MakeReturn< BinaryNode<FnArcTan2, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::atan2 ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1062 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1063 {
1064  using Tree_t = BinaryNode<FnArcTan2, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1065  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1066 }

◆ atan2() [5/8]

MakeReturn< BinaryNode<FnArcTan2, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::atan2 ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1263 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1264 {
1265  using Tree_t = BinaryNode<FnArcTan2, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1266  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1267 }

◆ atan2() [6/8]

MakeReturn< BinaryNode<FnArcTan2, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::atan2 ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1685 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1686 {
1687  typedef BinaryNode<FnArcTan2, typename CreateLeaf<Expression<T1>>::Leaf_t,
1688  typename CreateLeaf<Expression<T2>>::Leaf_t>
1689  Tree_t;
1690  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1691 }

◆ atan2() [7/8]

MakeReturn< BinaryNode<FnArcTan2, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::atan2 ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1909 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1910 {
1911  using Tree_t = BinaryNode<FnArcTan2, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1912  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1913 }

◆ atan2() [8/8]

MakeReturn< BinaryNode<FnArcTan2, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::atan2 ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2110 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2111 {
2112  using Tree_t = BinaryNode<FnArcTan2, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2113  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2114 }

◆ bcast()

◆ bessel_steed_array_cpu()

void qmcplusplus::bessel_steed_array_cpu ( const int  lmax,
const T  x,
T *  jl 
)

Compute spherical bessel function from 0 to lmax.

Using Steed/Barnett algorithm from Comp. Phys. Comm. 21, 297 (1981)

Definition at line 25 of file Bessel.h.

References B(), BLAS::cone, and qmcplusplus::simd::inv().

Referenced by Gvectors< ST, LT >::calc_jlm_G(), and TEST_CASE().

26 {
27  if (lmax < 0)
28  throw std::runtime_error("Negative lmax not allowed!");
29  else if (x < 0)
30  throw std::runtime_error("Negative x not allowed!");
31  else if (x == 0.0)
32  {
33  std::fill(jl, jl + lmax + 1, T(0.0));
34  jl[0] = T(1.0);
35  }
36  else if (x < 0.00024)
37  {
38  const double cone(1);
39  double inv_accumuated = cone;
40  double x_l = cone;
41  for (int l = 0; l <= lmax; l++)
42  {
43  jl[l] = x_l * inv_accumuated;
44  const double inv = cone / (2 * l + 3);
45  jl[l] *= cone - 0.5 * x * x * inv;
46  inv_accumuated *= inv;
47  x_l *= x;
48  }
49  }
50  else
51  {
52  const double cone(1);
53  const double ctwo(2);
54  double XI(cone / x);
55  double W(XI * ctwo);
56  double F(cone);
57  double FP((lmax + 1) * XI);
58  double B(FP * ctwo + XI);
59  double D(cone / B);
60  double DEL(-D);
61  FP += DEL;
62 
63  do
64  {
65  B += W;
66  D = cone / (B - D);
67  DEL *= (B * D - cone);
68  FP += DEL;
69  if (D < 0.0)
70  F = -F;
71  } while (std::fabs(DEL) >= std::fabs(FP) * 1.19209e-07);
72 
73  FP *= F;
74  jl[0] = F;
75 
76  if (lmax > 0)
77  {
78  double PL = lmax * XI;
79  jl[lmax] = F;
80  for (int L = lmax; L >= 1; L--)
81  {
82  jl[L - 1] = PL * jl[L] + FP;
83  FP = PL * jl[L - 1] - jl[L];
84  PL -= XI;
85  }
86  F = jl[0];
87  }
88 
89  // using hypot instead of sqrt to avoid overflow/underflow
90  W = XI / std::hypot(FP, F);
91  for (int L = 0; L <= lmax; L++)
92  jl[L] *= W;
93  }
94 }
constexpr std::complex< float > cone
Definition: BLAS.hpp:50
void inv(const T *restrict in, T *restrict out, int n)
Definition: vmath.hpp:65
double B(double x, int k, int i, const std::vector< double > &t)

◆ BOOSTSUB_H5_DATATYPE() [1/12]

qmcplusplus::BOOSTSUB_H5_DATATYPE ( char  ,
H5T_NATIVE_CHAR   
)

◆ BOOSTSUB_H5_DATATYPE() [2/12]

qmcplusplus::BOOSTSUB_H5_DATATYPE ( short  ,
H5T_NATIVE_SHORT   
)

◆ BOOSTSUB_H5_DATATYPE() [3/12]

qmcplusplus::BOOSTSUB_H5_DATATYPE ( int  ,
H5T_NATIVE_INT   
)

◆ BOOSTSUB_H5_DATATYPE() [4/12]

qmcplusplus::BOOSTSUB_H5_DATATYPE ( long  ,
H5T_NATIVE_LONG   
)

◆ BOOSTSUB_H5_DATATYPE() [5/12]

qmcplusplus::BOOSTSUB_H5_DATATYPE ( long  long,
H5T_NATIVE_LLONG   
)

◆ BOOSTSUB_H5_DATATYPE() [6/12]

qmcplusplus::BOOSTSUB_H5_DATATYPE ( unsigned  char,
H5T_NATIVE_UCHAR   
)

◆ BOOSTSUB_H5_DATATYPE() [7/12]

qmcplusplus::BOOSTSUB_H5_DATATYPE ( unsigned  short,
H5T_NATIVE_USHORT   
)

◆ BOOSTSUB_H5_DATATYPE() [8/12]

qmcplusplus::BOOSTSUB_H5_DATATYPE ( unsigned  int,
H5T_NATIVE_UINT   
)

◆ BOOSTSUB_H5_DATATYPE() [9/12]

qmcplusplus::BOOSTSUB_H5_DATATYPE ( unsigned  long,
H5T_NATIVE_ULONG   
)

◆ BOOSTSUB_H5_DATATYPE() [10/12]

qmcplusplus::BOOSTSUB_H5_DATATYPE ( unsigned long  long,
H5T_NATIVE_ULLONG   
)

◆ BOOSTSUB_H5_DATATYPE() [11/12]

qmcplusplus::BOOSTSUB_H5_DATATYPE ( float  ,
H5T_NATIVE_FLOAT   
)

◆ BOOSTSUB_H5_DATATYPE() [12/12]

qmcplusplus::BOOSTSUB_H5_DATATYPE ( double  ,
H5T_NATIVE_DOUBLE   
)

◆ broadcastCuspInfo()

void broadcastCuspInfo ( CuspCorrectionParameters param,
Communicate Comm,
int  root 
)

Broadcast cusp correction parameters.

Definition at line 198 of file CuspCorrectionConstruction.cpp.

References CuspCorrectionParameters::alpha, CuspCorrectionParameters::C, CuspCorrectionParameters::Rc, CuspCorrectionParameters::redo, and CuspCorrectionParameters::sg.

Referenced by LCAOrbitalBuilder::createSPOSetFromXML(), generateCuspInfo(), and TEST_CASE().

199 {
200 #ifdef HAVE_MPI
201  std::vector<double> buffer(9);
202  buffer[0] = param.Rc;
203  buffer[1] = param.C;
204  buffer[2] = param.sg;
205  buffer[3] = param.alpha[0];
206  buffer[4] = param.alpha[1];
207  buffer[5] = param.alpha[2];
208  buffer[6] = param.alpha[3];
209  buffer[7] = param.alpha[4];
210  buffer[8] = param.redo;
211 
212  Comm.comm.broadcast(buffer.begin(), buffer.end(), root);
213 
214  param.Rc = buffer[0];
215  param.C = buffer[1];
216  param.sg = buffer[2];
217  param.alpha[0] = buffer[3];
218  param.alpha[1] = buffer[4];
219  param.alpha[2] = buffer[5];
220  param.alpha[3] = buffer[6];
221  param.alpha[4] = buffer[7];
222  param.redo = buffer[8] == 0.0 ? 0 : 1;
223 #endif
224 }

◆ calcSmallDeterminant()

VALUE qmcplusplus::calcSmallDeterminant ( size_t  n,
const VALUE *  table_matrix,
const int *  it,
const size_t  nb_cols 
)
inline

Definition at line 282 of file SmallMatrixDetCalculator.h.

References evaluate(), and n.

Referenced by MultiDiracDeterminant::buildTableMatrix_calculateRatios_impl(), and TestSmallMatrixDetCalculator< T >::customized_evaluate().

283 {
284  switch (n)
285  {
286  case 1:
287  return CustomizedMatrixDet<1>::evaluate(table_matrix, it, nb_cols);
288  case 2:
289  return CustomizedMatrixDet<2>::evaluate(table_matrix, it, nb_cols);
290  case 3:
291  return CustomizedMatrixDet<3>::evaluate(table_matrix, it, nb_cols);
292  case 4:
293  return CustomizedMatrixDet<4>::evaluate(table_matrix, it, nb_cols);
294  case 5:
295  return CustomizedMatrixDet<5>::evaluate(table_matrix, it, nb_cols);
296  default:
297  throw std::runtime_error("calculateSmallDeterminant only handles the number of excitations <= 5.");
298  }
299 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ cancel()

void qmcplusplus::cancel ( CT &  r)
inline

Definition at line 74 of file CommUtilities.h.

75 {}

◆ castCUDAType()

CUDATypeMap<T> qmcplusplus::castCUDAType ( var)

Definition at line 53 of file CUDATypeMapping.hpp.

Referenced by qmcplusplus::cuBLAS::getrf_batched(), and qmcplusplus::cuBLAS::getri_batched().

54 {
55  return reinterpret_cast<CUDATypeMap<T>>(var);
56 }

◆ casthipblasType()

hipblasTypeMap<T> qmcplusplus::casthipblasType ( var)

Definition at line 48 of file hipblasTypeMapping.hpp.

49 {
50  return reinterpret_cast<hipblasTypeMap<T>>(var);
51 }

◆ ceil() [1/2]

◆ ceil() [2/2]

MakeReturn<UnaryNode<FnCeil, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::ceil ( const Expression< T1 > &  l)
inline

Definition at line 1403 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1405 {
1406  using Tree_t = UnaryNode<FnCeil, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1407  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1408 }

◆ CHECK() [1/10]

qmcplusplus::CHECK ( oh.  lower_bound = =0)

◆ CHECK() [2/10]

CHECK ( embt.em.  getNumEstimators() = =0)

◆ CHECK() [3/10]

CHECK ( emi.  get_estimator_inputs).size( = =2)

◆ CHECK() [4/10]

CHECK ( emn.  getNumEstimators() = =2)

◆ CHECK() [5/10]

qmcplusplus::CHECK ( emnta.  getMainEstimator).getName( = ="LocalEnergyEstimator")

◆ CHECK() [6/10]

CHECK ( emi2.  get_estimator_inputs).size( = =2)

◆ CHECK() [7/10]

CHECK ( emn2.  getNumEstimators() = =2)

◆ CHECK() [8/10]

qmcplusplus::CHECK ( emnta2.  getMainEstimator).getName( = ="RMCLocalEnergyEstimator")

◆ CHECK() [9/10]

qmcplusplus::CHECK ( log_values  [0] = =ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

Referenced by check_force_copy(), check_matrix(), OneBodyDensityMatricesTests< T >::checkData(), complex_test_case(), doSOECPotentialTest(), double_test_case(), fill_from_text(), MinTest::find_min(), getTestCaseForWeights(), if(), mpiTestFunctionWrapped(), TestFillBufferRngReal< T >::operator()(), TestFillVecRngReal< T >::operator()(), TestGetVecRngReal< T >::operator()(), TestFillBufferRngComplex< T >::operator()(), TestFillVecRngComplex< T >::operator()(), TestGetVecRngComplex< T >::operator()(), TEMPLATE_TEST_CASE(), test_C_diamond(), test_cartesian_ao(), TEST_CASE(), optimize::TEST_CASE(), qmcplusplus::testing::TEST_CASE(), TEST_CASE(), test_CoulombPBCAA_3p(), test_diamond_2x1x1_xml_input(), test_dirac_ao(), test_DiracDeterminant_delayed_update(), test_DiracDeterminant_first(), test_DiracDeterminant_second(), test_DiracDeterminantBatched_delayed_update(), test_DiracDeterminantBatched_first(), test_DiracDeterminantBatched_second(), test_distance_fcc_pbc_z_batched_APIs(), test_distance_pbc_z_batched_APIs(), test_distance_pbc_z_batched_APIs_ee_NEED_TEMP_DATA_ON_HOST(), test_e2iphi(), test_EtOH_mw(), test_gemm(), test_gemv(), test_gemv_batched(), test_ger(), test_ger_batched(), test_HCN(), test_hcpBe_rotation(), test_He(), test_He_mw(), test_He_sto3g_xml_input(), test_inverse(), test_isnan(), test_J1_spline(), test_J3_polynomial3D(), test_LCAO_DiamondC_2x1x1_cplx(), test_LCAO_DiamondC_2x1x1_real(), test_lcao_spinor(), test_lcao_spinor_excited(), test_lcao_spinor_ion_derivs(), test_LiH_msd(), test_Ne(), test_one_gemm(), test_one_gemv(), test_one_ger(), test_real_accumulator(), test_real_accumulator_basic(), test_real_accumulator_weights(), test_spline_bounds(), test_tiny_vector(), test_tiny_vector_size_two(), QMCDriverNewTestWrapper::testAdjustGlobalWalkerCount(), SpinDensityNewTests::testCopyConstructor(), MomentumDistributionTests::testCopyConstructor(), MagnetizationDensityTests::testCopyConstructor(), OneBodyDensityMatricesTests< T >::testCopyConstructor(), MagnetizationDensityTests::testData(), QMCDriverNewTestWrapper::testDetermineStepsPerBlock(), testDualAllocator(), OneBodyDensityMatricesTests< T >::testGenerateSamples(), OneBodyDensityMatricesTests< T >::testGenerateSamplesForSpinor(), MagnetizationDensityTests::testGrids(), MagnetizationDensityTests::testIntegrationFunctions(), EstimatorManagerNewTest::testReplaceMainEstimator(), and testTrialWaveFunction_diamondC_2x1x1().

◆ CHECK() [10/10]

qmcplusplus::CHECK ( log_values  [1] = =ComplexApprox(std::complex< double >{ 5.531331998282581, -8.805487075984523 }))

◆ check_force_copy()

void qmcplusplus::check_force_copy ( ForceChiesaPBCAA force,
ForceChiesaPBCAA force2 
)

Definition at line 86 of file test_force.cpp.

References ForceChiesaPBCAA::c, CHECK(), Matrix< T, Alloc >::cols(), ForceBase::getAddIonIon(), ForceChiesaPBCAA::getDistanceTableAAID(), ForceBase::getForcesIonIon(), ForceChiesaPBCAA::h, ForceChiesaPBCAA::m_exp, ForceChiesaPBCAA::N_basis, ForceChiesaPBCAA::NptclA, ForceChiesaPBCAA::NptclB, ForceChiesaPBCAA::NumSpeciesA, ForceChiesaPBCAA::NumSpeciesB, ForceChiesaPBCAA::Qat, ForceChiesaPBCAA::Qspec, ForceChiesaPBCAA::Rcut, REQUIRE(), Matrix< T, Alloc >::rows(), ForceChiesaPBCAA::Sinv, Matrix< T, Alloc >::size(), Vector< T, Alloc >::size(), ForceChiesaPBCAA::Zat, and ForceChiesaPBCAA::Zspec.

Referenced by TEST_CASE().

87 {
88  CHECK(force2.Rcut == Approx(force.Rcut));
89  REQUIRE(force2.m_exp == force.m_exp);
90  REQUIRE(force2.N_basis == force.N_basis);
91  REQUIRE(force2.getAddIonIon() == force.getAddIonIon());
92  REQUIRE(force2.Sinv.size() == force.Sinv.size());
93  std::cout << force.Sinv << std::endl;
94  std::cout << force2.Sinv << std::endl;
95  for (int i = 0; i < force2.Sinv.rows(); i++)
96  {
97  for (int j = 0; j < force2.Sinv.cols(); j++)
98  {
99  //std::cout << "Sinv " << i << " " << j << " " << force2.Sinv(i,j) << " " << force.Sinv(i,j) << std::endl;
100  CHECK(force2.Sinv(i, j) == Approx(force.Sinv(i, j)));
101  }
102  }
103 
104  REQUIRE(force2.h.size() == force.h.size());
105  for (int i = 0; i < force2.h.size(); i++)
106  {
107  CHECK(force2.h[i] == Approx(force.h[i]));
108  }
109 
110  REQUIRE(force2.c.size() == force.c.size());
111  for (int i = 0; i < force2.h.size(); i++)
112  {
113  CHECK(force2.c[i] == Approx(force.c[i]));
114  }
115 
116  REQUIRE(force2.getDistanceTableAAID() == force.getDistanceTableAAID());
117  REQUIRE(force2.NumSpeciesA == force.NumSpeciesA);
118  REQUIRE(force2.NumSpeciesB == force.NumSpeciesB);
119  REQUIRE(force2.NptclA == force.NptclA);
120  REQUIRE(force2.NptclB == force.NptclB);
121  REQUIRE(force2.Zat.size() == force.Zat.size());
122  REQUIRE(force2.Qat.size() == force.Qat.size());
123  REQUIRE(force2.Zspec.size() == force.Zspec.size());
124  REQUIRE(force2.Qspec.size() == force.Qspec.size());
125 
126  REQUIRE(force2.getForcesIonIon().size() == force.getForcesIonIon().size());
127 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ check_matrix()

void qmcplusplus::check_matrix ( Matrix< T1 > &  a,
Matrix< T2 > &  b 
)

Definition at line 39 of file test_DiracDeterminant.cpp.

References CHECK(), Matrix< T, Alloc >::cols(), REQUIRE(), Matrix< T, Alloc >::rows(), and Matrix< T, Alloc >::size().

Referenced by test_DiracDeterminant_delayed_update(), test_DiracDeterminant_first(), and test_DiracDeterminant_second().

40 {
41  REQUIRE(a.size() == b.size());
42  for (int i = 0; i < a.rows(); i++)
43  {
44  for (int j = 0; j < a.cols(); j++)
45  {
46  CHECK(a(i, j) == ValueApprox(b(i, j)));
47  }
48  }
49 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ checkArray()

qmcplusplus::checkArray ( real_pivot  ,
pivots  ,
 
)

◆ CHECKED_ELSE()

◆ checkMatrix()

CheckMatrixResult qmcplusplus::checkMatrix ( M1 &  a_mat,
M2 &  b_mat,
const bool  check_all = false,
std::optional< const double >  eps = std::nullopt 
)

This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declared M1::value_type and have an operator(i,j) accessor.

I leave the c++14 template meta programming to insure this as an exercise for the reader. Or just enjoy the compiler error.

Parameters
[in]a_mat- reference matrix, if padded must be identical to b_mat, can be a smaller than b_mat in which case it is compared to upper left block of b_mat.
[in]b_mat- the matrix to check
[in]check_all- if true continue to check matrix elements after failure
[in]eps- add a tolerance for Catch Approx checks. Default to same as in Approx.

Definition at line 63 of file checkMatrix.hpp.

Referenced by TEMPLATE_TEST_CASE(), TEST_CASE(), test_DiracDeterminantBatched_delayed_update(), test_DiracDeterminantBatched_first(), test_DiracDeterminantBatched_second(), test_inverse(), and testDualAllocator().

67 {
68  // This allows use to check a padded b matrix with a nonpadded a
69  if (a_mat.rows() > b_mat.rows() || a_mat.cols() > b_mat.cols())
70  return {false, "b_mat is too small for a_mat to be a checkable block"};
71  std::stringstream error_msg;
72  auto matrixElementError = [&error_msg](int i, int j, auto& a_mat, auto& b_mat) {
73  error_msg << "checkMatrix found bad element at " << i << ":" << j << " " << a_mat(i, j) << " != " << b_mat(i, j)
74  << '\n';
75  };
76  bool all_elements_match = true;
77  for (int i = 0; i < a_mat.rows(); i++)
78  for (int j = 0; j < a_mat.cols(); j++)
79  {
80  bool approx_equality = approxEquality<typename M1::value_type>(a_mat(i, j), b_mat(i, j), eps);
81  if (!approx_equality)
82  {
83  matrixElementError(i, j, a_mat, b_mat);
84  all_elements_match = false;
85  if (!check_all)
86  return {false, error_msg.str()};
87  }
88  }
89  return {all_elements_match, error_msg.str()};
90 }

◆ checkRs() [1/2]

qmcplusplus::checkRs ( mc_coords_rs.  positions)

◆ checkRs() [2/2]

qmcplusplus::checkRs ( mc_coords_rsspins.  positions)

◆ checkShapeConsistency()

bool qmcplusplus::checkShapeConsistency ( hid_t  grp,
const std::string &  aname,
int  rank,
hsize_t *  dims 
)
inline

free function to check dimension

Parameters
grpgroup id
anamename of the dataspace
rankrank of the multi-dimensional array
dims[rank]size for each direction, return the actual size on file
Returns
true if the dims is the same as the dataspace

Definition at line 98 of file hdf_wrapper_functions.h.

References dims, is_same(), and rank.

99 {
100  using TSpaceType = h5_space_type<T, 0>;
101 
102  std::vector<hsize_t> dims_in;
103  if (getDataShape<T>(grp, aname, dims_in))
104  {
105  const int user_rank = rank - TSpaceType::added_rank();
106  if (dims_in.size() != user_rank)
107  throw std::runtime_error(aname + " dataspace rank does not match\n");
108 
109  bool is_same = true;
110  for (int i = 0; i < user_rank; ++i)
111  {
112  is_same &= (dims_in[i] == dims[i]);
113  dims[i] = dims_in[i];
114  }
115  return is_same;
116  }
117  else
118  return false;
119 }
bool is_same(const xmlChar *a, const char *b)
std::vector< int > dims

◆ checkVec()

bool qmcplusplus::checkVec ( T &  vec,
expected_vec 
)

Definition at line 53 of file test_SpaceGridInput.cpp.

Referenced by TEST_CASE().

53  {
54  return vec == expected_vec;
55 }

◆ cholesky()

Tensor<T, 3> qmcplusplus::cholesky ( const Tensor< T, 3 > &  a)
inline

Definition at line 950 of file TensorOps.h.

References sqrt().

Referenced by DMCUpdatePbyPL2::advanceWalker().

951 {
952  Tensor<T, 3> L;
953  T L00Inv;
954  //L = T(0); // already done by default constructor
955  L(0, 0) = sqrt(a(0, 0));
956  L00Inv = 1.0 / L(0, 0);
957  L(1, 0) = a(1, 0) * L00Inv;
958  L(2, 0) = a(2, 0) * L00Inv;
959  L(1, 1) = sqrt(a(1, 1) - L(1, 0) * L(1, 0));
960  L(2, 1) = (a(2, 1) - L(2, 0) * L(1, 0)) / L(1, 1);
961  L(2, 2) = sqrt(a(2, 2) - (L(2, 0) * L(2, 0) + L(2, 1) * L(2, 1)));
962  return L;
963 }
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ close()

hFile qmcplusplus::close ( )

◆ complex_test_case()

void qmcplusplus::complex_test_case ( )

Definition at line 60 of file test_attrib_ops.cpp.

References OTCDot< T1, T2, D >::apply(), OTCDot_CC< T1, T2, D >::apply(), CHECK(), Dot(), Dot_CC(), REQUIRE(), Vector< T, Alloc >::resize(), and Vector< T, Alloc >::size().

61 {
63 
64  v1 = std::complex<double>(2.0, 1.0);
65  double val1 = OTCDot<double, double, D>::apply(v1, v1);
66  CHECK(val1 == Approx(3.0 * D));
67 
68  double val1_cc = OTCDot_CC<double, double, D>::apply(v1, v1);
69  CHECK(val1_cc == Approx(5.0 * D));
70 
71 
72  ParticleAttrib<TinyVector<std::complex<double>, D>> PA1;
73  PA1.resize(3);
74  REQUIRE(PA1.size() == 3);
75 
76  // Whole array operation
77  PA1 = std::complex<double>(1.0, 2.0);
78 
79  double val = Dot(PA1, PA1);
80  CHECK(val == Approx(-3.0 * 3 * D));
81 
82  double val_cc = Dot_CC(PA1, PA1);
83  CHECK(val_cc == Approx(5.0 * 3 * D));
84 }
T Dot(const ParticleAttrib< TinyVector< T, D >> &pa, const ParticleAttrib< TinyVector< T, D >> &pb)
REQUIRE(std::filesystem::exists(filename))
double Dot_CC(const ParticleAttrib< TinyVector< std::complex< double >, D >> &pa, const ParticleAttrib< TinyVector< std::complex< double >, D >> &pb)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ compute_batch_parameters()

void compute_batch_parameters ( int  sample_size,
int  batch_size,
int &  num_batches,
int &  final_batch_size 
)

Compute number of batches and final batch size given the number of samples and a batch size.

Parameters
[in]sample_sizenumber of samples to process.
[in]batch_sizeprocess samples in batch_size at a time (typically the number of walkers in a crowd).
[out]num_batchesnumber of batches to use.
[out]final_batch_sizethe last batch size. May be smaller than batch_size if the number of samples is not a multiple of the batch size.

There may be cases where the batch size is zero. One cause is when the number of walkers per rank is less than the number of crowds.

Definition at line 207 of file QMCCostFunctionBatched.cpp.

References batch_size.

Referenced by QMCCostFunctionBatched::checkConfigurations(), QMCCostFunctionBatched::correlatedSampling(), and TEST_CASE().

208 {
209  if (batch_size == 0)
210  num_batches = 0;
211  else
212  num_batches = sample_size / batch_size;
213 
214  final_batch_size = batch_size;
215  if (batch_size != 0 && sample_size % batch_size != 0)
216  {
217  num_batches += 1;
218  final_batch_size = sample_size % batch_size;
219  }
220 }

◆ compute_norm()

T qmcplusplus::compute_norm ( const Vector< std::complex< T >> &  cG)
inline

Compute the norm of an orbital.

Parameters
cGthe plane wave coefficients
Returns
norm of the orbital

Definition at line 220 of file einspline_helper.hpp.

References real(), and sqrt().

Referenced by SplineSetReader< typename SA::SplineBase >::readOneOrbitalCoefs().

221 {
222  T total_norm2(0);
223 #pragma omp parallel for reduction(+ : total_norm2)
224  for (size_t ig = 0; ig < cG.size(); ++ig)
225  total_norm2 += cG[ig].real() * cG[ig].real() + cG[ig].imag() * cG[ig].imag();
226  return std::sqrt(total_norm2);
227 }
QMCTraits::RealType real
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ compute_phase()

void qmcplusplus::compute_phase ( const Array< std::complex< T >, 3 > &  in,
const TinyVector< T2, 3 > &  twist,
T &  phase_r,
T &  phase_i 
)
inline

Compute the phase factor for rotation.

The algorithm aims at balanced real and imaginary parts.

Parameters
inthe real space orbital value on a 3D grid
twistk-point in reduced coordinates
phase_routput real part of the phase
phase_ioutput imaginary part of the phase

Definition at line 236 of file einspline_helper.hpp.

References TinyVector< T, D >::data(), qmcplusplus::Units::time::s, sincos(), and sqrt().

Referenced by fix_phase_rotate_c2c().

237 {
238  const T two_pi = -2.0 * M_PI;
239  const size_t nx = in.size(0);
240  const size_t ny = in.size(1);
241  const size_t nz = in.size(2);
242 
243  const T nx_i = 1.0 / static_cast<T>(nx);
244  const T ny_i = 1.0 / static_cast<T>(ny);
245  const T nz_i = 1.0 / static_cast<T>(nz);
246 
247  T rNorm = 0.0, iNorm = 0.0, riNorm = 0.0;
248 #pragma omp parallel for reduction(+ : rNorm, iNorm, riNorm)
249  for (size_t ix = 0; ix < nx; ++ix)
250  {
251  for (size_t iy = 0; iy < ny; ++iy)
252  {
253  const T rux = static_cast<T>(ix) * nx_i * twist[0];
254  T s, c;
255  T rsum = 0, isum = 0, risum = 0.0;
256  const T ruy = static_cast<T>(iy) * ny_i * twist[1];
257  const std::complex<T>* restrict in_ptr = in.data() + ix * ny * nz + iy * nz;
258  for (size_t iz = 0; iz < nz; ++iz)
259  {
260  const T ruz = static_cast<T>(iz) * nz_i * twist[2];
261  qmcplusplus::sincos(-two_pi * (rux + ruy + ruz), &s, &c);
262  const T re = c * in_ptr[iz].real() - s * in_ptr[iz].imag();
263  const T im = s * in_ptr[iz].real() + c * in_ptr[iz].imag();
264  rsum += re * re;
265  isum += im * im;
266  risum += re * im;
267  }
268  rNorm += rsum;
269  iNorm += isum;
270  riNorm += risum;
271  }
272  }
273 
274  const T x = (rNorm - iNorm) / riNorm;
275  const T y = 1.0 / std::sqrt(x * x + 4.0);
276  const T phs = std::sqrt(0.5 - y);
277  phase_r = phs;
278  phase_i = (x < 0) ? std::sqrt(1.0 - phs * phs) : -std::sqrt(1.0 - phs * phs);
279 }
Type_t * data()
Definition: OhmmsArray.h:87
size_t size() const
Definition: OhmmsArray.h:57
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
void sincos(T a, T *restrict s, T *restrict c)
sincos function wrapper
Definition: math.hpp:62

◆ computeLogDet()

void qmcplusplus::computeLogDet ( const T *restrict  diag,
int  n,
const int *restrict  pivot,
std::complex< T_FP > &  logdet 
)
inline

Definition at line 100 of file DiracMatrix.h.

References log(), and n.

Referenced by DiracMatrixComputeOMPTarget< VALUE_FP >::computeInvertAndLog(), DiracMatrix< VALUE_FP >::computeInvertAndLog(), cuSolverInverter< T_FP >::invert_transpose(), and rocSolverInverter< T_FP >::invert_transpose().

101 {
102  logdet = std::complex<T_FP>();
103  for (size_t i = 0; i < n; i++)
104  logdet += std::log(std::complex<T_FP>((pivot[i] == i + 1) ? diag[i] : -diag[i]));
105 }
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)

◆ computeLogDet_sycl() [1/4]

std::complex<T> qmcplusplus::computeLogDet_sycl ( sycl::queue aq,
int  n,
int  lda,
const TMAT *  a,
const INDEX *  pivot,
const std::vector< sycl::event > &  dependencies = {} 
)

◆ computeLogDet_sycl() [2/4]

std::complex<T> qmcplusplus::computeLogDet_sycl ( sycl::queue aq,
int  n,
int  lda,
const TMAT *restrict  a,
const INDEX *restrict  pivot,
const std::vector< sycl::event > &  dependencies 
)

Definition at line 92 of file sycl_determinant_helper.cpp.

References qmcplusplus::Units::distance::A, lda, log(), and n.

98 {
99  constexpr size_t COLBS = 128;
100 
101  std::complex<T> result{};
102  {
103  sycl::buffer<std::complex<T>, 1> abuff(&result, {1});
104  aq.submit([&](sycl::handler& cgh) {
105  cgh.depends_on(dependencies);
106 
107  size_t n_max = ((n + COLBS - 1) / COLBS) * COLBS;
108  sycl::global_ptr<const TMAT> A{a};
109  sycl::global_ptr<const INDEX> Pivot{pivot};
110  cgh.parallel_for(sycl::range<1>{n_max}, sycl::reduction(abuff, cgh, {T{}, T{}}, std::plus<std::complex<T>>()),
111  [=](sycl::id<1> i, auto& sum) {
112  std::complex<T> val{};
113  if (i < n)
114  val = (Pivot[i] == i + 1) ? std::log(std::complex<T>(A[i * lda + i]))
115  : std::log(std::complex<T>(-A[i * lda + i]));
116  sum.combine(val);
117  });
118  });
119  } //synchronous
120  return result;
121 }
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)

◆ computeLogDet_sycl() [3/4]

template std::complex<double> qmcplusplus::computeLogDet_sycl ( sycl::queue aq,
int  n,
int  lda,
const double *restrict  a,
const std::int64_t *restrict  pivot,
const std::vector< sycl::event > &  dependencies 
)

◆ computeLogDet_sycl() [4/4]

template std::complex<double> qmcplusplus::computeLogDet_sycl ( sycl::queue aq,
int  n,
int  lda,
const std::complex< double > *restrict  a,
const std::int64_t *restrict  pivot,
const std::vector< sycl::event > &  dependencies 
)

◆ computeRadialPhiBar()

void computeRadialPhiBar ( ParticleSet targetP,
ParticleSet sourceP,
int  curOrb_,
int  curCenter_,
SPOSet Phi,
Vector< QMCTraits::RealType > &  xgrid,
Vector< QMCTraits::RealType > &  rad_orb,
const CuspCorrectionParameters data 
)

Compute the radial part of the corrected wavefunction.

Definition at line 280 of file CuspCorrectionConstruction.cpp.

References OneMolecularOrbital::changeOrbital(), phiBar(), and Vector< T, Alloc >::size().

Referenced by applyCuspCorrection(), and TEST_CASE().

288 {
289  OneMolecularOrbital phiMO(targetP, sourceP, Phi);
290  phiMO.changeOrbital(curCenter_, curOrb_);
291  CuspCorrection cusp(data);
292 
293  for (int i = 0; i < xgrid.size(); i++)
294  {
295  rad_orb[i] = phiBar(cusp, xgrid[i], phiMO);
296  }
297 }
RealType phiBar(const CuspCorrection &cusp, RealType r, OneMolecularOrbital &phiMO)

◆ conj() [1/4]

float qmcplusplus::conj ( const float &  c)
inline

◆ conj() [2/4]

double qmcplusplus::conj ( const double &  c)
inline

Definition at line 97 of file complex_help.hpp.

97 { return c; }

◆ conj() [3/4]

std::complex<float> qmcplusplus::conj ( const std::complex< float > &  c)
inline

Definition at line 98 of file complex_help.hpp.

References conj().

98 { return std::conj(c); }
std::complex< double > conj(const std::complex< double > &c)

◆ conj() [4/4]

std::complex<double> qmcplusplus::conj ( const std::complex< double > &  c)
inline

Definition at line 99 of file complex_help.hpp.

Referenced by conj().

99 { return std::conj(c); }
std::complex< double > conj(const std::complex< double > &c)

◆ convert()

void qmcplusplus::convert ( const PL &  lat,
const PV &  pin,
PV &  pout 
)

Definition at line 24 of file ParticleUtility.h.

Referenced by RadialOrbitalSetBuilder< COT >::finalize(), SPOSetInputInfo::put(), DiracMatrixComputeOMPTarget< VALUE_FP >::reset(), and OrbitalImages::write_orbital_xsf().

25 {
26  if (pin.InUnit == pout.InUnit)
27  {
28  pout = pin;
29  return;
30  }
31  if (pin.InUnit)
32  {
33  for (int i = 0; i < pin.size(); i++)
34  pout[i] = lat.toCart(pin[i]);
35  return;
36  }
37  else
38  {
39  for (int i = 0; i < pin.size(); i++)
40  pout[i] = lat.toUnit(pin[i]);
41  return;
42  }
43 }

◆ convert2Cart()

void qmcplusplus::convert2Cart ( const PL &  lat,
PV &  pin 
)

Definition at line 49 of file ParticleUtility.h.

50 {
51  if (pin.InUnit)
52  {
53  PV tmp(pin.size());
54  tmp = pin;
55  pin.InUnit = false;
56  for (int i = 0; i < pin.size(); i++)
57  pin[i] = lat.toCart(pin[i]);
58  }
59 }

◆ convert2Unit()

void qmcplusplus::convert2Unit ( const PL &  lat,
PV &  pin 
)

Definition at line 62 of file ParticleUtility.h.

63 {
64  if (!pin.InUnit)
65  {
66  PV tmp(pin.size());
67  tmp = pin;
68  pin.InUnit = true;
69  for (int i = 0; i < pin.size(); i++)
70  pin[i] = lat.toUnit(pin[i]);
71  }
72 }

◆ convert_ref_to_ptr_list()

static std::vector<T*> qmcplusplus::convert_ref_to_ptr_list ( const std::vector< std::reference_wrapper< T >> &  ref_list)
static

Definition at line 103 of file template_types.hpp.

104 {
105  std::vector<T*> ptr_list;
106  ptr_list.reserve(ref_list.size());
107  for (auto& ref : ref_list)
108  ptr_list.push_back(&ref.get());
109  return ptr_list;
110 }

◆ convert_to_ns()

FakeChronoClock::duration convert_to_ns ( in)

Definition at line 27 of file test_runtime_manager.cpp.

Referenced by TEST_CASE().

28 {
29  return std::chrono::duration_cast<std::chrono::nanoseconds>(in);
30 }

◆ convert_to_s()

double qmcplusplus::convert_to_s ( in)

Definition at line 46 of file test_timer.cpp.

Referenced by TEST_CASE().

47 {
48  return std::chrono::duration_cast<std::chrono::duration<double>>(in).count();
49 }

◆ convertPtrToRefVector()

static RefVector<T> qmcplusplus::convertPtrToRefVector ( const std::vector< T *> &  ptr_list)
static

Definition at line 92 of file template_types.hpp.

93 {
94  RefVector<T> ref_list;
95  ref_list.reserve(ptr_list.size());
96  for (auto ptr : ptr_list)
97  ref_list.push_back(*ptr);
98  return ref_list;
99 }

◆ convertPtrToRefVectorSubset()

static RefVector<T> qmcplusplus::convertPtrToRefVectorSubset ( const std::vector< T *> &  ptr_list,
int  offset,
int  len 
)
static

Definition at line 140 of file template_types.hpp.

Referenced by QMCCostFunctionBatched::checkConfigurations(), and TEST_CASE().

141 {
142  // check lower and upper bounds
143  assert(offset >= 0);
144  assert(offset + len <= ptr_list.size());
145 
146  RefVector<T> ref_list;
147  ref_list.reserve(len);
148  for (int i = offset; i < offset + len; i++)
149  ref_list.push_back(*ptr_list[i]);
150 
151  return ref_list;
152 }

◆ convertRefVectorToRefVectorSubset()

static RefVector<T> qmcplusplus::convertRefVectorToRefVectorSubset ( const RefVector< T > &  ref_list,
int  offset,
int  len 
)
static

Definition at line 155 of file template_types.hpp.

156 {
157  // check lower and upper bounds
158  assert(offset >= 0);
159  assert(offset + len <= ref_list.size());
160 
161  RefVector<T> sub_ref_list;
162  sub_ref_list.reserve(len);
163  for (int i = offset; i < offset + len; i++)
164  sub_ref_list.push_back(ref_list[i]);
165 
166  return sub_ref_list;
167 }

◆ convertStrToVec()

std::vector<T> qmcplusplus::convertStrToVec ( const std::string &  s)
inline

extract the contents of a string to a vector of something. separator is white spaces.

Definition at line 152 of file string_utils.h.

References qmcplusplus::Units::time::s.

153 {
154  std::istringstream stream(s);
155  std::vector<T> b;
156  while (!stream.eof())
157  {
158  if (T t; stream >> t)
159  b.push_back(t);
160  else if (!stream.eof() && stream.fail())
161  {
162  std::ostringstream msg;
163  msg << "Error parsing string '" << s << "' for type (type_info::name) " << typeid(T).name() << "." << std::endl;
164  throw std::runtime_error(msg.str());
165  }
166  }
167  return b;
168 }

◆ convertToReal() [1/7]

◆ convertToReal() [2/7]

void qmcplusplus::convertToReal ( const std::complex< T1 > &  in,
T2 &  out 
)
inline

specialization of conversion from complex to real

Definition at line 40 of file ConvertToReal.h.

41 {
42  out = in.real();
43 }

◆ convertToReal() [3/7]

void qmcplusplus::convertToReal ( const TinyVector< T1, D > &  in,
TinyVector< T2, D > &  out 
)
inline

Definition at line 49 of file ConvertToReal.h.

References convertToReal().

50 {
51  for (int i = 0; i < D; ++i)
52  convertToReal(in[i], out[i]);
53 }
void convertToReal(const Matrix< T1 > &in, Matrix< T2 > &out)
specialization for a vector
Definition: ConvertToReal.h:84

◆ convertToReal() [4/7]

void qmcplusplus::convertToReal ( const Tensor< T1, D > &  in,
Tensor< T2, D > &  out 
)
inline

specialization for D tensory

Definition at line 57 of file ConvertToReal.h.

References convertToReal().

58 {
59  for (int i = 0; i < D * D; ++i)
60  convertToReal(in[i], out[i]);
61 }
void convertToReal(const Matrix< T1 > &in, Matrix< T2 > &out)
specialization for a vector
Definition: ConvertToReal.h:84

◆ convertToReal() [5/7]

void qmcplusplus::convertToReal ( const T1 *restrict  in,
T2 *restrict  out,
std::size_t  n 
)
inline

generic function to convert arrays

Parameters
instarting address of type T1
outstarting address of type T2
nsize of in/out

Definition at line 69 of file ConvertToReal.h.

References convertToReal(), and n.

70 {
71  for (int i = 0; i < n; ++i)
72  convertToReal(in[i], out[i]);
73 }
void convertToReal(const Matrix< T1 > &in, Matrix< T2 > &out)
specialization for a vector
Definition: ConvertToReal.h:84

◆ convertToReal() [6/7]

void qmcplusplus::convertToReal ( const Vector< T1 > &  in,
Vector< T2 > &  out 
)
inline

specialization for a vector

Definition at line 77 of file ConvertToReal.h.

References convertToReal(), Vector< T, Alloc >::data(), and Vector< T, Alloc >::size().

78 {
79  convertToReal(in.data(), out.data(), in.size());
80 }
void convertToReal(const Matrix< T1 > &in, Matrix< T2 > &out)
specialization for a vector
Definition: ConvertToReal.h:84

◆ convertToReal() [7/7]

void qmcplusplus::convertToReal ( const Matrix< T1 > &  in,
Matrix< T2 > &  out 
)
inline

specialization for a vector

Definition at line 84 of file ConvertToReal.h.

References convertToReal(), Matrix< T, Alloc >::data(), and Matrix< T, Alloc >::size().

85 {
86  convertToReal(in.data(), out.data(), in.size());
87 }
void convertToReal(const Matrix< T1 > &in, Matrix< T2 > &out)
specialization for a vector
Definition: ConvertToReal.h:84

◆ convertUPtrToPtrVector()

static std::vector<T*> qmcplusplus::convertUPtrToPtrVector ( const UPtrVector< T > &  uptr_list)
static

Definition at line 114 of file template_types.hpp.

115 {
116  std::vector<T*> ptr_list;
117  ptr_list.reserve(uptr_list.size());
118  for (auto& uptr : uptr_list)
119  ptr_list.push_back(uptr.get());
120  return ptr_list;
121 }

◆ convertUPtrToRefVector() [1/2]

static RefVector<T> qmcplusplus::convertUPtrToRefVector ( const UPtrVector< T > &  ptr_list)
static

convert a vector of std::unique_ptrs<T> to a refvector<T>

Definition at line 66 of file template_types.hpp.

Referenced by QMCCostFunctionBatched::correlatedSampling(), EstimatorManagerCrowd::get_operator_estimators(), EstimatorManagerCrowd::get_scalar_estimators(), SetupSFNBranch::operator()(), EstimatorManagerNew::reduceOperatorEstimators(), TEST_CASE(), and RandomNumberControl::write().

67 {
68  RefVector<T> ref_list;
69  ref_list.reserve(ptr_list.size());
70  for (const UPtr<T>& ptr : ptr_list)
71  ref_list.push_back(*ptr);
72  return ref_list;
73 }

◆ convertUPtrToRefVector() [2/2]

static RefVector<T2> qmcplusplus::convertUPtrToRefVector ( const UPtrVector< T > &  ptr_list)
static

convert a vector of std::unique_ptrs<T> to a refvector<T2> the static assert prevents ambiguity between this function and the above when T is a derived type of T2.

Definition at line 80 of file template_types.hpp.

81 {
82  static_assert(!std::is_same_v<T2, T> && std::is_base_of_v<T2, T>);
83  RefVector<T2> ref_list;
84  ref_list.reserve(ptr_list.size());
85  for (const UPtr<T>& ptr : ptr_list)
86  ref_list.push_back(*ptr);
87  return ref_list;
88 }

◆ convertUPtrToRefVectorSubset()

static RefVector<T> qmcplusplus::convertUPtrToRefVectorSubset ( const UPtrVector< T > &  ptr_list,
int  offset,
int  len 
)
static

Definition at line 125 of file template_types.hpp.

Referenced by CostFunctionCrowdData::get_h0_list(), CostFunctionCrowdData::get_h_list(), CostFunctionCrowdData::get_p_list(), and CostFunctionCrowdData::get_wf_list().

126 {
127  // check lower and upper bounds
128  assert(offset >= 0);
129  assert(offset + len <= ptr_list.size());
130 
131  RefVector<T> ref_list;
132  ref_list.reserve(len);
133  for (int i = offset; i < offset + len; i++)
134  ref_list.push_back(*ptr_list[i]);
135 
136  return ref_list;
137 }

◆ convertValueToLog() [1/2]

std::complex<T> qmcplusplus::convertValueToLog ( const std::complex< T > &  logpsi)
inline

evaluate log(psi) as log(|psi|) and phase

Parameters
psireal/complex value
Returns
complex<T>(log(|psi|), arg(psi))

The return value is always complex regardless of the type of psi. The sign of of a real psi value is represented in the complex part of the return value. The phase of std::log(complex) is in range [-pi, pi] defined in C++

Definition at line 85 of file OrbitalSetTraits.h.

References log().

Referenced by AGPDeterminant::acceptMove(), DiracDeterminantWithBackflow::acceptMove(), DiracDeterminant< DU_TYPE >::acceptMove(), MultiSlaterDetTableMethod::acceptMove(), MultiDiracDeterminant::acceptMove(), DiracDeterminantBatched< PL, VT, FPVT >::acceptMove(), TrialWaveFunction::calcRatioGrad(), TrialWaveFunction::calcRatioGradWithSpin(), MultiSlaterDetTableMethod::evaluate_vgl_impl(), LinearOrbital::evaluateLog(), MultiSlaterDetTableMethod::mw_accept_rejectMove(), and DiracDeterminantBatched< PL, VT, FPVT >::mw_accept_rejectMove().

86 {
87  return std::log(logpsi);
88 }
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)

◆ convertValueToLog() [2/2]

std::complex<T> qmcplusplus::convertValueToLog ( const T  logpsi)
inline

Definition at line 91 of file OrbitalSetTraits.h.

References log().

92 {
93  return std::log(std::complex<T>(logpsi));
94 }
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)

◆ Copy() [1/2]

void qmcplusplus::Copy ( const ParticleAttrib< TinyVector< std::complex< T >, D >> &  c,
ParticleAttrib< TinyVector< T, D >> &  r 
)
inline

Definition at line 203 of file ParticleAttribOps.h.

References real().

204 {
205  for (int i = 0; i < c.size(); i++)
206  {
207  //r[i]=real(c[i]);
208  for (int j = 0; j < D; j++)
209  r[i][j] = c[i][j].real();
210  }
211 }
QMCTraits::RealType real

◆ Copy() [2/2]

void qmcplusplus::Copy ( const ParticleAttrib< TinyVector< T, D >> &  c,
ParticleAttrib< TinyVector< T, D >> &  r 
)
inline

Definition at line 214 of file ParticleAttribOps.h.

215 {
216  r = c;
217 }

◆ copy_with_complex_cast() [1/4]

void qmcplusplus::copy_with_complex_cast ( const std::complex< double > &  source,
std::complex< double > &  dest 
)
inline

Definition at line 101 of file complex_help.hpp.

Referenced by RotatedSPOs::exponentiate_antisym_matrix().

101 { dest = source; }

◆ copy_with_complex_cast() [2/4]

void qmcplusplus::copy_with_complex_cast ( const std::complex< double > &  source,
double &  dest 
)
inline

Definition at line 102 of file complex_help.hpp.

102 { dest = source.real(); }

◆ copy_with_complex_cast() [3/4]

void qmcplusplus::copy_with_complex_cast ( const std::complex< float > &  source,
std::complex< float > &  dest 
)
inline

Definition at line 103 of file complex_help.hpp.

103 { dest = source; }

◆ copy_with_complex_cast() [4/4]

void qmcplusplus::copy_with_complex_cast ( const std::complex< float > &  source,
float &  dest 
)
inline

Definition at line 104 of file complex_help.hpp.

104 { dest = source.real(); }

◆ copyGridUnrotatedForTest() [1/2]

void qmcplusplus::copyGridUnrotatedForTest ( NonLocalECPComponent nlpp)

Definition at line 153 of file test_ecp.cpp.

References NonLocalECPComponent::rrotsgrid_m, and NonLocalECPComponent::sgridxyz_m.

Referenced by TEST_CASE().

153 { nlpp.rrotsgrid_m = nlpp.sgridxyz_m; }

◆ copyGridUnrotatedForTest() [2/2]

void qmcplusplus::copyGridUnrotatedForTest ( SOECPComponent sopp)

Definition at line 154 of file test_ecp.cpp.

References SOECPComponent::rrotsgrid_m_, and SOECPComponent::sgridxyz_m_.

154 { sopp.rrotsgrid_m_ = sopp.sgridxyz_m_; }

◆ cos() [1/2]

MakeReturn<UnaryNode<FnCos, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::cos ( const Vector< T1, C1 > &  l)
inline

Definition at line 64 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by assignGaussRand(), QMCFiniteSize::build_spherical_grid(), CubicFormula(), LPQHI_BasisClass::dEminus_dk(), LPQHI_BasisClass::dEplus_dk(), derivYlmSpherical(), LPQHIBasis::Eminus(), LPQHISRCoulombBasis::Eminus(), LPQHI_BasisClass::Eminus(), LPQHISRCoulombBasis::Eminus_dG(), LPQHIBasis::Eplus(), LPQHISRCoulombBasis::Eplus(), LPQHI_BasisClass::Eplus(), LPQHISRCoulombBasis::Eplus_dG(), SpinorSet::evaluate_notranspose(), SpinorSet::evaluate_notranspose_spin(), SpinorSet::evaluate_spin(), SpinorSet::evaluateDetSpinorRatios(), SpinorSet::evaluateGradSource(), SpinorSet::evaluateValue(), SpinorSet::evaluateVGL(), SpinorSet::evaluateVGL_spin(), CoulombFunctor< T >::Fk(), generateRotationMatrix(), MagnetizationDensity::generateSpinIntegrand(), MPC::init_f_G(), SpaceGrid::initialize_rectilinear(), ChannelPotential::jl(), kSpaceJastrow::kSpaceJastrow(), SOECPComponent::matrixElementDecomposed(), SpinorSet::mw_evaluate_notranspose(), SpinorSet::mw_evaluateVGLandDetRatioGradsWithSpin(), SpinorSet::mw_evaluateVGLWithSpin(), FnCos::operator()(), KspaceEwaldTerm::operator()(), SFNBranch::phaseChanged(), SimpleFixedNodeBranch::phaseChanged(), Quadrature3D< T >::Quadrature3D(), WaveFunctionTester::runBasicTest(), WaveFunctionTester::runZeroVarianceTest(), sincos(), sMatrixElement(), SOECPComponent::sMatrixElements(), NESpaceGrid< REAL >::someMoreAxisGridStuff(), sph2cart(), kSpaceJastrow::StructureFactor(), TEST_CASE(), test_e2iphi(), EslerCoulomb3D::Xk(), CoulombFunctor< T >::Xk(), YukawaBreakup< T >::Xk(), DerivYukawaBreakup< T >::Xk(), Ylm(), and Ylm().

66 {
67  using Tree_t = UnaryNode<FnCos, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
68  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
69 }

◆ cos() [2/2]

MakeReturn<UnaryNode<FnCos, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::cos ( const Expression< T1 > &  l)
inline

Definition at line 1411 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1413 {
1414  using Tree_t = UnaryNode<FnCos, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1415  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1416 }

◆ cosh() [1/2]

MakeReturn<UnaryNode<FnHypCos, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::cosh ( const Vector< T1, C1 > &  l)
inline

Definition at line 72 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by FnHypCos::operator()().

74 {
75  using Tree_t = UnaryNode<FnHypCos, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
76  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
77 }

◆ cosh() [2/2]

MakeReturn<UnaryNode<FnHypCos, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::cosh ( const Expression< T1 > &  l)
inline

Definition at line 1419 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1421 {
1422  using Tree_t = UnaryNode<FnHypCos, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1423  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1424 }

◆ CplxDot()

std::complex<T> qmcplusplus::CplxDot ( const ParticleAttrib< TinyVector< std::complex< T >, D >> &  pa,
const ParticleAttrib< TinyVector< std::complex< T >, D >> &  pb 
)
inline

Definition at line 145 of file ParticleAttribOps.h.

References OTCDot< T1, T2, D >::cplx_apply().

Referenced by BareKineticEnergy::evaluate().

147 {
148  std::complex<T> sum(0.0, 0.0);
149  for (int i = 0; i < pa.size(); i++)
150  {
151  sum += OTCDot<T, T, D>::cplx_apply(pa[i], pb[i]);
152  }
153  return sum;
154 }

◆ CplxSum()

std::complex<T> qmcplusplus::CplxSum ( const ParticleAttrib< std::complex< T >> &  pa)
inline

Definition at line 192 of file ParticleAttribOps.h.

Referenced by BareKineticEnergy::evaluate().

193 {
194  std::complex<T> sum(0.0, 0.0);
195  for (int i = 0; i < pa.size(); i++)
196  {
197  sum += pa[i];
198  }
199  return sum;
200 }

◆ create()

hFile qmcplusplus::create ( filename  )

◆ create_C_pbc_particlesets()

void qmcplusplus::create_C_pbc_particlesets ( ParticleSet elec,
ParticleSet ions 
)

Definition at line 95 of file test_ion_derivs.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), ParticleSet::create(), ParticleSet::createSK(), qmcplusplus::Units::charge::e, ParticleSet::getSpeciesSet(), ParticleSet::R, ParticleSet::resetGroups(), ParticleSet::setName(), and ParticleSet::update().

96 {
97  ions.setName("ion0");
98  ions.create({2});
99  ions.R[0] = {0.1, 0.1, 0.1};
100  ions.R[1] = {1.6865805750, 1.6865805750, 1.6865805750};
101  ions.R[0][0] += -1e-5;
102  SpeciesSet& ion_species = ions.getSpeciesSet();
103  int pIdx = ion_species.addSpecies("C");
104  int pChargeIdx = ion_species.addAttribute("charge");
105  int iatnumber = ion_species.addAttribute("atomic_number");
106  ion_species(pChargeIdx, pIdx) = 4;
107  ion_species(iatnumber, pIdx) = 6;
108 
109  elec.setName("e");
110  elec.create({4, 4});
111  elec.R[0] = {3.6006741306e+00, 1.0104445324e+00, 3.9141099719e+00};
112  elec.R[1] = {2.6451694427e+00, 3.4448681473e+00, 5.8351296103e+00};
113  elec.R[2] = {2.5458446692e+00, 4.5219372791e+00, 4.4785209995e+00};
114  elec.R[3] = {2.8301650128e+00, 1.5351128324e+00, 1.5004137310e+00};
115  elec.R[4] = {5.6422291182e+00, 2.9968904592e+00, 3.3039907052e+00};
116  elec.R[5] = {2.6062992989e+00, 4.0493925313e-01, 2.5900053291e+00};
117  elec.R[6] = {8.1001577415e-01, 9.7303865512e-01, 1.3901383112e+00};
118  elec.R[7] = {1.6343332400e+00, 6.1895704609e-01, 1.2145253306e+00};
119 
120  SpeciesSet& tspecies = elec.getSpeciesSet();
121  int upIdx = tspecies.addSpecies("u");
122  int dnIdx = tspecies.addSpecies("d");
123  int chargeIdx = tspecies.addAttribute("charge");
124  int massIdx = tspecies.addAttribute("mass");
125  tspecies(chargeIdx, upIdx) = -1;
126  tspecies(massIdx, upIdx) = 1.0;
127  tspecies(chargeIdx, dnIdx) = -1;
128  tspecies(massIdx, dnIdx) = 1.0;
129 
130 
131  ions.resetGroups();
132  elec.resetGroups();
133  ions.createSK();
134  elec.createSK();
135  elec.addTable(elec);
136  elec.addTable(ions);
137  elec.update();
138 }

◆ create_CN_Hamiltonian()

QMCHamiltonian& qmcplusplus::create_CN_Hamiltonian ( HamiltonianFactory hf)

Definition at line 141 of file test_ion_derivs.cpp.

References doc, HamiltonianFactory::getH(), Libxml2Document::getRoot(), okay, Libxml2Document::parseFromString(), HamiltonianFactory::put(), and REQUIRE().

Referenced by TEST_CASE().

142 {
143  //Incantation to build hamiltonian
144  const char* hamiltonian_xml = R"(<hamiltonian name="h0" type="generic" target="e">
145  <pairpot type="coulomb" name="ElecElec" source="e" target="e"/>
146  <pairpot type="coulomb" name="IonIon" source="ion0" target="ion0"/>
147  <pairpot name="PseudoPot" type="pseudo" source="ion0" wavefunction="psi0" format="xml" algorithm="non-batched">
148  <pseudo elementType="C" href="C.ccECP.xml"/>
149  <pseudo elementType="N" href="N.ccECP.xml"/>
150  </pairpot>
151  </hamiltonian>)";
152 
154  bool okay = doc.parseFromString(hamiltonian_xml);
155  REQUIRE(okay);
156 
157  xmlNodePtr root = doc.getRoot();
158  hf.put(root);
159 
160  return *hf.getH();
161 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ create_CN_particlesets()

void qmcplusplus::create_CN_particlesets ( ParticleSet elec,
ParticleSet ions 
)

Definition at line 30 of file test_ion_derivs.cpp.

References ParticleSet::addTable(), doc, Libxml2Document::getRoot(), okay, Libxml2Document::parseFromString(), XMLParticleParser::readXML(), REQUIRE(), and ParticleSet::update().

Referenced by TEST_CASE().

31 {
32  const char* particles = R"(<tmp>
33  <particleset name="ion0" size="2">
34  <group name="C">
35  <parameter name="charge">4</parameter>
36  <parameter name="valence">2</parameter>
37  <parameter name="atomicnumber">6</parameter>
38  </group>
39  <group name="N">
40  <parameter name="charge">5</parameter>
41  <parameter name="valence">3</parameter>
42  <parameter name="atomicnumber">7</parameter>
43  </group>
44  <attrib name="position" datatype="posArray">
45  0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
46  0.0000000000e+00 0.0000000000e+00 2.0786985865e+00
47 </attrib>
48  <attrib name="ionid" datatype="stringArray">
49  C N
50 </attrib>
51  </particleset>
52  <particleset name="e">
53  <group name="u" size="5">
54  <parameter name="charge">-1</parameter>
55  <attrib name="position" datatype="posArray">
56 -0.55936725 -0.26942464 0.14459603
57 0.19146719 1.40287983 0.63931251
58 1.14805915 -0.52057335 3.49621107
59 0.28293870 -0.10273952 0.01707021
60 0.60626935 -0.25538121 1.75750740
61 </attrib>
62  </group>
63  <group name="d" size="4">
64  <parameter name="charge">-1</parameter>
65  <attrib name="position" datatype="posArray">
66 -0.47405939 0.59523171 -0.59778601
67 0.03150661 -0.27343474 0.56279442
68 -1.32648025 0.00970226 2.26944242
69 2.42944286 0.64884151 1.87505288
70 </attrib>
71  </group>
72  </particleset>
73  </tmp>)";
74 
76  bool okay = doc.parseFromString(particles);
77  REQUIRE(okay);
78 
79  xmlNodePtr root = doc.getRoot();
80  xmlNodePtr part1 = xmlFirstElementChild(root);
81  xmlNodePtr part2 = xmlNextElementSibling(part1);
82 
83  XMLParticleParser parse_ions(ions);
84  parse_ions.readXML(part1);
85 
86  XMLParticleParser parse_electrons(elec);
87  parse_electrons.readXML(part2);
88  ions.addTable(ions);
89  elec.addTable(ions);
90  elec.addTable(elec);
91  elec.update();
92  ions.update();
93 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ create_names()

static TimerNameList_t<TimerEnum> qmcplusplus::create_names ( std::string_view  myName)
static

Definition at line 47 of file TrialWaveFunction.cpp.

References suffixes.

48 {
49  TimerNameList_t<TimerEnum> timer_names;
50  std::string prefix = std::string("WaveFunction:").append(myName).append("::");
51  for (std::size_t i = 0; i < suffixes.size(); ++i)
52  timer_names.push_back({static_cast<TimerEnum>(i), prefix + suffixes[i]});
53  return timer_names;
54 }
static const std::vector< std::string > suffixes

◆ create_particle_gradient()

UPtrVector<ParticleSet::ParticleGradient> qmcplusplus::create_particle_gradient ( int  nelec,
int  nentry 
)

Definition at line 199 of file test_TrialWaveFunction_He.cpp.

Referenced by TEST_CASE().

200 {
201  UPtrVector<ParticleSet::ParticleGradient> G_list;
202  for (int i = 0; i < nentry; i++)
203  G_list.emplace_back(std::make_unique<ParticleSet::ParticleGradient>(nelec));
204 
205  return G_list;
206 }

◆ create_particle_laplacian()

UPtrVector<ParticleSet::ParticleLaplacian> qmcplusplus::create_particle_laplacian ( int  nelec,
int  nentry 
)

Definition at line 208 of file test_TrialWaveFunction_He.cpp.

Referenced by TEST_CASE().

209 {
210  UPtrVector<ParticleSet::ParticleLaplacian> L_list;
211  for (int i = 0; i < nentry; i++)
212  L_list.emplace_back(std::make_unique<ParticleSet::ParticleLaplacian>(nelec));
213 
214  return L_list;
215 }

◆ createBsplineComplex() [1/2]

std::unique_ptr<BsplineReader> qmcplusplus::createBsplineComplex ( EinsplineSetBuilder e,
bool  hybrid_rep,
const std::string &  useGPU 
)

create a reader which handles complex (double size real) splines, C2R or C2C case spline storage and computation precision is ST

Definition at line 24 of file createBsplineComplex.cpp.

References app_summary(), qmcplusplus::Units::charge::e, OHMMS_PRECISION, OMPTARGET, and PlatformSelector< KIND >::selectPlatform().

Referenced by EinsplineSpinorSetBuilder::createSPOSetFromXML(), and EinsplineSetBuilder::createSPOSetFromXML().

25 {
26  using RealType = OHMMS_PRECISION;
27  std::unique_ptr<BsplineReader> aReader;
28 
29 #if defined(QMC_COMPLEX)
30  app_summary() << " Using complex valued spline SPOs with complex " << SplineStoragePrecision<ST>::value
31  << " precision storage (C2C)." << std::endl;
32  if (CPUOMPTargetSelector::selectPlatform(useGPU) == PlatformKind::OMPTARGET)
33  {
34  app_summary() << " Running OpenMP offload code path." << std::endl;
35  if (hybrid_rep)
36  {
37  app_summary() << " Using hybrid orbital representation." << std::endl;
38  aReader = std::make_unique<HybridRepSetReader<HybridRepCplx<SplineC2COMPTarget<ST>>>>(e);
39  }
40  else
41  aReader = std::make_unique<SplineSetReader<SplineC2COMPTarget<ST>>>(e);
42  }
43  else
44  {
45  app_summary() << " Running on CPU." << std::endl;
46  if (hybrid_rep)
47  {
48  app_summary() << " Using hybrid orbital representation." << std::endl;
49  aReader = std::make_unique<HybridRepSetReader<HybridRepCplx<SplineC2C<ST>>>>(e);
50  }
51  else
52  aReader = std::make_unique<SplineSetReader<SplineC2C<ST>>>(e);
53  }
54 #else //QMC_COMPLEX
55  app_summary() << " Using real valued spline SPOs with complex " << SplineStoragePrecision<ST>::value
56  << " precision storage (C2R)." << std::endl;
57  if (CPUOMPTargetSelector::selectPlatform(useGPU) == PlatformKind::OMPTARGET)
58  {
59  app_summary() << " Running OpenMP offload code path." << std::endl;
60  if (hybrid_rep)
61  {
62  app_summary() << " Using hybrid orbital representation." << std::endl;
63  aReader = std::make_unique<HybridRepSetReader<HybridRepCplx<SplineC2ROMPTarget<ST>>>>(e);
64  }
65  else
66  aReader = std::make_unique<SplineSetReader<SplineC2ROMPTarget<ST>>>(e);
67  }
68  else
69  {
70  app_summary() << " Running on CPU." << std::endl;
71  if (hybrid_rep)
72  {
73  app_summary() << " Using hybrid orbital representation." << std::endl;
74  aReader = std::make_unique<HybridRepSetReader<HybridRepCplx<SplineC2R<ST>>>>(e);
75  }
76  else
77  aReader = std::make_unique<SplineSetReader<SplineC2R<ST>>>(e);
78  }
79 #endif
80  return aReader;
81 }
#define OHMMS_PRECISION
Definition: config.h:70
std::ostream & app_summary()
Definition: OutputManager.h:63
QMCTraits::RealType RealType

◆ createBsplineComplex() [2/2]

std::unique_ptr< BsplineReader > createBsplineComplex ( EinsplineSetBuilder e,
bool  use_single,
bool  hybrid_rep,
const std::string &  useGPU 
)

create a reader which handles complex (double size real) splines, C2R or C2C case spline storage and computation precision is double

Definition at line 83 of file createBsplineComplex.cpp.

References qmcplusplus::Units::charge::e.

87 {
88  if (use_single)
89  return createBsplineComplex<float>(e, hybrid_rep, useGPU);
90  else
91  return createBsplineComplex<double>(e, hybrid_rep, useGPU);
92 }

◆ createBsplineReal() [1/2]

std::unique_ptr<BsplineReader> qmcplusplus::createBsplineReal ( EinsplineSetBuilder e,
bool  hybrid_rep,
const std::string &  useGPU 
)

create a reader which handles real splines, R2R case spline storage and computation precision is ST

Definition at line 24 of file createBsplineReal.cpp.

References app_summary(), qmcplusplus::Units::charge::e, OMPTARGET, and PlatformSelector< KIND >::selectPlatform().

25 {
26  app_summary() << " Using real valued spline SPOs with real " << SplineStoragePrecision<ST>::value
27  << " precision storage (R2R)." << std::endl;
28  if (CPUOMPTargetSelector::selectPlatform(useGPU) == PlatformKind::OMPTARGET)
29  app_summary() << "OpenMP offload has not been implemented to support real valued spline SPOs with real storage!"
30  << std::endl;
31  app_summary() << " Running on CPU." << std::endl;
32 
33  std::unique_ptr<BsplineReader> aReader;
34  if (hybrid_rep)
35  {
36  app_summary() << " Using hybrid orbital representation." << std::endl;
37  aReader = std::make_unique<HybridRepSetReader<HybridRepReal<SplineR2R<ST>>>>(e);
38  }
39  else
40  aReader = std::make_unique<SplineSetReader<SplineR2R<ST>>>(e);
41  return aReader;
42 }
std::ostream & app_summary()
Definition: OutputManager.h:63

◆ createBsplineReal() [2/2]

std::unique_ptr< BsplineReader > createBsplineReal ( EinsplineSetBuilder e,
bool  use_single,
bool  hybrid_rep,
const std::string &  useGPU 
)

create a reader which handles real splines, R2R case spline storage and computation precision is double

Definition at line 44 of file createBsplineReal.cpp.

References qmcplusplus::Units::charge::e.

Referenced by EinsplineSpinorSetBuilder::createSPOSetFromXML(), and EinsplineSetBuilder::createSPOSetFromXML().

48 {
49  if (use_single)
50  return createBsplineReal<float>(e, hybrid_rep, useGPU);
51  else
52  return createBsplineReal<double>(e, hybrid_rep, useGPU);
53 }

◆ createDistanceTable() [1/2]

std::unique_ptr<DistanceTable> qmcplusplus::createDistanceTable ( ParticleSet s,
std::ostream &  description 
)
inline

Definition at line 43 of file createDistanceTable.h.

References createDistanceTableAA(), createDistanceTableAAOMPTarget(), DC_POS_OFFLOAD, and qmcplusplus::Units::time::s.

Referenced by ParticleSet::addTable().

44 {
45  // during P-by-P move, the cost of single particle evaluation of distance tables
46  // is determined by the number of source particles.
47  // Thus the implementation selection is determined by the source particle set.
48  if (s.getCoordinates().getKind() == DynamicCoordinateKind::DC_POS_OFFLOAD)
49  return createDistanceTableAAOMPTarget(s, description);
50  else
51  return createDistanceTableAA(s, description);
52 }
std::unique_ptr< DistanceTable > createDistanceTableAA(ParticleSet &s, std::ostream &description)
Class to manage multiple DistanceTable objects.
std::unique_ptr< DistanceTable > createDistanceTableAAOMPTarget(ParticleSet &s, std::ostream &description)
Adding SymmetricDTD to the list, e.g., el-el distance table.

◆ createDistanceTable() [2/2]

std::unique_ptr<DistanceTable> qmcplusplus::createDistanceTable ( const ParticleSet s,
ParticleSet t,
std::ostream &  description 
)
inline

Definition at line 60 of file createDistanceTable.h.

References createDistanceTableAB(), createDistanceTableABOMPTarget(), DC_POS_OFFLOAD, and qmcplusplus::Units::time::s.

63 {
64  // during P-by-P move, the cost of single particle evaluation of distance tables
65  // is determined by the number of source particles.
66  // Thus the implementation selection is determined by the source particle set.
67  if (s.getCoordinates().getKind() == DynamicCoordinateKind::DC_POS_OFFLOAD)
68  return createDistanceTableABOMPTarget(s, t, description);
69  else
70  return createDistanceTableAB(s, t, description);
71 }
std::unique_ptr< DistanceTable > createDistanceTableAB(const ParticleSet &s, ParticleSet &t, std::ostream &description)
free function create a distable table of s-t
std::unique_ptr< DistanceTable > createDistanceTableABOMPTarget(const ParticleSet &s, ParticleSet &t, std::ostream &description)
Adding AsymmetricDTD to the list, e.g., el-el distance table.

◆ createDistanceTableAA()

std::unique_ptr< DistanceTable > createDistanceTableAA ( ParticleSet s,
std::ostream &  description 
)

Class to manage multiple DistanceTable objects.

Adding SymmetricDTD to the list, e.g., el-el distance table.

Date
2008-09-19 static data members are removed. DistanceTable::add functions are kept for compatibility only. New codes should use a member function of ParticleSet to add a distance table int ParticleSet::addTable(const ParticleSet& source)
Deprecated:
There is only one instance of the data memebers of DistanceTable in an application and the data are shared by many objects. Note that static data members and functions are used (based on singleton and factory patterns).
Todo:
DistanceTable should work as a factory, as well, to instantiate DistanceTable subject to different boundary conditions. Lattice/CrystalLattice.h and Lattice/CrystalLattice.cpp can be owned by DistanceTable to generically control the crystalline structure.

free function to create a distable table of s-s

Parameters
ssource/target particle set
Returns
index of the distance table with the name

Definition at line 27 of file createDistanceTableAA.cpp.

References qmcplusplus::ewaldref::DIM, OHMMS_DIM, OHMMS_PRECISION, qmcplusplus::Units::time::s, SUPERCELL_BULK, SUPERCELL_SLAB, and SUPERCELL_WIRE.

Referenced by createDistanceTable().

28 {
29  using RealType = OHMMS_PRECISION;
30  enum
31  {
32  DIM = OHMMS_DIM
33  };
34  const int sc = s.getLattice().SuperCellEnum;
35  std::unique_ptr<DistanceTable> dt;
36  std::ostringstream o;
37  o << " Distance table for similar particles (A-A):" << std::endl;
38  o << " source/target: " << s.getName() << std::endl;
39  o << " Using structure-of-arrays (SoA) data layout" << std::endl;
40 
41  if (sc == SUPERCELL_BULK)
42  {
43  if (s.getLattice().DiagonalOnly)
44  {
45  o << " Distance computations use orthorhombic periodic cell in 3D." << std::endl;
46  dt = std::make_unique<SoaDistanceTableAA<RealType, DIM, PPPO + SOA_OFFSET>>(s);
47  }
48  else
49  {
50  if (s.getLattice().WignerSeitzRadius > s.getLattice().SimulationCellRadius)
51  {
52  o << " Distance computations use general periodic cell in 3D with corner image checks." << std::endl;
53  dt = std::make_unique<SoaDistanceTableAA<RealType, DIM, PPPG + SOA_OFFSET>>(s);
54  }
55  else
56  {
57  o << " Distance computations use general periodic cell in 3D without corner image checks." << std::endl;
58  dt = std::make_unique<SoaDistanceTableAA<RealType, DIM, PPPS + SOA_OFFSET>>(s);
59  }
60  }
61  }
62  else if (sc == SUPERCELL_SLAB)
63  {
64  if (s.getLattice().DiagonalOnly)
65  {
66  o << " Distance computations use orthorhombic code for periodic cell in 2D." << std::endl;
67  dt = std::make_unique<SoaDistanceTableAA<RealType, DIM, PPNO + SOA_OFFSET>>(s);
68  }
69  else
70  {
71  if (s.getLattice().WignerSeitzRadius > s.getLattice().SimulationCellRadius)
72  {
73  o << " Distance computations use general periodic cell in 2D with corner image checks." << std::endl;
74  dt = std::make_unique<SoaDistanceTableAA<RealType, DIM, PPNG + SOA_OFFSET>>(s);
75  }
76  else
77  {
78  o << " Distance computations use general periodic cell in 2D without corner image checks." << std::endl;
79  dt = std::make_unique<SoaDistanceTableAA<RealType, DIM, PPNS + SOA_OFFSET>>(s);
80  }
81  }
82  }
83  else if (sc == SUPERCELL_WIRE)
84  {
85  o << " Distance computations use periodic cell in one dimension." << std::endl;
86  dt = std::make_unique<SoaDistanceTableAA<RealType, DIM, SUPERCELL_WIRE + SOA_OFFSET>>(s);
87  }
88  else //open boundary condition
89  {
90  o << " Distance computations use open boundary conditions in 3D." << std::endl;
91  dt = std::make_unique<SoaDistanceTableAA<RealType, DIM, SUPERCELL_OPEN + SOA_OFFSET>>(s);
92  }
93 
94  description << o.str() << std::endl;
95  return dt;
96 }
#define OHMMS_PRECISION
Definition: config.h:70
#define OHMMS_DIM
Definition: config.h:64
QMCTraits::RealType RealType

◆ createDistanceTableAAOMPTarget()

std::unique_ptr< DistanceTable > createDistanceTableAAOMPTarget ( ParticleSet s,
std::ostream &  description 
)

Adding SymmetricDTD to the list, e.g., el-el distance table.

Parameters
ssource/target particle set
Returns
index of the distance table with the name

Definition at line 27 of file createDistanceTableAAOMPTarget.cpp.

References qmcplusplus::ewaldref::DIM, OHMMS_DIM, OHMMS_PRECISION, qmcplusplus::Units::time::s, SUPERCELL_BULK, SUPERCELL_SLAB, and SUPERCELL_WIRE.

Referenced by createDistanceTable().

28 {
29  using RealType = OHMMS_PRECISION;
30  enum
31  {
32  DIM = OHMMS_DIM
33  };
34  const int sc = s.getLattice().SuperCellEnum;
35  std::unique_ptr<DistanceTable> dt;
36  std::ostringstream o;
37  o << " Distance table for similar particles (A-A):" << std::endl;
38  o << " source/target: " << s.getName() << std::endl;
39  o << " Using structure-of-arrays (SoA) data layout and OpenMP offload" << std::endl;
40 
41  if (sc == SUPERCELL_BULK)
42  {
43  if (s.getLattice().DiagonalOnly)
44  {
45  o << " Distance computations use orthorhombic periodic cell in 3D." << std::endl;
46  dt = std::make_unique<SoaDistanceTableAAOMPTarget<RealType, DIM, PPPO + SOA_OFFSET>>(s);
47  }
48  else
49  {
50  if (s.getLattice().WignerSeitzRadius > s.getLattice().SimulationCellRadius)
51  {
52  o << " Distance computations use general periodic cell in 3D with corner image checks." << std::endl;
53  dt = std::make_unique<SoaDistanceTableAAOMPTarget<RealType, DIM, PPPG + SOA_OFFSET>>(s);
54  }
55  else
56  {
57  o << " Distance computations use general periodic cell in 3D without corner image checks." << std::endl;
58  dt = std::make_unique<SoaDistanceTableAAOMPTarget<RealType, DIM, PPPS + SOA_OFFSET>>(s);
59  }
60  }
61  }
62  else if (sc == SUPERCELL_SLAB)
63  {
64  if (s.getLattice().DiagonalOnly)
65  {
66  o << " Distance computations use orthorhombic code for periodic cell in 2D." << std::endl;
67  dt = std::make_unique<SoaDistanceTableAAOMPTarget<RealType, DIM, PPNO + SOA_OFFSET>>(s);
68  }
69  else
70  {
71  if (s.getLattice().WignerSeitzRadius > s.getLattice().SimulationCellRadius)
72  {
73  o << " Distance computations use general periodic cell in 2D with corner image checks." << std::endl;
74  dt = std::make_unique<SoaDistanceTableAAOMPTarget<RealType, DIM, PPNG + SOA_OFFSET>>(s);
75  }
76  else
77  {
78  o << " Distance computations use general periodic cell in 2D without corner image checks." << std::endl;
79  dt = std::make_unique<SoaDistanceTableAAOMPTarget<RealType, DIM, PPNS + SOA_OFFSET>>(s);
80  }
81  }
82  }
83  else if (sc == SUPERCELL_WIRE)
84  {
85  o << " Distance computations use periodic cell in one dimension." << std::endl;
86  dt = std::make_unique<SoaDistanceTableAAOMPTarget<RealType, DIM, SUPERCELL_WIRE + SOA_OFFSET>>(s);
87  }
88  else //open boundary condition
89  {
90  o << " Distance computations use open boundary conditions in 3D." << std::endl;
91  dt = std::make_unique<SoaDistanceTableAAOMPTarget<RealType, DIM, SUPERCELL_OPEN + SOA_OFFSET>>(s);
92  }
93 
94  description << o.str() << std::endl;
95  return dt;
96 }
#define OHMMS_PRECISION
Definition: config.h:70
#define OHMMS_DIM
Definition: config.h:64
QMCTraits::RealType RealType

◆ createDistanceTableAB()

std::unique_ptr< DistanceTable > createDistanceTableAB ( const ParticleSet s,
ParticleSet t,
std::ostream &  description 
)

free function create a distable table of s-t

Adding AsymmetricDTD to the list, e.g., el-el distance table.

Parameters
ssource/target particle set
Returns
index of the distance table with the name

Definition at line 27 of file createDistanceTableAB.cpp.

References qmcplusplus::ewaldref::DIM, ParticleSet::getLattice(), OhmmsElementBase::getName(), OHMMS_DIM, qmcplusplus::Units::time::s, SUPERCELL_BULK, SUPERCELL_SLAB, and SUPERCELL_WIRE.

Referenced by createDistanceTable().

28 {
30  enum
31  {
32  DIM = OHMMS_DIM
33  };
34  const int sc = t.getLattice().SuperCellEnum;
35  std::unique_ptr<DistanceTable> dt;
36  std::ostringstream o;
37  o << " Distance table for dissimilar particles (A-B):" << std::endl;
38  o << " source: " << s.getName() << " target: " << t.getName() << std::endl;
39  o << " Using structure-of-arrays (SoA) data layout" << std::endl;
40 
41  if (sc == SUPERCELL_BULK)
42  {
43  if (s.getLattice().DiagonalOnly)
44  {
45  o << " Distance computations use orthorhombic periodic cell in 3D." << std::endl;
46  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, PPPO + SOA_OFFSET>>(s, t);
47  }
48  else
49  {
50  if (s.getLattice().WignerSeitzRadius > s.getLattice().SimulationCellRadius)
51  {
52  o << " Distance computations use general periodic cell in 3D with corner image checks." << std::endl;
53  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, PPPG + SOA_OFFSET>>(s, t);
54  }
55  else
56  {
57  o << " Distance computations use general periodic cell in 3D without corner image checks." << std::endl;
58  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, PPPS + SOA_OFFSET>>(s, t);
59  }
60  }
61  }
62  else if (sc == SUPERCELL_SLAB)
63  {
64  if (s.getLattice().DiagonalOnly)
65  {
66  o << " Distance computations use orthorhombic code for periodic cell in 2D." << std::endl;
67  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, PPNO + SOA_OFFSET>>(s, t);
68  }
69  else
70  {
71  if (s.getLattice().WignerSeitzRadius > s.getLattice().SimulationCellRadius)
72  {
73  o << " Distance computations use general periodic cell in 2D with corner image checks." << std::endl;
74  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, PPNG + SOA_OFFSET>>(s, t);
75  }
76  else
77  {
78  o << " Distance computations use general periodic cell in 2D without corner image checks." << std::endl;
79  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, PPNS + SOA_OFFSET>>(s, t);
80  }
81  }
82  }
83  else if (sc == SUPERCELL_WIRE)
84  {
85  o << " Distance computations use periodic cell in one dimension." << std::endl;
86  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, SUPERCELL_WIRE + SOA_OFFSET>>(s, t);
87  }
88  else //open boundary condition
89  {
90  o << " Distance computations use open boundary conditions in 3D." << std::endl;
91  dt = std::make_unique<SoaDistanceTableAB<RealType, DIM, SUPERCELL_OPEN + SOA_OFFSET>>(s, t);
92  }
93 
94  description << o.str() << std::endl;
95  return dt;
96 }
#define OHMMS_DIM
Definition: config.h:64
QMCTraits::RealType RealType

◆ createDistanceTableABOMPTarget()

std::unique_ptr< DistanceTable > createDistanceTableABOMPTarget ( const ParticleSet s,
ParticleSet t,
std::ostream &  description 
)

Adding AsymmetricDTD to the list, e.g., el-el distance table.

Parameters
ssource/target particle set
Returns
index of the distance table with the name

Definition at line 27 of file createDistanceTableABOMPTarget.cpp.

References qmcplusplus::ewaldref::DIM, ParticleSet::getLattice(), OhmmsElementBase::getName(), OHMMS_DIM, qmcplusplus::Units::time::s, SUPERCELL_BULK, SUPERCELL_SLAB, and SUPERCELL_WIRE.

Referenced by createDistanceTable().

30 {
32  enum
33  {
34  DIM = OHMMS_DIM
35  };
36  const int sc = t.getLattice().SuperCellEnum;
37  std::unique_ptr<DistanceTable> dt;
38  std::ostringstream o;
39  o << " Distance table for dissimilar particles (A-B):" << std::endl;
40  o << " source: " << s.getName() << " target: " << t.getName() << std::endl;
41  o << " Using structure-of-arrays (SoA) data layout and OpenMP offload" << std::endl;
42 
43  if (sc == SUPERCELL_BULK)
44  {
45  if (s.getLattice().DiagonalOnly)
46  {
47  o << " Distance computations use orthorhombic periodic cell in 3D." << std::endl;
48  dt = std::make_unique<SoaDistanceTableABOMPTarget<RealType, DIM, PPPO + SOA_OFFSET>>(s, t);
49  }
50  else
51  {
52  if (s.getLattice().WignerSeitzRadius > s.getLattice().SimulationCellRadius)
53  {
54  o << " Distance computations use general periodic cell in 3D with corner image checks." << std::endl;
55  dt = std::make_unique<SoaDistanceTableABOMPTarget<RealType, DIM, PPPG + SOA_OFFSET>>(s, t);
56  }
57  else
58  {
59  o << " Distance computations use general periodic cell in 3D without corner image checks." << std::endl;
60  dt = std::make_unique<SoaDistanceTableABOMPTarget<RealType, DIM, PPPS + SOA_OFFSET>>(s, t);
61  }
62  }
63  }
64  else if (sc == SUPERCELL_SLAB)
65  {
66  if (s.getLattice().DiagonalOnly)
67  {
68  o << " Distance computations use orthorhombic code for periodic cell in 2D." << std::endl;
69  dt = std::make_unique<SoaDistanceTableABOMPTarget<RealType, DIM, PPNO + SOA_OFFSET>>(s, t);
70  }
71  else
72  {
73  if (s.getLattice().WignerSeitzRadius > s.getLattice().SimulationCellRadius)
74  {
75  o << " Distance computations use general periodic cell in 2D with corner image checks." << std::endl;
76  dt = std::make_unique<SoaDistanceTableABOMPTarget<RealType, DIM, PPNG + SOA_OFFSET>>(s, t);
77  }
78  else
79  {
80  o << " Distance computations use general periodic cell in 2D without corner image checks." << std::endl;
81  dt = std::make_unique<SoaDistanceTableABOMPTarget<RealType, DIM, PPNS + SOA_OFFSET>>(s, t);
82  }
83  }
84  }
85  else if (sc == SUPERCELL_WIRE)
86  {
87  o << " Distance computations use periodic cell in one dimension." << std::endl;
88  dt = std::make_unique<SoaDistanceTableABOMPTarget<RealType, DIM, SUPERCELL_WIRE + SOA_OFFSET>>(s, t);
89  }
90  else //open boundary condition
91  {
92  o << " Distance computations use open boundary conditions in 3D." << std::endl;
93  dt = std::make_unique<SoaDistanceTableABOMPTarget<RealType, DIM, SUPERCELL_OPEN + SOA_OFFSET>>(s, t);
94  }
95 
96  description << o.str() << std::endl;
97  return dt;
98 }
#define OHMMS_DIM
Definition: config.h:64
QMCTraits::RealType RealType

◆ createDriftModifier() [1/2]

DriftModifierBase * createDriftModifier ( xmlNodePtr  cur,
const Communicate myComm 
)

create DriftModifier

Definition at line 19 of file DriftModifierBuilder.cpp.

References ParameterSet::add(), Communicate::barrier_and_abort(), and ParameterSet::put().

Referenced by QMCDriver::process(), and QMCDriverNew::QMCDriverNew().

20 {
21  std::string ModifierName("UNR");
22  ParameterSet m_param;
23  m_param.add(ModifierName, "drift_modifier");
24  m_param.put(cur);
25  if (ModifierName != "UNR")
26  myComm->barrier_and_abort("createDriftModifier unknown drift_modifier " + ModifierName);
27  DriftModifierBase* DriftModifier = new DriftModifierUNR;
28  return DriftModifier;
29 }
bool put(std::istream &is) override
read from std::istream
Definition: ParameterSet.h:42
class to handle a set of parameters
Definition: ParameterSet.h:27
void add(PDT &aparam, const std::string &aname_in, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new parameter corresponding to an xmlNode <parameter>
void barrier_and_abort(const std::string &msg) const

◆ createDriftModifier() [2/2]

DriftModifierBase * createDriftModifier ( const std::string &  drift_modifier_str,
QMCTraits::RealType  unr_a 
)

Definition at line 31 of file DriftModifierBuilder.cpp.

References lowerCase().

32 {
33  std::string dm_str(lowerCase(drift_modifier_str));
34  if (dm_str != "unr")
35  throw std::runtime_error("createDriftModifier unknown drift_modifier ");
36  DriftModifierBase* DriftModifier = new DriftModifierUNR(unr_a);
37  return DriftModifier;
38 }
std::string lowerCase(const std::string_view s)
++17

◆ createDynamicCoordinates()

std::unique_ptr< DynamicCoordinates > createDynamicCoordinates ( const DynamicCoordinateKind  kind)

create DynamicCoordinates based on kind

Definition at line 21 of file DynamicCoordinatesBuilder.cpp.

References DC_POS, and DC_POS_OFFLOAD.

22 {
23  if (kind == DynamicCoordinateKind::DC_POS)
24  return std::make_unique<RealSpacePositions>();
25  else if (kind == DynamicCoordinateKind::DC_POS_OFFLOAD)
26  return std::make_unique<RealSpacePositionsOMPTarget>();
27  // dummy return
28  return std::unique_ptr<RealSpacePositions>();
29 }

◆ createElectronParticleSet()

std::unique_ptr< ParticleSet > createElectronParticleSet ( const SimulationCell simulation_cell)

Definition at line 24 of file test_hamiltonian_factory.cpp.

References SpeciesSet::addAttribute(), and SpeciesSet::addSpecies().

Referenced by TEST_CASE().

25 {
26  auto qp = std::make_unique<ParticleSet>(simulation_cell);
27  qp->setName("e");
28  qp->create({2});
29  qp->R[0][0] = 1.0;
30  qp->R[0][1] = 2.0;
31  qp->R[0][2] = 3.0;
32  qp->R[1][0] = 0.0;
33  qp->R[1][1] = 1.1;
34  qp->R[1][2] = 2.2;
35 
36  SpeciesSet& tspecies = qp->getSpeciesSet();
37  int upIdx = tspecies.addSpecies("u");
38  int massIdx = tspecies.addAttribute("mass");
39  tspecies(massIdx, upIdx) = 1.0;
40 
41  return qp;
42 }

◆ createGlobalTimer()

NewTimer & createGlobalTimer ( const std::string &  myname,
timer_levels  mylevel 
)

◆ createSpline4RbyVs_temp()

std::unique_ptr<OneDimCubicSpline<T> > qmcplusplus::createSpline4RbyVs_temp ( const LRHandlerBase aLR,
rcut,
const LinearGrid< T > &  agrid 
)

Definition at line 137 of file LRCoulombSingleton.cpp.

References LRHandlerBase::evaluate(), LinearGrid< T, CT >::makeClone(), and OneDimGridBase< T, CT >::size().

Referenced by LRCoulombSingleton::createSpline4RbyVs().

140 {
141  using func_type = OneDimCubicSpline<T>;
142  const int ng = agrid.size();
143  std::vector<T> v(ng);
144  T r = agrid[0];
145  //check if the first point is not zero
146  v[0] = (r > std::numeric_limits<T>::epsilon()) ? r * aLR->evaluate(r, 1.0 / r) : 0.0;
147  for (int ig = 1; ig < ng - 1; ig++)
148  {
149  r = agrid[ig];
150  v[ig] = r * aLR->evaluate(r, 1.0 / r);
151  }
152  v[0] = 2.0 * v[1] - v[2];
153  v[ng - 1] = 0.0;
154  auto V0 = std::make_unique<func_type>(agrid.makeClone(), v);
155  T deriv = (v[1] - v[0]) / (agrid[1] - agrid[0]);
156  V0->spline(0, deriv, ng - 1, 0.0);
157  return V0;
158 }

◆ createSpline4RbyVsDeriv_temp()

std::unique_ptr<OneDimCubicSpline<T> > qmcplusplus::createSpline4RbyVsDeriv_temp ( const LRHandlerBase aLR,
rcut,
const LinearGrid< T > &  agrid 
)

Definition at line 161 of file LRCoulombSingleton.cpp.

References LRHandlerBase::evaluate(), LinearGrid< T, CT >::makeClone(), OneDimGridBase< T, CT >::size(), and LRHandlerBase::srDf().

Referenced by LRCoulombSingleton::createSpline4RbyVsDeriv().

164 {
165  using func_type = OneDimCubicSpline<T>;
166  int ng = agrid.size();
167  std::vector<T> v(ng);
168  T r = agrid[0];
169  //check if the first point is not zero
170  v[0] = (r > std::numeric_limits<T>::epsilon()) ? r * aLR->evaluate(r, 1.0 / r) : 0.0;
171  T v_val(0.0);
172  T v_deriv(0.0);
173 
174  for (int ig = 1; ig < ng - 1; ig++)
175  {
176  r = agrid[ig];
177  v_val = aLR->evaluate(r, 1.0 / r);
178  v_deriv = aLR->srDf(r, 1 / r);
179 
180  v[ig] = v_val + v_deriv * r;
181  }
182  v[0] = 2.0 * v[1] - v[2];
183  v[ng - 1] = 0.0;
184  auto dV0 = std::make_unique<func_type>(agrid.makeClone(), v);
185  T deriv = (v[1] - v[0]) / (agrid[1] - agrid[0]);
186  dV0->spline(0, deriv, ng - 1, 0.0);
187  return dV0;
188 }

◆ createSYCLInOrderQueueOnDefaultDevice()

sycl::queue createSYCLInOrderQueueOnDefaultDevice ( )

create an in-order queue using the default device

Definition at line 20 of file SYCLruntime.cpp.

References getSYCLDefaultDeviceDefaultQueue(), and queue.

Referenced by DelayedUpdateSYCL< T, T_FP >::DelayedUpdateSYCL().

21 {
22  return sycl::queue(getSYCLDefaultDeviceDefaultQueue().get_context(), getSYCLDefaultDeviceDefaultQueue().get_device(),
23  sycl::property::queue::in_order());
24 }
sycl::queue & getSYCLDefaultDeviceDefaultQueue()
return a reference to the per-device default queue
Definition: SYCLruntime.cpp:18

◆ createSYCLQueueOnDefaultDevice()

sycl::queue createSYCLQueueOnDefaultDevice ( )

create a out-of-order queue using the default device

Definition at line 26 of file SYCLruntime.cpp.

References getSYCLDefaultDeviceDefaultQueue(), and queue.

27 {
28  return sycl::queue(getSYCLDefaultDeviceDefaultQueue().get_context(), getSYCLDefaultDeviceDefaultQueue().get_device());
29 }
sycl::queue & getSYCLDefaultDeviceDefaultQueue()
return a reference to the per-device default queue
Definition: SYCLruntime.cpp:18

◆ createWalkerController()

WalkerControlBase * createWalkerController ( int  nwtot,
Communicate comm,
xmlNodePtr  cur,
bool  reconfig = false 
)

function to create WalkerControlBase or its derived class

Parameters
currentnumber of walkers

set of parameters

Definition at line 28 of file WalkerControlFactory.cpp.

References ParameterSet::add(), app_log(), comm, omp_get_max_threads(), ParameterSet::put(), WalkerControlBase::set_method(), WalkerControlBase::setMinMax(), and Communicate::size().

Referenced by SimpleFixedNodeBranch::initWalkerController(), and SimpleFixedNodeBranch::resetRun().

29 {
30  app_log() << " Creating WalkerController: target number of walkers = " << nwtot << std::endl;
31  ///set of parameters
32  int nmax = 0;
33  std::string reconfigopt("no");
34  ParameterSet m_param;
35  m_param.add(nwtot, "targetWalkers");
36  m_param.add(nwtot, "targetwalkers");
37  m_param.add(nmax, "max_walkers");
38  m_param.add(reconfigopt, "reconfiguration");
39  m_param.put(cur);
40  //if(nmax<0) nmax=2*nideal;
41  //if(nmin<0) nmin=nideal/2;
42  WalkerControlBase* wc = 0;
43  int ncontexts = comm->size();
44  if (reconfigopt != "no" && reconfigopt != "runwhileincorrect")
45  throw std::runtime_error("Reconfiguration is currently broken and gives incorrect results. Use dynamic "
46  "population control by setting reconfiguration=\"no\" or removing the reconfiguration "
47  "option from the DMC input section. If accessing the broken reconfiguration code path "
48  "is still desired, set reconfiguration to \"runwhileincorrect\" instead of \"yes\".");
49  //bool fixw = (reconfig || reconfigopt == "yes" || reconfigopt == "pure");
50  bool fixw = (reconfig || reconfigopt == "runwhileincorrect");
51  if (fixw)
52  {
53  int nwloc = std::max(omp_get_max_threads(), nwtot / ncontexts);
54  nwtot = nwloc * ncontexts;
55  }
56 #if defined(HAVE_MPI)
57  if (ncontexts > 1)
58  {
59  if (fixw)
60  {
61  app_log() << " Using WalkerReconfigurationMPI for population control." << std::endl;
62  wc = new WalkerReconfigurationMPI(comm);
63  }
64  else
65  {
66  app_log() << " Using WalkerControlMPI for dynamic population control." << std::endl;
67  wc = new WalkerControlMPI(comm);
68  }
69  }
70  else
71 #endif
72  {
73  if (fixw)
74  {
75  app_log() << " Using WalkerReconfiguration for population control." << std::endl;
76  wc = new WalkerReconfiguration(comm);
77  }
78  else
79  {
80  app_log() << " Using WalkerControlBase for dynamic population control." << std::endl;
81  wc = new WalkerControlBase(comm);
82  }
83  }
84  wc->set_method(fixw);
85  wc->setMinMax(nwtot, nmax);
86  return wc;
87 }
std::ostream & app_log()
Definition: OutputManager.h:65
int size() const
return the number of tasks
Definition: Communicate.h:118
bool put(std::istream &is) override
read from std::istream
Definition: ParameterSet.h:42
class to handle a set of parameters
Definition: ParameterSet.h:27
omp_int_t omp_get_max_threads()
Definition: OpenMP.h:26
void add(PDT &aparam, const std::string &aname_in, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new parameter corresponding to an xmlNode <parameter>

◆ cross()

TinyVector<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::cross ( const TinyVector< T1, D > &  lhs,
const TinyVector< T2, D > &  rhs 
)
inline

Definition at line 200 of file TinyVector.h.

Referenced by OTCross< TinyVector< T1, 3 >, TinyVector< T2, 3 > >::apply(), and LatticeAnalyzer< T, 3 >::calcSimulationCellRadius().

202 {
203  return OTCross<TinyVector<T1, D>, TinyVector<T2, D>>::apply(lhs, rhs);
204 }

◆ CUDAallocator_device_mem_allocated()

std::atomic<size_t> qmcplusplus::CUDAallocator_device_mem_allocated ( )

◆ cudaErrorCheck() [1/12]

qmcplusplus::cudaErrorCheck ( cudaMemcpyAsync(dev_lu.data(), lu.data(), sizeof(decltype(lu)::value_type) *lu.size(), cudaMemcpyHostToDevice, hstream ,
"cudaMemcpyAsync failed copying log_values to device"   
)

Referenced by qmcplusplus::compute::add_delay_list_save_sigma_VGL_batched(), CUDAManagedAllocator< T >::allocate(), OMPallocator< Value >::allocate(), CUDAAllocator< T_FP >::allocate(), CUDAHostAllocator< T_FP >::allocate(), CUDALockedPageAllocator< T, ULPHA >::allocate(), qmcplusplus::compute::applyW_batched(), qmcplusplus::compute::calcGradients_batched(), qmcplusplus::compute::BLAS::copy_batched(), qmcplusplus::compute::copyAinvRow_saveGL_batched(), CUDAAllocator< T_FP >::copyDeviceToDevice(), CUDAAllocator< T_FP >::copyFromDevice(), CUDAAllocator< T_FP >::copyToDevice(), CUDADeviceManager::CUDADeviceManager(), CUDAfill_n(), CUDAHandles::CUDAHandles(), cuSolverInverter< T_FP >::cuSolverInverter(), CUDAManagedAllocator< T >::deallocate(), OMPallocator< Value >::deallocate(), CUDAAllocator< T_FP >::deallocate(), CUDAHostAllocator< T_FP >::deallocate(), CUDALockedPageAllocator< T, ULPHA >::deallocate(), Queue< PlatformKind::CUDA >::enqueueD2H(), Queue< PlatformKind::CUDA >::enqueueH2D(), qmcplusplus::compute::BLAS::gemv_batched(), qmcplusplus::compute::BLAS::ger_batched(), DelayedUpdateCUDA< T, T_FP >::getInvRow(), DelayedUpdateCUDA< T, T_FP >::initializeInv(), cuSolverInverter< T_FP >::invert_transpose(), rocSolverInverter< T_FP >::invert_transpose(), DiracMatrixComputeCUDA< VALUE_FP >::invert_transpose(), DiracMatrixComputeCUDA< VALUE_FP >::mw_computeInvertAndLog(), DiracMatrixComputeCUDA< VALUE_FP >::mw_computeInvertAndLog_stride(), DiracMatrixComputeCUDA< VALUE_FP >::mw_invertTranspose(), Queue< PlatformKind::CUDA >::Queue(), rocSolverInverter< T_FP >::rocSolverInverter(), ScopedProfiler::ScopedProfiler(), Queue< PlatformKind::CUDA >::sync(), TEST_CASE(), DelayedUpdateCUDA< T, T_FP >::updateInvMat(), CUDAHandles::~CUDAHandles(), cuSolverInverter< T_FP >::~cuSolverInverter(), Queue< PlatformKind::CUDA >::~Queue(), rocSolverInverter< T_FP >::~rocSolverInverter(), and ScopedProfiler::~ScopedProfiler().

◆ cudaErrorCheck() [2/12]

qmcplusplus::cudaErrorCheck ( cudaMemcpyAsync(dev_lu2.data(), lu2.data(), sizeof(decltype(lu2)::value_type) *lu2.size(), cudaMemcpyHostToDevice, hstream ,
"cudaMemcpyAsync failed copying log_values to device"   
)

◆ cudaErrorCheck() [3/12]

qmcplusplus::cudaErrorCheck ( cudaMemcpyAsync(dev_lus.data(), lus.data(), sizeof(decltype(lus)::value_type) *lus.size(), cudaMemcpyHostToDevice, hstream ,
"cudaMemcpyAsync failed copying log_values to device"   
)

◆ cudaErrorCheck() [4/12]

qmcplusplus::cudaErrorCheck ( cudaMemcpyAsync(dev_pivots.data(), pivots.data(), sizeof(int) *pivots.size(), cudaMemcpyHostToDevice, hstream ,
"cudaMemcpyAsync failed copying log_values to device"   
)

◆ cudaErrorCheck() [5/12]

qmcplusplus::cudaErrorCheck ( cudaMemcpyAsync(log_values.data(), dev_log_values.data(), sizeof(std::complex< double >) *2, cudaMemcpyDeviceToHost, hstream ,
"cudaMemcpyAsync failed copying log_values from device"   
)

◆ cudaErrorCheck() [6/12]

cudaErrorCheck ( cudaStreamSynchronize(hstream ,
"cudaStreamSynchronize failed!"   
)

◆ cudaErrorCheck() [7/12]

qmcplusplus::cudaErrorCheck ( cudaMemcpyAsync(devM_vec.data(), M_vec.data(), sizeof(decltype(M_vec)::value_type) *M_vec.size(), cudaMemcpyHostToDevice, hstream ,
"cudaMemcpyAsync failed copying M to device"   
)

◆ cudaErrorCheck() [8/12]

qmcplusplus::cudaErrorCheck ( cudaMemcpyAsync(devM2_vec.data(), M2_vec.data(), sizeof(decltype(M2_vec)::value_type) *M2_vec.size(), cudaMemcpyHostToDevice, hstream ,
"cudaMemcpyAsync failed copying M2 to device"   
)

◆ cudaErrorCheck() [9/12]

qmcplusplus::cudaErrorCheck ( cudaMemcpyAsync(devMs.data(), Ms.data(), sizeof(decltype(Ms)::value_type) *Ms.size(), cudaMemcpyHostToDevice, hstream ,
"cudaMemcpyAsync failed copying Ms to device"   
)

◆ cudaErrorCheck() [10/12]

qmcplusplus::cudaErrorCheck ( cudaMemcpyAsync(M_vec.data(), devM_vec.data(), sizeof(decltype(M_vec)::value_type) *M_vec.size(), cudaMemcpyDeviceToHost, hstream ,
"cudaMemcpyAsync failed copying invM from device"   
)

◆ cudaErrorCheck() [11/12]

qmcplusplus::cudaErrorCheck ( cudaMemcpyAsync(M2_vec.data(), devM2_vec.data(), sizeof(decltype(M2_vec)::value_type) *M2_vec.size(), cudaMemcpyDeviceToHost, hstream ,
"cudaMemcpyAsync failed copying invM from device"   
)

◆ cudaErrorCheck() [12/12]

qmcplusplus::cudaErrorCheck ( cudaMemcpyAsync(pivots.data(), dev_pivots.data(), sizeof(int) *pivots.size(), cudaMemcpyDeviceToHost, hstream ,
"cudaMemcpyAsync failed copying pivots from device"   
)

◆ CUDAfill_n()

void CUDAfill_n ( T *  ptr,
size_t  n,
const T &  value 
)

fill device memory with a given value.

Parameters
ptrpointer to device memory
nsize of type T elemements desired value. Due to cudaMemset limitation. Only filling 0 is supported.

this function is only intended to prevent NaN in containers when device memory segments are allocated. do not use outside allocators.

Definition at line 20 of file CUDAfill.cpp.

References cudaErrorCheck(), cudaMemset, and n.

Referenced by qmc_allocator_traits< qmcplusplus::CUDAAllocator< T > >::fill_n().

21 {
22  if (value != T())
23  throw std::runtime_error("CUDAfill_n doesn't support fill non T() values!");
24  // setting 0 value on each byte should be 0 for int, float and double.
25  cudaErrorCheck(cudaMemset(ptr, 0, n * sizeof(T)), "Memset failed in CUDAfill_n!");
26 }
#define cudaMemset
Definition: cuda2hip.h:144
#define cudaErrorCheck(ans, cause)
Definition: CUDAerror.h:21

◆ CUDAfill_n< double >()

template void CUDAfill_n< double > ( double *  ptr,
size_t  n,
const double &  value 
)

◆ CUDAfill_n< float >()

template void CUDAfill_n< float > ( float *  ptr,
size_t  n,
const float &  value 
)

◆ CUDAfill_n< int >()

template void CUDAfill_n< int > ( int *  ptr,
size_t  n,
const int &  value 
)

◆ CUDAfill_n< size_t >()

template void CUDAfill_n< size_t > ( size_t *  ptr,
size_t  n,
const size_t &  value 
)

◆ CUDAfill_n< std::complex< double > >()

template void CUDAfill_n< std::complex< double > > ( std::complex< double > *  ptr,
size_t  n,
const std::complex< double > &  value 
)

◆ CUDAfill_n< std::complex< float > >()

template void CUDAfill_n< std::complex< float > > ( std::complex< float > *  ptr,
size_t  n,
const std::complex< float > &  value 
)

◆ delete_iter()

◆ derivYlmSpherical()

void qmcplusplus::derivYlmSpherical ( const int  l,
const int  m,
const TinyVector< T, 3 > &  r,
std::complex< T > &  theta_deriv,
std::complex< T > &  phi_deriv,
const bool  conj 
)
inline

calculate the derivative of a Ylm with respect to theta and phi param[in] l: angular momentum param[in] m: magnetic quantum number param[in] r: cartesian position align with [z,x,y].

note: MUST BE UNIT VECTOR to be consistent with Ylm above param[out] theta_deriv: derivative of Ylm with respect to theta param[out] phi_deriv: derivative of Ylm with respect to phi param[in] conj: true if we are taking derivatives of conj(Ylm)

Definition at line 115 of file Ylm.h.

References acos(), atan2(), conj(), cos(), qmcplusplus::Units::distance::m, sin(), sqrt(), tan(), and Ylm().

Referenced by sphericalHarmonicGrad(), and TEST_CASE().

121 {
122  T theta = std::acos(r[0]);
123  T phi = std::atan2(r[2], r[1]);
124  std::complex<T> emiphi = std::complex<T>(std::cos(phi), -std::sin(phi));
125  theta_deriv = static_cast<T>(m) / std::tan(theta) * Ylm(l, m, r);
126  theta_deriv += std::sqrt(static_cast<T>((l - m) * (l + m + 1))) * emiphi * Ylm(l, m + 1, r);
127  phi_deriv = std::complex<T>(0.0, static_cast<T>(m)) * Ylm(l, m, r);
128  if (conj)
129  {
130  theta_deriv = std::conj(theta_deriv);
131  phi_deriv = std::conj(phi_deriv);
132  }
133 }
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnArcCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t acos(const Vector< T1, C1 > &l)
MakeReturn< BinaryNode< FnArcTan2, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t atan2(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
std::complex< double > Ylm(int l, int m, const std::vector< double > &sph)
MakeReturn< UnaryNode< FnTan, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t tan(const Vector< T1, C1 > &l)
float conj(const float &c)
Workaround to allow conj on scalar to return real instead of complex.
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ det() [1/4]

Tensor<T, D>::Type_t qmcplusplus::det ( const Tensor< T, D > &  a)
inline

Definition at line 838 of file TensorOps.h.

Referenced by DiracDeterminant< DU_TYPE >::acquireResource(), MultiDiracDeterminant::acquireResource(), DiracDeterminantBatched< PL, VT, FPVT >::acquireResource(), EinsplineSetBuilder::AnalyzeTwists2(), SlaterDetBuilder::buildComponent(), WaveFunctionTester::checkGradientAtConfiguration(), MultiSlaterDetTableMethod::createResource(), MultiSlaterDetTableMethod::evaluateMultiDiracDeterminantDerivatives(), MultiSlaterDetTableMethod::evaluateMultiDiracDeterminantDerivativesWF(), qmcplusplus::ewaldref::ewaldSum(), ExpFitClass< M >::Fit(), ExpFitClass< M >::FitCusp(), EshdfFile::getPtvs(), SpaceGrid::initialize_rectilinear(), inverse(), SlaterDetWithBackflow::isOptimizable(), SlaterDet::isOptimizable(), qmcplusplus::ewaldref::madelungSum(), SlaterDetWithBackflow::makeClone(), MultiSlaterDetTableMethod::makeClone(), SlaterDet::makeClone(), MultiSlaterDetTableMethod::mw_accept_rejectMove(), DiracDeterminantBatched< PL, VT, FPVT >::mw_accept_rejectMove(), DiracDeterminantBatched< PL, VT, FPVT >::mw_calcRatio(), MultiSlaterDetTableMethod::mw_calcRatio(), DiracDeterminantBatched< PL, VT, FPVT >::mw_completeUpdates(), DiracDeterminantBatched< PL, VT, FPVT >::mw_evalGrad(), MultiSlaterDetTableMethod::mw_evalGrad_impl(), DiracDeterminantBatched< PL, VT, FPVT >::mw_evalGradWithSpin(), MultiDiracDeterminant::mw_evaluateDetsAndGradsForPtclMove(), MultiDiracDeterminant::mw_evaluateDetsForPtclMove(), DiracDeterminantBatched< PL, VT, FPVT >::mw_evaluateGL(), MultiDiracDeterminant::mw_evaluateGrads(), DiracDeterminantBatched< PL, VT, FPVT >::mw_evaluateLog(), DiracDeterminant< DU_TYPE >::mw_evaluateRatios(), DiracDeterminantBatched< PL, VT, FPVT >::mw_evaluateRatios(), DiracDeterminantBatched< PL, VT, FPVT >::mw_invertPsiM(), MultiSlaterDetTableMethod::mw_prepareGroup(), DiracDeterminant< DU_TYPE >::mw_ratioGrad(), MultiSlaterDetTableMethod::mw_ratioGrad(), DiracDeterminantBatched< PL, VT, FPVT >::mw_ratioGrad(), DiracDeterminantBatched< PL, VT, FPVT >::mw_ratioGradWithSpin(), DiracDeterminantBatched< PL, VT, FPVT >::mw_recompute(), EinsplineSetBuilder::ReadOrbitalInfo_ESHDF(), DiracDeterminant< DU_TYPE >::releaseResource(), DiracDeterminantBatched< PL, VT, FPVT >::releaseResource(), CrystalLattice< ST, 3 >::reset(), NESpaceGrid< REAL >::someMoreAxisGridStuff(), and TWF().

839 {
840  // to implement the general case here
841  return 0;
842 }

◆ det() [2/4]

Tensor<T, 1>::Type_t qmcplusplus::det ( const Tensor< T, 1 > &  a)
inline

Definition at line 848 of file TensorOps.h.

849 {
850  return a(0, 0);
851 }

◆ det() [3/4]

Tensor<T, 2>::Type_t qmcplusplus::det ( const Tensor< T, 2 > &  a)
inline

Definition at line 857 of file TensorOps.h.

858 {
859  return a(0, 0) * a(1, 1) - a(0, 1) * a(1, 0);
860 }

◆ det() [4/4]

Tensor<T, 3>::Type_t qmcplusplus::det ( const Tensor< T, 3 > &  a)
inline

Definition at line 866 of file TensorOps.h.

867 {
868  return a(0, 0) * (a(1, 1) * a(2, 2) - a(1, 2) * a(2, 1)) + a(0, 1) * (a(1, 2) * a(2, 0) - a(1, 0) * a(2, 2)) +
869  a(0, 2) * (a(1, 0) * a(2, 1) - a(1, 1) * a(2, 0));
870 }

◆ det_col_update()

void qmcplusplus::det_col_update ( T *restrict  pinv,
const T *restrict  tv,
int  m,
int  colchanged,
c_ratio,
T *restrict  temp,
T *restrict  rcopy 
)
inline

Definition at line 89 of file determinant_operators.h.

References BLAS::cone, BLAS::copy(), BLAS::gemv(), BLAS::ger(), and qmcplusplus::Units::distance::m.

Referenced by InverseUpdateByColumn().

96 {
97  const T cone(1);
98  c_ratio = cone / c_ratio;
99  BLAS::gemv('N', m, m, c_ratio, pinv, m, tv, 1, T(), temp, 1);
100  temp[colchanged] = cone - c_ratio;
101  BLAS::copy(m, pinv + colchanged, m, rcopy, 1);
102  BLAS::ger(m, m, -1.0, temp, 1, rcopy, 1, pinv, m);
103 }
constexpr std::complex< float > cone
Definition: BLAS.hpp:50
static void gemv(int n, int m, const double *restrict amat, const double *restrict x, double *restrict y)
Definition: BLAS.hpp:118
static void ger(int m, int n, double alpha, const double *x, int incx, const double *y, int incy, double *a, int lda)
Definition: BLAS.hpp:437
static void copy(int n, const T *restrict a, T *restrict b)
Definition: BLAS.hpp:381

◆ det_row_update()

void qmcplusplus::det_row_update ( T *restrict  pinv,
const T *restrict  tv,
int  m,
int  rowchanged,
c_ratio,
T *restrict  temp,
T *restrict  rcopy 
)
inline

Definition at line 72 of file determinant_operators.h.

References BLAS::gemv(), BLAS::ger(), and qmcplusplus::Units::distance::m.

Referenced by InverseUpdateByRow().

79 {
80  //const T ratio_inv(1.0/c_ratio);
81  c_ratio = T(1) / c_ratio;
82  BLAS::gemv('T', m, m, c_ratio, pinv, m, tv, 1, const_traits<T>::zero(), temp, 1);
83  temp[rowchanged] = const_traits<T>::one() - c_ratio;
84  memcpy(rcopy, pinv + m * rowchanged, m * sizeof(T));
85  BLAS::ger(m, m, const_traits<T>::minus_one(), rcopy, 1, temp, 1, pinv, m);
86 }
static void gemv(int n, int m, const double *restrict amat, const double *restrict x, double *restrict y)
Definition: BLAS.hpp:118
static void ger(int m, int n, double alpha, const double *x, int incx, const double *y, int incy, double *a, int lda)
Definition: BLAS.hpp:437

◆ Determinant()

T qmcplusplus::Determinant ( T *restrict  x,
int  n,
int  m,
int *restrict  pivot 
)
inline

determinant of a matrix

Parameters
xstarting address of an n-by-m matrix
nrows
mcols
pivotinteger pivot array
Returns
determinant

Definition at line 141 of file DeterminantOperators.h.

References LUFactorization(), qmcplusplus::Units::distance::m, and n.

Referenced by SmallMatrixDetCalculator< ValueType >::evaluate().

142 {
143  T detvalue(1.0);
144  LUFactorization(n, m, x, n, pivot);
145  for (int i = 0, ip = 1; i < m; i++, ip++)
146  {
147  if (pivot[i] == ip)
148  detvalue *= x[i * m + i];
149  else
150  detvalue *= -x[i * m + i];
151  }
152  return detvalue;
153 }
void LUFactorization(int n, int m, std::complex< float > *restrict a, int n0, int *restrict piv)
LU factorization of complex<float>

◆ determineDefaultDeviceNum()

int qmcplusplus::determineDefaultDeviceNum ( int  num_devices,
int  rank_id,
int  num_ranks 
)
inline

distribute MPI ranks among devices

the amount of MPI ranks for each device differs by 1 at maximum. larger id has more MPI ranks.

Definition at line 24 of file determineDefaultDeviceNum.h.

References num_ranks.

Referenced by CUDADeviceManager::CUDADeviceManager(), OMPDeviceManager::OMPDeviceManager(), and SYCLDeviceManager::SYCLDeviceManager().

25 {
26  if (num_ranks < num_devices)
27  num_devices = num_ranks;
28  // ranks are equally distributed among devices
29  int min_ranks_per_device = num_ranks / num_devices;
30  int residual = num_ranks % num_devices;
31  int assigned_device_id;
32  if (rank_id < min_ranks_per_device * (num_devices - residual))
33  assigned_device_id = rank_id / min_ranks_per_device;
34  else
35  assigned_device_id = (rank_id + num_devices - residual) / (min_ranks_per_device + 1);
36  return assigned_device_id;
37 }

◆ DetRatioByColumn()

MatA::value_type qmcplusplus::DetRatioByColumn ( const MatA &  Minv,
const VecB &  newv,
int  colchanged 
)
inline

determinant ratio with a column substitution

Parameters
Minvinverse matrix
newvcolumn vector
colchangedcolumn index to be replaced
Returns
$ M^{new}/M$

Definition at line 232 of file DeterminantOperators.h.

References qmcplusplus::simd::dot().

Referenced by MultiDiracDeterminant::evaluateDetsAndGradsForPtclMove(), MultiDiracDeterminant::evaluateDetsAndGradsForPtclMoveWithSpin(), MultiDiracDeterminant::evaluateDetsForPtclMove(), AGPDeterminant::ratio(), and AGPDeterminant::ratioDown().

233 {
234  //use BLAS dot since the stride is not uniform
235  return simd::dot(Minv.cols(), Minv.data() + colchanged, Minv.cols(), newv.data(), 1);
236 }
T dot(T *a, T *b)

◆ DetRatioByRow()

MatA::value_type qmcplusplus::DetRatioByRow ( const MatA &  Minv,
const VecB &  newv,
int  rowchanged 
)
inline

determinant ratio with a row substitution

Parameters
Minvinverse matrix
newvrow vector
rowchangedrow index to be replaced
Returns
$ M^{new}/M$

Definition at line 219 of file DeterminantOperators.h.

References qmcplusplus::simd::dot().

Referenced by AGPDeterminant::ratio(), and AGPDeterminant::ratioUp().

220 {
221  return simd::dot(Minv[rowchanged], newv.data(), Minv.cols());
222  //return BLAS::dot(Minv.cols(),Minv[rowchanged],newv.data());
223 }
T dot(T *a, T *b)

◆ dev_infos()

std::vector<int, CUDAAllocator<int> > qmcplusplus::dev_infos ( pivots.  size())

Referenced by TEST_CASE().

◆ dev_log_values()

std::vector<StdComp, CUDAAllocator<StdComp> > qmcplusplus::dev_log_values ( batch_size  )

Referenced by TEST_CASE().

◆ dev_lu()

std::vector<StdComp, CUDAHostAllocator<StdComp> > qmcplusplus::dev_lu ( lu.  size())

Referenced by TEST_CASE().

◆ dev_lu2()

std::vector<StdComp, CUDAHostAllocator<StdComp> > qmcplusplus::dev_lu2 ( lu2.  size())

◆ dev_lus()

std::vector<StdComp*, CUDAAllocator<StdComp*> > qmcplusplus::dev_lus ( batch_size  )

Referenced by TEST_CASE().

◆ dev_pivots()

std::vector< int, CUDAAllocator< int > > dev_pivots ( pivots.  size())

Referenced by TEST_CASE().

◆ devM2_vec()

std::vector<double, CUDAAllocator<double> > qmcplusplus::devM2_vec ( M2_vec.  size())

◆ devM_vec()

std::vector<double, CUDAAllocator<double> > qmcplusplus::devM_vec ( M_vec.  size())

Referenced by TEST_CASE().

◆ devMs()

std::vector<double*, CUDAAllocator<double*> > qmcplusplus::devMs ( Ms.  size())

Referenced by TEST_CASE().

◆ dlaplacian() [1/2]

T qmcplusplus::dlaplacian ( const TinyVector< T, D > &  g,
const T  l,
const TinyVector< T, D > &  gg,
const T  gl,
const T  ideriv 
)
inline

Convenience function to compute $\Re( \nabla^2_i \partial \Psi_T/\Psi_T)$.

Parameters
gOHMMS_DIM dimensional vector for $\nabla_i \ln \Psi_T$ .
lA number, representing $\nabla^2_i \ln \Psi_T$ .
ggOHMMS_DIM dimensional vector containing $\nabla_i \partial \ln \Psi_T$ .
glA number, representing $\nabla^2_i \partial \ln \Psi_T$
iderivA number, representing $\partial \ln \Psi_T$
Returns
A number corresponding to $\Re( \nabla^2_i \partial \Psi_T/\Psi_T)$

Definition at line 51 of file BareKineticHelper.h.

References dot().

Referenced by BareKineticEnergy::evaluateWithIonDerivs().

52 {
53  return gl + l * ideriv + 2.0 * dot(g, gg) + dot(g, g) * ideriv;
54 }
T dot(T *a, T *b)

◆ dlaplacian() [2/2]

T qmcplusplus::dlaplacian ( const TinyVector< std::complex< T >, D > &  g,
const std::complex< T >  l,
const TinyVector< std::complex< T >, D > &  gg,
const std::complex< T >  gl,
const std::complex< T >  ideriv 
)
inline

Definition at line 57 of file BareKineticHelper.h.

References OTCDot< T1, T2, D >::apply().

62 {
63  std::complex<T> l_times_ideriv = l * ideriv;
64  TinyVector<std::complex<T>, D> g_times_ideriv = g * ideriv;
65 
66  return gl.real() + l_times_ideriv.real() + 2.0 * OTCDot<T, T, D>::apply(g, gg) +
67  OTCDot<T, T, D>::apply(g, g_times_ideriv);
68 }

◆ DMCBatched::advanceWalkers< CoordsType::POS >()

template void qmcplusplus::DMCBatched::advanceWalkers< CoordsType::POS > ( const StateForThread &  sft,
Crowd crowd,
DriverTimers &  timers,
DMCTimers dmc_timers,
ContextForSteps step_context,
bool  recompute,
bool  accumulate_this_step 
)

◆ DMCBatched::advanceWalkers< CoordsType::POS_SPIN >()

template void qmcplusplus::DMCBatched::advanceWalkers< CoordsType::POS_SPIN > ( const StateForThread &  sft,
Crowd crowd,
DriverTimers &  timers,
DMCTimers dmc_timers,
ContextForSteps step_context,
bool  recompute,
bool  accumulate_this_step 
)

◆ doSOECPotentialTest()

void qmcplusplus::doSOECPotentialTest ( bool  use_VPs)

Definition at line 75 of file test_SOECPotential.cpp.

References SpeciesSet::addAttribute(), SOECPotential::addComponent(), TrialWaveFunction::addComponent(), SpeciesSet::addSpecies(), TestSOECPotential::addVPs(), Matrix< T, Alloc >::begin(), RadialJastrowBuilder::buildComponent(), CHECK(), Matrix< T, Alloc >::cols(), OHMMS::Controller, TestSOECPotential::copyGridUnrotatedForTest(), ParticleSet::create(), SOECPotential::createResource(), TrialWaveFunction::createResource(), ParticleSet::createSK(), TestSOECPotential::didGridChange(), doc, TestSOECPotential::evalFast(), qmcplusplus::testing::getParticularListener(), Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), ParticleSet::getTotalNum(), lattice, SOECPotential::makeClone(), TrialWaveFunction::makeClone(), TestSOECPotential::mw_evaluateImpl(), TrialWaveFunction::mw_evaluateLog(), ParticleSet::mw_update(), qmcplusplus::hdf::num_walkers, okay, OMPTARGET, Libxml2Document::parseFromString(), ECPComponentBuilder::pp_so, ParticleSet::R, ECPComponentBuilder::read_pp_file(), REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), SOECPotential::setRandomGenerator(), ParticleSet::setSpinor(), ParticleSet::spins, and ParticleSet::update().

Referenced by TEST_CASE().

76 {
77  using Real = QMCTraits::RealType;
79  using Value = QMCTraits::ValueType;
80  using Pos = QMCTraits::PosType;
82 
84 
85  //Cell definition:
86 
87  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
88  lattice.BoxBConds = false; // periodic
89  lattice.R.diagonal(20);
90  lattice.LR_dim_cutoff = 15;
91  lattice.reset();
92 
93  const SimulationCell simulation_cell(lattice);
94  auto ions_uptr = std::make_unique<ParticleSet>(simulation_cell);
95  auto elec_uptr = std::make_unique<ParticleSet>(simulation_cell);
96  ParticleSet& ions(*ions_uptr);
97  ParticleSet& elec(*elec_uptr);
98  ions.setName("ion0");
99  ions.create({1});
100  ions.R[0] = {0.0, 0.0, 0.0};
101 
102  SpeciesSet& ion_species = ions.getSpeciesSet();
103  int pIdx = ion_species.addSpecies("H");
104  int pChargeIdx = ion_species.addAttribute("charge");
105  int iatnumber = ion_species.addAttribute("atomic_number");
106  ion_species(pChargeIdx, pIdx) = 0;
107  ion_species(iatnumber, pIdx) = 1;
108  ions.createSK();
109 
110  elec.setName("e");
111  elec.setSpinor(true);
112  elec.create({2});
113  elec.R[0] = {0.138, -0.24, 0.216};
114  elec.R[1] = {-0.216, 0.24, -0.138};
115  elec.spins = {0.2, 0.51};
116 
117  SpeciesSet& tspecies = elec.getSpeciesSet();
118  int upIdx = tspecies.addSpecies("u");
119  int chargeIdx = tspecies.addAttribute("charge");
120  int massIdx = tspecies.addAttribute("mass");
121  tspecies(chargeIdx, upIdx) = -1;
122  tspecies(massIdx, upIdx) = 1.0;
123 
124  elec.createSK();
125 
126  ions.resetGroups();
127  elec.resetGroups();
128 
129  ParticleSet elec2(elec);
130  elec2.update();
131 
132  RefVector<ParticleSet> ptcls{elec, elec2};
133  RefVectorWithLeader<ParticleSet> p_list(elec, ptcls);
134  ResourceCollection pset_res("test_pset_res");
135  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
136 
137  RuntimeOptions runtime_options;
138  TrialWaveFunction psi(runtime_options);
139 
140  std::vector<Pos> kup, kdn;
141  std::vector<Real> k2up, k2dn;
142  QMCTraits::IndexType nelec = elec.getTotalNum();
143  REQUIRE(nelec == 2);
144 
145  kup.resize(nelec);
146  kup[0] = Pos(1, 1, 1);
147  kup[1] = Pos(2, 2, 2);
148 
149  kdn.resize(nelec);
150  kdn[0] = Pos(2, 2, 2);
151  kdn[1] = Pos(1, 1, 1);
152 
153  auto spo_up = std::make_unique<FreeOrbital>("free_orb_up", kup);
154  auto spo_dn = std::make_unique<FreeOrbital>("free_orb_dn", kdn);
155 
156  auto spinor_set = std::make_unique<SpinorSet>("free_orb_spinor");
157  spinor_set->set_spos(std::move(spo_up), std::move(spo_dn));
158  QMCTraits::IndexType norb = spinor_set->getOrbitalSetSize();
159  REQUIRE(norb == 2);
160 
161  auto dd = std::make_unique<DiracDeterminantBatched<PlatformKind::OMPTARGET, QMCTraits::ValueType,
162  QMCTraits::QTFull::ValueType>>(std::move(spinor_set), 0, nelec);
163  std::vector<std::unique_ptr<DiracDeterminantBase>> dirac_dets;
164  dirac_dets.push_back(std::move(dd));
165  auto sd = std::make_unique<SlaterDet>(elec, std::move(dirac_dets));
166  psi.addComponent(std::move(sd));
167 
168  //Add the two body jastrow, parameters from test_J2_bspline
169  //adding jastrow will allow for adding WF parameter derivatives since FreeOrbital doesn't
170  //support that
171  const char* particles = R"(<tmp>
172  <jastrow name="J2" type="Two-Body" function="Bspline" print="yes" gpu="no">
173  <correlation speciesA="u" speciesB="u" rcut="5" size="5">
174  <coefficients id="uu" type="Array"> 0.02904699284 -0.1004179 -0.1752703883 -0.2232576505 -0.2728029201</coefficients>
175  </correlation>
176  </jastrow>
177  </tmp>
178  )";
180  bool okay = doc.parseFromString(particles);
181  REQUIRE(okay);
182  xmlNodePtr root = doc.getRoot();
183  xmlNodePtr jas2 = xmlFirstElementChild(root);
184  RadialJastrowBuilder jastrow(c, elec);
185  psi.addComponent(jastrow.buildComponent(jas2));
186 
187  std::unique_ptr<TrialWaveFunction> psi_clone = psi.makeClone(elec2);
188  RefVectorWithLeader<TrialWaveFunction> twf_list(psi, {psi, *psi_clone});
189  ResourceCollection twf_res("test_twf_res");
190  psi.createResource(twf_res);
191  ResourceCollectionTeamLock<TrialWaveFunction> mw_twf_lock(twf_res, twf_list);
192 
193  //Now we set up the SO ECP component.
194  SOECPotential so_ecp(ions, elec, psi, false);
195  ECPComponentBuilder ecp_comp_builder("test_read_soecp", c);
196  okay = ecp_comp_builder.read_pp_file("so_ecp_test.xml");
197  REQUIRE(okay);
198  UPtr<SOECPComponent> so_ecp_comp = std::move(ecp_comp_builder.pp_so);
199  so_ecp.addComponent(0, std::move(so_ecp_comp));
200  UPtr<OperatorBase> so_ecp2_ptr = so_ecp.makeClone(elec2, *psi_clone);
201  auto& so_ecp2 = dynamic_cast<SOECPotential&>(*so_ecp2_ptr);
202 
203  StdRandom<FullPrecReal> rng(10101);
204  StdRandom<FullPrecReal> rng2(10201);
205  so_ecp.setRandomGenerator(&rng);
206  so_ecp2.setRandomGenerator(&rng2);
207 
208  RefVector<OperatorBase> so_ecps{so_ecp, so_ecp2};
209  RefVectorWithLeader<OperatorBase> o_list(so_ecp, so_ecps);
210  if (use_VPs)
211  testing::TestSOECPotential::addVPs(o_list, p_list);
212  ResourceCollection so_ecp_res("test_so_ecp_res");
213  so_ecp.createResource(so_ecp_res);
214  ResourceCollectionTeamLock<OperatorBase> so_ecp_lock(so_ecp_res, o_list);
215 
218 
219  CHECK(!testing::TestSOECPotential::didGridChange(so_ecp));
220  CHECK(!testing::TestSOECPotential::didGridChange(so_ecp2));
221 
222  int num_walkers = 2;
223  int max_values = 10;
224  Matrix<Real> local_pots(num_walkers, max_values);
225  Matrix<Real> local_pots2(num_walkers, max_values);
226  std::vector<ListenerVector<Real>> listeners;
227  listeners.emplace_back("sopotential", getParticularListener(local_pots));
228  listeners.emplace_back("sopotential", getParticularListener(local_pots2));
229 
230  Matrix<Real> ion_pots(num_walkers, max_values);
231  Matrix<Real> ion_pots2(num_walkers, max_values);
232  std::vector<ListenerVector<Real>> ion_listeners;
233  ion_listeners.emplace_back("sopotential", getParticularListener(ion_pots));
234  ion_listeners.emplace_back("sopotential", getParticularListener(ion_pots2));
235 
236  ParticleSet::mw_update(p_list);
237  TrialWaveFunction::mw_evaluateLog(twf_list, p_list);
238 
239  ListenerOption<Real> listener_opt{listeners, ion_listeners};
240  testing::TestSOECPotential::mw_evaluateImpl(so_ecp, o_list, twf_list, p_list, listener_opt, true);
241 
242  //use single walker API to get reference value
243  auto value = o_list[0].evaluateDeterministic(p_list[0]);
244 
245  //also check whether or not reference value from single_walker API is actually correct
246  //this value comes directly from the reference code soecp_eval_reference.cpp
247  CHECK(value == Approx(-3.530511241));
248 
249  CHECK(std::accumulate(local_pots.begin(), local_pots.begin() + local_pots.cols(), 0.0) == Approx(value));
250  CHECK(std::accumulate(local_pots2.begin(), local_pots2.begin() + local_pots2.cols(), 0.0) == Approx(value));
251  CHECK(std::accumulate(ion_pots.begin(), ion_pots.begin() + ion_pots.cols(), 0.0) == Approx(value));
252  CHECK(std::accumulate(ion_pots2.begin(), ion_pots2.begin() + ion_pots2.cols(), 0.0) == Approx(value));
253 
254  //Now lets try out the fast implementation
255  if (use_VPs)
256  {
257  value = 0.0;
258  SOECPotential so_ecp_exact(ions, elec, psi, true);
259  //srule is 0 for exact evaluation
260  ECPComponentBuilder ecp_comp_builder("test_read_soecp", c, -1, -1, 0);
261  okay = ecp_comp_builder.read_pp_file("so_ecp_test.xml");
262  REQUIRE(okay);
263  UPtr<SOECPComponent> so_ecp_comp = std::move(ecp_comp_builder.pp_so);
264  so_ecp_exact.addComponent(0, std::move(so_ecp_comp));
265  testing::TestSOECPotential::evalFast(so_ecp_exact, elec, value);
266  CHECK(value == Approx(-3.530511241));
267  }
268 
269  CHECK(!testing::TestSOECPotential::didGridChange(so_ecp));
270  CHECK(!testing::TestSOECPotential::didGridChange(so_ecp2));
271 
272  elec.R[0] = {0.05, 0.0, -0.05};
273  elec.update();
274  testing::TestSOECPotential::mw_evaluateImpl(so_ecp, o_list, twf_list, p_list, listener_opt, true);
275 
276  CHECK(!testing::TestSOECPotential::didGridChange(so_ecp));
277  CHECK(!testing::TestSOECPotential::didGridChange(so_ecp2));
278  auto value2 = o_list[0].evaluateDeterministic(elec);
279 
280  CHECK(std::accumulate(local_pots.begin(), local_pots.begin() + local_pots.cols(), 0.0) == Approx(value2));
281  // check the second walker which will be unchanged.
282  CHECK(std::accumulate(local_pots2[1], local_pots2[1] + local_pots2.cols(), 0.0) == Approx(value));
283 }
HamiltonianRef::FullPrecRealType FullPrecRealType
class that handles xmlDoc
Definition: Libxml2Doc.h:76
const char num_walkers[]
Definition: HDFVersion.h:37
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
ForceBase::Real Real
Definition: ForceBase.cpp:26
QMCTraits::IndexType IndexType
Definition: FSUtilities.h:11
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
auto getParticularListener(Matrix< T > &local_pots)
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType
DMCRefEnergy::FullPrecReal FullPrecReal
void copyGridUnrotatedForTest(NonLocalECPComponent &nlpp)
Definition: test_ecp.cpp:153

◆ Dot() [1/2]

◆ Dot() [2/2]

T qmcplusplus::Dot ( const ParticleAttrib< TinyVector< std::complex< T >, D >> &  pa,
const ParticleAttrib< TinyVector< std::complex< T >, D >> &  pb 
)
inline

Definition at line 133 of file ParticleAttribOps.h.

References OTCDot< T1, T2, D >::apply().

135 {
136  T sum = 0;
137  for (int i = 0; i < pa.size(); i++)
138  {
139  sum += OTCDot<T, T, D>::apply(pa[i], pb[i]);
140  }
141  return sum;
142 }

◆ dot() [1/16]

BinaryReturn<T1, T2, OpMultiply>::Type_t qmcplusplus::dot ( const TinyVector< T1, D > &  lhs,
const TinyVector< T2, D > &  rhs 
)
inline

Definition at line 190 of file TinyVector.h.

191 {
192  return OTDot<TinyVector<T1, D>, TinyVector<T2, D>>::apply(lhs, rhs);
193 }

◆ dot() [2/16]

Tensor<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const SymTensor< T1, D > &  lhs,
const SymTensor< T2, D > &  rhs 
)
inline

Definition at line 388 of file SymTensor.h.

390 {
391  return OTDot<SymTensor<T1, D>, SymTensor<T2, D>>::apply(lhs, rhs);
392 }

◆ dot() [3/16]

Tensor<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const SymTensor< T1, D > &  lhs,
const Tensor< T2, D > &  rhs 
)
inline

Definition at line 395 of file SymTensor.h.

397 {
398  return OTDot<SymTensor<T1, D>, Tensor<T2, D>>::apply(lhs, rhs);
399 }

◆ dot() [4/16]

Tensor<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const Tensor< T1, D > &  lhs,
const SymTensor< T2, D > &  rhs 
)
inline

Definition at line 402 of file SymTensor.h.

404 {
405  return OTDot<Tensor<T1, D>, SymTensor<T2, D>>::apply(lhs, rhs);
406 }

◆ dot() [5/16]

TinyVector<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const TinyVector< T1, D > &  lhs,
const SymTensor< T2, D > &  rhs 
)
inline

Definition at line 409 of file SymTensor.h.

411 {
412  return OTDot<TinyVector<T1, D>, SymTensor<T2, D>>::apply(lhs, rhs);
413 }

◆ dot() [6/16]

Tensor<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const Tensor< T1, D > &  lhs,
const Tensor< T2, D > &  rhs 
)
inline

Binary Operators.

Tensor-Tensor dot product $result(i,j)=\sum_k lhs(i,k)*rhs(k,j)$

Parameters
lhsa tensor
rhsa tensor

Definition at line 414 of file Tensor.h.

416 {
417  return OTDot<Tensor<T1, D>, Tensor<T2, D>>::apply(lhs, rhs);
418 }

◆ dot() [7/16]

TinyVector<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const SymTensor< T1, D > &  lhs,
const TinyVector< T2, D > &  rhs 
)
inline

Definition at line 416 of file SymTensor.h.

418 {
419  return OTDot<SymTensor<T1, D>, TinyVector<T2, D>>::apply(lhs, rhs);
420 }

◆ dot() [8/16]

TinyVector<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const TinyVector< T1, D > &  lhs,
const Tensor< T2, D > &  rhs 
)
inline

Vector-Tensor dot product $result(i)=\sum_k lhs(k)*rhs(k,i)$.

Parameters
lhsa vector
rhsa tensor

Definition at line 425 of file Tensor.h.

427 {
428  return OTDot<TinyVector<T1, D>, Tensor<T2, D>>::apply(lhs, rhs);
429 }

◆ dot() [9/16]

TinyVector<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const Tensor< T1, D > &  lhs,
const TinyVector< T2, D > &  rhs 
)
inline

Tensor-Vector dot product $result(i)=\sum_k lhs(i,k)*rhs(k)$.

Parameters
lhsa tensor
rhsa vector

Definition at line 436 of file Tensor.h.

438 {
439  return OTDot<Tensor<T1, D>, TinyVector<T2, D>>::apply(lhs, rhs);
440 }

◆ dot() [10/16]

Tensor<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const AntiSymTensor< T1, D > &  lhs,
const AntiSymTensor< T2, D > &  rhs 
)
inline

Definition at line 520 of file AntiSymTensor.h.

Referenced by MomentumDistribution::accumulate(), NESpaceGrid< REAL >::accumulate(), SODMCUpdatePbyPWithRejectionFast::advanceWalker(), DMCUpdatePbyPWithRejectionFast::advanceWalker(), SOVMCUpdatePbyP::advanceWalker(), VMCUpdatePbyP::advanceWalker(), DMCUpdatePbyPL2::advanceWalker(), DMCBatched::advanceWalkers(), RMCUpdatePbyPWithDrift::advanceWalkersRMC(), RMCUpdatePbyPWithDrift::advanceWalkersVMC(), EinsplineSetBuilder::AnalyzeTwists2(), DTD_BConds< T, 3, PPPO >::apply_bc(), DTD_BConds< T, D, SC >::apply_bc(), DTD_BConds< T, 3, PPPG >::apply_bc(), DTD_BConds< T, 2, PPPO >::apply_bc(), DTD_BConds< T, 2, SUPERCELL_WIRE >::apply_bc(), DTD_BConds< T, 3, PPNG >::apply_bc(), DTD_BConds< T, 3, PPNO >::apply_bc(), DTD_BConds< T, 3, SUPERCELL_WIRE >::apply_bc(), CrystalLattice< ST, 3 >::applyMinimumImage(), KContainer::BuildKLists(), LatticeAnalyzer< T, 3 >::calcSimulationCellRadius(), LatticeAnalyzer< T, 2 >::calcSimulationCellRadius(), LatticeAnalyzer< T, 3 >::calcSolidAngles(), LatticeAnalyzer< T, 2 >::calcSolidAngles(), SpinDensityInput::calculateDerivedParameters(), MagnetizationDensityInput::calculateDerivedParameters(), NonLocalECPComponent::calculateProjector(), LatticeAnalyzer< T, 3 >::calcWignerSeitzRadius(), LatticeAnalyzer< T, 2 >::calcWignerSeitzRadius(), SpaceGrid::check_grid(), NESpaceGrid< REAL >::check_grid(), BsplineReader::check_twists(), DiracDeterminantBase::checkG(), QMCUpdateBase::checkLogAndGL(), QMCDriverNew::checkLogAndGL(), NaNguard::checkOneParticleGradients(), DiracDeterminantBatched< PL, VT, FPVT >::computeGL(), QMCDriverNew::computeLogGreensFunction(), StructFact::computeRhok(), kSpaceJastrow::copyFromBuffer(), SplineR2R< ST >::create_spline(), CountingGaussian::d_to_b(), dlaplacian(), Dot(), CrystalLattice< ST, 3 >::Dot(), double_test_case(), DiracDeterminantWithBackflow::dummyEvalLi(), kSpaceJastrow::Equivalent(), DiracDeterminantWithBackflow::evalGrad(), kSpaceJastrow::evalGrad(), LCAOrbitalBuilder::EvalPeriodicImagePhaseFactors(), MomentumEstimator::evaluate(), SpaceGrid::evaluate(), HarmonicExternalPotential::evaluate(), CountingGaussianRegion::evaluate(), PWBasis::evaluate(), CountingGaussian::evaluate(), Gvectors< ST, LT >::evaluate_KE(), FreeOrbital::evaluate_notranspose(), CountingGaussian::evaluate_print(), Gvectors< ST, LT >::evaluate_psi_r(), DTD_BConds< T, D, SC >::evaluate_rsquared(), GridExternalPotential::evaluate_sp(), HarmonicExternalPotential::evaluate_sp(), BareKineticEnergy::evaluate_sp(), CountingGaussian::evaluateDerivative_A(), CountingGaussian::evaluateDerivative_B(), DiracDeterminantWithBackflow::evaluateDerivatives(), RotatedSPOs::evaluateDerivatives(), MultiSlaterDetTableMethod::evaluateDerivatives(), kSpaceJastrow::evaluateDerivatives(), CountingGaussianRegion::evaluateDerivatives(), CountingJastrow< RegionType >::evaluateDerivatives(), JeeIOrbitalSoA< FT >::evaluateDerivatives(), CountingJastrow< RegionType >::evaluateExponents(), DiracDeterminantWithBackflow::evaluateLog(), MultiSlaterDetTableMethod::evaluateLog(), kSpaceJastrow::evaluateLog(), DiracDeterminant< DU_TYPE >::evaluateLog(), CountingGaussian::evaluateLog(), AGPDeterminant::evaluateLogAndStore(), BareKineticEnergy::evaluateOneBodyOpMatrix(), NonLocalECPComponent::evaluateOneBodyOpMatrixContribution(), NonLocalECPComponent::evaluateOneBodyOpMatrixdRContribution(), BareKineticEnergy::evaluateOneBodyOpMatrixForceDeriv(), NonLocalECPComponent::evaluateOneWithForces(), BackflowTransformation::evaluatePbyP(), BackflowTransformation::evaluatePbyPAll(), BackflowTransformation::evaluatePbyPWithGrad(), kSpaceJastrow::evaluateRatiosAlltoOne(), CountingGaussianRegion::evaluateTemp(), CountingJastrow< RegionType >::evaluateTempExponents(), SoaAtomicBasisSet< ROT, SH >::evaluateV(), FreeOrbital::evaluateValue(), NonLocalECPComponent::evaluateValueAndDerivatives(), SoaAtomicBasisSet< ROT, SH >::evaluateVGH(), SoaAtomicBasisSet< ROT, SH >::evaluateVGHGH(), FreeOrbital::evaluateVGL(), SoaAtomicBasisSet< ROT, SH >::evaluateVGL(), qmcplusplus::ewaldref::ewaldEnergy(), extrap(), SkPot::FillFk(), KContainer::findApproxMMax(), found_shorter_base(), FreeOrbital::FreeOrbital(), DensityMatrices1B::generate_density_samples(), OneBodyDensityMatrices::generateDensitySamples(), OneBodyDensityMatrices::generateDensitySamplesWithSpin(), DriftModifierUNR::getDrift(), getScaledDrift(), getScaledDriftL2(), Gvectors< ST, LT >::Gvectors(), MPC::init_f_G(), MPC::init_gvecs(), MPC::init_spline(), SpaceGrid::initialize_rectilinear(), HybridRepCenterOrbitals< SPLINEBASE::DataType >::interpolate_buffer_vgl(), CrystalLattice< ST, 3 >::k_cart(), CountingGaussian::k_to_c(), CrystalLattice< ST, 3 >::k_unit(), kSpaceJastrow::kSpaceJastrow(), CrystalLattice< ST, 3 >::ksq(), laplacian(), QMCUpdateBase::logBackwardGF(), MomentumDistribution::MomentumDistribution(), BareKineticEnergy::mw_evaluatePerParticle(), NEReferencePoints::NEReferencePoints(), RspaceMadelungTerm::operator()(), KspaceMadelungTerm::operator()(), RspaceEwaldTerm::operator()(), KspaceEwaldTerm::operator()(), magLess::operator()(), kSpaceJastrow::operator()(), ReferencePoints::put(), SpinDensity::put(), MomentumEstimator::putSpecial(), Quadrature3D< T >::Quadrature3D(), kSpaceJastrow::ratio(), DiracDeterminantWithBackflow::ratioGrad(), kSpaceJastrow::ratioGrad(), EinsplineSetBuilder::ReadOrbitalInfo_ESHDF(), CrystalLattice< ST, 3 >::reset(), SplineC2R< ST >::resize_kpoints(), SplineC2C< ST >::resize_kpoints(), SplineC2COMPTarget< ST >::resize_kpoints(), SplineC2ROMPTarget< ST >::resize_kpoints(), SOECPComponent::rotateQuadratureGrid(), NonLocalECPComponent::rotateQuadratureGrid(), EinsplineSetBuilder::set_metadata(), LRBreakupParameters< T, 3 >::SetLRCutoffs(), setScaledDriftPbyPandNodeCorr(), PWBasis::setTwistAngle(), kSpaceJastrow::setupGvecs(), NESpaceGrid< REAL >::someMoreAxisGridStuff(), kSpaceJastrow::StructureFactor(), RotatedSPOs::table_method_eval(), TEST_CASE(), test_tiny_vector(), CrystalLattice< ST, 3 >::toCart(), CrystalLattice< ST, 3 >::toUnit(), PWBasis::trimforecut(), DiracDeterminant< DU_TYPE >::updateAfterSweep(), and MultiSlaterDetTableMethod::updateBuffer().

522 {
523  return OTDot<AntiSymTensor<T1, D>, AntiSymTensor<T2, D>>::apply(lhs, rhs);
524 }

◆ dot() [11/16]

Tensor<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const AntiSymTensor< T1, D > &  lhs,
const Tensor< T2, D > &  rhs 
)
inline

Definition at line 527 of file AntiSymTensor.h.

529 {
530  return OTDot<Tensor<T1, D>, Tensor<T2, D>>::apply(Tensor<T1, D>(lhs), rhs);
531 }

◆ dot() [12/16]

Tensor<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const Tensor< T1, D > &  lhs,
const AntiSymTensor< T2, D > &  rhs 
)
inline

Definition at line 534 of file AntiSymTensor.h.

536 {
537  return OTDot<Tensor<T1, D>, Tensor<T2, D>>::apply(lhs, Tensor<T2, D>(rhs));
538 }

◆ dot() [13/16]

Tensor<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const AntiSymTensor< T1, D > &  lhs,
const SymTensor< T2, D > &  rhs 
)
inline

Definition at line 541 of file AntiSymTensor.h.

543 {
544  return OTDot<Tensor<T1, D>, Tensor<T2, D>>::apply(Tensor<T1, D>(lhs), Tensor<T2, D>(rhs));
545 }

◆ dot() [14/16]

Tensor<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const SymTensor< T1, D > &  lhs,
const AntiSymTensor< T2, D > &  rhs 
)
inline

Definition at line 548 of file AntiSymTensor.h.

550 {
551  return OTDot<Tensor<T1, D>, Tensor<T2, D>>::apply(Tensor<T1, D>(lhs), Tensor<T2, D>(rhs));
552 }

◆ dot() [15/16]

TinyVector<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const TinyVector< T1, D > &  lhs,
const AntiSymTensor< T2, D > &  rhs 
)
inline

Definition at line 555 of file AntiSymTensor.h.

557 {
558  return OTDot<TinyVector<T1, D>, AntiSymTensor<T2, D>>::apply(lhs, rhs);
559 }

◆ dot() [16/16]

TinyVector<typename BinaryReturn<T1, T2, OpMultiply>::Type_t, D> qmcplusplus::dot ( const AntiSymTensor< T1, D > &  lhs,
const TinyVector< T2, D > &  rhs 
)
inline

Definition at line 562 of file AntiSymTensor.h.

564 {
565  return OTDot<AntiSymTensor<T1, D>, TinyVector<T2, D>>::apply(lhs, rhs);
566 }

◆ Dot_CC()

double qmcplusplus::Dot_CC ( const ParticleAttrib< TinyVector< std::complex< double >, D >> &  pa,
const ParticleAttrib< TinyVector< std::complex< double >, D >> &  pb 
)
inline

Definition at line 158 of file ParticleAttribOps.h.

References OTCDot_CC< T1, T2, D >::apply().

Referenced by complex_test_case(), and ACForce::compute_regularizer_f().

160 {
161  double sum = 0;
162  for (int i = 0; i < pa.size(); i++)
163  {
164  sum += OTCDot_CC<double, double, D>::apply(pa[i], pb[i]);
165  }
166  return sum;
167 }

◆ double_test_case()

void qmcplusplus::double_test_case ( )

Definition at line 31 of file test_attrib_ops.cpp.

References CHECK(), Dot(), dot(), REQUIRE(), Vector< T, Alloc >::resize(), and Vector< T, Alloc >::size().

32 {
34  v1 = 2.0;
35  double val1 = dot(v1, v1);
36  CHECK(val1 == Approx(4.0 * D));
37 
38 
39  ParticleAttrib<TinyVector<double, D>> PA1;
40  PA1.resize(3);
41  REQUIRE(PA1.size() == 3);
42 
43  // Whole array operation
44  PA1 = 1.0;
45 
46  double val = Dot(PA1, PA1);
47  CHECK(val == Approx(3 * 1.0 * D));
48 }
T dot(T *a, T *b)
T Dot(const ParticleAttrib< TinyVector< T, D >> &pa, const ParticleAttrib< TinyVector< T, D >> &pb)
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ dual_device_mem_allocated()

std::atomic<size_t> qmcplusplus::dual_device_mem_allocated ( )

◆ embt()

testing::EstimatorManagerNewTest qmcplusplus::embt ( ham  ,
,
num_ranks   
)

◆ emi()

◆ emi2()

EstimatorManagerInput qmcplusplus::emi2 ( estimators_doc2.  getRoot())

◆ estimateEquilibration()

int estimateEquilibration ( const std::vector< RealType > &  vals,
RealType  frac = 0.75 
)

estimate equilibration of block data

Assumes vals is an array to be averaged. This will estimate which, if any, of the data should be thrown out as equilibration data. Returns the index of the array to start averaging from. frac is the fraction of the data to average initially to help determine the equilibration

Definition at line 50 of file FSUtilities.cpp.

References getStats().

Referenced by SkParserHDF5::parse().

51 {
52  int idx = int(frac * vals.size());
53  RealType avg, err;
54  getStats(vals, avg, err, idx);
55  int c3, c2, c1;
56  c3 = vals.size();
57  c2 = vals.size();
58  c1 = vals.size();
59  for (int i = vals.size() - 2; i >= 0; i--)
60  {
61  if ((vals[i] - avg) * (vals[i + 1] - avg) < 0.0)
62  {
63  c3 = c2;
64  c2 = c1;
65  c1 = i;
66  }
67  }
68  if (c3 > frac * vals.size())
69  c3 = int(frac * vals.size());
70  return c3;
71 }
QMCTraits::RealType RealType
void getStats(const std::vector< RealType > &vals, RealType &avg, RealType &err, int start)
Simpleaverage and error estimate.
Definition: FSUtilities.cpp:31

◆ evaluate() [1/3]

void qmcplusplus::evaluate ( Vector< T, C > &  lhs,
const Op &  op,
const Expression< RHS > &  rhs 
)
inline

Definition at line 398 of file OhmmsVector.h.

References forEach(), and Vector< T, Alloc >::size().

399 {
400  if (forEach(rhs, SizeLeaf(lhs.size()), AndCombine()))
401  {
402  // We get here if the vectors on the RHS are the same size as those on
403  // the LHS.
404  for (int i = 0; i < lhs.size(); ++i)
405  {
406  // The actual assignment operation is performed here.
407  // PETE operator tags all define operator() to perform the operation.
408  // (In this case op performs an assignment.) forEach is used
409  // to compute the rhs value. EvalLeaf1 gets the
410  // values at each node using random access, and the tag
411  // OpCombine tells forEach to use the operator tags in the expression
412  // to combine values together.
413  op(lhs[i], forEach(rhs, EvalLeaf1(i), OpCombine()));
414  }
415  }
416  else
417  {
418  throw std::runtime_error("Error in evaluate: LHS and RHS don't conform in OhmmsVector.");
419  }
420 }
ForEach< Expr, FTag, CTag >::Type_t forEach(const Expr &e, const FTag &f, const CTag &c)
Definition: ForEach.h:87

◆ evaluate() [2/3]

void qmcplusplus::evaluate ( Matrix< T, Alloc > &  lhs,
const Op &  op,
const Expression< RHS > &  rhs 
)
inline

Definition at line 514 of file OhmmsMatrix.h.

References Matrix< T, Alloc >::cols(), forEach(), and Matrix< T, Alloc >::rows().

Referenced by assign(), calcSmallDeterminant(), CustomizedMatrixDet< 5 >::evaluate(), Hdispatcher::flex_evaluate(), ParticleSet::loadWalker(), ParticleSet::makeMoveAllParticles(), ParticleSet::makeMoveAllParticlesWithDrift(), MultiDiracDeterminant::mw_updateRatios(), operator &=(), operator%=(), operator*=(), operator+=(), operator-=(), operator/=(), operator<<=(), operator>>=(), operator^=(), operator|=(), and ParticleSet::update().

515 {
516  if (forEach(rhs, SizeLeaf2(lhs.rows(), lhs.cols()), AndCombine()))
517  {
518  // We get here if the vectors on the RHS are the same size as those on
519  // the LHS.
520  for (int i = 0; i < lhs.rows(); ++i)
521  {
522  for (int j = 0; j < lhs.cols(); ++j)
523  {
524  op(lhs(i, j), forEach(rhs, EvalLeaf2(i, j), OpCombine()));
525  }
526  }
527  }
528  else
529  {
530  throw std::runtime_error("Error in evaluate: LHS and RHS don't conform in OhmmsMatrix.");
531  }
532 }
ForEach< Expr, FTag, CTag >::Type_t forEach(const Expr &e, const FTag &f, const CTag &c)
Definition: ForEach.h:87

◆ evaluate() [3/3]

void qmcplusplus::evaluate ( ParticleAttrib< T > &  lhs,
const Op &  op,
const Expression< RHS > &  rhs 
)
inline

Definition at line 896 of file ParticleAttrib.cpp.

References forEach(), and Vector< T, Alloc >::size().

897 {
898  if (forEach(rhs, SizeLeafPA(lhs.size()), AndCombine()))
899  {
900  // We get here if the vectors on the RHS are the same size as those on
901  // the LHS.
902  for (int i = 0; i < lhs.size(); ++i)
903  {
904  // The actual assignment operation is performed here.
905  // PETE operator tags all define operator() to perform the operation.
906  // (In this case op performs an assignment.) forEach is used
907  // to compute the rhs value. EvalLeaf1 gets the
908  // values at each node using random access, and the tag
909  // OpCombine tells forEach to use the operator tags in the expression
910  // to combine values together.
911  op(lhs[i], forEach(rhs, EvalLeaf1(i), OpCombine()));
912  }
913  }
914  else
915  {
916  throw std::runtime_error("Error in evaluate: LHS and RHS don't conform in ParticleAttrib.");
917  }
918 }
ForEach< Expr, FTag, CTag >::Type_t forEach(const Expr &e, const FTag &f, const CTag &c)
Definition: ForEach.h:87

◆ evaluateForPhi0Body()

RealType qmcplusplus::evaluateForPhi0Body ( RealType  phi0,
ValueVector pos,
ValueVector ELcurr,
ValueVector ELideal,
CuspCorrection cusp,
OneMolecularOrbital phiMO,
ValGradLap  phiAtRc,
RealType  etaAtZero,
RealType  ELorigAtRc,
RealType  Z 
)

Definition at line 453 of file CuspCorrectionConstruction.cpp.

References CuspCorrectionParameters::alpha, CuspCorrectionParameters::C, CuspCorrection::cparam, evalX(), getCurrentLocalEnergy(), getELchi2(), getZeff(), ValGradLap::grad, ValGradLap::lap, phiBar(), CuspCorrectionParameters::Rc, CuspCorrectionParameters::sg, ValGradLap::val, and X2alpha().

Referenced by minimizeForPhiAtZero().

463 {
464  cusp.cparam.sg = phi0 > 0.0 ? 1.0 : -1.0;
465  cusp.cparam.C = (phiAtRc.val * phi0 < 0.0) ? 1.5 * phiAtRc.val : 0.0;
467  evalX(phiAtRc.val, phiAtRc.grad, phiAtRc.lap, cusp.cparam.Rc, Z, cusp.cparam.C, phi0, etaAtZero, X);
468  X2alpha(X, cusp.cparam.Rc, cusp.cparam.alpha);
469  RealType Zeff = getZeff(Z, etaAtZero, phiBar(cusp, 0.0, phiMO));
470  getCurrentLocalEnergy(pos, Zeff, cusp.cparam.Rc, ELorigAtRc, cusp, phiMO, ELcurr);
471  RealType chi2 = getELchi2(ELcurr, ELideal);
472  return chi2;
473 }
RealType phiBar(const CuspCorrection &cusp, RealType r, OneMolecularOrbital &phiMO)
void getCurrentLocalEnergy(const ValueVector &pos, RealType Zeff, RealType Rc, RealType originalELatRc, CuspCorrection &cusp, OneMolecularOrbital &phiMO, ValueVector &ELcurr)
Compute effective local energy at vector of points.
void evalX(RealType valRc, GradType gradRc, ValueType lapRc, RealType Rc, RealType Z, RealType C, RealType valAtZero, RealType eta0, TinyVector< ValueType, 5 > &X)
Evaluate various orbital quantities that enter as constraints on the correction.
QMCTraits::RealType RealType
void X2alpha(const TinyVector< ValueType, 5 > &X, RealType Rc, TinyVector< ValueType, 5 > &alpha)
Convert constraints to polynomial parameters.
RealType getZeff(RealType Z, RealType etaAtZero, RealType phiBarAtZero)
Effective nuclear charge to keep effective local energy finite at zero.
RealType getELchi2(const ValueVector &ELcurr, const ValueVector &ELideal)
Sum of squares difference between the current and ideal local energies This is the objective function...

◆ evalX()

void evalX ( RealType  valRc,
GradType  gradRc,
ValueType  lapRc,
RealType  Rc,
RealType  Z,
RealType  C,
RealType  valAtZero,
RealType  eta0,
TinyVector< ValueType, 5 > &  X 
)

Evaluate various orbital quantities that enter as constraints on the correction.

Parameters
valRcorbital value at Rc
gradRcorbital gradient at Rc
lapRcorbital laplacian at Rc
Rccutoff radius
Znuclear charge
Coffset to keep correction to a single sign
valAtZeroorbital value at zero
eta0value of non-corrected pieces of the orbital at zero
Xoutput

Definition at line 330 of file CuspCorrectionConstruction.cpp.

References abs(), qmcplusplus::Units::charge::C, and log().

Referenced by evaluateForPhi0Body().

339 {
340  X[0] = std::log(std::abs(valRc - C));
341  X[1] = gradRc[0] / (valRc - C);
342  X[2] = (lapRc - 2.0 * gradRc[0] / Rc) / (valRc - C);
343  X[3] = -Z * (valAtZero + eta0) / (valAtZero - C);
344  X[4] = std::log(std::abs(valAtZero - C));
345 }
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)

◆ exp() [1/2]

MakeReturn<UnaryNode<FnExp, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::exp ( const Vector< T1, C1 > &  l)
inline

Definition at line 80 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by SelfHealingOverlap::accumulate(), SOVMCUpdateAll::advanceWalker(), DMCUpdateAllWithRejection::advanceWalker(), SODMCUpdatePbyPWithRejectionFast::advanceWalker(), VMCUpdateAll::advanceWalker(), DMCUpdatePbyPWithRejectionFast::advanceWalker(), SOVMCUpdatePbyP::advanceWalker(), VMCUpdatePbyP::advanceWalker(), DMCUpdatePbyPL2::advanceWalker(), CSVMCUpdateAll::advanceWalker(), DMCUpdateAllWithKill::advanceWalker(), CSVMCUpdateAllWithDrift::advanceWalker(), VMCBatched::advanceWalkers(), DMCBatched::advanceWalkers(), RMCUpdatePbyPWithDrift::advanceWalkersRMC(), RMCUpdateAllWithDrift::advanceWalkersRMC(), RMCUpdatePbyPWithDrift::advanceWalkersVMC(), RMCUpdateAllWithDrift::advanceWalkersVMC(), AtomicOrbitals< ST >::AtomicOrbitals(), SFNBranch::branchWeight(), SimpleFixedNodeBranch::branchWeight(), SFNBranch::branchWeightBare(), SimpleFixedNodeBranch::branchWeightBare(), SimpleFixedNodeBranch::branchWeightTau(), QMCUpdateBase::checkLogAndGL(), QMCDriverNew::checkLogAndGL(), chid(), chiu(), CSUpdateBase::computeSumRatio(), LogToValue< T >::convert(), LogToValue< std::complex< T > >::convert(), QMCCostFunction::correlatedSampling(), QMCCostFunctionBatched::correlatedSampling(), GaussianCombo< T >::BasicGaussian::df(), YukawaBreakup< T >::df(), GaussianTimesRN< T >::BasicGaussian::df(), GenericSTO< T >::df(), RadialSTO< T >::df(), DerivYukawaBreakup< T >::df(), ExpFitClass< M >::eval(), ComplexExpFitClass< M >::eval(), EwaldHandler3D::evaldYkgstrain(), SelfHealingOverlapLegacy::evaluate(), GaussianCombo< T >::BasicGaussian::evaluate(), GaussianTimesRN< T >::BasicGaussian::evaluate(), GenericSTO< T >::evaluate(), ShortRangeCuspFunctor< T >::evaluate(), RadialSTO< T >::evaluate(), CountingGaussianRegion::evaluate(), CountingGaussian::evaluate(), ScaledPadeFunctor< T >::evaluate(), SHOSet::evaluate_check(), SHOSet::evaluate_d0(), CountingGaussian::evaluate_print(), EwaldHandler3D::evaluate_vlr_k(), ShortRangeCuspFunctor< T >::evaluateDerivatives(), TwoBodyJastrow< FT >::evaluateRatios(), J1Spin< FT >::evaluateRatios(), J1OrbitalSoA< FT >::evaluateRatios(), JeeIOrbitalSoA< FT >::evaluateRatios(), TwoBodyJastrow< FT >::evaluateRatiosAlltoOne(), kSpaceJastrow::evaluateRatiosAlltoOne(), J1Spin< FT >::evaluateRatiosAlltoOne(), JeeIOrbitalSoA< FT >::evaluateRatiosAlltoOne(), J1OrbitalSoA< FT >::evaluateRatiosAlltoOne(), CountingGaussianRegion::evaluateTemp(), EwaldHandler3D::evalYkgstrain(), RotatedSPOs::exponentiate_antisym_matrix(), GaussianTimesRN< T >::BasicGaussian::f(), GaussianCombo< T >::BasicGaussian::f(), GenericSTO< T >::f(), RadialSTO< T >::f(), SkPot::FillFk(), EwaldHandler3D::fillFk(), DensityMatrices1B::generate_density_samples(), OneBodyDensityMatrices::generateDensitySamples(), OneBodyDensityMatrices::generateDensitySamplesWithSpin(), LogGridLight< T >::getCL(), OptimalGrid::Init(), CSUpdateBase::initCSWalkers(), CSUpdateBase::initCSWalkersForPbyP(), OptimalGrid::InitRatio(), EwaldHandler3D::lrDf(), BackflowBuilder::makeShortRange_twoBody(), TwoBodyJastrow< FT >::mw_calcRatio(), TwoBodyJastrow< FT >::mw_evaluateRatios(), J1OrbitalSoA< FT >::mw_evaluateRatios(), TwoBodyJastrow< FT >::mw_ratioGrad(), OneBodyDensityMatrices::OneBodyDensityMatrices(), KspaceMadelungTerm::operator()(), YukawaBreakup< T >::operator()(), FnExp::operator()(), KspaceEwaldTerm::operator()(), DerivYukawaBreakup< T >::operator()(), OptimalGrid2::OptimalGrid2(), orbd(), orbu(), QMCFixedSampleLinearOptimizeBatched::previous_linear_methods_run(), ExampleHeComponent::ratio(), LatticeGaussianProduct::ratio(), kSpaceJastrow::ratio(), TwoBodyJastrow< FT >::ratio(), J1Spin< FT >::ratio(), J1OrbitalSoA< FT >::ratio(), JeeIOrbitalSoA< FT >::ratio(), CountingJastrow< RegionType >::ratio(), ExampleHeComponent::ratioGrad(), LatticeGaussianProduct::ratioGrad(), kSpaceJastrow::ratioGrad(), TwoBodyJastrow< FT >::ratioGrad(), CountingJastrow< RegionType >::ratioGrad(), JeeIOrbitalSoA< FT >::ratioGrad(), J1OrbitalSoA< FT >::ratioGrad(), J1Spin< FT >::ratioGrad(), CuspCorrection::Rr(), QMCFixedSampleLinearOptimize::run(), WaveFunctionTester::runBasicTest(), WaveFunctionTester::runRatioTest(), WaveFunctionTester::runZeroVarianceTest(), LogGridLight< T >::set(), LogGrid< T, CT >::set(), LogGridZero< T, CT >::set(), DensityMatrices1B::set_state(), EwaldHandlerQuasi2D::slab_vsr_k0(), EwaldHandlerQuasi2D::slabFunc(), EwaldHandler3D::srDf(), TEST_CASE(), test_DiracDeterminant_delayed_update(), test_DiracDeterminant_second(), test_DiracDeterminantBatched_delayed_update(), test_DiracDeterminantBatched_second(), TWF(), SHOSetBuilder::update_basis_states(), CSUpdateBase::updateCSWalkers(), DescentEngine::updateParameters(), Wso(), YukawaBreakup< T >::Xk(), DerivYukawaBreakup< T >::Xk(), and Ylm().

82 {
83  using Tree_t = UnaryNode<FnExp, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
84  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
85 }

◆ exp() [2/2]

MakeReturn<UnaryNode<FnExp, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::exp ( const Expression< T1 > &  l)
inline

Definition at line 1427 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1429 {
1430  using Tree_t = UnaryNode<FnExp, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1431  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1432 }

◆ expectedReferencePoints()

auto qmcplusplus::expectedReferencePoints ( )

Definition at line 107 of file test_ReferencePoints.cpp.

Referenced by TEST_CASE().

108 {
109  typename NEReferencePoints::Points expected_reference_points;
110  if constexpr (std::is_same_v<NEReferencePoints::Real, double>)
111  expected_reference_points = {
112  {"a1", {3.37316107749939, 3.37316107749939, 0}},
113  {"a2", {0, 3.37316107749939, 3.37316107749939}},
114  {"a3", {3.37316107749939, 0, 3.37316107749939}},
115  {"cmmm", {-3.37316107749939, -3.37316107749939, -3.37316107749939}},
116  {"cmmp", {0, -3.37316107749939, 0}},
117  {"cmpm", {-3.37316107749939, 0, 0}},
118  {"cmpp", {0, 0, 3.37316107749939}},
119  {"cpmm", {0, 0, -3.37316107749939}},
120  {"cpmp", {3.37316107749939, 0, 0}},
121  {"cppm", {0, 3.37316107749939, 0}},
122  {"cppp", {3.37316107749939, 3.37316107749939, 3.37316107749939}},
123  {"f1m", {-1.686580538749695, -1.686580538749695, 0}},
124  {"f1p", {1.686580538749695, 1.686580538749695, 0}},
125  {"f2m", {0, -1.686580538749695, -1.686580538749695}},
126  {"f2p", {0, 1.686580538749695, 1.686580538749695}},
127  {"f3m", {-1.686580538749695, 0, -1.686580538749695}},
128  {"f3p", {1.686580538749695, 0, 1.686580538749695}},
129  {"ion1", {0, 0, 0}},
130  {"ion2", {1.686580538749695, 1.686580538749695, 1.686580538749695}},
131  {"r1", {3.37316107749939, 3.37316107749939, 0}},
132  {"r2", {0, 3.37316107749939, 3.37316107749939}},
133  {"r3", {3.37316107749939, 0, 3.37316107749939}},
134  {"zero", {0, 0, 0}},
135  };
136  else
137  expected_reference_points = {
138  {"a1", {3.37316115, 3.37316115, 0}},
139  {"a2", {0, 3.37316115, 3.37316115}},
140  {"a3", {3.37316115, 0, 3.37316115}},
141  {"cmmm", {-3.37316115, -3.37316115, -3.37316115}},
142  {"cmmp", {0, -3.37316115, 0}},
143  {"cmpm", {-3.37316115, 0, 0}},
144  {"cmpp", {0, 0, 3.37316115}},
145  {"cpmm", {0, 0, -3.37316115}},
146  {"cpmp", {3.37316115, 0, 0}},
147  {"cppm", {0, 3.37316115, 0}},
148  {"cppp", {3.37316115, 3.37316115, 3.37316115}},
149  {"f1m", {-1.686580575, -1.686580575, 0}},
150  {"f1p", {1.686580575, 1.686580575, 0}},
151  {"f2m", {0, -1.686580575, -1.686580575}},
152  {"f2p", {0, 1.686580575, 1.686580575}},
153  {"f3m", {-1.686580575, 0, -1.686580575}},
154  {"f3p", {1.686580575, 0, 1.686580575}},
155  {"ion1", {0, 0, 0}},
156  {"ion2", {1.68658058, 1.68658058, 1.68658058}},
157  {"r1", {3.37316115, 3.37316115, 0}},
158  {"r2", {0, 3.37316115, 3.37316115}},
159  {"r3", {3.37316115, 0, 3.37316115}},
160  {"zero", {0, 0, 0}},
161  };
162  return expected_reference_points;
163 }

◆ extractCoefficientsID()

std::string extractCoefficientsID ( xmlNodePtr  cur)

return the id of the first coefficients. If not found, return an emtpy string

Definition at line 33 of file OptimizableFunctorBase.cpp.

References getXMLAttributeValue().

Referenced by BackflowBuilder::addOneBody(), BackflowBuilder::addTwoBody(), RadialJastrowBuilder::createJ1(), RadialJastrowBuilder::createJ2(), BackflowBuilder::makeShortRange_twoBody(), and eeI_JastrowBuilder::putkids().

34 {
35  xmlNodePtr xmlCoefs = cur->xmlChildrenNode;
36  while (xmlCoefs != NULL)
37  {
38  std::string cname((const char*)xmlCoefs->name);
39  if (cname == "coefficients")
40  return getXMLAttributeValue(xmlCoefs, "id");
41  xmlCoefs = xmlCoefs->next;
42  }
43  return "";
44 }
std::string getXMLAttributeValue(const xmlNodePtr cur, const std::string_view name)
get the value string for attribute name if name is unfound in cur you get an empty string back this i...

◆ extrap() [1/2]

double qmcplusplus::extrap ( int  N,
TinyVector< double, 3 >  g_124 
)
inline

Definition at line 129 of file MPC.cpp.

References qmcplusplus::Units::distance::A, dot(), inverse(), and qmcplusplus::Units::force::N.

Referenced by MPC::init_f_G().

130 {
131  Tensor<double, 3> A, Ainv;
132  double N1inv2 = 1.0 / (double)(N * N);
133  double N2inv2 = 1.0 / (double)((2 * N) * (2 * N));
134  double N4inv2 = 1.0 / (double)((4 * N) * (4 * N));
135  A(0, 0) = 1.0;
136  A(0, 1) = N1inv2;
137  A(0, 2) = N1inv2 * N1inv2;
138  A(1, 0) = 1.0;
139  A(1, 1) = N2inv2;
140  A(1, 2) = N2inv2 * N2inv2;
141  A(2, 0) = 1.0;
142  A(2, 1) = N4inv2;
143  A(2, 2) = N4inv2 * N4inv2;
144  Ainv = inverse(A);
145  TinyVector<double, 3> abc = dot(Ainv, g_124);
146  return abc[0];
147 }
T dot(T *a, T *b)
Tensor< T, D > inverse(const Tensor< T, D > &a)
Definition: TensorOps.h:879

◆ extrap() [2/2]

double qmcplusplus::extrap ( int  N,
TinyVector< double, 2 >  g_12 
)
inline

Definition at line 150 of file MPC.cpp.

References qmcplusplus::Units::distance::A, dot(), inverse(), and qmcplusplus::Units::force::N.

151 {
152  Tensor<double, 2> A, Ainv;
153  double N1inv2 = 1.0 / (double)(N * N);
154  double N2inv2 = 1.0 / (double)((2 * N) * (2 * N));
155  A(0, 0) = 1.0;
156  A(0, 1) = N1inv2;
157  A(1, 0) = 1.0;
158  A(1, 1) = N2inv2;
159  Ainv = inverse(A);
160  TinyVector<double, 2> abc = dot(Ainv, g_12);
161  return abc[0];
162 }
T dot(T *a, T *b)
Tensor< T, D > inverse(const Tensor< T, D > &a)
Definition: TensorOps.h:879

◆ fakeMainScalarSamples()

embt qmcplusplus::fakeMainScalarSamples ( )

◆ fakeSomeOperatorEstimatorSamples()

embt qmcplusplus::fakeSomeOperatorEstimatorSamples ( c->  rank())

◆ fill_from_text()

void qmcplusplus::fill_from_text ( int  num_opt_crowds,
FillData fd 
)

Definition at line 147 of file test_QMCCostFunctionBatched.cpp.

References CHECK(), comm, OHMMS::Controller, LinearMethodTestSupport::costFn, FillData::derivRecords, FillData::energy_new, QMCCostFunctionBase::ENERGY_NEW, QMCCostFunctionBatched::fillOverlapHamiltonianMatrices(), LinearMethodTestSupport::getDerivRecords(), LinearMethodTestSupport::getHDerivRecords(), LinearMethodTestSupport::getRecordsOnNode(), LinearMethodTestSupport::getSumValue(), ham, FillData::ham_gold, FillData::HDerivRecords, qmcplusplus::Units::force::N, FillData::numParam, FillData::numSamples, FillData::ovlp_gold, FillData::reweight, QMCCostFunctionBase::REWEIGHT, LinearMethodTestSupport::set_samples_and_param(), FillData::sum_e_wgt, QMCCostFunctionBase::SUM_E_WGT, FillData::sum_esq_wgt, QMCCostFunctionBase::SUM_ESQ_WGT, FillData::sum_wgt, and QMCCostFunctionBase::SUM_WGT.

Referenced by TEST_CASE().

148 {
149  std::vector<int> walkers_per_crowd(num_opt_crowds, 1);
150 
151  using Return_rt = qmcplusplus::QMCTraits::RealType;
152 
154 
155  testing::LinearMethodTestSupport lin(walkers_per_crowd, comm);
156 
157  int numSamples = fd.numSamples;
158  int numParam = fd.numParam;
159  lin.set_samples_and_param(numSamples, numParam);
160 
161  std::vector<Return_rt>& SumValue = lin.getSumValue();
162  SumValue[QMCCostFunctionBase::SUM_WGT] = fd.sum_wgt;
163  SumValue[QMCCostFunctionBase::SUM_E_WGT] = fd.sum_e_wgt;
164  SumValue[QMCCostFunctionBase::SUM_ESQ_WGT] = fd.sum_esq_wgt;
165 
166  auto& RecordsOnNode = lin.getRecordsOnNode();
167  for (int iw = 0; iw < numSamples; iw++)
168  {
169  RecordsOnNode(iw, QMCCostFunctionBase::REWEIGHT) = fd.reweight[iw];
170  RecordsOnNode(iw, QMCCostFunctionBase::ENERGY_NEW) = fd.energy_new[iw];
171  }
172 
173  auto& derivRecords = lin.getDerivRecords();
174  derivRecords = fd.derivRecords;
175 
176  auto& HDerivRecords = lin.getHDerivRecords();
177  HDerivRecords = fd.HDerivRecords;
178 
179  int N = numParam + 1;
180  Matrix<Return_rt> ham(N, N);
181  Matrix<Return_rt> ovlp(N, N);
182  lin.costFn.fillOverlapHamiltonianMatrices(ham, ovlp);
183 
184  for (int iw = 0; iw < numParam; iw++)
185  {
186  for (int iw2 = 0; iw2 < numParam; iw2++)
187  {
188  //app_log() << "iw = " << iw << " iw2 = " << iw2 << " ovlp = " << ovlp(iw,iw2) << " " << ovlp_gold(iw,iw2);
189  //app_log() << " ham = " << ham(iw,iw2) << " " << ham_gold(iw,iw2) << std::endl;
190  CHECK(ovlp(iw, iw2) == Approx(fd.ovlp_gold(iw, iw2)));
191  CHECK(ham(iw, iw2) == Approx(fd.ham_gold(iw, iw2)));
192  }
193  }
194 }
QTBase::RealType RealType
Definition: Configuration.h:58
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ fillIdentityMatrix()

void qmcplusplus::fillIdentityMatrix ( Matrix< T > &  m)

Definition at line 26 of file createTestMatrix.h.

References qmcplusplus::Units::distance::m.

Referenced by TEMPLATE_TEST_CASE(), and TEST_CASE().

27 {
28  std::fill(m.begin(), m.end(), T(0));
29  for (int i = 0; i < m.cols(); i++)
30  m(i, i) = 1.0;
31 }

◆ find_reduced_basis()

void qmcplusplus::find_reduced_basis ( TinyVector< TinyVector< T, 3 >, 3 > &  rb)
inline

Definition at line 243 of file LatticeAnalyzer.h.

References found_shorter_base().

Referenced by DTD_BConds< T, 3, PPPG >::DTD_BConds(), and DTD_BConds< T, 3, PPPG+SOA_OFFSET >::DTD_BConds().

244 {
245  int maxIter = 10000;
246 
247  for (int count = 0; count < maxIter; count++)
248  {
249  TinyVector<TinyVector<T, 3>, 3> saved(rb);
250  bool changed = false;
251  for (int i = 0; i < 3; ++i)
252  {
253  rb[i] = 0.0;
254  changed = found_shorter_base(rb);
255  rb[i] = saved[i];
256  if (changed)
257  break;
258  }
259  if (!changed && !found_shorter_base(rb))
260  return;
261  }
262 
263  throw std::runtime_error("Reduced basis not found in allowed number of iterations. "
264  "Check unit cell or contact a developer.");
265 }
bool found_shorter_base(TinyVector< TinyVector< T, 3 >, 3 > &rb)

◆ fix_phase_rotate()

void qmcplusplus::fix_phase_rotate ( const Array< std::complex< T >, 3 > &  e2pi,
Array< std::complex< T >, 3 > &  in,
Array< T, 3 > &  out 
)
inline

rotate the state after 3dfft

Definition at line 285 of file einspline_helper.hpp.

References atan2(), Array< T, D, ALLOC >::data(), real(), and sincos().

286 {
287  const int nx = e2pi.size(0);
288  const int ny = e2pi.size(1);
289  const int nz = e2pi.size(2);
290  T rNorm = 0.0, iNorm = 0.0;
291  //#pragma omp parallel for reduction(+:rNorm,iNorm)
292  for (int ix = 0; ix < nx; ix++)
293  {
294  T rpart = 0.0, ipart = 0.0;
295  const std::complex<T>* restrict p_ptr = e2pi.data() + ix * ny * nz;
296  std::complex<T>* restrict in_ptr = in.data() + ix * ny * nz;
297  for (int iyz = 0; iyz < ny * nz; ++iyz)
298  {
299  in_ptr[iyz] *= p_ptr[iyz];
300  rpart += in_ptr[iyz].real() * in_ptr[iyz].real();
301  ipart += in_ptr[iyz].imag() * in_ptr[iyz].imag();
302  }
303  rNorm += rpart;
304  iNorm += ipart;
305  }
306 
307  //#pragma omp parallel
308  {
309  T arg = std::atan2(iNorm, rNorm);
310  T phase_i, phase_r;
311  qmcplusplus::sincos(0.125 * M_PI - 0.5 * arg, &phase_i, &phase_r);
312  //#pragma omp for
313  for (int ix = 0; ix < nx; ix++)
314  {
315  const std::complex<T>* restrict in_ptr = in.data() + ix * ny * nz;
316  T* restrict out_ptr = out.data() + ix * ny * nz;
317  for (int iyz = 0; iyz < ny * nz; iyz++)
318  out_ptr[iyz] = phase_r * in_ptr[iyz].real() - phase_i * in_ptr[iyz].imag();
319  }
320  }
321 }
QMCTraits::RealType real
Type_t * data()
Definition: OhmmsArray.h:87
MakeReturn< BinaryNode< FnArcTan2, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t atan2(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
size_t size() const
Definition: OhmmsArray.h:57
void sincos(T a, T *restrict s, T *restrict c)
sincos function wrapper
Definition: math.hpp:62

◆ fix_phase_rotate_c2c() [1/2]

void qmcplusplus::fix_phase_rotate_c2c ( const Array< std::complex< T >, 3 > &  in,
Array< std::complex< T1 >, 3 > &  out,
const TinyVector< T2, 3 > &  twist 
)
inline

Definition at line 130 of file einspline_helper.hpp.

References compute_phase().

Referenced by OneSplineOrbData::fft_spline().

133 {
134  const int nx = in.size(0);
135  const int ny = in.size(1);
136  const int nz = in.size(2);
137  T phase_r, phase_i;
138 
139  compute_phase(in, twist, phase_r, phase_i);
140 
141 #pragma omp parallel for
142  for (int ix = 0; ix < nx; ++ix)
143  {
144  const std::complex<T>* restrict in_ptr = in.data() + ix * ny * nz;
145  std::complex<T1>* restrict out_ptr = out.data() + ix * ny * nz;
146  for (int iy = 0; iy < ny; ++iy)
147  for (int iz = 0; iz < nz; ++iz)
148  {
149  *out_ptr = std::complex<T1>(static_cast<T1>(phase_r * in_ptr->real() - phase_i * in_ptr->imag()),
150  static_cast<T1>(phase_i * in_ptr->real() + phase_r * in_ptr->imag()));
151  ++out_ptr;
152  ++in_ptr;
153  }
154  }
155 }
Type_t * data()
Definition: OhmmsArray.h:87
size_t size() const
Definition: OhmmsArray.h:57
void compute_phase(const Array< std::complex< T >, 3 > &in, const TinyVector< T2, 3 > &twist, T &phase_r, T &phase_i)
Compute the phase factor for rotation.

◆ fix_phase_rotate_c2c() [2/2]

void qmcplusplus::fix_phase_rotate_c2c ( const Array< std::complex< T >, 3 > &  in,
Array< T1, 3 > &  out_r,
Array< T1, 3 > &  out_i,
const TinyVector< T2, 3 > &  twist,
T &  phase_r,
T &  phase_i 
)
inline

Definition at line 158 of file einspline_helper.hpp.

References compute_phase(), and Array< T, D, ALLOC >::data().

164 {
165  const int nx = in.size(0);
166  const int ny = in.size(1);
167  const int nz = in.size(2);
168 
169  compute_phase(in, twist, phase_r, phase_i);
170 
171 #pragma omp parallel for
172  for (size_t ix = 0; ix < nx; ++ix)
173  for (size_t iy = 0; iy < ny; ++iy)
174  {
175  const size_t offset = ix * ny * nz + iy * nz;
176  const std::complex<T>* restrict in_ptr = in.data() + offset;
177  T1* restrict r_ptr = out_r.data() + offset;
178  T1* restrict i_ptr = out_i.data() + offset;
179  for (size_t iz = 0; iz < nz; ++iz)
180  {
181  r_ptr[iz] = static_cast<T1>(phase_r * in_ptr[iz].real() - phase_i * in_ptr[iz].imag());
182  i_ptr[iz] = static_cast<T1>(phase_i * in_ptr[iz].real() + phase_r * in_ptr[iz].imag());
183  }
184  }
185 }
Type_t * data()
Definition: OhmmsArray.h:87
size_t size() const
Definition: OhmmsArray.h:57
void compute_phase(const Array< std::complex< T >, 3 > &in, const TinyVector< T2, 3 > &twist, T &phase_r, T &phase_i)
Compute the phase factor for rotation.

◆ fix_phase_rotate_c2r()

void qmcplusplus::fix_phase_rotate_c2r ( Array< std::complex< T >, 3 > &  in,
Array< T1, 3 > &  out,
const TinyVector< T2, 3 > &  twist,
T &  phase_r,
T &  phase_i 
)
inline

rotate the state after 3dfft

First, add the eikr phase factor. Then, rotate the phase of the orbitals so that neither the real part nor the imaginary part are very near zero. This sometimes happens in crystals with high symmetry at special k-points.

Definition at line 70 of file einspline_helper.hpp.

References Array< T, D, ALLOC >::data(), qmcplusplus::Units::time::s, sincos(), and sqrt().

Referenced by OneSplineOrbData::fft_spline().

75 {
76  const T two_pi = -2.0 * M_PI;
77  const int nx = in.size(0);
78  const int ny = in.size(1);
79  const int nz = in.size(2);
80  T nx_i = 1.0 / static_cast<T>(nx);
81  T ny_i = 1.0 / static_cast<T>(ny);
82  T nz_i = 1.0 / static_cast<T>(nz);
83 
84  T rNorm = 0.0, iNorm = 0.0, riNorm = 0.0;
85 #pragma omp parallel for reduction(+ : rNorm, iNorm, riNorm)
86  for (int ix = 0; ix < nx; ix++)
87  {
88  T s, c;
89  std::complex<T>* restrict in_ptr = in.data() + ix * ny * nz;
90  T rux = static_cast<T>(ix) * nx_i * twist[0];
91  for (int iy = 0; iy < ny; iy++)
92  {
93  T ruy = static_cast<T>(iy) * ny_i * twist[1];
94  for (int iz = 0; iz < nz; iz++)
95  {
96  T ruz = static_cast<T>(iz) * nz_i * twist[2];
97  qmcplusplus::sincos(-two_pi * (rux + ruy + ruz), &s, &c);
98  std::complex<T> eikr(c, s);
99  *in_ptr *= eikr;
100  rNorm += in_ptr->real() * in_ptr->real();
101  iNorm += in_ptr->imag() * in_ptr->imag();
102  riNorm += in_ptr->real() * in_ptr->imag();
103  ++in_ptr;
104  }
105  }
106  }
107 
108  const T x = (rNorm - iNorm) / riNorm;
109  const T y = 1.0 / std::sqrt(x * x + 4.0);
110  const T phs = std::sqrt(0.5 - y);
111  phase_r = phs;
112  phase_i = (x < 0) ? std::sqrt(1.0 - phs * phs) : -std::sqrt(1.0 - phs * phs);
113 
114 #pragma omp parallel for
115  for (int ix = 0; ix < nx; ix++)
116  {
117  const std::complex<T>* restrict in_ptr = in.data() + ix * ny * nz;
118  T1* restrict out_ptr = out.data() + ix * ny * nz;
119  for (int iy = 0; iy < ny; iy++)
120  for (int iz = 0; iz < nz; iz++)
121  {
122  *out_ptr = static_cast<T1>(phase_r * in_ptr->real() - phase_i * in_ptr->imag());
123  ++in_ptr;
124  ++out_ptr;
125  }
126  }
127 }
Type_t * data()
Definition: OhmmsArray.h:87
size_t size() const
Definition: OhmmsArray.h:57
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
void sincos(T a, T *restrict s, T *restrict c)
sincos function wrapper
Definition: math.hpp:62

◆ flat_idx()

size_t qmcplusplus::flat_idx ( const int  i,
const int  a,
const int  n 
)
inline

◆ floor() [1/2]

MakeReturn<UnaryNode<FnFloor, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::floor ( const Vector< T1, C1 > &  l)
inline

Definition at line 96 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by SpinDensityNew::accumulate(), NESpaceGrid< REAL >::accumulate(), DTD_BConds< T, 3, PPPG >::apply_bc(), DTD_BConds< T, 3, PPNG >::apply_bc(), SpaceGrid::check_grid(), NESpaceGrid< REAL >::check_grid(), MagnetizationDensity::computeBin(), DTD_BConds< T, 3, PPPG+SOA_OFFSET >::computeDist(), DTD_BConds< T, 3, PPNG+SOA_OFFSET >::computeDist(), DTD_BConds< T, 3, PPPG+SOA_OFFSET >::computeDistances(), DTD_BConds< T, 3, PPNG+SOA_OFFSET >::computeDistances(), DTD_BConds< T, 3, PPPG+SOA_OFFSET >::computeDistancesOffload(), DTD_BConds< T, 3, PPNG+SOA_OFFSET >::computeDistancesOffload(), SplineR2R< ST >::convertPos(), NESpaceGrid< REAL >::copyToSoA(), ECPComponentBuilder::doBreakUp(), MPC::evalLR(), DensityEstimator::evaluate(), SpinDensity::evaluate(), SpaceGrid::evaluate(), qmcplusplus::ewaldref::ewaldEnergy(), KContainer::findApproxMMax(), CubicBsplineGrid< T, LINEAR_1DGRID, PBC_CONSTRAINTS >::getGridPoint(), CubicBsplineGrid< T, LINEAR_1DGRID, FIRSTDERIV_CONSTRAINTS >::getGridPoint(), getSplineBound(), SpaceGrid::initialize_rectilinear(), FnFloor::operator()(), parseGridInput(), qmcplusplus::simd::remainder(), OptimalGrid::ReverseMap(), OptimalGrid2::ReverseMap(), CenterGrid::ReverseMap(), LogGrid::ReverseMap(), ClusterGrid::ReverseMap(), kSpaceJastrow::setupGvecs(), OneDimCubicSplineLinearGrid< T >::splint(), CrystalLattice< ST, 3 >::toUnit_floor(), and EshdfFile::writeQboxElectrons().

98 {
99  using Tree_t = UnaryNode<FnFloor, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
100  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
101 }

◆ floor() [2/2]

MakeReturn<UnaryNode<FnFloor, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::floor ( const Expression< T1 > &  l)
inline

Definition at line 1443 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1445 {
1446  using Tree_t = UnaryNode<FnFloor, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1447  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1448 }

◆ fmod() [1/8]

MakeReturn< BinaryNode<FnFmod, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::fmod ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 327 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by FnFmod::operator()().

328 {
329  typedef BinaryNode<FnFmod, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
330  Tree_t;
331  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
332 }

◆ fmod() [2/8]

MakeReturn< BinaryNode<FnFmod, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::fmod ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 577 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

578 {
579  typedef BinaryNode<FnFmod, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
580  Tree_t;
581  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
582 }

◆ fmod() [3/8]

MakeReturn< BinaryNode<FnFmod, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::fmod ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 827 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

828 {
829  typedef BinaryNode<FnFmod, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
830  Tree_t;
831  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
832 }

◆ fmod() [4/8]

MakeReturn< BinaryNode<FnFmod, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::fmod ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1053 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1054 {
1055  using Tree_t = BinaryNode<FnFmod, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1056  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1057 }

◆ fmod() [5/8]

MakeReturn< BinaryNode<FnFmod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::fmod ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1254 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1255 {
1256  using Tree_t = BinaryNode<FnFmod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1257  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1258 }

◆ fmod() [6/8]

MakeReturn< BinaryNode<FnFmod, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::fmod ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1674 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1675 {
1676  typedef BinaryNode<FnFmod, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
1677  Tree_t;
1678  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1679 }

◆ fmod() [7/8]

MakeReturn< BinaryNode<FnFmod, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::fmod ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1900 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1901 {
1902  using Tree_t = BinaryNode<FnFmod, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1903  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1904 }

◆ fmod() [8/8]

MakeReturn< BinaryNode<FnFmod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::fmod ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2101 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2102 {
2103  using Tree_t = BinaryNode<FnFmod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2104  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2105 }

◆ for()

◆ forEach()

ForEach<Expr, FTag, CTag>::Type_t qmcplusplus::forEach ( const Expr &  e,
const FTag &  f,
const CTag &  c 
)
inline

Definition at line 87 of file ForEach.h.

References ForEach< Expr, FTag, CTag >::apply(), and qmcplusplus::Units::charge::e.

Referenced by evaluate().

88 {
89  return ForEach<Expr, FTag, CTag>::apply(e, f, c);
90 }

◆ found_shorter_base()

bool qmcplusplus::found_shorter_base ( TinyVector< TinyVector< T, 3 >, 3 > &  rb)
inline

Definition at line 208 of file LatticeAnalyzer.h.

References dot(), and sqrt().

Referenced by find_reduced_basis().

209 {
210  const T eps = 10.0 * std::numeric_limits<T>::epsilon();
211  int imax = 0;
212  T r2max = dot(rb[0], rb[0]);
213  for (int i = 1; i < 3; i++)
214  {
215  T r2 = dot(rb[i], rb[i]);
216  if ((r2 - r2max) > eps)
217  {
218  r2max = r2;
219  imax = i;
220  }
221  }
222 
223  T rmax = std::sqrt(r2max);
224  T tol = 4.0 * rmax * eps; // Error propagation for x^2
225 
226  TinyVector<TinyVector<T, 3>, 4> rb_new;
227  rb_new[0] = rb[0] + rb[1] - rb[2];
228  rb_new[1] = rb[0] + rb[2] - rb[1];
229  rb_new[2] = rb[1] + rb[2] - rb[0];
230  rb_new[3] = rb[0] + rb[1] + rb[2];
231  for (int i = 0; i < 4; ++i)
232  {
233  T r2 = dot(rb_new[i], rb_new[i]);
234  if ((r2 - r2max) < -tol)
235  {
236  rb[imax] = rb_new[i];
237  return true;
238  }
239  }
240  return false;
241 }
T dot(T *a, T *b)
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ FracPart()

TinyVector<T, 3> qmcplusplus::FracPart ( const TinyVector< T, 3 > &  twist)
inline

Definition at line 80 of file EinsplineSetBuilderCommon.cpp.

References IntPart().

Referenced by EinsplineSetBuilder::AnalyzeTwists2(), and EinsplineSetBuilder::TileIons().

81 {
82  return twist - IntPart(twist);
83 }
TinyVector< T, 3 > IntPart(const TinyVector< T, 3 > &twist)

◆ gauss_random_vals()

std::vector<double> qmcplusplus::gauss_random_vals ( size_test *3+(size_test *3) % 2+  size_test)

◆ generateCuspInfo()

void generateCuspInfo ( Matrix< CuspCorrectionParameters > &  info,
const ParticleSet targetPtcl,
const ParticleSet sourcePtcl,
const LCAOrbitalSet lcao,
const std::string &  id,
Communicate Comm 
)

Definition at line 661 of file CuspCorrectionConstruction.cpp.

References abs(), SpeciesSet::addAttribute(), app_log(), broadcastCuspInfo(), LCAOrbitalSet::C, OneMolecularOrbital::changeOrbital(), Matrix< T, Alloc >::cols(), CuspCorrection::cparam, createGlobalTimer(), FairDivideLow(), SPOSet::getOrbitalSetSize(), ParticleSet::getSpeciesSet(), ParticleSet::GroupID, LCAOrbitalSet::isIdentity(), LCAOrbitalSet::isOMPoffload(), minimizeForRc(), LCAOrbitalSet::myBasisSet, OneMolecularOrbital::phi(), Communicate::rank(), Matrix< T, Alloc >::rows(), Communicate::size(), splitPhiEta(), timer_level_fine, and timer_level_medium.

Referenced by LCAOrbitalBuilder::createSPOSetFromXML().

667 {
668  const int num_centers = info.rows();
669  const int orbital_set_size = info.cols();
671 
672  NewTimer& cuspCreateTimer = createGlobalTimer("CuspCorrectionConstruction::createCuspParameters", timer_level_medium);
673  NewTimer& splitPhiEtaTimer = createGlobalTimer("CuspCorrectionConstruction::splitPhiEta", timer_level_fine);
674  NewTimer& computeTimer = createGlobalTimer("CuspCorrectionConstruction::computeCorrection", timer_level_fine);
675 
676  ScopedTimer createCuspTimerWrapper(cuspCreateTimer);
677 
678  LCAOrbitalSet phi("phi", std::unique_ptr<LCAOrbitalSet::basis_type>(lcao.myBasisSet->makeClone()),
679  lcao.getOrbitalSetSize(), lcao.isIdentity(), lcao.isOMPoffload());
680 
681  LCAOrbitalSet eta("eta", std::unique_ptr<LCAOrbitalSet::basis_type>(lcao.myBasisSet->makeClone()),
682  lcao.getOrbitalSetSize(), lcao.isIdentity(), lcao.isOMPoffload());
683 
684  std::vector<bool> corrCenter(num_centers, "true");
685 
686  using GridType = OneDimGridBase<RealType>;
687  int npts = 500;
688 
689  // Parallelize correction of MO's across MPI ranks
690  std::vector<int> offset;
691  FairDivideLow(orbital_set_size, Comm.size(), offset);
692 
693  int start_mo = offset[Comm.rank()];
694  int end_mo = offset[Comm.rank() + 1];
695  app_log() << " Number of molecular orbitals to compute correction on this rank: " << end_mo - start_mo << std::endl;
696 
697 // Specify dynamic scheduling explicitly for load balancing. Each iteration should take enough
698 // time that scheduling overhead is not an issue.
699 #pragma omp parallel for schedule(dynamic) collapse(2)
700  for (int center_idx = 0; center_idx < num_centers; center_idx++)
701  {
702  for (int mo_idx = start_mo; mo_idx < end_mo; mo_idx++)
703  {
704  ParticleSet localTargetPtcl(targetPtcl);
705  ParticleSet localSourcePtcl(sourcePtcl);
706 
707  LCAOrbitalSet local_phi("local_phi", std::unique_ptr<LCAOrbitalSet::basis_type>(phi.myBasisSet->makeClone()),
708  phi.getOrbitalSetSize(), phi.isIdentity(), phi.isOMPoffload());
709 
710  LCAOrbitalSet local_eta("local_eta", std::unique_ptr<LCAOrbitalSet::basis_type>(eta.myBasisSet->makeClone()),
711  eta.getOrbitalSetSize(), eta.isIdentity(), eta.isOMPoffload());
712 
713 #pragma omp critical
714  app_log() << " Working on MO: " << mo_idx << " Center: " << center_idx << std::endl;
715 
716  {
717  ScopedTimer local_timer(splitPhiEtaTimer);
718 
719  *local_eta.C = *lcao.C;
720  *local_phi.C = *lcao.C;
721  splitPhiEta(center_idx, corrCenter, local_phi, local_eta);
722  }
723 
724  bool corrO = false;
725  auto& cref(*(local_phi.C));
726  for (int ip = 0; ip < cref.cols(); ip++)
727  {
728  if (std::abs(cref(mo_idx, ip)) > 0)
729  {
730  corrO = true;
731  break;
732  }
733  }
734 
735  if (corrO)
736  {
737  OneMolecularOrbital etaMO(&localTargetPtcl, &localSourcePtcl, &local_eta);
738  etaMO.changeOrbital(center_idx, mo_idx);
739 
740  OneMolecularOrbital phiMO(&localTargetPtcl, &localSourcePtcl, &local_phi);
741  phiMO.changeOrbital(center_idx, mo_idx);
742 
743  SpeciesSet& tspecies(localSourcePtcl.getSpeciesSet());
744  int iz = tspecies.addAttribute("charge");
745  RealType Z = tspecies(iz, localSourcePtcl.GroupID[center_idx]);
746 
747  RealType Rc_max = 0.2;
748  RealType rc = 0.1;
749 
750  RealType dx = rc * 1.2 / npts;
751  ValueVector pos(npts);
752  ValueVector ELideal(npts);
753  ValueVector ELcurr(npts);
754  for (int i = 0; i < npts; i++)
755  {
756  pos[i] = (i + 1.0) * dx;
757  }
758 
759  RealType eta0 = etaMO.phi(0.0);
760  ValueVector ELorig(npts);
761  CuspCorrection cusp(info(center_idx, mo_idx));
762  {
763  ScopedTimer local_timer(computeTimer);
764  minimizeForRc(cusp, phiMO, Z, rc, Rc_max, eta0, pos, ELcurr, ELideal);
765  }
766  // Update shared object. Each iteration accesses a different element and
767  // this is an array (no bookkeeping data to update), so no synchronization
768  // is necessary.
769  info(center_idx, mo_idx) = cusp.cparam;
770  }
771  }
772  }
773 
774  for (int root = 0; root < Comm.size(); root++)
775  {
776  int start_mo = offset[root];
777  int end_mo = offset[root + 1];
778  for (int mo_idx = start_mo; mo_idx < end_mo; mo_idx++)
779  {
780  for (int center_idx = 0; center_idx < num_centers; center_idx++)
781  {
782  broadcastCuspInfo(info(center_idx, mo_idx), Comm, root);
783  }
784  }
785  }
786 }
TimerType< ChronoClock > NewTimer
Definition: NewTimer.h:234
void minimizeForRc(CuspCorrection &cusp, OneMolecularOrbital &phiMO, RealType Z, RealType Rc_init, RealType Rc_max, RealType eta0, ValueVector &pos, ValueVector &ELcurr, ValueVector &ELideal)
Minimize chi2 with respect to Rc and phi at zero.
int rank() const
return the rank
Definition: Communicate.h:116
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
std::ostream & app_log()
Definition: OutputManager.h:65
ScopeGuard< NewTimer > ScopedTimer
Definition: NewTimer.h:257
void broadcastCuspInfo(CuspCorrectionParameters &param, Communicate &Comm, int root)
Broadcast cusp correction parameters.
OrbitalSetTraits< ValueType >::ValueVector ValueVector
int size() const
return the number of tasks
Definition: Communicate.h:118
void FairDivideLow(int ntot, int npart, IV &adist)
partition ntot elements among npart
Definition: FairDivide.h:114
NewTimer & createGlobalTimer(const std::string &myname, timer_levels mylevel)
QMCTraits::RealType RealType
GridType
The different types of grids that we currently allow.
Definition: Grid.h:29
void splitPhiEta(int center, const std::vector< bool > &corrCenter, LCAOrbitalSet &Phi, LCAOrbitalSet &Eta)
Divide molecular orbital into atomic S-orbitals on this center (phi), and everything else (eta)...

◆ generatePSetTimerNames()

static const TimerNameList_t<PSetTimers> qmcplusplus::generatePSetTimerNames ( std::string &  obj_name)
static

Definition at line 47 of file ParticleSet.cpp.

References PS_accept, PS_donePbyP, PS_dt_move, PS_loadWalker, PS_mw_copy, PS_newpos, and PS_update.

48 {
49  return {{PS_newpos, "ParticleSet:" + obj_name + "::computeNewPosDT"},
50  {PS_donePbyP, "ParticleSet:" + obj_name + "::donePbyP"},
51  {PS_accept, "ParticleSet:" + obj_name + "::acceptMove"},
52  {PS_loadWalker, "ParticleSet:" + obj_name + "::loadWalker"},
53  {PS_update, "ParticleSet:" + obj_name + "::update"},
54  {PS_dt_move, "ParticleSet:" + obj_name + "::dt_move"},
55  {PS_mw_copy, "ParticleSet:" + obj_name + "::mw_copy"}};
56 }

◆ generateRandomRotationMatrix()

QMCTraits::TensorType qmcplusplus::generateRandomRotationMatrix ( RandomBase< QMCTraits::FullPrecRealType > &  rng)
inline

Create a random 3D rotation matrix using a random generator.

Definition at line 25 of file RandomRotationMatrix.h.

Referenced by NonLocalECPotential::evalIonDerivsImpl(), SOECPotential::evaluateImpl(), NonLocalECPotential::evaluateImpl(), NonLocalECPotential::evaluateOneBodyOpMatrix(), NonLocalECPotential::evaluateOneBodyOpMatrixForceDeriv(), SOECPotential::evaluateValueAndDerivatives(), NonLocalECPotential::evaluateValueAndDerivatives(), SOECPotential::mw_evaluateImpl(), and NonLocalECPotential::mw_evaluateImpl().

26 {
27  auto rng1 = rng();
28  auto rng2 = rng();
29  auto rng3 = rng();
30  return generateRotationMatrix<QMCTraits::RealType>(rng1, rng2, rng3);
31  // The order of evaluation of function arguments is unspecified by the standard.
32  // The following code will cause failures in the deterministic tests.
33  // return generateRotationMatrix<QMCTraits::RealType>(rng(), rng(), rng());
34 }

◆ generateRotationMatrix()

Tensor<T, 3> qmcplusplus::generateRotationMatrix ( rng1,
rng2,
rng3 
)
inline

Create a random 3D rotation matrix from three random numbers.

Each input random number should be in the range [0,1). See the script Numerics/tests/derive_random_rotation.py for more information about the algorithm.

Definition at line 27 of file RotationMatrix3D.h.

References cos(), sin(), and sqrt().

28 {
29  // The angular values for a random rotation matrix
30  // phi : 0 to 2*pi
31  // psi : 0 to 2*pi
32  // cth : -1 to 1 (cth = cos(theta))
33  T phi(TWOPI * rng1);
34  T psi(TWOPI * rng2);
35  T cth(1.0 - 2 * rng3);
36  T sph(std::sin(phi)), cph(std::cos(phi));
37  T sth(std::sqrt(1.0 - cth * cth));
38  T sps(std::sin(psi)), cps(std::cos(psi));
39  // clang-format off
40  return Tensor<T,3>( cph * cth * cps - sph * sps,
41  sph * cth * cps + cph * sps,
42  -sth * cps,
43  -cph * cth * sps - sph * cps,
44  -sph * cth * sps + cph * cps,
45  sth * sps,
46  cph * sth,
47  sph * sth,
48  cth);
49  // clang-format on
50 }
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ get_first_address()

T* qmcplusplus::get_first_address ( ParticleAttrib< TinyVector< T, D >> &  a)
inline

◆ get_gridinfo_from_posgrid()

void get_gridinfo_from_posgrid ( const std::vector< PosType > &  posgridlist,
const IndexType axis,
RealType lx,
RealType rx,
RealType dx,
IndexType Nx 
)

Definition at line 6 of file FSUtilities.cpp.

Referenced by SkParserBase::compute_grid().

12 {
13  std::vector<RealType> kx;
14  kx.resize(posgridlist.size());
15 
16  for (IndexType i = 0; i < posgridlist.size(); i++)
17  kx[i] = posgridlist[i][axis];
18 
19  std::vector<RealType>::iterator it;
20 
21  std::sort(kx.begin(), kx.end());
22 
23  it = std::unique(kx.begin(), kx.end());
24 
25  lx = *(kx.begin());
26  rx = *(it - 1);
27  Nx = it - kx.begin();
28  dx = (rx - lx) / RealType(Nx - 1);
29 }
QMCTraits::IndexType IndexType
Definition: FSUtilities.h:11
QMCTraits::RealType RealType

◆ get_h5_datatype()

hid_t qmcplusplus::get_h5_datatype ( const T &  )
inline

map C types to hdf5 native types bool is explicit removed due to the fact that it is implementation-dependant

Referenced by h5d_append(), h5d_check_type(), h5d_read(), and h5d_write().

◆ get_last_address()

T* qmcplusplus::get_last_address ( ParticleAttrib< TinyVector< T, D >> &  a)
inline

Definition at line 102 of file ParticleAttrib.h.

Referenced by WalkerConfigurations::putConfigurations().

103 {
104  return &(a[0][0]) + D * a.size();
105 }

◆ get_leaf_name()

std::string qmcplusplus::get_leaf_name ( const std::string &  stack_name)

Definition at line 219 of file TimerManager.cpp.

Referenced by TimerManager< qmcplusplus::TimerType< CLOCK > >::output_timing(), and TimerManager< qmcplusplus::TimerType< CLOCK > >::print_stack().

220 {
221  int pos = stack_name.find_last_of(TIMER_STACK_SEPARATOR);
222  if (pos == std::string::npos)
223  return stack_name;
224 
225  return stack_name.substr(pos + 1, stack_name.length() - pos);
226 }

◆ get_level()

int qmcplusplus::get_level ( const std::string &  stack_name)

Definition at line 209 of file TimerManager.cpp.

Referenced by TimerManager< qmcplusplus::TimerType< CLOCK > >::collate_stack_profile(), TimerManager< qmcplusplus::TimerType< CLOCK > >::output_timing(), and TimerManager< qmcplusplus::TimerType< CLOCK > >::print_stack().

210 {
211  int level = 0;
212  for (int i = 0; i < stack_name.length(); i++)
213  if (stack_name[i] == TIMER_STACK_SEPARATOR)
214  level++;
215 
216  return level;
217 }

◆ get_two_species_particleset()

ParticleSet qmcplusplus::get_two_species_particleset ( const SimulationCell simulation_cell)

Definition at line 59 of file test_J2_derivatives.cpp.

References SpeciesSet::addSpecies(), ParticleSet::addTable(), ParticleSet::create(), ParticleSet::getSpeciesSet(), ParticleSet::R, ParticleSet::resetGroups(), ParticleSet::setName(), and ParticleSet::update().

Referenced by TEST_CASE().

60 {
61  ParticleSet elec(simulation_cell);
62  elec.setName("e");
63  elec.create({2, 2});
64 
65  elec.R[0] = {1.0, 0.0, 0.0};
66  elec.R[1] = {1.1, 1.0, 0.1};
67  elec.R[2] = {0.9, 0.8, 1.0};
68  elec.R[3] = {0.9, 0.5, 1.1};
69 
70  SpeciesSet& tspecies = elec.getSpeciesSet();
71  int upIdx = tspecies.addSpecies("u");
72  int downIdx = tspecies.addSpecies("d");
73  elec.resetGroups();
74 
75  elec.addTable(elec);
76  elec.update();
77 
78  return elec;
79 }

◆ getCUDAdeviceMemAllocated()

size_t qmcplusplus::getCUDAdeviceMemAllocated ( )
inline

Definition at line 35 of file CUDAallocator.hpp.

References CUDAallocator_device_mem_allocated.

Referenced by print_mem().

std::atomic< size_t > CUDAallocator_device_mem_allocated

◆ getCurrentLocalEnergy()

void getCurrentLocalEnergy ( const ValueVector pos,
RealType  Zeff,
RealType  Rc,
RealType  originalELatRc,
CuspCorrection cusp,
OneMolecularOrbital phiMO,
ValueVector ELcurr 
)

Compute effective local energy at vector of points.

Parameters
posinput vector of radial distances
Zeffeffective charge from getZeff
Rccutoff radius
originalELatRcLocal energy at the center from the uncorrected orbital
cuspcusp correction parameters
phiMOuncorrected orbital (S-orbitals on this center only)
ELcurroutput local energy at each distance in pos

Definition at line 374 of file CuspCorrectionConstruction.cpp.

References CuspCorrection::d2pr(), CuspCorrection::dpr(), qmcplusplus::Units::charge::e, OneMolecularOrbital::phi_vgl(), phiBar(), and CuspCorrection::Rr().

Referenced by evaluateForPhi0Body().

381 {
382  // assert(pos.size() == ELcurr.size());
383  ValueType val;
384  GradType grad;
385  ValueType lap;
386  phiMO.phi_vgl(Rc, val, grad, lap);
387  RealType dE = originalELatRc - (-0.5 * lap / val - Zeff / Rc);
388  for (int i = 0; i < pos.size(); i++)
389  {
390  RealType r = pos[i];
391  // prevent NaN's if phiBar is zero
392  RealType offset = 1e-12;
393  if (r <= Rc)
394  {
395  RealType dp = cusp.dpr(r);
396  ELcurr[i] = -0.5 * cusp.Rr(r) * (2.0 * dp / r + cusp.d2pr(r) + dp * dp) / (offset + phiBar(cusp, r, phiMO)) -
397  Zeff / r + dE;
398  }
399  else
400  {
401  phiMO.phi_vgl(pos[i], val, grad, lap);
402  ELcurr[i] = -0.5 * lap / val - Zeff / r + dE;
403  }
404  }
405 }
RealType phiBar(const CuspCorrection &cusp, RealType r, OneMolecularOrbital &phiMO)
LatticeGaussianProduct::GradType GradType
QMCTraits::RealType RealType
LatticeGaussianProduct::ValueType ValueType

◆ getDataShape()

bool qmcplusplus::getDataShape ( hid_t  grp,
const std::string &  aname,
std::vector< IT > &  sizes_out 
)
inline

free template function to read the (user) dimension and shape of the dataset.

The dimensions contributed by T is excluded.

Template Parameters
Tdata type supported by h5_space_type
Parameters
grpgroup id
anamename of the dataspace
sizes_outsizes of each direction. For a scalar, sizes_out.size() == 0
Returns
true if sizes_out is extracted successfully

For example, if the data on the file is Matrix<TinyVector<std::complex<double>, 3>> The dataset on the file has a rank of 2 (matrix) + 1 (TinyVector) + 1 (std::complex) + 0 (double) = 4 getDataShape<TinyVector<std::complex<double>, 3>> only returns the first 2 dimension getDataShape<std::complex<double>> only returns the first 3 dimension getDataShape<double> returns all the 4 dimension

Definition at line 45 of file hdf_wrapper_functions.h.

References rank.

46 {
47  using TSpaceType = h5_space_type<T, 0>;
48  TSpaceType TSpace;
49 
50  hid_t h1 = H5Dopen(grp, aname.c_str(), H5P_DEFAULT);
51  hid_t dataspace = H5Dget_space(h1);
52  int rank = H5Sget_simple_extent_ndims(dataspace);
53 
54  bool success = false;
55  if (h1 >= 0 && dataspace >= 0 && rank >= 0)
56  {
57  // check if the rank is sufficient to hold the data type
58  if (rank < TSpaceType::rank)
59  throw std::runtime_error(aname + " dataset is too small for the requested data type");
60  else
61  {
62  std::vector<hsize_t> sizes_in(rank);
63  int status_n = H5Sget_simple_extent_dims(dataspace, sizes_in.data(), NULL);
64 
65  // check if the lowest dimensions match the data type
66  int user_rank = rank - TSpaceType::added_rank();
67  bool size_match = true;
68  for (int dim = user_rank, dim_type = 0; dim < rank; dim++, dim_type++)
69  if (sizes_in[dim] != TSpace.dims[dim_type])
70  size_match = false;
71  if (!size_match)
72  throw std::runtime_error("The lower dimensions (container element type) of " + aname +
73  " dataset do not match the requested data type");
74  else
75  {
76  // save the sizes of each directions excluding dimensions contributed by the data type
77  sizes_out.resize(user_rank);
78  for (int dim = 0; dim < user_rank; dim++)
79  sizes_out[dim] = static_cast<IT>(sizes_in[dim]);
80  success = true;
81  }
82  }
83  }
84 
85  H5Sclose(dataspace);
86  H5Dclose(h1);
87  return success;
88 }

◆ getDriftScale()

T qmcplusplus::getDriftScale ( tau,
const ParticleAttrib< TinyVector< TG, D >> &  ga 
)
inline

Definition at line 24 of file DriftOperators.h.

References Dot(), and sqrt().

Referenced by setScaledDrift().

25 {
26  T vsq = Dot(ga, ga);
27  return (vsq < std::numeric_limits<T>::epsilon()) ? tau : ((-1.0 + std::sqrt(1.0 + 2.0 * tau * vsq)) / vsq);
28 }
T Dot(const ParticleAttrib< TinyVector< T, D >> &pa, const ParticleAttrib< TinyVector< T, D >> &pb)
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ getDualDeviceMemAllocated()

size_t qmcplusplus::getDualDeviceMemAllocated ( )
inline

Definition at line 34 of file DualAllocator.hpp.

References dual_device_mem_allocated.

34 { return dual_device_mem_allocated; }
std::atomic< size_t > dual_device_mem_allocated

◆ getELchi2()

RealType getELchi2 ( const ValueVector ELcurr,
const ValueVector ELideal 
)

Sum of squares difference between the current and ideal local energies This is the objective function to be minimized.

Parameters
Elcurrcurrent local energy
Elidealideal local energy

Definition at line 432 of file CuspCorrectionConstruction.cpp.

Referenced by evaluateForPhi0Body().

433 {
434  assert(ELcurr.size() == ELideal.size());
435 
436  RealType chi2 = 0.0;
437  for (int i = 0; i < ELcurr.size(); i++)
438  {
439  RealType diff = ELcurr[i] - ELideal[i];
440  chi2 += diff * diff;
441  }
442  return chi2;
443 }
QMCTraits::RealType RealType

◆ getGlobalTimerManager()

TimerManager< NewTimer > & getGlobalTimerManager ( )

Definition at line 44 of file TimerManager.cpp.

Referenced by createGlobalTimer(), main(), and QMCMain::QMCMain().

45 {
46  if (!global_timer_manager)
47  global_timer_manager = std::make_unique<TimerManager<NewTimer>>();
48  return *global_timer_manager;
49 }

◆ getIdealLocalEnergy()

void getIdealLocalEnergy ( const ValueVector pos,
RealType  Z,
RealType  Rc,
RealType  ELorigAtRc,
ValueVector ELideal 
)

Ideal local energy at a vector of points.

Parameters
posinput vector of radial distances
Znuclear charge
Rccutoff radius where the correction meets the actual orbital
ELorigAtRclocal energy at Rc. beta0 is adjusted to make energy continuous at Rc
ELideal- output the ideal local energy at pos values

Definition at line 317 of file CuspCorrectionConstruction.cpp.

References getOneIdealLocalEnergy().

Referenced by minimizeForPhiAtZero().

318 {
319  // assert(pos.size() == ELideal.size()
320  RealType beta0 = 0.0;
321  RealType tmp = getOneIdealLocalEnergy(Rc, Z, beta0);
322  beta0 = (ELorigAtRc - tmp) / (Z * Z);
323  for (int i = 0; i < pos.size(); i++)
324  {
325  ELideal[i] = getOneIdealLocalEnergy(pos[i], Z, beta0);
326  }
327 }
RealType getOneIdealLocalEnergy(RealType r, RealType Z, RealType beta0)
Ideal local energy at one point.
QMCTraits::RealType RealType

◆ getOffloadDevicePtr()

T* qmcplusplus::getOffloadDevicePtr ( T *  host_ptr)

Definition at line 38 of file OMPallocator.hpp.

Referenced by OMPallocator< Value >::allocate(), and OMPallocator< Value >::deallocate().

39 {
40  T* device_ptr;
41  PRAGMA_OFFLOAD("omp target data use_device_ptr(host_ptr)") { device_ptr = host_ptr; }
42  return device_ptr;
43 }

◆ getOMPdeviceMemAllocated()

size_t qmcplusplus::getOMPdeviceMemAllocated ( )
inline

Definition at line 35 of file OMPallocator.hpp.

References OMPallocator_device_mem_allocated.

Referenced by print_mem().

std::atomic< size_t > OMPallocator_device_mem_allocated

◆ getOneIdealLocalEnergy()

RealType getOneIdealLocalEnergy ( RealType  r,
RealType  Z,
RealType  beta0 
)

Ideal local energy at one point.

Parameters
rinput radial distance
Znuclear charge
beta0adjustable parameter to make energy continuous at Rc

Definition at line 303 of file CuspCorrectionConstruction.cpp.

Referenced by getIdealLocalEnergy().

304 {
305  RealType beta[7] = {3.25819, -15.0126, 33.7308, -42.8705, 31.2276, -12.1316, 1.94692};
306  RealType idealEL = beta0;
307  RealType r1 = r * r;
308  for (int i = 0; i < 7; i++)
309  {
310  idealEL += beta[i] * r1;
311  r1 *= r;
312  }
313  return idealEL * Z * Z;
314 }
QMCTraits::RealType RealType

◆ getOriginalLocalEnergy()

RealType getOriginalLocalEnergy ( const ValueVector pos,
RealType  Zeff,
RealType  Rc,
OneMolecularOrbital phiMO,
ValueVector Elorig 
)

Local energy from uncorrected orbital.

Parameters
posinput vector of radial distances
Zeffnuclear charge
Rccutoff radius
phiMOuncorrected orbital (S-orbitals on this center only)
ELorigoutput local energy at each distance in pos

Return is value of local energy at zero. This is the value needed for subsequent computations. The routine can be called with an empty vector of positions to get just this value.

Definition at line 408 of file CuspCorrectionConstruction.cpp.

References OneMolecularOrbital::phi_vgl().

Referenced by minimizeForPhiAtZero().

413 {
414  // assert(pos.size() == ELorig.size());
415 
416  ValueType val;
417  GradType grad;
418  ValueType lap;
419  for (int i = 0; i < pos.size(); i++)
420  {
421  RealType r = pos[i];
422  phiMO.phi_vgl(r, val, grad, lap);
423  ELorig[i] = -0.5 * lap / val - Zeff / r;
424  }
425 
426  phiMO.phi_vgl(Rc, val, grad, lap);
427  return -0.5 * lap / val - Zeff / Rc;
428 }
LatticeGaussianProduct::GradType GradType
QMCTraits::RealType RealType
LatticeGaussianProduct::ValueType ValueType

◆ getRatioByColSubstitution() [1/3]

T qmcplusplus::getRatioByColSubstitution ( const T *restrict  pinv,
const T *restrict  tc,
int  m,
int  colchanged 
)
inline

evaluate the determinant ratio with a column substitution

Definition at line 140 of file determinant_operators.h.

References BLAS::dot(), and qmcplusplus::Units::distance::m.

141 {
142  return BLAS::dot(m, pinv + colchanged, m, tc, 1);
143 }
static T dot(int n, const T *restrict a, const T *restrict b)
Definition: BLAS.hpp:304

◆ getRatioByColSubstitution() [2/3]

MAT::value_type qmcplusplus::getRatioByColSubstitution ( const MAT &  pinv,
const VV &  tc,
int  colchanged 
)
inline

Definition at line 146 of file determinant_operators.h.

References BLAS::dot().

147 {
148  return BLAS::dot(pinv.cols(), pinv.data() + colchanged, pinv.cols(), tc.data(), 1);
149 }
static T dot(int n, const T *restrict a, const T *restrict b)
Definition: BLAS.hpp:304

◆ getRatioByColSubstitution() [3/3]

MAT::value_type qmcplusplus::getRatioByColSubstitution ( const MAT &  refinv,
const VV &  tcm,
VV &  ratios,
int  m,
int  colchanged,
int  r_replaced,
IV &  ind 
)
inline

evaluate the ratio with a column substitution and multiple row substitutions

Parameters
refinvreference inverse(m,m)
tcmnew column whose size > m
ratiosratios of the row substitutions with the column substitution
mdimension
colchangedratio with a column substitution of refinv
r_replacedrow index for the excitations in ind
indindexes for the excited states (rows)
Returns
the ratio when a column is replaced for the refinv

Definition at line 164 of file determinant_operators.h.

References BLAS::dot(), and qmcplusplus::Units::distance::m.

171 {
172  using value_type = typename MAT::value_type;
173  //save the value of refinv(r,c)
174  value_type old_v = refinv(r_replaced, colchanged);
175  value_type pinned = tcm[r_replaced] * old_v;
176  typename MAT::value_type res0 = BLAS::dot(m, refinv.data() + colchanged, m, tcm.data(), 1);
177  for (int i = 0; i < ind.size(); ++i)
178  ratios[i] = res0 - pinned + old_v * tcm[ind[i] + m];
179  return res0;
180 }
static T dot(int n, const T *restrict a, const T *restrict b)
Definition: BLAS.hpp:304
QMCTraits::FullPrecRealType value_type

◆ getRatiosByRowSubstitution() [1/2]

void qmcplusplus::getRatiosByRowSubstitution ( const T *restrict  tm_new,
const T *restrict  r_replaced,
T *restrict  ratios,
int  m,
int  howmany 
)
inline

Definition at line 106 of file determinant_operators.h.

References BLAS::gemv(), and qmcplusplus::Units::distance::m.

111 {
112  BLAS::gemv('T', m, howmany, const_one(T()), tm_new, m, r_replaced, 1, T(), ratios, 1);
113 }
static void gemv(int n, int m, const double *restrict amat, const double *restrict x, double *restrict y)
Definition: BLAS.hpp:118

◆ getRatiosByRowSubstitution() [2/2]

void qmcplusplus::getRatiosByRowSubstitution ( const T *restrict  tm_new,
const T *restrict  r_replaced,
T *restrict  ratios,
int  m,
const INDARRAY &  ind 
)
inline

Definition at line 116 of file determinant_operators.h.

References BLAS::dot(), and qmcplusplus::Units::distance::m.

121 {
122  for (int i = 0; i < ind.size(); ++i)
123  ratios[i] = BLAS::dot(r_replaced, tm_new + ind[i] * m, m);
124 }
static T dot(int n, const T *restrict a, const T *restrict b)
Definition: BLAS.hpp:304

◆ getRatiosByRowSubstitution_dummy()

void qmcplusplus::getRatiosByRowSubstitution_dummy ( const T *restrict  tm_new,
const T *restrict  r_replaced,
T *restrict  ratios,
int  m,
int  howmany 
)
inline

Definition at line 127 of file determinant_operators.h.

References BLAS::dot(), and qmcplusplus::Units::distance::m.

132 {
133  for (int i = 0; i < howmany; ++i)
134  ratios[i] = BLAS::dot(r_replaced, tm_new + i * m, m);
135 }
static T dot(int n, const T *restrict a, const T *restrict b)
Definition: BLAS.hpp:304

◆ getScaledDrift()

void qmcplusplus::getScaledDrift ( Tt  tau,
const TinyVector< TG, D > &  qf,
TinyVector< T, D > &  drift 
)
inline

evaluate a drift with a real force

Parameters
tautimestep
qfquantum force
drift

Definition at line 36 of file DriftOperators.h.

References convertToReal(), dot(), and sqrt().

Referenced by DMCUpdatePbyPL2::advanceWalker(), and assignDrift().

37 {
38  //We convert the complex gradient to real and temporarily store in drift.
39  convertToReal(qf, drift);
40  T vsq = dot(drift, drift);
41  T sc = (vsq < std::numeric_limits<T>::epsilon()) ? tau : ((-1.0 + std::sqrt(1.0 + 2.0 * tau * vsq)) / vsq);
42  //Apply the umrigar scaled drift.
43  drift *= sc;
44 }
T dot(T *a, T *b)
void convertToReal(const T1 &in, T2 &out)
generic conversion from type T1 to type T2 using implicit conversion
Definition: ConvertToReal.h:32
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ getScaledDriftL2()

void qmcplusplus::getScaledDriftL2 ( Tt  tau,
const TinyVector< TG, D > &  qf,
const Tensor< T, D > &  Dmat,
TinyVector< T, D > &  Kvec,
TinyVector< T, D > &  drift 
)
inline

evaluate a drift with a real force with rescaling for an L2 potential

Parameters
tautimestep
qfquantum force
drift

Definition at line 52 of file DriftOperators.h.

References convertToReal(), dot(), and sqrt().

Referenced by DMCUpdatePbyPL2::advanceWalker().

53 {
54  //We convert the complex gradient to real and temporarily store in drift.
55  convertToReal(qf, drift);
56  //modify the bare drift in the presence of L2 potentials
57  drift = dot(Dmat, drift) - Kvec;
58  T vsq = dot(drift, drift);
59  T sc = (vsq < std::numeric_limits<T>::epsilon()) ? tau : ((-1.0 + std::sqrt(1.0 + 2.0 * tau * vsq)) / vsq);
60  //Apply the umrigar scaled drift.
61  drift *= sc;
62 }
T dot(T *a, T *b)
void convertToReal(const T1 &in, T2 &out)
generic conversion from type T1 to type T2 using implicit conversion
Definition: ConvertToReal.h:32
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ getSplineBound()

void qmcplusplus::getSplineBound ( const T  x,
const int  nmax,
int &  ind,
TRESIDUAL &  dx 
)
inline

break x into the integer part and residual part and apply bounds

Parameters
xinput coordinate
nmaxinput upper bound of the integer part
indoutput integer part
dxoutput fractional part

x in the range of [0, nmax+1) will be split correctly. x < 0, ind = 0, dx = 0 x >= nmax+1, ind = nmax, dx = 1 - epsilon

Attention: nmax is not the number grid points but the maximum allowed grid index For example, ng is the number of grid point. the actual grid points indices are 0, 1, ..., ng - 1. In a periodic/anti periodic spline, set nmax = ng - 1 In a natural boundary spline, set nmax = ng - 2 because the end point should be excluded and the last grid point has an index ng - 2.

Definition at line 37 of file SplineBound.hpp.

References floor().

Referenced by BsplineFunctor< REAL >::evaluate(), BsplineFunctor< REAL >::evaluate_impl(), BsplineFunctor< REAL >::evaluateDerivatives(), BsplineFunctor< REAL >::evaluateV(), BsplineFunctor< REAL >::evaluateVGL(), and test_spline_bounds().

38 {
39  // lower bound
40  if (x < 0)
41  {
42  ind = 0;
43  dx = T(0);
44  }
45  else
46  {
47 #if defined(__INTEL_LLVM_COMPILER) || defined(__INTEL_CLANG_COMPILER)
48  T ipart = std::floor(x);
49  dx = x - ipart;
50 #else
51  T ipart;
52  dx = std::modf(x, &ipart);
53 #endif
54  ind = static_cast<int>(ipart);
55  // upper bound
56  if (ind > nmax)
57  {
58  ind = nmax;
59  dx = T(1) - std::numeric_limits<T>::epsilon();
60  }
61  }
62 }
MakeReturn< UnaryNode< FnFloor, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t floor(const Vector< T1, C1 > &l)

◆ getSplinedSOPot()

QMCTraits::RealType qmcplusplus::getSplinedSOPot ( SOECPComponent so_comp,
int  l,
double  r 
)

Definition at line 44 of file test_ecp.cpp.

References SOECPComponent::sopp_m_.

Referenced by TEST_CASE().

44 { return so_comp->sopp_m_[l]->splint(r); }

◆ getStats()

void getStats ( const std::vector< RealType > &  vals,
RealType avg,
RealType err,
int  start = 0 
)

Simpleaverage and error estimate.

input array of values to be averaged. returns avg and err. Can pass a start index to average from "start" to the end of the array

Definition at line 31 of file FSUtilities.cpp.

References n, and sqrt().

Referenced by QMCFiniteSize::calcLeadingOrderCorrections(), QMCFiniteSize::calcPotentialCorrection(), estimateEquilibration(), and SkParserHDF5::parse().

32 {
33  avg = 0.0;
34  int n = 0;
35  for (int i = start; i < vals.size(); i++)
36  {
37  avg += vals[i];
38  n++;
39  }
40  avg /= n;
41  err = 0.0;
42  for (int i = start; i < vals.size(); i++)
43  {
44  err += (vals[i] - avg) * (vals[i] - avg);
45  }
46  err /= n;
47  err = std::sqrt(err);
48 }
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ getSYCLDefaultDeviceDefaultQueue()

◆ getSYCLdeviceFreeMem()

size_t getSYCLdeviceFreeMem ( )

query free memory on the default device

Definition at line 31 of file SYCLruntime.cpp.

References getSYCLDefaultDeviceDefaultQueue().

Referenced by print_mem().

32 {
33  auto device = getSYCLDefaultDeviceDefaultQueue().get_device();
34  if (device.has(sycl::aspect::ext_intel_free_memory))
35  return getSYCLDefaultDeviceDefaultQueue().get_device().get_info<sycl::ext::intel::info::device::free_memory>();
36  else
37  return 0;
38 }
sycl::queue & getSYCLDefaultDeviceDefaultQueue()
return a reference to the per-device default queue
Definition: SYCLruntime.cpp:18

◆ getSYCLdeviceMemAllocated()

size_t qmcplusplus::getSYCLdeviceMemAllocated ( )
inline

Definition at line 37 of file SYCLallocator.hpp.

References SYCLallocator_device_mem_allocated.

Referenced by print_mem().

std::atomic< size_t > SYCLallocator_device_mem_allocated

◆ getTestCaseForWeights()

auto qmcplusplus::getTestCaseForWeights ( Real  value1,
Real  value2,
Real  value3 
)

just set the values to test the electron weights

Definition at line 309 of file test_bare_kinetic.cpp.

References CHECK().

Referenced by TEST_CASE().

310 {
311  return [value1, value2,
312  value3](RefVectorWithLeader<OperatorBase>& o_list, RefVectorWithLeader<TrialWaveFunction>& twf_list,
313  RefVectorWithLeader<ParticleSet>& p_list, Matrix<Real>& kinetic_energies,
314  std::vector<ListenerVector<Real>>& listeners, std::vector<ListenerVector<Real>>& ion_listeners) {
315  auto& bare_ke = o_list[0];
316  bare_ke.mw_evaluatePerParticle(o_list, twf_list, p_list, listeners, ion_listeners);
317  CHECK(bare_ke.getValue() == Approx(value1));
318  auto& bare_ke2 = o_list[1];
319  CHECK(bare_ke2.getValue() == Approx(value1));
320  // Check that the sum of the particle energies is consistent with the total.
321  CHECK(std::accumulate(kinetic_energies.begin(), kinetic_energies.begin() + kinetic_energies.cols(), 0.0) ==
322  Approx(bare_ke.getValue()));
323  // check a single particle
324  CHECK(std::accumulate(kinetic_energies[1], kinetic_energies[1] + kinetic_energies.cols(), 0.0) == Approx(value1));
325 
326  auto& elec = p_list[0];
327  elec.L[0] = 2.0;
328  elec.L[1] = 1.0;
329  auto& elec2 = p_list[1];
330  elec2.L[0] = 2.0;
331  elec2.L[1] = 1.0;
332 
333  bare_ke.mw_evaluatePerParticle(o_list, twf_list, p_list, listeners, ion_listeners);
334  CHECK(std::accumulate(kinetic_energies.begin(), kinetic_energies.begin() + kinetic_energies.cols(), 0.0) ==
335  Approx(bare_ke.getValue()));
336  CHECK(std::accumulate(kinetic_energies[1], kinetic_energies[1] + kinetic_energies.cols(), 0.0) == Approx(value2));
337 
338  // test that mw_evaluatePerParticleWithToperator decays to mw_evaluatePerParticle
339  // If mw_evaluatePerParticle follows the standard behavior in OperatorBase the Listner will not receive a report
340  // and tis values will remain as in the previous check.
341  elec.L[0] = 1.0;
342  elec.L[1] = 0.0;
343  elec2.L[0] = 1.0;
344  elec2.L[1] = 0.0;
345 
346  bare_ke.mw_evaluatePerParticleWithToperator(o_list, twf_list, p_list, listeners, ion_listeners);
347  CHECK(std::accumulate(kinetic_energies[1], kinetic_energies[1] + kinetic_energies.cols(), 0.0) == Approx(value3));
348  };
349 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ getUnscaledDrift()

void qmcplusplus::getUnscaledDrift ( Tt  tau,
const TinyVector< TG, D > &  qf,
TinyVector< T, D > &  drift 
)
inline

evaluate a drift with a real force and no rescaling

Parameters
tautimestep
qfquantum force
drift

Definition at line 70 of file DriftOperators.h.

References convertToReal().

71 {
72  //We convert the complex gradient to real and temporarily store in drift.
73  convertToReal(qf, drift);
74  drift *= tau;
75 }
void convertToReal(const T1 &in, T2 &out)
generic conversion from type T1 to type T2 using implicit conversion
Definition: ConvertToReal.h:32

◆ getZeff()

RealType getZeff ( RealType  Z,
RealType  etaAtZero,
RealType  phiBarAtZero 
)

Effective nuclear charge to keep effective local energy finite at zero.

Parameters
Znuclear charge
etaAtZerovalue of non-S orbitals at this center
phiBarAtZerovalue of corrected orbital at zero

Definition at line 362 of file CuspCorrectionConstruction.cpp.

Referenced by evaluateForPhi0Body(), and minimizeForPhiAtZero().

362 { return Z * (1.0 + etaAtZero / phiBarAtZero); }

◆ h5d_append()

bool qmcplusplus::h5d_append ( hid_t  grp,
const std::string &  aname,
hsize_t &  current,
hsize_t  ndims,
const hsize_t *const  dims,
const T *const  first,
hsize_t  chunk_size = 1,
hid_t  xfer_plist = H5P_DEFAULT 
)
inline

Definition at line 399 of file hdf_wrapper_functions.h.

References dims, and get_h5_datatype().

Referenced by ObservableHelper::write(), TraceBuffer< TraceInt >::write_hdf(), and WalkerLogBuffer< WLog::Real >::writeHDF().

407 {
408  //app_log()<<omp_get_thread_num()<<" h5d_append group = "<<grp<<" name = "<<aname.c_str()<< std::endl;
409  if (grp < 0)
410  return true;
411  hid_t h5d_type_id = get_h5_datatype(*first);
412  hid_t dataspace;
413  hid_t memspace;
414  hid_t dataset = H5Dopen(grp, aname.c_str(), H5P_DEFAULT);
415  std::vector<hsize_t> max_dims(ndims);
416  max_dims[0] = H5S_UNLIMITED;
417  for (int d = 1; d < ndims; ++d)
418  max_dims[d] = dims[d];
419  herr_t ret = -1;
420  if (dataset < 0) //missing create one
421  {
422  //set file pointer
423  current = 0;
424  // set max and chunk dims
425  std::vector<hsize_t> chunk_dims(ndims);
426  chunk_dims[0] = chunk_size;
427  for (int d = 1; d < ndims; ++d)
428  chunk_dims[d] = dims[d];
429  // create a dataspace sized to the current buffer
430  dataspace = H5Screate_simple(ndims, dims, max_dims.data());
431  // create dataset property list
432  hid_t p = H5Pcreate(H5P_DATASET_CREATE);
433  // set layout (chunked, contiguous)
434  hid_t sl = H5Pset_layout(p, H5D_CHUNKED);
435  // set chunk size
436  hid_t cs = H5Pset_chunk(p, ndims, chunk_dims.data());
437  // create the dataset
438  dataset = H5Dcreate(grp, aname.c_str(), h5d_type_id, dataspace, H5P_DEFAULT, p, H5P_DEFAULT);
439  // create memory dataspace, size of current buffer
440  memspace = H5Screate_simple(ndims, dims, NULL);
441  // write the data for the first time
442  ret = H5Dwrite(dataset, h5d_type_id, memspace, dataspace, xfer_plist, first);
443  // update the "file pointer"
444  current = dims[0];
445 
446  //app_log()<<" creating dataset"<< std::endl;
447  //if(dataspace<0) app_log()<<" dataspace could not be created"<< std::endl;
448  //else app_log()<<" dataspace creation successful"<< std::endl;
449  //if(p<0) app_log()<<" property list could not be created"<< std::endl;
450  //else app_log()<<" property list creation successful"<< std::endl;
451  //if(sl<0) app_log()<<" layout could not be set"<< std::endl;
452  //else app_log()<<" layout set successfully"<< std::endl;
453  //if(cs<0) app_log()<<" chunk size could not be set"<< std::endl;
454  //else app_log()<<" chunk size set successfully"<< std::endl;
455  //if(dataset<0) app_log()<<" dataset could not be created"<< std::endl;
456  //else app_log()<<" dataset creation successful"<< std::endl;
457  //if(memspace<0) app_log()<<" memspace could not be created"<< std::endl;
458  //else app_log()<<" memspace creation successful"<< std::endl;
459  //if(ret<0) app_log()<<" data could not be written"<< std::endl;
460  //else app_log()<<" data write successful"<< std::endl;
461  //H5Eprint(NULL);
462 
463  // close the property list
464  H5Pclose(p);
465  }
466  else
467  {
468  // new end of file
469  std::vector<hsize_t> start(ndims);
470  std::vector<hsize_t> end(ndims);
471  for (int d = 1; d < ndims; ++d)
472  {
473  start[d] = 0;
474  end[d] = dims[d];
475  }
476  start[0] = current;
477  end[0] = start[0] + dims[0];
478  //extend the dataset (file)
479  herr_t he = H5Dset_extent(dataset, end.data());
480  //get the corresponding dataspace (filespace)
481  dataspace = H5Dget_space(dataset);
482  //set the extent
483  herr_t hse = H5Sset_extent_simple(dataspace, ndims, end.data(), max_dims.data());
484  //select hyperslab/slice of multidimensional data for appended write
485  const std::vector<hsize_t> ones(ndims, 1);
486  herr_t hsh = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start.data(), NULL, ones.data(), dims);
487  //create memory space describing current data block
488  memspace = H5Screate_simple(ndims, dims, NULL);
489  //append the datablock to the dataset
490  ret = H5Dwrite(dataset, h5d_type_id, memspace, dataspace, H5P_DEFAULT, first);
491  // update the "file pointer"
492  current = end[0];
493 
494  //app_log()<<" appending to dataset"<< std::endl;
495  //app_log()<<" ndims = "<<ndims<< std::endl;
496  //app_log()<<" dims = "<<dims[0]<<" "<<dims[1]<< std::endl;
497  //app_log()<<" start = "<<start[0]<<" "<<start[1]<< std::endl;
498  //app_log()<<" end = "<<end[0]<<" "<<end[1]<< std::endl;
499  //app_log()<<" current = "<<current<<" "<<&current<< std::endl;
500  //if(hse<0) app_log()<<" set_extent failed"<< std::endl;
501  //else app_log()<<" set_extent successful"<< std::endl;
502  //if(hsh<0) app_log()<<" select_hyperslab failed"<< std::endl;
503  //else app_log()<<" select_hyperslab successful"<< std::endl;
504  //if(he<0) app_log()<<" extend failed"<< std::endl;
505  //else app_log()<<" extend successful"<< std::endl;
506  //if(dataspace<0) app_log()<<" dataspace could not be gotten"<< std::endl;
507  //else app_log()<<" dataspace get successful"<< std::endl;
508  //if(memspace<0) app_log()<<" memspace could not be created"<< std::endl;
509  //else app_log()<<" memspace creation successful"<< std::endl;
510  //if(ret<0) app_log()<<" data could not be written"<< std::endl;
511  //else app_log()<<" data write successful"<< std::endl;
512  //H5Eprint(NULL);
513  }
514  // cleanup
515  H5Sclose(memspace);
516  H5Sclose(dataspace);
517  H5Dclose(dataset);
518  return ret != -1;
519 }
std::vector< int > dims
hid_t get_h5_datatype(const T &)
map C types to hdf5 native types bool is explicit removed due to the fact that it is implementation-d...

◆ h5d_check_existence()

bool qmcplusplus::h5d_check_existence ( hid_t  grp,
const std::string &  aname 
)
inline

Definition at line 136 of file hdf_wrapper_functions.h.

Referenced by h5data_proxy< T >::check_existence().

137 {
138  if (grp < 0)
139  return true;
140  hid_t h1 = H5Dopen(grp, aname.c_str(), H5P_DEFAULT);
141  if (h1 < 0)
142  {
143  H5Dclose(h1);
144  return false;
145  }
146  H5Dclose(h1);
147  return true;
148 }

◆ h5d_check_type()

bool qmcplusplus::h5d_check_type ( hid_t  grp,
const std::string &  aname 
)
inline

Definition at line 151 of file hdf_wrapper_functions.h.

References get_h5_datatype().

152 {
153  if (grp < 0)
154  return true;
155  hid_t h1 = H5Dopen(grp, aname.c_str(), H5P_DEFAULT);
156  T temp(0);
157  hid_t h5d_type_id = get_h5_datatype(temp);
158  hid_t datatype = H5Dget_type(h1);
159  if (datatype == H5I_INVALID_HID)
160  throw std::runtime_error(aname + " dataset either does not exist or there was an error determining its type.");
161  htri_t equality_check = H5Tequal(datatype, h5d_type_id);
162  H5Dclose(h1);
163  switch (equality_check)
164  {
165  case 1:
166  return true;
167  case 0:
168  return false;
169  default:
170  throw std::runtime_error("Type comparison attempted with an invalid type or nonexistent dataset " + aname);
171  }
172 }
hid_t get_h5_datatype(const T &)
map C types to hdf5 native types bool is explicit removed due to the fact that it is implementation-d...

◆ h5d_read() [1/3]

bool qmcplusplus::h5d_read ( hid_t  grp,
const std::string &  aname,
T *  first,
hid_t  xfer_plist 
)
inline

return true, if successful

Definition at line 123 of file hdf_wrapper_functions.h.

References get_h5_datatype().

Referenced by h5data_proxy< Vector< T > >::read(), h5data_proxy< std::vector< T > >::read(), h5data_proxy< T >::read(), h5data_proxy< boost::multi::array< T, 1, Alloc > >::read(), h5data_proxy< bool >::read(), h5data_proxy< Matrix< T > >::read(), h5data_proxy< accumulator_set< T > >::read(), h5data_proxy< boost::multi::array< T, 2, Alloc > >::read(), h5data_proxy< std::vector< bool > >::read(), h5data_proxy< Array< T, D > >::read(), h5data_proxy< boost::multi::array_ref< T, 1, Ptr > >::read(), h5data_proxy< double_hyperslab_proxy< CT, MAXDIM > >::read(), h5data_proxy< boost::multi::array_ref< T, 2, Ptr > >::read(), and h5data_proxy< hyperslab_proxy< CT, RANK > >::read().

124 {
125  if (grp < 0)
126  return true;
127  hid_t h1 = H5Dopen(grp, aname.c_str(), H5P_DEFAULT);
128  if (h1 < 0)
129  return false;
130  hid_t h5d_type_id = get_h5_datatype(*first);
131  herr_t ret = H5Dread(h1, h5d_type_id, H5S_ALL, H5S_ALL, xfer_plist, first);
132  H5Dclose(h1);
133  return ret != -1;
134 }
hid_t get_h5_datatype(const T &)
map C types to hdf5 native types bool is explicit removed due to the fact that it is implementation-d...

◆ h5d_read() [2/3]

bool qmcplusplus::h5d_read ( hid_t  grp,
const std::string &  aname,
hsize_t  ndims,
const hsize_t *  gcounts,
const hsize_t *  counts,
const hsize_t *  offsets,
T *  first,
hid_t  xfer_plist 
)

return true, if successful

Definition at line 210 of file hdf_wrapper_functions.h.

References get_h5_datatype().

218 {
219  if (grp < 0)
220  return true;
221  hid_t h1 = H5Dopen(grp, aname.c_str(), H5P_DEFAULT);
222  if (h1 < 0)
223  return false;
224  //herr_t ret = H5Dread(h1, h5d_type_id, H5S_ALL, H5S_ALL, xfer_plist, first);
225 
226  hid_t dataspace = H5Dget_space(h1);
227  hid_t memspace = H5Screate_simple(ndims, counts, NULL);
228  // According to the HDF5 manual (https://support.hdfgroup.org/HDF5/doc/RM/H5S/H5Sselect_hyperslab.htm)
229  // , the fifth argument (count) means the number of hyper-slabs to select along each dimensions
230  // while the sixth argument (block) is the size of each hyper-slab.
231  // To write a single hyper-slab of size counts in a dataset, we call
232  // H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offsets, NULL, ones.data(), counts);
233  // The vector "ones" means we want to write one hyper-slab (block) along each dimensions.
234  // The result is equivalent to calling
235  // H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offsets, NULL, counts, NULL);
236  // , but it implies writing count hyper-slabs along each dimension and each hyper-slab is of size one.
237  const std::vector<hsize_t> ones(ndims, 1);
238  herr_t ret = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offsets, NULL, ones.data(), counts);
239 
240  hid_t h5d_type_id = get_h5_datatype(*first);
241  ret = H5Dread(h1, h5d_type_id, memspace, dataspace, xfer_plist, first);
242 
243  H5Sclose(dataspace);
244  H5Sclose(memspace);
245 
246  H5Dclose(h1);
247  return ret != -1;
248 }
hid_t get_h5_datatype(const T &)
map C types to hdf5 native types bool is explicit removed due to the fact that it is implementation-d...

◆ h5d_read() [3/3]

bool qmcplusplus::h5d_read ( hid_t  grp,
const std::string &  aname,
hsize_t  ndims,
const hsize_t *  gcounts,
const hsize_t *  counts,
const hsize_t *  offsets,
hsize_t  mem_ndims,
const hsize_t *  mem_gcounts,
const hsize_t *  mem_counts,
const hsize_t *  mem_offsets,
T *  first,
hid_t  xfer_plist 
)

return true, if successful

Definition at line 302 of file hdf_wrapper_functions.h.

References get_h5_datatype().

314 {
315  if (grp < 0)
316  return true;
317  hid_t h1 = H5Dopen(grp, aname.c_str(), H5P_DEFAULT);
318  if (h1 < 0)
319  return false;
320 
321  hid_t dataspace = H5Dget_space(h1);
322  if (ndims != H5Sget_simple_extent_ndims(dataspace))
323  throw std::runtime_error(aname + " dataspace does not match ");
324  // check gcounts???
325  const std::vector<hsize_t> ones(std::max(ndims, mem_ndims), 1);
326  herr_t ret = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offsets, NULL, ones.data(), counts);
327 
328  hid_t memspace = H5Screate_simple(mem_ndims, mem_gcounts, NULL);
329  herr_t mem_ret = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, mem_offsets, NULL, ones.data(), mem_counts);
330 
331  hid_t h5d_type_id = get_h5_datatype(*first);
332  ret = H5Dread(h1, h5d_type_id, memspace, dataspace, xfer_plist, first);
333 
334  H5Sclose(dataspace);
335  H5Sclose(memspace);
336 
337  H5Dclose(h1);
338  return ret != -1;
339 }
hid_t get_h5_datatype(const T &)
map C types to hdf5 native types bool is explicit removed due to the fact that it is implementation-d...

◆ h5d_write() [1/3]

bool qmcplusplus::h5d_write ( hid_t  grp,
const std::string &  aname,
hsize_t  ndims,
const hsize_t *  dims,
const T *  first,
hid_t  xfer_plist 
)
inline

Definition at line 175 of file hdf_wrapper_functions.h.

References dims, and get_h5_datatype().

Referenced by h5data_proxy< Vector< T > >::write(), h5data_proxy< std::vector< T > >::write(), h5data_proxy< T >::write(), h5data_proxy< boost::multi::array< T, 1, Alloc > >::write(), h5data_proxy< accumulator_set< T > >::write(), h5data_proxy< Matrix< T > >::write(), h5data_proxy< bool >::write(), h5data_proxy< boost::multi::array< T, 2, Alloc > >::write(), h5data_proxy< std::vector< bool > >::write(), h5data_proxy< Array< T, D > >::write(), h5data_proxy< boost::multi::array_ref< T, 1, Ptr > >::write(), h5data_proxy< double_hyperslab_proxy< CT, MAXDIM > >::write(), h5data_proxy< boost::multi::array_ref< T, 2, Ptr > >::write(), and h5data_proxy< hyperslab_proxy< CT, RANK > >::write().

181 {
182  if (grp < 0)
183  return true;
184  hid_t h5d_type_id = get_h5_datatype(*first);
185  hid_t h1 = H5Dopen(grp, aname.c_str(), H5P_DEFAULT);
186  herr_t ret = -1;
187  if (h1 < 0) //missing create one
188  {
189  hid_t dataspace = H5Screate_simple(ndims, dims, NULL);
190  hid_t dataset = H5Dcreate(grp, aname.c_str(), h5d_type_id, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
191  ret = H5Dwrite(dataset, h5d_type_id, H5S_ALL, H5S_ALL, xfer_plist, first);
192  H5Sclose(dataspace);
193  H5Dclose(dataset);
194  }
195  else
196  {
197  ret = H5Dwrite(h1, h5d_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, first);
198  }
199  H5Dclose(h1);
200  return ret != -1;
201 }
std::vector< int > dims
hid_t get_h5_datatype(const T &)
map C types to hdf5 native types bool is explicit removed due to the fact that it is implementation-d...

◆ h5d_write() [2/3]

bool qmcplusplus::h5d_write ( hid_t  grp,
const std::string &  aname,
hsize_t  ndims,
const hsize_t *  gcounts,
const hsize_t *  counts,
const hsize_t *  offsets,
const T *  first,
hid_t  xfer_plist 
)
inline

Definition at line 252 of file hdf_wrapper_functions.h.

References get_h5_datatype().

260 {
261  if (grp < 0)
262  return true;
263  hid_t h5d_type_id = get_h5_datatype(*first);
264  hid_t h1 = H5Dopen(grp, aname.c_str(), H5P_DEFAULT);
265  hid_t filespace, memspace;
266  herr_t ret = -1;
267 
268  const std::vector<hsize_t> ones(ndims, 1);
269  if (h1 < 0) //missing create one
270  {
271  hid_t dataspace = H5Screate_simple(ndims, gcounts, NULL);
272  hid_t dataset = H5Dcreate(grp, aname.c_str(), h5d_type_id, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
273 
274  hid_t filespace = H5Dget_space(dataset);
275  ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offsets, NULL, ones.data(), counts);
276 
277  hid_t memspace = H5Screate_simple(ndims, counts, NULL);
278  ret = H5Dwrite(dataset, h5d_type_id, memspace, filespace, xfer_plist, first);
279 
280  H5Dclose(memspace);
281  H5Sclose(filespace);
282  H5Dclose(dataset);
283  H5Sclose(dataspace);
284  }
285  else
286  {
287  filespace = H5Dget_space(h1);
288  ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offsets, NULL, ones.data(), counts);
289 
290  memspace = H5Screate_simple(ndims, counts, NULL);
291  ret = H5Dwrite(h1, h5d_type_id, memspace, filespace, xfer_plist, first);
292 
293  H5Sclose(filespace);
294  H5Dclose(memspace);
295  }
296  H5Dclose(h1);
297  return ret != -1;
298 }
hid_t get_h5_datatype(const T &)
map C types to hdf5 native types bool is explicit removed due to the fact that it is implementation-d...

◆ h5d_write() [3/3]

bool qmcplusplus::h5d_write ( hid_t  grp,
const std::string &  aname,
hsize_t  ndims,
const hsize_t *  gcounts,
const hsize_t *  counts,
const hsize_t *  offsets,
hsize_t  mem_ndims,
const hsize_t *  mem_gcounts,
const hsize_t *  mem_counts,
const hsize_t *  mem_offsets,
const T *  first,
hid_t  xfer_plist 
)
inline

Definition at line 342 of file hdf_wrapper_functions.h.

References get_h5_datatype().

354 {
355  if (grp < 0)
356  return true;
357  std::cout << " h5d_write: " << mem_ndims << " " << *mem_gcounts << " " << *(mem_gcounts + 1) << " "
358  << *(mem_gcounts + 2) << " " << *mem_counts << " " << *(mem_counts + 1) << " " << *(mem_counts + 2) << " "
359  << *mem_offsets << " " << *(mem_offsets + 1) << " " << *(mem_offsets + 2) << " " << std::endl;
360  hid_t h5d_type_id = get_h5_datatype(*first);
361  hid_t h1 = H5Dopen(grp, aname.c_str(), H5P_DEFAULT);
362  herr_t ret = -1;
363 
364  const std::vector<hsize_t> ones(std::max(ndims, mem_ndims), 1);
365  if (h1 < 0) //missing create one
366  {
367  hid_t dataspace = H5Screate_simple(ndims, gcounts, NULL);
368  hid_t dataset = H5Dcreate(grp, aname.c_str(), h5d_type_id, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
369 
370  hid_t filespace = H5Dget_space(dataset);
371  ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offsets, NULL, ones.data(), counts);
372 
373  hid_t memspace = H5Screate_simple(mem_ndims, mem_gcounts, NULL);
374  ret = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, mem_offsets, NULL, ones.data(), mem_counts);
375  ret = H5Dwrite(dataset, h5d_type_id, memspace, filespace, xfer_plist, first);
376 
377  H5Dclose(memspace);
378  H5Sclose(filespace);
379  H5Dclose(dataset);
380  H5Sclose(dataspace);
381  }
382  else
383  {
384  hid_t filespace = H5Dget_space(h1);
385  ret = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offsets, NULL, ones.data(), counts);
386 
387  hid_t memspace = H5Screate_simple(mem_ndims, mem_gcounts, NULL);
388  ret = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, mem_offsets, NULL, ones.data(), mem_counts);
389  ret = H5Dwrite(h1, h5d_type_id, memspace, filespace, xfer_plist, first);
390 
391  H5Sclose(filespace);
392  H5Dclose(memspace);
393  }
394  H5Dclose(h1);
395  return ret != -1;
396 }
hid_t get_h5_datatype(const T &)
map C types to hdf5 native types bool is explicit removed due to the fact that it is implementation-d...

◆ has()

constexpr bool qmcplusplus::has ( const R &  this_one)

Definition at line 23 of file variant_help.hpp.

Referenced by MagnetizationDensityInput::MagnetizationDensityInputSection::checkParticularValidity(), and CustomTestInput::setFromStreamCustom().

24 {
25  return std::holds_alternative<T>(this_one);
26 }

◆ if()

if ( c->  rank() = = 0)

Definition at line 76 of file test_manager_mpi.cpp.

References CHECK(), EstimatorManagerNewTest::em, embt, EstimatorManagerNew::get_AverageCache(), and num_ranks.

Referenced by accum_sample(), ci_configuration2::calculateExcitations(), WalkerLogCollector::collect(), EnergyDensityEstimator::evaluate(), VirtualParticleSet::makeMoves(), EnergyDensityEstimator::put(), eeI_JastrowBuilder::putkids(), QMCDriverFactory::readSection(), SPOSetScanner::scan_path(), and EnergyDensityEstimator::set_ptcl().

77  {
78  double correct_value = (5.0 * num_ranks + 3.0) / (4 * (num_ranks - 1) + 5);
79  CHECK(embt.em.get_AverageCache()[0] == Approx(correct_value));
80  correct_value = (8.0 * num_ranks + 3.0) / (4 * (num_ranks - 1) + 5);
81  CHECK(embt.em.get_AverageCache()[1] == Approx(correct_value));
82  correct_value = (11.0 * num_ranks + 3.0) / (4 * (num_ranks - 1) + 5);
83  CHECK(embt.em.get_AverageCache()[2] == Approx(correct_value));
84  correct_value = (14.0 * num_ranks + 3.0) / (4 * (num_ranks - 1) + 5);
85  CHECK(embt.em.get_AverageCache()[3] == Approx(correct_value));
86  }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
testing::EstimatorManagerNewTest embt(ham, c, num_ranks)

◆ imag() [1/4]

◆ imag() [2/4]

double qmcplusplus::imag ( const double &  c)
inline

Definition at line 92 of file complex_help.hpp.

92 { return 0; }

◆ imag() [3/4]

float qmcplusplus::imag ( const std::complex< float > &  c)
inline

Definition at line 93 of file complex_help.hpp.

93 { return c.imag(); }

◆ imag() [4/4]

double qmcplusplus::imag ( const std::complex< double > &  c)
inline

Definition at line 94 of file complex_help.hpp.

94 { return c.imag(); }

◆ Include() [1/2]

bool qmcplusplus::Include ( int  i,
int  j,
int  k 
)
inline

Definition at line 41 of file kSpaceJastrow.cpp.

Referenced by kSpaceJastrow::setupGvecs().

42 {
43  if (i > 0)
44  return true;
45  else if (i == 0)
46  {
47  if (j > 0)
48  return true;
49  else if ((j == 0) && (k > 0))
50  return true;
51  }
52  return false;
53 }

◆ Include() [2/2]

bool qmcplusplus::Include ( int  i,
int  j 
)
inline

Definition at line 55 of file kSpaceJastrow.cpp.

56 {
57  if (i > 0)
58  return true;
59  else if (i == 0)
60  {
61  if (j > 0)
62  return true;
63  }
64  return false;
65 }

◆ infos()

std::vector<int, CUDAHostAllocator<int> > qmcplusplus::infos ( ,
1.  0 
)

Referenced by TEST_CASE().

◆ init_string_output()

void qmcplusplus::init_string_output ( )

Definition at line 33 of file test_output_manager.cpp.

References app_out, debug_out, err_out, infoDebug, infoError, infoLog, infoSummary, reset_string_output(), InfoStream::setStream(), and summary_out.

Referenced by TEST_CASE().

34 {
40 }
static std::ostringstream app_out
InfoStream infoSummary
InfoStream infoDebug
static std::ostringstream err_out
InfoStream infoLog
void setStream(std::ostream *output_stream)
Definition: InfoStream.cpp:24
InfoStream infoError
static std::ostringstream summary_out
static std::ostringstream debug_out

◆ InputSection::setIfInInput< qmcplusplus::MagnetizationDensityInput::Integrator >()

◆ InputSection::setIfInInput< qmcplusplus::OneBodyDensityMatricesInput::Integrator >()

◆ InputSection::setIfInInput< ReferencePointsInput::Coord >()

template bool qmcplusplus::InputSection::setIfInInput< ReferencePointsInput::Coord > ( ReferencePointsInput::Coord var,
const std::string &  tag 
)

◆ int2string()

std::string qmcplusplus::int2string ( const int &  i)
inline

Definition at line 119 of file string_utils.h.

Referenced by SpaceGrid::registerCollectables(), NESpaceGrid< REAL >::registerGrid(), SHOSetBuilder::report(), SHOSet::report(), and SHOSet::test_derivatives().

120 {
121  std::stringstream ss;
122  ss << i;
123  return ss.str();
124 }

◆ IntPart()

TinyVector<T, 3> qmcplusplus::IntPart ( const TinyVector< T, 3 > &  twist)
inline

Definition at line 74 of file EinsplineSetBuilderCommon.cpp.

References qmcplusplus::Units::charge::e.

Referenced by EinsplineSetBuilder::AnalyzeTwists2(), and FracPart().

75 {
76  return TinyVector<T, 3>(round(twist[0] - 1.0e-6), round(twist[1] - 1.0e-6), round(twist[2] - 1.0e-6));
77 }

◆ inverse() [1/4]

◆ inverse() [2/4]

Tensor<T, 1> qmcplusplus::inverse ( const Tensor< T, 1 > &  a)
inline

Definition at line 888 of file TensorOps.h.

889 {
890  return Tensor<T, 1>(1.0 / a(0, 0));
891 }

◆ inverse() [3/4]

Tensor<T, 2> qmcplusplus::inverse ( const Tensor< T, 2 > &  a)
inline

Definition at line 897 of file TensorOps.h.

References det().

898 {
899  T vinv = 1 / det(a);
900  return Tensor<T, 2>(vinv * a(1, 1), -vinv * a(0, 1), -vinv * a(1, 0), vinv * a(0, 0));
901 }
Tensor< T, 3 >::Type_t det(const Tensor< T, 3 > &a)
Definition: TensorOps.h:866

◆ inverse() [4/4]

Tensor<T, 3> qmcplusplus::inverse ( const Tensor< T, 3 > &  a)
inline

Definition at line 907 of file TensorOps.h.

References det().

908 {
909  T vinv = 1 / det(a);
910  // return Tensor<T,3>(vinv*(a(1,1)*a(2,2)-a(1,2)*a(2,1)),
911  // vinv*(a(1,2)*a(2,0)-a(1,0)*a(2,2)),
912  // vinv*(a(1,0)*a(2,1)-a(1,1)*a(2,0)),
913  // vinv*(a(2,1)*a(0,2)-a(2,2)*a(0,1)),
914  // vinv*(a(2,2)*a(0,0)-a(2,0)*a(0,2)),
915  // vinv*(a(2,0)*a(0,1)-a(2,1)*a(0,0)),
916  // vinv*(a(0,1)*a(1,2)-a(0,2)*a(1,1)),
917  // vinv*(a(0,2)*a(1,0)-a(0,0)*a(1,2)),
918  // vinv*(a(0,0)*a(1,1)-a(0,1)*a(1,0)));
919  return Tensor<T, 3>(vinv * (a(1, 1) * a(2, 2) - a(1, 2) * a(2, 1)), vinv * (a(2, 1) * a(0, 2) - a(2, 2) * a(0, 1)),
920  vinv * (a(0, 1) * a(1, 2) - a(0, 2) * a(1, 1)), vinv * (a(1, 2) * a(2, 0) - a(1, 0) * a(2, 2)),
921  vinv * (a(2, 2) * a(0, 0) - a(2, 0) * a(0, 2)), vinv * (a(0, 2) * a(1, 0) - a(0, 0) * a(1, 2)),
922  vinv * (a(1, 0) * a(2, 1) - a(1, 1) * a(2, 0)), vinv * (a(2, 0) * a(0, 1) - a(2, 1) * a(0, 0)),
923  vinv * (a(0, 0) * a(1, 1) - a(0, 1) * a(1, 0)));
924  // int i,j,i1,i2,j1,j2;
925  // int cyclic[]={1,2,0};
926  // for(i=0;i<3;i++){
927  // i1 = cyclic[i];
928  // i2 = cyclic[i1];
929  // for(j=0;j<3;j++){
930  // j1 = cyclic[j];
931  // j2 = cyclic[j1];
932  // x(i,j) = a(i1,j1)*a(i2,j2) - a(i1,j2)*a(i2,j1);
933  // }
934  // }
935  // typename T_t::Element_t
936  // detinv= 1.0e0/(a(0,0)*x(0,0)+a(1,0)*x(1,0)+a(2,0)*x(2,0));
937  // return detinv*x;
938 }
Tensor< T, 3 >::Type_t det(const Tensor< T, 3 > &a)
Definition: TensorOps.h:866

◆ InverseUpdateByColumn()

void qmcplusplus::InverseUpdateByColumn ( Matrix< T, ALLOC > &  Minv,
Vector< T, ALLOC > &  newcol,
Vector< T, ALLOC > &  rvec,
Vector< T, ALLOC > &  rvecinv,
int  colchanged,
c_ratio 
)
inline

Definition at line 269 of file DeterminantOperators.h.

References Matrix< T, Alloc >::data(), Vector< T, Alloc >::data(), det_col_update(), and Matrix< T, Alloc >::rows().

Referenced by AGPDeterminant::acceptMove(), MultiDiracDeterminant::evaluateDetsAndGradsForPtclMove(), MultiDiracDeterminant::evaluateDetsAndGradsForPtclMoveWithSpin(), MultiDiracDeterminant::evaluateDetsForPtclMove(), MultiDiracDeterminant::evaluateForWalkerMove(), MultiDiracDeterminant::evaluateForWalkerMoveWithSpin(), MultiDiracDeterminant::evaluateGrads(), MultiDiracDeterminant::evaluateGradsWithSpin(), and AGPDeterminant::ratioDown().

275 {
276  det_col_update(Minv.data(), newcol.data(), Minv.rows(), colchanged, c_ratio, rvec.data(), rvecinv.data());
277  //int nrows=Minv.rows();
278  //typename MatA::value_type ratio_inv=1.0/c_ratio;
279  //for(int i=0; i<nrows; i++) {
280  // if(i == colchanged) continue;
281  // typename MatA::value_type temp = 0.0;
282  // for(int k=0; k<nrows; k++) temp += newcol[k]*Minv(k,i);
283  // temp *= -ratio_inv;
284  // for(int k=0; k<nrows; k++) Minv(k,i) += temp*Minv(k,colchanged);
285  //}
286  //for(int k=0; k<nrows; k++) Minv(k,colchanged) *= ratio_inv;
287 }
void det_col_update(T *restrict pinv, const T *restrict tv, int m, int colchanged, T c_ratio, T *restrict temp, T *restrict rcopy)

◆ InverseUpdateByRow()

void qmcplusplus::InverseUpdateByRow ( Matrix< T, ALLOC > &  Minv,
Vector< T, ALLOC > &  newrow,
Vector< T, ALLOC > &  rvec,
Vector< T, ALLOC > &  rvecinv,
int  rowchanged,
c_ratio 
)
inline

update a inverse matrix by a row substitution

Parameters
Minvin/out inverse matrix
newrowrow vector
rvecworkspace
rvecinvworkspace
rowchangedrow index to be replaced
c_ratiodeterminant-ratio with the row replacement

Definition at line 247 of file DeterminantOperators.h.

References Matrix< T, Alloc >::cols(), Matrix< T, Alloc >::data(), Vector< T, Alloc >::data(), and det_row_update().

Referenced by AGPDeterminant::acceptMove(), and AGPDeterminant::ratioUp().

253 {
254  //using gemv+ger
255  det_row_update(Minv.data(), newrow.data(), Minv.cols(), rowchanged, c_ratio, rvec.data(), rvecinv.data());
256  //int ncols=Minv.cols();
257  //typename MatA::value_type ratio_inv=1.0/c_ratio;
258  //for(int j=0; j<ncols; j++) {
259  // if(j == rowchanged) continue;
260  // typename MatA::value_type temp = 0.0;
261  // for(int k=0; k<ncols; k++) temp += newrow[k]*Minv(j,k);
262  // temp *= -ratio_inv;
263  // for(int k=0; k<ncols; k++) Minv(j,k) += temp*Minv(rowchanged,k);
264  //}
265  //for(int k=0; k<ncols; k++) Minv(rowchanged,k) *= ratio_inv;
266 }
void det_row_update(T *restrict pinv, const T *restrict tv, int m, int rowchanged, T c_ratio, T *restrict temp, T *restrict rcopy)

◆ Invert() [1/2]

T qmcplusplus::Invert ( T *restrict  x,
int  n,
int  m,
T *restrict  work,
int *restrict  pivot 
)
inline

inverse a matrix

Parameters
xstarting address of an n-by-m matrix
nrows
mcols
workworkspace array
pivotinteger pivot array
Returns
determinant

Definition at line 118 of file DeterminantOperators.h.

References InvertLU(), LUFactorization(), qmcplusplus::Units::distance::m, and n.

Referenced by RotatedSPOs::evaluateDerivatives(), RotatedSPOs::evaluateDerivativesWF(), RotatedSPOs::evaluateDerivRatios(), and Invert().

119 {
120  T detvalue(1.0);
121  LUFactorization(n, m, x, n, pivot);
122  for (int i = 0, ip = 1; i < m; i++, ip++)
123  {
124  if (pivot[i] == ip)
125  detvalue *= x[i * m + i];
126  else
127  detvalue *= -x[i * m + i];
128  }
129  InvertLU(n, x, n, pivot, work, n);
130  return detvalue;
131 }
void InvertLU(int n, std::complex< float > *restrict a, int n0, int *restrict piv, std::complex< float > *restrict work, int n1)
Inversion of a complex<float> matrix after LU factorization.
void LUFactorization(int n, int m, std::complex< float > *restrict a, int n0, int *restrict piv)
LU factorization of complex<float>

◆ Invert() [2/2]

T qmcplusplus::Invert ( T *restrict  x,
int  n,
int  m 
)
inline

inverse a matrix

Parameters
xstarting address of an n-by-m matrix
nrows
mcols
Returns
determinant

Workspaces are handled internally.

Definition at line 164 of file DeterminantOperators.h.

References Invert(), qmcplusplus::Units::distance::m, and n.

165 {
166  std::vector<int> pivot(n);
167  std::vector<T> work(n);
168  return Invert(x, n, m, work.data(), pivot.data());
169 }
T Invert(T *restrict x, int n, int m)
inverse a matrix

◆ invert_matrix()

MatrixA::value_type qmcplusplus::invert_matrix ( MatrixA &  M,
bool  getdet = true 
)
inline

invert a matrix

Parameters
Ma matrix to be inverted
getdetbool, if true, calculate the determinant
Returns
the determinant

Definition at line 187 of file DeterminantOperators.h.

References InvertLU(), LUFactorization(), n, and sign().

Referenced by ExpFitClass< M >::Fit(), ExpFitClass< M >::FitCusp(), ForceCeperley::InitMatrix(), ForceChiesaPBCAA::InitMatrix(), ForceBase::initVarReduction(), TWFFastDerivWrapper::invertMatrices(), LinearFit(), QMCFixedSampleLinearOptimizeBatched::previous_linear_methods_run(), QMCFixedSampleLinearOptimize::run(), Eigensolver::solveGeneralizedEigenvalues_Inv(), and QMCFixedSampleLinearOptimizeBatched::solveShiftsWithoutLMYEngine().

188 {
189  OMPThreadCountProtectorLA protector;
190  using value_type = typename MatrixA::value_type;
191  const int n = M.rows();
192  std::vector<int> pivot(n);
193  std::vector<value_type> work(n);
194  LUFactorization(n, n, M.data(), n, pivot.data());
195  value_type det0 = 1.0;
196  if (getdet)
197  // calculate determinant
198  {
199  int sign = 1;
200  for (int i = 0; i < n; ++i)
201  {
202  if (pivot[i] != i + 1)
203  sign *= -1;
204  det0 *= M(i, i);
205  }
206  det0 *= static_cast<value_type>(sign);
207  }
208  InvertLU(n, M.data(), n, pivot.data(), work.data(), n);
209  return det0;
210 }
void InvertLU(int n, std::complex< float > *restrict a, int n0, int *restrict piv, std::complex< float > *restrict work, int n1)
Inversion of a complex<float> matrix after LU factorization.
double sign(double x)
Definition: Standard.h:73
QMCTraits::FullPrecRealType value_type
void LUFactorization(int n, int m, std::complex< float > *restrict a, int n0, int *restrict piv)
LU factorization of complex<float>

◆ InvertLU() [1/4]

void qmcplusplus::InvertLU ( int  n,
double *restrict  a,
int  n0,
int *restrict  piv,
double *restrict  work,
int  n1 
)
inline

Inversion of a double matrix after LU factorization.

Definition at line 65 of file DeterminantOperators.h.

References dgetri(), and n.

Referenced by Invert(), invert_matrix(), and InvertWithLog().

66 {
67  int status;
68  dgetri(n, a, n0, piv, work, n1, status);
69 }
void dgetri(const int &n, double *a, const int &n0, int const *piv, double *work, const int &, int &st)

◆ InvertLU() [2/4]

void qmcplusplus::InvertLU ( const int &  n,
float *restrict  a,
const int &  n0,
int *restrict  piv,
float *restrict  work,
const int &  n1 
)
inline

Inversion of a float matrix after LU factorization.

Definition at line 72 of file DeterminantOperators.h.

References n, and sgetri().

78 {
79  int status;
80  sgetri(n, a, n0, piv, work, n1, status);
81 }
void sgetri(const int &n, float *a, const int &n0, int const *piv, float *work, const int &, int &st)

◆ InvertLU() [3/4]

void qmcplusplus::InvertLU ( int  n,
std::complex< double > *restrict  a,
int  n0,
int *restrict  piv,
std::complex< double > *restrict  work,
int  n1 
)
inline

Inversion of a std::complex<double> matrix after LU factorization.

Definition at line 84 of file DeterminantOperators.h.

References n, and zgetri().

90 {
91  int status;
92  zgetri(n, a, n0, piv, work, n1, status);
93 }
void zgetri(const int &n, std::complex< double > *a, const int &n0, int const *piv, std::complex< double > *work, const int &, int &st)

◆ InvertLU() [4/4]

void qmcplusplus::InvertLU ( int  n,
std::complex< float > *restrict  a,
int  n0,
int *restrict  piv,
std::complex< float > *restrict  work,
int  n1 
)
inline

Inversion of a complex<float> matrix after LU factorization.

Definition at line 96 of file DeterminantOperators.h.

References cgetri(), and n.

102 {
103  int status;
104  cgetri(n, a, n0, piv, work, n1, status);
105 }
void cgetri(const int &n, std::complex< float > *a, const int &n0, int const *piv, std::complex< float > *work, const int &, int &st)

◆ InvertWithLog()

void qmcplusplus::InvertWithLog ( T *restrict  x,
int  n,
int  m,
T *restrict  work,
int *restrict  pivot,
std::complex< T1 > &  logdet 
)
inline

Definition at line 172 of file DeterminantOperators.h.

References InvertLU(), log(), LUFactorization(), qmcplusplus::Units::distance::m, and n.

Referenced by DiracDeterminantWithBackflow::dummyEvalLi(), DiracDeterminantWithBackflow::evaluateDerivatives(), MultiDiracDeterminant::evaluateForWalkerMove(), MultiDiracDeterminant::evaluateForWalkerMoveWithSpin(), DiracDeterminantWithBackflow::evaluateLog(), AGPDeterminant::evaluateLogAndStore(), DiracDeterminantWithBackflow::ratio(), DiracDeterminantWithBackflow::ratioGrad(), RotatedSPOs::table_method_eval(), RotatedSPOs::table_method_evalWF(), DiracDeterminantWithBackflow::testDerivFjj(), and DiracDeterminantWithBackflow::testL().

173 {
174  LUFactorization(n, m, x, n, pivot);
175  logdet = std::complex<T1>();
176  for (int i = 0; i < n; i++)
177  logdet += std::log(std::complex<T1>((pivot[i] == i + 1) ? x[i * m + i] : -x[i * m + i]));
178  InvertLU(n, x, n, pivot, work, n);
179 }
void InvertLU(int n, std::complex< float > *restrict a, int n0, int *restrict piv, std::complex< float > *restrict work, int n1)
Inversion of a complex<float> matrix after LU factorization.
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)
void LUFactorization(int n, int m, std::complex< float > *restrict a, int n0, int *restrict piv)
LU factorization of complex<float>

◆ is_same()

bool qmcplusplus::is_same ( const xmlChar *  a,
const char *  b 
)
inline

◆ isfinite() [1/2]

bool isfinite ( float  )

return true if the value is finite.

std::isfinite can be affected by compiler the -ffast-math option and return true constantly. The customized qmcplusplus::isnan should be always effective. This requires its definition compiled without -ffast-math.

Definition at line 21 of file math.cpp.

References isfinite().

Referenced by DMCBatched::advanceWalkers().

21 { return std::isfinite(a); }
bool isfinite(double a)
Definition: math.cpp:22

◆ isfinite() [2/2]

bool isfinite ( double  a)

Definition at line 22 of file math.cpp.

Referenced by isfinite().

22 { return std::isfinite(a); }
bool isfinite(double a)
Definition: math.cpp:22

◆ isinf() [1/2]

bool isinf ( float  )

return true if the value is Inf.

std::isinf can be affected by compiler the -ffast-math option and return true constantly. The customized qmcplusplus::isnan should be always effective. This requires its definition compiled without -ffast-math.

Definition at line 24 of file math.cpp.

References isinf().

Referenced by DiracDeterminantBase::checkG().

24 { return std::isinf(a); }
bool isinf(double a)
Definition: math.cpp:25

◆ isinf() [2/2]

bool isinf ( double  a)

Definition at line 25 of file math.cpp.

Referenced by isinf().

25 { return std::isinf(a); }
bool isinf(double a)
Definition: math.cpp:25

◆ isnan() [1/2]

bool isnan ( float  )

return true if the value is NaN.

std::isnan can be affected by compiler the -ffast-math option and return true constantly. The customized qmcplusplus::isnan should be always effective. This requires its definition compiled without -ffast-math.

Definition at line 18 of file math.cpp.

Referenced by DiracDeterminantBase::checkG(), NaNguard::checkOneParticleGradients(), NaNguard::checkOneParticleRatio(), HamiltonianRef::evaluate(), syclSolverInverter< T_FP >::invert_transpose(), cuSolverInverter< T_FP >::invert_transpose(), rocSolverInverter< T_FP >::invert_transpose(), QMCFixedSampleLinearOptimizeBatched::one_shift_run(), test_isnan(), QMCHamiltonian::updateComponent(), and DescentEngine::updateParameters().

18 { return a != a; }

◆ isnan() [2/2]

bool isnan ( double  a)

Definition at line 19 of file math.cpp.

19 { return a != a; }

◆ iszero()

bool qmcplusplus::iszero ( a)
inline

Definition at line 77 of file math.hpp.

Referenced by accumulator_set< FullPrecReal >::bad(), and accumulator_set< FullPrecReal >::variance().

78 {
79  return std::fpclassify(a) == FP_ZERO;
80 }

◆ laplacian() [1/2]

T qmcplusplus::laplacian ( const TinyVector< T, D > &  g,
l 
)
inline

compute real(laplacian)

Definition at line 27 of file BareKineticHelper.h.

References dot().

Referenced by SpeciesKineticEnergy::evaluate(), BareKineticEnergy::evaluate(), BareKineticEnergy::evaluate_orig(), and BareKineticEnergy::evaluateWithIonDerivs().

28 {
29  return dot(g, g) + l;
30 }
T dot(T *a, T *b)

◆ laplacian() [2/2]

T qmcplusplus::laplacian ( const TinyVector< std::complex< T >, D > &  g,
const std::complex< T > &  l 
)
inline

specialization of laplacian with complex g & l

Definition at line 35 of file BareKineticHelper.h.

References OTCDot< T1, T2, D >::apply().

36 {
37  return l.real() + OTCDot<T, T, D>::apply(g, g);
38 }

◆ ldexp() [1/8]

MakeReturn< BinaryNode<FnLdexp, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::ldexp ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 305 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by GKIntegration< F, GKRule >::Integrate(), and FnLdexp::operator()().

306 {
307  typedef BinaryNode<FnLdexp, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
308  Tree_t;
309  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
310 }

◆ ldexp() [2/8]

MakeReturn< BinaryNode<FnLdexp, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::ldexp ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 555 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

556 {
557  typedef BinaryNode<FnLdexp, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
558  Tree_t;
559  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
560 }

◆ ldexp() [3/8]

MakeReturn< BinaryNode<FnLdexp, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::ldexp ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 805 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

806 {
807  typedef BinaryNode<FnLdexp, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
808  Tree_t;
809  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
810 }

◆ ldexp() [4/8]

MakeReturn< BinaryNode<FnLdexp, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::ldexp ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1035 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1036 {
1037  using Tree_t = BinaryNode<FnLdexp, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1038  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1039 }

◆ ldexp() [5/8]

MakeReturn< BinaryNode<FnLdexp, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::ldexp ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1236 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1237 {
1238  using Tree_t = BinaryNode<FnLdexp, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1239  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1240 }

◆ ldexp() [6/8]

MakeReturn< BinaryNode<FnLdexp, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::ldexp ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1652 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1653 {
1654  typedef BinaryNode<FnLdexp, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
1655  Tree_t;
1656  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1657 }

◆ ldexp() [7/8]

MakeReturn< BinaryNode<FnLdexp, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::ldexp ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1882 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1883 {
1884  using Tree_t = BinaryNode<FnLdexp, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1885  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1886 }

◆ ldexp() [8/8]

MakeReturn< BinaryNode<FnLdexp, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::ldexp ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2083 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2084 {
2085  using Tree_t = BinaryNode<FnLdexp, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2086  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2087 }

◆ LegendrePll()

T qmcplusplus::LegendrePll ( int  l,
x 
)
inline

Definition at line 25 of file Ylm.h.

References sqrt().

Referenced by LegendrePlm(), and TEST_CASE().

26 {
27  if (l == 0)
28  return 1.0;
29  else
30  {
31  T sqt = std::sqrt(1.0 - x) * std::sqrt(1.0 + x);
32  T val = 1.0;
33  T dblfact = 1.0;
34  for (int i = 1; i <= l; i++)
35  {
36  val *= -sqt;
37  val *= dblfact;
38  dblfact += 2.0;
39  }
40  return val;
41  }
42 }
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ LegendrePlm()

T qmcplusplus::LegendrePlm ( int  l,
int  m,
x 
)
inline

Definition at line 45 of file Ylm.h.

References abs(), LegendrePll(), qmcplusplus::Units::distance::m, and sign().

Referenced by Ylm().

46 {
47  if (m < 0)
48  {
49  m = std::abs(m);
50  T posval = LegendrePlm(l, m, x);
51  T sign = (m % 2 == 0) ? 1.0 : -1.0;
52  T mfact = 1.0;
53  for (int i = 2; i <= (l - m); i++)
54  mfact *= static_cast<T>(i);
55  T pfact = 1.0;
56  for (int i = 2; i <= (l + m); i++)
57  pfact *= static_cast<T>(i);
58  return posval * sign * mfact / pfact;
59  }
60  // Now we can assume that m is not negative
61  T pmm = LegendrePll(m, x);
62  T pmp1m = x * (2 * m + 1) * pmm;
63  if (m == l)
64  return pmm;
65  else if (l == (m + 1))
66  return pmp1m;
67  else
68  // Use recursive formula
69  {
70  T Plm2m = pmm;
71  T Plm1m = pmp1m;
72  T Pl = 0;
73  for (int i = m + 2; i <= l; i++)
74  {
75  Pl = (1.0 / static_cast<T>(i - m)) * (x * (2 * i - 1) * Plm1m - (i + m - 1) * Plm2m);
76  Plm2m = Plm1m;
77  Plm1m = Pl;
78  }
79  return Pl;
80  }
81 }
T LegendrePlm(int l, int m, T x)
Definition: Ylm.h:45
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
double sign(double x)
Definition: Standard.h:73
T LegendrePll(int l, T x)
Definition: Ylm.h:25

◆ LinearFit()

void qmcplusplus::LinearFit ( std::vector< T > &  y,
Matrix< T > &  A,
std::vector< T > &  coefs 
)
inline

Definition at line 28 of file LinearFit.h.

References qmcplusplus::Units::distance::A, invert_matrix(), and qmcplusplus::Units::force::N.

Referenced by BsplineFunctor< REAL >::initialize(), BackflowBuilder::makeShortRange_twoBody(), and BsplineFunctor< REAL >::put().

29 {
30  int N = A.size(0);
31  int M = A.size(1);
32  if (y.size() != N)
33  throw std::runtime_error("Differernt number of rows in basis functions that in data points in LinearFit.");
34  // Construct alpha matrix
35  Matrix<T> alpha(M, M);
36  alpha = 0.0;
37  for (int j = 0; j < M; j++)
38  for (int k = 0; k < M; k++)
39  for (int i = 0; i < N; i++)
40  alpha(k, j) += A(i, j) * A(i, k);
41  // Next, construct beta vector
42  std::vector<T> beta(M, 0.0);
43  for (int k = 0; k < M; k++)
44  for (int i = 0; i < N; i++)
45  beta[k] += y[i] * A(i, k);
46  invert_matrix(alpha, false);
47  coefs.resize(M, 0.0);
48  for (int i = 0; i < M; i++)
49  for (int j = 0; j < M; j++)
50  coefs[i] += alpha(i, j) * beta[j];
51 }
MatrixA::value_type invert_matrix(MatrixA &M, bool getdet=true)
invert a matrix

◆ log() [1/2]

MakeReturn<UnaryNode<FnLog, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::log ( const Vector< T1, C1 > &  l)
inline

◆ log() [2/2]

MakeReturn<UnaryNode<FnLog, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::log ( const Expression< T1 > &  l)
inline

Definition at line 1451 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1453 {
1454  using Tree_t = UnaryNode<FnLog, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1455  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1456 }

◆ log10() [1/2]

MakeReturn<UnaryNode<FnLog10, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::log10 ( const Vector< T1, C1 > &  l)
inline

Definition at line 112 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by FnLog10::operator()().

114 {
115  using Tree_t = UnaryNode<FnLog10, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
116  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
117 }

◆ log10() [2/2]

MakeReturn<UnaryNode<FnLog10, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::log10 ( const Expression< T1 > &  l)
inline

Definition at line 1459 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1461 {
1462  using Tree_t = UnaryNode<FnLog10, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1463  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1464 }

◆ log_values()

◆ lower_bound()

TinyVector<T, 3> qmcplusplus::lower_bound ( const TinyVector< T, 3 > &  a,
const TinyVector< T, 3 > &  b 
)
inline

◆ lowerCase()

std::string lowerCase ( const std::string_view  s)

++17

take string_view (or something that can be implicitly converted to one) and return lcase string. Don't call on anything but ASCII strings.

According to en.cppreference.com std::tolower is only defined for usigned char and EOF. the std::tolower conversion is based on the c locale which to makes it unclear on what might happen to char > 127.

  • For tags, and keywords where we define explicitly define they are ASCII encoded and this is fine.
  • For other XML derived text this should never be used since we should assume that to be UTF-8 encoded.

Definition at line 22 of file ModernStringUtils.cpp.

References qmcplusplus::Units::time::s.

Referenced by ParameterSet::add(), RadialJastrowBuilder::buildComponent(), createDriftModifier(), QMCGaussianParserBase::createHamiltonian(), RadialJastrowBuilder::createJ1(), SPOSetBuilderFactory::createSPOSetBuilder(), getNodeName(), LocalEnergyInput::LocalEnergyInput(), InputSection::lookupAnyEnum(), ProjectData::lookupDriverVersion(), QMCFixedSampleLinearOptimize::processOptXML(), LatticeParser::put(), ParameterSet::put(), QMCCostFunctionBase::put(), RadialOrbitalSetBuilder< SoaAtomicBasisSet< MultiFunctorAdapter< FN >, SH > >::put(), OhmmsParameter< bool >::put(), ShortRangeCuspFunctor< T >::put(), TraceManager::put(), InputSection::readAttributes(), QMCDriverInput::readXML(), EstimatorManagerInput::readXML(), InputSection::readXML(), ShortRangeCuspFunctor< T >::set_variable_from_xml(), ParameterSet::setValue(), and TEST_CASE().

23 {
24  std::string lower_str{s};
25  std::transform(lower_str.begin(), lower_str.end(), lower_str.begin(),
26  [](unsigned char c) { return std::tolower(c); });
27  return lower_str;
28 }

◆ lu2_mat()

testing::MatrixAccessor<double> qmcplusplus::lu2_mat ( lu2.  data(),
,
 
)

◆ lu_mat()

testing::MatrixAccessor<double> qmcplusplus::lu_mat ( lu.  data(),
,
 
)

Referenced by TEST_CASE().

◆ LUFactorization() [1/4]

void qmcplusplus::LUFactorization ( int  n,
int  m,
double *restrict  a,
int  n0,
int *restrict  piv 
)
inline

LU factorization of double.

Definition at line 37 of file DeterminantOperators.h.

References dgetrf(), qmcplusplus::Units::distance::m, and n.

Referenced by Determinant(), Invert(), invert_matrix(), and InvertWithLog().

38 {
39  int status;
40  dgetrf(n, m, a, n0, piv, status);
41 }
void dgetrf(const int &n, const int &m, double *a, const int &n0, int *piv, int &st)

◆ LUFactorization() [2/4]

void qmcplusplus::LUFactorization ( int  n,
int  m,
float *restrict  a,
const int &  n0,
int *restrict  piv 
)
inline

LU factorization of float.

Definition at line 44 of file DeterminantOperators.h.

References qmcplusplus::Units::distance::m, n, and sgetrf().

45 {
46  int status;
47  sgetrf(n, m, a, n0, piv, status);
48 }
void sgetrf(const int &n, const int &m, float *a, const int &n0, int *piv, int &st)

◆ LUFactorization() [3/4]

void qmcplusplus::LUFactorization ( int  n,
int  m,
std::complex< double > *restrict  a,
int  n0,
int *restrict  piv 
)
inline

LU factorization of std::complex<double>

Definition at line 51 of file DeterminantOperators.h.

References qmcplusplus::Units::distance::m, n, and zgetrf().

52 {
53  int status;
54  zgetrf(n, m, a, n0, piv, status);
55 }
void zgetrf(const int &n, const int &m, std::complex< double > *a, const int &n0, int *piv, int &st)

◆ LUFactorization() [4/4]

void qmcplusplus::LUFactorization ( int  n,
int  m,
std::complex< float > *restrict  a,
int  n0,
int *restrict  piv 
)
inline

LU factorization of complex<float>

Definition at line 58 of file DeterminantOperators.h.

References cgetrf(), qmcplusplus::Units::distance::m, and n.

59 {
60  int status;
61  cgetrf(n, m, a, n0, piv, status);
62 }
void cgetrf(const int &n, const int &m, std::complex< float > *a, const int &n0, int *piv, int &st)

◆ lus()

std::vector<StdComp*, CUDAHostAllocator<StdComp*> > qmcplusplus::lus ( batch_size  )

◆ M2_mat()

testing::MatrixAccessor<double> qmcplusplus::M2_mat ( M2_vec.  data(),
,
 
)

◆ M_mat()

testing::MatrixAccessor<double> qmcplusplus::M_mat ( M_vec.  data(),
,
 
)

Referenced by TEST_CASE().

◆ make_bandgroup_name()

std::string qmcplusplus::make_bandgroup_name ( const std::string &  root,
int  spin,
int  twist,
const Tensor< int, 3 > &  tilematrix,
int  first,
int  last 
)
inline

Definition at line 54 of file BsplineReader.cpp.

Referenced by BsplineReader::create_spline_set().

60 {
61  std::ostringstream oo;
62  oo << root << ".tile_" << tilematrix(0, 0) << tilematrix(0, 1) << tilematrix(0, 2) << tilematrix(1, 0)
63  << tilematrix(1, 1) << tilematrix(1, 2) << tilematrix(2, 0) << tilematrix(2, 1) << tilematrix(2, 2) << ".spin_"
64  << spin << ".tw_" << twist << ".l" << first << "u" << last;
65  return oo.str();
66 }

◆ make_bandinfo_filename()

std::string qmcplusplus::make_bandinfo_filename ( const std::string &  root,
int  spin,
int  twist,
const Tensor< int, 3 > &  tilematrix,
int  gid 
)
inline

Definition at line 38 of file BsplineReader.cpp.

Referenced by BsplineReader::initialize_spo2band().

43 {
44  std::ostringstream oo;
45  oo << root << ".tile_" << tilematrix(0, 0) << tilematrix(0, 1) << tilematrix(0, 2) << tilematrix(1, 0)
46  << tilematrix(1, 1) << tilematrix(1, 2) << tilematrix(2, 0) << tilematrix(2, 1) << tilematrix(2, 2) << ".spin_"
47  << spin << ".tw_" << twist;
48  if (gid >= 0)
49  oo << ".g" << gid;
50  return oo.str();
51 }

◆ makeAnotherInput()

std::any qmcplusplus::makeAnotherInput ( xmlNodePtr  cur,
std::string &  value_label 
)

Definition at line 551 of file test_InputSection.cpp.

References AnotherInput::get_name().

Referenced by DelegatingInput::DelegatingInputSection::DelegatingInputSection().

552 {
553  AnotherInput another_input{cur};
554  value_label = another_input.get_name();
555  return another_input;
556 }

◆ makeGaussRandom() [1/4]

void qmcplusplus::makeGaussRandom ( std::vector< TinyVector< T, D >> &  a)
inline

◆ makeGaussRandom() [2/4]

void qmcplusplus::makeGaussRandom ( Matrix< TinyVector< T, D >> &  a)
inline

specialized functions: stick to overloading

Definition at line 32 of file RandomSeqGeneratorGlobal.h.

References assignGaussRand(), and Random.

33 {
34  assignGaussRand(&(a(0, 0)[0]), a.size() * D, Random);
35 }
#define Random
void assignGaussRand(T *restrict a, unsigned n, RG &rng)

◆ makeGaussRandom() [3/4]

void qmcplusplus::makeGaussRandom ( ParticleAttrib< TinyVector< T, D >> &  a)
inline

Definition at line 38 of file RandomSeqGeneratorGlobal.h.

References assignGaussRand(), and Random.

39 {
40  assignGaussRand(&(a[0][0]), a.size() * D, Random);
41 }
#define Random
void assignGaussRand(T *restrict a, unsigned n, RG &rng)

◆ makeGaussRandom() [4/4]

void qmcplusplus::makeGaussRandom ( ParticleAttrib< T > &  a)
inline

Definition at line 44 of file RandomSeqGeneratorGlobal.h.

References assignGaussRand(), Random, and Vector< T, Alloc >::size().

45 {
46  assignGaussRand(&(a[0]), a.size(), Random);
47 }
#define Random
void assignGaussRand(T *restrict a, unsigned n, RG &rng)

◆ makeGaussRandomWithEngine() [1/8]

◆ makeGaussRandomWithEngine() [2/8]

void qmcplusplus::makeGaussRandomWithEngine ( std::vector< TinyVector< T, D >> &  a,
RG &  rng 
)
inline

Definition at line 77 of file RandomSeqGenerator.h.

References assignGaussRand().

78 {
79  assignGaussRand(&(a[0][0]), a.size() * D, rng);
80 }
void assignGaussRand(T *restrict a, unsigned n, RG &rng)

◆ makeGaussRandomWithEngine() [3/8]

void qmcplusplus::makeGaussRandomWithEngine ( std::vector< T > &  a,
RG &  rng 
)
inline

Definition at line 83 of file RandomSeqGenerator.h.

References assignGaussRand().

84 {
85  static_assert(std::is_floating_point<T>::value,
86  "makeGaussRandomWithEngine(std::vector<T>...) only implemented for floating point T");
87  assignGaussRand(&(a[0]), a.size(), rng);
88 }
void assignGaussRand(T *restrict a, unsigned n, RG &rng)

◆ makeGaussRandomWithEngine() [4/8]

void qmcplusplus::makeGaussRandomWithEngine ( ParticleAttrib< T > &  a,
RG &  rng 
)
inline

Definition at line 91 of file RandomSeqGenerator.h.

References assignGaussRand(), and Vector< T, Alloc >::size().

92 {
93  assignGaussRand(&(a[0]), a.size(), rng);
94 }
void assignGaussRand(T *restrict a, unsigned n, RG &rng)

◆ makeGaussRandomWithEngine() [5/8]

void qmcplusplus::makeGaussRandomWithEngine ( MCCoords< CT > &  a,
RG &  rng 
)
inline

Definition at line 97 of file RandomSeqGenerator.h.

References makeGaussRandomWithEngine(), and POS_SPIN.

98 {
99  makeGaussRandomWithEngine(a.positions, rng);
100  if constexpr (CT == CoordsType::POS_SPIN)
101  makeGaussRandomWithEngine(a.spins, rng);
102 }
void makeGaussRandomWithEngine(MCCoords< CT > &a, RG &rng)

◆ makeGaussRandomWithEngine() [6/8]

qmcplusplus::makeGaussRandomWithEngine ( gauss_random_vals  ,
rng   
)

◆ makeGaussRandomWithEngine() [7/8]

qmcplusplus::makeGaussRandomWithEngine ( mc_coords_rs  ,
rng   
)

◆ makeGaussRandomWithEngine() [8/8]

qmcplusplus::makeGaussRandomWithEngine ( mc_coords_rsspins  ,
rng   
)

◆ makePsets()

PSetsAndRefList qmcplusplus::makePsets ( )

Definition at line 87 of file test_ReferencePoints.cpp.

References comm, OHMMS::Controller, lattice, MinimalParticlePool::make_diamondC_1x1x1(), qmcplusplus::testing::makeTestLattice(), particle_pool, and pset.

Referenced by TEST_CASE().

88 {
92  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
93  auto& pset = *(particle_pool.getParticleSet("e"));
94  auto& pset_ions = *(particle_pool.getParticleSet("ion"));
95 
96  // Setup particleset
97  pset.R = ParticleSet::ParticlePos{{1.751870349, 4.381521229, 2.865202269}, {3.244515371, 4.382273176, 4.21105285},
98  {3.000459944, 3.329603408, 4.265030556}, {3.748660329, 3.63420622, 5.393637791},
99  {3.033228526, 3.391869137, 4.654413566}, {3.114198787, 2.654334594, 5.231075822},
100  {3.657151589, 4.883870516, 4.201243939}, {2.97317591, 4.245644974, 4.284564732}};
101 
102  RefVector<ParticleSet> ref_psets;
103  ref_psets.push_back(pset_ions);
104  return {std::move(particle_pool), pset, pset_ions, ref_psets};
105 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice

◆ makeReferencePointsInput()

std::any makeReferencePointsInput ( xmlNodePtr  ,
std::string &  value_label 
)

factory function used by InputSection to make reference points Input

Parameters
[out]value_labelkey value in delegating InputSection for storing the constructed Input from processed node.

Definition at line 83 of file ReferencePointsInput.cpp.

Referenced by TEST_CASE().

84 {
85  ReferencePointsInput rpi{cur};
86  value_label = "referencepoints";
87  return rpi;
88 }

◆ makeRefVector()

static RefVector<TR> qmcplusplus::makeRefVector ( std::vector< T > &  vec_list)
static

}@

helper function to take vector of class A to refvector of any valid reference type for A

intended usage looks like this std::vector<DerivedType> vdt auto refvecbase = makeRefVector<BaseType>(vdt) or if you just want a refvector of type vdt auto refvec = makeRefVector<decltype(vdt)::value_type>(vdt)

godbolt.org indicates at least with clang 11&12 we get RVO here. auto ref_whatevers = makeRefVector<ValidTypeForReference>(whatevers); makes no extra copy.

Definition at line 54 of file template_types.hpp.

55 {
56  RefVector<TR> ref_list;
57  ref_list.reserve(vec_list.size());
58  for (int i = 0; i < vec_list.size(); ++i)
59  ref_list.push_back(vec_list[i]);
60  return ref_list;
61 }

◆ makeSpaceGridInput()

std::any makeSpaceGridInput ( xmlNodePtr  ,
std::string &  value_label 
)

factory function for a SpaceGridInput

Parameters
[in]inputnode for SpaceGridInput
[out]valuelabel returned to caller

Definition at line 143 of file SpaceGridInput.cpp.

Referenced by TEST_CASE().

144 {
145  SpaceGridInput sgi{cur};
146  value_label = "spacegrid";
147  return sgi;
148 }

◆ makeSphereRandom() [1/2]

void qmcplusplus::makeSphereRandom ( ParticleAttrib< TinyVector< T, 3 >> &  a)
inline

Definition at line 62 of file RandomSeqGeneratorGlobal.h.

References Random, and sqrt().

Referenced by InitMolecularSystem::initMolecule().

63 {
64  for (int i = 0; i < a.size(); i++)
65  {
66  bool failed = true;
67  while (failed)
68  {
69  T x = 1.0 - 2.0 * Random();
70  T y = 1.0 - 2.0 * Random();
71  T z = 1.0 - 2.0 * Random();
72  T sep = std::sqrt(x * x + y * y + z * z);
73  if (sep < 1)
74  {
75  T rinv = 1.0 / sep;
76  a[i][0] = x * rinv;
77  a[i][1] = y * rinv;
78  a[i][2] = z * rinv;
79  failed = false;
80  }
81  }
82  }
83 }
#define Random
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ makeSphereRandom() [2/2]

void qmcplusplus::makeSphereRandom ( ParticleAttrib< TinyVector< T, 2 >> &  a)
inline

Definition at line 86 of file RandomSeqGeneratorGlobal.h.

References Random, and sqrt().

87 {
88  for (int i = 0; i < a.size(); i++)
89  {
90  bool failed = true;
91  while (failed)
92  {
93  T x = 1.0 - 2.0 * Random();
94  T y = 1.0 - 2.0 * Random();
95  T sep = std::sqrt(x * x + y * y);
96  if (sep < 1)
97  {
98  T rinv = 1.0 / sep;
99  a[i][0] = x * rinv;
100  a[i][1] = y * rinv;
101  failed = false;
102  }
103  }
104  }
105 }
#define Random
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ makeTestRPI()

ReferencePointsInput qmcplusplus::makeTestRPI ( )

Definition at line 70 of file test_ReferencePoints.cpp.

References doc, Libxml2Document::getRoot(), node, okay, and Libxml2Document::parseFromString().

Referenced by TEST_CASE().

71 {
72  using Input = testing::ValidReferencePointsInputs;
74  bool okay = doc.parseFromString(Input::xml[Input::valid::CELL]);
75  xmlNodePtr node = doc.getRoot();
76  return {node};
77 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ makeUniformRandom() [1/2]

void qmcplusplus::makeUniformRandom ( ParticleAttrib< TinyVector< T, D >> &  a)
inline

Definition at line 50 of file RandomSeqGeneratorGlobal.h.

References assignUniformRand(), and Random.

Referenced by InitMolecularSystem::initWithVolume(), InitMolecularSystem::put(), and XMLParticleParser::readXML().

51 {
52  assignUniformRand(&(a[0][0]), a.size() * D, Random);
53 }
#define Random
void assignUniformRand(T *restrict a, unsigned n, RG &rng)

◆ makeUniformRandom() [2/2]

void qmcplusplus::makeUniformRandom ( ParticleAttrib< T > &  a)
inline

Definition at line 56 of file RandomSeqGeneratorGlobal.h.

References assignUniformRand(), Random, and Vector< T, Alloc >::size().

57 {
58  assignUniformRand(&(a[0]), a.size(), Random);
59 }
#define Random
void assignUniformRand(T *restrict a, unsigned n, RG &rng)

◆ minimizeForPhiAtZero()

RealType minimizeForPhiAtZero ( CuspCorrection cusp,
OneMolecularOrbital phiMO,
RealType  Z,
RealType  eta0,
ValueVector pos,
ValueVector ELcurr,
ValueVector ELideal,
RealType  start_phi0 
)

Minimize chi2 with respect to phi at zero for a fixed Rc.

Parameters
cuspcorrection parameters
phiMOuncorrected orbital (S-orbitals on this center only)
Znuclear charge
eta0value at zero for parts of the orbital that don't require correction - the non-S-orbitals on this center and all orbitals on other centers
posvector of radial positions
Elcurrstorage for current local energy
Elidealstorage for ideal local energy

Definition at line 477 of file CuspCorrectionConstruction.cpp.

References APP_ABORT, bracket_minimum(), CuspCorrection::cparam, qmcplusplus::Units::charge::e, evaluateForPhi0Body(), find_minimum(), getIdealLocalEnergy(), getOriginalLocalEnergy(), getZeff(), ValGradLap::grad, ValGradLap::lap, OneMolecularOrbital::phi_vgl(), phiBar(), CuspCorrectionParameters::Rc, and ValGradLap::val.

Referenced by minimizeForRc().

485 {
486  ValGradLap vglAtRc;
487  ValueVector tmp_pos(0);
488  ValueVector ELorig(0);
489  RealType Zeff = getZeff(Z, eta0, phiBar(cusp, 0.0, phiMO));
490 
491  RealType ELorigAtRc = getOriginalLocalEnergy(tmp_pos, Zeff, cusp.cparam.Rc, phiMO, ELorig);
492  getIdealLocalEnergy(pos, Z, cusp.cparam.Rc, ELorigAtRc, ELideal);
493  phiMO.phi_vgl(cusp.cparam.Rc, vglAtRc.val, vglAtRc.grad, vglAtRc.lap);
494 
495  Bracket_min_t<RealType> bracket(start_phi0, 0.0, 0.0, false);
496  try
497  {
498  bracket = bracket_minimum(
499  [&](RealType x) -> RealType {
500  return evaluateForPhi0Body(x, pos, ELcurr, ELideal, cusp, phiMO, vglAtRc, eta0, ELorigAtRc, Z);
501  },
502  start_phi0);
503  }
504  catch (const std::runtime_error& e)
505  {
506  APP_ABORT("Bracketing minimum failed for finding phi0. \n");
507  }
508 
509  auto min_res = find_minimum(
510  [&](RealType x) -> RealType {
511  return evaluateForPhi0Body(x, pos, ELcurr, ELideal, cusp, phiMO, vglAtRc, eta0, ELorigAtRc, Z);
512  },
513  bracket);
514 
515  start_phi0 = min_res.first;
516 
517  return min_res.second;
518 }
RealType phiBar(const CuspCorrection &cusp, RealType r, OneMolecularOrbital &phiMO)
Bracket_min_t< T > bracket_minimum(const F &f, T initial_value, T bound_max=-1.0)
RealType evaluateForPhi0Body(RealType phi0, ValueVector &pos, ValueVector &ELcurr, ValueVector &ELideal, CuspCorrection &cusp, OneMolecularOrbital &phiMO, ValGradLap phiAtRc, RealType etaAtZero, RealType ELorigAtRc, RealType Z)
OrbitalSetTraits< ValueType >::ValueVector ValueVector
void getIdealLocalEnergy(const ValueVector &pos, RealType Z, RealType Rc, RealType ELorigAtRc, ValueVector &ELideal)
Ideal local energy at a vector of points.
RealType getOriginalLocalEnergy(const ValueVector &pos, RealType Zeff, RealType Rc, OneMolecularOrbital &phiMO, ValueVector &ELorig)
Local energy from uncorrected orbital.
std::pair< T, T > find_minimum(const F &f, Bracket_min_t< T > &bracket)
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
QMCTraits::RealType RealType
RealType getZeff(RealType Z, RealType etaAtZero, RealType phiBarAtZero)
Effective nuclear charge to keep effective local energy finite at zero.

◆ minimizeForRc()

void minimizeForRc ( CuspCorrection cusp,
OneMolecularOrbital phiMO,
RealType  Z,
RealType  Rc_init,
RealType  Rc_max,
RealType  eta0,
ValueVector pos,
ValueVector ELcurr,
ValueVector ELideal 
)

Minimize chi2 with respect to Rc and phi at zero.

Parameters
cuspcorrection parameters
phiMOuncorrected orbital (S-orbitals on this center only)
Znuclear charge
Rc_initinitial value for Rc
Rc_maxmaximum value for Rc
eta0value at zero for parts of the orbital that don't require correction - the non-S-orbitals on this center and all orbitals on other centers
posvector of radial positions
Elcurrstorage for current local energy
Elidealstorage for ideal local energy

Output is parameter values in cusp.cparam

Definition at line 524 of file CuspCorrectionConstruction.cpp.

References Bracket_min_t< T >::a, APP_ABORT, bracket_minimum(), CuspCorrection::cparam, qmcplusplus::Units::charge::e, find_minimum(), minimizeForPhiAtZero(), OneMolecularOrbital::phi(), CuspCorrectionParameters::Rc, and Bracket_min_t< T >::success.

Referenced by generateCuspInfo().

533 {
534  Bracket_min_t<RealType> bracket(Rc_init, 0.0, 0.0, false);
535  RealType start_phi0 = phiMO.phi(0.0);
536  try
537  {
538  bracket = bracket_minimum(
539  [&](RealType x) -> RealType {
540  cusp.cparam.Rc = x;
541  return minimizeForPhiAtZero(cusp, phiMO, Z, eta0, pos, ELcurr, ELideal, start_phi0);
542  },
543  Rc_init, Rc_max);
544  }
545  catch (const std::runtime_error& e)
546  {
547  APP_ABORT("Bracketing minimum failed for finding rc. \n");
548  }
549 
550 
551  if (bracket.success)
552  {
553  auto min_res = find_minimum(
554  [&](RealType x) -> RealType {
555  cusp.cparam.Rc = x;
556  return minimizeForPhiAtZero(cusp, phiMO, Z, eta0, pos, ELcurr, ELideal, start_phi0);
557  },
558  bracket);
559  }
560  else
561  {
562  cusp.cparam.Rc = bracket.a;
563  minimizeForPhiAtZero(cusp, phiMO, Z, eta0, pos, ELcurr, ELideal, start_phi0);
564  }
565 }
Bracket_min_t< T > bracket_minimum(const F &f, T initial_value, T bound_max=-1.0)
std::pair< T, T > find_minimum(const F &f, Bracket_min_t< T > &bracket)
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
QMCTraits::RealType RealType
RealType minimizeForPhiAtZero(CuspCorrection &cusp, OneMolecularOrbital &phiMO, RealType Z, RealType eta0, ValueVector &pos, ValueVector &ELcurr, ValueVector &ELideal, RealType start_phi0)
Minimize chi2 with respect to phi at zero for a fixed Rc.

◆ mpiTestFunctionWrapped()

void qmcplusplus::mpiTestFunctionWrapped ( Communicate comm,
std::vector< double > &  fake_args 
)

Openmp generally works but is not guaranteed with std::atomic.

Definition at line 21 of file test_mpi_exception_wrapper.cpp.

References CHECK(), comm, and Communicate::size().

Referenced by TEST_CASE().

22 {
23  CHECK(fake_args.size() == 4);
24 
25  if (comm->size() != 3)
26  throw std::runtime_error("Bad Rank Count, test_mpi_exception_wrapper can only be run with 3 MPI ranks.");
27 }
int size() const
return the number of tasks
Definition: Communicate.h:118
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ normalize()

void qmcplusplus::normalize ( ParticleAttrib< TinyVector< T, D >> &  pa)

Definition at line 107 of file ParticleAttribOps.h.

References Dot(), and sqrt().

108 {
109  T factor = Dot(pa, pa);
110  factor = 1.0 / sqrt(factor);
111  pa *= factor;
112 }
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
T Dot(const ParticleAttrib< TinyVector< std::complex< T >, D >> &pa, const ParticleAttrib< TinyVector< std::complex< T >, D >> &pb)

◆ OMPallocator_device_mem_allocated()

std::atomic<size_t> qmcplusplus::OMPallocator_device_mem_allocated ( )

◆ operator &() [1/26]

constexpr bool qmcplusplus::operator& ( DriverDebugChecks  x,
DriverDebugChecks  y 
)

Definition at line 28 of file DriverDebugChecks.h.

29 {
30  return (static_cast<uint_fast8_t>(x) & static_cast<uint_fast8_t>(y)) != 0x0;
31 }

◆ operator &() [2/26]

constexpr bool qmcplusplus::operator& ( DTModes  x,
DTModes  y 
)

Definition at line 49 of file DTModes.h.

50 {
51  return (static_cast<uint_fast8_t>(x) & static_cast<uint_fast8_t>(y)) != 0x0;
52 }

◆ operator &() [3/26]

MakeReturn<BinaryNode<OpBitwiseAnd, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator& ( const Matrix< T1, C1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 121 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

122 {
123  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t,
124  typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
125  Tree_t;
126  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
127 }

◆ operator &() [4/26]

MakeReturn<BinaryNode<OpBitwiseAnd, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator& ( const ParticleAttrib< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 131 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

132 {
133  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
134  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
135  Tree_t;
136  return MakeReturn<Tree_t>::make(
137  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
138 }

◆ operator &() [5/26]

MakeReturn<BinaryNode<OpBitwiseAnd, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator& ( const Matrix< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 203 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

204 {
205  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t,
206  typename CreateLeaf<Expression<T2>>::Leaf_t>
207  Tree_t;
208  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
209 }

◆ operator &() [6/26]

MakeReturn<BinaryNode<OpBitwiseAnd, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator& ( const ParticleAttrib< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 218 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

219 {
220  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
221  typename CreateLeaf<Expression<T2>>::Leaf_t>
222  Tree_t;
223  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
224 }

◆ operator &() [7/26]

MakeReturn<BinaryNode<OpBitwiseAnd, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator& ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 269 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

270 {
271  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
272  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
273  Tree_t;
274  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
275 }

◆ operator &() [8/26]

MakeReturn<BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator& ( const Expression< T1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 285 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

286 {
287  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1>>::Leaf_t,
288  typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
289  Tree_t;
290  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
291 }

◆ operator &() [9/26]

MakeReturn<BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator& ( const Expression< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 302 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

303 {
304  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1>>::Leaf_t,
305  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
306  Tree_t;
307  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
308 }

◆ operator &() [10/26]

MakeReturn< BinaryNode<OpBitwiseAnd, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator& ( const Matrix< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 357 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

358 {
359  using Tree_t = BinaryNode<OpBitwiseAnd, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
360  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
361 }

◆ operator &() [11/26]

MakeReturn< BinaryNode<OpBitwiseAnd, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator& ( const ParticleAttrib< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 378 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

379 {
380  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>
381  Tree_t;
382  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<T2>::make(r)));
383 }

◆ operator &() [12/26]

MakeReturn< BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator& ( const T1 &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 422 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

423 {
424  using Tree_t = BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>;
425  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
426 }

◆ operator &() [13/26]

MakeReturn< BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator& ( const T1 &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 451 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

452 {
453  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
454  Tree_t;
455  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
456 }

◆ operator &() [14/26]

MakeReturn<BinaryNode<OpBitwiseAnd, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator& ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 519 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

520 {
521  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
522  typename CreateLeaf<Expression<T2>>::Leaf_t>
523  Tree_t;
524  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
525 }

◆ operator &() [15/26]

MakeReturn<BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator& ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 556 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

557 {
558  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1>>::Leaf_t,
559  typename CreateLeaf<Expression<T2>>::Leaf_t>
560  Tree_t;
561  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
562 }

◆ operator &() [16/26]

MakeReturn<BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator& ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 589 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

590 {
591  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1>>::Leaf_t,
592  typename CreateLeaf<Expression<T2>>::Leaf_t>
593  Tree_t;
594  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
595 }

◆ operator &() [17/26]

MakeReturn< BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator& ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 628 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

629 {
630  using Tree_t = BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
631  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
632 }

◆ operator &() [18/26]

MakeReturn< BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator& ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 661 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

662 {
663  using Tree_t = BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
664  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
665 }

◆ operator &() [19/26]

MakeReturn< BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator& ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 693 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

694 {
695  using Tree_t = BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
696  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
697 }

◆ operator &() [20/26]

MakeReturn< BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator& ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 726 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

727 {
728  using Tree_t = BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
729  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
730 }

◆ operator &() [21/26]

MakeReturn<BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator& ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 769 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

770 {
771  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1>>::Leaf_t,
772  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
773  Tree_t;
774  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
775 }

◆ operator &() [22/26]

MakeReturn< BinaryNode<OpBitwiseAnd, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator& ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1007 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1008 {
1009  using Tree_t = BinaryNode<OpBitwiseAnd, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1010  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1011 }

◆ operator &() [23/26]

MakeReturn< BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator& ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1208 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1209 {
1210  using Tree_t = BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1211  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1212 }

◆ operator &() [24/26]

MakeReturn<BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator& ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1616 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1617 {
1618  typedef BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1>>::Leaf_t,
1619  typename CreateLeaf<Expression<T2>>::Leaf_t>
1620  Tree_t;
1621  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1622 }

◆ operator &() [25/26]

MakeReturn< BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator& ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1854 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1855 {
1856  using Tree_t = BinaryNode<OpBitwiseAnd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1857  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1858 }

◆ operator &() [26/26]

MakeReturn< BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator& ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2055 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2056 {
2057  using Tree_t = BinaryNode<OpBitwiseAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2058  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2059 }

◆ operator &&() [1/8]

MakeReturn< BinaryNode<OpAnd, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator&& ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 416 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

417 {
418  typedef BinaryNode<OpAnd, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
419  Tree_t;
420  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
421 }

◆ operator &&() [2/8]

MakeReturn< BinaryNode<OpAnd, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator&& ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 666 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

667 {
668  typedef BinaryNode<OpAnd, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
669  Tree_t;
670  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
671 }

◆ operator &&() [3/8]

MakeReturn< BinaryNode<OpAnd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator&& ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 916 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

917 {
918  typedef BinaryNode<OpAnd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
919  Tree_t;
920  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
921 }

◆ operator &&() [4/8]

MakeReturn< BinaryNode<OpAnd, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator&& ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1125 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1126 {
1127  using Tree_t = BinaryNode<OpAnd, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1128  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1129 }

◆ operator &&() [5/8]

MakeReturn< BinaryNode<OpAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator&& ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1326 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1327 {
1328  using Tree_t = BinaryNode<OpAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1329  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1330 }

◆ operator &&() [6/8]

MakeReturn< BinaryNode<OpAnd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator&& ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1763 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1764 {
1765  typedef BinaryNode<OpAnd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
1766  Tree_t;
1767  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1768 }

◆ operator &&() [7/8]

MakeReturn< BinaryNode<OpAnd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator&& ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1972 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1973 {
1974  using Tree_t = BinaryNode<OpAnd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1975  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1976 }

◆ operator &&() [8/8]

MakeReturn< BinaryNode<OpAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator&& ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2173 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2174 {
2175  using Tree_t = BinaryNode<OpAnd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2176  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2177 }

◆ operator &=() [1/3]

Matrix<T1, C1>& qmcplusplus::operator&= ( Matrix< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 784 of file OhmmsMatrixOperators.h.

References evaluate().

785 {
786  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
787  evaluate(lhs, OpBitwiseAndAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
788  return lhs;
789 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator &=() [2/3]

ParticleAttrib<T1>& qmcplusplus::operator&= ( ParticleAttrib< T1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 817 of file ParticleAttrib.cpp.

References evaluate().

818 {
819  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
820  evaluate(lhs, OpBitwiseAndAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
821  return lhs;
822 }
void evaluate(ParticleAttrib< T > &lhs, const Op &op, const Expression< RHS > &rhs)

◆ operator &=() [3/3]

Vector<T1, C1>& qmcplusplus::operator&= ( Vector< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 2281 of file OhmmsVectorOperators.h.

References evaluate().

2282 {
2283  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
2284  evaluate(lhs, OpBitwiseAndAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
2285  return lhs;
2286 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator!() [1/5]

MakeReturn<UnaryNode<OpNot, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::operator! ( const Vector< T1, C1 > &  l)
inline

Definition at line 192 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

194 {
195  using Tree_t = UnaryNode<OpNot, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
196  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
197 }

◆ operator!() [2/5]

TinyMatrix<T1, D2, D1> qmcplusplus::operator! ( const TinyMatrix< T1, D1, D2 > &  a)
inline

Definition at line 554 of file TinyMatrixOps.h.

555 {
557  for (int i = 0; i < D1; i++)
558  for (int j = 0; j < D2; j++)
559  res(i, j) = a(j, i);
560  return res;
561 }

◆ operator!() [3/5]

TinyMatrix<T1, 3, 3> qmcplusplus::operator! ( const TinyMatrix< T1, 3, 3 > &  a)
inline

Definition at line 567 of file TinyMatrixOps.h.

568 {
569  return TinyMatrix<T1, 3, 3>(a(0, 0), a(1, 0), a(2, 0), a(0, 1), a(1, 1), a(2, 1), a(0, 2), a(1, 2), a(2, 2));
570 }

◆ operator!() [4/5]

TinyMatrix<T1, 4, 4> qmcplusplus::operator! ( const TinyMatrix< T1, 4, 4 > &  a)
inline

Definition at line 576 of file TinyMatrixOps.h.

577 {
578  return TinyMatrix<T1, 4, 4>(a(0, 0), a(1, 0), a(2, 0), a(3, 0), a(0, 1), a(1, 1), a(2, 1), a(3, 1), a(0, 2), a(1, 2),
579  a(2, 2), a(3, 2), a(0, 3), a(1, 3), a(2, 3), a(3, 3));
580 }

◆ operator!() [5/5]

MakeReturn<UnaryNode<OpNot, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::operator! ( const Expression< T1 > &  l)
inline

Definition at line 1539 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1541 {
1542  using Tree_t = UnaryNode<OpNot, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1543  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1544 }

◆ operator!=() [1/19]

bool qmcplusplus::operator!= ( const CUDAManagedAllocator< T1 > &  ,
const CUDAManagedAllocator< T2 > &   
)

Definition at line 76 of file CUDAallocator.hpp.

77 {
78  return false;
79 }

◆ operator!=() [2/19]

bool qmcplusplus::operator!= ( const SYCLSharedAllocator< T1 > &  ,
const SYCLSharedAllocator< T2 > &   
)

Definition at line 78 of file SYCLallocator.hpp.

79 {
80  return false;
81 }

◆ operator!=() [3/19]

bool qmcplusplus::operator!= ( const Mallocator< T1, ALIGN1 > &  ,
const Mallocator< T2, ALIGN2 > &   
)

Definition at line 88 of file Mallocator.hpp.

89 {
90  return ALIGN1 != ALIGN2;
91 }

◆ operator!=() [4/19]

bool qmcplusplus::operator!= ( const CUDAAllocator< T1 > &  ,
const CUDAAllocator< T2 > &   
)

Definition at line 180 of file CUDAallocator.hpp.

181 {
182  return false;
183 }

◆ operator!=() [5/19]

bool qmcplusplus::operator!= ( const CrystalLattice< T, D > &  lhs,
const CrystalLattice< T, D > &  rhs 
)
inline

Definition at line 180 of file CrystalLattice.cpp.

181 {
182  return !(lhs == rhs);
183 }

◆ operator!=() [6/19]

bool qmcplusplus::operator!= ( const SYCLAllocator< T1 > &  ,
const SYCLAllocator< T2 > &   
)

Definition at line 181 of file SYCLallocator.hpp.

182 {
183  return false;
184 }

◆ operator!=() [7/19]

bool qmcplusplus::operator!= ( const CUDAHostAllocator< T1 > &  ,
const CUDAHostAllocator< T2 > &   
)

Definition at line 230 of file CUDAallocator.hpp.

231 {
232  return false;
233 }

◆ operator!=() [8/19]

bool qmcplusplus::operator!= ( const SYCLHostAllocator< T1 > &  ,
const SYCLHostAllocator< T2 > &   
)

Definition at line 245 of file SYCLallocator.hpp.

246 {
247  return false;
248 }

◆ operator!=() [9/19]

bool qmcplusplus::operator!= ( const Matrix< T, Alloc > &  lhs,
const Matrix< T, Alloc > &  rhs 
)

Definition at line 403 of file OhmmsMatrix.h.

404 {
405  static_assert(qmc_allocator_traits<Alloc>::is_host_accessible, "operator== requires host accessible Vector.");
406  return !(lhs == rhs);
407 }

◆ operator!=() [10/19]

MakeReturn< BinaryNode<OpNE, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator!= ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 405 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

406 {
407  typedef BinaryNode<OpNE, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
408  Tree_t;
409  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
410 }

◆ operator!=() [11/19]

bool qmcplusplus::operator!= ( const Vector< T, Alloc > &  lhs,
const Vector< T, Alloc > &  rhs 
)

Definition at line 438 of file OhmmsVector.h.

439 {
440  static_assert(qmc_allocator_traits<Alloc>::is_host_accessible, "operator== requires host accessible Vector.");
441  return !(lhs == rhs);
442 }

◆ operator!=() [12/19]

bool qmcplusplus::operator!= ( const Tensor< T, D > &  lhs,
const Tensor< T, D > &  rhs 
)

Definition at line 535 of file Tensor.h.

536 {
537  return !(lhs == rhs);
538 }

◆ operator!=() [13/19]

MakeReturn< BinaryNode<OpNE, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator!= ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 655 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

656 {
657  typedef BinaryNode<OpNE, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
658  Tree_t;
659  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
660 }

◆ operator!=() [14/19]

MakeReturn< BinaryNode<OpNE, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator!= ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 905 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

906 {
907  typedef BinaryNode<OpNE, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
908  Tree_t;
909  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
910 }

◆ operator!=() [15/19]

MakeReturn< BinaryNode<OpNE, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator!= ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1116 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1117 {
1118  using Tree_t = BinaryNode<OpNE, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1119  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1120 }

◆ operator!=() [16/19]

MakeReturn< BinaryNode<OpNE, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator!= ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1317 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1318 {
1319  using Tree_t = BinaryNode<OpNE, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1320  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1321 }

◆ operator!=() [17/19]

MakeReturn< BinaryNode<OpNE, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator!= ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1752 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1753 {
1754  typedef BinaryNode<OpNE, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
1755  Tree_t;
1756  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1757 }

◆ operator!=() [18/19]

MakeReturn< BinaryNode<OpNE, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator!= ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1963 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1964 {
1965  using Tree_t = BinaryNode<OpNE, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1966  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1967 }

◆ operator!=() [19/19]

MakeReturn< BinaryNode<OpNE, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator!= ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2164 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2165 {
2166  using Tree_t = BinaryNode<OpNE, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2167  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2168 }

◆ operator%() [1/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator% ( const Matrix< T1, C1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 110 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

111 {
112  typedef BinaryNode<OpMod, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t, typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
113  Tree_t;
114  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
115 }

◆ operator%() [2/18]

MakeReturn<BinaryNode<OpMod, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator% ( const ParticleAttrib< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 118 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

119 {
120  typedef BinaryNode<OpMod, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
121  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
122  Tree_t;
123  return MakeReturn<Tree_t>::make(
124  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
125 }

◆ operator%() [3/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator% ( const Matrix< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 192 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

193 {
194  typedef BinaryNode<OpMod, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
195  Tree_t;
196  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
197 }

◆ operator%() [4/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator% ( const ParticleAttrib< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 206 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

207 {
208  typedef BinaryNode<OpMod, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
209  typename CreateLeaf<Expression<T2>>::Leaf_t>
210  Tree_t;
211  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
212 }

◆ operator%() [5/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator% ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 258 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

259 {
260  typedef BinaryNode<OpMod, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
261  Tree_t;
262  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
263 }

◆ operator%() [6/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator% ( const Expression< T1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 274 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

275 {
276  typedef BinaryNode<OpMod, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
277  Tree_t;
278  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
279 }

◆ operator%() [7/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator% ( const Expression< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 290 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

291 {
292  typedef BinaryNode<OpMod, typename CreateLeaf<Expression<T1>>::Leaf_t,
293  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
294  Tree_t;
295  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
296 }

◆ operator%() [8/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator% ( const Matrix< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 347 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

348 {
349  using Tree_t = BinaryNode<OpMod, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
350  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
351 }

◆ operator%() [9/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator% ( const ParticleAttrib< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 368 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

369 {
370  using Tree_t = BinaryNode<OpMod, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
371  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<T2>::make(r)));
372 }

◆ operator%() [10/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator% ( const T1 &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 412 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

413 {
414  using Tree_t = BinaryNode<OpMod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>;
415  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
416 }

◆ operator%() [11/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator% ( const T1 &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 441 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

442 {
443  using Tree_t = BinaryNode<OpMod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>;
444  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
445 }

◆ operator%() [12/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator% ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 508 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

509 {
510  typedef BinaryNode<OpMod, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
511  Tree_t;
512  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
513 }

◆ operator%() [13/18]

MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator% ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 545 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

546 {
547  typedef BinaryNode<OpMod, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
548  Tree_t;
549  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
550 }

◆ operator%() [14/18]

MakeReturn< BinaryNode< OpMod, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator% ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 618 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

619 {
620  using Tree_t = BinaryNode<OpMod, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
621  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
622 }

◆ operator%() [15/18]

MakeReturn< BinaryNode< OpMod, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator% ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 683 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

684 {
685  using Tree_t = BinaryNode<OpMod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
686  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
687 }

◆ operator%() [16/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator% ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 758 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

759 {
760  typedef BinaryNode<OpMod, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
761  Tree_t;
762  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
763 }

◆ operator%() [17/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator% ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 997 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

998 {
999  using Tree_t = BinaryNode<OpMod, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1000  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1001 }

◆ operator%() [18/18]

MakeReturn< BinaryNode<OpMod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator% ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1198 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1199 {
1200  using Tree_t = BinaryNode<OpMod, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1201  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1202 }

◆ operator%=() [1/3]

Matrix<T1, C1>& qmcplusplus::operator%= ( Matrix< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 768 of file OhmmsMatrixOperators.h.

References evaluate().

769 {
770  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
771  evaluate(lhs, OpModAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
772  return lhs;
773 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator%=() [2/3]

ParticleAttrib<T1>& qmcplusplus::operator%= ( ParticleAttrib< T1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 801 of file ParticleAttrib.cpp.

References evaluate().

802 {
803  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
804  evaluate(lhs, OpModAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
805  return lhs;
806 }
void evaluate(ParticleAttrib< T > &lhs, const Op &op, const Expression< RHS > &rhs)

◆ operator%=() [3/3]

Vector<T1, C1>& qmcplusplus::operator%= ( Vector< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 2265 of file OhmmsVectorOperators.h.

References evaluate().

2266 {
2267  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
2268  evaluate(lhs, OpModAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
2269  return lhs;
2270 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator*() [1/18]

MakeReturn< BinaryNode<OpMultiply, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator* ( const Matrix< T1, C1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 98 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

99 {
100  typedef BinaryNode<OpMultiply, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t,
101  typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
102  Tree_t;
103  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
104 }

◆ operator*() [2/18]

MakeReturn<BinaryNode<OpMultiply, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator* ( const ParticleAttrib< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 105 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

106 {
107  typedef BinaryNode<OpMultiply, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
108  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
109  Tree_t;
110  return MakeReturn<Tree_t>::make(
111  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
112 }

◆ operator*() [3/18]

MakeReturn< BinaryNode<OpMultiply, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator* ( const Matrix< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 180 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

181 {
182  typedef BinaryNode<OpMultiply, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t,
183  typename CreateLeaf<Expression<T2>>::Leaf_t>
184  Tree_t;
185  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
186 }

◆ operator*() [4/18]

MakeReturn<BinaryNode<OpMultiply, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator* ( const ParticleAttrib< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 194 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

195 {
196  typedef BinaryNode<OpMultiply, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
197  typename CreateLeaf<Expression<T2>>::Leaf_t>
198  Tree_t;
199  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
200 }

◆ operator*() [5/18]

MakeReturn< BinaryNode<OpMultiply, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator* ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 235 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

236 {
237  typedef BinaryNode<OpMultiply, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
238  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
239  Tree_t;
240  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
241 }

◆ operator*() [6/18]

MakeReturn< BinaryNode<OpMultiply, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator* ( const Expression< T1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 262 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

263 {
264  typedef BinaryNode<OpMultiply, typename CreateLeaf<Expression<T1>>::Leaf_t,
265  typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
266  Tree_t;
267  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
268 }

◆ operator*() [7/18]

MakeReturn<BinaryNode<OpMultiply, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator* ( const Expression< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 278 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

279 {
280  typedef BinaryNode<OpMultiply, typename CreateLeaf<Expression<T1>>::Leaf_t,
281  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
282  Tree_t;
283  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
284 }

◆ operator*() [8/18]

MakeReturn< BinaryNode<OpMultiply, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator* ( const Matrix< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 338 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

339 {
340  using Tree_t = BinaryNode<OpMultiply, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
341  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
342 }

◆ operator*() [9/18]

MakeReturn< BinaryNode<OpMultiply, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator* ( const ParticleAttrib< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 358 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

359 {
360  typedef BinaryNode<OpMultiply, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>
361  Tree_t;
362  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<T2>::make(r)));
363 }

◆ operator*() [10/18]

MakeReturn< BinaryNode<OpMultiply, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator* ( const T1 &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 403 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

404 {
405  using Tree_t = BinaryNode<OpMultiply, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>;
406  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
407 }

◆ operator*() [11/18]

MakeReturn< BinaryNode<OpMultiply, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator* ( const T1 &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 431 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

432 {
433  typedef BinaryNode<OpMultiply, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
434  Tree_t;
435  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
436 }

◆ operator*() [12/18]

MakeReturn< BinaryNode<OpMultiply, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator* ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 485 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

486 {
487  typedef BinaryNode<OpMultiply, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
488  typename CreateLeaf<Expression<T2>>::Leaf_t>
489  Tree_t;
490  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
491 }

◆ operator*() [13/18]

MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator* ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 533 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

534 {
535  typedef BinaryNode<OpMultiply, typename CreateLeaf<Expression<T1>>::Leaf_t,
536  typename CreateLeaf<Expression<T2>>::Leaf_t>
537  Tree_t;
538  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
539 }

◆ operator*() [14/18]

MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator* ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 609 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

610 {
611  using Tree_t = BinaryNode<OpMultiply, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
612  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
613 }

◆ operator*() [15/18]

MakeReturn< BinaryNode< OpMultiply, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator* ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 674 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

675 {
676  using Tree_t = BinaryNode<OpMultiply, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
677  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
678 }

◆ operator*() [16/18]

MakeReturn< BinaryNode<OpMultiply, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator* ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 735 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

736 {
737  typedef BinaryNode<OpMultiply, typename CreateLeaf<Expression<T1>>::Leaf_t,
738  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
739  Tree_t;
740  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
741 }

◆ operator*() [17/18]

MakeReturn< BinaryNode<OpMultiply, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator* ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 979 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

980 {
981  using Tree_t = BinaryNode<OpMultiply, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
982  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
983 }

◆ operator*() [18/18]

MakeReturn< BinaryNode<OpMultiply, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator* ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1180 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1181 {
1182  using Tree_t = BinaryNode<OpMultiply, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1183  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1184 }

◆ operator*=() [1/3]

Matrix<T1, C1>& qmcplusplus::operator*= ( Matrix< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 760 of file OhmmsMatrixOperators.h.

References evaluate().

761 {
762  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
763  evaluate(lhs, OpMultiplyAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
764  return lhs;
765 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator*=() [2/3]

ParticleAttrib<T1>& qmcplusplus::operator*= ( ParticleAttrib< T1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 793 of file ParticleAttrib.cpp.

References evaluate().

794 {
795  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
796  evaluate(lhs, OpMultiplyAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
797  return lhs;
798 }
void evaluate(ParticleAttrib< T > &lhs, const Op &op, const Expression< RHS > &rhs)

◆ operator*=() [3/3]

Vector<T1, C1>& qmcplusplus::operator*= ( Vector< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 2249 of file OhmmsVectorOperators.h.

References evaluate().

2250 {
2251  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
2252  evaluate(lhs, OpMultiplyAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
2253  return lhs;
2254 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator+() [1/23]

MakeReturn<UnaryNode<OpUnaryPlus, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::operator+ ( const Matrix< T1, C1 > &  l)
inline

Definition at line 38 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

40 {
41  using Tree_t = UnaryNode<OpUnaryPlus, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t>;
42  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l)));
43 }

◆ operator+() [2/23]

MakeReturn<UnaryNode<OpUnaryPlus, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t> >::Expression_t qmcplusplus::operator+ ( const ParticleAttrib< T1 > &  l)
inline

Definition at line 45 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

46 {
47  using Tree_t = UnaryNode<OpUnaryPlus, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t>;
48  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l)));
49 }

◆ operator+() [3/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator+ ( const Matrix< T1, C1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 74 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

75 {
76  typedef BinaryNode<OpAdd, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t, typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
77  Tree_t;
78  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
79 }

◆ operator+() [4/23]

MakeReturn<BinaryNode<OpAdd, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator+ ( const ParticleAttrib< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 79 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

80 {
81  typedef BinaryNode<OpAdd, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
82  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
83  Tree_t;
84  return MakeReturn<Tree_t>::make(
85  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
86 }

◆ operator+() [5/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator+ ( const Matrix< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 157 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

158 {
159  typedef BinaryNode<OpAdd, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
160  Tree_t;
161  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
162 }

◆ operator+() [6/23]

MakeReturn<UnaryNode<OpUnaryPlus, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::operator+ ( const Vector< T1, C1 > &  l)
inline

Definition at line 168 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

170 {
171  using Tree_t = UnaryNode<OpUnaryPlus, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
172  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
173 }

◆ operator+() [7/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator+ ( const ParticleAttrib< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 170 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

171 {
172  typedef BinaryNode<OpAdd, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
173  typename CreateLeaf<Expression<T2>>::Leaf_t>
174  Tree_t;
175  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
176 }

◆ operator+() [8/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator+ ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 212 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

213 {
214  typedef BinaryNode<OpAdd, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
215  Tree_t;
216  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
217 }

◆ operator+() [9/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator+ ( const Expression< T1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 239 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

240 {
241  typedef BinaryNode<OpAdd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
242  Tree_t;
243  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
244 }

◆ operator+() [10/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator+ ( const Expression< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 254 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

255 {
256  typedef BinaryNode<OpAdd, typename CreateLeaf<Expression<T1>>::Leaf_t,
257  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
258  Tree_t;
259  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
260 }

◆ operator+() [11/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator+ ( const Matrix< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 320 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

321 {
322  using Tree_t = BinaryNode<OpAdd, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
323  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
324 }

◆ operator+() [12/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator+ ( const ParticleAttrib< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 337 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

338 {
339  using Tree_t = BinaryNode<OpAdd, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
340  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<T2>::make(r)));
341 }

◆ operator+() [13/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator+ ( const T1 &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 385 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

386 {
387  using Tree_t = BinaryNode<OpAdd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>;
388  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
389 }

◆ operator+() [14/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator+ ( const T1 &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 410 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

411 {
412  using Tree_t = BinaryNode<OpAdd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>;
413  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
414 }

◆ operator+() [15/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator+ ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 462 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

463 {
464  typedef BinaryNode<OpAdd, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
465  Tree_t;
466  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
467 }

◆ operator+() [16/23]

MakeReturn< UnaryNode< OpUnaryPlus, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t operator+ ( const Expression< T1 > &  l)
inline

Definition at line 474 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

476 {
477  using Tree_t = UnaryNode<OpUnaryPlus, typename CreateLeaf<Expression<T1>>::Leaf_t>;
478  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
479 }

◆ operator+() [17/23]

const AntiSymTensor<T, D>& qmcplusplus::operator+ ( const AntiSymTensor< T, D > &  op)
inline

Definition at line 495 of file AntiSymTensor.h.

496 {
497  return op;
498 }

◆ operator+() [18/23]

MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator+ ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 510 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

511 {
512  typedef BinaryNode<OpAdd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
513  Tree_t;
514  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
515 }

◆ operator+() [19/23]

MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator+ ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 591 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

592 {
593  using Tree_t = BinaryNode<OpAdd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
594  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
595 }

◆ operator+() [20/23]

MakeReturn< BinaryNode< OpAdd, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator+ ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 656 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

657 {
658  using Tree_t = BinaryNode<OpAdd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
659  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
660 }

◆ operator+() [21/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator+ ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 712 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

713 {
714  typedef BinaryNode<OpAdd, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
715  Tree_t;
716  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
717 }

◆ operator+() [22/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator+ ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 961 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

962 {
963  using Tree_t = BinaryNode<OpAdd, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
964  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
965 }

◆ operator+() [23/23]

MakeReturn< BinaryNode<OpAdd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator+ ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1162 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1163 {
1164  using Tree_t = BinaryNode<OpAdd, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1165  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1166 }

◆ operator+=() [1/3]

Matrix<T1, C1>& qmcplusplus::operator+= ( Matrix< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 744 of file OhmmsMatrixOperators.h.

References evaluate().

745 {
746  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
747  evaluate(lhs, OpAddAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
748  return lhs;
749 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator+=() [2/3]

ParticleAttrib<T1>& qmcplusplus::operator+= ( ParticleAttrib< T1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 777 of file ParticleAttrib.cpp.

References evaluate().

778 {
779  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
780  evaluate(lhs, OpAddAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
781  return lhs;
782 }
void evaluate(ParticleAttrib< T > &lhs, const Op &op, const Expression< RHS > &rhs)

◆ operator+=() [3/3]

Vector<T1, C1>& qmcplusplus::operator+= ( Vector< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 2233 of file OhmmsVectorOperators.h.

References evaluate().

2234 {
2235  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
2236  evaluate(lhs, OpAddAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
2237  return lhs;
2238 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator-() [1/22]

MakeReturn<UnaryNode<OpUnaryMinus, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::operator- ( const Matrix< T1, C1 > &  l)
inline

Definition at line 31 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

32 {
33  using Tree_t = UnaryNode<OpUnaryMinus, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t>;
34  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l)));
35 }

◆ operator-() [2/22]

MakeReturn<UnaryNode<OpUnaryMinus, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t> >::Expression_t qmcplusplus::operator- ( const ParticleAttrib< T1 > &  l)
inline

Definition at line 37 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

38 {
39  using Tree_t = UnaryNode<OpUnaryMinus, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t>;
40  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l)));
41 }

◆ operator-() [3/22]

MakeReturn< BinaryNode<OpSubtract, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator- ( const Matrix< T1, C1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 85 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

86 {
87  typedef BinaryNode<OpSubtract, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t,
88  typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
89  Tree_t;
90  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
91 }

◆ operator-() [4/22]

MakeReturn<BinaryNode<OpSubtract, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator- ( const ParticleAttrib< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 92 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

93 {
94  typedef BinaryNode<OpSubtract, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
95  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
96  Tree_t;
97  return MakeReturn<Tree_t>::make(
98  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
99 }

◆ operator-() [5/22]

MakeReturn<UnaryNode<OpUnaryMinus, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::operator- ( const Vector< T1, C1 > &  l)
inline

Definition at line 161 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

162 {
163  using Tree_t = UnaryNode<OpUnaryMinus, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
164  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
165 }

◆ operator-() [6/22]

MakeReturn< BinaryNode<OpSubtract, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator- ( const Matrix< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 168 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

169 {
170  typedef BinaryNode<OpSubtract, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t,
171  typename CreateLeaf<Expression<T2>>::Leaf_t>
172  Tree_t;
173  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
174 }

◆ operator-() [7/22]

MakeReturn<BinaryNode<OpSubtract, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator- ( const ParticleAttrib< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 182 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

183 {
184  typedef BinaryNode<OpSubtract, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
185  typename CreateLeaf<Expression<T2>>::Leaf_t>
186  Tree_t;
187  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
188 }

◆ operator-() [8/22]

MakeReturn< BinaryNode<OpSubtract, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator- ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 223 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

224 {
225  typedef BinaryNode<OpSubtract, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
226  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
227  Tree_t;
228  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
229 }

◆ operator-() [9/22]

MakeReturn< BinaryNode<OpSubtract, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator- ( const Expression< T1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 250 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

251 {
252  typedef BinaryNode<OpSubtract, typename CreateLeaf<Expression<T1>>::Leaf_t,
253  typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
254  Tree_t;
255  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
256 }

◆ operator-() [10/22]

MakeReturn<BinaryNode<OpSubtract, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator- ( const Expression< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 266 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

267 {
268  typedef BinaryNode<OpSubtract, typename CreateLeaf<Expression<T1>>::Leaf_t,
269  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
270  Tree_t;
271  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
272 }

◆ operator-() [11/22]

MakeReturn< BinaryNode<OpSubtract, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator- ( const Matrix< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 329 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

330 {
331  using Tree_t = BinaryNode<OpSubtract, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
332  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
333 }

◆ operator-() [12/22]

MakeReturn< BinaryNode<OpSubtract, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator- ( const ParticleAttrib< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 347 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

348 {
349  typedef BinaryNode<OpSubtract, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>
350  Tree_t;
351  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<T2>::make(r)));
352 }

◆ operator-() [13/22]

MakeReturn< BinaryNode<OpSubtract, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator- ( const T1 &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 394 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

395 {
396  using Tree_t = BinaryNode<OpSubtract, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>;
397  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
398 }

◆ operator-() [14/22]

MakeReturn< BinaryNode<OpSubtract, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator- ( const T1 &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 420 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

421 {
422  typedef BinaryNode<OpSubtract, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
423  Tree_t;
424  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
425 }

◆ operator-() [15/22]

MakeReturn< UnaryNode< OpUnaryMinus, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t operator- ( const Expression< T1 > &  l)
inline

Definition at line 467 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

468 {
469  using Tree_t = UnaryNode<OpUnaryMinus, typename CreateLeaf<Expression<T1>>::Leaf_t>;
470  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
471 }

◆ operator-() [16/22]

MakeReturn< BinaryNode<OpSubtract, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator- ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 473 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

474 {
475  typedef BinaryNode<OpSubtract, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
476  typename CreateLeaf<Expression<T2>>::Leaf_t>
477  Tree_t;
478  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
479 }

◆ operator-() [17/22]

MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator- ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 521 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

522 {
523  typedef BinaryNode<OpSubtract, typename CreateLeaf<Expression<T1>>::Leaf_t,
524  typename CreateLeaf<Expression<T2>>::Leaf_t>
525  Tree_t;
526  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
527 }

◆ operator-() [18/22]

MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator- ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 600 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

601 {
602  using Tree_t = BinaryNode<OpSubtract, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
603  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
604 }

◆ operator-() [19/22]

MakeReturn< BinaryNode< OpSubtract, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator- ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 665 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

666 {
667  using Tree_t = BinaryNode<OpSubtract, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
668  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
669 }

◆ operator-() [20/22]

MakeReturn< BinaryNode<OpSubtract, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator- ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 723 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

724 {
725  typedef BinaryNode<OpSubtract, typename CreateLeaf<Expression<T1>>::Leaf_t,
726  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
727  Tree_t;
728  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
729 }

◆ operator-() [21/22]

MakeReturn< BinaryNode<OpSubtract, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator- ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 970 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

971 {
972  using Tree_t = BinaryNode<OpSubtract, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
973  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
974 }

◆ operator-() [22/22]

MakeReturn< BinaryNode<OpSubtract, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator- ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1171 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1172 {
1173  using Tree_t = BinaryNode<OpSubtract, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1174  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1175 }

◆ operator-=() [1/3]

Matrix<T1, C1>& qmcplusplus::operator-= ( Matrix< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 752 of file OhmmsMatrixOperators.h.

References evaluate().

753 {
754  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
755  evaluate(lhs, OpSubtractAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
756  return lhs;
757 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator-=() [2/3]

ParticleAttrib<T1>& qmcplusplus::operator-= ( ParticleAttrib< T1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 785 of file ParticleAttrib.cpp.

References evaluate().

786 {
787  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
788  evaluate(lhs, OpSubtractAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
789  return lhs;
790 }
void evaluate(ParticleAttrib< T > &lhs, const Op &op, const Expression< RHS > &rhs)

◆ operator-=() [3/3]

Vector<T1, C1>& qmcplusplus::operator-= ( Vector< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 2241 of file OhmmsVectorOperators.h.

References evaluate().

2242 {
2243  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
2244  evaluate(lhs, OpSubtractAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
2245  return lhs;
2246 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator/() [1/11]

hdf_path operator/ ( const hdf_path lhs,
const hdf_path rhs 
)

concatenates two paths with a directory separator

Parameters
lhsleft-hand side of directory separator
rhsright-hand side of directory separator
Returns
path

Definition at line 75 of file hdf_path.cpp.

75 { return hdf_path(lhs) /= rhs; }

◆ operator/() [2/11]

hdf_path operator/ ( const hdf_path lhs,
const std::string &  rhs 
)

Definition at line 77 of file hdf_path.cpp.

77 { return hdf_path(lhs) /= std::string_view(rhs); }

◆ operator/() [3/11]

hdf_path operator/ ( const hdf_path lhs,
const char *  rhs 
)

Definition at line 79 of file hdf_path.cpp.

79 { return hdf_path(lhs) /= std::string_view(rhs); }

◆ operator/() [4/11]

MakeReturn< BinaryNode<OpDivide, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator/ ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 247 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

248 {
249  typedef BinaryNode<OpDivide, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
250  Tree_t;
251  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
252 }

◆ operator/() [5/11]

MakeReturn< BinaryNode<OpDivide, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator/ ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 497 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

498 {
499  typedef BinaryNode<OpDivide, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
500  Tree_t;
501  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
502 }

◆ operator/() [6/11]

MakeReturn< BinaryNode<OpDivide, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator/ ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 747 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

748 {
749  typedef BinaryNode<OpDivide, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
750  Tree_t;
751  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
752 }

◆ operator/() [7/11]

MakeReturn< BinaryNode<OpDivide, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator/ ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 988 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

989 {
990  using Tree_t = BinaryNode<OpDivide, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
991  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
992 }

◆ operator/() [8/11]

MakeReturn< BinaryNode<OpDivide, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator/ ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1189 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1190 {
1191  using Tree_t = BinaryNode<OpDivide, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1192  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1193 }

◆ operator/() [9/11]

MakeReturn< BinaryNode<OpDivide, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator/ ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1594 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1595 {
1596  typedef BinaryNode<OpDivide, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
1597  Tree_t;
1598  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1599 }

◆ operator/() [10/11]

MakeReturn< BinaryNode<OpDivide, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator/ ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1835 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1836 {
1837  using Tree_t = BinaryNode<OpDivide, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1838  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1839 }

◆ operator/() [11/11]

MakeReturn< BinaryNode<OpDivide, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator/ ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2036 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2037 {
2038  using Tree_t = BinaryNode<OpDivide, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2039  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2040 }

◆ operator/=()

Vector<T1, C1>& qmcplusplus::operator/= ( Vector< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 2257 of file OhmmsVectorOperators.h.

References evaluate().

2258 {
2259  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
2260  evaluate(lhs, OpDivideAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
2261  return lhs;
2262 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator<() [1/8]

MakeReturn< BinaryNode<OpLT, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator< ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 350 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

351 {
352  typedef BinaryNode<OpLT, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
353  Tree_t;
354  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
355 }

◆ operator<() [2/8]

MakeReturn< BinaryNode<OpLT, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator< ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 600 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

601 {
602  typedef BinaryNode<OpLT, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
603  Tree_t;
604  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
605 }

◆ operator<() [3/8]

MakeReturn< BinaryNode<OpLT, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator< ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 850 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

851 {
852  typedef BinaryNode<OpLT, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
853  Tree_t;
854  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
855 }

◆ operator<() [4/8]

MakeReturn< BinaryNode<OpLT, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator< ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1071 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1072 {
1073  using Tree_t = BinaryNode<OpLT, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1074  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1075 }

◆ operator<() [5/8]

MakeReturn< BinaryNode<OpLT, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator< ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1272 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1273 {
1274  using Tree_t = BinaryNode<OpLT, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1275  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1276 }

◆ operator<() [6/8]

MakeReturn< BinaryNode<OpLT, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator< ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1697 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1698 {
1699  typedef BinaryNode<OpLT, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
1700  Tree_t;
1701  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1702 }

◆ operator<() [7/8]

MakeReturn< BinaryNode<OpLT, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator< ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1918 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1919 {
1920  using Tree_t = BinaryNode<OpLT, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1921  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1922 }

◆ operator<() [8/8]

MakeReturn< BinaryNode<OpLT, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator< ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2119 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2120 {
2121  using Tree_t = BinaryNode<OpLT, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2122  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2123 }

◆ operator<<() [1/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const std::vector< T > &  rhs 
)

collapsed vector printout [3, 3, 2, 2] is printed as [3(x2), 2(x2)]

Definition at line 25 of file StlPrettyPrint.hpp.

26 {
27  out << "[";
28  auto cursor = rhs.begin();
29  while (cursor != rhs.end())
30  {
31  // each iteration handles one unique value
32  const T ref_value = *cursor;
33  size_t count = 1;
34  while (++cursor != rhs.end() && *cursor == ref_value)
35  count++;
36  out << ref_value;
37  // identical elements are collapsed
38  if (count > 1)
39  out << "(x" << count << ")";
40  // if not the last element, add a separator
41  if (cursor != rhs.end())
42  out << ", ";
43  }
44  out << "]";
45  return out;
46 }

◆ operator<<() [2/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const AxisGrid< T > &  rhs 
)

Definition at line 29 of file test_ParseGridInput.cpp.

30 {
31  out << "{";
32  out << NativePrint(rhs.ndom_int) << ", //ndom_int\n";
33  out << NativePrint(rhs.ndu_int) << ", //ndu_int\n";
34  out << NativePrint(rhs.du_int) << ", //du_int\n";
35  out << rhs.umin << ", //umin\n";
36  out << rhs.umax << ", //umax\n";
37  out << rhs.odu << ", //odu\n";
38  out << NativePrint(rhs.gmap) << ", //gmap\n";
39  out << NativePrint(rhs.ndu_per_interval) << ", //ndu_per_interval\n";
40  out << rhs.dimensions << "} //dimensions\n";
41  return out;
42 }

◆ operator<<() [3/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  o_stream,
PosUnit  pos_unit 
)
inline

write unit type in human readable format

This could break tools if they rely on parsing log.

Definition at line 30 of file PosUnit.h.

References Cartesian, and Lattice.

31 {
32  switch (pos_unit)
33  {
34  case PosUnit::Cartesian:
35  o_stream << "Cartesian";
36  break;
37  case PosUnit::Lattice:
38  o_stream << "Lattice";
39  break;
40  }
41  return o_stream;
42 }
POLT::ParticleLayout Lattice

◆ operator<<() [4/36]

std::ostream & operator<< ( std::ostream &  o_stream,
const VMCDriverInput vmci 
)

Definition at line 34 of file VMCDriverInput.cpp.

34 { return o_stream; }

◆ operator<<() [5/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const NativePrint< TinyVector< T, D >> &  np_vec 
)
inline

Definition at line 46 of file NativeInitializerPrint.hpp.

47 {
48  out << "{ ";
49  auto vec = np_vec.get_obj();
50  for (int i = 0; i < D - 1; ++i)
51  out << std::setw(12) << std::setprecision(10) << vec[i] << ", ";
52  out << std::setw(12) << std::setprecision(10) << vec[D - 1] << " }";
53  return out;
54 }

◆ operator<<() [6/36]

std::ostream & operator<< ( std::ostream &  out,
const DiracComputeBenchmarkParameters dcbmp 
)

Definition at line 60 of file benchmark_DiracMatrixComputeCUDA.cpp.

References DiracComputeBenchmarkParameters::batch_size, DiracComputeBenchmarkParameters::n, and DiracComputeBenchmarkParameters::name.

61 {
62  out << dcbmp.name << " n=" << dcbmp.n << " batch=" << dcbmp.batch_size;
63  return out;
64 }

◆ operator<<() [7/36]

std::ostream & operator<< ( std::ostream &  out,
const testing::TestableNEReferencePoints rhs 
)

Definition at line 50 of file test_ReferencePoints.cpp.

References TestableNEReferencePoints::write_testable_description().

51 {
52  rhs.write_testable_description(out);
53  return out;
54 }

◆ operator<<() [8/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const NativePrint< std::vector< T >> &  np_vec 
)
inline

Definition at line 57 of file NativeInitializerPrint.hpp.

58 {
59  out << "{ ";
60  auto vec = np_vec.get_obj();
61  for (T& t : vec)
62  out << std::setprecision(10) << t << ", ";
63  out << " }";
64  return out;
65 }

◆ operator<<() [9/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const NativePrint< std::vector< bool >> &  np_vec 
)
inline

Definition at line 68 of file NativeInitializerPrint.hpp.

69 {
70  out << "{ ";
71  auto vec = np_vec.get_obj();
72  for (const bool& t : vec)
73  {
74  std::string bool_str = t ? "true" : "false";
75  out << std::setprecision(10) << bool_str << ", ";
76  }
77  out << " }";
78  return out;
79 }

◆ operator<<() [10/36]

std::ostream & operator<< ( std::ostream &  o_stream,
const DMCDriverInput dmci 
)

Definition at line 77 of file DMCDriverInput.cpp.

77 { return o_stream; }

◆ operator<<() [11/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const NativePrint< Vector< T >> &  np_vec 
)
inline

Definition at line 82 of file NativeInitializerPrint.hpp.

83 {
84  out << "{ ";
85  auto vec = np_vec.get_obj();
86  for (T& t : vec)
87  out << std::setprecision(10) << t << ", ";
88  out << " }";
89  return out;
90 }

◆ operator<<() [12/36]

ReportEngine& qmcplusplus::operator<< ( ReportEngine o,
const T &  val 
)
inline

Definition at line 94 of file ProgressReportEngine.h.

References app_debug.

95 {
96  app_debug() << val;
97  return o;
98 }
#define app_debug
Definition: OutputManager.h:75

◆ operator<<() [13/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const HDFVersion v 
)
inline

Definition at line 101 of file HDFVersion.h.

102 {
103  out << v[0] << " " << v[1];
104  return out;
105 }

◆ operator<<() [14/36]

std::ostream & operator<< ( std::ostream &  out,
const NEReferencePoints rhs 
)

Definition at line 110 of file NEReferencePoints.cpp.

References NEReferencePoints::write_description().

111 {
112  rhs.write_description(out, "");
113  return out;
114 }

◆ operator<<() [15/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const ci_configuration2 c 
)
inline

Definition at line 127 of file ci_configuration2.h.

References ci_configuration2::occup.

128 {
129  out << "ci ci_configuration2: ";
130  for (size_t i = 0; i < c.occup.size(); i++)
131  out << c.occup[i] << " ";
132  out << std::endl;
133  return out;
134 };

◆ operator<<() [16/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const ci_configuration c 
)
inline

Definition at line 128 of file ci_configuration.h.

References ci_configuration::occup.

129 {
130  out << "ci ci_configuration: ";
131  for (int i = 0; i < c.occup.size(); i++)
132  out << c.occup[i];
133  out << std::endl;
134  return out;
135 };

◆ operator<<() [17/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  o_stream,
const VMCBatched vmc_batched 
)

◆ operator<<() [18/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  os,
const astring rhs 
)
inline

Definition at line 185 of file string_utils.h.

References astring::s.

186 {
187  os << rhs.s << std::endl;
188  return os;
189 }

◆ operator<<() [19/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const TinyVector< T, D > &  rhs 
)

Definition at line 247 of file TinyVector.h.

References print().

248 {
249  printTinyVector<TinyVector<T, D>>::print(out, rhs);
250  return out;
251 }
void print(OptimizableFunctorBase &func, std::ostream &os, double extent)
evaluates a functor (value and derivative) and dumps the quantities to output

◆ operator<<() [20/36]

std::ostream & operator<< ( std::ostream &  os,
SFNBranch::VParamType rhs 
)

Definition at line 322 of file SFNBranch.cpp.

323 {
324  for (auto value : rhs)
325  os << std::setw(18) << std::setprecision(10) << value;
326  return os;
327 }

◆ operator<<() [21/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const OneDimGridBase< T > &  rhs 
)

Definition at line 347 of file OneDimGridBase.h.

348 {
349  for (int i = 0; i < rhs.size(); i++)
350  out << i << " " << rhs.r(i) << " " << rhs.dr(i) << std::endl;
351  return out;
352 }

◆ operator<<() [22/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  o_stream,
const QMCDriverNew qmcd 
)

Definition at line 393 of file QMCDriverNew.cpp.

References app_log(), QMCDriverNew::current_step_, QMCDriverInput::get_max_blocks(), MCPopulation::get_num_local_walkers(), QMCDriverInput::get_sub_steps(), QMCDriverInput::get_tau(), QMCDriverNew::population_, QMCDriverNew::qmcdriver_input_, QMCDriverNew::steps_per_block_, and QMCDriverNew::target_samples_.

394 {
395  o_stream << " time step = " << qmcd.qmcdriver_input_.get_tau() << '\n';
396  o_stream << " blocks = " << qmcd.qmcdriver_input_.get_max_blocks() << '\n';
397  o_stream << " steps = " << qmcd.steps_per_block_ << '\n';
398  o_stream << " substeps = " << qmcd.qmcdriver_input_.get_sub_steps() << '\n';
399  o_stream << " current = " << qmcd.current_step_ << '\n';
400  o_stream << " target samples = " << qmcd.target_samples_ << '\n';
401  o_stream << " walkers/mpi = " << qmcd.population_.get_num_local_walkers() << std::endl;
402  app_log().flush();
403 
404  return o_stream;
405 }
std::ostream & app_log()
Definition: OutputManager.h:65

◆ operator<<() [23/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const Matrix< T, Alloc > &  rhs 
)

Definition at line 412 of file OhmmsMatrix.h.

413 {
414  using size_type = typename Matrix<T, Alloc>::size_type;
415  size_type ii = 0;
416  for (size_type i = 0; i < rhs.rows(); i++)
417  {
418  for (size_type j = 0; j < rhs.cols(); j++)
419  out << rhs(ii++) << " ";
420  out << std::endl;
421  }
422  return out;
423 }

◆ operator<<() [24/36]

MakeReturn< BinaryNode<OpLeftShift, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator<< ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 438 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

439 {
440  typedef BinaryNode<OpLeftShift, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
441  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
442  Tree_t;
443  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
444 }

◆ operator<<() [25/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const Vector< T, Alloc > &  rhs 
)

Definition at line 446 of file OhmmsVector.h.

447 {
448  static_assert(qmc_allocator_traits<Alloc>::is_host_accessible, "operator<< requires host accessible Vector.");
449  for (int i = 0; i < rhs.size(); i++)
450  out << rhs[i] << std::endl;
451  return out;
452 }

◆ operator<<() [26/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const SymTensor< T, D > &  rhs 
)

Definition at line 449 of file SymTensor.h.

450 {
451  if (D >= 1)
452  {
453  for (int i = 0; i < D; i++)
454  {
455  for (int j = 0; j < D - 1; j++)
456  {
457  out << rhs(i, j) << " ";
458  }
459  out << rhs(i, D - 1) << " ";
460  if (i < D - 1)
461  out << std::endl;
462  }
463  }
464  else
465  {
466  out << " " << rhs(0, 0) << " ";
467  }
468  return out;
469 }

◆ operator<<() [27/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const Walker< RealType, PA > &  rhs 
)

Definition at line 476 of file Walker.h.

References copy().

477 {
478  copy(rhs.Properties.begin(), rhs.Properties.end(), std::ostream_iterator<double>(out, " "));
479  out << std::endl;
480  out << rhs.R;
481  return out;
482 }
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
Definition: Blitz.h:639

◆ operator<<() [28/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const Tensor< T, D > &  rhs 
)

Vector-vector outter product $ result(i,j)=v1(i)*v2(j)$.

Parameters
v1a vector
v2a vector

Definition at line 495 of file Tensor.h.

496 {
497  if (D >= 1)
498  {
499  for (int i = 0; i < D; i++)
500  {
501  for (int j = 0; j < D - 1; j++)
502  {
503  out << rhs(i, j) << " ";
504  }
505  out << rhs(i, D - 1) << " ";
506  if (i < D - 1)
507  out << std::endl;
508  }
509  }
510  else
511  {
512  out << " " << rhs(0, 0) << " ";
513  }
514  return out;
515 }

◆ operator<<() [29/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const AntiSymTensor< T, D > &  rhs 
)

Definition at line 615 of file AntiSymTensor.h.

616 {
617  if (D >= 1)
618  {
619  for (int i = 0; i < D; i++)
620  {
621  for (int j = 0; j < D - 1; j++)
622  {
623  out << rhs(i, j) << " ";
624  }
625  out << rhs(i, D - 1) << " ";
626  if (i < D - 1)
627  out << std::endl;
628  }
629  }
630  else
631  {
632  out << " " << rhs(0, 0) << " ";
633  }
634  return out;
635 }

◆ operator<<() [30/36]

MakeReturn< BinaryNode<OpLeftShift, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator<< ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 688 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

689 {
690  typedef BinaryNode<OpLeftShift, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
691  typename CreateLeaf<Expression<T2>>::Leaf_t>
692  Tree_t;
693  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
694 }

◆ operator<<() [31/36]

std::ostream & operator<< ( std::ostream &  os,
SimpleFixedNodeBranch::VParamType rhs 
)

Definition at line 822 of file SimpleFixedNodeBranch.cpp.

823 {
824  for (auto value : rhs)
825  os << std::setw(18) << std::setprecision(10) << value;
826  return os;
827 }

◆ operator<<() [32/36]

std::ostream& qmcplusplus::operator<< ( std::ostream &  out,
const ParticleAttrib< T > &  rhs 
)

Definition at line 922 of file ParticleAttrib.cpp.

923 {
924  for (int i = 0; i < rhs.size(); i++)
925  out << rhs[i] << std::endl;
926  return out;
927 }

◆ operator<<() [33/36]

MakeReturn< BinaryNode<OpLeftShift, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator<< ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 938 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

939 {
940  typedef BinaryNode<OpLeftShift, typename CreateLeaf<Expression<T1>>::Leaf_t,
941  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
942  Tree_t;
943  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
944 }

◆ operator<<() [34/36]

MakeReturn< BinaryNode<OpLeftShift, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator<< ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1143 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1144 {
1145  using Tree_t = BinaryNode<OpLeftShift, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1146  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1147 }

◆ operator<<() [35/36]

MakeReturn< BinaryNode<OpLeftShift, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator<< ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1785 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1786 {
1787  typedef BinaryNode<OpLeftShift, typename CreateLeaf<Expression<T1>>::Leaf_t,
1788  typename CreateLeaf<Expression<T2>>::Leaf_t>
1789  Tree_t;
1790  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1791 }

◆ operator<<() [36/36]

MakeReturn< BinaryNode<OpLeftShift, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator<< ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1990 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1991 {
1992  using Tree_t = BinaryNode<OpLeftShift, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1993  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1994 }

◆ operator<<=()

Vector<T1, C1>& qmcplusplus::operator<<= ( Vector< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 2297 of file OhmmsVectorOperators.h.

References evaluate().

2298 {
2299  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
2300  evaluate(lhs, OpLeftShiftAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
2301  return lhs;
2302 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator<=() [1/8]

MakeReturn< BinaryNode<OpLE, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator<= ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 361 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

362 {
363  typedef BinaryNode<OpLE, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
364  Tree_t;
365  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
366 }

◆ operator<=() [2/8]

MakeReturn< BinaryNode<OpLE, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator<= ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 611 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

612 {
613  typedef BinaryNode<OpLE, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
614  Tree_t;
615  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
616 }

◆ operator<=() [3/8]

MakeReturn< BinaryNode<OpLE, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator<= ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 861 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

862 {
863  typedef BinaryNode<OpLE, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
864  Tree_t;
865  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
866 }

◆ operator<=() [4/8]

MakeReturn< BinaryNode<OpLE, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator<= ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1080 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1081 {
1082  using Tree_t = BinaryNode<OpLE, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1083  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1084 }

◆ operator<=() [5/8]

MakeReturn< BinaryNode<OpLE, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator<= ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1281 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1282 {
1283  using Tree_t = BinaryNode<OpLE, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1284  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1285 }

◆ operator<=() [6/8]

MakeReturn< BinaryNode<OpLE, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator<= ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1708 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1709 {
1710  typedef BinaryNode<OpLE, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
1711  Tree_t;
1712  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1713 }

◆ operator<=() [7/8]

MakeReturn< BinaryNode<OpLE, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator<= ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1927 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1928 {
1929  using Tree_t = BinaryNode<OpLE, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1930  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1931 }

◆ operator<=() [8/8]

MakeReturn< BinaryNode<OpLE, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator<= ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2128 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2129 {
2130  using Tree_t = BinaryNode<OpLE, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2131  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2132 }

◆ operator==() [1/21]

bool qmcplusplus::operator== ( const CUDAManagedAllocator< T1 > &  ,
const CUDAManagedAllocator< T2 > &   
)

Definition at line 71 of file CUDAallocator.hpp.

72 {
73  return true;
74 }

◆ operator==() [2/21]

bool qmcplusplus::operator== ( const SYCLSharedAllocator< T1 > &  ,
const SYCLSharedAllocator< T2 > &   
)

Definition at line 73 of file SYCLallocator.hpp.

74 {
75  return true;
76 }

◆ operator==() [3/21]

bool operator== ( const hdf_path lhs,
const hdf_path rhs 
)
noexcept

Checks whether lhs and rhs are equal.

Parameters
lhsfirst path
rhssecond path
Returns
result

Definition at line 81 of file hdf_path.cpp.

81 { return lhs.string() == rhs.string(); }

◆ operator==() [4/21]

bool qmcplusplus::operator== ( const Mallocator< T1, ALIGN1 > &  ,
const Mallocator< T2, ALIGN2 > &   
)

Definition at line 83 of file Mallocator.hpp.

84 {
85  return ALIGN1 == ALIGN2;
86 }

◆ operator==() [5/21]

bool qmcplusplus::operator== ( const CrystalLattice< T, D > &  lhs,
const CrystalLattice< T, D > &  rhs 
)
inline

Definition at line 171 of file CrystalLattice.cpp.

References abs(), and CrystalLattice< T, D >::R.

172 {
173  for (int i = 0; i < D * D; ++i)
174  if (std::abs(lhs.R[i] - rhs.R[i]) > std::numeric_limits<T>::epsilon())
175  return false;
176  return true;
177 }
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)

◆ operator==() [6/21]

bool qmcplusplus::operator== ( const CUDAAllocator< T1 > &  ,
const CUDAAllocator< T2 > &   
)

Definition at line 175 of file CUDAallocator.hpp.

176 {
177  return true;
178 }

◆ operator==() [7/21]

bool qmcplusplus::operator== ( const SYCLAllocator< T1 > &  ,
const SYCLAllocator< T2 > &   
)

Definition at line 176 of file SYCLallocator.hpp.

177 {
178  return true;
179 }

◆ operator==() [8/21]

bool qmcplusplus::operator== ( const astring lhs,
const astring rhs 
)
inline

Definition at line 191 of file string_utils.h.

References astring::s.

191 { return lhs.s == rhs.s; }

◆ operator==() [9/21]

bool qmcplusplus::operator== ( const CUDAHostAllocator< T1 > &  ,
const CUDAHostAllocator< T2 > &   
)

Definition at line 225 of file CUDAallocator.hpp.

226 {
227  return true;
228 }

◆ operator==() [10/21]

bool qmcplusplus::operator== ( const SYCLHostAllocator< T1 > &  ,
const SYCLHostAllocator< T2 > &   
)

Definition at line 239 of file SYCLallocator.hpp.

240 {
241  return true;
242 }

◆ operator==() [11/21]

bool qmcplusplus::operator== ( const Matrix< T, Alloc > &  lhs,
const Matrix< T, Alloc > &  rhs 
)

Definition at line 388 of file OhmmsMatrix.h.

References Matrix< T, Alloc >::size().

389 {
390  static_assert(qmc_allocator_traits<Alloc>::is_host_accessible, "operator== requires host accessible Vector.");
391  if (lhs.size() == rhs.size())
392  {
393  for (int i = 0; i < rhs.size(); i++)
394  if (lhs(i) != rhs(i))
395  return false;
396  return true;
397  }
398  else
399  return false;
400 }

◆ operator==() [12/21]

MakeReturn< BinaryNode<OpEQ, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator== ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 394 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

395 {
396  typedef BinaryNode<OpEQ, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
397  Tree_t;
398  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
399 }

◆ operator==() [13/21]

bool qmcplusplus::operator== ( const Vector< T, Alloc > &  lhs,
const Vector< T, Alloc > &  rhs 
)

Definition at line 423 of file OhmmsVector.h.

References Vector< T, Alloc >::size().

424 {
425  static_assert(qmc_allocator_traits<Alloc>::is_host_accessible, "operator== requires host accessible Vector.");
426  if (lhs.size() == rhs.size())
427  {
428  for (int i = 0; i < rhs.size(); i++)
429  if (lhs[i] != rhs[i])
430  return false;
431  return true;
432  }
433  else
434  return false;
435 }

◆ operator==() [14/21]

bool qmcplusplus::operator== ( const Tensor< T, D > &  lhs,
const Tensor< T, D > &  rhs 
)

Definition at line 526 of file Tensor.h.

527 {
528  for (int i = 0; i < D * D; i++)
529  if (lhs[i] != rhs[i])
530  return false;
531  return true;
532 }

◆ operator==() [15/21]

MakeReturn< BinaryNode<OpEQ, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator== ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 644 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

645 {
646  typedef BinaryNode<OpEQ, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
647  Tree_t;
648  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
649 }

◆ operator==() [16/21]

MakeReturn< BinaryNode<OpEQ, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator== ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 894 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

895 {
896  typedef BinaryNode<OpEQ, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
897  Tree_t;
898  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
899 }

◆ operator==() [17/21]

MakeReturn< BinaryNode<OpEQ, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator== ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1107 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1108 {
1109  using Tree_t = BinaryNode<OpEQ, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1110  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1111 }

◆ operator==() [18/21]

MakeReturn< BinaryNode<OpEQ, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator== ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1308 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1309 {
1310  using Tree_t = BinaryNode<OpEQ, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1311  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1312 }

◆ operator==() [19/21]

MakeReturn< BinaryNode<OpEQ, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator== ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1741 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1742 {
1743  typedef BinaryNode<OpEQ, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
1744  Tree_t;
1745  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1746 }

◆ operator==() [20/21]

MakeReturn< BinaryNode<OpEQ, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator== ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1954 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1955 {
1956  using Tree_t = BinaryNode<OpEQ, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1957  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1958 }

◆ operator==() [21/21]

MakeReturn< BinaryNode<OpEQ, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator== ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2155 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2156 {
2157  using Tree_t = BinaryNode<OpEQ, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2158  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2159 }

◆ operator>() [1/8]

MakeReturn< BinaryNode<OpGT, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator> ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 372 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

373 {
374  typedef BinaryNode<OpGT, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
375  Tree_t;
376  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
377 }

◆ operator>() [2/8]

MakeReturn< BinaryNode<OpGT, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator> ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 622 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

623 {
624  typedef BinaryNode<OpGT, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
625  Tree_t;
626  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
627 }

◆ operator>() [3/8]

MakeReturn< BinaryNode<OpGT, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator> ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 872 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

873 {
874  typedef BinaryNode<OpGT, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
875  Tree_t;
876  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
877 }

◆ operator>() [4/8]

MakeReturn< BinaryNode<OpGT, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator> ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1089 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1090 {
1091  using Tree_t = BinaryNode<OpGT, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1092  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1093 }

◆ operator>() [5/8]

MakeReturn< BinaryNode<OpGT, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator> ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1290 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1291 {
1292  using Tree_t = BinaryNode<OpGT, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1293  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1294 }

◆ operator>() [6/8]

MakeReturn< BinaryNode<OpGT, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator> ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1719 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1720 {
1721  typedef BinaryNode<OpGT, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
1722  Tree_t;
1723  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1724 }

◆ operator>() [7/8]

MakeReturn< BinaryNode<OpGT, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator> ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1936 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1937 {
1938  using Tree_t = BinaryNode<OpGT, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1939  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1940 }

◆ operator>() [8/8]

MakeReturn< BinaryNode<OpGT, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator> ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2137 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2138 {
2139  using Tree_t = BinaryNode<OpGT, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2140  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2141 }

◆ operator>=() [1/8]

MakeReturn< BinaryNode<OpGE, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator>= ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 383 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

384 {
385  typedef BinaryNode<OpGE, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
386  Tree_t;
387  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
388 }

◆ operator>=() [2/8]

MakeReturn< BinaryNode<OpGE, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator>= ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 633 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

634 {
635  typedef BinaryNode<OpGE, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
636  Tree_t;
637  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
638 }

◆ operator>=() [3/8]

MakeReturn< BinaryNode<OpGE, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator>= ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 883 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

884 {
885  typedef BinaryNode<OpGE, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
886  Tree_t;
887  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
888 }

◆ operator>=() [4/8]

MakeReturn< BinaryNode<OpGE, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator>= ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1098 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1099 {
1100  using Tree_t = BinaryNode<OpGE, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1101  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1102 }

◆ operator>=() [5/8]

MakeReturn< BinaryNode<OpGE, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator>= ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1299 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1300 {
1301  using Tree_t = BinaryNode<OpGE, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1302  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1303 }

◆ operator>=() [6/8]

MakeReturn< BinaryNode<OpGE, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator>= ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1730 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1731 {
1732  typedef BinaryNode<OpGE, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
1733  Tree_t;
1734  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1735 }

◆ operator>=() [7/8]

MakeReturn< BinaryNode<OpGE, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator>= ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1945 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1946 {
1947  using Tree_t = BinaryNode<OpGE, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1948  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1949 }

◆ operator>=() [8/8]

MakeReturn< BinaryNode<OpGE, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator>= ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2146 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2147 {
2148  using Tree_t = BinaryNode<OpGE, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2149  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2150 }

◆ operator>>() [1/13]

std::istream& qmcplusplus::operator>> ( std::istream &  i_stream,
PosUnit pos_unit 
)
inline

Read unit type recorded in int.

This should really be human readable TODO: support both until going to string only.

Definition at line 49 of file PosUnit.h.

50 {
51  int unit_read;
52  i_stream >> unit_read;
53  pos_unit = static_cast<PosUnit>(unit_read);
54  return i_stream;
55 }
PosUnit
enum class to assist copy and unit conversion operations on position vectors
Definition: PosUnit.h:21

◆ operator>>() [2/13]

std::istream& qmcplusplus::operator>> ( std::istream &  is,
HDFVersion v 
)
inline

Definition at line 107 of file HDFVersion.h.

108 {
109  is >> v[0] >> v[1];
110  return is;
111 }

◆ operator>>() [3/13]

std::istream& qmcplusplus::operator>> ( std::istream &  is,
astring rhs 
)
inline

Definition at line 177 of file string_utils.h.

References astring::s.

178 {
179  char buf[256];
180  is.getline(buf, 256);
181  rhs.s.assign(buf);
182  return is;
183 }

◆ operator>>() [4/13]

std::istream& qmcplusplus::operator>> ( std::istream &  is,
TinyVector< T, D > &  rhs 
)

Definition at line 254 of file TinyVector.h.

255 {
256  //printTinyVector<TinyVector<T,D> >::print(out,rhs);
257  for (int i = 0; i < D; i++)
258  is >> rhs[i];
259  return is;
260 }

◆ operator>>() [5/13]

std::istream& qmcplusplus::operator>> ( std::istream &  is,
Matrix< T, Alloc > &  rhs 
)

Definition at line 427 of file OhmmsMatrix.h.

References Matrix< T, Alloc >::size().

428 {
429  using size_type = typename Matrix<T, Alloc>::size_type;
430  for (size_type i = 0; i < rhs.size(); i++)
431  {
432  is >> rhs(i++);
433  }
434  return is;
435 }

◆ operator>>() [6/13]

MakeReturn<BinaryNode<OpRightShift, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator>> ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 450 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

451 {
452  typedef BinaryNode<OpRightShift, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
453  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
454  Tree_t;
455  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
456 }

◆ operator>>() [7/13]

std::istream& qmcplusplus::operator>> ( std::istream &  is,
Vector< T, Alloc > &  rhs 
)

Definition at line 455 of file OhmmsVector.h.

References Vector< T, Alloc >::size().

456 {
457  static_assert(qmc_allocator_traits<Alloc>::is_host_accessible, "operator>> requires host accessible Vector.");
458  //printTinyVector<TinyVector<T,D> >::print(out,rhs);
459  for (int i = 0; i < rhs.size(); i++)
460  is >> rhs[i];
461  return is;
462 }

◆ operator>>() [8/13]

std::istream& qmcplusplus::operator>> ( std::istream &  is,
Tensor< T, D > &  rhs 
)

Definition at line 518 of file Tensor.h.

519 {
520  for (int i = 0; i < D * D; i++)
521  is >> rhs[i];
522  return is;
523 }

◆ operator>>() [9/13]

MakeReturn<BinaryNode<OpRightShift, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator>> ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 700 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

701 {
702  typedef BinaryNode<OpRightShift, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
703  typename CreateLeaf<Expression<T2>>::Leaf_t>
704  Tree_t;
705  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
706 }

◆ operator>>() [10/13]

MakeReturn<BinaryNode<OpRightShift, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator>> ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 950 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

951 {
952  typedef BinaryNode<OpRightShift, typename CreateLeaf<Expression<T1>>::Leaf_t,
953  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
954  Tree_t;
955  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
956 }

◆ operator>>() [11/13]

MakeReturn< BinaryNode<OpRightShift, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator>> ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1153 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1154 {
1155  using Tree_t = BinaryNode<OpRightShift, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1156  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1157 }

◆ operator>>() [12/13]

MakeReturn<BinaryNode<OpRightShift, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator>> ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1797 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1798 {
1799  typedef BinaryNode<OpRightShift, typename CreateLeaf<Expression<T1>>::Leaf_t,
1800  typename CreateLeaf<Expression<T2>>::Leaf_t>
1801  Tree_t;
1802  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1803 }

◆ operator>>() [13/13]

MakeReturn< BinaryNode<OpRightShift, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator>> ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 2000 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2001 {
2002  using Tree_t = BinaryNode<OpRightShift, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
2003  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
2004 }

◆ operator>>=()

Vector<T1, C1>& qmcplusplus::operator>>= ( Vector< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 2305 of file OhmmsVectorOperators.h.

References evaluate().

2306 {
2307  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
2308  evaluate(lhs, OpRightShiftAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
2309  return lhs;
2310 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator^() [1/18]

MakeReturn<BinaryNode<OpBitwiseXor, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator^ ( const Matrix< T1, C1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 145 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

146 {
147  typedef BinaryNode<OpBitwiseXor, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t,
148  typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
149  Tree_t;
150  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
151 }

◆ operator^() [2/18]

MakeReturn<BinaryNode<OpBitwiseXor, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator^ ( const ParticleAttrib< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 157 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

158 {
159  typedef BinaryNode<OpBitwiseXor, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
160  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
161  Tree_t;
162  return MakeReturn<Tree_t>::make(
163  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
164 }

◆ operator^() [3/18]

MakeReturn<BinaryNode<OpBitwiseXor, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator^ ( const Matrix< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 227 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

228 {
229  typedef BinaryNode<OpBitwiseXor, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t,
230  typename CreateLeaf<Expression<T2>>::Leaf_t>
231  Tree_t;
232  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
233 }

◆ operator^() [4/18]

MakeReturn<BinaryNode<OpBitwiseXor, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator^ ( const ParticleAttrib< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 242 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

243 {
244  typedef BinaryNode<OpBitwiseXor, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
245  typename CreateLeaf<Expression<T2>>::Leaf_t>
246  Tree_t;
247  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
248 }

◆ operator^() [5/18]

MakeReturn<BinaryNode<OpBitwiseXor, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator^ ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 293 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

294 {
295  typedef BinaryNode<OpBitwiseXor, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
296  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
297  Tree_t;
298  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
299 }

◆ operator^() [6/18]

MakeReturn<BinaryNode<OpBitwiseXor, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator^ ( const Expression< T1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 309 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

310 {
311  typedef BinaryNode<OpBitwiseXor, typename CreateLeaf<Expression<T1>>::Leaf_t,
312  typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
313  Tree_t;
314  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
315 }

◆ operator^() [7/18]

MakeReturn<BinaryNode<OpBitwiseXor, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator^ ( const Expression< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 326 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

327 {
328  typedef BinaryNode<OpBitwiseXor, typename CreateLeaf<Expression<T1>>::Leaf_t,
329  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
330  Tree_t;
331  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
332 }

◆ operator^() [8/18]

MakeReturn< BinaryNode<OpBitwiseXor, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator^ ( const Matrix< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 376 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

377 {
378  using Tree_t = BinaryNode<OpBitwiseXor, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
379  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
380 }

◆ operator^() [9/18]

MakeReturn< BinaryNode<OpBitwiseXor, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator^ ( const ParticleAttrib< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 400 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

401 {
402  typedef BinaryNode<OpBitwiseXor, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>
403  Tree_t;
404  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<T2>::make(r)));
405 }

◆ operator^() [10/18]

MakeReturn< BinaryNode<OpBitwiseXor, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator^ ( const T1 &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 441 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

442 {
443  using Tree_t = BinaryNode<OpBitwiseXor, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>;
444  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
445 }

◆ operator^() [11/18]

MakeReturn< BinaryNode<OpBitwiseXor, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator^ ( const T1 &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 473 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

474 {
475  typedef BinaryNode<OpBitwiseXor, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
476  Tree_t;
477  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
478 }

◆ operator^() [12/18]

MakeReturn<BinaryNode<OpBitwiseXor, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator^ ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 543 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

544 {
545  typedef BinaryNode<OpBitwiseXor, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
546  typename CreateLeaf<Expression<T2>>::Leaf_t>
547  Tree_t;
548  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
549 }

◆ operator^() [13/18]

MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator^ ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 580 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

581 {
582  typedef BinaryNode<OpBitwiseXor, typename CreateLeaf<Expression<T1>>::Leaf_t,
583  typename CreateLeaf<Expression<T2>>::Leaf_t>
584  Tree_t;
585  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
586 }

◆ operator^() [14/18]

MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator^ ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 647 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

648 {
649  using Tree_t = BinaryNode<OpBitwiseXor, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
650  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
651 }

◆ operator^() [15/18]

MakeReturn< BinaryNode< OpBitwiseXor, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator^ ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 712 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

713 {
714  using Tree_t = BinaryNode<OpBitwiseXor, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
715  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
716 }

◆ operator^() [16/18]

MakeReturn<BinaryNode<OpBitwiseXor, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator^ ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 793 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

794 {
795  typedef BinaryNode<OpBitwiseXor, typename CreateLeaf<Expression<T1>>::Leaf_t,
796  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
797  Tree_t;
798  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
799 }

◆ operator^() [17/18]

MakeReturn< BinaryNode<OpBitwiseXor, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator^ ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1026 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1027 {
1028  using Tree_t = BinaryNode<OpBitwiseXor, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1029  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1030 }

◆ operator^() [18/18]

MakeReturn< BinaryNode<OpBitwiseXor, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator^ ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1227 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1228 {
1229  using Tree_t = BinaryNode<OpBitwiseXor, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1230  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1231 }

◆ operator^=() [1/3]

Matrix<T1, C1>& qmcplusplus::operator^= ( Matrix< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 792 of file OhmmsMatrixOperators.h.

References evaluate().

793 {
794  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
795  evaluate(lhs, OpBitwiseXorAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
796  return lhs;
797 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator^=() [2/3]

ParticleAttrib<T1>& qmcplusplus::operator^= ( ParticleAttrib< T1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 825 of file ParticleAttrib.cpp.

References evaluate().

826 {
827  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
828  evaluate(lhs, OpBitwiseXorAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
829  return lhs;
830 }
void evaluate(ParticleAttrib< T > &lhs, const Op &op, const Expression< RHS > &rhs)

◆ operator^=() [3/3]

Vector<T1, C1>& qmcplusplus::operator^= ( Vector< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 2289 of file OhmmsVectorOperators.h.

References evaluate().

2290 {
2291  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
2292  evaluate(lhs, OpBitwiseXorAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
2293  return lhs;
2294 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator|() [1/20]

constexpr DriverDebugChecks qmcplusplus::operator| ( DriverDebugChecks  x,
DriverDebugChecks  y 
)

Definition at line 33 of file DriverDebugChecks.h.

34 {
35  return static_cast<DriverDebugChecks>(static_cast<uint_fast8_t>(x) | static_cast<uint_fast8_t>(y));
36 }

◆ operator|() [2/20]

constexpr DTModes qmcplusplus::operator| ( DTModes  x,
DTModes  y 
)

Definition at line 54 of file DTModes.h.

55 {
56  return static_cast<DTModes>(static_cast<uint_fast8_t>(x) | static_cast<uint_fast8_t>(y));
57 }

◆ operator|() [3/20]

MakeReturn< BinaryNode<OpBitwiseOr, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator| ( const Matrix< T1, C1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 133 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

134 {
135  typedef BinaryNode<OpBitwiseOr, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t,
136  typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
137  Tree_t;
138  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
139 }

◆ operator|() [4/20]

MakeReturn<BinaryNode<OpBitwiseOr, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator| ( const ParticleAttrib< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 144 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

145 {
146  typedef BinaryNode<OpBitwiseOr, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
147  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
148  Tree_t;
149  return MakeReturn<Tree_t>::make(
150  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
151 }

◆ operator|() [5/20]

MakeReturn< BinaryNode<OpBitwiseOr, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator| ( const Matrix< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 215 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

216 {
217  typedef BinaryNode<OpBitwiseOr, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t,
218  typename CreateLeaf<Expression<T2>>::Leaf_t>
219  Tree_t;
220  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
221 }

◆ operator|() [6/20]

MakeReturn<BinaryNode<OpBitwiseOr, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator| ( const ParticleAttrib< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 230 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

231 {
232  typedef BinaryNode<OpBitwiseOr, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t,
233  typename CreateLeaf<Expression<T2>>::Leaf_t>
234  Tree_t;
235  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
236 }

◆ operator|() [7/20]

MakeReturn< BinaryNode<OpBitwiseOr, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator| ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 281 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

282 {
283  typedef BinaryNode<OpBitwiseOr, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
284  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
285  Tree_t;
286  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
287 }

◆ operator|() [8/20]

MakeReturn< BinaryNode<OpBitwiseOr, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator| ( const Expression< T1 > &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 297 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

298 {
299  typedef BinaryNode<OpBitwiseOr, typename CreateLeaf<Expression<T1>>::Leaf_t,
300  typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>
301  Tree_t;
302  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
303 }

◆ operator|() [9/20]

MakeReturn<BinaryNode<OpBitwiseOr, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator| ( const Expression< T1 > &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 314 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

315 {
316  typedef BinaryNode<OpBitwiseOr, typename CreateLeaf<Expression<T1>>::Leaf_t,
317  typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
318  Tree_t;
319  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
320 }

◆ operator|() [10/20]

MakeReturn< BinaryNode<OpBitwiseOr, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator| ( const Matrix< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 366 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

367 {
368  using Tree_t = BinaryNode<OpBitwiseOr, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
369  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
370 }

◆ operator|() [11/20]

MakeReturn< BinaryNode<OpBitwiseOr, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >:: Expression_t qmcplusplus::operator| ( const ParticleAttrib< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 389 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

390 {
391  typedef BinaryNode<OpBitwiseOr, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>
392  Tree_t;
393  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l), CreateLeaf<T2>::make(r)));
394 }

◆ operator|() [12/20]

MakeReturn< BinaryNode<OpBitwiseOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator| ( const T1 &  l,
const Matrix< T2, C2 > &  r 
)
inline

Definition at line 431 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

432 {
433  using Tree_t = BinaryNode<OpBitwiseOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>;
434  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Matrix<T2, C2>>::make(r)));
435 }

◆ operator|() [13/20]

MakeReturn< BinaryNode<OpBitwiseOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator| ( const T1 &  l,
const ParticleAttrib< T2 > &  r 
)
inline

Definition at line 462 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

463 {
464  typedef BinaryNode<OpBitwiseOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>
465  Tree_t;
466  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<ParticleAttrib<T2>>::make(r)));
467 }

◆ operator|() [14/20]

MakeReturn< BinaryNode<OpBitwiseOr, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator| ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 531 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

532 {
533  typedef BinaryNode<OpBitwiseOr, typename CreateLeaf<Vector<T1, C1>>::Leaf_t,
534  typename CreateLeaf<Expression<T2>>::Leaf_t>
535  Tree_t;
536  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
537 }

◆ operator|() [15/20]

MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator| ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 568 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

569 {
570  typedef BinaryNode<OpBitwiseOr, typename CreateLeaf<Expression<T1>>::Leaf_t,
571  typename CreateLeaf<Expression<T2>>::Leaf_t>
572  Tree_t;
573  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
574 }

◆ operator|() [16/20]

MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t > >::Expression_t operator| ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 637 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

638 {
639  using Tree_t = BinaryNode<OpBitwiseOr, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
640  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
641 }

◆ operator|() [17/20]

MakeReturn< BinaryNode< OpBitwiseOr, typename CreateLeaf< T1 >::Leaf_t, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t operator| ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 702 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

703 {
704  using Tree_t = BinaryNode<OpBitwiseOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
705  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
706 }

◆ operator|() [18/20]

MakeReturn< BinaryNode<OpBitwiseOr, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator| ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 781 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

782 {
783  typedef BinaryNode<OpBitwiseOr, typename CreateLeaf<Expression<T1>>::Leaf_t,
784  typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
785  Tree_t;
786  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
787 }

◆ operator|() [19/20]

MakeReturn< BinaryNode<OpBitwiseOr, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator| ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1016 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1017 {
1018  using Tree_t = BinaryNode<OpBitwiseOr, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1019  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1020 }

◆ operator|() [20/20]

MakeReturn< BinaryNode<OpBitwiseOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator| ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1217 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1218 {
1219  using Tree_t = BinaryNode<OpBitwiseOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1220  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1221 }

◆ operator|=() [1/5]

DriverDebugChecks& qmcplusplus::operator|= ( DriverDebugChecks x,
DriverDebugChecks  y 
)
inline

Definition at line 40 of file DriverDebugChecks.h.

41 {
42  x = x | y;
43  return x;
44 }

◆ operator|=() [2/5]

DTModes& qmcplusplus::operator|= ( DTModes x,
DTModes  y 
)
inline

Definition at line 61 of file DTModes.h.

62 {
63  x = x | y;
64  return x;
65 }

◆ operator|=() [3/5]

Matrix<T1, C1>& qmcplusplus::operator|= ( Matrix< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 776 of file OhmmsMatrixOperators.h.

References evaluate().

777 {
778  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
779  evaluate(lhs, OpBitwiseOrAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
780  return lhs;
781 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator|=() [4/5]

ParticleAttrib<T1>& qmcplusplus::operator|= ( ParticleAttrib< T1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 809 of file ParticleAttrib.cpp.

References evaluate().

810 {
811  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
812  evaluate(lhs, OpBitwiseOrAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
813  return lhs;
814 }
void evaluate(ParticleAttrib< T > &lhs, const Op &op, const Expression< RHS > &rhs)

◆ operator|=() [5/5]

Vector<T1, C1>& qmcplusplus::operator|= ( Vector< T1, C1 > &  lhs,
const RHS &  rhs 
)
inline

Definition at line 2273 of file OhmmsVectorOperators.h.

References evaluate().

2274 {
2275  using Leaf_t = typename CreateLeaf<RHS>::Leaf_t;
2276  evaluate(lhs, OpBitwiseOrAssign(), MakeReturn<Leaf_t>::make(CreateLeaf<RHS>::make(rhs)));
2277  return lhs;
2278 }
void evaluate(Matrix< T, Alloc > &lhs, const Op &op, const Expression< RHS > &rhs)
Definition: OhmmsMatrix.h:514

◆ operator||() [1/8]

MakeReturn< BinaryNode<OpOr, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator|| ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 427 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

428 {
429  typedef BinaryNode<OpOr, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
430  Tree_t;
431  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
432 }

◆ operator||() [2/8]

MakeReturn< BinaryNode<OpOr, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator|| ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 677 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

678 {
679  typedef BinaryNode<OpOr, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
680  Tree_t;
681  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
682 }

◆ operator||() [3/8]

MakeReturn< BinaryNode<OpOr, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::operator|| ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 927 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

928 {
929  typedef BinaryNode<OpOr, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
930  Tree_t;
931  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
932 }

◆ operator||() [4/8]

MakeReturn< BinaryNode<OpOr, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator|| ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1134 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1135 {
1136  using Tree_t = BinaryNode<OpOr, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1137  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1138 }

◆ operator||() [5/8]

MakeReturn< BinaryNode<OpOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::operator|| ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1335 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1336 {
1337  using Tree_t = BinaryNode<OpOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1338  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1339 }

◆ operator||() [6/8]

MakeReturn< BinaryNode<OpOr, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::operator|| ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1774 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1775 {
1776  typedef BinaryNode<OpOr, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
1777  Tree_t;
1778  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1779 }

◆ operator||() [7/8]

MakeReturn< BinaryNode<OpOr, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::operator|| ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1981 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1982 {
1983  using Tree_t = BinaryNode<OpOr, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1984  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1985 }

◆ operator||() [8/8]

MakeReturn< BinaryNode<OpOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::operator|| ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2182 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2183 {
2184  using Tree_t = BinaryNode<OpOr, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2185  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2186 }

◆ operator~() [1/6]

constexpr DriverDebugChecks qmcplusplus::operator~ ( DriverDebugChecks  x)

Definition at line 38 of file DriverDebugChecks.h.

38 { return static_cast<DriverDebugChecks>(~static_cast<uint_fast8_t>(x)); }

◆ operator~() [2/6]

MakeReturn<UnaryNode<OpBitwiseNot, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::operator~ ( const Matrix< T1, C1 > &  l)
inline

Definition at line 47 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

48 {
49  using Tree_t = UnaryNode<OpBitwiseNot, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t>;
50  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l)));
51 }

◆ operator~() [3/6]

MakeReturn<UnaryNode<OpBitwiseNot, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t> >::Expression_t qmcplusplus::operator~ ( const ParticleAttrib< T1 > &  l)
inline

Definition at line 53 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

54 {
55  using Tree_t = UnaryNode<OpBitwiseNot, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t>;
56  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l)));
57 }

◆ operator~() [4/6]

constexpr DTModes qmcplusplus::operator~ ( DTModes  x)

Definition at line 59 of file DTModes.h.

59 { return static_cast<DTModes>(~static_cast<uint_fast8_t>(x)); }

◆ operator~() [5/6]

MakeReturn<UnaryNode<OpBitwiseNot, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::operator~ ( const Vector< T1, C1 > &  l)
inline

Definition at line 177 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

178 {
179  using Tree_t = UnaryNode<OpBitwiseNot, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
180  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
181 }

◆ operator~() [6/6]

MakeReturn< UnaryNode< OpBitwiseNot, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t operator~ ( const Expression< T1 > &  l)
inline

Definition at line 483 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

484 {
485  using Tree_t = UnaryNode<OpBitwiseNot, typename CreateLeaf<Expression<T1>>::Leaf_t>;
486  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
487 }

◆ original()

OneBodyDensityMatrices qmcplusplus::original ( std::move(obdmi ,
pset_target.  getLattice(),
species_set  ,
spomap  ,
pset_target   
)

◆ outerProduct()

◆ output_vector()

void qmcplusplus::output_vector ( const std::string &  name,
std::vector< int > &  vec 
)

Definition at line 33 of file test_walker_control.cpp.

34 {
35  std::cout << name;
36  for (int i = 0; i < vec.size(); i++)
37  {
38  std::cout << vec[i] << " ";
39  }
40  std::cout << std::endl;
41 }

◆ pad_string()

void qmcplusplus::pad_string ( const std::string &  in,
std::string &  out,
int  field_len 
)

Definition at line 351 of file TimerManager.cpp.

Referenced by TimerManager< qmcplusplus::TimerType< CLOCK > >::print_stack().

352 {
353  int len = in.size();
354  int pad_len = std::max(field_len - len, 0);
355  std::string pad_str(pad_len, ' ');
356  out = in + pad_str;
357 }

◆ parse_electron_ion_pbc_z()

void qmcplusplus::parse_electron_ion_pbc_z ( ParticleSet ions,
ParticleSet electrons 
)

Definition at line 382 of file test_distance_table.cpp.

References doc, OhmmsElementBase::getName(), Libxml2Document::getRoot(), ParticleSet::isSameMass(), okay, Libxml2Document::parseFromString(), XMLParticleParser::readXML(), and REQUIRE().

Referenced by TEST_CASE(), test_distance_fcc_pbc_z_batched_APIs(), test_distance_pbc_z_batched_APIs(), and test_distance_pbc_z_batched_APIs_ee_NEED_TEMP_DATA_ON_HOST().

383 {
384  const char* particles = R"(<tmp>
385  <particleset name="e">
386  <group name="u" size="2" mass="1.0">
387  <parameter name="charge" > -1 </parameter>
388  <parameter name="mass" > 1.0 </parameter>
389  <attrib name="position" datatype="posArray" condition="0">
390  0.00000000 0.00000000 0.00000000
391  3.00000000 0.00000000 0.00000000
392  </attrib>
393  </group>
394  <group name="d" size="1" mass="1.0">
395  <parameter name="charge" > -1 </parameter>
396  <parameter name="mass" > 1.0 </parameter>
397  <attrib name="position" datatype="posArray" condition="0">
398  0.00000000 0.00000000 3.00000000
399  </attrib>
400  </group>
401  </particleset>
402  <particleset name="ion0">
403  <group name="H" size="8" mass="1836.15">
404  <parameter name="charge" > 1 </parameter>
405  <parameter name="valence" > 1 </parameter>
406  <parameter name="atomicnumber" > 1 </parameter>
407  <parameter name="mass" > 1836.15 </parameter>
408  <attrib name="position" datatype="posArray" condition="0">
409  0.00000000 0.00000000 0.00000000
410  3.00000000 0.00000000 0.00000000
411  0.00000000 3.00000000 0.00000000
412  3.00000000 3.00000000 0.00000000
413  0.00000000 0.00000000 3.00000000
414  3.00000000 0.00000000 3.00000000
415  0.00000000 3.00000000 3.00000000
416  3.00000000 3.00000000 3.00000000
417  </attrib>
418  </group>
419  </particleset>
420 </tmp>
421 )";
422 
424  bool okay = doc.parseFromString(particles);
425  REQUIRE(okay);
426 
427  xmlNodePtr root = doc.getRoot();
428  xmlNodePtr part1 = xmlFirstElementChild(root);
429  xmlNodePtr part2 = xmlNextElementSibling(part1);
430 
431  // read particle set
432  XMLParticleParser parse_electrons(electrons);
433  parse_electrons.readXML(part1);
434 
435  XMLParticleParser parse_ions(ions);
436  parse_ions.readXML(part2);
437 
438  REQUIRE(electrons.getName() == "e");
439  REQUIRE(ions.getName() == "ion0");
440  REQUIRE(ions.isSameMass());
441  REQUIRE(electrons.isSameMass());
442 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ parse_pbc_fcc_lattice()

SimulationCell qmcplusplus::parse_pbc_fcc_lattice ( )

Definition at line 316 of file test_distance_table.cpp.

References app_log(), doc, Libxml2Document::getRoot(), lattice, okay, Libxml2Document::parseFromString(), LatticeParser::put(), and REQUIRE().

Referenced by test_distance_fcc_pbc_z_batched_APIs().

317 {
318  const char* particles = R"(<tmp>
319  <simulationcell>
320  <parameter name="lattice" units="bohr">
321  6.00000000 6.00000000 0.00000000
322  0.00000000 6.00000000 6.00000000
323  6.00000000 0.00000000 6.00000000
324  </parameter>
325  <parameter name="bconds">
326  p p p
327  </parameter>
328  <parameter name="LR_dim_cutoff" > 15 </parameter>
329  </simulationcell>
330 </tmp>
331 )";
332 
334  bool okay = doc.parseFromString(particles);
335  REQUIRE(okay);
336 
337  xmlNodePtr root = doc.getRoot();
338  xmlNodePtr part1 = xmlFirstElementChild(root);
339 
340  // read lattice
341  ParticleSet::ParticleLayout lattice;
342  LatticeParser lp(lattice);
343  lp.put(part1);
344  lattice.print(app_log(), 0);
345 
346  return SimulationCell(lattice);
347 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ parse_pbc_lattice()

SimulationCell qmcplusplus::parse_pbc_lattice ( )

Definition at line 349 of file test_distance_table.cpp.

References app_log(), doc, Libxml2Document::getRoot(), lattice, okay, Libxml2Document::parseFromString(), LatticeParser::put(), and REQUIRE().

Referenced by TEST_CASE(), test_distance_pbc_z_batched_APIs(), and test_distance_pbc_z_batched_APIs_ee_NEED_TEMP_DATA_ON_HOST().

350 {
351  const char* particles = R"(<tmp>
352  <simulationcell>
353  <parameter name="lattice" units="bohr">
354  6.00000000 0.00000000 0.00000000
355  0.00000000 6.00000000 0.00000000
356  0.00000000 0.00000000 6.00000000
357  </parameter>
358  <parameter name="bconds">
359  p p p
360  </parameter>
361  <parameter name="LR_dim_cutoff" > 15 </parameter>
362  </simulationcell>
363 </tmp>
364 )";
365 
367  bool okay = doc.parseFromString(particles);
368  REQUIRE(okay);
369 
370  xmlNodePtr root = doc.getRoot();
371  xmlNodePtr part1 = xmlFirstElementChild(root);
372 
373  // read lattice
374  ParticleSet::ParticleLayout lattice;
375  LatticeParser lp(lattice);
376  lp.put(part1);
377  lattice.print(app_log(), 0);
378 
379  return SimulationCell(lattice);
380 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ parseGridInput()

AxisGrid< REAL > parseGridInput ( std::istringstream &  grid_input_stream)

Parses the one dimensional grid specification format originated for EnergyDensity This has be refactored from QMCHamiltonian/SpaceGrid.cpp.

My evidence for correctness is that it can pass the unit test I wrote, there was no legacy test.

Definition at line 23 of file ParseGridInput.cpp.

References abs(), AxisGrid< REAL >::dimensions, AxisGrid< REAL >::du_int, qmcplusplus::Units::charge::e, floor(), AxisGrid< REAL >::gmap, omptarget::min(), n, AxisGrid< REAL >::ndom_int, AxisGrid< REAL >::ndu_int, AxisGrid< REAL >::ndu_per_interval, AxisGrid< REAL >::odu, qmcplusplus::modernstrutil::split(), AxisGrid< REAL >::umax, and AxisGrid< REAL >::umin.

24 {
25  using namespace modernstrutil;
26  const REAL utol = 1e-5;
27 
28  std::string grid_line;
29  std::getline(grid_input_stream, grid_line);
30  // This refactored from QMCHamiltonian/SpaceGrid::initializeRectilinear
31  std::vector<std::string_view> tokens = split(grid_line, " ");
32 
33  // count the number of intervals
34  int nintervals = 0;
35  for (int i = 0; i < tokens.size(); i++)
36  if (tokens[i][0] != '(')
37  nintervals++;
38  nintervals--;
39  // allocate temporary interval variables
40  AxisGrid<REAL> agr;
41  agr.ndom_int.resize(nintervals);
42  agr.du_int.resize(nintervals);
43  agr.ndu_int.resize(nintervals);
44  // determine number of domains in each interval and the width of each domain
45  REAL u1 = string2Real<REAL>(tokens[0]);
46 
47  agr.umin = u1;
48  if (std::abs(u1) > 1.0000001)
49  {
50  std::ostringstream msg;
51  msg << " interval endparticles cannot be greater than " << 1 << '\n' << " endpoint provided: " << u1;
52  throw UniformCommunicateError(msg.str());
53  }
54  bool is_int = false;
55  bool has_paren_val = false;
56  REAL du_i;
57  int ndom_i = 1;
58  int interval = -1;
59  for (int i = 1; i < tokens.size(); i++)
60  {
61  if (tokens[i][0] != '(')
62  {
63  REAL u2 = string2Real<REAL>(tokens[i]);
64  agr.umax = u2;
65  if (!has_paren_val)
66  du_i = u2 - u1;
67  has_paren_val = false;
68  interval++;
69  if (u2 < u1)
70  {
71  std::ostringstream msg;
72 
73  msg << " interval (" << u1 << "," << u2 << ") is negative" << std::endl;
74  throw UniformCommunicateError(msg.str());
75  }
76  if (std::abs(u2) > 1.0000001)
77  {
78  std::ostringstream msg;
79 
80  msg << " interval endparticles cannot be greater than " << 1 << std::endl;
81  msg << " endpoint provided: " << u2 << std::endl;
82  throw UniformCommunicateError(msg.str());
83  }
84  if (is_int)
85  {
86  agr.du_int[interval] = (u2 - u1) / ndom_i;
87  agr.ndom_int[interval] = ndom_i;
88  }
89  else
90  {
91  agr.du_int[interval] = du_i;
92  agr.ndom_int[interval] = std::floor((u2 - u1) / du_i + .5);
93  if (std::abs(u2 - u1 - du_i * agr.ndom_int[interval]) > utol)
94  {
95  std::ostringstream msg;
96 
97  msg << " interval (" << u1 << "," << u2 << ") not divisible by du=" << du_i << std::endl;
98  throw UniformCommunicateError(msg.str());
99  }
100  }
101  u1 = u2;
102  }
103  else
104  {
105  has_paren_val = true;
106  std::string paren_val{tokens[i].substr(1, tokens[i].length() - 2)};
107  is_int = tokens[i].find(".") == std::string::npos;
108  if (is_int)
109  {
110  ndom_i = string2Int<int>(paren_val);
111  du_i = -1.0;
112  }
113  else
114  {
115  ndom_i = 0;
116  du_i = string2Real<REAL>(paren_val);
117  }
118  }
119  }
120  // find the smallest domain width
121  REAL du_min = 1.0;
122  for (int i = 0; i < agr.du_int.size(); i++)
123  du_min = std::min(du_min, agr.du_int[i]);
124  agr.odu = 1.0 / du_min;
125  // make sure it divides into all other domain widths
126  for (int i = 0; i < agr.du_int.size(); i++)
127  {
128  agr.ndu_int[i] = floor(agr.du_int[i] / du_min + .5);
129  if (std::abs(agr.du_int[i] - agr.ndu_int[i] * du_min) > utol)
130  {
131  std::ostringstream msg;
132  msg << "interval " << i + 1 << " of axis is not divisible by smallest subinterval " << du_min;
133  throw UniformCommunicateError(msg.str());
134  }
135  }
136  // set up the interval map such that gmap[u/du]==domain index
137  agr.gmap.resize(floor((agr.umax - agr.umin) * agr.odu + .5));
138  int n = 0;
139  int nd = -1;
140  for (int i = 0; i < agr.ndom_int.size(); i++)
141  for (int j = 0; j < agr.ndom_int[i]; j++)
142  {
143  nd++;
144  for (int k = 0; k < agr.ndu_int[i]; k++)
145  {
146  //app_log()<<" accessing gmap "<<iaxis<<" "<<n<< std::endl;
147  agr.gmap[n] = nd;
148  n++;
149  }
150  }
151  agr.dimensions = nd + 1;
152  //end read in the grid contents
153  //save interval width information
154  int ndom_tot = 0;
155  for (int i = 0; i < agr.ndom_int.size(); i++)
156  ndom_tot += agr.ndom_int[i];
157  agr.ndu_per_interval.resize(ndom_tot);
158  int idom = 0;
159  for (int i = 0; i < agr.ndom_int.size(); i++)
160  for (int ii = 0; ii < agr.ndom_int[i]; ii++)
161  {
162  agr.ndu_per_interval[idom] = agr.ndu_int[i];
163  idom++;
164  }
165  return agr;
166 }
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
T min(T a, T b)
std::vector< std::string_view > split(const string_view s, const string_view delimiters)
MakeReturn< UnaryNode< FnFloor, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t floor(const Vector< T1, C1 > &l)

◆ parseGridInput< double >()

template AxisGrid< double > parseGridInput< double > ( std::istringstream &  grid_input_stream)

◆ parseGridInput< float >()

template AxisGrid< float > parseGridInput< float > ( std::istringstream &  grid_input_stream)

◆ ParticleSet::mw_accept_rejectMove< CoordsType::POS >()

template void qmcplusplus::ParticleSet::mw_accept_rejectMove< CoordsType::POS > ( const RefVectorWithLeader< ParticleSet > &  p_list,
Index_t  iat,
const std::vector< bool > &  isAccepted,
bool  forward_mode 
)

◆ ParticleSet::mw_accept_rejectMove< CoordsType::POS_SPIN >()

template void qmcplusplus::ParticleSet::mw_accept_rejectMove< CoordsType::POS_SPIN > ( const RefVectorWithLeader< ParticleSet > &  p_list,
Index_t  iat,
const std::vector< bool > &  isAccepted,
bool  forward_mode 
)

◆ ParticleSet::mw_makeMove< CoordsType::POS >()

template void qmcplusplus::ParticleSet::mw_makeMove< CoordsType::POS > ( const RefVectorWithLeader< ParticleSet > &  p_list,
Index_t  iat,
const MCCoords< CoordsType::POS > &  displs 
)

◆ ParticleSet::mw_makeMove< CoordsType::POS_SPIN >()

template void qmcplusplus::ParticleSet::mw_makeMove< CoordsType::POS_SPIN > ( const RefVectorWithLeader< ParticleSet > &  p_list,
Index_t  iat,
const MCCoords< CoordsType::POS_SPIN > &  displs 
)

◆ PETE_identity() [1/4]

MakeReturn<UnaryNode<OpIdentity, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::PETE_identity ( const Matrix< T1, C1 > &  l)
inline

Definition at line 55 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

56 {
57  using Tree_t = UnaryNode<OpIdentity, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t>;
58  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T1, C1>>::make(l)));
59 }

◆ PETE_identity() [2/4]

MakeReturn<UnaryNode<OpIdentity, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t> >::Expression_t qmcplusplus::PETE_identity ( const ParticleAttrib< T1 > &  l)
inline

Definition at line 61 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

62 {
63  using Tree_t = UnaryNode<OpIdentity, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t>;
64  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(l)));
65 }

◆ PETE_identity() [3/4]

MakeReturn<UnaryNode<OpIdentity, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::PETE_identity ( const Vector< T1, C1 > &  l)
inline

Definition at line 185 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

186 {
187  using Tree_t = UnaryNode<OpIdentity, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
188  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
189 }

◆ PETE_identity() [4/4]

MakeReturn< UnaryNode< OpIdentity, typename CreateLeaf< Expression< T1 > >::Leaf_t > >::Expression_t PETE_identity ( const Expression< T1 > &  l)
inline

Definition at line 491 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

492 {
493  using Tree_t = UnaryNode<OpIdentity, typename CreateLeaf<Expression<T1>>::Leaf_t>;
494  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
495 }

◆ peteCast() [1/4]

MakeReturn<UnaryNode<OpCast<T1>, typename CreateLeaf<Matrix<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::peteCast ( const T1 &  ,
const Matrix< T2, C2 > &  l 
)
inline

Definition at line 62 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

65 {
66  using Tree_t = UnaryNode<OpCast<T1>, typename CreateLeaf<Matrix<T2, C2>>::Leaf_t>;
67  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Matrix<T2, C2>>::make(l)));
68 }

◆ peteCast() [2/4]

MakeReturn<UnaryNode<OpCast<T1>, typename CreateLeaf<ParticleAttrib<T2> >::Leaf_t> >::Expression_t qmcplusplus::peteCast ( const T1 &  ,
const ParticleAttrib< T2 > &  l 
)
inline

Definition at line 69 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

70 {
71  using Tree_t = UnaryNode<OpCast<T1>, typename CreateLeaf<ParticleAttrib<T2>>::Leaf_t>;
72  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<ParticleAttrib<T2>>::make(l)));
73 }

◆ peteCast() [3/4]

MakeReturn<UnaryNode<OpCast<T1>, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::peteCast ( const T1 &  ,
const Vector< T2, C2 > &  l 
)
inline

Definition at line 200 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

203 {
204  using Tree_t = UnaryNode<OpCast<T1>, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
205  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T2, C2>>::make(l)));
206 }

◆ peteCast() [4/4]

MakeReturn< UnaryNode< OpCast< T1 >, typename CreateLeaf< Expression< T2 > >::Leaf_t > >::Expression_t peteCast ( const T1 &  ,
const Expression< T2 > &  l 
)
inline

Definition at line 498 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

501 {
502  using Tree_t = UnaryNode<OpCast<T1>, typename CreateLeaf<Expression<T2>>::Leaf_t>;
503  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T2>>::make(l)));
504 }

◆ peteCombine() [1/3]

Combine1<A, Op, Tag>::Type_t qmcplusplus::peteCombine ( const A &  a,
const Op &  op,
const Tag &  t 
)
inline

Definition at line 127 of file Combiners.h.

References Combine1< A, Op, Tag >::combine().

128 {
129  return Combine1<A, Op, Tag>::combine(a, op, t);
130 }

◆ peteCombine() [2/3]

Combine2<A, B, Op, Tag>::Type_t qmcplusplus::peteCombine ( const A &  a,
const B b,
const Op &  op,
const Tag &  t 
)
inline

Definition at line 133 of file Combiners.h.

134 {
135  return Combine2<A, B, Op, Tag>::combine(a, b, op, t);
136 }

◆ peteCombine() [3/3]

Combine3<A, B, C, Op, Tag>::Type_t qmcplusplus::peteCombine ( const A &  a,
const B b,
const C &  c,
const Op &  op,
const Tag &  t 
)
inline

Definition at line 139 of file Combiners.h.

References Combine3< A, B, C, Op, Tag >::combine().

144 {
145  return Combine3<A, B, C, Op, Tag>::combine(a, b, c, op, t);
146 }

◆ phiBar()

RealType phiBar ( const CuspCorrection cusp,
RealType  r,
OneMolecularOrbital phiMO 
)

Definition at line 364 of file CuspCorrectionConstruction.cpp.

References CuspCorrectionParameters::C, CuspCorrection::cparam, OneMolecularOrbital::phi(), CuspCorrectionParameters::Rc, and CuspCorrection::Rr().

Referenced by computeRadialPhiBar(), evaluateForPhi0Body(), getCurrentLocalEnergy(), and minimizeForPhiAtZero().

365 {
366  if (r <= cusp.cparam.Rc)
367  return cusp.cparam.C + cusp.Rr(r);
368  else
369  return phiMO.phi(r);
370 }

◆ pivots()

std::vector<int, CUDAHostAllocator<int> > qmcplusplus::pivots ( ,
-1.  0 
)

◆ PosAoS2SoA()

void qmcplusplus::PosAoS2SoA ( int  nrows,
int  ncols,
const T *restrict  iptr,
int  lda,
T *restrict  out,
int  ldb 
)

General conversion function from AoS[nrows][ncols] to SoA[ncols][ldb].

Parameters
nrowsthe first dimension
ncolsthe second dimension
iptrinput pointer
ldastride of iptr
outoutput pointer
ldastrided of out

Modeled after blas/lapack for lda/ldb

Definition at line 106 of file PosTransformer.h.

Referenced by VectorSoaContainer< ST, 5 >::copyIn().

107 {
108  T* restrict x = out;
109  T* restrict y = out + ldb;
110  T* restrict z = out + 2 * ldb;
111 #if !defined(__ibmxl__)
112 #pragma omp simd aligned(x, y, z: QMC_SIMD_ALIGNMENT)
113 #endif
114  for (int i = 0; i < nrows; ++i)
115  {
116  x[i] = iptr[i * ncols]; //x[i]=in[i][0];
117  y[i] = iptr[i * ncols + 1]; //y[i]=in[i][1];
118  z[i] = iptr[i * ncols + 2]; //z[i]=in[i][2];
119  }
120 }

◆ PosSoA2AoS()

void qmcplusplus::PosSoA2AoS ( int  nrows,
int  ncols,
const T *restrict  iptr,
int  lda,
T *restrict  out,
int  ldb 
)

General conversion function from SoA[ncols][ldb] to AoS[nrows][ncols].

Parameters
nrowsthe first dimension
ncolsthe second dimension
iptrinput pointer
ldastride of iptr
outoutput pointer
ldastrided of out

Modeled after blas/lapack for lda/ldb

Definition at line 133 of file PosTransformer.h.

References lda.

Referenced by VectorSoaContainer< ST, 5 >::copyOut().

134 {
135  const T* restrict x = iptr;
136  const T* restrict y = iptr + lda;
137  const T* restrict z = iptr + 2 * lda;
138 #if !defined(__ibmxl__)
139 #pragma omp simd aligned(x, y, z: QMC_SIMD_ALIGNMENT)
140 #endif
141  for (int i = 0; i < nrows; ++i)
142  {
143  out[i * ldb] = x[i]; //out[i][0]=x[i];
144  out[i * ldb + 1] = y[i]; //out[i][1]=y[i];
145  out[i * ldb + 2] = z[i]; //out[i][2]=z[i];
146  }
147 }

◆ pow() [1/9]

int qmcplusplus::pow ( int  i,
int  n 
)
inline

return i^n

std::pow(int,int) is not standard

Definition at line 74 of file math.hpp.

References n.

74 { return static_cast<int>(std::pow(static_cast<double>(i), n)); }
int pow(int i, int n)
return i^n
Definition: math.hpp:74

◆ pow() [2/9]

MakeReturn< BinaryNode<FnPow, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::pow ( const Vector< T1, C1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 316 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by GaussianCombo< T >::addGaussian(), BackflowBuilder::addRPA(), LRRPAHandlerTemp< Func, BreakupBasis >::Breakup(), RPAJastrow::buildOrbital(), LPQHISRCoulombBasis::c(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::CartesianTensor(), SimpleFixedNodeBranch::collect(), ACForce::compute_regularizer_f(), QMCCostFunction::correlatedSampling(), QMCCostFunctionBatched::correlatedSampling(), RadialJastrowBuilder::createJ1(), LPQHISRCoulombBasis::dc_dk(), SpaceWarpTransformation::df(), GaussianTimesRN< T >::BasicGaussian::df(), GenericSTO< T >::df(), RadialSTO< T >::df(), LPQHISRCoulombBasis::dh_dr(), LPQHISRCoulombBasis::Eminus_dG(), ForceCeperley::evaluate(), GaussianTimesRN< T >::BasicGaussian::evaluate(), UserFunctor< T >::evaluate(), GenericSTO< T >::evaluate(), RadialSTO< T >::evaluate(), ExampleHeComponent::evaluateDerivatives(), UserFunctor< T >::evaluateDerivatives(), qmcplusplus::ewaldref::ewaldSum(), SpaceWarpTransformation::f(), GaussianTimesRN< T >::BasicGaussian::f(), GenericSTO< T >::f(), RadialSTO< T >::f(), LRRPABFeeHandlerTemp< Func, BreakupBasis >::fillFk(), LRRPAHandlerTemp< Func, BreakupBasis >::fillFk(), ForceChiesaPBCAA::g_filter(), GaussianCombo< T >::GaussianCombo(), HEGGrid< T >::getCellLength(), qmcplusplus::ewaldref::getKappaEwald(), qmcplusplus::ewaldref::getKappaMadelung(), HEGGrid< T >::getNC(), QMCCostFunction::GradCost(), QMCCostFunctionBatched::GradCost(), LPQHISRCoulombBasis::h(), LPQHISRCoulombBasis::hintr2(), LogGrid::Init(), LRRPABFeeHandlerTemp< Func, BreakupBasis >::InitBreakup(), LRRPAHandlerTemp< Func, BreakupBasis >::InitBreakup(), LRHandlerTemp< Func, BreakupBasis >::InitBreakup(), LRHandlerSRCoulomb< Func, BreakupBasis >::InitBreakup(), QMCFiniteSize::initialize(), ForceCeperley::InitMatrix(), ForceChiesaPBCAA::InitMatrix(), ForceBase::initVarReduction(), LogGrid::LogGrid(), qmcplusplus::ewaldref::madelungSum(), MomentumDistribution::MomentumDistribution(), DensityMatrices1B::normalize(), OneBodyDensityMatrices::normalizeBasis(), OneBodyDensityMatrices::OneBodyDensityMatrices(), STONorm< T >::operator()(), FnPow::operator()(), GaussianCombo< T >::putBasisGroupH5(), MomentumEstimator::putSpecial(), YukawaBreakup< T >::reset(), DerivRPABreakup< T >::reset(), RPABreakup< T >::reset(), DerivYukawaBreakup< T >::reset(), EPRPABreakup< T >::reset(), derivEPRPABreakup< T >::reset(), RPABFeeBreakup< T >::reset(), LPQHISRCoulombBasis::rh(), PairCorrEstimator::set_norm_factor(), DensityMatrices1B::set_state(), SoaCartesianTensor< T >::SoaCartesianTensor(), SoaSphericalTensor< ST >::SoaSphericalTensor(), SphericalTensor< T, Point_t, Tensor_t, GGG_t >::SphericalTensor(), TEST_CASE(), DensityMatrices1B::test_overlap(), OneBodyDensityMatricesTests< T >::testGenerateSamples(), SHOSetBuilder::update_basis_states(), DescentEngine::updateParameters(), DerivRPABreakup< T >::Xk(), RPABreakup< T >::Xk(), EPRPABreakup< T >::Xk(), derivEPRPABreakup< T >::Xk(), RPABFeeBreakup< T >::Xk(), and Ylm().

317 {
318  typedef BinaryNode<FnPow, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
319  Tree_t;
320  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
321 }

◆ pow() [3/9]

MakeReturn< BinaryNode<FnPow, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::pow ( const Vector< T1, C1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 566 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

567 {
568  typedef BinaryNode<FnPow, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
569  Tree_t;
570  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
571 }

◆ pow() [4/9]

MakeReturn< BinaryNode<FnPow, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >:: Expression_t qmcplusplus::pow ( const Expression< T1 > &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 816 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

817 {
818  typedef BinaryNode<FnPow, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>
819  Tree_t;
820  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
821 }

◆ pow() [5/9]

MakeReturn< BinaryNode<FnPow, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::pow ( const Vector< T1, C1 > &  l,
const T2 &  r 
)
inline

Definition at line 1044 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1045 {
1046  using Tree_t = BinaryNode<FnPow, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1047  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l), CreateLeaf<T2>::make(r)));
1048 }

◆ pow() [6/9]

MakeReturn< BinaryNode<FnPow, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2> >::Leaf_t> >::Expression_t qmcplusplus::pow ( const T1 &  l,
const Vector< T2, C2 > &  r 
)
inline

Definition at line 1245 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1246 {
1247  using Tree_t = BinaryNode<FnPow, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Vector<T2, C2>>::Leaf_t>;
1248  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Vector<T2, C2>>::make(r)));
1249 }

◆ pow() [7/9]

MakeReturn< BinaryNode<FnPow, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >:: Expression_t qmcplusplus::pow ( const Expression< T1 > &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 1663 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1664 {
1665  typedef BinaryNode<FnPow, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>
1666  Tree_t;
1667  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<Expression<T2>>::make(r)));
1668 }

◆ pow() [8/9]

MakeReturn< BinaryNode<FnPow, typename CreateLeaf<Expression<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t> >::Expression_t qmcplusplus::pow ( const Expression< T1 > &  l,
const T2 &  r 
)
inline

Definition at line 1891 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1892 {
1893  using Tree_t = BinaryNode<FnPow, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t>;
1894  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l), CreateLeaf<T2>::make(r)));
1895 }

◆ pow() [9/9]

MakeReturn< BinaryNode<FnPow, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2> >::Leaf_t> >::Expression_t qmcplusplus::pow ( const T1 &  l,
const Expression< T2 > &  r 
)
inline

Definition at line 2092 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

2093 {
2094  using Tree_t = BinaryNode<FnPow, typename CreateLeaf<T1>::Leaf_t, typename CreateLeaf<Expression<T2>>::Leaf_t>;
2095  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<T1>::make(l), CreateLeaf<Expression<T2>>::make(r)));
2096 }

◆ print()

void print ( OptimizableFunctorBase func,
std::ostream &  os,
double  extent = -1.0 
)

evaluates a functor (value and derivative) and dumps the quantities to output

Parameters
functhe functor for which the value and derivative is evaluated
osthe output stream to write the quantities to
extentthe functor is evaluated from [0, extent) unless extent < 0, in which case the functor is evaluated from [0, cutoff_radius)

Definition at line 17 of file OptimizableFunctorBase.cpp.

References OptimizableFunctorBase::cutoff_radius, OptimizableFunctorBase::df(), OptimizableFunctorBase::f(), and n.

Referenced by RadialJastrowBuilder::createJ1(), RadialJastrowBuilder::createJ2(), and operator<<().

18 {
20  int n = 1000;
21  real_type d = extent == -1.0 ? func.cutoff_radius / n : extent / n;
22  real_type r = 0;
23  real_type u, du;
24  for (int i = 0; i < n; ++i)
25  {
26  u = func.f(r);
27  du = func.df(r);
28  os << std::setw(22) << r << std::setw(22) << u << std::setw(22) << du << std::endl;
29  r += d;
30  }
31 }
OHMMS_PRECISION real_type

◆ print_mem()

void print_mem ( const std::string &  title,
std::ostream &  log 
)

Definition at line 30 of file MemoryUsage.cpp.

References freemem(), getCUDAdeviceFreeMem(), getCUDAdeviceMemAllocated(), getOMPdeviceMemAllocated(), getSYCLdeviceFreeMem(), getSYCLdeviceMemAllocated(), log(), and memusage().

Referenced by CSUpdateBase::initCSWalkersForPbyP(), QMCUpdateBase::initWalkersForPbyP(), main(), CloneManager::makeClones(), VMCBatched::process(), DMCBatched::process(), QMCMain::QMCMain(), VMCBatched::run(), DMCBatched::run(), and TEST_CASE().

31 {
32  std::string line_separator;
33  for (int i = 0; i < title.size() + 30; i++)
34  line_separator += "=";
35  log << line_separator << std::endl;
36  log << "--- Memory usage report : " << title << " ---" << std::endl;
37  log << line_separator << std::endl;
38  log << std::right;
39  log << "Available memory on node 0, free + buffers : " << std::setw(7) << (freemem() >> 20) << " MiB" << std::endl;
40  log << "Memory footprint by rank 0 on node 0 : " << std::setw(7) << (memusage() >> 10) << " MiB" << std::endl;
41 #ifdef ENABLE_OFFLOAD
42  log << "Device memory allocated via OpenMP offload : " << std::setw(7) << (getOMPdeviceMemAllocated() >> 20) << " MiB"
43  << std::endl;
44 #endif
45 #ifdef ENABLE_CUDA
46  log << "Device memory allocated via CUDA allocator : " << std::setw(7) << (getCUDAdeviceMemAllocated() >> 20)
47  << " MiB" << std::endl;
48  log << "Free memory on the default device : " << std::setw(7) << (getCUDAdeviceFreeMem() >> 20) << " MiB"
49  << std::endl;
50 #endif
51 #ifdef ENABLE_SYCL
52  log << "Device memory allocated via SYCL allocator : " << std::setw(7) << (getSYCLdeviceMemAllocated() >> 20)
53  << " MiB" << std::endl;
54  log << "Free memory on the default device : " << std::setw(7) << (getSYCLdeviceFreeMem() >> 20) << " MiB"
55  << std::endl;
56 #endif
57  log << line_separator << std::endl;
58 }
size_t getOMPdeviceMemAllocated()
size_t getCUDAdeviceFreeMem()
Definition: CUDAruntime.cpp:15
size_t getSYCLdeviceFreeMem()
query free memory on the default device
Definition: SYCLruntime.cpp:31
size_t getSYCLdeviceMemAllocated()
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)
size_t memusage()
Definition: sysutil.cpp:66
size_t freemem()
Definition: sysutil.cpp:53
size_t getCUDAdeviceMemAllocated()

◆ print_vector()

void qmcplusplus::print_vector ( vector< int > &  out)

Definition at line 25 of file test_partition.cpp.

26 {
27  for (int i = 0; i < out.size(); i++)
28  {
29  std::cout << out[i] << " ";
30  }
31  std::cout << std::endl;
32 }

◆ Product_ABt()

void qmcplusplus::Product_ABt ( const VectorSoaContainer< T, D > &  A,
const Matrix< T, Alloc > &  B,
VectorSoaContainer< T, D > &  C 
)
inline

Find a better place for other user classes, Matrix should be padded as well.

Definition at line 193 of file LCAOrbitalSet.cpp.

References qmcplusplus::Units::distance::A, B(), qmcplusplus::Units::charge::C, BLAS::gemm(), and BLAS::zone.

Referenced by LCAOrbitalSet::evaluate_notranspose(), LCAOrbitalSet::evaluateGradSource(), LCAOrbitalSet::evaluateGradSourceRow(), LCAOrbitalSet::evaluateVGH(), LCAOrbitalSet::evaluateVGHGH(), and LCAOrbitalSet::evaluateVGL().

194 {
195  constexpr char transa = 't';
196  constexpr char transb = 'n';
197  constexpr T zone(1);
198  constexpr T zero(0);
199  BLAS::gemm(transa, transb, B.rows(), D, B.cols(), zone, B.data(), B.cols(), A.data(), A.capacity(), zero, C.data(),
200  C.capacity());
201 }
constexpr std::complex< double > zone
Definition: BLAS.hpp:52
static void gemm(char Atrans, char Btrans, int M, int N, int K, double alpha, const double *A, int lda, const double *restrict B, int ldb, double beta, double *restrict C, int ldc)
Definition: BLAS.hpp:235
double B(double x, int k, int i, const std::vector< double > &t)

◆ PSdispatcher::flex_accept_rejectMove< CoordsType::POS >()

template void qmcplusplus::PSdispatcher::flex_accept_rejectMove< CoordsType::POS > ( const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
const std::vector< bool > &  isAccepted,
bool  forward_mode 
) const

◆ PSdispatcher::flex_accept_rejectMove< CoordsType::POS_SPIN >()

template void qmcplusplus::PSdispatcher::flex_accept_rejectMove< CoordsType::POS_SPIN > ( const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
const std::vector< bool > &  isAccepted,
bool  forward_mode 
) const

◆ PSdispatcher::flex_makeMove< CoordsType::POS >()

template void qmcplusplus::PSdispatcher::flex_makeMove< CoordsType::POS > ( const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
const MCCoords< CoordsType::POS > &  displs 
) const

◆ PSdispatcher::flex_makeMove< CoordsType::POS_SPIN >()

template void qmcplusplus::PSdispatcher::flex_makeMove< CoordsType::POS_SPIN > ( const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
const MCCoords< CoordsType::POS_SPIN > &  displs 
) const

◆ put2box() [1/2]

void qmcplusplus::put2box ( ParticleAttrib< TinyVector< T, D >> &  inout)
inline

inout[i]=inout[i]-floor(inout[i])

See CPU/SIMD/vmath.h and should be specialized for vector libraries, e.g., INTEL vml, IBM massv

Definition at line 332 of file FastParticleOperators.h.

References qmcplusplus::simd::remainder().

Referenced by ParticleSet::convert2UnitInBox().

333 {
334  simd::remainder(&(inout[0][0]), inout.size() * D);
335 }
void remainder(const T *restrict in, T *restrict out, SIZET n)
mod on an array out[i]=in[i]-floor(in[i])
Definition: vmath.hpp:38

◆ put2box() [2/2]

void qmcplusplus::put2box ( const ParticleAttrib< TinyVector< T, D >> &  in,
ParticleAttrib< TinyVector< T, D >> &  out 
)
inline

out[i]=in[i]-floor(in[i])

Definition at line 340 of file FastParticleOperators.h.

References qmcplusplus::simd::remainder().

341 {
342  simd::remainder(&(in[0][0]), &(out[0][0]), in.size() * D);
343 }
void remainder(const T *restrict in, T *restrict out, SIZET n)
mod on an array out[i]=in[i]-floor(in[i])
Definition: vmath.hpp:38

◆ putContent2()

bool qmcplusplus::putContent2 ( std::vector< T > &  a,
xmlNodePtr  cur 
)
inline

Definition at line 23 of file kSpaceJastrowBuilder.cpp.

Referenced by kSpaceJastrowBuilder::buildComponent().

24 {
25  std::istringstream stream(XMLNodeString{cur});
26  T temp;
27  a.clear();
28  while (!stream.eof())
29  {
30  stream >> temp;
31  if (stream.fail() || stream.bad())
32  break;
33  else
34  a.push_back(temp);
35  }
36  return a.size() > 0;
37 }
convert xmlNode contents into a std::string

◆ QMCWFOptLinearFactoryNew()

std::unique_ptr< QMCFixedSampleLinearOptimizeBatched > QMCWFOptLinearFactoryNew ( xmlNodePtr  cur,
const ProjectData project_data,
const std::optional< EstimatorManagerInput > &  global_emi,
WalkerConfigurations wc,
MCPopulation &&  pop,
SampleStack samples,
Communicate comm 
)

Definition at line 10 of file QMCWFOptFactoryNew.cpp.

References app_summary(), comm, qmcplusplus::Units::charge::e, VMCDriverInput::readXML(), and QMCDriverInput::readXML().

Referenced by QMCDriverFactory::createQMCDriver().

18 {
19  app_summary() << "\n========================================"
20  "\n Reading WFOpt driver XML input section"
21  "\n========================================"
22  << std::endl;
23 
24  QMCDriverInput qmcdriver_input;
25  VMCDriverInput vmcdriver_input;
26  try
27  {
28  qmcdriver_input.readXML(cur);
29  vmcdriver_input.readXML(cur);
30  }
31  catch (const std::exception& e)
32  {
33  throw UniformCommunicateError(e.what());
34  }
35 
36  auto opt = std::make_unique<QMCFixedSampleLinearOptimizeBatched>(project_data, std::move(qmcdriver_input), global_emi,
37  std::move(vmcdriver_input), wc, std::move(pop),
38  samples, comm);
39  return opt;
40 }
std::ostream & app_summary()
Definition: OutputManager.h:63

◆ randomize()

void qmcplusplus::randomize ( ParticleAttrib< TinyVector< T, D >> &  displ,
fac 
)
inline

Definition at line 1369 of file WaveFunctionTester.cpp.

References assignUniformRand(), and Random.

Referenced by WaveFunctionTester::runRatioV().

1370 {
1371  T* rv = &(displ[0][0]);
1372  assignUniformRand(rv, displ.size() * D, Random);
1373  for (int i = 0; i < displ.size() * D; ++i)
1374  rv[i] = fac * (rv[i] - 0.5);
1375 }
#define Random
void assignUniformRand(T *restrict a, unsigned n, RG &rng)

◆ randomUpdateAccumulate()

void qmcplusplus::randomUpdateAccumulate ( testing::RandomForTest< QMCT::RealType > &  rft,
UPtrVector< OperatorEstBase > &  crowd_sdns 
)

Definition at line 89 of file test_SpinDensityNew.cpp.

References SpinDensityNew::accumulate(), QMCTraits::DIM, RandomForTest< VT >::fillVecRng(), pset, and qmcplusplus::hdf::walkers.

90 {
91  const SimulationCell simulation_cell;
92  for (auto& uptr_crowd_sdn : crowd_sdns)
93  {
94  std::vector<OperatorEstBase::MCPWalker> walkers;
95  int nwalkers = 4;
96  for (int iw = 0; iw < nwalkers; ++iw)
97  walkers.emplace_back(2);
98 
99  std::vector<ParticleSet> psets;
100 
101  SpinDensityNew& crowd_sdn = dynamic_cast<SpinDensityNew&>(*(uptr_crowd_sdn));
102 
103  std::vector<QMCT::RealType> rng_reals(nwalkers * QMCT::DIM * 2);
104  rft.fillVecRng(rng_reals);
105  auto it_rng_reals = rng_reals.begin();
106  for (int iw = 0; iw < nwalkers; ++iw)
107  {
108  psets.emplace_back(simulation_cell);
109  ParticleSet& pset = psets.back();
110  pset.create({2});
111  pset.R[0] = ParticleSet::PosType(*it_rng_reals++, *it_rng_reals++, *it_rng_reals++);
112  pset.R[1] = ParticleSet::PosType(*it_rng_reals++, *it_rng_reals++, *it_rng_reals++);
113  }
114 
115  std::vector<TrialWaveFunction> wfns;
116  std::vector<QMCHamiltonian> hams;
117  auto ref_walkers = makeRefVector<OperatorEstBase::MCPWalker>(walkers);
118  auto ref_psets = makeRefVector<ParticleSet>(psets);
119  auto ref_wfns = makeRefVector<TrialWaveFunction>(wfns);
120  auto ref_hams = makeRefVector<QMCHamiltonian>(hams);
121 
122  FakeRandom<OHMMS_PRECISION_FULL> rng;
123 
124  crowd_sdn.accumulate(ref_walkers, ref_psets, ref_wfns, ref_hams, rng);
125  }
126 }
const char walkers[]
Definition: HDFVersion.h:36
QMCTraits::PosType PosType
SpinDensityNew(std::move(sdi), species_set)

◆ readCuspInfo()

bool readCuspInfo ( const std::string &  cuspInfoFile,
const std::string &  objectName,
int  OrbitalSetSize,
Matrix< CuspCorrectionParameters > &  info 
)

Read cusp correction parameters from XML file.

Definition at line 30 of file CuspCorrectionConstruction.cpp.

References OhmmsAttributeSet::add(), APP_ABORT, app_log(), getNodeName(), Libxml2Document::getRoot(), Libxml2Document::parse(), OhmmsAttributeSet::put(), and Matrix< T, Alloc >::rows().

Referenced by LCAOrbitalBuilder::createSPOSetFromXML(), and TEST_CASE().

34 {
35  bool success = true;
36  int ncenter = info.rows();
37  app_log() << "Reading cusp info from : " << cuspInfoFile << std::endl;
38  Libxml2Document adoc;
39  if (!adoc.parse(cuspInfoFile))
40  {
41  app_log() << "Could not find precomputed cusp data for spo set: " << objectName << std::endl;
42  app_log() << "Recalculating data.\n";
43  return false;
44  }
45  xmlNodePtr head = adoc.getRoot();
46  head = head->children;
47  xmlNodePtr cur = NULL, ctr;
48  while (head != NULL)
49  {
50  std::string cname(getNodeName(head));
51  if (cname == "sposet")
52  {
53  std::string name;
54  OhmmsAttributeSet spoAttrib;
55  spoAttrib.add(name, "name");
56  spoAttrib.put(head);
57  if (name == objectName)
58  {
59  cur = head;
60  break;
61  }
62  }
63  head = head->next;
64  }
65  if (cur == NULL)
66  {
67  app_log() << "Could not find precomputed cusp data for spo set: " << objectName << std::endl;
68  app_log() << "Recalculating data.\n";
69  return false;
70  }
71  else
72  {
73  app_log() << "Found precomputed cusp data for spo set: " << objectName << std::endl;
74  }
75  cur = cur->children;
76  while (cur != NULL)
77  {
78  std::string cname(getNodeName(cur));
79  if (cname == "center")
80  {
81  int num = -1;
82  OhmmsAttributeSet Attrib;
83  Attrib.add(num, "num");
84  Attrib.put(cur);
85  if (num < 0 || num >= ncenter)
86  {
87  APP_ABORT("Error with cusp info xml block. incorrect center number. \n");
88  }
89  ctr = cur->children;
90  while (ctr != NULL)
91  {
92  std::string cname(getNodeName(ctr));
93  if (cname == "orbital")
94  {
95  int orb = -1;
96  OhmmsAttributeSet orbAttrib;
97  QMCTraits::RealType a1(0.0), a2, a3, a4, a5, a6, a7, a8, a9;
98  orbAttrib.add(orb, "num");
99  orbAttrib.add(a1, "redo");
100  orbAttrib.add(a2, "C");
101  orbAttrib.add(a3, "sg");
102  orbAttrib.add(a4, "rc");
103  orbAttrib.add(a5, "a1");
104  orbAttrib.add(a6, "a2");
105  orbAttrib.add(a7, "a3");
106  orbAttrib.add(a8, "a4");
107  orbAttrib.add(a9, "a5");
108  orbAttrib.put(ctr);
109  if (orb < OrbitalSetSize)
110  {
111  info(num, orb).redo = a1;
112  info(num, orb).C = a2;
113  info(num, orb).sg = a3;
114  info(num, orb).Rc = a4;
115  info(num, orb).alpha[0] = a5;
116  info(num, orb).alpha[1] = a6;
117  info(num, orb).alpha[2] = a7;
118  info(num, orb).alpha[3] = a8;
119  info(num, orb).alpha[4] = a9;
120  }
121  }
122  ctr = ctr->next;
123  }
124  }
125  cur = cur->next;
126  }
127  return success;
128 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
std::ostream & app_log()
Definition: OutputManager.h:65
bool put(xmlNodePtr cur)
assign attributes to the set
Definition: AttributeSet.h:55
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
class to handle a set of attributes of an xmlNode
Definition: AttributeSet.h:24
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Definition: AppAbort.h:27
QMCTraits::RealType RealType
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
Definition: AttributeSet.h:42
std::string getNodeName(xmlNodePtr cur)
Definition: libxmldefs.cpp:15

◆ readNameTypeLikeLegacy()

void qmcplusplus::readNameTypeLikeLegacy ( InputSection input_section_,
std::string &  name,
std::string &  type 
)

make input class state consistent with legacy ignoring the distinction between the name and type of estimator for scalar estimators.

Parameters
[in]input_section_naming here is to allow reuse of LAMBDA_setIfInInput macro
[in,out]nameoutput param but assumed to be unset
[in,out]typeoutput param but assumed to be unset

Definition at line 26 of file ScalarEstimatorInputs.cpp.

References LAMBDA_setIfInInput.

Referenced by CSLocalEnergyInput::CSLocalEnergyInput(), LocalEnergyInput::LocalEnergyInput(), and RMCLocalEnergyInput::RMCLocalEnergyInput().

27 {
28  auto setIfInInput = LAMBDA_setIfInInput;
29  setIfInInput(type, "type");
30  setIfInInput(name, "name");
31  if (name.empty())
32  name = type;
33  if (type.empty())
34  type = name;
35 }
#define LAMBDA_setIfInInput
If tag is present in input_secution set its variable.

◆ real() [1/4]

float qmcplusplus::real ( const float &  c)
inline

real part of a scalar. Cannot be replaced by std::real due to AFQMC specific needs.

Definition at line 86 of file complex_help.hpp.

Referenced by accum_sample(), SelfHealingOverlap::accumulate(), OTCDot< T1, T2, D >::apply(), OTCDot_CC< T1, T2, D >::apply(), OTAssign< TinyVector< T1, 3 >, TinyVector< std::complex< T2 >, 3 >, OP >::apply(), Quadrature3D< T >::CheckQuadratureRule(), DensityMatrices1B::compare(), MPC::compute_g_G(), compute_norm(), Copy(), kSpaceJastrow::evalGrad(), SelfHealingOverlapLegacy::evaluate(), PWRealOrbitalSet::evaluate(), DensityMatrices1B::evaluate_loop(), DensityMatrices1B::evaluate_matrix(), PWRealOrbitalSet::evaluate_notranspose(), BareKineticEnergy::evaluate_sp(), DiracDeterminantWithBackflow::evaluateDerivatives(), kSpaceJastrow::evaluateDerivatives(), kSpaceJastrow::evaluateLog(), OneBodyDensityMatrices::evaluateMatrix(), kSpaceJastrow::evaluateRatiosAlltoOne(), PWRealOrbitalSet::evaluateValue(), PWRealOrbitalSet::evaluateVGL(), ComplexExpFitClass< M >::Fit(), ComplexExpFitClass< M >::FitCusp(), fix_phase_rotate(), MPC::init_spline(), MomentumDistribution::MomentumDistribution(), BareKineticEnergy::mw_evaluatePerParticle(), DensityMatrices1B::normalize(), OneBodyDensityMatrices::normalizeBasis(), kSpaceJastrow::ratio(), kSpaceJastrow::ratioGrad(), WaveFunctionTester::runZeroVarianceTest(), TEST_CASE(), SHOSet::test_derivatives(), DiracDeterminantWithBackflow::testDerivFjj(), DiracDeterminantWithBackflow::testGGG(), and OrbitalImages::write_orbital_xsf().

86 { return c; }

◆ real() [2/4]

double qmcplusplus::real ( const double &  c)
inline

Definition at line 87 of file complex_help.hpp.

87 { return c; }

◆ real() [3/4]

float qmcplusplus::real ( const std::complex< float > &  c)
inline

Definition at line 88 of file complex_help.hpp.

88 { return c.real(); }

◆ real() [4/4]

double qmcplusplus::real ( const std::complex< double > &  c)
inline

Definition at line 89 of file complex_help.hpp.

89 { return c.real(); }

◆ real2string()

std::string qmcplusplus::real2string ( const double &  r)
inline

Definition at line 126 of file string_utils.h.

127 {
128  std::stringstream ss;
129  ss << r;
130  return ss.str();
131 }

◆ removeSTypeOrbitals()

void removeSTypeOrbitals ( const std::vector< bool > &  corrCenter,
LCAOrbitalSet Phi 
)

Remove S atomic orbitals from all molecular orbitals on all centers.

Definition at line 256 of file CuspCorrectionConstruction.cpp.

References LCAOrbitalSet::C, LCAOrbitalSet::getBasisSetSize(), SPOSet::getOrbitalSetSize(), and LCAOrbitalSet::myBasisSet.

Referenced by applyCuspCorrection(), and TEST_CASE().

257 {
259 
260  std::vector<bool> is_s_orbital(Phi.myBasisSet->BasisSetSize, false);
261 
262  Phi.myBasisSet->queryOrbitalsForSType(corrCenter, is_s_orbital);
263 
264  int nOrbs = Phi.getOrbitalSetSize();
265  int bss = Phi.getBasisSetSize();
266 
267  for (int i = 0; i < bss; i++)
268  {
269  if (is_s_orbital[i])
270  {
271  auto& cref(*(Phi.C));
272  for (int k = 0; k < nOrbs; k++)
273  cref(k, i) = 0.0;
274  }
275  }
276 }
QMCTraits::RealType RealType

◆ REQUIRE() [1/6]

◆ REQUIRE() [2/6]

qmcplusplus::REQUIRE ( std::filesystem::remove(filename)  )

◆ REQUIRE() [3/6]

REQUIRE ( okay  )

◆ REQUIRE() [4/6]

REQUIRE ( clone = nullptr)

◆ REQUIRE() [5/6]

REQUIRE ( clone.get() !  = &original)

◆ REQUIRE() [6/6]

REQUIRE ( dynamic_cast< decltype(&original)>(clone.get()) !  = nullptr)

◆ reset_string_output()

void qmcplusplus::reset_string_output ( )

Definition at line 25 of file test_output_manager.cpp.

References app_out, debug_out, err_out, and summary_out.

Referenced by init_string_output(), and TEST_CASE().

26 {
27  summary_out.str("");
28  app_out.str("");
29  err_out.str("");
30  debug_out.str("");
31 }
static std::ostringstream app_out
static std::ostringstream err_out
static std::ostringstream summary_out
static std::ostringstream debug_out

◆ saveCusp()

void saveCusp ( const std::string &  filename,
const Matrix< CuspCorrectionParameters > &  info,
const std::string &  id 
)

save cusp correction info to a file.

Definition at line 130 of file CuspCorrectionConstruction.cpp.

References app_log(), qmcplusplus::Units::charge::C, Matrix< T, Alloc >::cols(), doc, and Matrix< T, Alloc >::rows().

Referenced by LCAOrbitalBuilder::createSPOSetFromXML().

131 {
132  const int num_centers = info.rows();
133  const int orbital_set_size = info.cols();
134  xmlDocPtr doc = xmlNewDoc((const xmlChar*)"1.0");
135  xmlNodePtr cuspRoot = xmlNewNode(NULL, BAD_CAST "qmcsystem");
136  xmlNodePtr spo = xmlNewNode(NULL, (const xmlChar*)"sposet");
137  xmlNewProp(spo, (const xmlChar*)"name", (const xmlChar*)id.c_str());
138  xmlAddChild(cuspRoot, spo);
139  xmlDocSetRootElement(doc, cuspRoot);
140 
141  for (int center_idx = 0; center_idx < num_centers; center_idx++)
142  {
143  xmlNodePtr ctr = xmlNewNode(NULL, (const xmlChar*)"center");
144  std::ostringstream num;
145  num << center_idx;
146  xmlNewProp(ctr, (const xmlChar*)"num", (const xmlChar*)num.str().c_str());
147 
148  for (int mo_idx = 0; mo_idx < orbital_set_size; mo_idx++)
149  {
150  std::ostringstream num0, C, sg, rc, a1, a2, a3, a4, a5;
151  xmlNodePtr orb = xmlNewNode(NULL, (const xmlChar*)"orbital");
152  num0 << mo_idx;
153  xmlNewProp(orb, (const xmlChar*)"num", (const xmlChar*)num0.str().c_str());
154 
155 
156  C.setf(std::ios::scientific, std::ios::floatfield);
157  C.precision(14);
158  C << info(center_idx, mo_idx).C;
159  sg.setf(std::ios::scientific, std::ios::floatfield);
160  sg.precision(14);
161  sg << info(center_idx, mo_idx).sg;
162  rc.setf(std::ios::scientific, std::ios::floatfield);
163  rc.precision(14);
164  rc << info(center_idx, mo_idx).Rc;
165  a1.setf(std::ios::scientific, std::ios::floatfield);
166  a1.precision(14);
167  a1 << info(center_idx, mo_idx).alpha[0];
168  a2.setf(std::ios::scientific, std::ios::floatfield);
169  a2.precision(14);
170  a2 << info(center_idx, mo_idx).alpha[1];
171  a3.setf(std::ios::scientific, std::ios::floatfield);
172  a3.precision(14);
173  a3 << info(center_idx, mo_idx).alpha[2];
174  a4.setf(std::ios::scientific, std::ios::floatfield);
175  a4.precision(14);
176  a4 << info(center_idx, mo_idx).alpha[3];
177  a5.setf(std::ios::scientific, std::ios::floatfield);
178  a5.precision(14);
179  a5 << info(center_idx, mo_idx).alpha[4];
180  xmlNewProp(orb, (const xmlChar*)"C", (const xmlChar*)C.str().c_str());
181  xmlNewProp(orb, (const xmlChar*)"sg", (const xmlChar*)sg.str().c_str());
182  xmlNewProp(orb, (const xmlChar*)"rc", (const xmlChar*)rc.str().c_str());
183  xmlNewProp(orb, (const xmlChar*)"a1", (const xmlChar*)a1.str().c_str());
184  xmlNewProp(orb, (const xmlChar*)"a2", (const xmlChar*)a2.str().c_str());
185  xmlNewProp(orb, (const xmlChar*)"a3", (const xmlChar*)a3.str().c_str());
186  xmlNewProp(orb, (const xmlChar*)"a4", (const xmlChar*)a4.str().c_str());
187  xmlNewProp(orb, (const xmlChar*)"a5", (const xmlChar*)a5.str().c_str());
188  xmlAddChild(ctr, orb);
189  }
190  xmlAddChild(spo, ctr);
191  }
192 
193  app_log() << "Saving resulting cusp Info xml block to: " << filename << std::endl;
194  xmlSaveFormatFile(filename.c_str(), doc, 1);
195  xmlFreeDoc(doc);
196 }
std::ostream & app_log()
Definition: OutputManager.h:65

◆ sdi()

SpinDensityInput qmcplusplus::sdi ( node  )

◆ set_num_calls()

void qmcplusplus::set_num_calls ( TimerType< CLOCK > *  timer,
long  num_calls_input 
)

Definition at line 32 of file test_timer.cpp.

References TimerType< CLOCK >::num_calls.

Referenced by TEST_CASE().

33 {
34  timer->num_calls = num_calls_input;
35 }

◆ set_total_time()

void qmcplusplus::set_total_time ( TimerType< CLOCK > *  timer,
double  total_time_input 
)

Definition at line 26 of file test_timer.cpp.

References TimerType< CLOCK >::total_time.

Referenced by TEST_CASE().

27 {
28  timer->total_time = total_time_input;
29 }

◆ setScaledDrift() [1/3]

void qmcplusplus::setScaledDrift ( tau,
const ParticleAttrib< TinyVector< TG, D >> &  qf,
ParticleAttrib< TinyVector< T, D >> &  drift 
)
inline

da = scaled(tau)*ga

Parameters
tautime step
qfreal quantum forces
driftdrift

Definition at line 166 of file DriftOperators.h.

References getDriftScale(), and qmcplusplus::Units::time::s.

Referenced by RMCUpdateAllWithDrift::advanceWalkersRMC(), and RMCUpdateAllWithDrift::advanceWalkersVMC().

167 {
168  T s = getDriftScale(tau, qf);
169  PAOps<T, D, TG>::scale(s, qf, drift);
170 }
T getDriftScale(T tau, const ParticleAttrib< TinyVector< TG, D >> &ga)

◆ setScaledDrift() [2/3]

void qmcplusplus::setScaledDrift ( tau,
ParticleAttrib< TinyVector< T, D >> &  drift 
)
inline

da = scaled(tau)*ga

Parameters
tautime step
qfreal quantum forces
driftdrift

Definition at line 178 of file DriftOperators.h.

References getDriftScale(), and qmcplusplus::Units::time::s.

179 {
180  T s = getDriftScale(tau, drift);
181  drift *= s;
182 }
T getDriftScale(T tau, const ParticleAttrib< TinyVector< TG, D >> &ga)

◆ setScaledDrift() [3/3]

void qmcplusplus::setScaledDrift ( tau,
const ParticleAttrib< TinyVector< std::complex< TG >, D >> &  qf,
ParticleAttrib< TinyVector< T, D >> &  drift 
)
inline

da = scaled(tau)*ga

Parameters
tautime step
qfcomplex quantum forces
driftdrift

Definition at line 191 of file DriftOperators.h.

References convertToReal(), getDriftScale(), and qmcplusplus::Units::time::s.

194 {
195  for (int iat = 0; iat < qf.size(); ++iat)
196  convertToReal(qf[iat], drift[iat]);
197 
198  T s = getDriftScale(tau, drift);
199  drift *= s;
200 }
void convertToReal(const T1 &in, T2 &out)
generic conversion from type T1 to type T2 using implicit conversion
Definition: ConvertToReal.h:32
T getDriftScale(T tau, const ParticleAttrib< TinyVector< TG, D >> &ga)

◆ setScaledDriftPbyPandNodeCorr() [1/2]

T qmcplusplus::setScaledDriftPbyPandNodeCorr ( tau,
const ParticleAttrib< TinyVector< T1, D >> &  qf,
ParticleAttrib< TinyVector< T, D >> &  drift 
)
inline

scale drift

Parameters
tau_autimestep au
qfquantum forces
driftscaled quantum forces
returncorrection term

Assume, mass=1

Definition at line 86 of file DriftOperators.h.

References convertToReal(), dot(), norm(), and sqrt().

Referenced by DMCUpdateAllWithRejection::advanceWalker(), DMCUpdateAllWithKill::advanceWalker(), RMCUpdateAllWithDrift::advanceWalkersVMC(), QMCUpdateBase::getNodeCorrection(), RMCUpdateAllWithDrift::initWalkers(), QMCUpdateBase::initWalkers(), and TEST_CASE().

89 {
90  T norm = 0.0, norm_scaled = 0.0, tau2 = tau * tau;
91  for (int iat = 0; iat < qf.size(); ++iat)
92  {
93  convertToReal(qf[iat], drift[iat]);
94  T vsq = dot(drift[iat], drift[iat]);
95  T sc = (vsq < std::numeric_limits<T>::epsilon()) ? tau : ((-1.0 + std::sqrt(1.0 + 2.0 * tau * vsq)) / vsq);
96  norm_scaled += vsq * sc * sc;
97  norm += vsq * tau2;
98  drift[iat] *= sc;
99  }
100  return std::sqrt(norm_scaled / norm);
101 }
T dot(T *a, T *b)
void convertToReal(const T1 &in, T2 &out)
generic conversion from type T1 to type T2 using implicit conversion
Definition: ConvertToReal.h:32
double norm(const zVec &c)
Definition: VectorOps.h:118
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ setScaledDriftPbyPandNodeCorr() [2/2]

T qmcplusplus::setScaledDriftPbyPandNodeCorr ( tau_au,
const std::vector< T > &  massinv,
const ParticleAttrib< TinyVector< T1, D >> &  qf,
ParticleAttrib< TinyVector< T, D >> &  drift 
)
inline

scale drift

Parameters
tau_autimestep au
massinv1/m per particle
qfquantum forces, i.e. grad_psi_over_psi
driftscaled importance-sampling drift
returncorrection term

Fill the drift vector one particle at a time (pbyp).

The naive drift is tau/mass*|grad_psi_over_psi|, grad_psi_over_psi the log derivative of the guiding wavefunction; tau is timestep; mass is particle mass The naive drift diverges at a node and is large near a nucleus. Both cases may cause persistent configurations, because the reverse proposal probability is virtually zero.

The norm of the drift vector should be limited in two ways:

  1. Umrigar: suppress drift divergence with a sclaing factor
  2. Ceperley: limit max drift rate to diffusion rate -> set Umrigar "a" parameter The choice of drift vector does not affect VMC correctness so long as the proposal probabilities are correctly calculated. The choice of drift vector changes the DMC Green's function. BE CAREFUL!

T should be either float or double T1 may be real (float or double) or complex<float or double> D should be the number of spatial dimensions (int)

Definition at line 131 of file DriftOperators.h.

References convertToReal(), dot(), norm(), and sqrt().

135 {
136  // Umrigar eq. (34) "a" parameter is set to 1.0
137  T norm = 0.0, norm_scaled = 0.0; // variables to be accumulated
138  for (int iat = 0; iat < massinv.size(); ++iat)
139  {
140  // !!!! assume timestep is scaled by mass
141  T tau_over_mass = tau_au * massinv[iat];
142  // save real part of wf log derivative in drift
143  convertToReal(qf[iat], drift[iat]);
144  T vsq = dot(drift[iat], drift[iat]);
145  // calculate drift scalar "sc" of Umrigar, JCP 99, 2865 (1993); eq. (34) * tau
146  // use naive drift if vsq may cause numerical instability in the denominator
147  T sc = (vsq < std::numeric_limits<T>::epsilon()) ? tau_over_mass
148  : (-1.0 + std::sqrt(1.0 + 2.0 * tau_over_mass * vsq)) / vsq;
149  drift[iat] *= sc;
150 
151  norm_scaled += vsq * sc * sc;
152  norm += vsq * tau_over_mass * tau_over_mass;
153  }
154  return std::sqrt(norm_scaled / norm);
155 }
T dot(T *a, T *b)
void convertToReal(const T1 &in, T2 &out)
generic conversion from type T1 to type T2 using implicit conversion
Definition: ConvertToReal.h:32
double norm(const zVec &c)
Definition: VectorOps.h:118
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ setSpeciesProperty()

void qmcplusplus::setSpeciesProperty ( SpeciesSet tspecies,
int  sid,
xmlNodePtr  cur 
)

set the property of a SpeciesSet

Parameters
tspeciesSpeciesSet
sidid of the species whose properties to be set

Need unit handlers but for now, everything is in AU: m_e=1.0, hartree and bohr and unit="au" Example to define C(arbon) <group name="C"> <parameter name="mass" unit="amu">12</parameter> <parameter name="charge">-6</parameter> </group> Note that unit="amu" is given for the mass. When mass is not given, they are set to the electron mass.

Definition at line 46 of file XMLParticleIO.cpp.

References OhmmsAttributeSet::add(), SpeciesSet::addAttribute(), qmcplusplus::Units::proton_mass, OhmmsAttributeSet::put(), and putContent().

Referenced by XMLParticleParser::readXML(), and XMLParticleParser::reset().

47 {
48  const double proton_mass = 1822.888530063;
49  cur = cur->xmlChildrenNode;
50  while (cur != NULL)
51  {
52  std::string cname((const char*)cur->name);
53  if (cname == "parameter")
54  {
55  std::string pname;
56  std::string unit_name("au"); //hartree, bohr & me=1
57  OhmmsAttributeSet pAttrib;
58  pAttrib.add(pname, "name");
59  pAttrib.add(unit_name, "unit");
60  pAttrib.put(cur);
61  if (pname.size())
62  {
63  int iproperty = tspecies.addAttribute(pname);
64  double ap = 0.0;
65  double unit_conv = 1.0;
66  putContent(ap, cur);
67  if (pname == "mass")
68  {
69  if (unit_name == "amu")
70  unit_conv = proton_mass;
71  }
72  tspecies(iproperty, sid) = ap * unit_conv;
73  }
74  }
75  cur = cur->next;
76  }
77 }
bool put(xmlNodePtr cur)
assign attributes to the set
Definition: AttributeSet.h:55
class to handle a set of attributes of an xmlNode
Definition: AttributeSet.h:24
bool putContent(T &a, xmlNodePtr cur)
replaces a&#39;s value with the first "element" in the "string" returned by XMLNodeString{cur}.
Definition: libxmldefs.h:88
void add(PDT &aparam, const std::string &aname, std::vector< PDT > candidate_values={}, TagStatus status=TagStatus::OPTIONAL)
add a new attribute
Definition: AttributeSet.h:42

◆ setup_He_wavefunction()

std::unique_ptr<TrialWaveFunction> qmcplusplus::setup_He_wavefunction ( Communicate c,
ParticleSet elec,
ParticleSet ions,
const WaveFunctionFactory::PSetMap particle_set_map 
)

Definition at line 30 of file test_TrialWaveFunction_He.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), WaveFunctionFactory::buildTWF(), ParticleSet::create(), doc, Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), and ParticleSet::resetGroups().

Referenced by TEST_CASE().

34 {
35  std::vector<int> agroup(2);
36  int nelec = 2;
37  agroup[0] = 1;
38  agroup[1] = 1;
39  elec.create(agroup);
40  elec.R[0] = {1.0, 2.0, 3.0};
41  elec.R[1] = {1.0, 2.1, 2.2};
42  SpeciesSet& tspecies = elec.getSpeciesSet();
43  int upIdx = tspecies.addSpecies("u");
44  int downIdx = tspecies.addSpecies("d");
45  int massIdx = tspecies.addAttribute("mass");
46  // Define the charge so the Jastrow cusp is set automatically
47  int e_chargeIdx = tspecies.addAttribute("charge");
48  // Mass is set oddly so the parameter derivative code is tested properly
49  tspecies(massIdx, upIdx) = 3.0;
50  tspecies(massIdx, downIdx) = 3.0;
51  tspecies(e_chargeIdx, upIdx) = -1.0;
52  tspecies(e_chargeIdx, downIdx) = -1.0;
53  elec.resetGroups();
54 
55  ions.create({1});
56  ions.R[0] = {0.0, 0.0, 0.0};
57  SpeciesSet& he_species = ions.getSpeciesSet();
58  int He_Idx = he_species.addSpecies("He");
59  int chargeIdx = he_species.addAttribute("charge");
60  tspecies(chargeIdx, He_Idx) = 2.0;
61  tspecies(massIdx, upIdx) = 2.0;
62 
63  elec.addTable(ions);
64 
65  WaveFunctionFactory wff(elec, particle_set_map, c);
66 
67  const char* wavefunction_xml = R"(<wavefunction name="psi0" target="e">
68  <jastrow name="Jee" type="Two-Body" function="pade">
69  <correlation speciesA="u" speciesB="d">
70  <var id="jud_b" name="B">0.8</var>
71  </correlation>
72  </jastrow>
73  <determinantset type="MO" key="STO" transform="no" source="ion0">
74  <basisset>
75  <atomicBasisSet type="STO" elementType="He">
76  <basisGroup rid="R0" n="1" l="0" m="0" type="Slater">
77  <radfunc exponent="2.0"/>
78  </basisGroup>
79  </atomicBasisSet>
80  </basisset>
81  <slaterdeterminant>
82  <determinant id="updet" spin="1" size="1">
83  <coefficient id="updetC" type="Array" size="1">
84  1.0
85  </coefficient>
86  </determinant>
87  <determinant id="downdet" spin="-1" size="1">
88  <coefficient id="downdetC" type="Array" size="1">
89  1.0
90  </coefficient>
91  </determinant>
92  </slaterdeterminant>
93  </determinantset>
94  </wavefunction>)";
95 
96 
98  bool okay = doc.parseFromString(wavefunction_xml);
99  REQUIRE(okay);
100 
101  xmlNodePtr root = doc.getRoot();
102  RuntimeOptions runtime_options;
103  auto twf_ptr = wff.buildTWF(root, runtime_options);
104 
105  REQUIRE(twf_ptr != nullptr);
106  REQUIRE(twf_ptr->size() == 2);
107 
108  return twf_ptr;
109 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ setup_sfnb()

SetupSFNBranch qmcplusplus::setup_sfnb ( pools.  comm)

◆ setupParticleSetPool()

void setupParticleSetPool ( ParticleSetPool pp)

Definition at line 36 of file test_RotatedSPOs_LCAO.cpp.

References doc, Libxml2Document::getRoot(), okay, Libxml2Document::parseFromString(), ParticleSetPool::put(), and REQUIRE().

Referenced by TEST_CASE().

37 {
38  // See ParticleIO/tests/test_xml_io.cpp for particle parsing
39  const char* particles = R"(<tmp>
40  <particleset name="ion0" size="1">
41  <group name="He">
42  <parameter name="charge">2</parameter>
43  </group>
44  <attrib name="position" datatype="posArray">
45  0.0 0.0 0.0
46  </attrib>
47  </particleset>
48 
49  <particleset name="e" random="no">
50  <group name="u" size="1">
51  <parameter name="charge">-1</parameter>
52  <attrib name="position" datatype="posArray">
53  1.0 2.0 3.0
54  </attrib>
55  </group>
56  <group name="d" size="1">
57  <parameter name="charge">-1</parameter>
58  <attrib name="position" datatype="posArray">
59  0.0 1.1 2.2
60  </attrib>
61  </group>
62  </particleset>
63 </tmp>)";
65 
66  bool okay = doc.parseFromString(particles);
67  REQUIRE(okay);
68 
69  xmlNodePtr root = doc.getRoot();
70 
71  xmlNodePtr part_ion = xmlFirstElementChild(root);
72  pp.put(part_ion);
73  xmlNodePtr part_elec = xmlNextElementSibling(part_ion);
74  pp.put(part_elec);
75 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ setupParticleSetPoolBe()

void qmcplusplus::setupParticleSetPoolBe ( ParticleSetPool pp)

Definition at line 78 of file test_RotatedSPOs_LCAO.cpp.

References doc, Libxml2Document::getRoot(), okay, Libxml2Document::parseFromString(), ParticleSetPool::put(), and REQUIRE().

Referenced by TEST_CASE().

79 {
80  // See ParticleIO/tests/test_xml_io.cpp for particle parsing
81  const char* particles = R"(<qmcsystem>
82  <particleset name="ion0" size="1">
83  <group name="Be">
84  <parameter name="charge">4</parameter>
85  <parameter name="valence">4</parameter>
86  <parameter name="atomicnumber">4</parameter>
87  </group>
88  <attrib name="position" datatype="posArray">
89  0.0000000000e+00 0.0000000000e+00 0.0000000000e+00
90 </attrib>
91  <attrib name="ionid" datatype="stringArray">
92  Be
93 </attrib>
94  </particleset>
95 
96  <particleset name="e" random="no">
97  <group name="u" size="2">
98  <parameter name="charge">-1</parameter>
99  <attrib name="position" datatype="posArray">
100  0.7 2.0 3.0
101  1.2 1.5 0.5
102  </attrib>
103  </group>
104  <group name="d" size="2">
105  <parameter name="charge">-1</parameter>
106  <attrib name="position" datatype="posArray">
107  1.5 1.6 1.5
108  0.7 1.0 1.2
109  </attrib>
110  </group>
111  </particleset>
112 </qmcsystem>)";
113 
115 
116  bool okay = doc.parseFromString(particles);
117  REQUIRE(okay);
118 
119  xmlNodePtr root = doc.getRoot();
120 
121  xmlNodePtr part_ion = xmlFirstElementChild(root);
122  pp.put(part_ion);
123  xmlNodePtr part_elec = xmlNextElementSibling(part_ion);
124  pp.put(part_elec);
125 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ setupRotationXML()

std::string qmcplusplus::setupRotationXML ( const std::string &  rot_angle_up,
const std::string &  rot_angle_down,
const std::string &  coeff_up,
const std::string &  coeff_down 
)

Definition at line 127 of file test_RotatedSPOs_LCAO.cpp.

Referenced by TEST_CASE().

131 {
132  // Replace with std::format when minimum standard is switched to C++20
133 
134  const std::string wf_input1 = R"(<wavefunction target='e'>
135  <sposet_collection type="MolecularOrbital">
136  <!-- Use a single Slater Type Orbital (STO) for the basis. Cusp condition is correct. -->
137  <basisset keyword="STO" transform="no">
138  <atomicBasisSet type="STO" elementType="He" normalized="no">
139  <basisGroup rid="R0" l="0" m="0" type="Slater">
140  <radfunc n="1" exponent="2.0"/>
141  </basisGroup>
142  <basisGroup rid="R1" l="0" m="0" type="Slater">
143  <radfunc n="2" exponent="1.0"/>
144  </basisGroup>
145  </atomicBasisSet>
146  </basisset>
147  <rotated_sposet name="rot-spo-up">
148  <sposet basisset="LCAOBSet" name="spo-up">)";
149 
150  // Opt vars for up determinant
151  // <opt_vars>0.1</opt_vars>
152  const std::string opt_vars_start_tag("<opt_vars>");
153  const std::string opt_vars_end_tag("</opt_vars>");
154 
155  std::string rot_angle_up_element = opt_vars_start_tag + rot_angle_up + opt_vars_end_tag + "\n";
156 
157  // Construct the coefficient matrix XML element for the up determinant
158  // <coefficient id="updetC" type="Array" size="2">
159  // 1.0 0.0
160  // 0.0 1.0
161  // </coefficient>
162  const std::string wf_input_coeff_up_start = R"(<coefficient id="updetC" type="Array" size="2">)";
163 
164  const std::string wf_input_coeff_up_end("</coefficient>");
165 
166  std::string coeff_up_element = wf_input_coeff_up_start + coeff_up + wf_input_coeff_up_end;
167 
168  const std::string sposet_end = R"(</sposet>)";
169 
170  // Middle part of XML input block
171  const std::string wf_input2 = R"(
172  </rotated_sposet>
173  <rotated_sposet name="rot-spo-down">
174  <sposet basisset="LCAOBSet" name="spo-down">)";
175 
176  // Opt vars for down determinant
177  // <opt_vars>0.2</opt_vars>
178  std::string rot_angle_down_element = opt_vars_start_tag + rot_angle_down + opt_vars_end_tag + "\n";
179 
180  // Construct the coefficient matrix XML element for the down determinant
181  // <coefficient id="downdetC" type="Array" size="2">
182  // 1.0 0.0
183  // 0.0 1.0
184  // </coefficient>
185  const std::string wf_input_coeff_down_start = R"(<coefficient id="downdetC" type="Array" size="2">)";
186 
187  const std::string wf_input_coeff_down_end("</coefficient>");
188 
189  std::string coeff_down_element = wf_input_coeff_down_start + coeff_down + wf_input_coeff_down_end;
190 
191  const std::string wf_input3 = R"(
192  </rotated_sposet>
193  </sposet_collection>
194  <determinantset type="MO" key="STO" transform="no" source="ion0">
195  <slaterdeterminant>
196  <determinant sposet="rot-spo-up"/>
197  <determinant sposet="rot-spo-down"/>
198  </slaterdeterminant>
199  </determinantset>
200  </wavefunction>)";
201 
202 
203  // clang-format off
204  std::string wf_input = std::string(wf_input1) + "\n" +
205  coeff_up_element + "\n" +
206  sposet_end + "\n" +
207  (rot_angle_up.empty() ? std::string() : rot_angle_up_element) +
208  wf_input2 + "\n" +
209  coeff_down_element + "\n" +
210  sposet_end + "\n" +
211  (rot_angle_down.empty() ? std::string() : rot_angle_down_element) +
212  std::string(wf_input3);
213  // clang-format on
214 
215  return wf_input;
216 }

◆ sin() [1/2]

MakeReturn<UnaryNode<FnSin, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::sin ( const Vector< T1, C1 > &  l)
inline

Definition at line 120 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by assignGaussRand(), QMCFiniteSize::build_spherical_grid(), LatticeAnalyzer< T, 2 >::calcSimulationCellRadius(), RadialJastrowBuilder::computeJ2uk(), J2KECorrection< RealType, FT >::computeKEcorr(), LPQHI_BasisClass::dEminus_dk(), LPQHI_BasisClass::dEplus_dk(), derivYlmSpherical(), LPQHIBasis::Eminus(), LPQHISRCoulombBasis::Eminus(), LPQHI_BasisClass::Eminus(), LPQHISRCoulombBasis::Eminus_dG(), LPQHIBasis::Eplus(), LPQHISRCoulombBasis::Eplus(), LPQHI_BasisClass::Eplus(), LPQHISRCoulombBasis::Eplus_dG(), SpinorSet::evaluate_notranspose(), SpinorSet::evaluate_notranspose_spin(), SpinorSet::evaluate_spin(), SpinorSet::evaluateDetSpinorRatios(), SpinorSet::evaluateGradSource(), SpinorSet::evaluateValue(), SpinorSet::evaluateVGL(), SpinorSet::evaluateVGL_spin(), generateRotationMatrix(), MagnetizationDensity::generateSpinIntegrand(), MPC::init_f_G(), SpaceGrid::initialize_rectilinear(), ChannelPotential::jl(), kSpaceJastrow::kSpaceJastrow(), SOECPComponent::matrixElementDecomposed(), SpinorSet::mw_evaluate_notranspose(), SpinorSet::mw_evaluateVGLandDetRatioGradsWithSpin(), SpinorSet::mw_evaluateVGLWithSpin(), FnSin::operator()(), Quadrature3D< T >::Quadrature3D(), WaveFunctionTester::runBasicTest(), WaveFunctionTester::runZeroVarianceTest(), sincos(), sMatrixElement(), SOECPComponent::sMatrixElements(), NESpaceGrid< REAL >::someMoreAxisGridStuff(), sph2cart(), kSpaceJastrow::StructureFactor(), TEST_CASE(), test_e2iphi(), YukawaBreakup< T >::Xk(), DerivYukawaBreakup< T >::Xk(), Ylm(), and Ylm().

122 {
123  using Tree_t = UnaryNode<FnSin, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
124  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
125 }

◆ sin() [2/2]

MakeReturn<UnaryNode<FnSin, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::sin ( const Expression< T1 > &  l)
inline

Definition at line 1467 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1469 {
1470  using Tree_t = UnaryNode<FnSin, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1471  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1472 }

◆ sincos()

void qmcplusplus::sincos ( a,
T *restrict  s,
T *restrict  c 
)
inline

sincos function wrapper

Definition at line 62 of file math.hpp.

References cos(), qmcplusplus::Units::time::s, and sin().

Referenced by qmcplusplus::C2C::assign_v(), qmcplusplus::C2R::assign_v(), SplineC2R< ST >::assign_v(), SplineC2C< ST >::assign_v(), SplineC2COMPTarget< ST >::assign_v(), SplineC2ROMPTarget< ST >::assign_v(), SplineC2R< ST >::assign_vgh(), SplineC2C< ST >::assign_vgh(), SplineC2COMPTarget< ST >::assign_vgh(), SplineC2ROMPTarget< ST >::assign_vgh(), SplineC2R< ST >::assign_vghgh(), SplineC2C< ST >::assign_vghgh(), SplineC2COMPTarget< ST >::assign_vghgh(), SplineC2ROMPTarget< ST >::assign_vghgh(), qmcplusplus::C2C::assign_vgl(), qmcplusplus::C2R::assign_vgl(), SplineC2R< ST >::assign_vgl(), SplineC2C< ST >::assign_vgl(), SplineC2R< ST >::assign_vgl_from_l(), SplineC2C< ST >::assign_vgl_from_l(), SplineC2COMPTarget< ST >::assign_vgl_from_l(), SplineC2ROMPTarget< ST >::assign_vgl_from_l(), Gvectors< ST, LT >::calc_phase_shift(), compute_phase(), StructFact::computeRhok(), eval_e2iphi(), LCAOrbitalBuilder::EvalPeriodicImagePhaseFactors(), FreeOrbital::evaluate_notranspose(), Gvectors< ST, LT >::evaluate_psi_r(), SoaAtomicBasisSet< ROT, SH >::evaluateV(), FreeOrbital::evaluateValue(), SoaAtomicBasisSet< ROT, SH >::evaluateVGH(), SoaAtomicBasisSet< ROT, SH >::evaluateVGHGH(), FreeOrbital::evaluateVGL(), SoaAtomicBasisSet< ROT, SH >::evaluateVGL(), fix_phase_rotate(), fix_phase_rotate_c2r(), SoaAtomicBasisSet< ROT, SH >::mw_evaluateV(), SoaAtomicBasisSet< ROT, SH >::mw_evaluateVGL(), SpinorSet::mw_evaluateVGLandDetRatioGradsWithSpin(), StructFact::mw_updateAllPart(), and smoothing().

63 {
64  *s = std::sin(a);
65  *c = std::cos(a);
66 }
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)

◆ sinh() [1/2]

MakeReturn<UnaryNode<FnHypSin, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::sinh ( const Vector< T1, C1 > &  l)
inline

Definition at line 128 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by FnHypSin::operator()().

130 {
131  using Tree_t = UnaryNode<FnHypSin, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
132  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
133 }

◆ sinh() [2/2]

MakeReturn<UnaryNode<FnHypSin, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::sinh ( const Expression< T1 > &  l)
inline

Definition at line 1475 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1477 {
1478  using Tree_t = UnaryNode<FnHypSin, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1479  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1480 }

◆ smoothing() [1/3]

T smoothing ( smoothing_functions  func_id,
x,
T &  dx,
T &  d2x 
)

1/2 - 1/2 tanh(alpha * (x - 1/2))

(1+cos(PI*(1-cos(PI*x))/2))/2

1-x

Definition at line 22 of file SmoothFunctions.cpp.

References BLAS::cone, COSCOS, LEKS2018, LINEAR, qmcplusplus::Units::time::s, sincos(), and tanh().

Referenced by HybridRepCenterOrbitals< SPLINEBASE::DataType >::selectRegionAndComputeSmoothing().

23 {
24  if (x < 0)
25  {
26  dx = d2x = T(0);
27  return T(1);
28  }
29  else if (x >= 1)
30  {
31  dx = d2x = T(0);
32  return T(0);
33  }
34  else if (func_id == smoothing_functions::LEKS2018)
35  {
36  /// 1/2 - 1/2 tanh(alpha * (x - 1/2))
37  const T cone(1), chalf(0.5), alpha(2);
38  const T tanh_x = std::tanh((x - chalf) * alpha);
39  const T dtanhx_dx = cone - tanh_x * tanh_x;
40 
41  dx = -chalf * alpha * dtanhx_dx;
42  d2x = alpha * alpha * tanh_x * dtanhx_dx;
43  return chalf * (cone - tanh_x);
44  }
45  else if (func_id == smoothing_functions::COSCOS)
46  {
47  /// (1+cos(PI*(1-cos(PI*x))/2))/2
48  const T chalf(0.5), cone(1), pihalf(M_PI * chalf), pipihalf(M_PI * M_PI * chalf);
49  T s, c, scos, ccos;
50  qmcplusplus::sincos(T(M_PI) * x, &s, &c);
51  qmcplusplus::sincos(pihalf * (cone - c), &scos, &ccos);
52 
53  dx = -chalf * pipihalf * scos * s;
54  d2x = -pihalf * pipihalf * (ccos * pihalf * s * s + scos * c);
55  return chalf * (cone + ccos);
56  }
57  else if (func_id == smoothing_functions::LINEAR)
58  {
59  /// 1-x
60  dx = T(-1);
61  d2x = T(0);
62  return T(1) - x;
63  }
64  else
65  throw std::runtime_error("Unknown smooth function!");
66 }
constexpr std::complex< float > cone
Definition: BLAS.hpp:50
Definition: Grid.h:32
MakeReturn< UnaryNode< FnHypTan, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t tanh(const Vector< T1, C1 > &l)
void sincos(T a, T *restrict s, T *restrict c)
sincos function wrapper
Definition: math.hpp:62

◆ smoothing() [2/3]

template float smoothing ( smoothing_functions  func_id,
float  x,
float &  dx,
float &  d2x 
)

◆ smoothing() [3/3]

template double smoothing ( smoothing_functions  func_id,
double  x,
double &  dx,
double &  d2x 
)

◆ sortByIndex()

bool qmcplusplus::sortByIndex ( BandInfo  leftB,
BandInfo  rightB 
)

Definition at line 30 of file EinsplineSetBuilderESHDF.fft.cpp.

References BandInfo::BandIndex, qmcplusplus::Units::charge::e, BandInfo::Energy, and BandInfo::TwistIndex.

Referenced by EinsplineSetBuilder::OccupyBands_ESHDF().

31 {
32  if (leftB.BandIndex == rightB.BandIndex)
33  {
34  if ((leftB.Energy < rightB.Energy + 1e-6) && (leftB.Energy > rightB.Energy - 1e-6))
35  return leftB.TwistIndex < rightB.TwistIndex;
36  else
37  return leftB.Energy < rightB.Energy;
38  }
39  else
40  return (leftB.BandIndex < rightB.BandIndex);
41 };

◆ species_set()

qmcplusplus::species_set ( iattribute  ,
ispecies   
)

◆ sphericalHarmonic()

std::complex<T> qmcplusplus::sphericalHarmonic ( const int  l,
const int  m,
const TinyVector< T, 3 > &  r 
)
inline

wrapper for Ylm, which can take any normal position vector as an argument param[in] l angular momentum param[in] m magnetic quantum number param[in] r is a position vector.

This does not have to be normalized and is in the standard ordering [x,y,z]

Definition at line 141 of file Ylm.h.

References qmcplusplus::Units::distance::m, norm(), sqrt(), and Ylm().

Referenced by SOECPComponent::calculateProjector(), SOECPComponent::evaluateOneExactSpinIntegration(), SOECPComponent::evaluateValueAndDerivatives(), and TEST_CASE().

142 {
143  TinyVector<T, 3> unit;
144  T norm = std::sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]);
145  unit[0] = r[2] / norm;
146  unit[1] = r[0] / norm;
147  unit[2] = r[1] / norm;
148  return Ylm(l, m, unit);
149 }
double norm(const zVec &c)
Definition: VectorOps.h:118
std::complex< double > Ylm(int l, int m, const std::vector< double > &sph)
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

◆ sphericalHarmonicGrad()

void qmcplusplus::sphericalHarmonicGrad ( const int  l,
const int  m,
const TinyVector< T, 3 > &  r,
TinyVector< std::complex< T >, 3 > &  grad 
)
inline

get cartesian derivatives of spherical Harmonics.

This takes a arbitrary position vector (x,y,z) and returns (d/dx, d/dy, d/dz)Ylm param[in] l angular momentum param[in] m magnetic quantum number param[in] r position vector. This does not have to be normalized and is in the standard ordering [x,y,z] param[out] grad (d/dx, d/dy, d/dz) of Ylm

Definition at line 158 of file Ylm.h.

References derivYlmSpherical(), qmcplusplus::Units::distance::m, norm(), and sqrt().

Referenced by TEST_CASE().

162 {
163  TinyVector<T, 3> unit;
164  T norm = std::sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]);
165  unit[0] = r[2] / norm;
166  unit[1] = r[0] / norm;
167  unit[2] = r[1] / norm;
168  std::complex<T> dth, dph;
169  derivYlmSpherical(l, m, unit, dth, dph, false);
170 
171  T dth_dx = r[0] * r[2] / (norm * norm * std::sqrt(r[0] * r[0] + r[1] * r[1]));
172  T dph_dx = -r[1] / (r[0] * r[0] + r[1] * r[1]);
173  T dth_dy = r[1] * r[2] / (norm * norm * std::sqrt(r[0] * r[0] + r[1] * r[1]));
174  T dph_dy = r[0] / (r[0] * r[0] + r[1] * r[1]);
175  T dth_dz = -std::sqrt(r[0] * r[0] + r[1] * r[1]) / (norm * norm);
176  T dph_dz = 0;
177 
178  grad[0] = dth * dth_dx + dph * dph_dx;
179  grad[1] = dth * dth_dy + dph * dph_dy;
180  grad[2] = dth * dth_dz + dph * dph_dz;
181 }
double norm(const zVec &c)
Definition: VectorOps.h:118
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
void derivYlmSpherical(const int l, const int m, const TinyVector< T, 3 > &r, std::complex< T > &theta_deriv, std::complex< T > &phi_deriv, const bool conj)
calculate the derivative of a Ylm with respect to theta and phi param[in] l: angular momentum param[i...
Definition: Ylm.h:115

◆ SpinDensityNew()

qmcplusplus::SpinDensityNew ( std::move(sdi ,
species_set   
)

◆ split() [1/2]

std::vector<std::string> qmcplusplus::split ( const std::string &  s)
inline

Definition at line 57 of file string_utils.h.

References qmcplusplus::Units::time::s, and whitespace().

Referenced by SpaceGrid::initialize_rectilinear(), ReferencePoints::put(), ReferencePointsInput::readRefPointsXML(), and TEST_CASE().

58 {
59  std::vector<std::string> tokens;
60  int i = 0;
61  while (i < s.length())
62  {
63  while (i < s.length() && whitespace(s[i]))
64  i++;
65  int start = i;
66  while (i < s.length() && !whitespace(s[i]))
67  i++;
68  int end = i;
69  int len = end - start;
70  if (len > 0)
71  tokens.push_back(s.substr(start, len));
72  }
73  return tokens;
74 }
bool whitespace(char c)
Definition: string_utils.h:54

◆ split() [2/2]

std::vector<std::string> qmcplusplus::split ( const std::string &  s,
const std::string &  pattern 
)
inline

Definition at line 77 of file string_utils.h.

References qmcplusplus::Units::time::s.

78 {
79  int sloc = 0;
80  int eloc;
81  int plen = pattern.length();
82  std::string ss;
83  std::vector<std::string> tokens;
84  //app_log() << "split got string:" << std::endl<<"'"<<s<<"'"<< std::endl;
85  while (true)
86  {
87  eloc = s.find(pattern, sloc);
88  if (eloc != std::string::npos)
89  {
90  ss = s.substr(sloc, eloc - sloc);
91  if (ss != "")
92  {
93  //app_log()<<" adding token: "<< std::endl;
94  //app_log()<<" '"<< ss <<"'" << std::endl;
95  tokens.push_back(ss);
96  }
97  sloc = eloc + plen;
98  }
99  else
100  {
101  eloc = s.length();
102  ss = s.substr(sloc, eloc - sloc);
103  if (ss != "")
104  {
105  //app_log()<<" adding token: "<< std::endl;
106  //app_log()<<" '"<< ss <<"'" << std::endl;
107  tokens.push_back(ss);
108  }
109  break;
110  }
111  }
112  return tokens;
113 }

◆ split_real_components_c2c()

void qmcplusplus::split_real_components_c2c ( const Array< std::complex< T >, 3 > &  in,
Array< T1, 3 > &  out_r,
Array< T1, 3 > &  out_i 
)
inline

Split FFTs into real/imaginary components.

Parameters
inffts
out_rreal component
out_iimaginary components

Definition at line 193 of file einspline_helper.hpp.

References Array< T, D, ALLOC >::data().

Referenced by OneSplineOrbData::fft_spline().

194 {
195  const int nx = in.size(0);
196  const int ny = in.size(1);
197  const int nz = in.size(2);
198 
199 #pragma omp parallel for
200  for (size_t ix = 0; ix < nx; ++ix)
201  for (size_t iy = 0; iy < ny; ++iy)
202  {
203  const size_t offset = ix * ny * nz + iy * nz;
204  const std::complex<T>* restrict in_ptr = in.data() + offset;
205  T1* restrict r_ptr = out_r.data() + offset;
206  T1* restrict i_ptr = out_i.data() + offset;
207  for (size_t iz = 0; iz < nz; ++iz)
208  {
209  r_ptr[iz] = static_cast<T1>(in_ptr[iz].real());
210  i_ptr[iz] = static_cast<T1>(in_ptr[iz].imag());
211  }
212  }
213 }
Type_t * data()
Definition: OhmmsArray.h:87
size_t size() const
Definition: OhmmsArray.h:57

◆ splitPhiEta()

void splitPhiEta ( int  center,
const std::vector< bool > &  corrCenter,
LCAOrbitalSet Phi,
LCAOrbitalSet Eta 
)

Divide molecular orbital into atomic S-orbitals on this center (phi), and everything else (eta).

Definition at line 226 of file CuspCorrectionConstruction.cpp.

References LCAOrbitalSet::C, LCAOrbitalSet::getBasisSetSize(), SPOSet::getOrbitalSetSize(), and LCAOrbitalSet::myBasisSet.

Referenced by applyCuspCorrection(), generateCuspInfo(), and TEST_CASE().

227 {
229 
230  std::vector<bool> is_s_orbital(Phi.myBasisSet->BasisSetSize, false);
231  std::vector<bool> correct_this_center(corrCenter.size(), false);
232  correct_this_center[center] = corrCenter[center];
233 
234  Phi.myBasisSet->queryOrbitalsForSType(correct_this_center, is_s_orbital);
235 
236  int nOrbs = Phi.getOrbitalSetSize();
237  int bss = Phi.getBasisSetSize();
238 
239  for (int i = 0; i < bss; i++)
240  {
241  if (is_s_orbital[i])
242  {
243  auto& cref(*(Eta.C));
244  for (int k = 0; k < nOrbs; k++)
245  cref(k, i) = 0.0; //Eta->C(k,i) = 0.0;
246  }
247  else
248  {
249  auto& cref(*(Phi.C));
250  for (int k = 0; k < nOrbs; k++)
251  cref(k, i) = 0.0; //Phi->C(k,i) = 0.0;
252  }
253  }
254 }
QMCTraits::RealType RealType

◆ sqrt() [1/2]

MakeReturn<UnaryNode<FnSqrt, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::sqrt ( const Vector< T1, C1 > &  l)
inline

Definition at line 136 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by NESpaceGrid< REAL >::accumulate(), QMCCostFunctionBase::addCJParams(), SOVMCUpdateAll::advanceWalker(), SODMCUpdatePbyPWithRejectionFast::advanceWalker(), DMCUpdatePbyPWithRejectionFast::advanceWalker(), VMCUpdatePbyP::advanceWalker(), SOVMCUpdatePbyP::advanceWalker(), DMCUpdatePbyPL2::advanceWalker(), CSVMCUpdatePbyP::advanceWalker(), CSVMCUpdateAll::advanceWalker(), CSVMCUpdateAllWithDrift::advanceWalker(), RMCUpdatePbyPWithDrift::advanceWalkersRMC(), RMCUpdatePbyPWithDrift::advanceWalkersVMC(), SCTFunctor< SCT, 1 >::apply(), SCTFunctor< SCT, 2 >::apply(), DTD_BConds< T, D, SC >::apply_bc(), assignGaussRand(), AtomicOrbitals< ST >::AtomicOrbitals(), QMCFiniteSize::build_spherical_grid(), QMCFiniteSize::calcPotentialCorrection(), LatticeAnalyzer< T, 3 >::calcSimulationCellRadius(), LatticeAnalyzer< T, 2 >::calcSimulationCellRadius(), SpinDensityInput::calculateDerivedParameters(), MagnetizationDensityInput::calculateDerivedParameters(), LatticeAnalyzer< T, 3 >::calcWignerSeitzRadius(), LatticeAnalyzer< T, 2 >::calcWignerSeitzRadius(), cart2sph(), Cartesian2Spherical(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::CartesianTensor(), SpaceGrid::check_grid(), NESpaceGrid< REAL >::check_grid(), QMCUpdateBase::checkLogAndGL(), QMCDriverNew::checkLogAndGL(), Cholesky(), cholesky(), MPC::compute_g_G(), compute_norm(), compute_phase(), ACForce::compute_regularizer_f(), DTD_BConds< T, 3, SUPERCELL_OPEN+SOA_OFFSET >::computeDist(), DTD_BConds< T, 3, PPPO+SOA_OFFSET >::computeDist(), DTD_BConds< T, 3, PPPS+SOA_OFFSET >::computeDist(), DTD_BConds< T, 3, PPPG+SOA_OFFSET >::computeDist(), DTD_BConds< T, 3, PPNG+SOA_OFFSET >::computeDist(), DTD_BConds< T, 3, PPNO+SOA_OFFSET >::computeDist(), DTD_BConds< T, 3, PPNS+SOA_OFFSET >::computeDist(), DTD_BConds< T, 3, SUPERCELL_WIRE+SOA_OFFSET >::computeDist(), DTD_BConds< T, 3, SUPERCELL_OPEN+SOA_OFFSET >::computeDistances(), DTD_BConds< T, 3, PPPO+SOA_OFFSET >::computeDistances(), DTD_BConds< T, 3, PPPS+SOA_OFFSET >::computeDistances(), DTD_BConds< T, 3, PPPG+SOA_OFFSET >::computeDistances(), DTD_BConds< T, 3, PPNG+SOA_OFFSET >::computeDistances(), DTD_BConds< T, 3, PPNO+SOA_OFFSET >::computeDistances(), DTD_BConds< T, 3, PPNS+SOA_OFFSET >::computeDistances(), DTD_BConds< T, 3, SUPERCELL_WIRE+SOA_OFFSET >::computeDistances(), DTD_BConds< T, 3, SUPERCELL_OPEN+SOA_OFFSET >::computeDistancesOffload(), DTD_BConds< T, 3, PPPO+SOA_OFFSET >::computeDistancesOffload(), DTD_BConds< T, 3, PPPS+SOA_OFFSET >::computeDistancesOffload(), DTD_BConds< T, 3, PPPG+SOA_OFFSET >::computeDistancesOffload(), DTD_BConds< T, 3, PPNG+SOA_OFFSET >::computeDistancesOffload(), DTD_BConds< T, 3, PPNO+SOA_OFFSET >::computeDistancesOffload(), DTD_BConds< T, 3, PPNS+SOA_OFFSET >::computeDistancesOffload(), DTD_BConds< T, 3, SUPERCELL_WIRE+SOA_OFFSET >::computeDistancesOffload(), DescentEngine::computeFinalizationUncertainties(), RadialJastrowBuilder::computeJ2uk(), CountingJastrowBuilder::createCJ(), SHOSetBuilder::createSPOSet(), CubicFormula(), derivYlmSpherical(), DiracParser::DiracParser(), RPABFeeBreakup< T >::Dlindhard(), RPABFeeBreakup< T >::Dlindhardp(), dratioTWF(), Eig(), SpaceGrid::evaluate(), SphericalTensor< T, Point_t, Tensor_t, GGG_t >::evaluate(), SoaSphericalTensor< ST >::evaluate_bare(), SHOSet::evaluate_check(), SphericalTensor< T, Point_t, Tensor_t, GGG_t >::evaluateAll(), ExampleHeComponent::evaluateLog(), EwaldHandler2D::evaluateLR_r0(), EwaldHandlerQuasi2D::evaluateLR_r0(), EwaldHandler3D::evaluateLR_r0(), NonLocalECPComponent::evaluateOneBodyOpMatrixdRContribution(), NonLocalECPComponent::evaluateOneWithForces(), BackflowTransformation::evaluatePbyP(), BackflowTransformation::evaluatePbyPAll(), BackflowTransformation::evaluatePbyPWithGrad(), EwaldHandler2D::evaluateSR_k0(), SphericalTensor< T, Point_t, Tensor_t, GGG_t >::evaluateTest(), SoaAtomicBasisSet< ROT, SH >::evaluateV(), SoaAtomicBasisSet< ROT, SH >::evaluateVGH(), SoaAtomicBasisSet< ROT, SH >::evaluateVGHGH(), SoaAtomicBasisSet< ROT, SH >::evaluateVGL(), SoaSphericalTensor< ST >::evaluateVGL_impl(), SphericalTensor< T, Point_t, Tensor_t, GGG_t >::evaluateWithHessian(), EwaldHandler2D::EwaldHandler2D(), EwaldHandlerQuasi2D::EwaldHandlerQuasi2D(), qmcplusplus::ewaldref::ewaldSum(), EwaldHandler3D::filldFk_dk(), LRHandlerSRCoulomb< Func, BreakupBasis >::filldFk_dk(), EwaldHandler2D::fillFk(), EwaldHandlerQuasi2D::fillFk(), SkPot::FillFk(), LRHandlerTemp< Func, BreakupBasis >::fillFk(), LRHandlerSRCoulomb< Func, BreakupBasis >::fillYk(), LRHandlerSRCoulomb< Func, BreakupBasis >::fillYkg(), EwaldHandler3D::fillYkgstrain(), LRHandlerSRCoulomb< Func, BreakupBasis >::fillYkgstrain(), KContainer::findApproxMMax(), fix_phase_rotate_c2r(), found_shorter_base(), GaussianCombo< T >::GaussianCombo(), DensityMatrices1B::generate_density_samples(), DensityMatrices1B::generate_samples(), OneBodyDensityMatrices::generateDensitySamples(), OneBodyDensityMatrices::generateDensitySamplesWithSpin(), generateRotationMatrix(), OneBodyDensityMatrices::generateSamples(), DriftModifierUNR::getDrift(), getDriftScale(), qmcplusplus::ewaldref::getKappaEwald(), qmcplusplus::ewaldref::getKappaMadelung(), LinearMethod::getNonLinearRescale(), getScaledDrift(), getScaledDriftL2(), getStats(), Gvectors< ST, LT >::Gvectors(), MPC::init_f_G(), InitMolecularSystem::initAtom(), EwaldHandler3D::initBreakup(), SHOSet::initialize(), DensityMatrices1B::initialize(), J2KECorrection< RealType, FT >::J2KECorrection(), LegendrePll(), lMatrixElement(), SOECPComponent::lmMatrixElements(), EwaldHandler3D::lrDf(), qmcplusplus::ewaldref::madelungSum(), BackflowBuilder::makeLongRange_twoBody(), makeSphereRandom(), MomentumDistribution::MomentumDistribution(), DescentEngine::mpi_unbiased_ratio_of_means(), SoaAtomicBasisSet< ROT, SH >::mw_evaluateV(), SoaAtomicBasisSet< ROT, SH >::mw_evaluateVGL(), normalize(), DensityMatrices1B::normalize(), OneBodyDensityMatrices::normalizeBasis(), QMCFixedSampleLinearOptimizeBatched::one_shift_run(), OneBodyDensityMatrices::OneBodyDensityMatrices(), RspaceMadelungTerm::operator()(), STONorm< T >::operator()(), RPA0< T >::operator()(), RspaceEwaldTerm::operator()(), FnSqrt::operator()(), QMCCostFunctionBase::printCJParams(), WaveFunctionTester::printEloc(), QMCFiniteSize::printSkRawSphAvg(), GridExternalPotential::put(), StaticStructureFactor::put(), SpinDensity::put(), HarmonicExternalPotential::put(), MomentumEstimator::putSpecial(), Quadrature3D< T >::Quadrature3D(), ParticleSet::randomizeFromSource(), EshdfFile::readInEigFcn(), YukawaBreakup< T >::reset(), DerivYukawaBreakup< T >::reset(), CrystalLattice< ST, 3 >::reset(), QMCUpdateBase::resetRun(), WaveFunctionTester::runBasicTest(), DescentEngine::sample_finish(), SFNBranch::setBranchCutoff(), SimpleFixedNodeBranch::setBranchCutoff(), LRBreakupParameters< T, 3 >::SetLRCutoffs(), setScaledDriftPbyPandNodeCorr(), QMCUpdateBase::setTau(), kSpaceJastrow::setupGvecs(), LRBreakup< BreakupBasis >::SetupKVecs(), SimCellRad(), SkAllEstimator::SkAllEstimator(), SkEstimator::SkEstimator(), SkPot::SkPot(), EwaldHandlerQuasi2D::slab_vsr_k0(), SoaCartesianTensor< T >::SoaCartesianTensor(), SoaSphericalTensor< ST >::SoaSphericalTensor(), sphericalHarmonic(), sphericalHarmonicGrad(), SphericalTensor< T, Point_t, Tensor_t, GGG_t >::SphericalTensor(), EwaldHandler3D::srDf(), TauParams< RT, CoordsType::POS >::TauParams(), TauParams< RT, CoordsType::POS_SPIN >::TauParams(), TEST_CASE(), test_isnan(), TWF(), SHOSetBuilder::update_basis_states(), DescentEngine::updateParameters(), RPABFeeBreakup< T >::urpa(), DensityMatrices1B::warmup_sampling(), OneBodyDensityMatrices::warmupSampling(), WigSeitzRad(), RPABFeeBreakup< T >::Xk(), Ylm(), and Ylm().

138 {
139  using Tree_t = UnaryNode<FnSqrt, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
140  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
141 }

◆ sqrt() [2/2]

MakeReturn<UnaryNode<FnSqrt, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::sqrt ( const Expression< T1 > &  l)
inline

Definition at line 1483 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1485 {
1486  using Tree_t = UnaryNode<FnSqrt, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1487  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1488 }

◆ string2bool()

bool qmcplusplus::string2bool ( const std::string &  s)
inline

Definition at line 133 of file string_utils.h.

References qmcplusplus::Units::time::s.

134 {
135  if (s == "true" || s == "yes" || s == "1")
136  {
137  return true;
138  }
139  else if (s == "false" || s == "no" || s == "0")
140  {
141  return false;
142  }
143  else
144  {
145  throw std::runtime_error("string2bool received non-boolean string: " + s);
146  return false;
147  }
148 }

◆ string2Int()

T qmcplusplus::string2Int ( const std::string_view  svalue)
inline

alternate to string2real calls c++ string to real conversion based on T's precision template<typename T>

Definition at line 74 of file ModernStringUtils.hpp.

75 {
76  static_assert(std::is_integral_v<T>);
77  // full support for floating point from char not present until stdlibc++ aligned with gcc11
78  // there is still not from_char for floats as of libc++ 15
79  T result{};
80 #if _GLIBCXX_RELEASE > 10
81  auto [prt, ec] = std::from_chars(svalue.data(), svalue.data() + svalue.size(), result);
82  // std::errc() represents success or a value of 0 with respect to errc's error enumeration.
83  if (ec != std::errc())
84  {
85  if (ec == std::errc::result_out_of_range)
86  throw std::range_error("Value out of range for integral type parameter of string2Int");
87  else
88  {
89  std::ostringstream msg;
90  msg << "Could not convert from string " << std::string(svalue) << " to int!";
91  throw std::runtime_error(msg.str());
92  }
93  }
94 #else
95  // atof must be given a null terminated string, string_view is not guaranteed to have a null terminator.
96  std::string str_value(svalue);
97  if constexpr (std::is_same_v<T, int>)
98  result = atoi(str_value.c_str());
99  else if constexpr (std::is_same_v<T, long>)
100  result = atol(str_value.c_str());
101  else if constexpr (std::is_same_v<T, long long>)
102  result = atol(str_value.c_str());
103  else
104  throw std::runtime_error("unsupported type for string to integral type conversion with pre v.10 stdlibc++!");
105 #endif
106  return result;
107 }

◆ string2int()

int qmcplusplus::string2int ( const std::string &  s)
inline

Definition at line 115 of file string_utils.h.

References qmcplusplus::Units::time::s.

Referenced by SpaceGrid::initialize_rectilinear().

115 { return atoi(s.c_str()); }

◆ string2Real()

T qmcplusplus::string2Real ( const std::string_view  svalue)
inline

alternate to string2real calls c++ string to real conversion based on T's precision template<typename T>

Definition at line 52 of file ModernStringUtils.hpp.

53 {
54  static_assert(std::is_floating_point_v<T>);
55  T result;
56 // full support for floating point from char not present until stdlibc++ aligned with gcc11
57 // there is still not from_char for floats as of libc++ 15
58 #if _GLIBCXX_RELEASE > 10
59  auto [prt, ec] = std::from_chars(svalue.data(), svalue.data() + svalue.size(), result, std::chars_format::general);
60  if (ec != std::errc())
61  throw std::runtime_error("Could not convert from string to real value");
62 #else
63  // atof must be given a null terminated string, string_view is not guaranteed to have a null terminator.
64  std::string str_value(svalue);
65  result = static_cast<T>(atof(str_value.c_str()));
66 #endif
67  return result;
68 }

◆ string2real()

double qmcplusplus::string2real ( const std::string &  s)
inline

Definition at line 117 of file string_utils.h.

References qmcplusplus::Units::time::s.

Referenced by SpaceGrid::initialize_rectilinear(), and ReferencePoints::put().

117 { return atof(s.c_str()); }

◆ strip()

std::string qmcplusplus::strip ( const std::string &  s)
inline

Definition at line 26 of file string_utils.h.

References qmcplusplus::Units::time::s.

Referenced by ReferencePoints::put(), ReferencePointsInput::readRefPointsXML(), and TEST_CASE().

27 {
28  int start = s.length();
29  int end = 0;
30  int i;
31  for (i = 0; i < s.length(); i++)
32  {
33  if (s[i] != ' ' && s[i] != '\n' && s[i] != '\t')
34  {
35  start = i;
36  break;
37  }
38  }
39  for (i = s.length() - 1; i > 0; i--)
40  {
41  if (s[i] != ' ' && s[i] != '\n' && s[i] != '\t')
42  {
43  end = i;
44  break;
45  }
46  }
47  //app_log()<<"strip got '"<<s<<"'"<< std::endl;
48  //app_log()<<"start,end "<<start<<","<<end<<" "<<s[start]<<" "<<s[end]<< std::endl;
49  //app_log()<<"returning '"<<s.substr(start,end-start+1)<<"'"<< std::endl;
50  return s.substr(start, end - start + 1);
51 }

◆ Sum() [1/2]

◆ Sum() [2/2]

T qmcplusplus::Sum ( const ParticleAttrib< std::complex< T >> &  pa)
inline

Definition at line 181 of file ParticleAttribOps.h.

182 {
183  T sum = 0;
184  for (int i = 0; i < pa.size(); i++)
185  {
186  sum += pa[i].real();
187  }
188  return sum;
189 }

◆ SYCLallocator_device_mem_allocated()

std::atomic<size_t> qmcplusplus::SYCLallocator_device_mem_allocated ( )

◆ SymTrace()

T qmcplusplus::SymTrace ( h00,
h01,
h02,
h11,
h12,
h22,
const T  gg[6] 
)
inline

compute Trace(H*G)

gg is symmetrized as gg[0]=GG(0,0) gg[1]=GG(0,1)+GG(1,0) gg[2]=GG(0,2)+GG(2,0) gg[3]=GG(1,1) gg[4]=GG(1,2)+GG(2,1) gg[5]=GG(2,2)

Definition at line 45 of file contraction_helper.hpp.

Referenced by SplineC2R< ST >::assign_vgl(), SplineR2R< ST >::assign_vgl(), SplineC2C< ST >::assign_vgl(), SplineC2COMPTarget< ST >::evaluateVGL(), SplineC2ROMPTarget< ST >::evaluateVGL(), SplineC2COMPTarget< ST >::evaluateVGLMultiPos(), SplineC2ROMPTarget< ST >::evaluateVGLMultiPos(), SplineC2COMPTarget< ST >::mw_evaluateVGLandDetRatioGrads(), and SplineC2ROMPTarget< ST >::mw_evaluateVGLandDetRatioGrads().

46 {
47  return h00 * gg[0] + h01 * gg[1] + h02 * gg[2] + h11 * gg[3] + h12 * gg[4] + h22 * gg[5];
48 }

◆ t3_contract()

T qmcplusplus::t3_contract ( h000,
h001,
h002,
h011,
h012,
h022,
h111,
h112,
h122,
h222,
g1x,
g1y,
g1z,
g2x,
g2y,
g2z,
g3x,
g3y,
g3z 
)

Coordinate transform for a 3rd rank symmetric tensor representing coordinate derivatives (hence t3_contract, for contraction with vectors).

hijk are the symmetry inequivalent tensor elements, i,j,k range from 0 to 2 for x to z. (gix,giy,giz) are vectors, labelled 1, 2 and 3. g1 is contracted with the first tensor index, g2 with the second, g3 with the third.

This would be easier with a for loop, but I'm sticking with the convention in this section.

Definition at line 69 of file contraction_helper.hpp.

Referenced by SplineC2R< ST >::assign_vghgh(), SplineR2R< ST >::assign_vghgh(), SplineC2C< ST >::assign_vghgh(), SplineC2COMPTarget< ST >::assign_vghgh(), and SplineC2ROMPTarget< ST >::assign_vghgh().

88 {
89  return h000 * (g1x * g2x * g3x) + h001 * (g1x * g2x * g3y + g1x * g2y * g3x + g1y * g2x * g3x) +
90  h002 * (g1x * g2x * g3z + g1x * g2z * g3x + g1z * g2x * g3x) +
91  h011 * (g1x * g2y * g3y + g1y * g2x * g3y + g1y * g2y * g3x) +
92  h012 *
93  (g1x * g2y * g3z + g1x * g2z * g3y + g1y * g2x * g3z + g1y * g2z * g3x + g1z * g2x * g3y + g1z * g2y * g3x) +
94  h022 * (g1x * g2z * g3z + g1z * g2x * g3z + g1z * g2z * g3x) + h111 * (g1y * g2y * g3y) +
95  h112 * (g1y * g2y * g3z + g1y * g2z * g3y + g1z * g2y * g3y) +
96  h122 * (g1y * g2z * g3z + g1z * g2y * g3z + g1z * g2z * g3y) + h222 * (g1z * g2z * g3z);
97 }

◆ tan() [1/2]

MakeReturn<UnaryNode<FnTan, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::tan ( const Vector< T1, C1 > &  l)
inline

Definition at line 144 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by derivYlmSpherical(), and FnTan::operator()().

146 {
147  using Tree_t = UnaryNode<FnTan, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
148  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
149 }

◆ tan() [2/2]

MakeReturn<UnaryNode<FnTan, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::tan ( const Expression< T1 > &  l)
inline

Definition at line 1491 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1493 {
1494  using Tree_t = UnaryNode<FnTan, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1495  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1496 }

◆ tanh() [1/2]

MakeReturn<UnaryNode<FnHypTan, typename CreateLeaf<Vector<T1, C1> >::Leaf_t> >::Expression_t qmcplusplus::tanh ( const Vector< T1, C1 > &  l)
inline

Definition at line 152 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

Referenced by FnHypTan::operator()(), and smoothing().

154 {
155  using Tree_t = UnaryNode<FnHypTan, typename CreateLeaf<Vector<T1, C1>>::Leaf_t>;
156  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Vector<T1, C1>>::make(l)));
157 }

◆ tanh() [2/2]

MakeReturn<UnaryNode<FnHypTan, typename CreateLeaf<Expression<T1> >::Leaf_t> >::Expression_t qmcplusplus::tanh ( const Expression< T1 > &  l)
inline

Definition at line 1499 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1501 {
1502  using Tree_t = UnaryNode<FnHypTan, typename CreateLeaf<Expression<T1>>::Leaf_t>;
1503  return MakeReturn<Tree_t>::make(Tree_t(CreateLeaf<Expression<T1>>::make(l)));
1504 }

◆ TEMPLATE_TEST_CASE() [1/7]

qmcplusplus::TEMPLATE_TEST_CASE ( "RandomRotationMatrix"  ,
""  [numerics],
float  ,
double   
)

Definition at line 20 of file test_RotationMatrix3D.cpp.

References CHECK(), and qmcplusplus::Units::charge::e.

21 {
22  // TestType is defined by Catch
23  using TensorType = Tensor<TestType, 3>;
24 
25  TensorType rmat = generateRotationMatrix<TestType>(0.0, 0.0, 0.0);
26 
27  // Default rotation matrix should be the identity
28  for (int i = 0; i < 3; i++)
29  for (int j = 0; j < 3; j++)
30  if (i == j)
31  CHECK(rmat(i, j) == Approx(1.0));
32  else
33  CHECK(rmat(i, j) == Approx(0.0));
34 
35 
36  TensorType rmat2 = generateRotationMatrix<TestType>(0.1, 0.2, 0.3);
37 
38  CHECK(rmat2(0, 0) == Approx(-0.459016994374947));
39  CHECK(rmat2(0, 1) == Approx(0.842075137094350));
40  CHECK(rmat2(0, 2) == Approx(-0.283218753550188));
41  CHECK(rmat2(1, 0) == Approx(-0.489403985718866));
42  CHECK(rmat2(1, 1) == Approx(0.0263932022500210));
43  CHECK(rmat2(1, 2) == Approx(0.871657695220709));
44  CHECK(rmat2(2, 0) == Approx(0.741476323045772));
45  CHECK(rmat2(2, 1) == Approx(0.538714082201795));
46  CHECK(rmat2(2, 2) == Approx(0.400000000000000));
47 
48 
49  TensorType rmat3 = generateRotationMatrix<TestType>(0.9, 0.5, 0.8);
50 
51  CHECK(rmat3(0, 0) == Approx(0.485410196624969));
52  CHECK(rmat3(0, 1) == Approx(-0.352671151375484));
53  CHECK(rmat3(0, 2) == Approx(0.800000000000000));
54  CHECK(rmat3(1, 0) == Approx(-0.587785252292473));
55  CHECK(rmat3(1, 1) == Approx(-0.809016994374947));
56  CHECK(rmat3(1, 2) == Approx(9.79717439317882e-17));
57  CHECK(rmat3(2, 0) == Approx(0.647213595499958));
58  CHECK(rmat3(2, 1) == Approx(-0.470228201833979));
59  CHECK(rmat3(2, 2) == Approx(-0.600000000000000));
60 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEMPLATE_TEST_CASE() [2/7]

qmcplusplus::TEMPLATE_TEST_CASE ( "cuSolverInverter"  ,
""  [wavefunction][fermion],
double  ,
float   
)

Definition at line 27 of file test_cuSolverInverter.cpp.

References CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), Matrix< T, Alloc >::cols(), Matrix< T, Alloc >::data(), fillIdentityMatrix(), TestMatrix1::fillInput(), TestMatrix1::fillInverse(), cuSolverInverter< T_FP >::invert_transpose(), TestMatrix1::logDet(), qmcplusplus::Units::distance::m, qmcplusplus::Units::force::N, Matrix< T, Alloc >::resize(), Matrix< T, Alloc >::rows(), and qmcplusplus::simd::transpose().

28 {
29  // TestType is defined by Catch. It is the type in each instantiation of the templated test case.
30 #ifdef QMC_COMPLEX
31  using FullPrecValue = std::complex<double>;
32  using Value = std::complex<TestType>;
33 #else
34  using FullPrecValue = double;
35  using Value = TestType;
36 #endif
37  cuSolverInverter<FullPrecValue> solver;
38  const int N = 3;
39 
40  Matrix<Value> m(N, N);
41  Matrix<Value> m_invT(N, N);
42  Matrix<Value, CUDAAllocator<Value>> m_invGPU(N, N);
43  LogValue log_value;
44 
45  SECTION("identity")
46  {
48 
49  solver.invert_transpose(m, m_invT, m_invGPU, log_value);
50  CHECK(log_value == LogComplexApprox(0.0));
51 
52  Matrix<Value> eye;
53  eye.resize(3, 3);
54  fillIdentityMatrix(eye);
55 
56  CheckMatrixResult check_matrix_result = checkMatrix(m_invT, eye);
57  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
58  }
59 
60  SECTION("3x3 matrix")
61  {
62  Matrix<Value> a(N, N);
63  Matrix<Value> a_T(N, N);
64  TestMatrix1::fillInput(a);
65 
66  simd::transpose(a.data(), a.rows(), a.cols(), a_T.data(), a_T.rows(), a_T.cols());
67  solver.invert_transpose(a_T, m_invT, m_invGPU, log_value);
68  CHECK(log_value == LogComplexApprox(TestMatrix1::logDet()));
69 
70  Matrix<Value> b(3, 3);
71 
72  TestMatrix1::fillInverse(b);
73 
74  auto check_matrix_result = checkMatrix(m_invT, b);
75  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
76  }
77 }
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
Catch::Detail::LogComplexApprox LogComplexApprox
AntiSymTensor< T, D > transpose(const AntiSymTensor< T, D > &rhs)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void fillIdentityMatrix(Matrix< T > &m)
std::complex< double > LogValue

◆ TEMPLATE_TEST_CASE() [3/7]

qmcplusplus::TEMPLATE_TEST_CASE ( "rocSolverInverter"  ,
""  [wavefunction][fermion],
double  ,
float   
)

Definition at line 27 of file test_rocSolverInverter.cpp.

References CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), Matrix< T, Alloc >::cols(), Matrix< T, Alloc >::data(), fillIdentityMatrix(), TestMatrix1::fillInput(), TestMatrix1::fillInverse(), rocSolverInverter< T_FP >::invert_transpose(), TestMatrix1::logDet(), qmcplusplus::Units::distance::m, qmcplusplus::Units::force::N, Matrix< T, Alloc >::resize(), Matrix< T, Alloc >::rows(), and qmcplusplus::simd::transpose().

28 {
29  // TestType is defined by Catch. It is the type in each instantiation of the templated test case.
30 #ifdef QMC_COMPLEX
31  using FullPrecValue = std::complex<double>;
32  using Value = std::complex<TestType>;
33 #else
34  using FullPrecValue = double;
35  using Value = TestType;
36 #endif
37  rocSolverInverter<FullPrecValue> solver;
38  const int N = 3;
39 
40  Matrix<Value> m(N, N);
41  Matrix<Value> m_invT(N, N);
42  Matrix<Value, CUDAAllocator<Value>> m_invGPU(N, N);
43  LogValue log_value;
44 
45  SECTION("identity")
46  {
48 
49  solver.invert_transpose(m, m_invT, m_invGPU, log_value);
50  CHECK(log_value == LogComplexApprox(0.0));
51 
52  Matrix<Value> eye;
53  eye.resize(3, 3);
54  fillIdentityMatrix(eye);
55 
56  CheckMatrixResult check_matrix_result = checkMatrix(m_invT, eye);
57  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
58  }
59 
60  SECTION("3x3 matrix")
61  {
62  Matrix<Value> a(N, N);
63  Matrix<Value> a_T(N, N);
64  TestMatrix1::fillInput(a);
65 
66  simd::transpose(a.data(), a.rows(), a.cols(), a_T.data(), a_T.rows(), a_T.cols());
67  solver.invert_transpose(a_T, m_invT, m_invGPU, log_value);
68  CHECK(log_value == LogComplexApprox(TestMatrix1::logDet()));
69 
70  Matrix<Value> b(3, 3);
71 
72  TestMatrix1::fillInverse(b);
73 
74  auto check_matrix_result = checkMatrix(m_invT, b);
75  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
76  }
77 }
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
Catch::Detail::LogComplexApprox LogComplexApprox
AntiSymTensor< T, D > transpose(const AntiSymTensor< T, D > &rhs)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void fillIdentityMatrix(Matrix< T > &m)
std::complex< double > LogValue

◆ TEMPLATE_TEST_CASE() [4/7]

qmcplusplus::TEMPLATE_TEST_CASE ( "ParseGridInput::Good"  ,
""  [estimators],
float  ,
double   
)

Definition at line 44 of file test_ParseGridInput.cpp.

References CHECK(), and qmcplusplus::Units::time::s.

45 {
46  using Real = TestType;
47  using namespace std::string_literals;
48 
49  std::istringstream grid_input_1("0 (0.1) 1"s);
50  AxisGrid<Real> axis_grid_1 = parseGridInput<Real>(grid_input_1);
51  AxisGrid<Real> expected_1{{
52  10,
53  }, //ndom_int
54  {
55  1,
56  }, //ndu_int
57  {
58  0.1,
59  }, //du_int
60  0, //umin
61  1, //umax
62  10, //odu
63  {
64  0,
65  1,
66  2,
67  3,
68  4,
69  5,
70  6,
71  7,
72  8,
73  9,
74  }, //gmap
75  {
76  1,
77  1,
78  1,
79  1,
80  1,
81  1,
82  1,
83  1,
84  1,
85  1,
86  }, //ndu_per_interval
87  10}; //dimensions
88 
89  CHECK(axis_grid_1 == expected_1);
90 
91  std::istringstream grid_input_2("0.1 (10) 0.2 (20) 0.4 (10) 0.8"s);
92  AxisGrid<Real> axis_grid_2 = parseGridInput<Real>(grid_input_2);
93  AxisGrid<Real> expected_2{{
94  10,
95  20,
96  10,
97  }, //ndom_int
98  {
99  1,
100  1,
101  4,
102  }, //ndu_int
103  {
104  0.01,
105  0.01,
106  0.04,
107  }, //du_int
108  0.1, //umin
109  0.8, //umax
110  100, //odu
111  {
112  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
113  18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30, 30, 30, 31, 31,
114  31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, 35,
115  36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 39,
116  }, //gmap
117  {
118  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
119  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
120  }, //ndu_per_interval
121  40}; //dimensions
122 
123  CHECK(axis_grid_2 == expected_2);
124 }
ForceBase::Real Real
Definition: ForceBase.cpp:26
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEMPLATE_TEST_CASE() [5/7]

qmcplusplus::TEMPLATE_TEST_CASE ( "syclSolverInverter"  ,
""  [wavefunction][fermion],
double  ,
float   
)

Definition at line 52 of file test_syclSolverInverter.cpp.

53 {
54  // TestType is defined by Catch. It is the type in each instantiation of the templated test case.
55 #ifdef QMC_COMPLEX
56  using FullPrecValue = std::complex<double>;
57  using Value = std::complex<TestType>;
58 #else
59  using FullPrecValue = double;
60  using Value = TestType;
61 #endif
62 
63  SECTION("N=117") { test_inverse<Value, FullPrecValue>(117); }
64 
65  SECTION("N=911") { test_inverse<Value, FullPrecValue>(911); }
66 }

◆ TEMPLATE_TEST_CASE() [6/7]

qmcplusplus::TEMPLATE_TEST_CASE ( "ParseGridInput::Bad"  ,
""  [estimators],
float  ,
double   
)

Definition at line 126 of file test_ParseGridInput.cpp.

References qmcplusplus::Units::time::s.

127 {
128  using Real = TestType;
129  using namespace std::string_literals;
130 
131  std::istringstream grid_input_1("1.1 (0.1) 1.5"s);
132  CHECK_THROWS_AS(parseGridInput<Real>(grid_input_1), UniformCommunicateError);
133 
134  std::istringstream grid_input_2("0.8 (0.1) 0.5"s);
135  CHECK_THROWS_AS(parseGridInput<Real>(grid_input_2), UniformCommunicateError);
136 
137  std::istringstream grid_input_3("0.8 (0.1) 1.5"s);
138  CHECK_THROWS_AS(parseGridInput<Real>(grid_input_3), UniformCommunicateError);
139 
140  std::istringstream grid_input_4("0.1 (0.3) 0.2"s);
141  CHECK_THROWS_AS(parseGridInput<Real>(grid_input_4), UniformCommunicateError);
142 
143  std::istringstream grid_input_5("0.1 (10) 0.2 (20) 0.35 (10) 0.73"s);
144  CHECK_THROWS_AS(parseGridInput<Real>(grid_input_5), UniformCommunicateError);
145 }
ForceBase::Real Real
Definition: ForceBase.cpp:26

◆ TEMPLATE_TEST_CASE() [7/7]

qmcplusplus::TEMPLATE_TEST_CASE ( "ParseGridInput_constructors"  ,
""  [estimators],
float  ,
double   
)

Definition at line 147 of file test_ParseGridInput.cpp.

References CHECK().

148 {
149  using Real = TestType;
150  AxisGrid<Real> start_grid{{
151  10,
152  }, //ndom_int
153  {
154  1,
155  }, //ndu_int
156  {
157  0.1,
158  }, //du_int
159  0, //umin
160  1, //umax
161  10, //odu
162  {
163  0,
164  1,
165  2,
166  3,
167  4,
168  5,
169  6,
170  7,
171  8,
172  9,
173  }, //gmap
174  {
175  1,
176  1,
177  1,
178  1,
179  1,
180  1,
181  1,
182  1,
183  1,
184  1,
185  }, //ndu_per_interval
186  10}; //dimensions
187  AxisGrid<Real> copied_grid(start_grid);
188  AxisGrid<Real> assigned_grid(start_grid);
189 
190  CHECK(start_grid == copied_grid);
191  CHECK(start_grid == assigned_grid);
192 }
ForceBase::Real Real
Definition: ForceBase.cpp:26
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ test_C_diamond()

void qmcplusplus::test_C_diamond ( )

Definition at line 32 of file test_pyscf_complex_MO.cpp.

References CHECK(), OHMMS::Controller, SPOSetBuilderFactory::createSPOSetBuilder(), doc, qmcplusplus::Units::charge::e, Libxml2Document::getRoot(), Libxml2Document::getXPathContext(), imag(), lattice, okay, Libxml2Document::parse(), XMLParticleParser::readXML(), and REQUIRE().

Referenced by TEST_CASE().

33 {
34  std::ostringstream section_name;
35  section_name << "Carbon diamond off gamma unit test: ";
36 
37  SECTION(section_name.str())
38  {
40 
42  bool okay = doc.parse("C_diamond-twist-third.structure.xml");
43  REQUIRE(okay);
44  xmlNodePtr root = doc.getRoot();
45 
46  ParticleSet::ParticleLayout lattice;
47  // BCC H
48  lattice.R = {3.37316115, 3.37316115, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
49  lattice.reset();
50 
51  const SimulationCell simulation_cell(lattice);
52  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
53  auto& ions(*ions_ptr);
54  XMLParticleParser parse_ions(ions);
55  OhmmsXPathObject particleset_ion("//particleset[@name='ion0']", doc.getXPathContext());
56  REQUIRE(particleset_ion.size() == 1);
57  parse_ions.readXML(particleset_ion[0]);
58 
59  REQUIRE(ions.groups() == 1);
60  REQUIRE(ions.R.size() == 2);
61  ions.update();
62 
63  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
64  auto& elec(*elec_ptr);
65  XMLParticleParser parse_elec(elec);
66  OhmmsXPathObject particleset_elec("//particleset[@name='e']", doc.getXPathContext());
67  REQUIRE(particleset_elec.size() == 1);
68  parse_elec.readXML(particleset_elec[0]);
69 
70  REQUIRE(elec.groups() == 2);
71  REQUIRE(elec.R.size() == 8);
72 
73  elec.R = 0.0;
74 
75  elec.addTable(ions);
76  elec.update();
77 
78  Libxml2Document doc2;
79 
80  okay = doc2.parse("C_diamond-twist-third.wfj.xml");
81  REQUIRE(okay);
82  xmlNodePtr root2 = doc2.getRoot();
83 
84  WaveFunctionComponentBuilder::PSetMap particle_set_map;
85  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
86  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
87 
88  SPOSetBuilderFactory bf(c, elec, particle_set_map);
89 
90  OhmmsXPathObject MO_base("//determinantset", doc2.getXPathContext());
91  REQUIRE(MO_base.size() == 1);
92 
93  const auto sposet_builder_ptr = bf.createSPOSetBuilder(MO_base[0]);
94  auto& bb = *sposet_builder_ptr;
95 
96  OhmmsXPathObject slater_base("//sposet", doc2.getXPathContext());
97  auto sposet = bb.createSPOSet(slater_base[0]);
98 
99  SPOSet::ValueVector values;
100  values.resize(26);
101 
102  // BEGIN generated C++ input from Carbon1x1x1-tw1_gen_mos.py (pyscf version 1.6.2) on 2019-11-19 15:08:42.652893
103 
104  //Move electron 0 to position [[-10. -10. -10.]] a.u.:
105  elec.R[0] = {-10.0, -10.0, -10.0};
106  elec.update();
107  sposet->evaluateValue(elec, 0, values);
108 
109  // Position [[-10. -10. -10.]] a.u.
110  // Verifying values of SPO 0
111  CHECK(std::real(values[0]) == Approx(-0.060195105580765275));
112  CHECK(std::imag(values[0]) == Approx(-0.011833831357235357));
113 
114  // Verifying values of SPO 1
115  CHECK(std::real(values[1]) == Approx(0.0486805973426202));
116  CHECK(std::imag(values[1]) == Approx(0.02535990721099494));
117 
118  // Verifying values of SPO 2
119  CHECK(std::real(values[2]) == Approx(2.0679269928380872e-13));
120  CHECK(std::imag(values[2]) == Approx(-7.649005669303763e-14));
121 
122  // Verifying values of SPO 3
123  CHECK(std::real(values[3]) == Approx(-8.497271896529268e-13));
124  CHECK(std::imag(values[3]) == Approx(1.7299795493710973e-13));
125 
126  // Verifying values of SPO 4
127  CHECK(std::real(values[4]) == Approx(0.014722495006984714));
128  CHECK(std::imag(values[4]) == Approx(-0.07164030105855403));
129 
130  // Verifying values of SPO 5
131  CHECK(std::real(values[5]) == Approx(2.5059967122265113e-13));
132  CHECK(std::imag(values[5]) == Approx(2.6819557859270038e-12));
133 
134  // Verifying values of SPO 6
135  CHECK(std::real(values[6]) == Approx(-1.4149372320505777e-13));
136  CHECK(std::imag(values[6]) == Approx(-6.166027974666144e-13));
137 
138  // Verifying values of SPO 7
139  CHECK(std::real(values[7]) == Approx(0.1625931972310664));
140  CHECK(std::imag(values[7]) == Approx(-0.06588438085509145));
141 
142  // Verifying values of SPO 8
143  CHECK(std::real(values[8]) == Approx(0.14211538487895298));
144  CHECK(std::imag(values[8]) == Approx(-0.10262731977374147));
145 
146  // Verifying values of SPO 9
147  CHECK(std::real(values[9]) == Approx(6.853515151228338e-13));
148  CHECK(std::imag(values[9]) == Approx(-6.336955699765e-13));
149 
150  // Verifying values of SPO 10
151  CHECK(std::real(values[10]) == Approx(-2.242625356252415e-12));
152  CHECK(std::imag(values[10]) == Approx(1.2973476459787747e-12));
153 
154  // Verifying values of SPO 11
155  CHECK(std::real(values[11]) == Approx(0.16369199334396695));
156  CHECK(std::imag(values[11]) == Approx(-0.10523147038857521));
157 
158  // Verifying values of SPO 12
159  CHECK(std::real(values[12]) == Approx(-6.491920716278332e-14));
160  CHECK(std::imag(values[12]) == Approx(-2.5135275805165893e-14));
161 
162  // Verifying values of SPO 13
163  CHECK(std::real(values[13]) == Approx(2.477731561589818e-13));
164  CHECK(std::imag(values[13]) == Approx(-6.782768791069354e-14));
165 
166  // Verifying values of SPO 14
167  CHECK(std::real(values[14]) == Approx(-7.389267149549019e-13));
168  CHECK(std::imag(values[14]) == Approx(1.8454929424926995e-12));
169 
170  // Verifying values of SPO 15
171  CHECK(std::real(values[15]) == Approx(1.551052689063858e-12));
172  CHECK(std::imag(values[15]) == Approx(-5.080043156968638e-12));
173 
174  // Verifying values of SPO 16
175  CHECK(std::real(values[16]) == Approx(0.02643126908254878));
176  CHECK(std::imag(values[16]) == Approx(-0.10382334171056015));
177 
178  // Verifying values of SPO 17
179  CHECK(std::real(values[17]) == Approx(-0.008572223551589144));
180  CHECK(std::imag(values[17]) == Approx(0.1360121319699977));
181 
182  // Verifying values of SPO 18
183  CHECK(std::real(values[18]) == Approx(-8.83004606933017e-14));
184  CHECK(std::imag(values[18]) == Approx(6.17399794483608e-13));
185 
186  // Verifying values of SPO 19
187  CHECK(std::real(values[19]) == Approx(-1.2893852652240422e-13));
188  CHECK(std::imag(values[19]) == Approx(3.7305644684515455e-12));
189 
190  // Verifying values of SPO 20
191  CHECK(std::real(values[20]) == Approx(0.02873591847713064));
192  CHECK(std::imag(values[20]) == Approx(-0.153030888627405));
193 
194  // Verifying values of SPO 21
195  CHECK(std::real(values[21]) == Approx(-5.410008378781134e-13));
196  CHECK(std::imag(values[21]) == Approx(-1.9873859502526956e-14));
197 
198  // Verifying values of SPO 22
199  CHECK(std::real(values[22]) == Approx(1.3256132302963402e-12));
200  CHECK(std::imag(values[22]) == Approx(9.89605099255277e-13));
201 
202  // Verifying values of SPO 23
203  CHECK(std::real(values[23]) == Approx(1.1945652800271454e-13));
204  CHECK(std::imag(values[23]) == Approx(-2.047390035286864e-13));
205 
206  // Verifying values of SPO 24
207  CHECK(std::real(values[24]) == Approx(6.814895869844398e-13));
208  CHECK(std::imag(values[24]) == Approx(-9.42856903662901e-14));
209 
210  // Verifying values of SPO 25
211  CHECK(std::real(values[25]) == Approx(-0.015289434969691054));
212  CHECK(std::imag(values[25]) == Approx(-0.03615194381469279));
213 
214  //Move electron 0 to position [[-6.666667 -6.666667 -6.666667]] a.u.:
215  elec.R[0] = {-6.666667, -6.666667, -6.666667};
216  elec.update();
217  sposet->evaluateValue(elec, 0, values);
218 
219  // Position [[-6.666667 -6.666667 -6.666667]] a.u.
220  // Verifying values of SPO 0
221  CHECK(std::real(values[0]) == Approx(0.0956158275805242));
222  CHECK(std::imag(values[0]) == Approx(0.03287266037323013));
223 
224  // Verifying values of SPO 1
225  CHECK(std::real(values[1]) == Approx(0.11506570134621005));
226  CHECK(std::imag(values[1]) == Approx(-0.0900472787152517));
227 
228  // Verifying values of SPO 2
229  CHECK(std::real(values[2]) == Approx(3.6262524017215473e-13));
230  CHECK(std::imag(values[2]) == Approx(-8.165796056348355e-14));
231 
232  // Verifying values of SPO 3
233  CHECK(std::real(values[3]) == Approx(-1.499448351923057e-12));
234  CHECK(std::imag(values[3]) == Approx(1.207191898465219e-13));
235 
236  // Verifying values of SPO 4
237  CHECK(std::real(values[4]) == Approx(0.09133965128853623));
238  CHECK(std::imag(values[4]) == Approx(-0.07359368062940903));
239 
240  // Verifying values of SPO 5
241  CHECK(std::real(values[5]) == Approx(-2.1379426007743085e-12));
242  CHECK(std::imag(values[5]) == Approx(2.7089146897775157e-12));
243 
244  // Verifying values of SPO 6
245  CHECK(std::real(values[6]) == Approx(6.268878374154817e-13));
246  CHECK(std::imag(values[6]) == Approx(-7.328572427840399e-13));
247 
248  // Verifying values of SPO 7
249  CHECK(std::real(values[7]) == Approx(0.1450364317288277));
250  CHECK(std::imag(values[7]) == Approx(0.1499844328343919));
251 
252  // Verifying values of SPO 8
253  CHECK(std::real(values[8]) == Approx(0.1533421330529442));
254  CHECK(std::imag(values[8]) == Approx(0.09647361404443654));
255 
256  // Verifying values of SPO 9
257  CHECK(std::real(values[9]) == Approx(-8.187964194921162e-13));
258  CHECK(std::imag(values[9]) == Approx(4.4221050437064805e-13));
259 
260  // Verifying values of SPO 10
261  CHECK(std::real(values[10]) == Approx(4.14457530803798e-12));
262  CHECK(std::imag(values[10]) == Approx(-3.1273247862003916e-13));
263 
264  // Verifying values of SPO 11
265  CHECK(std::real(values[11]) == Approx(-0.23130832819832292));
266  CHECK(std::imag(values[11]) == Approx(-0.000920632077534666));
267 
268  // Verifying values of SPO 12
269  CHECK(std::real(values[12]) == Approx(2.3089689879702785e-13));
270  CHECK(std::imag(values[12]) == Approx(8.097805194661028e-13));
271 
272  // Verifying values of SPO 13
273  CHECK(std::real(values[13]) == Approx(-1.2650332172739602e-12));
274  CHECK(std::imag(values[13]) == Approx(-1.7846488183430846e-13));
275 
276  // Verifying values of SPO 14
277  CHECK(std::real(values[14]) == Approx(-1.4239386578211e-12));
278  CHECK(std::imag(values[14]) == Approx(1.6467786336155512e-12));
279 
280  // Verifying values of SPO 15
281  CHECK(std::real(values[15]) == Approx(3.445370725198817e-12));
282  CHECK(std::imag(values[15]) == Approx(-2.88321103094349e-12));
283 
284  // Verifying values of SPO 16
285  CHECK(std::real(values[16]) == Approx(0.06850124380096241));
286  CHECK(std::imag(values[16]) == Approx(-0.004634947034247484));
287 
288  // Verifying values of SPO 17
289  CHECK(std::real(values[17]) == Approx(0.35713027737573216));
290  CHECK(std::imag(values[17]) == Approx(0.09047102606218091));
291 
292  // Verifying values of SPO 18
293  CHECK(std::real(values[18]) == Approx(2.2383223715827679e-13));
294  CHECK(std::imag(values[18]) == Approx(9.967200661795276e-14));
295 
296  // Verifying values of SPO 19
297  CHECK(std::real(values[19]) == Approx(9.707838699186186e-12));
298  CHECK(std::imag(values[19]) == Approx(5.315903969755244e-13));
299 
300  // Verifying values of SPO 20
301  CHECK(std::real(values[20]) == Approx(0.24626463443252364));
302  CHECK(std::imag(values[20]) == Approx(-0.07802697773073676));
303 
304  // Verifying values of SPO 21
305  CHECK(std::real(values[21]) == Approx(-6.978536668841118e-13));
306  CHECK(std::imag(values[21]) == Approx(2.91436579306753e-13));
307 
308  // Verifying values of SPO 22
309  CHECK(std::real(values[22]) == Approx(1.3880337858309117e-12));
310  CHECK(std::imag(values[22]) == Approx(-2.2989839200496397e-12));
311 
312  // Verifying values of SPO 23
313  CHECK(std::real(values[23]) == Approx(-1.4148543446437055e-12));
314  CHECK(std::imag(values[23]) == Approx(3.6835638711982286e-13));
315 
316  // Verifying values of SPO 24
317  CHECK(std::real(values[24]) == Approx(-5.500253025100187e-13));
318  CHECK(std::imag(values[24]) == Approx(-1.235497815173411e-12));
319 
320  // Verifying values of SPO 25
321  CHECK(std::real(values[25]) == Approx(0.7850948237148717));
322  CHECK(std::imag(values[25]) == Approx(-0.6716776823047774));
323 
324  //Move electron 0 to position [[-3.333334 -3.333334 -3.333334]] a.u.:
325  elec.R[0] = {-3.333334, -3.333334, -3.333334};
326  elec.update();
327  sposet->evaluateValue(elec, 0, values);
328 
329  // Position [[-3.333334 -3.333334 -3.333334]] a.u.
330  // Verifying values of SPO 0
331  CHECK(std::real(values[0]) == Approx(-0.06005230809177282));
332  CHECK(std::imag(values[0]) == Approx(-0.005290783996832645));
333 
334  // Verifying values of SPO 1
335  CHECK(std::real(values[1]) == Approx(0.04593960387952771));
336  CHECK(std::imag(values[1]) == Approx(0.03337244273082512));
337 
338  // Verifying values of SPO 2
339  CHECK(std::real(values[2]) == Approx(2.1968109839728915e-13));
340  CHECK(std::imag(values[2]) == Approx(-8.417851376747011e-14));
341 
342  // Verifying values of SPO 3
343  CHECK(std::real(values[3]) == Approx(-8.999305207334697e-13));
344  CHECK(std::imag(values[3]) == Approx(2.0359793834210627e-13));
345 
346  // Verifying values of SPO 4
347  CHECK(std::real(values[4]) == Approx(0.018164912111658126));
348  CHECK(std::imag(values[4]) == Approx(-0.07922559625400716));
349 
350  // Verifying values of SPO 5
351  CHECK(std::real(values[5]) == Approx(1.4349914486982305e-13));
352  CHECK(std::imag(values[5]) == Approx(2.9226239484116607e-12));
353 
354  // Verifying values of SPO 6
355  CHECK(std::real(values[6]) == Approx(-1.1288736058805674e-13));
356  CHECK(std::imag(values[6]) == Approx(-6.832621491132385e-13));
357 
358  // Verifying values of SPO 7
359  CHECK(std::real(values[7]) == Approx(0.1651619894114805));
360  CHECK(std::imag(values[7]) == Approx(-0.06134476438049227));
361 
362  // Verifying values of SPO 8
363  CHECK(std::real(values[8]) == Approx(0.14028043757888803));
364  CHECK(std::imag(values[8]) == Approx(-0.10727459702035165));
365 
366  // Verifying values of SPO 9
367  CHECK(std::real(values[9]) == Approx(7.288215170092265e-13));
368  CHECK(std::imag(values[9]) == Approx(-6.500147642486826e-13));
369 
370  // Verifying values of SPO 10
371  CHECK(std::real(values[10]) == Approx(-2.3690801924617754e-12));
372  CHECK(std::imag(values[10]) == Approx(1.2809042021000265e-12));
373 
374  // Verifying values of SPO 11
375  CHECK(std::real(values[11]) == Approx(0.17134778976483186));
376  CHECK(std::imag(values[11]) == Approx(-0.09873043450786173));
377 
378  // Verifying values of SPO 12
379  CHECK(std::real(values[12]) == Approx(-4.721136675333712e-14));
380  CHECK(std::imag(values[12]) == Approx(1.479762495375543e-14));
381 
382  // Verifying values of SPO 13
383  CHECK(std::real(values[13]) == Approx(1.827221642785641e-13));
384  CHECK(std::imag(values[13]) == Approx(-3.08052194664315e-14));
385 
386  // Verifying values of SPO 14
387  CHECK(std::real(values[14]) == Approx(-4.352638042034029e-13));
388  CHECK(std::imag(values[14]) == Approx(1.8446439037660834e-12));
389 
390  // Verifying values of SPO 15
391  CHECK(std::real(values[15]) == Approx(6.46854097962043e-13));
392  CHECK(std::imag(values[15]) == Approx(-4.927302489657481e-12));
393 
394  // Verifying values of SPO 16
395  CHECK(std::real(values[16]) == Approx(0.007153805199742103));
396  CHECK(std::imag(values[16]) == Approx(-0.09671197376753325));
397 
398  // Verifying values of SPO 17
399  CHECK(std::real(values[17]) == Approx(0.0127598393467023));
400  CHECK(std::imag(values[17]) == Approx(0.16334397744406476));
401 
402  // Verifying values of SPO 18
403  CHECK(std::real(values[18]) == Approx(-6.968514298788527e-14));
404  CHECK(std::imag(values[18]) == Approx(6.594685735382753e-13));
405 
406  // Verifying values of SPO 19
407  CHECK(std::real(values[19]) == Approx(4.700545509464493e-13));
408  CHECK(std::imag(values[19]) == Approx(4.414564200230628e-12));
409 
410  // Verifying values of SPO 20
411  CHECK(std::real(values[20]) == Approx(0.04159487544411769));
412  CHECK(std::imag(values[20]) == Approx(-0.1385550610888857));
413 
414  // Verifying values of SPO 21
415  CHECK(std::real(values[21]) == Approx(-5.91423394723593e-13));
416  CHECK(std::imag(values[21]) == Approx(-4.260524213468368e-14));
417 
418  // Verifying values of SPO 22
419  CHECK(std::real(values[22]) == Approx(1.554485706631173e-12));
420  CHECK(std::imag(values[22]) == Approx(1.0536316828100446e-12));
421 
422  // Verifying values of SPO 23
423  CHECK(std::real(values[23]) == Approx(1.2028225633590926e-13));
424  CHECK(std::imag(values[23]) == Approx(-2.8023416921979087e-13));
425 
426  // Verifying values of SPO 24
427  CHECK(std::real(values[24]) == Approx(7.943472267278781e-13));
428  CHECK(std::imag(values[24]) == Approx(-1.860109288800894e-13));
429 
430  // Verifying values of SPO 25
431  CHECK(std::real(values[25]) == Approx(-0.02037392105518354));
432  CHECK(std::imag(values[25]) == Approx(-0.057434079996872056));
433 
434  //Move electron 0 to position [[-9.99999999e-07 -9.99999999e-07 -9.99999999e-07]] a.u.:
435  elec.R[0] = {-9.999999992515995e-07, -9.999999992515995e-07, -9.999999992515995e-07};
436  elec.update();
437  sposet->evaluateValue(elec, 0, values);
438 
439  // Position [[-9.99999999e-07 -9.99999999e-07 -9.99999999e-07]] a.u.
440  // Verifying values of SPO 0
441  CHECK(std::real(values[0]) == Approx(0.10167888698741122));
442  CHECK(std::imag(values[0]) == Approx(-0.005941230707015811));
443 
444  // Verifying values of SPO 1
445  CHECK(std::real(values[1]) == Approx(0.06770487558800753));
446  CHECK(std::imag(values[1]) == Approx(0.008637814352396151));
447 
448  // Verifying values of SPO 2
449  CHECK(std::real(values[2]) == Approx(3.60922270259699e-13));
450  CHECK(std::imag(values[2]) == Approx(-5.756254305688054e-14));
451 
452  // Verifying values of SPO 3
453  CHECK(std::real(values[3]) == Approx(-1.5147241100318388e-12));
454  CHECK(std::imag(values[3]) == Approx(4.370202116763758e-14));
455 
456  // Verifying values of SPO 4
457  CHECK(std::real(values[4]) == Approx(0.1285247939510426));
458  CHECK(std::imag(values[4]) == Approx(-0.010293562806552263));
459 
460  // Verifying values of SPO 5
461  CHECK(std::real(values[5]) == Approx(-3.1382097441498023e-12));
462  CHECK(std::imag(values[5]) == Approx(5.680356358934007e-13));
463 
464  // Verifying values of SPO 6
465  CHECK(std::real(values[6]) == Approx(8.714109078422965e-13));
466  CHECK(std::imag(values[6]) == Approx(-1.8866876919070565e-13));
467 
468  // Verifying values of SPO 7
469  CHECK(std::real(values[7]) == Approx(0.0787451415811546));
470  CHECK(std::imag(values[7]) == Approx(0.00141109567072648));
471 
472  // Verifying values of SPO 8
473  CHECK(std::real(values[8]) == Approx(-0.0387351183536941));
474  CHECK(std::imag(values[8]) == Approx(0.012263153973258889));
475 
476  // Verifying values of SPO 9
477  CHECK(std::real(values[9]) == Approx(-4.3274845513970603e-14));
478  CHECK(std::imag(values[9]) == Approx(-9.283134158055235e-14));
479 
480  // Verifying values of SPO 10
481  CHECK(std::real(values[10]) == Approx(2.4316486325254445e-13));
482  CHECK(std::imag(values[10]) == Approx(1.6584216636762436e-13));
483 
484  // Verifying values of SPO 11
485  CHECK(std::real(values[11]) == Approx(-0.010875903895641862));
486  CHECK(std::imag(values[11]) == Approx(0.04714572895763401));
487 
488  // Verifying values of SPO 12
489  CHECK(std::real(values[12]) == Approx(2.0172275308035739e-13));
490  CHECK(std::imag(values[12]) == Approx(5.497217874676079e-13));
491 
492  // Verifying values of SPO 13
493  CHECK(std::real(values[13]) == Approx(-8.496293946065942e-13));
494  CHECK(std::imag(values[13]) == Approx(-1.036705443495618e-13));
495 
496  // Verifying values of SPO 14
497  CHECK(std::real(values[14]) == Approx(-2.263782260614978e-12));
498  CHECK(std::imag(values[14]) == Approx(5.795082295856767e-13));
499 
500  // Verifying values of SPO 15
501  CHECK(std::real(values[15]) == Approx(6.377089828402728e-12));
502  CHECK(std::imag(values[15]) == Approx(-6.716103368246984e-13));
503 
504  // Verifying values of SPO 16
505  CHECK(std::real(values[16]) == Approx(0.12847308968746957));
506  CHECK(std::imag(values[16]) == Approx(0.02035282496639674));
507 
508  // Verifying values of SPO 17
509  CHECK(std::real(values[17]) == Approx(0.1737553721002816));
510  CHECK(std::imag(values[17]) == Approx(-0.0376579821006186));
511 
512  // Verifying values of SPO 18
513  CHECK(std::real(values[18]) == Approx(-1.4876446427583875e-13));
514  CHECK(std::imag(values[18]) == Approx(-3.7704344851099533e-13));
515 
516  // Verifying values of SPO 19
517  CHECK(std::real(values[19]) == Approx(4.382987028924654e-12));
518  CHECK(std::imag(values[19]) == Approx(-2.5937429287598488e-12));
519 
520  // Verifying values of SPO 20
521  CHECK(std::real(values[20]) == Approx(0.15399434198150766));
522  CHECK(std::imag(values[20]) == Approx(-0.02568058890861615));
523 
524  // Verifying values of SPO 21
525  CHECK(std::real(values[21]) == Approx(-1.869012757649718e-13));
526  CHECK(std::imag(values[21]) == Approx(2.032548120769792e-13));
527 
528  // Verifying values of SPO 22
529  CHECK(std::real(values[22]) == Approx(-9.61637020079959e-13));
530  CHECK(std::imag(values[22]) == Approx(-1.8784349076636863e-12));
531 
532  // Verifying values of SPO 23
533  CHECK(std::real(values[23]) == Approx(-1.0113611337362861e-12));
534  CHECK(std::imag(values[23]) == Approx(1.0432885024476444e-12));
535 
536  // Verifying values of SPO 24
537  CHECK(std::real(values[24]) == Approx(-8.348460811998449e-13));
538  CHECK(std::imag(values[24]) == Approx(-1.0209888494617845e-13));
539 
540  // Verifying values of SPO 25
541  CHECK(std::real(values[25]) == Approx(0.8037234583780705));
542  CHECK(std::imag(values[25]) == Approx(-0.8579924081605256));
543 
544  //Move electron 0 to position [[3.333332 3.333332 3.333332]] a.u.:
545  elec.R[0] = {3.3333320000000004, 3.3333320000000004, 3.3333320000000004};
546  elec.update();
547  sposet->evaluateValue(elec, 0, values);
548 
549  // Position [[3.333332 3.333332 3.333332]] a.u.
550  // Verifying values of SPO 0
551  CHECK(std::real(values[0]) == Approx(-0.059806620261567495));
552  CHECK(std::imag(values[0]) == Approx(0.0014605026493625755));
553 
554  // Verifying values of SPO 1
555  CHECK(std::real(values[1]) == Approx(0.042130656010843565));
556  CHECK(std::imag(values[1]) == Approx(0.041154352141271694));
557 
558  // Verifying values of SPO 2
559  CHECK(std::real(values[2]) == Approx(2.299461077958894e-13));
560  CHECK(std::imag(values[2]) == Approx(-9.228330396886522e-14));
561 
562  // Verifying values of SPO 3
563  CHECK(std::real(values[3]) == Approx(-9.411403950013916e-13));
564  CHECK(std::imag(values[3]) == Approx(2.373896446652552e-13));
565 
566  // Verifying values of SPO 4
567  CHECK(std::real(values[4]) == Approx(0.022449104164198187));
568  CHECK(std::imag(values[4]) == Approx(-0.08741397581582212));
569 
570  // Verifying values of SPO 5
571  CHECK(std::real(values[5]) == Approx(5.8607649950285695e-15));
572  CHECK(std::imag(values[5]) == Approx(3.172440606911535e-12));
573 
574  // Verifying values of SPO 6
575  CHECK(std::real(values[6]) == Approx(-7.517818458469839e-14));
576  CHECK(std::imag(values[6]) == Approx(-7.526353676741086e-13));
577 
578  // Verifying values of SPO 7
579  CHECK(std::real(values[7]) == Approx(0.16660016621038506));
580  CHECK(std::imag(values[7]) == Approx(-0.05698359576596997));
581 
582  // Verifying values of SPO 8
583  CHECK(std::real(values[8]) == Approx(0.13740625808310925));
584  CHECK(std::imag(values[8]) == Approx(-0.10946922834461466));
585 
586  // Verifying values of SPO 9
587  CHECK(std::real(values[9]) == Approx(7.572904391658913e-13));
588  CHECK(std::imag(values[9]) == Approx(-6.606785411995795e-13));
589 
590  // Verifying values of SPO 10
591  CHECK(std::real(values[10]) == Approx(-2.4508546356377402e-12));
592  CHECK(std::imag(values[10]) == Approx(1.2663325239134368e-12));
593 
594  // Verifying values of SPO 11
595  CHECK(std::real(values[11]) == Approx(0.17681058034809968));
596  CHECK(std::imag(values[11]) == Approx(-0.09275809690899624));
597 
598  // Verifying values of SPO 12
599  CHECK(std::real(values[12]) == Approx(-2.9056613057169995e-14));
600  CHECK(std::imag(values[12]) == Approx(4.9557581445141706e-14));
601 
602  // Verifying values of SPO 13
603  CHECK(std::real(values[13]) == Approx(1.2658321585137323e-13));
604  CHECK(std::imag(values[13]) == Approx(1.070843942851782e-14));
605 
606  // Verifying values of SPO 14
607  CHECK(std::real(values[14]) == Approx(-8.521829595450246e-14));
608  CHECK(std::imag(values[14]) == Approx(1.77439224452637e-12));
609 
610  // Verifying values of SPO 15
611  CHECK(std::real(values[15]) == Approx(-3.6150944959863987e-13));
612  CHECK(std::imag(values[15]) == Approx(-4.5876243176725545e-12));
613 
614  // Verifying values of SPO 16
615  CHECK(std::real(values[16]) == Approx(-0.014036906825284585));
616  CHECK(std::imag(values[16]) == Approx(-0.08614468966547723));
617 
618  // Verifying values of SPO 17
619  CHECK(std::real(values[17]) == Approx(0.033216162124121054));
620  CHECK(std::imag(values[17]) == Approx(0.18639424345387834));
621 
622  // Verifying values of SPO 18
623  CHECK(std::real(values[18]) == Approx(-4.552953546266951e-14));
624  CHECK(std::imag(values[18]) == Approx(6.769691296399057e-13));
625 
626  // Verifying values of SPO 19
627  CHECK(std::real(values[19]) == Approx(1.0413475613943049e-12));
628  CHECK(std::imag(values[19]) == Approx(4.9922947429389975e-12));
629 
630  // Verifying values of SPO 20
631  CHECK(std::real(values[20]) == Approx(0.049807632374415926));
632  CHECK(std::imag(values[20]) == Approx(-0.11666665209986808));
633 
634  // Verifying values of SPO 21
635  CHECK(std::real(values[21]) == Approx(-6.182341843173099e-13));
636  CHECK(std::imag(values[21]) == Approx(-6.314824100072268e-14));
637 
638  // Verifying values of SPO 22
639  CHECK(std::real(values[22]) == Approx(1.7345326427769266e-12));
640  CHECK(std::imag(values[22]) == Approx(1.094659994231126e-12));
641 
642  // Verifying values of SPO 23
643  CHECK(std::real(values[23]) == Approx(1.290911743878159e-13));
644  CHECK(std::imag(values[23]) == Approx(-3.4848512356417114e-13));
645 
646  // Verifying values of SPO 24
647  CHECK(std::real(values[24]) == Approx(8.886571862605712e-13));
648  CHECK(std::imag(values[24]) == Approx(-2.685212860435276e-13));
649 
650  // Verifying values of SPO 25
651  CHECK(std::real(values[25]) == Approx(-0.02637454702199341));
652  CHECK(std::imag(values[25]) == Approx(-0.08028180462518811));
653 
654  //Move electron 0 to position [[6.666665 6.666665 6.666665]] a.u.:
655  elec.R[0] = {6.666665000000002, 6.666665000000002, 6.666665000000002};
656  elec.update();
657  sposet->evaluateValue(elec, 0, values);
658 
659  // Position [[6.666665 6.666665 6.666665]] a.u.
660  // Verifying values of SPO 0
661  CHECK(std::real(values[0]) == Approx(0.11380752148567085));
662  CHECK(std::imag(values[0]) == Approx(-0.04390587226150721));
663 
664  // Verifying values of SPO 1
665  CHECK(std::real(values[1]) == Approx(0.02588030482486917));
666  CHECK(std::imag(values[1]) == Approx(0.10687921643358252));
667 
668  // Verifying values of SPO 2
669  CHECK(std::real(values[2]) == Approx(3.197341334549546e-13));
670  CHECK(std::imag(values[2]) == Approx(-2.3414238599544394e-14));
671 
672  // Verifying values of SPO 3
673  CHECK(std::real(values[3]) == Approx(-1.3703920844638083e-12));
674  CHECK(std::imag(values[3]) == Approx(-4.923708702683163e-14));
675 
676  // Verifying values of SPO 4
677  CHECK(std::real(values[4]) == Approx(0.18010843596428783));
678  CHECK(std::imag(values[4]) == Approx(0.04962376866516952));
679 
680  // Verifying values of SPO 5
681  CHECK(std::real(values[5]) == Approx(-4.672976839154819e-12));
682  CHECK(std::imag(values[5]) == Approx(-1.544795977090896e-12));
683 
684  // Verifying values of SPO 6
685  CHECK(std::real(values[6]) == Approx(1.2509722576569074e-12));
686  CHECK(std::imag(values[6]) == Approx(3.563501771870871e-13));
687 
688  // Verifying values of SPO 7
689  CHECK(std::real(values[7]) == Approx(0.010394738060449391));
690  CHECK(std::imag(values[7]) == Approx(-0.15080653874439975));
691 
692  // Verifying values of SPO 8
693  CHECK(std::real(values[8]) == Approx(-0.22742833831292314));
694  CHECK(std::imag(values[8]) == Approx(-0.08681115895058802));
695 
696  // Verifying values of SPO 9
697  CHECK(std::real(values[9]) == Approx(7.017990606811553e-13));
698  CHECK(std::imag(values[9]) == Approx(-6.006243721193688e-13));
699 
700  // Verifying values of SPO 10
701  CHECK(std::real(values[10]) == Approx(-3.5441754061629804e-12));
702  CHECK(std::imag(values[10]) == Approx(5.510674056680197e-13));
703 
704  // Verifying values of SPO 11
705  CHECK(std::real(values[11]) == Approx(0.19602654856168172));
706  CHECK(std::imag(values[11]) == Approx(0.08793147752366054));
707 
708  // Verifying values of SPO 12
709  CHECK(std::real(values[12]) == Approx(1.1100410142953716e-13));
710  CHECK(std::imag(values[12]) == Approx(2.1529784776147745e-13));
711 
712  // Verifying values of SPO 13
713  CHECK(std::real(values[13]) == Approx(-3.1113994995362083e-13));
714  CHECK(std::imag(values[13]) == Approx(-9.16124845162143e-14));
715 
716  // Verifying values of SPO 14
717  CHECK(std::real(values[14]) == Approx(-2.8425823215546873e-12));
718  CHECK(std::imag(values[14]) == Approx(-5.967361937077563e-13));
719 
720  // Verifying values of SPO 15
721  CHECK(std::real(values[15]) == Approx(8.500061674827252e-12));
722  CHECK(std::imag(values[15]) == Approx(1.6117350650343773e-12));
723 
724  // Verifying values of SPO 16
725  CHECK(std::real(values[16]) == Approx(0.1685048554426682));
726  CHECK(std::imag(values[16]) == Approx(0.040751301285559566));
727 
728  // Verifying values of SPO 17
729  CHECK(std::real(values[17]) == Approx(-0.05992911952275292));
730  CHECK(std::imag(values[17]) == Approx(-0.147726013001218));
731 
732  // Verifying values of SPO 18
733  CHECK(std::real(values[18]) == Approx(-6.090732565369773e-13));
734  CHECK(std::imag(values[18]) == Approx(-7.443355801535639e-13));
735 
736  // Verifying values of SPO 19
737  CHECK(std::real(values[19]) == Approx(-2.2154083501205196e-12));
738  CHECK(std::imag(values[19]) == Approx(-5.02729118133428e-12));
739 
740  // Verifying values of SPO 20
741  CHECK(std::real(values[20]) == Approx(0.061780347627032536));
742  CHECK(std::imag(values[20]) == Approx(0.01686579925949514));
743 
744  // Verifying values of SPO 21
745  CHECK(std::real(values[21]) == Approx(3.0787695380514886e-13));
746  CHECK(std::imag(values[21]) == Approx(1.6918178698834226e-14));
747 
748  // Verifying values of SPO 22
749  CHECK(std::real(values[22]) == Approx(-3.221671335678293e-12));
750  CHECK(std::imag(values[22]) == Approx(-9.562454010396891e-13));
751 
752  // Verifying values of SPO 23
753  CHECK(std::real(values[23]) == Approx(-4.3583890429925625e-13));
754  CHECK(std::imag(values[23]) == Approx(1.578955716802118e-12));
755 
756  // Verifying values of SPO 24
757  CHECK(std::real(values[24]) == Approx(-9.202570529310635e-13));
758  CHECK(std::imag(values[24]) == Approx(1.13342674089293e-12));
759 
760  // Verifying values of SPO 25
761  CHECK(std::real(values[25]) == Approx(0.7098778186417222));
762  CHECK(std::imag(values[25]) == Approx(-0.928839302822032));
763 
764  //Move electron 0 to position [[9.999998 9.999998 9.999998]] a.u.:
765  elec.R[0] = {9.999998000000001, 9.999998000000001, 9.999998000000001};
766  elec.update();
767  sposet->evaluateValue(elec, 0, values);
768 
769  // Position [[9.999998 9.999998 9.999998]] a.u.
770  // Verifying values of SPO 0
771  CHECK(std::real(values[0]) == Approx(-0.05950698756399922));
772  CHECK(std::imag(values[0]) == Approx(0.008451159090256224));
773 
774  // Verifying values of SPO 1
775  CHECK(std::real(values[1]) == Approx(0.0372927266605709));
776  CHECK(std::imag(values[1]) == Approx(0.04865086992861883));
777 
778  // Verifying values of SPO 2
779  CHECK(std::real(values[2]) == Approx(2.3700317966038143e-13));
780  CHECK(std::imag(values[2]) == Approx(-1.0025983406577301e-13));
781 
782  // Verifying values of SPO 3
783  CHECK(std::real(values[3]) == Approx(-9.70793757903483e-13));
784  CHECK(std::imag(values[3]) == Approx(2.724608733149554e-13));
785 
786  // Verifying values of SPO 4
787  CHECK(std::real(values[4]) == Approx(0.02755063738588984));
788  CHECK(std::imag(values[4]) == Approx(-0.09640122180554679));
789 
790  // Verifying values of SPO 5
791  CHECK(std::real(values[5]) == Approx(-1.6269971476154967e-13));
792  CHECK(std::imag(values[5]) == Approx(3.438238409269704e-12));
793 
794  // Verifying values of SPO 6
795  CHECK(std::real(values[6]) == Approx(-2.855643508474324e-14));
796  CHECK(std::imag(values[6]) == Approx(-8.265646196873323e-13));
797 
798  // Verifying values of SPO 7
799  CHECK(std::real(values[7]) == Approx(0.16726281762463338));
800  CHECK(std::imag(values[7]) == Approx(-0.052898517004949845));
801 
802  // Verifying values of SPO 8
803  CHECK(std::real(values[8]) == Approx(0.13334645793969357));
804  CHECK(std::imag(values[8]) == Approx(-0.10880327269811665));
805 
806  // Verifying values of SPO 9
807  CHECK(std::real(values[9]) == Approx(7.692422002437098e-13));
808  CHECK(std::imag(values[9]) == Approx(-6.640972494690012e-13));
809 
810  // Verifying values of SPO 10
811  CHECK(std::real(values[10]) == Approx(-2.4821733211548425e-12));
812  CHECK(std::imag(values[10]) == Approx(1.2520175866069816e-12));
813 
814  // Verifying values of SPO 11
815  CHECK(std::real(values[11]) == Approx(0.1798235956119672));
816  CHECK(std::imag(values[11]) == Approx(-0.0874643862941136));
817 
818  // Verifying values of SPO 12
819  CHECK(std::real(values[12]) == Approx(-1.1709383431389981e-14));
820  CHECK(std::imag(values[12]) == Approx(7.639071676987064e-14));
821 
822  // Verifying values of SPO 13
823  CHECK(std::real(values[13]) == Approx(8.413148674931816e-14));
824  CHECK(std::imag(values[13]) == Approx(5.638892139842643e-14));
825 
826  // Verifying values of SPO 14
827  CHECK(std::real(values[14]) == Approx(3.033437215039551e-13));
828  CHECK(std::imag(values[14]) == Approx(1.6158520918629484e-12));
829 
830  // Verifying values of SPO 15
831  CHECK(std::real(values[15]) == Approx(-1.4472936742422837e-12));
832  CHECK(std::imag(values[15]) == Approx(-4.016332839335127e-12));
833 
834  // Verifying values of SPO 16
835  CHECK(std::real(values[16]) == Approx(-0.03653573483382949));
836  CHECK(std::imag(values[16]) == Approx(-0.07139149065641964));
837 
838  // Verifying values of SPO 17
839  CHECK(std::real(values[17]) == Approx(0.05195911753492378));
840  CHECK(std::imag(values[17]) == Approx(0.20377702124340888));
841 
842  // Verifying values of SPO 18
843  CHECK(std::real(values[18]) == Approx(-1.3913349264311425e-14));
844  CHECK(std::imag(values[18]) == Approx(6.650238087623492e-13));
845 
846  // Verifying values of SPO 19
847  CHECK(std::real(values[19]) == Approx(1.5612684760915313e-12));
848  CHECK(std::imag(values[19]) == Approx(5.4326976941529405e-12));
849 
850  // Verifying values of SPO 20
851  CHECK(std::real(values[20]) == Approx(0.05183727962592069));
852  CHECK(std::imag(values[20]) == Approx(-0.08693036223348635));
853 
854  // Verifying values of SPO 21
855  CHECK(std::real(values[21]) == Approx(-6.168889188205947e-13));
856  CHECK(std::imag(values[21]) == Approx(-7.934625127721342e-14));
857 
858  // Verifying values of SPO 22
859  CHECK(std::real(values[22]) == Approx(1.854426333865271e-12));
860  CHECK(std::imag(values[22]) == Approx(1.1091023934392614e-12));
861 
862  // Verifying values of SPO 23
863  CHECK(std::real(values[23]) == Approx(1.4450940425974687e-13));
864  CHECK(std::imag(values[23]) == Approx(-4.0532507912929545e-13));
865 
866  // Verifying values of SPO 24
867  CHECK(std::real(values[24]) == Approx(9.63345721944599e-13));
868  CHECK(std::imag(values[24]) == Approx(-3.381600555043806e-13));
869 
870  // Verifying values of SPO 25
871  CHECK(std::real(values[25]) == Approx(-0.03316664551198499));
872  CHECK(std::imag(values[25]) == Approx(-0.10326287192308459));
873 
874  // END generated C++ input from Carbon1x1x1-tw1_gen_mos.py (pyscf version 1.6.2) on 2019-11-19 15:08:42.847403
875  }
876 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180

◆ test_cartesian_ao()

void qmcplusplus::test_cartesian_ao ( )

Definition at line 25 of file test_cartesian_ao.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), OHMMS::Controller, SPOSetBuilderFactory::createSPOSetBuilder(), doc, Libxml2Document::getRoot(), Libxml2Document::getXPathContext(), ispecies, okay, Libxml2Document::parse(), and REQUIRE().

Referenced by TEST_CASE().

26 {
27  std::ostringstream section_name;
28  section_name << "Cartesian AO ordering";
29 
30  SECTION(section_name.str())
31  {
33 
34  const SimulationCell simulation_cell;
35  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
36  auto& elec(*elec_ptr);
37  std::vector<int> agroup(2);
38  agroup[0] = 1;
39  elec.setName("e");
40  elec.create(agroup);
41  elec.R[0] = 0.0;
42 
43  SpeciesSet& tspecies = elec.getSpeciesSet();
44  int upIdx = tspecies.addSpecies("u");
45  int massIdx = tspecies.addAttribute("mass");
46  tspecies(massIdx, upIdx) = 1.0;
47 
48  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
49  auto& ions(*ions_ptr);
50  ions.setName("ion0");
51  ions.create({1});
52  ions.R[0] = 0.0;
53  SpeciesSet& ispecies = ions.getSpeciesSet();
54  int hIdx = ispecies.addSpecies("H");
55  ions.update();
56 
57  elec.addTable(ions);
58  elec.update();
59 
61  bool okay = doc.parse("cartesian_order.wfnoj.xml");
62  REQUIRE(okay);
63  xmlNodePtr root = doc.getRoot();
64 
65  WaveFunctionComponentBuilder::PSetMap particle_set_map;
66  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
67  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
68 
69  SPOSetBuilderFactory bf(c, elec, particle_set_map);
70 
71  OhmmsXPathObject MO_base("//determinantset", doc.getXPathContext());
72  REQUIRE(MO_base.size() == 1);
73 
74  const auto bb_ptr = bf.createSPOSetBuilder(MO_base[0]);
75  auto& bb(*bb_ptr);
76 
77  OhmmsXPathObject slater_base("//determinant", doc.getXPathContext());
78  auto sposet = bb.createSPOSet(slater_base[0]);
79 
80  SPOSet::ValueVector values;
81  values.resize(1);
82 
83  // Call makeMove to compute the distances
84  ParticleSet::SingleParticlePos newpos(0.1, -0.3, 0.2);
85  elec.makeMove(0, newpos);
86 
87  sposet->evaluateValue(elec, 0, values);
88 
89  //generated from ao_order_test.py
90  CHECK(values[0] == Approx(0.48224527310155046).epsilon(1E-6));
91  }
92 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180

◆ TEST_CASE() [1/537]

qmcplusplus::TEST_CASE ( "stdlib round"  ,
""  [numerics] 
)

Definition at line 12 of file test_stdlib.cpp.

References REQUIRE().

13 {
14  REQUIRE(round(0.4f) == 0.0f);
15  REQUIRE(round(0.6f) == 1.0f);
16  REQUIRE(round(1.2f) == 1.0f);
17  REQUIRE(round(1.8f) == 2.0f);
18  REQUIRE(round(-1.4f) == -1.0f);
19 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [2/537]

qmcplusplus::TEST_CASE ( "TWFGrads"  ,
""  [QMCWaveFunctions] 
)

Definition at line 17 of file test_TWFGrads.cpp.

References CHECK(), POS, POS_SPIN, and REQUIRE().

18 {
19  {
20  constexpr auto CT = CoordsType::POS;
21  auto grads = TWFGrads<CT>(3);
22  REQUIRE(grads.grads_positions.size() == 3);
23 
24  grads.grads_positions[0] = QMCTraits::GradType({0.1, 0.2, 0.3});
25  grads.grads_positions[1] = QMCTraits::GradType({0.4, 0.5, 0.6});
26  grads.grads_positions[2] = QMCTraits::GradType({0.7, 0.8, 0.9});
27 
28  auto shift = TWFGrads<CT>(3);
29  shift.grads_positions[0] = QMCTraits::GradType({1.0, 1.0, 1.0});
30  shift.grads_positions[1] = QMCTraits::GradType({1.0, 1.0, 1.0});
31  shift.grads_positions[2] = QMCTraits::GradType({1.0, 1.0, 1.0});
32 
33  grads += shift;
34 #ifdef QMC_COMPLEX
35  CHECK(grads.grads_positions[0][0] == ComplexApprox(QMCTraits::ValueType(1.1, 0.0)));
36  CHECK(grads.grads_positions[0][1] == ComplexApprox(QMCTraits::ValueType(1.2, 0.0)));
37  CHECK(grads.grads_positions[0][2] == ComplexApprox(QMCTraits::ValueType(1.3, 0.0)));
38  CHECK(grads.grads_positions[1][0] == ComplexApprox(QMCTraits::ValueType(1.4, 0.0)));
39  CHECK(grads.grads_positions[1][1] == ComplexApprox(QMCTraits::ValueType(1.5, 0.0)));
40  CHECK(grads.grads_positions[1][2] == ComplexApprox(QMCTraits::ValueType(1.6, 0.0)));
41  CHECK(grads.grads_positions[2][0] == ComplexApprox(QMCTraits::ValueType(1.7, 0.0)));
42  CHECK(grads.grads_positions[2][1] == ComplexApprox(QMCTraits::ValueType(1.8, 0.0)));
43  CHECK(grads.grads_positions[2][2] == ComplexApprox(QMCTraits::ValueType(1.9, 0.0)));
44 #else
45  CHECK(grads.grads_positions[0][0] == Approx(1.1));
46  CHECK(grads.grads_positions[0][1] == Approx(1.2));
47  CHECK(grads.grads_positions[0][2] == Approx(1.3));
48  CHECK(grads.grads_positions[1][0] == Approx(1.4));
49  CHECK(grads.grads_positions[1][1] == Approx(1.5));
50  CHECK(grads.grads_positions[1][2] == Approx(1.6));
51  CHECK(grads.grads_positions[2][0] == Approx(1.7));
52  CHECK(grads.grads_positions[2][1] == Approx(1.8));
53  CHECK(grads.grads_positions[2][2] == Approx(1.9));
54 #endif
55  }
56  {
57  constexpr auto CT = CoordsType::POS_SPIN;
58  auto grads = TWFGrads<CT>(2);
59  REQUIRE(grads.grads_positions.size() == 2);
60  REQUIRE(grads.grads_spins.size() == 2);
61  grads.grads_positions[0] = QMCTraits::GradType({0.1, 0.2, 0.3});
62  grads.grads_positions[1] = QMCTraits::GradType({0.4, 0.5, 0.6});
63  grads.grads_spins[0] = QMCTraits::ComplexType(0.7, 0.8);
64  grads.grads_spins[1] = QMCTraits::ComplexType(0.9, 1.0);
65 
66  auto shift = TWFGrads<CT>(2);
67  shift.grads_positions[0] = QMCTraits::GradType({1.0, 1.0, 1.0});
68  shift.grads_positions[1] = QMCTraits::GradType({1.0, 1.0, 1.0});
69  shift.grads_spins[0] = QMCTraits::ComplexType(1.0, 0.0);
70  shift.grads_spins[1] = QMCTraits::ComplexType(1.0, 0.0);
71 
72  grads += shift;
73 #ifdef QMC_COMPLEX
74  CHECK(grads.grads_positions[0][0] == ComplexApprox(QMCTraits::ValueType(1.1, 0.0)));
75  CHECK(grads.grads_positions[0][1] == ComplexApprox(QMCTraits::ValueType(1.2, 0.0)));
76  CHECK(grads.grads_positions[0][2] == ComplexApprox(QMCTraits::ValueType(1.3, 0.0)));
77  CHECK(grads.grads_positions[1][0] == ComplexApprox(QMCTraits::ValueType(1.4, 0.0)));
78  CHECK(grads.grads_positions[1][1] == ComplexApprox(QMCTraits::ValueType(1.5, 0.0)));
79  CHECK(grads.grads_positions[1][2] == ComplexApprox(QMCTraits::ValueType(1.6, 0.0)));
80 #else
81  CHECK(grads.grads_positions[0][0] == Approx(1.1));
82  CHECK(grads.grads_positions[0][1] == Approx(1.2));
83  CHECK(grads.grads_positions[0][2] == Approx(1.3));
84  CHECK(grads.grads_positions[1][0] == Approx(1.4));
85  CHECK(grads.grads_positions[1][1] == Approx(1.5));
86  CHECK(grads.grads_positions[1][2] == Approx(1.6));
87 #endif
88  CHECK(grads.grads_spins[0] == ComplexApprox(QMCTraits::ComplexType(1.7, 0.8)));
89  CHECK(grads.grads_spins[1] == ComplexApprox(QMCTraits::ComplexType(1.9, 1.0)));
90  }
91 }
LatticeGaussianProduct::GradType GradType
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
QMCTraits::ComplexType ComplexType
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [3/537]

qmcplusplus::TEST_CASE ( "StlPrettyPrint"  ,
""  [utilities] 
)

Definition at line 18 of file test_StlPrettyPrint.cpp.

References CHECK().

19 {
20  std::ostringstream msg;
21  std::vector<int> vec;
22 
23  msg << vec;
24  CHECK(msg.str() == "[]");
25 
26  msg.str(std::string());
27  vec = {4, 4, 3, 3};
28  msg << vec;
29  CHECK(msg.str() == "[4(x2), 3(x2)]");
30 
31  msg.str(std::string());
32  vec = {4, 4, 3};
33  msg << vec;
34  CHECK(msg.str() == "[4(x2), 3]");
35 
36  msg.str(std::string());
37  vec = {4, 3, 3};
38  msg << vec;
39  CHECK(msg.str() == "[4, 3(x2)]");
40 
41  msg.str(std::string());
42  vec = {4, 3, 2};
43  msg << vec;
44  CHECK(msg.str() == "[4, 3, 2]");
45 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [4/537]

qmcplusplus::TEST_CASE ( "test_communicate_split_one"  ,
""  [message] 
)

Definition at line 18 of file test_communciate.cpp.

References OHMMS::Controller, and REQUIRE().

19 {
21 
22  auto c2 = std::make_unique<Communicate>(*c, 1);
23 
24  REQUIRE(c2->size() == c->size());
25  REQUIRE(c2->rank() == c->rank());
26 
27  if (c->rank() == 0)
28  {
29  REQUIRE(c2->isGroupLeader() == true);
30  auto GroupLeaderComm = c2->getGroupLeaderComm();
31  REQUIRE(GroupLeaderComm != nullptr);
32  REQUIRE(GroupLeaderComm->size() == 1);
33  REQUIRE(GroupLeaderComm->rank() == 0);
34  }
35  else
36  {
37  REQUIRE(c2->isGroupLeader() == false);
38  REQUIRE(c2->getGroupLeaderComm() == nullptr);
39  }
40 
41  std::string real_name = c->getName();
42 
43  std::string name = "myname";
44  c->setName(name);
45  REQUIRE(c->getName() == name);
46 
47  std::string other_name = "myothername";
48  c->setName(other_name.data(), other_name.size());
49  REQUIRE(c->getName() == other_name);
50 
51  c->setName(real_name);
52 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [5/537]

qmcplusplus::TEST_CASE ( "SizeLimitedDataQueue"  ,
""  [estimators] 
)

Definition at line 18 of file test_SizeLimitedDataQueue.cpp.

References CHECK(), SizeLimitedDataQueue< T, NUM_FIELDS >::push(), SizeLimitedDataQueue< T, NUM_FIELDS >::size(), and SizeLimitedDataQueue< T, NUM_FIELDS >::weighted_avg().

19 {
20  SizeLimitedDataQueue<double, 1> weight_and_energy(3);
21  CHECK(weight_and_energy.size() == 0);
22  {
23  weight_and_energy.push({1.0, {2.0}});
24  CHECK(weight_and_energy.size() == 1);
25  auto avg = weight_and_energy.weighted_avg();
26  CHECK(Approx(avg[0]) == 2.0);
27  }
28  {
29  weight_and_energy.push({3.0, {1.0}});
30  CHECK(weight_and_energy.size() == 2);
31  auto avg = weight_and_energy.weighted_avg();
32  CHECK(Approx(avg[0]) == 1.25);
33  }
34  {
35  SizeLimitedDataQueue<double, 1>::HistoryElement temp{0.5, {3.0}};
36  weight_and_energy.push(std::move(temp));
37  CHECK(weight_and_energy.size() == 3);
38  auto avg = weight_and_energy.weighted_avg();
39  CHECK(Approx(avg[0]) == 1.444444444);
40  }
41  {
42  weight_and_energy.push({0.5, {3.0}});
43  CHECK(weight_and_energy.size() == 3);
44  auto avg = weight_and_energy.weighted_avg();
45  CHECK(Approx(avg[0]) == 1.5);
46  }
47 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [6/537]

qmcplusplus::TEST_CASE ( "Taus"  ,
""  [Particle] 
)

Definition at line 18 of file test_TauParams.cpp.

References CHECK().

19 {
20  auto tau = 1.0;
21  auto invmass = 0.2;
22  auto spin_mass = 0.5;
23 
24  TauParams<QMCTraits::RealType, CoordsType::POS> taus_rs(tau, invmass, spin_mass);
25  CHECK(Approx(taus_rs.tauovermass) == 0.2);
26  CHECK(Approx(taus_rs.oneover2tau) == 2.5);
27  CHECK(Approx(taus_rs.sqrttau) == 0.447213595499957927703605);
28 
29  TauParams<QMCTraits::RealType, CoordsType::POS_SPIN> taus_rsspins(tau, invmass, spin_mass);
30  CHECK(Approx(taus_rsspins.spin_tauovermass) == 0.4);
31  CHECK(Approx(taus_rsspins.spin_oneover2tau) == 1.25);
32  CHECK(Approx(taus_rsspins.spin_sqrttau) == 0.632455532033675882352952);
33 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [7/537]

qmcplusplus::TEST_CASE ( "NaNguard"  ,
""  [wavefunction] 
)

Definition at line 19 of file test_NaNguard.cpp.

References NaNguard::checkOneParticleGradients(), NaNguard::checkOneParticleRatio(), and sqrt().

20 {
21  const QMCTraits::ValueType const_nan = std::sqrt(-1.0);
22  CHECK_THROWS_WITH(NaNguard::checkOneParticleRatio(const_nan, "unit test"), Catch::Matchers::Contains("NaNguard::checkOneParticleRatio"));
23  CHECK_NOTHROW(NaNguard::checkOneParticleRatio(0.0, "unit test"));
24  CHECK_THROWS_WITH(NaNguard::checkOneParticleGradients({const_nan, -const_nan, const_nan}, "unit test"), Catch::Matchers::Contains("NaNguard::checkOneParticleGradients"));
25  CHECK_NOTHROW(NaNguard::checkOneParticleGradients({0.0,0.0,0.0}, "unit test"));
26 }
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [8/537]

qmcplusplus::TEST_CASE ( "Bessel"  ,
""  [numerics] 
)

Definition at line 19 of file test_bessel.cpp.

References bessel_steed_array_cpu(), CHECK(), and qmcplusplus::Units::charge::e.

20 {
21  double bessel_array[100];
22  bessel_steed_array_cpu(10, 1.0, bessel_array);
23 
24  CHECK(bessel_array[0] == Approx(0.84147098480789650670));
25  CHECK(bessel_array[1] == Approx(0.30116867893975678925));
26  CHECK(bessel_array[3] == Approx(9.006581117112515480e-03));
27  CHECK(bessel_array[5] == Approx(9.256115861125815763e-05));
28  CHECK(bessel_array[7] == Approx(4.790134198739488623e-07));
29  CHECK(bessel_array[10] == Approx(7.116552640047313024e-11));
30 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void bessel_steed_array_cpu(const int lmax, const T x, T *jl)
Compute spherical bessel function from 0 to lmax.
Definition: Bessel.h:25

◆ TEST_CASE() [9/537]

qmcplusplus::TEST_CASE ( "test oneDimCubicSplineLinearGrid"  ,
""  [numerics] 
)

Definition at line 19 of file test_OneDimCubicSplineLinearGrid.cpp.

References CHECK(), n, OneDimCubicSpline< Td, Tg, CTd, CTg >::spline(), and OneDimCubicSpline< Td, Tg, CTd, CTg >::splint().

20 {
21  const int n = 3;
22  std::vector<double> yvals = {1.0, 2.0, 1.5};
23 
24  auto grid = std::make_unique<LinearGrid<double>>();
25  grid->set(0.5, 2.0, n);
26 
27  OneDimCubicSpline<double> cubic_spline(std::move(grid), yvals);
28 
29  int imin = 0;
30  int imax = 3 - 1;
31 
32  double yp0 = 1.0;
33  double ypn = 2.0;
34 
35  cubic_spline.spline(imin, yp0, imax, ypn);
36 
37  OneDimCubicSplineLinearGrid linear_grid_cubic_spline(cubic_spline);
38 
39  std::vector<double> check_xvals = {0.0, 0.39999999998, 0.79999999996, 1.19999999994, 1.59999999992, 1.9999999999, 2.5};
40  std::vector<double> check_yvals;
41 
42  for (int i = 0; i < check_xvals.size(); i++)
43  {
44  double r = check_xvals[i];
45  double val = cubic_spline.splint(r);
46  check_yvals.push_back(val);
47 
48  //std::cout << i << " r = " << r << " val = " << val << " " << check_yvals[i] << std::endl;
49  }
50 
51  CHECK(check_yvals[0] == Approx(0.5));
52  CHECK(check_yvals[1] == Approx(0.9));
53  CHECK(check_yvals[2] == Approx(1.4779999999));
54  CHECK(check_yvals[3] == Approx(2.0012592592));
55  CHECK(check_yvals[4] == Approx(1.575851852));
56  CHECK(check_yvals[5] == Approx(1.5));
57  CHECK(check_yvals[6] == Approx(1.5));
58 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [10/537]

qmcplusplus::TEST_CASE ( "CheckSphericalIntegration"  ,
""  [numerics] 
)

Definition at line 19 of file test_Quadrature.cpp.

References Quadrature3D< T >::quad_ok, and REQUIRE().

20 {
21  // Use the built-in quadrature rule check
22  for (int quadrature_index = 1; quadrature_index < 9; quadrature_index++)
23  {
24  Quadrature3D<QMCTraits::RealType> myRule(quadrature_index, false);
25  REQUIRE(myRule.quad_ok);
26  }
27 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [11/537]

qmcplusplus::TEST_CASE ( "PlatformSelector"  ,
""  [platform] 
)

Definition at line 19 of file test_PlatformSelector.cpp.

References CHECK(), CPU, CUDA, OMPTARGET, PlatformSelector< KIND >::selectPlatform(), and SYCL.

20 {
21  SECTION("CPU_OMPTARGET")
22  {
23 #if defined(ENABLE_OFFLOAD)
24  CHECK(CPUOMPTargetSelector::selectPlatform("yes") == PlatformKind::OMPTARGET);
25  CHECK(CPUOMPTargetSelector::selectPlatform("") == PlatformKind::OMPTARGET);
26 #else
27  CHECK(CPUOMPTargetSelector::selectPlatform("yes") == PlatformKind::CPU);
28  CHECK(CPUOMPTargetSelector::selectPlatform("") == PlatformKind::CPU);
29 #endif
30  CHECK(CPUOMPTargetSelector::selectPlatform("omptarget") == PlatformKind::OMPTARGET);
31  CHECK(CPUOMPTargetSelector::selectPlatform("cpu") == PlatformKind::CPU);
32  CHECK(CPUOMPTargetSelector::selectPlatform("no") == PlatformKind::CPU);
33  }
34 
35  SECTION("CPU_OMPTARGET_CUDA")
36  {
37  using CPUOMPTargetCUDASelector = PlatformSelector<SelectorKind::CPU_OMPTARGET_CUDA>;
38 #if defined(ENABLE_CUDA)
39  CHECK(CPUOMPTargetCUDASelector::selectPlatform("yes") == PlatformKind::CUDA);
40  CHECK(CPUOMPTargetCUDASelector::selectPlatform("") == PlatformKind::CUDA);
41  CHECK(CPUOMPTargetCUDASelector::selectPlatform("cuda") == PlatformKind::CUDA);
42 #elif defined(ENABLE_OFFLOAD)
43  CHECK(CPUOMPTargetCUDASelector::selectPlatform("yes") == PlatformKind::OMPTARGET);
44  CHECK(CPUOMPTargetCUDASelector::selectPlatform("") == PlatformKind::OMPTARGET);
45 #else
46  CHECK(CPUOMPTargetCUDASelector::selectPlatform("yes") == PlatformKind::CPU);
47  CHECK(CPUOMPTargetCUDASelector::selectPlatform("") == PlatformKind::CPU);
48 #endif
49  CHECK(CPUOMPTargetCUDASelector::selectPlatform("omptarget") == PlatformKind::OMPTARGET);
50  CHECK(CPUOMPTargetCUDASelector::selectPlatform("cpu") == PlatformKind::CPU);
51  CHECK(CPUOMPTargetCUDASelector::selectPlatform("no") == PlatformKind::CPU);
52  }
53 
54  SECTION("CPU_OMPTARGET_SYCL")
55  {
56  using CPUOMPTargetSYCLSelector = PlatformSelector<SelectorKind::CPU_OMPTARGET_SYCL>;
57 #if defined(ENABLE_SYCL)
58  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("yes") == PlatformKind::SYCL);
59  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("") == PlatformKind::SYCL);
60  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("sycl") == PlatformKind::SYCL);
61 #elif defined(ENABLE_OFFLOAD)
62  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("yes") == PlatformKind::OMPTARGET);
63  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("") == PlatformKind::OMPTARGET);
64 #else
65  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("yes") == PlatformKind::CPU);
66  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("") == PlatformKind::CPU);
67 #endif
68  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("omptarget") == PlatformKind::OMPTARGET);
69  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("cpu") == PlatformKind::CPU);
70  CHECK(CPUOMPTargetSYCLSelector::selectPlatform("no") == PlatformKind::CPU);
71  }
72 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [12/537]

qmcplusplus::TEST_CASE ( "DTModes"  ,
""  [particle] 
)

Definition at line 19 of file test_DTModes.cpp.

References CHECK(), NEED_FULL_TABLE_ANYTIME, and NEED_TEMP_DATA_ON_HOST.

20 {
21  DTModes modes;
22 
23  modes = DTModes::NEED_FULL_TABLE_ANYTIME | ~DTModes::NEED_TEMP_DATA_ON_HOST;
24 
25  CHECK(modes & DTModes::NEED_FULL_TABLE_ANYTIME);
26  CHECK(!(modes & DTModes::NEED_TEMP_DATA_ON_HOST));
27 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [13/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A Ewald Quasi2D exception"  ,
""  [hamiltonian] 
)

Definition at line 19 of file test_ewald_quasi2d.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), ParticleSet::getSpeciesSet(), lattice, LRCoulombSingleton::QUASI2D, ParticleSet::R, ParticleSet::setName(), LRCoulombSingleton::this_lr_type, and ParticleSet::update().

20 {
21  LRCoulombSingleton::CoulombHandler = 0;
22  LRCoulombSingleton::this_lr_type = LRCoulombSingleton::QUASI2D;
23  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
24  lattice.BoxBConds = true;
25  lattice.BoxBConds[2] = false; // ppn
26  lattice.ndim = 2;
27  lattice.R.diagonal(1.0);
28  lattice.LR_dim_cutoff = 1.0;
29  lattice.reset();
30 
31  const SimulationCell simulation_cell(lattice);
32  ParticleSet elec(simulation_cell);
33  elec.setName("e");
34  elec.create({1});
35  elec.R[0] = {0.0, 0.0, 0.0};
36 
37  SpeciesSet& tspecies = elec.getSpeciesSet();
38  int upIdx = tspecies.addSpecies("u");
39  int chargeIdx = tspecies.addAttribute("charge");
40  int massIdx = tspecies.addAttribute("mass");
41  tspecies(chargeIdx, upIdx) = -1;
42  tspecies(massIdx, upIdx) = 1.0;
43 
44  elec.createSK();
45  elec.update();
46 
47  CHECK_THROWS(CoulombPBCAA(elec, true, false, false));
48 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice

◆ TEST_CASE() [14/537]

qmcplusplus::TEST_CASE ( "FakeRandom determinism"  ,
""  [utilities] 
)

Definition at line 19 of file test_FakeRandom.cpp.

References CHECK().

20 {
21  double expected = 0.5;
22  FakeRandom<double> our_rng;
23  for (auto i = 0; i < 3; ++i)
24  CHECK(our_rng() == Approx(expected));
25 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [15/537]

qmcplusplus::TEST_CASE ( "ci_configuration2"  ,
""  [wavefunction] 
)

Definition at line 19 of file test_ci_configuration.cpp.

References ci_configuration2::calculateExcitations(), ci_configuration2::calculateNumOfExcitations(), CHECK(), REQUIRE(), and sign().

20 {
21  const int n_states = 6;
22  std::vector<size_t> ref{0, 1, 2, 3};
23  ci_configuration2 ref_state(ref);
24 
25  size_t n_excited;
26  double sign = 0.0;
27  std::vector<size_t> pos(n_states);
28  std::vector<size_t> occupied(n_states);
29  std::vector<size_t> unoccupied(n_states);
30 
31  std::vector<size_t> ext1{0, 1, 4, 5};
32  ci_configuration2 ext1_state(ext1);
33 
34  n_excited = ext1_state.calculateNumOfExcitations(ref_state);
35  REQUIRE(n_excited == 2);
36 
37  sign = ext1_state.calculateExcitations(ref_state, n_excited, pos, occupied, unoccupied);
38 
39  REQUIRE(n_excited == 2);
40  CHECK(sign == 1.0);
41  CHECK(pos[0] == 2);
42  CHECK(pos[1] == 3);
43  CHECK(occupied[0] == 4);
44  CHECK(occupied[1] == 5);
45  CHECK(unoccupied[0] == 2);
46  CHECK(unoccupied[1] == 3);
47 
48  std::vector<size_t> ext2{0, 1, 2, 6};
49  ci_configuration2 ext2_state(ext2);
50 
51  n_excited = ext2_state.calculateNumOfExcitations(ref_state);
52  REQUIRE(n_excited == 1);
53 
54  sign = ext2_state.calculateExcitations(ref_state, n_excited, pos, occupied, unoccupied);
55 
56  REQUIRE(n_excited == 1);
57  CHECK(sign == 1.0);
58  CHECK(pos[0] == 3);
59  CHECK(occupied[0] == 6);
60  CHECK(unoccupied[0] == 3);
61 
62  std::vector<size_t> ref2{0, 1};
63  ci_configuration2 ref2_state(ref2);
64  std::vector<size_t> ext3{1, 6};
65  ci_configuration2 ext3_state(ext3);
66 
67  sign = ext3_state.calculateExcitations(ref2_state, n_excited, pos, occupied, unoccupied);
68  REQUIRE(n_excited == 1);
69  CHECK(sign == -1.0);
70 
71  sign = ref2_state.calculateExcitations(ext3_state, n_excited, pos, occupied, unoccupied);
72  REQUIRE(n_excited == 1);
73  CHECK(sign == -1.0);
74 }
REQUIRE(std::filesystem::exists(filename))
double sign(double x)
Definition: Standard.h:73
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [16/537]

qmcplusplus::TEST_CASE ( "string_utils_streamToVec"  ,
""  [utilities] 
)

Definition at line 20 of file test_string_utils.cpp.

References CHECK(), and REQUIRE().

21 {
22  { // empty string
23  std::string test_string("");
24  auto str_vec = convertStrToVec<std::string>(test_string);
25  REQUIRE(str_vec.size() == 0);
26  }
27 
28  { // whitespace string
29  std::string test_string(" ");
30  auto str_vec = convertStrToVec<std::string>(test_string);
31  REQUIRE(str_vec.size() == 0);
32  }
33 
34  {
35  std::string test_string("abc def 123");
36  auto str_vec = convertStrToVec<std::string>(test_string);
37  REQUIRE(str_vec.size() == 3);
38  CHECK(str_vec[0] == "abc");
39  CHECK(str_vec[1] == "def");
40  CHECK(str_vec[2] == "123");
41 
42  // won't work with int
43  CHECK_THROWS_WITH(convertStrToVec<int>(test_string),
44  Catch::Matchers::Contains("Error parsing string 'abc def 123' for type (type_info::name) i."));
45  }
46 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [17/537]

qmcplusplus::TEST_CASE ( "makeRefVector"  ,
""  [type_traits] 
)

Definition at line 20 of file test_template_types.cpp.

References CHECK(), is_same(), and qmcplusplus::Units::time::s.

21 {
22  struct Dummy
23  {
24  double d;
25  std::string s;
26  };
27 
28  struct DerivedDummy : Dummy
29  {
30  float f;
31  };
32 
33  std::vector<DerivedDummy> ddvec;
34  for (int i = 0; i < 3; ++i)
35  ddvec.push_back(DerivedDummy());
36 
37  auto bdum = makeRefVector<Dummy>(ddvec);
38  auto bdum2 = makeRefVector<Dummy>(ddvec);
39  CHECK(std::is_same<RefVector<Dummy>, decltype(bdum2)>::value);
40 
41  auto bdum3 = makeRefVector<decltype(ddvec)::value_type>(ddvec);
42 }
bool is_same(const xmlChar *a, const char *b)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [18/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A Ewald2D square"  ,
""  [hamiltonian] 
)

Definition at line 20 of file test_ewald2d.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, ParticleSet::setName(), LRCoulombSingleton::STRICT2D, LRCoulombSingleton::this_lr_type, and ParticleSet::update().

21 {
22  LRCoulombSingleton::CoulombHandler = 0;
23  LRCoulombSingleton::this_lr_type = LRCoulombSingleton::STRICT2D;
24  const double vmad_sq = -1.95013246;
25  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
26  lattice.BoxBConds = true; // periodic
27  lattice.ndim = 2;
28  lattice.R.diagonal(1.0);
29  lattice.LR_dim_cutoff = 30.0;
30  lattice.reset();
31 
32  const SimulationCell simulation_cell(lattice);
33  ParticleSet elec(simulation_cell);
34  elec.setName("e");
35  elec.create({1});
36  elec.R[0] = {0.0, 0.0, 0.0};
37 
38  SpeciesSet& tspecies = elec.getSpeciesSet();
39  int upIdx = tspecies.addSpecies("u");
40  int chargeIdx = tspecies.addAttribute("charge");
41  int massIdx = tspecies.addAttribute("mass");
42  tspecies(chargeIdx, upIdx) = -1;
43  tspecies(massIdx, upIdx) = 1.0;
44 
45  elec.createSK();
46  elec.update();
47 
48  CoulombPBCAA caa = CoulombPBCAA(elec, true, false, false);
49 
50  double val = caa.evaluate(elec);
51  CHECK(val == Approx(vmad_sq));
52 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [19/537]

qmcplusplus::TEST_CASE ( "EwaldRef"  ,
""  [hamiltonian] 
)

Definition at line 20 of file test_EwaldRef.cpp.

References qmcplusplus::Units::distance::A, CHECK(), and qmcplusplus::ewaldref::ewaldEnergy().

21 {
22  SECTION("diamondC_2x1x1")
23  {
27 
28  A = {6.7463223, 6.7463223, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
29 
30  const int num_centers = 4;
31  R.resize(num_centers);
32  Q.resize(num_centers, 4);
33 
34  R[0] = {0.0, 0.0, 0.0};
35  R[1] = {1.68658058, 1.68658058, 1.68658058};
36  R[2] = {3.37316115, 3.37316115, 0.0};
37  R[3] = {5.05974173, 5.05974173, 1.68658058};
38 
39  auto Vii_ref = ewaldref::ewaldEnergy(A, R, Q);
40  CHECK(Approx(Vii_ref) == -25.551326969);
41  }
42 
43  SECTION("diamondC_2x1x1 fake 5 ions")
44  {
48 
49  A = {6.7463223, 6.7463223, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
50 
51  const int num_centers = 5;
52  R.resize(num_centers);
53  Q.resize(num_centers, 4);
54 
55  R[0] = {0.0, 0.0, 0.0};
56  R[1] = {1.68658058, 1.68658058, 1.68658058};
57  R[2] = {3.37316115, 3.37316115, 0.0};
58  R[3] = {5.05974173, 5.05974173, 1.68658058};
59  R[4] = {5.05974173, 3.37316115, 0.0};
60 
61  auto Vii_ref = ewaldref::ewaldEnergy(A, R, Q);
62  CHECK(Approx(Vii_ref) == -30.9149928426);
63  }
64 
65  SECTION("32 H2O particle outside the box")
66  {
70 
71  A = {19.09677861, 0.0, 0.0, 0.0, 19.09677861, 0.0, 0.0, 0.0, 19.09677861};
72 
73 
74  const int num_centers = 96;
75  R.resize(num_centers);
76  Q.resize(num_centers, 1);
77  for (int i = 0; i < 32; i++)
78  Q[i] = 6;
79 
80  R[0] = {24.26616224, 34.23786910, -19.88728885};
81  R[1] = {32.99764184, 4.89042226, 1.78485767};
82  R[2] = {-15.27579016, 6.65758075, 38.82499031};
83  R[3] = {22.42481310, 11.92337821, -7.60669570};
84  R[4] = {10.09818623, -36.83076232, 19.09171414};
85  R[5] = {-11.23287228, 13.50815924, 31.73549375};
86  R[6] = {10.92768151, 24.86633926, 5.76944727};
87  R[7] = {-9.78708061, -29.22574847, -17.44821933};
88  R[8] = {-6.13987138, -55.38050301, 14.01883883};
89  R[9] = {29.88923132, -31.53574970, 35.33598895};
90  R[10] = {1.56789254, 17.86637793, -32.73459196};
91  R[11] = {34.80913331, 3.65144222, 9.38999246};
92  R[12] = {31.77272136, 32.05504644, 0.27278764};
93  R[13] = {-30.27341264, -39.32009856, 23.29068561};
94  R[14] = {35.83412076, 27.63459907, -1.26540786};
95  R[15] = {-10.87943680, 19.57945246, 13.17998940};
96  R[16] = {-49.64178269, -16.61639968, -11.19560688};
97  R[17] = {-18.60134911, 26.58693490, 31.83659410};
98  R[18] = {-7.11236224, -4.03040790, -14.07090078};
99  R[19] = {20.17679489, -3.46141136, -4.44342644};
100  R[20] = {4.56091071, 11.36220514, -16.19497185};
101  R[21] = {1.01714887, 38.91116182, -8.61870074};
102  R[22] = {6.32924084, 24.01974195, 15.37836450};
103  R[23] = {16.24028749, 10.66064431, 42.29377160};
104  R[24] = {-4.79620051, 8.82201637, 27.72832949};
105  R[25] = {14.76737825, 16.42141774, -3.33612251};
106  R[26] = {12.32262065, 48.53912749, 13.07764183};
107  R[27] = {32.35702468, 53.07692686, 10.72873114};
108  R[28] = {1.07544125, 32.48798270, 26.25604386};
109  R[29] = {23.46321761, 24.58760466, 10.48820680};
110  R[30] = {-0.36077140, 1.66652869, 38.94706662};
111  R[31] = {-23.26460739, -0.01549386, 5.84212613};
112  R[32] = {23.12061026, 34.20139738, -21.54098818};
113  R[33] = {25.71709396, 35.41932587, -20.30737496};
114  R[34] = {32.34058406, 4.98169603, 3.41910039};
115  R[35] = {34.23881396, 3.52021963, 1.85762346};
116  R[36] = {-16.89611694, 7.01972787, 37.90563855};
117  R[37] = {-15.44556316, 5.09009072, 39.54044062};
118  R[38] = {21.69575675, 12.50539496, -9.29422114};
119  R[39] = {23.01100614, 10.18061608, -8.16520426};
120  R[40] = {9.64824243, -36.16879126, 17.52365719};
121  R[41] = {11.76927104, -35.90555241, 19.85176199};
122  R[42] = {-12.91138372, 13.13055416, 31.33014750};
123  R[43] = {-10.51838573, 15.20947967, 31.45713709};
124  R[44] = {11.74992025, 26.05252035, 6.83177571};
125  R[45] = {10.06245150, 23.90673633, 7.06776471};
126  R[46] = {-11.38983293, -28.87482633, -16.90048221};
127  R[47] = {-9.53954539, -30.85828288, -16.37814301};
128  R[48] = {-5.28280499, -56.90059871, 14.29589158};
129  R[49] = {-6.34785464, -54.53220495, 15.61287951};
130  R[50] = {30.43498423, -30.47429053, 34.19138183};
131  R[51] = {28.79111146, -30.62452376, 36.34283503};
132  R[52] = {3.13093605, 17.57864822, -33.46648289};
133  R[53] = {1.80647236, 18.35957755, -30.90609295};
134  R[54] = {33.81438147, 3.51511737, 10.72884453};
135  R[55] = {36.42957346, 2.91758597, 10.24448882};
136  R[56] = {30.42780327, 30.93406090, 0.87568775};
137  R[57] = {32.79128374, 30.78533945, -1.03389184};
138  R[58] = {-29.69458953, -38.26714316, 21.99376657};
139  R[59] = {-28.86462181, -40.40102190, 23.51121665};
140  R[60] = {36.71076471, 27.30559775, -2.81622106};
141  R[61] = {34.26640396, 26.73301073, -1.26900023};
142  R[62] = {-11.52912465, 20.45741922, 14.45016882};
143  R[63] = {-9.10093995, 20.61124293, 13.03026640};
144  R[64] = {-49.34339494, -18.22820379, -12.45131100};
145  R[65] = {-49.56260317, -17.21553735, -9.34201231};
146  R[66] = {-17.19834084, 26.24035913, 31.22659050};
147  R[67] = {-18.92504030, 28.31660123, 31.41764182};
148  R[68] = {-7.14036799, -3.82826389, -15.73108188};
149  R[69] = {-5.62450527, -2.61343455, -13.47412527};
150  R[70] = {21.17457029, -4.96871361, -5.39550826};
151  R[71] = {18.32229325, -3.88765798, -4.78556136};
152  R[72] = {4.79809024, 12.59595064, -17.41898526};
153  R[73] = {4.16523985, 10.11729136, -17.19852981};
154  R[74] = {2.05683461, 40.37683341, -8.69740783};
155  R[75] = {0.68774693, 38.51526420, -6.82102317};
156  R[76] = {5.61021894, 24.83648159, 16.74378612};
157  R[77] = {8.04554680, 24.11120470, 14.94801717};
158  R[78] = {16.46450349, 9.58389726, 40.56712883};
159  R[79] = {15.21996765, 11.84690099, 41.50821245};
160  R[80] = {-4.28433040, 9.40845508, 26.07368529};
161  R[81] = {-3.68044951, 7.39886362, 27.87667299};
162  R[82] = {13.85105004, 15.06287472, -2.04540177};
163  R[83] = {14.57808438, 15.47487281, -5.04968838};
164  R[84] = {10.70881343, 49.55504426, 12.80342367};
165  R[85] = {12.59744352, 47.50941572, 11.51291080};
166  R[86] = {32.33170235, 51.27639580, 11.02301820};
167  R[87] = {32.17825658, 53.42766003, 8.99734516};
168  R[88] = {0.52424026, 31.64270820, 24.77015220};
169  R[89] = {0.82794193, 34.25468766, 25.37769915};
170  R[90] = {24.21797422, 23.99064017, 8.99006972};
171  R[91] = {24.04997757, 24.10648038, 11.99720981};
172  R[92] = {-0.60767545, 0.82025264, 37.32228009};
173  R[93] = {0.85953248, 0.69664754, 40.03347017};
174  R[94] = {-22.87267819, 0.93691110, 7.30758985};
175  R[95] = {-21.48731996, 0.09036670, 5.18794074};
176 
177  auto Vii_ref = ewaldref::ewaldEnergy(A, R, Q);
178  CHECK(Approx(Vii_ref) == -210.2521866119);
179  }
180 }
std::vector< real_t > ChargeArray
Type for lists of particle charges.
Definition: EwaldRef.h:54
Tensor< real_t, DIM > RealMat
Type for floating point matrices of shape DIM,DIM.
Definition: EwaldRef.h:50
real_t ewaldEnergy(const RealMat &a, const PosArray &R, const ChargeArray &Q, real_t tol)
Compute the total Ewald potential energy for a collection of charges.
Definition: EwaldRef.cpp:337
std::vector< RealVec > PosArray
Type for lists of particle positions.
Definition: EwaldRef.h:52
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [20/537]

qmcplusplus::TEST_CASE ( "NonLocalTOperator"  ,
""  [hamiltonian] 
)

Definition at line 20 of file test_NonLocalTOperator.cpp.

References CHECK(), NonLocalTOperator::groupByElectron(), REQUIRE(), NonLocalTOperator::selectMove(), and NonLocalTOperator::thingsThatShouldBeInMyConstructor().

21 {
23  NonLocalTOperator t_op;
24  t_op.thingsThatShouldBeInMyConstructor("v0", 1.0, 0.0, 0.0);
25 
26  std::vector<NonLocalData> Txy;
27  Txy.emplace_back(0, 0.4, PosType(0.1, 0.2, 0.3));
28  Txy.emplace_back(1, -0.4, PosType(0.2, 0.3, 0.1));
29  Txy.emplace_back(1, -0.3, PosType(0.2, 0.1, 0.3));
30  Txy.emplace_back(2, -0.2, PosType(0.3, 0.1, 0.2));
31  Txy.emplace_back(2, -0.1, PosType(0.3, 0.1, 0.2));
32  Txy.emplace_back(3, 0.0, PosType(0.3, 0.2, 0.1));
33 
34  auto select0 = t_op.selectMove(0.0, Txy);
35  CHECK(select0 == nullptr);
36 
37  auto select1 = t_op.selectMove(0.4, Txy);
38  CHECK(select1 == nullptr);
39 
40  auto select2 = t_op.selectMove(0.5, Txy);
41  REQUIRE(select2 != nullptr);
42  CHECK(select2->PID == 1);
43 
44  auto select3 = t_op.selectMove(0.6, Txy);
45  REQUIRE(select3 != nullptr);
46  CHECK(select3->PID == 1);
47 
48  auto select4 = t_op.selectMove(0.85, Txy);
49  REQUIRE(select4 != nullptr);
50  CHECK(select4->PID == 2);
51 
52  auto select5 = t_op.selectMove(0.9, Txy);
53  REQUIRE(select5 != nullptr);
54  CHECK(select5->PID == 2);
55 
56  auto select6 = t_op.selectMove(float(1) - std::numeric_limits<float>::epsilon(), Txy);
57  REQUIRE(select6 != nullptr);
58  CHECK(select6->PID == 2);
59 
60  t_op.groupByElectron(4, Txy);
61 
62  auto select7 = t_op.selectMove(0.7, 1);
63  REQUIRE(select7 != nullptr);
64  CHECK(select7->Weight == Approx(-0.4));
65 
66  auto select8 = t_op.selectMove(0.7, 2);
67  REQUIRE(select8 == nullptr);
68 
69  auto select9 = t_op.selectMove(0.8, 2);
70  REQUIRE(select9 != nullptr);
71  CHECK(select9->Weight == Approx(-0.2));
72 }
QMCTraits::PosType PosType
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [21/537]

qmcplusplus::TEST_CASE ( "UtilityFunctions OpenMP"  ,
""  [concurrency] 
)

Definition at line 20 of file test_UtilityFunctionsOPENMP.cpp.

References CHECK(), and omp_set_num_threads().

21 {
22  const int old_threads = maxCapacity<Executor::OPENMP>();
23 #ifdef _OPENMP
24  {
25  OverrideMaxCapacity<Executor::OPENMP> lock(97);
26  CHECK(maxCapacity<Executor::OPENMP>() == 97);
27  {
28  ThreadCountProtector<Executor::OPENMP> protector;
30  CHECK(maxCapacity<Executor::OPENMP>() == 17);
31  }
32  CHECK(maxCapacity<Executor::OPENMP>() == 97);
33 
34  {
35  OverrideMaxCapacity<Executor::OPENMP> lock(37);
36  CHECK(maxCapacity<Executor::OPENMP>() == 37);
37  }
38  CHECK(maxCapacity<Executor::OPENMP>() == 97);
39  }
40 #endif
41  CHECK(maxCapacity<Executor::OPENMP>() == old_threads);
42 }
void omp_set_num_threads(int num_threads)
Definition: OpenMP.h:31
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [22/537]

qmcplusplus::TEST_CASE ( "ConstantSizeMatrix basics"  ,
""  [containers] 
)

Definition at line 20 of file test_ConstantSizeMatrix.cpp.

References ConstantSizeMatrix< T, ALLOC >::capacity(), CHECK(), ConstantSizeMatrix< T, ALLOC >::resize(), and ConstantSizeMatrix< T, ALLOC >::size().

21 {
22  ConstantSizeMatrix<double> cmat(1, 9, 1, 32, 0.0);
23  CHECK(cmat.size() == 9);
24  CHECK(cmat.capacity() == 32);
25 
26  CHECK_NOTHROW(cmat.resize(1, 16));
27  CHECK(cmat.size() == 16);
28  CHECK(cmat.capacity() == 32);
29 
30  CHECK_THROWS(cmat.resize(1, 33));
31  CHECK_THROWS(cmat.resize(34, 2));
32 
33  CHECK_NOTHROW(cmat.resize(2, 9));
34  CHECK(cmat.capacity() == 32);
35 
36  CHECK_NOTHROW(cmat.resize(3, 9));
37  CHECK(cmat.capacity() == 32);
38 
39  //note the odd OhmmsMatrix style access operator semantics
40  //If these break you probably breaking other weird QMCPACK code.
41  std::vector<double> svec(16, 1.0);
42  cmat = svec;
43  double& matrices_d = cmat(0);
44  CHECK(matrices_d == Approx(1.0));
45  matrices_d = 4.0;
46  CHECK(cmat(0) == Approx(4.0));
47  CHECK(*(cmat[0]) == Approx(4.0));
48 
49  ConstantSizeMatrix<double> cmat2(2, 8, 2, 16, 0.0);
50  std::vector<double> svec2(16, 2.0);
51  svec.insert(svec.end(), svec2.begin(), svec2.end());
52  cmat2 = svec;
53  CHECK(*(cmat2[0]) == Approx(1.0));
54  CHECK(*(cmat2[0] + 1) == Approx(1.0));
55  CHECK(*(cmat2[1]) == Approx(2.0));
56 
57  ConstantSizeMatrix<double> cmat3(4, 32, 4, 32, 0.0);
58  CHECK_NOTHROW(cmat3.resize(2, 64));
59  CHECK(cmat3.size() == 128);
60  CHECK(cmat3.capacity() == 128);
61 
62  CHECK_NOTHROW(cmat3.resize(8, 16));
63  CHECK(cmat3.size() == 128);
64  CHECK(cmat3.capacity() == 128);
65 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [23/537]

qmcplusplus::TEST_CASE ( "RecordArray basics"  ,
""  [containers] 
)

Definition at line 20 of file test_RecordArray.cpp.

References CHECK(), RecordArray< T >::getNumOfEntries(), RecordArray< T >::getNumOfParams(), REQUIRE(), and RecordArray< T >::resize().

21 {
22  RecordArray<double> records;
23 
24  int nentry = 1;
25  int nparam = 2;
26  records.resize(nentry, nparam);
27 
28  records[0][0] = 1.1;
29  records[0][1] = 1.2;
30 
31  REQUIRE(records.getNumOfParams() == 2);
32  REQUIRE(records.getNumOfEntries() == 1);
33 
34  CHECK(records[0][0] == Approx(1.1));
35  CHECK(records[0][1] == Approx(1.2));
36 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [24/537]

qmcplusplus::TEST_CASE ( "kcontainer at gamma in 3D"  ,
""  [longrange] 
)

Definition at line 20 of file test_kcontainer.cpp.

References CHECK(), qmcplusplus::Units::charge::e, KContainer::kpts, KContainer::kpts_cart, lattice, sqrt(), and KContainer::updateKLists().

21 {
22  const int ndim = 3;
23  const double alat = 1.0;
24  const double blat = 2 * M_PI / alat;
25 
26  // check first 3 shells of kvectors
27  const std::vector<double> kcs = {blat, std::sqrt(2) * blat, std::sqrt(3) * blat};
28  const std::vector<int> nks = {6, 18, 26};
29 
30  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
31  lattice.R.diagonal(1.0);
32  lattice.set(lattice.R); // compute Rv and Gv from R
33 
34  KContainer klists;
35  for (int ik = 0; ik < kcs.size(); ik++)
36  {
37  const double kc = kcs[ik] + 1e-6;
38  klists.updateKLists(lattice, kc, ndim);
39  CHECK(klists.kpts.size() == nks[ik]);
40  }
41  const int mxk = klists.kpts.size();
42  int gvecs[26][3] = {{-1, 0, 0}, {0, -1, 0}, {0, 0, -1}, {0, 0, 1}, {0, 1, 0}, {1, 0, 0}, {-1, -1, 0},
43  {-1, 0, -1}, {-1, 0, 1}, {-1, 1, 0}, {0, -1, -1}, {0, -1, 1}, {0, 1, -1}, {0, 1, 1},
44  {1, -1, 0}, {1, 0, -1}, {1, 0, 1}, {1, 1, 0}, {-1, -1, -1}, {-1, -1, 1}, {-1, 1, -1},
45  {-1, 1, 1}, {1, -1, -1}, {1, -1, 1}, {1, 1, -1}, {1, 1, 1}};
46 
47  for (int ik = 0; ik < mxk; ik++)
48  {
49  for (int ldim = 0; ldim < ndim; ldim++)
50  {
51  CHECK(klists.kpts[ik][ldim] == gvecs[ik][ldim]);
52  CHECK(klists.kpts[ik][ldim] * blat == Approx(klists.kpts_cart[ik][ldim]));
53  }
54  }
55 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [25/537]

qmcplusplus::TEST_CASE ( "Aligned allocator"  ,
""  [numerics] 
)

Definition at line 21 of file test_aligned_allocator.cpp.

References REQUIRE().

22 {
23  bool not_aligned;
24 
25  aligned_vector<float> a(311);
26  std::cout << "address=" << a.data() << " require=" << (void*)(QMC_SIMD_ALIGNMENT - 1) << std::endl;
27  not_aligned = (size_t)a.data() & (QMC_SIMD_ALIGNMENT - 1);
28  REQUIRE(!not_aligned);
29  a.resize(829);
30  std::cout << "address=" << a.data() << " require=" << (void*)(QMC_SIMD_ALIGNMENT - 1) << std::endl;
31  not_aligned = (size_t)a.data() & (QMC_SIMD_ALIGNMENT - 1);
32  REQUIRE(!not_aligned);
33 
34  aligned_vector<double> b(311);
35  std::cout << "address=" << b.data() << " require=" << (void*)(QMC_SIMD_ALIGNMENT - 1) << std::endl;
36  not_aligned = (size_t)b.data() & (QMC_SIMD_ALIGNMENT - 1);
37  REQUIRE(!not_aligned);
38  b.resize(829);
39  std::cout << "address=" << b.data() << " require=" << (void*)(QMC_SIMD_ALIGNMENT - 1) << std::endl;
40  not_aligned = (size_t)b.data() & (QMC_SIMD_ALIGNMENT - 1);
41  REQUIRE(!not_aligned);
42 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [26/537]

qmcplusplus::TEST_CASE ( "OMP runtime memory"  ,
""  [OMP] 
)

Definition at line 21 of file test_runtime_mem.cpp.

References print_mem().

22 {
23  PRAGMA_OFFLOAD("omp target")
24  {
25  // intentional empty target to initialize offload runtime library.
26  }
27 
28  print_mem("OMP runtime memory", std::cout);
29 }
void print_mem(const std::string &title, std::ostream &log)
Definition: MemoryUsage.cpp:30

◆ TEST_CASE() [27/537]

qmcplusplus::TEST_CASE ( "SpaceGridInputs::parseXML::valid"  ,
""  [estimators] 
)

Definition at line 21 of file test_SpaceGridInput.cpp.

References doc, Libxml2Document::getRoot(), makeSpaceGridInput(), node, okay, Libxml2Document::parseFromString(), and ValidSpinDensityInput::xml.

22 {
24  for (auto input_xml : input::xml)
25  {
27  bool okay = doc.parseFromString(input_xml);
28  xmlNodePtr node = doc.getRoot();
29 
30  // Will throw if input is invalid.
31  SpaceGridInput spi(node);
32  std::string value_label;
33  auto wrapped_spi = makeSpaceGridInput(node, value_label);
34  }
35 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
std::any makeSpaceGridInput(xmlNodePtr cur, std::string &value_label)
factory function for a SpaceGridInput
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
testing::ValidSpinDensityInput input

◆ TEST_CASE() [28/537]

qmcplusplus::TEST_CASE ( "VMCDriverInput readXML"  ,
""  [drivers] 
)

Definition at line 21 of file test_VMCDriverInput.cpp.

References doc, VMCDriverInput::get_use_drift(), Libxml2Document::getRoot(), node, okay, Libxml2Document::parseFromString(), VMCDriverInput::readXML(), REQUIRE(), qmcplusplus::testing::valid_vmc_input_sections, and qmcplusplus::testing::valid_vmc_input_vmc_batch_index.

22 {
23  auto xml_test = [](const char* driver_xml) {
25  bool okay = doc.parseFromString(driver_xml);
26  REQUIRE(okay);
27  xmlNodePtr node = doc.getRoot();
28  VMCDriverInput vmcdriver_input;
29  vmcdriver_input.readXML(node);
30  REQUIRE(vmcdriver_input.get_use_drift() == false);
31  };
32 
34  testing::valid_vmc_input_sections.end(), xml_test);
35 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
constexpr int valid_vmc_input_vmc_batch_index
REQUIRE(std::filesystem::exists(filename))
constexpr std::array< const char *, 4 > valid_vmc_input_sections
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [29/537]

qmcplusplus::TEST_CASE ( "MCCoords"  ,
""  [Particle] 
)

Definition at line 21 of file test_MCCoords.cpp.

References CHECK(), POS, POS_SPIN, and REQUIRE().

22 {
23  {
24  constexpr auto mct = CoordsType::POS;
25  auto mc_coords = MCCoords<mct>(3);
26  REQUIRE(mc_coords.positions.size() == 3);
27 
28  QMCTraits::PosType p1({0.1, 0.2, 0.3});
29  QMCTraits::PosType p2({0.4, 0.5, 0.6});
30  QMCTraits::PosType p3({0.7, 0.8, 0.9});
31  QMCTraits::PosType p4({-1.0, -1.0, -1.0});
32 
33  mc_coords.positions = {p1, p2, p3};
34  auto shift_coords = MCCoords<mct>(3);
35  shift_coords.positions = {p4, p4, p4};
36  mc_coords += shift_coords;
37  CHECK(Approx(mc_coords.positions[0][0]) == -0.9);
38  CHECK(Approx(mc_coords.positions[0][1]) == -0.8);
39  CHECK(Approx(mc_coords.positions[0][2]) == -0.7);
40  CHECK(Approx(mc_coords.positions[1][0]) == -0.6);
41  CHECK(Approx(mc_coords.positions[1][1]) == -0.5);
42  CHECK(Approx(mc_coords.positions[1][2]) == -0.4);
43  CHECK(Approx(mc_coords.positions[2][0]) == -0.3);
44  CHECK(Approx(mc_coords.positions[2][1]) == -0.2);
45  CHECK(Approx(mc_coords.positions[2][2]) == -0.1);
46 
47  auto shift_coords2 = MCCoords<mct>(3);
48  shift_coords2.positions = {-p4, -p4, -p4};
49  mc_coords += shift_coords2;
50  CHECK(Approx(mc_coords.positions[0][0]) == 0.1);
51  CHECK(Approx(mc_coords.positions[0][1]) == 0.2);
52  CHECK(Approx(mc_coords.positions[0][2]) == 0.3);
53  CHECK(Approx(mc_coords.positions[1][0]) == 0.4);
54  CHECK(Approx(mc_coords.positions[1][1]) == 0.5);
55  CHECK(Approx(mc_coords.positions[1][2]) == 0.6);
56  CHECK(Approx(mc_coords.positions[2][0]) == 0.7);
57  CHECK(Approx(mc_coords.positions[2][1]) == 0.8);
58  CHECK(Approx(mc_coords.positions[2][2]) == 0.9);
59 
60  MCCoords<mct> subset(1);
61  mc_coords.getSubset(1, 1, subset);
62  REQUIRE(subset.positions.size() == 1);
63  CHECK(Approx(subset.positions[0][0]) == 0.4);
64  CHECK(Approx(subset.positions[0][1]) == 0.5);
65  CHECK(Approx(subset.positions[0][2]) == 0.6);
66  }
67  {
68  constexpr auto mct = CoordsType::POS_SPIN;
69  auto mc_coords = MCCoords<mct>(3);
70  REQUIRE(mc_coords.positions.size() == 3);
71  REQUIRE(mc_coords.spins.size() == 3);
72 
73  mc_coords.spins = {0.1, 0.2, 0.3};
74  auto shift_coords = MCCoords<mct>(3);
75  shift_coords.spins = {1.0, 1.0, 1.0};
76  mc_coords += shift_coords;
77  CHECK(Approx(mc_coords.spins[0]) == 1.1);
78  CHECK(Approx(mc_coords.spins[1]) == 1.2);
79  CHECK(Approx(mc_coords.spins[2]) == 1.3);
80 
81  auto shift_coords2 = MCCoords<mct>(3);
82  shift_coords2.spins = {-1.0, -1.0, -1.0};
83  mc_coords += shift_coords2;
84  CHECK(Approx(mc_coords.spins[0]) == 0.1);
85  CHECK(Approx(mc_coords.spins[1]) == 0.2);
86  CHECK(Approx(mc_coords.spins[2]) == 0.3);
87 
88  MCCoords<mct> subset(1);
89  mc_coords.getSubset(2, 1, subset);
90  REQUIRE(subset.spins.size() == 1);
91  CHECK(Approx(subset.spins[0]) == 0.3);
92  }
93 }
QMCTraits::PosType PosType
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [30/537]

qmcplusplus::TEST_CASE ( "ModernStringUtils_strToLower"  ,
""  [utilities] 
)

Definition at line 21 of file test_ModernStringUtils.cpp.

References CHECK(), and lowerCase().

22 {
23  std::string test_string("IamAMixedCaseTest_String");
24  std::string lcase_string = lowerCase(test_string);
25  CHECK(lcase_string == "iamamixedcasetest_string");
26  std::string i_am_not_just_ascii{"\xab"
27  "not_Just_ASCII"};
28  // very imcomplete check if we are in a c locale that clobbers char beyond ASII
29  // \todo If you know C locales well is this ever a worry?
30  i_am_not_just_ascii = lowerCase(i_am_not_just_ascii);
31  CHECK(i_am_not_just_ascii ==
32  "\xab"
33  "not_just_ascii");
34 }
std::string lowerCase(const std::string_view s)
++17
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [31/537]

qmcplusplus::TEST_CASE ( "ConstantSPOSet"  ,
""  [wavefunction] 
)

Definition at line 21 of file test_ConstantSPOSet.cpp.

References CHECK(), CHECKED_ELSE(), checkMatrix(), ParticleSet::create(), OHMMS_DIM, and Matrix< T, Alloc >::resize().

22 {
23  //For now, do a small square case.
24  const int nelec = 2;
25  const int norb = 2;
26  using WF = WaveFunctionTypes<QMCTraits::ValueType, QMCTraits::FullPrecValueType>;
27  using Real = WF::Real;
28  using Value = WF::Value;
29  using Grad = WF::Grad;
30  using ValueVector = Vector<Value>;
31  using GradVector = Vector<Grad>;
32  using ValueMatrix = Matrix<Value>;
33  using GradMatrix = Matrix<Grad>;
34 
35  ValueVector row0{Value(0.92387953), Value(0.92387953)};
36  ValueVector row1{Value(0.29131988), Value(0.81078057)};
37 
38  GradVector grow0{Grad({-2.22222, -1.11111, 0.33333}), Grad({8.795388, -0.816057, -0.9238793})};
39  GradVector grow1{Grad({2.22222, 1.11111, -0.33333}), Grad({-8.795388, 0.816057, 0.9238793})};
40 
41  ValueVector lrow0{Value(-0.2234545), Value(0.72340234)};
42  ValueVector lrow1{Value(-12.291810), Value(6.879057)};
43 
44 
45  ValueMatrix spomat;
46  GradMatrix gradspomat;
47  ValueMatrix laplspomat;
48 
49  spomat.resize(nelec, norb);
50  gradspomat.resize(nelec, norb);
51  laplspomat.resize(nelec, norb);
52 
53  for (int iorb = 0; iorb < norb; iorb++)
54  {
55  spomat(0, iorb) = row0[iorb];
56  spomat(1, iorb) = row1[iorb];
57 
58  gradspomat(0, iorb) = grow0[iorb];
59  gradspomat(1, iorb) = grow1[iorb];
60 
61  laplspomat(0, iorb) = lrow0[iorb];
62  laplspomat(1, iorb) = lrow1[iorb];
63  }
64 
65 
66  const SimulationCell simulation_cell;
67  ParticleSet elec(simulation_cell);
68 
69  elec.create({nelec});
70 
71  ValueVector psiV = {0.0, 0.0};
72  ValueVector psiL = {0.0, 0.0};
73  GradVector psiG;
74  psiG.resize(norb);
75 
76  //Test of value only constructor.
77  auto sposet = std::make_unique<ConstantSPOSet>("constant_spo", nelec, norb);
78  sposet->setRefVals(spomat);
79  sposet->setRefEGrads(gradspomat);
80  sposet->setRefELapls(laplspomat);
81 
82  sposet->evaluateValue(elec, 0, psiV);
83 
84  CHECK(psiV[0] == row0[0]);
85  CHECK(psiV[1] == row0[1]);
86 
87 
88  psiV = 0.0;
89 
90  sposet->evaluateValue(elec, 1, psiV);
91  CHECK(psiV[0] == row1[0]);
92  CHECK(psiV[1] == row1[1]);
93 
94  psiV = 0.0;
95 
96  sposet->evaluateVGL(elec, 1, psiV, psiG, psiL);
97 
98  for (int iorb = 0; iorb < norb; iorb++)
99  {
100  CHECK(psiV[iorb] == row1[iorb]);
101  CHECK(psiL[iorb] == lrow1[iorb]);
102 
103  for (int idim = 0; idim < OHMMS_DIM; idim++)
104  CHECK(psiG[iorb][idim] == grow1[iorb][idim]);
105  }
106  //Test of evaluate_notranspose.
107  ValueMatrix phimat, lphimat;
108  GradMatrix gphimat;
109  phimat.resize(nelec, norb);
110  gphimat.resize(nelec, norb);
111  lphimat.resize(nelec, norb);
112 
113  const int first_index = 0; //Only 2 electrons in this case.
114  const int last_index = 2;
115  sposet->evaluate_notranspose(elec, first_index, last_index, phimat, gphimat, lphimat);
116 
117  auto check = checkMatrix(phimat, spomat);
118  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
119  check = checkMatrix(lphimat, laplspomat);
120  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
121 
122  //Test of makeClone()
123  auto sposet_vgl2 = sposet->makeClone();
124  phimat = 0.0;
125  gphimat = 0.0;
126  lphimat = 0.0;
127 
128  sposet_vgl2->evaluate_notranspose(elec, first_index, last_index, phimat, gphimat, lphimat);
129 
130  check = checkMatrix(phimat, spomat);
131  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
132  check = checkMatrix(lphimat, laplspomat);
133  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
134 
135  //Lastly, check if name is correct.
136  std::string myname = sposet_vgl2->getClassName();
137  std::string targetstring("ConstantSPOSet");
138  CHECK(myname == targetstring);
139 }
CHECKED_ELSE(check_matrix_result.result)
OrbitalSetTraits< ValueType >::ValueVector ValueVector
#define OHMMS_DIM
Definition: config.h:64
ForceBase::Real Real
Definition: ForceBase.cpp:26
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [32/537]

qmcplusplus::TEST_CASE ( "ShortRangeCuspJastrowFunctor"  ,
""  [wavefunction] 
)

Definition at line 22 of file test_short_range_cusp_jastrow.cpp.

References ShortRangeCuspFunctor< T >::A, ShortRangeCuspFunctor< T >::B, CHECK(), ShortRangeCuspFunctor< T >::checkInVariablesExclusive(), OHMMS::Controller, OptimizableFunctorBase::cutoff_radius, doc, ShortRangeCuspFunctor< T >::evaluate(), ShortRangeCuspFunctor< T >::evaluateDerivatives(), Libxml2Document::getRoot(), ShortRangeCuspFunctor< T >::ID_A, ShortRangeCuspFunctor< T >::ID_B, ShortRangeCuspFunctor< T >::ID_R0, VariableSet::name(), ShortRangeCuspFunctor< T >::Opt_A, ShortRangeCuspFunctor< T >::Opt_B, ShortRangeCuspFunctor< T >::Opt_R0, Libxml2Document::parseFromString(), ShortRangeCuspFunctor< T >::put(), ShortRangeCuspFunctor< T >::R0, REQUIRE(), VariableSet::resetIndex(), ShortRangeCuspFunctor< T >::resetParametersExclusive(), and VariableSet::size_of_active().

23 {
25 
27 
28  // prepare xml input to set up the functor
29  const std::string xmltext("<tmp> "
30  " <correlation rcut=\"6\" cusp=\"3\" elementType=\"Li\"> "
31  " <var id=\"LiCuspR0\" name=\"R0\" optimize=\"yes\"> 0.0624 </var>"
32  " <coefficients id=\"LiCuspB\" type=\"Array\" optimize=\"yes\"> "
33  " 0.3 0.2 0.4 "
34  " </coefficients> "
35  " </correlation> "
36  "</tmp> ");
37 
38  // parse the xml input
40  const bool xml_parsed_okay = doc.parseFromString(xmltext);
41  REQUIRE(xml_parsed_okay == true);
42 
43  // get the xml root node pointer
44  xmlNodePtr root = doc.getRoot();
45  REQUIRE(root != NULL);
46 
47  // get the xml pointer to the functor node
48  xmlNodePtr child = root->xmlChildrenNode;
49  while (child != NULL)
50  {
51  if (xmlIsBlankNode(child))
52  child = child->next;
53  else
54  break;
55  }
56  REQUIRE(child != NULL);
57 
58  // prepare the Jastrow factor using the xml input
59  ShortRangeCuspFunctor<RealType> f("test_functor");
60  f.put(child);
61  CHECK(f.A == Approx(3.0));
62  CHECK(f.R0 == Approx(0.0624));
63  CHECK(f.B.at(0) == Approx(0.3));
64  CHECK(f.B.at(1) == Approx(0.2));
65  CHECK(f.B.at(2) == Approx(0.4));
66  REQUIRE(f.Opt_A == false);
67  REQUIRE(f.Opt_R0 == true);
68  REQUIRE(f.Opt_B == true);
69  REQUIRE(f.ID_A == "string_not_set");
70  REQUIRE(f.ID_R0 == "LiCuspR0");
71  REQUIRE(f.ID_B == "LiCuspB");
72  CHECK(f.cutoff_radius == Approx(6.0));
73 
74  // set finite difference displacement parameter
75  const RealType h = 0.0001;
76 
77  // accuracy tolerance depends on floating point precision
78  const RealType eps = (sizeof(RealType) < 6 ? 0.002 : 0.0001);
79 
80  // evaluate a couple ways at a given radius
81  RealType r = 0.04;
82  RealType val = f.evaluate(r);
83  RealType dudr = 10000000.0; // initialize to a wrong value
84  RealType d2udr2 = 15000000.0; // initialize to a wrong value
85  RealType val_2 = f.evaluate(r, dudr, d2udr2);
86 
87  CHECK(val == Approx(-0.1970331287).epsilon(eps));
88  CHECK(val_2 == Approx(-0.1970331287).epsilon(eps));
89  CHECK(val == Approx(val_2));
90 
91  // Finite difference to verify the spatial derivatives
92  RealType r_ph = r + h;
93  RealType r_mh = r - h;
94  RealType dudr_ph = 20000000.0; // initialize to a wrong value
95  RealType dudr_mh = 30000000.0; // initialize to a wrong value
96  RealType d2udr2_ph = 40000000.0; // initialize to a wrong value
97  RealType d2udr2_mh = 50000000.0; // initialize to a wrong value
98  RealType val_ph = f.evaluate(r_ph, dudr_ph, d2udr2_ph);
99  RealType val_mh = f.evaluate(r_mh, dudr_mh, d2udr2_mh);
100  RealType approx_dudr = (val_ph - val_mh) / (2 * h);
101  RealType approx_d2udr2 = (dudr_ph - dudr_mh) / (2 * h);
102  CHECK(dudr == Approx(approx_dudr).epsilon(eps));
103  CHECK(d2udr2 == Approx(approx_d2udr2).epsilon(eps));
104 
105  // currently the d3udr3_3 function is not implemented
106  //RealType dudr_3;
107  //RealType d2udr2_3;
108  //RealType d3udr3_3;
109  //RealType val_3 = f.evaluate(r, dudr_3, d2udr2_3, d3udr3_3);
110  //CHECK(val == Approx(val_3));
111  //CHECK(dudr == Approx(dudr_3));
112  //CHECK(d2udr2 == Approx(d2udr2_3));
113 
114  // Now let's do finite difference checks for the parameter derivatives
115 
116  // Adjust this based on the number of variational parameters
117  const int nparam = 4;
118 
119  // Outer vector is over parameters
120  // Inner (TinyVector) is the parameter derivative of the value, first, and second derivatives.
121  std::vector<TinyVector<RealType, 3>> param_derivs(nparam);
122 
123  f.evaluateDerivatives(r, param_derivs);
124 
125  optimize::VariableSet var_param;
126  f.checkInVariablesExclusive(var_param);
127  var_param.resetIndex();
128  REQUIRE(var_param.size_of_active() == nparam);
129 
130  for (int i = 0; i < nparam; i++)
131  {
132  const std::string var_name = var_param.name(i);
133  const RealType old_param = std::real(var_param[var_name]);
134  //std::cout << "checking parameter " << var_name << std::endl;
135 
136  RealType dudr_h = 10000000.0; // initialize to a wrong value
137  RealType d2udr2_h = 10000000.0; // initialize to a wrong value
138  var_param[var_name] = old_param + h;
139  f.resetParametersExclusive(var_param);
140  RealType val_h = f.evaluate(r, dudr_h, d2udr2_h);
141 
142  RealType dudr_m = 20000000.0; // initialize to a wrong value
143  RealType d2udr2_m = 20000000.0; // initialize to a wrong value
144  var_param[var_name] = old_param - h;
145  f.resetParametersExclusive(var_param);
146  RealType val_m = f.evaluate(r, dudr_m, d2udr2_m);
147 
148  const RealType val_dp = (val_h - val_m) / (2.0 * h);
149  CHECK(val_dp == Approx(param_derivs[i][0]).epsilon(eps));
150 
151  const RealType dudr_dp = (dudr_h - dudr_m) / (2.0 * h);
152  CHECK(dudr_dp == Approx(param_derivs[i][1]).epsilon(eps));
153 
154  const RealType d2udr2_dp = (d2udr2_h - d2udr2_m) / (2.0 * h);
155  CHECK(d2udr2_dp == Approx(param_derivs[i][2]).epsilon(eps));
156 
157  var_param[var_name] = old_param;
158  f.resetParametersExclusive(var_param);
159  }
160 
161  // Could do finite differences to verify the parameter derivatives
162 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
void resetIndex()
reset Index
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
int size_of_active() const
return the number of active variables
Definition: VariableSet.h:78
QMCTraits::RealType RealType
OHMMS_PRECISION real_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
const std::string & name(int i) const
return the name of i-th variable
Definition: VariableSet.h:189

◆ TEST_CASE() [33/537]

qmcplusplus::TEST_CASE ( "UserJastrowFunctor"  ,
""  [wavefunction] 
)

Definition at line 22 of file test_user_jastrow.cpp.

References UserFunctor< T >::A, UserFunctor< T >::B, CHECK(), UserFunctor< T >::checkInVariablesExclusive(), OHMMS::Controller, doc, UserFunctor< T >::evaluate(), UserFunctor< T >::evaluateDerivatives(), Libxml2Document::getRoot(), VariableSet::name(), okay, Libxml2Document::parseFromString(), UserFunctor< T >::put(), REQUIRE(), VariableSet::resetIndex(), UserFunctor< T >::resetParametersExclusive(), UserFunctor< T >::setCusp(), and VariableSet::size_of_active().

23 {
25 
27 
28  UserFunctor<RealType> uf("test_functor");
29 
30  // This may or may not need to be present
31  uf.setCusp(1.0);
32 
33  // Adjust this based on the example XML block
34  const char* xmltext = R"(<tmp>
35  <var name="B" id="j_B">2.0</var>
36  </tmp>)";
37 
39  bool okay = doc.parseFromString(xmltext);
40  REQUIRE(okay);
41 
42  xmlNodePtr root = doc.getRoot();
43  uf.put(root);
44 
45  // Adjust these
46  CHECK(uf.A == Approx(1.0));
47  CHECK(uf.B == Approx(2.0));
48 
49  RealType r = 1.0;
50  RealType val = uf.evaluate(r);
51 
52  RealType dudr;
53  RealType d2udr2;
54  RealType val_2 = uf.evaluate(r, dudr, d2udr2);
55 
56  CHECK(val == Approx(val_2));
57 
58  // Finite difference to verify the spatial derivatives
59 
60  RealType h = 0.01;
61  RealType r_plus_h = r + h;
62  RealType r_minus_h = r - h;
63  RealType val_plus_h = uf.evaluate(r_plus_h);
64  RealType val_minus_h = uf.evaluate(r_minus_h);
65 
66  RealType approx_dudr = (val_plus_h - val_minus_h) / (2 * h);
67  CHECK(dudr == Approx(approx_dudr).epsilon(h));
68 
69  RealType approx_d2udr2 = (val_plus_h + val_minus_h - 2 * val) / (h * h);
70  CHECK(d2udr2 == Approx(approx_d2udr2).epsilon(h));
71 
72 
73  RealType dudr_3;
74  RealType d2udr2_3;
75  RealType d3udr3_3;
76  RealType val_3 = uf.evaluate(r, dudr_3, d2udr2_3, d3udr3_3);
77 
78  CHECK(val == Approx(val_3));
79  CHECK(dudr == Approx(dudr_3));
80  CHECK(d2udr2 == Approx(d2udr2_3));
81 
82 
83  // Adjust this based on the number of variational parameters
84  const int nparam = 1;
85 
86  // Outer vector is over parameters
87  // Inner (TinyVector) is the parameter derivative of the value, first, and second derivatives.
88  std::vector<TinyVector<RealType, 3>> param_derivs(nparam);
89 
90  uf.evaluateDerivatives(r, param_derivs);
91 
92  optimize::VariableSet var_param;
93  uf.checkInVariablesExclusive(var_param);
94  var_param.resetIndex();
95  REQUIRE(var_param.size_of_active() == nparam);
96 
97 
98  for (int i = 0; i < nparam; i++)
99  {
100  std::string var_name = var_param.name(i);
101  RealType old_param = std::real(var_param[var_name]);
102  var_param[var_name] = old_param + h;
103 
104  uf.resetParametersExclusive(var_param);
105 
106  RealType dudr_h;
107  RealType d2udr2_h;
108  RealType val_h = uf.evaluate(r, dudr_h, d2udr2_h);
109 
110  RealType val_dp = (val_h - val) / h;
111  CHECK(val_dp == Approx(param_derivs[i][0]).epsilon(h));
112 
113  RealType dudr_dp = (dudr_h - dudr) / h;
114  CHECK(dudr_dp == Approx(param_derivs[i][1]).epsilon(h));
115 
116  RealType d2udr2_dp = (d2udr2_h - d2udr2) / h;
117  CHECK(d2udr2_dp == Approx(param_derivs[i][2]).epsilon(h));
118 
119  var_param[var_name] = old_param;
120  uf.resetParametersExclusive(var_param);
121  }
122 
123  // Could do finite differences to verify the parameter derivatives
124 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
void resetIndex()
reset Index
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
int size_of_active() const
return the number of active variables
Definition: VariableSet.h:78
QMCTraits::RealType RealType
OHMMS_PRECISION real_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
const std::string & name(int i) const
return the name of i-th variable
Definition: VariableSet.h:189

◆ TEST_CASE() [34/537]

qmcplusplus::TEST_CASE ( "OMPmath"  ,
""  [OMP] 
)

Definition at line 22 of file test_math.cpp.

References qmcplusplus::Units::distance::A, CHECK(), cos(), qmcplusplus::Units::time::s, and sin().

23 {
24  using vec_t = std::vector<double, OMPallocator<double>>;
25  vec_t A(3);
26 
27  // iterator
28  vec_t::iterator ia = A.begin();
29  for (; ia != A.end(); ia++)
30  {
31  *ia = 3.1;
32  }
33 
34  auto* A_ptr = A.data();
35  PRAGMA_OFFLOAD("omp target teams distribute map(always, tofrom:A_ptr[0:2])")
36  for (int i = 0; i < 2; i++)
37  {
38  float s, c, v = 1.2;
39  s = std::sin(i * v);
40  c = std::cos(i * v);
41  //sincos(i*v, &s, &c);
42  A_ptr[i] += s + c;
43  }
44 
45  CHECK(A[0] == Approx(4.1));
46  CHECK(A[1] == Approx(4.3943968404));
47 }
TinyVector< double, 3 > vec_t
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
for(int i=0;i< size_test;++i) CHECK(Approx(gauss_random_vals[offset_for_rs+i])
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [35/537]

qmcplusplus::TEST_CASE ( "SYCL_allocator"  ,
""  [SYCL] 
)

Definition at line 22 of file test_SYCLallocator.cpp.

References CHECK(), Vector< T, Alloc >::data(), getSYCLDefaultDeviceDefaultQueue(), and queue.

23 {
24  // SYCLAllocator
25  sycl::queue m_queue = getSYCLDefaultDeviceDefaultQueue();
26  Vector<double, SYCLAllocator<double>> vec(1024);
27  Vector<double> vec_h(1024);
28 
29  double* V = vec.data();
30  m_queue.parallel_for(sycl::range<1>{1024}, [=](sycl::id<1> item) { V[item] = item + 1; });
31 
32  //copy to host
33  m_queue.memcpy(vec_h.data(), vec.data(), 1024 * sizeof(double)).wait();
34 
35  CHECK(vec_h[0] == 1);
36  CHECK(vec_h[77] == 78);
37 }
sycl::queue & getSYCLDefaultDeviceDefaultQueue()
return a reference to the per-device default queue
Definition: SYCLruntime.cpp:18
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [36/537]

qmcplusplus::TEST_CASE ( "WFOptDriverInput Instantiation"  ,
""  [drivers] 
)

Definition at line 22 of file test_WFOptDriverInput.cpp.

22 { WFOptDriverInput driver_input; }

◆ TEST_CASE() [37/537]

qmcplusplus::TEST_CASE ( "QMCDriverInput Instantiation"  ,
""  [drivers] 
)

Definition at line 22 of file test_QMCDriverInput.cpp.

22 { QMCDriverInput driver_input; }

◆ TEST_CASE() [38/537]

qmcplusplus::TEST_CASE ( "drift pbyp and node correction real ,
""  [drivers][drift] 
)

Definition at line 22 of file test_drift.cpp.

References CHECK(), ParticleSet::create(), ParticleSet::G, ParticleSet::setName(), setScaledDriftPbyPandNodeCorr(), and sqrt().

23 {
24  const SimulationCell simulation_cell;
25  MCWalkerConfiguration elec(simulation_cell);
26 
27  elec.setName("elec");
28  std::vector<int> agroup(1);
29  agroup[0] = 1;
30  elec.create(agroup);
31 
32  ParticleSet::RealType tau = 0.5;
33  ParticleSet::RealType mass = 0.85;
34  std::vector<ParticleSet::RealType> massinv(1, 1. / mass);
35  ParticleSet::ParticlePos drift(1);
36 
37  // check from -xtot/2 to xtot/2 in step size of dx i.e. np.arange(-xtot/2,xtot/2,dx)
38  double xtot = 10.;
39  int nx = 100;
40  double gradx = -xtot / 2.;
41  double dx = xtot / nx;
42 
43  //app_log() << " begin printing" << std::endl;
44  for (int ix = 0; ix < nx; ix++)
45  {
46  elec.G[0][0] = gradx;
47  setScaledDriftPbyPandNodeCorr(tau, massinv, elec.G, drift);
48  double dval = drift[0][0];
49 
50  double scale_factor = (-1. + std::sqrt(1. + 2. * gradx * gradx * tau / mass)) / (gradx * gradx * tau / mass);
51  CHECK(dval == Approx(scale_factor * gradx * tau / mass));
52 
53  //app_log() << gradx << " " << dval << std::endl;
54  gradx += dx;
55  }
56  //app_log() << " end printing." << std::endl;
57 }
T setScaledDriftPbyPandNodeCorr(T tau, const ParticleAttrib< TinyVector< T1, D >> &qf, ParticleAttrib< TinyVector< T, D >> &drift)
scale drift
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
QMCTraits::RealType RealType
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [39/537]

qmcplusplus::TEST_CASE ( "Hybrid Engine query store"  ,
""  [drivers][hybrid] 
)

This provides a basic test of the hybrid engine's check on whether vectors need to be stored.

Definition at line 22 of file test_HybridEngine.cpp.

References ADAPTIVE, app_log(), DESCENT, and REQUIRE().

23 {
24 
25  //A fake constructor is used that sets the hybrid engine's step_num_ variable to 0 instead of the usual -1
26  std::unique_ptr<HybridEngine> hybridEngineObj = std::make_unique<HybridEngine>();
27 
28  //Descent and adaptive methods with associated numbers of update steps are added to the engine
29  hybridEngineObj->addMethod(OptimizerType::DESCENT);
30  hybridEngineObj->addUpdates(100);
31 
32  hybridEngineObj->addMethod(OptimizerType::ADAPTIVE);
33  hybridEngineObj->addUpdates(3);
34 
35  //A typical number of vectors that might be requested over the course of a descent optimization in the hybrid method
36  int test_store_num = 5;
37 
38  //Engine checks whether a vector should be stored. With step_num_ set to 0 this should be false.
39  int result = hybridEngineObj->queryStore(test_store_num,OptimizerType::DESCENT);
40 
41  app_log() << "Hybrid Test Result: " << result << std::endl;
42 
43  REQUIRE(result == false);
44 
45 
46 }
std::ostream & app_log()
Definition: OutputManager.h:65
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [40/537]

qmcplusplus::TEST_CASE ( "VirtualParticleSet"  ,
""  [particle] 
)

Definition at line 22 of file test_VirtualParticleSet.cpp.

References CHECK(), OHMMS::Controller, VirtualParticleSet::createResource(), DistanceTableAB::getDistances(), ParticleSet::getDistTableAB(), MinimalParticlePool::make_NiO_a4(), VirtualParticleSet::makeMoves(), ParticleSet::R, REQUIRE(), and ParticleSet::update().

23 {
24  auto pset_pool = MinimalParticlePool::make_NiO_a4(OHMMS::Controller);
25 
26  auto& ions = *pset_pool.getParticleSet("i");
27  auto& elecs = *pset_pool.getParticleSet("e");
28 
29  elecs.R[0] = {1, 2, 3};
30  elecs.R[1] = {2, 1, 3};
31  elecs.R[2] = {3, 1, 2};
32  elecs.R[3] = {3, 2, 1};
33 
34  ions.addTable(ions);
35  ions.update();
36  elecs.addTable(ions);
37  elecs.addTable(elecs);
38  elecs.update();
39 
40 
41  ParticleSet elecs_clone(elecs);
42  elecs_clone.update();
43 
44  VirtualParticleSet vp_Ni(elecs, 3);
45  VirtualParticleSet vp_O(elecs, 5);
46 
47  VirtualParticleSet vp_Ni_clone(elecs_clone, 3);
48  VirtualParticleSet vp_O_clone(elecs_clone, 5);
49 
50  vp_Ni_clone.makeMoves(elecs_clone, 3, {{0.1, 0.2, 0.3}, {0.2, 0.1, 0.3}, {0.3, 0.1, 0.2}});
51  const DistanceTableAB& dt_vp_ion = vp_Ni_clone.getDistTableAB(0);
52  CHECK(Approx(dt_vp_ion.getDistances()[2][1]) == 2.5020600118);
53 
54  // two walkers form a workgroup.
55  // One electron of the first walker gets inside O sphere and one electron of the other gets inside Ni sphere.
56  RefVectorWithLeader<VirtualParticleSet> vp_list(vp_Ni, {vp_O, vp_Ni_clone});
57  ResourceCollection collection{"NLPPcollection"};
58  vp_Ni.createResource(collection);
59 
60  {
61  ResourceCollectionTeamLock<VirtualParticleSet> vp_res_lock(collection, vp_list);
62  }
63 
64  vp_Ni_clone.makeMoves(elecs_clone, 3, {{0.1, 0.2, 0.3}, {0.3, 0.1, 0.2}, {0.2, 0.1, 0.3}});
65  CHECK(Approx(vp_Ni_clone.R[2][0]) == 3.2);
66  CHECK(Approx(vp_Ni_clone.R[2][1]) == 2.1);
67  CHECK(Approx(vp_Ni_clone.R[2][2]) == 1.3);
68 
69  REQUIRE(dt_vp_ion.getDistances().size() == 3);
70  CHECK(Approx(dt_vp_ion.getDistances()[2][1]) == 2.5784519198);
71 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [41/537]

qmcplusplus::TEST_CASE ( "J1 evaluate derivatives Jastrow"  ,
""  [wavefunction] 
)

Definition at line 22 of file test_J1OrbitalSoA.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ParticleSet::addTable(), app_log(), WaveFunctionFactory::buildTWF(), CHECK(), OHMMS::Controller, ParticleSet::create(), doc, ParticleSet::get(), ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), ispecies, okay, Libxml2Document::parseFromString(), ParticleSet::R, VariableSet::removeInactive(), REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), VariableSet::size_of_active(), twf, and ParticleSet::update().

23 {
25 
26  ParticleSetPool ptcl = ParticleSetPool(c);
27  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
28  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
29  ParticleSet& ions_(*ions_uptr);
30  ParticleSet& elec_(*elec_uptr);
31 
32  ions_.setName("ion0");
33  ptcl.addParticleSet(std::move(ions_uptr));
34  ions_.create({1});
35  ions_.R[0] = {0.0, 0.0, 0.0};
36  SpeciesSet& ispecies = ions_.getSpeciesSet();
37  int HIdx = ispecies.addSpecies("H");
38  int ichargeIdx = ispecies.addAttribute("charge");
39  ispecies(ichargeIdx, HIdx) = 1.0;
40 
41  elec_.setName("e");
42  ptcl.addParticleSet(std::move(elec_uptr));
43  elec_.create({1, 1});
44  elec_.R[0] = {0.5, 0.5, 0.5};
45  elec_.R[1] = {-0.5, -0.5, -0.5};
46 
47  SpeciesSet& tspecies = elec_.getSpeciesSet();
48  int upIdx = tspecies.addSpecies("u");
49  int downIdx = tspecies.addSpecies("d");
50  int massIdx = tspecies.addAttribute("mass");
51  int chargeIdx = tspecies.addAttribute("charge");
52  tspecies(massIdx, upIdx) = 1.0;
53  tspecies(massIdx, downIdx) = 1.0;
54  tspecies(chargeIdx, upIdx) = -1.0;
55  tspecies(massIdx, downIdx) = -1.0;
56  // Necessary to set mass
57  elec_.resetGroups();
58 
59  ions_.update();
60  elec_.addTable(elec_);
61  elec_.addTable(ions_);
62  elec_.update();
63 
64  ions_.get(app_log());
65  elec_.get(app_log());
66 
67  const char* jasxml = R"(<wavefunction name="psi0" target="e">
68  <jastrow name="J1" type="One-Body" function="Bspline" print="yes" source="ion0">
69  <correlation elementType="H" cusp="0.0" size="2" rcut="5.0">
70  <coefficients id="J1H" type="Array"> 0.5 0.1 </coefficients>
71  </correlation>
72  </jastrow>
73 </wavefunction>
74 )";
76  bool okay = doc.parseFromString(jasxml);
77  REQUIRE(okay);
78 
79  xmlNodePtr jas1 = doc.getRoot();
80 
81  // update all distance tables
82  elec_.update();
83  RuntimeOptions runtime_options;
84  WaveFunctionFactory wf_factory(elec_, ptcl.getPool(), c);
85  auto twf_ptr = wf_factory.buildTWF(jas1, runtime_options);
86  auto& twf(*twf_ptr);
87  twf.setMassTerm(elec_);
88  twf.evaluateLog(elec_);
89  twf.prepareGroup(elec_, 0);
90 
91  auto& twf_component_list = twf.getOrbitals();
92 
93  opt_variables_type active;
94  twf.checkInVariables(active);
95  active.removeInactive();
96  int nparam = active.size_of_active();
97  REQUIRE(nparam == 2);
98 
100  Vector<ValueType> dlogpsi(nparam);
101  Vector<ValueType> dhpsioverpsi(nparam);
102  //twf.evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
103  twf_component_list[0]->evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
104 
105  // Numbers not validated
106  std::vector<ValueType> expected_dlogpsi = {-0.9336294487, -1.0196051794};
107  std::vector<ValueType> expected_dhpsioverpsi = {-1.1596433096, 0.7595492539};
108  for (int i = 0; i < nparam; i++)
109  {
110  CHECK(dlogpsi[i] == ValueApprox(expected_dlogpsi[i]));
111  CHECK(dhpsioverpsi[i] == ValueApprox(expected_dhpsioverpsi[i]));
112  }
113 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [42/537]

qmcplusplus::TEST_CASE ( "StdRandom mt19937 determinism"  ,
""  [utilities] 
)

Definition at line 23 of file test_StdRandom.cpp.

References CHECK().

24 {
25  // Verify StdRandom (MT19937 internally) generates a fixed sequence given an fixed initial seed
26  // This is not guaranteed by Boost but appears to be the case
27  StdRandom<double> our_rng(13);
28  std::vector<double> expected = {0.7777024102, 0.6073413305, 0.237541216};
29  for (auto i = 0; i < expected.size(); ++i)
30  CHECK(our_rng() == Approx(expected[i]));
31 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [43/537]

qmcplusplus::TEST_CASE ( "Scalar Estimator Input ,
""  [estimators] 
)

Definition at line 23 of file test_ScalarEstimatorInputs.cpp.

References CHECK(), doc, LocalEnergyInput::get_type(), CSLocalEnergyInput::get_type(), RMCLocalEnergyInput::get_type(), Libxml2Document::getRoot(), getXMLAttributeValue(), lowerCase(), node, okay, Libxml2Document::parseFromString(), REQUIRE(), and ValidSpinDensityInput::xml.

24 {
25  using input = testing::ValidScalarEstimatorInput;
26 
27  for (auto input_xml : input::xml)
28  {
30  bool okay = doc.parseFromString(input_xml);
31  REQUIRE(okay);
32  xmlNodePtr node = doc.getRoot();
33  std::string atype(lowerCase(getXMLAttributeValue(node, "type")));
34  std::string aname(lowerCase(getXMLAttributeValue(node, "name")));
35  // Since legacy inconsistently used name instead of type attribute to specify scalar estimator type
36  if (atype.empty() && !aname.empty())
37  atype = aname;
38  if (aname.empty() && !atype.empty())
39  aname = atype;
40  if (atype == "localenergy" || atype == "elocal")
41  {
42  LocalEnergyInput lei(node);
43  CHECK(lowerCase(lei.get_type()) == "localenergy");
44  }
45  else if (atype == "cslocalenergy")
46  {
47  CSLocalEnergyInput cslei(node);
48  CHECK(lowerCase(cslei.get_type()) == "cslocalenergy");
49  }
50  else if (atype == "rmc")
51  {
52  RMCLocalEnergyInput rmclei(node);
53  CHECK(lowerCase(rmclei.get_type()) == "rmclocalenergy");
54  }
55  else
56  {
57  FAIL("Unhandled scalar estimator " << atype);
58  }
59  }
60 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
std::string lowerCase(const std::string_view s)
++17
std::string getXMLAttributeValue(const xmlNodePtr cur, const std::string_view name)
get the value string for attribute name if name is unfound in cur you get an empty string back this i...
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
testing::ValidSpinDensityInput input

◆ TEST_CASE() [44/537]

qmcplusplus::TEST_CASE ( "TwoBodyJastrow simple"  ,
""  [wavefunction] 
)

Definition at line 23 of file test_J2_derivatives.cpp.

References TwoBodyJastrow< FT >::checkOutVariables(), ParticleSet::create(), and ParticleSet::setName().

24 {
25  const SimulationCell simulation_cell;
26  ParticleSet elec(simulation_cell);
27  elec.setName("e");
28  elec.create({1, 1});
29  TwoBodyJastrow<FakeJasFunctor> jorb("J2_fake", elec, false);
30 
31  opt_variables_type active;
32  jorb.checkOutVariables(active);
33 }
optimize::VariableSet opt_variables_type

◆ TEST_CASE() [45/537]

qmcplusplus::TEST_CASE ( "spline_function_1"  ,
""  [numerics] 
)

Definition at line 23 of file test_one_dim_cubic_spline.cpp.

References CHECK(), CubicSplineSolve(), qmcplusplus::Units::charge::e, and n.

24 {
25  const int n = 3;
26  double x[n] = {0.0, 1.0, 2.0};
27  double y[n] = {1.0, 2.0, 1.5};
28  double y2[n];
29 
30  CubicSplineSolve(x, y, n, 1e+33, 1e+33, y2);
31 
32  CHECK(y2[0] == Approx(0));
33  CHECK(y2[1] == Approx(-2.25));
34  CHECK(y2[2] == Approx(0));
35 }
void CubicSplineSolve(T const *x, T const *y, int n, T yp0, T ypn, T *y2)
Solve for second derivatives for cubic splines.
Definition: SplineSolvers.h:33
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [46/537]

qmcplusplus::TEST_CASE ( "solveGeneralizedEigenvalues"  ,
""  [drivers] 
)

Definition at line 23 of file test_Eigensolver.cpp.

References app_log(), CHECK(), qmcplusplus::Units::force::N, and Eigensolver::solveGeneralizedEigenvalues().

24 {
25  // Eigenvalues and eigenvectors from gen_eigenval.py
26  const int N = 2;
27  Matrix<Real> Ovlp(N, N);
28  Matrix<Real> Ham(N, N);
29 
30  Ovlp(0, 0) = 1.0;
31  Ovlp(0, 1) = 0.1;
32  Ovlp(1, 0) = 0.15;
33  Ovlp(1, 1) = 1.0;
34 
35  Ham(0, 0) = -4.0;
36  Ham(0, 1) = 0.2;
37  Ham(1, 0) = 0.3;
38  Ham(1, 1) = 1.0;
39  std::vector<Real> ev(N);
40  Matrix<Real> evec(N, N);
41  Eigensolver::solveGeneralizedEigenvalues(Ham, Ovlp, ev, evec);
42  CHECK(ev[0] == Approx(-4.10958));
43  CHECK(ev[1] == Approx(1.00298));
44  app_log() << "ev = " << ev[0] << " " << ev[1] << std::endl;
45 
46  app_log() << " evec " << evec(0, 0) << " " << evec(0, 1) << std::endl;
47  app_log() << " evec " << evec(1, 0) << " " << evec(1, 1) << std::endl;
48 
49  CHECK(evec(0, 0) == Approx(-1.0));
50  CHECK(evec(0, 1) == Approx(0.17935662));
51  CHECK(evec(1, 0) == Approx(0.01992851));
52  CHECK(evec(1, 1) == Approx(1.0));
53 }
std::ostream & app_log()
Definition: OutputManager.h:65
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [47/537]

qmcplusplus::TEST_CASE ( "WaveFunctionFactory"  ,
""  [wavefunction] 
)

Definition at line 23 of file test_wavefunction_factory.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), WaveFunctionFactory::buildTWF(), OHMMS::Controller, doc, Libxml2Document::getRoot(), okay, Libxml2Document::parseFromString(), and REQUIRE().

24 {
26 
27  const SimulationCell simulation_cell;
28  auto qp = std::make_unique<ParticleSet>(simulation_cell);
29  std::vector<int> agroup(2, 1);
30  qp->setName("e");
31  qp->create(agroup);
32  qp->R[0] = {1.0, 2.0, 3.0};
33  qp->R[1] = {0.0, 1.1, 2.2};
34 
35  SpeciesSet& tspecies = qp->getSpeciesSet();
36  int upIdx = tspecies.addSpecies("u");
37  int downIdx = tspecies.addSpecies("d");
38  int massIdx = tspecies.addAttribute("mass");
39  tspecies(massIdx, upIdx) = 1.0;
40  tspecies(massIdx, downIdx) = 1.0;
41 
42  qp->update();
43 
44  WaveFunctionFactory::PSetMap particle_set_map;
45  particle_set_map.emplace("e", std::move(qp));
46 
47  WaveFunctionFactory wff(*particle_set_map["e"], particle_set_map, c);
48 
49  const char* wavefunction_xml = R"(<wavefunction>
50  <jastrow type="Two-Body" name="J2" function="bspline" print="yes" gpu="no">
51  <correlation speciesA="u" speciesB="d" size="8" cutoff="10.0">
52  <coefficients id="ud" type="Array">
53 0.5954603818 0.5062051797 0.3746940461 0.2521010502 0.1440163317 0.07796688253
54 0.03804420551 0.01449320872
55  </coefficients>
56  </correlation>
57  </jastrow>
58 </wavefunction>)";
60  bool okay = doc.parseFromString(wavefunction_xml);
61  REQUIRE(okay);
62 
63  xmlNodePtr root = doc.getRoot();
64  RuntimeOptions runtime_options;
65  auto twf_ptr = wff.buildTWF(root, runtime_options);
66 
67  REQUIRE(twf_ptr != nullptr);
68  REQUIRE(twf_ptr->size() == 1);
69 
70  auto& j2_base = twf_ptr->getOrbitals()[0];
71  REQUIRE(j2_base != nullptr);
72 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [48/537]

qmcplusplus::TEST_CASE ( "CUDA_allocators"  ,
""  [CUDA] 
)

Definition at line 23 of file test_CUDAallocator.cpp.

References cudaErrorCheck(), cudaMemoryTypeDevice, cudaMemoryTypeHost, cudaMemoryTypeManaged, cudaPointerAttributes, cudaPointerGetAttributes, Vector< T, Alloc >::data(), and REQUIRE().

24 {
25  { // CUDAManagedAllocator
26  Vector<double, CUDAManagedAllocator<double>> vec(1024);
28  cudaErrorCheck(cudaPointerGetAttributes(&attr, vec.data()), "cudaPointerGetAttributes failed!");
29 #if (CUDART_VERSION >= 10000 || HIP_VERSION_MAJOR >= 6)
30  REQUIRE(attr.type == cudaMemoryTypeManaged);
31 #endif
32  }
33  { // CUDAAllocator
34  Vector<double, CUDAAllocator<double>> vec(1024);
36  cudaErrorCheck(cudaPointerGetAttributes(&attr, vec.data()), "cudaPointerGetAttributes failed!");
37 #if (CUDART_VERSION >= 10000 || HIP_VERSION_MAJOR >= 6)
38  REQUIRE(attr.type == cudaMemoryTypeDevice);
39 #else
40  REQUIRE(attr.memoryType == cudaMemoryTypeDevice);
41 #endif
42  }
43  { // CUDAHostAllocator
44  Vector<double, CUDAHostAllocator<double>> vec(1024);
46  cudaErrorCheck(cudaPointerGetAttributes(&attr, vec.data()), "cudaPointerGetAttributes failed!");
47 #if (CUDART_VERSION >= 10000 || HIP_VERSION_MAJOR >= 6)
48  REQUIRE(attr.type == cudaMemoryTypeHost);
49 #else
50  REQUIRE(attr.memoryType == cudaMemoryTypeHost);
51 #endif
52  }
53 #if !defined(QMC_DISABLE_HIP_HOST_REGISTER)
54  { // CUDALockedPageAllocator
55  Vector<double, CUDALockedPageAllocator<double>> vec(1024);
57  cudaErrorCheck(cudaPointerGetAttributes(&attr, vec.data()), "cudaPointerGetAttributes failed!");
58 #if (CUDART_VERSION >= 10000 || HIP_VERSION_MAJOR >= 6)
59  REQUIRE(attr.type == cudaMemoryTypeHost);
60 #else
61  REQUIRE(attr.memoryType == cudaMemoryTypeHost);
62 #endif
63  Vector<double, CUDALockedPageAllocator<double>> vecb(vec);
64  }
65 #endif
66  { // CUDALockedPageAllocator zero size and copy constructor
67  Vector<double, CUDALockedPageAllocator<double>> vec;
68  Vector<double, CUDALockedPageAllocator<double>> vecb(vec);
69  }
70 }
#define cudaMemoryTypeDevice
Definition: cuda2hip.h:113
#define cudaPointerGetAttributes
Definition: cuda2hip.h:110
#define cudaErrorCheck(ans, cause)
Definition: CUDAerror.h:21
#define cudaMemoryTypeHost
Definition: cuda2hip.h:112
#define cudaMemoryTypeManaged
Definition: cuda2hip.h:114
REQUIRE(std::filesystem::exists(filename))
#define cudaPointerAttributes
Definition: cuda2hip.h:111

◆ TEST_CASE() [49/537]

qmcplusplus::TEST_CASE ( "CompositeSPO::diamond_1x1x1"  ,
"[wavefunction"   
)

Definition at line 23 of file test_CompositeSPOSet.cpp.

References CompositeSPOSet::add(), ProjectData::BATCH, CHECK(), comm, OHMMS::Controller, doc, CompositeSPOSet::evaluate_notranspose(), SPOSet::getOrbitalSetSize(), ProjectData::getRuntimeOptions(), MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), outputManager, particle_pool, OutputManagerClass::pause(), pset, SPOSet::size(), test_project, twf, and wavefunction_pool.

24 {
26 
27  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
31 
32  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
33  auto wavefunction_pool =
34  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
35  auto& pset = *particle_pool.getParticleSet("e");
36  auto& twf = *wavefunction_pool.getWaveFunction("wavefunction");
37 
38  CompositeSPOSet comp_sposet("one_composite_set");
39 
40  std::vector<std::string> sposets{"spo_ud", "spo_dm"};
41  for (auto sposet_str : sposets)
42  {
43  auto& sposet = twf.getSPOSet(sposet_str);
44  comp_sposet.add(sposet.makeClone());
45  }
46  CHECK(comp_sposet.size() == 8);
47 
48  SPOSet::ValueMatrix psiM(pset.R.size(), comp_sposet.getOrbitalSetSize());
49  SPOSet::GradMatrix dpsiM(pset.R.size(), comp_sposet.getOrbitalSetSize());
50  SPOSet::ValueMatrix d2psiM(pset.R.size(), comp_sposet.getOrbitalSetSize());
51  comp_sposet.evaluate_notranspose(pset, 0, pset.R.size(), psiM, dpsiM, d2psiM);
52 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
void pause()
Pause the summary and log streams.
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
OutputManagerClass outputManager(Verbosity::HIGH)
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [50/537]

qmcplusplus::TEST_CASE ( "SoaDistanceTableAA compute_size"  ,
""  [distance_table] 
)

Definition at line 23 of file test_SoaDistanceTableAA.cpp.

References CHECK(), SoaDistanceTableAA< T, D, SC >::compute_size(), ParticleSet::create(), ParticleSet::getTotalNum(), and ParticleSet::setName().

24 {
25  const SimulationCell simulation_cell;
26  ParticleSet elec(simulation_cell);
27 
28  elec.setName("e");
29  elec.create({6, 4});
30 
31  // using open BC
32  SoaDistanceTableAA<OHMMS_PRECISION, OHMMS_DIM, SUPERCELL_OPEN + SOA_OFFSET> dt_ee(elec);
33 
34  const size_t Alignment = getAlignment<OHMMS_PRECISION>();
35 
36  // create reference values
37  assert(elec.getTotalNum() == 10);
38  std::vector<int> ref_results(10);
39  if (Alignment == 4)
40  ref_results = {0, 4, 8, 12, 16, 24, 32, 40, 48, 60};
41  else if (Alignment == 8)
42  ref_results = {0, 8, 16, 24, 32, 40, 48, 56, 64, 80};
43 
44  // run checks
45  if (Alignment == 4 || Alignment == 8)
46  {
47  std::cout << "testing Alignment = " << Alignment << std::endl;
48  for (int i = 0; i < ref_results.size(); i++)
49  CHECK(dt_ee.compute_size(i) == ref_results[i]);
50  }
51 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [51/537]

qmcplusplus::TEST_CASE ( "VMCFactory Instantiation"  ,
""  [drivers] 
)

Definition at line 23 of file test_VMCFactoryNew.cpp.

References doc, Libxml2Document::getRoot(), node, okay, Libxml2Document::parseFromString(), REQUIRE(), UPDATE_MODE, qmcplusplus::testing::valid_vmc_input_sections, and qmcplusplus::testing::valid_vmc_input_vmc_batch_index.

24 {
25  using namespace testing;
27 
29  REQUIRE(okay);
30  xmlNodePtr node = doc.getRoot();
31  std::bitset<QMC_MODE_MAX> vmc_mode;
32  vmc_mode[UPDATE_MODE] = true;
33  int qmc_counter = 0;
34  VMCFactoryNew vmc_factory(node, vmc_mode[UPDATE_MODE]);
35 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
bit for move: walker or pbyp
Definition: DriverTraits.h:28
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
constexpr int valid_vmc_input_vmc_batch_index
REQUIRE(std::filesystem::exists(filename))
constexpr std::array< const char *, 4 > valid_vmc_input_sections
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [52/537]

qmcplusplus::TEST_CASE ( "selectEigenvalues"  ,
""  [drivers] 
)

Definition at line 23 of file test_LinearMethod.cpp.

References CHECK(), and LinearMethod::selectEigenvalue().

24 {
25  LinearMethod lm;
26  const int Ne = 4; // Number of eigenvalues
27  const int Nv = 4; // Size of eigenvectors
28 
29  // For direct solvers, Ne == Nv, but for iterative solvers we may have Ne <= Nv;
30 
31  Matrix<Real> evecs(Ne, Nv);
32  evecs = 1.0;
33  evecs(0, 0) = 2.0;
34  evecs(1, 0) = 3.0;
35  std::vector<Real> evals{-1.2, -1.5}; // size Ne
36  std::vector<Real> selected_evec(Nv);
37  Real zerozero = -1.0;
38  Real selected_eval = lm.selectEigenvalue(evals, evecs, zerozero, selected_evec);
39 
40  // Selects the closest to zerozero - 2.0
41  CHECK(selected_eval == Approx(-1.5));
42 
43  CHECK(selected_evec[0] == Approx(1.0));
44  CHECK(selected_evec[1] == Approx(1.0 / 3.0));
45 }
ForceBase::Real Real
Definition: ForceBase.cpp:26
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [53/537]

qmcplusplus::TEST_CASE ( "make_seed"  ,
""  [utilities] 
)

Definition at line 24 of file test_rng.cpp.

References make_seed(), and REQUIRE().

25 {
26  // not sure what to test here - mostly that it doesn't crash
27  // It's based on 'time' so it will return different values at different calls
28  // If the time is the same (1 second resolution), different inputs should
29  // give different seeds.
30  unsigned int seed1 = make_seed(0, 0);
31  unsigned int seed2 = make_seed(1, 1);
32 
33  REQUIRE(seed1 != seed2);
34 }
REQUIRE(std::filesystem::exists(filename))
uint32_t make_seed(int i, int n)

◆ TEST_CASE() [54/537]

qmcplusplus::TEST_CASE ( "compute_batch_parameters"  ,
""  [drivers] 
)

Definition at line 24 of file test_QMCCostFunctionBatched.cpp.

References batch_size, CHECK(), and compute_batch_parameters().

25 {
26  int sample_size = 1;
27  int batch_size = 1;
28 
29  int num_batches;
30  int final_batch_size;
31 
32  compute_batch_parameters(sample_size, batch_size, num_batches, final_batch_size);
33  CHECK(num_batches == 1);
34  CHECK(final_batch_size == 1);
35 
36 
37  sample_size = 11;
38  batch_size = 4;
39 
40  compute_batch_parameters(sample_size, batch_size, num_batches, final_batch_size);
41  CHECK(num_batches == 3);
42  CHECK(final_batch_size == 3);
43 
44  batch_size = 0;
45  compute_batch_parameters(sample_size, batch_size, num_batches, final_batch_size);
46  CHECK(num_batches == 0);
47  CHECK(final_batch_size == 0);
48 }
void compute_batch_parameters(int sample_size, int batch_size, int &num_batches, int &final_batch_size)
Compute number of batches and final batch size given the number of samples and a batch size...
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [55/537]

qmcplusplus::TEST_CASE ( "Density Estimator"  ,
""  [hamiltonian] 
)

Definition at line 24 of file test_density_estimator.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), ParticleSet::create(), DensityEstimator::evaluate(), ParticleSet::getSpeciesSet(), ParticleSet::R, ParticleSet::resetGroups(), OperatorBase::setHistories(), ParticleSet::setName(), and ParticleSet::update().

25 {
26  const SimulationCell simulation_cell;
27  ParticleSet elec(simulation_cell);
28 
29  elec.setName("elec");
30  elec.create({2});
31  elec.R[0] = {0.0, 1.0, 0.0};
32  elec.R[1] = {0.4, 0.3, 0.0};
33 
34  SpeciesSet& tspecies = elec.getSpeciesSet();
35  int upIdx = tspecies.addSpecies("u");
36  //int chargeIdx = tspecies.addAttribute("charge");
37  int massIdx = tspecies.addAttribute("mass");
38  int eChargeIdx = tspecies.addAttribute("charge");
39  tspecies(eChargeIdx, upIdx) = -1.0;
40  tspecies(massIdx, upIdx) = 1.0;
41 
42  // The call to resetGroups is needed transfer the SpeciesSet
43  // settings to the ParticleSet
44  elec.resetGroups();
45  elec.update();
46 
47  DensityEstimator density_estimator(elec);
48 
49  ParticleSet::Walker_t dummy = ParticleSet::Walker_t(1);
50  density_estimator.setHistories(dummy);
51 
52  const double val = density_estimator.evaluate(elec);
53  CHECK(val == Approx(0.0));
54 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [56/537]

qmcplusplus::TEST_CASE ( "WFOptDriverInput readXML"  ,
""  [drivers] 
)

Definition at line 24 of file test_WFOptDriverInput.cpp.

References doc, WFOptDriverInput::get_opt_crowd_size(), WFOptDriverInput::get_opt_method(), WFOptDriverInput::get_opt_num_crowds(), Libxml2Document::getRoot(), node, okay, Libxml2Document::parseFromString(), WFOptDriverInput::readXML(), REQUIRE(), and qmcplusplus::testing::valid_opt_input_sections.

25 {
26  auto xml_test = [](const char* driver_xml) {
28  bool okay = doc.parseFromString(driver_xml);
29  REQUIRE(okay);
30  xmlNodePtr node = doc.getRoot();
31  WFOptDriverInput wfoptdriver_input;
32  wfoptdriver_input.readXML(node);
33 
34  if (wfoptdriver_input.get_opt_method() == "")
35  {
36  REQUIRE(wfoptdriver_input.get_opt_num_crowds() == 0);
37  REQUIRE(wfoptdriver_input.get_opt_crowd_size() == 1);
38  }
39  else if (wfoptdriver_input.get_opt_method() == "test")
40  {
41  REQUIRE(wfoptdriver_input.get_opt_num_crowds() == 4);
42  REQUIRE(wfoptdriver_input.get_opt_crowd_size() == 8);
43  }
44  else
45  {
46  std::cout << "Unknown opt method: " << wfoptdriver_input.get_opt_method() << std::endl;
47  REQUIRE(false); // optimizer method name not one of the two options
48  }
49  };
50 
51  std::for_each(testing::valid_opt_input_sections.begin(), testing::valid_opt_input_sections.end(), xml_test);
52 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
constexpr std::array< const char *, 2 > valid_opt_input_sections
As far as I can tell these are no longer valid.
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [57/537]

qmcplusplus::TEST_CASE ( "Legendre"  ,
""  [numerics] 
)

Definition at line 24 of file test_ylm.cpp.

References abs(), CHECK(), and LegendrePll().

25 {
26  // l=0 should be 1.0 for all values
27  double v = LegendrePll(0, 0.5);
28  CHECK(v == Approx(1.0));
29 
30  // check endpoints
31  for (int i = 0; i < 10; i++)
32  {
33  double vp1 = LegendrePll(0, 2.0);
34  CHECK(vp1 == Approx(1.0));
35  double vm1 = LegendrePll(0, 2.0);
36  CHECK(std::abs(vm1) == Approx(1.0));
37  }
38 }
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
T LegendrePll(int l, T x)
Definition: Ylm.h:25

◆ TEST_CASE() [58/537]

qmcplusplus::TEST_CASE ( "StructFact"  ,
""  [lrhandler] 
)

evalaute bare Coulomb in 3D using LRHandlerTemp

Definition at line 24 of file test_StructFact.cpp.

References SpeciesSet::addSpecies(), app_log(), CrystalLattice< T, D >::BoxBConds, CHECK(), ParticleSet::create(), Tensor< T, D >::diagonal(), qmcplusplus::Units::charge::e, SimulationCell::getKLists(), ParticleSet::getLRBox(), ParticleSet::getSpeciesSet(), ParticleSet::groups(), KContainer::numk, ParticleSet::R, CrystalLattice< T, D >::R, REQUIRE(), CrystalLattice< T, D >::reset(), CrystalLattice< T, D >::Rv, StructFact::updateAllPart(), and CrystalLattice< T, D >::Volume.

25 {
26  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> Lattice;
27  Lattice.BoxBConds = true;
28  Lattice.LR_dim_cutoff = 30.;
29  Lattice.R.diagonal(5.0);
30  Lattice.reset();
31  CHECK(Approx(Lattice.Volume) == 125);
32  Lattice.SetLRCutoffs(Lattice.Rv);
33  Lattice.printCutoffs(app_log());
34  CHECK(Approx(Lattice.LR_rc) == 2.5);
35  CHECK(Approx(Lattice.LR_kc) == 12);
36 
37  Lattice.LR_dim_cutoff = 125;
38  const SimulationCell simulation_cell(Lattice);
39  ParticleSet ref(simulation_cell); // handler needs ref.getSimulationCell().getKLists()
40 
41  SpeciesSet& tspecies = ref.getSpeciesSet();
42  int upIdx = tspecies.addSpecies("u");
43  int downIdx = tspecies.addSpecies("d");
44 
45  ref.create({3,1});
46  ref.R[0] = {0.0, 1.0, 2.0};
47  ref.R[1] = {1.0, 0.2, 3.0};
48  ref.R[2] = {0.3, 4.0, 1.4};
49  ref.R[3] = {3.2, 4.7, 0.7};
50 
51  REQUIRE(simulation_cell.getKLists().numk == 263786);
52  StructFact sk(ref.getLRBox(), simulation_cell.getKLists());
53  sk.updateAllPart(ref);
54 
55  CHECK(sk.rhok_r.rows() == ref.groups());
56  CHECK(sk.rhok_i.rows() == ref.groups());
57  CHECK(sk.rhok_r.cols() == simulation_cell.getKLists().numk);
58  CHECK(sk.rhok_i.cols() == simulation_cell.getKLists().numk);
59 
60  std::vector<std::complex<double>> rhok_sum_ref{-125.80618630936, 68.199075127271};
61 
62  for (int i = 0; i < ref.groups(); i++)
63  {
64  std::complex<QMCTraits::RealType> rhok_sum, rhok_even_sum;
65  for (int ik = 0; ik < simulation_cell.getKLists().numk; ik++)
66  rhok_sum += std::complex<QMCTraits::RealType>(sk.rhok_r[i][ik], sk.rhok_i[i][ik]);
67 
68  //std::cout << std::setprecision(14) << rhok_sum << std::endl;
69  CHECK(ComplexApprox(rhok_sum).epsilon(5e-5) == rhok_sum_ref[i]);
70  }
71 }
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
POLT::ParticleLayout Lattice
std::ostream & app_log()
Definition: OutputManager.h:65
TinyVector< SingleParticlePos, D > Rv
Real-space unit vectors.
Scalar_t Volume
Physical properties of a supercell.
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
REQUIRE(std::filesystem::exists(filename))
void diagonal(const T &rhs)
Definition: Tensor.h:205
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

◆ TEST_CASE() [59/537]

qmcplusplus::TEST_CASE ( "array"  ,
""  [OhmmsPETE] 
)

Definition at line 24 of file test_Array.cpp.

References qmcplusplus::Units::distance::A, B(), CHECK(), and REQUIRE().

25 {
26  using Array1D = Array<double, 1>;
27  Array1D A(3);
28  Array1D B(3);
29 
30  // iterator
31  auto ia = A.begin();
32  for (; ia != A.end(); ia++)
33  {
34  *ia = 1.0;
35  }
36 
37  // Assignment. This eventually generates a call to 'evaluate' in OhmmsVector.h
38  // To do: pointer to tutorial on expression template techniques
39  B = A;
40 
41  for (auto& element : B)
42  element *= 3.1;
43 
44  CHECK(B(0) == Approx(3.1));
45  CHECK(B(1) == Approx(3.1));
46  CHECK(B(2) == Approx(3.1));
47  REQUIRE(B == B);
48  REQUIRE(!(B == A));
49  REQUIRE(A != B);
50 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
double B(double x, int k, int i, const std::vector< double > &t)

◆ TEST_CASE() [60/537]

qmcplusplus::TEST_CASE ( "matrix"  ,
""  [OhmmsPETE] 
)

Definition at line 24 of file test_Matrix.cpp.

References qmcplusplus::Units::distance::A, B(), qmcplusplus::Units::charge::C, CHECK(), and REQUIRE().

25 {
26  using Mat = Matrix<OHMMS_PRECISION>;
27  Mat A(3, 3);
28  Mat B(3, 3);
29  Mat C(3, 3);
30 
31  for (int i = 0; i < 3; i++)
32  {
33  for (int j = 0; j < 3; j++)
34  {
35  B(i, j) = (i + j) * 2.1;
36  }
37  }
38 
39  // Assign to all elements
40  A = 1.0;
41 
42  // Assignment. This eventually generates a call to 'evaluate' in OhmmsVector.h
43  C = A;
44 
45  // *= operator in OhmmMatrixOperators.h
46  A *= 3.1;
47 
48  // iterator
49  Mat::iterator ia = A.begin();
50  for (; ia != A.end(); ia++)
51  {
52  CHECK(*ia == Approx(3.1));
53  }
54 
55  REQUIRE( A == A);
56  REQUIRE( A != C);
57 
58  // copy constructor and copy method
59  Mat D(C);
60  CHECK(D.rows() == 3);
61  CHECK(D.cols() == 3);
62 
63  // swap_rows
64  A(0, 0) = 0.0;
65  A(0, 1) = 1.0;
66  A(1, 0) = 1.0;
67  A(1, 1) = 2.0;
68  A.swap_rows(0, 1);
69  CHECK(A(0, 0) == 1.0);
70  CHECK(A(0, 1) == 2.0);
71  CHECK(A(1, 0) == 0.0);
72  CHECK(A(1, 1) == 1.0);
73  // swap_cols
74  A.swap_cols(0, 1);
75  CHECK(A(0, 0) == 2.0);
76  CHECK(A(0, 1) == 1.0);
77  CHECK(A(1, 0) == 1.0);
78  CHECK(A(1, 1) == 0.0);
79 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
double B(double x, int k, int i, const std::vector< double > &t)

◆ TEST_CASE() [61/537]

qmcplusplus::TEST_CASE ( "ParallelExecutor<STD> function case"  ,
""  [concurrency] 
)

Definition at line 24 of file test_ParallelExecutorSTD.cpp.

References REQUIRE(), and TestTask().

25 {
26  int num_threads = 8;
27  ParallelExecutor<Executor::STD_THREADS> test_block;
28  std::atomic<int> count(0);
29  test_block(num_threads, TestTask, std::ref(count));
30  REQUIRE(count == 8);
31 }
void TestTask(const int ip, std::atomic< int > &counter)
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [62/537]

qmcplusplus::TEST_CASE ( "QMCDriverInput readXML"  ,
""  [drivers] 
)

Definition at line 24 of file test_QMCDriverInput.cpp.

References doc, QMCDriverInput::get_qmc_method(), Libxml2Document::getRoot(), node, okay, Libxml2Document::parseFromString(), QMCDriverInput::readXML(), REQUIRE(), qmcplusplus::testing::valid_dmc_input_dmc_batch_index, qmcplusplus::testing::valid_dmc_input_sections, qmcplusplus::testing::valid_vmc_input_sections, and qmcplusplus::testing::valid_vmc_input_vmc_batch_index.

25 {
26  auto xml_test = [](const char* driver_xml) {
28  bool okay = doc.parseFromString(driver_xml);
29  REQUIRE(okay);
30  xmlNodePtr node = doc.getRoot();
31  QMCDriverInput qmcdriver_input;
32  qmcdriver_input.readXML(node);
33  REQUIRE(qmcdriver_input.get_qmc_method().size() > 0);
34  };
35 
37  testing::valid_vmc_input_sections.end(), xml_test);
38 
40  testing::valid_dmc_input_sections.end(), xml_test);
41 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
constexpr int valid_vmc_input_vmc_batch_index
REQUIRE(std::filesystem::exists(filename))
constexpr std::array< const char *, 4 > valid_vmc_input_sections
constexpr int valid_dmc_input_dmc_batch_index
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
constexpr std::array< const char *, 3 > valid_dmc_input_sections

◆ TEST_CASE() [63/537]

qmcplusplus::TEST_CASE ( "ParticleSet distance table management"  ,
""  [particle] 
)

Definition at line 24 of file test_ParticleSet.cpp.

References ParticleSet::addTable(), ParticleSet::getDistTable(), REQUIRE(), and ParticleSet::setName().

25 {
26  const SimulationCell simulation_cell;
27  ParticleSet ions(simulation_cell);
28  ParticleSet elecs(simulation_cell);
29 
30  ions.setName("ions");
31  elecs.setName("electrons");
32 
33  const int ii_table_id = ions.addTable(ions);
34  const int ie_table_id = ions.addTable(elecs);
35  const int ei_table_id = elecs.addTable(ions);
36  const int ee_table_id = elecs.addTable(elecs);
37 
38  REQUIRE(ii_table_id == 0);
39  REQUIRE(ie_table_id == 1);
40  REQUIRE(ei_table_id == 0);
41  REQUIRE(ee_table_id == 1);
42 
43  // second query
44  const int ii_table_id2 = ions.addTable(ions);
45  const int ie_table_id2 = ions.addTable(elecs);
46  const int ei_table_id2 = elecs.addTable(ions);
47  const int ee_table_id2 = elecs.addTable(elecs);
48 
49  REQUIRE(ii_table_id2 == 0);
50  REQUIRE(ie_table_id2 == 1);
51  REQUIRE(ei_table_id2 == 0);
52  REQUIRE(ee_table_id2 == 1);
53 
54  REQUIRE(&(ions.getDistTable(ii_table_id2).get_origin()) == &ions);
55  REQUIRE(&(ions.getDistTable(ie_table_id2).get_origin()) == &elecs);
56  REQUIRE(&(elecs.getDistTable(ei_table_id2).get_origin()) == &ions);
57  REQUIRE(&(elecs.getDistTable(ee_table_id2).get_origin()) == &elecs);
58 
59  ParticleSet elecs_copy(elecs);
60  REQUIRE(elecs_copy.getDistTable(ei_table_id2).get_origin().getName() == "ions");
61  REQUIRE(elecs_copy.getDistTable(ee_table_id2).get_origin().getName() == "electrons");
62 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [64/537]

qmcplusplus::TEST_CASE ( "cuSolverInverter_bench"  ,
""  [wavefunction][benchmark] 
)

Definition at line 24 of file benchmark_cuSolverInverter.cpp.

References check_matrix_result, CHECKED_ELSE(), checkMatrix(), cuSolverInverter< T_FP >::invert_transpose(), DiracMatrix< T_FP >::invert_transpose(), qmcplusplus::Units::distance::m, qmcplusplus::testing::makeRngSpdMatrix(), qmcplusplus::Units::force::N, and Matrix< T, Alloc >::resize().

25 {
26 #ifdef QMC_COMPLEX
27  using FullPrecValue = std::complex<double>;
28 #else
29  using FullPrecValue = double;
30 #endif
31 
32  cuSolverInverter<FullPrecValue> solver;
33 
34  const int N = 1024;
35 
36  Matrix<FullPrecValue> m(N, N);
37  Matrix<FullPrecValue> m_invT(N, N);
38  Matrix<FullPrecValue> m_invT_CPU(N, N);
39  Matrix<FullPrecValue, CUDAAllocator<FullPrecValue>> m_invGPU;
40  std::complex<double> log_value;
41  m.resize(N, N);
42  m_invT.resize(N, N);
43  m_invT_CPU.resize(N, N);
44  m_invGPU.resize(N, N);
45 
46  testing::MakeRngSpdMatrix<FullPrecValue> makeRngSpdMatrix{};
48 
49  BENCHMARK("cuSolverInverter") { solver.invert_transpose(m, m_invT, m_invGPU, log_value); };
50 
51  DiracMatrix<FullPrecValue> dmat;
52  BENCHMARK("CPU") { dmat.invert_transpose(m, m_invT_CPU, log_value); };
53 
54  auto check_matrix_result = checkMatrix(m_invT, m_invT_CPU);
55  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
56 }
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
void makeRngSpdMatrix(testing::RandomForTest< RngValueType< T >> &rng, Matrix< T > &mat_spd)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63

◆ TEST_CASE() [65/537]

qmcplusplus::TEST_CASE ( "LogGridLight"  ,
""  [wavefunction][LCAO] 
)

Definition at line 25 of file test_multiquintic_spline.cpp.

References CHECK(), LogGridLight< T >::getCLForQuintic(), LogGridLight< T >::locate(), REQUIRE(), and LogGridLight< T >::set().

26 {
27  LogGridLight<double> grid;
28  grid.set(0.1, 1.0, 5);
29 
30  int idx = grid.locate(0.1);
31  REQUIRE(idx == 0);
32 
33  int idx2 = grid.locate(0.9);
34  REQUIRE(idx2 == 3);
35 
36  double t = grid(0);
37  CHECK(t == Approx(0.1));
38 
39  int idx3 = 0;
40  double t2 = grid.getCLForQuintic(0.1, idx3);
41  REQUIRE(idx3 == 0);
42  CHECK(t2 == Approx(0.0));
43 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [66/537]

qmcplusplus::TEST_CASE ( "ReferencePointsInput::parseXML::valid"  ,
""  [estimators] 
)

Definition at line 25 of file test_ReferencePointsInput.cpp.

References doc, Libxml2Document::getRoot(), node, okay, and Libxml2Document::parseFromString().

26 {
27  using Input = testing::ValidReferencePointsInputs;
28  for (auto input_xml : Input::xml)
29  {
31  bool okay = doc.parseFromString(input_xml);
32  xmlNodePtr node = doc.getRoot();
33 
34  // Will throw if input is invalid.
35  ReferencePointsInput rpi(node);
36  }
37 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [67/537]

qmcplusplus::TEST_CASE ( "ewald3d"  ,
""  [lrhandler] 
)

evalaute bare Coulomb using EwaldHandler3D

Definition at line 25 of file test_ewald3d.cpp.

References CrystalLattice< T, D >::BoxBConds, CHECK(), ParticleSet::createSK(), Tensor< T, D >::diagonal(), EwaldHandler3D::evaluate(), EwaldHandler3D::evaluateLR(), EwaldHandler3D::initBreakup(), LRHandlerBase::LR_kc, LRHandlerBase::LR_rc, LRHandlerBase::MaxKshell, CrystalLattice< T, D >::R, CrystalLattice< T, D >::reset(), CrystalLattice< T, D >::Rv, EwaldHandler3D::Sigma, sqrt(), and CrystalLattice< T, D >::Volume.

26 {
27  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> Lattice;
28  Lattice.BoxBConds = true;
29  Lattice.LR_dim_cutoff = 30.;
30  Lattice.R.diagonal(5.0);
31  Lattice.reset();
32  CHECK(Lattice.Volume == Approx(125));
33  Lattice.SetLRCutoffs(Lattice.Rv);
34  //Lattice.printCutoffs(app_log());
35  CHECK(Lattice.LR_rc == Approx(2.5));
36  CHECK(Lattice.LR_kc == Approx(12));
37 
38  const SimulationCell simulation_cell(Lattice);
39  ParticleSet ref(simulation_cell); // handler needs ref.getSimulationCell().getKLists()
40  ref.createSK();
41  EwaldHandler3D handler(ref, Lattice.LR_kc);
42 
43  // make sure initBreakup changes the default sigma
44  CHECK(handler.Sigma == Approx(Lattice.LR_kc));
45  handler.initBreakup(ref);
46  CHECK(handler.Sigma == Approx(std::sqrt(Lattice.LR_kc / (2.0 * Lattice.LR_rc))));
47 
48  std::cout << "handler.MaxKshell is " << handler.MaxKshell << std::endl;
49  CHECK( (std::is_same<OHMMS_PRECISION, OHMMS_PRECISION_FULL>::value ?
50  handler.MaxKshell == 78 : handler.MaxKshell >= 117 && handler.MaxKshell <= 128 ));
51  CHECK(handler.LR_rc == Approx(2.5));
52  CHECK(handler.LR_kc == Approx(12));
53 
54  mRealType r, dr, rinv;
55  mRealType vsr, vlr;
56  int nr = 101;
57  dr = 5.0 / nr; // L/[# of grid points]
58  for (int ir = 1; ir < nr; ir++)
59  {
60  r = ir * dr;
61  rinv = 1. / r;
62  vsr = handler.evaluate(r, rinv);
63  vlr = handler.evaluateLR(r);
64  // short-range part must vanish after rcut
65  if (r > 2.5)
66  CHECK(vsr == Approx(0.0));
67  // sum must recover the Coulomb potential
68  CHECK(vsr + vlr == Approx(rinv));
69  }
70 }
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
POLT::ParticleLayout Lattice
EwaldHandler3D::mRealType mRealType
TinyVector< SingleParticlePos, D > Rv
Real-space unit vectors.
Scalar_t Volume
Physical properties of a supercell.
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
void diagonal(const T &rhs)
Definition: Tensor.h:205
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

◆ TEST_CASE() [68/537]

qmcplusplus::TEST_CASE ( "vector"  ,
""  [OhmmsPETE] 
)

Definition at line 25 of file test_Vector.cpp.

References qmcplusplus::Units::distance::A, B(), qmcplusplus::Units::charge::C, CHECK(), and REQUIRE().

26 {
27  using vec_t = Vector<double>;
28  vec_t A(3);
29  vec_t B(3);
30 
31  // iterator
32  vec_t::iterator ia = A.begin();
33  for (; ia != A.end(); ia++)
34  {
35  *ia = 1.0;
36  }
37 
38  // Assignment. This eventually generates a call to 'evaluate' in OhmmsVector.h
39  // To do: pointer to tutorial on expression template techniques
40  B = A;
41 
42  // *= operator in OhmmVectorOperators.h
43  B *= 3.1;
44 
45  CHECK(B[0] == Approx(3.1));
46  CHECK(B[1] == Approx(3.1));
47  CHECK(B[2] == Approx(3.1));
48  REQUIRE(B == B);
49  REQUIRE(!(B == A));
50 
51  vec_t C(2);
52  REQUIRE(A != B);
53  REQUIRE(A != B);
54 }
TinyVector< double, 3 > vec_t
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
double B(double x, int k, int i, const std::vector< double > &t)

◆ TEST_CASE() [69/537]

qmcplusplus::TEST_CASE ( "vector"  ,
""  [OhmmsSoA] 
)

Definition at line 25 of file test_vector_soa.cpp.

References CHECK().

26 {
27  using vec_t = Vector<TinyVector<double, 3>>;
28  using vec_soa_t = VectorSoaContainer<double, 3>;
29 
30  vec_t R(4);
31  vec_soa_t RSoA(4);
32 
33  R[0] = TinyVector<double, 3>(0.00000000, 0.00000000, 0.00000000);
34  R[1] = TinyVector<double, 3>(1.68658058, 1.68658058, 1.68658058);
35  R[2] = TinyVector<double, 3>(3.37316115, 3.37316115, 0.00000000);
36  R[3] = TinyVector<double, 3>(5.05974172, 5.05974172, 1.68658058);
37 
38  RSoA.copyIn(R);
39 
40  //check in value
41  CHECK(R[1][0] == Approx(1.68658058));
42  CHECK(R[1][1] == Approx(1.68658058));
43  CHECK(R[1][2] == Approx(1.68658058));
44 
45  //check out value
46  CHECK(RSoA[1][0] == Approx(1.68658058));
47  CHECK(RSoA[1][1] == Approx(1.68658058));
48  CHECK(RSoA[1][2] == Approx(1.68658058));
49 
50  //check view value
51  vec_soa_t RSoA_view(RSoA.data(), RSoA.size(), RSoA.capacity());
52  CHECK(RSoA_view[1][0] == Approx(1.68658058));
53  CHECK(RSoA_view[1][1] == Approx(1.68658058));
54  CHECK(RSoA_view[1][2] == Approx(1.68658058));
55 }
TinyVector< double, 3 > vec_t
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [70/537]

qmcplusplus::TEST_CASE ( "Basic Gaussian"  ,
""  [numerics] 
)

Definition at line 25 of file test_gaussian_basis.cpp.

References CHECK(), GaussianCombo< T >::BasicGaussian::df(), GaussianCombo< T >::BasicGaussian::evaluate(), GaussianCombo< T >::BasicGaussian::f(), and GaussianCombo< T >::BasicGaussian::reset().

26 {
27  GaussianCombo<real_type>::BasicGaussian g1(3.0, 1.0);
28 
29  real_type alpha = 3.0;
30  g1.reset(alpha, 1.0);
31 
32  real_type r = 1.2;
33 
34  real_type f = g1.f(r * r);
35  //std::cout << "f = " << f << std::endl << std::endl;
36  CHECK(f == Approx(0.0132998835424438));
37 
38  real_type df = g1.df(r, r * r);
39  //std::cout << "df = " << df << std::endl << std::endl;
40  CHECK(df == Approx(-0.0957591615055951));
41 
42  df = 0.0;
43  real_type ddf = 0.0;
44  f = g1.evaluate(r, r * r, df, ddf);
45  //std::cout << "f = " << f << " " << df << " " << ddf << std::endl;
46  CHECK(f == Approx(0.0132998835424438));
47  CHECK(df == Approx(-0.0957591615055951));
48  CHECK(ddf == Approx(0.609666661585622));
49 
50  df = 0.0;
51  ddf = 0.0;
52  real_type d3f = 0.0;
53  f = g1.evaluate(r, r * r, df, ddf, d3f);
54  //std::cout << "f = " << f << " " << df << " " << ddf << " " << d3f << std::endl;
55  CHECK(f == Approx(0.0132998835424438));
56  CHECK(df == Approx(-0.0957591615055951));
57  CHECK(ddf == Approx(0.609666661585622));
58  CHECK(d3f == Approx(-3.24049002534934));
59 }
OHMMS_PRECISION real_type
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [71/537]

qmcplusplus::TEST_CASE ( "parsewords_empty"  ,
""  [utilities] 
)

Definition at line 25 of file test_parser.cpp.

References parsewords(), and REQUIRE().

26 {
27  string input = "";
28  vector<string> outlist;
29  unsigned int num = parsewords(input.c_str(), outlist);
30 
31  REQUIRE(num == 0);
32  REQUIRE(outlist.size() == 0);
33 }
REQUIRE(std::filesystem::exists(filename))
unsigned parsewords(const char *inbuf, std::vector< std::string > &slist, const std::string &extra_tokens)
testing::ValidSpinDensityInput input

◆ TEST_CASE() [72/537]

qmcplusplus::TEST_CASE ( "prime number set 32 bit"  ,
""  [utilities] 
)

Definition at line 26 of file test_prime_set.cpp.

References PrimeNumberSet< UIntType >::get(), REQUIRE(), and PrimeNumberSet< UIntType >::size().

27 {
29  //std::cout << "32 bit size = "<< pns.size() << std::endl;
30  REQUIRE(pns.size() == 4097);
31  REQUIRE(pns[0] == 3);
32 
33  std::vector<uint32_t> more_primes;
34  // get prime numbers already in the list
35  pns.get(1, 2, more_primes);
36  REQUIRE(more_primes.size() == 2);
37  REQUIRE(more_primes[0] == 5);
38 
39  // generate additional prime numbers
40  pns.get(4098, 2, more_primes);
41  REQUIRE(more_primes.size() == 4);
42  REQUIRE(more_primes[2] > pns[4096]);
43 }
class to generate prime numbers
size_t size() const
REQUIRE(std::filesystem::exists(filename))
bool get(UIntType offset, int n, std::vector< UIntType > &primes_add)
add n new primes starting with an offset

◆ TEST_CASE() [73/537]

qmcplusplus::TEST_CASE ( "ParallelExecutor<OPENMP> function case"  ,
""  [concurrency] 
)

Definition at line 26 of file test_ParallelExecutorOPENMP.cpp.

References omp_get_max_threads(), REQUIRE(), and TestTaskOMP().

27 {
28  const int num_threads = omp_get_max_threads();
29  ParallelExecutor<Executor::OPENMP> test_block;
30  int count(0);
31  test_block(num_threads, TestTaskOMP, std::ref(count));
32  REQUIRE(count == num_threads);
33 }
omp_int_t omp_get_max_threads()
Definition: OpenMP.h:26
REQUIRE(std::filesystem::exists(filename))
void TestTaskOMP(const int ip, int &counter)
Openmp generally works but is not guaranteed with std::atomic.

◆ TEST_CASE() [74/537]

qmcplusplus::TEST_CASE ( "SpinDensityInput::readXML"  ,
""  [estimators] 
)

Definition at line 26 of file test_SpinDensityInput.cpp.

References SpinDensityInput::calculateDerivedParameters(), CHECK(), doc, CrystalLattice< T, D >::explicitly_defined, SpinDensityInput::DerivedParameters::gdims, SpinDensityInput::get_cell(), Libxml2Document::getRoot(), SpinDensityInput::DerivedParameters::grid, lattice, qmcplusplus::testing::makeTestLattice(), node, SpinDensityInput::DerivedParameters::npoints, okay, Libxml2Document::parseFromString(), REQUIRE(), sdi, and ValidSpinDensityInput::xml.

27 {
28  using POLT = PtclOnLatticeTraits;
29  using Lattice = POLT::ParticleLayout;
30  using input = testing::ValidSpinDensityInput;
31  for (auto input_xml : input::xml)
32  {
34  bool okay = doc.parseFromString(input_xml);
35  REQUIRE(okay);
36  xmlNodePtr node = doc.getRoot();
37 
38  SpinDensityInput sdi(node);
39 
41  if (sdi.get_cell().explicitly_defined == true)
42  lattice = sdi.get_cell();
43  else
45 
46  SpinDensityInput::DerivedParameters dev_par = sdi.calculateDerivedParameters(lattice);
47 
48  CHECK(dev_par.npoints == 1000);
50  CHECK(dev_par.grid == grid);
52  CHECK(dev_par.gdims == gdims);
53  }
54 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
POLT::ParticleLayout Lattice
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
testing::ValidSpinDensityInput input
bool explicitly_defined
true, the lattice is defined by the input instead of an artificial default
PtclOnLatticeTraits POLT
SpinDensityInput sdi(node)
DerivedParameters calculateDerivedParameters(const Lattice &lattice) const
Derived parameters of SpinDensity.

◆ TEST_CASE() [75/537]

qmcplusplus::TEST_CASE ( "LRBreakupParameters"  ,
""  [lattice] 
)

Lattice is defined but Open BC is also used.

Definition at line 26 of file test_LRBreakupParameters.cpp.

References CHECK().

27 {
28  LRBreakupParameters<double, 3> myLR;
29 
31 
32  R[0][0] = 1.0;
33  R[1][1] = 1.0;
34  R[2][2] = 1.0;
35 
36  myLR.SetLRCutoffs(R);
37 
38  CHECK(myLR.LR_kc == Approx(30.0));
39 
40  R[0][0] = 2.0;
41  R[1][1] = 2.0;
42  R[2][2] = 3.0;
43 
44  myLR.SetLRCutoffs(R);
45 
46  CHECK(myLR.LR_kc == Approx(15.0));
47 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [76/537]

qmcplusplus::TEST_CASE ( "FS parse Sk file"  ,
""  [tools] 
)

Definition at line 26 of file test_qmcfstool.cpp.

References CHECK().

27 {
30  std::unique_ptr<SkParserBase> skparser = std::make_unique<SkParserASCII>();
31  std::string filename = "simple_Sk.dat";
32  skparser->parse(filename);
33  std::vector<RealType> sk = skparser->get_sk_raw();
34  std::vector<RealType> skerr = skparser->get_skerr_raw();
35  std::vector<PosType> grid = skparser->get_grid_raw();
36 
37  CHECK(grid[0][0] == Approx(0.0));
38  CHECK(grid[0][1] == Approx(0.0));
39  CHECK(grid[0][2] == Approx(-6.283185307179586));
40  CHECK(sk[0] == Approx(0.07225651367144714));
41  CHECK(skerr[0] == Approx(0.01));
42 
43  int last = sk.size() - 1;
44  CHECK(grid[last][0] == Approx(-18.84955592153876));
45  CHECK(grid[last][1] == Approx(18.84955592153876));
46  CHECK(grid[last][2] == Approx(75.39822368615503));
47  CHECK(sk[last] == Approx(0.9999947116274186));
48  CHECK(skerr[last] == Approx(0.01));
49 }
QMCTraits::PosType PosType
QMCTraits::RealType RealType
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [77/537]

qmcplusplus::TEST_CASE ( "SampleStack"  ,
""  [particle] 
)

Definition at line 26 of file test_sample_stack.cpp.

References SampleStack::appendSample(), CHECK(), SampleStack::clearEnsemble(), MCSample::convertToWalker(), SampleStack::getGlobalNumSamples(), SampleStack::getMaxSamples(), SampleStack::getNumSamples(), SampleStack::getSample(), REQUIRE(), SampleStack::resetSampleCount(), and SampleStack::setMaxSamples().

27 {
28  SampleStack samples;
29 
30  const int total_num = 2; // number of particles
31 
32  // reserve storage
33  int nranks = 2;
34  samples.setMaxSamples(8, nranks);
35  REQUIRE(samples.getMaxSamples() == 8);
36  REQUIRE(samples.getNumSamples() == 0);
37  REQUIRE(samples.getGlobalNumSamples() == 16);
38 
39  // increase storage
40  samples.setMaxSamples(10);
41  REQUIRE(samples.getMaxSamples() == 10);
42  REQUIRE(samples.getNumSamples() == 0);
43 
44  using Walker_t = ParticleSet::Walker_t;
45  using WalkerList_t = std::vector<std::unique_ptr<Walker_t>>;
46 
47  WalkerList_t walker_list;
48 
49  // Add size one list
50  walker_list.push_back(std::make_unique<Walker_t>(total_num));
51  walker_list[0]->R[0][0] = 1.1;
52  for (auto& wi : walker_list)
53  {
54  samples.appendSample(MCSample(*wi));
55  }
56  REQUIRE(samples.getNumSamples() == 1);
57 
58  Walker_t w1;
59  samples.getSample(0).convertToWalker(w1);
60  CHECK(w1.R[0][0] == Approx(1.1));
61 
62  // Should test that more members of the Walker are saved correctly
63 
64  samples.resetSampleCount();
65  REQUIRE(samples.getNumSamples() == 0);
66 
67  // clear storage
68  samples.clearEnsemble();
69  REQUIRE(samples.getNumSamples() == 0);
70 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [78/537]

qmcplusplus::TEST_CASE ( "rocSolverInverter_bench"  ,
""  [wavefunction][benchmark] 
)

Definition at line 26 of file benchmark_rocSolverInverter.cpp.

References check_matrix_result, CHECKED_ELSE(), checkMatrix(), rocSolverInverter< T_FP >::invert_transpose(), DiracMatrix< T_FP >::invert_transpose(), qmcplusplus::Units::distance::m, qmcplusplus::testing::makeRngSpdMatrix(), qmcplusplus::Units::force::N, and Matrix< T, Alloc >::resize().

27 {
28 #ifdef QMC_COMPLEX
29  using FullPrecValue = std::complex<double>;
30 #else
31  using FullPrecValue = double;
32 #endif
33 
34  rocSolverInverter<FullPrecValue> solver;
35 
36  const int N = 1024;
37 
38  Matrix<FullPrecValue> m(N, N);
39  Matrix<FullPrecValue> m_invT(N, N);
40  Matrix<FullPrecValue> m_invT_CPU(N, N);
41  Matrix<FullPrecValue, CUDAAllocator<FullPrecValue>> m_invGPU;
42  std::complex<double> log_value;
43  m.resize(N, N);
44  m_invT.resize(N, N);
45  m_invT_CPU.resize(N, N);
46  m_invGPU.resize(N, N);
47 
48  testing::MakeRngSpdMatrix<FullPrecValue> makeRngSpdMatrix{};
50 
51  BENCHMARK("rocSolverInverter") { solver.invert_transpose(m, m_invT, m_invGPU, log_value); };
52 
53  DiracMatrix<FullPrecValue> dmat;
54  BENCHMARK("CPU") { dmat.invert_transpose(m, m_invT_CPU, log_value); };
55 
56  auto check_matrix_result = checkMatrix(m_invT, m_invT_CPU);
57  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
58 }
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
void makeRngSpdMatrix(testing::RandomForTest< RngValueType< T >> &rng, Matrix< T > &mat_spd)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63

◆ TEST_CASE() [79/537]

qmcplusplus::TEST_CASE ( "Resource"  ,
""  [utilities] 
)

Definition at line 27 of file test_ResourceCollection.cpp.

References REQUIRE().

28 {
29  auto mem_res = std::make_unique<MemoryResource>("test_res");
30  mem_res->data.resize(5);
31 
32  auto res_copy = mem_res->makeClone();
33  auto& res_copy_ref = dynamic_cast<MemoryResource&>(*res_copy);
34  REQUIRE(res_copy_ref.data.size() == 5);
35 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [80/537]

qmcplusplus::TEST_CASE ( "J1 spin evaluate derivatives Jastrow"  ,
""  [wavefunction] 
)

Definition at line 27 of file test_J1Spin.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), OHMMS::Controller, ParticleSet::create(), doc, ParticleSet::G, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), ispecies, ParticleSet::L, log(), okay, Libxml2Document::parseFromString(), ParticleSet::R, VariableSet::removeInactive(), REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), VariableSet::size_of_active(), twf, and ParticleSet::update().

28 {
30 
31  ParticleSetPool ptcl = ParticleSetPool(c);
32  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
33  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
34  ParticleSet& ions_(*ions_uptr);
35  ParticleSet& elec_(*elec_uptr);
36 
37  ions_.setName("ion0");
38  ptcl.addParticleSet(std::move(ions_uptr));
39  ions_.create({1});
40  ions_.R[0] = {0.0, 0.0, 0.0};
41  SpeciesSet& ispecies = ions_.getSpeciesSet();
42  int HIdx = ispecies.addSpecies("H");
43  int ichargeIdx = ispecies.addAttribute("charge");
44  ispecies(ichargeIdx, HIdx) = 1.0;
45 
46  elec_.setName("e");
47  ptcl.addParticleSet(std::move(elec_uptr));
48  elec_.create({1, 1});
49  elec_.R[0] = {0.5, 0.5, 0.5};
50  elec_.R[1] = {-0.5, -0.5, -0.5};
51 
52  SpeciesSet& tspecies = elec_.getSpeciesSet();
53  int upIdx = tspecies.addSpecies("u");
54  int downIdx = tspecies.addSpecies("d");
55  int massIdx = tspecies.addAttribute("mass");
56  int chargeIdx = tspecies.addAttribute("charge");
57  tspecies(massIdx, upIdx) = 1.0;
58  tspecies(massIdx, downIdx) = 1.0;
59  tspecies(chargeIdx, upIdx) = -1.0;
60  tspecies(massIdx, downIdx) = -1.0;
61  // Necessary to set mass
62  elec_.resetGroups();
63 
64  ions_.update();
65  elec_.addTable(elec_);
66  elec_.addTable(ions_);
67  elec_.update();
68 
69  const char* jasxml = R"(<wavefunction name="psi0" target="e">
70 <jastrow name="J1" type="One-Body" function="Bspline" print="yes" source="ion0" spin="yes">
71  <correlation speciesA="H" speciesB="u" cusp="0.0" size="2" rcut="5.0">
72  <coefficients id="J1uH" type="Array"> 0.5 0.1 </coefficients>
73  </correlation>
74  <correlation speciesA="H" speciesB="d" cusp="0.0" size="2" rcut="5.0">
75  <coefficients id="J1dH" type="Array"> 0.5 0.1 </coefficients>
76  </correlation>
77 </jastrow>
78 </wavefunction>
79 )";
81  bool okay = doc.parseFromString(jasxml);
82  REQUIRE(okay);
83  xmlNodePtr jas1 = doc.getRoot();
84  WaveFunctionFactory wf_factory(elec_, ptcl.getPool(), c);
85  RuntimeOptions runtime_options;
86  auto twf_ptr = wf_factory.buildTWF(jas1, runtime_options);
87  auto& twf(*twf_ptr);
88  twf.setMassTerm(elec_);
89  auto& twf_component_list = twf.getOrbitals();
90  auto cloned_j1spin = twf_component_list[0]->makeClone(elec_);
91 
92  opt_variables_type active;
93  twf.checkInVariables(active);
94  active.removeInactive();
95  int nparam = active.size_of_active();
96  REQUIRE(nparam == 4);
97 
98  // check logs
99  //evaluateLog += into G + L so reset
100  elec_.G = 0.0;
101  elec_.L = 0.0;
102  LogValue log = twf_component_list[0]->evaluateLog(elec_, elec_.G, elec_.L);
103  LogValue expected_log{-0.568775, 0.0};
104  CHECK(log == LogComplexApprox(expected_log));
105  //evaluateLog += into G + L so reset
106  elec_.G = 0.0;
107  elec_.L = 0.0;
108  LogValue cloned_log = cloned_j1spin->evaluateLog(elec_, elec_.G, elec_.L);
109  CHECK(cloned_log == LogComplexApprox(expected_log));
110 
111  // check derivatives
112  twf.evaluateLog(elec_);
113  Vector<ValueType> dlogpsi(nparam);
114  Vector<ValueType> dhpsioverpsi(nparam);
115  Vector<ValueType> cloned_dlogpsi(nparam);
116  Vector<ValueType> cloned_dhpsioverpsi(nparam);
117 
118  twf_component_list[0]->evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
119  cloned_j1spin->evaluateDerivatives(elec_, active, cloned_dlogpsi, cloned_dhpsioverpsi);
120  // Numbers not validated
121  std::vector<ValueType> expected_dlogpsi = {-0.46681472435, -0.5098025897, -0.46681472435, -0.5098025897};
122  std::vector<ValueType> expected_dhpsioverpsi = {-0.5798216548, 0.37977462695, -0.5798216548, 0.37977462695};
123  for (int i = 0; i < nparam; i++)
124  {
125  CHECK(dlogpsi[i] == ValueApprox(expected_dlogpsi[i]));
126  CHECK(cloned_dlogpsi[i] == ValueApprox(expected_dlogpsi[i]));
127  CHECK(dhpsioverpsi[i] == ValueApprox(expected_dhpsioverpsi[i]));
128  CHECK(cloned_dhpsioverpsi[i] == ValueApprox(expected_dhpsioverpsi[i]));
129  }
130 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Catch::Detail::LogComplexApprox LogComplexApprox
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::complex< double > LogValue

◆ TEST_CASE() [81/537]

qmcplusplus::TEST_CASE ( "QMCTypes"  ,
""  [type_traits] 
)

Definition at line 27 of file test_qmctypes.cpp.

28 {
29  TestQMCTypes<float> float_test;
30  TestQMCTypes<double> double_test;
31 
32  // This should cause compiler error
33  // Realtype and ValueType precision do not match
34  //TestDeviceCUDA<float, double> pv_mismatch_test;
35  //REQUIRE(floatTest);
36 }

◆ TEST_CASE() [82/537]

qmcplusplus::TEST_CASE ( "EngineHandle construction"  ,
""  [drivers] 
)

This provides a basic test of constructing an EngineHandle object and checking information in it.

Definition at line 27 of file test_EngineHandle.cpp.

References app_log(), OHMMS::Controller, doc, Libxml2Document::getRoot(), okay, Libxml2Document::parseFromString(), DescentEngine::processXML(), and REQUIRE().

28 {
30 
31 
32  const std::string engine_input("<tmp> </tmp>");
33 
35  bool okay = doc.parseFromString(engine_input);
36  REQUIRE(okay);
37 
38  xmlNodePtr fakeXML = doc.getRoot();
39 
40  DescentEngine descentEngineObj = DescentEngine(c, fakeXML);
41 
42  descentEngineObj.processXML(fakeXML);
43 
44  app_log() << "Test of DescentEngineHandle construction" << std::endl;
45  std::unique_ptr<DescentEngineHandle> handle = std::make_unique<DescentEngineHandle>(descentEngineObj);
46 
47 
48  const int fake_num_params = 5;
49  const int fake_sample_num = 100;
50  handle->prepareSampling(fake_num_params, fake_sample_num);
51  auto& test_der_rat_samp = handle->getVector();
52 
53  REQUIRE(test_der_rat_samp.size() == 6);
54  REQUIRE(test_der_rat_samp[0] == 0.0);
55 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [83/537]

qmcplusplus::TEST_CASE ( "OneBodyDensityMatricesInput::from_xml"  ,
""  [estimators] 
)

Definition at line 27 of file test_OneBodyDensityMatricesInput.cpp.

References doc, Libxml2Document::getRoot(), node, obdmi, okay, Libxml2Document::parseFromString(), and REQUIRE().

28 {
29  using POLT = PtclOnLatticeTraits;
30  using Lattice = POLT::ParticleLayout;
31  using valid_input = testing::ValidOneBodyDensityMatricesInput;
32  for (auto input_xml : valid_input::xml)
33  {
35  bool okay = doc.parseFromString(input_xml);
36  REQUIRE(okay);
37  xmlNodePtr node = doc.getRoot();
38  OneBodyDensityMatricesInput obdmi(node);
39  }
40 
41  using invalid_input = testing::InvalidOneBodyDensityMatricesInput;
42  for (auto input_xml : invalid_input::xml)
43  {
45  bool okay = doc.parseFromString(input_xml);
46  REQUIRE(okay);
47  xmlNodePtr node = doc.getRoot();
48 
49  CHECK_THROWS_AS(OneBodyDensityMatricesInput(node), UniformCommunicateError);
50  }
51 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
POLT::ParticleLayout Lattice
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
OneBodyDensityMatricesInput obdmi(node)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
PtclOnLatticeTraits POLT

◆ TEST_CASE() [84/537]

qmcplusplus::TEST_CASE ( "checkMatrix_OhmmsMatrix_real"  ,
""  [utilities][for_testing] 
)

Definition at line 27 of file test_checkMatrix.cpp.

References CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), qmcplusplus::Units::charge::e, REQUIRE(), and Matrix< T, Alloc >::resize().

28 {
29  Matrix<double> a_mat;
30  a_mat.resize(3, 3);
31  a_mat(0, 0) = 2.3;
32  a_mat(0, 1) = 4.5;
33  a_mat(0, 2) = 2.6;
34  a_mat(1, 0) = 0.5;
35  a_mat(1, 1) = 8.5;
36  a_mat(1, 2) = 3.3;
37  a_mat(2, 0) = 1.8;
38  a_mat(2, 1) = 4.4;
39  a_mat(2, 2) = 4.9;
40 
41  Matrix<double> b_mat;
42  b_mat.resize(3, 3);
43  b_mat(0, 0) = 2.3;
44  b_mat(0, 1) = 4.5;
45  b_mat(0, 2) = 2.6;
46  b_mat(1, 0) = 0.5;
47  b_mat(1, 1) = 8.5;
48  b_mat(1, 2) = 3.3;
49  b_mat(2, 0) = 1.8;
50  b_mat(2, 1) = 4.4;
51  b_mat(2, 2) = 4.9;
52 
53  auto check_matrix_result = checkMatrix(a_mat, b_mat);
54  // This would be how you would fail and print the information about what element failed.
55  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
56 
57  //check with epsilon
58  b_mat(0,2) = 2.6005;
59  check_matrix_result = checkMatrix(a_mat, b_mat, false, 1e-4);
60  REQUIRE(check_matrix_result.result == false);
61  check_matrix_result = checkMatrix(a_mat, b_mat, false, 1e-3);
62  REQUIRE(check_matrix_result.result == true);
63 
64  b_mat.resize(4, 4);
65  b_mat(0, 0) = 2.3;
66  b_mat(0, 1) = 4.5;
67  b_mat(0, 2) = 2.6;
68  b_mat(1, 0) = 0.5;
69  b_mat(1, 1) = 8.5;
70  b_mat(1, 2) = 3.3;
71  b_mat(2, 0) = 1.8;
72  b_mat(2, 1) = 4.4;
73  b_mat(2, 2) = 4.9;
74 
75  check_matrix_result = checkMatrix(a_mat, b_mat);
76  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
77 
78  b_mat(0, 0) = 1.0;
79  b_mat(1,1) = 3.6;
80  check_matrix_result = checkMatrix(a_mat, b_mat, true);
81  std::string::size_type pos = 0;
82  int lines = 0;
83  while (true)
84  {
85  pos = check_matrix_result.result_message.find("\n", pos);
86  if (pos == std::string::npos)
87  break;
88  ++pos;
89  ++lines;
90  }
91  CHECK(lines == 2);
92  REQUIRE(check_matrix_result.result == false);
93 }
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
REQUIRE(std::filesystem::exists(filename))
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [85/537]

qmcplusplus::TEST_CASE ( "FakeRandom set_value"  ,
""  [utilities] 
)

Definition at line 27 of file test_FakeRandom.cpp.

References CHECK(), and FakeRandom< T >::set_value().

28 {
29  FakeRandom<double> our_rng;
30  double expected = 0.25;
31  our_rng.set_value(expected);
32  for (auto i = 0; i < 3; ++i)
33  CHECK(our_rng() == Approx(expected));
34 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [86/537]

qmcplusplus::TEST_CASE ( "RandomNumberControl make_seeds"  ,
""  [ohmmsapp] 
)

Definition at line 28 of file test_rng_control.cpp.

References RandomNumberControl::Children, RandomNumberControl::make_seeds(), and REQUIRE().

29 {
30  RandomNumberControl::make_seeds();
31 
32  REQUIRE(RandomNumberControl::Children.size() > 0);
33 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [87/537]

qmcplusplus::TEST_CASE ( "Crystal_lattice_periodic_bulk"  ,
""  [lattice] 
)

Lattice is defined but Open BC is also used.

Definition at line 28 of file test_CrystalLattice.cpp.

References CrystalLattice< T, D >::BoxBConds, CHECK(), Tensor< T, D >::diagonal(), CrystalLattice< T, D >::isValid(), CrystalLattice< T, D >::outOfBound(), CrystalLattice< T, D >::R, REQUIRE(), CrystalLattice< T, D >::reset(), and CrystalLattice< T, D >::Volume.

29 {
30  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> Lattice;
31  Lattice.BoxBConds = false; // Open BC
32  Lattice.R.diagonal(0.4);
33  Lattice.reset();
34 
35  CHECK(Lattice.Volume == Approx(0.4 * 0.4 * 0.4));
36 
37  vec_t v3(0.6, 1.2, -1.7);
38  REQUIRE(Lattice.isValid(v3) == false);
39  REQUIRE(Lattice.outOfBound(v3) == true);
40 
41  vec_t v4(0.45, 0.2, 0.1);
42  REQUIRE(Lattice.isValid(v4) == true);
43  REQUIRE(Lattice.outOfBound(v4) == false);
44 }
bool isValid(const TinyVector< T, D > &u) const
return true if all the open direction of reduced coordinates u are in the range [0,1)
TinyVector< double, 3 > vec_t
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
POLT::ParticleLayout Lattice
Scalar_t Volume
Physical properties of a supercell.
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
REQUIRE(std::filesystem::exists(filename))
void diagonal(const T &rhs)
Definition: Tensor.h:205
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool outOfBound(const TinyVector< T, D > &u) const
return true if any direction of reduced coordinates u goes larger than 0.5
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

◆ TEST_CASE() [88/537]

qmcplusplus::TEST_CASE ( "Cartesian Tensor ,
""  [numerics] 
)

Definition at line 28 of file test_cartesian_tensor.cpp.

References CHECK(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::evaluate(), and CartesianTensor< T, Point_t, Tensor_t, GGG_t >::getYlm().

29 {
31 
32  TinyVector<double, 3> pt(1.3, 1.2, -0.5);
33  //TinyVector<double, 3> pt(1.3, 0.0, 0.0);
34 
35  ct.evaluate(pt);
36 
37  //for (int i = 0; i < 35; i++) {
38  //std::cout << "XYZ = " << i << " " << ct.getYlm(i) << std::endl;
39  //}
40  CHECK(ct.getYlm(0) == Approx(0.282094791774));
41  CHECK(ct.getYlm(1) == Approx(0.635183265474));
42  CHECK(ct.getYlm(2) == Approx(0.586323014284));
43  CHECK(ct.getYlm(3) == Approx(-0.244301255951));
44  CHECK(ct.getYlm(4) == Approx(1.06602349055));
45  CHECK(ct.getYlm(5) == Approx(0.908327707927));
46  CHECK(ct.getYlm(6) == Approx(0.157695782626));
47  CHECK(ct.getYlm(7) == Approx(1.70437555172));
48  CHECK(ct.getYlm(8) == Approx(-0.710156479885));
49  CHECK(ct.getYlm(9) == Approx(-0.655529058355));
50  CHECK(ct.getYlm(10) == Approx(1.6397368054));
51  CHECK(ct.getYlm(11) == Approx(1.28969740543));
52  CHECK(ct.getYlm(12) == Approx(-0.0932940831475));
53  CHECK(ct.getYlm(13) == Approx(3.38451965731));
54  CHECK(ct.getYlm(14) == Approx(-1.41021652388));
55  CHECK(ct.getYlm(15) == Approx(3.12417199136));
56  CHECK(ct.getYlm(16) == Approx(-1.20160461206));
57  CHECK(ct.getYlm(17) == Approx(0.542390970723));
58  CHECK(ct.getYlm(18) == Approx(0.500668588359));
59  CHECK(ct.getYlm(19) == Approx(-2.25467692526));
60  CHECK(ct.getYlm(20) == Approx(2.41707280436));
61  CHECK(ct.getYlm(21) == Approx(1.75485528067));
62  CHECK(ct.getYlm(22) == Approx(0.0528927734576));
63  CHECK(ct.getYlm(23) == Approx(5.90305249944));
64  CHECK(ct.getYlm(24) == Approx(-2.4596052081));
65  CHECK(ct.getYlm(25) == Approx(5.02981988118));
66  CHECK(ct.getYlm(26) == Approx(-1.93454610815));
67  CHECK(ct.getYlm(27) == Approx(-0.363846924275));
68  CHECK(ct.getYlm(28) == Approx(-0.335858699331));
69  CHECK(ct.getYlm(29) == Approx(7.03459200681));
70  CHECK(ct.getYlm(30) == Approx(1.22128333452));
71  CHECK(ct.getYlm(31) == Approx(1.04062011935));
72  CHECK(ct.getYlm(32) == Approx(-5.07677948596));
73  CHECK(ct.getYlm(33) == Approx(-4.68625798704));
74  CHECK(ct.getYlm(34) == Approx(1.9526074946));
75  CHECK(ct.getYlm(35) == Approx(3.47382688598));
76  CHECK(ct.getYlm(36) == Approx(2.32807861094));
77  CHECK(ct.getYlm(37) == Approx(-0.0292375806134));
78  CHECK(ct.getYlm(38) == Approx(9.61982829963));
79  CHECK(ct.getYlm(39) == Approx(-4.00826179151));
80  CHECK(ct.getYlm(40) == Approx(7.56625548555));
81  CHECK(ct.getYlm(41) == Approx(-2.91009826367));
82  CHECK(ct.getYlm(42) == Approx(0.228053128784));
83  CHECK(ct.getYlm(43) == Approx(0.210510580416));
84  CHECK(ct.getYlm(44) == Approx(13.5641819555));
85  CHECK(ct.getYlm(45) == Approx(2.35489270061));
86  CHECK(ct.getYlm(46) == Approx(12.5207833436));
87  CHECK(ct.getYlm(47) == Approx(1.85218688514));
88  CHECK(ct.getYlm(48) == Approx(-0.905727961775));
89  CHECK(ct.getYlm(49) == Approx(-0.771744535477));
90  CHECK(ct.getYlm(50) == Approx(-9.78910512921));
91  CHECK(ct.getYlm(51) == Approx(-8.34101265448));
92  CHECK(ct.getYlm(52) == Approx(-1.44809247474));
93  CHECK(ct.getYlm(53) == Approx(-11.6655511199));
94  CHECK(ct.getYlm(54) == Approx(4.86064629996));
95  CHECK(ct.getYlm(55) == Approx(4.48675043074));
96  CHECK(ct.getYlm(56) == Approx(4.90938236205));
97  CHECK(ct.getYlm(57) == Approx(3.03706593382));
98  CHECK(ct.getYlm(58) == Approx(0.0158923005669));
99  CHECK(ct.getYlm(59) == Approx(15.0300731514));
100  CHECK(ct.getYlm(60) == Approx(-6.26253047974));
101  CHECK(ct.getYlm(61) == Approx(10.9122088466));
102  CHECK(ct.getYlm(62) == Approx(-4.19700340252));
103  CHECK(ct.getYlm(63) == Approx(-0.137042874894));
104  CHECK(ct.getYlm(64) == Approx(-0.126501115286));
105  CHECK(ct.getYlm(65) == Approx(24.0303233904));
106  CHECK(ct.getYlm(66) == Approx(4.17193114417));
107  CHECK(ct.getYlm(67) == Approx(20.4755418238));
108  CHECK(ct.getYlm(68) == Approx(3.0289263053));
109  CHECK(ct.getYlm(69) == Approx(0.61714957754));
110  CHECK(ct.getYlm(70) == Approx(0.525855261336));
111  CHECK(ct.getYlm(71) == Approx(-17.3423920977));
112  CHECK(ct.getYlm(72) == Approx(-13.6402610582));
113  CHECK(ct.getYlm(73) == Approx(0.986708699234));
114  CHECK(ct.getYlm(74) == Approx(26.2459034569));
115  CHECK(ct.getYlm(75) == Approx(-1.89857519219));
116  CHECK(ct.getYlm(76) == Approx(-1.49328080661));
117  CHECK(ct.getYlm(77) == Approx(-24.4531767752));
118  CHECK(ct.getYlm(78) == Approx(10.1888236563));
119  CHECK(ct.getYlm(79) == Approx(-22.5721631771));
120  CHECK(ct.getYlm(80) == Approx(8.68160122197));
121  CHECK(ct.getYlm(81) == Approx(-3.91877832936));
122  CHECK(ct.getYlm(82) == Approx(-3.61733384249));
123  CHECK(ct.getYlm(83) == Approx(12.1418905657));
124 }
The template parameters.
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [89/537]

qmcplusplus::TEST_CASE ( "double_1d_grid_functor"  ,
""  [numerics] 
)

Definition at line 28 of file test_grid_functor.cpp.

References CHECK(), OneDimGridBase< T, CT >::dh(), OneDimGridBase< T, CT >::dr(), LinearGrid< T, CT >::makeClone(), REQUIRE(), OneDimGridBase< T, CT >::rmax(), OneDimGridBase< T, CT >::rmin(), LinearGrid< T, CT >::set(), and OneDimGridBase< T, CT >::size().

29 {
30  LinearGrid<double> grid;
31  OneDimGridFunctor<double> f(grid.makeClone());
32 
33  grid.set(0.0, 1.0, 3);
34 
35  REQUIRE(grid.size() == 3);
36  REQUIRE(grid.rmin() == 0.0);
37  REQUIRE(grid.rmax() == 1.0);
38  CHECK(grid.dh() == Approx(0.5));
39  CHECK(grid.dr(1) == Approx(0.5));
40 }
REQUIRE(std::filesystem::exists(filename))
Linear Grid inherets from Grid.
Definition: Grid.h:73
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [90/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A Ewald3D"  ,
""  [hamiltonian] 
)

Definition at line 28 of file test_coulomb_pbcAA_ewald.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evalConsts(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, and ParticleSet::setName().

29 {
30  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
31  lattice.BoxBConds = true; // periodic
32  lattice.R.diagonal(1.0);
33  lattice.reset();
34 
35  const SimulationCell simulation_cell(lattice);
36  ParticleSet ions(simulation_cell);
37 
38  ions.setName("ion");
39  ions.create({1});
40  ions.R[0] = {0.0, 0.0, 0.0};
41  SpeciesSet& ion_species = ions.getSpeciesSet();
42  int pIdx = ion_species.addSpecies("H");
43  int pChargeIdx = ion_species.addAttribute("charge");
44  ion_species(pChargeIdx, pIdx) = 1;
45  ions.createSK();
46 
47  LRCoulombSingleton::CoulombHandler = std::make_unique<EwaldHandler3D>(ions);
48  LRCoulombSingleton::CoulombHandler->initBreakup(ions);
49 
50 
51  CoulombPBCAA caa(ions, false, false, false);
52  // Background charge term
53  double consts = caa.evalConsts();
54  CHECK(consts == Approx(-3.142553)); // not validated
55 
56  double val = caa.evaluate(ions);
57  CHECK(val == Approx(-1.418927)); // not validated
58 
59  LRCoulombSingleton::CoulombHandler.reset(nullptr);
60 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [91/537]

qmcplusplus::TEST_CASE ( "MCPopulation::createWalkers"  ,
""  [particle][population] 
)

Definition at line 28 of file test_MCPopulation.cpp.

References CHECK(), comm, OHMMS::Controller, WalkerConfigurations::createWalkers(), MCPopulation::createWalkers(), WalkerConfigurations::getActiveWalkers(), hamiltonian_pool, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), MinimalHamiltonianPool::make_hamWithEE(), particle_pool, Communicate::rank(), WalkerConfigurations::resize(), twf, and wavefunction_pool.

29 {
30  using namespace testing;
31 
32  RuntimeOptions runtime_options;
34 
35  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
36  auto wavefunction_pool = MinimalWaveFunctionPool::make_diamondC_1x1x1(runtime_options, comm, particle_pool);
37  auto hamiltonian_pool = MinimalHamiltonianPool::make_hamWithEE(comm, particle_pool, wavefunction_pool);
38  TrialWaveFunction twf(runtime_options);
39  WalkerConfigurations walker_confs;
40 
41  // Test is intended to be run on one rank
42  MCPopulation population(1, comm->rank(), particle_pool.getParticleSet("e"), &twf, hamiltonian_pool.getPrimary());
43 
44  population.createWalkers(8, walker_confs, 2.0);
45  CHECK(population.get_walkers().size() == 8);
46  CHECK(population.get_dead_walkers().size() == 8);
47  CHECK(population.get_num_local_walkers() == 8);
48  population.saveWalkerConfigurations(walker_confs);
49  CHECK(walker_confs.getActiveWalkers() == 8);
50 
51  MCPopulation population2(1, comm->rank(), particle_pool.getParticleSet("e"), &twf, hamiltonian_pool.getPrimary());
52  // keep 3 only configurations.
53  walker_confs.resize(3, 0);
54  CHECK(walker_confs.getActiveWalkers() == 3);
55  auto old_R00 = walker_confs[0]->R[0][0];
56  // first and second configurations are both copied from the gold particle set.
57  // must be identical.
58  CHECK(walker_confs[1]->R[0][0] == old_R00);
59  // modify the first configuration
60  auto new_R00 = walker_confs[1]->R[0][0] = 0.3;
61  population2.createWalkers(8, walker_confs, 1.0);
62  CHECK(population2.get_walkers()[0]->R[0][0] == old_R00);
63  CHECK(population2.get_walkers()[1]->R[0][0] == new_R00);
64  CHECK(population2.get_walkers()[2]->R[0][0] == old_R00);
65  CHECK(population2.get_walkers()[3]->R[0][0] == old_R00);
66  CHECK(population2.get_walkers()[4]->R[0][0] == new_R00);
67  CHECK(population2.get_walkers()[5]->R[0][0] == old_R00);
68  CHECK(population2.get_walkers()[6]->R[0][0] == old_R00);
69  CHECK(population2.get_walkers()[7]->R[0][0] == new_R00);
70 }
int rank() const
return the rank
Definition: Communicate.h:116
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [92/537]

qmcplusplus::TEST_CASE ( "particle_attrib_scalar"  ,
""  [particle_base] 
)

Definition at line 28 of file test_particle_attrib.cpp.

References REQUIRE(), Vector< T, Alloc >::resize(), and Vector< T, Alloc >::size().

29 {
30  ParticleAttrib<double> PA1;
31  REQUIRE(PA1.size() == 0);
32 
33  PA1.resize(4);
34  REQUIRE(PA1.size() == 4);
35 
36  ParticleAttrib<double> PA3(3);
37  REQUIRE(PA3.size() == 3);
38 
39  REQUIRE(PA3[0] == 0.0);
40  // Whole array operation
41  PA3 = 1.0;
42  REQUIRE(PA3[0] == 1.0);
43  REQUIRE(PA3[1] == 1.0);
44  REQUIRE(PA3[2] == 1.0);
45 
46  // Single element
47  PA3[0] = 2.0;
48  REQUIRE(PA3[0] == 2.0);
49  REQUIRE(PA3[1] == 1.0);
50 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [93/537]

qmcplusplus::TEST_CASE ( "read_lattice_xml"  ,
""  [particle_io][xml] 
)

Definition at line 28 of file test_lattice_parser.cpp.

References CHECK(), doc, Libxml2Document::getRoot(), okay, Libxml2Document::parseFromString(), LatticeParser::put(), CrystalLattice< T, D >::R, REQUIRE(), and CrystalLattice< T, D >::Volume.

29 {
30  SECTION("valid p p p input")
31  {
32  const char* const particles = R"(
33  <tmp>
34  <parameter name="lattice" units="bohr">
35  3.80000000 0.00000000 0.00000000
36  0.00000000 3.80000000 0.00000000
37  0.00000000 0.00000000 3.80000000
38  </parameter>
39  <parameter name="bconds">
40  p p p
41  </parameter>
42  <parameter name="LR_dim_cutoff">20</parameter>
43  </tmp>
44  )";
45 
47  bool okay = doc.parseFromString(particles);
48  REQUIRE(okay);
49 
50  xmlNodePtr root = doc.getRoot();
51 
52  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> uLattice;
53  LatticeParser lp(uLattice);
54  REQUIRE_NOTHROW(lp.put(root));
55 
56  CHECK(uLattice.R[0] == Approx(3.8));
57  CHECK(uLattice.Volume == Approx(3.8 * 3.8 * 3.8));
58 
59  CHECK(uLattice.LR_dim_cutoff == Approx(20));
60  }
61 
62  SECTION("invalid n p p input")
63  {
64  const char* const particles = R"(
65  <tmp>
66  <parameter name="lattice" units="bohr">
67  3.80000000 0.00000000 0.00000000
68  0.00000000 3.80000000 0.00000000
69  0.00000000 0.00000000 3.80000000
70  </parameter>
71  <parameter name="bconds">
72  n p p
73  </parameter>
74  <parameter name="LR_dim_cutoff">20</parameter>
75  </tmp>
76  )";
77 
79  bool okay = doc.parseFromString(particles);
80  REQUIRE(okay);
81 
82  xmlNodePtr root = doc.getRoot();
83 
84  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> uLattice;
85  LatticeParser lp(uLattice);
86  REQUIRE_THROWS_WITH(lp.put(root),
87  "LatticeParser::put. In \"bconds\", non periodic directions must be placed after the periodic "
88  "ones.");
89  }
90 
91  SECTION("invalid p n p input")
92  {
93  const char* const particles = R"(
94  <tmp>
95  <parameter name="lattice" units="bohr">
96  3.80000000 0.00000000 0.00000000
97  0.00000000 3.80000000 0.00000000
98  0.00000000 0.00000000 3.80000000
99  </parameter>
100  <parameter name="bconds">
101  p n p
102  </parameter>
103  <parameter name="LR_dim_cutoff">20</parameter>
104  </tmp>
105  )";
106 
108  bool okay = doc.parseFromString(particles);
109  REQUIRE(okay);
110 
111  xmlNodePtr root = doc.getRoot();
112 
113  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> uLattice;
114  LatticeParser lp(uLattice);
115  REQUIRE_THROWS_WITH(lp.put(root),
116  "LatticeParser::put. In \"bconds\", non periodic directions must be placed after the periodic "
117  "ones.");
118  }
119 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [94/537]

qmcplusplus::TEST_CASE ( "read_particleset_xml"  ,
""  [particle_io][xml] 
)

Definition at line 28 of file test_xml_io.cpp.

References CHECK(), doc, OhmmsElementBase::getName(), Libxml2Document::getRoot(), ParticleSet::groups(), okay, Libxml2Document::parseFromString(), ParticleSet::R, XMLParticleParser::readXML(), REQUIRE(), and Vector< T, Alloc >::size().

29 {
30  const char* particles = R"(<tmp>
31 <particleset name="ion0" size="1">
32  <group name="He">
33  <parameter name="charge">2</parameter>
34  </group>
35  <attrib name="position" datatype="posArray">
36  0.1 0.2 0.3
37  </attrib>
38 </particleset>
39 <particleset name="e">
40  <group name="u" size="1">
41  <parameter name="charge">-1</parameter>
42  <attrib name="position" datatype="posArray">
43  -0.28 0.0225 -2.709
44  </attrib>
45  </group>
46  <group name="d" size="1">
47  <parameter name="charge">-1</parameter>
48  <attrib name="position" datatype="posArray">
49  -1.08389 1.9679 -0.0128914
50  </attrib>
51  </group>
52 </particleset>
53 </tmp>
54 )";
56  bool okay = doc.parseFromString(particles);
57  REQUIRE(okay);
58 
59  xmlNodePtr root = doc.getRoot();
60 
61  const SimulationCell simulation_cell;
62  ParticleSet ions(simulation_cell), electrons(simulation_cell);
63 
64  XMLParticleParser parse_ions(ions);
65  xmlNodePtr part1 = xmlFirstElementChild(root);
66  parse_ions.readXML(part1);
67 
68  REQUIRE(ions.groups() == 1);
69  REQUIRE(ions.R.size() == 1);
70  CHECK(ions.R[0][0] == Approx(0.1));
71  CHECK(ions.R[0][1] == Approx(0.2));
72  CHECK(ions.R[0][2] == Approx(0.3));
73  REQUIRE(ions.getName() == "ion0");
74 
75  XMLParticleParser parse_electrons(electrons);
76  xmlNodePtr part2 = xmlNextElementSibling(part1);
77  parse_electrons.readXML(part2);
78 
79  REQUIRE(electrons.groups() == 2);
80  REQUIRE(electrons.R.size() == 2);
81  CHECK(electrons.R[0][0] == Approx(-0.28));
82  CHECK(electrons.R[0][1] == Approx(0.0225));
83  CHECK(electrons.R[0][2] == Approx(-2.709));
84 
85  CHECK(electrons.R[1][0] == Approx(-1.08389));
86  CHECK(electrons.R[1][1] == Approx(1.9679));
87  CHECK(electrons.R[1][2] == Approx(-0.0128914));
88  REQUIRE(electrons.getName() == "e");
89 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [95/537]

qmcplusplus::TEST_CASE ( "read_particle_mass_same_xml"  ,
""  [particle_io][xml] 
)

Definition at line 28 of file test_xml_mass.cpp.

References SpeciesSet::addAttribute(), CHECK(), doc, OhmmsElementBase::getName(), Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), ParticleSet::getTotalNum(), ParticleSet::GroupID, ParticleSet::isSameMass(), okay, Libxml2Document::parseFromString(), XMLParticleParser::readXML(), and REQUIRE().

29 {
30  // test that particle masses are properly read in
31 
32 
33  const char* particles = R"(<tmp>
34 <particleset name="e" random="yes">
35  <group name="u" size="4" mass="1.0">
36  <parameter name="charge" > -1 </parameter>
37  <parameter name="mass" > 1.0 </parameter>
38  </group>
39  <group name="d" size="4" mass="1.0">
40  <parameter name="charge" > -1 </parameter>
41  <parameter name="mass" > 1.0 </parameter>
42  </group>
43 </particleset>
44 <particleset name="ion0">
45  <group name="H" size="8" mass="1836.15">
46  <parameter name="charge" > 1 </parameter>
47  <parameter name="valence" > 1 </parameter>
48  <parameter name="atomicnumber" > 1 </parameter>
49  <parameter name="mass" > 1836.15 </parameter>
50  <attrib name="position" datatype="posArray" condition="0">
51  0.00000000 0.00000000 0.00000000
52  2.11170946 0.00000000 0.00000000
53  0.00000000 2.11170946 0.00000000
54  2.11170946 2.11170946 0.00000000
55  0.00000000 0.00000000 2.11170946
56  2.11170946 0.00000000 2.11170946
57  0.00000000 2.11170946 2.11170946
58  2.11170946 2.11170946 2.11170946
59  </attrib>
60  </group>
61 </particleset>
62 </tmp>
63 )"; // simple cubic lattice at rs=1.31
64 
66  bool okay = doc.parseFromString(particles);
67  REQUIRE(okay);
68 
69  xmlNodePtr root = doc.getRoot();
70  xmlNodePtr part1 = xmlFirstElementChild(root);
71  xmlNodePtr part2 = xmlNextElementSibling(part1);
72 
73  const SimulationCell simulation_cell;
74  ParticleSet ions(simulation_cell), electrons(simulation_cell);
75 
76  XMLParticleParser parse_electrons(electrons);
77  parse_electrons.readXML(part1);
78  REQUIRE(electrons.getName() == "e");
79 
80  XMLParticleParser parse_ions(ions);
81  parse_ions.readXML(part2);
82  REQUIRE(ions.getName() == "ion0");
83 
84  REQUIRE(ions.isSameMass());
85  REQUIRE(electrons.isSameMass());
86 
87  // test electrons
88  SpeciesSet& tspecies(electrons.getSpeciesSet());
89  int massind = tspecies.addAttribute("mass");
90  char order[] = "uuuudddd";
91  for (int iat = 0; iat < electrons.getTotalNum(); iat++)
92  {
93  int species_id = electrons.GroupID[iat];
94  std::string species_name = tspecies.speciesName[species_id];
95  REQUIRE(*species_name.c_str() == order[iat]);
96  CHECK(tspecies(massind, species_id) == Approx(1.0));
97  }
98 
99  // test ions
100  SpeciesSet& pspecies(ions.getSpeciesSet());
101  int pmassind = pspecies.addAttribute("mass");
102  char porder[] = "HHHHHHHH";
103  for (int iat = 0; iat < ions.getTotalNum(); iat++)
104  {
105  int species_id = ions.GroupID[iat];
106  std::string species_name = pspecies.speciesName[species_id];
107  REQUIRE(*species_name.c_str() == porder[iat]);
108  CHECK(pspecies(pmassind, species_id) == Approx(1836.15));
109  }
110 } // TEST_CASE read_particle_mass_same_xml
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [96/537]

qmcplusplus::TEST_CASE ( "MagnetizationDensityInput::from_xml"  ,
""  [estimators] 
)

Definition at line 28 of file test_MagnetizationDensityInput.cpp.

References app_log(), MagnetizationDensityInput::calculateDerivedParameters(), CHECK(), doc, MagnetizationDensityInput::get_corner(), MagnetizationDensityInput::get_dr(), MagnetizationDensityInput::get_grid(), MagnetizationDensityInput::get_integrator(), MagnetizationDensityInput::get_nsamples(), Libxml2Document::getRoot(), qmcplusplus::testing::invalid_mag_density_input_sections, lattice, qmcplusplus::testing::makeTestLattice(), node, okay, Libxml2Document::parseFromString(), REQUIRE(), qmcplusplus::testing::magdensity::valid_mag_density_input_sections, and qmcplusplus::testing::magdensity::valid_magdensity_input.

29 {
30  using POLT = PtclOnLatticeTraits;
31  using Lattice = POLT::ParticleLayout;
33  using namespace testing::magdensity;
34 
36 
37  for (auto input_xml : valid_mag_density_input_sections)
38  {
40  bool okay = doc.parseFromString(input_xml);
41  REQUIRE(okay);
42  xmlNodePtr node = doc.getRoot();
43  MagnetizationDensityInput magdens(node);
44  MagnetizationDensityInput::DerivedParameters dev_par = magdens.calculateDerivedParameters(lattice);
45  }
46 
47  for (auto input_xml : testing::invalid_mag_density_input_sections)
48  {
50  bool okay = doc.parseFromString(input_xml);
51  REQUIRE(okay);
52  xmlNodePtr node = doc.getRoot();
53 
54  CHECK_THROWS(MagnetizationDensityInput(node));
55  }
56 
57  //Lastly, going to check the state variables are consistent with the input.
58  //We'll take the magdensity::Inputs::valid_magdensity_input test case for
59  //thorough checking.
60  {
63  bool okay = doc.parseFromString(input_xml);
64  REQUIRE(okay);
65  xmlNodePtr node = doc.getRoot();
66  MagnetizationDensityInput magdens(node);
67  int nsamples = magdens.get_nsamples();
68  int integrator = int(magdens.get_integrator());
69  PosType grid = magdens.get_grid();
70  PosType dr = magdens.get_dr();
71  PosType corner = magdens.get_corner();
72 
73 
74  app_log() << "NSAMPLES = " << nsamples << std::endl;
75  app_log() << "INTEGRATOR = " << integrator << std::endl;
76  app_log() << "CORNER = " << corner << std::endl;
77  app_log() << "GRID = " << grid << std::endl;
78  app_log() << "DR = " << dr << std::endl;
79 
80  CHECK(nsamples == 64);
81  CHECK(integrator == 0);
82  CHECK(grid[0] == Approx(4));
83  CHECK(grid[1] == Approx(3));
84  CHECK(grid[2] == Approx(2));
85  CHECK(corner[0] == Approx(0.0));
86  CHECK(corner[1] == Approx(0.0));
87  CHECK(corner[2] == Approx(0.0));
88  CHECK(dr[0] == Approx(0.1));
89  CHECK(dr[1] == Approx(0.1));
90  CHECK(dr[2] == Approx(0.1));
91  }
92 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
POLT::ParticleLayout Lattice
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
QMCTraits::PosType PosType
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
constexpr std::array< std::string_view, 4 > valid_mag_density_input_sections
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
PtclOnLatticeTraits POLT
constexpr std::array< std::string_view, 3 > invalid_mag_density_input_sections

◆ TEST_CASE() [97/537]

qmcplusplus::TEST_CASE ( "ParticleSetPool"  ,
""  [qmcapp] 
)

Definition at line 29 of file test_particle_pool.cpp.

References ParticleSetPool::addParticleSet(), OHMMS::Controller, doc, ParticleSetPool::get(), ParticleSetPool::getParticleSet(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSetPool::getWalkerSet(), okay, Libxml2Document::parseFromString(), ParticleSetPool::put(), ParticleSetPool::randomize(), and REQUIRE().

30 {
31  Communicate* c;
33 
34  ParticleSetPool pp(c);
35 
36  // See ParticleIO/tests/test_xml_io.cpp for particle parsing
37  const char* particles = R"(
38 <particleset name="ion0" size="1">
39  <group name="He">
40  <parameter name="charge">2</parameter>
41  </group>
42  <attrib name="position" datatype="posArray">
43  0.1 0.2 0.3
44  </attrib>
45 </particleset>
46 )";
48  bool okay = doc.parseFromString(particles);
49  REQUIRE(okay);
50 
51  xmlNodePtr root = doc.getRoot();
52 
53  pp.put(root);
54 
55  ParticleSet* ions = pp.getParticleSet("ion0");
56  REQUIRE(ions != NULL);
57 
58  ParticleSet* not_here = pp.getParticleSet("does_not_exist");
59  REQUIRE(not_here == NULL);
60 
61  MCWalkerConfiguration* ws = pp.getWalkerSet("ion0");
62  REQUIRE(ws != NULL);
63 
64  REQUIRE_THROWS_AS(pp.getWalkerSet("does_not_exist"), std::runtime_error);
65 
66  auto ps2 = std::make_unique<ParticleSet>(pp.getSimulationCell());
67  ps2->setName("particle_set_2");
68  pp.addParticleSet(std::move(ps2));
69 
70  // should do nothing, since no random particlesets were specified
71  pp.randomize();
72 
73  std::stringstream out;
74  pp.get(out);
75  //std::cout << "ParticleSetPool::get returns " << std::endl;
76  //std::cout << out.str() << std::endl;
77 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [98/537]

qmcplusplus::TEST_CASE ( "PlaneWave SPO from HDF for BCC H"  ,
""  [wavefunction] 
)

Definition at line 29 of file test_pw.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), OHMMS::Controller, ParticleSet::create(), SPOSetBuilder::createSPOSet(), doc, Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), imag(), lattice, okay, Libxml2Document::parseFromString(), ParticleSet::R, real(), REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), and ParticleSet::update().

30 {
32 
33  // BCC H
34  PtclOnLatticeTraits::ParticleLayout lattice;
35  lattice.R = {3.77945227, 0.0, 0.0, 0.0, 3.77945227, 0.0, 0.0, 0.0, 3.77945227};
36  lattice.reset();
37 
38  ParticleSetPool ptcl = ParticleSetPool(c);
39  ptcl.setSimulationCell(lattice);
40  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
41  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
42  ParticleSet& ions(*ions_uptr);
43  ParticleSet& elec(*elec_uptr);
44 
45  ions.setName("ion");
46  ptcl.addParticleSet(std::move(ions_uptr));
47  ions.create({2});
48  ions.R[0] = {0.0, 0.0, 0.0};
49  ions.R[1] = {1.88972614, 1.88972614, 1.88972614};
50  std::vector<int> agroup(2);
51  agroup[0] = 1;
52  agroup[1] = 1;
53  elec.create(agroup);
54 
55  elec.setName("elec");
56  ptcl.addParticleSet(std::move(elec_uptr));
57  elec.R[0] = {0.0, 0.0, 0.0};
58  elec.R[1] = {0.0, 1.0, 0.0};
59  SpeciesSet& tspecies = elec.getSpeciesSet();
60  int upIdx = tspecies.addSpecies("u");
61  int downIdx = tspecies.addSpecies("d");
62  int chargeIdx = tspecies.addAttribute("charge");
63  tspecies(chargeIdx, upIdx) = -1;
64  tspecies(chargeIdx, downIdx) = -1;
65 
66  elec.addTable(ions);
67  elec.resetGroups();
68  elec.update();
69 
70  //BCC H
71  const char* particles = R"(
72 <sposet_collection type="PW" href="bccH.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion">
73  <sposet name="updet" size="1" spindataset="0">
74  <occupation mode="ground"/>
75  </sposet>
76 </sposet_collection>
77 )";
78 
80  bool okay = doc.parseFromString(particles);
81  REQUIRE(okay);
82 
83  xmlNodePtr root = doc.getRoot();
84  xmlNodePtr pw1 = xmlFirstElementChild(root);
85 
86 
87  PWOrbitalSetBuilder pw_builder(elec, c, root);
88  auto spo = pw_builder.createSPOSet(pw1);
89  REQUIRE(spo);
90 
91  const int orbSize = spo->getOrbitalSetSize();
92  elec.update();
93  SPOSet::ValueVector orbs(orbSize);
94  spo->evaluateValue(elec, 0, orbs);
95 
96  CHECK(std::real(orbs[0]) == Approx(-1.2473558998));
97 
98 #if 0
99  // Dump values of the orbitals
100  int basisSize= spo->getBasisSetSize();
101  printf("orb size = %d basis set size = %d\n",orbSize, basisSize);
102 
103  elec.R[1][1] = 0.0;
104  double step = 3.78/10;
105  FILE *fspo = fopen("spo.dat", "w");
106  for (int ix = 0; ix < 10; ix++) {
107  for (int iy = 0; iy < 10; iy++) {
108  for (int iz = 0; iz < 10; iz++) {
109  double x = step*ix;
110  double y = step*iy;
111  double z = step*iz;
112  elec.R[0] = {x, y, z};
113  elec.update();
114  SPOSet::ValueVector orbs(orbSize);
115  spo->evaluateValue(elec, 0, orbs);
116  fprintf(fspo, "%g %g %g",x,y,z);
117  for (int j = 0; j < orbSize; j++) {
118 #ifdef QMC_COMPLEX
119  fprintf(fspo, " %g,%g ",orbs[j].real(),orbs[j].imag());
120 #else
121  fprintf(fspo, " %g ",orbs[j]);
122 #endif
123  }
124  fprintf(fspo, "\n");
125  }
126  }
127  }
128  fclose(fspo);
129 #endif
130 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [99/537]

qmcplusplus::TEST_CASE ( "ProjectData"  ,
""  [ohmmsapp] 
)

Definition at line 29 of file test_project_data.cpp.

References OHMMS::Controller, ProjectData::getTitle(), and REQUIRE().

30 {
31  Communicate* c;
33 
34 
35  ProjectData proj1;
36  // If no name given, it gets set to time and date
37  // and the title is set equal to the name
38  REQUIRE(proj1.getTitle().size() > 0);
39 
40  ProjectData proj2("asample");
41  REQUIRE(proj2.getSeriesIndex() == 0);
42  proj2.advance();
43  REQUIRE(proj2.getSeriesIndex() == 1);
44  REQUIRE(proj2.getTitle() == std::string("asample"));
45 
46  proj2.setCommunicator(c);
47  std::stringstream o2;
48  proj2.get(o2);
49 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [100/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-B Ewald3D"  ,
""  [hamiltonian] 
)

Definition at line 29 of file test_coulomb_pbcAB_ewald.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAB::evalConsts(), CoulombPBCAA::evaluate(), CoulombPBCAB::evaluate(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, ParticleSet::resetGroups(), ParticleSet::setName(), and ParticleSet::update().

30 {
31  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
32  lattice.BoxBConds = true; // periodic
33  lattice.R.diagonal(1.0);
34  lattice.reset();
35 
36  const SimulationCell simulation_cell(lattice);
37  ParticleSet ions(simulation_cell);
38  ParticleSet elec(simulation_cell);
39 
40  ions.setName("ion");
41  ions.create({1});
42  ions.R[0] = {0.0, 0.0, 0.0};
43  SpeciesSet& ion_species = ions.getSpeciesSet();
44  int pIdx = ion_species.addSpecies("H");
45  int pChargeIdx = ion_species.addAttribute("charge");
46  ion_species(pChargeIdx, pIdx) = 1;
47  ions.createSK();
48  ions.update();
49 
50 
51  elec.setName("elec");
52  elec.create({1});
53  elec.R[0] = {0.5, 0.0, 0.0};
54  SpeciesSet& tspecies = elec.getSpeciesSet();
55  int upIdx = tspecies.addSpecies("u");
56  int chargeIdx = tspecies.addAttribute("charge");
57  int massIdx = tspecies.addAttribute("mass");
58  tspecies(chargeIdx, upIdx) = -1;
59  tspecies(massIdx, upIdx) = 1.0;
60 
61  elec.resetGroups();
62  elec.createSK();
63  elec.addTable(ions);
64  elec.update();
65 
66 
67  LRCoulombSingleton::CoulombHandler = std::make_unique<EwaldHandler3D>(ions);
68  LRCoulombSingleton::CoulombHandler->initBreakup(ions);
69 
70 
71  CoulombPBCAB cab(ions, elec);
72 
73  // Self energy plus Background charge term
74  double consts = cab.evalConsts(elec);
75  CHECK(consts == Approx(0.0523598776 * 2)); //not validated
76 
77  double val_ei = cab.evaluate(elec);
78  CHECK(val_ei == Approx(-0.008302 + 0.0523598776 * 2)); //Not validated
79 
80  CoulombPBCAA caa_elec(elec, true, false, false);
81  CoulombPBCAA caa_ion(ions, false, false, false);
82  double val_ee = caa_elec.evaluate(elec);
83  double val_ii = caa_ion.evaluate(ions);
84  double sum = val_ee + val_ii + val_ei;
85 
86  CHECK(val_ee == Approx(-1.418927));
87  CHECK(val_ii == Approx(-1.418927));
88  CHECK(sum == Approx(-2.741436)); // Can be validated via Ewald summation elsewhere
89  // -2.74136517454081
90 
91  LRCoulombSingleton::CoulombHandler.reset(nullptr);
92 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [101/537]

qmcplusplus::TEST_CASE ( "WalkerLogCollector::collect"  ,
""  [estimators] 
)

Definition at line 29 of file test_WalkerLogCollector.cpp.

References app_log(), ProjectData::BATCH, CHECK(), WalkerLogCollector::collect(), comm, OHMMS::Controller, ProjectData::getRuntimeOptions(), ham, hamiltonian_pool, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), MinimalHamiltonianPool::make_hamWithEE(), qmcplusplus::hdf::num_walkers, particle_pool, pset, test_project, twf, walker, WalkerLogCollector::walker_particle_real_buffer, WalkerLogCollector::walker_property_int_buffer, WalkerLogCollector::walker_property_real_buffer, qmcplusplus::hdf::walkers, and wavefunction_pool.

30 {
31  app_log() << "\n\n=======================================================\n";
32  app_log() << "test WalkerLogCollector::collect\n";
33 
34  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
36 
37 
38  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
39  auto wavefunction_pool =
40  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
41  auto& pset = *(particle_pool.getParticleSet("e"));
42  // This is where the pset properties "properies" gain the different hamiltonian operator values.
43  auto hamiltonian_pool = MinimalHamiltonianPool::make_hamWithEE(comm, particle_pool, wavefunction_pool);
44 
45  auto& twf = *(wavefunction_pool.getWaveFunction("wavefunction"));
46  auto& ham = *(hamiltonian_pool.getPrimary());
47 
48  // setup data structures for multiple walkers
49 
50  UPtrVector<QMCHamiltonian> hams;
51  UPtrVector<TrialWaveFunction> twfs;
52  std::vector<ParticleSet> psets;
53 
54  int num_walkers = 4;
55  int num_electrons = particle_pool.getParticleSet("e")->getTotalNum();
56  int num_ions = particle_pool.getParticleSet("ion")->getTotalNum();
57 
58  for (int iw = 0; iw < num_walkers; ++iw)
59  {
60  psets.emplace_back(pset);
61  psets.back().randomizeFromSource(*particle_pool.getParticleSet("ion"));
62  twfs.emplace_back(twf.makeClone(psets.back()));
63  hams.emplace_back(hamiltonian_pool.getPrimary()->makeClone(psets.back(), *twfs.back()));
64  }
65 
66  using MCPWalker = Walker<QMCTraits, PtclOnLatticeTraits>;
67 
68  std::vector<MCPWalker> walkers(num_walkers, MCPWalker(pset.getTotalNum()));
69 
70  for (auto& walker : walkers)
71  {
72  walker.R = pset.R;
73  walker.spins = pset.spins;
74  walker.Properties = pset.Properties;
75  walker.registerData();
76  walker.DataSet.allocate();
77  }
78 
79  WalkerLogState state{true, 1, false};
80  WalkerLogCollector wlc(state);
81 
82  auto& bsi = wlc.walker_property_int_buffer;
83  auto& bsr = wlc.walker_property_real_buffer;
84  auto& bpr = wlc.walker_particle_real_buffer;
85 
86  CHECK(bsi.nrows() == 0);
87  CHECK(bsr.nrows() == 0);
88  CHECK(bpr.nrows() == 0);
89  CHECK(bsi.ncols() == 0);
90  CHECK(bsr.ncols() == 0);
91  CHECK(bpr.ncols() == 0);
92 
93 #ifndef QMC_COMPLEX
94  const size_t npcols = 56;
95 #else
96  const size_t npcols = 88;
97 #endif
98 
99  int step = 0;
100  wlc.collect(walkers[0], psets[0], *(twfs[0]), *(hams[0]), step);
101 
102  CHECK(bsi.nrows() == 1);
103  CHECK(bsr.nrows() == 1);
104  CHECK(bpr.nrows() == 1);
105  CHECK(bsi.ncols() == 4);
106  CHECK(bsr.ncols() == 13);
107  CHECK(bpr.ncols() == npcols);
108 
109  for (size_t iw = 1; iw < walkers.size(); ++iw)
110  wlc.collect(walkers[iw], psets[iw], *(twfs[iw]), *(hams[iw]), step);
111 
112  CHECK(bsi.nrows() == 4);
113  CHECK(bsr.nrows() == 4);
114  CHECK(bpr.nrows() == 4);
115  CHECK(bsi.ncols() == 4);
116  CHECK(bsr.ncols() == 13);
117  CHECK(bpr.ncols() == npcols);
118 
119  for (step = 1; step < 3; ++step)
120  for (size_t iw = 0; iw < walkers.size(); ++iw)
121  wlc.collect(walkers[iw], psets[iw], *(twfs[iw]), *(hams[iw]), step);
122 
123  CHECK(bsi.nrows() == 12);
124  CHECK(bsr.nrows() == 12);
125  CHECK(bpr.nrows() == 12);
126  CHECK(bsi.ncols() == 4);
127  CHECK(bsr.ncols() == 13);
128  CHECK(bpr.ncols() == npcols);
129 
130  app_log() << "\nend test WalkerLogCollector::collect\n";
131  app_log() << "=======================================================\n";
132 }
std::ostream & app_log()
Definition: OutputManager.h:65
const char num_walkers[]
Definition: HDFVersion.h:37
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
const char walkers[]
Definition: HDFVersion.h:36
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker
Definition: test_walker.cpp:31
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [102/537]

qmcplusplus::TEST_CASE ( "OMPdeepcopy"  ,
""  [OMP] 
)

Definition at line 29 of file test_deep_copy.cpp.

References OMPallocator< T, HostAllocator >::allocate(), OMPallocator< T, HostAllocator >::deallocate(), REQUIRE(), and container::size.

30 {
31  const int MAX = 100;
32  auto* foo = new container;
33  foo->size = MAX;
34 
35  OMPallocator<double> myAlloc;
36 
37  foo->data = myAlloc.allocate(MAX);
38  for (int i = 0; i < MAX; i++)
39  foo->data[i] = i;
40 
41  auto* data_ptr = foo->data;
42 
43  PRAGMA_OFFLOAD("omp target enter data map(alloc:foo[0:1])")
44  PRAGMA_OFFLOAD("omp target map(always, to: foo[0:1], data_ptr[0:foo->size])") { foo->data = data_ptr; }
45 
46  int check_size(0);
47  double check_data1(0);
48  void* check_address1(nullptr);
49  void* check_address2(nullptr);
50  void* check_address3(nullptr);
51  // clang-format off
52  PRAGMA_OFFLOAD("omp target teams num_teams(1) \
53  map(from: check_size, check_data1, check_address1, check_address2, check_address3)")
54  // clang-format on
55  {
56  check_size = foo->size;
57  check_data1 = foo->data[1];
58  check_address1 = data_ptr;
59  check_address2 = foo->data;
60  check_address3 = foo;
61  }
62 
63  std::cout << "foo->data value on the host " << foo->data << std::endl;
64  std::cout << "foo->data value on the device " << check_address2 << std::endl;
65  std::cout << "foo->data mapped address on the device " << check_address1 << std::endl;
66  std::cout << "foo value on the host " << foo << std::endl;
67  std::cout << "foo mapped address on the device " << check_address3 << std::endl;
68 
69  REQUIRE(check_data1 == 1.0);
70  REQUIRE(check_size == MAX);
71 
72  PRAGMA_OFFLOAD("omp target teams num_teams(1) map(always,from:data_ptr[0:foo->size])") { data_ptr[1] = 2; }
73 
74  REQUIRE(data_ptr[1] == 2.0);
75 
76  myAlloc.deallocate(foo->data, MAX);
77  PRAGMA_OFFLOAD("omp target exit data map(delete:foo[0:1])")
78  delete foo;
79 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [103/537]

qmcplusplus::TEST_CASE ( "EstimatorManagerBase"  ,
""  [estimators] 
)

Definition at line 29 of file test_manager.cpp.

References EstimatorManagerBase::add(), OHMMS::Controller, EstimatorManagerBase::getEstimator(), REQUIRE(), EstimatorManagerBase::reset(), EstimatorManagerBase::size(), EstimatorManagerBase::start(), and EstimatorManagerBase::stop().

30 {
32 
33  EstimatorManagerBase em(c);
34 
35  REQUIRE(em.size() == 0);
36 
37  // Must create on heap since the EstimatorManager destructor deletes all estimators
38  auto fake_est_uptr = std::make_unique<FakeEstimator>();
39  auto fake_est = fake_est_uptr.get();
40 
41  em.add(std::move(fake_est_uptr), "fake");
42 
43  ScalarEstimatorBase* est2 = em.getEstimator("fake");
44  FakeEstimator* fake_est2 = dynamic_cast<FakeEstimator*>(est2);
45  REQUIRE(fake_est2 != NULL);
46  REQUIRE(fake_est2 == fake_est);
47 
48  // Check the copy constructor
49  EstimatorManagerBase em2(em);
50  REQUIRE(em.size() == 1);
51 
52  em.start(2, true);
53 
54  em.stop();
55  // compute averages over threads
56  //em.stop();
57  em.reset();
58 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [104/537]

qmcplusplus::TEST_CASE ( "DescentEngine RMSprop update"  ,
""  [drivers][descent] 
)

This provides a basic test of the descent engine's parameter update algorithm.

Definition at line 29 of file test_DescentEngine.cpp.

References app_log(), CHECK(), OHMMS::Controller, doc, Libxml2Document::getRoot(), mean(), n, okay, Libxml2Document::parseFromString(), and REQUIRE().

30 {
32 
33 
34  const std::string engine_input("<tmp> </tmp>");
35 
37  bool okay = doc.parseFromString(engine_input);
38  REQUIRE(okay);
39 
40  xmlNodePtr fakeXML = doc.getRoot();
41 
42  std::unique_ptr<DescentEngine> descentEngineObj = std::make_unique<DescentEngine>(c, fakeXML);
43 
44  optimize::VariableSet myVars;
45 
46  //Two fake parameters are specified
47  optimize::VariableSet::real_type first_param(1.0);
48  optimize::VariableSet::real_type second_param(-2.0);
49 
50  myVars.insert("first", first_param);
51  myVars.insert("second", second_param);
52 
53  std::vector<ValueType> LDerivs;
54 
55  //Corresponding fake derivatives are specified and given to the engine
56  ValueType first_deriv = 5;
57  ValueType second_deriv = 1;
58 
59  LDerivs.push_back(first_deriv);
60  LDerivs.push_back(second_deriv);
61 
62  descentEngineObj->setDerivs(LDerivs);
63 
64  descentEngineObj->setupUpdate(myVars);
65 
66  descentEngineObj->storeDerivRecord();
67  descentEngineObj->updateParameters();
68 
69  std::vector<ValueType> results = descentEngineObj->retrieveNewParams();
70 
71  app_log() << "Descent engine test of parameter update" << std::endl;
72  app_log() << "First parameter: " << results[0] << std::endl;
73  app_log() << "Second parameter: " << results[1] << std::endl;
74 
75  //The engine should update the parameters using the generic default step size of .001 and obtain these values.
76  CHECK(std::real(results[0]) == Approx(.995));
77  CHECK(std::real(results[1]) == Approx(-2.001));
78 
79  //Provide fake data to test mpi_unbiased_ratio_of_means
80  int n = 2;
81  ValueType mean = 0;
82  ValueType variance = 0;
83  ValueType stdErr = 0;
84 
85  std::vector<ValueType> weights;
86  weights.push_back(1.0);
87  weights.push_back(1.0);
88  std::vector<ValueType> numerSamples;
89  numerSamples.push_back(-2.0);
90  numerSamples.push_back(-2.0);
91  std::vector<ValueType> denomSamples;
92  denomSamples.push_back(1.0);
93  denomSamples.push_back(1.0);
94 
95  descentEngineObj->mpi_unbiased_ratio_of_means(n, weights, numerSamples, denomSamples, mean, variance, stdErr);
96  app_log() << "Descent engine test of mpi_unbiased_ratio_of_means" << std::endl;
97  app_log() << "Mean: " << mean << std::endl;
98  app_log() << "Variance: " << variance << std::endl;
99  app_log() << "Standard Error: " << stdErr << std::endl;
100 
101  //mpi_unbiased_ratio_of_means should calculate the mean, variance, and standard error and obtain the values below
102  CHECK(std::real(mean) == Approx(-2.0));
103  CHECK(std::real(variance) == Approx(0.0));
104  CHECK(std::real(stdErr) == Approx(0.0));
105 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
qmcplusplus::QMCTraits::RealType real_type
Definition: VariableSet.h:51
LatticeGaussianProduct::ValueType ValueType
ACC::value_type mean(const ACC &ac)
Definition: accumulators.h:147

◆ TEST_CASE() [105/537]

qmcplusplus::TEST_CASE ( "QMCDriverNew tiny case"  ,
""  [drivers] 
)

Definition at line 29 of file test_QMCDriverNew.cpp.

References ProjectData::BATCH, comm, OHMMS::Controller, doc, QMCDriverNew::get_num_living_walkers(), QMCDriverInterface::getBranchEngine(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), hamiltonian_pool, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), MinimalHamiltonianPool::make_hamWithEE(), node, okay, outputManager, Libxml2Document::parseFromString(), particle_pool, OutputManagerClass::pause(), QMCDriverNewTestWrapper::process(), Communicate::rank(), QMCDriverInput::readXML(), REQUIRE(), OutputManagerClass::resume(), QMCDriverNew::setStatus(), Communicate::size(), test_project, qmcplusplus::testing::valid_vmc_input_sections, qmcplusplus::testing::valid_vmc_input_vmc_tiny_index, and wavefunction_pool.

30 {
31  using namespace testing;
32  Concurrency::OverrideMaxCapacity<> override(8);
33  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
36 
39  REQUIRE(okay);
40  xmlNodePtr node = doc.getRoot();
41  QMCDriverInput qmcdriver_input;
42  qmcdriver_input.readXML(node);
43  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
44  auto wavefunction_pool =
45  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
46 
47  auto hamiltonian_pool = MinimalHamiltonianPool::make_hamWithEE(comm, particle_pool, wavefunction_pool);
48  WalkerConfigurations walker_confs;
49  QMCDriverNewTestWrapper qmcdriver(test_project, std::move(qmcdriver_input), walker_confs,
50  MCPopulation(comm->size(), comm->rank(), particle_pool.getParticleSet("e"),
51  wavefunction_pool.getPrimary(), hamiltonian_pool.getPrimary()),
52  comm);
53 
54  // setStatus must be called before process
55  std::string root_name{"Test"};
56  //For later sections this appears to contain important state.
57  std::string prev_config_file{""};
58 
59  qmcdriver.setStatus(root_name, prev_config_file, false);
60  // We want to express out expectations of the QMCDriver state machine so we catch
61  // changes to it over time.
63 
64  REQUIRE(qmcdriver.getBranchEngine() == nullptr);
65  qmcdriver.process(node);
66  REQUIRE(qmcdriver.get_num_living_walkers() == 1);
67 
68  // What else should we expect after process
69 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
void pause()
Pause the summary and log streams.
int rank() const
return the rank
Definition: Communicate.h:116
if(!okay) throw std xmlNodePtr node
constexpr int valid_vmc_input_vmc_tiny_index
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
int size() const
return the number of tasks
Definition: Communicate.h:118
const RuntimeOptions & getRuntimeOptions() const noexcept
OutputManagerClass outputManager(Verbosity::HIGH)
Wrapping information on parallelism.
Definition: Communicate.h:68
void resume()
Resume the summary and log streams.
REQUIRE(std::filesystem::exists(filename))
constexpr std::array< const char *, 4 > valid_vmc_input_sections
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [106/537]

qmcplusplus::TEST_CASE ( "MPIExceptionWrapper function case"  ,
""  [Utilities] 
)

Definition at line 29 of file test_mpi_exception_wrapper.cpp.

References comm, OHMMS::Controller, and mpiTestFunctionWrapped().

30 {
32 
33  MPIExceptionWrapper mew;
34  std::vector<double> test_vec{1, 2, 3, 4};
35  mew(mpiTestFunctionWrapped, comm, test_vec);
36 
37  // would really like to check for the MPIAbort but that kills the test program.
38 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
void mpiTestFunctionWrapped(Communicate *comm, std::vector< double > &fake_args)
Openmp generally works but is not guaranteed with std::atomic.

◆ TEST_CASE() [107/537]

qmcplusplus::TEST_CASE ( "open_bconds"  ,
""  [lattice] 
)

Definition at line 30 of file test_ParticleBConds.cpp.

References DTD_BConds< T, D, SC >::apply_bc(), CHECK(), DTD_BConds< T, D, SC >::evaluate_rsquared(), OHMMS_PRECISION, and sqrt().

31 {
32  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> Lattice;
33  DTD_BConds<OHMMS_PRECISION, 3, SUPERCELL_OPEN> bcond(Lattice);
34 
35  vec_t v(3.0, 4.0, 5.0);
36 
37  OHMMS_PRECISION r2 = bcond.apply_bc(v);
38  CHECK(Approx(r2) == 50.0);
39 
40 
41  std::vector<vec_t> disps(1);
42  disps[0] = v;
43  std::vector<OHMMS_PRECISION> r(1), rinv(1), rr(1);
44 
45  bcond.apply_bc(disps, r, rinv);
46 
47  CHECK(Approx(r[0]) == std::sqrt(50.0));
48  CHECK(Approx(rinv[0]) == 1.0 / std::sqrt(50.0));
49 
50  r[0] = 0.0;
51  bcond.apply_bc(disps, r);
52  CHECK(Approx(r[0]) == std::sqrt(50.0));
53 
54  bcond.evaluate_rsquared(disps.data(), rr.data(), disps.size());
55  CHECK(Approx(rr[0]) == 50.0);
56 }
TinyVector< double, 3 > vec_t
POLT::ParticleLayout Lattice
#define OHMMS_PRECISION
Definition: config.h:70
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [108/537]

qmcplusplus::TEST_CASE ( "ExampleHe"  ,
""  [wavefunction] 
)

Definition at line 30 of file test_example_he.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ExampleHeComponent::B, WaveFunctionFactory::buildTWF(), CHECK(), ExampleHeComponent::checkInVariablesExclusive(), ExampleHeComponent::checkOutVariables(), OHMMS::Controller, doc, Dot(), ExampleHeComponent::evalGrad(), ExampleHeComponent::evaluateDerivatives(), ExampleHeComponent::evaluateLog(), Libxml2Document::getRoot(), imag(), okay, Libxml2Document::parseFromString(), ExampleHeComponent::ratio(), ExampleHeComponent::ratioGrad(), REQUIRE(), ExampleHeComponent::resetParametersExclusive(), Vector< T, Alloc >::resize(), VariableSet::size_of_active(), and Sum().

31 {
33 
34  const SimulationCell simulation_cell;
35 
36  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
37  auto& elec(*elec_ptr);
38 
39  std::vector<int> agroup(1);
40  int nelec = 2;
41  agroup[0] = nelec;
42  elec.setName("e");
43  elec.create(agroup);
44  elec.R[0] = {1.0, 2.0, 3.0};
45  elec.R[1] = {0.0, 1.1, 2.2};
46  SpeciesSet& tspecies = elec.getSpeciesSet();
47  int upIdx = tspecies.addSpecies("u");
48  int downIdx = tspecies.addSpecies("d");
49  int massIdx = tspecies.addAttribute("mass");
50  tspecies(massIdx, upIdx) = 1.0;
51  tspecies(massIdx, downIdx) = 1.0;
52 
53  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
54  auto& ions(*ions_ptr);
55 
56  ions.setName("ion0");
57  ions.create({1});
58  ions.R[0] = {0.0, 0.0, 0.0};
59  SpeciesSet& he_species = ions.getSpeciesSet();
60  int He_Idx = he_species.addSpecies("He");
61  int chargeIdx = he_species.addAttribute("charge");
62  tspecies(chargeIdx, He_Idx) = 2.0;
63  tspecies(massIdx, upIdx) = 1.0;
64 
65  WaveFunctionFactory::PSetMap particle_set_map;
66  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
67  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
68 
69  WaveFunctionFactory wff(elec, particle_set_map, c);
70 
71  const char* wavefunction_xml = R"(<wavefunction>
72  <example_he name="mine" source="ion0">
73  <var id="B" name="B">0.8</var>
74  </example_he>
75 </wavefunction>)";
77  bool okay = doc.parseFromString(wavefunction_xml);
78  REQUIRE(okay);
79 
80  xmlNodePtr root = doc.getRoot();
81  RuntimeOptions runtime_options;
82  auto twf_ptr = wff.buildTWF(root, runtime_options);
83 
84  REQUIRE(twf_ptr != nullptr);
85  REQUIRE(twf_ptr->size() == 1);
86 
87  auto& base_example_he = twf_ptr->getOrbitals()[0];
88  REQUIRE(base_example_he != nullptr);
89 
90  ExampleHeComponent* example_he = dynamic_cast<ExampleHeComponent*>(base_example_he.get());
91  REQUIRE(example_he != nullptr);
92 
93  ions.update();
94  elec.update();
95 
96  ParticleSet::ParticleGradient all_grad;
97  ParticleSet::ParticleLaplacian all_lap;
98  all_grad.resize(nelec);
99  all_lap.resize(nelec);
100 
101  // Set the base expectations for wavefunction value and derivatives
102  LogValue logpsi = example_he->evaluateLog(elec, all_grad, all_lap);
103 
104  // Comparisons are performed at a single set of electron coordinates. This should be expanded.
105 
106  // Compare with evalGrad
107 
108  ParticleSet::GradType grad0;
109  int iat = 0;
110  grad0 = example_he->evalGrad(elec, iat);
111 
112  CHECK(grad0[0] == ValueApprox(all_grad[0][0]));
113  CHECK(grad0[1] == ValueApprox(all_grad[0][1]));
114  CHECK(grad0[2] == ValueApprox(all_grad[0][2]));
115 
116  ParticleSet::GradType grad1;
117  iat = 1;
118  grad1 = example_he->evalGrad(elec, iat);
119 
120  CHECK(grad1[0] == ValueApprox(all_grad[1][0]));
121  CHECK(grad1[1] == ValueApprox(all_grad[1][1]));
122  CHECK(grad1[2] == ValueApprox(all_grad[1][2]));
123 
124 
125  // Compare ratio and ratioGrad with a zero displacement
126  ParticleSet::SingleParticlePos zero_displ(0.0, 0.0, 0.0);
127  iat = 0;
128  elec.makeMove(iat, zero_displ);
129 
130 
131  PsiValue ratio = example_he->ratio(elec, iat);
132  CHECK(std::real(ratio) == Approx(1.0));
133 
134  ratio = example_he->ratioGrad(elec, iat, grad0);
135 
136  CHECK(std::real(ratio) == Approx(1.0));
137 
138  CHECK(grad0[0] == ValueApprox(all_grad[0][0]));
139  CHECK(grad0[1] == ValueApprox(all_grad[0][1]));
140  CHECK(grad0[2] == ValueApprox(all_grad[0][2]));
141 
142  iat = 1;
143  elec.makeMove(iat, zero_displ);
144  ratio = example_he->ratio(elec, iat);
145  CHECK(std::real(ratio) == Approx(1.0));
146 
147 
148  ratio = example_he->ratioGrad(elec, iat, grad1);
149 
150  CHECK(std::real(ratio) == Approx(1.0));
151  CHECK(grad1[0] == ValueApprox(all_grad[1][0]));
152  CHECK(grad1[1] == ValueApprox(all_grad[1][1]));
153  CHECK(grad1[2] == ValueApprox(all_grad[1][2]));
154 
155  // Compare ratio and ratioGrad with a non-zero displacement
156  // Should compare more displacements
157  ParticleSet::SingleParticlePos oldpos = elec.R[0];
158  ParticleSet::SingleParticlePos displ(0.15, 0.10, 0.21);
159  elec.R[0] = oldpos + displ;
160  elec.update();
161  ParticleSet::ParticleGradient new_grad;
162  ParticleSet::ParticleLaplacian new_lap;
163  new_grad.resize(nelec);
164  new_lap.resize(nelec);
165 
166  // wavefunction value and derivatives at new position
167  LogValue new_logpsi = example_he->evaluateLog(elec, new_grad, new_lap);
168  elec.R[0] = oldpos;
169  elec.update();
170 
171  iat = 0;
172  elec.makeMove(iat, displ);
173 
174  ratio = example_he->ratio(elec, iat);
175  CHECK(ValueApprox(ratio) == LogToValue<PsiValue>::convert(new_logpsi - logpsi));
176 
177  ratio = example_he->ratioGrad(elec, iat, grad0);
178 
179  CHECK(ValueApprox(ratio) == LogToValue<PsiValue>::convert(new_logpsi - logpsi));
180 
181  CHECK(grad0[0] == ValueApprox(new_grad[0][0]));
182  CHECK(grad0[1] == ValueApprox(new_grad[0][1]));
183  CHECK(grad0[2] == ValueApprox(new_grad[0][2]));
184 
185  // Compare parameter derivatives
186 
187  const int nparam = 1;
188  optimize::VariableSet var_param;
189  example_he->checkInVariablesExclusive(var_param);
190  REQUIRE(var_param.size_of_active() == nparam);
191 
192  example_he->checkOutVariables(var_param);
193 
194  RealType old_B = example_he->B;
195  // Interval size for finite-difference approximation to parameter derivative
196  RealType h = 0.01;
197  RealType new_B = old_B + h;
198 
199  var_param["B"] = new_B;
200  example_he->resetParametersExclusive(var_param);
201  CHECK(example_he->B == Approx(new_B));
202 
203  ParticleSet::ParticleGradient grad_plus_h;
204  ParticleSet::ParticleLaplacian lap_plus_h;
205  grad_plus_h.resize(nelec);
206  lap_plus_h.resize(nelec);
207 
208  LogValue logpsi_plus_h = example_he->evaluateLog(elec, grad_plus_h, lap_plus_h);
209 
210  //phase change is not allowed in finite difference
211  REQUIRE(std::imag(logpsi_plus_h) == std::imag(logpsi));
212 
213  // Finite difference derivative approximation
214  LogValue fd_logpsi = (logpsi_plus_h - logpsi) / LogValue(h);
215 
216  Vector<ValueType> dlogpsi(nparam);
217  Vector<ValueType> dhpsioverpsi(nparam);
218  example_he->evaluateDerivatives(elec, var_param, dlogpsi, dhpsioverpsi);
219 
220  CHECK(dlogpsi[0] == ValueApprox(std::real(fd_logpsi)).epsilon(h));
221 
222  ValueType eloc = -0.5 * (Sum(all_lap) + Dot(all_grad, all_grad));
223  ValueType eloc_h = -0.5 * (Sum(lap_plus_h) + Dot(grad_plus_h, grad_plus_h));
224 
225  ValueType fd_eloc = (eloc_h - eloc) / h;
226 
227  CHECK(dhpsioverpsi[0] == ValueApprox(fd_eloc).epsilon(h));
228 }
T Sum(const ParticleAttrib< T > &pa)
class that handles xmlDoc
Definition: Libxml2Doc.h:76
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
LatticeGaussianProduct::GradType GradType
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
T Dot(const ParticleAttrib< TinyVector< T, D >> &pa, const ParticleAttrib< TinyVector< T, D >> &pb)
Wrapping information on parallelism.
Definition: Communicate.h:68
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
real convert(real value, units units_in, units units_out)
REQUIRE(std::filesystem::exists(filename))
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
int size_of_active() const
return the number of active variables
Definition: VariableSet.h:78
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType
std::complex< double > LogValue

◆ TEST_CASE() [109/537]

qmcplusplus::TEST_CASE ( "readCuspInfo"  ,
""  [wavefunction] 
)

Definition at line 30 of file test_soa_cusp_corr.cpp.

References qmcplusplus::Units::charge::C, CHECK(), OHMMS::Controller, okay, readCuspInfo(), REQUIRE(), and Matrix< T, Alloc >::resize().

31 {
33 
34  using GridType = OneDimGridBase<double>;
35 
36  Matrix<CuspCorrectionParameters> info;
37  int num_center = 3;
38  int orbital_set_size = 7;
39  info.resize(num_center, orbital_set_size);
40 
41  bool okay = readCuspInfo("hcn_downdet.cuspInfo.xml", "downdet", orbital_set_size, info);
42  REQUIRE(okay);
43 
44  // N
45  CHECK(info(0, 0).redo == Approx(0.0)); // redo
46  CHECK(info(0, 0).C == Approx(0.0)); // C
47  CHECK(info(0, 0).sg == Approx(1.0)); // sg
48  CHECK(info(0, 0).Rc == Approx(0.0769130700800000)); // rc
49  CHECK(info(0, 0).alpha[0] == Approx(2.29508580995773)); // a1
50  CHECK(info(0, 0).alpha[1] == Approx(-7.00028778782666)); // a2
51  CHECK(info(0, 0).alpha[2] == Approx(0.834942828252775)); // a3
52  CHECK(info(0, 0).alpha[3] == Approx(-4.61597420905980)); // a4
53  CHECK(info(0, 0).alpha[4] == Approx(31.6558091872316)); // a5
54 
55  // Spot check a few values from these centers
56  // C
57  CHECK(info(0, 6).C == Approx(0.0)); // C
58  CHECK(info(0, 6).alpha[4] == Approx(0.0)); // a5
59 
60  // H
61  CHECK(info(2, 4).alpha[4] == Approx(-404.733151049101)); // a5
62 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
bool readCuspInfo(const std::string &cuspInfoFile, const std::string &objectName, int OrbitalSetSize, Matrix< CuspCorrectionParameters > &info)
Read cusp correction parameters from XML file.
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
GridType
The different types of grids that we currently allow.
Definition: Grid.h:29
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [110/537]

qmcplusplus::TEST_CASE ( "dummy"  ,
""  [lrhandler] 
)

evalaute bare Coulomb using DummyLRHandler

Definition at line 30 of file test_lrhandler.cpp.

References CrystalLattice< T, D >::BoxBConds, CHECK(), ParticleSet::createSK(), Tensor< T, D >::diagonal(), LRHandlerBase::Fk_symm, ParticleSet::getSimulationCell(), DummyLRHandler< Func >::initBreakup(), LRHandlerBase::LR_kc, LRHandlerBase::LR_rc, LRHandlerBase::MaxKshell, norm(), CrystalLattice< T, D >::R, CrystalLattice< T, D >::reset(), CrystalLattice< T, D >::Rv, and CrystalLattice< T, D >::Volume.

31 {
32  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> Lattice;
33  Lattice.BoxBConds = true;
34  Lattice.LR_dim_cutoff = 30.;
35  Lattice.R.diagonal(5.0);
36  Lattice.reset();
37  CHECK(Lattice.Volume == Approx(125));
38  Lattice.SetLRCutoffs(Lattice.Rv);
39  //Lattice.printCutoffs(app_log());
40  CHECK(Lattice.LR_rc == Approx(2.5));
41  CHECK(Lattice.LR_kc == Approx(12));
42 
43  const SimulationCell simulation_cell(Lattice);
44  ParticleSet ref(simulation_cell); // handler needs ref.getSimulationCell().getKLists()
45  ref.createSK();
46  DummyLRHandler<CoulombF2> handler(Lattice.LR_kc);
47 
48  handler.initBreakup(ref);
49 
50  std::cout << "handler.MaxKshell is " << handler.MaxKshell << std::endl;
51  CHECK( (std::is_same<OHMMS_PRECISION, OHMMS_PRECISION_FULL>::value ?
52  handler.MaxKshell == 78 : handler.MaxKshell >= 117 && handler.MaxKshell <= 128 ));
53  CHECK(handler.LR_kc == Approx(12));
54  CHECK(handler.LR_rc == Approx(0));
55 
56  std::vector<pRealType> rhok1(handler.MaxKshell);
57  std::vector<pRealType> rhok2(handler.MaxKshell);
58  CoulombF2 fk;
59  double norm = 4 * M_PI / Lattice.Volume;
60  // no actual LR breakup happened in DummyLRHandler,
61  // the full Coulomb potential should be retained in kspace
62  for (int ish = 0; ish < handler.MaxKshell; ish++)
63  {
64  int ik = ref.getSimulationCell().getKLists().kshell[ish];
65  double k2 = ref.getSimulationCell().getKLists().ksq[ik];
66  double fk_expect = fk(k2);
67  CHECK(handler.Fk_symm[ish] == Approx(norm * fk_expect));
68  }
69  // ?? cannot access base class method, too many overloads?
70  // handler.evaluate(SK->getKLists().kshell, rhok1.data(), rhok2.data());
71 }
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
POLT::ParticleLayout Lattice
TinyVector< SingleParticlePos, D > Rv
Real-space unit vectors.
Scalar_t Volume
Physical properties of a supercell.
double norm(const zVec &c)
Definition: VectorOps.h:118
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
void diagonal(const T &rhs)
Definition: Tensor.h:205
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

◆ TEST_CASE() [111/537]

qmcplusplus::TEST_CASE ( "Jastrow 2D"  ,
""  [wavefunction] 
)

Definition at line 30 of file test_2d_jastrow.cpp.

References ParticleSet::addTable(), app_log(), RadialJastrowBuilder::buildComponent(), CHECK(), OHMMS::Controller, doc, ParticleSet::G, Libxml2Document::getRoot(), ParticleSet::getTotalNum(), imag(), ParticleSet::L, lattice, qmcplusplus::Units::distance::m, ParticleSet::makeMove(), ParticleSet::makeVirtualMoves(), node, OHMMS_DIM, okay, Libxml2Document::parseFromString(), ParticleSet::R, XMLParticleParser::readXML(), real(), ParticleSet::rejectMove(), REQUIRE(), Vector< T, Alloc >::resize(), and ParticleSet::update().

31 {
34  xmlNodePtr root, node;
35  bool okay;
36 
37  // Step 1: create Jastrow
38  // TwoBodyJastrow<BsplineFunctor<RealType>> j2;
39  // RadialJastrowBuilder jastrow(Communicator, ParticleSet);
40  // ParticleSet( SimulationCell( CrystalLattice ) )
41  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
42  lattice.BoxBConds = true;
43  lattice.R.diagonal(70.89815403622065);
44  lattice.ndim = 2;
45  lattice.reset();
46  const SimulationCell cell(lattice);
47  ParticleSet elec(cell);
48  // read ParticleSet from xml text
49  const char* particle_text = R"(<tmp>
50  <particleset name="e" random="no">
51  <group name="u" size="2">
52  <parameter name="charge"> -1 </parameter>
53  <attrib name="position" datatype="posArray" condition="0">
54 54.66209032978565 2.018663420381362 0.0
55 23.566489035927912 3.443259712257945 0.0
56 </attrib>
57  </group>
58  <group name="d" size="2">
59  <parameter name="charge"> -1 </parameter>
60  <attrib name="position" datatype="posArray" condition="0">
61 67.26206197993817 30.29582561496142 0.0
62 37.00657847142635 1.4508035033146867 0.0
63 </attrib>
64  </group>
65  </particleset>
66  </tmp>)";
67  okay = doc.parseFromString(particle_text);
68  REQUIRE(okay);
69  root = doc.getRoot();
70  node = xmlFirstElementChild(root);
71  XMLParticleParser parse_electrons(elec);
72  parse_electrons.readXML(node);
73  int itab;
74  elec.addTable(elec);
75  elec.update(); // update distance tables
76  const int nelec = elec.getTotalNum();
77  // read Jastrow component from xml text
78  const char* jastrow_text = R"(<tmp>
79  <jastrow name="J2" type="Two-Body" function="Bspline">
80  <correlation speciesA="u" speciesB="u" size="8">
81  <coefficients id="uu" type="Array" optimize="yes">4.868951397 3.154235815 1.719776072 0.9676536301 0.6044866223 0.3368526364 0.1566214572 0.06031539785</coefficients>
82  </correlation>
83  <correlation speciesA="u" speciesB="d" size="8">
84  <coefficients id="ud" type="Array" optimize="yes">6.991319036 3.93760887 2.077967513 1.115208829 0.6946729632 0.3826149045 0.1705411558 0.06155742938</coefficients>
85  </correlation>
86  </jastrow>
87 </tmp>)";
88  okay = doc.parseFromString(jastrow_text);
89  REQUIRE(okay);
90  root = doc.getRoot();
91  node = xmlFirstElementChild(root);
92  RadialJastrowBuilder jastrow(c, elec);
93  using J2Type = TwoBodyJastrow<BsplineFunctor<RealType>>;
94  auto j2_uptr = jastrow.buildComponent(node);
95  J2Type* j2 = dynamic_cast<J2Type*>(j2_uptr.get());
96  REQUIRE(j2);
97 
98  // Step 2: test Jastrow vglh
99  double logpsi = real(j2->evaluateLog(elec, elec.G, elec.L));
100  CHECK(real(logpsi) == Approx(-1.51908));
101  CHECK(real(elec.G[0][0]) == Approx(0.08490220791));
102  CHECK(real(elec.G[0][1]) == Approx(-0.006958062051));
103  CHECK(real(elec.G[1][0]) == Approx(-0.1325957095));
104  CHECK(real(elec.G[1][1]) == Approx(0.01872445072));
105  CHECK(real(elec.G[2][0]) == Approx(0.004059085343));
106  CHECK(real(elec.G[2][1]) == Approx(0.009109497845));
107  CHECK(real(elec.G[3][0]) == Approx(0.04363441629));
108  CHECK(real(elec.G[3][1]) == Approx(-0.02087588652));
109  for (int i = 0; i < nelec; i++)
110  {
111  for (int l = 0; l < OHMMS_DIM; l++)
112  CHECK(imag(elec.G[i][l]) == Approx(0));
113  CHECK(real(elec.G[i][2]) == Approx(0)); // ndim=2
114  }
115  const std::vector<RealType> lap_values = {-0.00916449, -0.0166369, -0.00351783, -0.0153977};
116  for (int m = 0; m < nelec; m++)
117  CHECK(real(elec.L[m]) == Approx(lap_values[m]));
118 
119  WaveFunctionComponent::HessVector grad_grad_psi;
120  grad_grad_psi.resize(nelec);
121  grad_grad_psi = 0.0;
122 
123  CHECK_THROWS(j2->evaluateHessian(elec, grad_grad_psi));
124  //std::vector<double> hess_values = {
125  // -0.0108098, -0.00172466, 0,
126  // -0.00172466, 0.00164531, 0,
127  // 0, 0, 0.00513802,
128  // -0.0254307, 0.00476379, 0,
129  // 0.00476379, 0.00879376, 0,
130  // 0, 0, 0.00948111,
131  // -0.000367339, -0.00154737, 0,
132  // -0.00154737, -0.00315049, 0,
133  // 0, 0, 0.00032215,
134  // -0.0284186, 0.00421815, 0,
135  // 0.00421815, 0.0130209, 0,
136  // 0, 0, 0.0137115
137  //}; // why do the zz components have non-zero values?
138 
139  //int m = 0;
140  //for (int n = 0; n < nelec; n++)
141  // for (int i = 0; i < OHMMS_DIM; i++)
142  // for (int j = 0; j < OHMMS_DIM; j++, m++)
143  // CHECK(real(grad_grad_psi[n](i, j)) == Approx(hess_values[m]));
144 
145  // Step 3: test Jastrow ratio for pbyp move
146  PosType newpos(0.3, 0.2, 0.5);
147 
148  elec.makeVirtualMoves(newpos);
149  std::vector<ValueType> ratios(nelec);
150  j2->evaluateRatiosAlltoOne(elec, ratios);
151  std::vector<double> ratio_values = {1.46023, 1.46559, 0.444258, 1.90226};
152  for (int i = 0; i < ratios.size(); i++)
153  CHECK(real(ratios[i]) == Approx(ratio_values[i]));
154 
155  for (int i = 0; i < nelec; i++)
156  {
157  elec.makeMove(i, newpos - elec.R[i]);
158  PsiValue rat1 = j2->ratio(elec, i);
159  CHECK(real(rat1) == Approx(ratio_values[i]));
160  elec.rejectMove(i);
161  }
162 
163  // Step 4: test Jastrow parameter derivatives
164  UniqueOptObjRefs opt_obj_refs;
165  j2->extractOptimizableObjectRefs(opt_obj_refs);
166  REQUIRE(opt_obj_refs.size() == 2);
167 
168  opt_variables_type optvars;
169  Vector<ValueType> dlogpsi;
170  Vector<ValueType> dhpsioverpsi;
171 
172  for (OptimizableObject& obj : opt_obj_refs)
173  obj.checkInVariablesExclusive(optvars);
174  optvars.resetIndex();
175  const int NumOptimizables(optvars.size());
176  j2->checkOutVariables(optvars);
177  dlogpsi.resize(NumOptimizables);
178  dhpsioverpsi.resize(NumOptimizables);
179  j2->evaluateDerivatives(elec, optvars, dlogpsi, dhpsioverpsi);
180  app_log() << std::endl << "reporting dlogpsi and dhpsioverpsi" << std::scientific << std::endl;
181  for (int iparam = 0; iparam < NumOptimizables; iparam++)
182  app_log() << "param=" << iparam << " : " << dlogpsi[iparam] << " " << dhpsioverpsi[iparam] << std::endl;
183  app_log() << std::endl;
184  const std::vector<RealType> dlogpsi_values = {0, 0, 0, 0, 0, 0, -1.521258e-04, -2.194165e-01, 0, 0, -2.779981e-02, -5.327999e-01, -9.356640e-01, -4.847466e-01, -1.945081e-02, -2.453297e-01};
185  const std::vector<RealType> dhpsi_values = {0, 0, 0, 0, 0, 0, 5.953288e-03, 8.618836e-03, 0, 0, 2.572195e-02, -5.048126e-02, -3.139861e-02, 2.197638e-02, 4.319522e-02, 3.512834e-02};
186  for (int iparam = 0; iparam < NumOptimizables; iparam++)
187  {
188  CHECK(real(dlogpsi[iparam]) == Approx(dlogpsi_values[iparam]));
189  CHECK(real(dhpsioverpsi[iparam]) == Approx(dhpsi_values[iparam]));
190  }
191 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
QMCTraits::RealType real
if(!okay) throw std xmlNodePtr node
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
void resetIndex()
reset Index
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
#define OHMMS_DIM
Definition: config.h:64
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [112/537]

qmcplusplus::TEST_CASE ( "Gaussian Functor"  ,
""  [wavefunction] 
)

Definition at line 30 of file test_counting_jastrow.cpp.

References CHECK(), CountingGaussian::evaluate(), CountingGaussian::evaluateDerivatives(), CountingGaussian::evaluateLog(), CountingGaussian::evaluateLogDerivatives(), Libxml2Document::getRoot(), Libxml2Document::parseFromString(), CountingGaussian::put(), and REQUIRE().

31 {
34  using TensorType = QMCTraits::TensorType;
35 
36  CountingGaussian gf_abc("gf_abc");
37  CountingGaussian gf_adk("gf_adk");
38 
39  // test parse/put for both input modes
40  const char* gaussian_xml_abc = R"(<function id="g0">
41  <var name="A" opt="true">-1.5 0.353553390593273 -0.353553390593273 -2.25 -0.75 -2.25</var>
42  <var name="B" opt="true">-1.5 0.353553390593273 -0.353553390593273</var>
43  <var name="C" opt="true">-1.5</var>
44  </function>)";
45  const char* gaussian_xml_adk = R"(<function id="g1">
46  <var name="A" opt="true">-1.5 0.353553390593273 -0.353553390593273 -2.25 -0.75 -2.25</var>
47  <var name="D" opt="true">1.0 0.0 0.0</var>
48  <var name="K" opt="true">0.0</var>
49  </function>)";
50  Libxml2Document doc_abc, doc_adk;
51  bool parse_abc = doc_abc.parseFromString(gaussian_xml_abc);
52  bool parse_adk = doc_adk.parseFromString(gaussian_xml_adk);
53  xmlNodePtr root_abc = doc_abc.getRoot();
54  xmlNodePtr root_adk = doc_adk.getRoot();
55  bool put_abc = gf_abc.put(root_abc);
56  bool put_adk = gf_adk.put(root_adk);
57  REQUIRE((parse_abc && parse_adk && put_abc && put_adk) == true);
58 
59  // test points
60  PosType r1(1, 0, 0);
61  PosType r2(1.707106781186547, 0.5, -0.5);
62  PosType r3(0.4714617144631338, 0.1499413068889379, 0.2932213074999387);
63 
64  // return variables
65  RealType fval, lval, llap, flap;
66  PosType fgrad, lgrad;
67  opt_variables_type opt_vars;
68 
69  std::vector<RealType> dfval;
70  std::vector<PosType> dfgrad;
71  std::vector<RealType> dflap;
72  dfval.resize(10);
73  dfgrad.resize(10);
74  dflap.resize(10);
75 
76  // value tests for ADK input
77  gf_adk.evaluate(r1, fval, fgrad, flap);
78  gf_adk.evaluateLog(r1, lval, lgrad, llap);
79  CHECK(fval == Approx(1));
80  CHECK(fgrad[0] == Approx(0));
81  CHECK(fgrad[1] == Approx(0));
82  CHECK(fgrad[2] == Approx(0));
83  CHECK(flap == Approx(-12));
84  CHECK(lval == Approx(0));
85  CHECK(lgrad[0] == Approx(0));
86  CHECK(lgrad[1] == Approx(0));
87  CHECK(lgrad[2] == Approx(0));
88  CHECK(llap == Approx(-12));
89  // value tests for ABC input
90  gf_abc.evaluate(r1, fval, fgrad, flap);
91  gf_abc.evaluateLog(r1, lval, lgrad, llap);
92  CHECK(fval == Approx(1));
93  CHECK(fgrad[0] == Approx(0));
94  CHECK(fgrad[1] == Approx(0));
95  CHECK(fgrad[2] == Approx(0));
96  CHECK(flap == Approx(-12));
97  CHECK(lval == Approx(0));
98  CHECK(lgrad[0] == Approx(0));
99  CHECK(lgrad[1] == Approx(0));
100  CHECK(lgrad[2] == Approx(0));
101  CHECK(llap == Approx(-12));
102  // evaluateDerivatives
103  gf_abc.evaluateDerivatives(r3, dfval, dfgrad, dflap);
104  CHECK(dfval[0] == Approx(0.113120472934));
105  CHECK(dfval[1] == Approx(0.071952529875));
106  CHECK(dfval[2] == Approx(0.140708490047));
107  CHECK(dfval[3] == Approx(0.011441709933));
108  CHECK(dfval[4] == Approx(0.044750218821));
109  CHECK(dfval[5] == Approx(0.043756180154));
110  CHECK(dfval[6] == Approx(-0.47987130010));
111  CHECK(dfval[7] == Approx(-0.15261584911));
112  CHECK(dfval[8] == Approx(-0.29845157248));
113  CHECK(dfval[9] == Approx(0.508918630484));
114  // evaluateLogDerivatives
115  gf_abc.evaluateLogDerivatives(r3, dfval, dfgrad, dflap);
116  CHECK(dfval[0] == Approx(0.222276148205));
117  CHECK(dfval[1] == Approx(0.141383171229));
118  CHECK(dfval[2] == Approx(0.276485240702));
119  CHECK(dfval[3] == Approx(0.022482395511));
120  CHECK(dfval[4] == Approx(0.087931972108));
121  CHECK(dfval[5] == Approx(0.085978735172));
122  CHECK(dfval[6] == Approx(-0.94292342892));
123  CHECK(dfval[7] == Approx(-0.29988261377));
124  CHECK(dfval[8] == Approx(-0.58644261500));
125  CHECK(dfval[9] == Approx(1));
126 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
QMCTraits::PosType PosType
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [113/537]

qmcplusplus::TEST_CASE ( "distance_open_z"  ,
""  [distance_table][xml] 
)

Definition at line 30 of file test_distance_table.cpp.

References ParticleSet::addTable(), CHECK(), doc, ParticleSet::getDistTableAB(), OhmmsElementBase::getName(), Libxml2Document::getRoot(), ParticleSet::getTotalNum(), ParticleSet::isSameMass(), okay, Libxml2Document::parseFromString(), XMLParticleParser::readXML(), REQUIRE(), and ParticleSet::update().

31 {
32  // test that particle distances are properly calculated
33 
34 
35  const char* particles = R"(<tmp>
36 <particleset name="e" random="yes">
37  <group name="u" size="1" mass="1.0">
38  <parameter name="charge" > -1 </parameter>
39  <parameter name="mass" > 1.0 </parameter>
40  <attrib name="position" datatype="posArray" condition="0">
41  0.00000000 0.00000000 0.20000000
42  </attrib>
43  </group>
44  <group name="d" size="1" mass="1.0">
45  <parameter name="charge" > -1 </parameter>
46  <parameter name="mass" > 1.0 </parameter>
47  <attrib name="position" datatype="posArray" condition="0">
48  0.00000000 0.00000000 -0.20000000
49  </attrib>
50  </group>
51 </particleset>
52 <particleset name="ion0">
53  <group name="H" size="2" mass="1836.15">
54  <parameter name="charge" > 1 </parameter>
55  <parameter name="valence" > 1 </parameter>
56  <parameter name="atomicnumber" > 1 </parameter>
57  <parameter name="mass" > 1836.15 </parameter>
58  <attrib name="position" datatype="posArray" condition="0">
59  0.00000000 0.00000000 0.00000000
60  0.00000000 0.00000000 0.50000000
61  </attrib>
62  </group>
63 </particleset>
64 </tmp>
65 )";
66 
68  bool okay = doc.parseFromString(particles);
69  REQUIRE(okay);
70 
71  xmlNodePtr root = doc.getRoot();
72  xmlNodePtr part1 = xmlFirstElementChild(root);
73  xmlNodePtr part2 = xmlNextElementSibling(part1);
74 
75  // read particle set
76  const SimulationCell simulation_cell;
77  ParticleSet ions(simulation_cell), electrons(simulation_cell);
78 
79  XMLParticleParser parse_electrons(electrons);
80  parse_electrons.readXML(part1);
81 
82  XMLParticleParser parse_ions(ions);
83  parse_ions.readXML(part2);
84 
85  REQUIRE(electrons.getName() == "e");
86  REQUIRE(ions.getName() == "ion0");
87  REQUIRE(ions.isSameMass());
88  REQUIRE(electrons.isSameMass());
89 
90  // calculate particle distances
91  const int tid = electrons.addTable(ions);
92  electrons.update();
93 
94  // get target particle set's distance table data
95  const auto& dtable = electrons.getDistTableAB(tid);
96  REQUIRE(dtable.getName() == "ion0_e");
97 
98  REQUIRE(dtable.sources() == ions.getTotalNum());
99  REQUIRE(dtable.targets() == electrons.getTotalNum());
100 
101  double expect[] = {0.2, 0.2, 0.3, 0.7};
102  int idx(0);
103  for (int iat = 0; iat < dtable.sources(); iat++)
104  {
105  for (int jat = 0; jat < dtable.targets(); jat++, idx++)
106  {
107  double dist = dtable.getDistRow(jat)[iat];
108  CHECK(dist == Approx(expect[idx]));
109  }
110  }
111 
112  TinyVector<double, 3> displ1 = dtable.getDisplacements()[0][0];
113  CHECK(displ1[0] == Approx(0.0));
114  CHECK(displ1[1] == Approx(0.0));
115  CHECK(displ1[2] == Approx(-0.2));
116 
117  TinyVector<double, 3> displ2 = dtable.getDisplacements()[0][1];
118  CHECK(displ2[0] == Approx(0.0));
119  CHECK(displ2[1] == Approx(0.0));
120  CHECK(displ2[2] == Approx(0.3));
121 
122  // get distance between target="e" group="u" iat=0 and source="ion0" group="H" jat=1
123 
124 } // TEST_CASE distance_open_z
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [114/537]

qmcplusplus::TEST_CASE ( "kspace jastrow"  ,
""  [wavefunction] 
)

Definition at line 31 of file test_kspace_jastrow.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), app_log(), kSpaceJastrowBuilder::buildComponent(), CHECK(), OHMMS::Controller, ParticleSet::create(), ParticleSet::createSK(), doc, ParticleSet::G, Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), ParticleSet::L, lattice, okay, Libxml2Document::parseFromString(), LatticeParser::put(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), and ParticleSet::update().

32 {
34 
35  // initialize simulationcell for kvectors
36  const char* xmltext = R"(<tmp>
37  <simulationcell>
38  <parameter name="lattice" units="bohr">
39  6.00000000 0.00000000 0.00000000
40  0.00000000 6.00000000 0.00000000
41  0.00000000 0.00000000 6.00000000
42  </parameter>
43  <parameter name="bconds">
44  p p p
45  </parameter>
46  <parameter name="LR_dim_cutoff"> 15 </parameter>
47  </simulationcell>
48 </tmp>)";
50  bool okay = doc.parseFromString(xmltext);
51  REQUIRE(okay);
52 
53  xmlNodePtr root = doc.getRoot();
54  xmlNodePtr part1 = xmlFirstElementChild(root);
55 
56  // read lattice
57  ParticleSet::ParticleLayout lattice;
58  LatticeParser lp(lattice);
59  lp.put(part1);
60  lattice.print(app_log(), 0);
61 
62  const SimulationCell simulation_cell(lattice);
63  ParticleSet ions_(simulation_cell);
64  ParticleSet elec_(simulation_cell);
65 
66  ions_.setName("ion");
67  ions_.create({1});
68  ions_.R[0] = {0.0, 0.0, 0.0};
69  elec_.setName("elec");
70  elec_.create({2, 0});
71  elec_.R[0] = {-0.28, 0.0225, -2.709};
72  elec_.R[1] = {-1.08389, 1.9679, -0.0128914};
73  SpeciesSet& tspecies = elec_.getSpeciesSet();
74  int upIdx = tspecies.addSpecies("u");
75  int downIdx = tspecies.addSpecies("d");
76  int chargeIdx = tspecies.addAttribute("charge");
77  tspecies(chargeIdx, upIdx) = -1;
78  tspecies(chargeIdx, downIdx) = -1;
79  // initialize SK
80  elec_.createSK();
81 
82  const char* particles = R"(<tmp>
83 <jastrow name="Jk" type="kSpace" source="ion">
84  <correlation kc="1.5" type="Two-Body" symmetry="isotropic">
85  <coefficients id="cG2" type="Array">
86  -100. -50.
87  </coefficients>
88  </correlation>
89 </jastrow>
90 </tmp>
91 )";
92  okay = doc.parseFromString(particles);
93  REQUIRE(okay);
94 
95  root = doc.getRoot();
96  xmlNodePtr jas1 = xmlFirstElementChild(root);
97 
98  kSpaceJastrowBuilder jastrow(c, elec_, ions_);
99  std::unique_ptr<WaveFunctionComponent> jas(jastrow.buildComponent(jas1));
100 
101  // update all distance tables
102  elec_.update();
103 
104  double logpsi_real = std::real(jas->evaluateLog(elec_, elec_.G, elec_.L));
105  CHECK(logpsi_real == Approx(-4.4088303951)); // !!!! value not checked
106 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [115/537]

qmcplusplus::TEST_CASE ( "RPA Jastrow"  ,
""  [wavefunction] 
)

Definition at line 31 of file test_rpa_jastrow.cpp.

References SpeciesSet::addSpecies(), app_log(), CHECK(), ParticleSet::create(), ParticleSet::createSK(), doc, ParticleSet::G, Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), ParticleSet::L, lattice, okay, Libxml2Document::parseFromString(), LatticeParser::put(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), and ParticleSet::update().

32 {
33  // initialize simulationcell for kvectors
34  const char* xmltext = R"(<tmp>
35  <simulationcell>
36  <parameter name="lattice" units="bohr">
37  6.00000000 0.00000000 0.00000000
38  0.00000000 6.00000000 0.00000000
39  0.00000000 0.00000000 6.00000000
40  </parameter>
41  <parameter name="bconds">
42  p p p
43  </parameter>
44  <parameter name="LR_dim_cutoff"> 15 </parameter>
45  </simulationcell>
46 </tmp>)";
48  bool okay = doc.parseFromString(xmltext);
49  REQUIRE(okay);
50 
51  xmlNodePtr root = doc.getRoot();
52  xmlNodePtr part1 = xmlFirstElementChild(root);
53 
54  // read lattice
55  ParticleSet::ParticleLayout lattice;
56  LatticeParser lp(lattice);
57  lp.put(part1);
58  lattice.print(app_log(), 0);
59 
60  const SimulationCell simulation_cell(lattice);
61  ParticleSet ions_(simulation_cell);
62  ParticleSet elec_(simulation_cell);
63 
64  ions_.setName("ion");
65  ions_.create({2});
66  ions_.R[0] = {2.0, 0.0, 0.0};
67  ions_.R[1] = {-2.0, 0.0, 0.0};
68  SpeciesSet& source_species(ions_.getSpeciesSet());
69  source_species.addSpecies("O");
70  ions_.update();
71 
72  elec_.setName("elec");
73  elec_.create({2, 2});
74  elec_.R[0] = {1.00, 0.0, 0.0};
75  elec_.R[1] = {0.0, 0.0, 0.0};
76  elec_.R[2] = {-1.00, 0.0, 0.0};
77  elec_.R[3] = {0.0, 0.0, 2.0};
78  SpeciesSet& target_species(elec_.getSpeciesSet());
79  int upIdx = target_species.addSpecies("u");
80  int downIdx = target_species.addSpecies("d");
81  int chargeIdx = target_species.addAttribute("charge");
82  target_species(chargeIdx, upIdx) = -1;
83  target_species(chargeIdx, downIdx) = -1;
84 
85  // initialize SK
86  elec_.createSK();
87 
88  xmltext = R"(<tmp>
89  <jastrow name="Jee" type="Two-Body" function="rpa"/>
90 </tmp>)";
91  okay = doc.parseFromString(xmltext);
92  REQUIRE(okay);
93 
94  root = doc.getRoot();
95 
96  xmlNodePtr jas_node = xmlFirstElementChild(root);
97  auto jas = std::make_unique<RPAJastrow>(elec_);
98  jas->put(root);
99 
100  // update all distance tables
101  elec_.update();
102 
103  double logpsi_real = std::real(jas->evaluateLog(elec_, elec_.G, elec_.L));
104  CHECK(logpsi_real == Approx(-1.3327837613)); // note: number not validated
105 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [116/537]

qmcplusplus::TEST_CASE ( "Stress BCC H Ewald3D"  ,
""  [hamiltonian] 
)

Definition at line 31 of file test_stress.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombDerivHandler, LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), StressPBC::evaluate(), ParticleSet::getSpeciesSet(), ForceBase::getStressEE(), ForceBase::getStressEI(), lattice, ParticleSet::R, ParticleSet::resetGroups(), ParticleSet::setName(), and ParticleSet::update().

32 {
33  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
34  lattice.BoxBConds = true; // periodic
35  lattice.R.diagonal(3.24957306);
36  lattice.LR_dim_cutoff = 40;
37  lattice.reset();
38 
39  const SimulationCell simulation_cell(lattice);
40  ParticleSet ions(simulation_cell);
41  ParticleSet elec(simulation_cell);
42 
43  ions.setName("ion");
44  ions.create({2});
45  ions.R[0] = {0.0, 0.0, 0.0};
46  ions.R[1] = {1.62478653, 1.62478653, 1.62478653};
47  SpeciesSet& ion_species = ions.getSpeciesSet();
48  int pIdx = ion_species.addSpecies("H");
49  int pChargeIdx = ion_species.addAttribute("charge");
50  ion_species(pChargeIdx, pIdx) = 1;
51  ions.resetGroups();
52  ions.createSK();
53  ions.update();
54 
55  elec.setName("elec");
56  elec.create({2});
57  elec.R[0] = {0.4, 0.4, 0.4};
58  elec.R[1] = {2.02478653, 2.02478653, 2.02478653};
59  SpeciesSet& tspecies = elec.getSpeciesSet();
60  int upIdx = tspecies.addSpecies("u");
61  int chargeIdx = tspecies.addAttribute("charge");
62  int massIdx = tspecies.addAttribute("mass");
63  tspecies(chargeIdx, upIdx) = -1;
64  tspecies(massIdx, upIdx) = 1.0;
65 
66  // The call to resetGroups is needed transfer the SpeciesSet
67  // settings to the ParticleSet
68  elec.resetGroups();
69  elec.createSK();
70 
71  RuntimeOptions runtime_options;
72  TrialWaveFunction psi(runtime_options);
73 
74  LRCoulombSingleton::CoulombHandler = std::make_unique<EwaldHandler3D>(ions);
75  LRCoulombSingleton::CoulombHandler->initBreakup(ions);
76  LRCoulombSingleton::CoulombDerivHandler = std::make_unique<EwaldHandler3D>(ions);
77  LRCoulombSingleton::CoulombDerivHandler->initBreakup(ions);
78 
79  StressPBC est(ions, elec, psi);
80 
81  elec.update();
82  est.evaluate(elec);
83 
84  // i-i = e-e stress is validated against Quantum Espresso's ewald method
85  // they are also double checked using finite-difference
86  CHECK(est.getStressEE()(0, 0) == Approx(-0.01087883));
87  CHECK(est.getStressEE()(0, 1) == Approx(0.0));
88  CHECK(est.getStressEE()(0, 2) == Approx(0.0));
89  CHECK(est.getStressEE()(1, 0) == Approx(0.0));
90  CHECK(est.getStressEE()(1, 1) == Approx(-0.01087883));
91  CHECK(est.getStressEE()(1, 2) == Approx(0.0));
92  CHECK(est.getStressEE()(2, 0) == Approx(0.0));
93  CHECK(est.getStressEE()(2, 1) == Approx(0.0));
94  CHECK(est.getStressEE()(2, 2) == Approx(-0.01087883));
95 
96  //Electron-Ion stress diagonal is internally validated using fd.
97  CHECK(est.getStressEI()(0, 0) == Approx(-0.00745376));
98  //CHECK(est.getStressEI()(0, 1) == Approx(0.0));
99  //CHECK(est.getStressEI()(0, 2) == Approx(0.0));
100  //CHECK(est.getStressEI()(1, 0) == Approx(0.0));
101  CHECK(est.getStressEI()(1, 1) == Approx(-0.00745376));
102  //CHECK(est.getStressEI()(1, 2) == Approx(0.0));
103  //CHECK(est.getStressEI()(2, 0) == Approx(0.0));
104  //CHECK(est.getStressEI()(2, 1) == Approx(0.0));
105  CHECK(est.getStressEI()(2, 2) == Approx(-0.00745376));
106 
107  LRCoulombSingleton::CoulombHandler.reset(nullptr);
108 
109  LRCoulombSingleton::CoulombDerivHandler.reset(nullptr);
110 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [117/537]

qmcplusplus::TEST_CASE ( "LocalEnergyOnly"  ,
""  [estimators] 
)

Definition at line 31 of file test_local_energy_est.cpp.

References LocalEnergyOnlyEstimator::accumulate(), WalkerConfigurations::begin(), CHECK(), ParticleSet::create(), MCWalkerConfiguration::createWalkers(), WalkerConfigurations::end(), LocalEnergyOnlyEstimator::getName(), ScalarEstimatorBase::scalars, and ParticleSet::setName().

32 {
33  LocalEnergyOnlyEstimator le_est;
34 
35  const SimulationCell simulation_cell;
36  MCWalkerConfiguration W(simulation_cell);
37  W.setName("electrons");
38  W.create({1});
39  W.createWalkers(1);
40 
41  (*W.begin())->Properties(WP::LOCALENERGY) = 1.1;
42 
43  le_est.accumulate(W, W.begin(), W.end(), 1.0);
44 
45  CHECK(le_est.getName() == "LocalEnergyOnlyEstimator");
46  CHECK(le_est.scalars[0].mean() == Approx(1.1));
47 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [118/537]

qmcplusplus::TEST_CASE ( "test_runtime_manager"  ,
""  [utilities] 
)

Definition at line 32 of file test_runtime_manager.cpp.

References CHECK(), convert_to_ns(), qmcplusplus::Units::charge::e, RunTimeManager< CLOCK >::elapsed(), and qmcplusplus::Units::time::s.

33 {
34  // Use a local version rather than the global timer_manager, otherwise
35  // changes will persist from test to test.
36  RunTimeManager<FakeChronoClock> rm;
37  FakeChronoClock::fake_chrono_clock_increment = convert_to_ns(1.0s);
38  double e = rm.elapsed();
39  CHECK(e == Approx(1.0));
40 }
FakeChronoClock::duration convert_to_ns(T in)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [119/537]

qmcplusplus::TEST_CASE ( "Einspline SPO from HDF diamond_1x1x1"  ,
""  [wavefunction] 
)

Definition at line 32 of file test_einset.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), CHECK(), OHMMS::Controller, ParticleSet::create(), ParticleSet::createResource(), EinsplineSetBuilder::createSPOSetFromXML(), doc, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), lattice, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), Vector< T, Alloc >::size(), and ParticleSet::update().

33 {
35 
36  ParticleSet::ParticleLayout lattice;
37  // monoO
38  // lattice.R(0,0) = {5.10509515, -3.23993545, 0.0, 5.10509515, 3.23993545, 0.0, -6.49690625, 0.0, 7.08268015};
39 
40  // diamondC_1x1x1
41  lattice.R = {3.37316115, 3.37316115, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
42 
43  ParticleSetPool ptcl = ParticleSetPool(c);
44  ptcl.setSimulationCell(lattice);
45  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
46  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
47  ParticleSet& ions_(*ions_uptr);
48  ParticleSet& elec_(*elec_uptr);
49 
50  ions_.setName("ion");
51  ptcl.addParticleSet(std::move(ions_uptr));
52  ions_.create({2});
53  ions_.R[0] = {0.0, 0.0, 0.0};
54  ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
55 
56 
57  elec_.setName("elec");
58  ptcl.addParticleSet(std::move(elec_uptr));
59  elec_.create({2});
60  elec_.R[0] = {0.0, 0.0, 0.0};
61  elec_.R[1] = {0.0, 1.0, 0.0};
62 
63  SpeciesSet& tspecies = elec_.getSpeciesSet();
64  int upIdx = tspecies.addSpecies("u");
65  int chargeIdx = tspecies.addAttribute("charge");
66  tspecies(chargeIdx, upIdx) = -1;
67 
68  //diamondC_1x1x1
69  // add save_coefs="yes" to create an HDF file of spline coefficients for the eval_bspline_spo.py script
70  const char* particles = R"(<tmp>
71 <determinantset type="einspline" href="diamondC_1x1x1.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.0" precision="float" size="8"/>
72 </tmp>)";
73 
75  bool okay = doc.parseFromString(particles);
76  REQUIRE(okay);
77 
78  xmlNodePtr root = doc.getRoot();
79 
80  xmlNodePtr ein1 = xmlFirstElementChild(root);
81 
82  EinsplineSetBuilder einSet(elec_, ptcl.getPool(), c, ein1);
83  auto spo = einSet.createSPOSetFromXML(ein1);
84  REQUIRE(spo);
85 
86  // Test the case where the number of psi values is not the orbital set size
87  // or the number of electrons/2
88  const int psi_size = 3;
89  SPOSet::ValueMatrix psiM(elec_.R.size(), psi_size);
90  SPOSet::GradMatrix dpsiM(elec_.R.size(), psi_size);
91  SPOSet::ValueMatrix d2psiM(elec_.R.size(), psi_size);
92  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM, dpsiM, d2psiM);
93 
94  // value
95  CHECK(std::real(psiM[0][0]) == Approx(-0.42546836868));
96  CHECK(std::real(psiM[0][1]) == Approx(0.0));
97  CHECK(std::real(psiM[1][0]) == Approx(-0.8886948824));
98  CHECK(std::real(psiM[1][1]) == Approx(1.419412370359));
99  // grad
100  CHECK(std::real(dpsiM[1][0][0]) == Approx(-0.0000183403));
101  CHECK(std::real(dpsiM[1][0][1]) == Approx(0.1655139178));
102  CHECK(std::real(dpsiM[1][0][2]) == Approx(-0.0000193077));
103  CHECK(std::real(dpsiM[1][1][0]) == Approx(-1.3131694794));
104  CHECK(std::real(dpsiM[1][1][1]) == Approx(-1.1174004078));
105  CHECK(std::real(dpsiM[1][1][2]) == Approx(-0.8462534547));
106  // lapl
107  CHECK(std::real(d2psiM[1][0]) == Approx(1.3313053846));
108  CHECK(std::real(d2psiM[1][1]) == Approx(-4.712583065));
109 
110  // for vgh
111  SPOSet::ValueVector psiV(psiM[1], psi_size);
112  SPOSet::GradVector dpsiV(dpsiM[1], psi_size);
113  SPOSet::HessVector ddpsiV(psi_size);
114  spo->evaluateVGH(elec_, 1, psiV, dpsiV, ddpsiV);
115 
116  // Catch default is 100*(float epsilson)
117  double eps = 2000 * std::numeric_limits<float>::epsilon();
118  //hess
119  CHECK(std::real(ddpsiV[1](0, 0)) == Approx(-2.3160984034));
120  CHECK(std::real(ddpsiV[1](0, 1)) == Approx(1.8089479397));
121  CHECK(std::real(ddpsiV[1](0, 2)) == Approx(0.5608575749));
122  CHECK(std::real(ddpsiV[1](1, 0)) == Approx(1.8089479397));
123  CHECK(std::real(ddpsiV[1](1, 1)) == Approx(-0.07996207476).epsilon(eps));
124  CHECK(std::real(ddpsiV[1](1, 2)) == Approx(0.5237969314));
125  CHECK(std::real(ddpsiV[1](2, 0)) == Approx(0.5608575749));
126  CHECK(std::real(ddpsiV[1](2, 1)) == Approx(0.5237969314));
127  CHECK(std::real(ddpsiV[1](2, 2)) == Approx(-2.316497764));
128 
129  SPOSet::HessMatrix hesspsiV(elec_.R.size(), psi_size);
130  SPOSet::GGGMatrix d3psiV(elec_.R.size(), psi_size);
131  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM, dpsiM, hesspsiV, d3psiV);
132 
133  //The reference values for grad_grad_grad_psi.
134  /*
135  d3psiV(1,0)[0][0]=(0.046337127685546875,-0.046337127685546875)
136  d3psiV(1,0)[0][1]=(1.1755813360214233,-1.1755813360214233)
137  d3psiV(1,0)[0][2]=(0.066015571355819702,-0.066015541553497314)
138  d3psiV(1,0)[0][4]=(0.041470438241958618,-0.041470438241958618)
139  d3psiV(1,0)[0][5]=(-0.51674127578735352,0.51674127578735352)
140  d3psiV(1,0)[0][8]=(0.065953642129898071,-0.065953642129898071)
141  d3psiV(1,0)[1][4]=(-4.8771157264709473,4.8771157264709473)
142  d3psiV(1,0)[1][5]=(0.041532635688781738,-0.041532605886459351)
143  d3psiV(1,0)[1][8]=(1.1755810976028442,-1.1755810976028442)
144  d3psiV(1,0)[2][8]=(0.046399354934692383,-0.046399354934692383)
145 
146  d3psiV(1,1)[0][0]=(6.7155771255493164,-7.5906991958618164)
147  d3psiV(1,1)[0][1]=(5.545051097869873,-5.0280308723449707)
148  d3psiV(1,1)[0][2]=(0.98297119140625,-0.50021600723266602)
149  d3psiV(1,1)[0][4]=(-3.1704092025756836,3.8900821208953857)
150  d3psiV(1,1)[0][5]=(-1.9537661075592041,1.7758266925811768)
151  d3psiV(1,1)[0][8]=(1.9305641651153564,-2.1480715274810791)
152  d3psiV(1,1)[1][4]=(3.605137825012207,-3.2767453193664551)
153  d3psiV(1,1)[1][5]=(-0.73825764656066895,-0.33745908737182617)
154  d3psiV(1,1)[1][8]=(5.5741839408874512,-5.0784988403320312)
155  d3psiV(1,1)[2][8]=(3.131234884262085,-1.3596141338348389)
156 */
157 
158 #if 0 //Enable when finite precision issue on Rhea is found.
159  CHECK(std::real(d3psiV(1,0)[0][0] ) == Approx(0.0463371276));
160  CHECK(std::real(d3psiV(1,0)[0][1] ) == Approx(1.1755813360));
161  CHECK(std::real(d3psiV(1,0)[0][2] ) == Approx(0.0660155713));
162  CHECK(std::real(d3psiV(1,0)[0][4] ) == Approx(0.0414704382));
163  CHECK(std::real(d3psiV(1,0)[0][5] ) == Approx(-0.5167412758));
164  CHECK(std::real(d3psiV(1,0)[0][8] ) == Approx(0.0659536421));
165  CHECK(std::real(d3psiV(1,0)[1][4] ) == Approx(-4.8771157264));
166  CHECK(std::real(d3psiV(1,0)[1][5] ) == Approx(0.0415326356));
167  CHECK(std::real(d3psiV(1,0)[1][8] ) == Approx(1.1755810976));
168  CHECK(std::real(d3psiV(1,0)[2][8] ) == Approx(0.0463993549));
169 
170  CHECK(std::real(d3psiV(1,1)[0][0] ) == Approx(6.7155771255));
171  CHECK(std::real(d3psiV(1,1)[0][1] ) == Approx(5.5450510978));
172  CHECK(std::real(d3psiV(1,1)[0][2] ) == Approx(0.9829711914));
173  CHECK(std::real(d3psiV(1,1)[0][4] ) == Approx(-3.1704092025));
174  CHECK(std::real(d3psiV(1,1)[0][5] ) == Approx(-1.9537661075));
175  CHECK(std::real(d3psiV(1,1)[0][8] ) == Approx(1.9305641651));
176  CHECK(std::real(d3psiV(1,1)[1][4] ) == Approx(3.6051378250));
177  CHECK(std::real(d3psiV(1,1)[1][5] ) == Approx(-0.7382576465));
178  CHECK(std::real(d3psiV(1,1)[1][8] ) == Approx(5.5741839408));
179  CHECK(std::real(d3psiV(1,1)[2][8] ) == Approx(3.1312348842));
180 #endif
181 
182  // Test the batched interface
183  ParticleSet elec_2(elec_);
184  // interchange positions
185  elec_2.R[0] = elec_.R[1];
186  elec_2.R[1] = elec_.R[0];
187  RefVectorWithLeader<ParticleSet> p_list(elec_);
188  p_list.push_back(elec_);
189  p_list.push_back(elec_2);
190 
191  std::unique_ptr<SPOSet> spo_2(spo->makeClone());
192  RefVectorWithLeader<SPOSet> spo_list(*spo);
193  spo_list.push_back(*spo);
194  spo_list.push_back(*spo_2);
195 
196  ResourceCollection pset_res("test_pset_res");
197  ResourceCollection spo_res("test_spo_res");
198 
199  elec_.createResource(pset_res);
200  spo->createResource(spo_res);
201 
202  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
203  ResourceCollectionTeamLock<SPOSet> mw_sposet_lock(spo_res, spo_list);
204 
205  const int ne = elec_.R.size();
206  SPOSet::ValueMatrix psi(ne, psi_size);
207  SPOSet::GradMatrix dpsi(ne, psi_size);
208  SPOSet::ValueMatrix d2psi(ne, psi_size);
209  SPOSet::ValueMatrix psi_2(ne, psi_size);
210  SPOSet::GradMatrix dpsi_2(ne, psi_size);
211  SPOSet::ValueMatrix d2psi_2(ne, psi_size);
212 
213  RefVector<SPOSet::ValueMatrix> psi_v_list;
214  RefVector<SPOSet::GradMatrix> dpsi_v_list;
215  RefVector<SPOSet::ValueMatrix> d2psi_v_list;
216 
217  psi_v_list.push_back(psi);
218  psi_v_list.push_back(psi_2);
219  dpsi_v_list.push_back(dpsi);
220  dpsi_v_list.push_back(dpsi_2);
221  d2psi_v_list.push_back(d2psi);
222  d2psi_v_list.push_back(d2psi_2);
223  spo->mw_evaluate_notranspose(spo_list, p_list, 0, elec_.R.size(), psi_v_list, dpsi_v_list, d2psi_v_list);
224 
225  CHECK(std::real(psi_v_list[0].get()[0][0]) == Approx(-0.42546836868));
226  CHECK(std::real(psi_v_list[0].get()[1][0]) == Approx(-0.8886948824));
227  // Second particle set had particle positions flipped
228  CHECK(std::real(psi_v_list[1].get()[0][0]) == Approx(-0.8886948824));
229  CHECK(std::real(psi_v_list[1].get()[1][0]) == Approx(-0.42546836868));
230 
231 #if 0
232  // Dump values of the orbitals
233  int orbSize= spo->getOrbitalSetSize();
234  int basisSize= spo->getBasisSetSize();
235  printf("orb size = %d basis set size = %d\n",orbSize, basisSize);
236 
237  FILE *fspo = fopen("spo.dat", "w");
238  for (int ix = 0; ix < 30; ix++) {
239  for (int iy = 0; iy < 30; iy++) {
240  for (int iz = 0; iz < 30; iz++) {
241  double x = 0.1*ix - 1.5;
242  double y = 0.1*iy - 1.5;
243  double z = 0.1*iz - 1.5;
244  elec_.R[0] = {x, y, z};
245  elec_.update();
246  SPOSet::ValueVector orbs(orbSize);
247  spo->evaluate(elec_, 0, orbs);
248  fprintf(fspo, "%g %g %g",x,y,z);
249  for (int j = 0; j < orbSize; j++) {
250  fprintf(fspo, " %g ",orbs[j]);
251  }
252  fprintf(fspo, "\n");
253  }
254  }
255  }
256  fclose(fspo);
257 
258 #endif
259 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [120/537]

qmcplusplus::TEST_CASE ( "LCAOrbitalBuilder"  ,
""  [wavefunction][LCAO] 
)

Definition at line 32 of file test_LCAOrbitalBuilder.cpp.

References SpeciesSet::addSpecies(), CHECK(), OHMMS::Controller, ParticleSet::create(), doc, LCAOrbitalBuilder::getBasissetMap(), Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), okay, Libxml2Document::parseFromString(), REQUIRE(), ParticleSet::setName(), and ParticleSet::update().

33 {
35 
36  using Real = QMCTraits::RealType;
38 
39 
40  const SimulationCell sim_cell;
41  ParticleSet elec(sim_cell);
42  elec.setName("e");
43  ParticleSet ions(sim_cell);
44  ions.setName("ion0");
45  ions.create({1});
46  SpeciesSet& source_species(ions.getSpeciesSet());
47  source_species.addSpecies("C");
48  ions.update();
49 
50 
51  // Radial basis: Numerical (Transform to grid) Angular part: Cartesian
52  auto wf_xml_num_cart = R"(
53  <tmp>
54  <basisset keyword="STO" transform="yes">
55  <atomicBasisSet angular="cartesian" elementType="C" normalized="no" type="STO">
56  <basisGroup l="0" m="0" n="0" rid="1S1" type="Slater">
57  <radfunc contraction="1.0" exponent="11.4" n="1"/>
58  </basisGroup>
59  </atomicBasisSet>
60  </basisset>
61  </tmp>
62  )";
63 
65  bool okay = doc.parseFromString(wf_xml_num_cart);
66  REQUIRE(okay);
67 
69  LCAOrbitalBuilder lcaob_num_cart(elec, ions, c, doc.getRoot());
70  const auto& bs = lcaob_num_cart.getBasissetMap().at("LCAOBSet");
71  CHECK(dynamic_cast<
72  SoaLocalizedBasisSet<SoaAtomicBasisSet<MultiQuinticSpline1D<Real>, SoaCartesianTensor<Real>>, ValueType>*>(
73  bs.get()) != nullptr);
74 
75 
76  // Radial basis: Numerical (Transform to grid) Angular part: Spherical
77  auto wf_xml_num_sph = R"(
78  <tmp>
79  <basisset keyword="STO" transform="yes">
80  <atomicBasisSet angular="spherical" elementType="C" normalized="no" type="STO">
81  <basisGroup l="0" m="0" n="0" rid="1S1" type="Slater">
82  <radfunc contraction="1.0" exponent="11.4" n="1"/>
83  </basisGroup>
84  </atomicBasisSet>
85  </basisset>
86  </tmp>
87  )";
88 
89  okay = doc.parseFromString(wf_xml_num_sph);
90  REQUIRE(okay);
91 
92  LCAOrbitalBuilder lcaob_num_sph(elec, ions, c, doc.getRoot());
93  const auto& bs2 = lcaob_num_sph.getBasissetMap().at("LCAOBSet");
94  CHECK(dynamic_cast<
95  SoaLocalizedBasisSet<SoaAtomicBasisSet<MultiQuinticSpline1D<Real>, SoaSphericalTensor<Real>>, ValueType>*>(
96  bs2.get()) != nullptr);
97 
98 
99  // Radial basis: GTO Angular part: Cartesian
100  auto wf_xml_gto_cart = R"(
101  <tmp>
102  <basisset keyword="GTO" name="LCAOBSet">
103  <atomicBasisSet angular="cartesian" elementType="C" name="Gaussian-G2" normalized="no" type="Gaussian">
104  <grid npts="1001" rf="1.e2" ri="1.e-6" type="log" />
105  <basisGroup l="0" n="0" rid="H00" type="Gaussian">
106  <radfunc contraction="0.002006000801" exponent="82.64" />
107  <radfunc contraction="0.01534300612" exponent="12.41" />
108  </basisGroup>
109  </atomicBasisSet>
110  </basisset>
111  </tmp>
112  )";
113 
114  okay = doc.parseFromString(wf_xml_gto_cart);
115  REQUIRE(okay);
116 
117  LCAOrbitalBuilder lcaob_gto_cart(elec, ions, c, doc.getRoot());
118  const auto& bs3 = lcaob_gto_cart.getBasissetMap().at("LCAOBSet");
119  CHECK(dynamic_cast<SoaLocalizedBasisSet<
120  SoaAtomicBasisSet<MultiFunctorAdapter<GaussianCombo<Real>>, SoaCartesianTensor<Real>>, ValueType>*>(
121  bs3.get()) != nullptr);
122 
123 
124  // Radial basis: GTO Angular part: Spherical
125  auto wf_xml_gto_sph = R"(
126  <tmp>
127  <basisset keyword="GTO" name="LCAOBSet">
128  <atomicBasisSet angular="spherical" elementType="C" name="Gaussian-G2" normalized="no" type="Gaussian">
129  <grid npts="1001" rf="1.e2" ri="1.e-6" type="log" />
130  <basisGroup l="0" n="0" rid="H00" type="Gaussian">
131  <radfunc contraction="0.002006000801" exponent="82.64" />
132  <radfunc contraction="0.01534300612" exponent="12.41" />
133  </basisGroup>
134  </atomicBasisSet>
135  </basisset>
136  </tmp>
137  )";
138 
139  okay = doc.parseFromString(wf_xml_gto_sph);
140  REQUIRE(okay);
141 
142  LCAOrbitalBuilder lcaob_gto_sph(elec, ions, c, doc.getRoot());
143  const auto& bs4 = lcaob_gto_sph.getBasissetMap().at("LCAOBSet");
144  CHECK(dynamic_cast<SoaLocalizedBasisSet<
145  SoaAtomicBasisSet<MultiFunctorAdapter<GaussianCombo<Real>>, SoaSphericalTensor<Real>>, ValueType>*>(
146  bs4.get()) != nullptr);
147 
148 
149  // Radial basis: STO Angular part: Cartesian
150  auto wf_xml_sto_cart = R"(
151  <tmp>
152  <basisset keyword="STO" transform="no">
153  <atomicBasisSet angular="cartesian" elementType="C" normalized="no" type="STO">
154  <basisGroup l="0" m="0" n="0" rid="1S1" type="Slater">
155  <radfunc contraction="1.0" exponent="11.4" n="1"/>
156  </basisGroup>
157  </atomicBasisSet>
158  </basisset>
159  </tmp>
160  )";
161 
162  okay = doc.parseFromString(wf_xml_sto_cart);
163  REQUIRE(okay);
164 
165  LCAOrbitalBuilder lcaob_sto_cart(elec, ions, c, doc.getRoot());
166  const auto& bs5 = lcaob_sto_cart.getBasissetMap().at("LCAOBSet");
167  CHECK(dynamic_cast<SoaLocalizedBasisSet<
168  SoaAtomicBasisSet<MultiFunctorAdapter<SlaterCombo<Real>>, SoaCartesianTensor<Real>>, ValueType>*>(
169  bs5.get()) != nullptr);
170 
171 
172  // Radial basis: STO Angular part: Spherical
173  auto wf_xml_sto_sph = R"(
174  <tmp>
175  <basisset keyword="STO" transform="no">
176  <atomicBasisSet angular="spherical" elementType="C" normalized="no" type="STO">
177  <basisGroup l="0" m="0" n="0" rid="1S1" type="Slater">
178  <radfunc contraction="1.0" exponent="11.4" n="1"/>
179  </basisGroup>
180  </atomicBasisSet>
181  </basisset>
182  </tmp>
183  )";
184 
185  okay = doc.parseFromString(wf_xml_sto_sph);
186  REQUIRE(okay);
187 
188  LCAOrbitalBuilder lcaob_sto_sph(elec, ions, c, doc.getRoot());
189  const auto& bs6 = lcaob_sto_sph.getBasissetMap().at("LCAOBSet");
190  CHECK(dynamic_cast<SoaLocalizedBasisSet<
191  SoaAtomicBasisSet<MultiFunctorAdapter<SlaterCombo<Real>>, SoaSphericalTensor<Real>>, ValueType>*>(
192  bs6.get()) != nullptr);
193 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
ForceBase::Real Real
Definition: ForceBase.cpp:26
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
QMCTraits::RealType RealType
LCAOrbitalSet::basis_type BasisSet_t
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [121/537]

qmcplusplus::TEST_CASE ( "Spline applyRotation zero rotation"  ,
""  [wavefunction] 
)

Definition at line 32 of file test_spline_applyrotation.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), CHECK(), CHECKED_ELSE(), checkMatrix(), OHMMS::Controller, ParticleSet::create(), EinsplineSetBuilder::createSPOSetFromXML(), doc, qmcplusplus::Units::charge::e, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), lattice, norm(), okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), Vector< T, Alloc >::size(), and sqrt().

33 {
34  // How to get rid of all this annoying boilerplate?
36 
37  // diamondC_1x1x1
38  ParticleSet::ParticleLayout lattice;
39  lattice.R = {3.37316115, 3.37316115, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
40 
41  ParticleSetPool ptcl = ParticleSetPool(c);
42  ptcl.setSimulationCell(lattice);
43  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
44  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
45  ParticleSet& ions_(*ions_uptr);
46  ParticleSet& elec_(*elec_uptr);
47 
48  ions_.setName("ion");
49  ptcl.addParticleSet(std::move(ions_uptr));
50  ions_.create({2});
51  ions_.R[0] = {0.0, 0.0, 0.0};
52  ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
53 
54  elec_.setName("elec");
55  ptcl.addParticleSet(std::move(elec_uptr));
56  elec_.create({2});
57  elec_.R[0] = {0.0, 0.0, 0.0};
58  elec_.R[1] = {0.0, 1.0, 0.0};
59 
60  SpeciesSet& tspecies = elec_.getSpeciesSet();
61  int upIdx = tspecies.addSpecies("u");
62  int chargeIdx = tspecies.addAttribute("charge");
63  tspecies(chargeIdx, upIdx) = -1;
64 
65  // Load diamondC_1x1x1 wfn and explicitly construct a SplineC2C object with 7 orbitals
66  // This results in padding of the spline coefs table and thus is a more stringent test.
67  const char* particles = R"(<tmp>
68 <determinantset type="einspline" href="diamondC_1x1x1.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion" gpu="no" precision="double" size="7"/>
69 </tmp>)";
70 
72  bool okay = doc.parseFromString(particles);
73  REQUIRE(okay);
74  xmlNodePtr root = doc.getRoot();
75  xmlNodePtr ein1 = xmlFirstElementChild(root);
76  EinsplineSetBuilder einSet(elec_, ptcl.getPool(), c, ein1);
77  auto spo = einSet.createSPOSetFromXML(ein1);
78  REQUIRE(spo);
79 
80  const auto orbitalsetsize = spo->getOrbitalSetSize();
81  REQUIRE(orbitalsetsize == 7);
82  SPOSet::ValueMatrix psiM_bare(elec_.R.size(), orbitalsetsize);
83  SPOSet::GradMatrix dpsiM_bare(elec_.R.size(), orbitalsetsize);
84  SPOSet::ValueMatrix d2psiM_bare(elec_.R.size(), orbitalsetsize);
85  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM_bare, dpsiM_bare, d2psiM_bare);
86 
87  // Check before rotation is applied. From 'test_einset.cpp'
88  CHECK(std::real(psiM_bare[1][0]) == Approx(-0.8886948824));
89  CHECK(std::real(psiM_bare[1][1]) == Approx(1.4194120169));
90  // grad
91  CHECK(std::real(dpsiM_bare[1][0][0]) == Approx(-0.0000183403));
92  CHECK(std::real(dpsiM_bare[1][0][1]) == Approx(0.1655139178));
93  CHECK(std::real(dpsiM_bare[1][0][2]) == Approx(-0.0000193077));
94  CHECK(std::real(dpsiM_bare[1][1][0]) == Approx(-1.3131694794));
95  CHECK(std::real(dpsiM_bare[1][1][1]) == Approx(-1.1174004078));
96  CHECK(std::real(dpsiM_bare[1][1][2]) == Approx(-0.8462534547));
97  // lapl
98  CHECK(std::real(d2psiM_bare[1][0]) == Approx(1.3313053846));
99  CHECK(std::real(d2psiM_bare[1][1]) == Approx(-4.712583065));
100 
101  // zero rotation = identity matrix
102  SPOSet::ValueMatrix rot_mat(orbitalsetsize, orbitalsetsize);
103  rot_mat = 0;
104  for (int i = 0; i < orbitalsetsize; i++)
105  rot_mat[i][i] = 1;
106 
107  spo->storeParamsBeforeRotation(); // avoids coefs_copy_ nullptr segfault
108  spo->applyRotation(rot_mat, false);
109 
110  // Get the data for rotated orbitals
111  SPOSet::ValueMatrix psiM_rot(elec_.R.size(), orbitalsetsize);
112  SPOSet::GradMatrix dpsiM_rot(elec_.R.size(), orbitalsetsize);
113  SPOSet::ValueMatrix d2psiM_rot(elec_.R.size(), orbitalsetsize);
114  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM_rot, dpsiM_rot, d2psiM_rot);
115 
116  // Compute the expected value, gradient, and laplacian by hand using the transformation above
117  // Check value
118  SPOSet::ValueMatrix psiM_rot_manual(elec_.R.size(), orbitalsetsize);
119  for (int i = 0; i < elec_.R.size(); i++)
120  for (int j = 0; j < orbitalsetsize; j++)
121  {
122  psiM_rot_manual[i][j] = 0.;
123  for (int k = 0; k < orbitalsetsize; k++)
124  psiM_rot_manual[i][j] += psiM_bare[i][k] * rot_mat[k][j];
125  }
126  auto check = checkMatrix(psiM_rot_manual, psiM_rot, true);
127  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
128 
129  // Check grad
130  SPOSet::GradMatrix dpsiM_rot_manual(elec_.R.size(), orbitalsetsize);
131  for (int i = 0; i < elec_.R.size(); i++)
132  for (int j = 0; j < orbitalsetsize; j++)
133  {
134  dpsiM_rot_manual[i][j][0] = 0.;
135  dpsiM_rot_manual[i][j][1] = 0.;
136  dpsiM_rot_manual[i][j][2] = 0.;
137  for (int k = 0; k < orbitalsetsize; k++)
138  for (int l = 0; l < 3; l++)
139  dpsiM_rot_manual[i][j][l] += dpsiM_bare[i][k][l] * rot_mat[k][j];
140  }
141 
142  // No checkMatrix for tensors? Gotta do it by hand...
143  double res = 0.;
144  for (int i = 0; i < elec_.R.size(); i++)
145  for (int j = 0; j < orbitalsetsize; j++)
146  for (int k = 0; k < 3; k++)
147  res += std::sqrt(std::norm(dpsiM_rot_manual[i][j][k] - dpsiM_rot[i][j][k]));
148 
149  CHECK(res == Approx(0.).epsilon(2e-4)); // increase threshold to accomodate mixed precision.
150 
151  // Check laplacian
152  SPOSet::ValueMatrix d2psiM_rot_manual(elec_.R.size(), orbitalsetsize);
153  for (int i = 0; i < elec_.R.size(); i++)
154  for (int j = 0; j < orbitalsetsize; j++)
155  {
156  d2psiM_rot_manual[i][j] = 0.;
157  for (int k = 0; k < orbitalsetsize; k++)
158  d2psiM_rot_manual[i][j] += d2psiM_bare[i][k] * rot_mat[k][j];
159  }
160 
161  check = checkMatrix(d2psiM_rot_manual, d2psiM_rot, true, 2e-4);
162  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
163 
164 } // TEST_CASE
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
CHECKED_ELSE(check_matrix_result.result)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
double norm(const zVec &c)
Definition: VectorOps.h:118
REQUIRE(std::filesystem::exists(filename))
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [122/537]

qmcplusplus::TEST_CASE ( "SoA Cartesian Tensor ,
""  [numerics] 
)

Definition at line 32 of file test_soa_cartesian_tensor.cpp.

References CHECK(), SoaCartesianTensor< T >::evaluateV(), and SoaCartesianTensor< T >::getcXYZ().

33 {
34  SoaCartesianTensor<double> ct(6);
35 
36  double x = 1.3;
37  double y = 1.2;
38  double z = -0.5;
39  ct.evaluateV(x, y, z);
40 
41  const double* XYZ = ct.getcXYZ().data(0);
42 
43  CHECK(XYZ[0] == Approx(0.282094791774));
44  CHECK(XYZ[1] == Approx(0.635183265474));
45  CHECK(XYZ[2] == Approx(0.586323014284));
46  CHECK(XYZ[3] == Approx(-0.244301255951));
47  CHECK(XYZ[4] == Approx(1.06602349055));
48  CHECK(XYZ[5] == Approx(0.908327707927));
49  CHECK(XYZ[6] == Approx(0.157695782626));
50  CHECK(XYZ[7] == Approx(1.70437555172));
51  CHECK(XYZ[8] == Approx(-0.710156479885));
52  CHECK(XYZ[9] == Approx(-0.655529058355));
53  CHECK(XYZ[10] == Approx(1.6397368054));
54  CHECK(XYZ[11] == Approx(1.28969740543));
55  CHECK(XYZ[12] == Approx(-0.0932940831475));
56  CHECK(XYZ[13] == Approx(3.38451965731));
57  CHECK(XYZ[14] == Approx(-1.41021652388));
58  CHECK(XYZ[15] == Approx(3.12417199136));
59  CHECK(XYZ[16] == Approx(-1.20160461206));
60  CHECK(XYZ[17] == Approx(0.542390970723));
61  CHECK(XYZ[18] == Approx(0.500668588359));
62  CHECK(XYZ[19] == Approx(-2.25467692526));
63  CHECK(XYZ[20] == Approx(2.41707280436));
64  CHECK(XYZ[21] == Approx(1.75485528067));
65  CHECK(XYZ[22] == Approx(0.0528927734576));
66  CHECK(XYZ[23] == Approx(5.90305249944));
67  CHECK(XYZ[24] == Approx(-2.4596052081));
68  CHECK(XYZ[25] == Approx(5.02981988118));
69  CHECK(XYZ[26] == Approx(-1.93454610815));
70  CHECK(XYZ[27] == Approx(-0.363846924275));
71  CHECK(XYZ[28] == Approx(-0.335858699331));
72  CHECK(XYZ[29] == Approx(7.03459200681));
73  CHECK(XYZ[30] == Approx(1.22128333452));
74  CHECK(XYZ[31] == Approx(1.04062011935));
75  CHECK(XYZ[32] == Approx(-5.07677948596));
76  CHECK(XYZ[33] == Approx(-4.68625798704));
77  CHECK(XYZ[34] == Approx(1.9526074946));
78  CHECK(XYZ[35] == Approx(3.47382688598));
79  CHECK(XYZ[36] == Approx(2.32807861094));
80  CHECK(XYZ[37] == Approx(-0.0292375806134));
81  CHECK(XYZ[38] == Approx(9.61982829963));
82  CHECK(XYZ[39] == Approx(-4.00826179151));
83  CHECK(XYZ[40] == Approx(7.56625548555));
84  CHECK(XYZ[41] == Approx(-2.91009826367));
85  CHECK(XYZ[42] == Approx(0.228053128784));
86  CHECK(XYZ[43] == Approx(0.210510580416));
87  CHECK(XYZ[44] == Approx(13.5641819555));
88  CHECK(XYZ[45] == Approx(2.35489270061));
89  CHECK(XYZ[46] == Approx(12.5207833436));
90  CHECK(XYZ[47] == Approx(1.85218688514));
91  CHECK(XYZ[48] == Approx(-0.905727961775));
92  CHECK(XYZ[49] == Approx(-0.771744535477));
93  CHECK(XYZ[50] == Approx(-9.78910512921));
94  CHECK(XYZ[51] == Approx(-8.34101265448));
95  CHECK(XYZ[52] == Approx(-1.44809247474));
96  CHECK(XYZ[53] == Approx(-11.6655511199));
97  CHECK(XYZ[54] == Approx(4.86064629996));
98  CHECK(XYZ[55] == Approx(4.48675043074));
99  CHECK(XYZ[56] == Approx(4.90938236205));
100  CHECK(XYZ[57] == Approx(3.03706593382));
101  CHECK(XYZ[58] == Approx(0.0158923005669));
102  CHECK(XYZ[59] == Approx(15.0300731514));
103  CHECK(XYZ[60] == Approx(-6.26253047974));
104  CHECK(XYZ[61] == Approx(10.9122088466));
105  CHECK(XYZ[62] == Approx(-4.19700340252));
106  CHECK(XYZ[63] == Approx(-0.137042874894));
107  CHECK(XYZ[64] == Approx(-0.126501115286));
108  CHECK(XYZ[65] == Approx(24.0303233904));
109  CHECK(XYZ[66] == Approx(4.17193114417));
110  CHECK(XYZ[67] == Approx(20.4755418238));
111  CHECK(XYZ[68] == Approx(3.0289263053));
112  CHECK(XYZ[69] == Approx(0.61714957754));
113  CHECK(XYZ[70] == Approx(0.525855261336));
114  CHECK(XYZ[71] == Approx(-17.3423920977));
115  CHECK(XYZ[72] == Approx(-13.6402610582));
116  CHECK(XYZ[73] == Approx(0.986708699234));
117  CHECK(XYZ[74] == Approx(26.2459034569));
118  CHECK(XYZ[75] == Approx(-1.89857519219));
119  CHECK(XYZ[76] == Approx(-1.49328080661));
120  CHECK(XYZ[77] == Approx(-24.4531767752));
121  CHECK(XYZ[78] == Approx(10.1888236563));
122  CHECK(XYZ[79] == Approx(-22.5721631771));
123  CHECK(XYZ[80] == Approx(8.68160122197));
124  CHECK(XYZ[81] == Approx(-3.91877832936));
125  CHECK(XYZ[82] == Approx(-3.61733384249));
126  CHECK(XYZ[83] == Approx(12.1418905657));
127 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [123/537]

qmcplusplus::TEST_CASE ( "EstimatorManagerCrowd::EstimatorManagerCrowd"  ,
""  [estimators] 
)

Definition at line 32 of file test_EstimatorManagerCrowd.cpp.

References ProjectData::BATCH, CHECK(), comm, OHMMS::Controller, qmcplusplus::testing::createEstimatorManagerNewInputXML(), emi(), emn, estimators_doc, EstimatorManagerNew::getNumEstimators(), EstimatorManagerNew::getNumScalarEstimators(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), ham, hamiltonian_pool, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), MinimalHamiltonianPool::make_hamWithEE(), particle_pool, pset, test_project, twf, and wavefunction_pool.

33 {
34  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
36 
37  using namespace testing;
39  EstimatorManagerInput emi(estimators_doc.getRoot());
40 
41 
42  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
43  auto wavefunction_pool =
44  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
45  auto& pset = *(particle_pool.getParticleSet("e"));
46  auto hamiltonian_pool = MinimalHamiltonianPool::make_hamWithEE(comm, particle_pool, wavefunction_pool);
47  auto& twf = *(wavefunction_pool.getWaveFunction("wavefunction"));
48  auto& ham = *(hamiltonian_pool.getPrimary());
49 
50  EstimatorManagerNew emn(comm, std::move(emi), ham, pset, twf);
51 
52  CHECK(emn.getNumEstimators() == 2);
54 
55  EstimatorManagerCrowd emc(emn);
56 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
Libxml2Document createEstimatorManagerNewInputXML()
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
EstimatorManagerInput emi(estimators_doc.getRoot())
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
Libxml2Document estimators_doc
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
EstimatorManagerNew emn(comm, std::move(emi), ham, pset, twf)

◆ TEST_CASE() [124/537]

qmcplusplus::TEST_CASE ( "isnan"  ,
""  [numerics] 
)

Definition at line 32 of file test_math.cpp.

33 {
34  test_isnan<float>();
35  test_isnan<double>();
36 }

◆ TEST_CASE() [125/537]

qmcplusplus::TEST_CASE ( "TraceManager"  ,
""  [estimators] 
)

Definition at line 32 of file test_trace_manager.cpp.

References TraceManager::checkout_int(), TraceRequest::contribute_scalar(), OHMMS::Controller, TraceRequest::determine_stream_write(), TraceRequest::incorporate(), TraceManager::put(), TraceManager::request, TraceRequest::streaming_scalar(), and TraceManager::update_status().

33 {
35 
36  TraceManager tm(c);
37 
38  tm.put(NULL, true, "test");
39 
40  TraceRequest req1;
41  req1.contribute_scalar("scalar1", true);
42  req1.streaming_scalar("scalar1");
43 
44  tm.request.incorporate(req1);
45 
46  tm.request.determine_stream_write();
47 
48  auto int_sample = std::unique_ptr<Array<TraceInt, 1>>{tm.checkout_int<1>("scalar1")};
49  (*int_sample)(0) = 2;
50 
51  tm.update_status();
52 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68

◆ TEST_CASE() [126/537]

qmcplusplus::TEST_CASE ( "StdRandom save and load"  ,
""  [utilities] 
)

Definition at line 33 of file test_StdRandom.cpp.

References CHECK(), and StdRandom< T >::init().

34 {
35  using DoubleRNG = StdRandom<double>;
36  DoubleRNG rng;
37 
38  rng.init(111);
39 
40  std::vector<double> rng_doubles(100,0.0);
41  for(auto& elem : rng_doubles)
42  elem = rng();
43 
44  std::vector<DoubleRNG::uint_type> state;
45 
46  rng.save(state);
47 
48  CHECK(state.size() == rng.state_size());
49 
50  DoubleRNG rng2;
51  rng2.init(110);
52  rng2.load(state);
53 
54  CHECK(rng2() == rng());
55 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [127/537]

qmcplusplus::TEST_CASE ( "Pade functor"  ,
""  [wavefunction] 
)

Definition at line 33 of file test_pade_jastrow.cpp.

References qmcplusplus::Units::distance::A, B(), PadeFunctor< T >::B0, CHECK(), PadeFunctor< T >::evaluate(), and PadeFunctor< T >::setCusp().

34 {
35  double A = -0.25;
36  double B = 0.1;
37  PadeFunctor<double> pf("test_functor");
38  pf.B0 = B;
39  pf.setCusp(A);
40 
41  double r = 1.2;
42  double u = pf.evaluate(r);
43  CHECK(u == Approx(2.232142857142857));
44 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
double B(double x, int k, int i, const std::vector< double > &t)

◆ TEST_CASE() [128/537]

qmcplusplus::TEST_CASE ( "ParallelExecutor<STD> lambda case"  ,
""  [concurrency] 
)

Definition at line 33 of file test_ParallelExecutorSTD.cpp.

References REQUIRE().

34 {
35  int num_threads = 8;
36  ParallelExecutor<Executor::STD_THREADS> test_block;
37  std::atomic<int> count(0);
38  test_block(
39  num_threads, [](int id, std::atomic<int>& my_count) { ++my_count; }, std::ref(count));
40  REQUIRE(count == 8);
41 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [129/537]

qmcplusplus::TEST_CASE ( "HamiltonianPool"  ,
""  [qmcapp] 
)

Definition at line 33 of file test_hamiltonian_pool.cpp.

References WaveFunctionPool::addFactory(), ParticleSetPool::addParticleSet(), WaveFunctionFactory::buildEmptyTWFForTesting(), OHMMS::Controller, createElectronParticleSet(), doc, HamiltonianPool::empty(), HamiltonianPool::getHamiltonian(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), okay, Libxml2Document::parseFromString(), HamiltonianPool::put(), REQUIRE(), and QMCHamiltonian::size().

34 {
35  Communicate* c;
37 
38  // See src/QMCHamiltonians/tests/test_hamiltonian_factory for parsing tests
39  const char* hamiltonian_xml = R"(<hamiltonian name="h0" type="generic" target="e">
40  <pairpot type="coulomb" name="ElecElec" source="e" target="e"/>
41 </hamiltonian>)";
42 
44  bool okay = doc.parseFromString(hamiltonian_xml);
45  REQUIRE(okay);
46 
47  xmlNodePtr root = doc.getRoot();
48 
49  ParticleSetPool pp(c);
50  auto qp = createElectronParticleSet(pp.getSimulationCell());
51  pp.addParticleSet(std::move(qp));
52 
53  RuntimeOptions runtime_options;
54  WaveFunctionPool wfp(runtime_options, pp, c);
55  wfp.addFactory(WaveFunctionFactory::buildEmptyTWFForTesting(runtime_options, "psi0"), true);
56 
57  HamiltonianPool hpool(pp, wfp, c);
58 
59  REQUIRE(hpool.empty());
60 
61  hpool.put(root);
62 
63  QMCHamiltonian* h = hpool.getHamiltonian("h0");
64  REQUIRE(h != nullptr);
65 
66  // Bare kinetic energy is always added
67  REQUIRE(h->size() == 2);
68 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
std::unique_ptr< ParticleSet > createElectronParticleSet(const SimulationCell &simulation_cell)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [130/537]

qmcplusplus::TEST_CASE ( "pack scalar ,
""  [utilities] 
)

Definition at line 33 of file test_pooled_memory.cpp.

References PooledMemory< T_scalar, Alloc >::add(), PooledMemory< T_scalar, Alloc >::allocate(), PooledData< T >::byteSize(), PooledMemory< T_scalar, Alloc >::byteSize(), PooledMemory< T_scalar, Alloc >::Current, PooledMemory< T_scalar, Alloc >::current(), PooledMemory< T_scalar, Alloc >::data(), Timer::elapsed(), PooledMemory< T_scalar, Alloc >::get(), PooledMemory< T_scalar, Alloc >::put(), REQUIRE(), PooledData< T >::resize(), Timer::restart(), and PooledMemory< T_scalar, Alloc >::rewind().

34 {
35  PooledMemory<double> p;
36  int i0 = 1;
37  long i1 = (1L << 30) + (1L << 29);
38  float i2 = 0.33;
39  double i3 = 0.23;
40  complex<float> i4(0.23, 0.33);
41  complex<double> i5(0.33, 0.23);
42  std::vector<complex<double>> i6_dummy(3);
43  std::vector<complex<double>> i6(3);
44  i6[0] = complex<double>(0.23, 0.33);
45  i6[1] = complex<double>(0.33, 0.23);
46  i6[2] = complex<double>(0.56, 0.65);
47 
48  p.add(i0);
49  p.add(i1);
50  p.add(i2);
51  p.add(i3);
52  p.add(i4);
53  p.add(i5);
54  p.add(i6_dummy.data(), i6_dummy.data() + i6_dummy.size());
55  p.add(i6.data(), i6.data() + i6.size());
56 
57  p.allocate();
58  p.rewind();
59 
60  p << i0;
61  p << i1;
62  p << i2;
63  p << i3;
64  p << i4;
65  p << i5;
66  p.put(i6_dummy.data(), i6_dummy.data() + i6_dummy.size());
67  p.put(i6.data(), i6.data() + i6.size());
68 
69  p.rewind();
70  int j0 = i0;
71  i0 = 0;
72  long j1 = i1;
73  i1 = 0;
74  float j2 = i2;
75  i2 = 0;
76  double j3 = i3;
77  i3 = 0;
78  complex<float> j4 = i4;
79  i4 = 0;
80  complex<double> j5 = i5;
81  i5 = 0;
82  std::vector<complex<double>> j6(i6);
83  i6[0] = 0;
84  i6[1] = 0;
85  i6[2] = 0;
86  p >> i0;
87  p >> i1;
88  p >> i2;
89  p >> i3;
90  p >> i4;
91  p >> i5;
92 
93  p.get(i6_dummy.data(), i6_dummy.data() + i6_dummy.size());
94  bool not_aligned = (((size_t)p.data()) + p.current()) & (QMC_SIMD_ALIGNMENT - 1);
95  REQUIRE(!not_aligned);
96 
97  p.get(i6.data(), i6.data() + i6.size());
98 
99  REQUIRE(i0 == j0);
100  REQUIRE(i1 == j1);
101  REQUIRE(i2 == j2);
102  REQUIRE(i3 == j3);
103  REQUIRE(i4 == j4);
104  REQUIRE(i5 == j5);
105  REQUIRE(i6[0] == i6[0]);
106  REQUIRE(i6[1] == i6[1]);
107  REQUIRE(i6[2] == i6[2]);
108 
109 #ifdef CHECK_ALLOCATION_PERF
110  // up to 512 MB.
111  for (size_t size_scale = 15; size_scale < 30; size_scale++)
112  {
113  const size_t size = (1 << size_scale) + 17 * 8;
114  {
115  PooledMemory<double> pm_walker;
116  pm_walker.Current = size;
117  Timer PoolTimer;
118  pm_walker.allocate();
119  std::cout << "PooledMemory Allocate " << pm_walker.byteSize() << " bytes Time " << PoolTimer.elapsed()
120  << std::endl;
121  PoolTimer.restart();
122  PooledMemory<double> pm_walker_copy(pm_walker);
123  std::cout << "PooledMemory Copy Time " << PoolTimer.elapsed() << std::endl;
124  }
125 
126  {
127  PooledData<double> pd_walker;
128  Timer PoolTimer;
129  pd_walker.resize(size / 8);
130  std::cout << "PooledData Allocate " << pd_walker.byteSize() << " bytes Time " << PoolTimer.elapsed() << std::endl;
131  PoolTimer.restart();
132  PooledData<double> pd_walker_copy(pd_walker);
133  std::cout << "PooledData Copy Time " << PoolTimer.elapsed() << std::endl;
134  }
135 
136  std::cout << std::endl;
137  }
138 #endif
139 }
REQUIRE(std::filesystem::exists(filename))
void resize(size_type n, T val=T())
resize
Definition: PooledData.h:77
size_type byteSize() const
return the size of the data
Definition: PooledData.h:45

◆ TEST_CASE() [131/537]

qmcplusplus::TEST_CASE ( "Chiesa Force BCC H Ewald3D"  ,
""  [hamiltonian] 
)

Definition at line 33 of file test_force_ewald.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), OHMMS::Controller, LRCoulombSingleton::CoulombDerivHandler, LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), ForceChiesaPBCAA::evaluate(), ForceBase::getForces(), ForceBase::getForcesIonIon(), ParticleSet::getSpeciesSet(), ForceChiesaPBCAA::InitMatrix(), lattice, ParticleSet::R, ParticleSet::resetGroups(), ForceBase::setAddIonIon(), ParticleSet::setName(), and ParticleSet::update().

34 {
36 
37  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
38  lattice.BoxBConds = true; // periodic
39  lattice.R.diagonal(3.77945227);
40  lattice.LR_dim_cutoff = 40;
41  lattice.reset();
42 
43  const SimulationCell simulation_cell(lattice);
44  ParticleSet ions(simulation_cell);
45  ParticleSet elec(simulation_cell);
46 
47  ions.setName("ion");
48  ions.create({2});
49  ions.R[0] = {0.0, 0.0, 0.0};
50  ions.R[1] = {1.6, 1.6, 1.88972614};
51  SpeciesSet& ion_species = ions.getSpeciesSet();
52  int pIdx = ion_species.addSpecies("H");
53  int pChargeIdx = ion_species.addAttribute("charge");
54  ion_species(pChargeIdx, pIdx) = 1;
55  ions.createSK();
56 
57 
58  elec.setName("elec");
59  elec.create({2});
60  elec.R[0] = {0.5, 0.0, 0.0};
61  elec.R[1] = {0.0, 0.5, 0.0};
62  SpeciesSet& tspecies = elec.getSpeciesSet();
63  int upIdx = tspecies.addSpecies("u");
64  int chargeIdx = tspecies.addAttribute("charge");
65  int massIdx = tspecies.addAttribute("mass");
66  tspecies(chargeIdx, upIdx) = -1;
67  tspecies(massIdx, upIdx) = 1.0;
68 
69  elec.createSK();
70 
71  ParticleSetPool ptcl = ParticleSetPool(c);
72 
73  ions.resetGroups();
74 
75  // The call to resetGroups is needed transfer the SpeciesSet
76  // settings to the ParticleSet
77  elec.resetGroups();
78 
79  LRCoulombSingleton::CoulombHandler = std::make_unique<EwaldHandler3D>(ions);
80  LRCoulombSingleton::CoulombHandler->initBreakup(ions);
81  LRCoulombSingleton::CoulombDerivHandler = std::make_unique<EwaldHandler3D>(ions);
82  LRCoulombSingleton::CoulombDerivHandler->initBreakup(ions);
83 
84  ForceChiesaPBCAA force(ions, elec);
85  force.setAddIonIon(false);
86  force.InitMatrix();
87 
88  elec.update();
89  force.evaluate(elec);
90 
91  //Ion-Ion forces are validated against Quantum Espresso's ewald method:
92  CHECK(force.getForcesIonIon()[0][0] == Approx(-0.0228366));
93  CHECK(force.getForcesIonIon()[0][1] == Approx(-0.0228366));
94  CHECK(force.getForcesIonIon()[0][2] == Approx(0.0000000));
95  CHECK(force.getForcesIonIon()[1][0] == Approx(0.0228366));
96  CHECK(force.getForcesIonIon()[1][1] == Approx(0.0228366));
97  CHECK(force.getForcesIonIon()[1][2] == Approx(0.0000000));
98 
99  //Electron-Ion forces are unvalidated externally:
100  CHECK(force.getForces()[0][0] == Approx(3.959178977));
101  CHECK(force.getForces()[0][1] == Approx(3.959178977));
102  CHECK(force.getForces()[0][2] == Approx(0.000000000));
103  CHECK(force.getForces()[1][0] == Approx(-0.078308730));
104  CHECK(force.getForces()[1][1] == Approx(-0.078308730));
105  CHECK(force.getForces()[1][2] == Approx(0.000000000));
106 
107  LRCoulombSingleton::CoulombHandler.reset(nullptr);
108  LRCoulombSingleton::CoulombDerivHandler.reset(nullptr);
109 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [132/537]

qmcplusplus::TEST_CASE ( "Einspline SPO from HDF NiO a16 97 electrons"  ,
""  [wavefunction] 
)

Definition at line 33 of file test_einset_NiO_a16.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), app_log(), CHECK(), OHMMS::Controller, ParticleSet::create(), ParticleSet::createResource(), EinsplineSetBuilder::createSPOSetFromXML(), Vector< T, Alloc >::device_data(), QMCTraits::DIM_VGL, doc, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), imag(), ispecies, Lattice, lattice, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), Array< T, D, ALLOC >::resize(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), Vector< T, Alloc >::size(), and Vector< T, Alloc >::updateTo().

34 {
36 
37  ParticleSet::ParticleLayout lattice;
38  lattice.R = {3.94055, 3.94055, 7.8811, 3.94055, 3.94055, -7.8811, -7.8811, 7.8811, 0};
39 
40  ParticleSetPool ptcl = ParticleSetPool(c);
41  ptcl.setSimulationCell(lattice);
42  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
43  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
44  ParticleSet& ions_(*ions_uptr);
45  ParticleSet& elec_(*elec_uptr);
46 
47  ions_.setName("ion");
48  ptcl.addParticleSet(std::move(ions_uptr));
49  ions_.create({8, 8});
50  ions_.R[0] = {0.75, 0.25, 0};
51  ions_.R[1] = {0.75, 0.25, 0.5};
52  ions_.R[2] = {0.75, 0.75, 0.25};
53  ions_.R[3] = {0.75, 0.75, 0.75};
54  ions_.R[4] = {0.25, 0.75, 0};
55  ions_.R[5] = {0.25, 0.25, 0.25};
56  ions_.R[6] = {0.25, 0.75, 0.5};
57  ions_.R[7] = {0.25, 0.25, 0.75};
58  ions_.R[8] = {0, 0, 0};
59  ions_.R[9] = {0, 0, 0.5};
60  ions_.R[10] = {0, 0.5, 0.25};
61  ions_.R[11] = {0, 0.5, 0.75};
62  ions_.R[12] = {0.5, 0.5, 0};
63  ions_.R[13] = {0.5, 0, 0.25};
64  ions_.R[14] = {0.5, 0.5, 0.5};
65  ions_.R[15] = {0.5, 0, 0.75};
66 
67  // convert to cartesian
68  ions_.R.setUnit(PosUnit::Lattice);
69  ions_.convert2Cart(ions_.R);
70 
71  // printout coordinates
72  SpeciesSet& ispecies = ions_.getSpeciesSet();
73  int Oidx = ispecies.addSpecies("O");
74  int Niidx = ispecies.addSpecies("Ni");
75  ions_.print(app_log());
76 
77  elec_.setName("elec");
78  ptcl.addParticleSet(std::move(elec_uptr));
79  elec_.create({97});
80  elec_.R[0] = {0.0, 0.0, 0.0};
81  elec_.R[1] = {0.0, 1.0, 0.0};
82  elec_.R[2] = {0.0, 1.1, 0.0};
83  elec_.R[3] = {0.0, 1.2, 0.0};
84  elec_.R[4] = {0.0, 1.3, 0.0};
85 
86  SpeciesSet& tspecies = elec_.getSpeciesSet();
87  int upIdx = tspecies.addSpecies("u");
88  int chargeIdx = tspecies.addAttribute("charge");
89  tspecies(chargeIdx, upIdx) = -1;
90 
91  //diamondC_2x1x1
92  const char* particles = R"(<tmp>
93 <determinantset type="einspline" href="NiO-fcc-supertwist111-supershift000-S4.h5" tilematrix="1 0 0 0 1 1 0 2 -2" twistnum="0" source="ion" meshfactor="1.0" precision="float" size="97" gpu="omptarget"/>
94 </tmp>
95 )";
96 
98  bool okay = doc.parseFromString(particles);
99  REQUIRE(okay);
100 
101  xmlNodePtr root = doc.getRoot();
102 
103  xmlNodePtr ein1 = xmlFirstElementChild(root);
104 
105  EinsplineSetBuilder einSet(elec_, ptcl.getPool(), c, ein1);
106  auto spo = einSet.createSPOSetFromXML(ein1);
107  REQUIRE(spo);
108 
109  // for vgl
110  SPOSet::ValueMatrix psiM(elec_.R.size(), spo->getOrbitalSetSize());
111  SPOSet::GradMatrix dpsiM(elec_.R.size(), spo->getOrbitalSetSize());
112  SPOSet::ValueMatrix d2psiM(elec_.R.size(), spo->getOrbitalSetSize());
113  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM, dpsiM, d2psiM);
114 
115 #if !defined(QMC_COMPLEX)
116  // real part
117  // due to the different ordering of bands skip the tests on CUDA+Real builds
118  // checking evaluations, reference values are not independently generated.
119  // value
120  CHECK(std::real(psiM[1][0]) == Approx(-2.6693785191));
121  CHECK(std::real(psiM[1][1]) == Approx(-2.669519186));
122  // grad
123  CHECK(std::real(dpsiM[1][0][0]) == Approx(-0.0002679008));
124  CHECK(std::real(dpsiM[1][0][1]) == Approx(7.622625351));
125  CHECK(std::real(dpsiM[1][0][2]) == Approx(-0.0003001692));
126  CHECK(std::real(dpsiM[1][1][0]) == Approx(-0.0002825252));
127  CHECK(std::real(dpsiM[1][1][1]) == Approx(7.6229834557));
128  CHECK(std::real(dpsiM[1][1][2]) == Approx(-0.0002339484));
129  // lapl
130  CHECK(std::real(d2psiM[1][0]) == Approx(-2.6130394936).epsilon(0.0001));
131  CHECK(std::real(d2psiM[1][1]) == Approx(-2.6067698002).epsilon(0.0001));
132 #endif
133 
134 #if defined(QMC_COMPLEX)
135  // imaginary part
136  // value
137  CHECK(std::imag(psiM[1][0]) == Approx(2.6693942547));
138  CHECK(std::imag(psiM[1][1]) == Approx(-2.6693785191));
139  // grad
140  CHECK(std::imag(dpsiM[1][0][0]) == Approx(-0.000179037));
141  CHECK(std::imag(dpsiM[1][0][1]) == Approx(-7.6221408844));
142  CHECK(std::imag(dpsiM[1][0][2]) == Approx(-0.0000232533));
143  CHECK(std::imag(dpsiM[1][1][0]) == Approx(-0.0002679008));
144  CHECK(std::imag(dpsiM[1][1][1]) == Approx(7.622625351));
145  CHECK(std::imag(dpsiM[1][1][2]) == Approx(-0.0003001692));
146  // lapl
147  CHECK(std::imag(d2psiM[1][0]) == Approx(2.6158618927).epsilon(0.0001));
148  CHECK(std::imag(d2psiM[1][1]) == Approx(-2.6130394936).epsilon(0.0001));
149 #endif
150 
151  // test batched interfaces
152 
153  ParticleSet elec_2(elec_);
154  // interchange positions
155  elec_2.R[0] = elec_.R[1];
156  elec_2.R[1] = elec_.R[0];
157  RefVectorWithLeader<ParticleSet> p_list(elec_);
158  p_list.push_back(elec_);
159  p_list.push_back(elec_2);
160 
161  std::unique_ptr<SPOSet> spo_2(spo->makeClone());
162  RefVectorWithLeader<SPOSet> spo_list(*spo);
163  spo_list.push_back(*spo);
164  spo_list.push_back(*spo_2);
165 
166  ResourceCollection pset_res("test_pset_res");
167  ResourceCollection spo_res("test_spo_res");
168 
169  elec_.createResource(pset_res);
170  spo->createResource(spo_res);
171 
172  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
173  ResourceCollectionTeamLock<SPOSet> mw_sposet_lock(spo_res, spo_list);
174 
175  SPOSet::ValueVector psi(spo->getOrbitalSetSize());
176  SPOSet::GradVector dpsi(spo->getOrbitalSetSize());
177  SPOSet::ValueVector d2psi(spo->getOrbitalSetSize());
178  SPOSet::ValueVector psi_2(spo->getOrbitalSetSize());
179  SPOSet::GradVector dpsi_2(spo->getOrbitalSetSize());
180  SPOSet::ValueVector d2psi_2(spo->getOrbitalSetSize());
181 
182  RefVector<SPOSet::ValueVector> psi_v_list;
183  RefVector<SPOSet::GradVector> dpsi_v_list;
184  RefVector<SPOSet::ValueVector> d2psi_v_list;
185 
186  psi_v_list.push_back(psi);
187  psi_v_list.push_back(psi_2);
188  dpsi_v_list.push_back(dpsi);
189  dpsi_v_list.push_back(dpsi_2);
190  d2psi_v_list.push_back(d2psi);
191  d2psi_v_list.push_back(d2psi_2);
192 
193  spo->mw_evaluateVGL(spo_list, p_list, 0, psi_v_list, dpsi_v_list, d2psi_v_list);
194 #if !defined(QMC_COMPLEX)
195  // real part
196  // due to the different ordering of bands skip the tests on CUDA+Real builds
197  // checking evaluations, reference values are not independently generated.
198  // value
199  CHECK(std::real(psi_v_list[1].get()[0]) == Approx(-2.6693785191));
200  CHECK(std::real(psi_v_list[1].get()[1]) == Approx(-2.669519186));
201  // grad
202  CHECK(std::real(dpsi_v_list[1].get()[0][0]) == Approx(-0.0002679008));
203  CHECK(std::real(dpsi_v_list[1].get()[0][1]) == Approx(7.622625351));
204  CHECK(std::real(dpsi_v_list[1].get()[0][2]) == Approx(-0.0003001692));
205  CHECK(std::real(dpsi_v_list[1].get()[1][0]) == Approx(-0.0002825252));
206  CHECK(std::real(dpsi_v_list[1].get()[1][1]) == Approx(7.6229834557));
207  CHECK(std::real(dpsi_v_list[1].get()[1][2]) == Approx(-0.0002339484));
208  // lapl
209  CHECK(std::real(d2psi_v_list[1].get()[0]) == Approx(-2.6130394936).epsilon(0.0001));
210  CHECK(std::real(d2psi_v_list[1].get()[1]) == Approx(-2.6067698002).epsilon(0.0001));
211 #endif
212 
213 #if defined(QMC_COMPLEX)
214  // imaginary part
215  // value
216  CHECK(std::imag(psi_v_list[1].get()[0]) == Approx(2.6693942547));
217  CHECK(std::imag(psi_v_list[1].get()[1]) == Approx(-2.6693785191));
218  // grad
219  CHECK(std::imag(dpsi_v_list[1].get()[0][0]) == Approx(-0.000179037));
220  CHECK(std::imag(dpsi_v_list[1].get()[0][1]) == Approx(-7.6221408844));
221  CHECK(std::imag(dpsi_v_list[1].get()[0][2]) == Approx(-0.0000232533));
222  CHECK(std::imag(dpsi_v_list[1].get()[1][0]) == Approx(-0.0002679008));
223  CHECK(std::imag(dpsi_v_list[1].get()[1][1]) == Approx(7.622625351));
224  CHECK(std::imag(dpsi_v_list[1].get()[1][2]) == Approx(-0.0003001692));
225  // lapl
226  CHECK(std::imag(d2psi_v_list[1].get()[0]) == Approx(2.6158618927).epsilon(0.0001));
227  CHECK(std::imag(d2psi_v_list[1].get()[1]) == Approx(-2.6130394936).epsilon(0.0001));
228 #endif
229 
230  const size_t nw = 2;
231  std::vector<SPOSet::ValueType> ratio_v(nw);
232  std::vector<SPOSet::GradType> grads_v(nw);
233 
234  Vector<SPOSet::ValueType, OffloadPinnedAllocator<SPOSet::ValueType>> inv_row(5);
235  inv_row[0] = 0.1;
236  inv_row[1] = 0.2;
237  inv_row[2] = 0.3;
238  inv_row[3] = 0.4;
239  inv_row[4] = 0.5;
240  inv_row.updateTo();
241 
242  std::vector<const SPOSet::ValueType*> inv_row_ptr(nw, inv_row.device_data());
243 
244  SPOSet::OffloadMWVGLArray phi_vgl_v;
245  phi_vgl_v.resize(QMCTraits::DIM_VGL, nw, 5);
246  spo->mw_evaluateVGLandDetRatioGrads(spo_list, p_list, 0, inv_row_ptr, phi_vgl_v, ratio_v, grads_v);
247  phi_vgl_v.updateFrom();
248 #if !defined(QMC_COMPLEX)
249  CHECK(std::real(ratio_v[0]) == Approx(-0.4838374162));
250  CHECK(std::real(grads_v[0][0]) == Approx(-24.6573209338));
251  CHECK(std::real(grads_v[0][1]) == Approx(24.6573187288));
252  CHECK(std::real(grads_v[0][2]) == Approx(-0.0000002709));
253  CHECK(std::real(phi_vgl_v(0, 0, 0)) == Approx(-1.6125482321));
254  CHECK(std::real(ratio_v[1]) == Approx(-2.4885484445));
255  CHECK(std::real(grads_v[1][0]) == Approx(-0.6732621026));
256  CHECK(std::real(grads_v[1][1]) == Approx(-2.6037152796));
257  CHECK(std::real(grads_v[1][2]) == Approx(-0.0001673779));
258  CHECK(std::real(phi_vgl_v(0, 1, 0)) == Approx(-2.6693785191));
259 #else
260  CHECK(std::imag(ratio_v[0]) == Approx(0.0005530113));
261  CHECK(std::imag(grads_v[0][0]) == Approx(-0.000357729));
262  CHECK(std::imag(grads_v[0][1]) == Approx(-0.0005462062));
263  CHECK(std::imag(grads_v[0][2]) == Approx(0.0004516766));
264  CHECK(std::imag(phi_vgl_v(0, 0, 0)) == Approx(1.6124026775));
265  CHECK(std::imag(ratio_v[1]) == Approx(0.0009635784));
266  CHECK(std::imag(grads_v[1][0]) == Approx(0.0001453869));
267  CHECK(std::imag(grads_v[1][1]) == Approx(-0.0000331457));
268  CHECK(std::imag(grads_v[1][2]) == Approx(0.0000295465));
269  CHECK(std::imag(phi_vgl_v(0, 1, 0)) == Approx(2.6693942547));
270 #endif
271 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
POLT::ParticleLayout Lattice
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [133/537]

qmcplusplus::TEST_CASE ( "lattice gaussian"  ,
""  [wavefunction] 
)

Definition at line 34 of file test_lattice_gaussian.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), app_log(), LatticeGaussianProductBuilder::buildComponent(), CHECK(), OHMMS::Controller, doc, Dot(), exp(), Libxml2Document::getRoot(), lattice, log(), okay, Libxml2Document::parseFromString(), LatticeParser::put(), and REQUIRE().

35 {
36  Communicate* c;
38 
39  ParticleSet::ParticleLayout lattice;
40  // initialize simulationcell for kvectors
41  const char* xmltext = R"(<tmp>
42  <simulationcell>
43  <parameter name="lattice" units="bohr">
44  6.00000000 0.00000000 0.00000000
45  0.00000000 6.00000000 0.00000000
46  0.00000000 0.00000000 6.00000000
47  </parameter>
48  <parameter name="bconds">
49  p p p
50  </parameter>
51  <parameter name="LR_dim_cutoff"> 15 </parameter>
52  </simulationcell>
53 </tmp>)";
55  bool okay = doc.parseFromString(xmltext);
56  REQUIRE(okay);
57 
58  // read lattice
59  xmlNodePtr root = doc.getRoot();
60  xmlNodePtr part1 = xmlFirstElementChild(root);
61 
62  LatticeParser lp(lattice);
63  lp.put(part1);
64  lattice.print(app_log(), 0);
65  const SimulationCell simulation_cell(lattice);
66  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
67  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
68  auto &ions(*ions_ptr), elec(*elec_ptr);
69 
70  ions.setName("ion");
71  ions.create({2});
72  ions.R[0] = {0.0, 0.0, 0.0};
73  ions.R[1] = {0.0, 0.0, 0.0};
74  elec.setName("elec");
75  elec.create({2, 0});
76  elec.R[0] = {-0.28, 0.0225, -2.709};
77  elec.R[1] = {-1.08389, 1.9679, -0.0128914};
78  std::map<string, const std::unique_ptr<ParticleSet>> pp;
79  pp.emplace(ions_ptr->getName(), std::move(ions_ptr));
80  pp.emplace(elec_ptr->getName(), std::move(elec_ptr));
81 
82  SpeciesSet& tspecies = elec.getSpeciesSet();
83  int upIdx = tspecies.addSpecies("u");
84  int downIdx = tspecies.addSpecies("d");
85  int chargeIdx = tspecies.addAttribute("charge");
86  tspecies(chargeIdx, upIdx) = -1;
87  tspecies(chargeIdx, downIdx) = -1;
88 
89  // initialize SK
90  elec.createSK();
91 
92  const char* particles = R"(<tmp>
93  <ionwf name="ionwf" source="ion" width="0.5 0.5"/>
94 </tmp>
95 )";
96  okay = doc.parseFromString(particles);
97  REQUIRE(okay);
98 
99  root = doc.getRoot();
100 
101  xmlNodePtr jas1 = xmlFirstElementChild(root);
102 
103  LatticeGaussianProductBuilder jastrow(c, elec, pp);
104  auto LGP_uptr = jastrow.buildComponent(jas1);
105  auto LGP = dynamic_cast<LatticeGaussianProduct*>(LGP_uptr.get());
106  double width = 0.5;
107  double alpha = 1. / (2 * width * width);
108  // check initialization. Nope, cannot access Psi.Z
109  for (int i = 0; i < 2; i++)
110  {
111  CHECK(LGP->ParticleAlpha[i] == Approx(alpha));
112  }
113 
114  // update all distance tables
115  ions.update();
116  elec.update();
117 
118  LogValue logpsi = LGP->evaluateLog(elec, elec.G, elec.L);
119  // check answer
120  RealType r2 = Dot(elec.R, elec.R);
121  double wfval = std::exp(-alpha * r2);
122  CHECK(logpsi == ComplexApprox(std::log(wfval)));
123 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
T Dot(const ParticleAttrib< TinyVector< T, D >> &pa, const ParticleAttrib< TinyVector< T, D >> &pb)
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::complex< double > LogValue

◆ TEST_CASE() [134/537]

qmcplusplus::TEST_CASE ( "QMCHamiltonian::flex_evaluate"  ,
""  [hamiltonian] 
)

Definition at line 34 of file test_QMCHamiltonian.cpp.

References comm, OHMMS::Controller, hamiltonian_pool, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), MinimalHamiltonianPool::make_hamWithEE(), particle_pool, twf, and wavefunction_pool.

35 {
36  RuntimeOptions runtime_options;
39 
40  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
41  auto wavefunction_pool = MinimalWaveFunctionPool::make_diamondC_1x1x1(runtime_options, comm, particle_pool);
42  auto hamiltonian_pool = MinimalHamiltonianPool::make_hamWithEE(comm, particle_pool, wavefunction_pool);
43 
44  TrialWaveFunction twf(runtime_options);
45 
46  std::vector<QMCHamiltonian> hamiltonians;
47  //hamiltonians.emplace_back(*(hamiltonian_pool.getPrimary()));
48  //hamiltonians.emplace_back(*(hamiltonian_pool.getPrimary()));
49 
50  std::vector<ParticleSet> elecs;
51  elecs.emplace_back(*(particle_pool.getParticleSet("e")));
52  elecs.emplace_back(*(particle_pool.getParticleSet("e")));
53 
54  // TODO: finish initializing the elecs.
55  //std::vector<QMCHamiltonian::RealType> local_energies(QMCHamiltonian::flex_evaluate(makeRefVector<QMCHamiltonian>(hamiltonians), makeRefVector<ParticleSet>(elecs)));
56 
57  //TODO: Would be nice to check some values but I think the system needs a little more setup
58 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68

◆ TEST_CASE() [135/537]

qmcplusplus::TEST_CASE ( "Fixed node branch"  ,
""  [drivers][walker_control] 
)

Definition at line 34 of file test_fixed_node_branch.cpp.

References SimpleFixedNodeBranch::advanceQMCCounter(), SimpleFixedNodeBranch::B_COUNTER, CHECK(), OHMMS::Controller, SimpleFixedNodeBranch::getEstimatorManager(), SimpleFixedNodeBranch::getTau(), SimpleFixedNodeBranch::iParam, REQUIRE(), and SimpleFixedNodeBranch::setEstimatorManager().

35 {
37 
38  auto emb_uptr = std::make_unique<EstimatorManagerBase>(c);
39  auto emb = emb_uptr.get();
40 
41  double tau = 0.5;
42  int nideal = 1;
43  SimpleFixedNodeBranch fnb(tau, nideal);
44 
45  fnb.setEstimatorManager(std::move(emb_uptr));
46  REQUIRE(fnb.getEstimatorManager() == emb);
47 
48  CHECK(fnb.getTau() == Approx(tau));
49 
50  fnb.advanceQMCCounter();
51  REQUIRE(fnb.iParam[SimpleFixedNodeBranch::B_COUNTER] == 0);
52 
53  // default is classic cutoff scheme
54  //fnb.setBranchCutoff();
55 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [136/537]

qmcplusplus::TEST_CASE ( "ObservableHelper::set_dimensions"  ,
""  [hamiltonian] 
)

Definition at line 34 of file test_ObservableHelper.cpp.

References CHECK(), dims, ObservableHelper::lower_bound, oh, and ObservableHelper::set_dimensions().

35 {
36  ObservableHelper oh{hdf_path{"u"}};
37 
38  std::vector<int> dims = {10, 10};
40 
41  CHECK(oh.lower_bound == 1);
42 }
CHECK(oh.lower_bound==0)
hsize_t lower_bound
starting index
void set_dimensions(const std::vector< int > &dims, int first)
set the shape of this observable
std::vector< int > dims
ObservableHelper oh

◆ TEST_CASE() [137/537]

qmcplusplus::TEST_CASE ( "Hybridrep SPO from HDF diamond_1x1x1"  ,
""  [wavefunction] 
)

Definition at line 34 of file test_hybridrep.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), CHECK(), CHECKED_ELSE(), checkMatrix(), OHMMS::Controller, ParticleSet::create(), EinsplineSetBuilder::createSPOSetFromXML(), doc, qmcplusplus::Units::charge::e, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), lattice, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), Vector< T, Alloc >::size(), and ParticleSet::update().

35 {
37 
38  ParticleSet::ParticleLayout lattice;
39  // diamondC_1x1x1
40  lattice.R = {3.37316115, 3.37316115, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
41 
42  ParticleSetPool ptcl = ParticleSetPool(c);
43  ptcl.setSimulationCell(lattice);
44  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
45  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
46  ParticleSet& ions_(*ions_uptr);
47  ParticleSet& elec_(*elec_uptr);
48 
49  ions_.setName("ion");
50  ptcl.addParticleSet(std::move(ions_uptr));
51  ions_.create({2});
52  ions_.R[0] = {0.0, 0.0, 0.0};
53  ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
54  SpeciesSet& ion_species = ions_.getSpeciesSet();
55  int C_Idx = ion_species.addSpecies("C");
56  int C_chargeIdx = ion_species.addAttribute("charge");
57  int cutoffIdx = ion_species.addAttribute("cutoff_radius");
58  int lmaxIdx = ion_species.addAttribute("lmax");
59 
60  ion_species(C_chargeIdx, C_Idx) = 4;
61  ion_species(cutoffIdx, C_Idx) = 0.9;
62  ion_species(lmaxIdx, C_Idx) = 3;
63 
64  elec_.setName("elec");
65  ptcl.addParticleSet(std::move(elec_uptr));
66  elec_.create({3});
67  elec_.R[0] = {0.4, 0.0, 0.0};
68  elec_.R[1] = {0.0, 1.0, 0.0};
69  elec_.R[2] = {0.0, 0.5, 0.5};
70  SpeciesSet& tspecies = elec_.getSpeciesSet();
71  int upIdx = tspecies.addSpecies("u");
72  int chargeIdx = tspecies.addAttribute("charge");
73  tspecies(chargeIdx, upIdx) = -1;
74 
75  //diamondC_1x1x1
76  const char* particles = R"(<tmp>
77 <determinantset type="einspline" href="diamondC_1x1x1.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.0" precision="float" size="4" hybridrep="yes"/>
78 </tmp>
79 )";
80 
82  bool okay = doc.parseFromString(particles);
83  REQUIRE(okay);
84 
85  xmlNodePtr root = doc.getRoot();
86 
87  xmlNodePtr ein1 = xmlFirstElementChild(root);
88 
89  EinsplineSetBuilder einSet(elec_, ptcl.getPool(), c, ein1);
90  auto spo = einSet.createSPOSetFromXML(ein1);
91  REQUIRE(spo);
92 
93  ions_.update();
94  elec_.update();
95 
96  /* for vgl
97  * In DiracDeterminant, these psiM, dpsiM, and d2psiM
98  * are always sized to elec_.R.size() x elec_.R.size()
99  * Using the same sizes for these. This tests the case
100  * that spo->OrbitalSetSize > elec_.R.size()
101  */
102  SPOSet::ValueMatrix psiM(elec_.R.size(), elec_.R.size());
103  SPOSet::GradMatrix dpsiM(elec_.R.size(), elec_.R.size());
104  SPOSet::ValueMatrix d2psiM(elec_.R.size(), elec_.R.size());
105  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM, dpsiM, d2psiM);
106 
107  // due to the different ordering of bands skip the tests on CUDA+Real builds
108  // checking evaluations, reference values are not independently generated.
109  // electron 0
110  // value
111  CHECK(std::real(psiM[0][0]) == Approx(-0.6594096422));
112  CHECK(std::real(psiM[0][1]) == Approx(-1.3352056742));
113  // grad
114  CHECK(std::real(dpsiM[0][0][0]) == Approx(-0.8762991428));
115  CHECK(std::real(dpsiM[0][0][1]) == Approx(0.0000000044));
116  CHECK(std::real(dpsiM[0][0][2]) == Approx(0.0000000044));
117  CHECK(std::real(dpsiM[0][1][0]) == Approx(-0.8603816628));
118  CHECK(std::real(dpsiM[0][1][1]) == Approx(4.3501935005));
119  CHECK(std::real(dpsiM[0][1][2]) == Approx(-0.6386129856));
120  // lapl
121  CHECK(std::real(d2psiM[0][0]) == Approx(-4.1090884209));
122  CHECK(std::real(d2psiM[0][1]) == Approx(22.3851032257).epsilon(3e-5));
123 
124  // electron 1
125  // value
126  CHECK(std::real(psiM[1][0]) == Approx(-0.8886948824));
127  CHECK(std::real(psiM[1][1]) == Approx(1.4194120169));
128  // grad
129  CHECK(std::real(dpsiM[1][0][0]) == Approx(-0.0000183403));
130  CHECK(std::real(dpsiM[1][0][1]) == Approx(0.1655139178));
131  CHECK(std::real(dpsiM[1][0][2]) == Approx(-0.0000193077));
132  CHECK(std::real(dpsiM[1][1][0]) == Approx(-1.3131694794));
133  CHECK(std::real(dpsiM[1][1][1]) == Approx(-1.1174004078));
134  CHECK(std::real(dpsiM[1][1][2]) == Approx(-0.8462534547));
135  // lapl
136  CHECK(std::real(d2psiM[1][0]) == Approx(1.3313053846));
137  CHECK(std::real(d2psiM[1][1]) == Approx(-4.712583065));
138 
139  // electron 2
140  // value
141  CHECK(std::real(psiM[2][0]) == Approx(-0.8694150782));
142  CHECK(std::real(psiM[2][1]) == Approx(0.780789871));
143  // grad
144  CHECK(std::real(dpsiM[2][0][0]) == Approx(-0.0602699547));
145  CHECK(std::real(dpsiM[2][0][1]) == Approx(-0.2770632381));
146  CHECK(std::real(dpsiM[2][0][2]) == Approx(-0.2770632488));
147  CHECK(std::real(dpsiM[2][1][0]) == Approx(-1.5982062406));
148  CHECK(std::real(dpsiM[2][1][1]) == Approx(1.0020672904));
149  CHECK(std::real(dpsiM[2][1][2]) == Approx(-1.9794520201));
150  // lapl
151  CHECK(std::real(d2psiM[2][0]) == Approx(1.1232769428).epsilon(1e-4));
152  CHECK(std::real(d2psiM[2][1]) == Approx(-4.9779265738).epsilon(3e-5));
153 
154  //Let's also add test for orbital optimzation
155  if (spo->isRotationSupported())
156  {
157  SPOSet::ValueMatrix psiM(elec_.R.size(), spo->getOrbitalSetSize());
158  SPOSet::GradMatrix dpsiM(elec_.R.size(), spo->getOrbitalSetSize());
159  SPOSet::ValueMatrix d2psiM(elec_.R.size(), spo->getOrbitalSetSize());
160  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM, dpsiM, d2psiM);
161 
162  SPOSet::ValueVector row0{0.56752158, -0.3152607, 0.03525207, -0.75979421};
163  SPOSet::ValueVector row1{0.21452916, 0.75299027, -0.59552084, -0.17982718};
164  SPOSet::ValueVector row2{0.24049122, 0.55674778, 0.79497536, -0.01449368};
165  SPOSet::ValueVector row3{0.75766778, -0.1537799, -0.11011992, 0.62463179};
166  SPOSet::ValueMatrix rot_mat(4, 4);
167  for (int iorb = 0; iorb < 4; iorb++)
168  {
169  rot_mat[0][iorb] = row0[iorb];
170  rot_mat[1][iorb] = row1[iorb];
171  rot_mat[2][iorb] = row2[iorb];
172  rot_mat[3][iorb] = row3[iorb];
173  }
174  SPOSet::ValueMatrix psiM_rot_manual(elec_.R.size(), spo->size());
175  for (int i = 0; i < elec_.R.size(); i++)
176  for (int j = 0; j < spo->size(); j++)
177  {
178  psiM_rot_manual[i][j] = 0.0;
179  for (int k = 0; k < spo->size(); k++)
180  psiM_rot_manual[i][j] += psiM[i][k] * rot_mat[k][j];
181  }
182 
183  spo->storeParamsBeforeRotation();
184  spo->applyRotation(rot_mat, false);
185  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM, dpsiM, d2psiM);
186  auto check = checkMatrix(psiM_rot_manual, psiM, true);
187  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
188  }
189 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
CHECKED_ELSE(check_matrix_result.result)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [138/537]

qmcplusplus::TEST_CASE ( "walker"  ,
""  [particle] 
)

Definition at line 34 of file test_walker.cpp.

References CHECK(), Walker< t_traits, p_traits >::R, and REQUIRE().

35 {
36  MCPWalker w(1);
37  REQUIRE(w.R.size() == 1);
38  w.R[0] = 1.0;
39 
40  CHECK(w.R[0][0] == Approx(1.0));
41 }
REQUIRE(std::filesystem::exists(filename))
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker
Definition: test_walker.cpp:31
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [139/537]

qmcplusplus::TEST_CASE ( "FairDivideLow_one"  ,
""  [utilities] 
)

Definition at line 34 of file test_partition.cpp.

References FairDivideLow(), and REQUIRE().

35 {
36  std::vector<int> out;
37  FairDivideLow(1, 1, out);
38  REQUIRE(out.size() == 2);
39  REQUIRE(out[0] == 0);
40  REQUIRE(out[1] == 1);
41 }
void FairDivideLow(int ntot, int npart, IV &adist)
partition ntot elements among npart
Definition: FairDivide.h:114
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [140/537]

qmcplusplus::TEST_CASE ( "ParallelExecutor<OPENMP> lambda case"  ,
""  [concurrency] 
)

Definition at line 35 of file test_ParallelExecutorOPENMP.cpp.

References omp_get_max_threads(), and REQUIRE().

36 {
37  const int num_threads = omp_get_max_threads();
38  std::cout << "omp_get_max_threads() == " << num_threads << '\n';
39  ParallelExecutor<Executor::OPENMP> test_block;
40  int count(0);
41  test_block(
42  num_threads,
43  [](int id, int& c) {
44 #pragma omp atomic update
45  c++;
46  },
47  std::ref(count));
48  REQUIRE(count == num_threads);
49 }
omp_int_t omp_get_max_threads()
Definition: OpenMP.h:26
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [141/537]

qmcplusplus::TEST_CASE ( "RandomNumberControl no random in xml"  ,
""  [ohmmsapp] 
)

Definition at line 35 of file test_rng_control.cpp.

References doc, Libxml2Document::getXPathContext(), RandomNumberControl::initialize(), okay, Libxml2Document::parseFromString(), and REQUIRE().

36 {
37  const char* xml_input = R"(<tmp></tmp>)";
38 
40  bool okay = doc.parseFromString(xml_input);
41  REQUIRE(okay);
42 
43  RandomNumberControl rnc;
44 
45  xmlXPathContextPtr context = doc.getXPathContext();
46  rnc.initialize(context);
47 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [142/537]

qmcplusplus::TEST_CASE ( "TwoBodyJastrow one species and two variables"  ,
""  [wavefunction] 
)

Definition at line 35 of file test_J2_derivatives.cpp.

References TwoBodyJastrow< FT >::addFunc(), CHECK(), TwoBodyJastrow< FT >::checkOutVariables(), ParticleSet::create(), VariableSet::insertFrom(), ParticleSet::setName(), and VariableSet::size_of_active().

36 {
37  const SimulationCell simulation_cell;
38  ParticleSet elec(simulation_cell);
39  elec.setName("e");
40  elec.create({1, 1});
41  TwoBodyJastrow<FakeJasFunctor> jorb("J2_fake", elec, false);
42 
43  auto j2_uptr = std::make_unique<FakeJasFunctor>("test_fake");
44  auto& j2 = *j2_uptr;
45  j2.myVars.insert("opt1", 1.0);
46  j2.myVars.insert("opt2", 2.0);
47  // update num_active_vars
48  j2.myVars.resetIndex();
49  jorb.addFunc(0, 0, std::move(j2_uptr));
50 
51  opt_variables_type global_active;
52  global_active.insertFrom(j2.myVars);
53 
54  jorb.checkOutVariables(global_active);
55 
56  CHECK(global_active.size_of_active() == 2);
57 }
optimize::VariableSet opt_variables_type
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void insertFrom(const VariableSet &input)
insert a VariableSet to the list
Definition: VariableSet.cpp:37

◆ TEST_CASE() [143/537]

qmcplusplus::TEST_CASE ( "Bare Force"  ,
""  [hamiltonian] 
)

Definition at line 35 of file test_force.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), OHMMS::Controller, ParticleSet::create(), BareForce::evaluate(), ForceBase::getForces(), ParticleSet::getSpeciesSet(), ParticleSet::R, ParticleSet::resetGroups(), ForceBase::setAddIonIon(), ParticleSet::setName(), and ParticleSet::update().

36 {
38 
39  const SimulationCell simulation_cell;
40  ParticleSet ions(simulation_cell);
41  ParticleSet elec(simulation_cell);
42 
43  ions.setName("ion");
44  ions.create({1});
45  ions.R[0] = {0.0, 0.0, 0.0};
46  elec.setName("elec");
47  elec.create({2});
48  elec.R[0] = {0.0, 1.0, 0.0};
49  elec.R[1] = {0.4, 0.3, 0.0};
50  SpeciesSet& tspecies = elec.getSpeciesSet();
51  int upIdx = tspecies.addSpecies("u");
52  //int chargeIdx = tspecies.addAttribute("charge");
53  int massIdx = tspecies.addAttribute("mass");
54  int eChargeIdx = tspecies.addAttribute("charge");
55  tspecies(eChargeIdx, upIdx) = -1.0;
56  tspecies(massIdx, upIdx) = 1.0;
57 
58 
59  // The call to resetGroups is needed transfer the SpeciesSet
60  // settings to the ParticleSet
61  elec.resetGroups();
62 
63  SpeciesSet& ion_species = ions.getSpeciesSet();
64  int pIdx = ion_species.addSpecies("H");
65  int pChargeIdx = ion_species.addAttribute("charge");
66  ion_species(pChargeIdx, pIdx) = 1;
67 
68  ions.resetGroups();
69  // Must update ions first in SoA so ions.coordinates_ is valid
70  ions.update();
71 
72  elec.addTable(ions);
73  elec.update();
74 
75  BareForce force(ions, elec);
76  force.setAddIonIon(false);
77 
78  force.evaluate(elec);
79 
80  //std::cout << " Force = " << force.getForces() << std::endl;
81  CHECK(force.getForces()[0][0] == Approx(3.2));
82  CHECK(force.getForces()[0][1] == Approx(3.4));
83  CHECK(force.getForces()[0][2] == Approx(0.0));
84 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [144/537]

qmcplusplus::TEST_CASE ( "gaussian random array length 1"  ,
""  [particle_base] 
)

Definition at line 35 of file test_random_seq.cpp.

References assignGaussRand(), and CHECK().

36 {
37  FakeRandom rg;
38  std::vector<double> a(2);
39  assignGaussRand(a.data(), 1, rg);
40 
41  // assuming RNG input is 0.5
42  CHECK(a[0] == Approx(-1.1774100224305424));
43  CHECK(a[1] == Approx(0.0)); // ensure no overflow
44 }
void assignGaussRand(T *restrict a, unsigned n, RG &rng)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [145/537]

qmcplusplus::TEST_CASE ( "DiracMatrix_identity"  ,
""  [wavefunction][fermion] 
)

Definition at line 36 of file test_DiracMatrix.cpp.

References CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), fillIdentityMatrix(), DiracMatrix< T_FP >::invert_transpose(), qmcplusplus::Units::distance::m, and Matrix< T, Alloc >::resize().

37 {
38  DiracMatrix<ValueType> dm;
39 
40  Matrix<ValueType> m, m_invT;
41  LogValue log_value;
42  m.resize(3, 3);
43  m_invT.resize(3, 3);
44 
46 
47  dm.invert_transpose(m, m_invT, log_value);
48  CHECK(log_value == LogComplexApprox(0.0));
49 
50  Matrix<ValueType> eye;
51  eye.resize(3, 3);
52  fillIdentityMatrix(eye);
53 
54  CheckMatrixResult check_matrix_result = checkMatrix(m_invT, eye);
55  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
56 }
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
Catch::Detail::LogComplexApprox LogComplexApprox
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void fillIdentityMatrix(Matrix< T > &m)
std::complex< double > LogValue

◆ TEST_CASE() [146/537]

qmcplusplus::TEST_CASE ( "Bare Kinetic Energy"  ,
""  [hamiltonian] 
)

Definition at line 36 of file test_bare_kinetic.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), ParticleSet::create(), doc, BareKineticEnergy::evaluate(), ParticleSet::G, Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), ParticleSet::L, okay, Libxml2Document::parseFromString(), BareKineticEnergy::put(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), and ParticleSet::update().

37 {
38  const SimulationCell simulation_cell;
39  ParticleSet ions(simulation_cell);
40  ParticleSet elec(simulation_cell);
41 
42  ions.setName("ion");
43  ions.create({1});
44  ions.R[0] = {0.0, 0.0, 0.0};
45  elec.setName("elec");
46  elec.create({2});
47  elec.R[0] = {0.0, 1.0, 0.0};
48  elec.R[1] = {1.0, 1.0, 0.0};
49  SpeciesSet& tspecies = elec.getSpeciesSet();
50  int upIdx = tspecies.addSpecies("u");
51  int massIdx = tspecies.addAttribute("mass");
52  tspecies(massIdx, upIdx) = 1.0;
53 
54  elec.addTable(ions);
55  elec.update();
56 
57  const char* particles = R"(<tmp></tmp>)";
58 
60  bool okay = doc.parseFromString(particles);
61  REQUIRE(okay);
62 
63  xmlNodePtr root = doc.getRoot();
64 
65  xmlNodePtr h1 = xmlFirstElementChild(root);
66 
67  RuntimeOptions runtime_options;
68  TrialWaveFunction psi(runtime_options);
69  BareKineticEnergy bare_ke(elec, psi);
70  bare_ke.put(h1);
71 
72  elec.L[0] = 1.0;
73  elec.L[1] = 0.0;
74  double v = bare_ke.evaluate(elec);
75  REQUIRE(v == -0.5);
76 
77  elec.L[0] = 0.0;
78  elec.L[1] = 0.0;
79  elec.G[0][0] = 1.0;
80  elec.G[0][1] = 0.0;
81  elec.G[0][2] = 0.0;
82  elec.G[1][0] = 0.0;
83  elec.G[1][1] = 0.0;
84  elec.G[1][2] = 0.0;
85  v = bare_ke.evaluate(elec);
86  REQUIRE(v == -0.5);
87 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [147/537]

qmcplusplus::TEST_CASE ( "ModernStringUtils_split"  ,
""  [utilities] 
)

Definition at line 36 of file test_ModernStringUtils.cpp.

References CHECK(), qmcplusplus::modernstrutil::split(), and split().

37 {
39 
40  std::string nothing;
41  auto no_tokens = split(nothing, " ");
42  CHECK(no_tokens.empty());
43  no_tokens = split(nothing, "");
44  CHECK(no_tokens.empty());
45 
46  std::string white_space{" "};
47  auto tokens = split(white_space, ".");
48  CHECK(tokens.size() == 1);
49  CHECK(tokens[0] == " ");
50 
51  tokens = split(white_space, " ");
52  CHECK(tokens.empty());
53 
54  std::string test_line{"hi there 101, random line"};
55  tokens = split(test_line, " ");
56  CHECK(tokens[0].size() == 2);
57  CHECK(tokens[4].size() == 4);
58  CHECK(tokens[3] == "random");
59 
60  tokens = split(test_line, "");
61  CHECK(tokens.size() == 1);
62 
63  tokens = split(test_line, ";");
64  CHECK(tokens.size() == 1);
65 
66  std::string test_lines{R"(
67 this is a multi
68 line
69 token test
70 )"};
71  auto tokens_lines = split(test_lines, "\n");
72  CHECK(tokens_lines[0] == "this is a multi");
73  CHECK(tokens_lines[1] == "line");
74  CHECK(tokens_lines[2] == "token test");
75 
76  std::string test_multidel{"this \t is a multidelimiter \n \n token test"};
77  auto tokens_multidel = split(test_multidel, "\t \n");
78  CHECK(tokens_multidel[0] == "this");
79  CHECK(tokens_multidel[1] == "is");
80  CHECK(tokens_multidel[4] == "token");
81 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::vector< std::string_view > split(const string_view s, const string_view delimiters)

◆ TEST_CASE() [148/537]

qmcplusplus::TEST_CASE ( "transform2gridfunctor"  ,
""  [numerics] 
)

Definition at line 36 of file test_transform.cpp.

References CHECK(), and OneDimQuinticSpline< Td, Tg, CTd, CTg >::set().

37 {
38  using GridType = OneDimGridBase<double>;
39  using OutputType = OneDimQuinticSpline<double>;
40 
41  auto agrid = std::make_unique<LogGrid<double>>();
42  agrid->set(0.1, 10, 10);
43  OutputType output(std::move(agrid));
44  Input input;
45  Transform2GridFunctor<Input, OutputType> transform(input, output);
46  double rmin = 0.1;
47  double rmax = 10;
48  int npts = 10;
49  transform.generate(rmin, rmax, npts);
50  CHECK(output.splint(0.1) == Approx(0.01));
51  CHECK(output.splint(0.15) == Approx(0.0225));
52  CHECK(output.splint(7.0) == Approx(49.0));
53  CHECK(output.splint(10) == Approx(100.0));
54 }
GridType
The different types of grids that we currently allow.
Definition: Grid.h:29
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
testing::ValidSpinDensityInput input

◆ TEST_CASE() [149/537]

qmcplusplus::TEST_CASE ( "srcoul"  ,
""  [lrhandler] 
)

evalaute bare Coulomb in 3D

Definition at line 36 of file test_srcoul.cpp.

References CrystalLattice< T, D >::BoxBConds, CHECK(), ParticleSet::createSK(), Tensor< T, D >::diagonal(), LRHandlerSRCoulomb< Func, BreakupBasis >::evaluate(), LRHandlerSRCoulomb< Func, BreakupBasis >::initBreakup(), LRHandlerBase::LR_kc, LRHandlerBase::LR_rc, LRHandlerBase::MaxKshell, CrystalLattice< T, D >::R, CrystalLattice< T, D >::reset(), CrystalLattice< T, D >::Rv, and CrystalLattice< T, D >::Volume.

37 {
38  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> Lattice;
39  Lattice.BoxBConds = true;
40  Lattice.LR_dim_cutoff = 30.;
41  Lattice.R.diagonal(5.0);
42  Lattice.reset();
43  CHECK(Lattice.Volume == Approx(125));
44  Lattice.SetLRCutoffs(Lattice.Rv);
45  //Lattice.printCutoffs(app_log());
46  CHECK(Approx(Lattice.LR_rc) == 2.5);
47  CHECK(Approx(Lattice.LR_kc) == 12);
48 
49  const SimulationCell simulation_cell(Lattice);
50  ParticleSet ref(simulation_cell); // handler needs ref.getSimulationCell().getKLists()
51  ref.createSK();
52  LRHandlerSRCoulomb<EslerCoulomb3D_ForSRCOUL, LPQHISRCoulombBasis> handler(ref);
53 
54  handler.initBreakup(ref);
55 
56  std::cout << "handler.MaxKshell is " << handler.MaxKshell << std::endl;
57  CHECK( (std::is_same<OHMMS_PRECISION, OHMMS_PRECISION_FULL>::value ?
58  handler.MaxKshell == 78 : handler.MaxKshell >= 117 && handler.MaxKshell <= 128 ));
59  CHECK(Approx(handler.LR_rc) == 2.5);
60  CHECK(Approx(handler.LR_kc) == 12);
61 
62  mRealType r, dr, rinv;
63  mRealType vsr;
64  int nr = 101;
65  dr = 5.0 / nr; // L/[# of grid points]
66  for (int ir = 1; ir < nr; ir++)
67  {
68  r = ir * dr;
69  rinv = 1. / r;
70  vsr = handler.evaluate(r, rinv);
71  // short-range part must vanish after rcut
72  if (r > 2.5)
73  CHECK(vsr == Approx(0.0));
74  //// !!!! SR values not validated, see "srcoul df" test
75  //CHECK(vsr == Approx(rinv));
76  }
77 }
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
POLT::ParticleLayout Lattice
EwaldHandler3D::mRealType mRealType
TinyVector< SingleParticlePos, D > Rv
Real-space unit vectors.
Scalar_t Volume
Physical properties of a supercell.
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
void diagonal(const T &rhs)
Definition: Tensor.h:205
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

◆ TEST_CASE() [150/537]

qmcplusplus::TEST_CASE ( "FakeRandom read write"  ,
""  [utilities] 
)

Definition at line 36 of file test_FakeRandom.cpp.

References CHECK(), and FakeRandom< T >::set_value().

37 {
38  using DoubleRNG = FakeRandom<double>;
39  DoubleRNG rng;
40 
41  rng.set_value(1.0);
42 
43  std::stringstream stream;
44  rng.write(stream);
45 
46  DoubleRNG rng2;
47 
48  rng2.read(stream);
49 
50  for (auto i = 0; i < 3; ++i)
51  CHECK(rng2() == rng());
52 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [151/537]

qmcplusplus::TEST_CASE ( "DummyResource"  ,
""  [utilities] 
)

Definition at line 37 of file test_ResourceCollection.cpp.

References DummyResource::makeClone(), and REQUIRE().

38 {
39  DummyResource dummy;
40  auto dummy2 = dummy.makeClone();
41  REQUIRE(dummy2->getName() == "Dummy");
42  DummyResource dummy_alt("dummy_alt_name");
43  REQUIRE(dummy_alt.getName() == "dummy_alt_name");
44 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [152/537]

qmcplusplus::TEST_CASE ( "DiracMatrixComputeCUDA_cuBLAS_geam_call"  ,
""  [wavefunction][fermion] 
)

Definition at line 37 of file test_DiracMatrixComputeCUDA.cpp.

References qmcplusplus::Units::distance::A, qmcplusplus::syclBLAS::copy_n(), CUBLAS_OP_N, CUBLAS_OP_T, cublasErrorCheck, cudaCheck, cudaMemcpyAsync, cudaMemcpyHostToDevice, Matrix< T, Alloc >::data(), Matrix< T, Alloc >::device_data(), qmcplusplus::cuBLAS::geam(), BLASHandle< PlatformKind::CUDA >::h_cublas, lda, n, queue, Matrix< T, Alloc >::resize(), and Matrix< T, Alloc >::size().

38 {
39  OffloadPinnedMatrix<double> mat_a;
40  int n = 4;
41  mat_a.resize(n, n);
42  OffloadPinnedMatrix<double> temp_mat;
43  temp_mat.resize(n, n);
44  OffloadPinnedMatrix<double> mat_c;
45  mat_c.resize(n, n);
46 
47  double host_one(1.0);
48  double host_zero(0.0);
49 
50  std::vector<double> A{2, 5, 8, 7, 5, 2, 2, 8, 7, 5, 6, 6, 5, 4, 4, 8};
51  std::copy_n(A.begin(), 16, mat_a.data());
52  compute::Queue<PlatformKind::CUDA> queue;
53  compute::BLASHandle<PlatformKind::CUDA> cuda_handles(queue);
54  int lda = n;
55  cudaCheck(cudaMemcpyAsync((void*)(temp_mat.device_data()), (void*)(mat_a.data()), mat_a.size() * sizeof(double),
56  cudaMemcpyHostToDevice, queue.getNative()));
57  cublasErrorCheck(cuBLAS::geam(cuda_handles.h_cublas, CUBLAS_OP_T, CUBLAS_OP_N, n, n, &host_one,
58  temp_mat.device_data(), lda, &host_zero, mat_c.device_data(), lda, mat_a.device_data(),
59  lda),
60  "cuBLAS::geam failed.");
61 }
#define CUBLAS_OP_N
Definition: cuda2hip.h:19
#define CUBLAS_OP_T
Definition: cuda2hip.h:20
#define cudaMemcpyHostToDevice
Definition: cuda2hip.h:139
sycl::event copy_n(sycl::queue &aq, const T1 *restrict VA, size_t array_size, T2 *restrict VC, const std::vector< sycl::event > &events)
Definition: syclBLAS.cpp:548
cublasStatus_t geam(cublasHandle_t &handle, cublasOperation_t &transa, cublasOperation_t &transb, int m, int n, const float *alpha, const float *A, int lda, const float *beta, const float *B, int ldb, float *C, int ldc)
Definition: cuBLAS.hpp:110
#define cublasErrorCheck(ans, cause)
Definition: cuBLAS.hpp:34
#define cudaCheck(ans)
Definition: CUDAerror.h:27
#define cudaMemcpyAsync
Definition: cuda2hip.h:136

◆ TEST_CASE() [153/537]

qmcplusplus::TEST_CASE ( "PolynomialFunctor3D functor zero"  ,
""  [wavefunction] 
)

Definition at line 37 of file test_polynomial_eeI_jastrow.cpp.

References PolynomialFunctor3D::evaluate(), and REQUIRE().

38 {
39  PolynomialFunctor3D functor("test_functor");
40 
41  double r = 1.2;
42  double u = functor.evaluate(r, r, r);
43  REQUIRE(u == 0.0);
44 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [154/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-B ,
""  [hamiltonian] 
)

Definition at line 37 of file test_coulomb_pbcAB.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evaluate(), CoulombPBCAB::evaluate(), ParticleSet::getSpeciesSet(), lattice, CoulombPBCAB::myConst, ParticleSet::R, ParticleSet::resetGroups(), ParticleSet::setName(), and ParticleSet::update().

38 {
39  LRCoulombSingleton::CoulombHandler = 0;
40 
41  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
42  lattice.BoxBConds = true; // periodic
43  lattice.R.diagonal(1.0);
44  lattice.reset();
45 
46  const SimulationCell simulation_cell(lattice);
47  ParticleSet ions(simulation_cell);
48  ParticleSet elec(simulation_cell);
49 
50  ions.setName("ion");
51  ions.create({1});
52  ions.R[0] = {0.0, 0.0, 0.0};
53  SpeciesSet& ion_species = ions.getSpeciesSet();
54  int pIdx = ion_species.addSpecies("H");
55  int pChargeIdx = ion_species.addAttribute("charge");
56  ion_species(pChargeIdx, pIdx) = 1;
57  ions.createSK();
58  ions.update();
59 
60 
61  elec.setName("elec");
62  elec.create({1});
63  elec.R[0] = {0.5, 0.0, 0.0};
64  SpeciesSet& tspecies = elec.getSpeciesSet();
65  int upIdx = tspecies.addSpecies("u");
66  int chargeIdx = tspecies.addAttribute("charge");
67  int massIdx = tspecies.addAttribute("mass");
68  tspecies(chargeIdx, upIdx) = -1;
69  tspecies(massIdx, upIdx) = 1.0;
70 
71  elec.resetGroups();
72  elec.createSK();
73  elec.addTable(ions);
74  elec.update();
75 
76 
77  CoulombPBCAB cab(ions, elec);
78 
79  // Self energy plus Background charge term
80  CHECK(cab.myConst == Approx(2 * 0.0506238028)); // not validated
81 
82  double val_ei = cab.evaluate(elec);
83  CHECK(val_ei == Approx(-0.005314032183 + 2 * 0.0506238028)); // not validated
84 
85  CoulombPBCAA caa_elec(elec, true, false, false);
86  CoulombPBCAA caa_ion(ions, false, false, false);
87  double val_ee = caa_elec.evaluate(elec);
88  double val_ii = caa_ion.evaluate(ions);
89  double sum = val_ee + val_ii + val_ei;
90  CHECK(sum == Approx(-2.741363553)); // Can be validated via Ewald summation elsewhere
91  // -2.74136517454081
92 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [155/537]

qmcplusplus::TEST_CASE ( "temp3d"  ,
""  [lrhandler] 
)

evalaute bare Coulomb in 3D using LRHandlerTemp

Definition at line 37 of file test_temp.cpp.

References CrystalLattice< T, D >::BoxBConds, CHECK(), ParticleSet::createSK(), Tensor< T, D >::diagonal(), LRHandlerTemp< Func, BreakupBasis >::evaluate(), LRHandlerTemp< Func, BreakupBasis >::evaluateLR(), LRHandlerTemp< Func, BreakupBasis >::initBreakup(), LRHandlerBase::LR_kc, LRHandlerBase::LR_rc, LRHandlerBase::MaxKshell, CrystalLattice< T, D >::R, CrystalLattice< T, D >::reset(), CrystalLattice< T, D >::Rv, and CrystalLattice< T, D >::Volume.

38 {
39  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> Lattice;
40  Lattice.BoxBConds = true;
41  Lattice.LR_dim_cutoff = 30.;
42  Lattice.R.diagonal(5.0);
43  Lattice.reset();
44  CHECK(Approx(Lattice.Volume) == 125);
45  Lattice.SetLRCutoffs(Lattice.Rv);
46  //Lattice.printCutoffs(app_log());
47  CHECK(Approx(Lattice.LR_rc) == 2.5);
48  CHECK(Approx(Lattice.LR_kc) == 12);
49 
50  const SimulationCell simulation_cell(Lattice);
51  ParticleSet ref(simulation_cell); // handler needs ref.getSimulationCell().getKLists()
52  ref.createSK();
53  LRHandlerTemp<EslerCoulomb3D, LPQHIBasis> handler(ref);
54 
55  handler.initBreakup(ref);
56 
57  std::cout << "handler.MaxKshell is " << handler.MaxKshell << std::endl;
58  CHECK( (std::is_same<OHMMS_PRECISION, OHMMS_PRECISION_FULL>::value ?
59  handler.MaxKshell == 78 : handler.MaxKshell >= 117 && handler.MaxKshell <= 128 ));
60  CHECK(Approx(handler.LR_rc) == 2.5);
61  CHECK(Approx(handler.LR_kc) == 12);
62 
63  mRealType r, dr, rinv;
64  mRealType vsr, vlr;
65  int nr = 101;
66  dr = 5.0 / nr; // L/[# of grid points]
67  for (int ir = 1; ir < nr; ir++)
68  {
69  r = ir * dr;
70  rinv = 1. / r;
71  vsr = handler.evaluate(r, rinv);
72  vlr = handler.evaluateLR(r);
73  // short-range part must vanish after rcut
74  if (r > 2.5)
75  CHECK(Approx(vsr) == 0.0);
76  // sum must recover the Coulomb potential
77  CHECK(vsr + vlr == Approx(rinv));
78  }
79 }
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
POLT::ParticleLayout Lattice
EwaldHandler3D::mRealType mRealType
TinyVector< SingleParticlePos, D > Rv
Real-space unit vectors.
Scalar_t Volume
Physical properties of a supercell.
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
void diagonal(const T &rhs)
Definition: Tensor.h:205
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

◆ TEST_CASE() [156/537]

qmcplusplus::TEST_CASE ( "SpaceGridInputs::parseXML::invalid"  ,
""  [estimators] 
)

Definition at line 37 of file test_SpaceGridInput.cpp.

References doc, Libxml2Document::getRoot(), node, okay, Libxml2Document::parseFromString(), REQUIRE(), and ValidSpinDensityInput::xml.

38 {
40  for (auto input_xml : input::xml)
41  {
43  bool okay = doc.parseFromString(input_xml);
44  REQUIRE(okay);
45  xmlNodePtr node = doc.getRoot();
46 
47  auto constructBadSpaceGrid = [](xmlNodePtr cur) { SpaceGridInput spi(cur); };
48  CHECK_THROWS_AS(constructBadSpaceGrid(node), UniformCommunicateError);
49  }
50 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
testing::ValidSpinDensityInput input

◆ TEST_CASE() [157/537]

qmcplusplus::TEST_CASE ( "BSpline builder Jastrow J2"  ,
""  [wavefunction] 
)

Definition at line 38 of file test_J2_bspline.cpp.

References ParticleSet::acceptMove(), SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), app_log(), RadialJastrowBuilder::buildComponent(), CHECK(), OHMMS::Controller, ParticleSet::create(), BsplineFunctor< REAL >::CuspValue, BsplineFunctor< REAL >::DeltaR, doc, Dot(), BsplineFunctor< REAL >::evaluate(), ParticleSet::G, Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), ParticleSet::getTotalNum(), ParticleSet::L, qmcplusplus::Units::distance::m, ParticleSet::makeMove(), VirtualParticleSet::makeMoves(), ParticleSet::makeVirtualMoves(), qmcplusplus::Units::force::N, n, BsplineFunctor< REAL >::NumParams, OHMMS_DIM, okay, Libxml2Document::parseFromString(), ParticleSet::R, ParticleSet::rejectMove(), REQUIRE(), ParticleSet::resetGroups(), Vector< T, Alloc >::resize(), ParticleSet::setName(), Sum(), and ParticleSet::update().

39 {
41 
42  const SimulationCell simulation_cell;
43  ParticleSet ions_(simulation_cell);
44  ParticleSet elec_(simulation_cell);
45 
46  ions_.setName("ion");
47  ions_.create({1});
48  ions_.R[0] = {2.0, 0.0, 0.0};
49  elec_.setName("elec");
50  elec_.create({1, 1});
51  elec_.R[0] = {1.00, 0.0, 0.0};
52  elec_.R[1] = {0.0, 0.0, 0.0};
53  SpeciesSet& tspecies = elec_.getSpeciesSet();
54  int upIdx = tspecies.addSpecies("u");
55  int downIdx = tspecies.addSpecies("d");
56  int chargeIdx = tspecies.addAttribute("charge");
57  tspecies(chargeIdx, upIdx) = -1;
58  tspecies(chargeIdx, downIdx) = -1;
59  elec_.resetGroups();
60 
61  const char* particles = R"(<tmp>
62 <jastrow name="J2" type="Two-Body" function="Bspline" print="yes" gpu="no">
63  <correlation rcut="10" size="10" speciesA="u" speciesB="d">
64  <coefficients id="ud" type="Array"> 0.02904699284 -0.1004179 -0.1752703883 -0.2232576505 -0.2728029201 -0.3253286875 -0.3624525145 -0.3958223107 -0.4268582166 -0.4394531176</coefficients>
65  </correlation>
66 </jastrow>
67 </tmp>
68 )";
70  bool okay = doc.parseFromString(particles);
71  REQUIRE(okay);
72 
73  xmlNodePtr root = doc.getRoot();
74 
75  xmlNodePtr jas1 = xmlFirstElementChild(root);
76 
77  RadialJastrowBuilder jastrow(c, elec_);
78 
79  using J2Type = TwoBodyJastrow<BsplineFunctor<RealType>>;
80  auto j2_uptr = jastrow.buildComponent(jas1);
81  J2Type* j2 = dynamic_cast<J2Type*>(j2_uptr.get());
82  REQUIRE(j2);
83 
84  // update all distance tables
85  elec_.update();
86 
87  double logpsi_real = std::real(j2->evaluateLog(elec_, elec_.G, elec_.L));
88  CHECK(logpsi_real == Approx(0.1012632641)); // note: number not validated
89 
90  double KE = -0.5 * (Dot(elec_.G, elec_.G) + Sum(elec_.L));
91  CHECK(KE == Approx(-0.1616624771)); // note: number not validated
92 
93  UniqueOptObjRefs opt_obj_refs;
94  j2->extractOptimizableObjectRefs(opt_obj_refs);
95  REQUIRE(opt_obj_refs.size() == 1);
96 
97  opt_variables_type optvars;
98  Vector<WaveFunctionComponent::ValueType> dlogpsi;
99  Vector<WaveFunctionComponent::ValueType> dhpsioverpsi;
100 
101  for (OptimizableObject& obj : opt_obj_refs)
102  obj.checkInVariablesExclusive(optvars);
103  optvars.resetIndex();
104  const int NumOptimizables(optvars.size());
105  j2->checkOutVariables(optvars);
106  dlogpsi.resize(NumOptimizables);
107  dhpsioverpsi.resize(NumOptimizables);
108  j2->evaluateDerivatives(elec_, optvars, dlogpsi, dhpsioverpsi);
109 
110  app_log() << std::endl << "reporting dlogpsi and dhpsioverpsi" << std::scientific << std::endl;
111  for (int iparam = 0; iparam < NumOptimizables; iparam++)
112  app_log() << "param=" << iparam << " : " << dlogpsi[iparam] << " " << dhpsioverpsi[iparam] << std::endl;
113  app_log() << std::endl;
114 
115  CHECK(std::real(dlogpsi[2]) == Approx(-0.2211666667));
116  CHECK(std::real(dhpsioverpsi[3]) == Approx(0.1331717179));
117 
118 
119  // now test evaluateHessian
120  WaveFunctionComponent::HessVector grad_grad_psi;
121  grad_grad_psi.resize(elec_.getTotalNum());
122  grad_grad_psi = 0.0;
123 
124  app_log() << "eval hess" << std::endl;
125  j2->evaluateHessian(elec_, grad_grad_psi);
126  std::vector<double> hess_values = {
127  -0.0627236, 0, 0, 0, 0.10652, 0, 0, 0, 0.10652, -0.0627236, 0, 0, 0, 0.10652, 0, 0, 0, 0.10652,
128  };
129 
130  int m = 0;
131  for (int n = 0; n < elec_.getTotalNum(); n++)
132  for (int i = 0; i < OHMMS_DIM; i++)
133  for (int j = 0; j < OHMMS_DIM; j++, m++)
134  {
135  CHECK(std::real(grad_grad_psi[n](i, j)) == Approx(hess_values[m]));
136  }
137 
138 
139  struct JValues
140  {
141  double r;
142  double u;
143  double du;
144  double ddu;
145  };
146 
147  // Cut and paste from output of gen_bspline_jastrow.py
148  const int N = 20;
149  JValues Vals[N] = {{0.00, 0.1374071801, -0.5, 0.7866949593},
150  {0.60, -0.04952403966, -0.1706645865, 0.3110897524},
151  {1.20, -0.121361995, -0.09471371432, 0.055337302},
152  {1.80, -0.1695590431, -0.06815900213, 0.0331784053},
153  {2.40, -0.2058414025, -0.05505192964, 0.01049597156},
154  {3.00, -0.2382237097, -0.05422744821, -0.002401552969},
155  {3.60, -0.2712606182, -0.05600918024, -0.003537553803},
156  {4.20, -0.3047843679, -0.05428535477, 0.0101841028},
157  {4.80, -0.3347515004, -0.04506573714, 0.01469003611},
158  {5.40, -0.3597048574, -0.03904232165, 0.005388015505},
159  {6.00, -0.3823503292, -0.03657502025, 0.003511355265},
160  {6.60, -0.4036800017, -0.03415678101, 0.007891305516},
161  {7.20, -0.4219818468, -0.02556305518, 0.02075444724},
162  {7.80, -0.4192355508, 0.06799438701, 0.3266190181},
163  {8.40, -0.3019238309, 0.32586994, 0.2880861726},
164  {9.00, -0.09726352421, 0.2851358014, -0.4238666348},
165  {9.60, -0.006239062395, 0.04679296796, -0.2339648398},
166  {10.20, 0, 0, 0},
167  {10.80, 0, 0, 0},
168  {11.40, 0, 0, 0}};
169 
170 
171  BsplineFunctor<RealType>* bf = j2->getPairFunctions()[0];
172 
173  for (int i = 0; i < N; i++)
174  {
175  RealType dv = 0.0;
176  RealType ddv = 0.0;
177  RealType val = bf->evaluate(Vals[i].r, dv, ddv);
178  CHECK(Vals[i].u == Approx(val));
179  CHECK(Vals[i].du == Approx(dv));
180  CHECK(Vals[i].ddu == Approx(ddv));
181  }
182 
183 #ifdef PRINT_SPLINE_DATA
184  // write out values of the Bspline functor
185  //BsplineFunctor<double> *bf = j2->F[0];
186  printf("NumParams = %d\n", bf->NumParams);
187  printf("CuspValue = %g\n", bf->CuspValue);
188  printf("DeltaR = %g\n", bf->DeltaR);
189  printf("SplineCoeffs size = %d\n", bf->SplineCoefs.size());
190  for (int j = 0; j < bf->SplineCoefs.size(); j++)
191  {
192  printf("%d %g\n", j, bf->SplineCoefs[j]);
193  }
194  printf("\n");
195 
196  for (int i = 0; i < 20; i++)
197  {
198  double r = 0.6 * i;
199  elec_.R[0][0] = r;
200  elec_.update();
201  double logpsi_real = std::real(j2->evaluateLog(elec_, elec_.G, elec_.L));
202  //double alt_val = bf->evaluate(r);
203  double dv = 0.0;
204  double ddv = 0.0;
205  double alt_val = bf->evaluate(r, dv, ddv);
206  printf("%g %g %g %g %g\n", r, logpsi_real, alt_val, dv, ddv);
207  }
208 #endif
209 
211  using PosType = QMCTraits::PosType;
212 
213  // set virtutal particle position
214  PosType newpos(0.3, 0.2, 0.5);
215 
216  elec_.makeVirtualMoves(newpos);
217  std::vector<ValueType> ratios(elec_.getTotalNum());
218  j2->evaluateRatiosAlltoOne(elec_, ratios);
219 
220  CHECK(std::real(ratios[0]) == Approx(0.9522052017));
221  CHECK(std::real(ratios[1]) == Approx(0.9871985577));
222 
223  elec_.makeMove(0, newpos - elec_.R[0]);
224  PsiValue ratio_0 = j2->ratio(elec_, 0);
225  elec_.rejectMove(0);
226 
227  CHECK(std::real(ratio_0) == Approx(0.9522052017));
228 
229  VirtualParticleSet VP(elec_, 2);
230  std::vector<PosType> newpos2(2);
231  std::vector<ValueType> ratios2(2);
232  newpos2[0] = newpos - elec_.R[1];
233  newpos2[1] = PosType(0.2, 0.5, 0.3) - elec_.R[1];
234  VP.makeMoves(elec_, 1, newpos2);
235  j2->evaluateRatios(VP, ratios2);
236 
237  CHECK(std::real(ratios2[0]) == Approx(0.9871985577));
238  CHECK(std::real(ratios2[1]) == Approx(0.9989268241));
239 
240  //test acceptMove
241  elec_.makeMove(1, newpos - elec_.R[1]);
242  PsiValue ratio_1 = j2->ratio(elec_, 1);
243  j2->acceptMove(elec_, 1);
244  elec_.acceptMove(1);
245 
246  CHECK(std::real(ratio_1) == Approx(0.9871985577));
247  CHECK(std::real(j2->get_log_value()) == Approx(0.0883791773));
248 }
T Sum(const ParticleAttrib< T > &pa)
class that handles xmlDoc
Definition: Libxml2Doc.h:76
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
QMCTraits::RealType real
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
void resetIndex()
reset Index
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
#define OHMMS_DIM
Definition: config.h:64
T Dot(const ParticleAttrib< TinyVector< T, D >> &pa, const ParticleAttrib< TinyVector< T, D >> &pb)
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [158/537]

qmcplusplus::TEST_CASE ( "complex_helper"  ,
""  [type_traits] 
)

Definition at line 38 of file test_complex_helper.cpp.

References TestComplexHelper< P >::run().

39 {
40  TestComplexHelper<float> float_test;
41  float_test.run();
42  TestComplexHelper<double> double_test;
43  double_test.run();
44 }

◆ TEST_CASE() [159/537]

qmcplusplus::TEST_CASE ( "SpaceWarp"  ,
""  [hamiltonian] 
)

Definition at line 38 of file test_spacewarp.cpp.

References ParticleSet::addTable(), app_log(), CHECK(), SpaceWarpTransformation::computeSWT(), OHMMS::Controller, SpaceWarpTransformation::df(), doc, SpaceWarpTransformation::f(), ParticleSet::G, Libxml2Document::getRoot(), ParticleSet::getTotalNum(), Libxml2Document::getXPathContext(), ParticleSet::groups(), okay, Libxml2Document::parse(), ParticleSet::R, XMLParticleParser::readXML(), REQUIRE(), SpaceWarpTransformation::setPow(), Vector< T, Alloc >::size(), and ParticleSet::update().

39 {
41 
43  bool okay = doc.parse("Na2.structure.xml");
44  REQUIRE(okay);
45  xmlNodePtr root = doc.getRoot();
46 
47  const SimulationCell simulation_cell;
48 
49  ParticleSet ions(simulation_cell);
50  XMLParticleParser parse_ions(ions);
51  OhmmsXPathObject particleset_ion("//particleset[@name='ion0']", doc.getXPathContext());
52  REQUIRE(particleset_ion.size() == 1);
53  parse_ions.readXML(particleset_ion[0]);
54 
55  REQUIRE(ions.groups() == 1);
56  REQUIRE(ions.R.size() == 2);
57  ions.update();
58 
59  ParticleSet elec(simulation_cell);
60  XMLParticleParser parse_elec(elec);
61  OhmmsXPathObject particleset_elec("//particleset[@name='e']", doc.getXPathContext());
62  REQUIRE(particleset_elec.size() == 1);
63  parse_elec.readXML(particleset_elec[0]);
64 
65  REQUIRE(elec.groups() == 2);
66  REQUIRE(elec.R.size() == 2);
67 
68  elec.addTable(ions);
69  elec.update();
70 
71  //Now build the wavefunction. This will be needed to test \Nabla_i E_L and \Nabla_i logPsi contributions.
72  //For now, just take them from a reference calculation.
73 
74  using Force_t = ParticleSet::ParticlePos;
75  Force_t dE_L;
76  Force_t el_contribution;
77  Force_t psi_contribution;
78 
79  dE_L.resize(elec.getTotalNum());
80  el_contribution.resize(ions.getTotalNum());
81  psi_contribution.resize(ions.getTotalNum());
82 
83  dE_L[0][0] = -0.0328339806050;
84  dE_L[0][1] = -0.0834441565340;
85  dE_L[0][2] = 0.0997813066140;
86  dE_L[1][0] = -0.0140597469190;
87  dE_L[1][1] = 0.0591827022730;
88  dE_L[1][2] = -0.0622852142310;
89 
90  elec.G[0][0] = 0.4167938814700;
91  elec.G[0][1] = 0.2878426639600;
92  elec.G[0][2] = -0.3470187402100;
93  elec.G[1][0] = -0.2946265813200;
94  elec.G[1][1] = -0.3606166249000;
95  elec.G[1][2] = 0.3751881159300;
96 
97  SpaceWarpTransformation swt(elec, ions);
98  swt.setPow(3.0);
99 
100  CHECK(swt.f(2.0) == Approx(0.125));
101  CHECK(swt.df(2.0) == Approx(-0.1875));
102 
103  swt.setPow(4.0);
104  CHECK(swt.f(2.0) == Approx(0.0625));
105  CHECK(swt.df(2.0) == Approx(-0.125));
106 
107  swt.computeSWT(elec, ions, dE_L, elec.G, el_contribution, psi_contribution);
108  app_log() << "EL_Contribution: " << el_contribution << std::endl;
109  app_log() << "PSi_Contribution: " << psi_contribution << std::endl;
110  CHECK(el_contribution[0][0] == Approx(-0.0326934696861));
111  CHECK(el_contribution[0][1] == Approx(-0.0826080664130));
112  CHECK(el_contribution[0][2] == Approx(0.0988243408507));
113  CHECK(el_contribution[1][0] == Approx(-0.0142002578379));
114  CHECK(el_contribution[1][1] == Approx(0.0583466121520));
115  CHECK(el_contribution[1][2] == Approx(-0.0613282484677));
116 
117  CHECK(psi_contribution[0][0] == Approx(0.4051467191368));
118  CHECK(psi_contribution[0][1] == Approx(0.2757724717133));
119  CHECK(psi_contribution[0][2] == Approx(-0.3334287440127));
120  CHECK(psi_contribution[1][0] == Approx(-0.2829794189868));
121  CHECK(psi_contribution[1][1] == Approx(-0.3485464326533));
122  CHECK(psi_contribution[1][2] == Approx(0.3615981197327));
123 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180

◆ TEST_CASE() [160/537]

qmcplusplus::TEST_CASE ( "SYCL_host_allocator"  ,
""  [SYCL] 
)

Definition at line 39 of file test_SYCLallocator.cpp.

References CHECK(), Vector< T, Alloc >::data(), getSYCLDefaultDeviceDefaultQueue(), and queue.

40 {
41  sycl::queue m_queue = getSYCLDefaultDeviceDefaultQueue();
42  // SYCLHostAllocator
43  Vector<double, SYCLHostAllocator<double>> vec(1024, 1);
44 
45  double* V = vec.data();
46  m_queue.parallel_for(sycl::range<1>{1024}, [=](sycl::id<1> item) { V[item] += item + 1; }).wait();
47 
48  CHECK(vec[0] == 2);
49  CHECK(vec[77] == 79);
50 }
sycl::queue & getSYCLDefaultDeviceDefaultQueue()
return a reference to the per-device default queue
Definition: SYCLruntime.cpp:18
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [161/537]

qmcplusplus::TEST_CASE ( "BSpline functor zero"  ,
""  [wavefunction] 
)

Definition at line 39 of file test_J1_bspline.cpp.

References BsplineFunctor< REAL >::evaluate(), and REQUIRE().

40 {
41  // What is being tested here is different depending on QMC_MIXED_PRECISION
42  // double with either match the real_type of the OptimizableFunctorBase or not
43  BsplineFunctor<double> bf("test_functor");
44 
45  double r = 1.2;
46  double u = bf.evaluate(r);
47  REQUIRE(u == 0.0);
48 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [162/537]

qmcplusplus::TEST_CASE ( "spline_function_2"  ,
""  [numerics] 
)

Definition at line 39 of file test_one_dim_cubic_spline.cpp.

References CHECK(), CubicSplineSolve(), qmcplusplus::Units::charge::e, and n.

40 {
41  const int n = 3;
42  double x[n] = {0.0, 1.0, 2.0};
43  double y[n] = {1.0, 2.0, 1.5};
44  double y2[n];
45 
46  CubicSplineSolve(x, y, n, 1e+33, 1.0, y2);
47 
48  CHECK(y2[0] == Approx(0));
49  CHECK(y2[1] == Approx(-3.85714));
50  CHECK(y2[2] == Approx(6.42857));
51 }
void CubicSplineSolve(T const *x, T const *y, int n, T yp0, T ypn, T *y2)
Solve for second derivatives for cubic splines.
Definition: SplineSolvers.h:33
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [163/537]

qmcplusplus::TEST_CASE ( "ReferencePointsInput::parseXML::invalid"  ,
""  [estimators] 
)

Definition at line 39 of file test_ReferencePointsInput.cpp.

References doc, Libxml2Document::getRoot(), node, okay, Libxml2Document::parseFromString(), and REQUIRE().

40 {
41  using Input = testing::InvalidReferencePointsInputs;
42  for (auto input_xml : Input::xml)
43  {
45  bool okay = doc.parseFromString(input_xml);
46  REQUIRE(okay);
47  xmlNodePtr node = doc.getRoot();
48 
49  auto constructBadRefPoints = [](xmlNodePtr cur) { ReferencePointsInput rpi(cur); };
50  CHECK_THROWS_AS(constructBadRefPoints(node), UniformCommunicateError);
51  }
52 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [164/537]

qmcplusplus::TEST_CASE ( "DiracMatrixComputeOMPTarget_different_batch_sizes"  ,
""  [wavefunction][fermion] 
)

Definition at line 40 of file test_DiracMatrixComputeOMPTarget.cpp.

References qmcplusplus::Units::distance::A, CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), qmcplusplus::syclBLAS::copy_n(), Matrix< T, Alloc >::data(), DiracMatrixComputeOMPTarget< VALUE_FP >::invert_transpose(), log_values(), DiracMatrixComputeOMPTarget< VALUE_FP >::mw_invertTranspose(), queue, and Matrix< T, Alloc >::resize().

41 {
42  OffloadPinnedMatrix<double> mat_a;
43  mat_a.resize(4, 4);
44  std::vector<double> A{2, 5, 8, 7, 5, 2, 2, 8, 7, 5, 6, 6, 5, 4, 4, 8};
45  std::copy_n(A.data(), 16, mat_a.data());
46  OffloadPinnedVector<std::complex<double>> log_values;
47  log_values.resize(1);
48  OffloadPinnedMatrix<double> inv_mat_a;
49  inv_mat_a.resize(4, 4);
50  DiracMatrixComputeOMPTarget<double> dmc_omp;
51 
52  compute::Queue<PlatformKind::OMPTARGET> queue;
53  std::complex<double> log_value;
54  dmc_omp.invert_transpose(queue, mat_a, inv_mat_a, log_value);
55  CHECK(log_value == LogComplexApprox(std::complex<double>{5.267858159063328, 6.283185307179586}));
56 
57 
58  OffloadPinnedMatrix<double> mat_b;
59  mat_b.resize(4, 4);
60  double invA[16]{-0.08247423, -0.26804124, 0.26804124, 0.05154639, 0.18556701, -0.89690722, 0.39690722, 0.13402062,
61  0.24742268, -0.19587629, 0.19587629, -0.15463918, -0.29896907, 1.27835052, -0.77835052, 0.06185567};
62  std::copy_n(invA, 16, mat_b.data());
63 
64  auto check_matrix_result = checkMatrix(inv_mat_a, mat_b);
65  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
66 
67  OffloadPinnedMatrix<double> mat_a2;
68  mat_a2.resize(4, 4);
69  std::copy_n(A.begin(), 16, mat_a2.data());
70  OffloadPinnedMatrix<double> inv_mat_a2;
71  inv_mat_a2.resize(4, 4);
72 
73  RefVector<const OffloadPinnedMatrix<double>> a_mats{mat_a, mat_a2};
74  RefVector<OffloadPinnedMatrix<double>> inv_a_mats{inv_mat_a, inv_mat_a2};
75 
76  log_values.resize(2);
77  dmc_omp.mw_invertTranspose(queue, a_mats, inv_a_mats, log_values);
78 
79  check_matrix_result = checkMatrix(inv_mat_a, mat_b);
80  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
81  check_matrix_result = checkMatrix(inv_mat_a2, mat_b);
82  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
83 
84  CHECK(log_values[0] == ComplexApprox(std::complex<double>{5.267858159063328, 6.283185307179586}));
85  CHECK(log_values[1] == ComplexApprox(std::complex<double>{5.267858159063328, 6.283185307179586}));
86 
87  OffloadPinnedMatrix<double> mat_a3;
88  mat_a3.resize(4, 4);
89  std::copy_n(A.begin(), 16, mat_a3.data());
90  OffloadPinnedMatrix<double> inv_mat_a3;
91  inv_mat_a3.resize(4, 4);
92 
93  a_mats[1] = mat_a3;
94 
95  RefVector<const OffloadPinnedMatrix<double>> a_mats3{mat_a, mat_a2, mat_a3};
96  RefVector<OffloadPinnedMatrix<double>> inv_a_mats3{inv_mat_a, inv_mat_a2, inv_mat_a3};
97 
98  log_values.resize(3);
99  dmc_omp.mw_invertTranspose(queue, a_mats3, inv_a_mats3, log_values);
100 
101  check_matrix_result = checkMatrix(inv_mat_a, mat_b);
102  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
103  check_matrix_result = checkMatrix(inv_mat_a2, mat_b);
104  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
105  check_matrix_result = checkMatrix(inv_mat_a3, mat_b);
106  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
107 
108  CHECK(log_values[0] == ComplexApprox(std::complex<double>{5.267858159063328, 6.283185307179586}));
109  CHECK(log_values[1] == ComplexApprox(std::complex<double>{5.267858159063328, 6.283185307179586}));
110  CHECK(log_values[2] == ComplexApprox(std::complex<double>{5.267858159063328, 6.283185307179586}));
111 }
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
Catch::Detail::LogComplexApprox LogComplexApprox
sycl::event copy_n(sycl::queue &aq, const T1 *restrict VA, size_t array_size, T2 *restrict VC, const std::vector< sycl::event > &events)
Definition: syclBLAS.cpp:548
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [165/537]

qmcplusplus::TEST_CASE ( "RotatedSPOs via SplineR2R ,
""  [wavefunction] 
)

Definition at line 40 of file test_RotatedSPOs.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), CHECK(), OHMMS::Controller, ParticleSet::create(), EinsplineSetBuilder::createSPOSetFromXML(), doc, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), lattice, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), and Vector< T, Alloc >::size().

41 {
43 
44  /*
45  BEGIN Boilerplate stuff to make a simple SPOSet. Copied from test_einset.cpp
46  */
47 
49 
50  // We get a "Mismatched supercell lattices" error due to default ctor?
51  ParticleSet::ParticleLayout lattice;
52 
53  // diamondC_1x1x1
54  lattice.R = {3.37316115, 3.37316115, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
55 
56  ParticleSetPool ptcl = ParticleSetPool(c);
57  ptcl.setSimulationCell(lattice);
58  // LAttice seems fine after this point...
59 
60  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
61  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
62  ParticleSet& ions_(*ions_uptr);
63  ParticleSet& elec_(*elec_uptr);
64 
65  ions_.setName("ion");
66  ptcl.addParticleSet(std::move(ions_uptr));
67  ions_.create({2});
68  ions_.R[0] = {0.0, 0.0, 0.0};
69  ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
70  elec_.setName("elec");
71  ptcl.addParticleSet(std::move(elec_uptr));
72  elec_.create({2});
73  elec_.R[0] = {0.0, 0.0, 0.0};
74  elec_.R[1] = {0.0, 1.0, 0.0};
75  SpeciesSet& tspecies = elec_.getSpeciesSet();
76  int upIdx = tspecies.addSpecies("u");
77  int chargeIdx = tspecies.addAttribute("charge");
78  tspecies(chargeIdx, upIdx) = -1;
79 
80  //diamondC_1x1x1 - 8 bands available
81  const char* particles = R"(<tmp>
82 <determinantset type="einspline" href="diamondC_1x1x1.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.0" precision="float" size="8"/>
83 </tmp>
84 )";
85 
87  bool okay = doc.parseFromString(particles);
88  REQUIRE(okay);
89 
90  xmlNodePtr root = doc.getRoot();
91 
92  xmlNodePtr ein1 = xmlFirstElementChild(root);
93 
94  EinsplineSetBuilder einSet(elec_, ptcl.getPool(), c, ein1);
95  auto spo = einSet.createSPOSetFromXML(ein1);
96  REQUIRE(spo);
97 
98  /*
99  END Boilerplate stuff. Now we have a SplineR2R wavefunction
100  ready for rotation. What follows is the actual test.
101  */
102 
103  // SplineR2R only for the moment, so skip if QMC_COMPLEX is set
104 #if !defined(QMC_COMPLEX)
105 
106  spo->storeParamsBeforeRotation();
107  // 1.) Make a RotatedSPOs object so that we can use the rotation routines
108  auto rot_spo = std::make_unique<RotatedSPOs>("one_rotated_set", std::move(spo));
109 
110  // Sanity check for orbs. Expect 2 electrons, 8 orbitals, & 79507 coefs/orb.
111  const auto orbitalsetsize = rot_spo->getOrbitalSetSize();
112  REQUIRE(orbitalsetsize == 8);
113 
114  // 2.) Get data for unrotated orbitals. Check that there's no rotation
115  rot_spo->buildOptVariables(elec_.R.size());
116  SPOSet::ValueMatrix psiM_bare(elec_.R.size(), orbitalsetsize);
117  SPOSet::GradMatrix dpsiM_bare(elec_.R.size(), orbitalsetsize);
118  SPOSet::ValueMatrix d2psiM_bare(elec_.R.size(), orbitalsetsize);
119  rot_spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM_bare, dpsiM_bare, d2psiM_bare);
120 
121  // This stuff checks that no rotation was applied. Copied from test_einset.cpp.
122  // value
123  CHECK(std::real(psiM_bare[1][0]) == Approx(-0.8886948824));
124  CHECK(std::real(psiM_bare[1][1]) == Approx(1.4194120169));
125  // grad
126  CHECK(std::real(dpsiM_bare[1][0][0]) == Approx(-0.0000183403));
127  CHECK(std::real(dpsiM_bare[1][0][1]) == Approx(0.1655139178));
128  CHECK(std::real(dpsiM_bare[1][0][2]) == Approx(-0.0000193077));
129  CHECK(std::real(dpsiM_bare[1][1][0]) == Approx(-1.3131694794));
130  CHECK(std::real(dpsiM_bare[1][1][1]) == Approx(-1.1174004078));
131  CHECK(std::real(dpsiM_bare[1][1][2]) == Approx(-0.8462534547));
132  // lapl
133  CHECK(std::real(d2psiM_bare[1][0]) == Approx(1.3313053846));
134  CHECK(std::real(d2psiM_bare[1][1]) == Approx(-4.712583065));
135 
136  /*
137  3.) Apply a rotation to the orbitals
138  To do this, construct a params vector and call the
139  RotatedSPOs::apply_rotation(params) method. That should do the
140  right thing for this particular spline class.
141 
142  For 2 electrons in 8 orbs, we expect 2*(8-2) = 12 params.
143  */
144  const auto rot_size = rot_spo->m_act_rot_inds_.size();
145  REQUIRE(rot_size == 12); // = Nelec*(Norbs - Nelec) = 2*(8-2) = 12
146  std::vector<RealType> param(rot_size);
147  for (auto i = 0; i < rot_size; i++)
148  {
149  param[i] = 0.01 * static_cast<RealType>(i);
150  }
151  rot_spo->apply_rotation(param, false); // Expect this to call SplineR2R::applyRotation()
152 
153  // 4.) Get data for rotated orbitals.
154  SPOSet::ValueMatrix psiM_rot(elec_.R.size(), orbitalsetsize);
155  SPOSet::GradMatrix dpsiM_rot(elec_.R.size(), orbitalsetsize);
156  SPOSet::ValueMatrix d2psiM_rot(elec_.R.size(), orbitalsetsize);
157  rot_spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM_rot, dpsiM_rot, d2psiM_rot);
158 
159  /*
160  Manually encode the unitary transformation. Ugly, but it works.
161  @TODO: Use the total rotation machinery when it's implemented
162 
163  NB: This is truncated to 5 sig-figs, so there is some slop here as
164  compared to what is done in the splines via apply_rotation().
165  So below we reduce the threshold for comparison. This can
166  probably be ditched once we have a way to grab the actual
167  rotation matrix...
168  */
169  SPOSet::ValueMatrix rot_mat(orbitalsetsize, orbitalsetsize);
170  rot_mat[0][0] = 0.99726;
171  rot_mat[0][1] = -0.00722;
172  rot_mat[0][2] = 0.00014;
173  rot_mat[0][3] = -0.00982;
174  rot_mat[0][4] = -0.01979;
175  rot_mat[0][5] = -0.02976;
176  rot_mat[0][6] = -0.03972;
177  rot_mat[0][7] = -0.04969;
178  rot_mat[1][0] = -0.00722;
179  rot_mat[1][1] = 0.97754;
180  rot_mat[1][2] = -0.05955;
181  rot_mat[1][3] = -0.06945;
182  rot_mat[1][4] = -0.07935;
183  rot_mat[1][5] = -0.08925;
184  rot_mat[1][6] = -0.09915;
185  rot_mat[1][7] = -0.10905;
186  rot_mat[2][0] = -0.00014;
187  rot_mat[2][1] = 0.05955;
188  rot_mat[2][2] = 0.99821;
189  rot_mat[2][3] = -0.00209;
190  rot_mat[2][4] = -0.00239;
191  rot_mat[2][5] = -0.00269;
192  rot_mat[2][6] = -0.00299;
193  rot_mat[2][7] = -0.00329;
194  rot_mat[3][0] = 0.00982;
195  rot_mat[3][1] = 0.06945;
196  rot_mat[3][2] = -0.00209;
197  rot_mat[3][3] = 0.99751;
198  rot_mat[3][4] = -0.00289;
199  rot_mat[3][5] = -0.00329;
200  rot_mat[3][6] = -0.00368;
201  rot_mat[3][7] = -0.00408;
202  rot_mat[4][0] = 0.01979;
203  rot_mat[4][1] = 0.07935;
204  rot_mat[4][2] = -0.00239;
205  rot_mat[4][3] = -0.00289;
206  rot_mat[4][4] = 0.99661;
207  rot_mat[4][5] = -0.00388;
208  rot_mat[4][6] = -0.00438;
209  rot_mat[4][7] = -0.00488;
210  rot_mat[5][0] = 0.02976;
211  rot_mat[5][1] = 0.08925;
212  rot_mat[5][2] = -0.00269;
213  rot_mat[5][3] = -0.00329;
214  rot_mat[5][4] = -0.00388;
215  rot_mat[5][5] = 0.99552;
216  rot_mat[5][6] = -0.00508;
217  rot_mat[5][7] = -0.00568;
218  rot_mat[6][0] = 0.03972;
219  rot_mat[6][1] = 0.09915;
220  rot_mat[6][2] = -0.00299;
221  rot_mat[6][3] = -0.00368;
222  rot_mat[6][4] = -0.00438;
223  rot_mat[6][5] = -0.00508;
224  rot_mat[6][6] = 0.99422;
225  rot_mat[6][7] = -0.00647;
226  rot_mat[7][0] = 0.04969;
227  rot_mat[7][1] = 0.10905;
228  rot_mat[7][2] = -0.00329;
229  rot_mat[7][3] = -0.00408;
230  rot_mat[7][4] = -0.00488;
231  rot_mat[7][5] = -0.00568;
232  rot_mat[7][6] = -0.00647;
233  rot_mat[7][7] = 0.99273;
234 
235  // Now compute the expected values by hand using the transformation above
236  double val1 = 0.;
237  double val2 = 0.;
238  for (auto i = 0; i < rot_mat.size1(); i++)
239  {
240  val1 += psiM_bare[0][i] * rot_mat[i][0];
241  val2 += psiM_bare[1][i] * rot_mat[i][0];
242  }
243 
244  // value
245  CHECK(std::real(psiM_rot[0][0]) == Approx(val1));
246  CHECK(std::real(psiM_rot[1][0]) == Approx(val2));
247 
248  std::vector<double> grad1(3);
249  std::vector<double> grad2(3);
250  for (auto j = 0; j < grad1.size(); j++)
251  {
252  for (auto i = 0; i < rot_mat.size1(); i++)
253  {
254  grad1[j] += dpsiM_bare[0][i][j] * rot_mat[i][0];
255  grad2[j] += dpsiM_bare[1][i][j] * rot_mat[i][0];
256  }
257  }
258 
259  // grad
260  CHECK(dpsiM_rot[0][0][0] == Approx(grad1[0]).epsilon(0.0001));
261  CHECK(dpsiM_rot[0][0][1] == Approx(grad1[1]).epsilon(0.0001));
262  CHECK(dpsiM_rot[0][0][2] == Approx(grad1[2]).epsilon(0.0001));
263  CHECK(dpsiM_rot[1][0][0] == Approx(grad2[0]).epsilon(0.0001));
264  CHECK(dpsiM_rot[1][0][1] == Approx(grad2[1]).epsilon(0.0001));
265  CHECK(dpsiM_rot[1][0][2] == Approx(grad2[2]).epsilon(0.0001));
266 
267  double lap1 = 0.;
268  double lap2 = 0.;
269  for (auto i = 0; i < rot_mat.size1(); i++)
270  {
271  lap1 += d2psiM_bare[0][i] * rot_mat[i][0];
272  lap2 += d2psiM_bare[1][i] * rot_mat[i][0];
273  }
274 
275  // Lapl
276  CHECK(std::real(d2psiM_rot[0][0]) == Approx(lap1).epsilon(0.0001));
277  CHECK(std::real(d2psiM_rot[1][0]) == Approx(lap2).epsilon(0.0001));
278 
279 #endif
280 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [166/537]

qmcplusplus::TEST_CASE ( "Spherical Harmonics"  ,
""  [numerics] 
)

Definition at line 40 of file test_ylm.cpp.

References CHECK(), and Ylm().

41 {
42  // l=0 should be 1.0 for all values
44  vec_t v;
45  v[0] = 1.0;
46  v[1] = 0.0;
47  v[2] = 0.0;
48  std::complex<double> out = Ylm(0, 0, v);
49  CHECK(out.real() == Approx(0.28209479177387814)); // Y00 = 1/2 1/sqrt(pi)
50 }
TinyVector< double, 3 > vec_t
std::complex< double > Ylm(int l, int m, const std::vector< double > &sph)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [167/537]

qmcplusplus::TEST_CASE ( "SkAll"  ,
""  [hamiltonian] 
)

Definition at line 40 of file test_SkAllEstimator.cpp.

References SkAllEstimator::addObservables(), ParticleSet::addTable(), app_log(), ParticleSet::Collectables, OHMMS::Controller, doc, SkAllEstimator::evaluate(), SkAllEstimator::get(), ParticleSet::get(), ParticleSet::getDistTable(), OhmmsElementBase::getName(), ParticleSetPool::getParticleSet(), Libxml2Document::getRoot(), ParticleSet::getSimulationCell(), ParticleSet::isSameMass(), lat_xml, Libxml2Document::parseFromString(), ParticleSet::PropertyList, SkAllEstimator::put(), ParticleSetPool::put(), ParticleSet::R, ParticleSetPool::readSimulationCellXML(), REQUIRE(), OperatorBase::setHistories(), and ParticleSet::update().

41 {
42  // Boiler plate setup
43  std::cout << std::fixed;
44  std::cout << std::setprecision(8);
46 
47  Communicate* c;
49 
50  // XML parser
52 
53 
54  /*
55  Minimal xml input blocks
56  */
57  // Lattice block
58  const char* lat_xml = R"(<simulationcell>
59  <parameter name="lattice" units="bohr">
60  2.0 0.0 0.0
61  0.0 2.0 0.0
62  0.0 0.0 2.0
63  </parameter>
64  <parameter name="bconds">
65  p p p
66  </parameter>
67  <parameter name="LR_dim_cutoff" > 6 </parameter>
68  <parameter name="rs" > 1.0 </parameter>
69  <parameter name="nparticles" > 8 </parameter>
70  </simulationcell>)";
71 
72  // Particleset block for the electrons
73  const char* elec_pset_xml = R"(<particleset name="e" random="yes">
74  <group name="u" size="4">
75  <parameter name="charge" > -1 </parameter>
76  <parameter name="mass" > 1.0 </parameter>
77  </group>
78  <group name="d" size="4">
79  <parameter name="charge" > -1 </parameter>
80  <parameter name="mass" > 1.0 </parameter>
81  </group>
82  </particleset>)";
83 
84  // Particleset block for the ions
85  const char* ion_pset_xml = R"(<particleset name="i" size="4">
86  <group name="He">
87  <parameter name="charge" > 2 </parameter>
88  <parameter name="valence" > 2 </parameter>
89  <parameter name="atomicnumber"> 2 </parameter>
90  </group>
91  <attrib name="position" datatype="posArray"
92  condition="1">
93  0.00 0.00 0.00
94  0.25 0.25 0.25
95  0.50 0.50 0.50
96  0.75 0.75 0.75
97  </attrib>
98  <attrib name="ionid" datatype="stringArray">
99  He He He He
100  </attrib>
101  </particleset>)";
102 
103  // SKAllEstimator block, seems that writeionion does nothing?
104  const char* skall_xml = R"(<estimator
105  name="Skall" type="skall"
106  source="i" target="e" hdf5="yes"
107  />)";
108 
109  // Read in xml, add to pset_builder below
110  bool lat_okay = doc.parseFromString(lat_xml);
111  REQUIRE(lat_okay);
112  xmlNodePtr lat_xml_root = doc.getRoot();
113 
114  std::cout << "\n\n\ntest_SkAllEstimator: START\n";
115 
116  // Build a ParticleSetPool - makes ParticleSets
117  ParticleSetPool pset_builder(c, "pset_builder");
118 
119  // First attach the Lattice defined above
120  pset_builder.readSimulationCellXML(lat_xml_root);
121 
122  // Now build the elec ParticleSet
123  bool elec_pset_okay = doc.parseFromString(elec_pset_xml);
124  REQUIRE(elec_pset_okay);
125  xmlNodePtr elec_pset_xml_root = doc.getRoot();
126  pset_builder.put(elec_pset_xml_root);
127 
128  // Get the (now assembled) elec ParticleSet, sanity check, report
129  ParticleSet* elec = pset_builder.getParticleSet("e");
130  REQUIRE(elec->isSameMass());
131  REQUIRE(elec->getName() == "e");
132 
133  // Move the particles manually onto B1 lattice
134  // NB: Spins are grouped contiguously
135  // Up spins
136  elec->R[0][0] = 0.0;
137  elec->R[0][1] = 0.0;
138  elec->R[0][2] = 0.0;
139  elec->R[1][0] = 1.0;
140  elec->R[1][1] = 1.0;
141  elec->R[1][2] = 0.0;
142  elec->R[2][0] = 1.0;
143  elec->R[2][1] = 0.0;
144  elec->R[2][2] = 1.0;
145  elec->R[3][0] = 0.0;
146  elec->R[3][1] = 1.0;
147  elec->R[3][2] = 1.0;
148 
149  // Down spins
150  elec->R[4][0] = 1.0;
151  elec->R[4][1] = 0.0;
152  elec->R[4][2] = 0.0;
153  elec->R[5][0] = 0.0;
154  elec->R[5][1] = 1.0;
155  elec->R[5][2] = 0.0;
156  elec->R[6][0] = 0.0;
157  elec->R[6][1] = 0.0;
158  elec->R[6][2] = 1.0;
159  elec->R[7][0] = 1.0;
160  elec->R[7][1] = 1.0;
161  elec->R[7][2] = 1.0;
162 
163  elec->get(std::cout); // print particleset info to stdout
164 
165 
166  // Get the (now assembled) ion ParticleSet, sanity check, report
167  bool ion_pset_okay = doc.parseFromString(ion_pset_xml);
168  REQUIRE(ion_pset_okay);
169  xmlNodePtr ion_pset_xml_root = doc.getRoot();
170  pset_builder.put(ion_pset_xml_root);
171 
172  // Finally, make the ion ParticleSet, sanity check, report
173  // It seems that we need this only to construct skall, but it
174  // is never used to evaluate the estimator in this test.
175  ParticleSet* ion = pset_builder.getParticleSet("i");
176  REQUIRE(ion->isSameMass());
177  REQUIRE(ion->getName() == "i");
178  ion->get(std::cout); // print particleset info to stdout
179 
180 
181  // Set up the distance table, match expected layout
182  const int ee_table_id = elec->addTable(*elec);
183 
184  const auto& dii(elec->getDistTable(ee_table_id));
185  elec->update(); // distance table evaluation here
186 
187  // Check that the skall xml block is valid
188  bool skall_okay = doc.parseFromString(skall_xml);
189  REQUIRE(skall_okay);
190  xmlNodePtr skall_xml_root = doc.getRoot();
191 
192  // Make a SkAllEstimator, call put() to set up internals
193  SkAllEstimator skall(*ion, *elec);
194  skall.put(skall_xml_root);
195  skall.addObservables(elec->PropertyList, elec->Collectables);
196  skall.get(app_log()); // pretty print settings
197 
198  // Hack to make a walker so that t_walker_ points to something
199  // Only used to set t_walker_->Weight = 1 so that skall->evaluate()
200  // doesn't segfault.
201  // NB: setHistories(dummy) attaches dummy to t_walker_
202  ParticleSet::Walker_t dummy = ParticleSet::Walker_t(1);
203  skall.setHistories(dummy);
204  skall.evaluate(*elec);
205 
206  // s(k) is computed by & held by the ParticleSet. SkAll just
207  // takes that pre-computed s(k) and pulls out rho(k)..
208  // In order to compare to analytic result, need the list
209  // of k-vectors in cartesian coordinates.
210  // Luckily, ParticleSet stores that in SK->getKLists().kpts_cart
211  int nkpts = elec->getSimulationCell().getKLists().numk;
212  std::cout << "\n";
213  std::cout << "SkAll results:\n";
214  std::cout << std::fixed;
215  std::cout << std::setprecision(6);
216  std::cout << std::setw(4) << "i"
217  << " " << std::setw(8) << "kx"
218  << " " << std::setw(8) << "ky"
219  << " " << std::setw(8) << "kz"
220  << " " << std::setw(8) << "rhok_r"
221  << " " << std::setw(8) << "rhok_i"
222  << " " << std::setw(8) << "c.c."
223  << "\n";
224  std::cout << "================================================================\n";
225 
226  // Extract rhok out of Collectables, print values
227  auto rhok = elec->Collectables;
228  std::cout << std::fixed;
229  std::cout << std::setprecision(5);
230  for (int k = 0; k < nkpts; k++)
231  {
232  auto kvec = elec->getSimulationCell().getKLists().kpts_cart[k];
233  RealType kx = kvec[0];
234  RealType ky = kvec[1];
235  RealType kz = kvec[2];
236  RealType rk_r = rhok[nkpts + k];
237  RealType rk_i = rhok[2 * nkpts + k];
238  RealType rk_cc = rhok[k];
239  std::cout << std::setw(4) << k << " " << std::setw(8) << kx << " " << std::setw(8) << ky << " " << std::setw(8)
240  << kz << " " << std::setw(8) << rk_r << " " << std::setw(8) << rk_i << " " << std::setw(8) << rk_cc
241  << "\n";
242  }
243 
244  /*
245  Verify against analytic result:
246  NB: MUST match xml input!!!
247  rho(-1.94889, 0.00000, 0.00000)= 2.52341 + -3.71748i
248  rho( 0.00000, -1.94889, 0.00000)= 2.52341 + -3.71748i
249  rho( 0.00000, 0.00000, -1.94889)= 2.52341 + -3.71748i
250  rho( 0.00000, 0.00000, 1.94889)= 2.52341 + 3.71748i
251  rho( 0.00000, 1.94889, 0.00000)= 2.52341 + 3.71748i
252  rho( 1.94889, 0.00000, 0.00000)= 2.52341 + 3.71748i
253  rho(-1.94889, -1.94889, 0.00000)= -0.93151 + -2.34518i
254  rho(-1.94889, 0.00000, -1.94889)= -0.93151 + -2.34518i
255  rho(-1.94889, 0.00000, 1.94889)= 2.52341 + 0.00000i
256  rho(-1.94889, 1.94889, 0.00000)= 2.52341 + 0.00000i
257  rho( 0.00000, -1.94889, -1.94889)= -0.93151 + -2.34518i
258  rho( 0.00000, -1.94889, 1.94889)= 2.52341 + 0.00000i
259  rho( 0.00000, 1.94889, -1.94889)= 2.52341 + 0.00000i
260  rho( 0.00000, 1.94889, 1.94889)= -0.93151 + 2.34518i
261  rho( 1.94889, -1.94889, 0.00000)= 2.52341 + 0.00000i
262  rho( 1.94889, 0.00000, -1.94889)= 2.52341 + 0.00000i
263  rho( 1.94889, 0.00000, 1.94889)= -0.93151 + 2.34518i
264  rho( 1.94889, 1.94889, 0.00000)= -0.93151 + 2.34518i
265  rho(-1.94889, -1.94889, -1.94889)= -1.38359 + -0.30687i
266  rho(-1.94889, -1.94889, 1.94889)= 0.79595 + -1.17259i
267  rho(-1.94889, 1.94889, -1.94889)= 0.79595 + -1.17259i
268  rho(-1.94889, 1.94889, 1.94889)= 0.79595 + 1.17259i
269  rho( 1.94889, -1.94889, -1.94889)= 0.79595 + -1.17259i
270  rho( 1.94889, -1.94889, 1.94889)= 0.79595 + 1.17259i
271  rho( 1.94889, 1.94889, -1.94889)= 0.79595 + 1.17259i
272  rho( 1.94889, 1.94889, 1.94889)= -1.38359 + 0.30687i
273  */
274 
275  const RealType eps = 1E-04; // tolerance
276  REQUIRE(std::fabs(rhok[26] - 2.52341) < eps);
277  REQUIRE(std::fabs(rhok[52] + 3.71748) < eps);
278  REQUIRE(std::fabs(rhok[26 + 1] - 2.52341) < eps);
279  REQUIRE(std::fabs(rhok[52 + 1] + 3.71748) < eps);
280  REQUIRE(std::fabs(rhok[26 + 2] - 2.52341) < eps);
281  REQUIRE(std::fabs(rhok[52 + 2] + 3.71748) < eps);
282 
283  REQUIRE(std::fabs(rhok[26 + 3] - 2.52341) < eps);
284  REQUIRE(std::fabs(rhok[52 + 3] - 3.71748) < eps);
285  REQUIRE(std::fabs(rhok[26 + 4] - 2.52341) < eps);
286  REQUIRE(std::fabs(rhok[52 + 4] - 3.71748) < eps);
287  REQUIRE(std::fabs(rhok[26 + 5] - 2.52341) < eps);
288  REQUIRE(std::fabs(rhok[52 + 5] - 3.71748) < eps);
289 
290  REQUIRE(std::fabs(rhok[26 + 6] + 0.93151) < eps);
291  REQUIRE(std::fabs(rhok[52 + 6] + 2.34518) < eps);
292  REQUIRE(std::fabs(rhok[26 + 7] + 0.93151) < eps);
293  REQUIRE(std::fabs(rhok[52 + 7] + 2.34518) < eps);
294  REQUIRE(std::fabs(rhok[26 + 8] - 2.52341) < eps);
295  REQUIRE(std::fabs(rhok[52 + 8] - 0.00000) < eps);
296 
297  REQUIRE(std::fabs(rhok[26 + 9] - 2.52341) < eps);
298  REQUIRE(std::fabs(rhok[52 + 9] - 0.00000) < eps);
299  REQUIRE(std::fabs(rhok[26 + 10] + 0.93151) < eps);
300  REQUIRE(std::fabs(rhok[52 + 10] + 2.34518) < eps);
301  REQUIRE(std::fabs(rhok[26 + 11] - 2.52341) < eps);
302  REQUIRE(std::fabs(rhok[52 + 11] - 0.00000) < eps);
303 
304  REQUIRE(std::fabs(rhok[26 + 12] - 2.52341) < eps);
305  REQUIRE(std::fabs(rhok[52 + 12] - 0.00000) < eps);
306  REQUIRE(std::fabs(rhok[26 + 13] + 0.93151) < eps);
307  REQUIRE(std::fabs(rhok[52 + 13] - 2.34518) < eps);
308  REQUIRE(std::fabs(rhok[26 + 14] - 2.52341) < eps);
309  REQUIRE(std::fabs(rhok[52 + 14] - 0.00000) < eps);
310 
311  REQUIRE(std::fabs(rhok[26 + 15] - 2.52341) < eps);
312  REQUIRE(std::fabs(rhok[52 + 15] - 0.00000) < eps);
313  REQUIRE(std::fabs(rhok[26 + 16] + 0.93151) < eps);
314  REQUIRE(std::fabs(rhok[52 + 16] - 2.34518) < eps);
315  REQUIRE(std::fabs(rhok[26 + 17] + 0.93151) < eps);
316  REQUIRE(std::fabs(rhok[52 + 17] - 2.34518) < eps);
317 
318  REQUIRE(std::fabs(rhok[26 + 18] + 1.38359) < eps);
319  REQUIRE(std::fabs(rhok[52 + 18] + 0.30687) < eps);
320  REQUIRE(std::fabs(rhok[26 + 19] - 0.79595) < eps);
321  REQUIRE(std::fabs(rhok[52 + 19] + 1.17259) < eps);
322  REQUIRE(std::fabs(rhok[26 + 20] - 0.79595) < eps);
323  REQUIRE(std::fabs(rhok[52 + 20] + 1.17259) < eps);
324 
325  REQUIRE(std::fabs(rhok[26 + 21] - 0.79595) < eps);
326  REQUIRE(std::fabs(rhok[52 + 21] - 1.17259) < eps);
327  REQUIRE(std::fabs(rhok[26 + 22] - 0.79595) < eps);
328  REQUIRE(std::fabs(rhok[52 + 22] + 1.17259) < eps);
329  REQUIRE(std::fabs(rhok[26 + 23] - 0.79595) < eps);
330  REQUIRE(std::fabs(rhok[52 + 23] - 1.17259) < eps);
331 
332  REQUIRE(std::fabs(rhok[26 + 24] - 0.79595) < eps);
333  REQUIRE(std::fabs(rhok[52 + 24] - 1.17259) < eps);
334  REQUIRE(std::fabs(rhok[26 + 25] + 1.38359) < eps);
335  REQUIRE(std::fabs(rhok[52 + 25] - 0.30687) < eps);
336 
337  std::cout << "test_SkAllEstimator:: STOP\n";
338 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
const char * lat_xml
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [168/537]

qmcplusplus::TEST_CASE ( "MPIExceptionWrapper lambda case"  ,
""  [Utilities] 
)

Definition at line 40 of file test_mpi_exception_wrapper.cpp.

References CHECK(), comm, OHMMS::Controller, and Communicate::size().

41 {
43 
44  MPIExceptionWrapper mew;
45  std::vector<double> test_vec{1, 2, 3, 4};
46  auto lambdaTestFunction = [](Communicate* comm, std::vector<double>& fake_args) {
47  CHECK(fake_args.size() == 4);
48  if (comm->size() != 3)
49  throw std::runtime_error("Bad Rank Count, test_mpi_exception_wrapper can only be run with 3 MPI ranks.");
50  };
51  mew(lambdaTestFunction, comm, test_vec);
52 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
int size() const
return the number of tasks
Definition: Communicate.h:118
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [169/537]

qmcplusplus::TEST_CASE ( "VMC Particle-by-Particle advanceWalkers"  ,
""  [drivers][vmc] 
)

Definition at line 41 of file test_vmc.cpp.

References SpeciesSet::addAttribute(), TrialWaveFunction::addComponent(), QMCHamiltonian::addObservables(), QMCHamiltonian::addOperator(), SpeciesSet::addSpecies(), ParticleSet::addTable(), QMCUpdateBase::advanceWalkers(), WalkerConfigurations::begin(), CHECK(), ParticleSet::create(), MCWalkerConfiguration::createWalkers(), WalkerConfigurations::end(), ParticleSet::getSpeciesSet(), QMCUpdateBase::nAccept, QMCUpdateBase::nReject, ParticleSet::R, TrialWaveFunction::registerData(), REQUIRE(), QMCUpdateBase::resetRun(), MCWalkerConfiguration::resetWalkerProperty(), ParticleSet::setName(), QMCUpdateBase::startBlock(), and ParticleSet::update().

42 {
43  const SimulationCell simulation_cell;
44  ParticleSet ions(simulation_cell);
45  MCWalkerConfiguration elec(simulation_cell);
46 
47  ions.setName("ion");
48  ions.create({1});
49  ions.R[0] = {0.0, 0.0, 0.0};
50  elec.setName("elec");
51  std::vector<int> agroup(1);
52  agroup[0] = 2;
53  elec.create(agroup);
54  elec.R[0] = {1.0, 0.0, 0.0};
55  elec.R[1] = {0.0, 0.0, 1.0};
56  elec.createWalkers(1);
57 
58  SpeciesSet& tspecies = elec.getSpeciesSet();
59  int upIdx = tspecies.addSpecies("u");
60  int chargeIdx = tspecies.addAttribute("charge");
61  int massIdx = tspecies.addAttribute("mass");
62  tspecies(chargeIdx, upIdx) = -1;
63  tspecies(massIdx, upIdx) = 1.0;
64 
65  elec.addTable(ions);
66  elec.update();
67 
68  RuntimeOptions runtime_options;
69  TrialWaveFunction psi(runtime_options);
70  psi.addComponent(std::make_unique<ConstantOrbital>());
71  psi.registerData(elec, elec[0]->DataSet);
72  elec[0]->DataSet.allocate();
73 
74  FakeRandom rg;
75 
76  QMCHamiltonian h;
77  h.addOperator(std::make_unique<BareKineticEnergy>(elec, psi), "Kinetic");
78  h.addObservables(elec); // get double free error on 'h.Observables' w/o this
79 
80  elec.resetWalkerProperty(); // get memory corruption w/o this
81 
82  VMCUpdatePbyP vmc(elec, psi, h, rg);
83  EstimatorManagerBase EM;
84  SimpleFixedNodeBranch branch(0.1, 1);
85  TraceManager TM;
86  DriftModifierUNR DM;
87  vmc.resetRun(&branch, &EM, &TM, &DM);
88  vmc.startBlock(1);
89 
90  VMCUpdatePbyP::WalkerIter_t begin = elec.begin();
91  VMCUpdatePbyP::WalkerIter_t end = elec.end();
92  vmc.advanceWalkers(begin, end, true);
93 
94  // With the constant wavefunction, no moves should be rejected
95  REQUIRE(vmc.nReject == 0);
96  REQUIRE(vmc.nAccept == 2);
97 
98  // Each electron moved sqrt(tau)*gaussian_rng()
99  // See ParticleBase/tests/test_random_seq.cpp for the gaussian random numbers
100  // Values from diffuse.py
101  CHECK(elec.R[0][0] == Approx(0.627670258894097));
102  CHECK(elec.R[0][1] == Approx(0.0));
103  CHECK(elec.R[0][2] == Approx(-0.372329741105903));
104 
105  CHECK(elec.R[1][0] == Approx(0.0));
106  CHECK(elec.R[1][1] == Approx(-0.372329741105903));
107  CHECK(elec.R[1][2] == Approx(1.0));
108 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [170/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A"  ,
""  [hamiltonian] 
)

Definition at line 41 of file test_coulomb_pbcAA.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evalConsts(), CoulombPBCAA::evaluate(), CoulombPBCAA::get_madelung_constant(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, and ParticleSet::setName().

42 {
43  const double vmad_sc = -1.4186487397403098;
44  LRCoulombSingleton::CoulombHandler = 0;
45 
46  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
47  lattice.BoxBConds = true; // periodic
48  lattice.R.diagonal(1.0);
49  lattice.reset();
50 
51  const SimulationCell simulation_cell(lattice);
52  ParticleSet ions(simulation_cell);
53 
54  ions.setName("ion");
55  ions.create({1});
56  ions.R[0] = {0.0, 0.0, 0.0};
57  SpeciesSet& ion_species = ions.getSpeciesSet();
58  int pIdx = ion_species.addSpecies("H");
59  int pChargeIdx = ion_species.addAttribute("charge");
60  ion_species(pChargeIdx, pIdx) = 1;
61  ions.createSK();
62 
63 
64  CoulombPBCAA caa(ions, false, false, false);
65 
66  // Background charge term
67  double consts = caa.evalConsts();
68  CHECK(consts == Approx(-3.1151210154));
69 
70  double val = caa.evaluate(ions);
71  //std::cout << "val = " << val << std::endl;
72  CHECK(val == Approx(vmad_sc));
73 
74  // supercell Madelung energy
75  val = caa.get_madelung_constant();
76  CHECK(val == Approx(vmad_sc));
77 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [171/537]

qmcplusplus::TEST_CASE ( "DMC Particle-by-Particle advanceWalkers ConstantOrbital ,
""  [drivers][dmc] 
)

Definition at line 41 of file test_dmc.cpp.

References SpeciesSet::addAttribute(), TrialWaveFunction::addComponent(), QMCHamiltonian::addObservables(), QMCHamiltonian::addOperator(), SpeciesSet::addSpecies(), ParticleSet::addTable(), QMCUpdateBase::advanceWalkers(), WalkerConfigurations::begin(), CHECK(), ParticleSet::create(), MCWalkerConfiguration::createWalkers(), WalkerConfigurations::end(), ParticleSet::getSpeciesSet(), QMCUpdateBase::nAccept, QMCUpdateBase::nReject, ParticleSet::R, TrialWaveFunction::registerData(), REQUIRE(), QMCUpdateBase::resetRun(), MCWalkerConfiguration::resetWalkerProperty(), ParticleSet::setName(), QMCUpdateBase::startBlock(), and ParticleSet::update().

42 {
43  const SimulationCell simulation_cell;
44  ParticleSet ions(simulation_cell);
45  MCWalkerConfiguration elec(simulation_cell);
46 
47  ions.setName("ion");
48  ions.create({1});
49  ions.R[0] = {0.0, 0.0, 0.0};
50  elec.setName("elec");
51  std::vector<int> agroup(1);
52  agroup[0] = 2;
53  elec.create(agroup);
54  elec.R[0] = {1.0, 0.0, 0.0};
55  elec.R[1] = {0.0, 0.0, 1.0};
56  elec.createWalkers(1);
57 
58  SpeciesSet& tspecies = elec.getSpeciesSet();
59  int upIdx = tspecies.addSpecies("u");
60  int chargeIdx = tspecies.addAttribute("charge");
61  int massIdx = tspecies.addAttribute("mass");
62  tspecies(chargeIdx, upIdx) = -1;
63  tspecies(massIdx, upIdx) = 1.0;
64 
65  elec.addTable(ions);
66  elec.update();
67 
68  RuntimeOptions runtime_options;
69  TrialWaveFunction psi(runtime_options);
70  auto orb_uptr = std::make_unique<ConstantOrbital>();
71  auto orb = orb_uptr.get();
72  psi.addComponent(std::move(orb_uptr));
73  psi.registerData(elec, elec[0]->DataSet);
74  elec[0]->DataSet.allocate();
75 
76  FakeRandom rg;
77 
78  QMCHamiltonian h;
79  h.addOperator(std::make_unique<BareKineticEnergy>(elec, psi), "Kinetic");
80  h.addObservables(elec); // get double free error on 'h.Observables' w/o this
81 
82  elec.resetWalkerProperty(); // get memory corruption w/o this
83 
84  DMCUpdatePbyPWithRejectionFast dmc(elec, psi, h, rg);
85  EstimatorManagerBase EM;
86  double tau = 0.1;
87  SimpleFixedNodeBranch branch(tau, 1);
88  TraceManager TM;
89  DriftModifierUNR DM;
90  dmc.resetRun(&branch, &EM, &TM, &DM);
91  dmc.startBlock(1);
92 
93  DMCUpdatePbyPWithRejectionFast::WalkerIter_t begin = elec.begin();
94  DMCUpdatePbyPWithRejectionFast::WalkerIter_t end = elec.end();
95  dmc.advanceWalkers(begin, end, true);
96 
97  // With the constant wavefunction, no moves should be rejected
98  REQUIRE(dmc.nReject == 0);
99  REQUIRE(dmc.nAccept == 2);
100 
101  // Each electron moved sqrt(tau)*gaussian_rng()
102  // See ParticleBase/tests/test_random_seq.cpp for the gaussian random numbers
103  CHECK(elec.R[0][0] == Approx(0.6276702589209545));
104  CHECK(elec.R[0][1] == Approx(0.0));
105  CHECK(elec.R[0][2] == Approx(-0.3723297410790455));
106 
107  CHECK(elec.R[1][0] == Approx(0.0));
108  CHECK(elec.R[1][1] == Approx(-0.3723297410790455));
109  CHECK(elec.R[1][2] == Approx(1.0));
110 
111 
112  // Check rejection in case of node-crossing
113 
114  orb->FakeGradRatio = -1.0;
115 
116  dmc.advanceWalkers(begin, end, true);
117 #ifdef QMC_COMPLEX
118  REQUIRE(dmc.nReject == 0);
119  REQUIRE(dmc.nAccept == 4);
120 #else
121  // Should be rejected
122  REQUIRE(dmc.nReject == 2);
123  REQUIRE(dmc.nAccept == 2);
124 #endif
125 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [172/537]

qmcplusplus::TEST_CASE ( "VMC"  ,
""  [drivers][vmc] 
)

Definition at line 41 of file test_vmc_driver.cpp.

References CloneManager::acceptRatio(), SpeciesSet::addAttribute(), TrialWaveFunction::addComponent(), QMCHamiltonian::addOperator(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), CloneManager::clearClones(), OHMMS::Controller, ParticleSet::create(), MCWalkerConfiguration::createWalkers(), doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), ParticleSet::getSpeciesSet(), okay, omp_get_max_threads(), Libxml2Document::parseFromString(), QMCDriver::process(), ParticleSet::R, REQUIRE(), MCWalkerConfiguration::resetWalkerProperty(), VMC::run(), Communicate::setName(), ParticleSet::setName(), and ParticleSet::update().

42 {
43  ProjectData project_data;
45  c->setName("test");
46  const SimulationCell simulation_cell;
47  ParticleSet ions(simulation_cell);
48  MCWalkerConfiguration elec(simulation_cell);
49 
50  ions.setName("ion");
51  ions.create({1});
52  ions.R[0] = {0.0, 0.0, 0.0};
53 
54  elec.setName("elec");
55  std::vector<int> agroup(1, 2);
56  elec.create(agroup);
57  elec.R[0] = {1.0, 0.0, 0.0};
58  elec.R[1] = {0.0, 0.0, 1.0};
59  elec.createWalkers(1);
60 
61  SpeciesSet& tspecies = elec.getSpeciesSet();
62  int upIdx = tspecies.addSpecies("u");
63  int chargeIdx = tspecies.addAttribute("charge");
64  int massIdx = tspecies.addAttribute("mass");
65  tspecies(chargeIdx, upIdx) = -1;
66  tspecies(massIdx, upIdx) = 1.0;
67 
68  elec.addTable(ions);
69  elec.update();
70 
71  CloneManager::clearClones();
72 
73  TrialWaveFunction psi(project_data.getRuntimeOptions());
74  psi.addComponent(std::make_unique<ConstantOrbital>());
75  psi.registerData(elec, elec[0]->DataSet);
76  elec[0]->DataSet.allocate();
77 
78  using RNG = RandomBase<QMCTraits::FullPrecRealType>;
79  UPtrVector<RNG> rngs(omp_get_max_threads());
80  for (std::unique_ptr<RNG>& rng : rngs)
81  rng = std::make_unique<FakeRandom<QMCTraits::FullPrecRealType>>();
82 
83  QMCHamiltonian h;
84  h.addOperator(std::make_unique<BareKineticEnergy>(elec, psi), "Kinetic");
85  h.addObservables(elec); // get double free error on 'h.Observables' w/o this
86 
87  elec.resetWalkerProperty(); // get memory corruption w/o this
88 
89  VMC vmc_omp(project_data, elec, psi, h, rngs, c, false);
90 
91  const char* vmc_input = R"(<qmc method="vmc" move="pbyp" checkpoint="-1">
92  <parameter name="substeps">1</parameter>
93  <parameter name="steps">1</parameter>
94  <parameter name="blocks">1</parameter>
95  <parameter name="timestep">0.1</parameter>
96  <parameter name="usedrift">no</parameter>
97  </qmc>
98  )";
100  bool okay = doc.parseFromString(vmc_input);
101  REQUIRE(okay);
102  xmlNodePtr root = doc.getRoot();
103 
104  vmc_omp.process(root); // need to call 'process' for QMCDriver, which in turn calls 'put'
105 
106  vmc_omp.run();
107 
108  // With the constant wavefunction, no moves should be rejected
109  double ar = vmc_omp.acceptRatio();
110  CHECK(ar == Approx(1.0));
111 
112  // Each electron moved sqrt(tau)*gaussian_rng()
113  // See Particle>Base/tests/test_random_seq.cpp for the gaussian random numbers
114  // Values from diffuse.py for moving one step
115 
116  CHECK(elec[0]->R[0][0] == Approx(0.627670258894097));
117  CHECK(elec.R[0][1] == Approx(0.0));
118  CHECK(elec.R[0][2] == Approx(-0.372329741105903));
119 
120  CHECK(elec.R[1][0] == Approx(0.0));
121  CHECK(elec.R[1][1] == Approx(-0.372329741105903));
122  CHECK(elec.R[1][2] == Approx(1.0));
123 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
omp_int_t omp_get_max_threads()
Definition: OpenMP.h:26
REQUIRE(std::filesystem::exists(filename))
void setName(const std::string &aname)
Definition: Communicate.h:129
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
VMC type: vmc, vmc-ptcl, vmc-multiple, vmc-ptcl-multiple.

◆ TEST_CASE() [173/537]

qmcplusplus::TEST_CASE ( "double_1d_grid_functor_vs_n"  ,
""  [numerics] 
)

Definition at line 42 of file test_grid_functor.cpp.

References CHECK(), OneDimGridBase< T, CT >::dh(), OneDimGridBase< T, CT >::dr(), n, REQUIRE(), OneDimGridBase< T, CT >::rmax(), OneDimGridBase< T, CT >::rmin(), LinearGrid< T, CT >::set(), and OneDimGridBase< T, CT >::size().

43 {
44  for (int n = 2; n < 5; n++)
45  {
46  stringstream sec_name;
47  sec_name << "grid size " << n;
48  SECTION(sec_name.str())
49  {
50  LinearGrid<double> grid;
51  grid.set(0.0, 1.0, n);
52  REQUIRE(grid.size() == n);
53  REQUIRE(grid.rmin() == 0.0);
54  REQUIRE(grid.rmax() == 1.0);
55  CHECK(grid.dh() == Approx(1.0 / (n - 1)));
56  CHECK(grid.dr(0) == Approx(1.0 / (n - 1)));
57  }
58  }
59 }
REQUIRE(std::filesystem::exists(filename))
Linear Grid inherets from Grid.
Definition: Grid.h:73
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [174/537]

qmcplusplus::TEST_CASE ( "EstimatorManagerInput::testInserts"  ,
""  [estimators] 
)

Definition at line 42 of file test_EstimatorManagerInput.cpp.

References doc, emi(), Libxml2Document::getRoot(), node, okay, Libxml2Document::parseFromString(), REQUIRE(), EstimatorManagerInputTests::testAppendFromXML(), and ValidSpinDensityInput::xml.

43 {
44  using namespace testing;
45  EstimatorManagerInputTests emit;
46  EstimatorManagerInput emi;
47 
48  {
49  using input = testing::ValidOneBodyDensityMatricesInput;
51  bool okay = doc.parseFromString(input::xml[input::VANILLA]);
52  REQUIRE(okay);
53  xmlNodePtr node = doc.getRoot();
54  emit.testAppendFromXML<OneBodyDensityMatricesInput>(emi, node);
55  }
56  {
58  using spin_input = testing::ValidSpinDensityInput;
59  bool okay = doc.parseFromString(spin_input::xml[spin_input::GRID]);
60  REQUIRE(okay);
61  xmlNodePtr node = doc.getRoot();
62  emit.testAppendFromXML<SpinDensityInput>(emi, node);
63  }
64 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
EstimatorManagerInput emi(estimators_doc.getRoot())
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
testing::ValidSpinDensityInput input

◆ TEST_CASE() [175/537]

qmcplusplus::TEST_CASE ( "test_loop_timer"  ,
""  [utilities] 
)

Definition at line 42 of file test_runtime_manager.cpp.

References CHECK(), convert_to_ns(), LoopTimer< CLOCK >::get_time_per_iteration(), qmcplusplus::Units::time::s, LoopTimer< CLOCK >::start(), and LoopTimer< CLOCK >::stop().

43 {
44  LoopTimer<FakeChronoClock> loop;
45  double it_time = loop.get_time_per_iteration();
46  CHECK(it_time == Approx(0.0));
47 
48  loop.start();
49  loop.stop();
50  it_time = loop.get_time_per_iteration();
51  CHECK(it_time == Approx(1.0));
52 
53  FakeChronoClock::fake_chrono_clock_increment = convert_to_ns(2.0s);
54  loop.start();
55  loop.stop();
56  it_time = loop.get_time_per_iteration();
57  CHECK(it_time == Approx(1.5)); // 2 iterations
58  // restore value
59  FakeChronoClock::fake_chrono_clock_increment = convert_to_ns(1.0s);
60 }
FakeChronoClock::duration convert_to_ns(T in)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [176/537]

qmcplusplus::TEST_CASE ( "DMC"  ,
""  [drivers][dmc] 
)

Definition at line 42 of file test_dmc_driver.cpp.

References CloneManager::acceptRatio(), SpeciesSet::addAttribute(), TrialWaveFunction::addComponent(), QMCHamiltonian::addOperator(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), CloneManager::clearClones(), OHMMS::Controller, ParticleSet::create(), MCWalkerConfiguration::createWalkers(), doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), ParticleSet::getSpeciesSet(), okay, omp_get_max_threads(), Libxml2Document::parseFromString(), QMCDriver::process(), ParticleSet::R, REQUIRE(), DMC::run(), ParticleSet::setName(), and ParticleSet::update().

43 {
44  ProjectData project_data;
46 
47  const SimulationCell simulation_cell;
48  ParticleSet ions(simulation_cell);
49  MCWalkerConfiguration elec(simulation_cell);
50 
51  ions.setName("ion");
52  ions.create({1});
53  ions.R[0] = {0.0, 0.0, 0.0};
54  elec.setName("elec");
55  std::vector<int> agroup(1);
56  agroup[0] = 2;
57  elec.create(agroup);
58  elec.R[0] = {1.0, 0.0, 0.0};
59  elec.R[1] = {0.0, 0.0, 1.0};
60  elec.createWalkers(1);
61 
62  SpeciesSet& tspecies = elec.getSpeciesSet();
63  int upIdx = tspecies.addSpecies("u");
64  int chargeIdx = tspecies.addAttribute("charge");
65  int massIdx = tspecies.addAttribute("mass");
66  tspecies(chargeIdx, upIdx) = -1;
67  tspecies(massIdx, upIdx) = 1.0;
68 
69  elec.addTable(ions);
70  elec.update();
71 
72  CloneManager::clearClones();
73 
74  TrialWaveFunction psi(project_data.getRuntimeOptions());
75  psi.addComponent(std::make_unique<ConstantOrbital>());
76  psi.registerData(elec, elec[0]->DataSet);
77  elec[0]->DataSet.allocate();
78 
79  using RNG = RandomBase<QMCTraits::FullPrecRealType>;
80  UPtrVector<RNG> rngs(omp_get_max_threads());
81  for (std::unique_ptr<RNG>& rng : rngs)
82  rng = std::make_unique<FakeRandom<QMCTraits::FullPrecRealType>>();
83 
84  QMCHamiltonian h;
85  std::unique_ptr<BareKineticEnergy> p_bke = std::make_unique<BareKineticEnergy>(elec, psi);
86  h.addOperator(std::move(p_bke), "Kinetic");
87  h.addObservables(elec); // get double free error on 'h.Observables' w/o this
88 
89  elec.resetWalkerProperty(); // get memory corruption w/o this
90 
91  DMC dmc_omp(project_data, elec, psi, h, rngs, c, false);
92 
93  const char* dmc_input = R"(<qmc method="dmc" checkpoint="-1">
94  <parameter name="steps">1</parameter>
95  <parameter name="blocks">1</parameter>
96  <parameter name="timestep">0.1</parameter>
97  </qmc>
98  )";
100  bool okay = doc.parseFromString(dmc_input);
101  REQUIRE(okay);
102  xmlNodePtr root = doc.getRoot();
103 
104  dmc_omp.process(root); // need to call 'process' for QMCDriver, which in turn calls 'put'
105 
106  dmc_omp.run();
107 
108  // With the constant wavefunction, no moves should be rejected
109  double ar = dmc_omp.acceptRatio();
110  CHECK(ar == Approx(1.0));
111 
112  // Each electron moved sqrt(tau)*gaussian_rng()
113  // See Particle>Base/tests/test_random_seq.cpp for the gaussian random numbers
114  // Values from diffuse.py for moving one step
115 
116  CHECK(elec[0]->R[0][0] == Approx(0.627670258894097));
117  CHECK(elec.R[0][1] == Approx(0.0));
118  CHECK(elec.R[0][2] == Approx(-0.372329741105903));
119 
120  CHECK(elec.R[1][0] == Approx(0.0));
121  CHECK(elec.R[1][1] == Approx(-0.372329741105903));
122  CHECK(elec.R[1][2] == Approx(1.0));
123 }
DMC type: dmc, dmc-ptcl.
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
omp_int_t omp_get_max_threads()
Definition: OpenMP.h:26
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [177/537]

qmcplusplus::TEST_CASE ( "TrialWaveFunction_diamondC_1x1x1"  ,
""  [wavefunction] 
)

Definition at line 43 of file test_TrialWaveFunction.cpp.

References TrialWaveFunction::acceptMove(), SpeciesSet::addAttribute(), TrialWaveFunction::addComponent(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ParticleSet::addTable(), app_log(), RadialJastrowBuilder::buildComponent(), TrialWaveFunction::calcRatio(), CHECK(), OHMMS::Controller, ParticleSet::create(), TrialWaveFunction::createResource(), ParticleSet::createSK(), EinsplineSetBuilder::createSPOSetFromXML(), DC_POS, DC_POS_OFFLOAD, doc, qmcplusplus::Units::charge::e, TrialWaveFunction::evaluateLog(), TrialWaveFunction::extractOptimizableObjectRefs(), TrialWaveFunction::FERMIONIC, TrialWaveFunction::findMSD(), TrialWaveFunction::getLogPsi(), ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), TWFGrads< CoordsType::POS >::grads_positions, lattice, TrialWaveFunction::makeClone(), TrialWaveFunction::mw_accept_rejectMove(), TrialWaveFunction::mw_calcRatio(), TrialWaveFunction::mw_calcRatioGrad(), TrialWaveFunction::mw_evalGrad(), TrialWaveFunction::mw_evaluateLog(), ParticleSet::mw_makeMove(), ParticleSet::mw_update(), TrialWaveFunction::NONFERMIONIC, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), and ParticleSet::update().

44 {
46 
47 #if defined(ENABLE_OFFLOAD)
48  const DynamicCoordinateKind kind_selected = DynamicCoordinateKind::DC_POS_OFFLOAD;
49 #else
50  const DynamicCoordinateKind kind_selected = DynamicCoordinateKind::DC_POS;
51 #endif
52  // diamondC_1x1x1
53  ParticleSet::ParticleLayout lattice;
54  lattice.R = {3.37316115, 3.37316115, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
55  lattice.BoxBConds = {1, 1, 1};
56  lattice.reset();
57 
58  ParticleSetPool ptcl = ParticleSetPool(c);
59  ptcl.setSimulationCell(lattice);
60  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell(), kind_selected);
61  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell(), kind_selected);
62  ParticleSet& ions_(*ions_uptr);
63  ParticleSet& elec_(*elec_uptr);
64 
65  ions_.setName("ion");
66  ptcl.addParticleSet(std::move(ions_uptr));
67  ions_.create({2});
68  ions_.R[0] = {0.0, 0.0, 0.0};
69  ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
70  ions_.update();
71 
72 
73  elec_.setName("elec");
74  ptcl.addParticleSet(std::move(elec_uptr));
75  elec_.create({2, 2});
76  elec_.R[0] = {0.0, 0.0, 0.0};
77  elec_.R[1] = {0.0, 1.0, 1.0};
78  elec_.R[2] = {1.0, 1.0, 0.0};
79  elec_.R[3] = {1.0, 0.0, 1.0};
80 
81  SpeciesSet& tspecies = elec_.getSpeciesSet();
82  int upIdx = tspecies.addSpecies("u");
83  int downIdx = tspecies.addSpecies("d");
84  int chargeIdx = tspecies.addAttribute("charge");
85  tspecies(chargeIdx, upIdx) = -1;
86  tspecies(chargeIdx, downIdx) = -1;
87 
88  elec_.addTable(ions_);
89  elec_.resetGroups();
90  elec_.createSK(); // needed by AoS J2 for ChiesaKEcorrection
91 
92  // make a ParticleSet Clone
93  ParticleSet elec_clone(elec_);
94 
95  //diamondC_1x1x1
96  const char* spo_xml = R"(<tmp> \
97 <determinantset type="einspline" href="diamondC_1x1x1.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.0" precision="float" size="2"/>
98 </tmp>
99 )";
100 
102  bool okay = doc.parseFromString(spo_xml);
103  REQUIRE(okay);
104 
105  xmlNodePtr spo_root = doc.getRoot();
106  xmlNodePtr ein1 = xmlFirstElementChild(spo_root);
107 
108  EinsplineSetBuilder einSet(elec_, ptcl.getPool(), c, ein1);
109  auto spo = einSet.createSPOSetFromXML(ein1);
110  REQUIRE(spo != nullptr);
111 
112  std::vector<std::unique_ptr<DiracDeterminantBase>> dets;
113  dets.push_back(std::make_unique<DiracDet>(spo->makeClone(), 0, 2));
114  dets.push_back(std::make_unique<DiracDet>(spo->makeClone(), 2, 4));
115 
116  auto slater_det = std::make_unique<SlaterDet>(elec_, std::move(dets));
117 
118  RuntimeOptions runtime_options;
119  TrialWaveFunction psi(runtime_options);
120  psi.addComponent(std::move(slater_det));
121 
122  const char* jas_input = R"(<tmp>
123 <jastrow name="J2" type="Two-Body" function="Bspline" print="yes">
124  <correlation size="10" speciesA="u" speciesB="u">
125  <coefficients id="uu" type="Array"> 0.02904699284 -0.1004179 -0.1752703883 -0.2232576505 -0.2728029201 -0.3253286875 -0.3624525145 -0.3958223107 -0.4268582166 -0.4394531176</coefficients>
126  </correlation>
127 </jastrow>
128 </tmp>
129 )";
130  Libxml2Document doc_jas;
131  okay = doc.parseFromString(jas_input);
132  REQUIRE(okay);
133 
134  xmlNodePtr jas_root = doc.getRoot();
135  xmlNodePtr jas1 = xmlFirstElementChild(jas_root);
136 
137  RadialJastrowBuilder jb(c, elec_);
138  psi.addComponent(jb.buildComponent(jas1));
139 
140  // should not find MSD
141  CHECK(psi.findMSD().empty());
142 
143  // initialize distance tables.
144  elec_.update();
145  double logpsi = psi.evaluateLog(elec_);
146 
147  //app_log() << "debug before YYY " << std::setprecision(16) << psi.getLogPsi() << " " << psi.getPhase()<< std::endl;
148 #if defined(QMC_COMPLEX)
149  CHECK(logpsi == Approx(-0.1201465271523596));
150 #else
151  CHECK(logpsi == Approx(-1.471840358291562));
152 #endif
153 
154  // make a TrialWaveFunction Clone
155  std::unique_ptr<TrialWaveFunction> psi_clone(psi.makeClone(elec_clone));
156 
157  elec_clone.update();
158  double logpsi_clone = psi_clone->evaluateLog(elec_clone);
159 #if defined(QMC_COMPLEX)
160  CHECK(logpsi_clone == Approx(-0.1201465271523596));
161 #else
162  CHECK(logpsi_clone == Approx(-1.471840358291562));
163 #endif
164 
165  const int moved_elec_id = 0;
166 
167  using PosType = QMCTraits::PosType;
170  PosType delta(0.1, 0.1, 0.2);
171 
172  elec_.makeMove(moved_elec_id, delta);
173 
174  ValueType r_all_val = psi.calcRatio(elec_, moved_elec_id);
175  ValueType r_fermionic_val = psi.calcRatio(elec_, moved_elec_id, TrialWaveFunction::ComputeType::FERMIONIC);
176  ValueType r_bosonic_val = psi.calcRatio(elec_, moved_elec_id, TrialWaveFunction::ComputeType::NONFERMIONIC);
177 
178  //app_log() << "debug YYY " << std::setprecision(16) << r_all_val << std::endl;
179  //app_log() << "debug YYY " << std::setprecision(16) << r_fermionic_val << std::endl;
180  //app_log() << "debug YYY " << std::setprecision(16) << r_bosonic_val << std::endl;
181 #if defined(QMC_COMPLEX)
182  CHECK(r_all_val == ComplexApprox(ValueType(1.653821746120792, 0.5484992491019633)));
183  CHECK(r_fermionic_val == ComplexApprox(ValueType(1.804065087219802, 0.598328295048828)));
184 #else
185  CHECK(r_all_val == Approx(2.305591774210242));
186  CHECK(r_fermionic_val == ValueApprox(2.515045914101833));
187 #endif
188  CHECK(r_bosonic_val == ValueApprox(0.9167195562048454));
189 
190  psi.acceptMove(elec_, moved_elec_id);
191  elec_.acceptMove(moved_elec_id);
192 #if defined(QMC_COMPLEX)
193  CHECK(psi.getLogPsi() == Approx(0.4351202455204972));
194 #else
195  CHECK(psi.getLogPsi() == Approx(-0.63650297977845492));
196 #endif
197 
198  elec_.update(true);
199  psi.evaluateLog(elec_);
200 #if defined(QMC_COMPLEX)
201  CHECK(psi.getLogPsi() == Approx(0.4351202455204972));
202 #else
203  CHECK(psi.getLogPsi() == Approx(-0.63650297977845492));
204 #endif
205 
206  const auto opt_obj_refs = psi.extractOptimizableObjectRefs();
207  REQUIRE(opt_obj_refs.size() == 1);
208 
209  // testing batched interfaces
210  ResourceCollection pset_res("test_pset_res");
211  ResourceCollection twf_res("test_twf_res");
212 
213  elec_.createResource(pset_res);
214  psi.createResource(twf_res);
215 
216  //Temporary as switch to std::reference_wrapper proceeds
217  // testing batched interfaces
218  RefVectorWithLeader<ParticleSet> p_ref_list(elec_, {elec_, elec_clone});
219  RefVectorWithLeader<TrialWaveFunction> wf_ref_list(psi, {psi, *psi_clone});
220 
221  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_ref_list);
222  ResourceCollectionTeamLock<TrialWaveFunction> mw_twf_lock(twf_res, wf_ref_list);
223 
224  ParticleSet::mw_update(p_ref_list);
225  TrialWaveFunction::mw_evaluateLog(wf_ref_list, p_ref_list);
226 #if defined(QMC_COMPLEX)
227  REQUIRE(std::complex<RealType>(wf_ref_list[0].getLogPsi(), wf_ref_list[0].getPhase()) ==
228  LogComplexApprox(std::complex<RealType>(0.4351202455204972, 6.665972664860828)));
229  REQUIRE(std::complex<RealType>(wf_ref_list[1].getLogPsi(), wf_ref_list[1].getPhase()) ==
230  LogComplexApprox(std::complex<RealType>(-0.1201465271523596, 6.345732826640545)));
231 #else
232  REQUIRE(std::complex<RealType>(wf_ref_list[0].getLogPsi(), wf_ref_list[0].getPhase()) ==
233  LogComplexApprox(std::complex<RealType>(-0.6365029797784554, 3.141592653589793)));
234  REQUIRE(std::complex<RealType>(wf_ref_list[1].getLogPsi(), wf_ref_list[1].getPhase()) ==
235  LogComplexApprox(std::complex<RealType>(-1.471840358291562, 3.141592653589793)));
236 #endif
237 
238  TWFGrads<CoordsType::POS> grad_old(2);
239 
240  grad_old.grads_positions[0] = wf_ref_list[0].evalGrad(p_ref_list[0], moved_elec_id);
241  grad_old.grads_positions[1] = wf_ref_list[1].evalGrad(p_ref_list[1], moved_elec_id);
242 
243  app_log() << "evalGrad " << std::setprecision(14) << grad_old.grads_positions[0][0] << " "
244  << grad_old.grads_positions[0][1] << " " << grad_old.grads_positions[0][2] << " "
245  << grad_old.grads_positions[1][0] << " " << grad_old.grads_positions[1][1] << " "
246  << grad_old.grads_positions[1][2] << std::endl;
247 
248  TrialWaveFunction::mw_evalGrad(wf_ref_list, p_ref_list, moved_elec_id, grad_old);
249 #if defined(QMC_COMPLEX)
250  CHECK(grad_old.grads_positions[0][0] == ComplexApprox(ValueType(18.817970466022, -6.5837500306076)));
251  CHECK(grad_old.grads_positions[0][1] == ComplexApprox(ValueType(-22.840838391977, 3.9963373883645)));
252  CHECK(grad_old.grads_positions[0][2] == ComplexApprox(ValueType(3.8805320617146, 1.5825508129169)));
253  CHECK(grad_old.grads_positions[1][0] == ComplexApprox(ValueType(47.387717528888, -8.7703065253151e-06)));
254  CHECK(grad_old.grads_positions[1][1] == ComplexApprox(ValueType(-54.671696901113, -7.3126138879524)));
255  CHECK(grad_old.grads_positions[1][2] == ComplexApprox(ValueType(6.6288917088321, 7.3126230586018)));
256 #else
257  CHECK(grad_old.grads_positions[0][0] == Approx(14.77249702264));
258  CHECK(grad_old.grads_positions[0][1] == Approx(-20.385235323777));
259  CHECK(grad_old.grads_positions[0][2] == Approx(4.8529516184558));
260  CHECK(grad_old.grads_positions[1][0] == Approx(47.38770710732));
261  CHECK(grad_old.grads_positions[1][1] == Approx(-63.361119579044));
262  CHECK(grad_old.grads_positions[1][2] == Approx(15.318325284049));
263 #endif
264 
265  PosType delta_sign_changed(0.1, 0.1, -0.2);
266 
267  std::vector<PosType> displs{delta_sign_changed, delta_sign_changed};
268  ParticleSet::mw_makeMove(p_ref_list, moved_elec_id, displs);
269 
270  if (kind_selected != DynamicCoordinateKind::DC_POS_OFFLOAD)
271  {
272  ValueType r_0 = wf_ref_list[0].calcRatio(p_ref_list[0], moved_elec_id);
273  GradType grad_temp;
274  ValueType r_1 = wf_ref_list[1].calcRatioGrad(p_ref_list[1], moved_elec_id, grad_temp);
275 #if defined(QMC_COMPLEX)
276  CHECK(r_0 == ComplexApprox(ValueType(-0.045474407700114, -0.59956233350555)));
277  CHECK(r_1 == ComplexApprox(ValueType(-0.44602867091608, -1.8105588403509)));
278  CHECK(grad_temp[0] == ComplexApprox(ValueType(-6.6139971152489, 22.82304260002)));
279  CHECK(grad_temp[1] == ComplexApprox(ValueType(8.3367501707711, -23.362154838104)));
280  CHECK(grad_temp[2] == ComplexApprox(ValueType(-2.6347597529645, 0.67383144279783)));
281 #else
282  CHECK(r_0 == Approx(-0.4138835449));
283  CHECK(r_1 == Approx(-2.5974770159));
284  CHECK(grad_temp[0] == Approx(-17.865723259764));
285  CHECK(grad_temp[1] == Approx(19.854257889369));
286  CHECK(grad_temp[2] == Approx(-2.9669578650441));
287 #endif
288  }
289 
290  PosType delta_zero(0, 0, 0);
291  displs = {delta_zero, delta};
292  ParticleSet::mw_makeMove(p_ref_list, moved_elec_id, displs);
293 
294  std::vector<PsiValue> ratios(2);
295  TrialWaveFunction::mw_calcRatio(wf_ref_list, p_ref_list, moved_elec_id, ratios);
296  app_log() << "calcRatio " << std::setprecision(14) << ratios[0] << " " << ratios[1] << std::endl;
297 #if defined(QMC_COMPLEX)
298  CHECK(ratios[0] == ComplexApprox(PsiValue(1, 0)));
299  CHECK(ratios[1] == ComplexApprox(PsiValue(1.6538214581548, 0.54849918598717)));
300 #else
301  CHECK(ratios[0] == Approx(1));
302  CHECK(ratios[1] == Approx(2.3055913093424));
303 #endif
304 
305  std::fill(ratios.begin(), ratios.end(), 0);
306  TWFGrads<CoordsType::POS> grad_new(2);
307 
308  if (kind_selected != DynamicCoordinateKind::DC_POS_OFFLOAD)
309  {
310  ratios[0] = wf_ref_list[0].calcRatioGrad(p_ref_list[0], moved_elec_id, grad_new.grads_positions[0]);
311  ratios[1] = wf_ref_list[1].calcRatioGrad(p_ref_list[1], moved_elec_id, grad_new.grads_positions[1]);
312 
313  app_log() << "calcRatioGrad " << std::setprecision(14) << ratios[0] << " " << ratios[1] << std::endl
314  << grad_new.grads_positions[0][0] << " " << grad_new.grads_positions[0][1] << " "
315  << grad_new.grads_positions[0][2] << " " << grad_new.grads_positions[1][0] << " "
316  << grad_new.grads_positions[1][1] << " " << grad_new.grads_positions[1][2] << std::endl;
317  }
318  //Temporary as switch to std::reference_wrapper proceeds
319  // testing batched interfaces
320 
321  TrialWaveFunction::mw_calcRatioGrad(wf_ref_list, p_ref_list, moved_elec_id, ratios, grad_new);
322 #if defined(QMC_COMPLEX)
323  CHECK(ratios[0] == ComplexApprox(ValueType(1, 0)));
324  CHECK(grad_new.grads_positions[0][0] == ComplexApprox(ValueType(18.817970466022, -6.5837500306076)));
325  CHECK(grad_new.grads_positions[0][1] == ComplexApprox(ValueType(-22.840838391977, 3.9963373883645)));
326  CHECK(grad_new.grads_positions[0][2] == ComplexApprox(ValueType(3.8805320617146, 1.5825508129169)));
327  CHECK(ratios[1] == ComplexApprox(ValueType(1.6538214581548, 0.54849918598717)));
328  CHECK(grad_new.grads_positions[1][0] == ComplexApprox(ValueType(18.817970466022, -6.5837500306076)));
329  CHECK(grad_new.grads_positions[1][1] == ComplexApprox(ValueType(-22.840838391977, 3.9963373883645)));
330  CHECK(grad_new.grads_positions[1][2] == ComplexApprox(ValueType(3.8805320617146, 1.5825508129169)));
331 #else
332  CHECK(ratios[0] == Approx(1));
333  CHECK(grad_new.grads_positions[0][0] == Approx(14.77249702264));
334  CHECK(grad_new.grads_positions[0][1] == Approx(-20.385235323777));
335  CHECK(grad_new.grads_positions[0][2] == Approx(4.8529516184558));
336  CHECK(ratios[1] == Approx(2.3055913093424));
337  CHECK(grad_new.grads_positions[1][0] == Approx(14.77249702264));
338  CHECK(grad_new.grads_positions[1][1] == Approx(-20.385235323777));
339  CHECK(grad_new.grads_positions[1][2] == Approx(4.8529516184558));
340 #endif
341 
342  std::vector<bool> isAccepted(2, true);
343  TrialWaveFunction::mw_accept_rejectMove(wf_ref_list, p_ref_list, moved_elec_id, isAccepted);
344 #if defined(QMC_COMPLEX)
345  REQUIRE(std::complex<RealType>(wf_ref_list[0].getLogPsi(), wf_ref_list[0].getPhase()) ==
346  LogComplexApprox(std::complex<RealType>(0.4351202455204972, 6.665972664860828)));
347  REQUIRE(std::complex<RealType>(wf_ref_list[1].getLogPsi(), wf_ref_list[1].getPhase()) ==
348  LogComplexApprox(std::complex<RealType>(0.4351202455204972, 6.665972664860828)));
349 #else
350  REQUIRE(std::complex<RealType>(wf_ref_list[0].getLogPsi(), wf_ref_list[0].getPhase()) ==
351  LogComplexApprox(std::complex<RealType>(-0.6365029797784554, 3.141592653589793)));
352  REQUIRE(std::complex<RealType>(wf_ref_list[1].getLogPsi(), wf_ref_list[1].getPhase()) ==
353  LogComplexApprox(std::complex<RealType>(-0.6365029797784554, 3.141592653589793)));
354 #endif
355 
356  TrialWaveFunction::mw_evalGrad(wf_ref_list, p_ref_list, moved_elec_id, grad_old);
357 #if defined(QMC_COMPLEX)
358  CHECK(grad_old.grads_positions[0][0] == ComplexApprox(ValueType(18.817970466022, -6.5837500306076)));
359  CHECK(grad_old.grads_positions[0][1] == ComplexApprox(ValueType(-22.840838391977, 3.9963373883645)));
360  CHECK(grad_old.grads_positions[0][2] == ComplexApprox(ValueType(3.8805320617146, 1.5825508129169)));
361  CHECK(grad_old.grads_positions[1][0] == ComplexApprox(ValueType(18.817970466022, -6.5837500306076)));
362  CHECK(grad_old.grads_positions[1][1] == ComplexApprox(ValueType(-22.840838391977, 3.9963373883645)));
363  CHECK(grad_old.grads_positions[1][2] == ComplexApprox(ValueType(3.8805320617146, 1.5825508129169)));
364 #else
365  CHECK(grad_old.grads_positions[0][0] == Approx(14.77249702264));
366  CHECK(grad_old.grads_positions[0][1] == Approx(-20.385235323777));
367  CHECK(grad_old.grads_positions[0][2] == Approx(4.8529516184558));
368  CHECK(grad_old.grads_positions[1][0] == Approx(14.77249702264));
369  CHECK(grad_old.grads_positions[1][1] == Approx(-20.385235323777));
370  CHECK(grad_old.grads_positions[1][2] == Approx(4.8529516184558));
371 #endif
372 }
DynamicCoordinateKind
enumerator for DynamicCoordinates kinds
class that handles xmlDoc
Definition: Libxml2Doc.h:76
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
LatticeGaussianProduct::GradType GradType
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Catch::Detail::LogComplexApprox LogComplexApprox
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [178/537]

qmcplusplus::TEST_CASE ( "e2iphi"  ,
""  [numerics] 
)

Definition at line 43 of file test_e2iphi.cpp.

44 {
45  test_e2iphi<1, double>();
46  test_e2iphi<2, double>();
47  test_e2iphi<3, double>();
48  test_e2iphi<4, double>();
49 
50  test_e2iphi<1, float>();
51  test_e2iphi<2, float>();
52  test_e2iphi<3, float>();
53  test_e2iphi<4, float>();
54 }

◆ TEST_CASE() [179/537]

qmcplusplus::TEST_CASE ( "ParallelExecutor<STD> nested case"  ,
""  [concurrency] 
)

Definition at line 43 of file test_ParallelExecutorSTD.cpp.

References REQUIRE(), and TestTask().

44 {
45  int num_threads = 8;
46  ParallelExecutor<Executor::STD_THREADS> test_block;
47  std::atomic<int> count(0);
48  test_block(
49  num_threads,
50  [num_threads](int task_id, std::atomic<int>& my_count) {
51  ParallelExecutor<Executor::STD_THREADS> test_block2;
52  test_block2(num_threads, TestTask, std::ref(my_count));
53  },
54  std::ref(count));
55  REQUIRE(count == 64);
56 }
void TestTask(const int ip, std::atomic< int > &counter)
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [180/537]

qmcplusplus::TEST_CASE ( "OutputManager basic"  ,
""  [utilities] 
)

Definition at line 43 of file test_output_manager.cpp.

References DEBUG, HIGH, OutputManagerClass::isDebugActive(), OutputManagerClass::isHighActive(), LOW, REQUIRE(), and OutputManagerClass::setVerbosity().

44 {
46 
47  // Low verbosity
49  REQUIRE(om.isDebugActive() == false);
50  REQUIRE(om.isHighActive() == false);
51 
52  // High verbosity
54  REQUIRE(om.isDebugActive() == false);
55  REQUIRE(om.isHighActive() == true);
56 
57  // Debug verbosity
59  REQUIRE(om.isDebugActive() == true);
60  REQUIRE(om.isHighActive() == true);
61 }
bool isHighActive() const
Definition: OutputManager.h:47
REQUIRE(std::filesystem::exists(filename))
bool isDebugActive() const
Definition: OutputManager.h:45
void setVerbosity(Verbosity level)

◆ TEST_CASE() [181/537]

qmcplusplus::TEST_CASE ( "FairDivideLow_two"  ,
""  [utilities] 
)

Definition at line 43 of file test_partition.cpp.

References FairDivideLow(), and REQUIRE().

44 {
45  std::vector<int> out;
46  FairDivideLow(2, 1, out);
47  REQUIRE(out.size() == 2);
48  REQUIRE(out[0] == 0);
49  REQUIRE(out[1] == 2);
50 
51  FairDivideLow(2, 2, out);
52  REQUIRE(out.size() == 3);
53  REQUIRE(out[0] == 0);
54  REQUIRE(out[1] == 1);
55  REQUIRE(out[2] == 2);
56 }
void FairDivideLow(int ntot, int npart, IV &adist)
partition ntot elements among npart
Definition: FairDivide.h:114
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [182/537]

qmcplusplus::TEST_CASE ( "HamiltonianFactory"  ,
""  [hamiltonian] 
)

Definition at line 44 of file test_hamiltonian_factory.cpp.

References WaveFunctionFactory::buildEmptyTWFForTesting(), OHMMS::Controller, createElectronParticleSet(), doc, HamiltonianFactory::getH(), QMCHamiltonian::getOperatorType(), Libxml2Document::getRoot(), okay, Libxml2Document::parseFromString(), HamiltonianFactory::put(), REQUIRE(), QMCHamiltonian::size(), and QMCHamiltonian::total_size().

45 {
47 
48  const SimulationCell simulation_cell;
49  auto elec_ptr = createElectronParticleSet(simulation_cell);
50  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
51 
52  auto &ions(*ions_ptr), elec(*elec_ptr);
53 
54  ions.setName("ion0");
55  ions.create({1});
56 
57  HamiltonianFactory::PSetMap particle_set_map;
58  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
59  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
60 
61  RuntimeOptions runtime_options;
62  HamiltonianFactory::PsiPoolType psi_map;
63  psi_map.emplace("psi0", WaveFunctionFactory::buildEmptyTWFForTesting(runtime_options, "psi0"));
64 
65  HamiltonianFactory hf("h0", elec, particle_set_map, psi_map, c);
66 
67  const char* hamiltonian_xml = R"(<hamiltonian name="h0" type="generic" target="e">
68  <pairpot type="coulomb" name="ElecElec" source="e" target="e"/>
69  <pairpot type="coulomb" name="IonIon" source="ion0" target="ion0"/>
70  <pairpot type="coulomb" name="ElecIon" source="ion0" target="e"/>
71 </hamiltonian>)";
72 
74  bool okay = doc.parseFromString(hamiltonian_xml);
75  REQUIRE(okay);
76 
77  xmlNodePtr root = doc.getRoot();
78  hf.put(root);
79 
80 
81  REQUIRE(hf.getH());
82  REQUIRE(hf.getH()->size() == 3);
83  REQUIRE(hf.getH()->total_size() == 3);
84 
85  REQUIRE(hf.getH()->getOperatorType("ElecElec") == "coulomb");
86  REQUIRE(hf.getH()->getOperatorType("ElecIon") == "coulomb");
87 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
std::unique_ptr< ParticleSet > createElectronParticleSet(const SimulationCell &simulation_cell)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [183/537]

qmcplusplus::TEST_CASE ( "convertUPtrToRefvector"  ,
""  [type_traits] 
)

Definition at line 44 of file test_template_types.cpp.

References CHECK(), convertUPtrToRefVector(), qmcplusplus::Units::charge::e, and qmcplusplus::Units::time::s.

45 {
46  struct Dummy
47  {
48  double d;
49  std::string s;
50  };
51 
52  struct DerivedDummy : public Dummy
53  {
54  DerivedDummy() : e(0) {}
55  double e;
56  };
57 
58  struct OtherDummy
59  {
60  double f;
61  };
62 
63  UPtrVector<Dummy> uvec;
64  for (int i = 0; i < 3; ++i)
65  uvec.emplace_back(std::make_unique<Dummy>());
66 
67  RefVector<Dummy> rdum(convertUPtrToRefVector(uvec));
68  auto rdum2 = convertUPtrToRefVector(uvec);
69  CHECK(std::is_same_v<decltype(rdum), decltype(rdum2)>);
70  // Testing to make sure meta programming stops potential ambiguous template resolution.
71  UPtrVector<DerivedDummy> ddv;
72  ddv.emplace_back(std::make_unique<DerivedDummy>());
73  ddv.emplace_back(std::make_unique<DerivedDummy>());
74 
75  auto dummy_ref_vec = convertUPtrToRefVector(ddv);
76  auto d_ref_vec = convertUPtrToRefVector<Dummy>(ddv);
77  auto dd_ref_vec = convertUPtrToRefVector(ddv);
78  CHECK(!std::is_same_v<decltype(d_ref_vec), decltype(dd_ref_vec)>);
79 
80  // This should cause a compilation error. a DerivedDummy cannot be converted to an OtherDummy.
81  // RefVector<OtherDummy> od_ref_vec = convertUPtrToRefVector<OtherDummy>(ddv);
82 }
static RefVector< T > convertUPtrToRefVector(const UPtrVector< T > &ptr_list)
convert a vector of std::unique_ptrs<T> to a refvector<T>
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [184/537]

qmcplusplus::TEST_CASE ( "Walker control assign walkers"  ,
""  [drivers][walker_control] 
)

Definition at line 44 of file test_walker_control.cpp.

References WalkerControlMPI::determineNewWalkerPopulation(), qmcplusplus::Units::mass::me, and REQUIRE().

45 {
46  int Cur_pop = 8;
47  int NumContexts = 4;
48  std::vector<int> FairOffset(NumContexts + 1);
49 
50  // The in loop copy is necessary to support the assert at the end of the swaps.
51  // This was important for debugging but will go in a future PR as part of cleaning
52  // update determineNewWalkerPopulation
53  std::vector<int> NumPerRank = {4, 4, 0, 0};
54  std::vector<int> NewNum = NumPerRank;
55  for (int me = 0; me < NumContexts; me++)
56  {
57  std::vector<int> minus;
58  std::vector<int> plus;
59  std::vector<int> num_per_rank = NumPerRank;
60 
61  //std::cout << "For processor number " << me << std::endl;
62  WalkerControlMPI::determineNewWalkerPopulation(Cur_pop, NumContexts, me, num_per_rank, FairOffset, minus, plus);
63 
64  REQUIRE(minus.size() == plus.size());
65  //output_vector(" Minus: ", minus);
66 
67  //output_vector(" Plus: ", plus);
68 
69  for (int i = 0; i < plus.size(); i++)
70  {
71  if (me == plus[i])
72  NewNum[plus[i]]--;
73  }
74  for (int i = 0; i < minus.size(); i++)
75  {
76  if (me == minus[i])
77  NewNum[minus[i]]++;
78  }
79  }
80  //output_vector("New num per node: ", NewNum);
81 
82  for (int i = 0; i < NewNum.size(); i++)
83  {
84  int num = FairOffset[i + 1] - FairOffset[i];
85  REQUIRE(NewNum[i] == num);
86  }
87 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [185/537]

qmcplusplus::TEST_CASE ( "prime number set 64 bit"  ,
""  [utilities] 
)

Definition at line 45 of file test_prime_set.cpp.

References PrimeNumberSet< UIntType >::get(), REQUIRE(), and PrimeNumberSet< UIntType >::size().

46 {
48  //std::cout << "64 bit size = "<< pns.size() << std::endl;
49  REQUIRE(pns.size() == 55109);
50  REQUIRE(pns[0] == 3);
51 
52  std::vector<uint64_t> more_primes;
53  // get prime numbers already in the list
54  pns.get(1, 2, more_primes);
55  REQUIRE(more_primes.size() == 2);
56  REQUIRE(more_primes[0] == 5);
57 
58  // generate additional prime numbers
59  pns.get(55110, 2, more_primes);
60  REQUIRE(more_primes.size() == 4);
61  REQUIRE(more_primes[2] > pns[55108]);
62 }
class to generate prime numbers
size_t size() const
REQUIRE(std::filesystem::exists(filename))
bool get(UIntType offset, int n, std::vector< UIntType > &primes_add)
add n new primes starting with an offset

◆ TEST_CASE() [186/537]

qmcplusplus::TEST_CASE ( "MultiQuinticSpline"  ,
""  [wavefunction][LCAO] 
)

Definition at line 46 of file test_multiquintic_spline.cpp.

References MultiQuinticSpline1D< T >::add_spline(), CHECK(), MultiQuinticSpline1D< T >::evaluate(), MultiQuinticSpline1D< T >::initialize(), and OneDimQuinticSpline< Td, Tg, CTd, CTg >::set().

47 {
48  Vector<double> data(5);
49  data[0] = 0.0;
50  data[1] = 1.0;
51  data[2] = 2.0;
52  data[3] = 3.0;
53  data[4] = 4.0;
54 
55  Vector<double> data2(5);
56  data[0] = 2.0;
57  data[1] = 9.0;
58  data[2] = 1.0;
59  data[3] = 2.0;
60  data[4] = 0.1;
61 
62  auto agrid = std::make_unique<LogGrid<double>>();
63  agrid->set(.1, 1.0, 5);
64 
65  OneDimQuinticSpline<double> spline1(agrid->makeClone());
66  spline1.set(data);
67  spline1.spline();
68 
69  OneDimQuinticSpline<double> spline2(agrid->makeClone());
70  spline2.set(data2);
71  spline2.spline();
72 
73 
74  MultiQuinticSpline1D<double> m_spline;
75 
76  m_spline.initialize(*agrid, 2);
77  m_spline.add_spline(0, spline1);
78  m_spline.add_spline(1, spline2);
79 
80 
81  // Compare the values from the multi-spline routines against the values from
82  // the original single-spline routines.
83 
84  double u[2];
85  double du[2];
86  double d2u[2];
87  double d3u[2];
88 
89  double u1, u2;
90  double du1 = 0.0, du2 = 0.0;
91  double d2u1 = 0.0, d2u2 = 0.0;
92  double d3u1 = 0.0, d3u2 = 0.0;
93  for (int i = 0; i < 10; i++)
94  {
95  double r = 0.08 * i + 0.1;
96  m_spline.evaluate(r, u, du, d2u);
97 
98  u1 = spline1.splint(r, du1, d2u1);
99  u2 = spline2.splint(r, du2, d2u2);
100 
101  CHECK(u[0] == Approx(u1));
102  CHECK(du[0] == Approx(du1));
103  CHECK(d2u[0] == Approx(d2u1));
104  CHECK(u[1] == Approx(u2));
105  CHECK(du[1] == Approx(du2));
106  CHECK(d2u[1] == Approx(d2u2));
107 
108  m_spline.evaluate(r, u, du, d2u, d3u);
109  u1 = spline1.splint(r, du1, d2u1, d3u1);
110  u2 = spline2.splint(r, du2, d2u2, d3u2);
111 
112  CHECK(u[0] == Approx(u1));
113  CHECK(du[0] == Approx(du1));
114  CHECK(d2u[0] == Approx(d2u1));
115  CHECK(d3u[0] == Approx(d3u1));
116  CHECK(u[1] == Approx(u2));
117  CHECK(du[1] == Approx(du2));
118  CHECK(d2u[1] == Approx(d2u2));
119  CHECK(d3u[1] == Approx(d3u2));
120  }
121 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [187/537]

qmcplusplus::TEST_CASE ( "Pade2 functor"  ,
""  [wavefunction] 
)

Definition at line 46 of file test_pade_jastrow.cpp.

References qmcplusplus::Units::distance::A, Pade2ndOrderFunctor< T >::A, B(), Pade2ndOrderFunctor< T >::B, qmcplusplus::Units::charge::C, Pade2ndOrderFunctor< T >::C, CHECK(), Pade2ndOrderFunctor< T >::evaluate(), and Pade2ndOrderFunctor< T >::reset().

47 {
48  double A = 0.8;
49  double B = 5.0;
50  double C = -0.1;
51  Pade2ndOrderFunctor<double> pf2("test_functor");
52  pf2.A = A;
53  pf2.B = B;
54  pf2.C = C;
55  pf2.reset();
56 
57  double r = 1.2;
58  double u = pf2.evaluate(r);
59  CHECK(u == Approx(0.11657142857142856));
60 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
double B(double x, int k, int i, const std::vector< double > &t)

◆ TEST_CASE() [188/537]

qmcplusplus::TEST_CASE ( "ReadFileBuffer_no_file"  ,
""  [hamiltonian] 
)

Definition at line 46 of file test_ecp.cpp.

References ReadFileBuffer::open_file(), and REQUIRE().

47 {
48  ReadFileBuffer buf(NULL);
49  bool open_okay = buf.open_file("does_not_exist");
50  REQUIRE(open_okay == false);
51 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [189/537]

qmcplusplus::TEST_CASE ( "gaussian random array length 2"  ,
""  [particle_base] 
)

Definition at line 46 of file test_random_seq.cpp.

References assignGaussRand(), CHECK(), and qmcplusplus::Units::charge::e.

47 {
48  FakeRandom rg;
49  std::vector<double> a(3);
50  assignGaussRand(a.data(), 2, rg);
51 
52  // assuming RNG input is 0.5
53  CHECK(a[0] == Approx(-1.1774100224305424));
54  CHECK(a[1] == Approx(1.4419114152535772e-16));
55  CHECK(a[2] == Approx(0.0)); // ensure no overflow
56 }
void assignGaussRand(T *restrict a, unsigned n, RG &rng)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [190/537]

qmcplusplus::TEST_CASE ( "getSplineBound double"  ,
""  [numerics] 
)

Definition at line 47 of file test_SplineBound.cpp.

47 { test_spline_bounds<double>(); }

◆ TEST_CASE() [191/537]

qmcplusplus::TEST_CASE ( "walker assumptions"  ,
""  [particle] 
)

Currently significant amounts of code assumes that the Walker by default has "Properties" ending with the LOCALPOTENTIAL element.

This opens the door to off by 1 when considering the default size.

Definition at line 47 of file test_walker.cpp.

References ConstantSizeMatrix< T, ALLOC >::cols(), Walker< t_traits, p_traits >::Properties, and REQUIRE().

48 {
49  using WP = WalkerProperties::Indexes;
50  MCPWalker w1(1);
51  REQUIRE(w1.Properties.cols() == WP::NUMPROPERTIES);
52 }
WalkerProperties::Indexes WP
Definition: ParticleSet.cpp:34
REQUIRE(std::filesystem::exists(filename))
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker
Definition: test_walker.cpp:31

◆ TEST_CASE() [192/537]

qmcplusplus::TEST_CASE ( "getSplineBound float"  ,
""  [numerics] 
)

Definition at line 48 of file test_SplineBound.cpp.

48 { test_spline_bounds<float>(); }

◆ TEST_CASE() [193/537]

qmcplusplus::TEST_CASE ( "RandomNumberControl random in xml"  ,
""  [ohmmsapp] 
)

Definition at line 49 of file test_rng_control.cpp.

References OHMMS::Controller, doc, Libxml2Document::getXPathContext(), RandomNumberControl::initialize(), okay, Libxml2Document::parseFromString(), RandomNumberControl::read(), REQUIRE(), and RandomNumberControl::write().

50 {
51  Communicate* c;
53 
54  const char* xml_input = R"(<tmp><random seed="0"></random></tmp>)";
55 
57  bool okay = doc.parseFromString(xml_input);
58  REQUIRE(okay);
59 
60  RandomNumberControl rnc;
61 
62  xmlXPathContextPtr context = doc.getXPathContext();
63  rnc.initialize(context);
64 
65 
66  rnc.write("rng_out", c);
67 
68  RandomNumberControl rnc2;
69  rnc2.read("rng_out", c);
70  // not sure what to test here - for now make sure it doesn't crash.
71 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [194/537]

qmcplusplus::TEST_CASE ( "LocalEnergy"  ,
""  [estimators] 
)

Definition at line 49 of file test_local_energy_est.cpp.

References LocalEnergyEstimator::accumulate(), WalkerConfigurations::begin(), CHECK(), LocalEnergyEstimator::clone(), ParticleSet::create(), MCWalkerConfiguration::createWalkers(), WalkerConfigurations::end(), LocalEnergyEstimator::getName(), REQUIRE(), ScalarEstimatorBase::scalars, and ParticleSet::setName().

50 {
51  QMCHamiltonian H;
52  LocalEnergyEstimator le_est(H, false);
53 
54  CHECK(le_est.getName() == "LocalEnergyEstimator");
55 
56  std::unique_ptr<LocalEnergyEstimator> le_est2{le_est.clone()};
57  REQUIRE(le_est2 != nullptr);
58  REQUIRE(le_est2.get() != &le_est);
59 
60  const SimulationCell simulation_cell;
61  MCWalkerConfiguration W(simulation_cell);
62  W.setName("electrons");
63  W.create({1});
64  W.createWalkers(1);
65 
66  (*W.begin())->Properties(WP::LOCALENERGY) = 1.1;
67  (*W.begin())->Properties(WP::LOCALPOTENTIAL) = 1.2;
68 
69  le_est.accumulate(W, W.begin(), W.end(), 1.0);
70 
71  // from enum in LocalEnergyEstimator
72  // 0 - ENERGY_INDEX
73  // 1 - ENERGY2_INDEX
74  // 2 - POTENTIAL_INDEX
75  CHECK(le_est.scalars[0].mean() == Approx(1.1));
76  REQUIRE(le_est.scalars[1].mean() == le_est.scalars[0].mean2());
77  CHECK(le_est.scalars[2].mean() == Approx(1.2));
78 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [195/537]

qmcplusplus::TEST_CASE ( "BSpline functor one"  ,
""  [wavefunction] 
)

Definition at line 50 of file test_J1_bspline.cpp.

References BsplineFunctor< REAL >::evaluate(), REQUIRE(), and BsplineFunctor< REAL >::resize().

51 {
52  BsplineFunctor<double> bf("test_functor");
53 
54  bf.resize(1);
55 
56  double r = 1.2;
57  double u = bf.evaluate(r);
58  REQUIRE(u == 0.0);
59 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [196/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A Ewald Quasi2D square"  ,
""  [hamiltonian] 
)

Definition at line 50 of file test_ewald_quasi2d.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), lattice, LRCoulombSingleton::QUASI2D, ParticleSet::R, ParticleSet::setName(), LRCoulombSingleton::this_lr_type, and ParticleSet::update().

51 {
52  LRCoulombSingleton::CoulombHandler = 0;
53  LRCoulombSingleton::this_lr_type = LRCoulombSingleton::QUASI2D;
54  const double vmad_sq = -1.95013246;
55  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
56  lattice.BoxBConds = true;
57  lattice.BoxBConds[2] = false; // ppn
58  lattice.ndim = 2;
59  lattice.R.diagonal(1.0);
60  lattice.LR_dim_cutoff = 30.0;
61  lattice.reset();
62 
63  const SimulationCell simulation_cell(lattice);
64  ParticleSet elec(simulation_cell);
65  elec.setName("e");
66  elec.create({1});
67  elec.R[0] = {0.0, 0.0, 0.0};
68 
69  SpeciesSet& tspecies = elec.getSpeciesSet();
70  int upIdx = tspecies.addSpecies("u");
71  int chargeIdx = tspecies.addAttribute("charge");
72  int massIdx = tspecies.addAttribute("mass");
73  tspecies(chargeIdx, upIdx) = -1;
74  tspecies(massIdx, upIdx) = 1.0;
75 
76  elec.createSK();
77  elec.update();
78 
79  CoulombPBCAA caa(elec, true, false, false);
80 
81  double val = caa.evaluate(elec);
82  CHECK(val == Approx(vmad_sq));
83 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [197/537]

qmcplusplus::TEST_CASE ( "parsewords"  ,
""  [utilities] 
)

Definition at line 50 of file test_parser.cpp.

References parsewords(), and REQUIRE().

51 {
52  ParseCaseVector_t tlist = {// Input string, list of expected tokens, extra split characters
53  {
54  "a",
55  {"a"},
56  },
57  {
58  "b=",
59  {"b"},
60  },
61  {
62  "=c",
63  {"c"},
64  },
65  {
66  "d=e",
67  {"d", "e"},
68  },
69  {
70  "f,g",
71  {"f", "g"},
72  },
73  {
74  "h\ti,j",
75  {"h", "i", "j"},
76  },
77  {
78  "k|m",
79  {"k|m"},
80  },
81  {"n|o", {"n", "o"}, "|"}};
82  for (auto& tc : tlist)
83  {
84  SECTION(string("Parsing string: ") + tc.input)
85  {
86  vector<string> outlist;
87  unsigned int num = parsewords(tc.input.c_str(), outlist, tc.extra_split);
88  REQUIRE(num == tc.output.size());
89  REQUIRE(outlist.size() == tc.output.size());
90  for (int i = 0; i < tc.output.size(); i++)
91  {
92  REQUIRE(outlist[i] == tc.output[i]);
93  }
94  }
95  }
96 }
vector< ParseCase > ParseCaseVector_t
Definition: test_parser.cpp:47
REQUIRE(std::filesystem::exists(filename))
unsigned parsewords(const char *inbuf, std::vector< std::string > &slist, const std::string &extra_tokens)

◆ TEST_CASE() [198/537]

qmcplusplus::TEST_CASE ( "test_timer_stack"  ,
""  [utilities] 
)

Definition at line 51 of file test_timer.cpp.

References TimerManager< TIMER >::createTimer(), TimerManager< TIMER >::current_timer(), REQUIRE(), TimerType< CLOCK >::start(), TimerType< CLOCK >::stop(), and timer_level_coarse.

52 {
53  // Use a local version rather than the global timer_manager, otherwise
54  // changes will persist from test to test.
56  FakeTimer* t1 = tm.createTimer("timer1", timer_level_coarse);
57 #if defined(ENABLE_TIMERS)
58 #ifdef USE_STACK_TIMERS
59  t1->start();
60  REQUIRE(tm.current_timer() == t1);
61  t1->stop();
62  REQUIRE(tm.current_timer() == NULL);
63 #endif
64 #endif
65 }
TimerType< FakeChronoClock > FakeTimer
Definition: NewTimer.h:235
REQUIRE(std::filesystem::exists(filename))
TimerManager< FakeTimer > FakeTimerManager
Definition: test_timer.cpp:23

◆ TEST_CASE() [199/537]

qmcplusplus::TEST_CASE ( "PerParticleHamiltonianLogger_sum"  ,
""  [estimators] 
)

Definition at line 51 of file test_PerParticleHamiltonianLogger.cpp.

References CHECK(), PerParticleHamiltonianLogger::collect(), convertUPtrToRefVector(), doc, PerParticleHamiltonianLogger::get_block(), PerParticleHamiltonianLoggerInput::get_to_stdout(), Libxml2Document::getRoot(), node, okay, Libxml2Document::parseFromString(), pset, rank, REQUIRE(), PerParticleHamiltonianLogger::spawnCrowdClone(), PerParticleHamiltonianLogger::startBlock(), walker, and qmcplusplus::hdf::walkers.

52 {
53  std::string_view xml{R"XML(
54 <PerParticleHamiltonianLogger to_stdout="false"/>
55 )XML"};
56 
58  bool okay = doc.parseFromString(xml);
59  REQUIRE(okay);
60  xmlNodePtr node = doc.getRoot();
61  PerParticleHamiltonianLoggerInput pphli(node);
62 
63  CHECK(!pphli.get_to_stdout());
64 
65  if (std::filesystem::exists("rank_0_per_particle_log.dat"))
66  std::filesystem::remove("rank_0_per_particle_log.dat");
67 
68  {
69  int rank = 0;
70  PerParticleHamiltonianLogger rank_logger(std::move(pphli), rank);
71 
72  int ncrowds = 3;
73 
74  UPtrVector<OperatorEstBase> crowd_loggers;
75  for (int ic = 0; ic < ncrowds; ++ic)
76  {
77  crowd_loggers.emplace_back(rank_logger.spawnCrowdClone());
78  }
79 
80  int nwalkers = 3;
81 
82  const SimulationCell simulation_cell;
83  std::vector<OperatorEstBase::MCPWalker> walkers;
84  for (int iw = 0; iw < nwalkers; ++iw)
85  walkers.emplace_back(iw, iw, 2);
86 
87  std::vector<ParticleSet> psets;
88  for (int iw = 0; iw < nwalkers; ++iw)
89  {
90  psets.emplace_back(simulation_cell);
91  ParticleSet& pset = psets.back();
92  pset.create({2});
93  pset.R[0] = ParticleSet::PosType(0.00000000, 0.00000000, 0.00000000);
94  pset.R[1] = ParticleSet::PosType(0.68658058, 0.68658058, 0.68658058);
95  }
96 
97  std::vector<TrialWaveFunction> wfns;
98  std::vector<QMCHamiltonian> hams;
99 
100  auto ref_walkers = makeRefVector<OperatorEstBase::MCPWalker>(walkers);
101  auto ref_psets = makeRefVector<ParticleSet>(psets);
102  auto ref_wfns = makeRefVector<TrialWaveFunction>(wfns);
103  auto ref_hams = makeRefVector<QMCHamiltonian>(hams);
104 
105  std::vector<MultiWalkerTalker> multi_walker_talkers{{"Talker1", nwalkers},
106  {"Talker2", nwalkers},
107  {"Talker3", nwalkers}};
108  for (auto& crowd_oeb : crowd_loggers)
109  for (auto& mwt : multi_walker_talkers)
110  {
111  auto& crowd_logger = dynamic_cast<PerParticleHamiltonianLogger&>(*crowd_oeb);
112  ListenerVector<Real> listener("whatever", crowd_logger.getLogger());
113  mwt.registerVector(listener);
114  }
115 
116  rank_logger.startBlock(100);
117  CHECK(rank_logger.get_block() == 1);
118 
119  for (auto& mwt : multi_walker_talkers)
120  mwt.reportVector();
121 
122  FakeRandom<OHMMS_PRECISION_FULL> rng;
123 
124  int crowd_id = 0;
125  long walker_id = 0;
126  for (auto& crowd_oeb : crowd_loggers)
127  {
128  // Mocking walker ids
129  using Walker = typename decltype(ref_walkers)::value_type::type;
130  for(Walker& walker : ref_walkers)
131  walker.setWalkerID(walker_id++);
132  crowd_oeb->accumulate(ref_walkers, ref_psets, ref_wfns, ref_hams, rng);
133  }
134 
135  RefVector<OperatorEstBase> crowd_loggers_refs = convertUPtrToRefVector(crowd_loggers);
136  rank_logger.collect(crowd_loggers_refs);
137  }
138  // Now that the rank_logger has be destroyed its file must be present
139  CHECK(std::filesystem::exists("rank_0_per_particle_log.dat"));
140 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
const char walkers[]
Definition: HDFVersion.h:36
static RefVector< T > convertUPtrToRefVector(const UPtrVector< T > &ptr_list)
convert a vector of std::unique_ptrs<T> to a refvector<T>
QMCTraits::PosType PosType
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
QMCTraits::FullPrecRealType value_type

◆ TEST_CASE() [200/537]

qmcplusplus::TEST_CASE ( "FS evaluate ,
""  [tools] 
)

reference numbers and simple_Sk.dat created by fs_ref.py

Definition at line 51 of file test_qmcfstool.cpp.

References CHECK(), and QMCAppBase::parse().

52 {
55 
56  std::unique_ptr<SkParserBase> skparser = std::make_unique<SkParserASCII>();
57  std::string filename = "simple_Sk.dat";
58  skparser->parse(filename);
59 
60  QMCFiniteSize qfs(skparser.get());
61  qfs.parse(std::string("simple_input.xml"));
62  qfs.validateXML();
63  qfs.initialize();
64 
65  /// reference numbers and simple_Sk.dat created by fs_ref.py
66  std::vector<RealType> skr = skparser->get_sk_raw();
67  RealType vsum = qfs.calcPotentialDiscrete(skr);
68  CHECK(vsum == Approx(1.0547517220577185));
69 
70  std::vector<RealType> sk, skerr;
71  skparser->get_sk(sk, skerr);
72  RealType vint = qfs.calcPotentialInt(sk);
73  CHECK(vint == Approx(1.066688342657357).epsilon(0.001));
74 }
QMCTraits::PosType PosType
QMCTraits::RealType RealType
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [201/537]

qmcplusplus::TEST_CASE ( "ProjectData::put no series"  ,
""  [ohmmsapp] 
)

Definition at line 51 of file test_project_data.cpp.

References doc, Libxml2Document::getRoot(), ProjectData::getSeriesIndex(), ProjectData::getTitle(), okay, Libxml2Document::parseFromString(), ProjectData::put(), and REQUIRE().

52 {
53  ProjectData proj;
54 
55  const char* xml_input = R"(<project id="test1"></project>)";
57  bool okay = doc.parseFromString(xml_input);
58  REQUIRE(okay);
59 
60  xmlNodePtr root = doc.getRoot();
61 
62  proj.put(root);
63  REQUIRE(proj.getSeriesIndex() == 0);
64  REQUIRE(proj.getTitle() == std::string("test1"));
65 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [202/537]

qmcplusplus::TEST_CASE ( "OMPclass member"  ,
""  [OMP] 
)

Definition at line 51 of file test_class_member.cpp.

References maptest< T >::run().

52 {
53  maptest<double> tester;
54  tester.run();
55 }

◆ TEST_CASE() [203/537]

qmcplusplus::TEST_CASE ( "particle_attrib_ops_double"  ,
""  [particle_base] 
)

Definition at line 51 of file test_attrib_ops.cpp.

52 {
53  SECTION("dim = 1") { double_test_case<1>(); }
54  SECTION("dim = 2") { double_test_case<2>(); }
55  SECTION("dim = 3") { double_test_case<3>(); }
56  SECTION("dim = 4") { double_test_case<4>(); }
57 }

◆ TEST_CASE() [204/537]

qmcplusplus::TEST_CASE ( "QMCUpdate"  ,
""  [drivers] 
)

Definition at line 51 of file test_clone_manager.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), OHMMS::Controller, ParticleSet::create(), MCWalkerConfiguration::createWalkers(), ParticleSet::getSpeciesSet(), QMCUpdateBase::put(), and ParticleSet::setName().

52 {
54 
55  const SimulationCell simulation_cell;
56  MCWalkerConfiguration elec(simulation_cell);
57  elec.setName("e");
58  elec.create({1});
59  elec.createWalkers(1);
60 
61  SpeciesSet& tspecies = elec.getSpeciesSet();
62  int upIdx = tspecies.addSpecies("u");
63  int chargeIdx = tspecies.addAttribute("charge");
64  int massIdx = tspecies.addAttribute("mass");
65  tspecies(chargeIdx, upIdx) = -1;
66  tspecies(massIdx, upIdx) = 1.0;
67 
68  FakeRandom rg;
69 
70  QMCHamiltonian h;
71  RuntimeOptions runtime_options;
72  TrialWaveFunction psi(runtime_options);
73  FakeUpdate update(elec, psi, h, rg);
74 
75  update.put(NULL);
76 
77  //update.resetRun(brancher, estimator_manager);
78 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68

◆ TEST_CASE() [205/537]

qmcplusplus::TEST_CASE ( "ParallelExecutor<OPENMP> nested case"  ,
""  [concurrency] 
)

Definition at line 51 of file test_ParallelExecutorOPENMP.cpp.

References TestTaskOMP().

52 {
53  int num_threads = 1;
54  ParallelExecutor<Executor::OPENMP> test_block;
55  int count(0);
56  auto nested_tasks = [num_threads](int task_id, int& my_count) {
57  ParallelExecutor<Executor::OPENMP> test_block2;
58  test_block2(num_threads, TestTaskOMP, std::ref(my_count));
59  };
60 #ifdef _OPENMP
61  REQUIRE_THROWS_WITH(test_block(num_threads, nested_tasks, std::ref(count)),
62  Catch::Contains("ParallelExecutor should not be used for nested openmp threading"));
63 #endif
64 }
void TestTaskOMP(const int ip, int &counter)
Openmp generally works but is not guaranteed with std::atomic.

◆ TEST_CASE() [206/537]

qmcplusplus::TEST_CASE ( "Spherical Harmonics Many"  ,
""  [numerics] 
)

Definition at line 52 of file test_ylm.cpp.

References CHECK(), qmcplusplus::Units::distance::m, qmcplusplus::Units::force::N, and Ylm().

53 {
54  struct Point
55  {
56  double x;
57  double y;
58  double z;
59  };
60 
61  struct YlmValue
62  {
63  Point p;
64  int l;
65  int m;
66  double y_re;
67  double y_im;
68  };
69 
70 #if 0
71  // Use gen_ylm.py to create this file to test more values
72 #include "ylm.inc"
73 #else
74  // Test a small subset of values
75  const int N = 11;
76  YlmValue Vals[N] = {
77  {{0, 0, 1}, 1, -1, 0, 0},
78  {{0.587785, 0, 0.809017}, 1, -1, 0.203076, 0},
79  {{0.587785, 0, 0.809017}, 1, 0, 0.395288, 0},
80  {{0.951057, 0, 0.309017}, 1, 1, -0.328584, 0},
81  {{0.587785, 0, 0.809017}, 2, -2, 0.133454, 0},
82  {{0.293893, 0.904508, 0.309017}, 2, -1, 0.0701612, -0.215934},
83  {{0.587785, 0, -0.809017}, 2, 0, 0.303888, 0},
84  {{0.293893, 0.904508, -0.309017}, 2, 1, 0.0701612, 0.215934},
85  {{0.293893, 0.904508, 0.309017}, 2, 2, -0.282661, 0.205365},
86  {{-0.475528, -0.345492, -0.809017}, 3, -3, 0.0261823, 0.0805808},
87  {{-0.475528, -0.345492, 0.809017}, 4, 4, -0.0427344, 0.0310484},
88  };
89 #endif
90 
92  for (int i = 0; i < N; i++)
93  {
94  YlmValue& v = Vals[i];
95  vec_t w;
96  w[0] = v.p.z; // first component appears to be aligned along the z-axis
97  w[1] = v.p.x;
98  w[2] = v.p.y;
99 
100  std::complex<double> out = Ylm(v.l, v.m, w);
101  //printf("%d %d expected %g %g actual %g %g\n",v.l,v.m,v.y_re,v.y_im, out.real(), out.imag());
102  CHECK(v.y_re == Approx(out.real()));
103  CHECK(v.y_im == Approx(out.imag()));
104  }
105 }
TinyVector< double, 3 > vec_t
std::complex< double > Ylm(int l, int m, const std::vector< double > &sph)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [207/537]

qmcplusplus::TEST_CASE ( "array NestedContainers"  ,
""  [OhmmsPETE] 
)

Definition at line 52 of file test_Array.cpp.

References CHECK(), REQUIRE(), Array< T, D, ALLOC >::resize(), and Array< T, D, ALLOC >::size().

53 {
54  Array<std::vector<int>, 1> vec_of_vecs({2});
55  vec_of_vecs(0).push_back(123);
56  vec_of_vecs.resize(5);
57  vec_of_vecs(0).clear();
58  vec_of_vecs(0).push_back(123);
59  vec_of_vecs.resize(0);
60  vec_of_vecs.resize(3);
61  vec_of_vecs(0).push_back(123);
62  CHECK(vec_of_vecs(0).back() == 123);
63 
64  Array<std::vector<int>, 1> vec_copy(vec_of_vecs);
65  REQUIRE(vec_copy.size() == 3);
66  REQUIRE(vec_copy(0).size() == 1);
67  CHECK(vec_copy(0).back() == 123);
68 
69  Array<std::vector<int>, 1> vec_assign;
70  vec_assign = vec_of_vecs;
71  REQUIRE(vec_copy.size() == 3);
72  REQUIRE(vec_copy(0).size() == 1);
73  CHECK(vec_copy(0).back() == 123);
74 }
void resize(const std::array< SIZET, D > &dims)
Resize the container.
Definition: OhmmsArray.h:65
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
A D-dimensional Array class based on PETE.
Definition: OhmmsArray.h:25

◆ TEST_CASE() [208/537]

qmcplusplus::TEST_CASE ( "particle_attrib_vector"  ,
""  [particle_base] 
)

Definition at line 52 of file test_particle_attrib.cpp.

References REQUIRE(), Vector< T, Alloc >::resize(), and Vector< T, Alloc >::size().

53 {
54  ParticleAttrib<TinyVector<double, 2>> PA1;
55  REQUIRE(PA1.size() == 0);
56 
57  PA1.resize(3);
58  REQUIRE(PA1.size() == 3);
59 
60  PA1[0] = 1.0;
61  PA1[1] = 0.0;
62  REQUIRE(PA1[0][0] == 1.0);
63  REQUIRE(PA1[0][1] == 1.0);
64  REQUIRE(PA1[1][0] == 0.0);
65 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [209/537]

qmcplusplus::TEST_CASE ( "OneBodyDensityMatricesInput::copy_construction"  ,
""  [estimators] 
)

Definition at line 53 of file test_OneBodyDensityMatricesInput.cpp.

References doc, Libxml2Document::getRoot(), node, obdmi, okay, and Libxml2Document::parseFromString().

54 {
55  using Input = testing::ValidOneBodyDensityMatricesInput;
57  bool okay = doc.parseFromString(Input::xml[Input::valid::SCALE]);
58  xmlNodePtr node = doc.getRoot();
59  OneBodyDensityMatricesInput obdmi(node);
60  static_assert(std::is_copy_constructible_v<OneBodyDensityMatricesInput>);
61 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
OneBodyDensityMatricesInput obdmi(node)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [210/537]

qmcplusplus::TEST_CASE ( "ReadFileBuffer_simple_serial"  ,
""  [hamiltonian] 
)

Definition at line 53 of file test_ecp.cpp.

References ReadFileBuffer::contents(), ReadFileBuffer::length, ReadFileBuffer::open_file(), ReadFileBuffer::read_contents(), and REQUIRE().

54 {
55  // Initializing with no Communicate pointer under MPI,
56  // this will read the file on every node. Should be okay
57  // for testing purposes.
58  ReadFileBuffer buf(NULL);
59  bool open_okay = buf.open_file("simple.txt");
60  REQUIRE(open_okay == true);
61 
62  bool read_okay = buf.read_contents();
63  REQUIRE(read_okay);
64  REQUIRE(buf.length == 14);
65  REQUIRE(std::string("File contents\n") == buf.contents());
66 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [211/537]

qmcplusplus::TEST_CASE ( "updateXmlNodes"  ,
""  [drivers] 
)

Definition at line 54 of file test_QMCCostFunctionBase.cpp.

References QMCCostFunctionTest::callUpdateXmlNodes(), comm, OHMMS::Controller, doc, QMCCostFunctionTest::getDoc(), Libxml2Document::getRoot(), getXMLAttributeValue(), okay, Libxml2Document::parseFromString(), REQUIRE(), QMCCostFunctionBase::setRootName(), and QMCCostFunctionBase::setWaveFunctionNode().

55 {
56  const SimulationCell simulation_cell;
57  MCWalkerConfiguration w(simulation_cell);
58  QMCHamiltonian h;
59  RuntimeOptions runtime_options;
60  TrialWaveFunction psi(runtime_options);
61 
63 
64  QMCCostFunctionTest cost(w, psi, h, comm);
65 
66  cost.setRootName("tmp");
67 
68  const char* wf_xml = R"(
69 <wavefunction/>
70  )";
71 
73  bool okay = doc.parseFromString(wf_xml);
74  REQUIRE(okay);
75  cost.setWaveFunctionNode(doc.getRoot());
76 
77  cost.callUpdateXmlNodes();
78  //cost.printXml();
79 
80  xmlXPathContextPtr acontext = xmlXPathNewContext(cost.getDoc());
81  OhmmsXPathObject check_elem("//override_variational_parameters", acontext);
82  REQUIRE(check_elem.size() == 1);
83 
84  std::string href = getXMLAttributeValue(check_elem[0], "href");
85  REQUIRE(href == "tmp.vp.h5");
86 
87  xmlXPathFreeContext(acontext);
88 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
std::string getXMLAttributeValue(const xmlNodePtr cur, const std::string_view name)
get the value string for attribute name if name is unfound in cur you get an empty string back this i...
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [212/537]

qmcplusplus::TEST_CASE ( "accumulator basic float"  ,
""  [estimators] 
)

Definition at line 54 of file test_accumulator.cpp.

54 { test_real_accumulator_basic<double>(); }

◆ TEST_CASE() [213/537]

qmcplusplus::TEST_CASE ( "test_communicate_split_two"  ,
""  [message] 
)

Definition at line 54 of file test_communciate.cpp.

References OHMMS::Controller, REQUIRE(), and Communicate::size().

55 {
57  if (c->size() >= 2)
58  {
59  auto c2 = std::make_unique<Communicate>(*c, 2);
60 
61  std::vector<int> new_size(2);
62  new_size[0] = c->size() / 2;
63  new_size[1] = c->size() / 2;
64 
65  int midpoint = c->size() / 2;
66  int new_group_id = c->rank() < midpoint ? 0 : 1;
67  int new_rank = c->rank();
68  if (c->rank() >= midpoint)
69  {
70  new_rank -= midpoint;
71  }
72  // Adjust for odd size - the last group has the extra process
73  if (c->size() % 2 == 1)
74  {
75  new_size[1] = new_size[1] + 1;
76  }
77  REQUIRE(c2->size() == new_size[new_group_id]);
78  REQUIRE(c2->rank() == new_rank);
79 
80  if (c->rank() == 0 || c->rank() == midpoint)
81  {
82  REQUIRE(c2->isGroupLeader() == true);
83  auto GroupLeaderComm = c2->getGroupLeaderComm();
84  REQUIRE(GroupLeaderComm != nullptr);
85  REQUIRE(GroupLeaderComm->size() == 2);
86  if (c->rank() == 0)
87  {
88  REQUIRE(GroupLeaderComm->rank() == 0);
89  }
90  else
91  {
92  REQUIRE(GroupLeaderComm->rank() == 1);
93  }
94  }
95  else
96  {
97  REQUIRE(c2->isGroupLeader() == false);
98  REQUIRE(c2->getGroupLeaderComm() == nullptr);
99  }
100  }
101 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
int size() const
return the number of tasks
Definition: Communicate.h:118
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [214/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A Ewald2D body center"  ,
""  [hamiltonian] 
)

Definition at line 54 of file test_ewald2d.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), dot(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, ParticleSet::setName(), LRCoulombSingleton::STRICT2D, LRCoulombSingleton::this_lr_type, and ParticleSet::update().

55 {
56  LRCoulombSingleton::CoulombHandler = 0; // !!!! crucial if not first test
57  LRCoulombSingleton::this_lr_type = LRCoulombSingleton::STRICT2D;
58  const double vmad_bc = -2.7579038;
59 
60  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
61  lattice.BoxBConds = true; // periodic
62  lattice.ndim = 2;
63  lattice.R = 0.0;
64  lattice.R.diagonal(1.0);
65  lattice.LR_dim_cutoff = 30.0;
66  lattice.reset();
67 
68  const SimulationCell simulation_cell(lattice);
69  ParticleSet elec(simulation_cell);
70  elec.setName("e");
71  const int npart = 2;
72  elec.create({npart});
73  // initialize fractional coordinates
74  elec.R[0] = {0.0, 0.0, 0.0};
75  elec.R[1] = {0.5, 0.5, 0.0};
76  // convert to Cartesian coordinates
77  for (int i=0;i<npart;i++)
78  elec.R[i] = dot(elec.R[i], lattice.R);
79 
80  SpeciesSet& tspecies = elec.getSpeciesSet();
81  int upIdx = tspecies.addSpecies("u");
82  int chargeIdx = tspecies.addAttribute("charge");
83  int massIdx = tspecies.addAttribute("mass");
84  tspecies(chargeIdx, upIdx) = -1;
85  tspecies(massIdx, upIdx) = 1.0;
86 
87  elec.createSK();
88  elec.addTable(elec); // !!!! crucial with more than 1 particle
89  elec.update();
90 
91  CoulombPBCAA caa = CoulombPBCAA(elec, true, false, false);
92 
93  double val = caa.evaluate(elec);
94  CHECK(val/npart == Approx(vmad_bc));
95 }
T dot(T *a, T *b)
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [215/537]

qmcplusplus::TEST_CASE ( "walker HDF read and write"  ,
""  [particle] 
)

Definition at line 54 of file test_walker.cpp.

References Communicate::barrier(), OHMMS::Controller, WalkerConfigurations::createWalkers(), HDFWalkerOutput::dump(), WalkerConfigurations::getActiveWalkers(), okay, Walker< t_traits, p_traits >::R, HDFWalkerInput_0_4::read_hdf5(), REQUIRE(), Communicate::setName(), WalkerConfigurations::setWalkerOffsets(), Communicate::size(), and qmcplusplus::hdf::version.

55 {
57 
58  const size_t num_ptcls = 1;
59  MCPWalker w1(num_ptcls);
60  w1.R[0] = 1.0;
61 
62  MCPWalker w2(num_ptcls);
63  w2.R[0] = 0.5;
64 
65  // This method sets ownership to false so class does not attempt to
66  // free the walker elements.
67  WalkerConfigurations wc_list;
68  wc_list.createWalkers(2, num_ptcls);
69  wc_list[0]->R = w1.R;
70  wc_list[1]->R = w2.R;
71 
72  REQUIRE(wc_list.getActiveWalkers() == 2);
73 
74  std::vector<int> walker_offset(c->size() + 1);
75 
76  walker_offset[0] = 0;
77  int offset = 2;
78  for (int i = 0; i < c->size(); i++)
79  {
80  walker_offset[i + 1] = offset;
81  offset += 2;
82  }
83 
84  wc_list.setWalkerOffsets(walker_offset);
85 
86  c->setName("walker_test");
87  HDFWalkerOutput hout(num_ptcls, "this string apparently does nothing", c);
88  hout.dump(wc_list, 0);
89 
90  c->barrier();
91 
92  WalkerConfigurations wc_list2;
93 
94  HDFVersion version(0, 4);
95  HDFWalkerInput_0_4 hinp(wc_list2, num_ptcls, c, version);
96  bool okay = hinp.read_hdf5("walker_test.config.h5");
97  REQUIRE(okay);
98 
99  REQUIRE(wc_list2.getActiveWalkers() == 2);
100  for (int i = 0; i < 3; i++)
101  {
102  REQUIRE(wc_list2[0]->R[0][i] == w1.R[0][i]);
103  REQUIRE(wc_list2[1]->R[0][i] == w2.R[0][i]);
104  }
105 }
void barrier() const
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
int size() const
return the number of tasks
Definition: Communicate.h:118
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
void setName(const std::string &aname)
Definition: Communicate.h:129
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker
Definition: test_walker.cpp:31
const char version[]
Definition: HDFVersion.h:30

◆ TEST_CASE() [216/537]

qmcplusplus::TEST_CASE ( "ReferencePointsInput::makeReferencePointsInput"  ,
""  [estimators] 
)

Definition at line 54 of file test_ReferencePointsInput.cpp.

References CHECK(), doc, Libxml2Document::getRoot(), makeReferencePointsInput(), node, okay, and Libxml2Document::parseFromString().

55 {
56  using Input = testing::ValidReferencePointsInputs;
57  std::string value_label;
59  bool okay = doc.parseFromString(Input::xml[0]);
60  xmlNodePtr node = doc.getRoot();
61  makeReferencePointsInput(node, value_label);
62  CHECK(value_label == "referencepoints");
63 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
std::any makeReferencePointsInput(xmlNodePtr cur, std::string &value_label)
factory function used by InputSection to make reference points Input
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [217/537]

qmcplusplus::TEST_CASE ( "FakeRandom noops"  ,
""  [utilities] 
)

Definition at line 54 of file test_FakeRandom.cpp.

References CHECK(), and FakeRandom< T >::set_value().

55 {
56  using DoubleRNG = FakeRandom<double>;
57  DoubleRNG rng;
58  double expected{2.5};
59 
60  rng.set_value(expected);
61  CHECK(rng() == Approx(expected));
62 
63  rng.init(0);
64  CHECK(rng() == Approx(expected));
65 
66  rng.seed(1);
67  CHECK(rng() == Approx(expected));
68 
69  std::vector<DoubleRNG::uint_type> state;
70  rng.load(state);
71  CHECK(state.empty());
72  CHECK(rng() == Approx(expected));
73 
74  rng.save(state);
75  CHECK(rng() == Approx(expected));
76 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [218/537]

qmcplusplus::TEST_CASE ( "spline_function_3"  ,
""  [numerics] 
)

Definition at line 55 of file test_one_dim_cubic_spline.cpp.

References CHECK(), CubicSplineSolve(), and n.

56 {
57  const int n = 3;
58  double x[n] = {0.0, 1.0, 2.0};
59  double y[n] = {1.0, 2.0, 1.5};
60  double y2[n];
61 
62  CubicSplineSolve(x, y, n, 1.0, 2.0, y2);
63 
64  CHECK(y2[0] == Approx(2.75));
65  CHECK(y2[1] == Approx(-5.5));
66  CHECK(y2[2] == Approx(10.25));
67 }
void CubicSplineSolve(T const *x, T const *y, int n, T yp0, T ypn, T *y2)
Solve for second derivatives for cubic splines.
Definition: SplineSolvers.h:33
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [219/537]

qmcplusplus::TEST_CASE ( "solveGeneralizedEigenvaluesInv"  ,
""  [drivers] 
)

Definition at line 55 of file test_Eigensolver.cpp.

References app_log(), CHECK(), qmcplusplus::Units::force::N, and Eigensolver::solveGeneralizedEigenvalues_Inv().

56 {
57  const int N = 2;
58  Matrix<Real> Ovlp(N, N);
59  Matrix<Real> Ham(N, N);
60 
61  Ovlp(0, 0) = 1.0;
62  Ovlp(0, 1) = 0.1;
63  Ovlp(1, 0) = 0.15;
64  Ovlp(1, 1) = 1.0;
65 
66  Ham(0, 0) = -4.0;
67  Ham(0, 1) = 0.2;
68  Ham(1, 0) = 0.3;
69  Ham(1, 1) = 1.0;
70  std::vector<Real> ev(N);
71  Matrix<Real> evec(N, N);
72  Eigensolver::solveGeneralizedEigenvalues_Inv(Ham, Ovlp, ev, evec);
73  CHECK(ev[0] == Approx(-4.10958));
74  CHECK(ev[1] == Approx(1.00298));
75  app_log() << "ev = " << ev[0] << " " << ev[1] << std::endl;
76 
77  app_log() << " evec " << evec(0, 0) << " " << evec(0, 1) << std::endl;
78  app_log() << " evec " << evec(1, 0) << " " << evec(1, 1) << std::endl;
79 
80  CHECK(evec(0, 0) == Approx(-0.98429354));
81  CHECK(evec(0, 1) == Approx(0.17653957));
82  CHECK(evec(1, 0) == Approx(-0.01992456));
83  CHECK(evec(1, 1) == Approx(-0.99980149));
84 }
std::ostream & app_log()
Definition: OutputManager.h:65
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [220/537]

qmcplusplus::TEST_CASE ( "TraceManager check_trace_build"  ,
""  [estimators] 
)

Definition at line 55 of file test_trace_manager.cpp.

References TraceSamples< T >::checkout_array(), TraceManager::checkout_complex(), TraceManager::checkout_int(), TraceManager::checkout_real(), and ParticleSet::create().

56 {
57  std::string domain = "domain";
58  std::string name = "name";
59  std::string name1 = "name_1";
60  std::string name2 = "name_2";
61  std::string name3 = "name_3";
62  std::string name4 = "name_4";
63  int index = 0;
64  int dim = 3;
65  std::string label = "label";
66  Vector<int> vi;
67  Vector<double> vr;
68  Vector<std::complex<double>> vc;
69  // Shape checking code requires size > 0
70  TinyVector<int, 4> shape1 = {1, 0, 0, 0};
71  TinyVector<int, 4> shape2 = {1, 1, 0, 0};
72  TinyVector<int, 4> shape3 = {1, 1, 1, 0};
73  TinyVector<int, 4> shape4 = {1, 1, 1, 1};
74  const SimulationCell simulation_cell;
75  ParticleSet P(simulation_cell);
76  P.create({1}); // zero-sized particle set not handled well by TraceManager
77  TraceSample<int> tsi(domain, name, index, dim, vi);
78  TraceSample<double> tsr(domain, name, index, dim, vr);
79  TraceSample<std::complex<double>> tsc(domain, name, index, dim, vc);
80  TraceSamples<int> tssi;
81  TraceSamples<TraceReal> tssr;
82  TraceSamples<TraceComp> tssc;
83  TraceBuffer<int> tbi;
84  TraceBuffer<TraceReal> tbr;
85 
86  auto ai1 = std::unique_ptr<Array<int, 1>>{tssi.checkout_array<1>(domain, name1, shape1)};
87  ai1.reset(tssi.checkout_array<1>(P, name, shape1));
88  auto ai2 = std::unique_ptr<Array<int, 2>>{tssi.checkout_array<2>(domain, name2, shape2)};
89  ai2.reset(tssi.checkout_array<2>(P, name2, shape2));
90  auto ai3 = std::unique_ptr<Array<int, 3>>{tssi.checkout_array<3>(domain, name3, shape3)};
91  ai3.reset(tssi.checkout_array<3>(P, name3, shape3));
92  auto ai4 = std::unique_ptr<Array<int, 4>>{tssi.checkout_array<4>(domain, name4, shape4)};
93  ai4.reset(tssi.checkout_array<4>(P, name4, shape4));
94 
95  auto ar1 = std::unique_ptr<Array<TraceReal, 1>>{tssr.checkout_array<1>(domain, name1, shape1)};
96  ar1.reset(tssr.checkout_array<1>(P, name1, shape1));
97  auto ar2 = std::unique_ptr<Array<TraceReal, 2>>{tssr.checkout_array<2>(domain, name2, shape2)};
98  ar2.reset(tssr.checkout_array<2>(P, name2, shape2));
99  auto ar3 = std::unique_ptr<Array<TraceReal, 3>>{tssr.checkout_array<3>(domain, name3, shape3)};
100  ar3.reset(tssr.checkout_array<3>(P, name3, shape3));
101  auto ar4 = std::unique_ptr<Array<TraceReal, 4>>{tssr.checkout_array<4>(domain, name4, shape4)};
102  ar4.reset(tssr.checkout_array<4>(P, name4, shape4));
103 
104  auto ac1 = std::unique_ptr<Array<TraceComp, 1>>{tssc.checkout_array<1>(domain, name1, shape1)};
105  ac1.reset(tssc.checkout_array<1>(P, name1, shape1));
106  auto ac2 = std::unique_ptr<Array<TraceComp, 2>>{tssc.checkout_array<2>(domain, name2, shape2)};
107  ac2.reset(tssc.checkout_array<2>(P, name2, shape2));
108  auto ac3 = std::unique_ptr<Array<TraceComp, 3>>{tssc.checkout_array<3>(domain, name3, shape3)};
109  ac3.reset(tssc.checkout_array<3>(P, name3, shape3));
110  auto ac4 = std::unique_ptr<Array<TraceComp, 4>>{tssc.checkout_array<4>(domain, name4, shape4)};
111  ac4.reset(tssc.checkout_array<4>(P, name4, shape4));
112 
113  TraceManager tm;
114  auto al1 = std::unique_ptr<Array<long, 1>>{tm.checkout_int<1>(name1)};
115  al1.reset(tm.checkout_int<1>(domain, name1, 10));
116  al1.reset(tm.checkout_int<1>(name1, P));
117  auto al2 = std::unique_ptr<Array<long, 2>>{tm.checkout_int<2>(name2, 5, 6)};
118  al2.reset(tm.checkout_int<2>(domain, name2, 10, 11));
119  al2.reset(tm.checkout_int<2>(name2, P, 11));
120  auto al3 = std::unique_ptr<Array<long, 3>>{tm.checkout_int<3>(name3, 5, 6, 7)};
121  al3.reset(tm.checkout_int<3>(domain, name3, 10, 11, 12));
122  al3.reset(tm.checkout_int<3>(name3, P, 11, 12));
123  auto al4 = std::unique_ptr<Array<long, 4>>{tm.checkout_int<4>(name4, 5, 6, 7, 8)};
124  al4.reset(tm.checkout_int<4>(domain, name4, 10, 11, 12, 13));
125  al4.reset(tm.checkout_int<4>(name4, P, 11, 12, 13));
126  ar1.reset(tm.checkout_real<1>(name1));
127  ar1.reset(tm.checkout_real<1>(domain, name1, 10));
128  ar1.reset(tm.checkout_real<1>(name1, P));
129  ar2.reset(tm.checkout_real<2>(name2, 5, 6));
130  ar2.reset(tm.checkout_real<2>(domain, name2, 10, 11));
131  ar2.reset(tm.checkout_real<2>(name2, P, 11));
132  ar3.reset(tm.checkout_real<3>(name3, 5, 6, 7));
133  ar3.reset(tm.checkout_real<3>(domain, name3, 10, 11, 12));
134  ar3.reset(tm.checkout_real<3>(name3, P, 11, 12));
135  ar4.reset(tm.checkout_real<4>(name4, 5, 6, 7, 8));
136  ar4.reset(tm.checkout_real<4>(domain, name4, 10, 11, 12, 13));
137  ar4.reset(tm.checkout_real<4>(name4, P, 11, 12, 13));
138 
139  ac1.reset(tm.checkout_complex<1>(name1));
140  ac1.reset(tm.checkout_complex<1>(domain, name1, 10));
141  ac1.reset(tm.checkout_complex<1>(name1, P));
142  ac2.reset(tm.checkout_complex<2>(name2, 5, 6));
143  ac2.reset(tm.checkout_complex<2>(domain, name2, 10, 11));
144  ac2.reset(tm.checkout_complex<2>(name2, P, 11));
145  ac3.reset(tm.checkout_complex<3>(name3, 5, 6, 7));
146  ac3.reset(tm.checkout_complex<3>(domain, name3, 10, 11, 12));
147  ac3.reset(tm.checkout_complex<3>(name3, P, 11, 12));
148  ac4.reset(tm.checkout_complex<4>(name4, 5, 6, 7, 8));
149  ac4.reset(tm.checkout_complex<4>(domain, name4, 10, 11, 12, 13));
150  ac4.reset(tm.checkout_complex<4>(name4, P, 11, 12, 13));
151 }

◆ TEST_CASE() [221/537]

qmcplusplus::TEST_CASE ( "Density Estimator evaluate exception"  ,
""  [hamiltonian] 
)

Definition at line 56 of file test_density_estimator.cpp.

References DensityEstimator::evaluate(), DensityEstimator::getClassName(), REQUIRE(), and DensityEstimator::resetTargetParticleSet().

57 {
58  const SimulationCell simulation_cell;
59  ParticleSet elec(simulation_cell);
60  DensityEstimator density_estimator(elec);
61  REQUIRE(density_estimator.getClassName() == "DensityEstimator");
62  // empty function
63  density_estimator.resetTargetParticleSet(elec);
64  // check exception is thrown when weights are not defined
65  CHECK_THROWS_AS(density_estimator.evaluate(elec), std::invalid_argument);
66 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [222/537]

qmcplusplus::TEST_CASE ( "accumulator basic double"  ,
""  [estimators] 
)

Definition at line 56 of file test_accumulator.cpp.

56 { test_real_accumulator_basic<double>(); }

◆ TEST_CASE() [223/537]

qmcplusplus::TEST_CASE ( "Vector simple intializer list"  ,
""  [OhmmsPETE] 
)

Definition at line 56 of file test_Vector.cpp.

References CHECK().

57 {
58  //empty list should work
59  Vector<int> vec_int{};
60  Vector<double> vec_double{5.0, 4.0, 3.0, 2.0, 1.0};
61  CHECK(vec_double[0] == Approx(5.0));
62  CHECK(vec_double[4] == Approx(1.0));
63 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [224/537]

qmcplusplus::TEST_CASE ( "SpaceGridInputs::parseXML::axes"  ,
""  [estimators] 
)

Definition at line 57 of file test_SpaceGridInput.cpp.

References CHECK(), checkVec(), doc, SpaceGridInput::get_axis_grids(), SpaceGridInput::get_axis_labels(), SpaceGridInput::get_axis_p1s(), SpaceGridInput::get_axis_scales(), SpaceGridInput::get_origin_fraction(), SpaceGridInput::get_origin_p1(), SpaceGridInput::get_origin_p2(), Libxml2Document::getRoot(), node, okay, Libxml2Document::parseFromString(), REQUIRE(), and ValidSpinDensityInput::xml.

58 {
59  using Real = double;
61  auto& input_xml = input::xml[input::WITH_STEP];
63 
64  bool okay = doc.parseFromString(input_xml);
65  REQUIRE(okay);
66  xmlNodePtr node = doc.getRoot();
67 
68  SpaceGridInput sgi(node);
69 
70  auto& axis_p1 = sgi.get_axis_p1s();
71  CHECK(checkVec(axis_p1, {"r1","r2","r3"}));
72  auto& axis_scale = sgi.get_axis_scales();
73  CHECK(checkVec(axis_scale, {6.9,6.9,6.9}));
74  auto& axis_label = sgi.get_axis_labels();
75  CHECK(checkVec(axis_label, {"r","phi","theta"}));
76  auto& axis_grid = sgi.get_axis_grids();
77  qmcplusplus::AxisGrid<Real> expected_1({
78  10,
79  }, //ndom_int
80  {
81  1,
82  }, //ndu_int
83  {
84  0.1,
85  }, //du_int
86  0, //umin
87  1, //umax
88  10, //odu
89  {
90  0,
91  1,
92  2,
93  3,
94  4,
95  5,
96  6,
97  7,
98  8,
99  9,
100  }, //gmap
101  {
102  1,
103  1,
104  1,
105  1,
106  1,
107  1,
108  1,
109  1,
110  1,
111  1,
112  }, //ndu_per_interval
113  10); //dimensions
114  CHECK(axis_grid[0] == expected_1);
115  CHECK(sgi.get_origin_p1() == "ion1");
116  CHECK(sgi.get_origin_p2().empty());
117  CHECK(sgi.get_origin_fraction() == 0.0);
118 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ForceBase::Real Real
Definition: ForceBase.cpp:26
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
testing::ValidSpinDensityInput input
bool checkVec(T &vec, T expected_vec)

◆ TEST_CASE() [225/537]

qmcplusplus::TEST_CASE ( "kcontainer at twist in 3D"  ,
""  [longrange] 
)

Definition at line 57 of file test_kcontainer.cpp.

References CHECK(), qmcplusplus::Units::charge::e, KContainer::kpts, KContainer::kpts_cart, lattice, and KContainer::updateKLists().

58 {
59  const int ndim = 3;
60  const double alat = 1.0;
61  const double blat = 2 * M_PI / alat;
62 
63  // twist one shell of kvectors
64  const double kc = blat + 1e-6;
65 
66  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
67  lattice.R.diagonal(1.0);
68  lattice.set(lattice.R); // compute Rv and Gv from R
69 
70  KContainer klists;
71 
72  PosType twist;
73  twist[0] = 0.1;
74  klists.updateKLists(lattice, kc, ndim, twist);
75  CHECK(klists.kpts.size() == 1);
76  CHECK(klists.kpts_cart[0][0] == Approx(blat * (twist[0] - 1)));
77 
78  twist = {-0.5, 0, 0.5};
79  klists.updateKLists(lattice, kc, ndim, twist);
80  int gvecs[3][3] = {{0, 0, -1}, {1, 0, -1}, {1, 0, 0}};
81  CHECK(klists.kpts.size() == 3);
82  for (int ik = 0; ik < klists.kpts.size(); ik++)
83  for (int ldim = 0; ldim < ndim; ldim++)
84  CHECK(klists.kpts_cart[ik][ldim] == Approx(blat * (twist[ldim] + gvecs[ik][ldim])));
85 }
QMCTraits::PosType PosType
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [226/537]

qmcplusplus::TEST_CASE ( "VectorSoaContainer copy constructor"  ,
""  [OhmmsSoA] 
)

Definition at line 57 of file test_vector_soa.cpp.

References CHECK(), and VectorSoaContainer< T, D, Alloc >::copyIn().

58 {
59  Vector<TinyVector<double, 3>> R(4);
60  VectorSoaContainer<double, 3> RSoA(4);
61 
62  R[0] = TinyVector<double, 3>(0.00000000, 0.00000000, 0.00000000);
63  R[1] = TinyVector<double, 3>(1.68658058, 1.68658058, 1.68658058);
64  R[2] = TinyVector<double, 3>(3.37316115, 3.37316115, 0.00000000);
65  R[3] = TinyVector<double, 3>(5.05974172, 5.05974172, 1.68658058);
66 
67  RSoA.copyIn(R);
68 
69  VectorSoaContainer<double, 3> rsoa_copy(RSoA);
70 
71  // more importantly this test shall not leak memory
72 
73  //check out value
74  CHECK(rsoa_copy[1][0] == Approx(1.68658058));
75  CHECK(rsoa_copy[1][1] == Approx(1.68658058));
76  CHECK(rsoa_copy[1][2] == Approx(1.68658058));
77 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [227/537]

qmcplusplus::TEST_CASE ( "StdRandom clone ,
""  [utilities] 
)

Definition at line 57 of file test_StdRandom.cpp.

References CHECK(), and StdRandom< T >::init().

58 {
59  using DoubleRNG = StdRandom<double>;
60  DoubleRNG rng;
61 
62  rng.init(111);
63  std::vector<double> rng_doubles(100, 0.0);
64  for (auto& elem : rng_doubles)
65  elem = rng();
66 
67  std::vector<DoubleRNG::uint_type> state1;
68  rng.save(state1);
69 
70  std::stringstream stream1;
71  rng.write(stream1);
72 
73  auto rng2 = rng.makeClone();
74  std::vector<DoubleRNG::uint_type> state2;
75  rng2->save(state2);
76 
77  CHECK(state1.size() == state2.size());
78  CHECK(state1 == state2);
79 
80  std::stringstream stream2;
81  rng2->write(stream2);
82 
83  CHECK(stream1.str() == stream2.str());
84 
85  CHECK((*rng2)() == rng());
86  CHECK((*rng2)() == rng());
87 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [228/537]

qmcplusplus::TEST_CASE ( "EstimatorManagerCrowd PerParticleHamiltonianLogger integration"  ,
""  [estimators] 
)

Definition at line 58 of file test_EstimatorManagerCrowd.cpp.

References EstimatorManagerCrowd::accumulate(), EstimatorManagerInput::append(), ProjectData::BATCH, CHECK(), comm, OHMMS::Controller, convertUPtrToRefVector(), qmcplusplus::testing::createEstimatorManagerNewVMCInputXML(), emi(), emn, estimators_doc, RefVectorWithLeader< T >::getLeader(), EstimatorManagerNew::getNumEstimators(), EstimatorManagerNew::getNumScalarEstimators(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), ham, hamiltonian_pool, QMCHamiltonian::informOperatorsOfListener(), MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), MinimalHamiltonianPool::make_hamWithEE(), QMCHamiltonian::mw_evaluate(), ParticleSet::mw_update(), qmcplusplus::hdf::num_walkers, particle_pool, pset, EstimatorManagerCrowd::registerListeners(), QMCHamiltonian::saveProperty(), test_project, twf, walker, qmcplusplus::hdf::walkers, and wavefunction_pool.

59 {
60  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
62 
63  using namespace testing;
65  EstimatorManagerInput emi(estimators_doc.getRoot());
66 
67 
68  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
69  auto wavefunction_pool =
70  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
71  auto& pset = *(particle_pool.getParticleSet("e"));
72  // This is where the pset properties "properies" gain the different hamiltonian operator values.
73  auto hamiltonian_pool = MinimalHamiltonianPool::make_hamWithEE(comm, particle_pool, wavefunction_pool);
74 
75  auto& twf = *(wavefunction_pool.getWaveFunction("wavefunction"));
76  auto& ham = *(hamiltonian_pool.getPrimary());
77 
79 
80  PerParticleHamiltonianLoggerInput pphli;
81  emi.append(std::move(pphli));
82 
83  EstimatorManagerNew emn(comm, std::move(emi), ham, pset, twf);
84 
85  CHECK(emn.getNumEstimators() == 3);
87 
88  // We repeat a bunch of test_QMCHamiltonian here to get things set up.
89 
90  UPtrVector<QMCHamiltonian> hams;
91  UPtrVector<TrialWaveFunction> twfs;
92  std::vector<ParticleSet> psets;
93 
94  int num_walkers = 4;
95  int num_electrons = particle_pool.getParticleSet("e")->getTotalNum();
96  int num_ions = particle_pool.getParticleSet("ion")->getTotalNum();
97 
98  for (int iw = 0; iw < num_walkers; ++iw)
99  {
100  psets.emplace_back(pset);
101  psets.back().randomizeFromSource(*particle_pool.getParticleSet("ion"));
102  twfs.emplace_back(twf.makeClone(psets.back()));
103  hams.emplace_back(hamiltonian_pool.getPrimary()->makeClone(psets.back(), *twfs.back()));
104  }
105 
106  EstimatorManagerCrowd emc(emn);
107 
108  using MCPWalker = Walker<QMCTraits, PtclOnLatticeTraits>;
109 
110  std::vector<MCPWalker> walkers(num_walkers, MCPWalker(pset.getTotalNum()));
111 
112  for (auto& walker : walkers)
113  {
114  walker.R = pset.R;
115  walker.spins = pset.spins;
116  walker.Properties = pset.Properties;
117  walker.registerData();
118  walker.DataSet.allocate();
119  }
120 
121  auto walker_refs = makeRefVector<MCPWalker>(walkers);
122  RefVectorWithLeader<MCPWalker> walker_list{walker_refs[0], walker_refs};
123 
124  auto p_refs = makeRefVector<ParticleSet>(psets);
125  RefVectorWithLeader<ParticleSet> p_list{p_refs[0], p_refs};
126 
127  ResourceCollection pset_res("test_pset_res");
128  p_list.getLeader().createResource(pset_res);
129  ResourceCollectionTeamLock<ParticleSet> pset_lock(pset_res, p_list);
130 
131  auto twf_refs = convertUPtrToRefVector(twfs);
132  RefVectorWithLeader<TrialWaveFunction> twf_list{twf_refs[0], twf_refs};
133 
134  ResourceCollection wfc_res("test_wfc_res");
135  twf_list.getLeader().createResource(wfc_res);
136  ResourceCollectionTeamLock<TrialWaveFunction> mw_wfc_lock(wfc_res, twf_list);
137 
138  auto ham_refs = convertUPtrToRefVector(hams);
139  RefVectorWithLeader<QMCHamiltonian> ham_list(ham_refs[0], ham_refs);
140 
141  ResourceCollection ham_res("test_ham_res");
142  ham_list.getLeader().createResource(ham_res);
143  ResourceCollectionTeamLock<QMCHamiltonian> mw_ham_lock(ham_res, ham_list);
144 
145  emc.registerListeners(ham_list);
146 
147  // Setup RNG
148  FakeRandom<OHMMS_PRECISION_FULL> rng;
149 
150  // Without this QMCHamiltonian::mw_evaluate segfaults
151  // Because the CoulombPBCAA hamiltonian component has PtclRhoK (StructFact) that is invalid.
152  ParticleSet::mw_update(p_list);
153 
154  QMCHamiltonian::mw_evaluate(ham_list, twf_list, p_list);
155 
156  auto savePropertiesIntoWalker = [](QMCHamiltonian& ham, MCPWalker& walker) {
157  ham.saveProperty(walker.getPropertyBase());
158  };
159  for (int iw = 0; iw < num_walkers; ++iw)
160  savePropertiesIntoWalker(*(hams[iw]), walkers[iw]);
161 
162  emc.accumulate(walker_refs, p_refs, twf_refs, ham_refs, rng);
163 }
void informOperatorsOfListener()
Some Hamiltonian components need to be informed that they are in a per particle reporting situation s...
class that handles xmlDoc
Definition: Libxml2Doc.h:76
void saveProperty(IT first)
save the values of Hamiltonian elements to the Properties
const char num_walkers[]
Definition: HDFVersion.h:37
Libxml2Document createEstimatorManagerNewVMCInputXML()
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
const char walkers[]
Definition: HDFVersion.h:36
EstimatorManagerInput emi(estimators_doc.getRoot())
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
static RefVector< T > convertUPtrToRefVector(const UPtrVector< T > &ptr_list)
convert a vector of std::unique_ptrs<T> to a refvector<T>
const RuntimeOptions & getRuntimeOptions() const noexcept
void append(const EstimatorInput &ei)
typed appending of already parsed inputs.
Wrapping information on parallelism.
Definition: Communicate.h:68
Libxml2Document estimators_doc
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker
Definition: test_walker.cpp:31
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
EstimatorManagerNew emn(comm, std::move(emi), ham, pset, twf)

◆ TEST_CASE() [229/537]

qmcplusplus::TEST_CASE ( "NonLocalECPotential"  ,
""  [hamiltonian] 
)

Definition at line 58 of file test_NonLocalECPotential.cpp.

References SpeciesSet::addAttribute(), NonLocalECPotential::addComponent(), SpeciesSet::addSpecies(), ParticleSet::addTable(), Matrix< T, Alloc >::begin(), CHECK(), Matrix< T, Alloc >::cols(), comm, OHMMS::Controller, TestNonLocalECPotential::copyGridUnrotatedForTest(), ParticleSet::create(), NonLocalECPotential::createResource(), ParticleSet::createResource(), ParticleSet::createSK(), TestNonLocalECPotential::didGridChange(), qmcplusplus::testing::getParticularListener(), ParticleSet::getSpeciesSet(), lattice, NonLocalECPotential::makeClone(), TestNonLocalECPotential::mw_evaluateImpl(), qmcplusplus::hdf::num_walkers, okay, ECPComponentBuilder::pp_nonloc, ParticleSet::R, ECPComponentBuilder::read_pp_file(), REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), NonLocalECPotential::setRandomGenerator(), and ParticleSet::update().

59 {
60  using Real = QMCTraits::RealType;
62  using Position = QMCTraits::PosType;
64 
65  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
66  lattice.BoxBConds = true; // periodic
67  lattice.R.diagonal(20.0);
68  lattice.LR_dim_cutoff = 15;
69  lattice.reset();
70 
71  const SimulationCell simulation_cell(lattice);
72 
73  ParticleSet ions(simulation_cell);
74 
75  ions.setName("ion");
76  ions.create({2});
77  ions.R[0] = {0.0, 1.0, 0.0};
78  ions.R[1] = {0.0, -1.0, 0.0};
79 
80  SpeciesSet& ion_species = ions.getSpeciesSet();
81  int index_species = ion_species.addSpecies("Na");
82  int index_charge = ion_species.addAttribute("charge");
83  int index_atomic_number = ion_species.addAttribute("atomic_number");
84  ion_species(index_charge, index_species) = 1;
85  ion_species(index_atomic_number, index_species) = 1;
86  ions.createSK();
87  ions.resetGroups(); // test_ecp.cpp claims this is needed
88  ions.update(); // elsewhere its implied this is needed
89 
90  ParticleSet ions2(ions);
91  ions2.update();
92 
93  ParticleSet elec(simulation_cell);
94  elec.setName("elec");
95  elec.create({2, 1});
96  elec.R[0] = {0.4, 0.0, 0.0};
97  elec.R[1] = {1.0, 0.0, 0.0};
98 
99  SpeciesSet& tspecies = elec.getSpeciesSet();
100  int upIdx = tspecies.addSpecies("u");
101  int chargeIdx = tspecies.addAttribute("charge");
102  int massIdx = tspecies.addAttribute("mass");
103  tspecies(chargeIdx, upIdx) = -1;
104  tspecies(massIdx, upIdx) = 1.0;
105 
106  int dnIdx = tspecies.addSpecies("d");
107  chargeIdx = tspecies.addAttribute("charge");
108  massIdx = tspecies.addAttribute("mass");
109  tspecies(chargeIdx, dnIdx) = -1;
110  tspecies(massIdx, dnIdx) = 1.0;
111 
112  elec.createSK();
113  elec.resetGroups();
114  const int ei_table_index = elec.addTable(ions);
115  elec.update();
116 
117  ParticleSet elec2(elec);
118  elec2.update();
119 
120  RefVector<ParticleSet> ptcls{elec, elec2};
121  RefVectorWithLeader<ParticleSet> p_list(elec, ptcls);
122 
123  RuntimeOptions runtime_options;
124  TrialWaveFunction psi(runtime_options);
125  TrialWaveFunction psi2(runtime_options);
126  RefVectorWithLeader<TrialWaveFunction> twf_list(psi, {psi, psi2});
127 
128  bool doForces = false;
129  bool use_DLA = false;
130 
131  NonLocalECPotential nl_ecp(ions, elec, psi, doForces, use_DLA);
132 
133  int num_walkers = 2;
134  int max_values = 10;
135  Matrix<Real> local_pots(num_walkers, max_values);
136  Matrix<Real> local_pots2(num_walkers, max_values);
137 
138  ResourceCollection pset_res("test_pset_res");
139  elec.createResource(pset_res);
140  ResourceCollectionTeamLock<ParticleSet> pset_lock(pset_res, p_list);
141 
142  std::vector<ListenerVector<Real>> listeners;
143  listeners.emplace_back("nonlocalpotential", getParticularListener(local_pots));
144  listeners.emplace_back("nonlocalpotential", getParticularListener(local_pots2));
145 
146  Matrix<Real> ion_pots(num_walkers, max_values);
147  Matrix<Real> ion_pots2(num_walkers, max_values);
148 
149  std::vector<ListenerVector<Real>> ion_listeners;
150  ion_listeners.emplace_back("nonlocalpotential", getParticularListener(ion_pots));
151  ion_listeners.emplace_back("nonlocalpotential", getParticularListener(ion_pots2));
152 
153 
154  // This took some time to sort out from the multistage mess of put and clones
155  // but this accomplishes in a straight forward way what I interpret to be done by that code.
157  ECPComponentBuilder ecp_comp_builder("test_read_ecp", comm, 4, 1);
158 
159  bool okay = ecp_comp_builder.read_pp_file("Na.BFD.xml");
160  REQUIRE(okay);
161  UPtr<NonLocalECPComponent> nl_ecp_comp = std::move(ecp_comp_builder.pp_nonloc);
162  nl_ecp.addComponent(0, std::move(nl_ecp_comp));
163  UPtr<OperatorBase> nl_ecp2_ptr = nl_ecp.makeClone(elec2, psi2);
164  auto& nl_ecp2 = dynamic_cast<NonLocalECPotential&>(*nl_ecp2_ptr);
165 
166  StdRandom<FullPrecReal> rng(10101);
167  StdRandom<FullPrecReal> rng2(10201);
168  nl_ecp.setRandomGenerator(&rng);
169  nl_ecp2.setRandomGenerator(&rng2);
170 
171  RefVector<OperatorBase> nl_ecps{nl_ecp, nl_ecp2};
172  RefVectorWithLeader<OperatorBase> o_list(nl_ecp, nl_ecps);
173  ResourceCollection nl_ecp_res("test_nl_ecp_res");
174  nl_ecp.createResource(nl_ecp_res);
175  ResourceCollectionTeamLock<OperatorBase> nl_ecp_lock(nl_ecp_res, o_list);
176 
177  // Despite what test_ecp.cpp says this does not need to be done.
178  // I think because of the pp
181 
182  CHECK(!testing::TestNonLocalECPotential::didGridChange(nl_ecp));
183 
184  ListenerOption<Real> listener_opt{listeners, ion_listeners};
185  testing::TestNonLocalECPotential::mw_evaluateImpl(nl_ecp, o_list, twf_list, p_list, false, listener_opt, true);
186 
187  // I'd like to see this gone when legacy drivers are dropped but for now we'll check against
188  // the single particle API
189  auto value = o_list[0].evaluateDeterministic(p_list[0]);
190 
191  CHECK(std::accumulate(local_pots.begin(), local_pots.begin() + local_pots.cols(), 0.0) == Approx(value));
192  CHECK(std::accumulate(local_pots2.begin(), local_pots2.begin() + local_pots2.cols(), 0.0) == Approx(value));
193  CHECK(std::accumulate(ion_pots.begin(), ion_pots.begin() + ion_pots.cols(), 0.0) == Approx(-2.1047365665));
194  CHECK(std::accumulate(ion_pots2.begin(), ion_pots2.begin() + ion_pots2.cols(), 0.0) == Approx(-2.1047365665));
195 
196  CHECK(!testing::TestNonLocalECPotential::didGridChange(nl_ecp));
197 
198  elec.R[0] = {0.5, 0.0, 2.0};
199  elec.update();
200 
201  testing::TestNonLocalECPotential::mw_evaluateImpl(nl_ecp, o_list, twf_list, p_list, false, listener_opt, true);
202 
203  CHECK(!testing::TestNonLocalECPotential::didGridChange(nl_ecp));
204  auto value2 = o_list[0].evaluateDeterministic(elec);
205 
206  CHECK(std::accumulate(local_pots.begin(), local_pots.begin() + local_pots.cols(), 0.0) == Approx(value2));
207  // check the second walker which will be unchanged.
208  CHECK(std::accumulate(local_pots2[1], local_pots2[1] + local_pots2.cols(), 0.0) == Approx(value));
209 
210  // Randomizing grid does nothing for Na pp
211  testing::TestNonLocalECPotential::mw_evaluateImpl(nl_ecp, o_list, twf_list, p_list, false, listener_opt, false);
212  auto value3 = o_list[0].evaluateDeterministic(p_list[0]);
213  CHECK(std::accumulate(local_pots.begin(), local_pots.begin() + local_pots.cols(), 0.0) == Approx(value3));
214 }
HamiltonianRef::FullPrecRealType FullPrecRealType
const char num_walkers[]
Definition: HDFVersion.h:37
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
ForceBase::Real Real
Definition: ForceBase.cpp:26
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
auto getParticularListener(Matrix< T > &local_pots)
QMCTraits::RealType RealType
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
DMCRefEnergy::FullPrecReal FullPrecReal
void copyGridUnrotatedForTest(NonLocalECPComponent &nlpp)
Definition: test_ecp.cpp:153

◆ TEST_CASE() [230/537]

qmcplusplus::TEST_CASE ( "DiracMatrix_inverse"  ,
""  [wavefunction][fermion] 
)

Definition at line 58 of file test_DiracMatrix.cpp.

References CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), Matrix< T, Alloc >::cols(), Matrix< T, Alloc >::data(), TestMatrix1::fillInput(), TestMatrix1::fillInverse(), DiracMatrix< T_FP >::invert_transpose(), TestMatrix1::logDet(), Matrix< T, Alloc >::resize(), Matrix< T, Alloc >::rows(), and qmcplusplus::simd::transpose().

59 {
60  DiracMatrix<ValueType> dm;
61 
62  Matrix<ValueType> a, a_T, a_inv;
63  LogValue log_value;
64  a.resize(3, 3);
65  a_T.resize(3, 3);
66  a_inv.resize(3, 3);
67 
68  TestMatrix1::fillInput(a);
69 
70  simd::transpose(a.data(), a.rows(), a.cols(), a_T.data(), a_T.rows(), a_T.cols());
71  dm.invert_transpose(a_T, a_inv, log_value);
72  CHECK(log_value == LogComplexApprox(TestMatrix1::logDet()));
73 
74  Matrix<ValueType> b;
75  b.resize(3, 3);
76 
77  TestMatrix1::fillInverse(b);
78 
79  auto check_matrix_result = checkMatrix(a_inv, b);
80  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
81 }
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
Catch::Detail::LogComplexApprox LogComplexApprox
AntiSymTensor< T, D > transpose(const AntiSymTensor< T, D > &rhs)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::complex< double > LogValue

◆ TEST_CASE() [231/537]

qmcplusplus::TEST_CASE ( "gaussian random array length 3"  ,
""  [particle_base] 
)

Definition at line 58 of file test_random_seq.cpp.

References assignGaussRand(), CHECK(), and qmcplusplus::Units::charge::e.

59 {
60  FakeRandom rg;
61  std::vector<double> a(4);
62  assignGaussRand(a.data(), 3, rg);
63 
64  // assuming RNG input is 0.5
65  CHECK(a[0] == Approx(-1.1774100224305424));
66  CHECK(a[1] == Approx(1.4419114152535772e-16));
67  CHECK(a[2] == Approx(-1.1774100224305424));
68  CHECK(a[3] == Approx(0.0)); // ensure no overflow
69 }
void assignGaussRand(T *restrict a, unsigned n, RG &rng)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [232/537]

qmcplusplus::TEST_CASE ( "FairDivideLow_three"  ,
""  [utilities] 
)

Definition at line 58 of file test_partition.cpp.

References FairDivideLow(), and REQUIRE().

59 {
60  std::vector<int> out;
61  FairDivideLow(3, 1, out);
62  REQUIRE(out.size() == 2);
63  REQUIRE(out[0] == 0);
64  REQUIRE(out[1] == 3);
65 
66  FairDivideLow(3, 2, out);
67  REQUIRE(out.size() == 3);
68  REQUIRE(out[0] == 0);
69  REQUIRE(out[1] == 1);
70  REQUIRE(out[2] == 3);
71 
72  FairDivideLow(3, 3, out);
73  REQUIRE(out.size() == 4);
74  REQUIRE(out[0] == 0);
75  REQUIRE(out[1] == 1);
76  REQUIRE(out[2] == 2);
77  REQUIRE(out[3] == 3);
78 }
void FairDivideLow(int ntot, int npart, IV &adist)
partition ntot elements among npart
Definition: FairDivide.h:114
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [233/537]

qmcplusplus::TEST_CASE ( "Estimator adhoc addVector operator"  ,
""  [estimators] 
)

Definition at line 60 of file test_manager.cpp.

References REQUIRE().

61 {
62  int num_scalars = 3;
63  std::vector<double> vec_a{1.0, 2.0, 3.0};
64  std::vector<double> vec_b{2.0, 3.0, 4.0};
65  std::vector<std::vector<double>> est{vec_a, vec_b};
66  auto addVectors = [](const auto& vec_a, const auto& vec_b) {
67  std::vector<ScalarEstimatorBase::RealType> result_vector(vec_a.size(), 0.0);
68  for (int i = 0; i < vec_a.size(); ++i)
69  result_vector[i] = vec_a[i] + vec_b[i];
70  return result_vector;
71  };
72 
73  std::vector<double> reduced_scalars(num_scalars);
74  reduced_scalars = std::accumulate(est.begin(), est.end(), std::vector<double>(num_scalars, 0.0), addVectors);
75  std::vector<double> correct{3.0, 5.0, 7.0};
76  REQUIRE(reduced_scalars == correct);
77 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [234/537]

qmcplusplus::TEST_CASE ( "periodic_bulk_bconds"  ,
""  [lattice] 
)

Lattice is defined but Open BC is also used.

Definition at line 60 of file test_ParticleBConds.cpp.

References DTD_BConds< T, D, SC >::apply_bc(), CrystalLattice< T, D >::BoxBConds, CHECK(), Tensor< T, D >::diagonal(), OHMMS_PRECISION, CrystalLattice< T, D >::R, REQUIRE(), CrystalLattice< T, D >::reset(), and CrystalLattice< T, D >::Volume.

61 {
62  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> Lattice;
63  Lattice.BoxBConds = false; // Open BC
64  Lattice.R.diagonal(0.4);
65  Lattice.reset();
66 
67  CHECK(Lattice.Volume == Approx(0.4 * 0.4 * 0.4));
68 
69  DTD_BConds<OHMMS_PRECISION, 3, SUPERCELL_BULK> bcond(Lattice);
70 
71  vec_t v1(0.0, 0.0, 0.0);
72 
73  OHMMS_PRECISION r2 = bcond.apply_bc(v1);
74  REQUIRE(r2 == 0.0);
75 
76  vec_t v2(0.5, 0.0, 0.0);
77  r2 = bcond.apply_bc(v2);
78  CHECK(r2 == Approx(0.01));
79 }
TinyVector< double, 3 > vec_t
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
POLT::ParticleLayout Lattice
#define OHMMS_PRECISION
Definition: config.h:70
Scalar_t Volume
Physical properties of a supercell.
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
REQUIRE(std::filesystem::exists(filename))
void diagonal(const T &rhs)
Definition: Tensor.h:205
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

◆ TEST_CASE() [235/537]

qmcplusplus::TEST_CASE ( "MomentumDistribution::MomentumDistribution"  ,
""  [estimators] 
)

Definition at line 61 of file test_MomentumDistribution.cpp.

References ProjectData::BATCH, CHECK(), comm, OHMMS::Controller, crowd, doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), lattice, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), qmcplusplus::testing::makeTestLattice(), node, oeba, okay, Libxml2Document::parseFromString(), particle_pool, pset, test_project, MomentumDistributionTests::testCopyConstructor(), and wavefunction_pool.

62 {
63  // clang-format: off
64  const char* xml = R"(
65 <estimator type="MomentumDistribution" name="nofk" samples="5" kmax="3"/>
66 )";
67  // clang-format: on
68 
69  // Read xml into input object
71  bool okay = doc.parseFromString(xml);
72  if (!okay)
73  throw std::runtime_error("cannot parse MomentumDistributionInput section");
74  xmlNodePtr node = doc.getRoot();
75  MomentumDistributionInput mdi(node);
76 
77  // Instantiate other dependencies (internal QMCPACK objects)
79  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
82 
83  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
84  auto wavefunction_pool =
85  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
86  auto& pset = *(particle_pool.getParticleSet("e"));
87  DataLocality dl = DataLocality::crowd;
88 
89  // Build from input
90  MomentumDistribution md(std::move(mdi), pset.getTotalNum(), pset.getTwist(), pset.getLattice(), dl);
91 
92  CHECK(md.twist[0] == Approx(0.0));
93  CHECK(md.twist[1] == Approx(0.0));
94  CHECK(md.twist[2] == Approx(0.0));
95  CHECK(md.kPoints.size() == 27);
96 
97  // make sure there is something in mds data
98  using namespace testing;
99  OEBAccessor oeba(md);
100  oeba[0] = 1.0;
101 
102  MomentumDistributionTests mdt;
103  mdt.testCopyConstructor(md);
104 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
DataLocality
data locality with respect to walker buffer
Definition: DataLocality.h:19
OEBAccessor oeba(sdn)

◆ TEST_CASE() [236/537]

qmcplusplus::TEST_CASE ( "Gaussian Combo"  ,
""  [numerics] 
)

Definition at line 61 of file test_gaussian_basis.cpp.

References GaussianCombo< T >::addGaussian(), CHECK(), GaussianCombo< T >::d2Y, GaussianCombo< T >::d3Y, GaussianCombo< T >::df(), GaussianCombo< T >::dY, GaussianCombo< T >::evaluate(), GaussianCombo< T >::evaluateAll(), GaussianCombo< T >::evaluateWithThirdDeriv(), GaussianCombo< T >::f(), REQUIRE(), GaussianCombo< T >::size(), and GaussianCombo< T >::Y.

62 {
63  GaussianCombo<real_type> gc(0, false);
64 
65  // STO-3G for H
66  gc.addGaussian(0.15432897, 3.42525091);
67  gc.addGaussian(0.53532814, 0.62391373);
68  gc.addGaussian(0.44463454, 0.16885540);
69 
70  REQUIRE(gc.size() == 3);
71 
72  real_type r = 1.3;
73  real_type f = gc.f(r);
74  //std::cout << "f = " << f << std::endl << std::endl;
75  CHECK(f == Approx(0.556240444149480));
76 
77  f = gc.evaluate(r, 1.0 / r);
78  CHECK(f == Approx(0.556240444149480));
79 
80  real_type df = gc.df(r);
81  CHECK(df == Approx(-0.661028435778766));
82 
83  gc.evaluateAll(r, 1.0 / r);
84  CHECK(gc.Y == Approx(0.556240444149480));
85  CHECK(gc.dY == Approx(-0.661028435778766));
86  CHECK(gc.d2Y == Approx(0.643259180749128));
87 
88  gc.evaluateWithThirdDeriv(r, 1.0 / r);
89  CHECK(gc.Y == Approx(0.556240444149480));
90  CHECK(gc.dY == Approx(-0.661028435778766));
91  CHECK(gc.d2Y == Approx(0.643259180749128));
92  CHECK(gc.d3Y == Approx(-0.896186412781167));
93 }
REQUIRE(std::filesystem::exists(filename))
OHMMS_PRECISION real_type
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [237/537]

qmcplusplus::TEST_CASE ( "test_loop_control"  ,
""  [utilities] 
)

Definition at line 62 of file test_runtime_manager.cpp.

References RunTimeControl< CLOCK >::checkStop(), RunTimeControl< CLOCK >::generateStopMessage(), REQUIRE(), RunTimeControl< CLOCK >::runtime_padding(), LoopTimer< CLOCK >::start(), and LoopTimer< CLOCK >::stop().

63 {
64  // fake clock advances every time "now" is called
65  LoopTimer<FakeChronoClock> loop;
66  int max_cpu_secs = 9;
67  RunTimeManager<FakeChronoClock> rm; // fake clock = 1
68  RunTimeControl<FakeChronoClock> rc(rm, max_cpu_secs, "dummy", false);
69  rc.runtime_padding(1.0);
70  REQUIRE(!rc.checkStop(loop)); // fake clock = 2
71 
72  loop.start(); // fake clock = 3
73  loop.stop(); // fake clock = 4
74  // fake clock = 5
75  // estimated time with margin and padding = 1.0 sec/it * 1.1 + 1.0 (pad) = 2.1
76  // remaining = 9 - 4.0 = 5.0 enough time for another loop.
77  REQUIRE(!rc.checkStop(loop));
78 
79  loop.start(); // fake clock = 6
80  loop.stop(); // fake clock = 7
81  // fake clock = 8
82  // estimated time with margin and padding = 1.0 sec/it * 1.1 + 1.0 = 2.1
83  // remaining = 9 - 8.0 = 1.0 not enough time for another loop
84  REQUIRE(rc.checkStop(loop));
85 
86  std::string msg = rc.generateStopMessage("QMC", 2);
87  REQUIRE(msg.size() > 0);
88 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [238/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A BCC H Ewald3D"  ,
""  [hamiltonian] 
)

Definition at line 62 of file test_coulomb_pbcAA_ewald.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evalConsts(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, and ParticleSet::setName().

63 {
64  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
65  lattice.BoxBConds = true; // periodic
66  lattice.R.diagonal(3.77945227);
67  lattice.reset();
68 
69  const SimulationCell simulation_cell(lattice);
70  ParticleSet ions(simulation_cell);
71  ParticleSet elec(simulation_cell);
72 
73  ions.setName("ion");
74  ions.create({2});
75  ions.R[0] = {0.0, 0.0, 0.0};
76  ions.R[1] = {1.88972614, 1.88972614, 1.88972614};
77  SpeciesSet& ion_species = ions.getSpeciesSet();
78  int pIdx = ion_species.addSpecies("H");
79  int pChargeIdx = ion_species.addAttribute("charge");
80  ion_species(pChargeIdx, pIdx) = 1;
81  ions.createSK();
82 
83  LRCoulombSingleton::CoulombHandler = std::make_unique<EwaldHandler3D>(ions);
84  LRCoulombSingleton::CoulombHandler->initBreakup(ions);
85 
86  CoulombPBCAA caa(ions, false, false, false);
87 
88  // Background charge term
89  double consts = caa.evalConsts();
90  CHECK(consts == Approx(-1.690675)); // not validated
91 
92  double val = caa.evaluate(elec);
93  CHECK(val == Approx(-0.963074)); // not validated
94 
95  LRCoulombSingleton::CoulombHandler.reset(nullptr);
96 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [239/537]

qmcplusplus::TEST_CASE ( "integrateListeners"  ,
""  [hamiltonian] 
)

QMCHamiltonian + Hamiltonians with listeners integration test.

Definition at line 62 of file test_QMCHamiltonian.cpp.

References Matrix< T, Alloc >::begin(), CHECK(), comm, OHMMS::Controller, convertUPtrToRefVector(), copy(), Matrix< T, Alloc >::end(), generate_test_data, qmcplusplus::testing::getParticularListener(), qmcplusplus::testing::getSummingListener(), hamiltonian_pool, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), MinimalHamiltonianPool::makeHamWithEEEI(), QMCHamiltonian::mw_evaluate(), QMCHamiltonian::mw_registerKineticListener(), QMCHamiltonian::mw_registerLocalEnergyListener(), QMCHamiltonian::mw_registerLocalIonPotentialListener(), QMCHamiltonian::mw_registerLocalPotentialListener(), ParticleSet::mw_update(), qmcplusplus::hdf::num_walkers, particle_pool, pset_target, and wavefunction_pool.

63 {
64  RuntimeOptions runtime_options;
66 
67  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
68  auto wavefunction_pool = MinimalWaveFunctionPool::make_diamondC_1x1x1(runtime_options, comm, particle_pool);
69  auto hamiltonian_pool = MinimalHamiltonianPool::makeHamWithEEEI(comm, particle_pool, wavefunction_pool);
70  auto& pset_target = *(particle_pool.getParticleSet("e"));
71  //auto& species_set = pset_target.getSpeciesSet();
72  //auto& spo_map = wavefunction_pool.getWaveFunction("wavefunction")->getSPOMap();
73  auto& trial_wavefunction = *(wavefunction_pool.getPrimary());
74 
75  UPtrVector<QMCHamiltonian> hams;
76  UPtrVector<TrialWaveFunction> twfs;
77  std::vector<ParticleSet> psets;
78 
79  // This must be done before clones otherwise the clone particle sets do not have the correct state.
80  hamiltonian_pool.getPrimary()->informOperatorsOfListener();
81 
82 
83  int num_walkers = 4;
84  int num_electrons = particle_pool.getParticleSet("e")->getTotalNum();
85  int num_ions = particle_pool.getParticleSet("ion")->getTotalNum();
86 
87  for (int iw = 0; iw < num_walkers; ++iw)
88  {
89  psets.emplace_back(pset_target);
90  psets.back().randomizeFromSource(*particle_pool.getParticleSet("ion"));
91  twfs.emplace_back(trial_wavefunction.makeClone(psets.back()));
92  hams.emplace_back(hamiltonian_pool.getPrimary()->makeClone(psets.back(), *twfs.back()));
93  }
94 
95  RefVector<QMCHamiltonian> ham_refs = convertUPtrToRefVector(hams);
96  RefVectorWithLeader<QMCHamiltonian> ham_list{ham_refs[0], ham_refs};
97 
98  ResourceCollection ham_res("test_ham_res");
99  ham_list.getLeader().createResource(ham_res);
100  ResourceCollectionTeamLock<QMCHamiltonian> ham_lock(ham_res, ham_list);
101 
102  Matrix<Real> kinetic(num_walkers, num_electrons);
103  Matrix<Real> local_pots(num_walkers, num_electrons);
104  Matrix<Real> local_nrg(num_walkers, num_electrons);
105  Matrix<Real> ion_pots(num_walkers, num_ions);
106 
109 
110  ListenerVector<Real> listener_kinetic("kinetic", getSummingListener(kinetic));
111  QMCHamiltonian::mw_registerKineticListener(ham_list.getLeader(), listener_kinetic);
112  ListenerVector<Real> listener_potential("potential", getSummingListener(local_pots));
113  QMCHamiltonian::mw_registerLocalPotentialListener(ham_list.getLeader(), listener_potential);
114  ListenerVector<Real> listener_energy("local_energy", getSummingListener(local_nrg));
115  QMCHamiltonian::mw_registerLocalEnergyListener(ham_list.getLeader(), listener_energy);
116  ListenerVector<Real> listener_ion_potential("ion_potential", getSummingListener(ion_pots));
117  QMCHamiltonian::mw_registerLocalIonPotentialListener(ham_list.getLeader(), listener_ion_potential);
118 
119  auto p_refs = makeRefVector<ParticleSet>(psets);
120  RefVectorWithLeader<ParticleSet> p_list{p_refs[0], p_refs};
121 
122  ResourceCollection pset_res("test_pset_res");
123  p_list.getLeader().createResource(pset_res);
124  ResourceCollectionTeamLock<ParticleSet> pset_lock(pset_res, p_list);
125 
126  auto twf_refs = convertUPtrToRefVector(twfs);
127  RefVectorWithLeader<TrialWaveFunction> twf_list{twf_refs[0], twf_refs};
128 
129  ResourceCollection wfc_res("test_wfc_res");
130  twf_list.getLeader().createResource(wfc_res);
131  ResourceCollectionTeamLock<TrialWaveFunction> mw_wfc_lock(wfc_res, twf_list);
132 
133  // Otherwise we'll get no kinetic energy values
134  p_refs[0].get().L[0] = 1.0;
135  p_refs[1].get().L[1] = 1.0;
136  p_refs[2].get().L[2] = 1.0;
137  p_refs[3].get().L[3] = 1.0;
138 
139  if constexpr (generate_test_data)
140  {
141  std::cout << "QMCHamiltonian-registerListeners initialize psets with:\n{";
142 
143  for (int iw = 0; iw < num_walkers; ++iw)
144  {
145  //psets.emplace_back(pset_target);
146  std::cout << "{";
147  for (auto r : p_refs[iw].get().R)
148  std::cout << NativePrint(r) << ",";
149  std::cout << "},\n";
150  }
151  std::cout << "}\n";
152  }
153  else
154  {
155  std::vector<ParticleSet::ParticlePos> deterministic_rs = {
156  {
157  {0.515677886, 0.9486072745, -1.17423246},
158  {-0.3166678423, 1.376550506, 1.445290031},
159  {1.96071365, 2.47265689, 1.051449486},
160  {0.745853269, 0.5551359072, 4.080774681},
161  {-0.3515016103, -0.5192222523, 0.9941510909},
162  {-0.8354426872, 0.7071638258, -0.3409843552},
163  {0.4386044751, 1.237378731, 2.331874152},
164  {2.125850717, 0.3221067321, 0.5825731561},
165  },
166  {
167  {-0.4633736785, 0.06318772224, -0.8580153742},
168  {-1.174926354, -0.6276503679, 0.07458759314},
169  {1.327618206, 2.085829379, 1.415749862},
170  {0.9114727103, 0.1789183931, -0.08135540251},
171  {-2.267908723, 0.802928773, 0.9522812957},
172  {1.502715257, -1.84493529, 0.2805620469},
173  {3.168934617, 0.1348337978, 1.371092768},
174  {0.8310229518, 1.070827168, 1.18016733},
175  },
176  {
177  {-0.04847732172, -1.201739871, -1.700527771},
178  {0.1589259538, -0.3096047065, -2.066626415},
179  {2.255976232, 1.629132391, -0.8024446773},
180  {2.534792993, 3.121092901, 1.609780703},
181  {-0.2892376071, -0.152022511, -2.727613712},
182  {0.2477154804, 0.5039232765, 2.995702733},
183  {3.679345099, 3.037770313, 2.808899306},
184  {0.6418578532, 1.935944544, 1.515637954},
185  },
186  {
187  {0.91126951, 0.0234699242, 1.442297821},
188  {-0.9240061217, -0.1014997844, 0.9081020061},
189  {1.887794866, 2.210192703, 2.209118551},
190  {2.758945014, -1.21140421, 1.3337907},
191  {0.376540703, 0.3485486555, 0.9056881595},
192  {-0.3512770187, -0.4056820917, -2.068499576},
193  {0.5358460986, 2.720153363, 1.41999706},
194  {2.284020089, 1.173071915, 1.044597715},
195  },
196  };
197  for (int iw = 0; iw < num_walkers; ++iw)
198  {
199  p_refs[iw].get().R = deterministic_rs[iw];
200  }
201  }
202 
203  ParticleSet::mw_update(p_list);
204 
205  auto energies = QMCHamiltonian::mw_evaluate(ham_list, twf_list, p_list);
206 
207  CHECK(ham_list[0].getLocalEnergy() == energies[0]);
208  CHECK(ham_list[1].getLocalEnergy() == energies[1]);
209  CHECK(ham_list[0].getLocalEnergy() == p_list[0].PropertyList[WP::LOCALENERGY]);
210  CHECK(ham_list[1].getLocalEnergy() == p_list[1].PropertyList[WP::LOCALENERGY]);
211 
212  if constexpr (generate_test_data)
213  {
214  std::vector<Real> vector_kinetic;
215  std::copy(kinetic.begin(), kinetic.end(), std::back_inserter(vector_kinetic));
216  std::cout << " size kinetic: " << vector_kinetic.size() << '\n';
217  std::cout << " std::vector<Real> kinetic_ref_vector = " << NativePrint(vector_kinetic) << ";\n";
218 
219  std::vector<Real> vector_pots;
220  std::copy(local_pots.begin(), local_pots.end(), std::back_inserter(vector_pots));
221  std::cout << " size potentials: " << vector_pots.size() << '\n';
222  std::cout << " std::vector<Real> potential_ref_vector = " << NativePrint(vector_pots) << ";\n";
223 
224  std::vector<Real> vector_ions;
225  std::copy(ion_pots.begin(), ion_pots.end(), std::back_inserter(vector_ions));
226  std::cout << " size ion potentials: " << vector_ions.size() << '\n';
227  std::cout << " std::vector<Real> ion_potential_ref_vector = " << NativePrint(vector_ions) << ";\n";
228  }
229  else
230  {
231  std::vector<Real> kinetic_ref_vector = {
232  -0.5, -0, -0, -0, -0, -0, -0, -0, -0, -0.5, -0, -0, -0, -0, -0, -0,
233  -0, -0, -0.5, -0, -0, -0, -0, -0, -0, -0, -0, -0.5, -0, -0, -0, -0,
234  };
235  std::vector<Real> potential_ref_vector = {
236  -0.4304472804, -0.2378402054, -0.9860844016, -0.08201235533, -0.8099648952, -0.9536881447, -0.4498806596,
237  -0.4415832162, -0.9407452345, -0.6449454427, -2.240605593, -1.194514155, 0.04097786546, -0.1860728562,
238  -0.1374063194, -0.8808210492, 0.3020428121, 0.3772183955, -0.112801373, -0.5531326532, 0.4633262753,
239  0.3185032904, 0.3001851439, -0.4555109739, -0.2190704495, -0.7140043378, -1.641614318, 0.1718038917,
240  -0.7621642947, 0.2606962323, -0.1486036181, -1.001747012,
241  };
242  std::vector<Real> ion_potential_ref_vector = {
243  0.04332125187, 0.173753351, -0.9332901239, -1.323815107, 1.695662975, 0.5990064144, 0.1634206772, -1.207304001,
244  };
245 
246  std::size_t num_data = num_electrons * num_walkers;
247  for (std::size_t id = 0; id < num_data; ++id)
248  {
249  INFO("id : " << id);
250  CHECK(kinetic_ref_vector[id] == Approx(kinetic(id)));
251  }
252 
253  for (std::size_t id = 0; id < num_data; ++id)
254  {
255  INFO("id : " << id);
256  CHECK(potential_ref_vector[id] == Approx(local_pots(id)));
257  }
258 
259  std::size_t num_data_ions = num_ions * num_walkers;
260  for (std::size_t id = 0; id < num_data_ions; ++id)
261  {
262  INFO("id : " << id);
263  CHECK(ion_potential_ref_vector[id] == Approx(ion_pots(id)));
264  }
265 
266  // When only EE and EI coulomb potentials the local energy is just the sum of
267  // the local_pots and kinetic
268  auto sum_local_pots = std::accumulate(local_pots.begin(), local_pots.end(), 0.0);
269  auto sum_kinetic = std::accumulate(kinetic.begin(), kinetic.end(), 0.0);
270  auto sum_local_nrg = std::accumulate(local_nrg.begin(), local_nrg.end(), 0.0);
271  CHECK(sum_local_nrg == Approx(sum_local_pots + sum_kinetic));
272 
273  // Here we test consistency between the per particle energies and the per hamiltonian energies
274  typename decltype(energies)::value_type hamiltonian_local_nrg_sum = 0.0;
275  typename decltype(energies)::value_type energies_sum = 0.0;
276  for (int iw = 0; iw < num_walkers; ++iw) {
277  hamiltonian_local_nrg_sum += ham_list[iw].getLocalEnergy();
278  energies_sum += energies[iw];
279  }
280 
281  // the QMCHamiltonian.getLocalEnergy() contains the ion_potential as well.
282  sum_local_nrg += std::accumulate(ion_pots.begin(), ion_pots.end(), 0.0);
283  CHECK(sum_local_nrg == Approx(hamiltonian_local_nrg_sum));
284  CHECK(sum_local_nrg == Approx(energies_sum));
285  }
286 }
const char num_walkers[]
Definition: HDFVersion.h:37
constexpr bool generate_test_data
set to true to generate new random R for particles.
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
static RefVector< T > convertUPtrToRefVector(const UPtrVector< T > &ptr_list)
convert a vector of std::unique_ptrs<T> to a refvector<T>
void copy(const Array< T1, 3 > &src, Array< T2, 3 > &dest)
Definition: Blitz.h:639
Wrapping information on parallelism.
Definition: Communicate.h:68
auto getParticularListener(Matrix< T > &local_pots)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
QMCTraits::FullPrecRealType value_type
auto getSummingListener(Matrix< T > &local_pots)

◆ TEST_CASE() [240/537]

qmcplusplus::TEST_CASE ( "VMCBatched::calc_default_local_walkers"  ,
""  [drivers] 
)

Definition at line 62 of file test_VMCBatched.cpp.

References ProjectData::BATCH, test_project, and VMCBatchedTest::testCalcDefaultLocalWalkers().

63 {
64  using namespace testing;
65  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
66  VMCBatchedTest vbt(test_project);
67  vbt.testCalcDefaultLocalWalkers();
68 }
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)

◆ TEST_CASE() [241/537]

qmcplusplus::TEST_CASE ( "Pade Jastrow"  ,
""  [wavefunction] 
)

Definition at line 63 of file test_pade_jastrow.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), RadialJastrowBuilder::buildComponent(), CHECK(), OHMMS::Controller, ParticleSet::create(), doc, ParticleSet::G, Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), ParticleSet::L, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), and ParticleSet::update().

64 {
66 
67  const SimulationCell simulation_cell;
68  ParticleSet ions_(simulation_cell);
69  ParticleSet elec_(simulation_cell);
70 
71  // Need 1 electron and 1 proton, somehow
72  ions_.setName("ion");
73  ions_.create({1});
74  ions_.R[0] = {0.0, 0.0, 0.0};
75  elec_.setName("elec");
76  elec_.create({2, 0});
77  elec_.R[0] = {-0.28, 0.0225, -2.709};
78  elec_.R[1] = {-1.08389, 1.9679, -0.0128914};
79  SpeciesSet& tspecies = elec_.getSpeciesSet();
80  int upIdx = tspecies.addSpecies("u");
81  int downIdx = tspecies.addSpecies("d");
82  int chargeIdx = tspecies.addAttribute("charge");
83  int massIdx = tspecies.addAttribute("mass");
84  tspecies(chargeIdx, upIdx) = -1;
85  tspecies(chargeIdx, downIdx) = -1;
86  tspecies(massIdx, upIdx) = 1;
87  tspecies(massIdx, downIdx) = 1;
88 
89  const char* particles = R"(<tmp>
90 <jastrow name="Jee" type="Two-Body" function="pade">
91  <correlation speciesA="u" speciesB="u">
92  <var id="juu_b" name="B">0.1</var>
93  </correlation>
94 </jastrow>
95 </tmp>
96 )";
98  bool okay = doc.parseFromString(particles);
99  REQUIRE(okay);
100 
101  xmlNodePtr root = doc.getRoot();
102 
103  xmlNodePtr jas1 = xmlFirstElementChild(root);
104 
105  // cusp = -0.25
106  // r_ee = 3.42050023755
107  RadialJastrowBuilder jastrow(c, elec_);
108  std::unique_ptr<WaveFunctionComponent> jas(jastrow.buildComponent(jas1));
109 
110  // update all distance tables
111  elec_.update();
112 
113  double logpsi_real = std::real(jas->evaluateLog(elec_, elec_.G, elec_.L));
114  CHECK(logpsi_real == Approx(-1.862821769493147));
115 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [242/537]

qmcplusplus::TEST_CASE ( "DiracMatrixComputeCUDA_different_batch_sizes"  ,
""  [wavefunction][fermion] 
)

Definition at line 63 of file test_DiracMatrixComputeCUDA.cpp.

References qmcplusplus::Units::distance::A, CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), qmcplusplus::syclBLAS::copy_n(), Matrix< T, Alloc >::data(), DiracMatrixComputeCUDA< VALUE_FP >::invert_transpose(), log_values(), DiracMatrixComputeCUDA< VALUE_FP >::mw_invertTranspose(), queue, and Matrix< T, Alloc >::resize().

64 {
65  OffloadPinnedMatrix<double> mat_a;
66  mat_a.resize(4, 4);
67  std::vector<double> A{2, 5, 8, 7, 5, 2, 2, 8, 7, 5, 6, 6, 5, 4, 4, 8};
68  std::copy_n(A.data(), 16, mat_a.data());
69  OffloadPinnedVector<std::complex<double>> log_values;
70  log_values.resize(1);
71  OffloadPinnedMatrix<double> inv_mat_a;
72  inv_mat_a.resize(4, 4);
73  compute::Queue<PlatformKind::CUDA> queue;
74  DiracMatrixComputeCUDA<double> dmcc;
75 
76  dmcc.invert_transpose(queue, mat_a, inv_mat_a, log_values);
77 
78 
79  OffloadPinnedMatrix<double> mat_b;
80  mat_b.resize(4, 4);
81  double invA[16]{-0.08247423, -0.26804124, 0.26804124, 0.05154639, 0.18556701, -0.89690722, 0.39690722, 0.13402062,
82  0.24742268, -0.19587629, 0.19587629, -0.15463918, -0.29896907, 1.27835052, -0.77835052, 0.06185567};
83  std::copy_n(invA, 16, mat_b.data());
84 
85  auto check_matrix_result = checkMatrix(inv_mat_a, mat_b);
86  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
87 
88  OffloadPinnedMatrix<double> mat_a2;
89  mat_a2.resize(4, 4);
90  std::copy_n(A.begin(), 16, mat_a2.data());
91  OffloadPinnedMatrix<double> inv_mat_a2;
92  inv_mat_a2.resize(4, 4);
93 
94  RefVector<const OffloadPinnedMatrix<double>> a_mats{mat_a, mat_a2};
95  RefVector<OffloadPinnedMatrix<double>> inv_a_mats{inv_mat_a, inv_mat_a2};
96 
97  log_values.resize(2);
98  dmcc.mw_invertTranspose(queue, a_mats, inv_a_mats, log_values);
99 
100  check_matrix_result = checkMatrix(inv_mat_a, mat_b);
101  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
102  check_matrix_result = checkMatrix(inv_mat_a2, mat_b);
103  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
104 
105  CHECK(log_values[0] == ComplexApprox(std::complex<double>{5.267858159063328, 6.283185307179586}));
106  CHECK(log_values[1] == ComplexApprox(std::complex<double>{5.267858159063328, 6.283185307179586}));
107 
108  OffloadPinnedMatrix<double> mat_a3;
109  mat_a3.resize(4, 4);
110  std::copy_n(A.begin(), 16, mat_a3.data());
111  OffloadPinnedMatrix<double> inv_mat_a3;
112  inv_mat_a3.resize(4, 4);
113 
114  a_mats[1] = mat_a3;
115 
116  RefVector<const OffloadPinnedMatrix<double>> a_mats3{mat_a, mat_a2, mat_a3};
117  RefVector<OffloadPinnedMatrix<double>> inv_a_mats3{inv_mat_a, inv_mat_a2, inv_mat_a3};
118 
119  log_values.resize(3);
120  dmcc.mw_invertTranspose(queue, a_mats3, inv_a_mats3, log_values);
121 
122  check_matrix_result = checkMatrix(inv_mat_a, mat_b);
123  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
124  check_matrix_result = checkMatrix(inv_mat_a2, mat_b);
125  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
126  check_matrix_result = checkMatrix(inv_mat_a3, mat_b);
127  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
128 
129  CHECK(log_values[0] == ComplexApprox(std::complex<double>{5.267858159063328, 6.283185307179586}));
130  CHECK(log_values[1] == ComplexApprox(std::complex<double>{5.267858159063328, 6.283185307179586}));
131  CHECK(log_values[2] == ComplexApprox(std::complex<double>{5.267858159063328, 6.283185307179586}));
132 }
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
sycl::event copy_n(sycl::queue &aq, const T1 *restrict VA, size_t array_size, T2 *restrict VC, const std::vector< sycl::event > &events)
Definition: syclBLAS.cpp:548
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [243/537]

qmcplusplus::TEST_CASE ( "OutputManager output"  ,
""  [utilities] 
)

Definition at line 63 of file test_output_manager.cpp.

References app_debug, app_error(), app_log(), app_out, app_summary(), DEBUG, debug_out, err_out, HIGH, init_string_output(), LOW, outputManager, REQUIRE(), reset_string_output(), OutputManagerClass::setVerbosity(), and summary_out.

64 {
66 
67  // Low verbosity
69 
70  app_summary() << "test1";
71  app_log() << "test2";
72  app_debug() << "test3";
73  app_error() << "test4";
74  REQUIRE(summary_out.str() == "test1");
75  REQUIRE(app_out.str() == "");
76  REQUIRE(debug_out.str() == "");
77  REQUIRE(err_out.str() == "ERROR test4");
78 
80 
81  // High verbosity
83 
84  app_summary() << "test5";
85  app_log() << "test6";
86  app_debug() << "test7";
87  app_error() << "test8";
88  REQUIRE(summary_out.str() == "test5");
89  REQUIRE(app_out.str() == "test6");
90  REQUIRE(debug_out.str() == "");
91  REQUIRE(err_out.str() == "ERROR test8");
92 
94 
95  // Debug verbosity
97 
98  app_summary() << "test9";
99  app_log() << "testA";
100  app_debug() << "testB";
101  app_error() << "testC";
102  REQUIRE(summary_out.str() == "test9");
103  REQUIRE(app_out.str() == "testA");
104  REQUIRE(debug_out.str() == "testB");
105  REQUIRE(err_out.str() == "ERROR testC");
106 }
static std::ostringstream app_out
#define app_debug
Definition: OutputManager.h:75
std::ostream & app_log()
Definition: OutputManager.h:65
std::ostream & app_summary()
Definition: OutputManager.h:63
std::ostream & app_error()
Definition: OutputManager.h:67
static std::ostringstream err_out
OutputManagerClass outputManager(Verbosity::HIGH)
REQUIRE(std::filesystem::exists(filename))
static std::ostringstream summary_out
void setVerbosity(Verbosity level)
static std::ostringstream debug_out

◆ TEST_CASE() [244/537]

qmcplusplus::TEST_CASE ( "symmetric_distance_table OpenBC"  ,
""  [particle] 
)

make sure getCoordinates().getAllParticlePos() is updated no matter SoA or AoS.

Definition at line 64 of file test_ParticleSet.cpp.

References ParticleSet::addTable(), CHECK(), ParticleSet::create(), DynamicCoordinates::getAllParticlePos(), ParticleSet::getCoordinates(), DistanceTableAA::getDistances(), ParticleSet::getDistTableAA(), ParticleSet::R, ParticleSet::setName(), and ParticleSet::update().

65 {
66  const SimulationCell simulation_cell;
67  ParticleSet source(simulation_cell);
68 
69  source.setName("electrons");
70 
71  source.create({2});
72  source.R[0] = {0.0, 1.0, 2.0};
73  source.R[1] = {1.1, 1.0, 3.2};
74  source.update();
75  /// make sure getCoordinates().getAllParticlePos() is updated no matter SoA or AoS.
76  CHECK(source.getCoordinates().getAllParticlePos()[0][1] == Approx(1.0));
77  CHECK(source.getCoordinates().getAllParticlePos()[1][2] == Approx(3.2));
78 
79  const int TableID = source.addTable(source);
80  source.update();
81  const auto& d_aa = source.getDistTableAA(TableID);
82  const auto& aa_dists = d_aa.getDistances();
83  const auto& aa_displs = d_aa.getDisplacements();
84 
85  CHECK(aa_dists[1][0] == Approx(1.62788206));
86  CHECK(aa_displs[1][0][0] == Approx(-1.1));
87  CHECK(aa_displs[1][0][1] == Approx(0.0));
88  CHECK(aa_displs[1][0][2] == Approx(-1.2));
89 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [245/537]

qmcplusplus::TEST_CASE ( "applyCuspInfo"  ,
""  [wavefunction] 
)

Definition at line 65 of file test_soa_cusp_corr.cpp.

References LCAOrbitalSet::C, CHECK(), computeRadialPhiBar(), OHMMS::Controller, SPOSetBuilderFactory::createSPOSetBuilder(), doc, SPOSet::getOrbitalSetSize(), Libxml2Document::getRoot(), Libxml2Document::getXPathContext(), LCAOrbitalSet::isIdentity(), LCAOrbitalSet::isOMPoffload(), LCAOrbitalSet::myBasisSet, okay, Libxml2Document::parse(), readCuspInfo(), XMLParticleParser::readXML(), removeSTypeOrbitals(), REQUIRE(), Matrix< T, Alloc >::resize(), Vector< T, Alloc >::resize(), and splitPhiEta().

66 {
68 
70  bool okay = doc.parse("hcn.structure.xml");
71  REQUIRE(okay);
72  xmlNodePtr root = doc.getRoot();
73 
74  const SimulationCell simulation_cell;
75  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
76  auto& ions(*ions_ptr);
77  XMLParticleParser parse_ions(ions);
78  OhmmsXPathObject particleset_ion("//particleset[@name='ion0']", doc.getXPathContext());
79  REQUIRE(particleset_ion.size() == 1);
80  parse_ions.readXML(particleset_ion[0]);
81 
82  REQUIRE(ions.groups() == 3);
83  REQUIRE(ions.R.size() == 3);
84  ions.update();
85 
86  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
87  auto& elec(*elec_ptr);
88  XMLParticleParser parse_elec(elec);
89  OhmmsXPathObject particleset_elec("//particleset[@name='e']", doc.getXPathContext());
90  REQUIRE(particleset_elec.size() == 1);
91  parse_elec.readXML(particleset_elec[0]);
92 
93  REQUIRE(elec.groups() == 2);
94  REQUIRE(elec.R.size() == 14);
95 
96  elec.R = 0.0;
97 
98  elec.addTable(ions);
99  elec.update();
100 
101  Libxml2Document doc2;
102  okay = doc2.parse("hcn.wfnoj.xml");
103  REQUIRE(okay);
104  xmlNodePtr root2 = doc2.getRoot();
105 
106  WaveFunctionComponentBuilder::PSetMap particle_set_map;
107  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
108  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
109 
110  SPOSetBuilderFactory bf(c, elec, particle_set_map);
111 
112  OhmmsXPathObject MO_base("//determinantset", doc2.getXPathContext());
113  REQUIRE(MO_base.size() == 1);
114 
115  const auto bb_ptr = bf.createSPOSetBuilder(MO_base[0]);
116  auto& bb(*bb_ptr);
117 
118  OhmmsXPathObject slater_base("//determinant", doc2.getXPathContext());
119  auto sposet = bb.createSPOSet(slater_base[0]);
120 
121  LCAOrbitalSet& lcob = dynamic_cast<LCAOrbitalSet&>(*sposet);
122 
123  LCAOrbitalSet phi("phi", std::unique_ptr<LCAOrbitalSet::basis_type>(lcob.myBasisSet->makeClone()),
124  lcob.getOrbitalSetSize(), lcob.isIdentity(), lcob.isOMPoffload());
125 
126  LCAOrbitalSet eta("eta", std::unique_ptr<LCAOrbitalSet::basis_type>(lcob.myBasisSet->makeClone()),
127  lcob.getOrbitalSetSize(), lcob.isIdentity(), lcob.isOMPoffload());
128 
129  *(eta.C) = *(lcob.C);
130  *(phi.C) = *(lcob.C);
131 
132 
133  int num_center = 3;
134  std::vector<bool> corrCenter(num_center, "true");
135 
136  // N is first atom
137  int center_idx = 0;
138 
140 
141  splitPhiEta(center_idx, corrCenter, phi, eta);
142 
143  // 1S orbital on N
144  CHECK((*phi.C)(0, 0) == Approx(1.00180500));
145  CHECK((*eta.C)(0, 0) == Approx(0.0));
146 
147  int orbital_set_size = 7;
148  Matrix<CuspCorrectionParameters> info;
149  info.resize(num_center, orbital_set_size);
150  okay = readCuspInfo("hcn_downdet.cuspInfo.xml", "downdet", orbital_set_size, info);
151 
152  REQUIRE(okay);
153  Vector<RealType> xgrid;
154  Vector<RealType> rad_orb;
155  int ngrid = 10;
156  xgrid.resize(ngrid);
157  for (int i = 0; i < ngrid; i++)
158  {
159  xgrid[i] = 0.012 * (i + 1);
160  }
161 
162  rad_orb.resize(ngrid);
163 
164  int mo_idx = 0;
165  computeRadialPhiBar(&elec, &ions, mo_idx, center_idx, &phi, xgrid, rad_orb, info(center_idx, mo_idx));
166 
167  // Comparisons generated from gen_cusp_corr.py
168  // Center 0 MO 0 rc = 0.07691307008
169  CHECK(rad_orb[0] == Approx(9.1266186340)); // x = 0.012
170  CHECK(rad_orb[1] == Approx(8.3939106599)); // x = 0.024
171  CHECK(rad_orb[2] == Approx(7.7213972780)); // x = 0.036
172  CHECK(rad_orb[3] == Approx(7.1039662640)); // x = 0.048
173  CHECK(rad_orb[4] == Approx(6.5370601478)); // x = 0.06
174  CHECK(rad_orb[5] == Approx(6.0165935481)); // x = 0.072
175  CHECK(rad_orb[6] == Approx(5.5390213984)); // x = 0.084
176  CHECK(rad_orb[7] == Approx(5.1023814795)); // x = 0.096
177  CHECK(rad_orb[8] == Approx(4.7033287383)); // x = 0.108
178  CHECK(rad_orb[9] == Approx(4.3370522377)); // x = 0.12
179 
180 
181  mo_idx = 1;
182  computeRadialPhiBar(&elec, &ions, mo_idx, center_idx, &phi, xgrid, rad_orb, info(center_idx, mo_idx));
183 
184  // Center 0 MO 1 rc = 0.060909477888
185  CHECK(rad_orb[0] == Approx(-0.0099816961)); // x = 0.012
186  CHECK(rad_orb[1] == Approx(-0.0092950723)); // x = 0.024
187  CHECK(rad_orb[2] == Approx(-0.0086498844)); // x = 0.036
188  CHECK(rad_orb[3] == Approx(-0.0080440071)); // x = 0.048
189  CHECK(rad_orb[4] == Approx(-0.0074778482)); // x = 0.06
190  CHECK(rad_orb[5] == Approx(-0.0069529708)); // x = 0.072
191  CHECK(rad_orb[6] == Approx(-0.0064707256)); // x = 0.084
192  CHECK(rad_orb[7] == Approx(-0.0060313791)); // x = 0.096
193  CHECK(rad_orb[8] == Approx(-0.0056312867)); // x = 0.108
194  CHECK(rad_orb[9] == Approx(-0.0052652668)); // x = 0.12
195 
196 
197  // Reset the MO matrices for another center
198 
199  *(eta.C) = *(lcob.C);
200  *(phi.C) = *(lcob.C);
201 
202 
203  // C is second atom
204  center_idx = 1;
205  splitPhiEta(center_idx, corrCenter, phi, eta);
206 
207  // 1S orbital on N
208  CHECK((*phi.C)(0, 0) == Approx(0.0));
209  CHECK((*eta.C)(0, 0) == Approx(1.00180500));
210 
211  mo_idx = 0;
212  computeRadialPhiBar(&elec, &ions, mo_idx, center_idx, &phi, xgrid, rad_orb, info(center_idx, mo_idx));
213 
214  // Center 1 MO 0 rc = 0.105
215  CHECK(rad_orb[0] == Approx(0.0017535517)); // x = 0.012
216  CHECK(rad_orb[1] == Approx(0.0016496533)); // x = 0.024
217  CHECK(rad_orb[2] == Approx(0.0015544835)); // x = 0.036
218  CHECK(rad_orb[3] == Approx(0.0014678130)); // x = 0.048
219  CHECK(rad_orb[4] == Approx(0.0013891000)); // x = 0.06
220  CHECK(rad_orb[5] == Approx(0.0013175785)); // x = 0.072
221  CHECK(rad_orb[6] == Approx(0.0012523246)); // x = 0.084
222  CHECK(rad_orb[7] == Approx(0.0011923038)); // x = 0.096
223  CHECK(rad_orb[8] == Approx(0.0011364095)); // x = 0.108
224  CHECK(rad_orb[9] == Approx(0.0010837868)); // x = 0.12
225 
226 
227  removeSTypeOrbitals(corrCenter, lcob);
228 
229  CHECK((*lcob.C)(0, 0) == Approx(0.0));
230  CHECK((*lcob.C)(0, 1) == Approx(0.0));
231  CHECK((*lcob.C)(0, 2) == Approx(0.0));
232  CHECK((*lcob.C)(0, 3) != 0.0);
233 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
bool readCuspInfo(const std::string &cuspInfoFile, const std::string &objectName, int OrbitalSetSize, Matrix< CuspCorrectionParameters > &info)
Read cusp correction parameters from XML file.
Wrapping information on parallelism.
Definition: Communicate.h:68
void removeSTypeOrbitals(const std::vector< bool > &corrCenter, LCAOrbitalSet &Phi)
Remove S atomic orbitals from all molecular orbitals on all centers.
REQUIRE(std::filesystem::exists(filename))
QMCTraits::RealType RealType
void computeRadialPhiBar(ParticleSet *targetP, ParticleSet *sourceP, int curOrb_, int curCenter_, SPOSet *Phi, Vector< QMCTraits::RealType > &xgrid, Vector< QMCTraits::RealType > &rad_orb, const CuspCorrectionParameters &data)
Compute the radial part of the corrected wavefunction.
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180
void splitPhiEta(int center, const std::vector< bool > &corrCenter, LCAOrbitalSet &Phi, LCAOrbitalSet &Eta)
Divide molecular orbital into atomic S-orbitals on this center (phi), and everything else (eta)...

◆ TEST_CASE() [246/537]

qmcplusplus::TEST_CASE ( "Vector nested intializer list"  ,
""  [OhmmsPETE] 
)

Definition at line 65 of file test_Vector.cpp.

References CHECK(), and qmcplusplus::Units::second.

66 {
67  Vector<TinyVector<double, 3>> vec_tinyd3({{1, 2, 3}, {4, 5, 6}, {7, 8, 9}});
68  CHECK(vec_tinyd3[1][1] == 5);
69  CHECK(vec_tinyd3[2][0] == 7);
70  Vector<std::pair<int, int>> vec_pair{{1, 2}, {3, 4}};
71  CHECK(vec_pair[0].first == 1);
72  CHECK(vec_pair[1].second == 4);
73 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [247/537]

qmcplusplus::TEST_CASE ( "EstimatorManagerInput::readXML"  ,
""  [estimators] 
)

Definition at line 66 of file test_EstimatorManagerInput.cpp.

References Libxml2Document::addChild(), CHECK(), qmcplusplus::testing::createEstimatorManagerNewInputXML(), doc, emi(), estimators_doc, EstimatorManagerInput::get_estimator_inputs(), EstimatorManagerInput::get_scalar_estimator_inputs(), Libxml2Document::getRoot(), node, okay, Libxml2Document::parseFromString(), and REQUIRE().

67 {
68  using namespace testing;
70  EstimatorManagerInput emi(estimators_doc.getRoot());
71 
72  CHECK(emi.get_estimator_inputs().size() == 2);
73  CHECK(emi.get_scalar_estimator_inputs().size() == 5);
74 
75  // CHECK EMI throws if unparsable estimators are in input.
77  std::string bad_estimator = R"XML(
78 <estimator type="NeutrinoDensity" name="bad_estimator"/>
79 )XML";
80  bool okay = doc.parseFromString(bad_estimator);
81  REQUIRE(okay);
82  xmlNodePtr node = doc.getRoot();
83  int max_node_recurse = 1;
84  estimators_doc.addChild(xmlCopyNode(node, max_node_recurse));
85  CHECK_THROWS_AS(EstimatorManagerInput(estimators_doc.getRoot()), UniformCommunicateError);
86 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
ScalarEstimatorInputs & get_scalar_estimator_inputs()
if(!okay) throw std xmlNodePtr node
Libxml2Document createEstimatorManagerNewInputXML()
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
EstimatorManagerInput emi(estimators_doc.getRoot())
REQUIRE(std::filesystem::exists(filename))
Libxml2Document estimators_doc
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void addChild(xmlNodePtr newnode)
Definition: Libxml2Doc.cpp:111

◆ TEST_CASE() [248/537]

qmcplusplus::TEST_CASE ( "test_timer_scoped"  ,
""  [utilities] 
)

Definition at line 67 of file test_timer.cpp.

References CHECK(), TimerManager< TIMER >::createTimer(), TimerType< CLOCK >::get_num_calls(), TimerType< CLOCK >::get_total(), REQUIRE(), and timer_level_coarse.

68 {
70  FakeTimer* t1 = tm.createTimer("timer1", timer_level_coarse);
71  {
72  ScopedFakeTimer st(*t1);
73  }
74 #if defined(ENABLE_TIMERS)
75  CHECK(t1->get_total() == Approx(1.0));
76  REQUIRE(t1->get_num_calls() == 1);
77 #endif
78 
79 
80  const std::string prefix_str("Prefix::");
81  FakeTimer& t2(*(tm.createTimer(prefix_str + "timer2", timer_level_coarse)));
82  {
83  ScopedFakeTimer st(t2);
84  }
85 #if defined(ENABLE_TIMERS)
86  CHECK(t1->get_total() == Approx(1.0));
87  REQUIRE(t1->get_num_calls() == 1);
88 #endif
89 }
ScopeGuard< FakeTimer > ScopedFakeTimer
Definition: NewTimer.h:258
TimerType< FakeChronoClock > FakeTimer
Definition: NewTimer.h:235
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
TimerManager< FakeTimer > FakeTimerManager
Definition: test_timer.cpp:23

◆ TEST_CASE() [249/537]

qmcplusplus::TEST_CASE ( "Pair Correlation"  ,
""  [hamiltonian] 
)

Definition at line 67 of file test_PairCorrEstimator.cpp.

References PairCorrEstimator::addObservables(), ParticleSet::addTable(), ParticleSet::Collectables, OHMMS::Controller, doc, PairCorrEstimator::evaluate(), ParticleSet::get(), ParticleSet::getDistTable(), ParticleSet::getLattice(), OhmmsElementBase::getName(), ParticleSetPool::getParticleSet(), Libxml2Document::getRoot(), gofr_xml, ParticleSet::isSameMass(), lat_xml, Libxml2Document::parseFromString(), ParticleSet::PropertyList, pset_xml, ParticleSetPool::put(), PairCorrEstimator::put(), ParticleSet::R, ParticleSetPool::readSimulationCellXML(), REQUIRE(), and ParticleSet::update().

68 {
69  std::cout << std::fixed;
70  std::cout << std::setprecision(8);
72 
74 
75  // XML parser
77 
78  std::cout << "\n\n\ntest_paircorr:: START\n";
79 
80  // TEST new idea: ParticlesetPool to make a ParticleSet
81  bool lat_okay = doc.parseFromString(lat_xml);
82  REQUIRE(lat_okay);
83  xmlNodePtr lat_xml_root = doc.getRoot();
84 
85  ParticleSetPool pset_builder(c, "pset_builder");
86  pset_builder.readSimulationCellXML(lat_xml_root); // Builds lattice
87 
88  bool pset_okay = doc.parseFromString(pset_xml);
89  REQUIRE(pset_okay);
90  xmlNodePtr pset_xml_root = doc.getRoot();
91  pset_builder.put(pset_xml_root); // Builds ParticleSet
92 
93  // Get the (now assembled) ParticleSet, do simple sanity checks, then print info
94  ParticleSet* elec = pset_builder.getParticleSet("e");
95 
96  std::cout << "cheeeee " << elec->getLattice().R << std::endl;
97  REQUIRE(elec->isSameMass());
98  REQUIRE(elec->getName() == "e");
99 
100  // Move the particles manually onto B1 lattice
101  // NB: Spins are grouped contiguously
102  // Up spins
103  elec->R[0][0] = 0.0;
104  elec->R[0][1] = 0.0;
105  elec->R[0][2] = 0.0;
106  elec->R[1][0] = 1.0;
107  elec->R[1][1] = 1.0;
108  elec->R[1][2] = 0.0;
109  elec->R[2][0] = 1.0;
110  elec->R[2][1] = 0.0;
111  elec->R[2][2] = 1.0;
112  elec->R[3][0] = 0.0;
113  elec->R[3][1] = 1.0;
114  elec->R[3][2] = 1.0;
115 
116  // Down spins
117  elec->R[4][0] = 1.0;
118  elec->R[4][1] = 0.0;
119  elec->R[4][2] = 0.0;
120  elec->R[5][0] = 0.0;
121  elec->R[5][1] = 1.0;
122  elec->R[5][2] = 0.0;
123  elec->R[6][0] = 0.0;
124  elec->R[6][1] = 0.0;
125  elec->R[6][2] = 1.0;
126  elec->R[7][0] = 1.0;
127  elec->R[7][1] = 1.0;
128  elec->R[7][2] = 1.0;
129 
130  elec->get(std::cout); // print particleset info to stdout
131 
132  // Set up the distance table, match expected layout
133  const int ee_table_id = elec->addTable(*elec);
134 
135  const auto& dii(elec->getDistTable(ee_table_id));
136  elec->update(); // distance table evaluation here
137 
138  // Make a PairCorrEstimator, call put() to set up internals
139  std::string name = elec->getName();
140  PairCorrEstimator paircorr(*elec, name);
141  bool gofr_okay = doc.parseFromString(gofr_xml);
142  REQUIRE(gofr_okay);
143  xmlNodePtr gofr_xml_root = doc.getRoot();
144  paircorr.put(gofr_xml_root);
145  paircorr.addObservables(elec->PropertyList, elec->Collectables);
146 
147  // Compute g(r) then print it to stdout
148  // NB: Hardcoded to match hardcoded xml above. ***Fragile!!!***
149  paircorr.evaluate(*elec);
150 
151  // Hardcoded gofr parameters - MUST match xml input for PairCorrEstimator!!!
152  // This might cause a segfault if it does not match xml input!
153  const RealType Rmax = 2.0;
154  const int Nbins = 99;
155  const RealType deltaR = Rmax / static_cast<RealType>(Nbins);
156 
157  auto gofr = elec->Collectables;
158  std::cout << "\n";
159  std::cout << "gofr:\n";
160  std::cout << std::fixed;
161  std::cout << std::setprecision(6);
162  std::cout << std::setw(4) << "i"
163  << " " << std::setw(12) << "r"
164  << " " << std::setw(12) << "uu"
165  << " " << std::setw(12) << "ud"
166  << " " << std::setw(12) << "dd"
167  << "\n";
168  std::cout << "============================================================\n";
169 
170  for (int i = 0; i < Nbins; i++)
171  {
172  std::cout << std::setw(4) << i << " " << std::setw(12) << i * deltaR << " " << std::setw(12) << gofr[i] << " "
173  << std::setw(12) << gofr[i + Nbins] << " " << std::setw(12) << gofr[i + 2 * Nbins] << "\n";
174  }
175 
176  // Verify against analytic result.
177  // NB: At the moment the tolerance is fairly loose because there
178  // is about 0.08-0.01 disagreement between QMCPACK and analytic
179  // result, depending on the bin. I'm not sure about the source
180  // of the disagreement because norm_factor is now exact.
181  // The only thing left is the distance table (I think)...
182  const RealType eps = 1E-02; // tolerance
183 
184  // Nearest neighbor peak (ud) | Distance = 1
185  const int bin_nn = 49;
186  REQUIRE(std::fabs(gofr[49] - 0.00000000) < eps);
187  REQUIRE(std::fabs(gofr[148] - 23.6361163) < eps);
188  REQUIRE(std::fabs(gofr[247] - 0.00000000) < eps);
189 
190  // 2nd-nearest neighbor peak (uu/dd) | Distance = sqrt(2)
191  const int bin_2n = 70;
192  REQUIRE(std::fabs(gofr[70] - 15.536547) < eps);
193  REQUIRE(std::fabs(gofr[169] - 0.0000000) < eps);
194  REQUIRE(std::fabs(gofr[268] - 15.536547) < eps);
195 
196  // 3rd-nearest neighbor peak (ud) | Distance = sqrt(3)
197  REQUIRE(std::fabs(gofr[85] - 0.00000000) < eps);
198  REQUIRE(std::fabs(gofr[184] - 2.6408410) < eps);
199  REQUIRE(std::fabs(gofr[283] - 0.0000000) < eps);
200 
201  std::cout << "test_paircorr:: STOP\n";
202 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
const char * gofr_xml
REQUIRE(std::filesystem::exists(filename))
const char * lat_xml
const char * pset_xml
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [250/537]

qmcplusplus::TEST_CASE ( "ProjectData::put with series"  ,
""  [ohmmsapp] 
)

Definition at line 67 of file test_project_data.cpp.

References doc, Libxml2Document::getRoot(), ProjectData::getSeriesIndex(), ProjectData::getTitle(), okay, Libxml2Document::parseFromString(), ProjectData::put(), and REQUIRE().

68 {
69  ProjectData proj;
70 
71  const char* xml_input = R"(<project id="test1" series="1"></project>)";
73  bool okay = doc.parseFromString(xml_input);
74  REQUIRE(okay);
75 
76  xmlNodePtr root = doc.getRoot();
77 
78  proj.put(root);
79  REQUIRE(proj.getSeriesIndex() == 1);
80  REQUIRE(proj.getTitle() == std::string("test1"));
81 
82  // host and date nodes get added for output to the .cont.xml file
83 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [251/537]

qmcplusplus::TEST_CASE ( "ConstantSizeMatrix Ohmms integration"  ,
""  [containers] 
)

Definition at line 67 of file test_ConstantSizeMatrix.cpp.

References CHECK(), and ConstantSizeMatrix< T, ALLOC >::size().

68 {
69  ConstantSizeMatrix<double> cmat(2, 8, 2, 32, 0.0);
70  Matrix<double> omat(2, 9);
71  omat = 2.0;
72  cmat = omat;
73 
74  CHECK(cmat.size() == 18);
75  CHECK(*omat[1] == 2.0);
76 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [252/537]

qmcplusplus::TEST_CASE ( "cuBLAS_LU::computeLogDet"  ,
""  [wavefunction][CUDA] 
)

Single double computeLogDet.

Definition at line 67 of file test_cuBLAS_LU.cpp.

References batch_size, CHECK(), qmcplusplus::cuBLAS_LU::computeLogDet_batched(), cudaCheck, cudaMemcpyAsync, cudaMemcpyDeviceToHost, cudaMemcpyHostToDevice, cudaStreamSynchronize, dev_log_values(), dev_lu(), dev_lus(), dev_pivots(), hstream, lda, log_values(), lu, lus, n, and pivots.

68 {
69  auto cuda_handles = std::make_unique<testing::CUDAHandles>();
70  int n = 4;
71  int lda = 4;
72  int batch_size = 1;
73  auto& hstream = cuda_handles->hstream;
74 
75  // clang-format off
76  std::vector<double, CUDAHostAllocator<double>> lu = {7., 0.28571429, 0.71428571, 0.71428571,
77  5., 3.57142857, 0.12, -0.44,
78  6., 6.28571429, -1.04, -0.46153846,
79  6., 5.28571429, 3.08, 7.46153846};
80  // clang-format on
81  std::vector<double, CUDAAllocator<double>> dev_lu(16);
82 
83  std::vector<double*, CUDAHostAllocator<double*>> lus(1, nullptr);
84  lus[0] = dev_lu.data();
85  std::vector<double*, CUDAHostAllocator<double*>> dev_lus(1);
86 
87  using StdComp = std::complex<double>;
88  std::vector<StdComp, CUDAHostAllocator<StdComp>> log_values(batch_size, 0.0);
89  std::vector<StdComp, CUDAAllocator<StdComp>> dev_log_values(batch_size, 0.0);
90 
91  std::vector<int, CUDAHostAllocator<int>> pivots = {3, 3, 4, 4};
92  std::vector<int, CUDAAllocator<int>> dev_pivots(4);
93 
94  // Transfers and launch kernel.
95  cudaCheck(cudaMemcpyAsync(dev_lu.data(), lu.data(), sizeof(decltype(lu)::value_type) * 16, cudaMemcpyHostToDevice,
96  hstream));
97  cudaCheck(cudaMemcpyAsync(dev_lus.data(), lus.data(), sizeof(double**), cudaMemcpyHostToDevice, hstream));
98  cudaCheck(cudaMemcpyAsync(dev_pivots.data(), pivots.data(), sizeof(int) * 4, cudaMemcpyHostToDevice, hstream));
99 
100  // The types of the pointers passed here matter
101  // Pass the C++ types
102  cuBLAS_LU::computeLogDet_batched(cuda_handles->hstream, n, lda, dev_lus.data(), dev_pivots.data(),
103  dev_log_values.data(), batch_size);
104 
105  // Copy back to the log_values
106  cudaCheck(cudaMemcpyAsync(log_values.data(), dev_log_values.data(), sizeof(std::complex<double>) * 1,
109  CHECK(log_values[0] == ComplexApprox(std::complex<double>{5.267858159063328, 6.283185307179586}));
110 }
std::vector< StdComp, CUDAHostAllocator< StdComp > > dev_lu(lu.size())
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
std::vector< StdComp *, CUDAAllocator< StdComp * > > dev_lus(batch_size)
CHECK(log_values[1]==ComplexApprox(std::complex< double >{ 5.531331998282581, -8.805487075984523 }))
void computeLogDet_batched(cudaStream_t &hstream, const int n, const int lda, T **Ms, const int *pivots, std::complex< double > *logdets, const int batch_size)
std::vector< int, CUDAHostAllocator< int > > pivots(8, -1.0)
#define cudaMemcpyDeviceToHost
Definition: cuda2hip.h:138
#define cudaStreamSynchronize
Definition: cuda2hip.h:152
#define cudaMemcpyHostToDevice
Definition: cuda2hip.h:139
std::vector< StdComp, CUDAAllocator< StdComp > > dev_log_values(batch_size)
std::vector< StdComp, CUDAHostAllocator< StdComp > > lu
#define cudaCheck(ans)
Definition: CUDAerror.h:27
std::vector< int, CUDAAllocator< int > > dev_pivots(pivots.size())
QMCTraits::FullPrecRealType value_type
std::vector< StdComp *, CUDAHostAllocator< StdComp * > > lus(batch_size)
std::complex< double > StdComp
#define cudaMemcpyAsync
Definition: cuda2hip.h:136

◆ TEST_CASE() [253/537]

qmcplusplus::TEST_CASE ( "DiracMatrixComputeCUDA_large_determinants_benchmark_legacy_1024_4"  ,
""  [wavefunction][fermion][.benchmark] 
)

This and other [.benchmark] benchmarks only run if "[benchmark]" is explicitly passed as tag to test.

Definition at line 68 of file benchmark_DiracMatrixComputeCUDA.cpp.

References DiracComputeBenchmarkParameters::batch_size, DiracMatrix< T_FP >::invert_transpose(), log_values(), qmcplusplus::testing::makeRngSpdMatrix(), qmcplusplus::Units::meter, DiracMatrixComputeCUDA< VALUE_FP >::mw_invertTranspose(), DiracComputeBenchmarkParameters::n, DiracComputeBenchmarkParameters::name, queue, and DiracComputeBenchmarkParameters::str().

69 {
70  DiracComputeBenchmarkParameters params;
71  params.name = "Batched CUDA";
72  params.n = 1024;
73  params.batch_size = 4;
74 
75  compute::Queue<PlatformKind::CUDA> queue;
76  DiracMatrixComputeCUDA<double> dmcc;
77 
78  std::vector<Matrix<double>> spd_mats(params.batch_size, {params.n, params.n});
79  std::vector<OffloadPinnedMatrix<double>> pinned_spd_mats(params.batch_size, {params.n, params.n});
80 
82  for (int im = 0; im < params.batch_size; ++im)
83  {
84  makeRngSpdMatrix(spd_mats[im]);
85  for (int i = 0; i < params.n; ++i)
86  for (int j = 0; j < params.n; ++j)
87  pinned_spd_mats[im](i, j) = spd_mats[im](i, j);
88  }
89 
90  OffloadPinnedVector<std::complex<double>> log_values(params.batch_size);
91  std::vector<OffloadPinnedMatrix<double>> pinned_inv_mats(params.batch_size, {params.n, params.n});
92 
93  auto a_mats = makeRefVector<const decltype(pinned_spd_mats)::value_type>(pinned_spd_mats);
94  RefVector<OffloadPinnedMatrix<double>> inv_a_mats =
95  makeRefVector<decltype(pinned_inv_mats)::value_type>(pinned_inv_mats);
96 
97  std::vector<bool> compute_mask(params.batch_size, true);
98  BENCHMARK_ADVANCED(params.str())(Catch::Benchmark::Chronometer meter)
99  {
100  meter.measure([&] { dmcc.mw_invertTranspose(queue, a_mats, inv_a_mats, log_values); });
101  };
102 
103  DiracMatrix<double> dmat;
104  std::vector<Matrix<double>> inv_mats_test(params.batch_size, {params.n, params.n});
105  ;
106  std::vector<std::complex<double>> log_values_test(params.batch_size);
107 
108  params.name = "legacy CPU";
109  BENCHMARK_ADVANCED(params.str())(Catch::Benchmark::Chronometer meter)
110  {
111  meter.measure([&] {
112  for (int im = 0; im < params.batch_size; ++im)
113  dmat.invert_transpose(spd_mats[im], inv_mats_test[im], log_values_test[im]);
114  });
115  };
116 }
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
void makeRngSpdMatrix(testing::RandomForTest< RngValueType< T >> &rng, Matrix< T > &mat_spd)
Functor to provide scope for rng when making SpdMatrix for testing.

◆ TEST_CASE() [254/537]

qmcplusplus::TEST_CASE ( "ReadFileBuffer_simple_mpi"  ,
""  [hamiltonian] 
)

Definition at line 68 of file test_ecp.cpp.

References ReadFileBuffer::contents(), OHMMS::Controller, ReadFileBuffer::length, ReadFileBuffer::open_file(), ReadFileBuffer::read_contents(), and REQUIRE().

69 {
71 
72  ReadFileBuffer buf(c);
73  bool open_okay = buf.open_file("simple.txt");
74  REQUIRE(open_okay == true);
75 
76  bool read_okay = buf.read_contents();
77  REQUIRE(read_okay);
78  REQUIRE(buf.length == 14);
79  REQUIRE(std::string("File contents\n") == buf.contents());
80 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [255/537]

qmcplusplus::TEST_CASE ( "QMCDriverFactory create VMC Driver"  ,
""  [qmcapp] 
)

Definition at line 68 of file test_QMCDriverFactory.cpp.

References CHECK(), comm, OHMMS::Controller, qmcplusplus::testing::createDriver(), doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), QMCDriverFactory::DriverAssemblyState::new_run_type, node, okay, Libxml2Document::parseFromString(), QMCDriverFactory::readSection(), REQUIRE(), test_project, qmcplusplus::testing::valid_vmc_input_sections, qmcplusplus::testing::valid_vmc_input_vmc_index, and VMC.

69 {
70  using namespace testing;
73 
74  ProjectData test_project;
75  QMCDriverFactory driver_factory(test_project);
76 
79  REQUIRE(okay);
80  xmlNodePtr node = doc.getRoot();
81  QMCDriverFactory::DriverAssemblyState das = driver_factory.readSection(node);
82  REQUIRE(das.new_run_type == QMCRunType::VMC);
83 
84  auto qmc_driver = testing::createDriver(test_project.getRuntimeOptions(), comm, driver_factory, node, das);
85 
86  REQUIRE(qmc_driver != nullptr);
87  REQUIRE_THROWS(dynamic_cast<VMCBatched&>(*qmc_driver));
88  REQUIRE_NOTHROW(dynamic_cast<VMC&>(*qmc_driver));
89  CHECK(qmc_driver->getEngineName() == "VMC");
90 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
constexpr int valid_vmc_input_vmc_index
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
constexpr std::array< const char *, 4 > valid_vmc_input_sections
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
auto createDriver(const RuntimeOptions &runtime_options, Communicate *comm, QMCDriverFactory &driver_factory, xmlNodePtr node, QMCDriverFactory::DriverAssemblyState &das)

◆ TEST_CASE() [256/537]

qmcplusplus::TEST_CASE ( "Test OptimizableObject ,
""  [wavefunction] 
)

Definition at line 69 of file test_OptimizableObject.cpp.

References CHECK(), and UniqueOptObjRefs::push_back().

70 {
71  FakeOptimizableObject fake_a("functor_a");
72  FakeOptimizableObject fake_b("functor_b");
73 
74  UniqueOptObjRefs opt_obj_refs;
75  opt_obj_refs.push_back(fake_a);
76  opt_obj_refs.push_back(fake_b);
77 
78  CHECK(opt_obj_refs.size() == 2);
79 
80  FakeOptimizableObject fake_c("functor_b");
81  opt_obj_refs.push_back(fake_c);
82  CHECK(opt_obj_refs.size() == 2);
83  CHECK(opt_obj_refs[0].getName() == "functor_a");
84  CHECK(opt_obj_refs[1].getName() == "functor_b");
85 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [257/537]

qmcplusplus::TEST_CASE ( "gaussian random particle attrib array length 1"  ,
""  [particle_base] 
)

Definition at line 71 of file test_random_seq.cpp.

References CHECK(), makeGaussRandomWithEngine(), and Vector< T, Alloc >::resize().

72 {
73  FakeRandom rg;
74  ParticleAttrib<TinyVector<double, 1>> PA;
75  PA.resize(1);
77 
78  // assuming RNG input is 0.5
79  CHECK(PA[0][0] == Approx(-1.1774100224305424));
80 }
makeGaussRandomWithEngine(mc_coords_rsspins, rng)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [258/537]

qmcplusplus::TEST_CASE ( "spline_function_4"  ,
""  [numerics] 
)

Definition at line 71 of file test_one_dim_cubic_spline.cpp.

References CHECK(), CubicSplineSolve(), qmcplusplus::Units::charge::e, and n.

72 {
73  const int n = 4;
74  double x[n] = {0.0, 1.2, 2.4, 3.0};
75  double y[n] = {1.0, 2.0, 1.5, 1.8};
76  double y2[n];
77 
78  CubicSplineSolve(x, y, n, 1e+33, 1e+33, y2);
79 
80  CHECK(y2[0] == Approx(0));
81  CHECK(y2[1] == Approx(-2.12121));
82  CHECK(y2[2] == Approx(2.23485));
83  CHECK(y2[3] == Approx(0));
84 }
void CubicSplineSolve(T const *x, T const *y, int n, T yp0, T ypn, T *y2)
Solve for second derivatives for cubic splines.
Definition: SplineSolvers.h:33
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [259/537]

qmcplusplus::TEST_CASE ( "ResourceCollection"  ,
""  [utilities] 
)

Definition at line 72 of file test_ResourceCollection.cpp.

References CHECK(), WFCResourceConsumer::createResource(), MemoryResource::data, WFCResourceConsumer::getResourceHandle(), and REQUIRE().

73 {
74  ResourceCollection res_collection("abc");
75  WFCResourceConsumer wfc, wfc1, wfc2;
76  REQUIRE(wfc.getResourceHandle().hasResource() == false);
77 
78  wfc.createResource(res_collection);
79  REQUIRE(wfc.getResourceHandle().hasResource() == false);
80 
81  RefVectorWithLeader wfc_list(wfc, {wfc, wfc1, wfc2});
82 
83  {
84  ResourceCollectionTeamLock lock(res_collection, wfc_list);
85  auto& res_handle = wfc.getResourceHandle();
86  REQUIRE(res_handle);
87 
88  MemoryResource& mem_res = res_handle;
89  const MemoryResource& const_mem_res = res_handle;
90  CHECK(mem_res.data.size() == 5);
91  CHECK(const_mem_res.data.size() == 5);
92  }
93 
94  REQUIRE(wfc.getResourceHandle().hasResource() == false);
95 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [260/537]

qmcplusplus::TEST_CASE ( "MCPopulation::createWalkers_walker_ids"  ,
""  [particle][population] 
)

Definition at line 73 of file test_MCPopulation.cpp.

References CHECK(), comm, OHMMS::Controller, hamiltonian_pool, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), MinimalHamiltonianPool::make_hamWithEE(), num_ranks, particle_pool, twf, and wavefunction_pool.

74 {
75  using namespace testing;
76 
77  RuntimeOptions runtime_options;
79 
80  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
81  auto wavefunction_pool = MinimalWaveFunctionPool::make_diamondC_1x1x1(runtime_options, comm, particle_pool);
82  auto hamiltonian_pool = MinimalHamiltonianPool::make_hamWithEE(comm, particle_pool, wavefunction_pool);
83  TrialWaveFunction twf(runtime_options);
84  WalkerConfigurations walker_confs;
85 
86  std::vector<MCPopulation> pops;
87 
88  int num_ranks = 3;
89  for (int i = 0; i < num_ranks; ++i)
90  pops.emplace_back(num_ranks, i, particle_pool.getParticleSet("e"), &twf, hamiltonian_pool.getPrimary());
91 
92  std::vector<long> walker_ids;
93  for (int i = 0; i < num_ranks; ++i)
94  {
95  pops[i].createWalkers(8, walker_confs, 2.0);
96  CHECK(pops[i].get_walkers().size() == 8);
97  CHECK(pops[i].get_dead_walkers().size() == 8);
98  CHECK(pops[i].get_num_local_walkers() == 8);
99  auto walker_elems = pops[i].get_walker_elements();
100  for (WalkerElementsRef& wer : walker_elems)
101  {
102  walker_ids.push_back(wer.walker.getWalkerID());
103  }
104  }
105  std::sort(walker_ids.begin(), walker_ids.end());
106  // Walker IDs cannot collide
107  for (int i = 1; i < walker_ids.size(); ++i)
108  CHECK(walker_ids[i - 1] != walker_ids[i]);
109 
110  int new_walkers = 3;
111 
112  for (int i = 0; i < num_ranks; ++i)
113  for (int iw = 0; iw < new_walkers; ++iw)
114  {
115  auto wer = pops[i].spawnWalker();
116  walker_ids.push_back(wer.walker.getWalkerID());
117  }
118 
119  std::sort(walker_ids.begin(), walker_ids.end());
120  // Walker IDs cannot collide
121  for (int i = 1; i < walker_ids.size(); ++i)
122  CHECK(walker_ids[i - 1] != walker_ids[i]);
123 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [261/537]

qmcplusplus::TEST_CASE ( "ewald3d df"  ,
""  [lrhandler] 
)

evalaute bare Coulomb derivative using EwaldHandler3D

Definition at line 74 of file test_ewald3d.cpp.

References CrystalLattice< T, D >::BoxBConds, CHECK(), ParticleSet::createSK(), Tensor< T, D >::diagonal(), EwaldHandler3D::evaluate(), EwaldHandler3D::evaluateLR(), EwaldHandler3D::initBreakup(), LRHandlerBase::LR_kc, LRHandlerBase::LR_rc, EwaldHandler3D::lrDf(), LRHandlerBase::MaxKshell, CrystalLattice< T, D >::R, CrystalLattice< T, D >::reset(), CrystalLattice< T, D >::Rv, EwaldHandler3D::Sigma, sqrt(), EwaldHandler3D::srDf(), and CrystalLattice< T, D >::Volume.

75 {
76  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> Lattice;
77  Lattice.BoxBConds = true;
78  Lattice.LR_dim_cutoff = 30.;
79  Lattice.R.diagonal(5.0);
80  Lattice.reset();
81  CHECK(Lattice.Volume == Approx(125));
82  Lattice.SetLRCutoffs(Lattice.Rv);
83  //Lattice.printCutoffs(app_log());
84  CHECK(Lattice.LR_rc == Approx(2.5));
85  CHECK(Lattice.LR_kc == Approx(12));
86 
87  const SimulationCell simulation_cell(Lattice);
88  ParticleSet ref(simulation_cell); // handler needs ref.getSimulationCell().getKLists()
89  ref.createSK();
90  EwaldHandler3D handler(ref, Lattice.LR_kc);
91 
92  // make sure initBreakup changes the default sigma
93  CHECK(handler.Sigma == Approx(Lattice.LR_kc));
94  handler.initBreakup(ref);
95  CHECK(handler.Sigma == Approx(std::sqrt(Lattice.LR_kc / (2.0 * Lattice.LR_rc))));
96 
97  std::cout << "handler.MaxKshell is " << handler.MaxKshell << std::endl;
98  CHECK( (std::is_same<OHMMS_PRECISION, OHMMS_PRECISION_FULL>::value ?
99  handler.MaxKshell == 78 : handler.MaxKshell >= 117 && handler.MaxKshell <= 128 ));
100  CHECK(handler.LR_rc == Approx(2.5));
101  CHECK(handler.LR_kc == Approx(12));
102 
103  mRealType r, dr, rinv;
104  mRealType rm, rp; // minus (m), plus (p)
105  mRealType vsrm, vsrp, dvsr, vlrm, vlrp, dvlr;
106  dr = 0.00001; // finite difference step
107  std::vector<mRealType> rlist = {0.1, 0.5, 1.0, 2.0, 2.5};
108  for (auto it = rlist.begin(); it != rlist.end(); ++it)
109  {
110  r = *it;
111  // test short-range piece
112  rm = r - dr;
113  rinv = 1. / rm;
114  vsrm = handler.evaluate(rm, rinv);
115  vlrm = handler.evaluateLR(rm);
116  rp = r + dr;
117  rinv = 1. / rp;
118  vsrp = handler.evaluate(rp, rinv);
119  vlrp = handler.evaluateLR(rp);
120  dvsr = (vsrp - vsrm) / (2 * dr);
121  rinv = 1. / r;
122  CHECK(handler.srDf(r, rinv) == Approx(dvsr));
123  // test long-range piece
124  dvlr = (vlrp - vlrm) / (2 * dr);
125  CHECK(handler.lrDf(r) == Approx(dvlr));
126  }
127 }
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
POLT::ParticleLayout Lattice
EwaldHandler3D::mRealType mRealType
TinyVector< SingleParticlePos, D > Rv
Real-space unit vectors.
Scalar_t Volume
Physical properties of a supercell.
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
void diagonal(const T &rhs)
Definition: Tensor.h:205
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

◆ TEST_CASE() [262/537]

qmcplusplus::TEST_CASE ( "tiny vector"  ,
""  [OhmmsPETE] 
)

Definition at line 75 of file test_TinyVector.cpp.

76 {
77  test_tiny_vector<1>();
78  test_tiny_vector<2>();
79  test_tiny_vector<3>();
80  test_tiny_vector<4>();
81  test_tiny_vector_size_two<2>();
82  test_tiny_vector_size_two<3>();
83  test_tiny_vector_size_two<4>();
84 }

◆ TEST_CASE() [263/537]

qmcplusplus::TEST_CASE ( "VectorViewer"  ,
""  [OhmmsPETE] 
)

Definition at line 75 of file test_Vector.cpp.

References REQUIRE(), and Vector< T, Alloc >::size().

76 {
77  int a[3];
78  a[0] = 2;
79  a[1] = 4;
80  a[2] = -5;
81  Vector<int> view_a(a, 3);
82 
83  REQUIRE(view_a.size() == 3);
84 
85  // operator[]
86  REQUIRE(view_a[0] == 2);
87  REQUIRE(view_a[1] == 4);
88  REQUIRE(view_a[2] == -5);
89 
90  // operator[] returning a reference
91  view_a[1] = 42;
92 
93  REQUIRE(a[0] == 2);
94  REQUIRE(a[1] == 42);
95  REQUIRE(a[2] == -5);
96 
97  // TODO: add optional bounds checking to accesses via operator[]
98 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [264/537]

qmcplusplus::TEST_CASE ( "Array::data"  ,
""  [OhmmsPETE] 
)

Definition at line 76 of file test_Array.cpp.

References CHECK(), Array< T, D, ALLOC >::data(), Array< T, D, ALLOC >::data_at(), REQUIRE(), and Array< T, D, ALLOC >::size().

77 {
78  Array<float, 3> tensor(2, 4, 5);
79  REQUIRE(tensor.size() == 40);
80 
81  CHECK(tensor.data() + 1 * 4 * 5 + 2 * 5 + 3 == tensor.data_at(1, 2, 3));
82 
83  tensor(1, 2, 3) = 0.5f;
84  CHECK(*tensor.data_at(1, 2, 3) == 0.5f);
85 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
A D-dimensional Array class based on PETE.
Definition: OhmmsArray.h:25

◆ TEST_CASE() [265/537]

qmcplusplus::TEST_CASE ( "bracket minimum"  ,
""  [numerics] 
)

Definition at line 77 of file test_min_oned.cpp.

References MinTest::find_bracket(), and MinTest::find_bracket_bound().

78 {
79  MinTest min_test;
80  min_test.find_bracket(1.3);
81  min_test.find_bracket(-1.3);
82  min_test.find_bracket(10.0);
83 
84 
85  MinTest min_test2(1.5);
86  min_test2.find_bracket(1.3);
87  min_test2.find_bracket(-1.3);
88  min_test2.find_bracket(10.0);
89  min_test2.find_bracket_bound(1.2, 1.4);
90 
91  MinTest min_test3(-0.5);
92  min_test3.find_bracket(1.3);
93  min_test3.find_bracket(-1.3);
94  min_test3.find_bracket(10.0);
95  min_test3.find_bracket_bound(1.0, 2.0);
96 }

◆ TEST_CASE() [266/537]

qmcplusplus::TEST_CASE ( "SmallMatrixDetCalculator::evaluate-Small"  ,
""  [wavefunction][fermion][multidet] 
)

Simple synthetic test case will trip on changes in this method.

Definition at line 78 of file test_multi_dirac_determinant.cpp.

References CHECK(), TestSmallMatrixDetCalculator< T >::customized_evaluate(), and TestSmallMatrixDetCalculator< T >::generic_evaluate().

79 {
80  TestSmallMatrixDetCalculator<double> double_test;
81  CHECK(double_test.generic_evaluate(1) == Approx(0.0));
82  CHECK(double_test.generic_evaluate(2) == Approx(0.5));
83  CHECK(double_test.generic_evaluate(3) == Approx(-0.7407407407));
84  CHECK(double_test.generic_evaluate(4) == Approx(-0.87890625));
85  CHECK(double_test.generic_evaluate(5) == Approx(-0.96768));
86 
87  CHECK(double_test.customized_evaluate<1>() == Approx(0.0));
88  CHECK(double_test.customized_evaluate<2>() == Approx(0.5));
89  CHECK(double_test.customized_evaluate<3>() == Approx(-0.7407407407));
90  CHECK(double_test.customized_evaluate<4>() == Approx(-0.87890625));
91  CHECK(double_test.customized_evaluate<5>() == Approx(-0.96768));
92 
93  CHECK(double_test.generic_evaluate(1<<3) == Approx(-1.1086723208));
94  CHECK(double_test.generic_evaluate(1<<7) == Approx(-1.3432116824));
95  CHECK(double_test.generic_evaluate(1<<12) == Approx(-1.3586431786));
96 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [267/537]

qmcplusplus::TEST_CASE ( "FakeRandom clone ,
""  [utilities] 
)

Definition at line 78 of file test_FakeRandom.cpp.

References CHECK(), and FakeRandom< T >::write().

79 {
80  using DoubleRNG = FakeRandom<double>;
81  DoubleRNG rng;
82 
83  std::stringstream stream1;
84  rng.write(stream1);
85 
86  auto rng2 = rng.makeClone();
87 
88  std::stringstream stream2;
89  rng2->write(stream2);
90 
91  CHECK(stream1.str() == stream2.str());
92 
93  for (auto i = 0; i < 3; ++i)
94  CHECK((*rng2)() == rng());
95 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [268/537]

qmcplusplus::TEST_CASE ( "Crowd integration"  ,
""  [drivers] 
)

Definition at line 79 of file test_Crowd.cpp.

References comm, OHMMS::Controller, crowd, SetupPools::hamiltonian_pool, SetupPools::particle_pool, pools, and SetupPools::wavefunction_pool.

80 {
82  using namespace testing;
83  SetupPools pools;
84 
85  EstimatorManagerNew em(*pools.hamiltonian_pool->getPrimary(), comm);
86 
87  const MultiWalkerDispatchers dispatchers(true);
88  DriverWalkerResourceCollection driverwalker_resource_collection_;
89 
90  Crowd crowd(em, driverwalker_resource_collection_, *pools.particle_pool->getParticleSet("e"),
91  *pools.wavefunction_pool->getPrimary(), *pools.hamiltonian_pool->getPrimary(), dispatchers);
92 }
UPtr< ParticleSetPool > particle_pool
Definition: SetupPools.h:33
UPtr< HamiltonianPool > hamiltonian_pool
Definition: SetupPools.h:35
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
UPtr< WaveFunctionPool > wavefunction_pool
Definition: SetupPools.h:34
SetupPools pools

◆ TEST_CASE() [269/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A BCC H"  ,
""  [hamiltonian] 
)

Definition at line 79 of file test_coulomb_pbcAA.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evalConsts(), CoulombPBCAA::evaluate(), CoulombPBCAA::get_madelung_constant(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, and ParticleSet::setName().

80 {
81  const double alat = 3.77945227;
82  const double vmad_sc = -1.4186487397403098 / alat;
83  LRCoulombSingleton::CoulombHandler = 0;
84 
85  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
86  lattice.BoxBConds = true; // periodic
87  lattice.R.diagonal(alat);
88  lattice.reset();
89 
90  const SimulationCell simulation_cell(lattice);
91  ParticleSet ions(simulation_cell);
92  ParticleSet elec(simulation_cell);
93 
94  ions.setName("ion");
95  ions.create({2});
96  ions.R[0] = {0.0, 0.0, 0.0};
97  ions.R[1] = {1.88972614, 1.88972614, 1.88972614};
98  SpeciesSet& ion_species = ions.getSpeciesSet();
99  int pIdx = ion_species.addSpecies("H");
100  int pChargeIdx = ion_species.addAttribute("charge");
101  ion_species(pChargeIdx, pIdx) = 1;
102  ions.createSK();
103 
104 
105  CoulombPBCAA caa(ions, false, false, false);
106 
107  // Background charge term
108  double consts = caa.evalConsts();
109  CHECK(consts == Approx(-1.675229452)); // not validated
110 
111  double val = caa.evaluate(elec);
112  CHECK(val == Approx(-0.9628996199)); // not validated
113 
114  // supercell Madelung energy
115  val = caa.get_madelung_constant();
116  CHECK(val == Approx(vmad_sc));
117 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [270/537]

qmcplusplus::TEST_CASE ( "VectorSoaContainer move constructor"  ,
""  [OhmmsSoA] 
)

Definition at line 79 of file test_vector_soa.cpp.

References CHECK(), and VectorSoaContainer< T, D, Alloc >::copyIn().

80 {
81  Vector<TinyVector<double, 3>> R(4);
82  VectorSoaContainer<double, 3> RSoA(4);
83 
84  R[0] = TinyVector<double, 3>(0.00000000, 0.00000000, 0.00000000);
85  R[1] = TinyVector<double, 3>(1.68658058, 1.68658058, 1.68658058);
86  R[2] = TinyVector<double, 3>(3.37316115, 3.37316115, 0.00000000);
87  R[3] = TinyVector<double, 3>(5.05974172, 5.05974172, 1.68658058);
88 
89  RSoA.copyIn(R);
90 
91  VectorSoaContainer<double, 3> rsoa_move(std::move(RSoA));
92 
93  // more importantly this test shall not leak memory
94 
95  //check out value
96  CHECK(rsoa_move[1][0] == Approx(1.68658058));
97  CHECK(rsoa_move[1][1] == Approx(1.68658058));
98  CHECK(rsoa_move[1][2] == Approx(1.68658058));
99 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [271/537]

qmcplusplus::TEST_CASE ( "ParticleSetPool random"  ,
""  [qmcapp] 
)

Definition at line 79 of file test_particle_pool.cpp.

References OHMMS::Controller, doc, ParticleSetPool::getParticleSet(), Libxml2Document::getRoot(), ParticleSet::isSpinor(), okay, Libxml2Document::parseFromString(), ParticleSetPool::put(), ParticleSetPool::randomize(), and REQUIRE().

80 {
81  Communicate* c;
83 
84  ParticleSetPool pp(c);
85 
86  // See ParticleIO/tests/test_xml_io.cpp for particle parsing
87  const char* particles = R"(
88 <tmp>
89 <particleset name="ion0" size="1">
90  <group name="He">
91  <parameter name="charge">2</parameter>
92  </group>
93  <attrib name="position" datatype="posArray">
94  0.1 0.2 0.3
95  </attrib>
96 </particleset>
97 <particleset name="elec" random="yes" randomsrc="ion0" spinor="yes">
98  <group name="u" size="4">
99  <parameter name="charge">-1</parameter>
100  </group>
101 </particleset>
102 </tmp>
103 )";
105  bool okay = doc.parseFromString(particles);
106  REQUIRE(okay);
107 
108  xmlNodePtr root = doc.getRoot();
109 
110  xmlNodePtr part_ion = xmlFirstElementChild(root);
111  pp.put(part_ion);
112  pp.put(xmlNextElementSibling(part_ion));
113 
114  ParticleSet* ions = pp.getParticleSet("ion0");
115  REQUIRE(ions != NULL);
116  REQUIRE(!ions->isSpinor());
117 
118  ParticleSet* elec = pp.getParticleSet("elec");
119  REQUIRE(ions != NULL);
120  REQUIRE(elec->isSpinor());
121  REQUIRE(elec->R.size() == 4);
122  REQUIRE(elec->spins.size() == 4);
123 
124 
125  // should do something
126  pp.randomize();
127 
128  REQUIRE(elec->R[0][0] != 0.0);
129  REQUIRE(elec->spins[0] != 0.0);
130 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [272/537]

qmcplusplus::TEST_CASE ( "FairDivideLow_four"  ,
""  [utilities] 
)

Definition at line 80 of file test_partition.cpp.

References FairDivideLow(), and REQUIRE().

81 {
82  std::vector<int> out;
83  FairDivideLow(4, 2, out);
84  REQUIRE(out.size() == 3);
85  REQUIRE(out[0] == 0);
86  REQUIRE(out[1] == 2);
87  REQUIRE(out[2] == 4);
88 }
void FairDivideLow(int ntot, int npart, IV &adist)
partition ntot elements among npart
Definition: FairDivide.h:114
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [273/537]

qmcplusplus::TEST_CASE ( "LocalEnergy with hdf5"  ,
""  [estimators] 
)

Definition at line 80 of file test_local_energy_est.cpp.

References LocalEnergyEstimator::add2Record(), WalkerConfigurations::begin(), hdf_archive::close(), hdf_archive::create(), ParticleSet::create(), MCWalkerConfiguration::createWalkers(), LocalEnergyEstimator::registerObservables(), REQUIRE(), and ParticleSet::setName().

81 {
82  QMCHamiltonian H;
83  LocalEnergyEstimator le_est(H, true);
84 
85  const SimulationCell simulation_cell;
86  MCWalkerConfiguration W(simulation_cell);
87  W.setName("electrons");
88  W.create({1});
89  W.createWalkers(1);
90 
91  (*W.begin())->Properties(WP::LOCALENERGY) = 1.1;
92  (*W.begin())->Properties(WP::LOCALPOTENTIAL) = 1.2;
93 
94  std::vector<ObservableHelper> h5desc;
95 
96  std::filesystem::path filename("tmp_obs.h5");
97  hdf_archive h_file;
98  h_file.create(filename);
99  le_est.registerObservables(h5desc, h_file);
100  h_file.close();
101  REQUIRE(std::filesystem::exists(filename));
102  // Check contents?
103  REQUIRE(std::filesystem::remove(filename));
104 
105  LocalEnergyEstimator::RecordListType record;
106  le_est.add2Record(record);
107  // Not sure how to test this - for now make sure it doesn't crash
108 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [274/537]

qmcplusplus::TEST_CASE ( "srcoul df"  ,
""  [lrhandler] 
)

evalaute bare Coulomb derivative in 3D

Definition at line 81 of file test_srcoul.cpp.

References CrystalLattice< T, D >::BoxBConds, CHECK(), ParticleSet::createSK(), EslerCoulomb3D_ForSRCOUL::df(), Tensor< T, D >::diagonal(), LRHandlerSRCoulomb< Func, BreakupBasis >::evaluate(), LRHandlerSRCoulomb< Func, BreakupBasis >::evaluateLR(), LRHandlerSRCoulomb< Func, BreakupBasis >::initBreakup(), LRHandlerBase::LR_kc, LRHandlerBase::LR_rc, LRHandlerSRCoulomb< Func, BreakupBasis >::lrDf(), LRHandlerBase::MaxKshell, CrystalLattice< T, D >::R, EslerCoulomb3D_ForSRCOUL::reset(), CrystalLattice< T, D >::reset(), CrystalLattice< T, D >::Rv, LRHandlerSRCoulomb< Func, BreakupBasis >::srDf(), and CrystalLattice< T, D >::Volume.

82 {
83  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> Lattice;
84  Lattice.BoxBConds = true;
85  Lattice.LR_dim_cutoff = 30.;
86  Lattice.R.diagonal(5.0);
87  Lattice.reset();
88  CHECK(Lattice.Volume == Approx(125));
89  Lattice.SetLRCutoffs(Lattice.Rv);
90  //Lattice.printCutoffs(app_log());
91  CHECK(Approx(Lattice.LR_rc) == 2.5);
92  CHECK(Approx(Lattice.LR_kc) == 12);
93 
94  const SimulationCell simulation_cell(Lattice);
95  ParticleSet ref(simulation_cell); // handler needs ref.getSimulationCell().getKLists()
96  ref.createSK();
97  LRHandlerSRCoulomb<EslerCoulomb3D_ForSRCOUL, LPQHISRCoulombBasis> handler(ref);
98 
99  handler.initBreakup(ref);
100 
101  std::cout << "handler.MaxKshell is " << handler.MaxKshell << std::endl;
102  CHECK( (std::is_same<OHMMS_PRECISION, OHMMS_PRECISION_FULL>::value ?
103  handler.MaxKshell == 78 : handler.MaxKshell >= 117 && handler.MaxKshell <= 128 ));
104  CHECK(Approx(handler.LR_rc) == 2.5);
105  CHECK(Approx(handler.LR_kc) == 12);
106 
107  EslerCoulomb3D_ForSRCOUL fref;
108  fref.reset(ref);
109  mRealType r, dr, rinv;
110  mRealType rm, rp; // minus (m), plus (p)
111  mRealType vsrm, vsrp, dvsr, vlrm, vlrp, dvlr;
112  dr = 0.00001; // finite difference step
113  std::vector<mRealType> rlist = {0.1, 0.5, 1.0, 2.0, 2.5};
114  for (auto it = rlist.begin(); it != rlist.end(); ++it)
115  {
116  r = *it;
117  // test short-range piece
118  rm = r - dr;
119  rinv = 1. / rm;
120  vsrm = handler.evaluate(rm, rinv);
121  vlrm = handler.evaluateLR(rm);
122  rp = r + dr;
123  rinv = 1. / rp;
124  vsrp = handler.evaluate(rp, rinv);
125  vlrp = handler.evaluateLR(rp);
126  dvsr = (vsrp - vsrm) / (2 * dr);
127  rinv = 1. / r;
128  CHECK(handler.srDf(r, rinv) == Approx(dvsr));
129  // test long-range piece
130  dvlr = (vlrp - vlrm) / (2 * dr);
131  CHECK(handler.lrDf(r) == Approx(dvlr));
132  // test total derivative
133  CHECK(dvsr + dvlr == Approx(fref.df(r)));
134  }
135 }
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
POLT::ParticleLayout Lattice
EwaldHandler3D::mRealType mRealType
TinyVector< SingleParticlePos, D > Rv
Real-space unit vectors.
Scalar_t Volume
Physical properties of a supercell.
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
void diagonal(const T &rhs)
Definition: Tensor.h:205
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

◆ TEST_CASE() [275/537]

qmcplusplus::TEST_CASE ( "matrix converting assignment"  ,
""  [OhmmsPETE] 
)

Definition at line 81 of file test_Matrix.cpp.

References Matrix< T, Alloc >::assignUpperLeft(), and CHECK().

82 {
83  Matrix<double> mat_A(3,3);
84  Matrix<float> mat_B(3,3);
85 
86  for (int i = 0; i < 3; i++)
87  for (int j = 0; j < 3; j++)
88  mat_A(i, j) = (i + j) * 2.1;
89 
90  mat_B = mat_A;
91 
92  CHECK(mat_B(0,0) == Approx(0));
93  CHECK(mat_B(1,1) == Approx(4.2));
94 
95  Matrix<float> mat_C(2,2);
96  for (int i = 0; i < 2; i++)
97  for (int j = 0; j < 2; j++)
98  mat_C(i, j) = (i + j) * 2.2;
99 
100  mat_A.assignUpperLeft(mat_C);
101  CHECK(mat_A(1,0) == Approx(2.2));
102  CHECK(mat_A(1,2) == Approx(6.3));
103 
104  Matrix<float> mat_D(4,4);
105  for (int i = 0; i < 4; i++)
106  for (int j = 0; j < 4; j++)
107  mat_D(i, j) = (i + j) * 2.3;
108 
109  mat_A.assignUpperLeft(mat_D);
110  CHECK(mat_A(1,0) == Approx(2.3));
111  CHECK(mat_A(1,2) == Approx(6.9));
112 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [276/537]

qmcplusplus::TEST_CASE ( "CloneManager"  ,
""  [drivers] 
)

Definition at line 81 of file test_clone_manager.cpp.

References OHMMS::Controller.

82 {
84 
85  CloneManager cm;
86 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68

◆ TEST_CASE() [277/537]

qmcplusplus::TEST_CASE ( "uniform 3D Lattice layout"  ,
""  [lattice] 
)

Definition at line 81 of file test_ParticleBConds.cpp.

References CrystalLattice< T, D >::BoxBConds, Tensor< T, D >::diagonal(), CrystalLattice< T, D >::R, REQUIRE(), and CrystalLattice< T, D >::reset().

82 {
83  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> Lattice;
84  Lattice.BoxBConds = true; // periodic
85 
86  Lattice.R.diagonal(1.0);
87  Lattice.reset();
88 
89  REQUIRE(Lattice.R(0, 0) == 1.0);
90  REQUIRE(Lattice.R(0, 1) == 0.0);
91  REQUIRE(Lattice.R(0, 2) == 0.0);
92  REQUIRE(Lattice.R(1, 0) == 0.0);
93  REQUIRE(Lattice.R(1, 1) == 1.0);
94  REQUIRE(Lattice.R(1, 2) == 0.0);
95  REQUIRE(Lattice.R(2, 0) == 0.0);
96  REQUIRE(Lattice.R(2, 1) == 0.0);
97  REQUIRE(Lattice.R(2, 2) == 1.0);
98 }
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
POLT::ParticleLayout Lattice
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
REQUIRE(std::filesystem::exists(filename))
void diagonal(const T &rhs)
Definition: Tensor.h:205
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

◆ TEST_CASE() [278/537]

qmcplusplus::TEST_CASE ( "ReadFileBuffer_ecp"  ,
""  [hamiltonian] 
)

Definition at line 82 of file test_ecp.cpp.

References OHMMS::Controller, okay, ECPComponentBuilder::read_pp_file(), REQUIRE(), and ECPComponentBuilder::Zeff.

83 {
85 
86  ECPComponentBuilder ecp("test_read_ecp", c, 4, 1);
87 
88  bool okay = ecp.read_pp_file("C.BFD.xml");
89  REQUIRE(okay);
90 
91  REQUIRE(ecp.Zeff == 4);
92 
93  // TODO: add more checks that pseudopotential file was read correctly
94 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [279/537]

qmcplusplus::TEST_CASE ( "TwoBodyJastrow two variables"  ,
""  [wavefunction] 
)

Definition at line 82 of file test_J2_derivatives.cpp.

References TwoBodyJastrow< FT >::addFunc(), CHECK(), TwoBodyJastrow< FT >::checkOutVariables(), TwoBodyJastrow< FT >::extractOptimizableObjectRefs(), get_two_species_particleset(), TwoBodyJastrow< FT >::getComponentOffset(), VariableSet::insertFrom(), REQUIRE(), VariableSet::resetIndex(), and VariableSet::size_of_active().

83 {
84  const SimulationCell simulation_cell;
85  ParticleSet elec = get_two_species_particleset(simulation_cell);
86 
87  TwoBodyJastrow<FakeJasFunctor> jorb("J2_fake", elec, false);
88 
89  auto j2a_uptr = std::make_unique<FakeJasFunctor>("test_fake_a");
90  auto& j2a = *j2a_uptr;
91  j2a.myVars.insert("opt1", 1.0);
92  // update num_active_vars
93  j2a.myVars.resetIndex();
94  jorb.addFunc(0, 0, std::move(j2a_uptr));
95 
96  auto j2b_uptr = std::make_unique<FakeJasFunctor>("test_fake_b");
97  auto& j2b = *j2b_uptr;
98  j2b.myVars.insert("opt2", 2.0);
99  // update num_active_vars
100  j2b.myVars.resetIndex();
101  jorb.addFunc(0, 1, std::move(j2b_uptr));
102 
103  opt_variables_type global_active;
104  global_active.insertFrom(j2a.myVars);
105  global_active.insertFrom(j2b.myVars);
106  global_active.resetIndex();
107 
108  jorb.checkOutVariables(global_active);
109 
110  // Formatted output of variables involved
111  //j2a.myVars.print(app_log(),0,true);
112  //j2b.myVars.print(app_log(),0,true);
113  //global_active.print(app_log(),0,true);
114  //jorb.getComponentVars().print(app_log(),0,true);
115 
116  CHECK(global_active.size_of_active() == 2);
117 
118  // Order is based on the function list F
119  // For two species (ia - index of first species, ib - index of second species)
120  // F[0] is (0,0)
121  // F[1] and F[2] are (0,1),(1,0) - use the same functions
122  // F[3] is (1,1) b-b (by default uses the same function as a-a)
123 
124  // Index into global_active
125  auto o1 = jorb.getComponentOffset(0);
126  CHECK(o1.first == 0);
127  CHECK(o1.second == 1);
128 
129  auto o2 = jorb.getComponentOffset(1);
130  CHECK(o2.first == 1);
131  CHECK(o2.second == 2);
132 
133  auto o3 = jorb.getComponentOffset(2);
134  CHECK(o3.first == 1);
135  CHECK(o3.second == 2);
136 
137  auto o4 = jorb.getComponentOffset(3);
138  CHECK(o4.first == 0);
139  CHECK(o4.second == 1);
140 
141  UniqueOptObjRefs opt_obj_refs;
142  jorb.extractOptimizableObjectRefs(opt_obj_refs);
143  REQUIRE(opt_obj_refs.size() == 2);
144 }
ParticleSet get_two_species_particleset(const SimulationCell &simulation_cell)
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void insertFrom(const VariableSet &input)
insert a VariableSet to the list
Definition: VariableSet.cpp:37

◆ TEST_CASE() [280/537]

qmcplusplus::TEST_CASE ( "gaussian random input one"  ,
""  [particle_base] 
)

Definition at line 82 of file test_random_seq.cpp.

References assignGaussRand(), CHECK(), and FakeRandom< T >::set_value().

83 {
84  FakeRandom rg;
85  rg.set_value(1.0);
86  std::vector<double> a(2);
87  assignGaussRand(a.data(), 2, rg);
88 
89  // uniform RNG input is 1.0
90  // most uniform RNGs do not produce 1.0 exactly (open interval),
91  // but the code is there to prevent it, so a test.
92  CHECK(a[0] == Approx(8.49042441685));
93  CHECK(a[1] == Approx(0.0)); // ensure no overflow
94 }
void assignGaussRand(T *restrict a, unsigned n, RG &rng)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [281/537]

qmcplusplus::TEST_CASE ( "ModernStringUtils_string2Real"  ,
""  [utilities] 
)

Definition at line 83 of file test_ModernStringUtils.cpp.

References CHECK().

84 {
85  std::string_view svalue{"101.52326626"};
86  double value = string2Real<double>(svalue);
87  CHECK(value == Approx(101.52326626));
88 } // namespace qmcplusplus
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [282/537]

qmcplusplus::TEST_CASE ( "WaveFunctionPool"  ,
""  [qmcapp] 
)

Definition at line 83 of file test_wavefunction_pool.cpp.

References ProjectData::BATCH, OHMMS::Controller, doc, TrialWaveFunction::getOrbitals(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), okay, Libxml2Document::parseFromString(), REQUIRE(), setupParticleSetPool(), and test_project.

84 {
85  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
86  Communicate* c;
88 
89  ParticleSetPool pp(c);
91 
92  WaveFunctionPool wp(test_project.getRuntimeOptions(), pp, c);
93 
94  REQUIRE(wp.empty() == true);
95 
96 
97  const char* wf_input = R"(<wavefunction target='e'>
98  <determinantset type='einspline' href='diamondC_1x1x1.pwscf.h5' tilematrix='1 0 0 0 1 0 0 0 1' twistnum='0' source='ion' meshfactor='1.0' precision='float'>
99  <slaterdeterminant>
100  <determinant id='updet' size='4'>
101  <occupation mode='ground' spindataset='0'/>
102  </determinant>
103  <determinant id='downdet' size='4'>
104  <occupation mode='ground' spindataset='0'/>
105  </determinant>
106  </slaterdeterminant>
107  </determinantset>
108  </wavefunction>
109  )";
110 
112  bool okay = doc.parseFromString(wf_input);
113  REQUIRE(okay);
114 
115  xmlNodePtr root = doc.getRoot();
116 
117  wp.put(root);
118 
119  TrialWaveFunction* psi = wp.getWaveFunction("psi0");
120  REQUIRE(psi != nullptr);
121  REQUIRE(psi->getOrbitals().size() == 1);
122 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
void setupParticleSetPool(ParticleSetPool &pp)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [283/537]

qmcplusplus::TEST_CASE ( "DiracMatrix_inverse_matching"  ,
""  [wavefunction][fermion] 
)

Definition at line 83 of file test_DiracMatrix.cpp.

References CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), Matrix< T, Alloc >::cols(), Matrix< T, Alloc >::data(), DiracMatrix< T_FP >::invert_transpose(), Matrix< T, Alloc >::resize(), Matrix< T, Alloc >::rows(), and qmcplusplus::simd::transpose().

84 {
85  DiracMatrix<double> dm;
86 
87  Matrix<double> a, a_T, a_inv;
88  LogValue log_value;
89  a.resize(4, 4);
90  a_T.resize(4, 4);
91  a_inv.resize(4, 4);
92 
93  a(0, 0) = 6;
94  a(0, 1) = 5;
95  a(0, 2) = 7;
96  a(0, 3) = 5;
97  a(1, 0) = 2;
98  a(1, 1) = 2;
99  a(1, 2) = 5;
100  a(1, 3) = 4;
101  a(2, 0) = 8;
102  a(2, 1) = 2;
103  a(2, 2) = 6;
104  a(2, 3) = 4;
105  a(3, 0) = 3;
106  a(3, 1) = 8;
107  a(3, 2) = 6;
108  a(3, 3) = 8;
109 
110  simd::transpose(a.data(), a.rows(), a.cols(), a_T.data(), a_T.rows(), a_T.cols());
111  dm.invert_transpose(a_T, a_inv, log_value);
112  CHECK(log_value == LogComplexApprox(std::complex<double>{5.50533, 6.28319}));
113 
114  Matrix<std::complex<double>> inv_M;
115  inv_M.resize(4, 4);
116  inv_M(0, 0) = -0.0650406504065041;
117  inv_M(0, 1) = -0.2113821138211382;
118  inv_M(0, 2) = 0.2113821138211382;
119  inv_M(0, 3) = 0.04065040650406502;
120  inv_M(1, 0) = 0.3739837398373983;
121  inv_M(1, 1) = -0.28455284552845533;
122  inv_M(1, 2) = -0.21544715447154467;
123  inv_M(1, 3) = 0.016260162601626094;
124  inv_M(2, 0) = 0.3902439024390243;
125  inv_M(2, 1) = 0.2682926829268292;
126  inv_M(2, 2) = -0.2682926829268292;
127  inv_M(2, 3) = -0.24390243902439013;
128  inv_M(3, 0) = -0.6422764227642275;
129  inv_M(3, 1) = 0.1626016260162603;
130  inv_M(3, 2) = 0.33739837398373973;
131  inv_M(3, 3) = 0.2764227642276421;
132 
133  auto check_matrix_result = checkMatrix(inv_M, a_inv);
134  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
135 }
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
Catch::Detail::LogComplexApprox LogComplexApprox
AntiSymTensor< T, D > transpose(const AntiSymTensor< T, D > &rhs)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::complex< double > LogValue

◆ TEST_CASE() [284/537]

qmcplusplus::TEST_CASE ( "SPO input spline from xml LiH_msd"  ,
""  [wavefunction] 
)

Definition at line 83 of file test_spo_collection_input_MSD_LCAO_h5.cpp.

References app_log(), and test_LiH_msd_xml_input().

84 {
85  // capture 3 spo input styles, the 2nd and 3rd ones will be deprecated and removed eventually.
86  // the first case should be simplified using SPOSetBuilderFactory instead of WaveFunctionFactory
87  app_log() << "-------------------------------------------------------------" << std::endl;
88  app_log() << "LiH_msd input style 1 using sposet_collection" << std::endl;
89  app_log() << "-------------------------------------------------------------" << std::endl;
90  const char* spo_xml_string1 = R"(<wavefunction name="psi0" target="e">
91  <sposet_collection type="MolecularOrbital" name="LCAOBSet" source="ion0" transform="yes" cuspCorrection="no" href="LiH.orbs.h5">
92  <sposet basisset="LCAOBSet" name="spo-up" size="85">
93  <occupation mode="ground"/>
94  <coefficient size="85" spindataset="0"/>
95  </sposet>
96  <sposet basisset="LCAOBSet" name="spo-dn" size="85">
97  <occupation mode="ground"/>
98  <coefficient size="85" spindataset="0"/>
99  </sposet>
100  </sposet_collection>
101  <determinantset>
102  <multideterminant optimize="yes" spo_up="spo-up" spo_dn="spo-dn">
103  <detlist size="1487" type="DETS" nca="0" ncb="0" nea="2" neb="2" nstates="85" cutoff="1e-20" href="LiH.orbs.h5"/>
104  </multideterminant>
105  </determinantset>
106 </wavefunction>
107 )";
108  test_LiH_msd_xml_input(spo_xml_string1, "spo-up", 85, 105);
109 
110  app_log() << "-----------------------------------------------------------------" << std::endl;
111  app_log() << "LiH_msd input style 1 using sposet_collection with basisset added" << std::endl;
112  app_log() << "-----------------------------------------------------------------" << std::endl;
113  const char* spo_xml_string1_updated =
114  R"(<wavefunction name=" psi0 " target=" e ">
115  <sposet_collection type = "MolecularOrbital" name = "LCAOBSet" source = "ion0" cuspCorrection = "no" href =
116  "LiH.orbs.h5" > <basisset name = "LCAOBSet" key = "GTO" transform = "yes">
117  <grid type = "log" ri = "1.e-6" rf = "1.e2" npts = "1001" /></basisset>
118  <sposet basisset = "LCAOBSet" name = "spo-up" size = "85"><occupation mode = "ground" />
119  <coefficient size = "85" spindataset = "0" /></sposet>
120  <sposet basisset = "LCAOBSet" name = "spo-dn" size = "85"><occupation mode = "ground" />
121  <coefficient size = "85" spindataset = "0" /></sposet></sposet_collection><determinantset>
122  <multideterminant optimize = "yes" spo_up = "spo-up" spo_dn = "spo-dn">
123  <detlist size = "1487" type = "DETS" nca = "0" ncb = "0" nea = "2" neb = "2" nstates = "85" cutoff =
124  "1e-20" href = "LiH.orbs.h5" /></multideterminant></determinantset></wavefunction>)";
125  test_LiH_msd_xml_input(spo_xml_string1_updated, "spo-up", 85, 105);
126 
127  app_log() << "------------------------------------------------------------------------------" << std::endl;
128  app_log() << "LiH_msd input style 1 using sposet_collection with basisset added no transform" << std::endl;
129  app_log() << "------------------------------------------------------------------------------" << std::endl;
130  const char* spo_xml_string1_updated_no_transform = R"(<wavefunction name="psi0" target="e">
131  <sposet_collection type="MolecularOrbital" name="LCAOBSet" source="ion0" cuspCorrection="no" href="LiH.orbs.h5">
132  <basisset name="LCAOBSet" key="GTO" transform="no">
133  <grid type="log" ri="1.e-6" rf="1.e2" npts="1001"/>
134  </basisset>
135  <sposet basisset="LCAOBSet" name="spo-up" size="85">
136  <occupation mode="ground"/>
137  <coefficient size="85" spindataset="0"/>
138  </sposet>
139  <sposet basisset="LCAOBSet" name="spo-dn" size="85">
140  <occupation mode="ground"/>
141  <coefficient size="85" spindataset="0"/>
142  </sposet>
143  </sposet_collection>
144  <determinantset>
145  <multideterminant optimize="yes" spo_up="spo-up" spo_dn="spo-dn">
146  <detlist size="1487" type="DETS" nca="0" ncb="0" nea="2" neb="2" nstates="85" cutoff="1e-20" href="LiH.orbs.h5"/>
147  </multideterminant>
148  </determinantset>
149 </wavefunction>
150 )";
151  test_LiH_msd_xml_input(spo_xml_string1_updated_no_transform, "spo-up", 85, 105);
152 
153  app_log() << "-------------------------------------------------------------" << std::endl;
154  app_log() << "LiH_msd input style 2 using sposet_collection" << std::endl;
155  app_log() << "-------------------------------------------------------------" << std::endl;
156  const char* spo_xml_string2 = R"(<wavefunction name="psi0" target="e">
157  <sposet_collection type="MolecularOrbital" name="LCAOBSet" source="ion0" transform="yes" cuspCorrection="no" href="LiH.orbs.h5">
158  <sposet basisset="LCAOBSet" name="spo" size="85">
159  <occupation mode="ground"/>
160  <coefficient size="85" spindataset="0"/>
161  </sposet>
162  </sposet_collection>
163  <determinantset>
164  <multideterminant optimize="yes" spo_up="spo" spo_dn="spo">
165  <detlist size="1487" type="DETS" nca="0" ncb="0" nea="2" neb="2" nstates="85" cutoff="1e-20" href="LiH.orbs.h5"/>
166  </multideterminant>
167  </determinantset>
168 </wavefunction>
169 )";
170  test_LiH_msd_xml_input(spo_xml_string2, "spo", 85, 105);
171 
172  app_log() << "-------------------------------------------------------------" << std::endl;
173  app_log() << "LiH_msd input style 3 sposet inside determinantset" << std::endl;
174  app_log() << "-------------------------------------------------------------" << std::endl;
175  const char* spo_xml_string3 = R"(<wavefunction name="psi0" target="e">
176  <determinantset type="MolecularOrbital" name="LCAOBSet" source="ion0" transform="yes" cuspCorrection="no" href="LiH.orbs.h5">
177  <sposet basisset="LCAOBSet" name="spo-up" size="85">
178  <occupation mode="ground"/>
179  <coefficient size="85" spindataset="0"/>
180  </sposet>
181  <sposet basisset="LCAOBSet" name="spo-dn" size="85">
182  <occupation mode="ground"/> \
183  <coefficient size="85" spindataset="0"/>
184  </sposet>
185  <multideterminant optimize="yes" spo_up="spo-up" spo_dn="spo-dn">
186  <detlist size="1487" type="DETS" nca="0" ncb="0" nea="2" neb="2" nstates="85" cutoff="1e-20" href="LiH.orbs.h5"/>
187  </multideterminant>
188  </determinantset>
189 </wavefunction>
190 )";
191  test_LiH_msd_xml_input(spo_xml_string3, "spo-up", 85, 105);
192 }
void test_LiH_msd_xml_input(const std::string &spo_xml_string, const std::string &check_sponame, int check_spo_size, int check_basisset_size)
std::ostream & app_log()
Definition: OutputManager.h:65

◆ TEST_CASE() [285/537]

qmcplusplus::TEST_CASE ( "convertPtrToRefvectorSubset"  ,
""  [type_traits] 
)

Definition at line 84 of file test_template_types.cpp.

References CHECK(), and convertPtrToRefVectorSubset().

85 {
86  struct Dummy2
87  {
88  Dummy2(int j) : i(j) {}
89  int i;
90  };
91 
92  std::vector<Dummy2*> pvec;
93  for (int i = 0; i < 5; ++i)
94  pvec.push_back(new Dummy2(i));
95 
96  auto rdum = convertPtrToRefVectorSubset(pvec, 1, 4);
97 
98  CHECK(rdum.size() == 4);
99  CHECK(rdum[0].get().i == 1);
100 
101  for (int i = 0; i < 5; ++i)
102  delete pvec[i];
103 }
static RefVector< T > convertPtrToRefVectorSubset(const std::vector< T *> &ptr_list, int offset, int len)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [286/537]

qmcplusplus::TEST_CASE ( "accumulator some values float"  ,
""  [estimators] 
)

Definition at line 85 of file test_accumulator.cpp.

85 { test_real_accumulator<float>(); }

◆ TEST_CASE() [287/537]

qmcplusplus::TEST_CASE ( "ProjectData::TestDriverVersion"  ,
""  [ohmmsapp] 
)

Definition at line 85 of file test_project_data.cpp.

References doc, ProjectData::getDriverVersion(), Libxml2Document::getRoot(), ProjectData::getSeriesIndex(), okay, Libxml2Document::parseFromString(), ProjectData::put(), and REQUIRE().

86 {
87  using DV = ProjectData::DriverVersion;
88  SECTION("driver version batch")
89  {
90  ProjectData proj;
91 
92  const char* xml_input = R"(
93  <project id="test1" series="1">
94  <parameter name='driver_version'>
95  batch
96  </parameter>
97  </project>
98  )";
100  bool okay = doc.parseFromString(xml_input);
101  REQUIRE(okay);
102 
103  xmlNodePtr root = doc.getRoot();
104 
105  proj.put(root);
106  REQUIRE(proj.getSeriesIndex() == 1);
107  REQUIRE(proj.getDriverVersion() == DV::BATCH);
108  }
109  SECTION("driver version legacy")
110  {
111  ProjectData proj;
112  REQUIRE(proj.getDriverVersion() == DV::LEGACY);
113 
114  const char* xml_input = R"(
115  <project id="test1" series="1">
116  <parameter name='driver_version'>
117  legacy
118  </parameter>
119  </project>
120  )";
122  bool okay = doc.parseFromString(xml_input);
123  REQUIRE(okay);
124 
125  xmlNodePtr root = doc.getRoot();
126 
127  proj.put(root);
128  REQUIRE(proj.getSeriesIndex() == 1);
129  REQUIRE(proj.getDriverVersion() == DV::LEGACY);
130  }
131  SECTION("driver version bad value")
132  {
133  ProjectData proj;
134 
135  const char* xml_input = R"(
136  <project id=" test1 " series=" 1 ">
137  <parameter name = 'driver_version' >
138  linear
139  </parameter>
140  </project>)";
142  bool okay = doc.parseFromString(xml_input);
143  REQUIRE(okay);
144 
145  xmlNodePtr root = doc.getRoot();
146 
147  REQUIRE_THROWS(proj.put(root));
148  }
149 
150  // host and date nodes get added for output to the .cont.xml file
151 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [288/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A Ewald Quasi2D triangular"  ,
""  [hamiltonian] 
)

Definition at line 85 of file test_ewald_quasi2d.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), lattice, LRCoulombSingleton::QUASI2D, ParticleSet::R, ParticleSet::setName(), sqrt(), LRCoulombSingleton::this_lr_type, and ParticleSet::update().

86 {
87  LRCoulombSingleton::CoulombHandler = 0; // !!!! crucial if not first test
88  LRCoulombSingleton::this_lr_type = LRCoulombSingleton::QUASI2D;
89  const double vmad_tri = -1.106102587;
90  const double alat = std::sqrt(2.0*M_PI/std::sqrt(3));
91 
92  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
93  lattice.BoxBConds = true;
94  lattice.BoxBConds[2] = false; // ppn
95  lattice.ndim = 2;
96  lattice.R = 0.0;
97  lattice.R(0, 0) = alat;
98  lattice.R(1, 0) = -1.0/2*alat;
99  lattice.R(1, 1) = std::sqrt(3)/2*alat;
100  lattice.R(2, 2) = 2*alat;
101  lattice.LR_dim_cutoff = 30.0;
102  lattice.reset();
103 
104  const SimulationCell simulation_cell(lattice);
105  ParticleSet elec(simulation_cell);
106  elec.setName("e");
107  elec.create({1});
108  elec.R[0] = {0.0, 0.0, 0.0};
109 
110  SpeciesSet& tspecies = elec.getSpeciesSet();
111  int upIdx = tspecies.addSpecies("u");
112  int chargeIdx = tspecies.addAttribute("charge");
113  int massIdx = tspecies.addAttribute("mass");
114  tspecies(chargeIdx, upIdx) = -1;
115  tspecies(massIdx, upIdx) = 1.0;
116 
117  elec.createSK();
118  elec.update();
119 
120  CoulombPBCAA caa(elec, true, false, false);
121 
122  double val = caa.evaluate(elec);
123  CHECK(val == Approx(vmad_tri));
124 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [289/537]

qmcplusplus::TEST_CASE ( "tiny vector operator out"  ,
""  [OhmmsPETE] 
)

Definition at line 86 of file test_TinyVector.cpp.

References CHECK().

87 {
88  TinyVector<double, 3> point{0.0, -0.0, 1.0};
89  std::ostringstream ostr;
90  ostr << point;
91  std::string expected{" 0 0 1"};
92  CHECK(expected == ostr.str());
93 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [290/537]

qmcplusplus::TEST_CASE ( "particle_attrib_ops_complex"  ,
""  [particle_base] 
)

Definition at line 86 of file test_attrib_ops.cpp.

87 {
88  SECTION("dim = 1") { complex_test_case<1>(); }
89  SECTION("dim = 2") { complex_test_case<2>(); }
90  SECTION("dim = 3") { complex_test_case<3>(); }
91  SECTION("dim = 4") { complex_test_case<4>(); }
92 }

◆ TEST_CASE() [291/537]

qmcplusplus::TEST_CASE ( "OptimizableObject HDF output and input ,
""  [wavefunction] 
)

Definition at line 87 of file test_OptimizableObject.cpp.

References CHECK(), FakeOptimizableObject::checkInVariablesExclusive(), FakeOptimizableObject::extra_data, VariableSet::readFromHDF(), FakeOptimizableObject::readVariationalParameters(), VariableSet::writeToHDF(), and FakeOptimizableObject::writeVariationalParameters().

88 {
89  FakeOptimizableObject fake_a("functor_a", 1.1, 2.3);
90  fake_a.extra_data = 3.4;
91 
92  hdf_archive hout;
93  opt_variables_type opt_vars;
94  fake_a.checkInVariablesExclusive(opt_vars);
95  opt_vars.writeToHDF("opt_obj.h5", hout);
96 
97  fake_a.writeVariationalParameters(hout);
98 
99  FakeOptimizableObject fake_2a("functor_a");
100  hdf_archive hin;
101  opt_variables_type opt_vars2;
102  fake_2a.checkInVariablesExclusive(opt_vars2);
103 
104  opt_vars2.readFromHDF("opt_obj.h5", hin);
105  CHECK(std::real(opt_vars2["var1"]) == Approx(1.1));
106  CHECK(std::real(opt_vars2["var2"]) == Approx(2.3));
107 
108  fake_2a.readVariationalParameters(hin);
109 
110  opt_variables_type opt_vars3;
111  fake_2a.checkInVariablesExclusive(opt_vars3);
112  CHECK(std::real(opt_vars3["var1"]) == Approx(1.1));
113  CHECK(std::real(opt_vars3["var2"]) == Approx(2.3));
114  CHECK(fake_2a.extra_data == Approx(3.4));
115 }
void writeToHDF(const std::string &filename, qmcplusplus::hdf_archive &hout) const
QMCTraits::RealType real
void readFromHDF(const std::string &filename, qmcplusplus::hdf_archive &hin)
Read variational parameters from an HDF file.
optimize::VariableSet opt_variables_type
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [292/537]

qmcplusplus::TEST_CASE ( "accumulator some values double"  ,
""  [estimators] 
)

Definition at line 87 of file test_accumulator.cpp.

87 { test_real_accumulator<double>(); }

◆ TEST_CASE() [293/537]

qmcplusplus::TEST_CASE ( "kcontainer at gamma in 2D"  ,
""  [longrange] 
)

Definition at line 87 of file test_kcontainer.cpp.

References CHECK(), qmcplusplus::Units::charge::e, KContainer::kpts, KContainer::kpts_cart, lattice, sqrt(), and KContainer::updateKLists().

88 {
89  const int ndim = 2;
90  const double alat = 1.0;
91  const double blat = 2 * M_PI / alat;
92 
93  // check first 3 shells of kvectors
94  const std::vector<double> kcs = {blat, std::sqrt(2) * blat, 2 * blat};
95  const std::vector<int> nks = {4, 8, 12};
96 
97  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
98  lattice.R.diagonal(1.0);
99  lattice.set(lattice.R); // compute Rv and Gv from R
100 
101  KContainer klists;
102  for (int ik = 0; ik < kcs.size(); ik++)
103  {
104  const double kc = kcs[ik] + 1e-6;
105  klists.updateKLists(lattice, kc, ndim);
106  CHECK(klists.kpts.size() == nks[ik]);
107  }
108  const int mxk = klists.kpts.size();
109  int gvecs[12][3] = {
110  {-1, 0, 0}, {0, -1, 0}, {0, 1, 0}, {1, 0, 0}, {-1, -1, 0}, {-1, 1, 0},
111  {1, -1, 0}, {1, 1, 0}, {-2, 0, 0}, {0, -2, 0}, {0, 2, 0}, {2, 0, 0},
112  };
113 
114  for (int ik = 0; ik < mxk; ik++)
115  {
116  for (int ldim = 0; ldim < ndim; ldim++)
117  {
118  CHECK(klists.kpts[ik][ldim] == gvecs[ik][ldim]);
119  CHECK(klists.kpts[ik][ldim] * blat == Approx(klists.kpts_cart[ik][ldim]));
120  }
121  }
122 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [294/537]

qmcplusplus::TEST_CASE ( "Array::dimension sizes constructor"  ,
""  [OhmmsPETE] 
)

Definition at line 87 of file test_Array.cpp.

References CHECK(), and Array< T, D, ALLOC >::shape().

88 {
89  const int dim = 2;
90  Array<double, 1> vec(dim);
91 
92  Array<double, 3> rank3_tensor(2, 4, 5);
93  CHECK(rank3_tensor.shape() == std::array<std::size_t, 3>{2, 4, 5});
94  // rank3_tensor.resize(5,6); this is caught at compile time.
95 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [295/537]

qmcplusplus::TEST_CASE ( "solveGeneralizedEigenvaluesCompare"  ,
""  [drivers] 
)

Definition at line 87 of file test_Eigensolver.cpp.

References CHECK(), qmcplusplus::Units::force::N, Eigensolver::solveGeneralizedEigenvalues(), and Eigensolver::solveGeneralizedEigenvalues_Inv().

88 {
89  const int N = 4;
90  Matrix<Real> Ovlp(N, N);
91  Matrix<Real> Ham(N, N);
92 
93  std::mt19937 mt(100);
94  std::uniform_real_distribution<Real> rnd(0.0, 1.0);
95 
96 
97  for (int i = 0; i < N; i++)
98  {
99  Ovlp(i, i) = 1.0;
100  }
101 
102  for (int i = 0; i < N; i++)
103  {
104  Ovlp(i, i) = 1.0;
105  for (int j = 0; j < i; j++)
106  {
107  Ovlp(i, j) = rnd(mt);
108  Ovlp(j, i) = Ovlp(i, j) + 0.1;
109  }
110  }
111 
112 
113  for (int i = 0; i < N; i++)
114  {
115  Ham(i, i) = 1.0;
116  for (int j = 0; j < i; j++)
117  {
118  Ham(i, j) = rnd(mt);
119  Ham(j, i) = Ham(i, j) - 0.1;
120  }
121  }
122 
123  Matrix<Real> Ovlp_copy(N, N);
124  Matrix<Real> Ham_copy(N, N);
125 
126  Ovlp_copy = Ovlp;
127  Ham_copy = Ham;
128 
129  std::vector<Real> ev1(N);
130  Matrix<Real> evec1(N, N);
131  Eigensolver::solveGeneralizedEigenvalues(Ham_copy, Ovlp_copy, ev1, evec1);
132 
133  Ovlp_copy = Ovlp;
134  Ham_copy = Ham;
135 
136  std::vector<Real> ev2(N);
137  Matrix<Real> evec2(N, N);
138  Eigensolver::solveGeneralizedEigenvalues_Inv(Ham_copy, Ovlp_copy, ev2, evec2);
139 
140  for (int i = 0; i < N; i++)
141  {
142  CHECK(ev1[i] == Approx(ev2[i]));
143  }
144 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [296/537]

qmcplusplus::TEST_CASE ( "spline_function_5"  ,
""  [numerics] 
)

Definition at line 88 of file test_one_dim_cubic_spline.cpp.

References CHECK(), CubicSplineSolve(), and n.

89 {
90  const int n = 4;
91  double x[n] = {0.0, 1.2, 2.4, 3.0};
92  double y[n] = {1.0, 2.0, 1.5, 1.8};
93  double y2[n];
94 
95  CubicSplineSolve(x, y, n, 0.0, 1.0, y2);
96 
97  CHECK(y2[0] == Approx(3.60507));
98  CHECK(y2[1] == Approx(-3.04348));
99  CHECK(y2[2] == Approx(2.31884));
100  CHECK(y2[3] == Approx(1.34058));
101 }
void CubicSplineSolve(T const *x, T const *y, int n, T yp0, T ypn, T *y2)
Solve for second derivatives for cubic splines.
Definition: SplineSolvers.h:33
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [297/537]

qmcplusplus::TEST_CASE ( "WalkerControl round trip index conversions"  ,
""  [drivers][walker_control] 
)

Definition at line 89 of file test_walker_control.cpp.

References REQUIRE().

90 {
91  std::vector<int> walker_counts; //= {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 23, 37};
92  for (int i = 0; i < 1000; ++i)
93  walker_counts.push_back(i);
94  for (int i = 0; i < 1000000; i += 1000)
95  walker_counts.push_back(i);
96  for (int i = 0; i < 100000000; i += 100000)
97  walker_counts.push_back(i);
98 
99  std::vector<QMCTraits::FullPrecRealType> fp_counts(walker_counts.size());
100  std::vector<int> walker_count_results(walker_counts.size());
101  for (int iw = 0; iw < walker_counts.size(); ++iw)
102  {
103  fp_counts[iw] = walker_counts[iw];
104  }
105  for (int iw = 0; iw < fp_counts.size(); ++iw)
106  {
107  walker_count_results[iw] = static_cast<int>(fp_counts[iw]);
108  }
109  bool all_pass = true;
110  for (int iw = 0; iw < walker_counts.size(); ++iw)
111  {
112  all_pass &= (walker_counts[iw] == walker_count_results[iw]);
113  }
114  REQUIRE(all_pass);
115 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [298/537]

qmcplusplus::TEST_CASE ( "Bare KE Pulay PBC"  ,
""  [hamiltonian] 
)

Definition at line 89 of file test_bare_kinetic.cpp.

References SpeciesSet::addAttribute(), TrialWaveFunction::addComponent(), SpeciesSet::addSpecies(), RadialJastrowBuilder::buildComponent(), CHECK(), OHMMS::Controller, ParticleSet::create(), ParticleSet::createSK(), doc, BareKineticEnergy::evaluate(), TrialWaveFunction::evaluateLog(), BareKineticEnergy::evaluateWithIonDerivs(), Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), ParticleSet::getTotalNum(), lattice, okay, Libxml2Document::parseFromString(), BareKineticEnergy::put(), ParticleSet::R, REQUIRE(), ParticleSet::resetGroups(), Vector< T, Alloc >::resize(), ParticleSet::setName(), and ParticleSet::update().

90 {
94 
96 
97  //Cell definition:
98 
99  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
100  lattice.BoxBConds = true; // periodic
101  lattice.R.diagonal(20);
102  lattice.LR_dim_cutoff = 15;
103  lattice.reset();
104 
105  const SimulationCell simulation_cell(lattice);
106  ParticleSet ions(simulation_cell);
107  ParticleSet elec(simulation_cell);
108 
109  ions.setName("ion0");
110  ions.create({2});
111  ions.R[0] = {0.0, 0.0, 0.0};
112  ions.R[1] = {6.0, 0.0, 0.0};
113  SpeciesSet& ion_species = ions.getSpeciesSet();
114  int pIdx = ion_species.addSpecies("Na");
115  int pChargeIdx = ion_species.addAttribute("charge");
116  int iatnumber = ion_species.addAttribute("atomic_number");
117  ion_species(pChargeIdx, pIdx) = 1;
118  ion_species(iatnumber, pIdx) = 11;
119  ions.createSK();
120 
121  elec.setName("e");
122  std::vector<int> agroup(2, 1);
123  elec.create(agroup);
124  elec.R[0] = {2.0, 0.0, 0.0};
125  elec.R[1] = {3.0, 0.0, 0.0};
126  SpeciesSet& tspecies = elec.getSpeciesSet();
127  int upIdx = tspecies.addSpecies("u");
128  int downIdx = tspecies.addSpecies("d");
129  int chargeIdx = tspecies.addAttribute("charge");
130  int massIdx = tspecies.addAttribute("mass");
131  tspecies(chargeIdx, upIdx) = -1;
132  tspecies(chargeIdx, downIdx) = -1;
133  tspecies(massIdx, upIdx) = 1.0;
134  tspecies(massIdx, downIdx) = 1.0;
135 
136  elec.createSK();
137 
138  ions.resetGroups();
139 
140  // The call to resetGroups is needed transfer the SpeciesSet
141  // settings to the ParticleSet
142  elec.resetGroups();
143 
144  //Cool. Now to construct a wavefunction with 1 and 2 body jastrow (no determinant)
145  RuntimeOptions runtime_options;
146  TrialWaveFunction psi(runtime_options);
147 
148  //Add the two body jastrow
149  const char* particles = R"(<tmp>
150  <jastrow name="J2" type="Two-Body" function="Bspline" print="yes" gpu="no">
151  <correlation speciesA="u" speciesB="d" rcut="10" size="8">
152  <coefficients id="ud" type="Array"> 2.015599059 1.548994099 1.17959447 0.8769687661 0.6245736507 0.4133517767 0.2333851935 0.1035636904</coefficients>
153  </correlation>
154  </jastrow>
155  </tmp>
156  )";
158  bool okay = doc.parseFromString(particles);
159  REQUIRE(okay);
160 
161  xmlNodePtr root = doc.getRoot();
162 
163  xmlNodePtr jas2 = xmlFirstElementChild(root);
164 
165  RadialJastrowBuilder jastrow(c, elec);
166  psi.addComponent(jastrow.buildComponent(jas2));
167  // Done with two body jastrow.
168 
169  //Add the one body jastrow.
170  const char* particles2 = R"(<tmp>
171  <jastrow name="J1" type="One-Body" function="Bspline" source="ion0" print="yes">
172  <correlation elementType="Na" rcut="10" size="10" cusp="0">
173  <coefficients id="eNa" type="Array"> 1.244201343 -1.188935609 -1.840397253 -1.803849126 -1.612058635 -1.35993202 -1.083353212 -0.8066295188 -0.5319252448 -0.3158819772</coefficients>
174  </correlation>
175  </jastrow>
176  </tmp>
177  )";
178  bool okay3 = doc.parseFromString(particles2);
179  REQUIRE(okay3);
180 
181  root = doc.getRoot();
182 
183  xmlNodePtr jas1 = xmlFirstElementChild(root);
184 
185  RadialJastrowBuilder jastrow1bdy(c, elec, ions);
186  psi.addComponent(jastrow1bdy.buildComponent(jas1));
187 
188  const char* kexml = R"(<tmp></tmp>)";
189 
190  root = doc.getRoot();
191 
192  xmlNodePtr h1 = xmlFirstElementChild(root);
193 
194  BareKineticEnergy bare_ke(elec, psi);
195  bare_ke.put(h1);
196 
197  // update all distance tables
198  ions.update();
199  elec.update();
200 
201  RealType logpsi = psi.evaluateLog(elec);
202 
203  RealType keval = bare_ke.evaluate(elec);
204 
205  //This is validated against an alternate code path (waveefunction tester for local energy).
206  CHECK(keval == Approx(-0.147507745));
207 
208  ParticleSet::ParticlePos HFTerm, PulayTerm;
209  HFTerm.resize(ions.getTotalNum());
210  PulayTerm.resize(ions.getTotalNum());
211 
212  RealType keval2 = bare_ke.evaluateWithIonDerivs(elec, ions, psi, HFTerm, PulayTerm);
213 
214  CHECK(keval2 == Approx(-0.147507745));
215  //These are validated against finite differences (delta=1e-6).
216  CHECK(PulayTerm[0][0] == Approx(-0.13166));
217  CHECK(PulayTerm[0][1] == Approx(0.0));
218  CHECK(PulayTerm[0][2] == Approx(0.0));
219  CHECK(PulayTerm[1][0] == Approx(-0.12145));
220  CHECK(PulayTerm[1][1] == Approx(0.0));
221  CHECK(PulayTerm[1][2] == Approx(0.0));
222 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [299/537]

qmcplusplus::TEST_CASE ( "HamiltonianFactory pseudopotential"  ,
""  [hamiltonian] 
)

Definition at line 89 of file test_hamiltonian_factory.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), WaveFunctionFactory::buildEmptyTWFForTesting(), OHMMS::Controller, createElectronParticleSet(), doc, Libxml2Document::getRoot(), okay, Libxml2Document::parseFromString(), HamiltonianFactory::put(), and REQUIRE().

90 {
92 
93  const SimulationCell simulation_cell;
94  auto elec_ptr = createElectronParticleSet(simulation_cell);
95  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
96 
97  auto &ions(*ions_ptr), elec(*elec_ptr);
98 
99  ions.setName("ion0");
100  std::vector<int> agroup({1});
101  ions.create(agroup);
102 
103  SpeciesSet& tspecies = ions.getSpeciesSet();
104  int idx = tspecies.addSpecies("C");
105  int chargeIdx = tspecies.addAttribute("charge");
106  int atomicNumberIdx = tspecies.addAttribute("atomicnumber");
107  tspecies(chargeIdx, idx) = 4;
108  tspecies(atomicNumberIdx, idx) = 6;
109 
110  HamiltonianFactory::PSetMap particle_set_map;
111  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
112  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
113 
114  RuntimeOptions runtime_options;
115  HamiltonianFactory::PsiPoolType psi_map;
116  psi_map.emplace("psi0", WaveFunctionFactory::buildEmptyTWFForTesting(runtime_options, "psi0"));
117 
118  HamiltonianFactory hf("h0", elec, particle_set_map, psi_map, c);
119 
120  const char* hamilonian_xml = R"(<hamiltonian name="h0" type="generic" target="e">
121  <pairpot type="pseudo" name="PseudoPot" source="ion0" wavefunction="psi0" format="xml">
122  <pseudo elementType="C" href="C.BFD.xml"/>
123  </pairpot>
124 </hamiltonian>)";
125 
127  bool okay = doc.parseFromString(hamilonian_xml);
128  REQUIRE(okay);
129 
130  xmlNodePtr root = doc.getRoot();
131  hf.put(root);
132 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
std::unique_ptr< ParticleSet > createElectronParticleSet(const SimulationCell &simulation_cell)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [300/537]

qmcplusplus::TEST_CASE ( "FairDivideAligned"  ,
""  [utilities] 
)

Definition at line 90 of file test_partition.cpp.

References FairDivideAligned(), and REQUIRE().

91 {
92  int first, last;
93 
94  FairDivideAligned(37, 6, 5, 2, first, last);
95  REQUIRE(first == 24);
96  REQUIRE(last == 36);
97 
98  FairDivideAligned(37, 6, 5, 4, first, last);
99  REQUIRE(first == 37);
100  REQUIRE(last == 37);
101 
102  FairDivideAligned(37, 6, 1, 0, first, last);
103  REQUIRE(first == 0);
104  REQUIRE(last == 37);
105 }
REQUIRE(std::filesystem::exists(filename))
void FairDivideAligned(const int ntot, const int base, const int npart, const int me, int &first, int &last)
Partition ntot over npart and the size of each partition is a multiple of base size.
Definition: FairDivide.h:96

◆ TEST_CASE() [301/537]

qmcplusplus::TEST_CASE ( "updateXmlNodes with existing element"  ,
""  [drivers] 
)

Definition at line 90 of file test_QMCCostFunctionBase.cpp.

References QMCCostFunctionTest::callUpdateXmlNodes(), comm, OHMMS::Controller, doc, QMCCostFunctionTest::getDoc(), Libxml2Document::getRoot(), getXMLAttributeValue(), okay, Libxml2Document::parseFromString(), REQUIRE(), QMCCostFunctionBase::setRootName(), and QMCCostFunctionBase::setWaveFunctionNode().

91 {
92  const SimulationCell simulation_cell;
93  MCWalkerConfiguration w(simulation_cell);
94  QMCHamiltonian h;
95  RuntimeOptions runtime_options;
96  TrialWaveFunction psi(runtime_options);
97 
99 
100  QMCCostFunctionTest cost(w, psi, h, comm);
101  cost.setRootName("tmp2");
102 
103  const char* wf_xml = R"(
104 <wavefunction>
105  <override_variational_parameters href="vp.tmp.h5"/>
106 </wavefunction>
107  )";
108 
110  bool okay = doc.parseFromString(wf_xml);
111  REQUIRE(okay);
112  cost.setWaveFunctionNode(doc.getRoot());
113 
114  cost.callUpdateXmlNodes();
115  //cost.printXml();
116 
117  xmlXPathContextPtr acontext = xmlXPathNewContext(cost.getDoc());
118  OhmmsXPathObject check_elem("//override_variational_parameters", acontext);
119  REQUIRE(check_elem.size() == 1);
120 
121  std::string href = getXMLAttributeValue(check_elem[0], "href");
122  REQUIRE(href == "tmp2.vp.h5");
123 
124  xmlXPathFreeContext(acontext);
125 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
std::string getXMLAttributeValue(const xmlNodePtr cur, const std::string_view name)
get the value string for attribute name if name is unfound in cur you get an empty string back this i...
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [302/537]

qmcplusplus::TEST_CASE ( "ModernStringUtils_string2Int"  ,
""  [utilities] 
)

Definition at line 90 of file test_ModernStringUtils.cpp.

References CHECK().

91 {
92  std::string_view svalue{"1003"};
93  auto value = string2Int<int>(svalue);
94  CHECK(value == 1003);
95  long too_large_for_int = std::numeric_limits<int>::max();
96  too_large_for_int += 2;
97  std::ostringstream input;
98  input << too_large_for_int;
99 //Safety pre stdlibcxx 10 doesn't seem worth the effort
100 #if _GLIBCXX_RELEASE > 10
101  CHECK_THROWS_AS(string2Int<int>(input.str()), std::range_error);
102  CHECK_THROWS_AS(string2Int<int>("bad"), std::runtime_error);
103 #endif
104  long big_enough = string2Int<decltype(big_enough)>(input.str());
105  CHECK(big_enough == too_large_for_int);
106 } // namespace qmcplusplus
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
testing::ValidSpinDensityInput input

◆ TEST_CASE() [303/537]

qmcplusplus::TEST_CASE ( "test_timer_flat_profile"  ,
""  [utilities] 
)

Definition at line 91 of file test_timer.cpp.

References TimerManager< TIMER >::FlatProfileData::callList, CHECK(), TimerManager< TIMER >::collate_flat_profile(), TimerManager< TIMER >::createTimer(), TimerManager< TIMER >::FlatProfileData::nameList, REQUIRE(), set_num_calls(), set_total_time(), and TimerManager< TIMER >::FlatProfileData::timeList.

92 {
94  FakeTimer* t1 = tm.createTimer("timer1");
95  set_total_time(t1, 1.1);
96  set_num_calls(t1, 2);
97 
98  FakeTimerManager::FlatProfileData p;
99  tm.collate_flat_profile(NULL, p);
100 
101  REQUIRE(p.nameList.size() == 1);
102  REQUIRE(p.nameList.at("timer1") == 0);
103  REQUIRE(p.timeList.size() == 1);
104  CHECK(p.timeList[0] == Approx(1.1));
105  REQUIRE(p.callList.size() == 1);
106  REQUIRE(p.callList[0] == 2);
107 }
TimerType< FakeChronoClock > FakeTimer
Definition: NewTimer.h:235
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
TimerManager< FakeTimer > FakeTimerManager
Definition: test_timer.cpp:23
void set_total_time(TimerType< CLOCK > *timer, double total_time_input)
Definition: test_timer.cpp:26
void set_num_calls(TimerType< CLOCK > *timer, long num_calls_input)
Definition: test_timer.cpp:32

◆ TEST_CASE() [304/537]

qmcplusplus::TEST_CASE ( "symmetric_distance_table PBC"  ,
""  [particle] 
)

Definition at line 91 of file test_ParticleSet.cpp.

References ParticleSet::addTable(), CrystalLattice< T, D >::BoxBConds, CHECK(), ParticleSet::create(), DistanceTableAA::getDistances(), ParticleSet::getDistTableAA(), ParticleSet::R, CrystalLattice< T, D >::R, CrystalLattice< T, D >::reset(), ParticleSet::setName(), and ParticleSet::update().

92 {
93  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> Lattice;
94  Lattice.BoxBConds = true; // periodic
95  Lattice.R = ParticleSet::Tensor_t(6.74632230, 6.74632230, 0.00000000, 0.00000000, 3.37316115, 3.37316115, 3.37316115,
96  0.00000000, 3.37316115);
97  Lattice.reset();
98 
99  const SimulationCell simulation_cell(Lattice);
100  ParticleSet source(simulation_cell);
101 
102  source.setName("electrons");
103 
104  source.create({4});
105  source.R[0] = ParticleSet::PosType(0.00000000, 0.00000000, 0.00000000);
106  source.R[1] = ParticleSet::PosType(1.68658058, 1.68658058, 1.68658058);
107  source.R[2] = ParticleSet::PosType(3.37316115, 3.37316115, 0.00000000);
108  source.R[3] = ParticleSet::PosType(5.05974172, 5.05974172, 1.68658058);
109 
110  const int TableID = source.addTable(source);
111  source.update();
112  const auto& d_aa = source.getDistTableAA(TableID);
113  const auto& aa_dists = d_aa.getDistances();
114  const auto& aa_displs = d_aa.getDisplacements();
115 
116  CHECK(aa_dists[2][1] == Approx(2.9212432441));
117  CHECK(aa_displs[2][1][0] == Approx(-1.68658057));
118  CHECK(aa_displs[2][1][1] == Approx(-1.68658057));
119  CHECK(aa_displs[2][1][2] == Approx(1.68658057));
120 }
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
POLT::ParticleLayout Lattice
QMCTraits::PosType PosType
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

◆ TEST_CASE() [305/537]

qmcplusplus::TEST_CASE ( "read_particleset_recorder_xml"  ,
""  [particle_io][xml] 
)

Definition at line 91 of file test_xml_io.cpp.

References CHECK(), doc, Libxml2Document::getRoot(), okay, Libxml2Document::parseFromString(), XMLParticleParser::readXML(), and REQUIRE().

92 {
93  const char* particles = R"(<tmp>
94 <particleset name="ion0" size="3">
95  <group name="He">
96  <parameter name="charge">2</parameter>
97  </group>
98  <group name="H">
99  <parameter name="charge">1</parameter>
100  </group>
101  <attrib name="position" datatype="posArray">
102  0.1 0.2 0.3
103  0.3 0.1 0.2
104  0.2 0.3 0.1
105  </attrib>
106  <attrib name="ionid" datatype="stringArray">
107  H He He
108  </attrib>
109 </particleset>
110 </tmp>
111 )";
113  bool okay = doc.parseFromString(particles);
114  REQUIRE(okay);
115 
116  xmlNodePtr root = doc.getRoot();
117 
118  const SimulationCell simulation_cell;
119  ParticleSet ions(simulation_cell), electrons(simulation_cell);
120 
121  XMLParticleParser parse_ions(ions);
122  xmlNodePtr part1 = xmlFirstElementChild(root);
123  parse_ions.readXML(part1);
124 
125  CHECK(ions.groups() == 2);
126  CHECK(ions.R.size() == 3);
127  CHECK(ions.GroupID[0] == 0); // He
128  CHECK(ions.GroupID[1] == 0); // He
129  CHECK(ions.GroupID[2] == 1); // H
130  CHECK(ions.R[0][0] == Approx(0.3));
131  CHECK(ions.R[0][1] == Approx(0.1));
132  CHECK(ions.R[0][2] == Approx(0.2));
133  CHECK(ions.R[1][0] == Approx(0.2));
134  CHECK(ions.R[1][1] == Approx(0.3));
135  CHECK(ions.R[1][2] == Approx(0.1));
136  CHECK(ions.R[2][0] == Approx(0.1));
137  CHECK(ions.R[2][1] == Approx(0.2));
138  CHECK(ions.R[2][2] == Approx(0.3));
139  CHECK(ions.getName() == "ion0");
140 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [306/537]

qmcplusplus::TEST_CASE ( "EstimatorManagerNew::collectMainEstimators"  ,
""  [estimators] 
)

Definition at line 92 of file test_EstimatorManagerNew.cpp.

References CHECK(), EstimatorManagerNewTest::collectMainEstimators(), OHMMS::Controller, EstimatorManagerNewTest::em, embt, EstimatorManagerNewTest::fakeMainScalarSamples(), EstimatorManagerNew::get_AverageCache(), ham, REQUIRE(), and EstimatorManagerNewTest::testReplaceMainEstimator().

93 {
95 
96  QMCHamiltonian ham;
97  testing::EstimatorManagerNewTest embt(ham, c, 1);
98  // by design we have done no averaging here
99  // the division by total weight happens only when a block is over and the
100  // accumulated data has been reduced down. So here there should just be simple sums.
101 
103 
106  double correct_value = 5.0;
107  CHECK(embt.em.get_AverageCache()[0] == Approx(correct_value));
108  correct_value = 8.0;
109  CHECK(embt.em.get_AverageCache()[1] == Approx(correct_value));
110  correct_value = 11.0;
111  CHECK(embt.em.get_AverageCache()[2] == Approx(correct_value));
112  correct_value = 14.0;
113  CHECK(embt.em.get_AverageCache()[3] == Approx(correct_value));
114 }
CHECK(emnta2.getMainEstimator().getName()=="RMCLocalEnergyEstimator")
bool testReplaceMainEstimator()
test replacing the main estimator
void collectMainEstimators()
call private EMB method and collect EMBTs estimators_ as main_estimators
void fakeMainScalarSamples()
Quickly add main scalar samples using FakeEstimator mock estimator.
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
testing::EstimatorManagerNewTest embt(ham, c, 1)

◆ TEST_CASE() [307/537]

qmcplusplus::TEST_CASE ( "QMCDriverFactory create VMCBatched driver"  ,
""  [qmcapp] 
)

Definition at line 92 of file test_QMCDriverFactory.cpp.

References ProjectData::BATCH, CHECK(), comm, OHMMS::Controller, qmcplusplus::testing::createDriver(), doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), QMCDriverFactory::DriverAssemblyState::new_run_type, node, okay, Libxml2Document::parseFromString(), QMCDriverFactory::readSection(), REQUIRE(), test_project, qmcplusplus::testing::valid_vmc_batch_input_vmc_batch_index, qmcplusplus::testing::valid_vmc_input_sections, qmcplusplus::testing::valid_vmc_input_vmc_batch_index, and VMC_BATCH.

93 {
96  using namespace testing;
97 
98  SECTION("driver version behavior")
99  {
100  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
101  QMCDriverFactory driver_factory(test_project);
102 
105  REQUIRE(okay);
106  xmlNodePtr node = doc.getRoot();
107  QMCDriverFactory::DriverAssemblyState das = driver_factory.readSection(node);
108  REQUIRE(das.new_run_type == QMCRunType::VMC_BATCH);
109 
110  auto qmc_driver = testing::createDriver(test_project.getRuntimeOptions(), comm, driver_factory, node, das);
111  REQUIRE(qmc_driver != nullptr);
112  REQUIRE_NOTHROW(dynamic_cast<VMCBatched&>(*qmc_driver));
113  REQUIRE_THROWS(dynamic_cast<VMC&>(*qmc_driver));
114  CHECK(qmc_driver->getEngineName() == "VMCBatched");
115  }
116  SECTION("Deprecated _batch behavior")
117  {
118  using namespace testing;
119  ProjectData test_project;
120  QMCDriverFactory driver_factory(test_project);
121 
124  REQUIRE(okay);
125  xmlNodePtr node = doc.getRoot();
126  QMCDriverFactory::DriverAssemblyState das = driver_factory.readSection(node);
127  REQUIRE(das.new_run_type == QMCRunType::VMC_BATCH);
128 
129  auto qmc_driver = testing::createDriver(test_project.getRuntimeOptions(), comm, driver_factory, node, das);
130 
131  REQUIRE(qmc_driver != nullptr);
132  REQUIRE_NOTHROW(dynamic_cast<VMCBatched&>(*qmc_driver));
133  REQUIRE_THROWS(dynamic_cast<VMC&>(*qmc_driver));
134  CHECK(qmc_driver->getEngineName() == "VMCBatched");
135  }
136 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
constexpr int valid_vmc_input_vmc_batch_index
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
constexpr std::array< const char *, 4 > valid_vmc_input_sections
constexpr int valid_vmc_batch_input_vmc_batch_index
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
auto createDriver(const RuntimeOptions &runtime_options, Communicate *comm, QMCDriverFactory &driver_factory, xmlNodePtr node, QMCDriverFactory::DriverAssemblyState &das)

◆ TEST_CASE() [308/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-B BCC H"  ,
""  [hamiltonian] 
)

Definition at line 94 of file test_coulomb_pbcAB.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAB::evalConsts(), CoulombPBCAA::evaluate(), CoulombPBCAB::evaluate(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, ParticleSet::resetGroups(), ParticleSet::setName(), and ParticleSet::update().

95 {
96  LRCoulombSingleton::CoulombHandler = 0;
97 
98  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
99  lattice.BoxBConds = true; // periodic
100  lattice.R.diagonal(3.77945227);
101  lattice.reset();
102 
103  const SimulationCell simulation_cell(lattice);
104  ParticleSet ions(simulation_cell);
105  ParticleSet elec(simulation_cell);
106 
107  ions.setName("ion");
108  ions.create({2});
109  ions.R[0] = {0.0, 0.0, 0.0};
110  ions.R[1] = {1.88972614, 1.88972614, 1.88972614};
111  SpeciesSet& ion_species = ions.getSpeciesSet();
112  int pIdx = ion_species.addSpecies("H");
113  int pChargeIdx = ion_species.addAttribute("charge");
114  ion_species(pChargeIdx, pIdx) = 1;
115  ions.createSK();
116  ions.update();
117 
118  elec.setName("elec");
119  elec.create({2});
120  elec.R[0] = {0.5, 0.0, 0.0};
121  elec.R[1] = {0.0, 0.5, 0.0};
122  SpeciesSet& tspecies = elec.getSpeciesSet();
123  int upIdx = tspecies.addSpecies("u");
124  int chargeIdx = tspecies.addAttribute("charge");
125  int massIdx = tspecies.addAttribute("mass");
126  tspecies(chargeIdx, upIdx) = -1;
127  tspecies(massIdx, upIdx) = 1.0;
128 
129  elec.resetGroups();
130  elec.createSK();
131  elec.addTable(ions);
132  elec.update();
133 
134  CoulombPBCAB cab(ions, elec);
135 
136  // Background charge term
137  double consts = cab.evalConsts(elec);
138  CHECK(consts == Approx(0.0267892759 * 4)); // not validated
139 
140 
141  double val_ei = cab.evaluate(elec);
142  CHECK(val_ei == Approx(-2.219665062 + 0.0267892759 * 4)); // not validated
143 
144 
145  CoulombPBCAA caa_elec(elec, false, false, false);
146  CoulombPBCAA caa_ion(ions, false, false, false);
147  double val_ee = caa_elec.evaluate(elec);
148  double val_ii = caa_ion.evaluate(ions);
149  double sum = val_ee + val_ii + val_ei;
150  CHECK(sum == Approx(-3.143491064)); // Can be validated via Ewald summation elsewhere
151  // -3.14349127313640
152 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [309/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-B BCC H Ewald3D"  ,
""  [hamiltonian] 
)

Definition at line 94 of file test_coulomb_pbcAB_ewald.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAB::evalConsts(), CoulombPBCAA::evaluate(), CoulombPBCAB::evaluate(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, ParticleSet::resetGroups(), ParticleSet::setName(), and ParticleSet::update().

95 {
96  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
97  lattice.BoxBConds = true; // periodic
98  lattice.R.diagonal(3.77945227);
99  lattice.reset();
100 
101  const SimulationCell simulation_cell(lattice);
102  ParticleSet ions(simulation_cell);
103  ParticleSet elec(simulation_cell);
104 
105  ions.setName("ion");
106  ions.create({2});
107  ions.R[0] = {0.0, 0.0, 0.0};
108  ions.R[1] = {1.88972614, 1.88972614, 1.88972614};
109  SpeciesSet& ion_species = ions.getSpeciesSet();
110  int pIdx = ion_species.addSpecies("H");
111  int pChargeIdx = ion_species.addAttribute("charge");
112  ion_species(pChargeIdx, pIdx) = 1;
113  ions.createSK();
114  ions.update();
115 
116 
117  elec.setName("elec");
118  elec.create({2});
119  elec.R[0] = {0.5, 0.0, 0.0};
120  elec.R[1] = {0.0, 0.5, 0.0};
121  SpeciesSet& tspecies = elec.getSpeciesSet();
122  int upIdx = tspecies.addSpecies("u");
123  int chargeIdx = tspecies.addAttribute("charge");
124  int massIdx = tspecies.addAttribute("mass");
125  tspecies(chargeIdx, upIdx) = -1;
126  tspecies(massIdx, upIdx) = 1.0;
127 
128  elec.resetGroups();
129  elec.createSK();
130  elec.addTable(ions);
131  elec.update();
132 
133 
134  LRCoulombSingleton::CoulombHandler = std::make_unique<EwaldHandler3D>(ions);
135  LRCoulombSingleton::CoulombHandler->initBreakup(ions);
136 
137  CoulombPBCAB cab(ions, elec);
138 
139  // Background charge term
140  double consts = cab.evalConsts(elec);
141  CHECK(consts == Approx(0.0277076538 * 4)); //not validated
142 
143 
144  double val_ei = cab.evaluate(elec);
145  CHECK(val_ei == Approx(-2.223413 + 0.0277076538 * 4)); //Not validated
146 
147 
148  CoulombPBCAA caa_elec(elec, false, false, false);
149  CoulombPBCAA caa_ion(ions, false, false, false);
150  double val_ee = caa_elec.evaluate(elec);
151  double val_ii = caa_ion.evaluate(ions);
152  double sum = val_ee + val_ii + val_ei;
153 
154  CHECK(val_ee == Approx(-0.012808 - 0.0277076538 * 2));
155  CHECK(val_ii == Approx(-0.907659 - 0.0277076538 * 2));
156  CHECK(sum == Approx(-3.143880)); // Can be validated via Ewald summation elsewhere
157  // -3.14349127313640
158 
159  LRCoulombSingleton::CoulombHandler.reset(nullptr);
160 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [310/537]

qmcplusplus::TEST_CASE ( "Crowd redistribute walkers"  )

Definition at line 94 of file test_Crowd.cpp.

References crowd, CrowdWithWalkers::get_crowd(), CrowdWithWalkers::hams, CrowdWithWalkers::makeAnotherPointWalker(), pools, CrowdWithWalkers::psets, REQUIRE(), CrowdWithWalkers::twfs, and CrowdWithWalkers::walkers.

95 {
96  using namespace testing;
97  SetupPools pools;
98 
99  CrowdWithWalkers crowd_with_walkers(pools);
100  Crowd& crowd = crowd_with_walkers.get_crowd();
101 
102  crowd_with_walkers.makeAnotherPointWalker();
103  crowd.clearWalkers();
104  for (int iw = 0; iw < crowd_with_walkers.walkers.size(); ++iw)
105  crowd.addWalker(*crowd_with_walkers.walkers[iw], *crowd_with_walkers.psets[iw], *crowd_with_walkers.twfs[iw],
106  *crowd_with_walkers.hams[iw]);
107  REQUIRE(crowd.size() == 3);
108 }
REQUIRE(std::filesystem::exists(filename))
SetupPools pools

◆ TEST_CASE() [311/537]

qmcplusplus::TEST_CASE ( "Gaussian Combo P"  ,
""  [numerics] 
)

Definition at line 95 of file test_gaussian_basis.cpp.

References GaussianCombo< T >::addGaussian(), CHECK(), GaussianCombo< T >::d2Y, GaussianCombo< T >::d3Y, GaussianCombo< T >::df(), GaussianCombo< T >::dY, GaussianCombo< T >::evaluate(), GaussianCombo< T >::evaluateAll(), GaussianCombo< T >::evaluateWithThirdDeriv(), GaussianCombo< T >::f(), REQUIRE(), GaussianCombo< T >::size(), and GaussianCombo< T >::Y.

96 {
97  GaussianCombo<real_type> gc(1, false);
98 
99  // cc-pVDZ for C, the 2P basis
100  gc.addGaussian(0.0381090, 9.4390000);
101  gc.addGaussian(0.2094800, 2.0020000);
102  gc.addGaussian(0.5085570, 0.5456000);
103 
104  REQUIRE(gc.size() == 3);
105 
106  real_type r = 1.3;
107  real_type f = gc.f(r);
108 
109  CHECK(f == Approx(0.326057642350121));
110 
111  f = gc.evaluate(r, 1.0 / r);
112  CHECK(f == Approx(0.326057642350121));
113 
114  real_type df = gc.df(r);
115  CHECK(df == Approx(-0.649531407846947));
116 
117  gc.evaluateAll(r, 1.0 / r);
118  CHECK(gc.Y == Approx(0.326057642350121));
119  CHECK(gc.dY == Approx(-0.649531407846947));
120  CHECK(gc.d2Y == Approx(1.39522444199589));
121 
122  gc.evaluateWithThirdDeriv(r, 1.0 / r);
123  CHECK(gc.Y == Approx(0.326057642350121));
124  CHECK(gc.dY == Approx(-0.649531407846947));
125  CHECK(gc.d2Y == Approx(1.39522444199589));
126  CHECK(gc.d3Y == Approx(-3.38467690038774));
127 }
REQUIRE(std::filesystem::exists(filename))
OHMMS_PRECISION real_type
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [312/537]

qmcplusplus::TEST_CASE ( "InputSection::InputSection"  ,
""  [estimators] 
)

Definition at line 96 of file test_InputSection.cpp.

References CHECK(), and InputSection::has().

97 {
98  // empty input section
99  TestInputSection ti;
100  // no values assigned yet
101  CHECK(!ti.has("name"));
102  CHECK(!ti.has("samples"));
103  CHECK(!ti.has("kmax"));
104  CHECK(!ti.has("full"));
105  CHECK(!ti.has("label"));
106  CHECK(!ti.has("count"));
107  CHECK(!ti.has("width"));
108  CHECK(!ti.has("rational"));
109  CHECK(!ti.has("sposets"));
110 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [313/537]

qmcplusplus::TEST_CASE ( "gaussian random input zero"  ,
""  [particle_base] 
)

Definition at line 96 of file test_random_seq.cpp.

References assignGaussRand(), CHECK(), and FakeRandom< T >::set_value().

97 {
98  FakeRandom rg;
99  rg.set_value(0.0);
100  std::vector<double> a(2);
101  assignGaussRand(a.data(), 2, rg);
102 
103  // uniform RNG input is 0.0
104  CHECK(a[0] == Approx(0.0));
105  CHECK(a[1] == Approx(0.0));
106 }
void assignGaussRand(T *restrict a, unsigned n, RG &rng)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [314/537]

qmcplusplus::TEST_CASE ( "ReadFileBuffer_sorep"  ,
""  [hamiltonian] 
)

Definition at line 96 of file test_ecp.cpp.

References CHECK(), OHMMS::Controller, getSplinedSOPot(), okay, ECPComponentBuilder::pp_so, ECPComponentBuilder::read_pp_file(), REQUIRE(), and ECPComponentBuilder::Zeff.

97 {
99 
100  ECPComponentBuilder ecp("test_read_sorep", c);
101 
102  bool okay = ecp.read_pp_file("so_ecp_test.xml");
103  REQUIRE(okay);
104 
105  REQUIRE(ecp.Zeff == 13);
106 
107  double rlist[5] = {0.001, 0.500, 1.000, 2.000, 10.000};
108  double so_p[5] = {0.999999000005, 0.778800783071, 0.3678794411714, 0.01831563888873418, 0.000};
109  double so_d[5] = {9.99998000e-01, 6.06530660e-01, 1.35335283e-01, 3.35462628e-04, 0.000};
110  double so_f[5] = {9.99997000e-01, 4.72366553e-01, 4.97870684e-02, 6.14421235e-06, 0.000};
111 
112  for (int i = 0; i < 5; i++)
113  {
114  double r = rlist[i];
115  double so_p_ref = so_p[i];
116  double so_d_ref = so_d[i];
117  double so_f_ref = so_f[i];
118 
119  double so_p_val = getSplinedSOPot(ecp.pp_so.get(), 0, r);
120  double so_d_val = getSplinedSOPot(ecp.pp_so.get(), 1, r);
121  double so_f_val = getSplinedSOPot(ecp.pp_so.get(), 2, r);
122 
123  CHECK(so_p_val == Approx(so_p_ref));
124  CHECK(so_d_val == Approx(so_d_ref));
125  CHECK(so_f_val == Approx(so_f_ref));
126  }
127 
128  // TODO: add more checks that pseudopotential file was read correctly
129 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
QMCTraits::RealType getSplinedSOPot(SOECPComponent *so_comp, int l, double r)
Definition: test_ecp.cpp:44

◆ TEST_CASE() [315/537]

qmcplusplus::TEST_CASE ( "fillOverlapAndHamiltonianMatrices"  ,
""  [drivers] 
)

Definition at line 97 of file test_QMCCostFunctionBatched.cpp.

References CHECK(), comm, OHMMS::Controller, LinearMethodTestSupport::costFn, QMCCostFunctionBase::ENERGY_NEW, QMCCostFunctionBatched::fillOverlapHamiltonianMatrices(), LinearMethodTestSupport::getDerivRecords(), LinearMethodTestSupport::getHDerivRecords(), LinearMethodTestSupport::getRecordsOnNode(), LinearMethodTestSupport::getSumValue(), ham, qmcplusplus::Units::force::N, QMCCostFunctionBase::REWEIGHT, LinearMethodTestSupport::set_samples_and_param(), QMCCostFunctionBase::SUM_E_WGT, QMCCostFunctionBase::SUM_ESQ_WGT, and QMCCostFunctionBase::SUM_WGT.

98 {
99  std::vector<int> walkers_per_crowd{1};
100 
101  using Return_rt = qmcplusplus::QMCTraits::RealType;
102 
104 
105  testing::LinearMethodTestSupport lin(walkers_per_crowd, comm);
106 
107  int numSamples = 1;
108  int numParam = 1;
109  lin.set_samples_and_param(numSamples, numParam);
110 
111  std::vector<Return_rt>& SumValue = lin.getSumValue();
112  SumValue[QMCCostFunctionBase::SUM_WGT] = 1.0;
113  SumValue[QMCCostFunctionBase::SUM_E_WGT] = -1.3;
114  SumValue[QMCCostFunctionBase::SUM_ESQ_WGT] = 1.69;
115 
116  auto& RecordsOnNode = lin.getRecordsOnNode();
117  RecordsOnNode(0, QMCCostFunctionBase::REWEIGHT) = 1.0;
118  RecordsOnNode(0, QMCCostFunctionBase::ENERGY_NEW) = -1.4;
119 
120  auto& derivRecords = lin.getDerivRecords();
121  derivRecords(0, 0) = 1.1;
122 
123  auto& HDerivRecords = lin.getHDerivRecords();
124  HDerivRecords(0, 0) = -1.2;
125 
126  int N = numParam + 1;
127  Matrix<Return_rt> ham(N, N);
128  Matrix<Return_rt> ovlp(N, N);
129  lin.costFn.fillOverlapHamiltonianMatrices(ham, ovlp);
130 
131  CHECK(ovlp(0, 0) == Approx(1.0));
132  CHECK(ovlp(1, 0) == Approx(0.0));
133  CHECK(ovlp(0, 1) == Approx(0.0));
134  // With one sample, value is always zero
135  CHECK(ovlp(1, 1) == Approx(0.0));
136 
137  CHECK(ham(0, 0) == Approx(-1.3));
138  // With one sample, values are always zero
139  CHECK(ham(1, 0) == Approx(0.0));
140  CHECK(ham(0, 1) == Approx(-1.2));
141  CHECK(ham(1, 1) == Approx(0.0));
142 }
QTBase::RealType RealType
Definition: Configuration.h:58
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [316/537]

qmcplusplus::TEST_CASE ( "get scaled drift real ,
""  [drivers][drift] 
)

Definition at line 97 of file test_drift.cpp.

References CHECK(), ParticleSet::create(), ParticleSet::G, DriftModifierUNR::getDrift(), ParticleSet::setName(), and sqrt().

98 {
99  const SimulationCell simulation_cell;
100  MCWalkerConfiguration elec(simulation_cell);
101 
102  elec.setName("elec");
103  std::vector<int> agroup(1);
104  agroup[0] = 1;
105  elec.create(agroup);
106 
107  ParticleSet::RealType tau = 0.5;
108  ParticleSet::RealType mass = 0.85;
109  std::vector<ParticleSet::RealType> massinv(1, 1. / mass);
110  ParticleSet::PosType drift;
111 
112  // check from -xtot/2 to xtot/2 in step size of dx i.e. np.arange(-xtot/2,xtot/2,dx)
113  double xtot = 10.;
114  int nx = 100;
115  double gradx = -xtot / 2.;
116  double dx = xtot / nx;
117 
118  DriftModifierUNR DM;
119  for (int ix = 0; ix < nx; ix++)
120  {
121  elec.G[0][0] = gradx;
122  DM.getDrift(tau / mass, elec.G[0], drift);
123  double dval = drift[0];
124 
125  double scale_factor = (-1. + std::sqrt(1. + 2. * gradx * gradx * tau / mass)) / (gradx * gradx * tau / mass);
126  CHECK(dval == Approx(scale_factor * gradx * tau / mass));
127 
128  gradx += dx;
129  }
130 }
QMCTraits::PosType PosType
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
QMCTraits::RealType RealType
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [317/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A Ewald2D triangular"  ,
""  [hamiltonian] 
)

Definition at line 97 of file test_ewald2d.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, ParticleSet::setName(), sqrt(), LRCoulombSingleton::STRICT2D, LRCoulombSingleton::this_lr_type, and ParticleSet::update().

98 {
99  LRCoulombSingleton::CoulombHandler = 0; // !!!! crucial if not first test
100  LRCoulombSingleton::this_lr_type = LRCoulombSingleton::STRICT2D;
101  const double vmad_tri = -1.1061025865191676;
102  const double alat = std::sqrt(2.0*M_PI/std::sqrt(3));
103 
104  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
105  lattice.BoxBConds = true; // periodic
106  lattice.ndim = 2;
107  lattice.R = 0.0;
108  lattice.R(0, 0) = alat;
109  lattice.R(1, 0) = -1.0/2*alat;
110  lattice.R(1, 1) = std::sqrt(3)/2*alat;
111  lattice.R(2, 2) = 2*alat;
112  lattice.LR_dim_cutoff = 30.0;
113  lattice.reset();
114 
115  const SimulationCell simulation_cell(lattice);
116  ParticleSet elec(simulation_cell);
117  elec.setName("e");
118  elec.create({1});
119  elec.R[0] = {0.0, 0.0, 0.0};
120 
121  SpeciesSet& tspecies = elec.getSpeciesSet();
122  int upIdx = tspecies.addSpecies("u");
123  int chargeIdx = tspecies.addAttribute("charge");
124  int massIdx = tspecies.addAttribute("mass");
125  tspecies(chargeIdx, upIdx) = -1;
126  tspecies(massIdx, upIdx) = 1.0;
127 
128  elec.createSK();
129  elec.update();
130 
131  CoulombPBCAA caa = CoulombPBCAA(elec, true, false, false);
132 
133  double val = caa.evaluate(elec);
134  CHECK(val == Approx(vmad_tri));
135 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [318/537]

qmcplusplus::TEST_CASE ( "checkMatrix_real"  ,
""  [utilities][for_testing] 
)

Definition at line 97 of file test_checkMatrix.cpp.

References CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), and REQUIRE().

98 {
99  // clang-format off
100  std::vector<double> a_vec{2.3, 4.5, 2.6,
101  0.5, 8.5, 3.3,
102  1.8, 4.4, 4.9};
103  MatrixAccessor<double> a_mat(a_vec.data(), 3, 3);
104  std::vector<double> b_vec{2.3, 4.5, 2.6,
105  0.5, 8.5, 3.3,
106  1.8, 4.4, 4.9};
107  MatrixAccessor<double> b_mat(b_vec.data(), 3, 3);
108 
109  auto check_matrix_result = checkMatrix(a_mat, b_mat);
110  // This would be how you would fail and print the information about what element failed.
111  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
112 
113  std::vector<double> c_vec{2.3, 4.5, 2.6, 0.0,
114  0.5, 8.5, 3.3, 0.0,
115  1.8, 4.4, 4.9, 0,0,
116  0.0, 0.0, 0.0, 0.0};
117  MatrixAccessor<double> c_mat(c_vec.data(), 4, 4);
118  // clang-format on
119 
120  check_matrix_result = checkMatrix(a_mat, c_mat);
121  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
122 
123  b_vec[0] = 1.0;
124  b_vec[5] = 3.6;
125  check_matrix_result = checkMatrix(a_mat, b_mat, true);
126  std::string::size_type pos = 0;
127  int lines = 0;
128  while (true)
129  {
130  pos = check_matrix_result.result_message.find("\n", pos);
131  if (pos == std::string::npos)
132  break;
133  ++pos;
134  ++lines;
135  }
136  CHECK(lines == 2);
137  REQUIRE(check_matrix_result.result == false);
138 }
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
REQUIRE(std::filesystem::exists(filename))
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [319/537]

qmcplusplus::TEST_CASE ( "find minimum"  ,
""  [numerics] 
)

Definition at line 98 of file test_min_oned.cpp.

References MinTest::find_min().

99 {
100  MinTest min_test;
101  min_test.find_min(1.3);
102  min_test.find_min(-1.3);
103  min_test.find_min(10.0);
104 
105  MinTest min_test2(1.5);
106  min_test2.find_min(1.3);
107  min_test2.find_min(-1.3);
108  min_test2.find_min(10.0);
109 
110  MinTest min_test3(-0.5);
111  min_test3.find_min(1.3);
112  min_test3.find_min(-1.3);
113  min_test3.find_min(10.0);
114 }

◆ TEST_CASE() [320/537]

qmcplusplus::TEST_CASE ( "EstimatorManagerInput::moveFromEstimatorInputs"  ,
""  [estimators] 
)

Definition at line 98 of file test_EstimatorManagerInput.cpp.

References doc, emi(), EstimatorManagerInput::get_estimator_inputs(), Libxml2Document::getRoot(), node, okay, Libxml2Document::parseFromString(), REQUIRE(), EstimatorManagerInputTests::testAppendFromXML(), and ValidSpinDensityInput::xml.

99 {
100  using namespace testing;
101  EstimatorManagerInputTests emit;
102  EstimatorManagerInput emi;
103 
104  {
105  using input = testing::ValidOneBodyDensityMatricesInput;
107  bool okay = doc.parseFromString(input::xml[input::VANILLA]);
108  REQUIRE(okay);
109  xmlNodePtr node = doc.getRoot();
110  emit.testAppendFromXML<OneBodyDensityMatricesInput>(emi, node);
111  }
112  {
114  using spin_input = testing::ValidSpinDensityInput;
115  bool okay = doc.parseFromString(spin_input::xml[spin_input::GRID]);
116  REQUIRE(okay);
117  xmlNodePtr node = doc.getRoot();
118  emit.testAppendFromXML<SpinDensityInput>(emi, node);
119  }
120  TakesAMovedInput<SpinDensityInput> takes_sdi(
121  std::move(std::get<SpinDensityInput>(emi.get_estimator_inputs().back())));
122  emi.get_estimator_inputs().pop_back();
123  TakesAMovedInput<OneBodyDensityMatricesInput> takes_obdmi(
124  std::move(std::get<OneBodyDensityMatricesInput>(emi.get_estimator_inputs().back())));
125  emi.get_estimator_inputs().pop_back();
126 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
EstimatorManagerInput emi(estimators_doc.getRoot())
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
testing::ValidSpinDensityInput input

◆ TEST_CASE() [321/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A elec Ewald3D"  ,
""  [hamiltonian] 
)

Definition at line 98 of file test_coulomb_pbcAA_ewald.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evalConsts(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, ParticleSet::setName(), and ParticleSet::update().

99 {
100  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
101  lattice.BoxBConds = true; // periodic
102  lattice.R.diagonal(1.0);
103  lattice.reset();
104 
105  const SimulationCell simulation_cell(lattice);
106  ParticleSet elec(simulation_cell);
107 
108  elec.setName("elec");
109  elec.create({1});
110  elec.R[0] = {0.0, 0.5, 0.0};
111  SpeciesSet& tspecies = elec.getSpeciesSet();
112  int upIdx = tspecies.addSpecies("u");
113  int chargeIdx = tspecies.addAttribute("charge");
114  int massIdx = tspecies.addAttribute("mass");
115  tspecies(chargeIdx, upIdx) = -1;
116  tspecies(massIdx, upIdx) = 1.0;
117 
118  elec.createSK();
119  elec.update();
120 
121  LRCoulombSingleton::CoulombHandler = std::make_unique<EwaldHandler3D>(elec);
122  LRCoulombSingleton::CoulombHandler->initBreakup(elec);
123 
124  CoulombPBCAA caa(elec, true, false, false);
125 
126  // Self-energy correction, no background charge for e-e interaction
127  double consts = caa.evalConsts();
128  CHECK(consts == Approx(-3.142553));
129 
130  double val = caa.evaluate(elec);
131  CHECK(val == Approx(-1.418927)); // not validated
132 
133  LRCoulombSingleton::CoulombHandler.reset(nullptr);
134 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [322/537]

qmcplusplus::TEST_CASE ( "WalkerControl::determineNewWalkerPopulation"  ,
""  [drivers][walker_control] 
)

Definition at line 99 of file test_WalkerControl.cpp.

References CHECK(), and UnifiedDriverWalkerControlMPITest::testNewDistribution().

100 {
101  std::vector<int> minus;
102  std::vector<int> plus;
103 
104  testing::UnifiedDriverWalkerControlMPITest::testNewDistribution(minus, plus);
105  CHECK(minus.size() == 2);
106  CHECK(plus.size() == 2);
107 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [323/537]

qmcplusplus::TEST_CASE ( "readLine"  ,
""  [utilities] 
)

Definition at line 99 of file test_parser.cpp.

References readLine(), and REQUIRE().

100 {
101  ParseCaseVector_t tlist = {
102  // Input string, list of expected tokens, extra split characters
103  {"", {""}},
104  {"one", {"one"}},
105  {"one\ntwo", {"one", "two"}},
106  {"one;two", {"one", "two"}},
107  {"one\\\ntwo", {"onetwo"}},
108  {"one\\ two", {"one\\ two"}},
109  {"12345678901234567890extra", {"1234567890123456789"}}, // assuming bufLen=20 below
110  };
111 
112 
113  for (auto& tc : tlist)
114  {
115  SECTION(string("Parsing string: ") + tc.input)
116  {
117  const int bufLen = 20;
118  char buf[bufLen];
119  std::istringstream input(tc.input);
120  for (int i = 0; i < tc.output.size(); i++)
121  {
122  char* out = readLine(buf, bufLen, input);
123  REQUIRE(buf == tc.output[i]);
124  if (i == tc.output.size() - 1)
125  {
126  REQUIRE(out == NULL);
127  }
128  else
129  {
130  REQUIRE(out != NULL);
131  }
132  }
133  }
134  }
135 }
char * readLine(char *s, int max, std::istream &fp)
vector< ParseCase > ParseCaseVector_t
Definition: test_parser.cpp:47
REQUIRE(std::filesystem::exists(filename))
testing::ValidSpinDensityInput input

◆ TEST_CASE() [324/537]

qmcplusplus::TEST_CASE ( "NestedContainers"  ,
""  [OhmmsPETE] 
)

Definition at line 100 of file test_Vector.cpp.

References CHECK(), Vector< T, Alloc >::clear(), REQUIRE(), Vector< T, Alloc >::resize(), and Vector< T, Alloc >::size().

101 {
102  Vector<std::vector<int>> vec_of_vecs(2);
103  vec_of_vecs[0].push_back(123);
104  vec_of_vecs.resize(5);
105  vec_of_vecs[0].clear();
106  vec_of_vecs[0].push_back(123);
107  vec_of_vecs.resize(0);
108  vec_of_vecs.resize(3);
109  vec_of_vecs[0].push_back(123);
110  CHECK(vec_of_vecs[0].back() == 123);
111 
112  Vector<std::vector<int>> vec_copy(vec_of_vecs);
113  REQUIRE(vec_copy.size() == 3);
114  REQUIRE(vec_copy[0].size() == 1);
115  CHECK(vec_copy[0].back() == 123);
116 
117  Vector<std::vector<int>> vec_assign;
118  vec_assign = vec_of_vecs;
119  REQUIRE(vec_copy.size() == 3);
120  REQUIRE(vec_copy[0].size() == 1);
121  CHECK(vec_copy[0].back() == 123);
122 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [325/537]

qmcplusplus::TEST_CASE ( "VectorSoaContainer assignment"  ,
""  [OhmmsSoA] 
)

Definition at line 101 of file test_vector_soa.cpp.

References CHECK(), and VectorSoaContainer< T, D, Alloc >::copyIn().

102 {
103  Vector<TinyVector<double, 3>> R(4);
104  VectorSoaContainer<double, 3> RSoA(4);
105 
106  R[0] = TinyVector<double, 3>(0.00000000, 0.00000000, 0.00000000);
107  R[1] = TinyVector<double, 3>(1.68658058, 1.68658058, 1.68658058);
108  R[2] = TinyVector<double, 3>(3.37316115, 3.37316115, 0.00000000);
109  R[3] = TinyVector<double, 3>(5.05974172, 5.05974172, 1.68658058);
110  RSoA.copyIn(R);
111 
112  VectorSoaContainer<double, 3> rsoa_assign;
113  rsoa_assign = RSoA;
114  CHECK(rsoa_assign[3][0] == Approx(5.05974172));
115  CHECK(rsoa_assign[3][1] == Approx(5.05974172));
116  CHECK(rsoa_assign[3][2] == Approx(1.68658058));
117 
118  Vector<TinyVector<double, 3>> r_big(5);
119  VectorSoaContainer<double, 3> r_soa_big(5);
120 
121  r_big[0] = TinyVector<double, 3>(0.00000000, 0.00000000, 0.00000000);
122  r_big[1] = TinyVector<double, 3>(1.68658058, 1.68658058, 1.68658058);
123  r_big[2] = TinyVector<double, 3>(3.37316115, 3.37316115, 0.00000000);
124  r_big[3] = TinyVector<double, 3>(5.05974172, 5.05974172, 1.68658058);
125  r_big[4] = TinyVector<double, 3>(3.37316115, 3.37316115, 0.00000000);
126 
127  r_soa_big.copyIn(r_big);
128 
129  rsoa_assign = r_soa_big;
130  CHECK(rsoa_assign[4][0] == Approx(3.37316115));
131  CHECK(rsoa_assign[4][2] == Approx(0.00000000));
132 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [326/537]

qmcplusplus::TEST_CASE ( "test_communicate_split_four"  ,
""  [message] 
)

Definition at line 103 of file test_communciate.cpp.

References OHMMS::Controller, REQUIRE(), and Communicate::size().

104 {
106  // For simplicity, only test the case where the number of processes is divisible by 4.
107  if (c->size() % 4 == 0)
108  {
109  auto c2 = std::make_unique<Communicate>(*c, 4);
110 
111  REQUIRE(c2->size() == c->size() / 4);
112  int group_size = c->size() / 4;
113  int new_rank = c->rank() % group_size;
114  REQUIRE(c2->rank() == new_rank);
115 
116  if (new_rank == 0)
117  {
118  REQUIRE(c2->isGroupLeader() == true);
119  auto GroupLeaderComm = c2->getGroupLeaderComm();
120  REQUIRE(GroupLeaderComm != nullptr);
121  REQUIRE(GroupLeaderComm->size() == 4);
122  REQUIRE(GroupLeaderComm->rank() == c->rank() / group_size);
123  }
124  else
125  {
126  REQUIRE(c2->isGroupLeader() == false);
127  REQUIRE(c2->getGroupLeaderComm() == nullptr);
128  }
129  }
130 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
int size() const
return the number of tasks
Definition: Communicate.h:118
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [327/537]

qmcplusplus::TEST_CASE ( "fairDivide_one"  ,
""  [utilities] 
)

Definition at line 107 of file test_partition.cpp.

References fairDivide(), and REQUIRE().

108 {
109  auto out = fairDivide(1, 1);
110  REQUIRE(out.size() == 1);
111  REQUIRE(out[0] == 1);
112 }
REQUIRE(std::filesystem::exists(filename))
std::vector< IV > fairDivide(IV ntot, IV npart)
return the occupation vector for ntot entities partitioned npart ways.
Definition: FairDivide.h:77

◆ TEST_CASE() [328/537]

qmcplusplus::TEST_CASE ( "Derivatives of Spherical Harmonics"  ,
""  [numerics] 
)

Definition at line 107 of file test_ylm.cpp.

References CHECK(), derivYlmSpherical(), imag(), qmcplusplus::Units::distance::m, and qmcplusplus::Units::force::N.

108 {
109  struct Point
110  {
111  double x;
112  double y;
113  double z;
114  };
115 
116  struct YlmDerivValue
117  {
118  Point p;
119  int l;
120  int m;
121  double th_re;
122  double th_im;
123  double ph_re;
124  double ph_im;
125  };
126 
127  //reference values from sympy
128  //d/dtheta Ylm and d/dphi Ylm
129  const int N = 10;
130  YlmDerivValue Vals[N] = {
131  {{0.587785, 0, 0.809017}, 1, -1, 0.27951007, 0.0, 0.0, -0.2030763},
132  {{0.587785, 0, 0.809017}, 1, 0, -0.2871933, 0.0, 0.0, 0.0},
133  {{0.951057, 0, 0.309017}, 1, 1, -0.1067635, 0.0, 0.0, -0.3285845},
134  {{0.587785, 0, 0.809017}, 2, -2, 0.3673685, 0.0, 0.0, -0.2669088},
135  {{0.293893, 0.904508, 0.309017}, 2, -1, -0.1931373, 0.5944147, -0.2159338, -0.0701613},
136  {{0.587785, 0, -0.809017}, 2, 0, 0.8998655, 0.0, 0.0, 0.0},
137  {{0.293893, 0.904508, -0.309017}, 2, 1, 0.1931373, 0.5944146, -0.2159339, 0.0701613},
138  {{0.293893, 0.904508, 0.309017}, 2, 2, -0.1836842, 0.1334547, -0.4107311, -0.5653217},
139  {{-0.475528, -0.345492, -0.809017}, 3, -3, -0.1081114, -0.3327295, 0.2417422, -0.0785476},
140  {{-0.475528, -0.345492, 0.809017}, 4, 4, -0.2352762, 0.1709368, -0.1241928, -0.1709382},
141  };
142 
144  for (int i = 0; i < N; i++)
145  {
146  YlmDerivValue& v = Vals[i];
147  vec_t w;
148  w[0] = v.p.z; // first component appears to be aligned along the z-axis
149  w[1] = v.p.x;
150  w[2] = v.p.y;
151 
152  std::complex<double> theta, phi;
153  derivYlmSpherical(v.l, v.m, w, theta, phi, false);
154  //printf("%d %d expected %g %g %g %g actual %g %g %g %g\n",v.l,v.m,v.th_re,v.th_im, v.ph_re, v.ph_im, theta.real(), theta.imag(), phi.real(), phi.imag());
155  CHECK(std::real(theta) == Approx(v.th_re));
156  CHECK(std::imag(theta) == Approx(v.th_im));
157  CHECK(std::real(phi) == Approx(v.ph_re));
158  CHECK(std::imag(phi) == Approx(v.ph_im));
159  }
160 }
TinyVector< double, 3 > vec_t
QMCTraits::RealType real
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
void derivYlmSpherical(const int l, const int m, const TinyVector< T, 3 > &r, std::complex< T > &theta_deriv, std::complex< T > &phi_deriv, const bool conj)
calculate the derivative of a Ylm with respect to theta and phi param[in] l: angular momentum param[i...
Definition: Ylm.h:115
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [329/537]

qmcplusplus::TEST_CASE ( "MomentumDistribution::accumulate"  ,
""  [estimators] 
)

Definition at line 107 of file test_MomentumDistribution.cpp.

References ProjectData::BATCH, CHECK(), comm, OHMMS::Controller, convertUPtrToRefVector(), crowd, doc, qmcplusplus::Units::charge::e, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), lattice, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), qmcplusplus::testing::makeTestLattice(), node, okay, outputManager, Libxml2Document::parseFromString(), particle_pool, OutputManagerClass::pause(), pset, OutputManagerClass::resume(), test_project, walker, qmcplusplus::hdf::walkers, and wavefunction_pool.

108 {
110 
111  // clang-format: off
112  const char* xml = R"(
113 <estimator type="MomentumDistribution" name="nofk" samples="5" kmax="3"/>
114 )";
115  // clang-format: on
116 
117  // Read xml into input object
119  bool okay = doc.parseFromString(xml);
120  if (!okay)
121  throw std::runtime_error("cannot parse MomentumDistributionInput section");
122  xmlNodePtr node = doc.getRoot();
123  MomentumDistributionInput mdi(node);
124 
125  // Instantiate other dependencies (internal QMCPACK objects)
127  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
128  Communicate* comm;
131  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
132  auto wavefunction_pool =
133  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
134  auto& pset = *(particle_pool.getParticleSet("e"));
135  DataLocality dl = DataLocality::crowd;
136 
137  // Setup particleset
138  pset.R = ParticleSet::ParticlePos{{1.751870349, 4.381521229, 2.865202269}, {3.244515371, 4.382273176, 4.21105285},
139  {3.000459944, 3.329603408, 4.265030556}, {3.748660329, 3.63420622, 5.393637791},
140  {3.033228526, 3.391869137, 4.654413566}, {3.114198787, 2.654334594, 5.231075822},
141  {3.657151589, 4.883870516, 4.201243939}, {2.97317591, 4.245644974, 4.284564732}};
142 
143  // Build from input
144  MomentumDistribution md(std::move(mdi), pset.getTotalNum(), pset.getTwist(), pset.getLattice(), dl);
145 
146  // Test accumulate
147 
148  // Setup walker, particleset, wavefunction ref vectors
149  // Make clones
150  std::vector<MCPWalker> walkers;
151  int nwalkers = 4;
152  for (int iw = 0; iw < nwalkers; ++iw)
153  walkers.emplace_back(8);
154 
155  std::vector<ParticleSet> psets;
156  for (int iw = 0; iw < nwalkers; ++iw)
157  psets.emplace_back(pset);
158 
159  auto& trial_wavefunction = *(wavefunction_pool.getPrimary());
160  std::vector<UPtr<TrialWaveFunction>> wfns(nwalkers);
161  for (int iw = 0; iw < nwalkers; ++iw)
162  wfns[iw] = trial_wavefunction.makeClone(psets[iw]);
163 
164  // Initialize walker, pset, wfn
165  for (int iw = 0; iw < nwalkers; ++iw)
166  {
167  auto& walker = walkers[iw];
168  auto& pset = psets[iw];
169  pset.update(true);
170  pset.donePbyP();
171  wfns[iw]->evaluateLog(pset);
172  pset.saveWalker(walker);
173  }
174 
175  // Create ref vectors
176  std::vector<QMCHamiltonian> hams;
177 
178  auto ref_walkers = makeRefVector<MCPWalker>(walkers);
179  auto ref_psets = makeRefVector<ParticleSet>(psets);
180  auto ref_wfns = convertUPtrToRefVector(wfns);
181  auto ref_hams = makeRefVector<QMCHamiltonian>(hams);
182 
183  // Setup RNG
184  FakeRandom<OHMMS_PRECISION_FULL> rng;
185 
186  // Perform accumulate
187  md.accumulate(ref_walkers, ref_psets, ref_wfns, ref_hams, rng);
188 
189  // Check data
190  std::vector<RealType>& data = md.get_data();
191 
192  using Data = MomentumDistribution::Data;
193  Data ref_data;
194 
195  ref_data = {3.92261216, -5.752141485, 4.78276286, 8.307662762, -5.130834919, 0.08942598353, 0.9716326509,
196  21.82310933, -9.177741101, -0.2024849597, -2.520417488, -9.470020717, -9.4969045, 3.866360129,
197  -9.4969045, -9.470020717, -2.520417488, -0.2024849597, -9.177741101, 21.82310933, 0.9716326509,
198  0.08942598353, -5.130834919, 8.307662762, 4.78276286, -5.752141485, 3.92261216};
199 
200  //std::cout<<"\n\n\nn(k) data:\n{";
201  //for(int i=0;i<data.size();++i)
202  // std::cout<<data[i]<<", ";
203  //std::cout<<"}\n\n\n";
204 
205  for (size_t id = 0; id < ref_data.size(); ++id)
206  {
207 #ifdef MIXED_PRECISION
208  CHECK(data[id] == Approx(ref_data[id]).epsilon(2.e-05));
209 #else
210  // default Catch2 epsilon std::numeric_limits<float>::epsilon()*100
211  // set value for x86_64
212  CHECK(data[id] == Approx(ref_data[id]).epsilon(1.192092896e-05));
213 #endif
214  }
215 
217 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
void pause()
Pause the summary and log streams.
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
const char walkers[]
Definition: HDFVersion.h:36
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
static RefVector< T > convertUPtrToRefVector(const UPtrVector< T > &ptr_list)
convert a vector of std::unique_ptrs<T> to a refvector<T>
const RuntimeOptions & getRuntimeOptions() const noexcept
OutputManagerClass outputManager(Verbosity::HIGH)
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
void resume()
Resume the summary and log streams.
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker
Definition: test_walker.cpp:31
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
DataLocality
data locality with respect to walker buffer
Definition: DataLocality.h:19

◆ TEST_CASE() [330/537]

qmcplusplus::TEST_CASE ( "walker buffer  add,
update  ,
restore"  ,
""  [particle] 
)

Definition at line 107 of file test_walker.cpp.

References CHECK(), and qmcplusplus::hdf::walkers.

108 {
109  int num_particles = 4;
110 
111  UPtrVector<MCPWalker> walkers(2);
112  auto createWalker = [num_particles](UPtr<MCPWalker>& walker_ptr) {
113  walker_ptr = std::make_unique<MCPWalker>(num_particles);
114  walker_ptr->registerData();
115  walker_ptr->DataSet.allocate();
116  };
117  std::for_each(walkers.begin(), walkers.end(), createWalker);
118 
119  walkers[0]->Properties(WP::LOGPSI) = 1.2;
120  walkers[0]->Properties(WP::SIGN) = 1.3;
121  walkers[0]->Properties(WP::UMBRELLAWEIGHT) = 1.4;
122  walkers[0]->Properties(WP::LOCALPOTENTIAL) = 1.6;
123  walkers[0]->updateBuffer();
124 
125  std::memcpy(walkers[1]->DataSet.data(), walkers[0]->DataSet.data(), walkers[0]->DataSet.size());
126  walkers[1]->copyFromBuffer();
127  CHECK(walkers[1]->Properties(WP::LOGPSI) == Approx(1.2));
128  CHECK(walkers[1]->Properties(WP::LOCALPOTENTIAL) == Approx(1.6));
129 }
const char walkers[]
Definition: HDFVersion.h:36
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [331/537]

qmcplusplus::TEST_CASE ( "OutputManager pause"  ,
""  [utilities] 
)

Definition at line 108 of file test_output_manager.cpp.

References app_log(), app_out, app_summary(), init_string_output(), outputManager, OutputManagerClass::pause(), REQUIRE(), reset_string_output(), OutputManagerClass::resume(), and summary_out.

109 {
111 
113 
114  app_summary() << "test1";
115  app_log() << "test2";
116 
117  REQUIRE(summary_out.str() == "");
118  REQUIRE(app_out.str() == "");
119 
121 
123  app_summary() << "test3";
124  app_log() << "test4";
125 
126  REQUIRE(summary_out.str() == "test3");
127  REQUIRE(app_out.str() == "test4");
128 }
void pause()
Pause the summary and log streams.
static std::ostringstream app_out
std::ostream & app_log()
Definition: OutputManager.h:65
std::ostream & app_summary()
Definition: OutputManager.h:63
OutputManagerClass outputManager(Verbosity::HIGH)
void resume()
Resume the summary and log streams.
REQUIRE(std::filesystem::exists(filename))
static std::ostringstream summary_out

◆ TEST_CASE() [332/537]

qmcplusplus::TEST_CASE ( "test_timer_flat_profile_same_name"  ,
""  [utilities] 
)

Definition at line 109 of file test_timer.cpp.

References TimerManager< TIMER >::FlatProfileData::callList, CHECK(), TimerManager< TIMER >::collate_flat_profile(), convert_to_ns(), TimerManager< TIMER >::createTimer(), TimerManager< TIMER >::FlatProfileData::nameList, REQUIRE(), qmcplusplus::Units::time::s, TimerManager< TIMER >::set_timer_threshold(), TimerType< CLOCK >::start(), TimerType< CLOCK >::stop(), TimerManager< TIMER >::FlatProfileData::timeList, and timer_level_fine.

110 {
111  FakeTimerManager tm;
112  tm.set_timer_threshold(timer_level_fine);
113  FakeTimer* t1 = tm.createTimer("timer1");
114  FakeTimer* t2 = tm.createTimer("timer2");
115  FakeTimer* t3 = tm.createTimer("timer1");
116 
117  FakeChronoClock::fake_chrono_clock_increment = convert_to_ns(1.1s);
118  t1->start();
119  t1->stop();
120  FakeChronoClock::fake_chrono_clock_increment = convert_to_ns(1.2s);
121  for (int i = 0; i < 3; i++)
122  {
123  t2->start();
124  t2->stop();
125 
126  t3->start();
127  t3->stop();
128  }
129  t3->start();
130  t3->stop();
131 
132  FakeTimerManager::FlatProfileData p;
133 
134  tm.collate_flat_profile(NULL, p);
135 
136 #ifdef ENABLE_TIMERS
137  REQUIRE(p.nameList.size() == 2);
138  int idx1 = p.nameList.at("timer1");
139  int idx2 = p.nameList.at("timer2");
140  REQUIRE(p.timeList.size() == 2);
141  CHECK(p.timeList[idx1] == Approx(5.9));
142  CHECK(p.timeList[idx2] == Approx(3.6));
143 
144  REQUIRE(p.callList.size() == 2);
145  REQUIRE(p.callList[idx1] == 5);
146  REQUIRE(p.callList[idx2] == 3);
147 #endif
148 }
TimerType< FakeChronoClock > FakeTimer
Definition: NewTimer.h:235
FakeChronoClock::duration convert_to_ns(T in)
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
TimerManager< FakeTimer > FakeTimerManager
Definition: test_timer.cpp:23

◆ TEST_CASE() [333/537]

qmcplusplus::TEST_CASE ( "ModernStringUtils_strip"  ,
""  [utilities] 
)

Definition at line 109 of file test_ModernStringUtils.cpp.

References CHECK(), strip(), and qmcplusplus::modernstrutil::strip().

110 {
111  using modernstrutil::strip;
112 
113  std::string nothing;
114  auto stripped_nothing = strip(nothing);
115  CHECK(stripped_nothing.empty());
116 
117  std::string white_space{" "};
118  auto stripped_white_space = strip(white_space);
119  CHECK(stripped_white_space.empty());
120 
121  std::string test_lines{R"(
122  r1 1 0 0
123  r2 0 1 0
124  r3 0 0 1
125 )"};
126 
127  std::string_view stripped_lines = strip(test_lines);
128 
129  std::string_view ref_stripped{"r1 1 0 0\n r2 0 1 0\n r3 0 0 1"};
130  CHECK(ref_stripped == stripped_lines);
131 
132  std::string_view another{"r1 1 0 0\n r2 0 1 0\n r3 0 0 1\n \0"};
133  std::string_view another_stripped = strip(another);
134  CHECK(another_stripped == "r1 1 0 0\n r2 0 1 0\n r3 0 0 1");
135 
136  std::string_view unneeded{"this needs no stripping"};
137  std::string_view unneeded_stripped = strip(unneeded);
138  CHECK(unneeded_stripped == unneeded);
139 }
std::string_view strip(const string_view s)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [334/537]

qmcplusplus::TEST_CASE ( "accumulator with weights float"  ,
""  [estimators] 
)

Definition at line 110 of file test_accumulator.cpp.

110 { test_real_accumulator_weights<float>(); }

◆ TEST_CASE() [335/537]

qmcplusplus::TEST_CASE ( "TrialWaveFunction flex_evaluateParameterDerivatives"  ,
""  [wavefunction] 
)

Definition at line 111 of file test_TrialWaveFunction_He.cpp.

References CHECK(), TrialWaveFunction::checkInVariables(), OHMMS::Controller, TrialWaveFunction::createResource(), TrialWaveFunction::evaluateDerivatives(), TrialWaveFunction::mw_evaluateParameterDerivatives(), ParticleSet::R, setup_He_wavefunction(), and ParticleSet::update().

112 {
114 
116 
117  const SimulationCell simulation_cell;
118  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
119  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
120  auto &ions(*ions_ptr), elec(*elec_ptr);
121  ions.setName("ion0");
122  elec.setName("e");
123  WaveFunctionFactory::PSetMap particle_set_map;
124  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
125  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
126 
127  auto psi_ptr = setup_He_wavefunction(c, elec, ions, particle_set_map);
128  TrialWaveFunction& psi(*psi_ptr);
129 
130  ions.update();
131  elec.update();
132 
133  const int nparam = 1;
134  optimize::VariableSet var_param;
135  psi.checkInVariables(var_param);
136 
137  Vector<ValueType> dlogpsi(nparam);
138  Vector<ValueType> dhpsioverpsi(nparam);
139 
140  psi.evaluateDerivatives(elec, var_param, dlogpsi, dhpsioverpsi);
141 
142 
143  // testing batched interfaces
144  ResourceCollection pset_res("test_pset_res");
145  ResourceCollection twf_res("test_twf_res");
146 
147  elec.createResource(pset_res);
148  psi.createResource(twf_res);
149 
150  {
151  // Test list with one wavefunction
152  RefVectorWithLeader<TrialWaveFunction> wf_list(psi, {psi});
153  RefVectorWithLeader<ParticleSet> p_list(elec, {elec});
154 
155  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
156  ResourceCollectionTeamLock<TrialWaveFunction> mw_twf_lock(twf_res, wf_list);
157 
158 
159  const int nentry = 1;
160  RecordArray<ValueType> dlogpsi_list(nentry, nparam);
161  RecordArray<ValueType> dhpsi_over_psi_list(nentry, nparam);
162 
163  TrialWaveFunction::mw_evaluateParameterDerivatives(wf_list, p_list, var_param, dlogpsi_list, dhpsi_over_psi_list);
164 
165  CHECK(dlogpsi[0] == ValueApprox(dlogpsi_list[0][0]));
166  CHECK(dhpsioverpsi[0] == ValueApprox(dhpsi_over_psi_list[0][0]));
167  }
168 
169  { // Test list with two wavefunctions
170  const int nentry = 2;
171  RecordArray<ValueType> dlogpsi_list(nentry, nparam);
172  RecordArray<ValueType> dhpsi_over_psi_list(nentry, nparam);
173 
174  ParticleSet elec2(elec);
175  elec2.R[0][0] = 0.9;
176  elec2.update();
177 
178  RefVectorWithLeader<TrialWaveFunction> wf_list(psi, {psi, psi});
179  RefVectorWithLeader<ParticleSet> p_list(elec, {elec, elec2});
180  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
181  ResourceCollectionTeamLock<TrialWaveFunction> mw_twf_lock(twf_res, wf_list);
182 
183  TrialWaveFunction::mw_evaluateParameterDerivatives(wf_list, p_list, var_param, dlogpsi_list, dhpsi_over_psi_list);
184 
185  Vector<ValueType> dlogpsi2(nparam);
186  Vector<ValueType> dhpsioverpsi2(nparam);
187 
188  psi.evaluateDerivatives(elec2, var_param, dlogpsi2, dhpsioverpsi2);
189 
190  CHECK(dlogpsi[0] == ValueApprox(dlogpsi_list[0][0]));
191  CHECK(dhpsioverpsi[0] == ValueApprox(dhpsi_over_psi_list[0][0]));
192 
193  CHECK(dlogpsi2[0] == ValueApprox(dlogpsi_list[1][0]));
194  CHECK(dhpsioverpsi2[0] == ValueApprox(dhpsi_over_psi_list[1][0]));
195  }
196 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
std::unique_ptr< TrialWaveFunction > setup_He_wavefunction(Communicate *c, ParticleSet &elec, ParticleSet &ions, const WaveFunctionFactory::PSetMap &particle_set_map)
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [336/537]

qmcplusplus::TEST_CASE ( "InputSection::assignAnyEnum"  ,
""  [estimators] 
)

Definition at line 112 of file test_InputSection.cpp.

References InputSection::get(), VALUE1, and VALUE2.

113 {
114  enum class SomeEnum
115  {
116  VALUE1,
117  VALUE2
118  };
119 
120  TestAssignAnyEnum taae;
121  CHECK_THROWS_AS(taae.get<SomeEnum>("testenum"), UniformCommunicateError);
122 }

◆ TEST_CASE() [337/537]

qmcplusplus::TEST_CASE ( "cuBLAS_LU::computeLogDet_complex"  ,
""  [wavefunction][CUDA] 
)

Definition at line 112 of file test_cuBLAS_LU.cpp.

References batch_size, CHECK(), qmcplusplus::cuBLAS_LU::computeLogDet_batched(), cudaErrorCheck(), cudaMemcpyAsync, cudaMemcpyDeviceToHost, cudaMemcpyHostToDevice, cudaStreamSynchronize, dev_log_values(), dev_lu(), dev_lus(), dev_pivots(), hstream, lda, log_values(), lu, lus, n, and pivots.

113 {
114  auto cuda_handles = std::make_unique<testing::CUDAHandles>();
115  int n = 4;
116  int lda = 4;
117  int batch_size = 1;
118  auto& hstream = cuda_handles->hstream;
119 
120  using StdComp = std::complex<double>;
121  // clang-format off
122  std::vector<StdComp,
123  CUDAHostAllocator<StdComp>> lu = {{8.0, 0.5},
124  {0.8793774319066148, 0.07003891050583658},
125  {0.24980544747081712, -0.0031128404669260694},
126  {0.6233463035019455, -0.026459143968871595},
127  {2.0, 0.1},
128  {6.248249027237354, 0.2719844357976654},
129  {0.7194170575332381, -0.01831314754114669},
130  {0.1212375092639108, 0.02522449751055713},
131  {6.0, -0.2},
132  {0.7097276264591441, -0.4443579766536965},
133  {4.999337315778741, 0.6013141870887196},
134  {0.26158183940834034, 0.23245112532996867},
135  {4.0, -0.6},
136  {4.440466926070039, -1.7525291828793774},
137  {0.840192589866152, 1.5044529443071093},
138  {1.0698651110730424, -0.10853319738453365}};
139  // clang-format on
140  std::vector<StdComp, CUDAAllocator<StdComp>> dev_lu(lu.size());
141  std::vector<StdComp*, CUDAHostAllocator<StdComp*>> lus(batch_size);
142  lus[0] = dev_lu.data();
143  std::vector<StdComp*, CUDAAllocator<StdComp*>> dev_lus(batch_size);
144 
145  std::vector<StdComp, CUDAHostAllocator<StdComp>> log_values(batch_size);
146  std::vector<StdComp, CUDAAllocator<StdComp>> dev_log_values(batch_size);
147 
148  std::vector<int, CUDAHostAllocator<int>> pivots = {3, 4, 3, 4};
149  std::vector<int, CUDAAllocator<int>> dev_pivots(4);
150 
151  cudaErrorCheck(cudaMemcpyAsync(dev_lu.data(), lu.data(), sizeof(double) * 32, cudaMemcpyHostToDevice, hstream),
152  "cudaMemcpyAsync failed copying log_values to device");
153  cudaErrorCheck(cudaMemcpyAsync(dev_lus.data(), lus.data(), sizeof(double*), cudaMemcpyHostToDevice, hstream),
154  "cudaMemcpyAsync failed copying lus to device");
156  "cudaMemcpyAsync failed copying log_values to device");
157 
158  cuBLAS_LU::computeLogDet_batched(cuda_handles->hstream, n, lda, dev_lus.data(), dev_pivots.data(),
159  dev_log_values.data(), batch_size);
160 
163  "cudaMemcpyAsync failed copying log_values from device");
164  cudaErrorCheck(cudaStreamSynchronize(hstream), "cudaStreamSynchronize failed!");
165  CHECK(log_values[0] == ComplexApprox(StdComp{5.603777579195571, -6.1586603331188225}));
166 }
std::vector< StdComp, CUDAHostAllocator< StdComp > > dev_lu(lu.size())
#define cudaErrorCheck(ans, cause)
Definition: CUDAerror.h:21
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
std::vector< StdComp *, CUDAAllocator< StdComp * > > dev_lus(batch_size)
CHECK(log_values[1]==ComplexApprox(std::complex< double >{ 5.531331998282581, -8.805487075984523 }))
void computeLogDet_batched(cudaStream_t &hstream, const int n, const int lda, T **Ms, const int *pivots, std::complex< double > *logdets, const int batch_size)
std::vector< int, CUDAHostAllocator< int > > pivots(8, -1.0)
#define cudaMemcpyDeviceToHost
Definition: cuda2hip.h:138
#define cudaStreamSynchronize
Definition: cuda2hip.h:152
#define cudaMemcpyHostToDevice
Definition: cuda2hip.h:139
std::vector< StdComp, CUDAAllocator< StdComp > > dev_log_values(batch_size)
std::vector< StdComp, CUDAHostAllocator< StdComp > > lu
std::vector< int, CUDAAllocator< int > > dev_pivots(pivots.size())
std::vector< StdComp *, CUDAHostAllocator< StdComp * > > lus(batch_size)
std::complex< double > StdComp
#define cudaMemcpyAsync
Definition: cuda2hip.h:136

◆ TEST_CASE() [338/537]

qmcplusplus::TEST_CASE ( "fccz sr lr clone ,
""  [hamiltonian] 
)

Definition at line 112 of file test_force_ewald.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), clone, LRCoulombSingleton::CoulombDerivHandler, LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), ForceChiesaPBCAA::evaluateLR(), ForceChiesaPBCAA::evaluateSR(), ForceBase::getAddIonIon(), ForceBase::getForces(), ParticleSet::getSpeciesSet(), ForceChiesaPBCAA::InitMatrix(), lattice, ForceChiesaPBCAA::makeClone(), ParticleSet::R, REQUIRE(), ParticleSet::resetGroups(), ForceBase::setAddIonIon(), ForceBase::setForces(), ParticleSet::setName(), and ParticleSet::update().

113 {
114  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
115  lattice.BoxBConds = true; // periodic
116  lattice.R.diagonal(3.77945227);
117  lattice.LR_dim_cutoff = 40;
118  lattice.reset();
119 
120  const SimulationCell simulation_cell(lattice);
121  ParticleSet ions(simulation_cell);
122  ParticleSet elec(simulation_cell);
123 
124  ions.setName("ion");
125  ions.create({2});
126  ions.R[0] = {0.0, 0.0, 0.0};
127  ions.R[1] = {1.6, 1.6, 1.88972614};
128  SpeciesSet& ion_species = ions.getSpeciesSet();
129  int pIdx = ion_species.addSpecies("H");
130  int pChargeIdx = ion_species.addAttribute("charge");
131  ion_species(pChargeIdx, pIdx) = 1;
132  ions.createSK();
133 
134 
135  elec.setName("elec");
136  elec.create({2});
137  elec.R[0] = {0.5, 0.0, 0.0};
138  elec.R[1] = {0.0, 0.5, 0.0};
139  SpeciesSet& tspecies = elec.getSpeciesSet();
140  int upIdx = tspecies.addSpecies("u");
141  int chargeIdx = tspecies.addAttribute("charge");
142  int massIdx = tspecies.addAttribute("mass");
143  tspecies(chargeIdx, upIdx) = -1;
144  tspecies(massIdx, upIdx) = 1.0;
145  elec.createSK();
146 
147  // The call to resetGroups is needed transfer the SpeciesSet
148  // settings to the ParticleSet
149  ions.resetGroups();
150  elec.resetGroups();
151 
152  LRCoulombSingleton::CoulombHandler = std::make_unique<EwaldHandler3D>(ions);
153  LRCoulombSingleton::CoulombHandler->initBreakup(ions);
154  LRCoulombSingleton::CoulombDerivHandler = std::make_unique<EwaldHandler3D>(ions);
155  LRCoulombSingleton::CoulombDerivHandler->initBreakup(ions);
156 
157  ForceChiesaPBCAA force(ions, elec);
158  force.setAddIonIon(false);
159  force.InitMatrix();
160 
161  elec.update();
162  // test SR part
163  force.evaluateSR(elec);
164  CHECK(force.getForces()[0][0] == Approx(1.6938118975));
165  CHECK(force.getForces()[0][1] == Approx(1.6938118975));
166  CHECK(force.getForces()[0][2] == Approx(0.000000000));
167  CHECK(force.getForces()[1][0] == Approx(0.000000000));
168  CHECK(force.getForces()[1][1] == Approx(0.000000000));
169  CHECK(force.getForces()[1][2] == Approx(0.000000000));
170  // test LR part
171  force.setForces(0);
172  force.evaluateLR(elec);
173  CHECK(force.getForces()[0][0] == Approx(2.2653670795));
174  CHECK(force.getForces()[0][1] == Approx(2.2653670795));
175  CHECK(force.getForces()[0][2] == Approx(0.000000000));
176  CHECK(force.getForces()[1][0] == Approx(-0.078308730));
177  CHECK(force.getForces()[1][1] == Approx(-0.078308730));
178  CHECK(force.getForces()[1][2] == Approx(0.000000000));
179 
180  // test cloning !!!! makeClone is not testable
181  // example call path:
182  // QMCDrivers/CloneManager::makeClones
183  // QMCHamiltonian::makeClone
184  // OperatorBase::add2Hamiltonian -> ForceChiesaPBCAA::makeClone
185  RuntimeOptions runtime_options;
186  TrialWaveFunction psi(runtime_options);
187  std::unique_ptr<ForceChiesaPBCAA> clone(dynamic_cast<ForceChiesaPBCAA*>(force.makeClone(elec, psi).release()));
188  clone->evaluate(elec);
189  REQUIRE(clone->getAddIonIon() == force.getAddIonIon());
190  CHECK(clone->getForcesIonIon()[0][0] == Approx(-0.0228366));
191  CHECK(clone->getForcesIonIon()[0][1] == Approx(-0.0228366));
192  CHECK(clone->getForcesIonIon()[0][2] == Approx(0.0000000));
193  CHECK(clone->getForcesIonIon()[1][0] == Approx(0.0228366));
194  CHECK(clone->getForcesIonIon()[1][1] == Approx(0.0228366));
195  CHECK(clone->getForcesIonIon()[1][2] == Approx(0.0000000));
196 
197  LRCoulombSingleton::CoulombHandler.reset(nullptr);
198  LRCoulombSingleton::CoulombDerivHandler.reset(nullptr);
199 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [339/537]

qmcplusplus::TEST_CASE ( "accumulator with weights double"  ,
""  [estimators] 
)

Definition at line 112 of file test_accumulator.cpp.

112 { test_real_accumulator_weights<double>(); }

◆ TEST_CASE() [340/537]

qmcplusplus::TEST_CASE ( "DiracMatrixComputeOMPTarget_large_determinants_against_legacy"  ,
""  [wavefunction][fermion] 
)

Definition at line 113 of file test_DiracMatrixComputeOMPTarget.cpp.

References check_matrix_result, CHECKED_ELSE(), checkMatrix(), DiracMatrix< T_FP >::invert_transpose(), log_values(), qmcplusplus::testing::makeRngSpdMatrix(), DiracMatrixComputeOMPTarget< VALUE_FP >::mw_invertTranspose(), n, queue, and Matrix< T, Alloc >::resize().

114 {
115  int n = 64;
116 
117  DiracMatrixComputeOMPTarget<double> dmc_omp;
118 
119  Matrix<double> mat_spd;
120  mat_spd.resize(n, n);
121  testing::MakeRngSpdMatrix<double> makeRngSpdMatrix;
122  makeRngSpdMatrix(mat_spd);
123  // You would hope you could do this
124  // OffloadPinnedMatrix<double> mat_a(mat_spd);
125  // But you can't
126  OffloadPinnedMatrix<double> mat_a(n, n);
127  for (int i = 0; i < n; ++i)
128  for (int j = 0; j < n; ++j)
129  mat_a(i, j) = mat_spd(i, j);
130 
131  Matrix<double> mat_spd2;
132  mat_spd2.resize(n, n);
133  makeRngSpdMatrix(mat_spd2);
134  // You would hope you could do this
135  // OffloadPinnedMatrix<double> mat_a(mat_spd);
136  // But you can't
137  OffloadPinnedMatrix<double> mat_a2(n, n);
138  for (int i = 0; i < n; ++i)
139  for (int j = 0; j < n; ++j)
140  mat_a2(i, j) = mat_spd2(i, j);
141 
142  OffloadPinnedVector<std::complex<double>> log_values;
143  log_values.resize(2);
144  OffloadPinnedMatrix<double> inv_mat_a;
145  inv_mat_a.resize(n, n);
146  OffloadPinnedMatrix<double> inv_mat_a2;
147  inv_mat_a2.resize(n, n);
148 
149  RefVector<const OffloadPinnedMatrix<double>> a_mats{mat_a, mat_a2};
150  RefVector<OffloadPinnedMatrix<double>> inv_a_mats{inv_mat_a, inv_mat_a2};
151 
152  compute::Queue<PlatformKind::OMPTARGET> queue;
153  dmc_omp.mw_invertTranspose(queue, a_mats, inv_a_mats, log_values);
154 
155  DiracMatrix<double> dmat;
156  Matrix<double> inv_mat_test(n, n);
157  std::complex<double> det_log_value;
158  dmat.invert_transpose(mat_spd, inv_mat_test, det_log_value);
159 
160  auto check_matrix_result = checkMatrix(inv_mat_a, inv_mat_test);
161  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
162 
163  dmat.invert_transpose(mat_spd2, inv_mat_test, det_log_value);
164  check_matrix_result = checkMatrix(inv_mat_a2, inv_mat_test);
165  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
166 }
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
void makeRngSpdMatrix(testing::RandomForTest< RngValueType< T >> &rng, Matrix< T > &mat_spd)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63

◆ TEST_CASE() [341/537]

qmcplusplus::TEST_CASE ( "SPO input spline from xml He_sto3g"  ,
""  [wavefunction] 
)

Definition at line 113 of file test_spo_collection_input_LCAO_xml.cpp.

References app_log(), and test_He_sto3g_xml_input().

114 {
115  // capture 3 spo input styles, the 2nd and 3rd ones will be deprecated and removed eventually.
116  // the first case should be simplified using SPOSetBuilderFactory instead of WaveFunctionFactory
117  app_log() << "-------------------------------------------------------------" << std::endl;
118  app_log() << "He_sto3g input style 1 using sposet_collection" << std::endl;
119  app_log() << "-------------------------------------------------------------" << std::endl;
120  const char* spo_xml_string1 = R"(<wavefunction name="psi0" target="e">
121  <sposet_collection type="MolecularOrbital" name="LCAOBSet" source="ion0" transform="yes" cuspCorrection="no">
122  <basisset name="LCAOBSet">
123  <atomicBasisSet name="Gaussian" angular="cartesian" type="Gaussian" elementType="He" normalized="no">
124  <grid type="log" ri="1.e-6" rf="1.e2" npts="1001"/>
125  <basisGroup rid="He00" n="0" l="0" type="Gaussian">
126  <radfunc exponent="6.362421400000e+00" contraction="1.543289672950e-01"/>
127  <radfunc exponent="1.158923000000e+00" contraction="5.353281422820e-01"/>
128  <radfunc exponent="3.136498000000e-01" contraction="4.446345421850e-01"/>
129  </basisGroup>
130  </atomicBasisSet>
131  </basisset>
132  <sposet name="spo" size="1">
133  <occupation mode="ground"/>
134  <coefficient size="1" id="updetC">
135  1.00000000000000e+00
136  </coefficient>
137  </sposet>
138  </sposet_collection>
139  <determinantset>
140  <slaterdeterminant>
141  <determinant name="det_up" sposet="spo"/>
142  <determinant name="det_dn" sposet="spo"/>
143  </slaterdeterminant>
144  </determinantset>
145 </wavefunction>
146 )";
147  test_He_sto3g_xml_input(spo_xml_string1);
148 
149  app_log() << "-------------------------------------------------------------" << std::endl;
150  app_log() << "He_sto3g input style 1 using sposet_collection updated" << std::endl;
151  app_log() << "-------------------------------------------------------------" << std::endl;
152  const char* spo_xml_string1_updated = R"(<wavefunction name="psi0" target="e">
153  <sposet_collection type="MolecularOrbital" name="LCAOBSet" source="ion0" cuspCorrection="no">
154  <basisset name="LCAOBSet" transform="yes">
155  <atomicBasisSet name="Gaussian" angular="cartesian" type="Gaussian" elementType="He" normalized="no">
156  <grid type="log" ri="1.e-6" rf="1.e2" npts="1001"/>
157  <basisGroup rid="He00" n="0" l="0" type="Gaussian">
158  <radfunc exponent="6.362421400000e+00" contraction="1.543289672950e-01"/>
159  <radfunc exponent="1.158923000000e+00" contraction="5.353281422820e-01"/>
160  <radfunc exponent="3.136498000000e-01" contraction="4.446345421850e-01"/>
161  </basisGroup>
162  </atomicBasisSet>
163  </basisset>
164  <sposet name="spo" basisset="LCAOBSet" size="1">
165  <occupation mode="ground"/>
166  <coefficient size="1" id="updetC">
167  1.00000000000000e+00
168  </coefficient>
169  </sposet>
170  </sposet_collection>
171  <determinantset>
172  <slaterdeterminant>
173  <determinant name="det_up" sposet="spo"/>
174  <determinant name="det_dn" sposet="spo"/>
175  </slaterdeterminant>
176  </determinantset>
177 </wavefunction>
178 )";
179  test_He_sto3g_xml_input(spo_xml_string1_updated);
180 
181  app_log() << "-------------------------------------------------------------" << std::endl;
182  app_log() << "He_sto3g input style 2 sposet inside determinantset" << std::endl;
183  app_log() << "-------------------------------------------------------------" << std::endl;
184  const char* spo_xml_string2 = R"(<wavefunction name="psi0" target="e">
185  <determinantset type="MolecularOrbital" name="LCAOBSet" source="ion0" transform="yes" cuspCorrection="no">
186  <basisset name="LCAOBSet">
187  <grid type="log" ri="1.e-6" rf="1.e2" npts="1001"/>
188  <atomicBasisSet name="Gaussian" angular="cartesian" type="Gaussian" elementType="He" normalized="no">
189  <basisGroup rid="He00" n="0" l="0" type="Gaussian">
190  <radfunc exponent="6.362421400000e+00" contraction="1.543289672950e-01"/>
191  <radfunc exponent="1.158923000000e+00" contraction="5.353281422820e-01"/>
192  <radfunc exponent="3.136498000000e-01" contraction="4.446345421850e-01"/>
193  </basisGroup>
194  </atomicBasisSet>
195  </basisset>
196  <sposet name="spo" size="1">
197  <occupation mode="ground"/>
198  <coefficient size="1" id="updetC">
199  1.00000000000000e+00
200  </coefficient>
201  </sposet>
202  <sposet name="spo-down" size="1">
203  <occupation mode="ground"/>
204  <coefficient size="1" id="downdetC">
205  1.00000000000000e+00
206  </coefficient>
207  </sposet>
208  <slaterdeterminant>
209  <determinant name="det_up" sposet="spo"/>
210  <determinant name="det_dn" sposet="spo-down"/>
211  </slaterdeterminant>
212  </determinantset>
213 </wavefunction>
214 )";
215  test_He_sto3g_xml_input(spo_xml_string2);
216 
217  app_log() << "-------------------------------------------------------------" << std::endl;
218  app_log() << "He_sto3g input style 3 sposet inside determinantset" << std::endl;
219  app_log() << "-------------------------------------------------------------" << std::endl;
220  const char* spo_xml_string3 = R"(<wavefunction name="psi0" target="e">
221  <determinantset type="MolecularOrbital" name="LCAOBSet" source="ion0" transform="yes" cuspCorrection="no">
222  <basisset name="LCAOBSet">
223  <atomicBasisSet name="Gaussian" angular="cartesian" type="Gaussian" elementType="He" normalized="no">
224  <grid type="log" ri="1.e-6" rf="1.e2" npts="1001"/>
225  <basisGroup rid="He00" n="0" l="0" type="Gaussian">
226  <radfunc exponent="6.362421400000e+00" contraction="1.543289672950e-01"/>
227  <radfunc exponent="1.158923000000e+00" contraction="5.353281422820e-01"/>
228  <radfunc exponent="3.136498000000e-01" contraction="4.446345421850e-01"/>
229  </basisGroup>
230  </atomicBasisSet>
231  </basisset>
232  <slaterdeterminant>
233  <determinant name="spo" size="1">
234  <occupation mode="ground"/>
235  <coefficient size="1" id="updetC">
236  1.00000000000000e+00
237  </coefficient>
238  </determinant>
239  <determinant name="spo-down" size="1">
240  <occupation mode="ground"/>
241  <coefficient size="1" id="downdetC">
242  1.00000000000000e+00
243  </coefficient>
244  </determinant>
245  </slaterdeterminant>
246  </determinantset>
247 </wavefunction>
248 )";
249  test_He_sto3g_xml_input(spo_xml_string3);
250 }
std::ostream & app_log()
Definition: OutputManager.h:65
void test_He_sto3g_xml_input(const std::string &spo_xml_string)

◆ TEST_CASE() [342/537]

qmcplusplus::TEST_CASE ( "fairDivide_empties"  ,
""  [utilities] 
)

Definition at line 114 of file test_partition.cpp.

References fairDivide(), and REQUIRE().

115 {
116  auto out = fairDivide(2, 3);
117  REQUIRE(out.size() == 3);
118  REQUIRE(out[0] == 1);
119  REQUIRE(out[1] == 1);
120  REQUIRE(out[2] == 0);
121 }
REQUIRE(std::filesystem::exists(filename))
std::vector< IV > fairDivide(IV ntot, IV npart)
return the occupation vector for ntot entities partitioned npart ways.
Definition: FairDivide.h:77

◆ TEST_CASE() [343/537]

qmcplusplus::TEST_CASE ( "OhmmsMatrix_VectorSoaContainer_View"  ,
""  [Integration][Allocators] 
)

Definition at line 114 of file test_dual_allocators_ohmms_containers.cpp.

115 {
116  testDualAllocator<OffloadPinnedAllocator<double>>();
117  testDualAllocator<OffloadPinnedAllocator<std::complex<double>>>();
118 #if defined(ENABLE_CUDA) || defined(ENABLE_SYCL)
119  testDualAllocator<VendorDualPinnedAllocator<double>>();
120  testDualAllocator<VendorDualPinnedAllocator<std::complex<double>>>();
121 #endif
122 }

◆ TEST_CASE() [344/537]

qmcplusplus::TEST_CASE ( "SPO input spline from HDF diamond_2x1x1"  ,
""  [wavefunction] 
)

Definition at line 115 of file test_spo_collection_input_spline.cpp.

References app_log(), and test_diamond_2x1x1_xml_input().

116 {
117  // capture 3 spo input styles, the 2nd and 3rd ones will be deprecated and removed eventually.
118  // the first case should be simplified using SPOSetBuilderFactory instead of WaveFunctionFactory
119  app_log() << "-------------------------------------------------------------" << std::endl;
120  app_log() << "diamondC_2x1x1 input style 1 using sposet_collection" << std::endl;
121  app_log() << "-------------------------------------------------------------" << std::endl;
122  const char* spo_xml_string1 = R"(<wavefunction name="psi0" target="elec">
123 <sposet_collection name="einspline_diamond_size4" type="einspline" href="diamondC_2x1x1.pwscf.h5" tilematrix="2 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.0" precision="float">
124  <sposet name="spo" size="4" spindataset="0"/>
125 </sposet_collection>
126 </wavefunction>
127 )";
128  test_diamond_2x1x1_xml_input(spo_xml_string1);
129 
130  app_log() << "-------------------------------------------------------------" << std::endl;
131  app_log() << "diamondC_2x1x1 input style 2 sposet inside determinantset" << std::endl;
132  app_log() << "-------------------------------------------------------------" << std::endl;
133  const char* spo_xml_string2 = R"(<wavefunction name="psi0" target="elec">
134 <determinantset type="einspline" href="diamondC_2x1x1.pwscf.h5" tilematrix="2 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.0" precision="float">
135  <sposet name="spo" size="4" spindataset="0"/>
136  <slaterdeterminant>
137  <determinant name="det" sposet="spo"/>
138  </slaterdeterminant>
139 </determinantset>
140 </wavefunction>
141 )";
142  test_diamond_2x1x1_xml_input(spo_xml_string2);
143 
144  app_log() << "-------------------------------------------------------------" << std::endl;
145  app_log() << "diamondC_2x1x1 input style 3 sposet inside determinantset" << std::endl;
146  app_log() << "-------------------------------------------------------------" << std::endl;
147  const char* spo_xml_string3 = R"(<wavefunction name="psi0" target="elec">
148 <determinantset type="einspline" href="diamondC_2x1x1.pwscf.h5" tilematrix="2 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.0" precision="float">
149  <slaterdeterminant>
150  <determinant name="spo" size="4" spindataset="0"/>
151  </slaterdeterminant>
152 </determinantset>
153 </wavefunction>
154 )";
155  test_diamond_2x1x1_xml_input(spo_xml_string3);
156 }
std::ostream & app_log()
Definition: OutputManager.h:65
void test_diamond_2x1x1_xml_input(const std::string &spo_xml_string)

◆ TEST_CASE() [345/537]

qmcplusplus::TEST_CASE ( "one_dim_cubic_spline_1"  ,
""  [numerics] 
)

Definition at line 115 of file test_one_dim_cubic_spline.cpp.

References CHECK(), n, OneDimCubicSpline< Td, Tg, CTd, CTg >::spline(), and OneDimCubicSpline< Td, Tg, CTd, CTg >::splint().

116 {
117  const int n = 3;
118  std::vector<double> yvals = {1.0, 2.0, 1.5};
119 
120  auto grid = std::make_unique<LinearGrid<double>>();
121  grid->set(0.0, 2.0, n);
122 
123  OneDimCubicSpline<double> cubic_spline(std::move(grid), yvals);
124 
125  int imin = 0;
126  int imax = 3 - 1;
127 
128  double yp0 = 1.0;
129  double ypn = 2.0;
130 
131  cubic_spline.spline(imin, yp0, imax, ypn);
132 
133  std::vector<double> check_xvals = {0.0, 0.39999999998, 0.79999999996, 1.19999999994, 1.59999999992, 1.9999999999};
134  std::vector<double> check_yvals;
135  std::vector<D2U> check_yvals_d2u;
136 
137  for (int i = 0; i < check_xvals.size(); i++)
138  {
139  double r = check_xvals[i];
140  double val = cubic_spline.splint(r);
141  check_yvals.push_back(val);
142 
143  double du, d2u;
144  double val2 = cubic_spline.splint(r, du, d2u);
145  check_yvals_d2u.push_back(D2U(val2, du, d2u));
146 
147  //std::cout << i << " r = " << r << " val = " << val << " " << check_yvals[i] << std::endl;
148  }
149 
150  CHECK(check_yvals[0] == Approx(1));
151  CHECK(check_yvals[1] == Approx(1.532));
152  CHECK(check_yvals[2] == Approx(1.976));
153  CHECK(check_yvals[3] == Approx(1.836));
154  CHECK(check_yvals[4] == Approx(1.352));
155  CHECK(check_yvals[5] == Approx(1.5));
156 
157  CHECK(check_yvals_d2u[0].val == Approx(1));
158  CHECK(check_yvals_d2u[0].du == Approx(1));
159  CHECK(check_yvals_d2u[0].d2u == Approx(2.75));
160  CHECK(check_yvals_d2u[1].val == Approx(1.532));
161  CHECK(check_yvals_d2u[1].du == Approx(1.44));
162  CHECK(check_yvals_d2u[1].d2u == Approx(-0.55));
163  CHECK(check_yvals_d2u[2].val == Approx(1.976));
164  CHECK(check_yvals_d2u[2].du == Approx(0.56));
165  CHECK(check_yvals_d2u[2].d2u == Approx(-3.85));
166  CHECK(check_yvals_d2u[3].val == Approx(1.836));
167  CHECK(check_yvals_d2u[3].du == Approx(-1.16));
168  CHECK(check_yvals_d2u[3].d2u == Approx(-2.35));
169  CHECK(check_yvals_d2u[4].val == Approx(1.352));
170  CHECK(check_yvals_d2u[4].du == Approx(-0.84));
171  CHECK(check_yvals_d2u[4].d2u == Approx(3.95));
172  CHECK(check_yvals_d2u[5].val == Approx(1.5));
173  CHECK(check_yvals_d2u[5].du == Approx(2));
174  CHECK(check_yvals_d2u[5].d2u == Approx(10.25));
175 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [346/537]

qmcplusplus::TEST_CASE ( "J1 evaluate derivatives Jastrow with two species"  ,
""  [wavefunction] 
)

Definition at line 115 of file test_J1OrbitalSoA.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ParticleSet::addTable(), app_log(), WaveFunctionFactory::buildTWF(), CHECK(), OHMMS::Controller, ParticleSet::create(), doc, ParticleSet::get(), ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), ispecies, okay, Libxml2Document::parseFromString(), ParticleSet::R, VariableSet::removeInactive(), REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), VariableSet::size_of_active(), twf, and ParticleSet::update().

116 {
118  ParticleSetPool ptcl = ParticleSetPool(c);
119  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
120  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
121  ParticleSet& ions_(*ions_uptr);
122  ParticleSet& elec_(*elec_uptr);
123 
124  ions_.setName("ion0");
125  ptcl.addParticleSet(std::move(ions_uptr));
126  ions_.create({1, 1});
127  ions_.R[0] = {0.0, 0.0, 1.0};
128  ions_.R[1] = {0.0, 0.0, 0.0};
129  SpeciesSet& ispecies = ions_.getSpeciesSet();
130  int OIdx = ispecies.addSpecies("O");
131  int HIdx = ispecies.addSpecies("H");
132  int imassIdx = ispecies.addAttribute("mass");
133  int ichargeIdx = ispecies.addAttribute("charge");
134  ispecies(ichargeIdx, HIdx) = 1.0;
135  ispecies(ichargeIdx, OIdx) = 8.0;
136  ispecies(imassIdx, HIdx) = 1.0;
137  ispecies(imassIdx, OIdx) = 16.0;
138 
139  elec_.setName("e");
140  ptcl.addParticleSet(std::move(elec_uptr));
141  elec_.create({1, 1});
142  elec_.R[0] = {0.5, 0.5, 0.5};
143  elec_.R[1] = {-0.5, -0.5, -0.5};
144 
145  SpeciesSet& tspecies = elec_.getSpeciesSet();
146  int upIdx = tspecies.addSpecies("u");
147  int downIdx = tspecies.addSpecies("d");
148  int massIdx = tspecies.addAttribute("mass");
149  int chargeIdx = tspecies.addAttribute("charge");
150  tspecies(massIdx, upIdx) = 1.0;
151  tspecies(massIdx, downIdx) = 1.0;
152  tspecies(chargeIdx, upIdx) = -1.0;
153  tspecies(massIdx, downIdx) = -1.0;
154  // Necessary to set mass
155  elec_.resetGroups();
156 
157  ions_.update();
158  elec_.addTable(elec_);
159  elec_.addTable(ions_);
160  elec_.update();
161 
162  ions_.get(app_log());
163  elec_.get(app_log());
164 
165  const char* jasxml = R"(<wavefunction name="psi0" target="e">
166  <jastrow name="J1" type="One-Body" function="Bspline" print="yes" source="ion0">
167  <correlation elementType="H" cusp="0.0" size="2" rcut="5.0">
168  <coefficients id="J1H" type="Array"> 0.5 0.1 </coefficients>
169  </correlation>
170  <correlation elementType="O" cusp="0.0" size="2" rcut="5.0">
171  <coefficients id="J1O" type="Array"> 0.2 0.1 </coefficients>
172  </correlation>
173  </jastrow>
174 </wavefunction>
175 )";
177  bool okay = doc.parseFromString(jasxml);
178  REQUIRE(okay);
179 
180  xmlNodePtr jas1 = doc.getRoot();
181 
182  // update all distance tables
183  elec_.update();
184  RuntimeOptions runtime_options;
185  WaveFunctionFactory wf_factory(elec_, ptcl.getPool(), c);
186  auto twf_ptr = wf_factory.buildTWF(jas1, runtime_options);
187  auto& twf(*twf_ptr);
188  twf.setMassTerm(elec_);
189  twf.evaluateLog(elec_);
190  twf.prepareGroup(elec_, 0);
191 
192  auto& twf_component_list = twf.getOrbitals();
193 
194  opt_variables_type active;
195  twf.checkInVariables(active);
196  active.removeInactive();
197  int nparam = active.size_of_active();
198  REQUIRE(nparam == 4);
199 
201  Vector<ValueType> dlogpsi(nparam);
202  Vector<ValueType> dhpsioverpsi(nparam);
203  //twf.evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
204  twf_component_list[0]->evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
205 
206  // Numbers not validated independently
207  std::vector<ValueType> expected_dlogpsi = {-0.6360001724, -1.1764442146, -0.9336294487, -1.0196051794};
208  std::vector<ValueType> expected_dhpsioverpsi = {-0.6225838942, 0.0099980417, -1.1853702074, 0.7798000176};
209  for (int i = 0; i < nparam; i++)
210  {
211  CHECK(dlogpsi[i] == ValueApprox(expected_dlogpsi[i]));
212  CHECK(dhpsioverpsi[i] == ValueApprox(expected_dhpsioverpsi[i]));
213  }
214 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [347/537]

qmcplusplus::TEST_CASE ( "EstimatorManagerNew::collectScalarEstimators"  ,
""  [estimators] 
)

Definition at line 116 of file test_EstimatorManagerNew.cpp.

References CHECK(), OHMMS::Controller, EstimatorManagerNewTest::em, embt, EstimatorManagerNewTest::fakeScalarSamplesAndCollect(), EstimatorManagerNew::get_AverageCache(), and ham.

117 {
119 
120  QMCHamiltonian ham;
121  testing::EstimatorManagerNewTest embt(ham, c, 1);
122  // by design we have done no averaging here
123  // the division by total weight happens only when a block is over and the
124  // accumulated data has been reduced down. So here there should just be simple sums.
125 
127  double correct_value = 11.0;
128  CHECK(embt.em.get_AverageCache()[0] == Approx(correct_value));
129  correct_value = 20.0;
130  CHECK(embt.em.get_AverageCache()[1] == Approx(correct_value));
131  correct_value = 29.0;
132  CHECK(embt.em.get_AverageCache()[2] == Approx(correct_value));
133  correct_value = 38.0;
134  CHECK(embt.em.get_AverageCache()[3] == Approx(correct_value));
135 }
CHECK(emnta2.getMainEstimator().getName()=="RMCLocalEnergyEstimator")
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
testing::EstimatorManagerNewTest embt(ham, c, 1)
void fakeScalarSamplesAndCollect()
Quickly add scalar samples using FakeEstimator mock estimator.

◆ TEST_CASE() [348/537]

qmcplusplus::TEST_CASE ( "Pade2 Jastrow"  ,
""  [wavefunction] 
)

Definition at line 117 of file test_pade_jastrow.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), OHMMS::Controller, ParticleSet::create(), doc, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), ispecies, okay, Libxml2Document::parseFromString(), ParticleSet::R, VariableSet::removeInactive(), REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), VariableSet::size_of_active(), twf, and ParticleSet::update().

118 {
120 
121  ParticleSetPool ptcl = ParticleSetPool(c);
122  auto& simulation_cell(ptcl.getSimulationCell());
123  auto ions_uptr = std::make_unique<ParticleSet>(simulation_cell);
124  auto elec_uptr = std::make_unique<ParticleSet>(simulation_cell);
125  ParticleSet& ions_(*ions_uptr);
126  ParticleSet& elec_(*elec_uptr);
127 
128  ions_.setName("ion0");
129  ptcl.addParticleSet(std::move(ions_uptr));
130  ions_.create({1});
131  ions_.R[0] = {0.0, 0.0, 0.0};
132  SpeciesSet& ispecies = ions_.getSpeciesSet();
133  int HIdx = ispecies.addSpecies("H");
134  int ichargeIdx = ispecies.addAttribute("charge");
135  ispecies(ichargeIdx, HIdx) = 1.0;
136 
137  elec_.setName("e");
138  ptcl.addParticleSet(std::move(elec_uptr));
139  elec_.create({1, 1});
140  elec_.R[0] = {0.5, 0.5, 0.5};
141  elec_.R[1] = {-0.5, -0.5, -0.5};
142 
143  SpeciesSet& tspecies = elec_.getSpeciesSet();
144  int upIdx = tspecies.addSpecies("u");
145  int downIdx = tspecies.addSpecies("d");
146  int massIdx = tspecies.addAttribute("mass");
147  int chargeIdx = tspecies.addAttribute("charge");
148  tspecies(massIdx, upIdx) = 1.0;
149  tspecies(massIdx, downIdx) = 1.0;
150  tspecies(chargeIdx, upIdx) = -1.0;
151  tspecies(massIdx, downIdx) = -1.0;
152  // Necessary to set mass
153  elec_.resetGroups();
154 
155  ions_.update();
156  elec_.addTable(elec_);
157  elec_.addTable(ions_);
158  elec_.update();
159 
160  const char* jasxml = R"(<wavefunction name="psi0" target="e">
161  <jastrow name="J1" type="One-Body" function="pade2" print="yes" source="ion0">
162  <correlation elementType="H">
163  <var id="J1H_A" name="A">0.8</var>
164  <var id="J1H_B" name="B">5.0</var>
165  <var id="J1H_C" name="C">-0.1</var>
166  </correlation>
167  </jastrow>
168 </wavefunction>
169 )";
171  bool okay = doc.parseFromString(jasxml);
172  REQUIRE(okay);
173 
174  xmlNodePtr jas1 = doc.getRoot();
175 
176  // update all distance tables
177  elec_.update();
178  WaveFunctionFactory wf_factory(elec_, ptcl.getPool(), c);
179  RuntimeOptions runtime_options;
180  auto twf_ptr = wf_factory.buildTWF(jas1, runtime_options);
181  auto& twf(*twf_ptr);
182  twf.setMassTerm(elec_);
183  twf.evaluateLog(elec_);
184  twf.prepareGroup(elec_, 0);
185 
186  auto& twf_component_list = twf.getOrbitals();
187 
188  opt_variables_type active;
189  twf.checkInVariables(active);
190  active.removeInactive();
191  int nparam = active.size_of_active();
192  REQUIRE(nparam == 3);
193 
195  Vector<ValueType> dlogpsi(nparam);
196  Vector<ValueType> dhpsioverpsi(nparam);
197  //twf.evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
198  twf_component_list[0]->evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
199 
200  // Numbers not validated
201  std::vector<ValueType> expected_dlogpsi = {-0.3249548841, 0.0376658437, -0.2814191847};
202  std::vector<ValueType> expected_dhpsioverpsi = {0.0146266746, 0.0031788682, 0.4554097531};
203  for (int i = 0; i < nparam; i++)
204  {
205  CHECK(dlogpsi[i] == ValueApprox(expected_dlogpsi[i]));
206  CHECK(dhpsioverpsi[i] == ValueApprox(expected_dhpsioverpsi[i]));
207  }
208 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [349/537]

qmcplusplus::TEST_CASE ( "Walker control assign walkers odd ranks"  ,
""  [drivers][walker_control] 
)

Definition at line 118 of file test_walker_control.cpp.

References WalkerControlMPI::determineNewWalkerPopulation(), qmcplusplus::Units::mass::me, and REQUIRE().

119 {
120  int Cur_pop = 9;
121  int NumContexts = 3;
122  std::vector<int> NumPerRank = {5, 2, 2};
123  std::vector<int> FairOffset(NumContexts + 1);
124 
125  std::vector<int> NewNum = NumPerRank;
126  for (int me = 0; me < NumContexts; me++)
127  {
128  std::vector<int> minus;
129  std::vector<int> plus;
130  std::vector<int> num_per_rank = NumPerRank;
131  //std::cout << "For processor number " << me << std::endl;
132  WalkerControlMPI::determineNewWalkerPopulation(Cur_pop, NumContexts, me, num_per_rank, FairOffset, minus, plus);
133 
134  REQUIRE(minus.size() == plus.size());
135  //output_vector(" Minus: ", minus);
136 
137  //output_vector(" Plus: ", plus);
138 
139  for (int i = 0; i < plus.size(); i++)
140  {
141  if (me == plus[i])
142  NewNum[plus[i]]--;
143  }
144  for (int i = 0; i < minus.size(); i++)
145  {
146  if (me == minus[i])
147  NewNum[minus[i]]++;
148  }
149  }
150  //output_vector("New num per node: ", NewNum);
151 
152  for (int i = 0; i < NewNum.size(); i++)
153  {
154  int num = FairOffset[i + 1] - FairOffset[i];
155  REQUIRE(NewNum[i] == num);
156  }
157 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [350/537]

qmcplusplus::TEST_CASE ( "SpaceGrid::Construction"  ,
""  [estimators] 
)

Definition at line 119 of file test_NESpaceGrid.cpp.

References CHECK(), comm, OHMMS::Controller, OHMMS_DIM, SpaceGridEnv< VALID >::ref_points_, and SpaceGridEnv< VALID >::sgi_.

120 {
121  using Input = testing::ValidSpaceGridInput;
122  Communicate* comm;
124 
125  testing::SpaceGridEnv<Input::valid::ORIGIN> sge(comm);
126 
127  // EnergyDensityEstimator gets this from an enum giving indexes into each offset of SOA buffer.
128  // It is a smell.
129  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), 1, false);
130 
131  using NES = testing::NESpaceGridTests<double>;
132  auto buffer_start = NES::getBufferStart(space_grid);
133  auto buffer_end = NES::getBufferEnd(space_grid);
134  space_grid.write_description(std::cout, std::string(""));
135  auto& sgi = *(sge.sgi_);
136  auto& agr = sgi.get_axis_grids();
137  for (int id = 0; id < OHMMS_DIM; ++id)
138  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
139 
140  // CHECK(buffer_start == 0);
141  // CHECK(buffer_end == 7999);
142 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
#define OHMMS_DIM
Definition: config.h:64
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [351/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A elec"  ,
""  [hamiltonian] 
)

Definition at line 119 of file test_coulomb_pbcAA.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evalConsts(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, ParticleSet::setName(), and ParticleSet::update().

120 {
121  LRCoulombSingleton::CoulombHandler = 0;
122 
123  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
124  lattice.BoxBConds = true; // periodic
125  lattice.R.diagonal(1.0);
126  lattice.reset();
127 
128  const SimulationCell simulation_cell(lattice);
129  ParticleSet elec(simulation_cell);
130 
131  elec.setName("elec");
132  elec.create({1});
133  elec.R[0] = {0.0, 0.5, 0.0};
134  SpeciesSet& tspecies = elec.getSpeciesSet();
135  int upIdx = tspecies.addSpecies("u");
136  int chargeIdx = tspecies.addAttribute("charge");
137  int massIdx = tspecies.addAttribute("mass");
138  tspecies(chargeIdx, upIdx) = -1;
139  tspecies(massIdx, upIdx) = 1.0;
140 
141  elec.createSK();
142  elec.update();
143 
144 
145  CoulombPBCAA caa(elec, true, false, false);
146 
147  // Self-energy correction, no background charge for e-e interaction
148  double consts = caa.evalConsts();
149  CHECK(consts == Approx(-3.1151210154));
150 
151  double val = caa.evaluate(elec);
152  CHECK(val == Approx(-1.418648723)); // not validated
153 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [352/537]

qmcplusplus::TEST_CASE ( "benchmark_DiracMatrixComputeCUDA_vs_legacy_256_10"  ,
""  [wavefunction][fermion][benchmark] 
)

This test will run by default.

Definition at line 120 of file benchmark_DiracMatrixComputeCUDA.cpp.

References DiracComputeBenchmarkParameters::batch_size, DiracMatrix< T_FP >::invert_transpose(), log_values(), qmcplusplus::testing::makeRngSpdMatrix(), qmcplusplus::Units::meter, DiracMatrixComputeCUDA< VALUE_FP >::mw_invertTranspose(), DiracComputeBenchmarkParameters::n, DiracComputeBenchmarkParameters::name, queue, and DiracComputeBenchmarkParameters::str().

121 {
122  DiracComputeBenchmarkParameters params;
123  params.name = "Batched CUDA";
124  params.n = 256;
125  params.batch_size = 10;
126 
127  compute::Queue<PlatformKind::CUDA> queue;
128  DiracMatrixComputeCUDA<double> dmcc;
129 
130  std::vector<Matrix<double>> spd_mats(params.batch_size, {params.n, params.n});
131  std::vector<OffloadPinnedMatrix<double>> pinned_spd_mats(params.batch_size, {params.n, params.n});
132 
133  testing::MakeRngSpdMatrix<double> makeRngSpdMatrix;
134  for (int im = 0; im < params.batch_size; ++im)
135  {
136  makeRngSpdMatrix(spd_mats[im]);
137  for (int i = 0; i < params.n; ++i)
138  for (int j = 0; j < params.n; ++j)
139  pinned_spd_mats[im](i, j) = spd_mats[im](i, j);
140  }
141 
142  OffloadPinnedVector<std::complex<double>> log_values(params.batch_size);
143  std::vector<OffloadPinnedMatrix<double>> pinned_inv_mats(params.batch_size, {params.n, params.n});
144 
145  auto a_mats = makeRefVector<const decltype(pinned_spd_mats)::value_type>(pinned_spd_mats);
146  RefVector<OffloadPinnedMatrix<double>> inv_a_mats =
147  makeRefVector<decltype(pinned_inv_mats)::value_type>(pinned_inv_mats);
148 
149  std::vector<bool> compute_mask(params.batch_size, true);
150  BENCHMARK_ADVANCED(params.str())(Catch::Benchmark::Chronometer meter)
151  {
152  meter.measure([&] { dmcc.mw_invertTranspose(queue, a_mats, inv_a_mats, log_values); });
153  };
154 
155 
156  DiracMatrix<double> dmat;
157  std::vector<Matrix<double>> inv_mats_test(params.batch_size, {params.n, params.n});
158  ;
159  std::vector<std::complex<double>> log_values_test(params.batch_size);
160 
161  params.name = "legacy CPU";
162  BENCHMARK_ADVANCED(params.str())(Catch::Benchmark::Chronometer meter)
163  {
164  meter.measure([&] {
165  for (int im = 0; im < params.batch_size; ++im)
166  dmat.invert_transpose(spd_mats[im], inv_mats_test[im], log_values_test[im]);
167  });
168  };
169 }
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
void makeRngSpdMatrix(testing::RandomForTest< RngValueType< T >> &rng, Matrix< T > &mat_spd)

◆ TEST_CASE() [353/537]

qmcplusplus::TEST_CASE ( "read_lattice_xml_lrhandle"  ,
""  [particle_io][xml] 
)

Definition at line 121 of file test_lattice_parser.cpp.

References CHECK(), doc, Libxml2Document::getRoot(), okay, Libxml2Document::parseFromString(), LatticeParser::put(), CrystalLattice< T, D >::R, and REQUIRE().

122 {
123  SECTION("valid p p n input")
124  {
125  const char* const particles = R"(
126  <tmp>
127  <parameter name="lattice" units="bohr">
128  3.80000000 0.00000000 0.00000000
129  0.00000000 3.80000000 0.00000000
130  0.00000000 0.00000000 10.00000000
131  </parameter>
132  <parameter name="bconds">
133  p p n
134  </parameter>
135  <parameter name="LR_dim_cutoff">30</parameter>
136  <parameter name="LR_handler"> opt_breakup </parameter>
137  </tmp>
138  )";
139 
141  bool okay = doc.parseFromString(particles);
142  REQUIRE(okay);
143 
144  xmlNodePtr root = doc.getRoot();
145 
146  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> uLattice;
147  LatticeParser lp(uLattice);
148  REQUIRE_NOTHROW(lp.put(root));
149 
150  CHECK(uLattice.R[8] == Approx(10.0));
151  CHECK(uLattice.LR_dim_cutoff == Approx(30));
152  }
153 
154  SECTION("valid p p n ewald_quasi2d input")
155  {
156  const char* const particles = R"(
157  <tmp>
158  <parameter name="lattice" units="bohr">
159  3.80000000 0.00000000 0.00000000
160  0.00000000 3.80000000 0.00000000
161  0.00000000 0.00000000 10.00000000
162  </parameter>
163  <parameter name="bconds">
164  p p n
165  </parameter>
166  <parameter name="LR_dim_cutoff">30</parameter>
167  <parameter name="LR_handler"> ewald_quasi2d </parameter>
168  </tmp>
169  )";
170 
172  bool okay = doc.parseFromString(particles);
173  REQUIRE(okay);
174 
175  xmlNodePtr root = doc.getRoot();
176 
177  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> uLattice;
178  LatticeParser lp(uLattice);
179  REQUIRE_NOTHROW(lp.put(root));
180  }
181 
182  SECTION("invalid p p p ewald_quasi2d input")
183  {
184  const char* const particles = R"(
185  <tmp>
186  <parameter name="lattice" units="bohr">
187  3.80000000 0.00000000 0.00000000
188  0.00000000 3.80000000 0.00000000
189  0.00000000 0.00000000 10.00000000
190  </parameter>
191  <parameter name="bconds">
192  p p p
193  </parameter>
194  <parameter name="LR_dim_cutoff">30</parameter>
195  <parameter name="LR_handler"> ewald_quasi2d </parameter>
196  </tmp>
197  )";
198 
200  bool okay = doc.parseFromString(particles);
201  REQUIRE(okay);
202 
203  xmlNodePtr root = doc.getRoot();
204 
205  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> uLattice;
206  LatticeParser lp(uLattice);
207  REQUIRE_THROWS_WITH(lp.put(root),
208  "LatticeParser::put. Quasi 2D Ewald only works with boundary condition 'p p n'!");
209  }
210 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [354/537]

qmcplusplus::TEST_CASE ( "particle set lattice with vacuum"  ,
""  [particle] 
)

Definition at line 122 of file test_ParticleSet.cpp.

References CrystalLattice< T, D >::BoxBConds, CHECK(), ParticleSet::createSK(), ParticleSet::getLRBox(), CrystalLattice< T, D >::R, CrystalLattice< T, D >::reset(), ParticleSet::setName(), SUPERCELL_BULK, SUPERCELL_SLAB, SUPERCELL_WIRE, CrystalLattice< T, D >::SuperCellEnum, and CrystalLattice< T, D >::VacuumScale.

123 {
124  // PPP case
125  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> Lattice;
126  Lattice.BoxBConds = true;
127  Lattice.R = {1.0, 2.0, 3.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0};
128 
129  Lattice.VacuumScale = 2.0;
130  Lattice.reset();
131  {
132  const SimulationCell simulation_cell(Lattice);
133  ParticleSet source(simulation_cell);
134  source.setName("electrons");
135  source.createSK();
136 
138  CHECK(source.getLRBox().R(0, 0) == 1.0);
139  CHECK(source.getLRBox().R(0, 1) == 2.0);
140  CHECK(source.getLRBox().R(0, 2) == 3.0);
141  }
142 
143  // PPN case
144  Lattice.BoxBConds[2] = false;
145  Lattice.reset();
146  {
147  const SimulationCell simulation_cell(Lattice);
148  ParticleSet source(simulation_cell);
149  source.setName("electrons");
150  source.createSK();
151 
153  CHECK(source.getLRBox().R(2, 0) == 0.0);
154  CHECK(source.getLRBox().R(2, 1) == 0.0);
155  CHECK(source.getLRBox().R(2, 2) == 2.0);
156  }
157 
158  // PNN case
159  Lattice.BoxBConds[1] = false;
160  Lattice.reset();
161  {
162  const SimulationCell simulation_cell(Lattice);
163  ParticleSet source(simulation_cell);
164  source.setName("electrons");
165  source.createSK();
166 
168  CHECK(source.getLRBox().R(0, 0) == 1.0);
169  CHECK(source.getLRBox().R(0, 1) == 2.0);
170  CHECK(source.getLRBox().R(0, 2) == 3.0);
171  CHECK(source.getLRBox().R(1, 0) == 0.0);
172  CHECK(source.getLRBox().R(1, 1) == 2.0);
173  CHECK(source.getLRBox().R(1, 2) == 0.0);
174  CHECK(source.getLRBox().R(2, 0) == 0.0);
175  CHECK(source.getLRBox().R(2, 1) == 0.0);
176  CHECK(source.getLRBox().R(2, 2) == 2.0);
177  }
178 }
int SuperCellEnum
supercell enumeration
void reset()
Evaluate the reciprocal vectors, volume and metric tensor.
POLT::ParticleLayout Lattice
T VacuumScale
The scale factor for adding vacuum.
TinyVector< int, D > BoxBConds
The boundary condition in each direction.
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
Tensor_t R
Real-space unit vectors. R(i,j) i=vector and j=x,y,z.

◆ TEST_CASE() [355/537]

qmcplusplus::TEST_CASE ( "fairDivide_typical"  ,
""  [utilities] 
)

Definition at line 123 of file test_partition.cpp.

References fairDivide(), and REQUIRE().

124 {
125  auto out = fairDivide(7, 3);
126  REQUIRE(out.size() == 3);
127  REQUIRE(out[0] == 3);
128  REQUIRE(out[1] == 2);
129  REQUIRE(out[2] == 2);
130 }
REQUIRE(std::filesystem::exists(filename))
std::vector< IV > fairDivide(IV ntot, IV npart)
return the occupation vector for ntot entities partitioned npart ways.
Definition: FairDivide.h:77

◆ TEST_CASE() [356/537]

qmcplusplus::TEST_CASE ( "InputSection::readXML"  ,
""  [estimators] 
)

Definition at line 124 of file test_InputSection.cpp.

References CHECK(), doc, InputSection::get(), Libxml2Document::getRoot(), InputSection::has(), okay, Libxml2Document::parseFromString(), InputSection::readXML(), TestInputSection::report(), REQUIRE(), VALUE1, and VALUE2.

125 {
126  SECTION("minimum required attributes and parameters")
127  {
128  // clang-format: off
129  const char* xml = R"(
130 <test full="no">
131  <parameter name="count"> 15 </parameter>
132 </test>
133 )";
134  // clang-format: on
135 
136  // parse xml doc
138  bool okay = doc.parseFromString(xml);
139  REQUIRE(okay);
140  xmlNodePtr cur = doc.getRoot();
141 
142  // read xml
143  TestInputSection ti;
144  ti.readXML(cur);
145 
146  ti.report(std::cout);
147 
148  // assigned from xml
149  CHECK(ti.has("full"));
150  CHECK(ti.has("count"));
151  // assigned from defaults
152  CHECK(ti.has("name"));
153  CHECK(ti.has("samples"));
154  CHECK(ti.has("width"));
155  CHECK(ti.has("rational"));
156  // unassigned
157  CHECK(!ti.has("kmax"));
158  CHECK(!ti.has("label"));
159  CHECK(!ti.has("sposets"));
160  CHECK(!ti.has("center"));
161  // check value correctness
162  CHECK(ti.get<bool>("full") == false);
163  CHECK(ti.get<int>("count") == 15);
164  CHECK(ti.get<std::string>("name") == "demo");
165  CHECK(ti.get<int>("samples") == 20);
166  CHECK(ti.get<Real>("width") == Approx(1.0));
167  CHECK(ti.get<bool>("rational") == false);
168  }
169 
170  SECTION("complete attributes and parameters")
171  {
172  // clang-format: off
173  const char* xml = R"(
174 <test name="alice" samples="10" kmax="3.0" full="no">
175  <parameter name="label" > relative </parameter>
176  <parameter name="count" > 15 </parameter>
177  <parameter name="width" type="super"> 2.5 </parameter>
178  <parameter name="rational"> yes </parameter>
179  <parameter name="testenum1"> Value1 </parameter>
180  <parameter name="testenum2"> Value2 </parameter>
181  <parameter name="sposets"> spo1 spo2 </parameter>
182  <density> 10.0 20.0 30.0 </density>
183  <target> 0.0 0.2 0.3 </target>
184  <target> 0.1 0.3 0.5 </target>
185  <parameter name="center"> 0.0 0.0 0.1 </parameter>
186 </test>
187 )";
188  // clang-format: on
189 
190  // parse xml doc
192  bool okay = doc.parseFromString(xml);
193  REQUIRE(okay);
194  xmlNodePtr cur = doc.getRoot();
195 
196  // read xml
197  TestInputSection ti;
198  ti.readXML(cur);
199 
200  ti.report(std::cout);
201  // assigned from xml
202  CHECK(ti.has("name"));
203  CHECK(ti.has("samples"));
204  CHECK(ti.has("kmax"));
205  CHECK(ti.has("full"));
206  CHECK(ti.has("label"));
207  CHECK(ti.has("count"));
208  CHECK(ti.has("width"));
209  CHECK(ti.has("width::type"));
210  CHECK(ti.has("rational"));
211  CHECK(ti.has("sposets"));
212  // check value correctness
213  CHECK(ti.get<std::string>("name") == "alice");
214  CHECK(ti.get<int>("samples") == 10);
215  CHECK(ti.get<Real>("kmax") == Approx(3.0));
216  CHECK(ti.get<bool>("full") == false);
217  CHECK(ti.get<std::string>("label") == "relative");
218  CHECK(ti.get<int>("count") == 15);
219  CHECK(ti.get<Real>("width") == Approx(2.5));
220  CHECK(ti.get<std::string>("width::type") == "super");
221  CHECK(ti.get<bool>("rational") == true);
222  CHECK(ti.get<std::vector<Real>>("density") == std::vector<Real>{10.0, 20.0, 30.0});
223  CHECK(ti.get<TestEnum1>("testenum1") == TestEnum1::VALUE1);
224  CHECK(ti.get<TestEnum2>("testenum2") == TestEnum2::VALUE2);
225  CHECK(ti.get<std::vector<std::string>>("sposets") == std::vector<std::string>{"spo1", "spo2"});
226  }
227 
228 
229  SECTION("invalid inputs")
230  {
231  // cases that should result in thrown exception:
232  // required attribute/parameter is missing
233  // unrecognized attribute/parameter encountered
234 
235  std::map<std::string, std::string_view> invalid_inputs =
236  {{"missing_attribute", R"(
237 <test>
238  <parameter name="count"> 15 </parameter>
239 </test>
240 )"},
241  {"missing_parameter", R"(
242 <test full="no"/>
243 )"},
244  {"foreign_attribute", R"(
245 <test full="no" area="51">
246  <parameter name="count"> 15 </parameter>
247 </test>
248 )"},
249  {"foreign_parameter", R"(
250 <test full="no">
251  <parameter name="count"> 15 </parameter>
252  <parameter name="area" > 51 </parameter>
253 </test>
254 )"},
255  {"invalid_section_name", R"(<not_test><parameter name="nothing"></parameter></not_test>)"}};
256 
257  std::cout << "really going to try bad sections\n" << std::endl;
258  for (auto& [label, xml] : invalid_inputs)
259  {
260  // parse xml doc
262  bool okay = doc.parseFromString(xml);
263  REQUIRE(okay);
264  xmlNodePtr cur = doc.getRoot();
265 
266  // read xml
267  TestInputSection ti;
268  CHECK_THROWS_AS(ti.readXML(cur), UniformCommunicateError);
269  }
270  }
271 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ForceBase::Real Real
Definition: ForceBase.cpp:26
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [357/537]

qmcplusplus::TEST_CASE ( "kcontainer at twist in 2D"  ,
""  [longrange] 
)

Definition at line 124 of file test_kcontainer.cpp.

References CHECK(), qmcplusplus::Units::charge::e, KContainer::kpts, KContainer::kpts_cart, lattice, and KContainer::updateKLists().

125 {
126  const int ndim = 2;
127  const double alat = 1.0;
128  const double blat = 2 * M_PI / alat;
129 
130  // twist one shell of kvectors
131  const double kc = blat + 1e-6;
132 
133  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
134  lattice.R.diagonal(1.0);
135  lattice.set(lattice.R); // compute Rv and Gv from R
136 
137  KContainer klists;
138 
139  PosType twist;
140  twist[0] = 0.1;
141  klists.updateKLists(lattice, kc, ndim, twist);
142  CHECK(klists.kpts.size() == 1);
143  CHECK(klists.kpts_cart[0][0] == Approx(blat * (twist[0] - 1)));
144 
145  twist[1] = 0.1;
146  klists.updateKLists(lattice, kc, ndim, twist);
147  CHECK(klists.kpts.size() == 2);
148  CHECK(klists.kpts_cart[0][0] == Approx(blat * (twist[0] - 1)));
149  CHECK(klists.kpts_cart[0][1] == Approx(blat * twist[1]));
150  CHECK(klists.kpts_cart[1][0] == Approx(blat * (twist[0])));
151  CHECK(klists.kpts_cart[1][1] == Approx(blat * (twist[1] - 1)));
152 
153  twist = {-0.5, 0.5, 0};
154  klists.updateKLists(lattice, kc, ndim, twist);
155  CHECK(klists.kpts.size() == 3);
156  //for (int ik=0;ik<3;ik++)
157  // app_log() << klists.kpts_cart[ik] << std::endl;
158  CHECK(klists.kpts_cart[0][0] == Approx(blat * (twist[0] - 0)));
159  CHECK(klists.kpts_cart[0][1] == Approx(blat * (twist[1] - 1)));
160  CHECK(klists.kpts_cart[1][0] == Approx(blat * (twist[0] + 1)));
161  CHECK(klists.kpts_cart[1][1] == Approx(blat * (twist[1] - 1)));
162  CHECK(klists.kpts_cart[2][0] == Approx(blat * (twist[0] + 1)));
163  CHECK(klists.kpts_cart[2][1] == Approx(blat * twist[1]));
164 }
QMCTraits::PosType PosType
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [358/537]

qmcplusplus::TEST_CASE ( "SODMC"  ,
""  [drivers][dmc] 
)

Definition at line 125 of file test_dmc_driver.cpp.

References CloneManager::acceptRatio(), SpeciesSet::addAttribute(), TrialWaveFunction::addComponent(), QMCHamiltonian::addOperator(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), CloneManager::clearClones(), OHMMS::Controller, ParticleSet::create(), MCWalkerConfiguration::createWalkers(), doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), ParticleSet::getSpeciesSet(), okay, omp_get_max_threads(), Libxml2Document::parseFromString(), QMCDriver::process(), ParticleSet::R, REQUIRE(), DMC::run(), ParticleSet::setName(), ParticleSet::setSpinor(), ParticleSet::spins, and ParticleSet::update().

126 {
127  ProjectData project_data;
129 
130  const SimulationCell simulation_cell;
131  ParticleSet ions(simulation_cell);
132  MCWalkerConfiguration elec(simulation_cell);
133 
134  ions.setName("ion");
135  ions.create({1});
136  ions.R[0] = {0.0, 0.0, 0.0};
137  elec.setName("elec");
138  std::vector<int> agroup(1);
139  agroup[0] = 1;
140  elec.create(agroup);
141  elec.R[0] = {1.0, 0.0, 0.0};
142  elec.spins[0] = 0.0;
143  elec.setSpinor(true);
144  elec.createWalkers(1);
145 
146  SpeciesSet& tspecies = elec.getSpeciesSet();
147  int upIdx = tspecies.addSpecies("u");
148  int chargeIdx = tspecies.addAttribute("charge");
149  int massIdx = tspecies.addAttribute("mass");
150  tspecies(chargeIdx, upIdx) = -1;
151  tspecies(massIdx, upIdx) = 1.0;
152 
153  elec.addTable(ions);
154  elec.update();
155 
156  CloneManager::clearClones();
157 
158  TrialWaveFunction psi(project_data.getRuntimeOptions());
159  psi.addComponent(std::make_unique<ConstantOrbital>());
160  psi.registerData(elec, elec[0]->DataSet);
161  elec[0]->DataSet.allocate();
162 
163  using RNG = RandomBase<QMCTraits::FullPrecRealType>;
164  UPtrVector<RNG> rngs(omp_get_max_threads());
165  for (std::unique_ptr<RNG>& rng : rngs)
166  rng = std::make_unique<FakeRandom<QMCTraits::FullPrecRealType>>();
167 
168  QMCHamiltonian h;
169  std::unique_ptr<BareKineticEnergy> p_bke = std::make_unique<BareKineticEnergy>(elec, psi);
170  h.addOperator(std::move(p_bke), "Kinetic");
171  h.addObservables(elec); // get double free error on 'h.Observables' w/o this
172 
173  elec.resetWalkerProperty(); // get memory corruption w/o this
174 
175  DMC dmc_omp(project_data, elec, psi, h, rngs, c, false);
176 
177  const char* dmc_input = R"(<qmc method="dmc" checkpoint="-1">
178  <parameter name="steps">1</parameter>
179  <parameter name="blocks">1</parameter>
180  <parameter name="timestep">0.1</parameter>
181  <parameter name="SpinMass">0.25</parameter>
182  </qmc>
183  )";
185  bool okay = doc.parseFromString(dmc_input);
186  REQUIRE(okay);
187  xmlNodePtr root = doc.getRoot();
188 
189  dmc_omp.process(root); // need to call 'process' for QMCDriver, which in turn calls 'put'
190 
191  dmc_omp.run();
192 
193  // With the constant wavefunction, no moves should be rejected
194  double ar = dmc_omp.acceptRatio();
195  CHECK(ar == Approx(1.0));
196 
197  // Each electron moved sqrt(tau)*gaussian_rng()
198  // See Particle>Base/tests/test_random_seq.cpp for the gaussian random numbers
199  // Values from diffuse.py for moving one step
200 
201  CHECK(elec[0]->R[0][0] == Approx(0.627670258894097));
202  CHECK(elec.R[0][1] == Approx(0.0));
203  CHECK(elec.R[0][2] == Approx(-0.372329741105903));
204 
205  CHECK(elec.spins[0] == Approx(-0.74465948215809097));
206 }
DMC type: dmc, dmc-ptcl.
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
omp_int_t omp_get_max_threads()
Definition: OpenMP.h:26
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [359/537]

qmcplusplus::TEST_CASE ( "SOVMC"  ,
""  [drivers][vmc] 
)

Definition at line 125 of file test_vmc_driver.cpp.

References CloneManager::acceptRatio(), SpeciesSet::addAttribute(), TrialWaveFunction::addComponent(), QMCHamiltonian::addOperator(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), CloneManager::clearClones(), OHMMS::Controller, ParticleSet::create(), MCWalkerConfiguration::createWalkers(), doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), ParticleSet::getSpeciesSet(), okay, omp_get_max_threads(), Libxml2Document::parseFromString(), QMCDriver::process(), ParticleSet::R, REQUIRE(), MCWalkerConfiguration::resetWalkerProperty(), VMC::run(), Communicate::setName(), ParticleSet::setName(), ParticleSet::setSpinor(), ParticleSet::spins, and ParticleSet::update().

126 {
127  ProjectData project_data;
129  c->setName("test");
130  const SimulationCell simulation_cell;
131  ParticleSet ions(simulation_cell);
132  MCWalkerConfiguration elec(simulation_cell);
133 
134  ions.setName("ion");
135  ions.create({1});
136  ions.R[0] = {0.0, 0.0, 0.0};
137 
138  elec.setName("elec");
139  std::vector<int> agroup(1, 1);
140  elec.create(agroup);
141  elec.R[0] = {1.0, 0.0, 0.0};
142  elec.spins[0] = 0.0;
143  elec.setSpinor(true);
144  elec.createWalkers(1);
145 
146  SpeciesSet& tspecies = elec.getSpeciesSet();
147  int upIdx = tspecies.addSpecies("u");
148  int chargeIdx = tspecies.addAttribute("charge");
149  int massIdx = tspecies.addAttribute("mass");
150  tspecies(chargeIdx, upIdx) = -1;
151  tspecies(massIdx, upIdx) = 1.0;
152 
153  elec.addTable(ions);
154  elec.update();
155 
156  CloneManager::clearClones();
157 
158  TrialWaveFunction psi(project_data.getRuntimeOptions());
159  psi.addComponent(std::make_unique<ConstantOrbital>());
160  psi.registerData(elec, elec[0]->DataSet);
161  elec[0]->DataSet.allocate();
162 
163  using RNG = RandomBase<QMCTraits::FullPrecRealType>;
164  UPtrVector<RNG> rngs(omp_get_max_threads());
165  for (std::unique_ptr<RNG>& rng : rngs)
166  rng = std::make_unique<FakeRandom<QMCTraits::FullPrecRealType>>();
167 
168  QMCHamiltonian h;
169  h.addOperator(std::make_unique<BareKineticEnergy>(elec, psi), "Kinetic");
170  h.addObservables(elec); // get double free error on 'h.Observables' w/o this
171 
172  elec.resetWalkerProperty(); // get memory corruption w/o this
173 
174  VMC vmc_omp(project_data, elec, psi, h, rngs, c, false);
175 
176  const char* vmc_input = R"(<qmc method="vmc" move="pbyp" checkpoint="-1">
177  <parameter name="substeps">1</parameter>
178  <parameter name="steps">1</parameter>
179  <parameter name="blocks">1</parameter>
180  <parameter name="timestep">0.1</parameter>
181  <parameter name="usedrift">no</parameter>
182  <parameter name="SpinMass">0.25</parameter>
183  </qmc>
184  )";
186  bool okay = doc.parseFromString(vmc_input);
187  REQUIRE(okay);
188  xmlNodePtr root = doc.getRoot();
189 
190  vmc_omp.process(root); // need to call 'process' for QMCDriver, which in turn calls 'put'
191 
192  vmc_omp.run();
193 
194  // With the constant wavefunction, no moves should be rejected
195  double ar = vmc_omp.acceptRatio();
196  CHECK(ar == Approx(1.0));
197 
198  // Each electron moved sqrt(tau)*gaussian_rng()
199  // See Particle>Base/tests/test_random_seq.cpp for the gaussian random numbers
200  // Values from diffuse.py for moving one step
201 
202  CHECK(elec.R[0][0] == Approx(0.627670258894097));
203  CHECK(elec.R[0][1] == Approx(0.0));
204  CHECK(elec.R[0][2] == Approx(-0.372329741105903));
205 
206  CHECK(elec.spins[0] == Approx(-0.74465948215809097));
207 
208  //Now we're going to test that the step updated the walker variables.
209  CHECK(elec[0]->R[0][0] == Approx(elec.R[0][0]));
210  CHECK(elec[0]->R[0][1] == Approx(elec.R[0][1]));
211  CHECK(elec[0]->R[0][2] == Approx(elec.R[0][2]));
212  CHECK(elec[0]->spins[0] == Approx(elec.spins[0]));
213 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
omp_int_t omp_get_max_threads()
Definition: OpenMP.h:26
REQUIRE(std::filesystem::exists(filename))
void setName(const std::string &aname)
Definition: Communicate.h:129
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
VMC type: vmc, vmc-ptcl, vmc-multiple, vmc-ptcl-multiple.

◆ TEST_CASE() [360/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A Ewald Quasi2D staggered square"  ,
""  [hamiltonian] 
)

Definition at line 126 of file test_ewald_quasi2d.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), lattice, LRCoulombSingleton::QUASI2D, ParticleSet::R, ParticleSet::setName(), LRCoulombSingleton::this_lr_type, and ParticleSet::update().

127 {
128  LRCoulombSingleton::CoulombHandler = 0; // !!!! crucial if not first test
129  LRCoulombSingleton::this_lr_type = LRCoulombSingleton::QUASI2D;
130  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
131  lattice.BoxBConds = true;
132  lattice.BoxBConds[2] = false; // ppn
133  lattice.ndim = 2;
134  lattice.R = 0.0;
135  lattice.R.diagonal(1.0);
136  lattice.R(2,2) = 10;
137  lattice.LR_dim_cutoff = 30.0;
138  lattice.reset();
139 
140  const SimulationCell simulation_cell(lattice);
141  ParticleSet elec(simulation_cell);
142  int npart = 2;
143  elec.setName("e");
144  elec.create({npart});
145  elec.R[0] = {0.0, 0.0, 0.0};
146  elec.R[1] = {0.5, 0.5, 0.0};
147 
148  SpeciesSet& tspecies = elec.getSpeciesSet();
149  int upIdx = tspecies.addSpecies("u");
150  int chargeIdx = tspecies.addAttribute("charge");
151  int massIdx = tspecies.addAttribute("mass");
152  tspecies(chargeIdx, upIdx) = -1;
153  tspecies(massIdx, upIdx) = 1.0;
154 
155  elec.createSK();
156  elec.addTable(elec); // !!!! crucial to compute distance table
157 
158  CoulombPBCAA caa(elec, true, false, false);
159 
160  const int ntest = 4;
161  const double zheight[ntest] = {0, 0.1, 0.5, 3.0};
162  const double vmad_sq = -1.95013246;
163  const double vmad_bc = -2.7579038;
164  const double vmad_ref[ntest] = {vmad_bc, -2.4846003745840357, -2.019557388069959, vmad_sq};
165  double val;
166  for (int itest=0; itest<ntest; itest++)
167  {
168  elec.R[1][2] = zheight[itest];
169  elec.update();
170  val = caa.evaluate(elec);
171  CHECK(val/npart == Approx(vmad_ref[itest]));
172  }
173 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [361/537]

qmcplusplus::TEST_CASE ( "DiracDeterminantBatched_first"  ,
""  [wavefunction][fermion] 
)

Definition at line 126 of file test_DiracDeterminantBatched.cpp.

127 {
128 #if defined(ENABLE_OFFLOAD) && defined(ENABLE_CUDA)
129  test_DiracDeterminantBatched_first<PlatformKind::CUDA>();
130 #endif
131 #if defined(ENABLE_OFFLOAD) && defined(ENABLE_SYCL)
132  test_DiracDeterminantBatched_first<PlatformKind::SYCL>();
133 #endif
134  test_DiracDeterminantBatched_first<PlatformKind::OMPTARGET>();
135 }

◆ TEST_CASE() [362/537]

qmcplusplus::TEST_CASE ( "Cartesian Tensor evaluateAll subset"  ,
""  [numerics] 
)

Definition at line 126 of file test_cartesian_tensor.cpp.

References CHECK(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::evaluateAll(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::getGradYlm(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::getLaplYlm(), and CartesianTensor< T, Point_t, Tensor_t, GGG_t >::getYlm().

127 {
129 
130  TinyVector<double, 3> pt(1.3, 1.2, -0.5);
131  ct.evaluateAll(pt);
132 
133  //for (int i = 0; i < 35; i++) {
134  // std::cout << "XYZ = " << i << " " << ct.getYlm(i) << " " << ct.getGradYlm(i) << " " << ct.getLaplYlm(i) << std::endl;
135  //}
136 
137  CHECK(ct.getYlm(0) == Approx(0.282094791774));
138  CHECK(ct.getGradYlm(0)[0] == Approx(0));
139  CHECK(ct.getGradYlm(0)[1] == Approx(0));
140  CHECK(ct.getGradYlm(0)[2] == Approx(0));
141  CHECK(ct.getLaplYlm(0) == Approx(0));
142 
143  CHECK(ct.getYlm(1) == Approx(0.635183265474));
144  CHECK(ct.getGradYlm(1)[0] == Approx(0.488602511903));
145  CHECK(ct.getGradYlm(1)[1] == Approx(0));
146  CHECK(ct.getGradYlm(1)[2] == Approx(0));
147  CHECK(ct.getLaplYlm(1) == Approx(0));
148 
149  CHECK(ct.getYlm(8) == Approx(-0.710156479885));
150  CHECK(ct.getGradYlm(8)[0] == Approx(-0.546274215296));
151  CHECK(ct.getGradYlm(8)[1] == Approx(0));
152  CHECK(ct.getGradYlm(8)[2] == Approx(1.42031295977));
153  CHECK(ct.getLaplYlm(8) == Approx(0));
154 
155  CHECK(ct.getYlm(23) == Approx(5.90305249944));
156  CHECK(ct.getGradYlm(23)[0] == Approx(13.6224288449));
157  CHECK(ct.getGradYlm(23)[1] == Approx(4.9192104162));
158  CHECK(ct.getGradYlm(23)[2] == Approx(0));
159  CHECK(ct.getLaplYlm(23) == Approx(20.9575828383));
160 
161  CHECK(ct.getYlm(34) == Approx(1.9526074946));
162  CHECK(ct.getGradYlm(34)[0] == Approx(1.50200576508));
163  CHECK(ct.getGradYlm(34)[1] == Approx(1.62717291217));
164  CHECK(ct.getGradYlm(34)[2] == Approx(-7.81042997841));
165  CHECK(ct.getLaplYlm(34) == Approx(15.6208599568));
166 
167  CHECK(ct.getYlm(50) == Approx(-9.78910512921));
168  CHECK(ct.getGradYlm(50)[0] == Approx(-22.5902426059));
169  CHECK(ct.getGradYlm(50)[1] == Approx(-8.15758760768));
170  CHECK(ct.getGradYlm(50)[2] == Approx(19.5782102584));
171  CHECK(ct.getLaplYlm(50) == Approx(-34.7542193937));
172 
173  CHECK(ct.getYlm(83) == Approx(12.1418905657));
174  CHECK(ct.getGradYlm(83)[0] == Approx(18.6798316395));
175  CHECK(ct.getGradYlm(83)[1] == Approx(20.2364842761));
176  CHECK(ct.getGradYlm(83)[2] == Approx(-48.5675622627));
177  CHECK(ct.getLaplYlm(83) == Approx(128.367962683));
178 }
The template parameters.
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [363/537]

qmcplusplus::TEST_CASE ( "distance_open_xy"  ,
""  [distance_table][xml] 
)

Definition at line 126 of file test_distance_table.cpp.

References ParticleSet::addTable(), CHECK(), doc, ParticleSet::getDistTableAB(), OhmmsElementBase::getName(), Libxml2Document::getRoot(), ParticleSet::getTotalNum(), ParticleSet::isSameMass(), okay, Libxml2Document::parseFromString(), XMLParticleParser::readXML(), REQUIRE(), sqrt(), and ParticleSet::update().

127 {
128  const char* particles = R"(<tmp>
129 <particleset name="e" random="yes">
130  <group name="u" size="2" mass="1.0">
131  <parameter name="charge" > -1 </parameter>
132  <parameter name="mass" > 1.0 </parameter>
133  <attrib name="position" datatype="posArray" condition="0">
134  0.70000000 0.00000000 0.00000000
135  0.00000000 1.00000000 0.00000000
136  </attrib>
137  </group>
138  <group name="d" size="1" mass="1.0">
139  <parameter name="charge" > -1 </parameter>
140  <parameter name="mass" > 1.0 </parameter>
141  <attrib name="position" datatype="posArray" condition="0">
142  -0.90000000 0.00000000 0.00000000
143  </attrib>
144  </group>
145 </particleset>
146 <particleset name="ion0">
147  <group name="H" size="2" mass="1836.15">
148  <parameter name="charge" > 1 </parameter>
149  <parameter name="valence" > 1 </parameter>
150  <parameter name="atomicnumber" > 1 </parameter>
151  <parameter name="mass" > 1836.15 </parameter>
152  <attrib name="position" datatype="posArray" condition="0">
153  0.00000000 0.00000000 0.00000000
154  1.00000000 0.00000000 0.00000000
155  </attrib>
156  </group>
157 </particleset>
158 </tmp>
159 )";
160 
162  bool okay = doc.parseFromString(particles);
163  REQUIRE(okay);
164 
165  xmlNodePtr root = doc.getRoot();
166  xmlNodePtr part1 = xmlFirstElementChild(root);
167  xmlNodePtr part2 = xmlNextElementSibling(part1);
168 
169  // read particle set
170  const SimulationCell simulation_cell;
171  ParticleSet ions(simulation_cell), electrons(simulation_cell);
172 
173  XMLParticleParser parse_electrons(electrons);
174  parse_electrons.readXML(part1);
175 
176  XMLParticleParser parse_ions(ions);
177  parse_ions.readXML(part2);
178 
179  REQUIRE(electrons.getName() == "e");
180  REQUIRE(ions.getName() == "ion0");
181  REQUIRE(ions.isSameMass());
182  REQUIRE(electrons.isSameMass());
183 
184  // calculate particle distances
185  const int tid = electrons.addTable(ions);
186  electrons.update();
187 
188  // get distance table attached to target particle set (electrons)
189  const auto& dtable = electrons.getDistTableAB(tid);
190  REQUIRE(dtable.getName() == "ion0_e");
191 
192  REQUIRE(dtable.sources() == ions.getTotalNum());
193  REQUIRE(dtable.targets() == electrons.getTotalNum());
194 
195  // calculate distance, one source particle at a time i.e.
196  // H0 - e0: 0.7
197  // H0 - e1: 1.0
198  // H0 - e2: 0.9
199  // H1 - e0: 0.3
200  // etc.
201  double expect[] = {0.7, 1.0, 0.9, 0.3, std::sqrt(2), 1.9};
202  int idx(0);
203  for (int iat = 0; iat < dtable.sources(); iat++)
204  {
205  for (int jat = 0; jat < dtable.targets(); jat++, idx++)
206  {
207  double dist = dtable.getDistRow(jat)[iat];
208  CHECK(dist == Approx(expect[idx]));
209  }
210  }
211 
212 } // TEST_CASE distance_open_xy
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [364/537]

qmcplusplus::TEST_CASE ( "DMC Particle-by-Particle advanceWalkers LinearOrbital ,
""  [drivers][dmc] 
)

Definition at line 127 of file test_dmc.cpp.

References SpeciesSet::addAttribute(), TrialWaveFunction::addComponent(), QMCHamiltonian::addObservables(), QMCHamiltonian::addOperator(), SpeciesSet::addSpecies(), ParticleSet::addTable(), QMCUpdateBase::advanceWalkers(), WalkerConfigurations::begin(), CHECK(), ParticleSet::create(), MCWalkerConfiguration::createWalkers(), WalkerConfigurations::end(), ParticleSet::getSpeciesSet(), QMCUpdateBase::nAccept, QMCUpdateBase::nReject, ParticleSet::R, TrialWaveFunction::registerData(), REQUIRE(), QMCUpdateBase::resetRun(), MCWalkerConfiguration::resetWalkerProperty(), ParticleSet::setName(), QMCUpdateBase::startBlock(), and ParticleSet::update().

129 {
130  const SimulationCell simulation_cell;
131  ParticleSet ions(simulation_cell);
132  MCWalkerConfiguration elec(simulation_cell);
133 
134  ions.setName("ion");
135  ions.create({1});
136  ions.R[0] = {0.0, 0.0, 0.0};
137  elec.setName("elec");
138  std::vector<int> agroup(1);
139  agroup[0] = 2;
140  elec.create(agroup);
141  elec.R[0] = {1.0, 0.0, 0.0};
142  elec.R[1] = {0.0, 0.0, 1.0};
143  elec.createWalkers(1);
144 
145  SpeciesSet& tspecies = elec.getSpeciesSet();
146  int upIdx = tspecies.addSpecies("u");
147  int chargeIdx = tspecies.addAttribute("charge");
148  int massIdx = tspecies.addAttribute("mass");
149  tspecies(chargeIdx, upIdx) = -1;
150  tspecies(massIdx, upIdx) = 1.0;
151 
152  elec.addTable(ions);
153  elec.update();
154 
155  RuntimeOptions runtime_options;
156  TrialWaveFunction psi(runtime_options);
157  psi.addComponent(std::make_unique<LinearOrbital>());
158  psi.registerData(elec, elec[0]->DataSet);
159  elec[0]->DataSet.allocate();
160 
161  FakeRandom rg;
162 
163  QMCHamiltonian h;
164  h.addOperator(std::make_unique<BareKineticEnergy>(elec, psi), "Kinetic");
165  h.addObservables(elec); // get double free error on 'h.Observables' w/o this
166 
167  elec.resetWalkerProperty(); // get memory corruption w/o this
168 
169  DMCUpdatePbyPWithRejectionFast dmc(elec, psi, h, rg);
170  EstimatorManagerBase EM;
171  double tau = 0.1;
172  SimpleFixedNodeBranch branch(tau, 1);
173  TraceManager TM;
174  DriftModifierUNR DM;
175  dmc.resetRun(&branch, &EM, &TM, &DM);
176  dmc.startBlock(1);
177 
178  DMCUpdatePbyPWithRejectionFast::WalkerIter_t begin = elec.begin();
179  DMCUpdatePbyPWithRejectionFast::WalkerIter_t end = elec.end();
180  dmc.advanceWalkers(begin, end, true);
181 
182  REQUIRE(dmc.nReject == 0);
183  REQUIRE(dmc.nAccept == 2);
184 
185  // Each electron moved sqrt(tau)*gaussian_rng()
186  // See ParticleBase/tests/test_random_seq.cpp for the gaussian random numbers
187  // See DMC_propagator notebook for computation of these values
188  CHECK(elec.R[0][0] == Approx(0.695481606677082));
189  CHECK(elec.R[0][1] == Approx(0.135622695565971));
190  CHECK(elec.R[0][2] == Approx(-0.168895697756948));
191 
192  CHECK(elec.R[1][0] == Approx(0.0678113477829853));
193  CHECK(elec.R[1][1] == Approx(-0.236707045539933));
194  CHECK(elec.R[1][2] == Approx(1.20343404334896));
195 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [365/537]

qmcplusplus::TEST_CASE ( "CountingJastrow"  ,
""  [wavefunction] 
)

Definition at line 128 of file test_counting_jastrow.cpp.

References CountingJastrow< RegionType >::acceptMove(), Vector< T, Alloc >::begin(), CountingJastrowBuilder::buildComponent(), CHECK(), CountingJastrow< RegionType >::checkInVariablesExclusive(), CountingJastrow< RegionType >::checkOutVariables(), OHMMS::Controller, ParticleSet::create(), doc, qmcplusplus::Units::charge::e, Vector< T, Alloc >::end(), CountingJastrow< RegionType >::evalGrad(), CountingJastrow< RegionType >::evaluateDerivatives(), CountingJastrow< RegionType >::evaluateLog(), ParticleSet::G, WaveFunctionComponent::get_log_value(), Libxml2Document::getRoot(), ParticleSet::L, CountingJastrow< RegionType >::makeClone(), ParticleSet::makeMoveAndCheck(), Libxml2Document::parseFromString(), ParticleSet::R, CountingJastrow< RegionType >::ratio(), CountingJastrow< RegionType >::ratioGrad(), CountingJastrow< RegionType >::recompute(), REQUIRE(), CountingJastrow< RegionType >::resetParametersExclusive(), Vector< T, Alloc >::resize(), and ParticleSet::setName().

129 {
130  using PosType = QMCTraits::PosType;
134  using VariableSet = optimize::VariableSet;
135  using LogValue = std::complex<QMCTraits::QTFull::RealType>;
136 
138 
139  // initialize particle sets
140  const SimulationCell simulation_cell;
141  ParticleSet elec(simulation_cell);
142  std::vector<int> egroup(1);
143  int num_els = 4;
144  egroup[0] = num_els;
145  elec.setName("e");
146  elec.create(egroup);
147  PosType Re[] = {PosType(2.4601162537, 6.7476360528, -1.9073129953),
148  PosType(2.2585811248, 2.1282254384, 0.051545776028),
149  PosType(0.84796873937, 5.1735597110, 0.84642416761),
150  PosType(3.1597337850, 5.1079432473, 1.0545953717)};
151  for (int i = 0; i < num_els; ++i)
152  for (int k = 0; k < 3; ++k)
153  elec.R[i][k] = Re[i][k];
154 
155  ParticleSet ion0(simulation_cell);
156  std::vector<int> igroup(1);
157  int num_ion = 4;
158  igroup[0] = num_ion;
159  ion0.setName("ion0");
160  ion0.create(igroup);
161  PosType Ri[] = {PosType(2.61363352510301, 5.01928226905281, 0.0), PosType(3.74709851167814, 3.70007145722224, 0.0),
162  PosType(6.11011670934565, 1.66504047681825, 0.0), PosType(8.10584803421091, 7.78608266172472, 0.0)};
163 
164  for (int i = 0; i < num_ion; ++i)
165  for (int k = 0; k < 3; ++k)
166  ion0.R[i][k] = Ri[i][k];
167 
168  const char* cj_normgauss_xml = R"(<jastrow name="ncjf_normgauss" type="Counting">
169  <var name="F" opt="true">
170  4.4903e-01 5.3502e-01 5.2550e-01 6.8081e-01
171  5.1408e-01 4.8658e-01 6.2182e-01
172  2.7189e-01 9.4951e-01
173  0.0000e+00
174  </var>
175  <region type="normalized_gaussian" reference_id="g0" opt="true" >
176  <function id="g0">
177  <var name="A" opt="False">-1.0 -0.0 -0.0 -1.0 -0.0 -1.0</var>
178  <var name="B" opt="False">-2.6136335251 -5.01928226905 0.0</var>
179  <var name="C" opt="False">-32.0242747</var>
180  </function>
181  <function id="g1">
182  <var name="A" opt="true">-1.0 -0.0 -0.0 -1.0 -0.0 -1.0</var>
183  <var name="B" opt="true">-3.74709851168 -3.70007145722 0.0</var>
184  <var name="C" opt="true">-27.7312760448</var>
185  </function>
186  <function id="g2">
187  <var name="A" opt="true">-1.0 -0.0 -0.0 -1.0 -0.0 -1.0</var>
188  <var name="B" opt="true">-6.11011670935 -1.66504047682 0.0</var>
189  <var name="C" opt="true">-40.1058859913</var>
190  </function>
191  <function id="g3">
192  <var name="A" opt="true">-1.0 -0.0 -0.0 -1.0 -0.0 -1.0</var>
193  <var name="B" opt="true">-8.10584803421 -7.78608266172 0.0</var>
194  <var name="C" opt="true">-126.327855569</var>
195  </function>
196  </region>
197  </jastrow>)";
198  // test put for normalized_gaussian
200  bool parse_cj = doc.parseFromString(cj_normgauss_xml);
201  REQUIRE(parse_cj);
202 
203  xmlNodePtr cj_root = doc.getRoot();
204  CountingJastrowBuilder cjb(c, elec);
205 
206  auto cj_uptr = cjb.buildComponent(cj_root);
207  CountingJastrow<CountingGaussianRegion>* cj = dynamic_cast<CountingJastrow<CountingGaussianRegion>*>(cj_uptr.get());
208 
209  // reference for evaluateLog, evalGrad
210  RealType Jval_exact = 7.8100074447e+00;
211  PosType Jgrad_exact[] = {PosType(3.6845037054e-04, -4.2882992861e-04, 0),
212  PosType(2.2032083234e-02, -2.5647245917e-02, 0),
213  PosType(6.0625112202e-04, -7.0560012380e-04, 0),
214  PosType(1.0622511249e-01, -1.2363268199e-01, 0)};
215  RealType Jlap_exact[] = {1.9649428566e-03, -1.1385706794e-01, 3.2312809658e-03, 4.0668060285e-01};
216 
217 
218  // test evaluateLog for cj
219  LogValue logval = cj->evaluateLog(elec, elec.G, elec.L);
220  for (int i = 0; i < num_els; ++i)
221  {
222  for (int k = 0; k < 3; ++k)
223  CHECK(Jgrad_exact[i][k] == Approx(std::real(elec.G[i][k])));
224  CHECK(Jlap_exact[i] == Approx(std::real(elec.L[i])));
225  }
226  CHECK(ComplexApprox(Jval_exact) == logval);
227 
228  // test automatic/minimal voronoi generator
229  const char* cj_voronoi_xml = R"(<jastrow name="ncjf_voronoi" type="Counting" source="ion0">
230  <var name="F" opt="true">
231  4.4903e-01 5.3502e-01 5.2550e-01 6.8081e-01
232  5.1408e-01 4.8658e-01 6.2182e-01
233  2.7189e-01 9.4951e-01
234  0.0000e+00
235  </var>
236  <region type="voronoi" opt="true">
237  <var name="alpha">1.0</var>
238  </region>
239  </jastrow>)";
240  // test put
241  Libxml2Document doc2;
242  bool parse_cjv = doc2.parseFromString(cj_voronoi_xml);
243  REQUIRE(parse_cjv);
244 
245  xmlNodePtr cjv_root = doc2.getRoot();
246  CountingJastrowBuilder cjvb(c, elec, ion0);
247 
248  // test evaluateLog for cjv
249  auto cjv_uptr = cjvb.buildComponent(cjv_root);
250  CountingJastrow<CountingGaussianRegion>* cjv = dynamic_cast<CountingJastrow<CountingGaussianRegion>*>(cjv_uptr.get());
251 
252  for (int i = 0; i < num_els; ++i)
253  {
254  for (int k = 0; k < 3; ++k)
255  elec.G[i][k] = 0;
256  elec.L[i] = 0;
257  }
258 
259  logval = cjv->evaluateLog(elec, elec.G, elec.L);
260  for (int i = 0; i < num_els; ++i)
261  {
262  for (int k = 0; k < 3; ++k)
263  CHECK(Jgrad_exact[i][k] == Approx(std::real(elec.G[i][k])));
264  CHECK(Jlap_exact[i] == Approx(std::real(elec.L[i])));
265  }
266  CHECK(ComplexApprox(Jval_exact) == logval);
267 
268  // test evalGrad
269  for (int iat = 0; iat < num_els; ++iat)
270  {
271  GradType Jgrad_iat = cj->evalGrad(elec, iat);
272  for (int k = 0; k < 3; ++k)
273  CHECK(Jgrad_exact[iat][k] == Approx(std::real(Jgrad_iat[k])));
274  }
275 
276  // reference for ratio, ratioGrad, acceptMove
277  PosType dr[] = {PosType(0.0984629815, 0.0144420719, 0.1334309321),
278  PosType(-0.1026409581, 0.2289767772, 0.490138058592),
279  PosType(0.03517477469, 0.2693941041, 0.16922043039),
280  PosType(0.3851116893, -0.1387760973, 0.1980082182)};
281 
282  RealType ratioval_exact[] = {1.00003304765, 0.987624289443, 0.999873210738, 1.09014860194};
283 
284  PosType Jgrad_t_exact[] = {PosType(4.4329270315e-04, -5.1593699287e-04, 0),
285  PosType(4.8722465115e-02, -5.6707785196e-02, 0),
286  PosType(3.2691265772e-04, -3.8048525335e-04, 0),
287  PosType(2.0373800011e-01, -2.3712542045e-01, 0)};
288 
289  // test ratio, ratioGrad, acceptMove
290  for (int iat = 0; iat < num_els; ++iat)
291  {
292  elec.makeMoveAndCheck(iat, dr[iat]);
293 
294  RealType ratioval = std::real(cj->ratio(elec, iat));
295  CHECK(ratioval_exact[iat] == Approx(std::real(ratioval)));
296 
297  GradType grad_iat(0, 0, 0);
298  RealType gradratioval = std::real(cj->ratioGrad(elec, iat, grad_iat));
299  CHECK(ratioval_exact[iat] == Approx(gradratioval));
300  for (int k = 0; k < 3; ++k)
301  CHECK(Jgrad_t_exact[iat][k] == Approx(std::real(grad_iat[k])));
302 
303  cj->acceptMove(elec, iat);
304  }
305 
306 #ifndef QMC_COMPLEX
307  // setup and reference for evaluateDerivatives
308  PosType R2[] = {PosType(4.3280064837, 2.4657709845, 6.3466520181e-01),
309  PosType(9.7075155012, 7.2984775093, -8.1975111678e-01),
310  PosType(5.7514912378, 5.2001615327, 6.6673589235e-01),
311  PosType(8.3805220665, 7.9424368608, -3.5106422506e-02)};
312  PosType G2[] = {PosType(3.3480105792e-01, 2.1316369526e-01, -4.1812914940e-01),
313  PosType(-7.0561066397e-01, 1.7863210008e-01, 3.5677994771e-01),
314  PosType(-9.2302398033e-01, -5.0740272660e-01, -2.6078603626e-01),
315  PosType(-8.3764545416e-01, -4.9181684009e-01, 1.0675382607e-01)};
316  for (int i = 0; i < num_els; ++i)
317  for (int k = 0; k < 3; ++k)
318  {
319  elec.R[i][k] = R2[i][k];
320  elec.G[i][k] = G2[i][k];
321  }
322 
323  int num_derivs = 39;
324  RealType dlogpsi_exact[] = {7.0982172306e-04, 9.8329357367e-02, 6.6879065207e-03, 1.0670293004e-01,
325  3.4053136887e+00, 4.6322726464e-01, 7.3906096412e+00, 1.5753284303e-02,
326  5.0267496641e-01, -1.3874695168e+00, -2.6249136239e+00, -4.2223002567e+00,
327  -3.0798330637e+00, 3.7905326800e+00, 8.4038996349e+00, 2.2816901707e+00,
328  4.1911712810e+00, -9.3658177215e+00, -1.2434457046e+01, 1.6771424507e+00,
329  2.3712452266e+00, 3.6980955070e+00, 2.5407601111e+00, 1.8976924460e-01,
330  -1.0446470315e+00, -1.2992491105e+00, -8.5624882767e-01, 9.8686287993e+00,
331  1.1847431541e+01, -2.5193792283e-01, -3.0763224769e-01, 1.2429858182e-01,
332  1.3295440602e-02, 6.4178676394e-02, 1.2758462324e-01, 7.5131761426e-02,
333  1.1629004831e-01, 3.9639061816e-01, 6.7088705514e-01};
334  RealType dhpsioverpsi_exact[] = {-1.6695881381e-02, -4.8902571790e-01, -1.2725397012e-01, -6.6714806635e-01,
335  6.9379259933e+00, -4.8393983437e+00, 7.4947765640e+00, -8.8373306290e-01,
336  -6.8244030879e+00, 7.9150085031e-01, -1.4313255643e+00, 3.7225112718e+01,
337  1.7787191536e+01, -1.6672327906e+01, -4.1705496948e+01, -9.9674671566e+00,
338  -2.0150790757e+01, 1.1226368249e+02, 1.2744525474e+02, -1.5801247401e+01,
339  -1.3618595564e+01, -2.8161585388e+01, -1.4057266918e+01, 1.7626748997e+00,
340  7.8913447811e+00, 9.2144952390e+00, 4.6068416473e+00, -9.3975889104e+01,
341  -8.8298321426e+01, 1.5097063606e+01, 1.8605794463e+01, -7.3647009565e+00,
342  -5.9114663448e-01, -3.9243955679e+00, -7.8630886487e+00, -4.4437106408e+00,
343  -7.0313362338e+00, -2.3986142270e+01, -4.0724297500e+01};
344  Vector<ValueType> dlogpsi;
345  Vector<ValueType> dhpsioverpsi;
346  dlogpsi.resize(num_derivs);
347  dhpsioverpsi.resize(num_derivs);
348  std::fill(dlogpsi.begin(), dlogpsi.end(), 0);
349  std::fill(dhpsioverpsi.begin(), dhpsioverpsi.end(), 0);
350 
351  // prepare variable set
352  VariableSet optVars;
353  optVars.clear();
354  cj->checkInVariablesExclusive(optVars);
355  optVars.resetIndex();
356  cj->checkInVariablesExclusive(optVars);
357  cj->checkOutVariables(optVars);
358  optVars.print(std::cout);
359 
360  // test evaluateDerivatives
361  cj->evaluateDerivatives(elec, optVars, dlogpsi, dhpsioverpsi);
362  for (int p = 0; p < num_derivs; ++p)
363  {
364  CHECK(dlogpsi_exact[p] == Approx(std::real(dlogpsi[p])).epsilon(1e-3));
365  CHECK(dhpsioverpsi_exact[p] == Approx(std::real(dhpsioverpsi[p])).epsilon(1e-3));
366  }
367 
368 
369  // test makeClone
370  auto cj2_uptr = cj->makeClone(elec);
371  CountingJastrow<CountingGaussianRegion>* cj2 = dynamic_cast<CountingJastrow<CountingGaussianRegion>*>(cj2_uptr.get());
372  std::fill(dlogpsi.begin(), dlogpsi.end(), 0);
373  std::fill(dhpsioverpsi.begin(), dhpsioverpsi.end(), 0);
374 
375  // prepare variable set
376  VariableSet optVars2;
377  optVars2.clear();
378  cj2->checkInVariablesExclusive(optVars2);
379  optVars2.resetIndex();
380  cj2->checkInVariablesExclusive(optVars2);
381  cj2->checkOutVariables(optVars2);
382  optVars2.print(std::cout);
383 
384  cj2->evaluateDerivatives(elec, optVars2, dlogpsi, dhpsioverpsi);
385  for (int p = 0; p < num_derivs; ++p)
386  {
387  CHECK(dlogpsi_exact[p] == Approx(std::real(dlogpsi[p])).epsilon(1e-3));
388  CHECK(dhpsioverpsi_exact[p] == Approx(std::real(dhpsioverpsi[p])).epsilon(1e-3));
389  }
390 
391  // test resetParameters, recompute
392  for (int p = 0; p < num_derivs; ++p)
393  optVars[p] = 0;
394  cj->resetParametersExclusive(optVars);
395  cj->recompute(elec);
396  REQUIRE(cj->get_log_value() == LogValue(0));
397 #endif
398 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
LatticeGaussianProduct::GradType GradType
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType
std::complex< double > LogValue

◆ TEST_CASE() [366/537]

qmcplusplus::TEST_CASE ( "EstimatorManagerInput::moveConstructor"  ,
""  [estimators] 
)

Definition at line 128 of file test_EstimatorManagerInput.cpp.

References CHECK(), qmcplusplus::testing::createEstimatorManagerNewInputXML(), emi(), estimators_doc, EstimatorManagerInput::get_estimator_inputs(), EstimatorManagerInput::get_scalar_estimator_inputs(), and Libxml2Document::getRoot().

129 {
130  using namespace testing;
132  EstimatorManagerInput emi(estimators_doc.getRoot());
133 
134  CHECK(emi.get_estimator_inputs().size() == 2);
135  CHECK(emi.get_scalar_estimator_inputs().size() == 5);
136 
137  EstimatorManagerInput emi_moved_to(std::move(emi));
138 
139  CHECK(emi_moved_to.get_estimator_inputs().size() == 2);
140  CHECK(emi_moved_to.get_scalar_estimator_inputs().size() == 5);
141 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
ScalarEstimatorInputs & get_scalar_estimator_inputs()
Libxml2Document createEstimatorManagerNewInputXML()
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
EstimatorManagerInput emi(estimators_doc.getRoot())
Libxml2Document estimators_doc
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [367/537]

qmcplusplus::TEST_CASE ( "Gaussian Combo D"  ,
""  [numerics] 
)

Definition at line 129 of file test_gaussian_basis.cpp.

References GaussianCombo< T >::addGaussian(), CHECK(), GaussianCombo< T >::d2Y, GaussianCombo< T >::d3Y, GaussianCombo< T >::df(), GaussianCombo< T >::dY, GaussianCombo< T >::evaluate(), GaussianCombo< T >::evaluateAll(), GaussianCombo< T >::evaluateWithThirdDeriv(), GaussianCombo< T >::f(), REQUIRE(), GaussianCombo< T >::size(), and GaussianCombo< T >::Y.

130 {
131  GaussianCombo<real_type> gc(2, false);
132 
133  // cc-pVDZ for C, the 3D basis
134  gc.addGaussian(1.0, 0.5500000);
135 
136  REQUIRE(gc.size() == 1);
137 
138  real_type r = 1.3;
139  real_type f = gc.f(r);
140 
141  CHECK(f == Approx(0.361815669819519));
142 
143  f = gc.evaluate(r, 1.0 / r);
144  CHECK(f == Approx(0.361815669819519));
145 
146  real_type df = gc.df(r);
147  CHECK(df == Approx(-0.517396407841913));
148 
149  gc.evaluateAll(r, 1.0 / r);
150  CHECK(gc.Y == Approx(0.361815669819519));
151  CHECK(gc.dY == Approx(-0.517396407841913));
152  CHECK(gc.d2Y == Approx(0.341879626412464));
153 
154  gc.evaluateWithThirdDeriv(r, 1.0 / r);
155  CHECK(gc.Y == Approx(0.361815669819519));
156  CHECK(gc.dY == Approx(-0.517396407841913));
157  CHECK(gc.d2Y == Approx(0.341879626412464));
158  CHECK(gc.d3Y == Approx(0.649384231482385));
159 }
REQUIRE(std::filesystem::exists(filename))
OHMMS_PRECISION real_type
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [368/537]

qmcplusplus::TEST_CASE ( "SoA Cartesian Tensor evaluateVGL subset"  ,
""  [numerics] 
)

Definition at line 129 of file test_soa_cartesian_tensor.cpp.

References CHECK(), SoaCartesianTensor< T >::evaluateVGL(), and SoaCartesianTensor< T >::getcXYZ().

130 {
131  SoaCartesianTensor<double> ct(6);
132 
133  double x = 1.3;
134  double y = 1.2;
135  double z = -0.5;
136  ct.evaluateVGL(x, y, z);
137 
138  const double* XYZ = ct.getcXYZ().data(0);
139  const double* gr0 = ct.getcXYZ().data(1);
140  const double* gr1 = ct.getcXYZ().data(2);
141  const double* gr2 = ct.getcXYZ().data(3);
142  const double* lap = ct.getcXYZ().data(4);
143 
144  CHECK(XYZ[0] == Approx(0.282094791774));
145  CHECK(gr0[0] == Approx(0));
146  CHECK(gr1[0] == Approx(0));
147  CHECK(gr2[0] == Approx(0));
148  CHECK(lap[0] == Approx(0));
149 
150  CHECK(XYZ[1] == Approx(0.635183265474));
151  CHECK(gr0[1] == Approx(0.488602511903));
152  CHECK(gr1[1] == Approx(0));
153  CHECK(gr2[1] == Approx(0));
154  CHECK(lap[1] == Approx(0));
155 
156  CHECK(XYZ[8] == Approx(-0.710156479885));
157  CHECK(gr0[8] == Approx(-0.546274215296));
158  CHECK(gr1[8] == Approx(0));
159  CHECK(gr2[8] == Approx(1.42031295977));
160  CHECK(lap[8] == Approx(0));
161 
162  CHECK(XYZ[23] == Approx(5.90305249944));
163  CHECK(gr0[23] == Approx(13.6224288449));
164  CHECK(gr1[23] == Approx(4.9192104162));
165  CHECK(gr2[23] == Approx(0));
166  CHECK(lap[23] == Approx(20.9575828383));
167 
168  CHECK(XYZ[34] == Approx(1.9526074946));
169  CHECK(gr0[34] == Approx(1.50200576508));
170  CHECK(gr1[34] == Approx(1.62717291217));
171  CHECK(gr2[34] == Approx(-7.81042997841));
172  CHECK(lap[34] == Approx(15.6208599568));
173 
174  CHECK(XYZ[50] == Approx(-9.78910512921));
175  CHECK(gr0[50] == Approx(-22.5902426059));
176  CHECK(gr1[50] == Approx(-8.15758760768));
177  CHECK(gr2[50] == Approx(19.5782102584));
178  CHECK(lap[50] == Approx(-34.7542193937));
179 
180  CHECK(XYZ[83] == Approx(12.1418905657));
181  CHECK(gr0[83] == Approx(18.6798316395));
182  CHECK(gr1[83] == Approx(20.2364842761));
183  CHECK(gr2[83] == Approx(-48.5675622627));
184  CHECK(lap[83] == Approx(128.367962683));
185 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [369/537]

qmcplusplus::TEST_CASE ( "Chiesa Force"  ,
""  [hamiltonian] 
)

Definition at line 130 of file test_force.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), check_force_copy(), ParticleSet::create(), ParticleSet::createSK(), ForceChiesaPBCAA::evaluate(), CoulombPBCAA::evaluateWithIonDerivs(), LRCoulombSingleton::EWALD, ForceBase::getForces(), ForceBase::getForcesIonIon(), ParticleSet::getSpeciesSet(), ForceChiesaPBCAA::InitMatrix(), lattice, ForceChiesaPBCAA::makeClone(), ParticleSet::R, REQUIRE(), ParticleSet::resetGroups(), ForceBase::setAddIonIon(), ParticleSet::setName(), LRCoulombSingleton::this_lr_type, and ParticleSet::update().

131 {
132  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
133  lattice.BoxBConds = true; // periodic
134  lattice.R.diagonal(5.0);
135  lattice.LR_dim_cutoff = 25;
136  lattice.reset();
137  LRCoulombSingleton::this_lr_type = LRCoulombSingleton::EWALD;
138 
139  const SimulationCell simulation_cell(lattice);
140  ParticleSet ions(simulation_cell);
141  ParticleSet elec(simulation_cell);
142 
143  ions.setName("ion");
144  ions.create({2});
145  ions.R[0] = {0.0, 0.0, 0.0};
146  ions.R[1] = {2.0, 0.0, 0.0};
147  elec.setName("elec");
148  elec.create({2});
149  elec.R[0] = {0.0, 1.0, 0.0};
150  elec.R[1] = {0.4, 0.3, 0.0};
151  SpeciesSet& tspecies = elec.getSpeciesSet();
152  int upIdx = tspecies.addSpecies("u");
153  int massIdx = tspecies.addAttribute("mass");
154  int eChargeIdx = tspecies.addAttribute("charge");
155  tspecies(eChargeIdx, upIdx) = -1.0;
156  tspecies(massIdx, upIdx) = 1.0;
157 
158  elec.createSK();
159 
160  SpeciesSet& ion_species = ions.getSpeciesSet();
161  int pIdx = ion_species.addSpecies("H");
162  int pChargeIdx = ion_species.addAttribute("charge");
163  ion_species(pChargeIdx, pIdx) = 1;
164  ions.createSK();
165 
166  ions.resetGroups();
167 
168  // The call to resetGroups is needed transfer the SpeciesSet
169  // settings to the ParticleSet
170  elec.resetGroups();
171 
172 
173  ForceChiesaPBCAA force(ions, elec);
174  force.setAddIonIon(false);
175  force.InitMatrix();
176 
177  elec.update();
178  force.evaluate(elec);
179  std::cout << " Force = " << force.getForces() << std::endl;
180  std::cout << " Forces_IonIon = " << force.getForcesIonIon() << std::endl;
181 
182  // Unvalidated externally
183  CHECK(force.getForces()[0][0] == Approx(3.186559306));
184  CHECK(force.getForces()[0][1] == Approx(3.352572459));
185  CHECK(force.getForces()[0][2] == Approx(0.0));
186  CHECK(force.getForcesIonIon()[0][0] == Approx(-0.1478626893));
187  CHECK(force.getForcesIonIon()[0][1] == Approx(0.0));
188  CHECK(force.getForcesIonIon()[0][2] == Approx(0.0));
189  CHECK(force.getForcesIonIon()[1][0] == Approx(0.1478626893));
190  CHECK(force.getForcesIonIon()[1][1] == Approx(0.0));
191  CHECK(force.getForcesIonIon()[1][2] == Approx(0.0));
192 
193  // Let's test CoulombPBCAA and CoulombPBCAB forces, too; Unvalidated externally
194  CoulombPBCAA ionForce(ions, false, true, false);
195  CHECK(ionForce.getForces()[0][0] == Approx(-0.1478626893));
196  CHECK(ionForce.getForces()[1][0] == Approx(0.1478626893));
197 
198  CoulombPBCAB elecIonForce(ions, elec, true);
199  elecIonForce.evaluate(elec); // Not computed upon construction
200  std::cout << " CoulombElecIon = " << elecIonForce.getForces() << std::endl;
201  CHECK(elecIonForce.getForces()[0][0] == Approx(3.186558296));
202  CHECK(elecIonForce.getForces()[0][1] == Approx(3.352572459));
203  CHECK(elecIonForce.getForces()[1][0] == Approx(-0.3950094326));
204  CHECK(elecIonForce.getForces()[1][1] == Approx(0.142639218));
205 
206  // The following crafty test is supposed to crash if some checks are out of place
207  // This imitates an actual simulation, where Nelec ~= Nnuc that would also crash
208 
209  // ParticleSet with 3 ions
210  ParticleSet ions3(simulation_cell);
211  ions3.setName("ion");
212  ions3.create({3});
213  ions3.R[0] = {0, 0, 0};
214  ions3.R[1] = {1, 1, 1};
215  ions3.R[2] = {2, 2, 2};
216  SpeciesSet& ion3_species = ions3.getSpeciesSet();
217  int p3Idx = ion3_species.addSpecies("H");
218  int p3ChargeIdx = ion3_species.addAttribute("charge");
219  ion3_species(p3ChargeIdx, p3Idx) = 1;
220  ions3.createSK();
221  ions3.resetGroups();
222 
223  // Namely, sending in incompatible force arrays to evaluateWithIonDerivs is not
224  // supposed to do harm, IF
225  // 1) forces are not enabled
226  CoulombPBCAA noIonForce(ions3, false, false, false);
227  // 2) The species is active
228  CoulombPBCAA noElecForce(elec, true, true, false);
229 
230  RuntimeOptions runtime_options;
231  TrialWaveFunction psi(runtime_options);
232  // Making local copies here in refactoring attempt to disallow modifying
233  // ForceBase members directly...
234  // Probably fine for a test but if this type of behavior was needed in
235  // production code in the future, a different solution would be needed.
236  auto noElecForces = noElecForce.getForces();
237  noIonForce.evaluateWithIonDerivs(ions3, ions3, psi, noElecForces, noElecForces);
238  auto noIonForces = noIonForce.getForces();
239  noElecForce.evaluateWithIonDerivs(elec, ions3, psi, noIonForces, noIonForces);
240 
241  // It seems a bit silly to test the makeClone method
242  // but this class does not use the compiler's copy constructor and
243  // there was a bug where the add_ion_ion_ member did not get
244  // copied. Would be nice if there were a better way than inspection
245  // to ensure all the members are copied/set up/tested.
246 
247  std::unique_ptr<OperatorBase> base_force2 = force.makeClone(elec, psi);
248  ForceChiesaPBCAA* force2 = dynamic_cast<ForceChiesaPBCAA*>(base_force2.get());
249  REQUIRE(force2 != nullptr);
250 
251  check_force_copy(*force2, force);
252 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
void check_force_copy(ForceChiesaPBCAA &force, ForceChiesaPBCAA &force2)
Definition: test_force.cpp:86
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [370/537]

qmcplusplus::TEST_CASE ( "OutputManager shutoff"  ,
""  [utilities] 
)

Definition at line 131 of file test_output_manager.cpp.

References app_debug, app_error(), app_log(), app_out, app_summary(), debug_out, err_out, init_string_output(), outputManager, REQUIRE(), OutputManagerClass::shutOff(), and summary_out.

132 {
134 
136 
137  app_summary() << "test1";
138  app_log() << "test2";
139  app_error() << "test3";
140  app_debug() << "test4";
141 
142  REQUIRE(summary_out.str() == "");
143  REQUIRE(app_out.str() == "");
144  REQUIRE(err_out.str() == "");
145  REQUIRE(debug_out.str() == "");
146 }
static std::ostringstream app_out
#define app_debug
Definition: OutputManager.h:75
std::ostream & app_log()
Definition: OutputManager.h:65
void shutOff()
Permanently shut off all streams.
std::ostream & app_summary()
Definition: OutputManager.h:63
std::ostream & app_error()
Definition: OutputManager.h:67
static std::ostringstream err_out
OutputManagerClass outputManager(Verbosity::HIGH)
REQUIRE(std::filesystem::exists(filename))
static std::ostringstream summary_out
static std::ostringstream debug_out

◆ TEST_CASE() [371/537]

qmcplusplus::TEST_CASE ( "J1 spin evaluate derivatives multiparticle Jastrow"  ,
""  [wavefunction] 
)

Definition at line 132 of file test_J1Spin.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), OHMMS::Controller, ParticleSet::create(), doc, ParticleSet::G, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), ispecies, ParticleSet::L, log(), okay, Libxml2Document::parseFromString(), ParticleSet::R, VariableSet::removeInactive(), REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), VariableSet::size_of_active(), twf, and ParticleSet::update().

133 {
135 
136  ParticleSetPool ptcl = ParticleSetPool(c);
137  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
138  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
139  ParticleSet& ions_(*ions_uptr);
140  ParticleSet& elec_(*elec_uptr);
141 
142  ions_.setName("ion0");
143  ptcl.addParticleSet(std::move(ions_uptr));
144  ions_.create({2});
145  ions_.R[0] = {-1.0, 0.0, 0.0};
146  ions_.R[1] = {1.0, 0.0, 0.0};
147  SpeciesSet& ispecies = ions_.getSpeciesSet();
148  int BeIdx = ispecies.addSpecies("Be");
149  int ichargeIdx = ispecies.addAttribute("charge");
150  ispecies(ichargeIdx, BeIdx) = 4.0;
151 
152  elec_.setName("e");
153  ptcl.addParticleSet(std::move(elec_uptr));
154  elec_.create({4, 4, 1});
155  elec_.R[0] = {0.5, 0.5, 0.5};
156  elec_.R[1] = {-0.5, 0.5, 0.5};
157  elec_.R[2] = {0.5, -0.5, 0.5};
158  elec_.R[3] = {0.5, 0.5, -0.5};
159  elec_.R[4] = {-0.5, -0.5, 0.5};
160  elec_.R[5] = {0.5, -0.5, -0.5};
161  elec_.R[6] = {-0.5, 0.5, -0.5};
162  elec_.R[7] = {-0.5, -0.5, -0.5};
163  elec_.R[8] = {1.5, 1.5, 1.5};
164 
165  SpeciesSet& tspecies = elec_.getSpeciesSet();
166  int upIdx = tspecies.addSpecies("u");
167  int downIdx = tspecies.addSpecies("d");
168  int posIdx = tspecies.addSpecies("p");
169  int massIdx = tspecies.addAttribute("mass");
170  int chargeIdx = tspecies.addAttribute("charge");
171  tspecies(massIdx, upIdx) = 1.0;
172  tspecies(massIdx, downIdx) = 1.0;
173  tspecies(massIdx, posIdx) = 1.0;
174  tspecies(chargeIdx, upIdx) = -1.0;
175  tspecies(massIdx, downIdx) = -1.0;
176  tspecies(massIdx, posIdx) = 1.0;
177  // Necessary to set mass
178  elec_.resetGroups();
179 
180  ions_.update();
181  elec_.addTable(elec_);
182  elec_.addTable(ions_);
183  elec_.update();
184 
185  const char* jasxml = R"(<wavefunction name="psi0" target="e">
186 <jastrow name="J1" type="One-Body" function="Bspline" print="yes" source="ion0" spin="yes">
187  <correlation speciesA="Be" speciesB="u" cusp="0.0" size="2" rcut="5.0">
188  <coefficients id="J1uH" type="Array"> 0.5 0.1 </coefficients>
189  </correlation>
190  <correlation speciesA="Be" speciesB="d" cusp="0.0" size="2" rcut="5.0">
191  <coefficients id="J1dH" type="Array"> 0.5 0.1 </coefficients>
192  </correlation>
193  <correlation speciesA="Be" speciesB="p" cusp="0.0" size="2" rcut="5.0">
194  <coefficients id="J1pH" type="Array"> 0.5 0.1 </coefficients>
195  </correlation>
196 </jastrow>
197 </wavefunction>
198 )";
200  bool okay = doc.parseFromString(jasxml);
201  REQUIRE(okay);
202  xmlNodePtr jas1 = doc.getRoot();
203  WaveFunctionFactory wf_factory(elec_, ptcl.getPool(), c);
204  RuntimeOptions runtime_options;
205  auto twf_ptr = wf_factory.buildTWF(jas1, runtime_options);
206  auto& twf(*twf_ptr);
207  twf.setMassTerm(elec_);
208  auto& twf_component_list = twf.getOrbitals();
209  auto cloned_j1spin = twf_component_list[0]->makeClone(elec_);
210 
211  opt_variables_type active;
212  twf.checkInVariables(active);
213  active.removeInactive();
214  int nparam = active.size_of_active();
215  REQUIRE(nparam == 6);
216 
217  // check logs
218  //evaluateLog += into G + L so reset
219  elec_.G = 0.0;
220  elec_.L = 0.0;
221  LogValue log = twf_component_list[0]->evaluateLog(elec_, elec_.G, elec_.L);
222  LogValue expected_log{-3.58983, 0.0};
223  CHECK(log == LogComplexApprox(expected_log));
224  //evaluateLog += into G + L so reset
225  elec_.G = 0.0;
226  elec_.L = 0.0;
227  LogValue cloned_log = cloned_j1spin->evaluateLog(elec_, elec_.G, elec_.L);
228  CHECK(cloned_log == LogComplexApprox(expected_log));
229 
230  // check derivatives
231  twf.evaluateLog(elec_);
232  Vector<ValueType> dlogpsi(nparam);
233  Vector<ValueType> dhpsioverpsi(nparam);
234  Vector<ValueType> cloned_dlogpsi(nparam);
235  Vector<ValueType> cloned_dhpsioverpsi(nparam);
236 
237  twf_component_list[0]->evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
238  cloned_j1spin->evaluateDerivatives(elec_, active, cloned_dlogpsi, cloned_dhpsioverpsi);
239  // Numbers not validated
240  std::vector<ValueType> expected_dlogpsi = {-2.544, -4.70578, -2.544, -4.70578, -0.055314, -0.770138};
241  std::vector<ValueType> expected_dhpsioverpsi = {-2.45001, 0.0794429, -2.45001, 0.0794429, 0.0462761, -0.330801};
242  for (int i = 0; i < nparam; i++)
243  {
244  CHECK(dlogpsi[i] == ValueApprox(expected_dlogpsi[i]));
245  CHECK(cloned_dlogpsi[i] == ValueApprox(expected_dlogpsi[i]));
246  CHECK(dhpsioverpsi[i] == ValueApprox(expected_dhpsioverpsi[i]));
247  CHECK(cloned_dhpsioverpsi[i] == ValueApprox(expected_dhpsioverpsi[i]));
248  }
249 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Catch::Detail::LogComplexApprox LogComplexApprox
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::complex< double > LogValue

◆ TEST_CASE() [372/537]

qmcplusplus::TEST_CASE ( "ReadMolecularOrbital GTO He"  ,
""  [wavefunction] 
)

Definition at line 132 of file test_MO.cpp.

References test_He().

132 { test_He(false); }
void test_He(bool transform)
Definition: test_MO.cpp:26

◆ TEST_CASE() [373/537]

qmcplusplus::TEST_CASE ( "ReadFileBuffer_reopen"  ,
""  [hamiltonian] 
)

Definition at line 132 of file test_ecp.cpp.

References ReadFileBuffer::length, ReadFileBuffer::open_file(), ReadFileBuffer::read_contents(), and REQUIRE().

133 {
134  // Initializing with no Communicate pointer under MPI,
135  // this will read the file on every node. Should be okay
136  // for testing purposes.
137  ReadFileBuffer buf(NULL);
138  bool open_okay = buf.open_file("simple.txt");
139  REQUIRE(open_okay == true);
140 
141  bool read_okay = buf.read_contents();
142  REQUIRE(read_okay);
143  REQUIRE(buf.length == 14);
144 
145  open_okay = buf.open_file("C.BFD.xml");
146  REQUIRE(open_okay == true);
147 
148  read_okay = buf.read_contents();
149  REQUIRE(read_okay);
150  REQUIRE(buf.length > 14);
151 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [374/537]

qmcplusplus::TEST_CASE ( "fairDivide_even"  ,
""  [utilities] 
)

Definition at line 132 of file test_partition.cpp.

References fairDivide(), and REQUIRE().

133 {
134  auto out = fairDivide(6, 3);
135  REQUIRE(out.size() == 3);
136  REQUIRE(out[0] == 2);
137  REQUIRE(out[1] == 2);
138  REQUIRE(out[2] == 2);
139 }
REQUIRE(std::filesystem::exists(filename))
std::vector< IV > fairDivide(IV ntot, IV npart)
return the occupation vector for ntot entities partitioned npart ways.
Definition: FairDivide.h:77

◆ TEST_CASE() [375/537]

qmcplusplus::TEST_CASE ( "ParticleSetPool putLattice"  ,
""  [qmcapp] 
)

Definition at line 132 of file test_particle_pool.cpp.

References OHMMS::Controller, doc, Libxml2Document::getRoot(), lattice, okay, Libxml2Document::parseFromString(), ParticleSetPool::readSimulationCellXML(), and REQUIRE().

133 {
134  Communicate* c;
135  c = OHMMS::Controller;
136 
137  ParticleSetPool pp(c);
138 
139  const char* lattice = R"(<parameter name="lattice"> </parameter>)";
140 
143  REQUIRE(okay);
144 
145  xmlNodePtr root = doc.getRoot();
146  pp.readSimulationCellXML(root);
147 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [376/537]

qmcplusplus::TEST_CASE ( "PlaneWave SPO from HDF for LiH arb"  ,
""  [wavefunction] 
)

Definition at line 133 of file test_pw.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), OHMMS::Controller, ParticleSet::create(), SPOSetBuilder::createSPOSet(), doc, Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), imag(), lattice, okay, Libxml2Document::parseFromString(), ParticleSet::R, real(), REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), and ParticleSet::update().

134 {
136 
137  // LiH
138  PtclOnLatticeTraits::ParticleLayout lattice;
139  lattice.R = {-3.55, 0.0, 3.55, 0.0, 3.55, 3.55, -3.55, 3.55, 0.0};
140  lattice.reset();
141 
142  ParticleSetPool ptcl = ParticleSetPool(c);
143  ptcl.setSimulationCell(lattice);
144  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
145  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
146  ParticleSet& ions(*ions_uptr);
147  ParticleSet& elec(*elec_uptr);
148 
149  ions.setName("ion");
150  ptcl.addParticleSet(std::move(ions_uptr));
151  ions.create({2});
152  ions.R[0] = {0.0, 0.0, 0.0};
153  ions.R[1] = {3.55, 3.55, 3.55};
154  std::vector<int> agroup(2);
155  agroup[0] = 2;
156  agroup[1] = 2;
157  elec.create(agroup);
158 
159  elec.setName("elec");
160  ptcl.addParticleSet(std::move(elec_uptr));
161  elec.R[0] = {0.0, 0.0, 0.0};
162  elec.R[1] = {0.0, 1.0, 0.0};
163  elec.R[2] = {0.0, 0.0, 1.0};
164  elec.R[3] = {0.0, 1.0, 1.0};
165  SpeciesSet& tspecies = elec.getSpeciesSet();
166  int upIdx = tspecies.addSpecies("u");
167  int downIdx = tspecies.addSpecies("d");
168  int chargeIdx = tspecies.addAttribute("charge");
169  tspecies(chargeIdx, upIdx) = -1;
170  tspecies(chargeIdx, downIdx) = -1;
171 
172  elec.addTable(ions);
173  elec.resetGroups();
174  elec.update();
175 
176  //diamondC_1x1x1
177  const char* particles = R"(
178 <sposet_collection type="PW" href="LiH-arb.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion">
179  <sposet name="updet" size="2" spindataset="0">
180  <occupation mode="ground"/>
181  </sposet>
182 </sposet_collection>
183 )";
184 
186  bool okay = doc.parseFromString(particles);
187  REQUIRE(okay);
188 
189  xmlNodePtr root = doc.getRoot();
190  xmlNodePtr pw1 = xmlFirstElementChild(root);
191 
192 
193  PWOrbitalSetBuilder pw_builder(elec, c, root);
194  auto spo = pw_builder.createSPOSet(pw1);
195  REQUIRE(spo);
196 
197  const int orbSize = spo->getOrbitalSetSize();
198  elec.update();
199  SPOSet::ValueVector orbs(orbSize);
200  spo->evaluateValue(elec, 0, orbs);
201 
202  CHECK(std::real(orbs[0]) == Approx(-14.3744302974));
203 
204 #if 0
205  // Dump values of the orbitals
206  int basisSize= spo->getBasisSetSize();
207  printf("orb size = %d basis set size = %d\n",orbSize, basisSize);
208 
209  elec.R[1][1] = 0.0;
210  double step = 3.55/10;
211  FILE *fspo = fopen("spo.dat", "w");
212  for (int ix = 0; ix < 10; ix++) {
213  for (int iy = 0; iy < 10; iy++) {
214  for (int iz = 0; iz < 10; iz++) {
215  double x = step*ix;
216  double y = step*iy;
217  double z = step*iz;
218  elec.R[0] = {x, y, z};
219  elec.update();
220  SPOSet::ValueVector orbs(orbSize);
221  spo->evaluateValue(elec, 0, orbs);
222  fprintf(fspo, "%g %g %g",x,y,z);
223  for (int j = 0; j < orbSize; j++) {
224 #ifdef QMC_COMPLEX
225  fprintf(fspo, " %g,%g ",orbs[j].real(),orbs[j].imag());
226 #else
227  fprintf(fspo, " %g ",orbs[j]);
228 #endif
229  }
230  fprintf(fspo, "\n");
231  }
232  }
233  }
234  fclose(fspo);
235 #endif
236 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [377/537]

qmcplusplus::TEST_CASE ( "ReadMolecularOrbital Numerical He"  ,
""  [wavefunction] 
)

Definition at line 134 of file test_MO.cpp.

References test_He().

134 { test_He(true); }
void test_He(bool transform)
Definition: test_MO.cpp:26

◆ TEST_CASE() [378/537]

qmcplusplus::TEST_CASE ( "DiracMatrixComputeCUDA_complex_determinants_against_legacy"  ,
""  [wavefunction][fermion] 
)

Definition at line 134 of file test_DiracMatrixComputeCUDA.cpp.

References check_matrix_result, CHECKED_ELSE(), checkMatrix(), DiracMatrix< T_FP >::invert_transpose(), log_values(), qmcplusplus::testing::makeRngSpdMatrix(), DiracMatrixComputeCUDA< VALUE_FP >::mw_invertTranspose(), n, queue, and Matrix< T, Alloc >::resize().

135 {
136  int n = 64;
137  compute::Queue<PlatformKind::CUDA> queue;
138 
139  DiracMatrixComputeCUDA<std::complex<double>> dmcc;
140 
141  Matrix<std::complex<double>> mat_spd;
142  mat_spd.resize(n, n);
143  testing::MakeRngSpdMatrix<std::complex<double>> makeRngSpdMatrix;
144  makeRngSpdMatrix(mat_spd);
145  // You would hope you could do this
146  // OffloadPinnedMatrix<double> mat_a(mat_spd);
147  // But you can't
148  OffloadPinnedMatrix<std::complex<double>> mat_a(n, n);
149  for (int i = 0; i < n; ++i)
150  for (int j = 0; j < n; ++j)
151  mat_a(i, j) = mat_spd(i, j);
152 
153  Matrix<std::complex<double>> mat_spd2;
154  mat_spd2.resize(n, n);
155  makeRngSpdMatrix(mat_spd2);
156  // You would hope you could do this
157  // OffloadPinnedMatrix<double> mat_a(mat_spd);
158  // But you can't
159  OffloadPinnedMatrix<std::complex<double>> mat_a2(n, n);
160  for (int i = 0; i < n; ++i)
161  for (int j = 0; j < n; ++j)
162  mat_a2(i, j) = mat_spd2(i, j);
163 
164  OffloadPinnedVector<std::complex<double>> log_values;
165  log_values.resize(2);
166  OffloadPinnedMatrix<std::complex<double>> inv_mat_a;
167  inv_mat_a.resize(n, n);
168  OffloadPinnedMatrix<std::complex<double>> inv_mat_a2;
169  inv_mat_a2.resize(n, n);
170 
171  RefVector<const OffloadPinnedMatrix<std::complex<double>>> a_mats{mat_a, mat_a2};
172  RefVector<OffloadPinnedMatrix<std::complex<double>>> inv_a_mats{inv_mat_a, inv_mat_a2};
173 
174  dmcc.mw_invertTranspose(queue, a_mats, inv_a_mats, log_values);
175 
176  DiracMatrix<std::complex<double>> dmat;
177  Matrix<std::complex<double>> inv_mat_test(n, n);
178  std::complex<double> det_log_value;
179  dmat.invert_transpose(mat_spd, inv_mat_test, det_log_value);
180 
181  auto check_matrix_result = checkMatrix(inv_mat_a, inv_mat_test);
182  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
183 
184  dmat.invert_transpose(mat_spd2, inv_mat_test, det_log_value);
185  check_matrix_result = checkMatrix(inv_mat_a2, inv_mat_test);
186  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
187 }
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
void makeRngSpdMatrix(testing::RandomForTest< RngValueType< T >> &rng, Matrix< T > &mat_spd)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63

◆ TEST_CASE() [379/537]

qmcplusplus::TEST_CASE ( "DiracMatrix_inverse_matching_2"  ,
""  [wavefunction][fermion] 
)

Definition at line 137 of file test_DiracMatrix.cpp.

References CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), Matrix< T, Alloc >::cols(), Matrix< T, Alloc >::data(), DiracMatrix< T_FP >::invert_transpose(), lu, lu_mat(), Matrix< T, Alloc >::resize(), Matrix< T, Alloc >::rows(), qmcplusplus::simd::transpose(), and Xgetrf().

138 {
139  DiracMatrix<double> dm;
140 
141  Matrix<double> a, a_T, a_inv;
142  LogValue log_value;
143  a.resize(4, 4);
144  a_T.resize(4, 4);
145  a_inv.resize(4, 4);
146 
147  a(0, 0) = 6;
148  a(0, 1) = 2;
149  a(0, 2) = 8;
150  a(0, 3) = 3;
151  a(1, 0) = 5;
152  a(1, 1) = 2;
153  a(1, 2) = 2;
154  a(1, 3) = 8;
155  a(2, 0) = 7;
156  a(2, 1) = 5;
157  a(2, 2) = 6;
158  a(2, 3) = 6;
159  a(3, 0) = 5;
160  a(3, 1) = 4;
161  a(3, 2) = 4;
162  a(3, 3) = 8;
163 
164  // lets check Xgetrf against the cuBLAS batched
165 
166  simd::transpose(a.data(), a.rows(), a.cols(), a_T.data(), a_T.rows(), a_T.cols());
167  int pivot[4]{-1, -1, -1, -1};
168  int status = Xgetrf(a_T.rows(), a_T.cols(), a_T.data(), a_T.cols(), pivot);
169  std::vector<double> lu{7.0,
170  0.8571428571428571,
171  0.7142857142857142,
172  0.7142857142857142,
173  5.0,
174  -2.2857142857142856,
175  0.6874999999999998,
176  -0.18750000000000022,
177  6.0,
178  2.8571428571428577,
179  -4.249999999999999,
180  -0.05882352941176502,
181  6.0,
182  -2.1428571428571423,
183  5.1875,
184  3.617647058823531};
185 
186  Matrix<double> lu_mat(lu.data(), 4, 4);
188  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
189 
190  dm.invert_transpose(a, a_inv, log_value);
191  CHECK(log_value == LogComplexApprox(std::complex<double>{5.50533, 6.28319}));
192 
193  Matrix<std::complex<double>> inv_M;
194  inv_M.resize(4, 4);
195  inv_M(0, 0) = -0.0650406504065041;
196  inv_M(0, 1) = -0.2113821138211382;
197  inv_M(0, 2) = 0.2113821138211382;
198  inv_M(0, 3) = 0.04065040650406502;
199  inv_M(1, 0) = 0.3739837398373983;
200 
201  inv_M(1, 1) = -0.28455284552845533;
202  inv_M(1, 2) = -0.21544715447154467;
203  inv_M(1, 3) = 0.016260162601626094;
204  inv_M(2, 0) = 0.3902439024390243;
205  inv_M(2, 1) = 0.2682926829268292;
206  inv_M(2, 2) = -0.2682926829268292;
207  inv_M(2, 3) = -0.24390243902439013;
208  inv_M(3, 0) = -0.6422764227642275;
209  inv_M(3, 1) = 0.1626016260162603;
210  inv_M(3, 2) = 0.33739837398373973;
211  inv_M(3, 3) = 0.2764227642276421;
212 
213  check_matrix_result = checkMatrix(inv_M, a_inv);
214  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
215 }
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
int Xgetrf(int n, int m, float *restrict a, int lda, int *restrict piv)
wrappers around xgetrf lapack routines
Definition: DiracMatrix.h:31
Catch::Detail::LogComplexApprox LogComplexApprox
AntiSymTensor< T, D > transpose(const AntiSymTensor< T, D > &rhs)
testing::MatrixAccessor< double > lu_mat(lu.data(), 4, 4)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::vector< StdComp, CUDAHostAllocator< StdComp > > lu
std::complex< double > LogValue

◆ TEST_CASE() [380/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A Ewald2D honeycomb"  ,
""  [hamiltonian] 
)

Definition at line 137 of file test_ewald2d.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), dot(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, ParticleSet::setName(), sqrt(), LRCoulombSingleton::STRICT2D, LRCoulombSingleton::this_lr_type, and ParticleSet::update().

138 {
139  LRCoulombSingleton::CoulombHandler = 0; // !!!! crucial if not first test
140  LRCoulombSingleton::this_lr_type = LRCoulombSingleton::STRICT2D;
141  const double vmad_hon = -1.510964233;
142  const double alat = std::sqrt(2.0*M_PI/std::sqrt(3));
143 
144  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
145  lattice.BoxBConds = true; // periodic
146  lattice.ndim = 2;
147  lattice.R = 0.0;
148  lattice.R(0, 0) = alat;
149  lattice.R(1, 0) = -1.0/2*alat;
150  lattice.R(1, 1) = std::sqrt(3)/2*alat;
151  lattice.R(2, 2) = 2*alat;
152  lattice.LR_dim_cutoff = 30.0;
153  lattice.reset();
154 
155  const SimulationCell simulation_cell(lattice);
156  ParticleSet elec(simulation_cell);
157  elec.setName("e");
158  const int npart = 2;
159  elec.create({npart});
160  // initialize fractional coordinates
161  elec.R[0] = {0.0, 0.0, 0.0};
162  elec.R[1] = {2./3, 1./3, 0.0};
163  // convert to Cartesian coordinates
164  for (int i=0;i<npart;i++)
165  elec.R[i] = dot(elec.R[i], lattice.R);
166 
167  SpeciesSet& tspecies = elec.getSpeciesSet();
168  int upIdx = tspecies.addSpecies("u");
169  int chargeIdx = tspecies.addAttribute("charge");
170  int massIdx = tspecies.addAttribute("mass");
171  tspecies(chargeIdx, upIdx) = -1;
172  tspecies(massIdx, upIdx) = 1.0;
173 
174  elec.createSK();
175  elec.addTable(elec); // !!!! crucial with more than 1 particle
176  elec.update();
177 
178  CoulombPBCAA caa = CoulombPBCAA(elec, true, false, false);
179 
180  double val = caa.evaluate(elec);
181  CHECK(val/npart == Approx(vmad_hon));
182 }
T dot(T *a, T *b)
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [381/537]

qmcplusplus::TEST_CASE ( "EstimatorManagerNew adhoc addVector operator"  ,
""  [estimators] 
)

Definition at line 137 of file test_EstimatorManagerNew.cpp.

References REQUIRE().

138 {
139  int num_scalars = 3;
140  std::vector<double> vec_a{1.0, 2.0, 3.0};
141  std::vector<double> vec_b{2.0, 3.0, 4.0};
142  std::vector<std::vector<double>> est{vec_a, vec_b};
143  auto addVectors = [](const auto& vec_a, const auto& vec_b) {
144  std::vector<ScalarEstimatorBase::RealType> result_vector(vec_a.size(), 0.0);
145  for (int i = 0; i < vec_a.size(); ++i)
146  result_vector[i] = vec_a[i] + vec_b[i];
147  return result_vector;
148  };
149 
150  std::vector<double> reduced_scalars(num_scalars);
151  reduced_scalars = std::accumulate(est.begin(), est.end(), std::vector<double>(num_scalars, 0.0), addVectors);
152  std::vector<double> correct{3.0, 5.0, 7.0};
153  REQUIRE(reduced_scalars == correct);
154 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [382/537]

qmcplusplus::TEST_CASE ( "QMCDriverFactory create DMC driver"  ,
""  [qmcapp] 
)

Definition at line 138 of file test_QMCDriverFactory.cpp.

References CHECK(), comm, OHMMS::Controller, qmcplusplus::testing::createDriver(), DMC, doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), QMCDriverFactory::DriverAssemblyState::new_run_type, node, okay, Libxml2Document::parseFromString(), QMCDriverFactory::readSection(), REQUIRE(), test_project, qmcplusplus::testing::valid_dmc_input_dmc_index, and qmcplusplus::testing::valid_dmc_input_sections.

139 {
140  using namespace testing;
141  Communicate* comm;
143 
144  ProjectData test_project;
145  QMCDriverFactory driver_factory(test_project);
146 
149  REQUIRE(okay);
150  xmlNodePtr node = doc.getRoot();
151  QMCDriverFactory::DriverAssemblyState das = driver_factory.readSection(node);
152  REQUIRE(das.new_run_type == QMCRunType::DMC);
153 
154  auto qmc_driver = testing::createDriver(test_project.getRuntimeOptions(), comm, driver_factory, node, das);
155 
156  REQUIRE(qmc_driver != nullptr);
157  REQUIRE_THROWS(dynamic_cast<DMCBatched&>(*qmc_driver));
158  REQUIRE_NOTHROW(dynamic_cast<DMC&>(*qmc_driver));
159  CHECK(qmc_driver->getEngineName() == "DMC");
160 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
constexpr int valid_dmc_input_dmc_index
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
constexpr std::array< const char *, 3 > valid_dmc_input_sections
auto createDriver(const RuntimeOptions &runtime_options, Communicate *comm, QMCDriverFactory &driver_factory, xmlNodePtr node, QMCDriverFactory::DriverAssemblyState &das)

◆ TEST_CASE() [383/537]

qmcplusplus::TEST_CASE ( "getwords"  ,
""  [utilities] 
)

Definition at line 138 of file test_parser.cpp.

References getwords(), and REQUIRE().

139 {
140  ParseCaseVector_t tlist = {
141  // Input string, list of expected tokens, extra split characters
142  {"one\n", {"one"}},
143  {"one,two\n", {"one", "two"}},
144  {"one|two\n", {"one|two"}},
145  {"a|b\n", {"a", "b"}, "|"},
146  };
147 
148  for (auto& tc : tlist)
149  {
150  SECTION(string("Parsing input: ") + tc.input)
151  {
152  vector<string> outlist;
153  std::istringstream input(tc.input);
154  int num = getwords(outlist, input, 0, tc.extra_split);
155  REQUIRE(num == tc.output.size());
156  REQUIRE(outlist.size() == tc.output.size());
157  for (int i = 0; i < tc.output.size(); i++)
158  {
159  REQUIRE(outlist[i] == tc.output[i]);
160  }
161  }
162  }
163 }
vector< ParseCase > ParseCaseVector_t
Definition: test_parser.cpp:47
REQUIRE(std::filesystem::exists(filename))
testing::ValidSpinDensityInput input
int getwords(std::vector< std::string > &slist, std::istream &fp, std::string &aline)

◆ TEST_CASE() [384/537]

qmcplusplus::TEST_CASE ( "MCPopulation::redistributeWalkers"  ,
""  [particle][population] 
)

Definition at line 139 of file test_MCPopulation.cpp.

References comm, OHMMS::Controller, MCPopulation::createWalkers(), hamiltonian_pool, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), MinimalHamiltonianPool::make_hamWithEE(), particle_pool, Communicate::rank(), REQUIRE(), qmcplusplus::hdf::walkers, and wavefunction_pool.

140 {
141  using namespace testing;
142 
143  RuntimeOptions runtime_options;
145 
146  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
147  auto wavefunction_pool = MinimalWaveFunctionPool::make_diamondC_1x1x1(runtime_options, comm, particle_pool);
148  auto hamiltonian_pool = MinimalHamiltonianPool::make_hamWithEE(comm, particle_pool, wavefunction_pool);
149  WalkerConfigurations walker_confs;
150  MCPopulation population(1, comm->rank(), particle_pool.getParticleSet("e"), wavefunction_pool.getPrimary(),
151  hamiltonian_pool.getPrimary());
152 
153  population.createWalkers(8, walker_confs);
154  REQUIRE(population.get_walkers().size() == 8);
155 
156  std::vector<std::unique_ptr<WalkerConsumer>> walker_consumers(2);
157  std::for_each(walker_consumers.begin(), walker_consumers.end(),
158  [](std::unique_ptr<WalkerConsumer>& wc) { wc.reset(new WalkerConsumer()); });
159  population.redistributeWalkers(walker_consumers);
160 
161  REQUIRE((*walker_consumers[0]).walkers.size() == 4);
162 
163  std::vector<std::unique_ptr<WalkerConsumer>> walker_consumers_incommensurate(3);
164  std::for_each(walker_consumers_incommensurate.begin(), walker_consumers_incommensurate.end(),
165  [](std::unique_ptr<WalkerConsumer>& wc) { wc.reset(new WalkerConsumer()); });
166 
167  population.redistributeWalkers(walker_consumers_incommensurate);
168  REQUIRE((*walker_consumers_incommensurate[0]).walkers.size() == 3);
169  REQUIRE((*walker_consumers_incommensurate[2]).walkers.size() == 2);
170 }
int rank() const
return the rank
Definition: Communicate.h:116
const char walkers[]
Definition: HDFVersion.h:36
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [385/537]

qmcplusplus::TEST_CASE ( "DiracDeterminant_first"  ,
""  [wavefunction][fermion] 
)

Definition at line 142 of file test_DiracDeterminant.cpp.

References ACCEL, and HOST.

143 {
144  test_DiracDeterminant_first<DiracDeterminant<>>(DetMatInvertor::HOST);
145  test_DiracDeterminant_first<DiracDeterminant<>>(DetMatInvertor::ACCEL);
146 #if defined(ENABLE_CUDA)
147  test_DiracDeterminant_first<DiracDeterminant<DelayedUpdateCUDA<ValueType, QMCTraits::QTFull::ValueType>>>(
148  DetMatInvertor::HOST);
149  test_DiracDeterminant_first<DiracDeterminant<DelayedUpdateCUDA<ValueType, QMCTraits::QTFull::ValueType>>>(
150  DetMatInvertor::ACCEL);
151 #elif defined(ENABLE_SYCL)
152  test_DiracDeterminant_first<DiracDeterminant<DelayedUpdateSYCL<ValueType, QMCTraits::QTFull::ValueType>>>(
153  DetMatInvertor::HOST);
154 #endif
155 }

◆ TEST_CASE() [386/537]

qmcplusplus::TEST_CASE ( "read_dynamic_spin_eset_xml"  ,
""  [particle_io][xml] 
)

Definition at line 142 of file test_xml_io.cpp.

References CHECK(), doc, OhmmsElementBase::getName(), Libxml2Document::getRoot(), ParticleSet::groups(), okay, Libxml2Document::parseFromString(), ParticleSet::R, XMLParticleParser::readXML(), REQUIRE(), Vector< T, Alloc >::size(), and ParticleSet::spins.

143 {
144  const char* particles = R"(<tmp>
145 <particleset name="e">
146  <group name="e" size="3">
147  <parameter name="charge">-1</parameter>
148  <attrib name="position" datatype="posArray">
149  -0.28 0.0225 -2.709
150  -1.28 1.0225 -1.709
151  -2.28 2.0225 -0.709
152  </attrib>
153  <attrib name="spins" datatype="scalarArray">
154  1.0
155  0.2
156  3.0
157  </attrib>
158  </group>
159 </particleset>
160 </tmp>
161 )";
163  bool okay = doc.parseFromString(particles);
164  REQUIRE(okay);
165 
166  xmlNodePtr root = doc.getRoot();
167 
168  xmlNodePtr part1 = xmlFirstElementChild(root);
169 
170  const SimulationCell simulation_cell;
171  ParticleSet electrons(simulation_cell);
172 
173  XMLParticleParser parse_electrons(electrons);
174  parse_electrons.readXML(part1);
175 
176  REQUIRE(electrons.groups() == 1);
177 
178  REQUIRE(electrons.R.size() == 3);
179 
180  CHECK(electrons.R[0][0] == Approx(-0.28));
181  CHECK(electrons.R[0][1] == Approx(0.0225));
182  CHECK(electrons.R[0][2] == Approx(-2.709));
183 
184  CHECK(electrons.R[1][0] == Approx(-1.28));
185  CHECK(electrons.R[1][1] == Approx(1.0225));
186  CHECK(electrons.R[1][2] == Approx(-1.709));
187 
188  CHECK(electrons.R[2][0] == Approx(-2.28));
189  CHECK(electrons.R[2][1] == Approx(2.0225));
190  CHECK(electrons.R[2][2] == Approx(-0.709));
191 
192  CHECK(electrons.spins[0] == Approx(1.0));
193  CHECK(electrons.spins[1] == Approx(0.2));
194  CHECK(electrons.spins[2] == Approx(3.0));
195 
196  REQUIRE(electrons.getName() == "e");
197 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [387/537]

qmcplusplus::TEST_CASE ( "EstimatorManagerInput::MergeConstructor"  ,
""  [estimators] 
)

Definition at line 143 of file test_EstimatorManagerInput.cpp.

References CHECK(), qmcplusplus::testing::createEstimatorManagerNewGlobalInputXML(), qmcplusplus::testing::createEstimatorManagerNewInputXML(), estimators_doc, and Libxml2Document::getRoot().

144 {
145  using namespace testing;
148  EstimatorManagerInput emi_global(global_estimators_doc.getRoot());
149  EstimatorManagerInput emi_local(estimators_doc.getRoot());
150  EstimatorManagerInput emi_merged{emi_global, emi_local};
151 
152  CHECK(emi_merged.get_estimator_inputs().size() == 2);
153  CHECK(emi_merged.get_scalar_estimator_inputs().size() == 6);
154 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
Libxml2Document createEstimatorManagerNewInputXML()
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Libxml2Document createEstimatorManagerNewGlobalInputXML()
Libxml2Document estimators_doc
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [388/537]

qmcplusplus::TEST_CASE ( "SpaceGrid::CYLINDRICAL"  ,
""  [estimators] 
)

Definition at line 144 of file test_NESpaceGrid.cpp.

References CHECK(), comm, OHMMS::Controller, OHMMS_DIM, SpaceGridEnv< VALID >::ref_points_, and SpaceGridEnv< VALID >::sgi_.

145 {
146  using Input = testing::ValidSpaceGridInput;
147  Communicate* comm;
149 
150  testing::SpaceGridEnv<Input::valid::CYLINDRICAL> sge(comm);
151 
152  // EnergyDensityEstimator gets this from an enum giving indexes into each offset of SOA buffer.
153  // It is a smell.
154  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), 1, false);
155 
156  using NES = testing::NESpaceGridTests<double>;
157  auto buffer_start = NES::getBufferStart(space_grid);
158  auto buffer_end = NES::getBufferEnd(space_grid);
159  space_grid.write_description(std::cout, std::string(""));
160  auto& sgi = *(sge.sgi_);
161  auto& agr = sgi.get_axis_grids();
162  for (int id = 0; id < OHMMS_DIM; ++id)
163  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
164 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
#define OHMMS_DIM
Definition: config.h:64
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [389/537]

qmcplusplus::TEST_CASE ( "ompBLAS gemm"  ,
""  [OMP] 
)

Definition at line 146 of file test_ompBLAS.cpp.

References qmcplusplus::Units::energy::K, and qmcplusplus::Units::force::N.

147 {
148  const int M = 37;
149  const int N = 71;
150  const int K = 23;
151 
152  // Non-batched test
153  std::cout << "Testing NN gemm" << std::endl;
154  test_gemm<float>(M, N, K, 'N', 'N');
155  test_gemm<double>(M, N, K, 'N', 'N');
156 #if defined(QMC_COMPLEX)
157  test_gemm<std::complex<float>>(N, M, K, 'N', 'N');
158  test_gemm<std::complex<double>>(N, M, K, 'N', 'N');
159 #endif
160  std::cout << "Testing NT gemm" << std::endl;
161  test_gemm<float>(M, N, K, 'N', 'T');
162  test_gemm<double>(M, N, K, 'N', 'T');
163 #if defined(QMC_COMPLEX)
164  test_gemm<std::complex<float>>(N, M, K, 'N', 'T');
165  test_gemm<std::complex<double>>(N, M, K, 'N', 'T');
166 #endif
167  std::cout << "Testing TN gemm" << std::endl;
168  test_gemm<float>(M, N, K, 'T', 'N');
169  test_gemm<double>(M, N, K, 'T', 'N');
170 #if defined(QMC_COMPLEX)
171  test_gemm<std::complex<float>>(N, M, K, 'T', 'N');
172  test_gemm<std::complex<double>>(N, M, K, 'T', 'N');
173 #endif
174  std::cout << "Testing TT gemm" << std::endl;
175  test_gemm<float>(M, N, K, 'T', 'T');
176  test_gemm<double>(M, N, K, 'T', 'T');
177 #if defined(QMC_COMPLEX)
178  test_gemm<std::complex<float>>(N, M, K, 'T', 'T');
179  test_gemm<std::complex<double>>(N, M, K, 'T', 'T');
180 #endif
181 }

◆ TEST_CASE() [390/537]

qmcplusplus::TEST_CASE ( "TwoBodyJastrow variables fail"  ,
""  [wavefunction] 
)

Definition at line 149 of file test_J2_derivatives.cpp.

References TwoBodyJastrow< FT >::addFunc(), CHECK(), TwoBodyJastrow< FT >::checkOutVariables(), TwoBodyJastrow< FT >::evaluateDerivatives(), TwoBodyJastrow< FT >::evaluateDerivativesWF(), get_two_species_particleset(), TwoBodyJastrow< FT >::getComponentOffset(), VariableSet::insertFrom(), VariableSet::resetIndex(), and VariableSet::size_of_active().

150 {
151  const SimulationCell simulation_cell;
152  ParticleSet elec = get_two_species_particleset(simulation_cell);
153 
154  TwoBodyJastrow<FakeJasFunctor> jorb("J2_fake", elec, false);
155 
156  auto j2a_uptr = std::make_unique<FakeJasFunctor>("test_fake_a");
157  auto& j2a = *j2a_uptr;
158  j2a.myVars.insert("opt1", 1.0);
159  // update num_active_vars
160  j2a.myVars.resetIndex();
161  jorb.addFunc(0, 0, std::move(j2a_uptr));
162 
163  auto j2b_uptr = std::make_unique<FakeJasFunctor>("test_fake_b");
164  auto& j2b = *j2b_uptr;
165  j2b.myVars.insert("opt2", 2.0);
166  // update num_active_vars
167  j2b.myVars.resetIndex();
168  jorb.addFunc(0, 1, std::move(j2b_uptr));
169 
170  opt_variables_type global_active;
171  global_active.insertFrom(j2b.myVars);
172  global_active.resetIndex();
173 
174 
175  jorb.checkOutVariables(global_active);
176 
177  CHECK(global_active.size_of_active() == 1);
178  // Not optimizing the parameter in this Jastrow factor, indicated by first index is -1
179  auto o1 = jorb.getComponentOffset(0);
180  CHECK(o1.first == -1);
181 
182  // Offset into set of active variables (global_active)
183  auto o2 = jorb.getComponentOffset(1);
184  CHECK(o2.first == 0);
185  CHECK(o2.second == 1);
186 
187  auto o3 = jorb.getComponentOffset(2);
188  CHECK(o3.first == 0);
189  CHECK(o3.second == 1);
190 
191  auto o4 = jorb.getComponentOffset(3);
192  CHECK(o4.first == -1);
193 
195 
196  // Check derivative indexing
197  int num_vars = 1;
198  j2b.derivs_.resize(num_vars);
199  // Elements are d/dp_i u(r), d/dp_i du/dr, d/dp_i d2u/dr2
200  j2b.derivs_[0] = {0.5, 1.3, 2.4};
201  Vector<ValueType> dlogpsi(num_vars);
202  jorb.evaluateDerivativesWF(elec, global_active, dlogpsi);
203 
204  CHECK(dlogpsi[0] == ValueApprox(-2.0)); // 4 * derivs_[0][0]
205 
206  Vector<ValueType> dlogpsi2(num_vars);
207  Vector<ValueType> dhpsioverpsi(num_vars);
208 
209  jorb.evaluateDerivatives(elec, global_active, dlogpsi2, dhpsioverpsi);
210  CHECK(dlogpsi2[0] == ValueApprox(-2.0));
211 }
ParticleSet get_two_species_particleset(const SimulationCell &simulation_cell)
optimize::VariableSet opt_variables_type
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType
void insertFrom(const VariableSet &input)
insert a VariableSet to the list
Definition: VariableSet.cpp:37

◆ TEST_CASE() [391/537]

qmcplusplus::TEST_CASE ( "test_timer_nested_profile"  ,
""  [utilities] 
)

Definition at line 150 of file test_timer.cpp.

References CHECK(), TimerManager< TIMER >::collate_flat_profile(), TimerManager< TIMER >::collate_stack_profile(), convert_to_ns(), convert_to_s(), TimerManager< TIMER >::createTimer(), TimerManager< TIMER >::FlatProfileData::nameList, TimerManager< TIMER >::StackProfileData::nameList, REQUIRE(), qmcplusplus::Units::time::s, TimerManager< TIMER >::set_timer_threshold(), TimerType< CLOCK >::start(), TimerType< CLOCK >::stop(), TimerManager< TIMER >::StackProfileData::timeExclList, TimerManager< TIMER >::FlatProfileData::timeList, TimerManager< TIMER >::StackProfileData::timeList, and timer_level_fine.

151 {
152  FakeTimerManager tm;
153  tm.set_timer_threshold(timer_level_fine);
154  FakeTimer* t1 = tm.createTimer("timer1");
155  FakeTimer* t2 = tm.createTimer("timer2");
156 
157  FakeChronoClock::fake_chrono_clock_increment = convert_to_ns(1.1s);
158  t1->start();
159  t2->start();
160  t2->stop();
161  t1->stop();
162 
163  FakeTimerManager::FlatProfileData p;
164  tm.collate_flat_profile(NULL, p);
165 
166 #ifdef ENABLE_TIMERS
167  REQUIRE(p.nameList.size() == 2);
168  int idx1 = p.nameList.at("timer1");
169  int idx2 = p.nameList.at("timer2");
170  REQUIRE(p.timeList.size() == 2);
171  CHECK(p.timeList[idx1] == Approx(3 * convert_to_s(FakeChronoClock::fake_chrono_clock_increment)));
172  CHECK(p.timeList[idx2] == Approx(convert_to_s(FakeChronoClock::fake_chrono_clock_increment)));
173 #endif
174 
175  FakeTimerManager::StackProfileData p2;
176  tm.collate_stack_profile(NULL, p2);
177 
178 #ifdef ENABLE_TIMERS
179  REQUIRE(p2.nameList.size() == 2);
180  idx1 = p2.nameList.at("timer1");
181  idx2 = p2.nameList.at("timer1/timer2");
182  REQUIRE(p2.timeList.size() == 2);
183  REQUIRE(p2.timeExclList.size() == 2);
184  CHECK(p2.timeList[idx1] == Approx(convert_to_s(3 * FakeChronoClock::fake_chrono_clock_increment)));
185  CHECK(p2.timeList[idx2] == Approx(convert_to_s(FakeChronoClock::fake_chrono_clock_increment)));
186 
187  // Time in t1 minus time inside t2
188  CHECK(p2.timeExclList[idx1] == Approx(2 * convert_to_s(FakeChronoClock::fake_chrono_clock_increment)));
189  CHECK(p2.timeExclList[idx2] == Approx(convert_to_s(FakeChronoClock::fake_chrono_clock_increment)));
190 #endif
191 }
TimerType< FakeChronoClock > FakeTimer
Definition: NewTimer.h:235
FakeChronoClock::duration convert_to_ns(T in)
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
TimerManager< FakeTimer > FakeTimerManager
Definition: test_timer.cpp:23
double convert_to_s(T in)
Definition: test_timer.cpp:46

◆ TEST_CASE() [392/537]

qmcplusplus::TEST_CASE ( "QMCDriverNew test driver operations"  ,
""  [drivers] 
)

Definition at line 150 of file test_QMCDriverNew.cpp.

References ProjectData::BATCH, CHECK(), comm, QMCDriverNew::computeLogGreensFunction(), OHMMS::Controller, doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), hamiltonian_pool, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), MinimalHamiltonianPool::make_hamWithEE(), node, okay, outputManager, Libxml2Document::parseFromString(), particle_pool, OutputManagerClass::pause(), POS, POS_SPIN, Communicate::rank(), QMCDriverInput::readXML(), REQUIRE(), OutputManagerClass::resume(), QMCDriverNew::scaleBySqrtTau(), Communicate::size(), test_project, QMCDriverNewTestWrapper::testDetermineStepsPerBlock(), QMCDriverNewTestWrapper::testMeasureImbalance(), qmcplusplus::testing::valid_vmc_input_sections, qmcplusplus::testing::valid_vmc_input_vmc_tiny_index, and wavefunction_pool.

151 {
152  using namespace testing;
153  Concurrency::OverrideMaxCapacity<> override(8);
154  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
157 
160  REQUIRE(okay);
161  xmlNodePtr node = doc.getRoot();
162 
163  QMCDriverInput qmcdriver_input;
164  qmcdriver_input.readXML(node);
165  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
166  auto wavefunction_pool =
167  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
168 
169  auto hamiltonian_pool = MinimalHamiltonianPool::make_hamWithEE(comm, particle_pool, wavefunction_pool);
170  WalkerConfigurations walker_confs;
171  QMCDriverNewTestWrapper qmcdriver(test_project, std::move(qmcdriver_input), walker_confs,
172  MCPopulation(comm->size(), comm->rank(), particle_pool.getParticleSet("e"),
173  wavefunction_pool.getPrimary(), hamiltonian_pool.getPrimary()),
174  comm);
175 
176 
177  auto tau = 1.0;
178  auto invmass = 0.2;
179  auto spin_mass = 0.5;
180  {
181  TauParams<QMCTraits::RealType, CoordsType::POS> taus(tau, invmass, spin_mass);
182  constexpr auto mct = CoordsType::POS;
183  auto mc_coords = MCCoords<mct>(3);
184  QMCTraits::PosType p1({0.1, 0.2, 0.3});
185  QMCTraits::PosType p2({0.4, 0.5, 0.6});
186  QMCTraits::PosType p3({0.7, 0.8, 0.9});
187  mc_coords.positions = {p1, p2, p3};
188 
189  auto deltas = mc_coords;
190  QMCDriverNew::scaleBySqrtTau(taus, deltas);
191  mc_coords += deltas;
192  CHECK(Approx(mc_coords.positions[0][0]) == 0.14472135955);
193  CHECK(Approx(mc_coords.positions[0][1]) == 0.28944271910);
194  CHECK(Approx(mc_coords.positions[0][2]) == 0.43416407865);
195  CHECK(Approx(mc_coords.positions[1][0]) == 0.57888543820);
196  CHECK(Approx(mc_coords.positions[1][1]) == 0.72360679775);
197  CHECK(Approx(mc_coords.positions[1][2]) == 0.86832815730);
198  CHECK(Approx(mc_coords.positions[2][0]) == 1.01304951685);
199  CHECK(Approx(mc_coords.positions[2][1]) == 1.15777087640);
200  CHECK(Approx(mc_coords.positions[2][2]) == 1.30249223595);
201 
202  std::vector<QMCTraits::RealType> loggf(3), loggb(3);
203 
204  qmcdriver.computeLogGreensFunction(deltas, taus, loggf);
205  CHECK(Approx(loggf[0]) == -0.07);
206  CHECK(Approx(loggf[1]) == -0.385);
207  CHECK(Approx(loggf[2]) == -0.97);
208 
209  qmcdriver.computeLogGreensFunction(mc_coords, taus, loggb);
210  CHECK(Approx(loggb[0]) == -0.733049516850);
211  CHECK(Approx(loggb[1]) == -4.031772342675);
212  CHECK(Approx(loggb[2]) == -10.15797187635);
213  }
214 
215  {
216  TauParams<QMCTraits::RealType, CoordsType::POS_SPIN> taus(tau, invmass, spin_mass);
217  constexpr auto mct = CoordsType::POS_SPIN;
218  auto mc_coords = MCCoords<mct>(3);
219  QMCTraits::PosType p1({-0.1, -0.2, -0.3});
220  QMCTraits::PosType p2({-0.4, -0.5, -0.6});
221  QMCTraits::PosType p3({-0.7, -0.8, -0.9});
222  mc_coords.positions = {p1, p2, p3};
223  mc_coords.spins = {0.1, 0.2, 0.3};
224 
225  auto deltas = mc_coords;
226  QMCDriverNew::scaleBySqrtTau(taus, deltas);
227  mc_coords += deltas;
228  CHECK(Approx(mc_coords.positions[0][0]) == -0.14472135955);
229  CHECK(Approx(mc_coords.positions[0][1]) == -0.28944271910);
230  CHECK(Approx(mc_coords.positions[0][2]) == -0.43416407865);
231  CHECK(Approx(mc_coords.positions[1][0]) == -0.57888543820);
232  CHECK(Approx(mc_coords.positions[1][1]) == -0.72360679775);
233  CHECK(Approx(mc_coords.positions[1][2]) == -0.86832815730);
234  CHECK(Approx(mc_coords.positions[2][0]) == -1.01304951685);
235  CHECK(Approx(mc_coords.positions[2][1]) == -1.15777087640);
236  CHECK(Approx(mc_coords.positions[2][2]) == -1.30249223595);
237 
238  CHECK(Approx(mc_coords.spins[0]) == 0.163245553203);
239  CHECK(Approx(mc_coords.spins[1]) == 0.326491106407);
240  CHECK(Approx(mc_coords.spins[2]) == 0.489736659610);
241 
242  std::vector<QMCTraits::RealType> loggf(3), loggb(3);
243 
244  qmcdriver.computeLogGreensFunction(deltas, taus, loggf);
245  CHECK(Approx(loggf[0]) == -0.075);
246  CHECK(Approx(loggf[1]) == -0.405);
247  CHECK(Approx(loggf[2]) == -1.015);
248 
249  qmcdriver.computeLogGreensFunction(mc_coords, taus, loggb);
250  CHECK(Approx(loggb[0]) == -0.766360905151);
251  CHECK(Approx(loggb[1]) == -4.165017895878);
252  CHECK(Approx(loggb[2]) == -10.457774371057);
253  }
254 
255  {
257  qmcdriver.testMeasureImbalance();
259  }
260 
261  qmcdriver.testDetermineStepsPerBlock();
262 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
void pause()
Pause the summary and log streams.
int rank() const
return the rank
Definition: Communicate.h:116
if(!okay) throw std xmlNodePtr node
constexpr int valid_vmc_input_vmc_tiny_index
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
int size() const
return the number of tasks
Definition: Communicate.h:118
const RuntimeOptions & getRuntimeOptions() const noexcept
OutputManagerClass outputManager(Verbosity::HIGH)
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
void resume()
Resume the summary and log streams.
REQUIRE(std::filesystem::exists(filename))
constexpr std::array< const char *, 4 > valid_vmc_input_sections
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [393/537]

qmcplusplus::TEST_CASE ( "ProjectData::TestIsComplex"  ,
""  [ohmmsapp] 
)

Definition at line 153 of file test_project_data.cpp.

References ProjectData::isComplex(), and REQUIRE().

154 {
155  ProjectData proj;
156 #ifdef QMC_COMPLEX
157  REQUIRE(proj.isComplex());
158 #else
159  REQUIRE(!proj.isComplex());
160 #endif
161 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [394/537]

qmcplusplus::TEST_CASE ( "SlaterDet mw_ APIs"  ,
""  [wavefunction] 
)

Definition at line 153 of file test_SlaterDet.cpp.

References CHECK(), comm, OHMMS::Controller, SlaterDet::createResource(), MinimalParticlePool::make_O2_spinor(), SlaterDet::mw_evalGrad(), SlaterDet::mw_evalGradWithSpin(), SlaterDet::mw_ratioGrad(), SlaterDet::mw_ratioGradWithSpin(), and particle_pool.

154 {
156 
157  auto particle_pool = MinimalParticlePool::make_O2_spinor(comm);
158  auto& elec0 = *(particle_pool).getParticleSet("e");
159  auto& elec1 = *(particle_pool).getParticleSet("e");
160  RefVectorWithLeader<ParticleSet> p_list(elec0, {elec0, elec1});
161 
162  std::unique_ptr<ConstantSPOSet> spo_ptr0 = std::make_unique<ConstantSPOSet>("dummySPO", 3, 3);
163  std::unique_ptr<ConstantSPOSet> spo_ptr1 = std::make_unique<ConstantSPOSet>("dummySPO", 3, 3);
164  //Right now, DiracDeterminantBatched has mw_ WithSpin APIs but DiracDeterminant does not.
165  //We want to add a test to make sure Slater determinant chooses the mw_ implementation if it has it.
166 
167  // First, do without mw_ APIs
168  {
169  std::unique_ptr<DiracDeterminantBase> det_ptr0 =
170  std::make_unique<DummyDiracDetWithoutMW>("dummy", std::move(spo_ptr0), 0, 12);
171  std::unique_ptr<DiracDeterminantBase> det_ptr1 =
172  std::make_unique<DummyDiracDetWithoutMW>("dummy", std::move(spo_ptr1), 0, 12);
173 
174  std::vector<std::unique_ptr<DiracDeterminantBase>> dirac_dets0;
175  dirac_dets0.push_back(std::move(det_ptr0));
176  std::vector<std::unique_ptr<DiracDeterminantBase>> dirac_dets1;
177  dirac_dets1.push_back(std::move(det_ptr1));
178 
179  SlaterDet slaterdet0(elec0, std::move(dirac_dets0));
180  SlaterDet slaterdet1(elec0, std::move(dirac_dets1));
181 
182  RefVectorWithLeader<WaveFunctionComponent> sd_list(slaterdet0, {slaterdet0, slaterdet1});
183  ResourceCollection sd_res("test_sd_res");
184  slaterdet0.createResource(sd_res);
185  ResourceCollectionTeamLock<WaveFunctionComponent> mw_sd_lock(sd_res, sd_list);
186 
187  std::vector<SPOSet::GradType> grads(2);
188  std::vector<WaveFunctionComponent::PsiValue> ratios(2);
189  std::vector<SPOSet::ComplexType> spingrads(2);
190  slaterdet0.mw_evalGrad(sd_list, p_list, 0, grads);
191  for (auto grad : grads)
192  {
193  CHECK(grad[0] == ValueApprox(123.));
194  CHECK(grad[1] == ValueApprox(456.));
195  CHECK(grad[2] == ValueApprox(789.));
196  }
197 
198  slaterdet0.mw_evalGradWithSpin(sd_list, p_list, 0, grads, spingrads);
199  for (auto grad : grads)
200  {
201  CHECK(grad[0] == ValueApprox(0.123));
202  CHECK(grad[1] == ValueApprox(0.456));
203  CHECK(grad[2] == ValueApprox(0.789));
204  }
205  for (auto sgrad : spingrads)
206  CHECK(sgrad == ComplexApprox(SPOSet::ComplexType(0.1, 0.2)));
207 
208  slaterdet0.mw_ratioGrad(sd_list, p_list, 0, ratios, grads);
209  for (auto grad : grads)
210  {
211  CHECK(grad[0] == ValueApprox(123.));
212  CHECK(grad[1] == ValueApprox(456.));
213  CHECK(grad[2] == ValueApprox(789.));
214  }
215 
216  slaterdet0.mw_ratioGradWithSpin(sd_list, p_list, 0, ratios, grads, spingrads);
217  for (auto grad : grads)
218  {
219  CHECK(grad[0] == ValueApprox(0.123));
220  CHECK(grad[1] == ValueApprox(0.456));
221  CHECK(grad[2] == ValueApprox(0.789));
222  }
223  for (auto sgrad : spingrads)
224  CHECK(sgrad == ComplexApprox(SPOSet::ComplexType(0.1, 0.2)));
225  }
226  //Now do with MW
227  {
228  std::unique_ptr<DiracDeterminantBase> det_ptr0 =
229  std::make_unique<DummyDiracDetWithMW>("dummy", std::move(spo_ptr0), 0, 12);
230  std::unique_ptr<DiracDeterminantBase> det_ptr1 =
231  std::make_unique<DummyDiracDetWithMW>("dummy", std::move(spo_ptr1), 0, 12);
232 
233  std::vector<std::unique_ptr<DiracDeterminantBase>> dirac_dets0;
234  dirac_dets0.push_back(std::move(det_ptr0));
235  std::vector<std::unique_ptr<DiracDeterminantBase>> dirac_dets1;
236  dirac_dets1.push_back(std::move(det_ptr1));
237 
238  SlaterDet slaterdet0(elec0, std::move(dirac_dets0));
239  SlaterDet slaterdet1(elec1, std::move(dirac_dets1));
240 
241  RefVectorWithLeader<WaveFunctionComponent> sd_list(slaterdet0, {slaterdet0, slaterdet1});
242 
243  ResourceCollection sd_res("test_sd_res");
244  slaterdet0.createResource(sd_res);
245  ResourceCollectionTeamLock<WaveFunctionComponent> mw_sd_lock(sd_res, sd_list);
246 
247  std::vector<SPOSet::GradType> grads(2);
248  std::vector<WaveFunctionComponent::PsiValue> ratios(2);
249  std::vector<SPOSet::ComplexType> spingrads(2);
250  slaterdet0.mw_evalGrad(sd_list, p_list, 0, grads);
251  for (auto grad : grads)
252  {
253  CHECK(grad[0] == ValueApprox(321.));
254  CHECK(grad[1] == ValueApprox(654.));
255  CHECK(grad[2] == ValueApprox(987.));
256  }
257 
258  slaterdet0.mw_evalGradWithSpin(sd_list, p_list, 0, grads, spingrads);
259  for (auto grad : grads)
260  {
261  CHECK(grad[0] == ValueApprox(0.321));
262  CHECK(grad[1] == ValueApprox(0.654));
263  CHECK(grad[2] == ValueApprox(0.987));
264  }
265  for (auto sgrad : spingrads)
266  CHECK(sgrad == ComplexApprox(SPOSet::ComplexType(0.2, 0.1)));
267 
268  slaterdet0.mw_ratioGrad(sd_list, p_list, 0, ratios, grads);
269  for (auto grad : grads)
270  {
271  CHECK(grad[0] == ValueApprox(321.));
272  CHECK(grad[1] == ValueApprox(654.));
273  CHECK(grad[2] == ValueApprox(987.));
274  }
275 
276  slaterdet0.mw_ratioGradWithSpin(sd_list, p_list, 0, ratios, grads, spingrads);
277  for (auto grad : grads)
278  {
279  CHECK(grad[0] == ValueApprox(0.321));
280  CHECK(grad[1] == ValueApprox(0.654));
281  CHECK(grad[2] == ValueApprox(0.987));
282  }
283  for (auto sgrad : spingrads)
284  CHECK(sgrad == ComplexApprox(SPOSet::ComplexType(0.2, 0.1)));
285  }
286 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
QMCTraits::ComplexType ComplexType

◆ TEST_CASE() [395/537]

qmcplusplus::TEST_CASE ( "CoulombAB::Listener"  ,
""  [hamiltonian] 
)

Definition at line 154 of file test_coulomb_pbcAB.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), Matrix< T, Alloc >::begin(), CHECK(), Matrix< T, Alloc >::cols(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), CoulombPBCAB::createResource(), ParticleSet::createResource(), ParticleSet::createSK(), CoulombPBCAB::evalConsts(), qmcplusplus::testing::getParticularListener(), ParticleSet::getSpeciesSet(), OperatorBase::getValue(), lattice, CoulombPBCAB::mw_evaluatePerParticle(), ParticleSet::mw_update(), ParticleSet::R, ParticleSet::setName(), ParticleSet::turnOnPerParticleSK(), and ParticleSet::update().

155 {
157 
158  LRCoulombSingleton::CoulombHandler = 0;
159 
160  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
161  lattice.BoxBConds = true; // periodic
162  lattice.R.diagonal(3.77945227);
163  lattice.reset();
164 
165  const SimulationCell simulation_cell(lattice);
166 
167  ParticleSet ions(simulation_cell);
168 
169  ions.setName("ion");
170  ions.create({2});
171  ions.R[0] = {0.0, 0.0, 0.0};
172  ions.R[1] = {1.88972614, 1.88972614, 1.88972614};
173  SpeciesSet& ion_species = ions.getSpeciesSet();
174  int pIdx = ion_species.addSpecies("H");
175  int pChargeIdx = ion_species.addAttribute("charge");
176  ion_species(pChargeIdx, pIdx) = 1;
177  ions.createSK();
178  ions.update();
179  ions.turnOnPerParticleSK();
180 
181  ParticleSet ions2(ions);
182  ions2.update();
183 
184  ParticleSet elec(simulation_cell);
185 
186  elec.setName("elec");
187  elec.create({2});
188  elec.R[0] = {0.0, 0.5, 0.0};
189  elec.R[1] = {0.0, 0.5, 0.0};
190  SpeciesSet& tspecies = elec.getSpeciesSet();
191  int upIdx = tspecies.addSpecies("u");
192  int chargeIdx = tspecies.addAttribute("charge");
193  int massIdx = tspecies.addAttribute("mass");
194  tspecies(chargeIdx, upIdx) = -1;
195  tspecies(massIdx, upIdx) = 1.0;
196 
197  elec.createSK();
198  elec.update();
199  elec.turnOnPerParticleSK();
200 
201  ParticleSet elec2(elec);
202 
203  elec2.R[0] = {0.0, 0.5, 0.1};
204  elec2.R[1] = {0.6, 0.05, -0.1};
205  elec2.update();
206 
207  CoulombPBCAB cab(ions, elec, false);
208  CoulombPBCAB cab2(ions2, elec2, false);
209  RefVector<OperatorBase> cabs{cab, cab2};
210  RefVectorWithLeader<OperatorBase> o_list(cab, cabs);
211  // Self-energy correction, no background charge for e-e interaction
212  double consts = cab.evalConsts(elec);
213  CHECK(consts == Approx(0.0267892759 * 4));
214  RefVector<ParticleSet> ptcls{elec, elec2};
215  RefVectorWithLeader<ParticleSet> p_list(elec, ptcls);
216 
217  RefVector<ParticleSet> ion_ptcls{ions, ions2};
218  RefVectorWithLeader<ParticleSet> ion_p_list(ions, ion_ptcls);
219 
220  RuntimeOptions runtime_options;
221  TrialWaveFunction psi(runtime_options);
222  TrialWaveFunction psi_clone(runtime_options);
223  RefVectorWithLeader<TrialWaveFunction> twf_list(psi, {psi, psi_clone});
224 
225  Matrix<Real> local_pots(2);
226  Matrix<Real> local_pots2(2);
227 
228  ResourceCollection cab_res("test_cab_res");
229  cab.createResource(cab_res);
230  ResourceCollectionTeamLock<OperatorBase> cab_lock(cab_res, o_list);
231 
232  ResourceCollection pset_res("test_pset_res");
233  elec.createResource(pset_res);
234  ResourceCollectionTeamLock<ParticleSet> pset_lock(pset_res, p_list);
235 
236  std::vector<ListenerVector<Real>> listeners;
237  listeners.emplace_back("localpotential", getParticularListener(local_pots));
238  listeners.emplace_back("localpotential", getParticularListener(local_pots2));
239 
240  Matrix<Real> ion_pots(2);
241  Matrix<Real> ion_pots2(2);
242 
243  std::vector<ListenerVector<Real>> ion_listeners;
244  ion_listeners.emplace_back("localpotential", getParticularListener(ion_pots));
245  ion_listeners.emplace_back("localpotential", getParticularListener(ion_pots2));
246 
247  ParticleSet::mw_update(p_list);
248  cab.mw_evaluatePerParticle(o_list, twf_list, p_list, listeners, ion_listeners);
249  CHECK(cab.getValue() == Approx(-2.219665062 + 0.0267892759 * 4));
250  CHECK(cab2.getValue() == Approx(-1.7222343352));
251  // Check that the sum of the particle energies == the total
252  Real elec_ion_sum = std::accumulate(local_pots.begin(), local_pots.begin() + local_pots.cols(), 0.0);
253  CHECK(elec_ion_sum == Approx(-1.0562537047));
254  CHECK(elec_ion_sum + std::accumulate(ion_pots.begin(), ion_pots.begin() + ion_pots.cols(), 0.0) ==
255  Approx(-2.219665062 + 0.0267892759 * 4));
256  elec_ion_sum = std::accumulate(local_pots[1], local_pots[1] + local_pots.cols(), 0.0);
257  CHECK(elec_ion_sum == Approx(-0.8611171676));
258  CHECK(elec_ion_sum + std::accumulate(ion_pots[1], ion_pots[1] + ion_pots.cols(), 0.0) == Approx(-1.7222343352));
259 }
ForceBase::Real Real
Definition: ForceBase.cpp:26
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
auto getParticularListener(Matrix< T > &local_pots)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [396/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A BCC"  ,
""  [hamiltonian] 
)

Definition at line 155 of file test_coulomb_pbcAA.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evaluate(), CoulombPBCAA::get_madelung_constant(), ParticleSet::getSpeciesSet(), lattice, ParticleSet::R, ParticleSet::setName(), and ParticleSet::update().

156 {
157  const double alat = 1.0;
158  const double vmad_bcc = -1.819616724754322 / alat;
159  LRCoulombSingleton::CoulombHandler = 0;
160 
161  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
162  lattice.BoxBConds = true; // periodic
163  lattice.R = 0.5 * alat;
164  lattice.R(0, 0) = -0.5 * alat;
165  lattice.R(1, 1) = -0.5 * alat;
166  lattice.R(2, 2) = -0.5 * alat;
167  lattice.reset();
168 
169  const SimulationCell simulation_cell(lattice);
170  ParticleSet elec(simulation_cell);
171 
172  elec.setName("elec");
173  elec.create({1});
174  elec.R[0] = {0.0, 0.0, 0.0};
175 
176  SpeciesSet& tspecies = elec.getSpeciesSet();
177  int upIdx = tspecies.addSpecies("u");
178  int chargeIdx = tspecies.addAttribute("charge");
179  int massIdx = tspecies.addAttribute("mass");
180  tspecies(chargeIdx, upIdx) = -1;
181  tspecies(massIdx, upIdx) = 1.0;
182 
183  elec.createSK();
184  elec.update();
185 
186 
187  CoulombPBCAA caa(elec, true, false, false);
188 
189  double val = caa.evaluate(elec);
190  CHECK(val == Approx(vmad_bcc));
191 
192  val = caa.get_madelung_constant();
193  CHECK(val == Approx(vmad_bcc));
194 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [397/537]

qmcplusplus::TEST_CASE ( "Evaluate_ecp"  ,
""  [hamiltonian] 
)

Definition at line 156 of file test_ecp.cpp.

References SpeciesSet::addAttribute(), TrialWaveFunction::addComponent(), SpeciesSet::addSpecies(), ParticleSet::addTable(), RadialJastrowBuilder::buildComponent(), CHECK(), TrialWaveFunction::checkInVariables(), TrialWaveFunction::checkOutVariables(), OHMMS::Controller, copyGridUnrotatedForTest(), ParticleSet::create(), ParticleSet::createSK(), NonLocalECPComponent::deleteVirtualParticle(), doc, qmcplusplus::Units::charge::e, TrialWaveFunction::evaluateDerivatives(), TrialWaveFunction::evaluateLog(), NonLocalECPComponent::evaluateOne(), NonLocalECPComponent::evaluateOneWithForces(), NonLocalECPComponent::evaluateValueAndDerivatives(), ParticleSet::getDistTableAB(), NonLocalECPComponent::getRmax(), Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), ParticleSet::getTotalNum(), NonLocalECPComponent::initVirtualParticle(), lattice, okay, Libxml2Document::parseFromString(), ECPComponentBuilder::pp_nonloc, ParticleSet::R, ECPComponentBuilder::read_pp_file(), REQUIRE(), ParticleSet::resetGroups(), VariableSet::resetIndex(), Vector< T, Alloc >::resize(), ParticleSet::setName(), VariableSet::size(), and ParticleSet::update().

157 {
160  using PosType = QMCTraits::PosType;
161 
163 
164  //Cell definition:
165 
166  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
167  lattice.BoxBConds = true; // periodic
168  lattice.R.diagonal(20);
169  lattice.LR_dim_cutoff = 15;
170  lattice.reset();
171 
172  const SimulationCell simulation_cell(lattice);
173  ParticleSet ions(simulation_cell);
174  ParticleSet elec(simulation_cell);
175 
176  ions.setName("ion0");
177  ions.create({2});
178  ions.R[0] = {0.0, 0.0, 0.0};
179  ions.R[1] = {6.0, 0.0, 0.0};
180  SpeciesSet& ion_species = ions.getSpeciesSet();
181  int pIdx = ion_species.addSpecies("Na");
182  int pChargeIdx = ion_species.addAttribute("charge");
183  int iatnumber = ion_species.addAttribute("atomic_number");
184  ion_species(pChargeIdx, pIdx) = 1;
185  ion_species(iatnumber, pIdx) = 11;
186  ions.createSK();
187 
188  elec.setName("e");
189  std::vector<int> agroup(2, 1);
190  elec.create(agroup);
191  elec.R[0] = {2.0, 0.0, 0.0};
192  elec.R[1] = {3.0, 0.0, 0.0};
193  SpeciesSet& tspecies = elec.getSpeciesSet();
194  int upIdx = tspecies.addSpecies("u");
195  int downIdx = tspecies.addSpecies("d");
196  int chargeIdx = tspecies.addAttribute("charge");
197  int massIdx = tspecies.addAttribute("mass");
198  tspecies(chargeIdx, upIdx) = -1;
199  tspecies(chargeIdx, downIdx) = -1;
200  tspecies(massIdx, upIdx) = 1.0;
201  tspecies(massIdx, downIdx) = 1.0;
202 
203  elec.createSK();
204 
205  ions.resetGroups();
206 
207  // The call to resetGroups is needed transfer the SpeciesSet
208  // settings to the ParticleSet
209  elec.resetGroups();
210 
211  //Cool. Now to construct a wavefunction with 1 and 2 body jastrow (no determinant)
212  RuntimeOptions runtime_options;
213  TrialWaveFunction psi(runtime_options);
214 
215  //Add the two body jastrow
216  const char* particles = R"(<tmp>
217  <jastrow name="J2" type="Two-Body" function="Bspline" print="yes" gpu="no">
218  <correlation speciesA="u" speciesB="d" rcut="10" size="8">
219  <coefficients id="ud" type="Array"> 2.015599059 1.548994099 1.17959447 0.8769687661 0.6245736507 0.4133517767 0.2333851935 0.1035636904</coefficients>
220  </correlation>
221  </jastrow>
222  </tmp>
223  )";
225  bool okay = doc.parseFromString(particles);
226  REQUIRE(okay);
227 
228  xmlNodePtr root = doc.getRoot();
229 
230  xmlNodePtr jas2 = xmlFirstElementChild(root);
231 
232  RadialJastrowBuilder jastrow(c, elec);
233  psi.addComponent(jastrow.buildComponent(jas2));
234  // Done with two body jastrow.
235 
236  //Add the one body jastrow.
237  const char* particles2 = R"(<tmp>
238  <jastrow name="J1" type="One-Body" function="Bspline" source="ion0" print="yes">
239  <correlation elementType="Na" rcut="10" size="10" cusp="0">
240  <coefficients id="eNa" type="Array"> 1.244201343 -1.188935609 -1.840397253 -1.803849126 -1.612058635 -1.35993202 -1.083353212 -0.8066295188 -0.5319252448 -0.3158819772</coefficients>
241  </correlation>
242  </jastrow>
243  </tmp>
244  )";
245  bool okay3 = doc.parseFromString(particles2);
246  REQUIRE(okay3);
247 
248  root = doc.getRoot();
249 
250  xmlNodePtr jas1 = xmlFirstElementChild(root);
251 
252  RadialJastrowBuilder jastrow1bdy(c, elec, ions);
253  psi.addComponent(jastrow1bdy.buildComponent(jas1));
254 
255  //Now we set up the nonlocal ECP component.
256  ECPComponentBuilder ecp("test_read_ecp", c);
257 
258  bool okay2 = ecp.read_pp_file("Na.BFD.xml");
259 
260  NonLocalECPComponent* nlpp = ecp.pp_nonloc.get();
261 
262  REQUIRE(nlpp != nullptr);
263 
264  //This line is required because the randomized quadrature Lattice is set by
265  //random number generator in NonLocalECPotential. We take the unrotated
266  //quadrature Lattice instead...
268 
269  const int myTableIndex = elec.addTable(ions);
270 
271  const auto& myTable = elec.getDistTableAB(myTableIndex);
272 
273  // update all distance tables
274  ions.update();
275  elec.update();
276 
277  //Need to set up temporary data for this configuration in trial wavefunction. Needed for ratios.
278  double logpsi = psi.evaluateLog(elec);
279  CHECK(logpsi == Approx(5.1497823982));
280 
281  auto test_evaluateOne = [&]() {
282  double Value1(0.0);
283  //Using SoA distance tables, hence the guard.
284  for (int jel = 0; jel < elec.getTotalNum(); jel++)
285  {
286  const auto& dist = myTable.getDistRow(jel);
287  const auto& displ = myTable.getDisplRow(jel);
288  for (int iat = 0; iat < ions.getTotalNum(); iat++)
289  if (nlpp != nullptr && dist[iat] < nlpp->getRmax())
290  Value1 += nlpp->evaluateOne(elec, iat, psi, jel, dist[iat], -displ[iat], false);
291  }
292  //These numbers are validated against an alternate code path via wavefunction tester.
293  CHECK(Value1 == Approx(6.9015710211e-02));
294  };
295 
296  {
297  nlpp->initVirtualParticle(elec);
298  test_evaluateOne();
299  nlpp->deleteVirtualParticle();
300  test_evaluateOne();
301  }
302 
303  opt_variables_type optvars;
304  Vector<ValueType> dlogpsi;
305  Vector<ValueType> dhpsioverpsi;
306 
307  psi.checkInVariables(optvars);
308  optvars.resetIndex();
309  const int NumOptimizables(optvars.size());
310  psi.checkOutVariables(optvars);
311  auto test_evaluateValueAndDerivatives = [&]() {
312  dlogpsi.resize(NumOptimizables, ValueType(0));
313  dhpsioverpsi.resize(NumOptimizables, ValueType(0));
314  psi.evaluateDerivatives(elec, optvars, dlogpsi, dhpsioverpsi);
315  CHECK(std::real(dlogpsi[0]) == Approx(-0.2211666667));
316  CHECK(std::real(dlogpsi[2]) == Approx(-0.1215));
317  CHECK(std::real(dlogpsi[3]) == Approx(0.0));
318  CHECK(std::real(dlogpsi[9]) == Approx(-0.0853333333));
319  CHECK(std::real(dlogpsi[10]) == Approx(-0.745));
320 
321  CHECK(std::real(dhpsioverpsi[0]) == Approx(-0.6463306581));
322  CHECK(std::real(dhpsioverpsi[2]) == Approx(1.5689981479));
323  CHECK(std::real(dhpsioverpsi[3]) == Approx(0.0));
324  CHECK(std::real(dhpsioverpsi[9]) == Approx(0.279561213));
325  CHECK(std::real(dhpsioverpsi[10]) == Approx(-0.3968828778));
326 
327  double Value1 = 0.0;
328  //Using SoA distance tables, hence the guard.
329  for (int jel = 0; jel < elec.getTotalNum(); jel++)
330  {
331  const auto& dist = myTable.getDistRow(jel);
332  const auto& displ = myTable.getDisplRow(jel);
333  for (int iat = 0; iat < ions.getTotalNum(); iat++)
334  if (nlpp != nullptr && dist[iat] < nlpp->getRmax())
335  Value1 += nlpp->evaluateValueAndDerivatives(elec, iat, psi, jel, dist[iat], -displ[iat], optvars, dlogpsi,
336  dhpsioverpsi);
337  }
338  CHECK(Value1 == Approx(6.9015710211e-02));
339 
340  CHECK(std::real(dhpsioverpsi[0]) == Approx(-0.6379341942));
341  CHECK(std::real(dhpsioverpsi[2]) == Approx(1.5269279991));
342  CHECK(std::real(dhpsioverpsi[3]) == Approx(-0.0355730676));
343  CHECK(std::real(dhpsioverpsi[9]) == Approx(0.279561213));
344  CHECK(std::real(dhpsioverpsi[10]) == Approx(-0.3968763604));
345  };
346 
347  {
348  nlpp->initVirtualParticle(elec);
349  test_evaluateValueAndDerivatives();
350  nlpp->deleteVirtualParticle();
351  test_evaluateValueAndDerivatives();
352  }
353 
354  double Value2(0.0);
355  double Value3(0.0);
356  ParticleSet::ParticlePos PulayTerm, HFTerm, HFTerm2;
357  HFTerm.resize(ions.getTotalNum());
358  HFTerm2.resize(ions.getTotalNum());
359  PulayTerm.resize(ions.getTotalNum());
360  HFTerm = 0;
361  HFTerm2 = 0;
362  PulayTerm = 0;
363 
364  for (int jel = 0; jel < elec.getTotalNum(); jel++)
365  {
366  const auto& dist = myTable.getDistRow(jel);
367  const auto& displ = myTable.getDisplRow(jel);
368  for (int iat = 0; iat < ions.getTotalNum(); iat++)
369  if (nlpp != nullptr && dist[iat] < nlpp->getRmax())
370  {
371  Value2 += nlpp->evaluateOneWithForces(elec, iat, psi, jel, dist[iat], -displ[iat], HFTerm[iat]);
372  Value3 +=
373  nlpp->evaluateOneWithForces(elec, ions, iat, psi, jel, dist[iat], -displ[iat], HFTerm2[iat], PulayTerm);
374  }
375  }
376  //These values are validated against print statements.
377  //Two-body jastrow-only wave functions agree with finite difference of NLPP to machine precision.
378  // These numbers assume the Hellman Feynmann implementation is correct, and dump the values
379  // when a one body term is added in.
380 
381  CHECK(Value2 == Approx(6.9015710211e-02));
382  CHECK(Value3 == Approx(6.9015710211e-02));
383 
384  //The total force (HFTerm+PulayTerm) is validated against finite difference of nonlocal PP w.r.t
385  //ion coordinates. delta=1e-6. Should be good up to 7th or 8th sig fig. These are:
386  // F[0][0]= 0.3474359
387  // F[0][1]= 0
388  // F[0][2]= 0
389  // F[1][0]=-0.002734064
390  // F[1][1]= 0
391  // F[1][2]= 0
392 
393  CHECK(HFTerm[0][0] == Approx(-0.3557369031));
394  CHECK(HFTerm[0][1] == Approx(0.0));
395  CHECK(HFTerm[0][2] == Approx(0.0));
396  CHECK(HFTerm[1][0] == Approx(0.001068673105));
397  CHECK(HFTerm[1][1] == Approx(0.0));
398  CHECK(HFTerm[1][2] == Approx(0.0));
399 
400  CHECK(HFTerm2[0][0] == Approx(-0.3557369031));
401  CHECK(HFTerm2[0][1] == Approx(0.0));
402  CHECK(HFTerm2[0][2] == Approx(0.0));
403  CHECK(HFTerm2[1][0] == Approx(0.001068673105));
404  CHECK(HFTerm2[1][1] == Approx(0.0));
405  CHECK(HFTerm2[1][2] == Approx(0.0));
406 
407  CHECK(PulayTerm[0][0] == Approx(0.008300993315));
408  CHECK(PulayTerm[0][1] == Approx(0.0));
409  CHECK(PulayTerm[0][2] == Approx(0.0));
410  CHECK(PulayTerm[1][0] == Approx(0.001665391103));
411  CHECK(PulayTerm[1][1] == Approx(0.0));
412  CHECK(PulayTerm[1][2] == Approx(0.0));
413 
414  //Comparing against finite difference results above, here's what we get.
415  //HFTerm[0][0]+PulayTerm[0][0] = −0.34743591
416  //HFTerm[0][1]+PulayTerm[0][1] = 0.0
417  //HFTerm[0][2]+PulayTerm[0][2] = 0.0
418  //HFTerm[1][0]+PulayTerm[1][0] = 0.002734064
419  //HFTerm[1][1]+PulayTerm[1][1] = 0.0
420  //HFTerm[1][2]+PulayTerm[1][2] = 0.0
421 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
void resetIndex()
reset Index
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType
void copyGridUnrotatedForTest(SOECPComponent &sopp)
Definition: test_ecp.cpp:154

◆ TEST_CASE() [398/537]

qmcplusplus::TEST_CASE ( "Spherical Harmonics Wrapper"  ,
""  [numerics] 
)

Definition at line 162 of file test_ylm.cpp.

References CHECK(), qmcplusplus::Units::distance::m, qmcplusplus::Units::force::N, and sphericalHarmonic().

163 {
164  struct Point
165  {
166  double x;
167  double y;
168  double z;
169  };
170 
171  struct YlmValue
172  {
173  Point p;
174  int l;
175  int m;
176  double y_re;
177  double y_im;
178  };
179 
180  // Test a small subset of values, same test as Spherical Harmonics except some are scaled to not be unit vectors
181  const int N = 11;
182  YlmValue Vals[N] = {
183  {{0, 0, 5}, 1, -1, 0, 0},
184  {{2.938925, 0, 4.045085}, 1, -1, 0.203076, 0},
185  {{2.938925, 0, 4.045085}, 1, 0, 0.395288, 0},
186  {{0.951057, 0, 0.309017}, 1, 1, -0.328584, 0},
187  {{0.587785, 0, 0.809017}, 2, -2, 0.133454, 0},
188  {{1.469465, 4.52254, 1.545085}, 2, -1, 0.0701612, -0.215934},
189  {{0.587785, 0, -0.809017}, 2, 0, 0.303888, 0},
190  {{0.293893, 0.904508, -0.309017}, 2, 1, 0.0701612, 0.215934},
191  {{1.469465, 4.52254, 1.545085}, 2, 2, -0.282661, 0.205365},
192  {{-0.475528, -0.345492, -0.809017}, 3, -3, 0.0261823, 0.0805808},
193  {{-2.37764, -1.72746, 4.045085}, 4, 4, -0.0427344, 0.0310484},
194  };
195 
197  for (int i = 0; i < N; i++)
198  {
199  YlmValue& v = Vals[i];
200  vec_t w;
201  w[0] = v.p.x;
202  w[1] = v.p.y;
203  w[2] = v.p.z;
204 
205  std::complex<double> out = sphericalHarmonic(v.l, v.m, w);
206  //printf("%d %d expected %g %g actual %g %g\n",v.l,v.m,v.y_re,v.y_im, out.real(), out.imag());
207  CHECK(v.y_re == Approx(out.real()));
208  CHECK(v.y_im == Approx(out.imag()));
209  }
210 }
TinyVector< double, 3 > vec_t
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::complex< T > sphericalHarmonic(const int l, const int m, const TinyVector< T, 3 > &r)
wrapper for Ylm, which can take any normal position vector as an argument param[in] l angular momentu...
Definition: Ylm.h:141

◆ TEST_CASE() [399/537]

qmcplusplus::TEST_CASE ( "QMCDriverFactory create DMCBatched driver"  ,
""  [qmcapp] 
)

Definition at line 162 of file test_QMCDriverFactory.cpp.

References ProjectData::BATCH, CHECK(), comm, OHMMS::Controller, qmcplusplus::testing::createDriver(), DMC_BATCH, doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), QMCDriverFactory::DriverAssemblyState::new_run_type, node, okay, Libxml2Document::parseFromString(), QMCDriverFactory::readSection(), REQUIRE(), test_project, qmcplusplus::testing::valid_dmc_batch_input_dmc_batch_index, qmcplusplus::testing::valid_dmc_input_dmc_batch_index, and qmcplusplus::testing::valid_dmc_input_sections.

163 {
164  using namespace testing;
165  Communicate* comm;
167 
168  SECTION("driver version behavior")
169  {
170  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
171  QMCDriverFactory driver_factory(test_project);
172 
175  REQUIRE(okay);
176  xmlNodePtr node = doc.getRoot();
177  QMCDriverFactory::DriverAssemblyState das = driver_factory.readSection(node);
178  REQUIRE(das.new_run_type == QMCRunType::DMC_BATCH);
179 
180  auto qmc_driver = testing::createDriver(test_project.getRuntimeOptions(), comm, driver_factory, node, das);
181  REQUIRE(qmc_driver != nullptr);
182  REQUIRE_NOTHROW(dynamic_cast<DMCBatched&>(*qmc_driver));
183  REQUIRE_THROWS(dynamic_cast<DMC&>(*qmc_driver));
184  CHECK(qmc_driver->getEngineName() == "DMCBatched");
185  }
186  SECTION("Deprecated _batch behavior")
187  {
188  ProjectData test_project;
189  QMCDriverFactory driver_factory(test_project);
190 
193  REQUIRE(okay);
194  xmlNodePtr node = doc.getRoot();
195  QMCDriverFactory::DriverAssemblyState das = driver_factory.readSection(node);
196  REQUIRE(das.new_run_type == QMCRunType::DMC_BATCH);
197 
198  auto qmc_driver = testing::createDriver(test_project.getRuntimeOptions(), comm, driver_factory, node, das);
199 
200  REQUIRE(qmc_driver != nullptr);
201  REQUIRE_NOTHROW(dynamic_cast<DMCBatched&>(*qmc_driver));
202  REQUIRE_THROWS(dynamic_cast<DMC&>(*qmc_driver));
203  CHECK(qmc_driver->getEngineName() == "DMCBatched");
204  }
205 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
constexpr int valid_dmc_input_dmc_batch_index
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
constexpr std::array< const char *, 3 > valid_dmc_input_sections
constexpr int valid_dmc_batch_input_dmc_batch_index
auto createDriver(const RuntimeOptions &runtime_options, Communicate *comm, QMCDriverFactory &driver_factory, xmlNodePtr node, QMCDriverFactory::DriverAssemblyState &das)

◆ TEST_CASE() [400/537]

qmcplusplus::TEST_CASE ( "Eloc_Derivatives:slater_noj"  ,
""  [hamiltonian] 
)

Definition at line 163 of file test_ion_derivs.cpp.

References app_log(), WaveFunctionFactory::buildTWF(), CHECK(), OHMMS::Controller, convertToReal(), create_CN_Hamiltonian(), create_CN_particlesets(), dot(), qmcplusplus::Units::charge::e, TrialWaveFunction::evalGradSource(), QMCHamiltonian::evaluateDeterministic(), QMCHamiltonian::evaluateIonDerivs(), QMCHamiltonian::evaluateIonDerivsDeterministic(), TrialWaveFunction::evaluateLog(), QMCHamiltonian::getHamiltonian(), QMCHamiltonian::getObservable(), QMCHamiltonian::getObservableName(), Libxml2Document::getRoot(), ham, Libxml2Document::parse(), REQUIRE(), Vector< T, Alloc >::resize(), QMCHamiltonian::setRandomGenerator(), and QMCHamiltonian::sizeOfObservables().

163  :slater_noj", "[hamiltonian]")
164 {
165  app_log() << "====Ion Derivative Test: Single Slater No Jastrow====\n";
166  using RealType = QMCTraits::RealType;
167 
168  Communicate* c = OHMMS::Controller;
169 
170  const SimulationCell simulation_cell;
171  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
172  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
173  auto &ions(*ions_ptr), elec(*elec_ptr);
174 
175  create_CN_particlesets(elec, ions);
176 
177  int Nions = ions.getTotalNum();
178  int Nelec = elec.getTotalNum();
179 
180  HamiltonianFactory::PSetMap particle_set_map;
181  particle_set_map.emplace("e", std::move(elec_ptr));
182  particle_set_map.emplace("ion0", std::move(ions_ptr));
183 
184  WaveFunctionFactory wff(elec, particle_set_map, c);
185 
186  Libxml2Document wfdoc;
187  bool wfokay = wfdoc.parse("cn.wfnoj.xml");
188  REQUIRE(wfokay);
189 
190  RuntimeOptions runtime_options;
191  xmlNodePtr wfroot = wfdoc.getRoot();
192  HamiltonianFactory::PsiPoolType psi_map;
193  psi_map.emplace("psi0", wff.buildTWF(wfroot, runtime_options));
194 
195  TrialWaveFunction* psi = psi_map["psi0"].get();
196  REQUIRE(psi != nullptr);
197 
198  HamiltonianFactory hf("h0", elec, particle_set_map, psi_map, c);
199 
200  //Output of WFTester Eloc test for this ion/electron configuration.
201  //Logpsi: (-1.4233853149e+01,0.0000000000e+00)
202  //HamTest Total -1.617071104264908143e+01
203  //HamTest Kinetic 9.182193792758450712e+00
204  //HamTest ElecElec 1.901556057075800865e+01
205  //HamTest IonIon 9.621404531608845900e+00
206  //HamTest LocalECP -6.783942829945100073e+01
207  //HamTest NonLocalECP 1.384955836167661225e+01
208 
209 
210  RealType logpsi = psi->evaluateLog(elec);
211  CHECK(logpsi == Approx(-14.233853149));
212 
213  QMCHamiltonian& ham = create_CN_Hamiltonian(hf);
214  RealType eloc = ham.evaluateDeterministic(elec);
215  enum observ_id
216  {
217  KINETIC = 0,
218  LOCALECP,
219  NONLOCALECP,
220  ELECELEC,
221  IONION
222  };
223  CHECK(eloc == Approx(-1.6170527168e+01));
224  CHECK(ham.getObservable(ELECELEC) == Approx(1.9015560571e+01));
225  CHECK(ham.getObservable(IONION) == Approx(9.6214045316e+00));
226  CHECK(ham.getObservable(LOCALECP) == Approx(-6.7839428299e+01));
227  CHECK(ham.getObservable(KINETIC) == Approx(9.1821937928e+00));
228  CHECK(ham.getObservable(NONLOCALECP) == Approx(1.3849558361e+01));
229 
230  for (int i = 0; i < ham.sizeOfObservables(); i++)
231  app_log() << " HamTest " << ham.getObservableName(i) << " " << ham.getObservable(i) << std::endl;
232 
233  //Now for the derivative tests
234  ParticleSet::ParticleGradient wfgradraw;
235  ParticleSet::ParticlePos hf_term;
236  ParticleSet::ParticlePos pulay_term;
237  ParticleSet::ParticlePos wf_grad;
238 
239  wfgradraw.resize(Nions);
240  wf_grad.resize(Nions);
241  hf_term.resize(Nions);
242  pulay_term.resize(Nions);
243 
244  wfgradraw[0] = psi->evalGradSource(elec, ions, 0); //On the C atom.
245  wfgradraw[1] = psi->evalGradSource(elec, ions, 1); //On the N atom.
246 
247  convertToReal(wfgradraw[0], wf_grad[0]);
248  convertToReal(wfgradraw[1], wf_grad[1]);
249 
250  //Reference from finite differences on this configuration.
251  CHECK(wf_grad[0][0] == Approx(-1.9044650674260308));
252  CHECK(wf_grad[0][1] == Approx(2.1257764985627148));
253  CHECK(wf_grad[0][2] == Approx(7.0556319963444016));
254  CHECK(wf_grad[1][0] == Approx(1.4233346821157509));
255  CHECK(wf_grad[1][1] == Approx(-0.1446706081154048));
256  CHECK(wf_grad[1][2] == Approx(0.1440176276013005));
257 
258  //Kinetic Force
259  hf_term = 0.0;
260  pulay_term = 0.0;
261  (ham.getHamiltonian(KINETIC))->evaluateWithIonDerivsDeterministic(elec, ions, *psi, hf_term, pulay_term);
262 #if defined(MIXED_PRECISION)
263  CHECK(hf_term[0][0] + pulay_term[0][0] == Approx(1.0852823603357820).epsilon(1e-4));
264  CHECK(hf_term[0][1] + pulay_term[0][1] == Approx(24.2154119471038562).epsilon(1e-4));
265  CHECK(hf_term[0][2] + pulay_term[0][2] == Approx(111.8849364775797852).epsilon(1e-4));
266  CHECK(hf_term[1][0] + pulay_term[1][0] == Approx(2.1572063443997536).epsilon(1e-4));
267  CHECK(hf_term[1][1] + pulay_term[1][1] == Approx(-3.3743242489947529).epsilon(1e-4));
268  CHECK(hf_term[1][2] + pulay_term[1][2] == Approx(7.5625192454964454).epsilon(1e-4));
269 #else
270  CHECK(hf_term[0][0] + pulay_term[0][0] == Approx(1.0852823603357820));
271  CHECK(hf_term[0][1] + pulay_term[0][1] == Approx(24.2154119471038562));
272  CHECK(hf_term[0][2] + pulay_term[0][2] == Approx(111.8849364775797852));
273  CHECK(hf_term[1][0] + pulay_term[1][0] == Approx(2.1572063443997536));
274  CHECK(hf_term[1][1] + pulay_term[1][1] == Approx(-3.3743242489947529));
275  CHECK(hf_term[1][2] + pulay_term[1][2] == Approx(7.5625192454964454));
276 #endif
277  //NLPP Force
278  hf_term = 0.0;
279  pulay_term = 0.0;
280  double val =
281  (ham.getHamiltonian(NONLOCALECP))->evaluateWithIonDerivsDeterministic(elec, ions, *psi, hf_term, pulay_term);
282 
283 //MP fails the first REQUIRE with 24.22544. Just bypass the checks in those builds.
284 #if defined(MIXED_PRECISION)
285  CHECK(hf_term[0][0] + pulay_term[0][0] == Approx(24.2239540340527491).epsilon(2e-4));
286  CHECK(hf_term[0][1] + pulay_term[0][1] == Approx(-41.9981344310649263).epsilon(2e-4));
287  CHECK(hf_term[0][2] + pulay_term[0][2] == Approx(-98.9123955744908159).epsilon(2e-4));
288  CHECK(hf_term[1][0] + pulay_term[1][0] == Approx(2.5105943834091704).epsilon(2e-4));
289  CHECK(hf_term[1][1] + pulay_term[1][1] == Approx(1.1345766918857692).epsilon(2e-4));
290  CHECK(hf_term[1][2] + pulay_term[1][2] == Approx(-5.2293234395150989).epsilon(2e-4));
291 #else
292  CHECK(hf_term[0][0] + pulay_term[0][0] == Approx(24.2239540340527491));
293  CHECK(hf_term[0][1] + pulay_term[0][1] == Approx(-41.9981344310649263));
294  CHECK(hf_term[0][2] + pulay_term[0][2] == Approx(-98.9123955744908159));
295  CHECK(hf_term[1][0] + pulay_term[1][0] == Approx(2.5105943834091704));
296  CHECK(hf_term[1][1] + pulay_term[1][1] == Approx(1.1345766918857692));
297  CHECK(hf_term[1][2] + pulay_term[1][2] == Approx(-5.2293234395150989));
298 #endif
299 
300  //End of deterministic tests. Let's call evaluateIonDerivs and evaluateIonDerivsDeterministic at the
301  //QMCHamiltonian level to make sure there are no crashes.
302 
303  hf_term = 0.0;
304  pulay_term = 0.0;
305  wf_grad = 0.0;
306  ham.evaluateIonDerivsDeterministic(elec, ions, *psi, hf_term, pulay_term, wf_grad);
307 
308  CHECK(dot(hf_term[0], hf_term[0]) != Approx(0));
309  CHECK(dot(pulay_term[0], pulay_term[0]) != Approx(0));
310  CHECK(dot(wf_grad[0], wf_grad[0]) != Approx(0));
311 
312  CHECK(dot(hf_term[1], hf_term[1]) != Approx(0));
313  CHECK(dot(pulay_term[1], pulay_term[1]) != Approx(0));
314  CHECK(dot(wf_grad[1], wf_grad[1]) != Approx(0));
315 
316  hf_term = 0.0;
317  pulay_term = 0.0;
318  wf_grad = 0.0;
319  RandomGenerator myrng;
320  ham.setRandomGenerator(&myrng);
321  ham.evaluateIonDerivs(elec, ions, *psi, hf_term, pulay_term, wf_grad);
322 
323  CHECK(dot(hf_term[0], hf_term[0]) != Approx(0));
324  CHECK(dot(pulay_term[0], pulay_term[0]) != Approx(0));
325  CHECK(dot(wf_grad[0], wf_grad[0]) != Approx(0));
326 
327  CHECK(dot(hf_term[1], hf_term[1]) != Approx(0));
328  CHECK(dot(pulay_term[1], pulay_term[1]) != Approx(0));
329  CHECK(dot(wf_grad[1], wf_grad[1]) != Approx(0));
330 }

◆ TEST_CASE() [401/537]

qmcplusplus::TEST_CASE ( "Cartesian Gaussian Ordering"  ,
""  [wavefunction] 
)

Definition at line 164 of file test_cartesian_ao.cpp.

References test_cartesian_ao().

164 { test_cartesian_ao(); }
void test_cartesian_ao()

◆ TEST_CASE() [402/537]

qmcplusplus::TEST_CASE ( "getwordsWithMergedNumbers"  ,
""  [utilities] 
)

Definition at line 165 of file test_parser.cpp.

References getwordsWithMergedNumbers(), and REQUIRE().

166 {
167  // 1.0-2.0 -> 1.0 -2.0
168  // 105 C 5 Z 0.000000 0.000000 -0.567800-103.884284 -2.142253
169 
170  ParseCaseVector_t tlist = {// Input string, list of expected tokens, extra split characters
171  {"1\n", {"1"}},
172  {"1 2\n", {"1", "2"}},
173  {"1.0 -2.0\n", {"1.0", "-2.0"}},
174  {"1.0-2.0\n", {"1.0", "-2.0"}},
175  {"-1.0-2.0-3.0\n", {"-1.0", "-2.0", "-3.0"}},
176  {"105 C 5 Z 0.000000 0.000000 -0.567800-103.884284 -2.142253\n",
177  {"105", "C", "5", "Z", "0.000000", "0.000000", "-0.567800", "-103.884284", "-2.142253"}}};
178 
179  for (auto& tc : tlist)
180  {
181  SECTION(string("Parsing input: ") + tc.input)
182  {
183  vector<string> outlist;
184  std::istringstream input(tc.input);
185  int num = getwordsWithMergedNumbers(outlist, input);
186  REQUIRE(num == tc.output.size());
187  REQUIRE(outlist.size() == tc.output.size());
188  for (int i = 0; i < tc.output.size(); i++)
189  {
190  REQUIRE(outlist[i] == tc.output[i]);
191  }
192  }
193  }
194 }
vector< ParseCase > ParseCaseVector_t
Definition: test_parser.cpp:47
REQUIRE(std::filesystem::exists(filename))
testing::ValidSpinDensityInput input
int getwordsWithMergedNumbers(std::vector< std::string > &slist, std::istream &fp, int dummy, const std::string &extra_tokens)

◆ TEST_CASE() [403/537]

qmcplusplus::TEST_CASE ( "ReferencePoints::DefaultConstruction"  ,
""  [estimators] 
)

Definition at line 165 of file test_ReferencePoints.cpp.

References approxEquality(), CHECK(), expectedReferencePoints(), generate_test_data, NEReferencePoints::get_points(), makePsets(), and makeTestRPI().

166 {
167  auto rpi = makeTestRPI();
168  auto ppr = makePsets();
169  NEReferencePoints ref_points(rpi, ppr.pset, ppr.ref_psets);
170 
171  if (generate_test_data)
172  {
173  testing::TestableNEReferencePoints tref_points(ref_points);
174  std::cout << "expected_reference_points" << tref_points;
175  }
176 
177  typename NEReferencePoints::Points expected_reference_points;
178  expected_reference_points = expectedReferencePoints();
179 
180  for (auto& [key, value] : ref_points.get_points())
181  {
182  bool coords_match = approxEquality(expected_reference_points[key], value);
183  CHECK(coords_match);
184  }
185 }
PSetsAndRefList makePsets()
constexpr bool generate_test_data
set to true to generate new random R for particles.
ReferencePointsInput makeTestRPI()
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool approxEquality(const TinyVector< T1, D > &val_a, const TinyVector< T2, D > &val_b)

◆ TEST_CASE() [404/537]

qmcplusplus::TEST_CASE ( "Dirac Cartesian Gaussian Ordering"  ,
""  [wavefunction] 
)

Definition at line 165 of file test_cartesian_ao.cpp.

References test_dirac_ao().

165 { test_dirac_ao(); }

◆ TEST_CASE() [405/537]

qmcplusplus::TEST_CASE ( "SpaceGrid::SPHERICAL"  ,
""  [estimators] 
)

Definition at line 166 of file test_NESpaceGrid.cpp.

References CHECK(), comm, OHMMS::Controller, OHMMS_DIM, SpaceGridEnv< VALID >::ref_points_, and SpaceGridEnv< VALID >::sgi_.

167 {
168  using Input = testing::ValidSpaceGridInput;
169  Communicate* comm;
171 
172  testing::SpaceGridEnv<Input::valid::SPHERICAL> sge(comm);
173 
174  // EnergyDensityEstimator gets this from an enum giving indexes into each offset of SOA buffer.
175  // It is a smell.
176  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), 1, false);
177 
178  using NES = testing::NESpaceGridTests<double>;
179  auto buffer_start = NES::getBufferStart(space_grid);
180  auto buffer_end = NES::getBufferEnd(space_grid);
181  space_grid.write_description(std::cout, std::string(""));
182  auto& sgi = *(sge.sgi_);
183  auto& agr = sgi.get_axis_grids();
184  for (int id = 0; id < OHMMS_DIM; ++id)
185  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
186 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
#define OHMMS_DIM
Definition: config.h:64
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [406/537]

qmcplusplus::TEST_CASE ( "Spline applyRotation one rotation"  ,
""  [wavefunction] 
)

Definition at line 167 of file test_spline_applyrotation.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), CHECK(), CHECKED_ELSE(), checkMatrix(), OHMMS::Controller, ParticleSet::create(), EinsplineSetBuilder::createSPOSetFromXML(), doc, qmcplusplus::Units::charge::e, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), lattice, norm(), okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), Vector< T, Alloc >::size(), and sqrt().

168 {
169  // How to get rid of all this annoying boilerplate?
171 
172  // diamondC_1x1x1
173  ParticleSet::ParticleLayout lattice;
174  lattice.R = {3.37316115, 3.37316115, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
175 
176  ParticleSetPool ptcl = ParticleSetPool(c);
177  ptcl.setSimulationCell(lattice);
178  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
179  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
180  ParticleSet& ions_(*ions_uptr);
181  ParticleSet& elec_(*elec_uptr);
182 
183  ions_.setName("ion");
184  ptcl.addParticleSet(std::move(ions_uptr));
185  ions_.create({2});
186  ions_.R[0] = {0.0, 0.0, 0.0};
187  ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
188 
189  elec_.setName("elec");
190  ptcl.addParticleSet(std::move(elec_uptr));
191  elec_.create({2});
192  elec_.R[0] = {0.0, 0.0, 0.0};
193  elec_.R[1] = {0.0, 1.0, 0.0};
194 
195  SpeciesSet& tspecies = elec_.getSpeciesSet();
196  int upIdx = tspecies.addSpecies("u");
197  int chargeIdx = tspecies.addAttribute("charge");
198  tspecies(chargeIdx, upIdx) = -1;
199 
200  // Load diamondC_1x1x1 wfn and explicitly construct a SplineC2C object with 7 orbitals
201  // This results in padding of the spline coefs table and thus is a more stringent test.
202  const char* particles = R"(<tmp>
203 <determinantset type="einspline" href="diamondC_1x1x1.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion" gpu="no" precision="double" size="7"/>
204 </tmp>)";
205 
207  bool okay = doc.parseFromString(particles);
208  REQUIRE(okay);
209  xmlNodePtr root = doc.getRoot();
210  xmlNodePtr ein1 = xmlFirstElementChild(root);
211  EinsplineSetBuilder einSet(elec_, ptcl.getPool(), c, ein1);
212  auto spo = einSet.createSPOSetFromXML(ein1);
213  REQUIRE(spo);
214 
215  const auto orbitalsetsize = spo->getOrbitalSetSize();
216  REQUIRE(orbitalsetsize == 7);
217  SPOSet::ValueMatrix psiM_bare(elec_.R.size(), orbitalsetsize);
218  SPOSet::GradMatrix dpsiM_bare(elec_.R.size(), orbitalsetsize);
219  SPOSet::ValueMatrix d2psiM_bare(elec_.R.size(), orbitalsetsize);
220  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM_bare, dpsiM_bare, d2psiM_bare);
221 
222  // Check before rotation is applied. From 'test_einset.cpp'
223  CHECK(std::real(psiM_bare[1][0]) == Approx(-0.8886948824));
224  CHECK(std::real(psiM_bare[1][1]) == Approx(1.4194120169));
225  // grad
226  CHECK(std::real(dpsiM_bare[1][0][0]) == Approx(-0.0000183403));
227  CHECK(std::real(dpsiM_bare[1][0][1]) == Approx(0.1655139178));
228  CHECK(std::real(dpsiM_bare[1][0][2]) == Approx(-0.0000193077));
229  CHECK(std::real(dpsiM_bare[1][1][0]) == Approx(-1.3131694794));
230  CHECK(std::real(dpsiM_bare[1][1][1]) == Approx(-1.1174004078));
231  CHECK(std::real(dpsiM_bare[1][1][2]) == Approx(-0.8462534547));
232  // lapl
233  CHECK(std::real(d2psiM_bare[1][0]) == Approx(1.3313053846));
234  CHECK(std::real(d2psiM_bare[1][1]) == Approx(-4.712583065));
235 
236  /* Apply a rotation, U = exp(-K) as shown below, to the splines.
237  Because K = -K.T, U is unitary.
238  K=
239  0.00000000e+00 -2.33449314e-01 5.21735139e-01 1.67744276e-01 -1.68565994e-01 1.26632312e-02 2.29272040e-01
240  2.33449314e-01 0.00000000e+00 -3.81982621e-01 -6.76995896e-01 7.15727948e-02 9.10926961e-01 -6.94864205e-01
241  -5.21735139e-01 3.81982621e-01 0.00000000e+00 2.37433139e-01 -7.09878105e-01 -6.33841289e-01 -7.49009582e-01
242  -1.67744276e-01 6.76995896e-01 -2.37433139e-01 0.00000000e+00 -6.72002172e-01 4.27152921e-01 -4.82983743e-03
243  1.68565994e-01 -7.15727948e-02 7.09878105e-01 6.72002172e-01 0.00000000e+00 -7.93860012e-01 -7.76624731e-01
244  -1.26632312e-02 -9.10926961e-01 6.33841289e-01 -4.27152921e-01 7.93860012e-01 0.00000000e+00 -2.74931052e-01
245  -2.29272040e-01 6.94864205e-01 7.49009582e-01 4.82983743e-03 7.76624731e-01 2.74931052e-01 0.00000000e+00
246  U=
247  8.06061880e-01 3.54921598e-01 -3.40706426e-01 -5.90163619e-02 1.11650454e-01 -1.99768450e-01 -2.28818375e-01
248  1.58069821e-02 2.10363421e-01 2.74922448e-01 2.12581764e-01 2.64602356e-01 -6.34971914e-01 6.01265560e-01
249  4.43696646e-01 -6.06912539e-02 2.61413193e-01 -1.98368802e-01 -6.43234645e-02 5.75880430e-01 5.96646495e-01
250  1.45865363e-01 -5.16577220e-01 -2.09866367e-01 5.55699395e-01 5.73062990e-01 1.74778224e-01 8.77170506e-03
251  -3.24609748e-01 2.89664179e-01 -7.50613752e-01 -1.63060005e-01 1.70803377e-01 1.63784167e-01 4.05850414e-01
252  1.32570771e-03 3.80299846e-01 -5.08439810e-02 7.59141791e-01 -4.77844928e-01 2.12149087e-01 5.60882349e-02
253  1.62781208e-01 -5.75073150e-01 -3.60485665e-01 -1.70070331e-02 -5.72251258e-01 -3.50549638e-01 2.49394158e-01
254  UU.T=
255  1.00000000e+00 -2.77555756e-17 5.55111512e-17 -8.67361738e-18 -1.11022302e-16 -6.07153217e-17 6.93889390e-17
256  -2.77555756e-17 1.00000000e+00 5.55111512e-17 -1.84748050e-16 5.55111512e-17 -6.93889390e-18 8.32667268e-17
257  5.55111512e-17 5.55111512e-17 1.00000000e+00 1.45716772e-16 -5.55111512e-17 1.38777878e-16 5.55111512e-17
258  -8.67361738e-18 -1.84748050e-16 1.45716772e-16 1.00000000e+00 -1.95156391e-17 1.80411242e-16 8.02309608e-17
259  -1.11022302e-16 5.55111512e-17 -5.55111512e-17 -1.95156391e-17 1.00000000e+00 7.28583860e-17 1.11022302e-16
260  -6.07153217e-17 -6.93889390e-18 1.38777878e-16 1.80411242e-16 7.28583860e-17 1.00000000e+00 -1.12757026e-16
261  6.93889390e-17 8.32667268e-17 5.55111512e-17 8.02309608e-17 1.11022302e-16 -1.12757026e-16 1.00000000e+00
262 
263  NB: There's nothing special about this rotation. I purposefully made something 'ugly' to make a worst case scenario...
264  */
265  SPOSet::ValueMatrix rot_mat(orbitalsetsize, orbitalsetsize);
266  rot_mat[0][0] = 8.06061880e-01;
267  rot_mat[0][1] = 3.54921598e-01;
268  rot_mat[0][2] = -3.40706426e-01;
269  rot_mat[0][3] = -5.90163619e-02;
270  rot_mat[0][4] = 1.11650454e-01;
271  rot_mat[0][5] = -1.99768450e-01;
272  rot_mat[0][6] = -2.28818375e-01;
273  rot_mat[1][0] = 1.58069821e-02;
274  rot_mat[1][1] = 2.10363421e-01;
275  rot_mat[1][2] = 2.74922448e-01;
276  rot_mat[1][3] = 2.12581764e-01;
277  rot_mat[1][4] = 2.64602356e-01;
278  rot_mat[1][5] = -6.34971914e-01;
279  rot_mat[1][6] = 6.01265560e-01;
280  rot_mat[2][0] = 4.43696646e-01;
281  rot_mat[2][1] = -6.06912539e-02;
282  rot_mat[2][2] = 2.61413193e-01;
283  rot_mat[2][3] = -1.98368802e-01;
284  rot_mat[2][4] = -6.43234645e-02;
285  rot_mat[2][5] = 5.75880430e-01;
286  rot_mat[2][6] = 5.96646495e-01;
287  rot_mat[3][0] = 1.45865363e-01;
288  rot_mat[3][1] = -5.16577220e-01;
289  rot_mat[3][2] = -2.09866367e-01;
290  rot_mat[3][3] = 5.55699395e-01;
291  rot_mat[3][4] = 5.73062990e-01;
292  rot_mat[3][5] = 1.74778224e-01;
293  rot_mat[3][6] = 8.77170506e-03;
294  rot_mat[4][0] = -3.24609748e-01;
295  rot_mat[4][1] = 2.89664179e-01;
296  rot_mat[4][2] = -7.50613752e-01;
297  rot_mat[4][3] = -1.63060005e-01;
298  rot_mat[4][4] = 1.70803377e-01;
299  rot_mat[4][5] = 1.63784167e-01;
300  rot_mat[4][6] = 4.05850414e-01;
301  rot_mat[5][0] = 1.32570771e-03;
302  rot_mat[5][1] = 3.80299846e-01;
303  rot_mat[5][2] = -5.08439810e-02;
304  rot_mat[5][3] = 7.59141791e-01;
305  rot_mat[5][4] = -4.77844928e-01;
306  rot_mat[5][5] = 2.12149087e-01;
307  rot_mat[5][6] = 5.60882349e-02;
308  rot_mat[6][0] = 1.62781208e-01;
309  rot_mat[6][1] = -5.75073150e-01;
310  rot_mat[6][2] = -3.60485665e-01;
311  rot_mat[6][3] = -1.70070331e-02;
312  rot_mat[6][4] = -5.72251258e-01;
313  rot_mat[6][5] = -3.50549638e-01;
314  rot_mat[6][6] = 2.49394158e-01;
315  spo->storeParamsBeforeRotation(); // avoids coefs_copy_ nullptr segfault
316  spo->applyRotation(rot_mat, false);
317 
318  // Get the data for rotated orbitals
319  SPOSet::ValueMatrix psiM_rot(elec_.R.size(), orbitalsetsize);
320  SPOSet::GradMatrix dpsiM_rot(elec_.R.size(), orbitalsetsize);
321  SPOSet::ValueMatrix d2psiM_rot(elec_.R.size(), orbitalsetsize);
322  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM_rot, dpsiM_rot, d2psiM_rot);
323 
324  // Compute the expected value, gradient, and laplacian by hand using the transformation above
325  // Check value
326  SPOSet::ValueMatrix psiM_rot_manual(elec_.R.size(), orbitalsetsize);
327  for (int i = 0; i < elec_.R.size(); i++)
328  for (int j = 0; j < orbitalsetsize; j++)
329  {
330  psiM_rot_manual[i][j] = 0.;
331  for (int k = 0; k < orbitalsetsize; k++)
332  psiM_rot_manual[i][j] += psiM_bare[i][k] * rot_mat[k][j];
333  }
334  auto check = checkMatrix(psiM_rot_manual, psiM_rot, true);
335  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
336 
337  // Check grad
338  SPOSet::GradMatrix dpsiM_rot_manual(elec_.R.size(), orbitalsetsize);
339  for (int i = 0; i < elec_.R.size(); i++)
340  for (int j = 0; j < orbitalsetsize; j++)
341  {
342  dpsiM_rot_manual[i][j][0] = 0.;
343  dpsiM_rot_manual[i][j][1] = 0.;
344  dpsiM_rot_manual[i][j][2] = 0.;
345  for (int k = 0; k < orbitalsetsize; k++)
346  for (int l = 0; l < 3; l++)
347  dpsiM_rot_manual[i][j][l] += dpsiM_bare[i][k][l] * rot_mat[k][j];
348  }
349 
350  // No checkMatrix for tensors? Gotta do it by hand...
351  double res = 0.;
352  for (int i = 0; i < elec_.R.size(); i++)
353  for (int j = 0; j < orbitalsetsize; j++)
354  for (int k = 0; k < 3; k++)
355  res += std::sqrt(std::norm(dpsiM_rot_manual[i][j][k] - dpsiM_rot[i][j][k]));
356 
357  CHECK(res == Approx(0.).epsilon(2e-4)); // increase threshold to accomodate mixed precision.
358 
359  // Check laplacian
360  SPOSet::ValueMatrix d2psiM_rot_manual(elec_.R.size(), orbitalsetsize);
361  for (int i = 0; i < elec_.R.size(); i++)
362  for (int j = 0; j < orbitalsetsize; j++)
363  {
364  d2psiM_rot_manual[i][j] = 0.;
365  for (int k = 0; k < orbitalsetsize; k++)
366  d2psiM_rot_manual[i][j] += d2psiM_bare[i][k] * rot_mat[k][j];
367  }
368 
369  check = checkMatrix(d2psiM_rot_manual, d2psiM_rot, true, 2e-4);
370  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
371 
372 } // TEST_CASE
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
CHECKED_ELSE(check_matrix_result.result)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
double norm(const zVec &c)
Definition: VectorOps.h:118
REQUIRE(std::filesystem::exists(filename))
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [407/537]

qmcplusplus::TEST_CASE ( "RandomForTest_fillBufferRng_real"  ,
""  [utilities][for_testing] 
)

Definition at line 167 of file test_RandomForTest.cpp.

168 {
169  TestFillBufferRngReal<float> tfbrr_f;
170  tfbrr_f();
171  TestFillBufferRngReal<double> tfbrr_d;
172  tfbrr_d();
173 }

◆ TEST_CASE() [408/537]

qmcplusplus::TEST_CASE ( "cuBLAS_LU::computeLogDet_float"  ,
""  [wavefunction][CUDA] 
)

while this working is a good test, in production code its likely we want to widen the matrix M to double and thereby the LU matrix as well.

Definition at line 171 of file test_cuBLAS_LU.cpp.

References batch_size, CHECK(), qmcplusplus::cuBLAS_LU::computeLogDet_batched(), cudaCheck, cudaMemcpyAsync, cudaMemcpyDeviceToHost, cudaMemcpyHostToDevice, cudaStreamSynchronize, dev_log_values(), dev_lu(), dev_lus(), dev_pivots(), hstream, lda, log_values(), lu, lus, n, and pivots.

172 {
173  auto cuda_handles = std::make_unique<testing::CUDAHandles>();
174  int n = 4;
175  int lda = 4;
176  int batch_size = 1;
177  auto& hstream = cuda_handles->hstream;
178 
179  // clang-format off
180  std::vector<float, CUDAHostAllocator<float>> lu = {7., 0.28571429, 0.71428571, 0.71428571,
181  5., 3.57142857, 0.12, -0.44,
182  6., 6.28571429, -1.04, -0.46153846,
183  6., 5.28571429, 3.08, 7.46153846};
184  // clang-format on
185  std::vector<float, CUDAAllocator<float>> dev_lu(lu.size());
186 
187  std::vector<float*, CUDAHostAllocator<float*>> lus(batch_size, nullptr);
188  lus[0] = dev_lu.data();
189  std::vector<float*, CUDAAllocator<float*>> dev_lus(batch_size);
190 
191  using StdComp = std::complex<double>;
192  std::vector<StdComp, CUDAHostAllocator<StdComp>> log_values(batch_size, 0.0);
193  std::vector<StdComp, CUDAAllocator<StdComp>> dev_log_values(batch_size, 0.0);
194 
195  std::vector<int, CUDAHostAllocator<int>> pivots = {3, 3, 4, 4};
196  std::vector<int, CUDAAllocator<int>> dev_pivots(4);
197 
198  // Transfer and run kernel.
199  cudaCheck(cudaMemcpyAsync(dev_lu.data(), lu.data(), sizeof(float) * 16, cudaMemcpyHostToDevice, hstream));
200  cudaCheck(cudaMemcpyAsync(dev_lus.data(), lus.data(), sizeof(float**), cudaMemcpyHostToDevice, hstream));
201  cudaCheck(cudaMemcpyAsync(dev_pivots.data(), pivots.data(), sizeof(int) * 4, cudaMemcpyHostToDevice, hstream));
202 
203  // The types of the pointers passed here matter
205  batch_size);
206 
207  cudaCheck(cudaMemcpyAsync(log_values.data(), dev_log_values.data(), sizeof(std::complex<double>) * batch_size,
210  CHECK(log_values[0] == ComplexApprox(std::complex<double>{5.267858159063328, 6.283185307179586}));
211 }
std::vector< StdComp, CUDAHostAllocator< StdComp > > dev_lu(lu.size())
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
std::vector< StdComp *, CUDAAllocator< StdComp * > > dev_lus(batch_size)
CHECK(log_values[1]==ComplexApprox(std::complex< double >{ 5.531331998282581, -8.805487075984523 }))
void computeLogDet_batched(cudaStream_t &hstream, const int n, const int lda, T **Ms, const int *pivots, std::complex< double > *logdets, const int batch_size)
std::vector< int, CUDAHostAllocator< int > > pivots(8, -1.0)
#define cudaMemcpyDeviceToHost
Definition: cuda2hip.h:138
#define cudaStreamSynchronize
Definition: cuda2hip.h:152
#define cudaMemcpyHostToDevice
Definition: cuda2hip.h:139
std::vector< StdComp, CUDAAllocator< StdComp > > dev_log_values(batch_size)
std::vector< StdComp, CUDAHostAllocator< StdComp > > lu
#define cudaCheck(ans)
Definition: CUDAerror.h:27
std::vector< int, CUDAAllocator< int > > dev_pivots(pivots.size())
std::vector< StdComp *, CUDAHostAllocator< StdComp * > > lus(batch_size)
std::complex< double > StdComp
#define cudaMemcpyAsync
Definition: cuda2hip.h:136

◆ TEST_CASE() [409/537]

qmcplusplus::TEST_CASE ( "benchmark_DiracMatrixComputeCUDASingle_vs_legacy_256_10"  ,
""  [wavefunction][fermion][.benchmark] 
)

Only runs if [benchmark] tag is passed.

Definition at line 173 of file benchmark_DiracMatrixComputeCUDA.cpp.

References DiracComputeBenchmarkParameters::batch_size, DiracMatrix< T_FP >::invert_transpose(), DiracMatrixComputeCUDA< VALUE_FP >::invert_transpose(), log_values(), qmcplusplus::testing::makeRngSpdMatrix(), qmcplusplus::Units::meter, DiracComputeBenchmarkParameters::n, DiracComputeBenchmarkParameters::name, queue, and DiracComputeBenchmarkParameters::str().

174 {
175  DiracComputeBenchmarkParameters params;
176  params.name = "Forced Serial Batched CUDA";
177  params.n = 256;
178  params.batch_size = 10;
179 
180  compute::Queue<PlatformKind::CUDA> queue;
181  DiracMatrixComputeCUDA<double> dmcc;
182 
183  std::vector<Matrix<double>> spd_mats(params.batch_size, {params.n, params.n});
184  std::vector<OffloadPinnedMatrix<double>> pinned_spd_mats(params.batch_size, {params.n, params.n});
185 
186  testing::MakeRngSpdMatrix<double> makeRngSpdMatrix;
187  for (int im = 0; im < params.batch_size; ++im)
188  {
189  makeRngSpdMatrix(spd_mats[im]);
190  for (int i = 0; i < params.n; ++i)
191  for (int j = 0; j < params.n; ++j)
192  pinned_spd_mats[im](i, j) = spd_mats[im](i, j);
193  }
194 
195  std::vector<OffloadPinnedMatrix<double>> pinned_inv_mats(params.batch_size, {params.n, params.n});
196  std::vector<OffloadPinnedVector<std::complex<double>>> log_values(params.batch_size);
197  for (auto& log_value : log_values)
198  log_value.resize(1, {0, 0});
199 
200  auto a_mats = makeRefVector<decltype(pinned_spd_mats)::value_type>(pinned_spd_mats);
201  RefVector<OffloadPinnedMatrix<double>> inv_a_mats =
202  makeRefVector<decltype(pinned_inv_mats)::value_type>(pinned_inv_mats);
203 
204  std::vector<bool> compute_mask(params.batch_size, true);
205  BENCHMARK_ADVANCED(params.str())(Catch::Benchmark::Chronometer meter)
206  {
207  meter.measure([&] {
208  for (int im = 0; im < params.batch_size; ++im)
209  dmcc.invert_transpose(queue, pinned_spd_mats[im], pinned_inv_mats[im], log_values[im]);
210  });
211  };
212 
213 
214  DiracMatrix<double> dmat;
215  std::vector<Matrix<double>> inv_mats_test(params.batch_size, {params.n, params.n});
216  std::vector<std::complex<double>> log_values_test(params.batch_size);
217 
218  params.name = "legacy CPU";
219  BENCHMARK_ADVANCED(params.str())(Catch::Benchmark::Chronometer meter)
220  {
221  meter.measure([&] {
222  for (int im = 0; im < params.batch_size; ++im)
223  dmat.invert_transpose(spd_mats[im], inv_mats_test[im], log_values_test[im]);
224  });
225  };
226 }
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
void makeRngSpdMatrix(testing::RandomForTest< RngValueType< T >> &rng, Matrix< T > &mat_spd)

◆ TEST_CASE() [410/537]

qmcplusplus::TEST_CASE ( "RandomForTest_fillVectorRngReal"  ,
""  [utilities][for_testing] 
)

Definition at line 175 of file test_RandomForTest.cpp.

176 {
177  TestFillVecRngReal<float> tfvrr_f;
178  tfvrr_f();
179  TestFillVecRngReal<double> tfvrr_d;
180  tfvrr_d();
181 }

◆ TEST_CASE() [411/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A Ewald Quasi2D staggered square 2x2"  ,
""  [hamiltonian] 
)

Definition at line 175 of file test_ewald_quasi2d.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), lattice, LRCoulombSingleton::QUASI2D, ParticleSet::R, ParticleSet::setName(), LRCoulombSingleton::this_lr_type, and ParticleSet::update().

176 {
177  LRCoulombSingleton::CoulombHandler = 0; // !!!! crucial if not first test
178  LRCoulombSingleton::this_lr_type = LRCoulombSingleton::QUASI2D;
179  //const double vmad_sq = -1.95013246;
180  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
181  lattice.BoxBConds = true;
182  lattice.BoxBConds[2] = false; // ppn
183  lattice.ndim = 2;
184  lattice.R.diagonal(2.0);
185  lattice.R(2,2) = 10;
186  lattice.LR_dim_cutoff = 30.0;
187  lattice.reset();
188 
189  const SimulationCell simulation_cell(lattice);
190  ParticleSet elec(simulation_cell);
191  int npart = 8;
192  elec.setName("e");
193  elec.create({npart});
194  elec.R[0] = {0.0, 0.0, 0.0};
195  elec.R[1] = {1.0, 0.0, 0.0};
196  elec.R[2] = {0.0, 1.0, 0.0};
197  elec.R[3] = {1.0, 1.0, 0.0};
198  elec.R[4] = {0.5, 0.5, 0.0};
199  elec.R[5] = {1.5, 0.5, 0.0};
200  elec.R[6] = {0.5, 1.5, 0.0};
201  elec.R[7] = {1.5, 1.5, 0.0};
202 
203  SpeciesSet& tspecies = elec.getSpeciesSet();
204  int upIdx = tspecies.addSpecies("u");
205  int chargeIdx = tspecies.addAttribute("charge");
206  int massIdx = tspecies.addAttribute("mass");
207  tspecies(chargeIdx, upIdx) = -1;
208  tspecies(massIdx, upIdx) = 1.0;
209 
210  elec.createSK();
211  elec.addTable(elec); // !!!! crucial to compute distance table
212 
213  CoulombPBCAA caa(elec, true, false, false);
214 
215  const int ntest = 4;
216  const double zheight[ntest] = {0, 0.1, 0.5, 3.0};
217  const double vmad_sq = -1.95013246;
218  const double vmad_bc = -2.7579038;
219  const double vmad_ref[ntest] = {vmad_bc, -2.4846003745840357, -2.019557388069959, vmad_sq};
220  double val;
221  for (int itest=0; itest<ntest; itest++)
222  {
223  for (int i=npart/2;i<npart;i++)
224  elec.R[i][2] = zheight[itest];
225  elec.update();
226  val = caa.evaluate(elec);
227  CHECK(val/npart == Approx(vmad_ref[itest]));
228  }
229 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [412/537]

qmcplusplus::TEST_CASE ( "Cartesian Tensor evaluateWithHessian subset"  ,
""  [numerics] 
)

Definition at line 180 of file test_cartesian_tensor.cpp.

References CHECK(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::evaluateWithHessian(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::getGradYlm(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::getHessYlm(), and CartesianTensor< T, Point_t, Tensor_t, GGG_t >::getYlm().

181 {
183 
184  TinyVector<double, 3> pt(1.3, 1.2, -0.5);
185  ct.evaluateWithHessian(pt);
186 
187  //for (int i = 0; i < 35; i++) {
188  // std::cout << "XYZ = " << i << " " << ct.getYlm(i) << " " << ct.getHessYlm(i) << std::endl;
189  //}
190 
191  CHECK(ct.getYlm(0) == Approx(0.282094791774));
192  CHECK(ct.getGradYlm(0)[0] == Approx(0));
193  CHECK(ct.getGradYlm(0)[1] == Approx(0));
194  CHECK(ct.getGradYlm(0)[2] == Approx(0));
195 
196  CHECK(ct.getHessYlm(0)(0, 0) == Approx(0));
197  CHECK(ct.getHessYlm(0)(0, 1) == Approx(0));
198  CHECK(ct.getHessYlm(0)(0, 2) == Approx(0));
199  CHECK(ct.getHessYlm(0)(1, 0) == Approx(0));
200  CHECK(ct.getHessYlm(0)(1, 1) == Approx(0));
201  CHECK(ct.getHessYlm(0)(1, 2) == Approx(0));
202  CHECK(ct.getHessYlm(0)(2, 0) == Approx(0));
203  CHECK(ct.getHessYlm(0)(2, 1) == Approx(0));
204  CHECK(ct.getHessYlm(0)(2, 2) == Approx(0));
205 
206 
207  CHECK(ct.getYlm(1) == Approx(0.635183265474));
208  CHECK(ct.getGradYlm(1)[0] == Approx(0.488602511903));
209  CHECK(ct.getGradYlm(1)[1] == Approx(0));
210  CHECK(ct.getGradYlm(1)[2] == Approx(0));
211 
212  CHECK(ct.getHessYlm(1)(0, 0) == Approx(0));
213  CHECK(ct.getHessYlm(1)(0, 1) == Approx(0));
214  CHECK(ct.getHessYlm(1)(0, 2) == Approx(0));
215  CHECK(ct.getHessYlm(1)(1, 0) == Approx(0));
216  CHECK(ct.getHessYlm(1)(1, 1) == Approx(0));
217  CHECK(ct.getHessYlm(1)(1, 2) == Approx(0));
218  CHECK(ct.getHessYlm(1)(2, 0) == Approx(0));
219  CHECK(ct.getHessYlm(1)(2, 1) == Approx(0));
220  CHECK(ct.getHessYlm(1)(2, 2) == Approx(0));
221 
222 
223  CHECK(ct.getYlm(15) == Approx(3.12417199136));
224  CHECK(ct.getGradYlm(15)[0] == Approx(2.40320922412));
225  CHECK(ct.getGradYlm(15)[1] == Approx(5.20695331894));
226  CHECK(ct.getGradYlm(15)[2] == Approx(0));
227 
228  CHECK(ct.getHessYlm(15)(0, 0) == Approx(0));
229  CHECK(ct.getHessYlm(15)(0, 1) == Approx(4.00534870687));
230  CHECK(ct.getHessYlm(15)(0, 2) == Approx(0));
231  CHECK(ct.getHessYlm(15)(1, 0) == Approx(4.00534870687));
232  CHECK(ct.getHessYlm(15)(1, 1) == Approx(4.33912776578));
233  CHECK(ct.getHessYlm(15)(1, 2) == Approx(0));
234  CHECK(ct.getHessYlm(15)(2, 0) == Approx(0));
235  CHECK(ct.getHessYlm(15)(2, 1) == Approx(0));
236  CHECK(ct.getHessYlm(15)(2, 2) == Approx(0));
237 
238 
239  CHECK(ct.getYlm(32) == Approx(-5.07677948596));
240  CHECK(ct.getGradYlm(32)[0] == Approx(-7.81042997841));
241  CHECK(ct.getGradYlm(32)[1] == Approx(-4.23064957164));
242  CHECK(ct.getGradYlm(32)[2] == Approx(10.1535589719));
243 
244  CHECK(ct.getHessYlm(32)(0, 0) == Approx(-6.00802306031));
245  CHECK(ct.getHessYlm(32)(0, 1) == Approx(-6.50869164867));
246  CHECK(ct.getHessYlm(32)(0, 2) == Approx(15.6208599568));
247  CHECK(ct.getHessYlm(32)(1, 0) == Approx(-6.50869164867));
248  CHECK(ct.getHessYlm(32)(1, 1) == Approx(0));
249  CHECK(ct.getHessYlm(32)(1, 2) == Approx(8.46129914327));
250  CHECK(ct.getHessYlm(32)(2, 0) == Approx(15.6208599568));
251  CHECK(ct.getHessYlm(32)(2, 1) == Approx(8.46129914327));
252  CHECK(ct.getHessYlm(32)(2, 2) == Approx(0));
253 
254 
255  CHECK(ct.getYlm(52) == Approx(-1.44809247474));
256  CHECK(ct.getGradYlm(52)[0] == Approx(-1.11391728826));
257  CHECK(ct.getGradYlm(52)[1] == Approx(-1.20674372895));
258  CHECK(ct.getGradYlm(52)[2] == Approx(8.68855484841));
259 
260  CHECK(ct.getHessYlm(52)(0, 0) == Approx(0));
261  CHECK(ct.getHessYlm(52)(0, 1) == Approx(-0.928264406882));
262  CHECK(ct.getHessYlm(52)(0, 2) == Approx(6.68350372955));
263  CHECK(ct.getHessYlm(52)(1, 0) == Approx(-0.928264406882));
264  CHECK(ct.getHessYlm(52)(1, 1) == Approx(0));
265  CHECK(ct.getHessYlm(52)(1, 2) == Approx(7.24046237368));
266  CHECK(ct.getHessYlm(52)(2, 0) == Approx(6.68350372955));
267  CHECK(ct.getHessYlm(52)(2, 1) == Approx(7.24046237368));
268  CHECK(ct.getHessYlm(52)(2, 2) == Approx(-34.7542193937));
269 
270 
271  CHECK(ct.getYlm(71) == Approx(-17.3423920977));
272  CHECK(ct.getGradYlm(71)[0] == Approx(-53.3612064546));
273  CHECK(ct.getGradYlm(71)[1] == Approx(-14.4519934148));
274  CHECK(ct.getGradYlm(71)[2] == Approx(34.6847841955));
275 
276  CHECK(ct.getHessYlm(71)(0, 0) == Approx(-123.141245664));
277  CHECK(ct.getHessYlm(71)(0, 1) == Approx(-44.4676720455));
278  CHECK(ct.getHessYlm(71)(0, 2) == Approx(106.722412909));
279  CHECK(ct.getHessYlm(71)(1, 0) == Approx(-44.4676720455));
280  CHECK(ct.getHessYlm(71)(1, 1) == Approx(0));
281  CHECK(ct.getHessYlm(71)(1, 2) == Approx(28.9039868295));
282  CHECK(ct.getHessYlm(71)(2, 0) == Approx(106.722412909));
283  CHECK(ct.getHessYlm(71)(2, 1) == Approx(28.9039868295));
284  CHECK(ct.getHessYlm(71)(2, 2) == Approx(0));
285 }
The template parameters.
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [413/537]

qmcplusplus::TEST_CASE ( "RandomForTest_getVecRngReal"  ,
""  [utilities][for_testing] 
)

Definition at line 183 of file test_RandomForTest.cpp.

184 {
185  TestGetVecRngReal<float> tgvrr_f;
186  tgvrr_f();
187  TestGetVecRngReal<double> tgvrr_d;
188  tgvrr_d();
189 }

◆ TEST_CASE() [414/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A Ewald2D tri. in rect."  ,
""  [hamiltonian] 
)

Definition at line 184 of file test_ewald2d.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), app_log(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), ParticleSet::getTotalNum(), lattice, ParticleSet::R, ParticleSet::setName(), sqrt(), LRCoulombSingleton::STRICT2D, LRCoulombSingleton::this_lr_type, and ParticleSet::update().

185 {
187  LRCoulombSingleton::CoulombHandler = 0; // !!!! crucial if not first test
188  LRCoulombSingleton::this_lr_type = LRCoulombSingleton::STRICT2D;
189  const double vmad_tri = -1.1061025865191676;
190  const RealType alat = std::sqrt(2.0*M_PI/std::sqrt(3));
191 
192  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
193  lattice.BoxBConds = true; // periodic
194  lattice.ndim = 2;
195  lattice.R = 0.0;
196  lattice.R(0, 0) = alat;
197  lattice.R(1, 1) = std::sqrt(3)*alat;
198  lattice.R(2, 2) = 4.0;
199  lattice.LR_dim_cutoff = 30.0;
200  lattice.reset();
201  lattice.print(app_log());
202 
203  const SimulationCell simulation_cell(lattice);
204  ParticleSet elec(simulation_cell);
205  elec.setName("e");
206  elec.create({2});
207  elec.R[0] = {0.0, 0.0, 0.0};
208  elec.R[1] = {alat/2, static_cast<RealType>(std::sqrt(3))*alat/2, 0.0};
209 
210  SpeciesSet& tspecies = elec.getSpeciesSet();
211  int upIdx = tspecies.addSpecies("u");
212  int chargeIdx = tspecies.addAttribute("charge");
213  int massIdx = tspecies.addAttribute("mass");
214  tspecies(chargeIdx, upIdx) = -1;
215  tspecies(massIdx, upIdx) = 1.0;
216 
217  elec.createSK();
218  elec.addTable(elec); // !!!! crucial with more than 1 particle
219  elec.update();
220  app_log() << elec.R << std::endl;
221 
222  CoulombPBCAA caa = CoulombPBCAA(elec, true, false, false);
223 
224  double val = caa.evaluate(elec)/elec.getTotalNum();
225  CHECK(val == Approx(vmad_tri));
226 }
std::ostream & app_log()
Definition: OutputManager.h:65
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
QMCTraits::RealType RealType
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [415/537]

qmcplusplus::TEST_CASE ( "ReferencePoints::Construction"  ,
""  [estimators] 
)

Definition at line 187 of file test_ReferencePoints.cpp.

References approxEquality(), CHECK(), expectedReferencePoints(), generate_test_data, NEReferencePoints::get_points(), makePsets(), and makeTestRPI().

188 {
189  auto rpi = makeTestRPI();
190  auto ppr = makePsets();
191  NEReferencePoints ref_points(rpi, ppr.pset, ppr.ref_psets);
192 
193  if (generate_test_data)
194  {
195  testing::TestableNEReferencePoints tref_points(ref_points);
196  std::cout << "expected_reference_points" << tref_points;
197  }
198 
199  typename NEReferencePoints::Points expected_reference_points;
200  expected_reference_points = expectedReferencePoints();
201 
202  for (auto& [key, value] : ref_points.get_points())
203  {
204  bool coords_match = approxEquality(expected_reference_points[key], value);
205  CHECK(coords_match);
206  }
207 }
PSetsAndRefList makePsets()
constexpr bool generate_test_data
set to true to generate new random R for particles.
ReferencePointsInput makeTestRPI()
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool approxEquality(const TinyVector< T1, D > &val_a, const TinyVector< T2, D > &val_b)

◆ TEST_CASE() [416/537]

qmcplusplus::TEST_CASE ( "SpinDensityNew::accumulate"  ,
""  [estimators] 
)

Definition at line 187 of file test_SpinDensityNew.cpp.

References SpinDensityNew::accumulate(), CHECK(), doc, OperatorEstBase::get_data(), Libxml2Document::getRoot(), ValidSpinDensityInput::GRID, iattribute, ispecies, node, okay, Libxml2Document::parseFromString(), pset, REQUIRE(), sdi, sdn, species_set, qmcplusplus::hdf::walkers, and ValidSpinDensityInput::xml.

188 {
190  using QMCT = QMCTraits;
191 
193  using input = testing::ValidSpinDensityInput;
194  bool okay = doc.parseFromString(input::xml[input::GRID]);
195  REQUIRE(okay);
196  xmlNodePtr node = doc.getRoot();
197  SpinDensityInput sdi(node);
198  SpeciesSet species_set;
199  int ispecies = species_set.addSpecies("u");
200  ispecies = species_set.addSpecies("d");
201  CHECK(ispecies == 1);
202  int iattribute = species_set.addAttribute("membersize");
203  species_set(iattribute, 0) = 1;
204  species_set(iattribute, 1) = 1;
205 
206  SpinDensityNew sdn(std::move(sdi), species_set);
207  std::vector<MCPWalker> walkers;
208  int nwalkers = 4;
209  for (int iw = 0; iw < nwalkers; ++iw)
210  walkers.emplace_back(2);
211 
212  std::vector<ParticleSet> psets;
213 
214  const SimulationCell simulation_cell;
215  for (int iw = 0; iw < nwalkers; ++iw)
216  {
217  psets.emplace_back(simulation_cell);
218  ParticleSet& pset = psets.back();
219  pset.create({2});
220  pset.R[0] = ParticleSet::PosType(0.00000000, 0.00000000, 0.00000000);
221  pset.R[1] = ParticleSet::PosType(1.68658058, 1.68658058, 1.68658058);
222  }
223 
224  std::vector<TrialWaveFunction> wfns;
225  std::vector<QMCHamiltonian> hams;
226 
227  auto ref_walkers = makeRefVector<MCPWalker>(walkers);
228  auto ref_psets = makeRefVector<ParticleSet>(psets);
229  auto ref_wfns = makeRefVector<TrialWaveFunction>(wfns);
230  auto ref_hams = makeRefVector<QMCHamiltonian>(hams);
231 
232  FakeRandom<OHMMS_PRECISION_FULL> rng;
233 
234  sdn.accumulate(ref_walkers, ref_psets, ref_wfns, ref_hams, rng);
235 
236  std::vector<QMCT::RealType>& data_ref = sdn.get_data();
237  // There should be a check that the discretization of particle locations expressed in lattice coords
238  // is correct. This just checks it hasn't changed from how it was in SpinDensity which lacked testing.
239  CHECK(data_ref[555] == 4);
240  CHECK(data_ref[1777] == 4);
241 }
std::vector< QMCT::RealType > & get_data()
class that handles xmlDoc
Definition: Libxml2Doc.h:76
void accumulate(const RefVector< MCPWalker > &walkers, const RefVector< ParticleSet > &psets, const RefVector< TrialWaveFunction > &wfns, const RefVector< QMCHamiltonian > &hams, RandomBase< FullPrecRealType > &rng) override
accumulate 1 or more walkers of SpinDensity samples
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
SpinDensityInput sdi(node)
const char walkers[]
Definition: HDFVersion.h:36
QMCTraits::PosType PosType
SpinDensityNew(std::move(sdi), species_set)
species_set(iattribute, ispecies)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker
Definition: test_walker.cpp:31
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
testing::ValidSpinDensityInput input
SpinDensityNew sdn(std::move(sdi), lattice, species_set)

◆ TEST_CASE() [417/537]

qmcplusplus::TEST_CASE ( "SoA Cartesian Tensor evaluateVGH subset"  ,
""  [numerics] 
)

Definition at line 187 of file test_soa_cartesian_tensor.cpp.

References CHECK(), SoaCartesianTensor< T >::evaluateVGH(), and SoaCartesianTensor< T >::getcXYZ().

188 {
189  SoaCartesianTensor<double> ct(6);
190 
191  double x = 1.3;
192  double y = 1.2;
193  double z = -0.5;
194  ct.evaluateVGH(x, y, z);
195 
196  const double* XYZ = ct.getcXYZ().data(0);
197  const double* gr0 = ct.getcXYZ().data(1);
198  const double* gr1 = ct.getcXYZ().data(2);
199  const double* gr2 = ct.getcXYZ().data(3);
200  const double* h00 = ct.getcXYZ().data(4);
201  const double* h01 = ct.getcXYZ().data(5);
202  const double* h02 = ct.getcXYZ().data(6);
203  const double* h11 = ct.getcXYZ().data(7);
204  const double* h12 = ct.getcXYZ().data(8);
205  const double* h22 = ct.getcXYZ().data(9);
206 
207  CHECK(XYZ[0] == Approx(0.282094791774));
208  CHECK(gr0[0] == Approx(0));
209  CHECK(gr1[0] == Approx(0));
210  CHECK(gr2[0] == Approx(0));
211 
212  CHECK(h00[0] == Approx(0));
213  CHECK(h01[0] == Approx(0));
214  CHECK(h02[0] == Approx(0));
215  CHECK(h11[0] == Approx(0));
216  CHECK(h12[0] == Approx(0));
217  CHECK(h22[0] == Approx(0));
218 
219 
220  CHECK(XYZ[1] == Approx(0.635183265474));
221  CHECK(gr0[1] == Approx(0.488602511903));
222  CHECK(gr1[1] == Approx(0));
223  CHECK(gr2[1] == Approx(0));
224 
225  CHECK(h00[1] == Approx(0));
226  CHECK(h01[1] == Approx(0));
227  CHECK(h02[1] == Approx(0));
228  CHECK(h11[1] == Approx(0));
229  CHECK(h12[1] == Approx(0));
230  CHECK(h22[1] == Approx(0));
231 
232 
233  CHECK(XYZ[15] == Approx(3.12417199136));
234  CHECK(gr0[15] == Approx(2.40320922412));
235  CHECK(gr1[15] == Approx(5.20695331894));
236  CHECK(gr2[15] == Approx(0));
237 
238  CHECK(h00[15] == Approx(0));
239  CHECK(h01[15] == Approx(4.00534870687));
240  CHECK(h02[15] == Approx(0));
241  CHECK(h11[15] == Approx(4.33912776578));
242  CHECK(h12[15] == Approx(0));
243  CHECK(h22[15] == Approx(0));
244 
245 
246  CHECK(XYZ[32] == Approx(-5.07677948596));
247  CHECK(gr0[32] == Approx(-7.81042997841));
248  CHECK(gr1[32] == Approx(-4.23064957164));
249  CHECK(gr2[32] == Approx(10.1535589719));
250 
251  CHECK(h00[32] == Approx(-6.00802306031));
252  CHECK(h01[32] == Approx(-6.50869164867));
253  CHECK(h02[32] == Approx(15.6208599568));
254  CHECK(h11[32] == Approx(0));
255  CHECK(h12[32] == Approx(8.46129914327));
256  CHECK(h22[32] == Approx(0));
257 
258 
259  CHECK(XYZ[52] == Approx(-1.44809247474));
260  CHECK(gr0[52] == Approx(-1.11391728826));
261  CHECK(gr1[52] == Approx(-1.20674372895));
262  CHECK(gr2[52] == Approx(8.68855484841));
263 
264  CHECK(h00[52] == Approx(0));
265  CHECK(h01[52] == Approx(-0.928264406882));
266  CHECK(h02[52] == Approx(6.68350372955));
267  CHECK(h11[52] == Approx(0));
268  CHECK(h12[52] == Approx(7.24046237368));
269  CHECK(h22[52] == Approx(-34.7542193937));
270 
271 
272  CHECK(XYZ[71] == Approx(-17.3423920977));
273  CHECK(gr0[71] == Approx(-53.3612064546));
274  CHECK(gr1[71] == Approx(-14.4519934148));
275  CHECK(gr2[71] == Approx(34.6847841955));
276 
277  CHECK(h00[71] == Approx(-123.141245664));
278  CHECK(h01[71] == Approx(-44.4676720455));
279  CHECK(h02[71] == Approx(106.722412909));
280  CHECK(h11[71] == Approx(0));
281  CHECK(h12[71] == Approx(28.9039868295));
282  CHECK(h22[71] == Approx(0));
283 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [418/537]

qmcplusplus::TEST_CASE ( "SpaceGrid::Basic"  ,
""  [estimators] 
)

Definition at line 188 of file test_NESpaceGrid.cpp.

References ParticleSet::addTable(), ParticleSet::applyMinimumImage(), CHECK(), comm, OHMMS::Controller, ParticleSet::getDistTableAB(), ParticleSet::getTotalNum(), OHMMS_DIM, SpaceGridEnv< VALID >::pset_elec_, SpaceGridEnv< VALID >::pset_ions_, ParticleSet::R, SpaceGridEnv< VALID >::ref_points_, Matrix< T, Alloc >::resize(), SpaceGridEnv< VALID >::sgi_, and ParticleSet::update().

189 {
190  using Input = testing::ValidSpaceGridInput;
191  Communicate* comm;
193  testing::SpaceGridEnv<Input::valid::ORIGIN> sge(comm);
194  int num_values = 3;
195  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), num_values, true);
196  using NES = testing::NESpaceGridTests<double>;
197  auto buffer_start = NES::getBufferStart(space_grid);
198  auto buffer_end = NES::getBufferEnd(space_grid);
199  space_grid.write_description(std::cout, std::string(""));
200  auto& sgi = *(sge.sgi_);
201  auto& agr = sgi.get_axis_grids();
202  for (int id = 0; id < OHMMS_DIM; ++id)
203  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
204  //CHECK(buffer_start == 0);
205  //CHECK(buffer_end == 23999);
206 
207  CHECK(space_grid.nDomains() == 8000);
208 
209  CHECK(space_grid.getDataVector().size() == 24000);
210 
211  Matrix<Real> values;
212  values.resize(sge.pset_elec_.getTotalNum(), num_values);
213 
214  for (int ip = 0; ip < sge.pset_elec_.getTotalNum(); ++ip)
215  for (int iv = 0; iv < num_values; ++iv)
216  values(ip, iv) = ip + 0.1 * iv;
217 
218  const int ei_tid = sge.pset_elec_.addTable(sge.pset_ions_);
219  sge.pset_elec_.update();
220  sge.pset_ions_.update();
221 
222  std::vector<bool> p_outside(8, false);
223  space_grid.accumulate(sge.pset_elec_.R, values, p_outside, sge.pset_elec_.getDistTableAB(ei_tid));
224 
225  // check that what's in data_pool is what is expected.
226  const auto& grid_data = NES::getData(space_grid);
227 
228  auto tensorAccessor = [](const auto& grid_data, int i, int j, int k, int iv) {
229  return grid_data[1200 * i + 60 * j + 3 * k + iv];
230  };
231 
232  CHECK(tensorAccessor(grid_data, 10, 17, 9, 0) == Approx(2.0));
233  CHECK(tensorAccessor(grid_data, 10, 17, 9, 1) == Approx(2.1));
234  CHECK(tensorAccessor(grid_data, 10, 17, 9, 2) == Approx(2.2));
235  CHECK(tensorAccessor(grid_data, 12, 15, 7, 0) == Approx(4.0));
236  CHECK(tensorAccessor(grid_data, 12, 15, 7, 1) == Approx(4.1));
237  CHECK(tensorAccessor(grid_data, 12, 15, 7, 2) == Approx(4.2));
238  CHECK(tensorAccessor(grid_data, 12, 16, 11, 0) == Approx(3.0));
239  CHECK(tensorAccessor(grid_data, 12, 16, 11, 1) == Approx(3.1));
240  CHECK(tensorAccessor(grid_data, 12, 16, 11, 2) == Approx(3.2));
241  CHECK(tensorAccessor(grid_data, 13, 11, 15, 0) == Approx(6.0));
242  CHECK(tensorAccessor(grid_data, 13, 11, 15, 1) == Approx(6.1));
243  CHECK(tensorAccessor(grid_data, 13, 11, 15, 2) == Approx(6.2));
244  CHECK(tensorAccessor(grid_data, 14, 13, 13, 0) == Approx(1.0));
245  CHECK(tensorAccessor(grid_data, 14, 13, 13, 1) == Approx(1.2));
246  CHECK(tensorAccessor(grid_data, 14, 13, 13, 2) == Approx(1.4));
247  CHECK(tensorAccessor(grid_data, 15, 11, 10, 0) == Approx(7.0));
248  CHECK(tensorAccessor(grid_data, 15, 11, 10, 1) == Approx(7.1));
249  CHECK(tensorAccessor(grid_data, 15, 11, 10, 2) == Approx(7.2));
250  CHECK(tensorAccessor(grid_data, 17, 12, 9, 0) == Approx(5.0));
251  CHECK(tensorAccessor(grid_data, 17, 12, 9, 1) == Approx(5.1));
252  CHECK(tensorAccessor(grid_data, 17, 12, 9, 2) == Approx(5.2));
253  // new pset R's
254  // check again
255  auto min_R =
256  ParticleSet::ParticlePos{{-0.6759092808, 0.835668385, 1.985307097}, {0.09710352868, -0.76751858, -1.89306891},
257  {-0.5605484247, -0.9578875303, 1.476860642}, {2.585144997, 1.862680197, 3.282609463},
258  {-0.1961335093, 1.111888766, -0.578481257}, {1.794641614, 1.6000278, -0.9474347234},
259  {2.157717228, 0.9254754186, 2.263158321}, {1.883366346, 2.136350632, 3.188981533}};
260  sge.pset_elec_.applyMinimumImage(min_R);
261  sge.pset_elec_.R = min_R;
262 
263  sge.pset_elec_.update();
264 
265  std::vector<bool> p_outside_2(8, false);
266  space_grid.accumulate(sge.pset_elec_.R, values, p_outside_2, sge.pset_elec_.getDistTableAB(ei_tid));
267 
268  CHECK(tensorAccessor(grid_data, 1, 13, 15, 0) == Approx(2.0));
269  CHECK(tensorAccessor(grid_data, 1, 13, 15, 1) == Approx(2.1));
270  CHECK(tensorAccessor(grid_data, 1, 13, 15, 2) == Approx(2.2));
271  CHECK(tensorAccessor(grid_data, 2, 6, 7, 0) == Approx(5.0));
272  CHECK(tensorAccessor(grid_data, 2, 6, 7, 1) == Approx(5.1));
273  CHECK(tensorAccessor(grid_data, 2, 6, 7, 2) == Approx(5.2));
274  CHECK(tensorAccessor(grid_data, 4, 0, 11, 1) == Approx(0.1));
275  CHECK(tensorAccessor(grid_data, 4, 0, 11, 2) == Approx(0.2));
276  CHECK(tensorAccessor(grid_data, 10, 17, 9, 0) == Approx(2.0));
277  CHECK(tensorAccessor(grid_data, 10, 17, 9, 1) == Approx(2.1));
278  CHECK(tensorAccessor(grid_data, 10, 17, 9, 2) == Approx(2.2));
279  CHECK(tensorAccessor(grid_data, 12, 0, 18, 0) == Approx(7.0));
280  CHECK(tensorAccessor(grid_data, 12, 0, 18, 1) == Approx(7.1));
281  CHECK(tensorAccessor(grid_data, 12, 0, 18, 2) == Approx(7.2));
282  CHECK(tensorAccessor(grid_data, 12, 13, 0, 0) == Approx(6.0));
283  CHECK(tensorAccessor(grid_data, 12, 13, 0, 1) == Approx(6.1));
284  CHECK(tensorAccessor(grid_data, 12, 13, 0, 2) == Approx(6.2));
285  CHECK(tensorAccessor(grid_data, 12, 15, 7, 0) == Approx(4.0));
286  CHECK(tensorAccessor(grid_data, 12, 15, 7, 1) == Approx(4.1));
287  CHECK(tensorAccessor(grid_data, 12, 15, 7, 2) == Approx(4.2));
288  CHECK(tensorAccessor(grid_data, 12, 16, 11, 0) == Approx(3.0));
289  CHECK(tensorAccessor(grid_data, 12, 16, 11, 1) == Approx(3.1));
290  CHECK(tensorAccessor(grid_data, 12, 16, 11, 2) == Approx(3.2));
291  CHECK(tensorAccessor(grid_data, 13, 1, 6, 0) == Approx(1.0));
292  CHECK(tensorAccessor(grid_data, 13, 1, 6, 1) == Approx(1.1));
293  CHECK(tensorAccessor(grid_data, 13, 1, 6, 2) == Approx(1.2));
294  CHECK(tensorAccessor(grid_data, 13, 11, 15, 0) == Approx(6.0));
295  CHECK(tensorAccessor(grid_data, 13, 11, 15, 1) == Approx(6.1));
296  CHECK(tensorAccessor(grid_data, 13, 11, 15, 2) == Approx(6.2));
297  CHECK(tensorAccessor(grid_data, 13, 17, 1, 0) == Approx(3.0));
298  CHECK(tensorAccessor(grid_data, 13, 17, 1, 1) == Approx(3.1));
299  CHECK(tensorAccessor(grid_data, 13, 17, 1, 2) == Approx(3.2));
300  CHECK(tensorAccessor(grid_data, 14, 12, 4, 0) == Approx(4.0));
301  CHECK(tensorAccessor(grid_data, 14, 12, 4, 1) == Approx(4.1));
302  CHECK(tensorAccessor(grid_data, 14, 12, 4, 2) == Approx(4.2));
303  CHECK(tensorAccessor(grid_data, 14, 13, 13, 0) == Approx(1.0));
304  CHECK(tensorAccessor(grid_data, 14, 13, 13, 1) == Approx(1.2));
305  CHECK(tensorAccessor(grid_data, 14, 13, 13, 2) == Approx(1.4));
306  CHECK(tensorAccessor(grid_data, 15, 11, 10, 0) == Approx(7.0));
307  CHECK(tensorAccessor(grid_data, 15, 11, 10, 1) == Approx(7.1));
308  CHECK(tensorAccessor(grid_data, 15, 11, 10, 2) == Approx(7.2));
309  CHECK(tensorAccessor(grid_data, 17, 12, 9, 0) == Approx(5.0));
310  CHECK(tensorAccessor(grid_data, 17, 12, 9, 1) == Approx(5.1));
311  CHECK(tensorAccessor(grid_data, 17, 12, 9, 2) == Approx(5.2));
312 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
#define OHMMS_DIM
Definition: config.h:64
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [419/537]

qmcplusplus::TEST_CASE ( "OmpBLAS gemv"  ,
""  [SYCL] 
)

Definition at line 189 of file test_syclBLAS.cpp.

References qmcplusplus::Units::force::N.

190 {
191  const int M = 137;
192  const int N = 79;
193  const int batch_count = 23;
194 
195  // Non-batched test
196  std::cout << "Testing TRANS gemv" << std::endl;
197  test_gemv<float>(M, N, 'T');
198  test_gemv<double>(M, N, 'T');
199 #if defined(QMC_COMPLEX)
200  test_gemv<std::complex<float>>(N, M, 'T');
201  test_gemv<std::complex<double>>(N, M, 'T');
202 #endif
203  // Batched Test
204  std::cout << "Testing TRANS gemv_batched" << std::endl;
205  test_gemv_batched<float>(M, N, 'T', batch_count);
206  test_gemv_batched<double>(M, N, 'T', batch_count);
207 #if defined(QMC_COMPLEX)
208  test_gemv_batched<std::complex<float>>(N, M, 'T', batch_count);
209  test_gemv_batched<std::complex<double>>(N, M, 'T', batch_count);
210 #endif
211 }

◆ TEST_CASE() [420/537]

qmcplusplus::TEST_CASE ( "DiracMatrixComputeCUDA_large_determinants_against_legacy"  ,
""  [wavefunction][fermion] 
)

Definition at line 189 of file test_DiracMatrixComputeCUDA.cpp.

References check_matrix_result, CHECKED_ELSE(), checkMatrix(), DiracMatrix< T_FP >::invert_transpose(), log_values(), qmcplusplus::testing::makeRngSpdMatrix(), DiracMatrixComputeCUDA< VALUE_FP >::mw_invertTranspose(), n, queue, and Matrix< T, Alloc >::resize().

190 {
191  int n = 64;
192  compute::Queue<PlatformKind::CUDA> queue;
193  DiracMatrixComputeCUDA<double> dmcc;
194 
195  Matrix<double> mat_spd;
196  mat_spd.resize(n, n);
197  testing::MakeRngSpdMatrix<double> makeRngSpdMatrix;
198  makeRngSpdMatrix(mat_spd);
199  // You would hope you could do this
200  // OffloadPinnedMatrix<double> mat_a(mat_spd);
201  // But you can't
202  OffloadPinnedMatrix<double> mat_a(n, n);
203  for (int i = 0; i < n; ++i)
204  for (int j = 0; j < n; ++j)
205  mat_a(i, j) = mat_spd(i, j);
206 
207  Matrix<double> mat_spd2;
208  mat_spd2.resize(n, n);
209  makeRngSpdMatrix(mat_spd2);
210  // You would hope you could do this
211  // OffloadPinnedMatrix<double> mat_a(mat_spd);
212  // But you can't
213  OffloadPinnedMatrix<double> mat_a2(n, n);
214  for (int i = 0; i < n; ++i)
215  for (int j = 0; j < n; ++j)
216  mat_a2(i, j) = mat_spd2(i, j);
217 
218  OffloadPinnedVector<std::complex<double>> log_values;
219  log_values.resize(2);
220  OffloadPinnedMatrix<double> inv_mat_a;
221  inv_mat_a.resize(n, n);
222  OffloadPinnedMatrix<double> inv_mat_a2;
223  inv_mat_a2.resize(n, n);
224 
225  RefVector<const OffloadPinnedMatrix<double>> a_mats{mat_a, mat_a2};
226  RefVector<OffloadPinnedMatrix<double>> inv_a_mats{inv_mat_a, inv_mat_a2};
227 
228  dmcc.mw_invertTranspose(queue, a_mats, inv_a_mats, log_values);
229 
230  DiracMatrix<double> dmat;
231  Matrix<double> inv_mat_test(n, n);
232  std::complex<double> det_log_value;
233  dmat.invert_transpose(mat_spd, inv_mat_test, det_log_value);
234 
235  auto check_matrix_result = checkMatrix(inv_mat_a, inv_mat_test);
236  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
237 
238  dmat.invert_transpose(mat_spd2, inv_mat_test, det_log_value);
239  check_matrix_result = checkMatrix(inv_mat_a2, inv_mat_test);
240  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
241 }
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
void makeRngSpdMatrix(testing::RandomForTest< RngValueType< T >> &rng, Matrix< T > &mat_spd)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63

◆ TEST_CASE() [421/537]

qmcplusplus::TEST_CASE ( "Hybridrep SPO from HDF diamond_2x1x1"  ,
""  [wavefunction] 
)

Definition at line 191 of file test_hybridrep.cpp.

References abs(), SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), app_log(), CHECK(), OHMMS::Controller, ParticleSet::create(), ParticleSet::createResource(), EinsplineSetBuilder::createSPOSetFromXML(), doc, dot(), qmcplusplus::Units::charge::e, ParticleSet::getDistTable(), ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), lattice, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), Vector< T, Alloc >::size(), and ParticleSet::update().

192 {
194 
195  ParticleSet::ParticleLayout lattice;
196  // diamondC_2x1x1
197  lattice.R = {6.7463223, 6.7463223, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
198 
199  ParticleSetPool ptcl = ParticleSetPool(c);
200  ptcl.setSimulationCell(lattice);
201  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
202  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
203  ParticleSet& ions_(*ions_uptr);
204  ParticleSet& elec_(*elec_uptr);
205 
206  ions_.setName("ion");
207  ptcl.addParticleSet(std::move(ions_uptr));
208  ions_.create({4});
209  ions_.R[0] = {0.0, 0.0, 0.0};
210  ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
211  ions_.R[2] = {3.37316115, 3.37316115, 0.0};
212  ions_.R[3] = {5.05974173, 5.05974173, 1.68658058};
213  SpeciesSet& ion_species = ions_.getSpeciesSet();
214  int C_Idx = ion_species.addSpecies("C");
215  int C_chargeIdx = ion_species.addAttribute("charge");
216  int cutoffIdx = ion_species.addAttribute("cutoff_radius");
217  int lmaxIdx = ion_species.addAttribute("lmax");
218 
219  ion_species(C_chargeIdx, C_Idx) = 4;
220  ion_species(cutoffIdx, C_Idx) = 0.9;
221  ion_species(lmaxIdx, C_Idx) = 3;
222 
223  elec_.setName("elec");
224  ptcl.addParticleSet(std::move(elec_uptr));
225  elec_.create({3});
226  elec_.R[0] = {0.4, 0.0, 0.0};
227  elec_.R[1] = {0.0, 1.0, 0.0};
228  elec_.R[2] = {0.0, 0.5, 0.5};
229  SpeciesSet& tspecies = elec_.getSpeciesSet();
230  int upIdx = tspecies.addSpecies("u");
231  int chargeIdx = tspecies.addAttribute("charge");
232  tspecies(chargeIdx, upIdx) = -1;
233 
234  //diamondC_2x1x1
235  const char* particles = R"(<tmp>
236 <determinantset type="einspline" href="diamondC_2x1x1.pwscf.h5" tilematrix="2 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.0" precision="float" size="4" hybridrep="yes"/>
237 </tmp>
238 )";
239 
241  bool okay = doc.parseFromString(particles);
242  REQUIRE(okay);
243 
244  xmlNodePtr root = doc.getRoot();
245 
246  xmlNodePtr ein1 = xmlFirstElementChild(root);
247 
248  EinsplineSetBuilder einSet(elec_, ptcl.getPool(), c, ein1);
249  auto spo = einSet.createSPOSetFromXML(ein1);
250  REQUIRE(spo);
251 
252  ions_.update();
253  elec_.update();
254 
257  elec_.getDistTable(0).get_first_neighbor(0, r, dr, false);
258  app_log() << std::setprecision(14) << "check r^2 against dr^2. "
259  << "r = " << r << " dr = " << dr << std::endl;
260  app_log() << "abs(r^2 - dr^2) = " << std::abs(r * r - dot(dr, dr))
261  << " epsilon = " << std::numeric_limits<double>::epsilon() << std::endl;
262 #if defined(MIXED_PRECISION)
263  REQUIRE(std::abs(r * r - dot(dr, dr)) < std::numeric_limits<double>::epsilon() * 1e8);
264 #else
265  REQUIRE(std::abs(r * r - dot(dr, dr)) < std::numeric_limits<double>::epsilon());
266 #endif
267 
268  /* for vgl
269  * In DiracDeterminant, these psiM, dpsiM, and d2psiM
270  * are always sized to elec_.R.size() x elec_.R.size()
271  * Using the same sizes for these. This tests the case
272  * that spo->OrbitalSetSize > elec_.R.size()
273  */
274  SPOSet::ValueMatrix psiM(elec_.R.size(), elec_.R.size());
275  SPOSet::GradMatrix dpsiM(elec_.R.size(), elec_.R.size());
276  SPOSet::ValueMatrix d2psiM(elec_.R.size(), elec_.R.size());
277  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM, dpsiM, d2psiM);
278 
279 #if defined(QMC_COMPLEX)
281  // electron 0
282  // value
283  CHECK(psiM[0][0] == ComplexApprox(ValueType{0.6776432991, 0.6776432991}));
284  CHECK(psiM[0][1] == ComplexApprox(ValueType{1.0759553909, 1.0762499571}));
285  // grad
286  CHECK(dpsiM[0][0][0] == ComplexApprox(ValueType{0.8782411218, 0.878241539}));
287  CHECK(dpsiM[0][0][1] == ComplexApprox(ValueType{0.004904394, 0.0049043936}));
288  CHECK(dpsiM[0][0][2] == ComplexApprox(ValueType{-0.0049044029, -0.0049044029}));
289  CHECK(dpsiM[0][1][0] == ComplexApprox(ValueType{1.1041458845, 1.1067043543}));
290  CHECK(dpsiM[0][1][1] == ComplexApprox(ValueType{0.6333346963, 0.6384321451}));
291  CHECK(dpsiM[0][1][2] == ComplexApprox(ValueType{-0.6333346963, -0.6384321451}));
292  // lapl
293  CHECK(d2psiM[0][0] == ComplexApprox(ValueType{4.0779185295, 4.0779790878}).epsilon(1e-4));
294  CHECK(d2psiM[0][1] == ComplexApprox(ValueType{-0.7860302329, -0.7897151113}).epsilon(1e-4));
295 
296  // electron 1
297  // value
298  CHECK(psiM[1][0] == ComplexApprox(ValueType{0.9008999467, 0.9008999467}));
299  CHECK(psiM[1][1] == ComplexApprox(ValueType{1.2383049726, 1.2383049726}));
300  // grad
301  CHECK(dpsiM[1][0][0] == ComplexApprox(ValueType{0.0025820041, 0.0025820041}));
302  CHECK(dpsiM[1][0][1] == ComplexApprox(ValueType{-0.1880052537, -0.1880052537}));
303  CHECK(dpsiM[1][0][2] == ComplexApprox(ValueType{-0.0025404284, -0.0025404284}));
304  CHECK(dpsiM[1][1][0] == ComplexApprox(ValueType{0.1069662273, 0.1069453433}));
305  CHECK(dpsiM[1][1][1] == ComplexApprox(ValueType{-0.4364597797, -0.43649593}));
306  CHECK(dpsiM[1][1][2] == ComplexApprox(ValueType{-0.106951952, -0.1069145575}));
307  // lapl
308  CHECK(d2psiM[1][0] == ComplexApprox(ValueType{-1.3757134676, -1.3757134676}));
309  CHECK(d2psiM[1][1] == ComplexApprox(ValueType{-2.4803137779, -2.4919104576}));
310 
311  // electron 2
312  // value
313  CHECK(psiM[2][0] == ComplexApprox(ValueType{0.8841851282, 0.8841851282}));
314  CHECK(psiM[2][1] == ComplexApprox(ValueType{1.0331713017, 1.0291547321}));
315  // grad
316  CHECK(dpsiM[2][0][0] == ComplexApprox(ValueType{0.0688574613, 0.0688574613}));
317  CHECK(dpsiM[2][0][1] == ComplexApprox(ValueType{0.2735091889, 0.2735091889}));
318  CHECK(dpsiM[2][0][2] == ComplexApprox(ValueType{0.2666900514, 0.2666900514}));
319  CHECK(dpsiM[2][1][0] == ComplexApprox(ValueType{0.5398793935, 0.5376840012}));
320  CHECK(dpsiM[2][1][1] == ComplexApprox(ValueType{0.7525391523, 0.7550587239}));
321  CHECK(dpsiM[2][1][2] == ComplexApprox(ValueType{-0.1224437827, -0.1228616516}));
322  // lapl
323  CHECK(d2psiM[2][0] == ComplexApprox(ValueType{-1.1799273657, -1.2044699918}).epsilon(1e-4));
324  CHECK(d2psiM[2][1] == ComplexApprox(ValueType{-2.0339757673, -1.885562226}).epsilon(1e-4));
325 #endif
326 
327  // test batched interfaces
328  ParticleSet elec_2(elec_);
329  // interchange positions
330  elec_2.R[0] = elec_.R[1];
331  elec_2.R[1] = elec_.R[0];
332  elec_2.update();
333  RefVectorWithLeader<ParticleSet> p_list(elec_);
334  p_list.push_back(elec_);
335  p_list.push_back(elec_2);
336 
337  std::unique_ptr<SPOSet> spo_2(spo->makeClone());
338  RefVectorWithLeader<SPOSet> spo_list(*spo);
339  spo_list.push_back(*spo);
340  spo_list.push_back(*spo_2);
341 
342  ResourceCollection pset_res("test_pset_res");
343  ResourceCollection spo_res("test_spo_res");
344 
345  elec_.createResource(pset_res);
346  spo->createResource(spo_res);
347 
348  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
349  ResourceCollectionTeamLock<SPOSet> mw_sposet_lock(spo_res, spo_list);
350 
351  SPOSet::ValueVector psi(spo->getOrbitalSetSize());
352  SPOSet::GradVector dpsi(spo->getOrbitalSetSize());
353  SPOSet::ValueVector d2psi(spo->getOrbitalSetSize());
354  SPOSet::ValueVector psi_2(spo->getOrbitalSetSize());
355  SPOSet::GradVector dpsi_2(spo->getOrbitalSetSize());
356  SPOSet::ValueVector d2psi_2(spo->getOrbitalSetSize());
357 
358  RefVector<SPOSet::ValueVector> psi_v_list;
359  RefVector<SPOSet::GradVector> dpsi_v_list;
360  RefVector<SPOSet::ValueVector> d2psi_v_list;
361 
362  psi_v_list.push_back(psi);
363  psi_v_list.push_back(psi_2);
364  dpsi_v_list.push_back(dpsi);
365  dpsi_v_list.push_back(dpsi_2);
366  d2psi_v_list.push_back(d2psi);
367  d2psi_v_list.push_back(d2psi_2);
368 
369  spo->mw_evaluateVGL(spo_list, p_list, 0, psi_v_list, dpsi_v_list, d2psi_v_list);
370 #if defined(QMC_COMPLEX)
372  // value
373  CHECK(psi_v_list[1].get()[0] == ComplexApprox(ValueType{0.9008999467, 0.9008999467}));
374  CHECK(psi_v_list[1].get()[1] == ComplexApprox(ValueType{1.2383049726, 1.2383049726}));
375  // grad
376  CHECK(dpsi_v_list[1].get()[0][0] == ComplexApprox(ValueType{0.0025820041, 0.0025820041}));
377  CHECK(dpsi_v_list[1].get()[0][1] == ComplexApprox(ValueType{-0.1880052537, -0.1880052537}));
378  CHECK(dpsi_v_list[1].get()[0][2] == ComplexApprox(ValueType{-0.0025404284, -0.0025404284}));
379  CHECK(dpsi_v_list[1].get()[1][0] == ComplexApprox(ValueType{0.1069662273, 0.1069453433}));
380  CHECK(dpsi_v_list[1].get()[1][1] == ComplexApprox(ValueType{-0.4364597797, -0.43649593}));
381  CHECK(dpsi_v_list[1].get()[1][2] == ComplexApprox(ValueType{-0.106951952, -0.1069145575}));
382  // lapl
383  CHECK(d2psi_v_list[1].get()[0] == ComplexApprox(ValueType{-1.3757134676, -1.3757134676}));
384  CHECK(d2psi_v_list[1].get()[1] == ComplexApprox(ValueType{-2.4803137779, -2.4919104576}));
385 #endif
386 }
T dot(T *a, T *b)
class that handles xmlDoc
Definition: Libxml2Doc.h:76
MakeReturn< UnaryNode< FnFabs, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t abs(const Vector< T1, C1 > &l)
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [422/537]

qmcplusplus::TEST_CASE ( "RandomForTest_fillBufferRngComplex"  ,
""  [utilities][for_testing] 
)

Definition at line 191 of file test_RandomForTest.cpp.

192 {
193  TestFillBufferRngComplex<std::complex<float>> tfbrc_f;
194  tfbrc_f();
195  TestFillBufferRngComplex<std::complex<double>> tfbrc_d;
196  tfbrc_d();
197 }

◆ TEST_CASE() [423/537]

qmcplusplus::TEST_CASE ( "test_timer_nested_profile_two_children"  ,
""  [utilities] 
)

Definition at line 193 of file test_timer.cpp.

References TimerManager< TIMER >::collate_stack_profile(), convert_to_ns(), TimerManager< TIMER >::createTimer(), doc, Libxml2Document::dump(), Libxml2Document::getRoot(), TimerManager< TIMER >::StackProfileData::names, Libxml2Document::newDoc(), TimerManager< TIMER >::output_timing(), REQUIRE(), qmcplusplus::Units::time::s, TimerManager< TIMER >::set_timer_threshold(), TimerType< CLOCK >::start(), TimerType< CLOCK >::stop(), and timer_level_fine.

194 {
195  FakeTimerManager tm;
196  tm.set_timer_threshold(timer_level_fine);
197  FakeTimer* t1 = tm.createTimer("timer1");
198  FakeTimer* t2 = tm.createTimer("timer2");
199  FakeTimer* t3 = tm.createTimer("timer3");
200 
201  FakeChronoClock::fake_chrono_clock_increment = convert_to_ns(1.1s);
202  t1->start();
203  t2->start();
204  t2->stop();
205  t3->start();
206  t3->stop();
207  t1->stop();
208 
209  FakeTimerManager::StackProfileData p2;
210  tm.collate_stack_profile(NULL, p2);
211 
212 #ifdef ENABLE_TIMERS
213  REQUIRE(p2.names.size() == 3);
214  REQUIRE(p2.names[0] == "timer1");
215  REQUIRE(p2.names[1] == "timer1/timer2");
216  REQUIRE(p2.names[2] == "timer1/timer3");
217 #endif
218 
219 
221  doc.newDoc("resources");
222  tm.output_timing(NULL, doc, doc.getRoot());
223  doc.dump("tmp.xml");
224  // To really test this, should read the file in and inspect the contents.
225  // For now, it makes for quick iterations on writing the file.
226 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
TimerType< FakeChronoClock > FakeTimer
Definition: NewTimer.h:235
void newDoc(const std::string &rootName)
Definition: Libxml2Doc.cpp:93
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
FakeChronoClock::duration convert_to_ns(T in)
REQUIRE(std::filesystem::exists(filename))
TimerManager< FakeTimer > FakeTimerManager
Definition: test_timer.cpp:23
void dump(const std::string &newxml)
Definition: Libxml2Doc.cpp:109

◆ TEST_CASE() [424/537]

qmcplusplus::TEST_CASE ( "RandomForTest_fillVecRngComplex"  ,
""  [utilities][for_testing] 
)

Definition at line 199 of file test_RandomForTest.cpp.

200 {
201  TestFillVecRngComplex<std::complex<float>> tfvrc_f;
202  tfvrc_f();
203  TestFillVecRngComplex<std::complex<double>> tfvrc_d;
204  tfvrc_d();
205 }

◆ TEST_CASE() [425/537]

qmcplusplus::TEST_CASE ( "fillfromText"  ,
""  [drivers] 
)

Definition at line 199 of file test_QMCCostFunctionBatched.cpp.

References fill_from_text(), and get_diamond_fill_data().

200 {
201  FillData fd;
202 
203  // Generated from short-diamondC_1x1x1_pp-opt_sdj-1-16 with 1 thread and 10 samples
204  // And the bsplines sizes were reduced from 8 to 4 to give a total of 12 parameters
206 
207  // Test for 1 and 2 crowds (threads)
208  for (int num_opt_crowds = 1; num_opt_crowds < 3; num_opt_crowds++)
209  {
210  fill_from_text(num_opt_crowds, fd);
211  }
212 }
void fill_from_text(int num_opt_crowds, FillData &fd)
void get_diamond_fill_data(qmcplusplus::FillData &fd)

◆ TEST_CASE() [426/537]

qmcplusplus::TEST_CASE ( "fccz h3"  ,
""  [hamiltonian] 
)

Definition at line 202 of file test_force_ewald.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombDerivHandler, LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), ForceChiesaPBCAA::evaluate(), ForceBase::getForces(), ForceBase::getForcesIonIon(), ParticleSet::getSpeciesSet(), ForceChiesaPBCAA::InitMatrix(), lattice, ParticleSet::R, ParticleSet::resetGroups(), ForceBase::setAddIonIon(), ParticleSet::setName(), and ParticleSet::update().

203 {
204  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
205  lattice.BoxBConds = true; // periodic
206  lattice.R.diagonal(3.77945227);
207  lattice.LR_dim_cutoff = 40;
208  lattice.reset();
209 
210  const SimulationCell simulation_cell(lattice);
211  ParticleSet ions(simulation_cell);
212  ParticleSet elec(simulation_cell);
213 
214  ions.setName("ion");
215  ions.create({3});
216  ions.R[0] = {0.0, 0.0, 0.0};
217  ions.R[1] = {1.6, 1.6, 1.88972614};
218  ions.R[2] = {1.4, 0.0, 0.0};
219  SpeciesSet& ion_species = ions.getSpeciesSet();
220  int pIdx = ion_species.addSpecies("H");
221  int pChargeIdx = ion_species.addAttribute("charge");
222  ion_species(pChargeIdx, pIdx) = 1;
223  ions.createSK();
224 
225  elec.setName("elec");
226  elec.create({2});
227  elec.R[0] = {0.5, 0.0, 0.0};
228  elec.R[1] = {0.0, 0.5, 0.0};
229  SpeciesSet& tspecies = elec.getSpeciesSet();
230  int upIdx = tspecies.addSpecies("u");
231  int chargeIdx = tspecies.addAttribute("charge");
232  int massIdx = tspecies.addAttribute("mass");
233  tspecies(chargeIdx, upIdx) = -1;
234  tspecies(massIdx, upIdx) = 1.0;
235  elec.createSK();
236 
237  // The call to resetGroups is needed transfer the SpeciesSet
238  // settings to the ParticleSet
239  ions.resetGroups();
240  elec.resetGroups();
241 
242  LRCoulombSingleton::CoulombHandler = std::make_unique<EwaldHandler3D>(ions);
243  LRCoulombSingleton::CoulombHandler->initBreakup(ions);
244  LRCoulombSingleton::CoulombDerivHandler = std::make_unique<EwaldHandler3D>(ions);
245  LRCoulombSingleton::CoulombDerivHandler->initBreakup(ions);
246 
247  ForceChiesaPBCAA force(ions, elec);
248  force.setAddIonIon(false);
249 
250  //Ion-Ion forces are validated against Quantum Espresso's ewald method:
251  CHECK(force.getForcesIonIon()[0][0] == Approx(-0.37660901));
252  CHECK(force.getForcesIonIon()[0][1] == Approx(-0.02283659));
253  CHECK(force.getForcesIonIon()[0][2] == Approx(0.0000000));
254  CHECK(force.getForcesIonIon()[1][0] == Approx(0.04012282));
255  CHECK(force.getForcesIonIon()[1][1] == Approx(0.066670175));
256  CHECK(force.getForcesIonIon()[1][2] == Approx(0.0000000));
257  CHECK(force.getForcesIonIon()[2][0] == Approx(0.336486185));
258  CHECK(force.getForcesIonIon()[2][1] == Approx(-0.04383358));
259  CHECK(force.getForcesIonIon()[2][2] == Approx(0.0000000));
260 
261  elec.update();
262  force.InitMatrix();
263  force.evaluate(elec);
264  //Electron-Ion forces are unvalidated externally:
265  CHECK(force.getForces()[0][0] == Approx(3.959178977));
266  CHECK(force.getForces()[0][1] == Approx(3.959178977));
267  CHECK(force.getForces()[0][2] == Approx(0.000000000));
268  CHECK(force.getForces()[1][0] == Approx(-0.078308730));
269  CHECK(force.getForces()[1][1] == Approx(-0.078308730));
270  CHECK(force.getForces()[1][2] == Approx(0.000000000));
271  CHECK(force.getForces()[2][0] == Approx(-1.4341388802));
272  CHECK(force.getForces()[2][1] == Approx(0.1379375923));
273  CHECK(force.getForces()[2][2] == Approx(0.000000000));
274 
275  LRCoulombSingleton::CoulombHandler.reset(nullptr);
276  LRCoulombSingleton::CoulombDerivHandler.reset(nullptr);
277 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [427/537]

qmcplusplus::TEST_CASE ( "Pair Correlation Pair Index"  ,
""  [hamiltonian] 
)

Definition at line 204 of file test_PairCorrEstimator.cpp.

References PairCorrEstimator::gen_pair_id(), and REQUIRE().

205 {
206  // Check generation of pair id for 2 species groups
207  REQUIRE(PairCorrEstimator::gen_pair_id(0, 0, 2) == 0);
208  REQUIRE(PairCorrEstimator::gen_pair_id(0, 1, 2) == 1);
209  REQUIRE(PairCorrEstimator::gen_pair_id(1, 0, 2) == 1);
210  REQUIRE(PairCorrEstimator::gen_pair_id(1, 1, 2) == 2);
211 
212  // Check generation of pair id for 3 species groups
213  REQUIRE(PairCorrEstimator::gen_pair_id(0, 0, 3) == 0);
214  REQUIRE(PairCorrEstimator::gen_pair_id(0, 1, 3) == 1);
215  REQUIRE(PairCorrEstimator::gen_pair_id(0, 2, 3) == 2);
216  REQUIRE(PairCorrEstimator::gen_pair_id(1, 0, 3) == 1);
217  REQUIRE(PairCorrEstimator::gen_pair_id(1, 1, 3) == 3);
218  REQUIRE(PairCorrEstimator::gen_pair_id(1, 2, 3) == 4);
219  REQUIRE(PairCorrEstimator::gen_pair_id(2, 0, 3) == 2);
220  REQUIRE(PairCorrEstimator::gen_pair_id(2, 1, 3) == 4);
221  REQUIRE(PairCorrEstimator::gen_pair_id(2, 2, 3) == 5);
222 }
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [428/537]

qmcplusplus::TEST_CASE ( "RandomForTest_getVecRngComplex"  ,
""  [utilities][for_testing] 
)

Definition at line 207 of file test_RandomForTest.cpp.

208 {
209  TestGetVecRngComplex<std::complex<float>> tgvrc_f;
210  tgvrc_f();
211  TestGetVecRngComplex<std::complex<double>> tgvrc_d;
212  tgvrc_d();
213 }

◆ TEST_CASE() [429/537]

qmcplusplus::TEST_CASE ( "ReferencePoints::Description"  ,
""  [estimators] 
)

Definition at line 209 of file test_ReferencePoints.cpp.

References CHECK(), makePsets(), makeTestRPI(), and NEReferencePoints::write_description().

210 {
211  auto rpi = makeTestRPI();
212  auto ppr = makePsets();
213  NEReferencePoints ref_points(rpi, ppr.pset, ppr.ref_psets);
214 
215  std::ostringstream ostr_stream;
216  ref_points.write_description(ostr_stream, " ");
217 
218  std::string expected_description;
219  // ParticleSet still lowers the coordinate precision in mixed
220  if constexpr (std::is_same_v<QMCTraits::RealType, double>)
221  expected_description = R"( reference_points
222  a1: 3.37316115 3.37316115 0
223  a2: 0 3.37316115 3.37316115
224  a3: 3.37316115 0 3.37316115
225  cmmm: -3.37316115 -3.37316115 -3.37316115
226  cmmp: 0 -3.37316115 0
227  cmpm: -3.37316115 0 0
228  cmpp: 0 0 3.37316115
229  cpmm: 0 0 -3.37316115
230  cpmp: 3.37316115 0 0
231  cppm: 0 3.37316115 0
232  cppp: 3.37316115 3.37316115 3.37316115
233  f1m: -1.686580575 -1.686580575 0
234  f1p: 1.686580575 1.686580575 0
235  f2m: 0 -1.686580575 -1.686580575
236  f2p: 0 1.686580575 1.686580575
237  f3m: -1.686580575 0 -1.686580575
238  f3p: 1.686580575 0 1.686580575
239  ion1: 0 0 0
240  ion2: 1.68658058 1.68658058 1.68658058
241  r1: 3.37316115 3.37316115 0
242  r2: 0 3.37316115 3.37316115
243  r3: 3.37316115 0 3.37316115
244  zero: 0 0 0
245  end reference_points
246 )";
247  else
248  expected_description = R"( reference_points
249  a1: 3.373161077 3.373161077 0
250  a2: 0 3.373161077 3.373161077
251  a3: 3.373161077 0 3.373161077
252  cmmm: -3.373161077 -3.373161077 -3.373161077
253  cmmp: 0 -3.373161077 0
254  cmpm: -3.373161077 0 0
255  cmpp: 0 0 3.373161077
256  cpmm: 0 0 -3.373161077
257  cpmp: 3.373161077 0 0
258  cppm: 0 3.373161077 0
259  cppp: 3.373161077 3.373161077 3.373161077
260  f1m: -1.686580539 -1.686580539 0
261  f1p: 1.686580539 1.686580539 0
262  f2m: 0 -1.686580539 -1.686580539
263  f2p: 0 1.686580539 1.686580539
264  f3m: -1.686580539 0 -1.686580539
265  f3p: 1.686580539 0 1.686580539
266  ion1: 0 0 0
267  ion2: 1.686580539 1.686580539 1.686580539
268  r1: 3.373161077 3.373161077 0
269  r2: 0 3.373161077 3.373161077
270  r3: 3.373161077 0 3.373161077
271  zero: 0 0 0
272  end reference_points
273 )";
274  CHECK(ostr_stream.str() == expected_description);
275  // This subclass and function are used to generate the test data and may be useful for further test cases in future.
276  testing::TestableNEReferencePoints test_ref_points(ref_points);
277  std::ostringstream ostr_testing_stream;
278  ostr_testing_stream << test_ref_points;
279  std::string expected_testable_description;
280  if constexpr (std::is_same_v<QMCTraits::RealType, double>)
281  {
282  std::cout << "ParticleSet coords were double\n";
283  expected_testable_description = R"({
284  {"a1", { 3.37316115,3.37316115,0}},
285  {"a2", { 0,3.37316115,3.37316115}},
286  {"a3", { 3.37316115,0,3.37316115}},
287  {"cmmm", { -3.37316115,-3.37316115,-3.37316115}},
288  {"cmmp", { 0,-3.37316115,0}},
289  {"cmpm", { -3.37316115,0,0}},
290  {"cmpp", { 0,0,3.37316115}},
291  {"cpmm", { 0,0,-3.37316115}},
292  {"cpmp", { 3.37316115,0,0}},
293  {"cppm", { 0,3.37316115,0}},
294  {"cppp", { 3.37316115,3.37316115,3.37316115}},
295  {"f1m", { -1.686580575,-1.686580575,0}},
296  {"f1p", { 1.686580575,1.686580575,0}},
297  {"f2m", { 0,-1.686580575,-1.686580575}},
298  {"f2p", { 0,1.686580575,1.686580575}},
299  {"f3m", { -1.686580575,0,-1.686580575}},
300  {"f3p", { 1.686580575,0,1.686580575}},
301  {"ion1", { 0,0,0}},
302  {"ion2", { 1.68658058,1.68658058,1.68658058}},
303  {"r1", { 3.37316115,3.37316115,0}},
304  {"r2", { 0,3.37316115,3.37316115}},
305  {"r3", { 3.37316115,0,3.37316115}},
306  {"zero", { 0,0,0}},
307 };
308 )";
309  }
310  else
311  {
312  std::cout << "ParticleSet coords were in float.\n";
313  expected_testable_description = R"({
314  {"a1", {3.37316107749939,3.37316107749939,0}},
315  {"a2", { 0,3.37316107749939,3.37316107749939}},
316  {"a3", {3.37316107749939,0,3.37316107749939}},
317  {"cmmm", {-3.37316107749939,-3.37316107749939,-3.37316107749939}},
318  {"cmmp", { 0,-3.37316107749939,0}},
319  {"cmpm", {-3.37316107749939,0,0}},
320  {"cmpp", { 0,0,3.37316107749939}},
321  {"cpmm", { 0,0,-3.37316107749939}},
322  {"cpmp", {3.37316107749939,0,0}},
323  {"cppm", { 0,3.37316107749939,0}},
324  {"cppp", {3.37316107749939,3.37316107749939,3.37316107749939}},
325  {"f1m", {-1.686580538749695,-1.686580538749695,0}},
326  {"f1p", {1.686580538749695,1.686580538749695,0}},
327  {"f2m", { 0,-1.686580538749695,-1.686580538749695}},
328  {"f2p", { 0,1.686580538749695,1.686580538749695}},
329  {"f3m", {-1.686580538749695,0,-1.686580538749695}},
330  {"f3p", {1.686580538749695,0,1.686580538749695}},
331  {"ion1", { 0,0,0}},
332  {"ion2", {1.686580538749695,1.686580538749695,1.686580538749695}},
333  {"r1", {3.37316107749939,3.37316107749939,0}},
334  {"r2", { 0,3.37316107749939,3.37316107749939}},
335  {"r3", {3.37316107749939,0,3.37316107749939}},
336  {"zero", { 0,0,0}},
337 };
338 )";
339  }
340  CHECK(ostr_testing_stream.str() == expected_testable_description);
341 }
PSetsAndRefList makePsets()
ReferencePointsInput makeTestRPI()
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [430/537]

qmcplusplus::TEST_CASE ( "Cartesian derivatives of Spherical Harmonics"  ,
""  [numerics] 
)

Definition at line 212 of file test_ylm.cpp.

References CHECK(), imag(), qmcplusplus::Units::distance::m, qmcplusplus::Units::force::N, and sphericalHarmonicGrad().

213 {
214  struct Point
215  {
216  double x;
217  double y;
218  double z;
219  };
220 
221  struct YlmDerivValue
222  {
223  Point p;
224  int l;
225  int m;
226  double dx_re;
227  double dx_im;
228  double dy_re;
229  double dy_im;
230  double dz_re;
231  double dz_im;
232  };
233 
234  //reference values from sympy
235  // (d/dx, d/dy, d/dz)Ylm
236  const int N = 10;
237  YlmDerivValue Vals[N] =
238  {{{0.587785, 0, 0.809017}, 1, -1, 0.2261289, 0.0, 0.0, -0.3454942, -0.1642922, 0.0},
239  {{2.938925, 0, 4.045085}, 1, 0, -0.0464689, 0.0, 0.0, 0.0, 0.0337616, 0.0},
240  {{4.755285, 0, 1.545085}, 1, 1, -0.0065983, 0.0, 0.0, -0.0690987, 0.020307, 0.0},
241  {{0.587785, 0, 0.809017}, 2, -2, 0.2972075, 0.0, 0.0, -0.4540925, -0.2159337, 0.0},
242  {{1.469465, 4.52254, 1.545085}, 2, -1, 0.0394982, 0.0253845, -0.0253846, 0.0303795, 0.0367369, -0.1130644},
243  {{0.587785, 0, -0.809017}, 2, 0, -0.7280067, 0.0, 0.0, 0.0, -0.5289276, 0.0},
244  {{0.293893, 0.904508, -0.309017}, 2, 1, 0.1974909, -0.1269229, -0.1269229, -0.1518973, -0.183685, -0.5653221},
245  {{1.469465, 4.52254, 1.545085}, 2, 2, 0.0786382, 0.1156131, -0.0374877, -0.0288926, 0.0349388, -0.0253846},
246  {{-0.475528, -0.345492, -0.809017}, 3, -3, 0.1709827, -0.2963218, -0.3841394, -0.0501111, 0.0635463, 0.1955735},
247  {{-2.37764, -1.72746, 4.045085}, 4, 4, 0.0059594, -0.0565636, 0.0565635, 0.0307981, 0.0276584, -0.0200945}};
248 
250  for (int i = 0; i < N; i++)
251  {
252  YlmDerivValue& v = Vals[i];
253  vec_t w;
254  w[0] = v.p.x; // first component appears to be aligned along the z-axis
255  w[1] = v.p.y;
256  w[2] = v.p.z;
257 
259  sphericalHarmonicGrad(v.l, v.m, w, grad);
260  //printf("%d %d expected %g %g %g %g actual %g %g %g %g\n",v.l,v.m,v.th_re,v.th_im, v.ph_re, v.ph_im, theta.real(), theta.imag(), phi.real(), phi.imag());
261  CHECK(std::real(grad[0]) == Approx(v.dx_re));
262  CHECK(std::imag(grad[0]) == Approx(v.dx_im));
263  CHECK(std::real(grad[1]) == Approx(v.dy_re));
264  CHECK(std::imag(grad[1]) == Approx(v.dy_im));
265  CHECK(std::real(grad[2]) == Approx(v.dz_re));
266  CHECK(std::imag(grad[2]) == Approx(v.dz_im));
267  }
268 }
TinyVector< double, 3 > vec_t
QMCTraits::RealType real
void sphericalHarmonicGrad(const int l, const int m, const TinyVector< T, 3 > &r, TinyVector< std::complex< T >, 3 > &grad)
get cartesian derivatives of spherical Harmonics.
Definition: Ylm.h:158
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [431/537]

qmcplusplus::TEST_CASE ( "OmpBLAS gemv notrans"  ,
""  [SYCL] 
)

Definition at line 213 of file test_syclBLAS.cpp.

References qmcplusplus::Units::force::N.

214 {
215  const int M = 137;
216  const int N = 79;
217  const int batch_count = 23;
218 
219  // Non-batched test
220  std::cout << "Testing NOTRANS gemv" << std::endl;
221  test_gemv<float>(M, N, 'N');
222  test_gemv<double>(M, N, 'N');
223 #if defined(QMC_COMPLEX)
224  test_gemv<std::complex<float>>(N, M, 'N');
225  test_gemv<std::complex<double>>(N, M, 'N');
226 #endif
227  // Batched Test
228  std::cout << "Testing NOTRANS gemv_batched" << std::endl;
229  test_gemv_batched<float>(M, N, 'N', batch_count);
230  test_gemv_batched<double>(M, N, 'N', batch_count);
231 #if defined(QMC_COMPLEX)
232  test_gemv_batched<std::complex<float>>(N, M, 'N', batch_count);
233  test_gemv_batched<std::complex<double>>(N, M, 'N', batch_count);
234 #endif
235 }

◆ TEST_CASE() [432/537]

qmcplusplus::TEST_CASE ( "distance_open_species_deviation"  ,
""  [distance_table][xml] 
)

Definition at line 214 of file test_distance_table.cpp.

References ParticleSet::addTable(), CHECK(), doc, ParticleSet::getDistTableAB(), OhmmsElementBase::getName(), Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), ParticleSet::getTotalNum(), ParticleSet::GroupID, ParticleSet::isSameMass(), okay, Libxml2Document::parseFromString(), pow(), XMLParticleParser::readXML(), REQUIRE(), sqrt(), and ParticleSet::update().

215 {
216  // pull out distances between specific species
217 
218 
219  const char* particles = R"(<tmp>
220 <particleset name="e" random="yes">
221  <group name="u" size="2" mass="1.0">
222  <parameter name="charge" > -1 </parameter>
223  <parameter name="mass" > 1.0 </parameter>
224  <attrib name="position" datatype="posArray" condition="0">
225  0.70000000 0.00000000 0.00000000
226  0.00000000 1.00000000 0.00000000
227  </attrib>
228  </group>
229  <group name="d" size="1" mass="1.0">
230  <parameter name="charge" > -1 </parameter>
231  <parameter name="mass" > 1.0 </parameter>
232  <attrib name="position" datatype="posArray" condition="0">
233  -0.90000000 0.00000000 0.00000000
234  </attrib>
235  </group>
236 </particleset>
237 <particleset name="ion0">
238  <group name="H" size="2" mass="1836.15">
239  <parameter name="charge" > 1 </parameter>
240  <parameter name="valence" > 1 </parameter>
241  <parameter name="atomicnumber" > 1 </parameter>
242  <parameter name="mass" > 1836.15 </parameter>
243  <attrib name="position" datatype="posArray" condition="0">
244  0.00000000 0.00000000 0.00000000
245  1.00000000 0.00000000 0.00000000
246  </attrib>
247  </group>
248 </particleset>
249 </tmp>
250 )";
251 
253  bool okay = doc.parseFromString(particles);
254  REQUIRE(okay);
255 
256  xmlNodePtr root = doc.getRoot();
257  xmlNodePtr part1 = xmlFirstElementChild(root);
258  xmlNodePtr part2 = xmlNextElementSibling(part1);
259 
260  // read particle set
261  const SimulationCell simulation_cell;
262  ParticleSet ions(simulation_cell), electrons(simulation_cell);
263 
264  XMLParticleParser parse_electrons(electrons);
265  parse_electrons.readXML(part1);
266 
267  XMLParticleParser parse_ions(ions);
268  parse_ions.readXML(part2);
269 
270  REQUIRE(electrons.getName() == "e");
271  REQUIRE(ions.getName() == "ion0");
272  REQUIRE(ions.isSameMass());
273  REQUIRE(electrons.isSameMass());
274 
275  // calculate particle distances
276  const int tid = electrons.addTable(ions);
277  electrons.update();
278 
279  // get distance table attached to target particle set (electrons)
280  const auto& dtable = electrons.getDistTableAB(tid);
281  REQUIRE(dtable.getName() == "ion0_e");
282 
283  // get the electron species set
284  SpeciesSet& especies(electrons.getSpeciesSet());
285 
286  REQUIRE(dtable.sources() == ions.getTotalNum());
287  REQUIRE(dtable.targets() == electrons.getTotalNum());
288 
289  // !! assume "u" and "H" groups have the same number of particles
290  double latdev2 = 0.0; // mean-squared deviation from lattice
291  int cur_jat(-1); // keep an index to the last found target particle
292  double expect[] = {0.7, std::sqrt(2)};
293  int idx(0);
294  for (int iat = 0; iat < dtable.sources(); iat++, idx++)
295  {
296  for (int jat = cur_jat + 1; jat < dtable.targets(); jat++, idx++)
297  {
298  // find next "u"
299  int species_id = electrons.GroupID[jat];
300  string species_name = especies.speciesName[species_id];
301  if (species_name != "u")
302  continue;
303 
304  // calculate distance from lattice site iat
305  double dist = dtable.getDistRow(jat)[iat];
306  latdev2 += std::pow(dist, 2); // !? pow(x,2) does what?
307  CHECK(dist == Approx(expect[idx]));
308  cur_jat = jat;
309  break;
310  }
311  }
312  CHECK(latdev2 / ions.getTotalNum() == Approx(1.245));
313 
314 } // TEST_CASE distance_open_species_deviation
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
MakeReturn< BinaryNode< FnPow, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t pow(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
REQUIRE(std::filesystem::exists(filename))
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [433/537]

qmcplusplus::TEST_CASE ( "TwoBodyJastrow other variables"  ,
""  [wavefunction] 
)

Definition at line 215 of file test_J2_derivatives.cpp.

References TwoBodyJastrow< FT >::addFunc(), CHECK(), TwoBodyJastrow< FT >::checkOutVariables(), TwoBodyJastrow< FT >::evaluateDerivatives(), TwoBodyJastrow< FT >::evaluateDerivativesWF(), get_two_species_particleset(), TwoBodyJastrow< FT >::getComponentOffset(), VariableSet::insert(), VariableSet::insertFrom(), VariableSet::resetIndex(), and VariableSet::size_of_active().

216 {
217  const SimulationCell simulation_cell;
218  ParticleSet elec = get_two_species_particleset(simulation_cell);
219 
220  TwoBodyJastrow<FakeJasFunctor> jorb("J2_fake", elec, false);
221 
222  auto j2a_uptr = std::make_unique<FakeJasFunctor>("test_fake_a");
223  auto j2a = *j2a_uptr;
224  j2a.myVars.insert("opt1", 1.0);
225  // update num_active_vars
226  j2a.myVars.resetIndex();
227  jorb.addFunc(0, 0, std::move(j2a_uptr));
228 
229  auto j2b_uptr = std::make_unique<FakeJasFunctor>("test_fake_b");
230  auto& j2b = *j2b_uptr;
231  j2b.myVars.insert("opt2", 2.0);
232  // update num_active_vars
233  j2b.myVars.resetIndex();
234  jorb.addFunc(0, 1, std::move(j2b_uptr));
235 
236  opt_variables_type global_active;
237  // This is a parameter from another part of the wavefunction
238  global_active.insert("other_opt", 1.0);
239  global_active.insertFrom(j2b.myVars);
240  global_active.resetIndex();
241 
242 
243  jorb.checkOutVariables(global_active);
244 
245  //global_active.print(app_log(),0,true);
246  //jorb.getComponentVars().print(app_log(),0,true);
247 
248  CHECK(global_active.size_of_active() == 2);
249  // Not optimizing the parameter in this Jastrow factor, indicated by first index is -1
250  auto o1 = jorb.getComponentOffset(0);
251  CHECK(o1.first < 0);
252 
253  // Offset into set of active variables (global_active)
254  auto o2 = jorb.getComponentOffset(1);
255  CHECK(o2.first == 0);
256  CHECK(o2.second == 1);
257 
258  auto o3 = jorb.getComponentOffset(2);
259  CHECK(o3.first == 0);
260  CHECK(o3.second == 1);
261 
262  auto o4 = jorb.getComponentOffset(3);
263  CHECK(o4.first < 0);
264 
265 
267 
268  // Check derivative indexing
269  int num_vars = 2;
270  j2b.derivs_.resize(num_vars);
271  // Elements are d/dp_i u(r), d/dp_i du/dr, d/dp_i d2u/dr2
272  j2b.derivs_[0] = {0.5, 1.3, 2.4};
273  Vector<ValueType> dlogpsi(num_vars);
274  jorb.evaluateDerivativesWF(elec, global_active, dlogpsi);
275 
276  CHECK(dlogpsi[1] == ValueApprox(-2.0)); // 4 * derivs_[0][0]
277 
278  Vector<ValueType> dlogpsi2(num_vars);
279  Vector<ValueType> dhpsioverpsi(num_vars);
280 
281  jorb.evaluateDerivatives(elec, global_active, dlogpsi2, dhpsioverpsi);
282  CHECK(dlogpsi2[1] == ValueApprox(-2.0));
283 }
ParticleSet get_two_species_particleset(const SimulationCell &simulation_cell)
void insert(const std::string &vname, real_type v, bool enable=true, int type=OTHER_P)
Definition: VariableSet.h:133
optimize::VariableSet opt_variables_type
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [434/537]

qmcplusplus::TEST_CASE ( "SOVMC-alle"  ,
""  [drivers][vmc] 
)

Definition at line 215 of file test_vmc_driver.cpp.

References CloneManager::acceptRatio(), SpeciesSet::addAttribute(), TrialWaveFunction::addComponent(), QMCHamiltonian::addOperator(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), CloneManager::clearClones(), OHMMS::Controller, ParticleSet::create(), MCWalkerConfiguration::createWalkers(), doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), ParticleSet::getSpeciesSet(), okay, omp_get_max_threads(), Libxml2Document::parseFromString(), QMCDriver::process(), ParticleSet::R, REQUIRE(), MCWalkerConfiguration::resetWalkerProperty(), VMC::run(), Communicate::setName(), ParticleSet::setName(), ParticleSet::setSpinor(), ParticleSet::spins, and ParticleSet::update().

216 {
217  ProjectData project_data;
219  c->setName("test");
220  const SimulationCell simulation_cell;
221  ParticleSet ions(simulation_cell);
222  MCWalkerConfiguration elec(simulation_cell);
223 
224  ions.setName("ion");
225  ions.create({1});
226  ions.R[0] = {0.0, 0.0, 0.0};
227 
228  elec.setName("elec");
229  std::vector<int> agroup(1, 1);
230  elec.create(agroup);
231  elec.R[0] = {1.0, 0.0, 0.0};
232  elec.spins[0] = 0.0;
233  elec.setSpinor(true);
234  elec.createWalkers(1);
235 
236  SpeciesSet& tspecies = elec.getSpeciesSet();
237  int upIdx = tspecies.addSpecies("u");
238  int chargeIdx = tspecies.addAttribute("charge");
239  int massIdx = tspecies.addAttribute("mass");
240  tspecies(chargeIdx, upIdx) = -1;
241  tspecies(massIdx, upIdx) = 1.0;
242 
243  elec.addTable(ions);
244  elec.update();
245 
246  CloneManager::clearClones();
247 
248  TrialWaveFunction psi(project_data.getRuntimeOptions());
249  psi.addComponent(std::make_unique<ConstantOrbital>());
250  psi.registerData(elec, elec[0]->DataSet);
251  elec[0]->DataSet.allocate();
252 
253  using RNG = RandomBase<QMCTraits::FullPrecRealType>;
254  UPtrVector<RNG> rngs(omp_get_max_threads());
255  for (std::unique_ptr<RNG>& rng : rngs)
256  rng = std::make_unique<FakeRandom<QMCTraits::FullPrecRealType>>();
257 
258  QMCHamiltonian h;
259  h.addOperator(std::make_unique<BareKineticEnergy>(elec, psi), "Kinetic");
260  h.addObservables(elec); // get double free error on 'h.Observables' w/o this
261 
262  elec.resetWalkerProperty(); // get memory corruption w/o this
263 
264  VMC vmc_omp(project_data, elec, psi, h, rngs, c, false);
265 
266  const char* vmc_input = R"(<qmc method="vmc" move="alle" checkpoint="-1">
267  <parameter name="substeps">1</parameter>
268  <parameter name="steps">1</parameter>
269  <parameter name="blocks">1</parameter>
270  <parameter name="timestep">0.1</parameter>
271  <parameter name="usedrift">no</parameter>
272  <parameter name="SpinMass">0.25</parameter>
273  </qmc>
274  )";
275 
277  bool okay = doc.parseFromString(vmc_input);
278  REQUIRE(okay);
279  xmlNodePtr root = doc.getRoot();
280 
281  vmc_omp.process(root); // need to call 'process' for QMCDriver, which in turn calls 'put'
282 
283  vmc_omp.run();
284 
285  // With the constant wavefunction, no moves should be rejected
286  double ar = vmc_omp.acceptRatio();
287  CHECK(ar == Approx(1.0));
288 
289  // Each electron moved sqrt(tau)*gaussian_rng()
290  // See Particle>Base/tests/test_random_seq.cpp for the gaussian random numbers
291  // Values from diffuse.py for moving one step
292 
293  CHECK(elec.R[0][0] == Approx(0.627670258894097));
294  CHECK(elec.R[0][1] == Approx(0.0));
295  CHECK(elec.R[0][2] == Approx(-0.372329741105903));
296 
297  CHECK(elec.spins[0] == Approx(-0.74465948215809097));
298 
299  //Now we're going to test that the step updated the walker variables.
300  CHECK(elec[0]->R[0][0] == Approx(elec.R[0][0]));
301  CHECK(elec[0]->R[0][1] == Approx(elec.R[0][1]));
302  CHECK(elec[0]->R[0][2] == Approx(elec.R[0][2]));
303  CHECK(elec[0]->spins[0] == Approx(elec.spins[0]));
304 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
omp_int_t omp_get_max_threads()
Definition: OpenMP.h:26
REQUIRE(std::filesystem::exists(filename))
void setName(const std::string &aname)
Definition: Communicate.h:129
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
VMC type: vmc, vmc-ptcl, vmc-multiple, vmc-ptcl-multiple.

◆ TEST_CASE() [435/537]

qmcplusplus::TEST_CASE ( "J1 evaluate derivatives Jastrow with two species one without Jastrow"  ,
""  [wavefunction] 
)

Definition at line 216 of file test_J1OrbitalSoA.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ParticleSet::addTable(), app_log(), WaveFunctionFactory::buildTWF(), CHECK(), OHMMS::Controller, ParticleSet::create(), doc, ParticleSet::get(), ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), ispecies, okay, Libxml2Document::parseFromString(), ParticleSet::R, VariableSet::removeInactive(), REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), VariableSet::size_of_active(), twf, and ParticleSet::update().

217 {
219  ParticleSetPool ptcl = ParticleSetPool(c);
220  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
221  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
222  ParticleSet& ions_(*ions_uptr);
223  ParticleSet& elec_(*elec_uptr);
224 
225  ions_.setName("ion0");
226  ptcl.addParticleSet(std::move(ions_uptr));
227  ions_.create({1, 1});
228  ions_.R[0] = {0.0, 0.0, 1.0};
229  ions_.R[1] = {0.0, 0.0, 0.0};
230  SpeciesSet& ispecies = ions_.getSpeciesSet();
231  int OIdx = ispecies.addSpecies("O");
232  int HIdx = ispecies.addSpecies("H");
233  int imassIdx = ispecies.addAttribute("mass");
234  int ichargeIdx = ispecies.addAttribute("charge");
235  ispecies(ichargeIdx, HIdx) = 1.0;
236  ispecies(ichargeIdx, OIdx) = 8.0;
237  ispecies(imassIdx, HIdx) = 1.0;
238  ispecies(imassIdx, OIdx) = 16.0;
239 
240  elec_.setName("e");
241  ptcl.addParticleSet(std::move(elec_uptr));
242  elec_.create({1, 1});
243  elec_.R[0] = {0.5, 0.5, 0.5};
244  elec_.R[1] = {-0.5, -0.5, -0.5};
245 
246  SpeciesSet& tspecies = elec_.getSpeciesSet();
247  int upIdx = tspecies.addSpecies("u");
248  int downIdx = tspecies.addSpecies("d");
249  int massIdx = tspecies.addAttribute("mass");
250  int chargeIdx = tspecies.addAttribute("charge");
251  tspecies(massIdx, upIdx) = 1.0;
252  tspecies(massIdx, downIdx) = 1.0;
253  tspecies(chargeIdx, upIdx) = -1.0;
254  tspecies(massIdx, downIdx) = -1.0;
255  // Necessary to set mass
256  elec_.resetGroups();
257 
258  ions_.update();
259  elec_.addTable(elec_);
260  elec_.addTable(ions_);
261  elec_.update();
262 
263  ions_.get(app_log());
264  elec_.get(app_log());
265 
266  const char* jasxml = R"(<wavefunction name="psi0" target="e">
267  <jastrow name="J1" type="One-Body" function="Bspline" print="yes" source="ion0">
268  <correlation elementType="H" cusp="0.0" size="2" rcut="5.0">
269  <coefficients id="J1H" type="Array"> 0.5 0.1 </coefficients>
270  </correlation>
271  </jastrow>
272 </wavefunction>
273 )";
275  bool okay = doc.parseFromString(jasxml);
276  REQUIRE(okay);
277 
278  xmlNodePtr jas1 = doc.getRoot();
279 
280  // update all distance tables
281  elec_.update();
282  RuntimeOptions runtime_options;
283  WaveFunctionFactory wf_factory(elec_, ptcl.getPool(), c);
284  auto twf_ptr = wf_factory.buildTWF(jas1, runtime_options);
285  auto& twf(*twf_ptr);
286  twf.setMassTerm(elec_);
287  twf.evaluateLog(elec_);
288  twf.prepareGroup(elec_, 0);
289 
290  auto& twf_component_list = twf.getOrbitals();
291 
292  opt_variables_type active;
293  twf.checkInVariables(active);
294  active.removeInactive();
295  int nparam = active.size_of_active();
296  REQUIRE(nparam == 2);
297 
299  Vector<ValueType> dlogpsi(nparam);
300  Vector<ValueType> dhpsioverpsi(nparam);
301  //twf.evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
302  twf_component_list[0]->evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
303 
304  // Numbers not validated independently
305  std::vector<ValueType> expected_dlogpsi = {-0.9336294487, -1.0196051794};
306  std::vector<ValueType> expected_dhpsioverpsi = {-1.1596433096, 0.7595492539};
307  for (int i = 0; i < nparam; i++)
308  {
309  CHECK(dlogpsi[i] == ValueApprox(expected_dlogpsi[i]));
310  CHECK(dhpsioverpsi[i] == ValueApprox(expected_dhpsioverpsi[i]));
311  }
312 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [436/537]

qmcplusplus::TEST_CASE ( "RandomForTest_call_operator"  ,
""  [utilities][for_testing] 
)

Definition at line 216 of file test_RandomForTest.cpp.

References CHECK().

217 {
218  testing::RandomForTest<double> rng_for_test;
219  double test = rng_for_test();
220  CHECK(test == Approx(0.6121701794));
221 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [437/537]

qmcplusplus::TEST_CASE ( "TrialWaveFunction flex_evaluateDeltaLogSetup"  ,
""  [wavefunction] 
)

Definition at line 217 of file test_TrialWaveFunction_He.cpp.

References TrialWaveFunction::addComponent(), CHECK(), OHMMS::Controller, convertUPtrToRefVector(), create_particle_gradient(), create_particle_laplacian(), TrialWaveFunction::createResource(), ParticleSet::createResource(), TrialWaveFunction::evaluateDeltaLog(), TrialWaveFunction::evaluateDeltaLogSetup(), ParticleSet::G, TrialWaveFunction::getOrbitals(), ParticleSet::L, TrialWaveFunction::mw_evaluateDeltaLog(), TrialWaveFunction::mw_evaluateDeltaLogSetup(), ParticleSet::R, Vector< T, Alloc >::resize(), TrialWaveFunction::setLogPsi(), setup_He_wavefunction(), and ParticleSet::update().

218 {
221 
223  const SimulationCell simulation_cell;
224  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
225  auto elec1_ptr = std::make_unique<ParticleSet>(simulation_cell);
226  auto &ions(*ions_ptr), elec1(*elec1_ptr);
227  ions.setName("ion0");
228  elec1.setName("e");
229  WaveFunctionFactory::PSetMap particle_set_map;
230  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
231  particle_set_map.emplace(elec1_ptr->getName(), std::move(elec1_ptr));
232 
233  // This He wavefunction has two components
234  // The orbitals are fixed and have not optimizable parameters.
235  // The Jastrow factor does have an optimizable parameter.
236  auto psi_ptr = setup_He_wavefunction(c, elec1, ions, particle_set_map);
237  TrialWaveFunction& psi(*psi_ptr);
238  ions.update();
239  elec1.update();
240 
241  ParticleSet elec1b(elec1);
242  elec1b.update();
243 
244  ParticleSet elec2(elec1);
245  elec2.R[0][0] = 0.9;
246  elec2.update();
247  ParticleSet elec2b(elec2);
248  elec2b.update();
249 
250  RuntimeOptions runtime_options;
251  TrialWaveFunction psi2(runtime_options);
252  auto orb1 = psi.getOrbitals()[0]->makeClone(elec2);
253  psi2.addComponent(std::move(orb1));
254  auto orb2 = psi.getOrbitals()[1]->makeClone(elec2);
255  psi2.addComponent(std::move(orb2));
256 
257 
258  // testing batched interfaces
259  ResourceCollection pset_res("test_pset_res");
260  ResourceCollection twf_res("test_twf_res");
261 
262  elec1b.createResource(pset_res);
263  psi.createResource(twf_res);
264 
265  const int nelec = 2;
266  RealType logpsi_fixed_r1;
267  RealType logpsi_opt_r1;
268  ParticleSet::ParticleGradient fixedG1;
269  ParticleSet::ParticleLaplacian fixedL1;
270  fixedG1.resize(nelec);
271  fixedL1.resize(nelec);
272 
273  { // Prepare to compare using list with one wavefunction and particleset
274  const int nentry = 1;
275 
276  RefVectorWithLeader<ParticleSet> p_list(elec1b, {elec1b});
277  RefVectorWithLeader<TrialWaveFunction> wf_list(psi, {psi});
278 
279  // Evaluate new flex_evaluateDeltaLogSetup
280  auto fixedG_list_ptr = create_particle_gradient(nelec, nentry);
281  auto fixedL_list_ptr = create_particle_laplacian(nelec, nentry);
282  auto fixedG_list = convertUPtrToRefVector(fixedG_list_ptr);
283  auto fixedL_list = convertUPtrToRefVector(fixedL_list_ptr);
284 
285  std::vector<RealType> logpsi_fixed_list(nentry);
286  std::vector<RealType> logpsi_opt_list(nentry);
287 
288  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
289  ResourceCollectionTeamLock<TrialWaveFunction> mw_twf_lock(twf_res, wf_list);
290 
291  TrialWaveFunction::mw_evaluateDeltaLogSetup(wf_list, p_list, logpsi_fixed_list, logpsi_opt_list, fixedG_list,
292  fixedL_list);
293 
294 
295  // Evaluate old (single item) evaluateDeltaLog
296  psi.evaluateDeltaLogSetup(elec1, logpsi_fixed_r1, logpsi_opt_r1, fixedG1, fixedL1);
297 
298  CHECK(logpsi_fixed_r1 == Approx(logpsi_fixed_list[0]));
299  CHECK(logpsi_opt_r1 == Approx(logpsi_opt_list[0]));
300 
301  CHECK(fixedG1[0][0] == ValueApprox(fixedG_list[0].get()[0][0]));
302  CHECK(fixedG1[0][1] == ValueApprox(fixedG_list[0].get()[0][1]));
303  CHECK(fixedG1[0][2] == ValueApprox(fixedG_list[0].get()[0][2]));
304  CHECK(fixedG1[1][0] == ValueApprox(fixedG_list[0].get()[1][0]));
305  CHECK(fixedG1[1][1] == ValueApprox(fixedG_list[0].get()[1][1]));
306  CHECK(fixedG1[1][2] == ValueApprox(fixedG_list[0].get()[1][2]));
307 
308  CHECK(fixedL1[0] == ValueApprox(fixedL_list[0].get()[0]));
309  CHECK(fixedL1[1] == ValueApprox(fixedL_list[0].get()[1]));
310 
311  // Compare the ParticleSet gradient and laplacian storage
312  // This should be temporary until these get removed from ParticleSet
313  CHECK(elec1b.L[0] == ValueApprox(elec1.L[0]));
314  CHECK(elec1b.L[1] == ValueApprox(elec1.L[1]));
315 
316  CHECK(elec1b.G[0][0] == ValueApprox(elec1.G[0][0]));
317  CHECK(elec1b.G[1][1] == ValueApprox(elec1.G[1][1]));
318  }
319 
320  { // Prepare to compare using list with two wavefunctions and particlesets
321  const int nentry = 2;
322 
323  RefVectorWithLeader<ParticleSet> p_list(elec1b, {elec1b, elec2b});
324  RefVectorWithLeader<TrialWaveFunction> wf_list(psi, {psi, psi2});
325 
326  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
327  ResourceCollectionTeamLock<TrialWaveFunction> mw_twf_lock(twf_res, wf_list);
328 
329  auto fixedG_list_ptr = create_particle_gradient(nelec, nentry);
330  auto fixedL_list_ptr = create_particle_laplacian(nelec, nentry);
331  auto fixedG_list = convertUPtrToRefVector(fixedG_list_ptr);
332  auto fixedL_list = convertUPtrToRefVector(fixedL_list_ptr);
333 
334  std::vector<RealType> logpsi_fixed_list2(nentry);
335  std::vector<RealType> logpsi_opt_list2(nentry);
336 
337  RealType logpsi_fixed_r1b;
338  RealType logpsi_opt_r1b;
339  psi2.evaluateDeltaLogSetup(elec1, logpsi_fixed_r1b, logpsi_opt_r1b, fixedG1, fixedL1);
340 
341  CHECK(logpsi_fixed_r1 == Approx(logpsi_fixed_r1b));
342  CHECK(logpsi_opt_r1 == Approx(logpsi_opt_r1b));
343 
344  auto fixedG_list2_ptr = create_particle_gradient(nelec, nentry);
345  auto fixedL_list2_ptr = create_particle_laplacian(nelec, nentry);
346  auto fixedG_list2 = convertUPtrToRefVector(fixedG_list2_ptr);
347  auto fixedL_list2 = convertUPtrToRefVector(fixedL_list2_ptr);
348 
349  TrialWaveFunction::mw_evaluateDeltaLogSetup(wf_list, p_list, logpsi_fixed_list2, logpsi_opt_list2, fixedG_list2,
350  fixedL_list2);
351 
352  // Evaluate old (single item) evaluateDeltaLog corresponding to the second wavefunction/particleset
353 
354  RealType logpsi_fixed_r2;
355  RealType logpsi_opt_r2;
356  ParticleSet::ParticleGradient fixedG2;
357  ParticleSet::ParticleLaplacian fixedL2;
358  fixedG2.resize(nelec);
359  fixedL2.resize(nelec);
360 
361  psi2.setLogPsi(0.0);
362  psi2.evaluateDeltaLogSetup(elec2, logpsi_fixed_r2, logpsi_opt_r2, fixedG2, fixedL2);
363 
364  CHECK(logpsi_fixed_r1 == Approx(logpsi_fixed_r1b));
365  CHECK(logpsi_opt_r1 == Approx(logpsi_opt_r1b));
366 
367  CHECK(logpsi_fixed_r1 == Approx(logpsi_fixed_list2[0]));
368  CHECK(logpsi_opt_r1 == Approx(logpsi_opt_list2[0]));
369 
370  CHECK(logpsi_fixed_r2 == Approx(logpsi_fixed_list2[1]));
371  CHECK(logpsi_opt_r2 == Approx(logpsi_opt_list2[1]));
372 
373  // Laplacian for first entry in the wavefunction/particleset list
374  CHECK(fixedL1[0] == ValueApprox(fixedL_list2[0].get()[0]));
375  CHECK(fixedL1[1] == ValueApprox(fixedL_list2[0].get()[1]));
376  // Laplacian for second entry in the wavefunction/particleset list
377  CHECK(fixedL2[0] == ValueApprox(fixedL_list2[1].get()[0]));
378  CHECK(fixedL2[1] == ValueApprox(fixedL_list2[1].get()[1]));
379 
380 
381  // First entry wavefunction/particleset list
382  // Gradient for first electron
383  CHECK(fixedG1[0][0] == ValueApprox(fixedG_list2[0].get()[0][0]));
384  CHECK(fixedG1[0][1] == ValueApprox(fixedG_list2[0].get()[0][1]));
385  CHECK(fixedG1[0][2] == ValueApprox(fixedG_list2[0].get()[0][2]));
386  // Gradient for second electron
387  CHECK(fixedG1[1][0] == ValueApprox(fixedG_list2[0].get()[1][0]));
388  CHECK(fixedG1[1][1] == ValueApprox(fixedG_list2[0].get()[1][1]));
389  CHECK(fixedG1[1][2] == ValueApprox(fixedG_list2[0].get()[1][2]));
390 
391 
392  // Second entry wavefunction/particleset list
393  // Gradient for first electron
394  CHECK(fixedG2[0][0] == ValueApprox(fixedG_list2[1].get()[0][0]));
395  CHECK(fixedG2[0][1] == ValueApprox(fixedG_list2[1].get()[0][1]));
396  CHECK(fixedG2[0][2] == ValueApprox(fixedG_list2[1].get()[0][2]));
397  // Gradient for second electron
398  CHECK(fixedG2[1][0] == ValueApprox(fixedG_list2[1].get()[1][0]));
399  CHECK(fixedG2[1][1] == ValueApprox(fixedG_list2[1].get()[1][1]));
400  CHECK(fixedG2[1][2] == ValueApprox(fixedG_list2[1].get()[1][2]));
401 
402  // Compare the ParticleSet gradient and laplacian storage
403  // This should be temporary until these get removed from ParticleSet
404  CHECK(elec1b.L[0] == ValueApprox(elec1.L[0]));
405  CHECK(elec1b.L[1] == ValueApprox(elec1.L[1]));
406  CHECK(elec2b.L[0] == ValueApprox(elec2.L[0]));
407  CHECK(elec2b.L[1] == ValueApprox(elec2.L[1]));
408 
409  CHECK(elec2b.G[0][0] == ValueApprox(elec2.G[0][0]));
410  CHECK(elec2b.G[1][1] == ValueApprox(elec2.G[1][1]));
411 
412 
413  // these lists not used if 'recompute' is false
414  RefVector<ParticleSet::ParticleGradient> dummyG_list;
415  RefVector<ParticleSet::ParticleLaplacian> dummyL_list;
416 
417  std::vector<RealType> logpsi_variable_list(nentry);
418  TrialWaveFunction::mw_evaluateDeltaLog(wf_list, p_list, logpsi_variable_list, dummyG_list, dummyL_list, false);
419 
420  RealType logpsi1 = psi.evaluateDeltaLog(p_list[0], false);
421  CHECK(logpsi1 == Approx(logpsi_variable_list[0]));
422 
423  RealType logpsi2 = psi2.evaluateDeltaLog(p_list[1], false);
424  CHECK(logpsi2 == Approx(logpsi_variable_list[1]));
425 
426 
427  // Now check with 'recompute = true'
428  auto dummyG_list2_ptr = create_particle_gradient(nelec, nentry);
429  auto dummyL_list2_ptr = create_particle_laplacian(nelec, nentry);
430  auto dummyG_list2 = convertUPtrToRefVector(dummyG_list2_ptr);
431  auto dummyL_list2 = convertUPtrToRefVector(dummyL_list2_ptr);
432 
433  std::vector<RealType> logpsi_variable_list2(nentry);
434 
435  TrialWaveFunction::mw_evaluateDeltaLog(wf_list, p_list, logpsi_variable_list2, dummyG_list2, dummyL_list2, true);
436 
437  RealType logpsi1b = psi.evaluateDeltaLog(p_list[0], true);
438  CHECK(logpsi1b == Approx(logpsi_variable_list2[0]));
439 
440  RealType logpsi2b = psi2.evaluateDeltaLog(p_list[1], true);
441  CHECK(logpsi2b == Approx(logpsi_variable_list2[1]));
442  }
443 }
UPtrVector< ParticleSet::ParticleGradient > create_particle_gradient(int nelec, int nentry)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
static RefVector< T > convertUPtrToRefVector(const UPtrVector< T > &ptr_list)
convert a vector of std::unique_ptrs<T> to a refvector<T>
UPtrVector< ParticleSet::ParticleLaplacian > create_particle_laplacian(int nelec, int nentry)
Wrapping information on parallelism.
Definition: Communicate.h:68
std::unique_ptr< TrialWaveFunction > setup_He_wavefunction(Communicate *c, ParticleSet &elec, ParticleSet &ions, const WaveFunctionFactory::PSetMap &particle_set_map)
QMCTraits::RealType RealType
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [438/537]

qmcplusplus::TEST_CASE ( "MomentumDistribution::spawnCrowdClone"  ,
""  [estimators] 
)

Definition at line 219 of file test_MomentumDistribution.cpp.

References ProjectData::BATCH, clone, comm, OHMMS::Controller, crowd, doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), lattice, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), qmcplusplus::testing::makeTestLattice(), node, okay, Libxml2Document::parseFromString(), particle_pool, pset, rank, REQUIRE(), test_project, and wavefunction_pool.

220 {
221  // clang-format: off
222  const char* xml = R"(
223 <estimator type="MomentumDistribution" name="nofk" samples="5" kmax="3"/>
224 )";
225  // clang-format: on
226 
227  // Read xml into input object
229  bool okay = doc.parseFromString(xml);
230  if (!okay)
231  throw std::runtime_error("cannot parse MomentumDistributionInput section");
232  xmlNodePtr node = doc.getRoot();
233  MomentumDistributionInput mdi(node);
234 
235  // Instantiate other dependencies (internal QMCPACK objects)
237  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
238  Communicate* comm;
240 
241  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
242  auto wavefunction_pool =
243  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
244  auto& pset = *(particle_pool.getParticleSet("e"));
245  DataLocality dl = DataLocality::crowd;
246 
247  // Build from input
248  MomentumDistribution md(std::move(mdi), pset.getTotalNum(), pset.getTwist(), pset.getLattice(), dl);
249 
250  auto clone = md.spawnCrowdClone();
251  REQUIRE(clone != nullptr);
252  REQUIRE(clone.get() != &md);
253  REQUIRE(dynamic_cast<decltype(&md)>(clone.get()) != nullptr);
254 
255  // This check can be removed once a rank locality memory scheme is implemented
256  // for MomentumDistribution. Then checks relevant to that should be added.
257  MomentumDistributionInput fail_mdi(node);
258  dl = DataLocality::rank;
259  MomentumDistribution fail_md(std::move(fail_mdi), pset.getTotalNum(), pset.getTwist(), pset.getLattice(), dl);
260  CHECK_THROWS_AS(clone = fail_md.spawnCrowdClone(), std::runtime_error);
261 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
DataLocality
data locality with respect to walker buffer
Definition: DataLocality.h:19

◆ TEST_CASE() [439/537]

qmcplusplus::TEST_CASE ( "DiracMatrix_inverse_complex"  ,
""  [wavefunction][fermion] 
)

This test case is meant to match the cuBLAS_LU::getrf_batched_complex.

Definition at line 220 of file test_DiracMatrix.cpp.

References CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), Matrix< T, Alloc >::cols(), Matrix< T, Alloc >::data(), DiracMatrix< T_FP >::invert_transpose(), lu, lu_mat(), Matrix< T, Alloc >::resize(), Matrix< T, Alloc >::rows(), qmcplusplus::simd::transpose(), and Xgetrf().

221 {
222  DiracMatrix<std::complex<double>> dm;
223 
224  Matrix<std::complex<double>> a, a_T, a_inv;
225  LogValue log_value;
226  a.resize(4, 4);
227  a_T.resize(4, 4);
228  a_inv.resize(4, 4);
229 
230  a(0, 0) = {2.0, 0.1};
231  a(0, 1) = {5.0, 0.1};
232  a(0, 2) = {7.0, 0.2};
233  a(0, 3) = {5.0, 0.0};
234  a(1, 0) = {5.0, 0.1};
235  a(1, 1) = {2.0, 0.2};
236  a(1, 2) = {5.0, 1.0};
237  a(1, 3) = {4.0, -0.1};
238  a(2, 0) = {8.0, 0.5};
239  a(2, 1) = {2.0, 0.1};
240  a(2, 2) = {6.0, -0.2};
241  a(2, 3) = {4.0, -0.6};
242  a(3, 0) = {7.0, 1.0};
243  a(3, 1) = {8.0, 0.5};
244  a(3, 2) = {6.0, -0.2};
245  a(3, 3) = {8.0, -2.0};
246 
247  simd::transpose(a.data(), a.rows(), a.cols(), a_T.data(), a_T.rows(), a_T.cols());
248  int pivot[4]{-1, -1, -1, -1};
249  int status = Xgetrf(a_T.rows(), a_T.cols(), a_T.data(), a_T.cols(), pivot);
250 
251  double lu[32]{8.0,
252  0.5,
253  0.8793774319066148,
254  0.07003891050583658,
255  0.24980544747081712,
256  -0.0031128404669260694,
257  0.6233463035019455,
258  -0.026459143968871595,
259  2.0,
260  0.1,
261  6.248249027237354,
262  0.2719844357976654,
263  0.7194170575332381,
264  -0.01831314754114669,
265  0.1212375092639108,
266  0.02522449751055713,
267  6.0,
268  -0.2,
269  0.7097276264591441,
270  -0.4443579766536965,
271  4.999337315778741,
272  0.6013141870887196,
273  0.26158183940834034,
274  0.23245112532996867,
275  4.0,
276  -0.6,
277  4.440466926070039,
278  -1.7525291828793774,
279  0.840192589866152,
280  1.5044529443071093,
281  1.0698651110730424,
282  -0.10853319738453365};
283 
284  Matrix<std::complex<double>> lu_mat(reinterpret_cast<std::complex<double>*>(lu), 4, 4);
286  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
287 
288  dm.invert_transpose(a, a_inv, log_value);
289  CHECK(log_value == LogComplexApprox(std::complex<double>{5.603777579195571, 0.12452497406076501}));
290 
291  Matrix<std::complex<double>> b;
292  b.resize(4, 4);
293 
294  b(0, 0) = {-0.05356228836958328, 0.018778132944668208};
295  b(0, 1) = {0.20217332569060176, 0.10247607676441389};
296  b(0, 2) = {0.1752053760997507, 0.08545803475354152};
297  b(0, 3) = {-0.22019253129809616, -0.23960901438764967};
298  b(1, 0) = {-0.16917709116094917, 0.18307841761769691};
299  b(1, 1) = {-0.6356039515926515, 0.24028909525203923};
300  b(1, 2) = {-0.16030725389326506, -0.2749054789157097};
301  b(1, 3) = {0.9251760746083686, 0.09385511919367814};
302  b(2, 0) = {0.21572431303125872, -0.10633509516999905};
303  b(2, 1) = {0.24869726332502523, -0.11905352270298367};
304  b(2, 2) = {0.16292868571183988, 0.17275739697798137};
305  b(2, 3) = {-0.560684625012445, -0.09607837395378985};
306  b(3, 0) = {0.023435592783503056, -0.030184486280558254};
307  b(3, 1) = {0.09553876547173154, -0.09007339752988484};
308  b(3, 2) = {-0.11510984212629605, -0.020898880528951114};
309  b(3, 3) = {0.05299966349431483, 0.13363053130258684};
310  check_matrix_result = checkMatrix(b, a_inv);
311  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
312 }
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
int Xgetrf(int n, int m, float *restrict a, int lda, int *restrict piv)
wrappers around xgetrf lapack routines
Definition: DiracMatrix.h:31
Catch::Detail::LogComplexApprox LogComplexApprox
AntiSymTensor< T, D > transpose(const AntiSymTensor< T, D > &rhs)
testing::MatrixAccessor< double > lu_mat(lu.data(), 4, 4)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::vector< StdComp, CUDAHostAllocator< StdComp > > lu
std::complex< double > LogValue

◆ TEST_CASE() [440/537]

qmcplusplus::TEST_CASE ( "Rotated LCAO WF0 zero angle"  ,
""  [qmcapp] 
)

Definition at line 224 of file test_RotatedSPOs_LCAO.cpp.

References ProjectData::BATCH, CHECK(), TrialWaveFunction::checkInVariables(), TrialWaveFunction::checkOutVariables(), OHMMS::Controller, doc, TrialWaveFunction::evaluateDerivatives(), TrialWaveFunction::evaluateLog(), ParticleSet::G, TrialWaveFunction::getOrbitals(), ParticleSetPool::getParticleSet(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), identity_coeff, ParticleSet::L, TrialWaveFunction::mw_evaluateParameterDerivatives(), okay, Libxml2Document::parseFromString(), REQUIRE(), TrialWaveFunction::resetParameters(), setupParticleSetPool(), setupRotationXML(), test_project, and ParticleSet::update().

225 {
226  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
227  Communicate* c;
228  c = OHMMS::Controller;
229 
230  ParticleSetPool pp(c);
232 
233  WaveFunctionPool wp(test_project.getRuntimeOptions(), pp, c);
234 
235  REQUIRE(wp.empty() == true);
236 
237 
238  std::string wf_input = setupRotationXML("", "", identity_coeff, identity_coeff);
239 
241  bool okay = doc.parseFromString(wf_input);
242  REQUIRE(okay);
243 
244  xmlNodePtr root = doc.getRoot();
245 
246  wp.put(root);
247 
248  TrialWaveFunction* psi = wp.getWaveFunction("psi0");
249  REQUIRE(psi != nullptr);
250  REQUIRE(psi->getOrbitals().size() == 1);
251 
252  opt_variables_type opt_vars;
253  psi->checkInVariables(opt_vars);
254  opt_vars.resetIndex();
255  psi->checkOutVariables(opt_vars);
256  psi->resetParameters(opt_vars);
257 
258  ParticleSet* elec = pp.getParticleSet("e");
259  elec->update();
260 
261 
262  double logval = psi->evaluateLog(*elec);
263  CHECK(logval == Approx(-11.467952668216984));
264 
265  CHECK(elec->G[0][0] == ValueApprox(-0.5345224838248487));
266  CHECK(elec->L[0] == ValueApprox(-1.0690449676496974));
267  CHECK(elec->L[1] == ValueApprox(-1.626231256363484));
268 
270  Vector<ValueType> dlogpsi(2);
271  Vector<ValueType> dhpsioverpsi(2);
272  psi->evaluateDerivatives(*elec, opt_vars, dlogpsi, dhpsioverpsi);
273 
274  CHECK(dlogpsi[0] == ValueApprox(32.2062050179872));
275  CHECK(dlogpsi[1] == ValueApprox(5.87482925187464));
276  CHECK(dhpsioverpsi[0] == ValueApprox(46.0088643114103));
277  CHECK(dhpsioverpsi[1] == ValueApprox(7.84119772047731));
278 
279  RefVectorWithLeader<TrialWaveFunction> wf_list(*psi, {*psi});
280  RefVectorWithLeader<ParticleSet> p_list(*elec, {*elec});
281 
282  // Test list with one wavefunction
283 
284  int nparam = 2;
285  int nentry = 1;
286  RecordArray<ValueType> dlogpsi_list(nentry, nparam);
287  RecordArray<ValueType> dhpsi_over_psi_list(nentry, nparam);
288 
289  TrialWaveFunction::mw_evaluateParameterDerivatives(wf_list, p_list, opt_vars, dlogpsi_list, dhpsi_over_psi_list);
290 
291  CHECK(dlogpsi_list[0][0] == ValueApprox(32.2062050179872));
292  CHECK(dlogpsi_list[0][1] == ValueApprox(5.87482925187464));
293  CHECK(dhpsi_over_psi_list[0][0] == ValueApprox(46.0088643114103));
294  CHECK(dhpsi_over_psi_list[0][1] == ValueApprox(7.84119772047731));
295 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
void resetIndex()
reset Index
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const std::string identity_coeff
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
void setupParticleSetPool(ParticleSetPool &pp)
optimize::VariableSet opt_variables_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType
std::string setupRotationXML(const std::string &rot_angle_up, const std::string &rot_angle_down, const std::string &coeff_up, const std::string &coeff_down)

◆ TEST_CASE() [441/537]

qmcplusplus::TEST_CASE ( "test_timer_nested_profile_alt_routes"  ,
""  [utilities] 
)

Definition at line 228 of file test_timer.cpp.

References CHECK(), TimerManager< TIMER >::collate_stack_profile(), convert_to_ns(), TimerManager< TIMER >::createTimer(), doc, Libxml2Document::dump(), Libxml2Document::getRoot(), TimerManager< TIMER >::StackProfileData::names, Libxml2Document::newDoc(), TimerManager< TIMER >::output_timing(), REQUIRE(), qmcplusplus::Units::time::s, TimerManager< TIMER >::set_timer_threshold(), TimerType< CLOCK >::start(), TimerType< CLOCK >::stop(), TimerManager< TIMER >::StackProfileData::timeExclList, TimerManager< TIMER >::StackProfileData::timeList, and timer_level_fine.

229 {
230  FakeTimerManager tm;
231  tm.set_timer_threshold(timer_level_fine);
232  FakeTimer* t1 = tm.createTimer("timer1");
233  FakeTimer* t2 = tm.createTimer("timer2");
234  FakeTimer* t3 = tm.createTimer("timer3");
235  FakeTimer* t4 = tm.createTimer("timer4");
236  FakeTimer* t5 = tm.createTimer("timer5");
237 
238 
239  FakeChronoClock::fake_chrono_clock_increment = convert_to_ns(1.1s);
240  t1->start();
241  t2->start();
242  t3->start();
243  t4->start();
244  t4->stop();
245  t5->start();
246  t5->stop();
247  t3->stop();
248  t2->stop();
249  t3->start();
250  t4->start();
251  t4->stop();
252  t3->stop();
253  t1->stop();
254 
255  FakeTimerManager::StackProfileData p2;
256  tm.collate_stack_profile(NULL, p2);
257  //tm.print_stack(NULL);
258 #ifdef ENABLE_TIMERS
259  REQUIRE(p2.names.size() == 7);
260  REQUIRE(p2.names[0] == "timer1");
261  REQUIRE(p2.names[1] == "timer1/timer2");
262  REQUIRE(p2.names[2] == "timer1/timer2/timer3");
263  REQUIRE(p2.names[3] == "timer1/timer2/timer3/timer4");
264  REQUIRE(p2.names[4] == "timer1/timer2/timer3/timer5");
265  REQUIRE(p2.names[5] == "timer1/timer3");
266  REQUIRE(p2.names[6] == "timer1/timer3/timer4");
267 
268  CHECK(p2.timeList[0] == Approx(14.3));
269  CHECK(p2.timeExclList[0] == Approx(3.3));
270  CHECK(p2.timeList[1] == Approx(7.7));
271  CHECK(p2.timeExclList[1] == Approx(2.2));
272 #endif
273 
275  doc.newDoc("resources");
276  tm.output_timing(NULL, doc, doc.getRoot());
277  doc.dump("tmp2.xml");
278 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
TimerType< FakeChronoClock > FakeTimer
Definition: NewTimer.h:235
void newDoc(const std::string &rootName)
Definition: Libxml2Doc.cpp:93
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
FakeChronoClock::duration convert_to_ns(T in)
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
TimerManager< FakeTimer > FakeTimerManager
Definition: test_timer.cpp:23
void dump(const std::string &newxml)
Definition: Libxml2Doc.cpp:109

◆ TEST_CASE() [442/537]

qmcplusplus::TEST_CASE ( "benchmark_DiracMatrixComputeCUDASingle_vs_legacy_1024_4"  ,
""  [wavefunction][fermion][.benchmark] 
)

Only runs if [benchmark] tag is passed.

Definition at line 230 of file benchmark_DiracMatrixComputeCUDA.cpp.

References DiracComputeBenchmarkParameters::batch_size, DiracMatrix< T_FP >::invert_transpose(), DiracMatrixComputeCUDA< VALUE_FP >::invert_transpose(), log_values(), qmcplusplus::testing::makeRngSpdMatrix(), qmcplusplus::Units::meter, DiracComputeBenchmarkParameters::n, DiracComputeBenchmarkParameters::name, queue, and DiracComputeBenchmarkParameters::str().

231 {
232  DiracComputeBenchmarkParameters params;
233  params.name = "Forced Serial Batched CUDA";
234  params.n = 1024;
235  params.batch_size = 4;
236 
237  compute::Queue<PlatformKind::CUDA> queue;
238  DiracMatrixComputeCUDA<double> dmcc;
239 
240  std::vector<Matrix<double>> spd_mats(params.batch_size, {params.n, params.n});
241  std::vector<OffloadPinnedMatrix<double>> pinned_spd_mats(params.batch_size, {params.n, params.n});
242 
243 
244  testing::MakeRngSpdMatrix<double> makeRngSpdMatrix;
245  for (int im = 0; im < params.batch_size; ++im)
246  {
247  makeRngSpdMatrix(spd_mats[im]);
248  for (int i = 0; i < params.n; ++i)
249  for (int j = 0; j < params.n; ++j)
250  pinned_spd_mats[im](i, j) = spd_mats[im](i, j);
251  }
252 
253  std::vector<OffloadPinnedMatrix<double>> pinned_inv_mats(params.batch_size, {params.n, params.n});
254  std::vector<OffloadPinnedVector<std::complex<double>>> log_values(params.batch_size);
255  for (auto& log_value : log_values)
256  log_value.resize(1, {0, 0});
257 
258  auto a_mats = makeRefVector<decltype(pinned_spd_mats)::value_type>(pinned_spd_mats);
259  RefVector<OffloadPinnedMatrix<double>> inv_a_mats =
260  makeRefVector<decltype(pinned_inv_mats)::value_type>(pinned_inv_mats);
261 
262  std::vector<bool> compute_mask(params.batch_size, true);
263  BENCHMARK_ADVANCED(params.str())(Catch::Benchmark::Chronometer meter)
264  {
265  meter.measure([&] {
266  for (int im = 0; im < params.batch_size; ++im)
267  dmcc.invert_transpose(queue, pinned_spd_mats[im], pinned_inv_mats[im], log_values[im]);
268  });
269  };
270 
271 
272  DiracMatrix<double> dmat;
273  std::vector<Matrix<double>> inv_mats_test(params.batch_size, {params.n, params.n});
274  ;
275  std::vector<std::complex<double>> log_values_test(params.batch_size);
276 
277  params.name = "legacy CPU";
278 
279  BENCHMARK_ADVANCED(params.str())(Catch::Benchmark::Chronometer meter)
280  {
281  meter.measure([&] {
282  for (int im = 0; im < params.batch_size; ++im)
283  dmat.invert_transpose(spd_mats[im], inv_mats_test[im], log_values_test[im]);
284  });
285  };
286 }
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
void makeRngSpdMatrix(testing::RandomForTest< RngValueType< T >> &rng, Matrix< T > &mat_spd)

◆ TEST_CASE() [443/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A Ewald Quasi2D staggered triangle"  ,
""  [hamiltonian] 
)

Definition at line 231 of file test_ewald_quasi2d.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), dot(), CoulombPBCAA::evaluate(), ParticleSet::getSpeciesSet(), lattice, LRCoulombSingleton::QUASI2D, ParticleSet::R, ParticleSet::setName(), sqrt(), LRCoulombSingleton::this_lr_type, and ParticleSet::update().

232 {
233  LRCoulombSingleton::CoulombHandler = 0; // !!!! crucial if not first test
234  LRCoulombSingleton::this_lr_type = LRCoulombSingleton::QUASI2D;
235  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
236  lattice.BoxBConds = true;
237  lattice.BoxBConds[2] = false; // ppn
238  lattice.ndim = 2;
239  const double alat = std::sqrt(2.0*M_PI/std::sqrt(3));
240  lattice.R = 0.0;
241  lattice.R(0, 0) = alat;
242  lattice.R(1, 0) = -1.0/2*alat;
243  lattice.R(1, 1) = std::sqrt(3)/2*alat;
244  lattice.R(2, 2) = 2*alat;
245  lattice.LR_dim_cutoff = 30.0;
246  lattice.reset();
247 
248  const SimulationCell simulation_cell(lattice);
249  ParticleSet elec(simulation_cell);
250  int npart = 2;
251  elec.setName("e");
252  elec.create({npart});
253  // initialize fractional coordinates
254  elec.R[0] = {0.0, 0.0, 0.0};
255  elec.R[1] = {2./3, 1./3, 0.0};
256  // convert to Cartesian coordinates
257  for (int i=0;i<npart;i++)
258  elec.R[i] = dot(elec.R[i], lattice.R);
259 
260  SpeciesSet& tspecies = elec.getSpeciesSet();
261  int upIdx = tspecies.addSpecies("u");
262  int chargeIdx = tspecies.addAttribute("charge");
263  int massIdx = tspecies.addAttribute("mass");
264  tspecies(chargeIdx, upIdx) = -1;
265  tspecies(massIdx, upIdx) = 1.0;
266 
267  elec.createSK();
268  elec.addTable(elec); // !!!! crucial to compute distance table
269 
270  CoulombPBCAA caa(elec, true, false, false);
271 
272  const int ntest = 4;
273  const double zheight[ntest] = {0, 0.1, 0.5, 3.0};
274  const double vmad_hon = -1.510964233;
275  const double vmad_tri = -1.106102587;
276  const double vmad_ref[ntest] = {vmad_hon, -1.4193042644, -1.2005504968, vmad_tri};
277  double val;
278  for (int itest=0; itest<ntest; itest++)
279  {
280  elec.R[1][2] = zheight[itest];
281  elec.update();
282  val = caa.evaluate(elec);
283  CHECK(val/npart == Approx(vmad_ref[itest]));
284  }
285 }
T dot(T *a, T *b)
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [444/537]

qmcplusplus::TEST_CASE ( "HCN MO with cusp"  ,
""  [wavefunction] 
)

Definition at line 235 of file test_soa_cusp_corr.cpp.

References castCharToXMLChar(), CHECK(), OHMMS::Controller, SPOSetBuilderFactory::createSPOSetBuilder(), doc, Libxml2Document::getRoot(), Libxml2Document::getXPathContext(), okay, Libxml2Document::parse(), XMLParticleParser::readXML(), and REQUIRE().

236 {
238 
240  bool okay = doc.parse("hcn.structure.xml");
241  REQUIRE(okay);
242  xmlNodePtr root = doc.getRoot();
243 
244  const SimulationCell simulation_cell;
245  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
246  auto& ions(*ions_ptr);
247  XMLParticleParser parse_ions(ions);
248  OhmmsXPathObject particleset_ion("//particleset[@name='ion0']", doc.getXPathContext());
249  REQUIRE(particleset_ion.size() == 1);
250  parse_ions.readXML(particleset_ion[0]);
251 
252  REQUIRE(ions.groups() == 3);
253  REQUIRE(ions.R.size() == 3);
254  ions.update();
255 
256  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
257  auto& elec(*elec_ptr);
258  XMLParticleParser parse_elec(elec);
259  OhmmsXPathObject particleset_elec("//particleset[@name='e']", doc.getXPathContext());
260  REQUIRE(particleset_elec.size() == 1);
261  parse_elec.readXML(particleset_elec[0]);
262 
263  REQUIRE(elec.groups() == 2);
264  REQUIRE(elec.R.size() == 14);
265 
266  elec.R = 0.0;
267 
268  elec.addTable(ions);
269  elec.update();
270 
271  Libxml2Document doc2;
272  okay = doc2.parse("hcn.wfnoj.xml");
273  REQUIRE(okay);
274  xmlNodePtr root2 = doc2.getRoot();
275 
276  WaveFunctionComponentBuilder::PSetMap particle_set_map;
277  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
278  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
279 
280  SPOSetBuilderFactory bf(c, elec, particle_set_map);
281 
282  OhmmsXPathObject MO_base("//determinantset", doc2.getXPathContext());
283  REQUIRE(MO_base.size() == 1);
284 
285  xmlSetProp(MO_base[0], castCharToXMLChar("cuspCorrection"), castCharToXMLChar("yes"));
286 
287  const auto bb_ptr = bf.createSPOSetBuilder(MO_base[0]);
288  auto& bb(*bb_ptr);
289 
290  OhmmsXPathObject slater_base("//determinant", doc2.getXPathContext());
291  auto sposet = bb.createSPOSet(slater_base[0]);
292 
293  SPOSet::ValueVector values;
294  SPOSet::GradVector dpsi;
295  SPOSet::ValueVector d2psi;
296  values.resize(7);
297  dpsi.resize(7);
298  d2psi.resize(7);
299 
300  elec.R = 0.0;
301  elec.update();
302  ParticleSet::SingleParticlePos newpos;
303  elec.makeMove(0, newpos);
304 
305  sposet->evaluateValue(elec, 0, values);
306 
307  // Values from gen_cusp_corr.py
308  CHECK(values[0] == Approx(0.00945227));
309  CHECK(values[1] == Approx(0.0200836));
310  CHECK(values[2] == Approx(0.416375));
311  CHECK(values[3] == Approx(-0.0885443));
312  CHECK(values[4] == Approx(0.273159));
313  CHECK(values[5] == Approx(0));
314  CHECK(values[6] == Approx(0));
315 
316  // Put electron near N atom
317  elec.R[0][0] = -1.09;
318  elec.update();
319  elec.makeMove(0, newpos);
320 
321  values = 0.0;
322  sposet->evaluateValue(elec, 0, values);
323  //std::cout << "values = " << values << std::endl;
324  // Values from gen_cusp_corr.py
325  CHECK(values[0] == Approx(9.5150713253));
326  CHECK(values[1] == Approx(-0.0086731542));
327  CHECK(values[2] == Approx(-1.6426151116));
328  CHECK(values[3] == Approx(0.6569242017));
329  CHECK(values[4] == Approx(0.9775522176));
330  CHECK(values[5] == Approx(0.0000000000));
331  CHECK(values[6] == Approx(0.0000000000));
332 
333 
334  values = 0.0;
335  sposet->evaluateVGL(elec, 0, values, dpsi, d2psi);
336 
337  //std::cout << "values = " << values << std::endl;
338  //std::cout << "dpsi = " << dpsi << std::endl;
339  //std::cout << "d2psi = " << d2psi << std::endl;
340 
341  // Values from gen_cusp_corr.py
342  CHECK(values[0] == Approx(9.5150713253));
343  CHECK(values[1] == Approx(-0.0086731542));
344  CHECK(values[2] == Approx(-1.6426151116));
345  CHECK(values[3] == Approx(0.6569242017));
346  CHECK(values[4] == Approx(0.9775522176));
347  CHECK(values[5] == Approx(0.0000000000));
348  CHECK(values[6] == Approx(0.0000000000));
349 
350  CHECK(dpsi[0][0] == Approx(-66.5007223213));
351  CHECK(dpsi[0][1] == Approx(0.0000000000));
352  CHECK(dpsi[0][2] == Approx(0.0000000000));
353  CHECK(d2psi[0] == Approx(-21540.9990552510));
354 
355  CHECK(values[1] == Approx(-0.0086731542));
356  CHECK(dpsi[1][0] == Approx(0.0616909346));
357  CHECK(dpsi[1][1] == Approx(0.0000000000));
358  CHECK(dpsi[1][2] == Approx(0.0000000000));
359  CHECK(d2psi[1] == Approx(19.8720529007));
360 
361 
362  SPOSet::ValueMatrix all_values;
363  SPOSet::GradMatrix all_grad;
364  SPOSet::ValueMatrix all_lap;
365  all_values.resize(7, 7);
366  all_grad.resize(7, 7);
367  all_lap.resize(7, 7);
368 
369 
370  sposet->evaluate_notranspose(elec, 0, 7, all_values, all_grad, all_lap);
371 
372  // Values from gen_cusp_corr.py
373  CHECK(values[0] == Approx(9.5150713253));
374 
375  CHECK(all_values[0][0] == Approx(9.5150713253));
376  CHECK(all_grad[0][0][0] == Approx(-66.5007223213));
377  CHECK(all_grad[0][0][1] == Approx(0.0000000000));
378  CHECK(all_grad[0][0][2] == Approx(0.0000000000));
379  CHECK(all_lap[0][0] == Approx(-21540.9990552510));
380 
381  CHECK(all_values[0][1] == Approx(-0.0086731542));
382  CHECK(all_grad[0][1][0] == Approx(0.0616909346));
383  CHECK(all_grad[0][1][1] == Approx(0.0000000000));
384  CHECK(all_grad[0][1][2] == Approx(0.0000000000));
385  CHECK(all_lap[0][1] == Approx(19.8720529007));
386 
387 
388  // Test the makeClone method
389  std::unique_ptr<SPOSet> sposet_clone(sposet->makeClone());
390 
391  sposet_clone->evaluate_notranspose(elec, 0, 7, all_values, all_grad, all_lap);
392 
393  // Values from gen_cusp_corr.py
394  CHECK(values[0] == Approx(9.5150713253));
395 
396  CHECK(all_values[0][0] == Approx(9.5150713253));
397  CHECK(all_grad[0][0][0] == Approx(-66.5007223213));
398  CHECK(all_grad[0][0][1] == Approx(0.0000000000));
399  CHECK(all_grad[0][0][2] == Approx(0.0000000000));
400  CHECK(all_lap[0][0] == Approx(-21540.9990552510));
401 
402  CHECK(all_values[0][1] == Approx(-0.0086731542));
403  CHECK(all_grad[0][1][0] == Approx(0.0616909346));
404  CHECK(all_grad[0][1][1] == Approx(0.0000000000));
405  CHECK(all_grad[0][1][2] == Approx(0.0000000000));
406  CHECK(all_lap[0][1] == Approx(19.8720529007));
407 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180
xmlChar * castCharToXMLChar(char *c)
unsafe char* to xmlChar* cast
Definition: libxmldefs.h:70

◆ TEST_CASE() [445/537]

qmcplusplus::TEST_CASE ( "OneBodyDensityMatrices::OneBodyDensityMatrices"  ,
""  [estimators] 
)

Definition at line 238 of file test_OneBodyDensityMatrices.cpp.

References ProjectData::BATCH, comm, OHMMS::Controller, doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), lattice, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), qmcplusplus::testing::makeSpeciesSet(), qmcplusplus::testing::makeTestLattice(), node, obdmi, oeba, okay, Libxml2Document::parseFromString(), particle_pool, pset_target, species_set, test_project, OneBodyDensityMatricesTests< T >::testCopyConstructor(), and wavefunction_pool.

239 {
240  using Input = testing::ValidOneBodyDensityMatricesInput;
243  bool okay = doc.parseFromString(Input::xml[Input::valid::VANILLA]);
244  if (!okay)
245  throw std::runtime_error("cannot parse OneBodyDensitMatricesInput section");
246  xmlNodePtr node = doc.getRoot();
247  OneBodyDensityMatricesInput obdmi(node);
249  auto species_set = testing::makeSpeciesSet(SpeciesCases::GOOD);
250 
251  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
252  Communicate* comm;
254 
255  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
256  auto wavefunction_pool =
257  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
258  auto& pset_target = *(particle_pool.getParticleSet("e"));
259  auto& spo_map = wavefunction_pool.getWaveFunction("wavefunction")->getSPOMap();
260 
261  // Good constructor
262  OneBodyDensityMatrices obdm(std::move(obdmi), lattice, species_set, spo_map, pset_target);
263  // make sure there is something in obdm's data
264  testing::OEBAccessor oeba(obdm);
265  oeba[0] = 1.0;
266  testing::OneBodyDensityMatricesTests<QMCTraits::FullPrecRealType> obdmt;
267  obdmt.testCopyConstructor(obdm);
268 
269  species_set = testing::makeSpeciesSet(SpeciesCases::NO_MEMBERSIZE);
270  CHECK_THROWS_AS(OneBodyDensityMatrices(std::move(obdmi), lattice, species_set, spo_map, pset_target),
271  UniformCommunicateError);
272 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
OneBodyDensityMatricesInput obdmi(node)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
OEBAccessor oeba(sdn)
SpeciesSet makeSpeciesSet(const SpeciesCases species_case)

◆ TEST_CASE() [446/537]

qmcplusplus::TEST_CASE ( "SPO input spline from xml LiH_msd arbitrary species"  ,
""  [wavefunction] 
)

Definition at line 253 of file test_spo_collection_input_MSD_LCAO_h5.cpp.

References app_log(), and test_LiH_msd_xml_input_with_positron().

254 {
255  app_log() << "-------------------------------------------------------------" << std::endl;
256  app_log() << "LiH_msd with positron xml input style" << std::endl;
257  app_log() << "-------------------------------------------------------------" << std::endl;
258  const char* spo_xml_string1 = R"(<wavefunction name="psi0" target="e">
259  <sposet_collection type="MolecularOrbital" name="LCAOBSet" source="ion0" transform="yes" cuspCorrection="no" href="LiH.orbs.h5">
260  <sposet basisset="LCAOBSet" name="spo-up" size="5">
261  <occupation mode="ground"/>
262  <coefficient size="5" spindataset="0"/>
263  </sposet>
264  <sposet basisset="LCAOBSet" name="spo-dn" size="5">
265  <occupation mode="ground"/>
266  <coefficient size="5" spindataset="0"/>
267  </sposet>
268  <sposet basisset="LCAOBSet" name="spo-ps" size="5">
269  <occupation mode="ground"/>
270  <coefficient size="5" spindataset="0"/>
271  </sposet>
272  </sposet_collection>
273  <determinantset>
274  <multideterminant optimize="yes" spo_0="spo-up" spo_1="spo-dn" spo_2="spo-ps">
275  <detlist size="2" type="DETS" nc0="0" nc1="0" nc2="0" ne0="2" ne1="2" ne2="1" nstates="5" cutoff="1e-20">
276  <ci id="CIcoeff_0" coeff="0.7071" qchem_coeff="0.7071" occ0="11000" occ1="11000" occ2="10000"/>
277  <ci id="CIcoeff_1" coeff="-0.7071" qchem_coeff="-0.7071" occ0="10100" occ1="11000" occ2="00100" />
278  </detlist>
279  </multideterminant>
280  </determinantset>
281 </wavefunction>
282 )";
283  test_LiH_msd_xml_input_with_positron(spo_xml_string1, "spo-ps", 5, 105);
284 }
void test_LiH_msd_xml_input_with_positron(const std::string &spo_xml_string, const std::string &check_sponame, int check_spo_size, int check_basisset_size)
std::ostream & app_log()
Definition: OutputManager.h:65

◆ TEST_CASE() [447/537]

qmcplusplus::TEST_CASE ( "PolynomialFunctor3D Jastrow"  ,
""  [wavefunction] 
)

Definition at line 254 of file test_polynomial_eeI_jastrow.cpp.

References DC_POS, DC_POS_OFFLOAD, and test_J3_polynomial3D().

255 {
256  test_J3_polynomial3D(DynamicCoordinateKind::DC_POS);
257  test_J3_polynomial3D(DynamicCoordinateKind::DC_POS_OFFLOAD);
258 }
void test_J3_polynomial3D(const DynamicCoordinateKind kind_selected)

◆ TEST_CASE() [448/537]

qmcplusplus::TEST_CASE ( "Ceperley Force"  ,
""  [hamiltonian] 
)

From the 'Force.ipynb' Jupyter notebook

Definition at line 255 of file test_force.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ForceCeperley::c, CHECK(), ParticleSet::create(), qmcplusplus::Units::charge::e, ForceCeperley::evaluate(), ForceBase::getForces(), ForceBase::getForcesIonIon(), ParticleSet::getSpeciesSet(), ForceCeperley::InitMatrix(), ForceCeperley::N_basis, ParticleSet::R, ForceCeperley::Rcut, ParticleSet::resetGroups(), ForceBase::setAddIonIon(), ParticleSet::setName(), and ParticleSet::update().

256 {
257  const SimulationCell simulation_cell;
258  ParticleSet ions(simulation_cell);
259  ParticleSet elec(simulation_cell);
260 
261  ions.setName("ion");
262  ions.create({2});
263  ions.R[0] = {0.0, 0.0, 0.0};
264  ions.R[1] = {2.0, 0.0, 0.0};
265  elec.setName("elec");
266  elec.create({2});
267  elec.R[0] = {0.0, 1.0, 0.0};
268  elec.R[1] = {0.2, 0.3, 0.0};
269  SpeciesSet& tspecies = elec.getSpeciesSet();
270  int upIdx = tspecies.addSpecies("u");
271  int massIdx = tspecies.addAttribute("mass");
272  int eChargeIdx = tspecies.addAttribute("charge");
273  tspecies(eChargeIdx, upIdx) = -1.0;
274  tspecies(massIdx, upIdx) = 1.0;
275  //elec.createSK();
276 
277  SpeciesSet& ion_species = ions.getSpeciesSet();
278  int pIdx = ion_species.addSpecies("H");
279  int pChargeIdx = ion_species.addAttribute("charge");
280  ion_species(pChargeIdx, pIdx) = 1;
281  //ions.createSK();
282  ions.resetGroups();
283 
284  // The call to resetGroups is needed transfer the SpeciesSet
285  // settings to the ParticleSet
286  elec.resetGroups();
287 
288  ForceCeperley force(ions, elec);
289  force.InitMatrix();
290 
291  /// From the 'Force.ipynb' Jupyter notebook
292  // for m_exp=2, N_basis=4, Rcut=0.4
293  double coeff[4] = {4375, -44296.9, 147656, -161133};
294  for (int i = 0; i < 4; i++)
295  {
296  CHECK(force.c[i] == Approx(coeff[i]));
297  }
298 
299  ions.update();
300  elec.update();
301 
302  force.setAddIonIon(true); // is true by default
303  force.evaluate(elec);
304  std::cout << " Force ionion = " << force.getForcesIonIon() << std::endl;
305  std::cout << " Force = " << force.getForces() << std::endl;
306  CHECK(force.getForces()[0][0] == Approx(8.99061106).epsilon(1e-4));
307  CHECK(force.getForces()[0][1] == Approx(14.86091659).epsilon(1e-4));
308  CHECK(force.getForces()[0][2] == Approx(0.0));
309  CHECK(force.getForces()[1][0] == Approx(-0.2250998297).epsilon(1e-4));
310  CHECK(force.getForces()[1][1] == Approx(0.1388117844).epsilon(1e-4));
311  CHECK(force.getForces()[1][2] == Approx(0.0));
312 
313  force.N_basis = 6;
314  force.Rcut = 0.8;
315  force.InitMatrix();
316  // for m_exp=2, N_basis=6, Rcut=0.800000
317  double coeff2[6] = {3281.25, -33837.9, 135352, -261841, 245476, -89496.4};
318  for (int i = 0; i < 6; i++)
319  {
320  CHECK(force.c[i] == Approx(coeff2[i]));
321  }
322 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [449/537]

qmcplusplus::TEST_CASE ( "Einspline SPO from HDF diamond_2x1x1 5 electrons"  ,
""  [wavefunction] 
)

Definition at line 261 of file test_einset.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), CHECK(), OHMMS::Controller, ParticleSet::create(), ParticleSet::createResource(), EinsplineSetBuilder::createSPOSetFromXML(), Vector< T, Alloc >::device_data(), QMCTraits::DIM_VGL, doc, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), imag(), lattice, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), Array< T, D, ALLOC >::resize(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), Vector< T, Alloc >::size(), and Vector< T, Alloc >::updateTo().

262 {
264 
265  ParticleSet::ParticleLayout lattice;
266  // diamondC_2x1x1
267  lattice.R = {6.7463223, 6.7463223, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
268 
269  ParticleSetPool ptcl = ParticleSetPool(c);
270  ptcl.setSimulationCell(lattice);
271  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
272  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
273  ParticleSet& ions_(*ions_uptr);
274  ParticleSet& elec_(*elec_uptr);
275 
276  ions_.setName("ion");
277  ptcl.addParticleSet(std::move(ions_uptr));
278  ions_.create({4});
279  ions_.R[0] = {0.0, 0.0, 0.0};
280  ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
281  ions_.R[2] = {3.37316115, 3.37316115, 0.0};
282  ions_.R[3] = {5.05974173, 5.05974173, 1.68658058};
283 
284 
285  elec_.setName("elec");
286  ptcl.addParticleSet(std::move(elec_uptr));
287  elec_.create({5});
288  elec_.R[0] = {0.0, 0.0, 0.0};
289  elec_.R[1] = {0.0, 1.0, 0.0};
290  elec_.R[2] = {0.0, 1.1, 0.0};
291  elec_.R[3] = {0.0, 1.2, 0.0};
292  elec_.R[4] = {0.0, 1.3, 0.0};
293 
294  SpeciesSet& tspecies = elec_.getSpeciesSet();
295  int upIdx = tspecies.addSpecies("u");
296  int chargeIdx = tspecies.addAttribute("charge");
297  tspecies(chargeIdx, upIdx) = -1;
298 
299  //diamondC_2x1x1
300  const char* particles = R"(<tmp>
301 <determinantset type="einspline" href="diamondC_2x1x1.pwscf.h5" tilematrix="2 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.0" precision="float" size="5"/>
302 </tmp>
303 )";
304 
306  bool okay = doc.parseFromString(particles);
307  REQUIRE(okay);
308 
309  xmlNodePtr root = doc.getRoot();
310 
311  xmlNodePtr ein1 = xmlFirstElementChild(root);
312 
313  EinsplineSetBuilder einSet(elec_, ptcl.getPool(), c, ein1);
314  auto spo = einSet.createSPOSetFromXML(ein1);
315  REQUIRE(spo);
316 
317  // for vgl
318  SPOSet::ValueMatrix psiM(elec_.R.size(), spo->getOrbitalSetSize());
319  SPOSet::GradMatrix dpsiM(elec_.R.size(), spo->getOrbitalSetSize());
320  SPOSet::ValueMatrix d2psiM(elec_.R.size(), spo->getOrbitalSetSize());
321  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM, dpsiM, d2psiM);
322 
323  // real part
324  // due to the different ordering of bands skip the tests on CUDA+Real builds
325  // checking evaluations, reference values are not independently generated.
326  // value
327  CHECK(std::real(psiM[1][0]) == Approx(0.9008999467));
328  CHECK(std::real(psiM[1][1]) == Approx(1.2383049726));
329  // grad
330  CHECK(std::real(dpsiM[1][0][0]) == Approx(0.0025820041));
331  CHECK(std::real(dpsiM[1][0][1]) == Approx(-0.1880052537));
332  CHECK(std::real(dpsiM[1][0][2]) == Approx(-0.0025404284));
333  CHECK(std::real(dpsiM[1][1][0]) == Approx(0.1069662273));
334  CHECK(std::real(dpsiM[1][1][1]) == Approx(-0.4364597797));
335  CHECK(std::real(dpsiM[1][1][2]) == Approx(-0.106951952));
336  // lapl
337  CHECK(std::real(d2psiM[1][0]) == Approx(-1.3757134676));
338  CHECK(std::real(d2psiM[1][1]) == Approx(-2.4803137779));
339 
340 #if defined(QMC_COMPLEX)
341  // imaginary part
342  // value
343  CHECK(std::imag(psiM[1][0]) == Approx(0.9008999467));
344  CHECK(std::imag(psiM[1][1]) == Approx(1.2383049726));
345  // grad
346  CHECK(std::imag(dpsiM[1][0][0]) == Approx(0.0025820041));
347  CHECK(std::imag(dpsiM[1][0][1]) == Approx(-0.1880052537));
348  CHECK(std::imag(dpsiM[1][0][2]) == Approx(-0.0025404284));
349  CHECK(std::imag(dpsiM[1][1][0]) == Approx(0.1069453433));
350  CHECK(std::imag(dpsiM[1][1][1]) == Approx(-0.43649593));
351  CHECK(std::imag(dpsiM[1][1][2]) == Approx(-0.1069145575));
352  // lapl
353  CHECK(std::imag(d2psiM[1][0]) == Approx(-1.3757134676));
354  CHECK(std::imag(d2psiM[1][1]) == Approx(-2.4919104576));
355 #endif
356 
357  // test batched interfaces
358  ParticleSet elec_2(elec_);
359  // interchange positions
360  elec_2.R[0] = elec_.R[1];
361  elec_2.R[1] = elec_.R[0];
362  RefVectorWithLeader<ParticleSet> p_list(elec_);
363  p_list.push_back(elec_);
364  p_list.push_back(elec_2);
365 
366  std::unique_ptr<SPOSet> spo_2(spo->makeClone());
367  RefVectorWithLeader<SPOSet> spo_list(*spo);
368  spo_list.push_back(*spo);
369  spo_list.push_back(*spo_2);
370 
371  ResourceCollection pset_res("test_pset_res");
372  ResourceCollection spo_res("test_spo_res");
373 
374  elec_.createResource(pset_res);
375  spo->createResource(spo_res);
376 
377  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
378  ResourceCollectionTeamLock<SPOSet> mw_sposet_lock(spo_res, spo_list);
379 
380  SPOSet::ValueVector psi(spo->getOrbitalSetSize());
381  SPOSet::GradVector dpsi(spo->getOrbitalSetSize());
382  SPOSet::ValueVector d2psi(spo->getOrbitalSetSize());
383  SPOSet::ValueVector psi_2(spo->getOrbitalSetSize());
384  SPOSet::GradVector dpsi_2(spo->getOrbitalSetSize());
385  SPOSet::ValueVector d2psi_2(spo->getOrbitalSetSize());
386 
387  RefVector<SPOSet::ValueVector> psi_v_list;
388  RefVector<SPOSet::GradVector> dpsi_v_list;
389  RefVector<SPOSet::ValueVector> d2psi_v_list;
390 
391  psi_v_list.push_back(psi);
392  psi_v_list.push_back(psi_2);
393  dpsi_v_list.push_back(dpsi);
394  dpsi_v_list.push_back(dpsi_2);
395  d2psi_v_list.push_back(d2psi);
396  d2psi_v_list.push_back(d2psi_2);
397 
398  spo->mw_evaluateVGL(spo_list, p_list, 0, psi_v_list, dpsi_v_list, d2psi_v_list);
399  // real part
400  // due to the different ordering of bands skip the tests on CUDA+Real builds
401  // checking evaluations, reference values are not independently generated.
402  // value
403  CHECK(std::real(psi_v_list[1].get()[0]) == Approx(0.9008999467));
404  CHECK(std::real(psi_v_list[1].get()[1]) == Approx(1.2383049726));
405  // grad
406  CHECK(std::real(dpsi_v_list[1].get()[0][0]) == Approx(0.0025820041));
407  CHECK(std::real(dpsi_v_list[1].get()[0][1]) == Approx(-0.1880052537));
408  CHECK(std::real(dpsi_v_list[1].get()[0][2]) == Approx(-0.0025404284));
409  CHECK(std::real(dpsi_v_list[1].get()[1][0]) == Approx(0.1069662273));
410  CHECK(std::real(dpsi_v_list[1].get()[1][1]) == Approx(-0.4364597797));
411  CHECK(std::real(dpsi_v_list[1].get()[1][2]) == Approx(-0.106951952));
412  // lapl
413  CHECK(std::real(d2psi_v_list[1].get()[0]) == Approx(-1.3757134676));
414  CHECK(std::real(d2psi_v_list[1].get()[1]) == Approx(-2.4803137779));
415 
416 #if defined(QMC_COMPLEX)
417  // imaginary part
418  // value
419  CHECK(std::imag(psi_v_list[1].get()[0]) == Approx(0.9008999467));
420  CHECK(std::imag(psi_v_list[1].get()[1]) == Approx(1.2383049726));
421  // grad
422  CHECK(std::imag(dpsi_v_list[1].get()[0][0]) == Approx(0.0025820041));
423  CHECK(std::imag(dpsi_v_list[1].get()[0][1]) == Approx(-0.1880052537));
424  CHECK(std::imag(dpsi_v_list[1].get()[0][2]) == Approx(-0.0025404284));
425  CHECK(std::imag(dpsi_v_list[1].get()[1][0]) == Approx(0.1069453433));
426  CHECK(std::imag(dpsi_v_list[1].get()[1][1]) == Approx(-0.43649593));
427  CHECK(std::imag(dpsi_v_list[1].get()[1][2]) == Approx(-0.1069145575));
428  // lapl
429  CHECK(std::imag(d2psi_v_list[1].get()[0]) == Approx(-1.3757134676));
430  CHECK(std::imag(d2psi_v_list[1].get()[1]) == Approx(-2.4919104576));
431 #endif
432 
433  const size_t nw = 2;
434  std::vector<SPOSet::ValueType> ratio_v(nw);
435  std::vector<SPOSet::GradType> grads_v(nw);
436 
437  Vector<SPOSet::ValueType, OffloadPinnedAllocator<SPOSet::ValueType>> inv_row(5);
438  inv_row = {0.1, 0.2, 0.3, 0.4, 0.5};
439  inv_row.updateTo();
440 
441  std::vector<const SPOSet::ValueType*> inv_row_ptr(nw, inv_row.device_data());
442 
443  SPOSet::OffloadMWVGLArray phi_vgl_v;
444  phi_vgl_v.resize(QMCTraits::DIM_VGL, nw, 5);
445  spo->mw_evaluateVGLandDetRatioGrads(spo_list, p_list, 0, inv_row_ptr, phi_vgl_v, ratio_v, grads_v);
446 #if !defined(QMC_COMPLEX)
447  CHECK(std::real(ratio_v[0]) == Approx(0.2365307168));
448  CHECK(std::real(grads_v[0][0]) == Approx(-5.4095164399));
449  CHECK(std::real(grads_v[0][1]) == Approx(14.37990087));
450  CHECK(std::real(grads_v[0][2]) == Approx(16.9374788259));
451  CHECK(std::real(ratio_v[1]) == Approx(1.0560744941));
452  CHECK(std::real(grads_v[1][0]) == Approx(-0.0863436466));
453  CHECK(std::real(grads_v[1][1]) == Approx(-0.7499371447));
454  CHECK(std::real(grads_v[1][2]) == Approx(0.8570534314));
455 #endif
456 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [450/537]

qmcplusplus::TEST_CASE ( "DiracDeterminantBatched_second"  ,
""  [wavefunction][fermion] 
)

Definition at line 263 of file test_DiracDeterminantBatched.cpp.

264 {
265 #if defined(ENABLE_OFFLOAD) && defined(ENABLE_CUDA)
266  test_DiracDeterminantBatched_second<PlatformKind::CUDA>();
267 #endif
268 #if defined(ENABLE_OFFLOAD) && defined(ENABLE_SYCL)
269  test_DiracDeterminantBatched_second<PlatformKind::SYCL>();
270 #endif
271  test_DiracDeterminantBatched_second<PlatformKind::OMPTARGET>();
272 }

◆ TEST_CASE() [451/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A BCC 3 particles"  ,
""  [hamiltonian] 
)

Definition at line 267 of file test_coulomb_pbcAA.cpp.

References DC_POS, DC_POS_OFFLOAD, and test_CoulombPBCAA_3p().

268 {
269  test_CoulombPBCAA_3p(DynamicCoordinateKind::DC_POS);
270  test_CoulombPBCAA_3p(DynamicCoordinateKind::DC_POS_OFFLOAD);
271 }
void test_CoulombPBCAA_3p(DynamicCoordinateKind kind)

◆ TEST_CASE() [452/537]

qmcplusplus::TEST_CASE ( "InputSection::InvalidElement"  ,
""  [estimators] 
)

Definition at line 273 of file test_InputSection.cpp.

References doc, Libxml2Document::getRoot(), okay, Libxml2Document::parseFromString(), InputSection::readXML(), and REQUIRE().

274 {
275  std::string invalid_element{R"(<test> &lt; </test>)"};
277  bool okay = doc.parseFromString(invalid_element);
278  REQUIRE(okay);
279  xmlNodePtr cur = doc.getRoot();
280  TestInputSection ti;
281  CHECK_THROWS_AS(ti.readXML(cur), UniformCommunicateError);
282 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ TEST_CASE() [453/537]

qmcplusplus::TEST_CASE ( "OneBodyDensityMatrices::generateSamples"  ,
""  [estimators] 
)

Definition at line 274 of file test_OneBodyDensityMatrices.cpp.

References ProjectData::BATCH, comm, OHMMS::Controller, doc, Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), node, obdmi, okay, Libxml2Document::parseFromString(), particle_pool, pset_target, species_set, test_project, and wavefunction_pool.

275 {
276  using Input = testing::ValidOneBodyDensityMatricesInput;
277 
279 
280  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
282 
283  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
284  auto wavefunction_pool =
285  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
286  auto& pset_target = *(particle_pool.getParticleSet("e"));
287  auto& species_set = pset_target.getSpeciesSet();
288  auto& spo_map = wavefunction_pool.getWaveFunction("wavefunction")->getSPOMap();
289 
290  auto samplingCaseRunner = [&pset_target, &species_set, &spo_map](Input::valid test_case) {
292 
293  bool okay = doc.parseFromString(Input::xml[test_case]);
294  if (!okay)
295  throw std::runtime_error("cannot parse OneBodyDensitMatricesInput section");
296  xmlNodePtr node = doc.getRoot();
297  OneBodyDensityMatricesInput obdmi(node);
298 
299  OneBodyDensityMatrices obDenMat(std::move(obdmi), pset_target.getLattice(), species_set, spo_map, pset_target);
300 
301  testing::OneBodyDensityMatricesTests<QMCTraits::FullPrecRealType> obdmt;
302  //Get control over which rng is used.
303  //we don't want FakeRandom.
304  StdRandom<OneBodyDensityMatrices::FullPrecRealType> rng;
305  obdmt.testGenerateSamples(test_case, obDenMat, pset_target, rng);
306  };
307 
308  samplingCaseRunner(Input::valid::VANILLA);
309  samplingCaseRunner(Input::valid::SCALE);
310  samplingCaseRunner(Input::valid::GRID);
311 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
OneBodyDensityMatricesInput obdmi(node)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker
Definition: test_walker.cpp:31

◆ TEST_CASE() [454/537]

qmcplusplus::TEST_CASE ( "CoulombAA::mw_evaluatePerParticle"  ,
""  [hamiltonian] 
)

Definition at line 274 of file test_coulomb_pbcAA.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), Matrix< T, Alloc >::begin(), CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), Matrix< T, Alloc >::cols(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), CoulombPBCAA::createResource(), ParticleSet::createResource(), ParticleSet::createSK(), DC_POS, DC_POS_OFFLOAD, qmcplusplus::testing::getParticularListener(), ParticleSet::getSpeciesSet(), OperatorBase::getValue(), CoulombPBCAA::informOfPerParticleListener(), lattice, CoulombPBCAA::mw_evaluatePerParticle(), ParticleSet::mw_update(), CoulombPBCAA::myConst, ParticleSet::R, ParticleSet::setName(), and ParticleSet::update().

275 {
277  LRCoulombSingleton::CoulombHandler = 0;
278 
279  // Constructing a mock "golden" set of walker elements
280  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
281  lattice.BoxBConds = true; // periodic
282  lattice.R.diagonal(1.0);
283  lattice.reset();
284 
285  const SimulationCell simulation_cell(lattice);
286  ParticleSet elec(simulation_cell);
287 
288  elec.setName("elec");
289  elec.create({2});
290  elec.R[0] = {0.0, 0.5, 0.0};
291  elec.R[1] = {0.0, 0.0, 0.0};
292  SpeciesSet& tspecies = elec.getSpeciesSet();
293  int upIdx = tspecies.addSpecies("u");
294  int chargeIdx = tspecies.addAttribute("charge");
295  int massIdx = tspecies.addAttribute("mass");
296  tspecies(chargeIdx, upIdx) = -1;
297  tspecies(massIdx, upIdx) = 1.0;
298 
299  // The XMLParticleParser always calls createSK on particle sets it creates.
300  // Since most code assumes a valid particle set is as created by XMLParticleParser,
301  // we must call createSK().
302  elec.createSK();
303  elec.update();
304  // golden particle set valid (enough for this test)
305 
306  DynamicCoordinateKind kind = DynamicCoordinateKind::DC_POS;
307  // golden CoulombPBCAA
308  CoulombPBCAA caa(elec, true, false, kind == DynamicCoordinateKind::DC_POS_OFFLOAD);
309 
310  // mock golden wavefunction, only needed to satisfy APIs
311  RuntimeOptions runtime_options;
312  TrialWaveFunction psi(runtime_options);
313 
314  // informOfPerParticleListener should be called on the golden instance of this operator if there
315  // are listeners present for it. This would normally be done by QMCHamiltonian but this is a unit test.
316  caa.informOfPerParticleListener();
317 
318  // Now we can make a clone of the mock walker
319  ParticleSet elec2(elec);
320 
321  elec2.R[0] = {0.0, 0.5, 0.1};
322  elec2.R[1] = {0.6, 0.05, -0.1};
323  elec2.update();
324 
325  CoulombPBCAA caa2(elec2, true, false, kind == DynamicCoordinateKind::DC_POS_OFFLOAD);
326  RefVector<OperatorBase> caas{caa, caa2};
327  RefVectorWithLeader<OperatorBase> o_list(caa, caas);
328 
329  TrialWaveFunction psi_clone(runtime_options);
330  RefVectorWithLeader<TrialWaveFunction> twf_list(psi, {psi, psi_clone});
331 
332  // Self-energy correction, no background charge for e-e interaction
333  double consts = caa.myConst;
334  CHECK(consts == Approx(-6.3314780332));
335  RefVector<ParticleSet> ptcls{elec, elec2};
336  RefVectorWithLeader<ParticleSet> p_list(elec, ptcls);
337 
338  ResourceCollection caa_res("test_caa_res");
339  caa.createResource(caa_res);
340  ResourceCollectionTeamLock<OperatorBase> caa_lock(caa_res, o_list);
341 
342  ResourceCollection pset_res("test_pset_res");
343  elec.createResource(pset_res);
344  ResourceCollectionTeamLock<ParticleSet> pset_lock(pset_res, p_list);
345 
346  // The test Listener emitted by getParticularListener binds a Matrix
347  // it will write the reported data into it with each walker's particle values
348  // in a row.
349  Matrix<Real> local_pots(2);
350  Matrix<Real> local_pots2(2);
351 
352  std::vector<ListenerVector<Real>> listeners;
353  listeners.emplace_back("localenergy", getParticularListener(local_pots));
354  listeners.emplace_back("localenergy", getParticularListener(local_pots2));
355  std::vector<ListenerVector<Real>> ion_listeners;
356 
357  ParticleSet::mw_update(p_list);
358 
359  caa.mw_evaluatePerParticle(o_list, twf_list, p_list, listeners, ion_listeners);
360  CHECK(caa.getValue() == Approx(-2.9332312765));
361  CHECK(caa2.getValue() == Approx(-3.4537460926));
362  // Check that the sum of the particle energies == the total
363  CHECK(std::accumulate(local_pots.begin(), local_pots.begin() + local_pots.cols(), 0.0) == Approx(-2.9332312765));
364  CHECK(std::accumulate(local_pots[1], local_pots[1] + local_pots.cols(), 0.0) == Approx(-3.4537460926));
365  // Check that the second listener received the same data
366  auto check_matrix_result = checkMatrix(local_pots, local_pots2);
367  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
368 }
DynamicCoordinateKind
enumerator for DynamicCoordinates kinds
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
auto getParticularListener(Matrix< T > &local_pots)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [455/537]

qmcplusplus::TEST_CASE ( "RotatedSPOs SplineR2R hcpBe values"  ,
""  [wavefunction] 
)

Definition at line 274 of file test_RotatedSPOs_NLPP.cpp.

References test_hcpBe_rotation().

275 {
276  SECTION("nlpp non-batched")
277  {
278  bool use_single_det = GENERATE(true, false);
279  bool use_nlpp_batched = false;
280  test_hcpBe_rotation(use_single_det, use_nlpp_batched);
281  }
282 
283  SECTION("nlpp batched")
284  {
285  bool use_single_det = true;
286  bool use_nlpp_batched = true;
287  test_hcpBe_rotation(use_single_det, use_nlpp_batched);
288  }
289 }
void test_hcpBe_rotation(bool use_single_det, bool use_nlpp_batched)

◆ TEST_CASE() [456/537]

qmcplusplus::TEST_CASE ( "test_timer_nested_profile_collate"  ,
""  [utilities] 
)

Definition at line 280 of file test_timer.cpp.

References TimerManager< TIMER >::collate_stack_profile(), convert_to_ns(), TimerManager< TIMER >::createTimer(), doc, Libxml2Document::dump(), Libxml2Document::getRoot(), TimerManager< TIMER >::StackProfileData::names, Libxml2Document::newDoc(), TimerManager< TIMER >::output_timing(), REQUIRE(), qmcplusplus::Units::time::s, TimerManager< TIMER >::set_timer_threshold(), TimerType< CLOCK >::start(), TimerType< CLOCK >::stop(), and timer_level_fine.

281 {
282  FakeTimerManager tm;
283  tm.set_timer_threshold(timer_level_fine);
284  FakeTimer* t1 = tm.createTimer("timer1");
285  FakeTimer* t2 = tm.createTimer("timer2");
286  FakeTimer* t2b = tm.createTimer("timer2");
287  FakeTimer* t3 = tm.createTimer("timer3");
288 
289 
290  FakeChronoClock::fake_chrono_clock_increment = convert_to_ns(1.1s);
291  t1->start();
292  t2->start();
293  t3->start();
294  t3->stop();
295  t2->stop();
296  t2b->start();
297  t3->start();
298  t3->stop();
299  t2b->stop();
300  t2->start();
301  t3->start();
302  t3->stop();
303  t2->stop();
304  t2b->start();
305  t3->start();
306  t3->stop();
307  t2b->stop();
308  t1->stop();
309 
310 
311  FakeTimerManager::StackProfileData p2;
312  tm.collate_stack_profile(NULL, p2);
313  //tm.print_stack(NULL);
314 #ifdef ENABLE_TIMERS
315  REQUIRE(p2.names.size() == 3);
316  REQUIRE(p2.names[0] == "timer1");
317  REQUIRE(p2.names[1] == "timer1/timer2");
318  REQUIRE(p2.names[2] == "timer1/timer2/timer3");
319 #endif
320 
322  doc.newDoc("resources");
323  tm.output_timing(NULL, doc, doc.getRoot());
324  doc.dump("tmp3.xml");
325 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
TimerType< FakeChronoClock > FakeTimer
Definition: NewTimer.h:235
void newDoc(const std::string &rootName)
Definition: Libxml2Doc.cpp:93
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
FakeChronoClock::duration convert_to_ns(T in)
REQUIRE(std::filesystem::exists(filename))
TimerManager< FakeTimer > FakeTimerManager
Definition: test_timer.cpp:23
void dump(const std::string &newxml)
Definition: Libxml2Doc.cpp:109

◆ TEST_CASE() [457/537]

qmcplusplus::TEST_CASE ( "RotatedSPOs createRotationIndices"  ,
""  [wavefunction] 
)

Definition at line 282 of file test_RotatedSPOs.cpp.

References CHECK(), RotatedSPOs::createRotationIndices(), and RotatedSPOs::createRotationIndicesFull().

283 {
284  // No active-active or virtual-virtual rotations
285  // Only active-virtual
286  RotatedSPOs::RotationIndices rot_ind;
287  int nel = 1;
288  int nmo = 3;
289  RotatedSPOs::createRotationIndices(nel, nmo, rot_ind);
290  CHECK(rot_ind.size() == 2);
291 
292  // Full rotation contains all rotations
293  // Size should be number of pairs of orbitals: nmo*(nmo-1)/2
294  RotatedSPOs::RotationIndices full_rot_ind;
295  RotatedSPOs::createRotationIndicesFull(nel, nmo, full_rot_ind);
296  CHECK(full_rot_ind.size() == 3);
297 
298  nel = 2;
299  RotatedSPOs::RotationIndices rot_ind2;
300  RotatedSPOs::createRotationIndices(nel, nmo, rot_ind2);
301  CHECK(rot_ind2.size() == 2);
302 
303  RotatedSPOs::RotationIndices full_rot_ind2;
304  RotatedSPOs::createRotationIndicesFull(nel, nmo, full_rot_ind2);
305  CHECK(full_rot_ind2.size() == 3);
306 
307  nmo = 4;
308  RotatedSPOs::RotationIndices rot_ind3;
309  RotatedSPOs::createRotationIndices(nel, nmo, rot_ind3);
310  CHECK(rot_ind3.size() == 4);
311 
312  RotatedSPOs::RotationIndices full_rot_ind3;
313  RotatedSPOs::createRotationIndicesFull(nel, nmo, full_rot_ind3);
314  CHECK(full_rot_ind3.size() == 6);
315 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [458/537]

qmcplusplus::TEST_CASE ( "mw_evaluate Numerical He"  ,
""  [wavefunction] 
)

Definition at line 283 of file test_MO.cpp.

References test_He_mw().

283 { test_He_mw(true); }
void test_He_mw(bool transform)
Definition: test_MO.cpp:136

◆ TEST_CASE() [459/537]

qmcplusplus::TEST_CASE ( "InputSection::init"  ,
""  [estimators] 
)

Definition at line 284 of file test_InputSection.cpp.

References InputSection::init().

285 {
286  SECTION("bad type handling")
287  {
288  TestInputSection ti;
289  CHECK_THROWS_AS(ti.init({{"full", bool(false)}, {"count", int(15)}, {"width", int(10)}}), UniformCommunicateError);
290  }
291  SECTION("minimum required attributes and parameters")
292  {
293  // initialize
294  TestInputSection ti;
295  ti.init({{"full", bool(false)}, {"count", int(15)}});
296 
297  ti.report(std::cout);
298 
299  // assigned from initializer-list
300  CHECK(ti.has("full"));
301  CHECK(ti.has("count"));
302  // assigned from defaults
303  CHECK(ti.has("name"));
304  CHECK(ti.has("samples"));
305  CHECK(ti.has("width"));
306  CHECK(ti.has("rational"));
307  // unassigned
308  CHECK(!ti.has("kmax"));
309  CHECK(!ti.has("label"));
310  // check value correctness
311  CHECK(ti.get<bool>("full") == false);
312  CHECK(ti.get<int>("count") == 15);
313  CHECK(ti.get<std::string>("name") == "demo");
314  CHECK(ti.get<int>("samples") == 20);
315  CHECK(ti.get<Real>("width") == Approx(1.0));
316  CHECK(ti.get<bool>("rational") == false);
317  }
318 
319 
320  SECTION("complete attributes and parameters")
321  {
322  // initialize
323  TestInputSection ti;
324  ti.init({{"name", std::string("alice")},
325  {"samples", int(10)},
326  {"kmax", Real(3.0)},
327  {"full", bool(false)},
328  {"label", std::string("relative")},
329  {"count", int(15)},
330  {"width", Real(2.5)},
331  {"rational", bool(true)},
332  {"sposets", std::vector<std::string>{"spo1", "spo2"}},
333  {"center", InputSection::Position(0.0, 0.0, 0.1)}});
334 
335  ti.report(std::cout);
336  // assigned from initializer-list
337  CHECK(ti.has("name"));
338  CHECK(ti.has("samples"));
339  CHECK(ti.has("kmax"));
340  CHECK(ti.has("full"));
341  CHECK(ti.has("label"));
342  CHECK(ti.has("count"));
343  CHECK(ti.has("width"));
344  CHECK(ti.has("rational"));
345  // check value correctness
346  CHECK(ti.get<std::string>("name") == "alice");
347  CHECK(ti.get<int>("samples") == 10);
348  CHECK(ti.get<Real>("kmax") == Approx(3.0));
349  CHECK(ti.get<bool>("full") == false);
350  CHECK(ti.get<std::string>("label") == "relative");
351  CHECK(ti.get<int>("count") == 15);
352  CHECK(ti.get<Real>("width") == Approx(2.5));
353  CHECK(ti.get<bool>("rational") == true);
354  CHECK(ti.get<std::vector<std::string>>("sposets") == std::vector<std::string>{"spo1", "spo2"});
355  CHECK(ti.get<InputSection::Position>("center") == InputSection::Position(0.0, 0.0, 0.1));
356  }
357 
358 
359  SECTION("invalid type assignment")
360  {
361  TestInputSection ti;
362  CHECK_THROWS_AS(ti.init({{"full", bool(false)}, {"count", Real(15.)}}), UniformCommunicateError);
363  }
364 }
ForceBase::Real Real
Definition: ForceBase.cpp:26
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [460/537]

qmcplusplus::TEST_CASE ( "DiracDeterminant_second"  ,
""  [wavefunction][fermion] 
)

Definition at line 285 of file test_DiracDeterminant.cpp.

References ACCEL, and HOST.

286 {
287  test_DiracDeterminant_second<DiracDeterminant<>>(DetMatInvertor::HOST);
288  test_DiracDeterminant_second<DiracDeterminant<>>(DetMatInvertor::ACCEL);
289 #if defined(ENABLE_CUDA)
290  test_DiracDeterminant_second<DiracDeterminant<DelayedUpdateCUDA<ValueType, QMCTraits::QTFull::ValueType>>>(
291  DetMatInvertor::HOST);
292  test_DiracDeterminant_second<DiracDeterminant<DelayedUpdateCUDA<ValueType, QMCTraits::QTFull::ValueType>>>(
293  DetMatInvertor::ACCEL);
294 #elif defined(ENABLE_SYCL)
295  test_DiracDeterminant_second<DiracDeterminant<DelayedUpdateSYCL<ValueType, QMCTraits::QTFull::ValueType>>>(
296  DetMatInvertor::HOST);
297 #endif
298 }

◆ TEST_CASE() [461/537]

qmcplusplus::TEST_CASE ( "SOECPotential"  ,
""  [hamiltonian] 
)

Definition at line 285 of file test_SOECPotential.cpp.

References doSOECPotentialTest().

286 {
287  //do test using VPs. This uses mw_ APIs for TWF in the mw_ SOECP APIs
288  doSOECPotentialTest(true);
289  //do test without VPs. This uses legacy APIs for TWF in the mw_ SOECP APIs
290  doSOECPotentialTest(false);
291 }
void doSOECPotentialTest(bool use_VPs)

◆ TEST_CASE() [462/537]

qmcplusplus::TEST_CASE ( "SPO input spline from h5 LiH_msd arbitrary species"  ,
""  [wavefunction] 
)

Definition at line 285 of file test_spo_collection_input_MSD_LCAO_h5.cpp.

References app_log(), and test_LiH_msd_xml_input_with_positron().

286 {
287  app_log() << "-------------------------------------------------------------" << std::endl;
288  app_log() << "LiH_msd with positron h5 input style" << std::endl;
289  app_log() << "-------------------------------------------------------------" << std::endl;
290  const char* spo_xml_string1 = R"(<wavefunction name="psi0" target="e">
291  <sposet_collection type="MolecularOrbital" name="LCAOBSet" source="ion0" transform="yes" cuspCorrection="no" href="LiH.orbs.h5">
292  <sposet basisset="LCAOBSet" name="spo-up" size="5">
293  <occupation mode="ground"/>
294  <coefficient size="5" spindataset="0"/>
295  </sposet>
296  <sposet basisset="LCAOBSet" name="spo-dn" size="5">
297  <occupation mode="ground"/>
298  <coefficient size="5" spindataset="0"/>
299  </sposet>
300  <sposet basisset="LCAOBSet" name="spo-ps" size="5">
301  <occupation mode="ground"/>
302  <coefficient size="5" spindataset="0"/>
303  </sposet>
304  </sposet_collection>
305  <determinantset>
306  <multideterminant optimize="yes" spo_0="spo-up" spo_1="spo-dn" spo_2="spo-ps">
307  <detlist size="2" type="DETS" cutoff="1e-20" href="LiH.Multidet.h5"/>
308  </multideterminant>
309  </determinantset>
310 </wavefunction>
311 )";
312  test_LiH_msd_xml_input_with_positron(spo_xml_string1, "spo-ps", 5, 105);
313 }
void test_LiH_msd_xml_input_with_positron(const std::string &spo_xml_string, const std::string &check_sponame, int check_spo_size, int check_basisset_size)
std::ostream & app_log()
Definition: OutputManager.h:65

◆ TEST_CASE() [463/537]

qmcplusplus::TEST_CASE ( "Cartesian Tensor evaluateWithThirdDeriv subset"  ,
""  [numerics] 
)

Definition at line 287 of file test_cartesian_tensor.cpp.

References CHECK(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::evaluateWithThirdDeriv(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::getGGGYlm(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::getGradYlm(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::getHessYlm(), and CartesianTensor< T, Point_t, Tensor_t, GGG_t >::getYlm().

288 {
290 
291  TinyVector<double, 3> pt(1.3, 1.2, -0.5);
292  ct.evaluateWithThirdDeriv(pt);
293 
294  //for (int i = 0; i < 35; i++) {
295  // std::cout << "XYZ = " << i << " " << ct.getYlm(i) << " " << ct.getGGGYlm(i) << std::endl;
296  //}
297 
298 
299  CHECK(ct.getYlm(0) == Approx(0.282094791774));
300 
301 
302  CHECK(ct.getYlm(27) == Approx(-0.363846924275));
303  CHECK(ct.getGradYlm(27)[0] == Approx(-0.279882249443));
304  CHECK(ct.getGradYlm(27)[1] == Approx(0));
305  CHECK(ct.getGradYlm(27)[2] == Approx(2.18308154565));
306 
307  CHECK(ct.getHessYlm(27)(0, 0) == Approx(0));
308  CHECK(ct.getHessYlm(27)(0, 1) == Approx(0));
309  CHECK(ct.getHessYlm(27)(0, 2) == Approx(1.67929349666));
310  CHECK(ct.getHessYlm(27)(1, 0) == Approx(0));
311  CHECK(ct.getHessYlm(27)(1, 1) == Approx(0));
312  CHECK(ct.getHessYlm(27)(1, 2) == Approx(0));
313  CHECK(ct.getHessYlm(27)(2, 0) == Approx(1.67929349666));
314  CHECK(ct.getHessYlm(27)(2, 1) == Approx(0));
315  CHECK(ct.getHessYlm(27)(2, 2) == Approx(-8.73232618261));
316 
317 
318  CHECK(ct.getGGGYlm(27)[0](0, 0) == Approx(0));
319  CHECK(ct.getGGGYlm(27)[0](0, 1) == Approx(0));
320  CHECK(ct.getGGGYlm(27)[0](0, 2) == Approx(0));
321  CHECK(ct.getGGGYlm(27)[0](1, 0) == Approx(0));
322  CHECK(ct.getGGGYlm(27)[0](1, 1) == Approx(0));
323  CHECK(ct.getGGGYlm(27)[0](1, 2) == Approx(0));
324  CHECK(ct.getGGGYlm(27)[0](2, 0) == Approx(0));
325  CHECK(ct.getGGGYlm(27)[0](2, 1) == Approx(0));
326  CHECK(ct.getGGGYlm(27)[0](2, 2) == Approx(-6.71717398662));
327  CHECK(ct.getGGGYlm(27)[1](0, 0) == Approx(0));
328  CHECK(ct.getGGGYlm(27)[1](0, 1) == Approx(0));
329  CHECK(ct.getGGGYlm(27)[1](0, 2) == Approx(0));
330  CHECK(ct.getGGGYlm(27)[1](1, 0) == Approx(0));
331  CHECK(ct.getGGGYlm(27)[1](1, 1) == Approx(0));
332  CHECK(ct.getGGGYlm(27)[1](1, 2) == Approx(0));
333  CHECK(ct.getGGGYlm(27)[1](2, 0) == Approx(0));
334  CHECK(ct.getGGGYlm(27)[1](2, 1) == Approx(0));
335  CHECK(ct.getGGGYlm(27)[1](2, 2) == Approx(0));
336  CHECK(ct.getGGGYlm(27)[2](0, 0) == Approx(0));
337  CHECK(ct.getGGGYlm(27)[2](0, 1) == Approx(0));
338  CHECK(ct.getGGGYlm(27)[2](0, 2) == Approx(-6.71717398662));
339  CHECK(ct.getGGGYlm(27)[2](1, 0) == Approx(0));
340  CHECK(ct.getGGGYlm(27)[2](1, 1) == Approx(0));
341  CHECK(ct.getGGGYlm(27)[2](1, 2) == Approx(0));
342  CHECK(ct.getGGGYlm(27)[2](2, 0) == Approx(-6.71717398662));
343  CHECK(ct.getGGGYlm(27)[2](2, 1) == Approx(0));
344  CHECK(ct.getGGGYlm(27)[2](2, 2) == Approx(17.4646523652));
345 
346 
347  CHECK(ct.getYlm(62) == Approx(-4.19700340252));
348  CHECK(ct.getGradYlm(62)[0] == Approx(0));
349  CHECK(ct.getGradYlm(62)[1] == Approx(-17.4875141772));
350  CHECK(ct.getGradYlm(62)[2] == Approx(8.39400680505));
351 
352  CHECK(ct.getHessYlm(62)(0, 0) == Approx(0));
353  CHECK(ct.getHessYlm(62)(0, 1) == Approx(0));
354  CHECK(ct.getHessYlm(62)(0, 2) == Approx(0));
355  CHECK(ct.getHessYlm(62)(1, 0) == Approx(0));
356  CHECK(ct.getHessYlm(62)(1, 1) == Approx(-58.291713924));
357  CHECK(ct.getHessYlm(62)(1, 2) == Approx(34.9750283544));
358  CHECK(ct.getHessYlm(62)(2, 0) == Approx(0));
359  CHECK(ct.getHessYlm(62)(2, 1) == Approx(34.9750283544));
360  CHECK(ct.getHessYlm(62)(2, 2) == Approx(0));
361  CHECK(ct.getGGGYlm(62)[0](0, 0) == Approx(0));
362  CHECK(ct.getGGGYlm(62)[0](0, 1) == Approx(0));
363  CHECK(ct.getGGGYlm(62)[0](0, 2) == Approx(0));
364  CHECK(ct.getGGGYlm(62)[0](1, 0) == Approx(0));
365  CHECK(ct.getGGGYlm(62)[0](1, 1) == Approx(0));
366  CHECK(ct.getGGGYlm(62)[0](1, 2) == Approx(0));
367  CHECK(ct.getGGGYlm(62)[0](2, 0) == Approx(0));
368  CHECK(ct.getGGGYlm(62)[0](2, 1) == Approx(0));
369  CHECK(ct.getGGGYlm(62)[0](2, 2) == Approx(0));
370  CHECK(ct.getGGGYlm(62)[1](0, 0) == Approx(0));
371  CHECK(ct.getGGGYlm(62)[1](0, 1) == Approx(0));
372  CHECK(ct.getGGGYlm(62)[1](0, 2) == Approx(0));
373  CHECK(ct.getGGGYlm(62)[1](1, 0) == Approx(0));
374  CHECK(ct.getGGGYlm(62)[1](1, 1) == Approx(-145.72928481));
375  CHECK(ct.getGGGYlm(62)[1](1, 2) == Approx(116.583427848));
376  CHECK(ct.getGGGYlm(62)[1](2, 0) == Approx(0));
377  CHECK(ct.getGGGYlm(62)[1](2, 1) == Approx(116.583427848));
378  CHECK(ct.getGGGYlm(62)[1](2, 2) == Approx(0));
379  CHECK(ct.getGGGYlm(62)[2](0, 0) == Approx(0));
380  CHECK(ct.getGGGYlm(62)[2](0, 1) == Approx(0));
381  CHECK(ct.getGGGYlm(62)[2](0, 2) == Approx(0));
382  CHECK(ct.getGGGYlm(62)[2](1, 0) == Approx(0));
383  CHECK(ct.getGGGYlm(62)[2](1, 1) == Approx(116.583427848));
384  CHECK(ct.getGGGYlm(62)[2](1, 2) == Approx(0));
385  CHECK(ct.getGGGYlm(62)[2](2, 0) == Approx(0));
386  CHECK(ct.getGGGYlm(62)[2](2, 1) == Approx(0));
387  CHECK(ct.getGGGYlm(62)[2](2, 2) == Approx(0));
388 }
The template parameters.
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [464/537]

qmcplusplus::TEST_CASE ( "Coulomb PBC A-A Ewald Quasi2D staggered triangle 2x2"  ,
""  [hamiltonian] 
)

Definition at line 287 of file test_ewald_quasi2d.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), ParticleSet::createSK(), dot(), CoulombPBCAA::evaluate(), for(), ParticleSet::getSpeciesSet(), lattice, LRCoulombSingleton::QUASI2D, ParticleSet::R, ParticleSet::setName(), sqrt(), LRCoulombSingleton::this_lr_type, and ParticleSet::update().

288 {
289  LRCoulombSingleton::CoulombHandler = 0; // !!!! crucial if not first test
290  LRCoulombSingleton::this_lr_type = LRCoulombSingleton::QUASI2D;
291  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
292  lattice.BoxBConds = true;
293  lattice.BoxBConds[2] = false; // ppn
294  lattice.ndim = 2;
295  const double rs = 10;
296  const double alat = rs*2*std::sqrt(2.0*M_PI/std::sqrt(3));
297  lattice.R = 0.0;
298  lattice.R(0, 0) = alat;
299  lattice.R(1, 0) = -1.0/2*alat;
300  lattice.R(1, 1) = std::sqrt(3)/2*alat;
301  lattice.R(2, 2) = 2*alat;
302  lattice.LR_dim_cutoff = 30.0;
303  lattice.reset();
304 
305  const SimulationCell simulation_cell(lattice);
306  ParticleSet elec(simulation_cell);
307  int npart = 8;
308  elec.setName("e");
309  elec.create({npart});
310  // initialize fractional coordinates
311  TinyVector<double, 3> r0 = {0.0, 0.0, 0.0};
312  TinyVector<double, 3> r1 = {2./3, 1./3, 0.0};
313  elec.R[0] = {0.0, 0.0, 0.0};
314  elec.R[1] = {0.5, 0.0, 0.0};
315  elec.R[2] = {0.0, 0.5, 0.0};
316  elec.R[3] = {0.5, 0.5, 0.0};
317  elec.R[4] = {0.0, 0.0, 0.0};
318  elec.R[5] = {0.5, 0.0, 0.0};
319  elec.R[6] = {0.0, 0.5, 0.0};
320  elec.R[7] = {0.5, 0.5, 0.0};
321  for (int i=0;i<npart/2;i++)
322  elec.R[i] += r0/2;
323  for (int i=npart/2;i<npart;i++)
324  elec.R[i] += r1/2;
325  // convert to Cartesian coordinates
326  for (int i=0;i<npart;i++)
327  {
328  elec.R[i] = dot(elec.R[i], lattice.R);
329  }
330 
331  SpeciesSet& tspecies = elec.getSpeciesSet();
332  int upIdx = tspecies.addSpecies("u");
333  int chargeIdx = tspecies.addAttribute("charge");
334  int massIdx = tspecies.addAttribute("mass");
335  tspecies(chargeIdx, upIdx) = -1;
336  tspecies(massIdx, upIdx) = 1.0;
337 
338  elec.createSK();
339  elec.addTable(elec); // !!!! crucial to compute distance table
340 
341  CoulombPBCAA caa(elec, true, false, false);
342 
343  const int ntest = 4;
344  TinyVector<double, ntest> zheight = {0, 0.1, 0.5, 3.0};
345  zheight *= rs;
346  const double vmad_hon = -1.510964233;
347  const double vmad_tri = -1.106102587;
348  TinyVector<double, ntest> vmad_ref = {vmad_hon, -1.4193042644, -1.2005504968, vmad_tri};
349  vmad_ref /= rs;
350  double val;
351  for (int itest=0; itest<ntest; itest++)
352  {
353  for (int i=npart/2;i<npart;i++)
354  elec.R[i][2] = zheight[itest];
355  elec.update();
356  val = caa.evaluate(elec);
357  CHECK(val/npart == Approx(vmad_ref[itest]));
358  }
359 }
T dot(T *a, T *b)
for(int i=0;i< size_test;++i) CHECK(Approx(gauss_random_vals[offset_for_rs+i])
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [465/537]

qmcplusplus::TEST_CASE ( "TwoBodyJastrow Jastrow three particles of three types"  ,
""  [wavefunction] 
)

Definition at line 288 of file test_J2_derivatives.cpp.

References TwoBodyJastrow< FT >::addFunc(), CHECK(), ParticleSet::create(), TwoBodyJastrow< FT >::getPairFunctions(), ParticleSet::R, and ParticleSet::setName().

289 {
290  const SimulationCell simulation_cell;
291  ParticleSet ions(simulation_cell);
292  ParticleSet elec(simulation_cell);
293 
294  ions.setName("ion");
295  ions.create({1});
296  ions.R[0] = {0.0, 0.0, 0.0};
297  elec.setName("elec");
298  elec.create({1, 1, 1});
299  elec.R[0] = {-0.28, 0.0225, -2.709};
300  elec.R[1] = {-1.08389, 1.9679, -0.0128914};
301  elec.R[2] = {-2.08389, 0.9679, 0.0128914};
302  TwoBodyJastrow<FakeJasFunctor> jorb("J2_fake", elec, false);
303 
304  // 0 uu (0,0)
305  // 1 ud (0,1)
306  // 2 up (0,2)
307  // 3 du (1,0)
308  // 4 dd (1,1)
309  // 5 dp (1,2)
310  // 6 pu (2,0)
311  // 7 pd (2,1)
312  // 8 pp (2,2)
313 
314  auto j2a_uptr = std::make_unique<FakeJasFunctor>("test_fake_a");
315  auto& j2a = *j2a_uptr;
316  j2a.myVars.insert("opt1", 1.0);
317  // update num_active_vars
318  j2a.myVars.resetIndex();
319  jorb.addFunc(0, 1, std::move(j2a_uptr));
320 
321  auto j2b_uptr = std::make_unique<FakeJasFunctor>("test_fake_b");
322  auto j2b = *j2b_uptr;
323  j2b.myVars.insert("opt2", 2.0);
324  // update num_active_vars
325  j2b.myVars.resetIndex();
326  jorb.addFunc(0, 2, std::make_unique<FakeJasFunctor>(*j2b_uptr));
327 
328  // currently opposite spins won't be set to be equivalent
329  // setting u,p doesn't set d,p
330  jorb.addFunc(1, 2, std::move(j2b_uptr));
331 
332  auto& F = jorb.getPairFunctions();
333  for (size_t i = 0; i < F.size(); ++i)
334  CHECK(F[i] != nullptr);
335 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [466/537]

qmcplusplus::TEST_CASE ( "cuBLAS_LU::getrf_batched_complex"  ,
""  [wavefunction][CUDA] 
)

Definition at line 295 of file test_cuBLAS_LU.cpp.

References qmcplusplus::Units::distance::A, B(), batch_size, CHECK(), check_matrix_result, checkArray, CHECKED_ELSE(), checkMatrix(), qmcplusplus::cuBLAS_LU::computeGetrf_batched(), cudaErrorCheck(), cudaMemcpyAsync, cudaMemcpyDeviceToHost, cudaMemcpyHostToDevice, cudaStreamSynchronize, dev_infos(), dev_pivots(), devMs(), hstream, infos(), lda, lu, lu_mat(), M_mat(), Ms, n, pivots, and real_pivot.

296 {
297  auto cuda_handles = std::make_unique<testing::CUDAHandles>();
298  int n = 4;
299  int lda = 4;
300  int batch_size = 1;
301  auto& hstream = cuda_handles->hstream;
302 
303  using StdComp = std::complex<double>;
304  // clang-format off
305  std::vector<StdComp, CUDAHostAllocator<StdComp>> M = {{2.0, 0.1}, {5.0, 0.1}, {8.0, 0.5}, {7.0, 1.0},
306  {5.0, 0.1}, {2.0, 0.2}, {2.0, 0.1}, {8.0, 0.5},
307  {7.0, 0.2}, {5.0, 1.0}, {6.0, -0.2}, {6.0, -0.2},
308  {5.0, 0.0}, {4.0, -0.1}, {4.0, -0.6}, {8.0, -2.0}};
309  // clang-format on
310  std::vector<StdComp, CUDAAllocator<StdComp>> devM(M.size());
311  std::vector<StdComp*, CUDAHostAllocator<StdComp*>> Ms(batch_size);
312  std::vector<StdComp*, CUDAAllocator<StdComp*>> devMs(batch_size);
313  Ms[0] = devM.data();
314 
315  std::vector<int, CUDAHostAllocator<int>> pivots = {1, 1, 1, 1};
316  std::vector<int, CUDAAllocator<int>> dev_pivots(pivots.size());
317 
318  std::vector<int, CUDAHostAllocator<int>> infos = {1, 1, 1, 1};
319  std::vector<int, CUDAAllocator<int>> dev_infos(infos.size());
320 
321  cudaErrorCheck(cudaMemcpyAsync(devM.data(), M.data(), sizeof(decltype(devM)::value_type) * devM.size(), cudaMemcpyHostToDevice, hstream),
322  "cudaMemcpyAsync failed copying M to device");
323  cudaErrorCheck(cudaMemcpyAsync(devMs.data(), Ms.data(), sizeof(decltype(devMs)::value_type) * devMs.size(), cudaMemcpyHostToDevice, hstream),
324  "cudaMemcpyAsync failed copying Ms to device");
325 
326  cuBLAS_LU::computeGetrf_batched(cuda_handles->h_cublas, cuda_handles->hstream, n, lda, devMs.data(), dev_pivots.data(), infos.data(), dev_infos.data(), batch_size);
327 
328  cudaErrorCheck(cudaMemcpyAsync(M.data(), devM.data(), sizeof(decltype(devM)::value_type) * devM.size(), cudaMemcpyDeviceToHost, hstream),
329  "cudaMemcpyAsync failed copying invM from device");
330  cudaErrorCheck(cudaMemcpyAsync(pivots.data(), dev_pivots.data(), sizeof(int) * pivots.size(), cudaMemcpyDeviceToHost, hstream),
331  "cudaMemcpyAsync failed copying pivots from device");
332 
333  cudaErrorCheck(cudaStreamSynchronize(hstream), "cudaStreamSynchronize failed!");
334 
335  std::vector<int> real_pivot = {3, 4, 3, 4};
336 
337  auto checkArray = [](auto A, auto B, int n) {
338  for (int i = 0; i < n; ++i)
339  {
340  CHECK(A[i] == B[i]);
341  }
342  };
343  checkArray(real_pivot.begin(), pivots.begin(), 4);
344  // clang-format off
345  std::vector<StdComp> lu{{8.0, 0.5},
346  {0.8793774319066148, 0.07003891050583658},
347  {0.24980544747081712, -0.0031128404669260694},
348  {0.6233463035019455, -0.026459143968871595},
349  {2.0, 0.1},
350  {6.248249027237354, 0.2719844357976654},
351  {0.7194170575332381, -0.01831314754114669},
352  {0.1212375092639108, 0.02522449751055713},
353  {6.0, -0.2},
354  {0.7097276264591441, -0.4443579766536965},
355  {4.999337315778741, 0.6013141870887196},
356  {0.26158183940834034, 0.23245112532996867},
357  {4.0, -0.6},
358  {4.440466926070039, -1.7525291828793774},
359  {0.840192589866152, 1.5044529443071093},
360  {1.0698651110730424, -0.10853319738453365}};
361  // clang-format on
362  // This could actually be any container that supported the concept of
363  // access via operator()(i, j) and had <T, ALLOCT> template signature
364  testing::MatrixAccessor<std::complex<double>> lu_mat(lu.data(), 4, 4);
365  testing::MatrixAccessor<std::complex<double>> M_mat(M.data(), 4, 4);
367  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
368 }
#define cudaErrorCheck(ans, cause)
Definition: CUDAerror.h:21
CHECK(log_values[1]==ComplexApprox(std::complex< double >{ 5.531331998282581, -8.805487075984523 }))
CHECKED_ELSE(check_matrix_result.result)
std::vector< double *, CUDAAllocator< double * > > devMs(Ms.size())
auto check_matrix_result
std::vector< int, CUDAAllocator< int > > dev_infos(pivots.size())
void computeGetrf_batched(cublasHandle_t &h_cublas, cudaStream_t &hstream, const int n, const int lda, T *Ms[], int *pivots, int *host_infos, int *infos, const int batch_size)
std::vector< int, CUDAHostAllocator< int > > pivots(8, -1.0)
std::vector< int, CUDAHostAllocator< int > > infos(8, 1.0)
testing::MatrixAccessor< double > M_mat(M_vec.data(), 4, 4)
std::vector< int > real_pivot
#define cudaMemcpyDeviceToHost
Definition: cuda2hip.h:138
std::vector< double *, CUDAHostAllocator< double * > > Ms
#define cudaStreamSynchronize
Definition: cuda2hip.h:152
#define cudaMemcpyHostToDevice
Definition: cuda2hip.h:139
testing::MatrixAccessor< double > lu_mat(lu.data(), 4, 4)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
checkArray(real_pivot, pivots, 8)
std::vector< StdComp, CUDAHostAllocator< StdComp > > lu
double B(double x, int k, int i, const std::vector< double > &t)
std::vector< int, CUDAAllocator< int > > dev_pivots(pivots.size())
QMCTraits::FullPrecRealType value_type
std::complex< double > StdComp
#define cudaMemcpyAsync
Definition: cuda2hip.h:136

◆ TEST_CASE() [467/537]

qmcplusplus::TEST_CASE ( "Rotated LCAO WF1"  ,
""  [qmcapp] 
)

Definition at line 298 of file test_RotatedSPOs_LCAO.cpp.

References ProjectData::BATCH, CHECK(), TrialWaveFunction::checkInVariables(), TrialWaveFunction::checkOutVariables(), OHMMS::Controller, doc, TrialWaveFunction::evaluateDerivatives(), TrialWaveFunction::evaluateLog(), ParticleSet::G, TrialWaveFunction::getOrbitals(), ParticleSetPool::getParticleSet(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), identity_coeff, ParticleSet::L, okay, Libxml2Document::parseFromString(), REQUIRE(), TrialWaveFunction::resetParameters(), setupParticleSetPool(), setupRotationXML(), test_project, and ParticleSet::update().

299 {
300  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
301  Communicate* c;
302  c = OHMMS::Controller;
303 
304  ParticleSetPool pp(c);
306 
307  WaveFunctionPool wp(test_project.getRuntimeOptions(), pp, c);
308 
309  REQUIRE(wp.empty() == true);
310 
311 
312  std::string wf_input = setupRotationXML("0.1", "0.2", identity_coeff, identity_coeff);
313 
315  bool okay = doc.parseFromString(wf_input);
316  REQUIRE(okay);
317 
318  xmlNodePtr root = doc.getRoot();
319 
320  wp.put(root);
321 
322  TrialWaveFunction* psi = wp.getWaveFunction("psi0");
323  REQUIRE(psi != nullptr);
324  REQUIRE(psi->getOrbitals().size() == 1);
325 
326  opt_variables_type opt_vars;
327  psi->checkInVariables(opt_vars);
328  psi->checkOutVariables(opt_vars);
329  psi->resetParameters(opt_vars);
330 
331  ParticleSet* elec = pp.getParticleSet("e");
332  elec->update();
333 
334 
335  double logval = psi->evaluateLog(*elec);
336  CHECK(logval == Approx(-9.26625670653773));
337 
338  CHECK(elec->G[0][0] == ValueApprox(-0.2758747113720909));
339  CHECK(elec->L[0] == ValueApprox(-0.316459652026054));
340  CHECK(elec->L[1] == ValueApprox(-0.6035591598540904));
341 
343  Vector<ValueType> dlogpsi(2);
344  Vector<ValueType> dhpsioverpsi(2);
345  psi->evaluateDerivatives(*elec, opt_vars, dlogpsi, dhpsioverpsi);
346 
347 
348  CHECK(dlogpsi[0] == ValueApprox(7.58753078998516));
349  CHECK(dlogpsi[1] == ValueApprox(2.58896036829191));
350  CHECK(dhpsioverpsi[0] == ValueApprox(2.59551625714144));
351  CHECK(dhpsioverpsi[1] == ValueApprox(1.70071425070404));
352 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const std::string identity_coeff
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
void setupParticleSetPool(ParticleSetPool &pp)
optimize::VariableSet opt_variables_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType
std::string setupRotationXML(const std::string &rot_angle_up, const std::string &rot_angle_down, const std::string &coeff_up, const std::string &coeff_down)

◆ TEST_CASE() [468/537]

qmcplusplus::TEST_CASE ( "SpaceGrid::Accumulate::outside"  ,
""  [estimators] 
)

Definition at line 314 of file test_NESpaceGrid.cpp.

References ParticleSet::addTable(), ParticleSet::applyMinimumImage(), CHECK(), comm, OHMMS::Controller, ParticleSet::getDistTableAB(), ParticleSet::getTotalNum(), OHMMS_DIM, SpaceGridEnv< VALID >::pset_elec_, SpaceGridEnv< VALID >::pset_ions_, ParticleSet::R, SpaceGridEnv< VALID >::ref_points_, Matrix< T, Alloc >::resize(), SpaceGridEnv< VALID >::sgi_, and ParticleSet::update().

315 {
316  using Input = testing::ValidSpaceGridInput;
317  Communicate* comm;
319  testing::SpaceGridEnv<Input::valid::CYLINDRICAL> sge(comm);
320  int num_values = 3;
321  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), num_values, false);
322  using NES = testing::NESpaceGridTests<double>;
323  auto buffer_start = NES::getBufferStart(space_grid);
324  auto buffer_end = NES::getBufferEnd(space_grid);
325  space_grid.write_description(std::cout, std::string(""));
326  auto& sgi = *(sge.sgi_);
327  auto& agr = sgi.get_axis_grids();
328  for (int id = 0; id < OHMMS_DIM; ++id)
329  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
330 
331  CHECK(space_grid.nDomains() == 2000);
332  CHECK(space_grid.getDataVector().size() == 6000);
333 
334  Matrix<Real> values;
335  values.resize(sge.pset_elec_.getTotalNum(), num_values);
336 
337  for (int ip = 0; ip < sge.pset_elec_.getTotalNum(); ++ip)
338  for (int iv = 0; iv < num_values; ++iv)
339  values(ip, iv) = ip + 0.1 * iv;
340 
341  const int ei_tid = sge.pset_elec_.addTable(sge.pset_ions_);
342  sge.pset_elec_.update();
343  sge.pset_ions_.update();
344 
345  std::vector<bool> p_outside(8, false);
346  space_grid.accumulate(sge.pset_elec_.R, values, p_outside, sge.pset_elec_.getDistTableAB(ei_tid));
347 
348  // new pset R's
349  // check again
350  auto min_R =
351  ParticleSet::ParticlePos{{1.883366346, 2.136350632, 3.188981533}, {0.09710352868, -0.76751858, -1.89306891}};
352  sge.pset_elec_.applyMinimumImage(min_R);
353  sge.pset_elec_.R = min_R;
354 
355  sge.pset_elec_.update();
356  std::cout << NativePrint(p_outside) << '\n';
357 
358  std::vector<bool> p_outside_2(8, false);
359  space_grid.accumulate(sge.pset_elec_.R, values, p_outside_2, sge.pset_elec_.getDistTableAB(ei_tid));
360 
361  std::cout << NativePrint(p_outside_2) << '\n';
362 
363 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
#define OHMMS_DIM
Definition: config.h:64
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [469/537]

qmcplusplus::TEST_CASE ( "DiracMatrix_update_row"  ,
""  [wavefunction][fermion] 
)

Definition at line 315 of file test_DiracMatrix.cpp.

References DelayedUpdate< T, T_FP >::acceptRow(), CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), Matrix< T, Alloc >::cols(), Matrix< T, Alloc >::data(), Vector< T, Alloc >::data(), qmcplusplus::simd::dot(), DelayedUpdate< T, T_FP >::getInvRow(), DiracMatrix< T_FP >::invert_transpose(), DelayedUpdate< T, T_FP >::resize(), Matrix< T, Alloc >::resize(), Matrix< T, Alloc >::rows(), Vector< T, Alloc >::size(), and qmcplusplus::simd::transpose().

316 {
317  DiracMatrix<ValueType> dm;
318  DelayedUpdate<ValueType, QMCTraits::QTFull::ValueType> updateEng;
319  updateEng.resize(3, 1);
320 
321  Matrix<ValueType> a, a_T, a_inv;
322  LogValue log_value;
323  a.resize(3, 3);
324  a_T.resize(3, 3);
325  a_inv.resize(3, 3);
326 
327  a(0, 0) = 2.3;
328  a(0, 1) = 4.5;
329  a(0, 2) = 2.6;
330  a(1, 0) = 0.5;
331  a(1, 1) = 8.5;
332  a(1, 2) = 3.3;
333  a(2, 0) = 1.8;
334  a(2, 1) = 4.4;
335  a(2, 2) = 4.9;
336 
337  simd::transpose(a.data(), a.rows(), a.cols(), a_T.data(), a_T.rows(), a_T.cols());
338  dm.invert_transpose(a_T, a_inv, log_value);
339 
340  // new row
341  Vector<ValueType> v(3), invRow(3);
342  v[0] = 1.9;
343  v[1] = 2.0;
344  v[2] = 3.1;
345 
346  updateEng.getInvRow(a_inv, 0, invRow);
347  ValueType det_ratio1 = simd::dot(v.data(), invRow.data(), invRow.size());
348 
349  ValueType det_ratio = 0.178276269185;
350  CHECK(det_ratio1 == ValueApprox(det_ratio));
351  updateEng.acceptRow(a_inv, 0, v, det_ratio1);
352 
353  Matrix<ValueType> b;
354  b.resize(3, 3);
355 
356  b(0, 0) = 3.455170657;
357  b(0, 1) = -1.35124809;
358  b(0, 2) = -0.9233316353;
359  b(1, 0) = 0.05476311768;
360  b(1, 1) = 0.1591951095;
361  b(1, 2) = -0.1362710138;
362  b(2, 0) = -2.235099338;
363  b(2, 1) = 0.7119205298;
364  b(2, 2) = 0.9105960265;
365 
366  auto check_matrix_result = checkMatrix(a_inv, b);
367  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
368 }
T dot(T *a, T *b)
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
AntiSymTensor< T, D > transpose(const AntiSymTensor< T, D > &rhs)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType
std::complex< double > LogValue

◆ TEST_CASE() [470/537]

qmcplusplus::TEST_CASE ( "RotatedSPOs constructAntiSymmetricMatrix"  ,
""  [wavefunction] 
)

Definition at line 317 of file test_RotatedSPOs.cpp.

References CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), RotatedSPOs::constructAntiSymmetricMatrix(), RotatedSPOs::createRotationIndices(), and RotatedSPOs::extractParamsFromAntiSymmetricMatrix().

318 {
320  using ValueMatrix = SPOSet::ValueMatrix;
321 
322  RotatedSPOs::RotationIndices rot_ind;
323  int nel = 1;
324  int nmo = 3;
325  RotatedSPOs::createRotationIndices(nel, nmo, rot_ind);
326 
327  ValueMatrix m3(nmo, nmo);
328  m3 = ValueType(0);
329  std::vector<ValueType> params = {0.1, 0.2};
330 
331  RotatedSPOs::constructAntiSymmetricMatrix(rot_ind, params, m3);
332 
333  // clang-format off
334  std::vector<ValueType> expected_data = { 0.0, -0.1, -0.2,
335  0.1, 0.0, 0.0,
336  0.2, 0.0, 0.0 };
337  // clang-format on
338 
339  ValueMatrix expected_m3(expected_data.data(), 3, 3);
340 
341  CheckMatrixResult check_matrix_result = checkMatrix(m3, expected_m3, true);
342  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
343 
344  std::vector<ValueType> params_out(2);
345  RotatedSPOs::extractParamsFromAntiSymmetricMatrix(rot_ind, m3, params_out);
346  //Using ComplexApprox handles real or complex builds. In any case, no imaginary component expected.
347  CHECK(std::real(params_out[0]) == Approx(0.1));
348  CHECK(std::real(params_out[1]) == Approx(0.2));
349 }
QMCTraits::RealType real
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [471/537]

qmcplusplus::TEST_CASE ( "Ion-ion Force"  ,
""  [hamiltonian] 
)

Definition at line 325 of file test_force.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), ParticleSet::create(), ForceBase::getForces(), ParticleSet::getSpeciesSet(), ParticleSet::R, ParticleSet::resetGroups(), and ParticleSet::setName().

326 {
327  const SimulationCell simulation_cell;
328  ParticleSet ions(simulation_cell);
329  ParticleSet elec(simulation_cell);
330 
331  ions.setName("ions");
332  ions.create({3});
333  ions.R[0] = {0.0, 0.0, 0.0};
334  ions.R[1] = {2.0, 0.0, 0.0};
335  ions.R[2] = {1.0, 1.0, 0.0};
336  elec.setName("elec");
337  elec.create({3});
338  elec.R[0] = {0.0, 1.0, 0.0};
339  elec.R[1] = {2.0, 1.0, 0.0};
340  elec.R[2] = {1.0, 0.0, 0.0};
341  SpeciesSet& ionSpecies = ions.getSpeciesSet();
342  int HIdx = ionSpecies.addSpecies("H");
343  int HChargeIdx = ionSpecies.addAttribute("charge");
344  ionSpecies(HChargeIdx, HIdx) = 1;
345  ions.resetGroups();
346 
347  SpeciesSet& elecSpecies = elec.getSpeciesSet();
348  int upIdx = elecSpecies.addSpecies("u");
349  int massIdx = elecSpecies.addAttribute("mass");
350  int eChargeIdx = elecSpecies.addAttribute("charge");
351  elecSpecies(eChargeIdx, upIdx) = -1.0;
352  elecSpecies(massIdx, upIdx) = 1.0;
353  elec.resetGroups();
354 
355  CoulombPotential<OperatorBase::Return_t> ionForce(ions, false, true);
356  CoulombPotential<OperatorBase::Return_t> elecIonForce(elec, ions, true); // Should be zero
357  CoulombPotential<OperatorBase::Return_t> elecForce(elec, true, true); // Should be zero
358 
359  double coeff0[3] = {-0.60355339059, -0.35355339059, 0.0};
360  double coeff1[3] = {0.60355339059, -0.35355339059, 0.0};
361  double coeff2[3] = {0.00000000000, 0.70710678119, 0.0};
362  for (int i = 0; i < 3; i++)
363  {
364  CHECK(ionForce.getForces()[0][i] == Approx(coeff0[i]));
365  CHECK(ionForce.getForces()[1][i] == Approx(coeff1[i]));
366  CHECK(ionForce.getForces()[2][i] == Approx(coeff2[i]));
367  CHECK(elecIonForce.getForces()[0][i] == Approx(0.0));
368  CHECK(elecIonForce.getForces()[1][i] == Approx(0.0));
369  CHECK(elecIonForce.getForces()[2][i] == Approx(0.0));
370  CHECK(elecForce.getForces()[0][i] == Approx(0.0));
371  CHECK(elecForce.getForces()[1][i] == Approx(0.0));
372  CHECK(elecForce.getForces()[2][i] == Approx(0.0));
373  }
374 }
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [472/537]

qmcplusplus::TEST_CASE ( "OmpBLAS ger"  ,
""  [SYCL] 
)

Definition at line 332 of file test_syclBLAS.cpp.

References qmcplusplus::Units::force::N.

333 {
334  const int M = 137;
335  const int N = 79;
336  const int batch_count = 23;
337 
338  // Batched Test
339  std::cout << "Testing ger_batched" << std::endl;
340  test_ger_batched<float>(M, N, batch_count);
341  test_ger_batched<double>(M, N, batch_count);
342 #if defined(QMC_COMPLEX)
343  test_ger_batched<std::complex<float>>(N, M, batch_count);
344  test_ger_batched<std::complex<double>>(N, M, batch_count);
345 #endif
346 }

◆ TEST_CASE() [473/537]

qmcplusplus::TEST_CASE ( "Eloc_Derivatives:slater_wj"  ,
""  [hamiltonian] 
)

Definition at line 332 of file test_ion_derivs.cpp.

References app_log(), WaveFunctionFactory::buildTWF(), CHECK(), OHMMS::Controller, convertToReal(), create_CN_Hamiltonian(), create_CN_particlesets(), dot(), qmcplusplus::Units::charge::e, TrialWaveFunction::evalGradSource(), QMCHamiltonian::evaluateDeterministic(), QMCHamiltonian::evaluateIonDerivs(), QMCHamiltonian::evaluateIonDerivsDeterministic(), TrialWaveFunction::evaluateLog(), QMCHamiltonian::getHamiltonian(), QMCHamiltonian::getObservable(), QMCHamiltonian::getObservableName(), Libxml2Document::getRoot(), ham, Libxml2Document::parse(), REQUIRE(), Vector< T, Alloc >::resize(), QMCHamiltonian::setRandomGenerator(), and QMCHamiltonian::sizeOfObservables().

332  :slater_wj", "[hamiltonian]")
333 {
334  app_log() << "====Ion Derivative Test: Single Slater+Jastrow====\n";
335  using RealType = QMCTraits::RealType;
336 
337  Communicate* c = OHMMS::Controller;
338 
339  const SimulationCell simulation_cell;
340  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
341  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
342  auto &ions(*ions_ptr), elec(*elec_ptr);
343 
344  create_CN_particlesets(elec, ions);
345 
346  int Nions = ions.getTotalNum();
347  int Nelec = elec.getTotalNum();
348 
349  HamiltonianFactory::PSetMap particle_set_map;
350  particle_set_map.emplace("e", std::move(elec_ptr));
351  particle_set_map.emplace("ion0", std::move(ions_ptr));
352 
353  WaveFunctionFactory wff(elec, particle_set_map, c);
354 
355  Libxml2Document wfdoc;
356  bool wfokay = wfdoc.parse("cn.wfj.xml");
357  REQUIRE(wfokay);
358 
359  RuntimeOptions runtime_options;
360  xmlNodePtr wfroot = wfdoc.getRoot();
361  HamiltonianFactory::PsiPoolType psi_map;
362  psi_map.emplace("psi0", wff.buildTWF(wfroot, runtime_options));
363 
364  TrialWaveFunction* psi = psi_map["psi0"].get();
365  REQUIRE(psi != nullptr);
366 
367  HamiltonianFactory hf("h0", elec, particle_set_map, psi_map, c);
368 
369  //Output of WFTester Eloc test for this ion/electron configuration.
370  // Logpsi: (-8.945509461103977600e+00,0.000000000000000000e+00)
371  // HamTest Total -1.779268125690864721e+01
372  // HamTest Kinetic 7.673240415372170276e+00
373  // HamTest ElecElec 1.901556057075800865e+01
374  // HamTest IonIon 9.621404531608845900e+00
375  // HamTest LocalECP -6.783942829945100073e+01
376  // HamTest NonLocalECP 1.373654152480333224e+01
377 
378  RealType logpsi = psi->evaluateLog(elec);
379  CHECK(logpsi == Approx(-8.9455094611e+00));
380 
381  QMCHamiltonian& ham = create_CN_Hamiltonian(hf);
382 
383  RealType eloc = ham.evaluateDeterministic(elec);
384  enum observ_id
385  {
386  KINETIC = 0,
387  LOCALECP,
388  NONLOCALECP,
389  ELECELEC,
390  IONION
391  };
392  CHECK(eloc == Approx(-1.77926812569e+01));
393  CHECK(ham.getObservable(ELECELEC) == Approx(1.9015560571e+01));
394  CHECK(ham.getObservable(IONION) == Approx(9.6214045316e+00));
395  CHECK(ham.getObservable(LOCALECP) == Approx(-6.7839428299e+01));
396  CHECK(ham.getObservable(KINETIC) == Approx(7.6732404154e+00));
397  CHECK(ham.getObservable(NONLOCALECP) == Approx(1.37365415248e+01));
398 
399  for (int i = 0; i < ham.sizeOfObservables(); i++)
400  app_log() << " HamTest " << ham.getObservableName(i) << " " << ham.getObservable(i) << std::endl;
401 
402  //Now for the derivative tests
403  ParticleSet::ParticleGradient wfgradraw;
404  ParticleSet::ParticlePos hf_term;
405  ParticleSet::ParticlePos pulay_term;
406  ParticleSet::ParticlePos wf_grad;
407 
408  wfgradraw.resize(Nions);
409  wf_grad.resize(Nions);
410  hf_term.resize(Nions);
411  pulay_term.resize(Nions);
412 
413  wfgradraw[0] = psi->evalGradSource(elec, ions, 0); //On the C atom.
414  wfgradraw[1] = psi->evalGradSource(elec, ions, 1); //On the N atom.
415 
416  convertToReal(wfgradraw[0], wf_grad[0]);
417  convertToReal(wfgradraw[1], wf_grad[1]);
418 
419  //Reference from finite differences on this configuration.
420  CHECK(wf_grad[0][0] == Approx(-1.8996878390353797));
421  CHECK(wf_grad[0][1] == Approx(2.3247646590007776));
422  CHECK(wf_grad[0][2] == Approx(7.9587196049502031));
423  CHECK(wf_grad[1][0] == Approx(1.8093817104158914));
424  CHECK(wf_grad[1][1] == Approx(-0.0966225639942308));
425  CHECK(wf_grad[1][2] == Approx(-1.5197874544625731));
426 
427  //Kinetic Force
428  hf_term = 0.0;
429  pulay_term = 0.0;
430  (ham.getHamiltonian(KINETIC))->evaluateWithIonDerivsDeterministic(elec, ions, *psi, hf_term, pulay_term);
431 #if defined(MIXED_PRECISION)
432  CHECK(hf_term[0][0] + pulay_term[0][0] == Approx(-3.3359153349010735).epsilon(1e-4));
433  CHECK(hf_term[0][1] + pulay_term[0][1] == Approx(30.0487085581835309).epsilon(1e-4));
434  CHECK(hf_term[0][2] + pulay_term[0][2] == Approx(126.5885230360197369).epsilon(1e-4));
435  CHECK(hf_term[1][0] + pulay_term[1][0] == Approx(2.7271604366774223).epsilon(1e-4));
436  CHECK(hf_term[1][1] + pulay_term[1][1] == Approx(-3.5321234918228579).epsilon(1e-4));
437  CHECK(hf_term[1][2] + pulay_term[1][2] == Approx(5.8844148870917925).epsilon(1e-4));
438 #else
439  CHECK(hf_term[0][0] + pulay_term[0][0] == Approx(-3.3359153349010735));
440  CHECK(hf_term[0][1] + pulay_term[0][1] == Approx(30.0487085581835309));
441  CHECK(hf_term[0][2] + pulay_term[0][2] == Approx(126.5885230360197369));
442  CHECK(hf_term[1][0] + pulay_term[1][0] == Approx(2.7271604366774223));
443  CHECK(hf_term[1][1] + pulay_term[1][1] == Approx(-3.5321234918228579));
444  CHECK(hf_term[1][2] + pulay_term[1][2] == Approx(5.8844148870917925));
445 #endif
446  //NLPP Force
447  hf_term = 0.0;
448  pulay_term = 0.0;
449  double val =
450  (ham.getHamiltonian(NONLOCALECP))->evaluateWithIonDerivsDeterministic(elec, ions, *psi, hf_term, pulay_term);
451 //MP fails the first REQUIRE with 27.15313. Just bypass the checks in those builds.
452 #if defined(MIXED_PRECISION)
453  CHECK(hf_term[0][0] + pulay_term[0][0] == Approx(27.1517161490208956).epsilon(2e-4));
454  CHECK(hf_term[0][1] + pulay_term[0][1] == Approx(-42.8268964286715459).epsilon(2e-4));
455  CHECK(hf_term[0][2] + pulay_term[0][2] == Approx(-101.5046844660360961).epsilon(2e-4));
456  CHECK(hf_term[1][0] + pulay_term[1][0] == Approx(2.2255825024686260).epsilon(2e-4));
457  CHECK(hf_term[1][1] + pulay_term[1][1] == Approx(1.1362118534918864).epsilon(2e-4));
458  CHECK(hf_term[1][2] + pulay_term[1][2] == Approx(-4.5825638607333019).epsilon(2e-4));
459 #else
460  CHECK(hf_term[0][0] + pulay_term[0][0] == Approx(27.1517161490208956));
461  CHECK(hf_term[0][1] + pulay_term[0][1] == Approx(-42.8268964286715459));
462  CHECK(hf_term[0][2] + pulay_term[0][2] == Approx(-101.5046844660360961));
463  CHECK(hf_term[1][0] + pulay_term[1][0] == Approx(2.2255825024686260));
464  CHECK(hf_term[1][1] + pulay_term[1][1] == Approx(1.1362118534918864));
465  CHECK(hf_term[1][2] + pulay_term[1][2] == Approx(-4.5825638607333019));
466 #endif
467 
468  //End of deterministic tests. Let's call evaluateIonDerivs and evaluateIonDerivsDeterministic at the
469  //QMCHamiltonian level to make sure there are no crashes.
470 
471  hf_term = 0.0;
472  pulay_term = 0.0;
473  wf_grad = 0.0;
474  ham.evaluateIonDerivsDeterministic(elec, ions, *psi, hf_term, pulay_term, wf_grad);
475 
476  CHECK(dot(hf_term[0], hf_term[0]) != Approx(0));
477  CHECK(dot(pulay_term[0], pulay_term[0]) != Approx(0));
478  CHECK(dot(wf_grad[0], wf_grad[0]) != Approx(0));
479 
480  CHECK(dot(hf_term[1], hf_term[1]) != Approx(0));
481  CHECK(dot(pulay_term[1], pulay_term[1]) != Approx(0));
482  CHECK(dot(wf_grad[1], wf_grad[1]) != Approx(0));
483 
484  hf_term = 0.0;
485  pulay_term = 0.0;
486  wf_grad = 0.0;
487  RandomGenerator myrng;
488  ham.setRandomGenerator(&myrng);
489  ham.evaluateIonDerivs(elec, ions, *psi, hf_term, pulay_term, wf_grad);
490 
491  CHECK(dot(hf_term[0], hf_term[0]) != Approx(0));
492  CHECK(dot(pulay_term[0], pulay_term[0]) != Approx(0));
493  CHECK(dot(wf_grad[0], wf_grad[0]) != Approx(0));
494 
495  CHECK(dot(hf_term[1], hf_term[1]) != Approx(0));
496  CHECK(dot(pulay_term[1], pulay_term[1]) != Approx(0));
497  CHECK(dot(wf_grad[1], wf_grad[1]) != Approx(0));
498 }

◆ TEST_CASE() [474/537]

qmcplusplus::TEST_CASE ( "LiH multi Slater dets table_method"  ,
""  [wavefunction] 
)

Definition at line 340 of file test_multi_slater_determinant.cpp.

References app_log(), and test_LiH_msd().

341 {
342  app_log() << "-----------------------------------------------------------------" << std::endl;
343  app_log() << "LiH_msd using the table method no precomputation" << std::endl;
344  app_log() << "-----------------------------------------------------------------" << std::endl;
345  const char* spo_xml_string1 = R"(<wavefunction name="psi0" target="e">
346  <sposet_collection type="MolecularOrbital" name="LCAOBSet" source="ion0" cuspCorrection="no" href="LiH.orbs.h5">
347  <basisset name="LCAOBSet" key="GTO" transform="yes">
348  <grid type="log" ri="1.e-6" rf="1.e2" npts="1001"/>
349  </basisset>
350  <sposet basisset="LCAOBSet" name="spo-up" size="85">
351  <occupation mode="ground"/>
352  <coefficient size="85" spindataset="0"/>
353  </sposet>
354  <sposet basisset="LCAOBSet" name="spo-dn" size="85">
355  <occupation mode="ground"/>
356  <coefficient size="85" spindataset="0"/>
357  </sposet>
358  </sposet_collection>
359  <determinantset>
360  <multideterminant optimize="yes" spo_up="spo-up" spo_dn="spo-dn" algorithm="table_method">
361  <detlist size="1487" type="DETS" cutoff="1e-20" href="LiH.orbs.h5"/>
362  </multideterminant>
363  </determinantset>
364 </wavefunction>
365 )";
366  test_LiH_msd(spo_xml_string1, "spo-up", 85, 105, true, true);
367 }
std::ostream & app_log()
Definition: OutputManager.h:65
void test_LiH_msd(const std::string &spo_xml_string, const std::string &check_sponame, int check_spo_size, int check_basisset_size, int test_nlpp_algorithm_batched, int test_batched_api)

◆ TEST_CASE() [475/537]

qmcplusplus::TEST_CASE ( "ReferencePoints::HDF5"  ,
""  [estimators] 
)

Definition at line 343 of file test_ReferencePoints.cpp.

References approxEquality(), CHECK(), hdf_archive::close(), hdf_archive::create(), expectedReferencePoints(), makePsets(), makeTestRPI(), okay, hdf_archive::open(), hdf_archive::push(), hdf_archive::readEntry(), REQUIRE(), and NEReferencePoints::write().

344 {
345  auto rpi = makeTestRPI();
346  auto ppr = makePsets();
347  NEReferencePoints ref_points(rpi, ppr.pset, ppr.ref_psets);
348 
349  hdf_archive hd;
350  std::string test_file{"reference_points_test.hdf"};
351  bool okay = hd.create(test_file);
352  REQUIRE(okay);
353 
354  ref_points.write(hd);
355 
356  hd.close();
357 
358  hdf_archive hd_read;
359  bool okay_read = hd.open(test_file);
360 
361  hd.push("reference_points");
362 
363  typename NEReferencePoints::Points expected_reference_points;
364  expected_reference_points = expectedReferencePoints();
365 
366  for (auto& map_entry : expected_reference_points)
367  {
368  std::string key{map_entry.first};
369  NEReferencePoints::Point point;
370  hd.readEntry(point, key);
371  CHECK(approxEquality(point, map_entry.second));
372  }
373  hd.close();
374 }
PSetsAndRefList makePsets()
REQUIRE(std::filesystem::exists(filename))
ReferencePointsInput makeTestRPI()
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool approxEquality(const TinyVector< T1, D > &val_a, const TinyVector< T2, D > &val_b)

◆ TEST_CASE() [476/537]

qmcplusplus::TEST_CASE ( "ompBLAS gemv"  ,
""  [OMP] 
)

Definition at line 344 of file test_ompBLAS.cpp.

References qmcplusplus::Units::force::N.

345 {
346  const int M = 137;
347  const int N = 79;
348  const int batch_count = 23;
349 
350  // Non-batched test
351  std::cout << "Testing TRANS gemv" << std::endl;
352  test_gemv<float>(M, N, 'T');
353  test_gemv<double>(M, N, 'T');
354 #if defined(QMC_COMPLEX)
355  test_gemv<std::complex<float>>(N, M, 'T');
356  test_gemv<std::complex<double>>(N, M, 'T');
357 #endif
358  // Batched Test
359  std::cout << "Testing TRANS gemv_batched" << std::endl;
360  test_gemv_batched<float>(M, N, 'T', batch_count);
361  test_gemv_batched<double>(M, N, 'T', batch_count);
362 #if defined(QMC_COMPLEX)
363  test_gemv_batched<std::complex<float>>(N, M, 'T', batch_count);
364  test_gemv_batched<std::complex<double>>(N, M, 'T', batch_count);
365 #endif
366 }

◆ TEST_CASE() [477/537]

qmcplusplus::TEST_CASE ( "BareKineticEnergyListener"  ,
""  [hamiltonian] 
)

Definition at line 351 of file test_bare_kinetic.cpp.

References getTestCaseForWeights(), outputManager, OutputManagerClass::pause(), OutputManagerClass::resume(), and testElecCase().

352 {
354  testElecCase(1.0, 1.0, getTestCaseForWeights(-0.5, -1.5, -0.5));
355  testElecCase(0.5, 1.0, getTestCaseForWeights(-1.0, -2.5, -1.0));
357 }
void pause()
Pause the summary and log streams.
OutputManagerClass outputManager(Verbosity::HIGH)
void resume()
Resume the summary and log streams.
auto getTestCaseForWeights(Real value1, Real value2, Real value3)
just set the values to test the electron weights
void testElecCase(double mass_up, double mass_dn, std::function< void(RefVectorWithLeader< OperatorBase > &o_list, RefVectorWithLeader< TrialWaveFunction > &twf_list, RefVectorWithLeader< ParticleSet > &p_list, Matrix< Real > &kinetic_energies, std::vector< ListenerVector< Real >> &listeners, std::vector< ListenerVector< Real >> &ion_listeners)> tests)
Provide a test scope parameterized on electron species mass that then can run a set of tests using it...

◆ TEST_CASE() [478/537]

qmcplusplus::TEST_CASE ( "RotatedSPOs exponentiate matrix"  ,
""  [wavefunction] 
)

Definition at line 352 of file test_RotatedSPOs.cpp.

References CHECK(), CHECKED_ELSE(), checkMatrix(), RotatedSPOs::exponentiate_antisym_matrix(), CheckMatrixResult::result, and CheckMatrixResult::result_message.

353 {
355  using RealType = SPOSet::RealType;
356  using ValueMatrix = SPOSet::ValueMatrix;
357 
358  std::vector<SPOSet::ValueType> mat1_data = {0.0};
359  SPOSet::ValueMatrix m1(mat1_data.data(), 1, 1);
360  RotatedSPOs::exponentiate_antisym_matrix(m1);
361  // Always return 1.0 (the only possible anti-symmetric 1x1 matrix is 0)
362  CHECK(m1(0, 0) == ValueApprox(1.0));
363 
364  // clang-format off
365  std::vector<SPOSet::ValueType> mat2_data = { 0.0, -0.1,
366  0.1, 0.0 };
367  // clang-format on
368 
369  SPOSet::ValueMatrix m2(mat2_data.data(), 2, 2);
370  RotatedSPOs::exponentiate_antisym_matrix(m2);
371 
372  // clang-format off
373  std::vector<ValueType> expected_rot2 = { 0.995004165278026, -0.0998334166468282,
374  0.0998334166468282, 0.995004165278026 };
375  // clang-format on
376 
377  ValueMatrix expected_m2(expected_rot2.data(), 2, 2);
378  CheckMatrixResult check_matrix_result2 = checkMatrix(m2, expected_m2, true);
379  CHECKED_ELSE(check_matrix_result2.result) { FAIL(check_matrix_result2.result_message); }
380 
381 
382  // clang-format off
383  std::vector<ValueType> m3_input_data = { 0.0, -0.3, -0.1,
384  0.3, 0.0, -0.2,
385  0.1, 0.2, 0.0 };
386 
387 
388  std::vector<ValueType> expected_rot3 = { 0.950580617906092, -0.302932713402637, -0.0680313164049401,
389  0.283164960565074, 0.935754803277919, -0.210191705950743,
390  0.127334574917630, 0.180540076694398, 0.975290308953046 };
391 
392  // clang-format on
393 
394  ValueMatrix m3(m3_input_data.data(), 3, 3);
395  ValueMatrix expected_m3(expected_rot3.data(), 3, 3);
396 
397  RotatedSPOs::exponentiate_antisym_matrix(m3);
398 
399  CheckMatrixResult check_matrix_result3 = checkMatrix(m3, expected_m3, true);
400  CHECKED_ELSE(check_matrix_result3.result) { FAIL(check_matrix_result3.result_message); }
401 #ifdef QMC_COMPLEX
402  //Going to test exponentiating a complex antihermitian matrix.
403  using cmplx_t = std::complex<RealType>;
404  std::vector<cmplx_t> m3_input_data_cplx = {cmplx_t(0, 0), cmplx_t(0.3, 0.1), cmplx_t(0.1, -0.3),
405  cmplx_t(-0.3, 0.1), cmplx_t(0, 0), cmplx_t(0.2, 0.01),
406  cmplx_t(-0.1, -0.3), cmplx_t(-0.2, 0.01), cmplx_t(0, 0)};
407 
408  std::vector<cmplx_t> expected_rot_cmplx = {cmplx_t(0.90198269, -0.00652118), cmplx_t(0.27999104, 0.12545423),
409  cmplx_t(0.12447606, -0.27704993), cmplx_t(-0.29632557, 0.06664911),
410  cmplx_t(0.93133822, -0.00654092), cmplx_t(0.19214149, 0.05828413),
411  cmplx_t(-0.06763124, -0.29926537), cmplx_t(-0.19210869, -0.03907491),
412  cmplx_t(0.93133822, -0.00654092)};
413 
414  Matrix<std::complex<RealType>> m3_cmplx(m3_input_data_cplx.data(), 3, 3);
415  Matrix<std::complex<RealType>> m3_cmplx_expected(expected_rot_cmplx.data(), 3, 3);
416 
417  RotatedSPOs::exponentiate_antisym_matrix(m3_cmplx);
418 
419  CheckMatrixResult check_matrix_result4 = checkMatrix(m3_cmplx, m3_cmplx_expected, true);
420  CHECKED_ELSE(check_matrix_result4.result) { FAIL(check_matrix_result4.result_message); }
421 #endif
422 }
CHECKED_ELSE(check_matrix_result.result)
QMCTraits::RealType RealType
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [479/537]

qmcplusplus::TEST_CASE ( "Rotated LCAO WF2 with jastrow"  ,
""  [qmcapp] 
)

Definition at line 355 of file test_RotatedSPOs_LCAO.cpp.

References ProjectData::BATCH, CHECK(), TrialWaveFunction::checkInVariables(), TrialWaveFunction::checkOutVariables(), OHMMS::Controller, doc, TrialWaveFunction::evaluateDerivatives(), TrialWaveFunction::evaluateLog(), ParticleSet::G, TrialWaveFunction::getOrbitals(), ParticleSetPool::getParticleSet(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), ParticleSet::L, okay, Libxml2Document::parseFromString(), REQUIRE(), TrialWaveFunction::resetParameters(), setupParticleSetPool(), test_project, and ParticleSet::update().

356 {
357  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
358  Communicate* c;
359  c = OHMMS::Controller;
360 
361  ParticleSetPool pp(c);
363 
364  WaveFunctionPool wp(test_project.getRuntimeOptions(), pp, c);
365 
366  REQUIRE(wp.empty() == true);
367 
368 
369  const char* wf_input = R"(<wavefunction target='e'>
370 
371  <sposet_collection type="MolecularOrbital">
372  <!-- Use a single Slater Type Orbital (STO) for the basis. Cusp condition is correct. -->
373  <basisset keyword="STO" transform="no">
374  <atomicBasisSet type="STO" elementType="He" normalized="no">
375  <basisGroup rid="R0" l="0" m="0" type="Slater">
376  <radfunc n="1" exponent="2.0"/>
377  </basisGroup>
378  <basisGroup rid="R1" l="0" m="0" type="Slater">
379  <radfunc n="2" exponent="1.0"/>
380  </basisGroup>
381  </atomicBasisSet>
382  </basisset>
383  <rotated_sposet name="rot-spo-up">
384  <sposet basisset="LCAOBSet" name="spo-up" method="history">
385  <coefficient id="updetC" type="Array" size="2">
386  1.0 0.0
387  0.0 1.0
388  </coefficient>
389  </sposet>
390  </rotated_sposet>
391  <rotated_sposet name="rot-spo-down">
392  <sposet basisset="LCAOBSet" name="spo-down" method="history">
393  <coefficient id="updetC" type="Array" size="2">
394  1.0 0.0
395  0.0 1.0
396  </coefficient>
397  </sposet>
398  </rotated_sposet>
399  </sposet_collection>
400  <determinantset type="MO" key="STO" transform="no" source="ion0">
401  <slaterdeterminant>
402  <determinant sposet="rot-spo-up"/>
403  <determinant sposet="rot-spo-down"/>
404  </slaterdeterminant>
405  </determinantset>
406  <jastrow name="Jee" type="Two-Body" function="pade">
407  <correlation speciesA="u" speciesB="d">
408  <var id="jud_b" name="B">0.1</var>
409  </correlation>
410  </jastrow>
411  </wavefunction>)";
412 
414  bool okay = doc.parseFromString(wf_input);
415  REQUIRE(okay);
416 
417  xmlNodePtr root = doc.getRoot();
418 
419  wp.put(root);
420 
421  TrialWaveFunction* psi = wp.getWaveFunction("psi0");
422  REQUIRE(psi != nullptr);
423  REQUIRE(psi->getOrbitals().size() == 2);
424 
425  opt_variables_type opt_vars;
426  psi->checkInVariables(opt_vars);
427  opt_vars.resetIndex();
428  psi->checkOutVariables(opt_vars);
429  psi->resetParameters(opt_vars);
430 
431  ParticleSet* elec = pp.getParticleSet("e");
432  elec->update();
433 
434 
435  double logval = psi->evaluateLog(*elec);
436  CHECK(logval == Approx(-15.791249652199634));
437 
438  CHECK(elec->G[0][0] == ValueApprox(-0.2956989647881321));
439  CHECK(elec->L[0] == ValueApprox(-0.6560429678274734));
440  CHECK(elec->L[1] == ValueApprox(-1.2132292565412577));
441 
443  Vector<ValueType> dlogpsi(3);
444  Vector<ValueType> dhpsioverpsi(3);
445  psi->evaluateDerivatives(*elec, opt_vars, dlogpsi, dhpsioverpsi);
446 
447  CHECK(dlogpsi[0] == ValueApprox(32.206205017987166));
448  CHECK(dlogpsi[1] == ValueApprox(5.874829251874641));
449  CHECK(dlogpsi[2] == ValueApprox(49.08414605622605));
450  CHECK(dhpsioverpsi[0] == ValueApprox(32.462519534916666));
451  CHECK(dhpsioverpsi[1] == ValueApprox(10.047601212881027));
452  CHECK(dhpsioverpsi[2] == ValueApprox(2.0820644399551895));
453 
454  // Check for out-of-bounds array access when a variable is disabled.
455  // When a variable is disabled, myVars.where() returns -1.
456  opt_vars.insert("rot-spo-up_orb_rot_0000_0001", 0.0, false);
457  psi->checkOutVariables(opt_vars);
458  psi->evaluateDerivatives(*elec, opt_vars, dlogpsi, dhpsioverpsi);
459 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
void resetIndex()
reset Index
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
void setupParticleSetPool(ParticleSetPool &pp)
optimize::VariableSet opt_variables_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [480/537]

qmcplusplus::TEST_CASE ( "SpaceGrid::BadPeriodic"  ,
""  [estimators] 
)

Definition at line 365 of file test_NESpaceGrid.cpp.

References ParticleSet::addTable(), CHECK(), comm, OHMMS::Controller, ParticleSet::getDistTableAB(), ParticleSet::getTotalNum(), OHMMS_DIM, SpaceGridEnv< VALID >::pset_elec_, SpaceGridEnv< VALID >::pset_ions_, ParticleSet::R, SpaceGridEnv< VALID >::ref_points_, Matrix< T, Alloc >::resize(), SpaceGridEnv< VALID >::sgi_, and ParticleSet::update().

366 {
367  using Input = testing::ValidSpaceGridInput;
368  Communicate* comm;
370  testing::SpaceGridEnv<Input::valid::ORIGIN> sge(comm);
371  int num_values = 3;
372  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), num_values, false);
373 
374  using NES = testing::NESpaceGridTests<double>;
375  auto buffer_start = NES::getBufferStart(space_grid);
376  auto buffer_end = NES::getBufferEnd(space_grid);
377  space_grid.write_description(std::cout, std::string(""));
378  auto& sgi = *(sge.sgi_);
379  auto& agr = sgi.get_axis_grids();
380  for (int id = 0; id < OHMMS_DIM; ++id)
381  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
382  // CHECK(buffer_start == Approx(0));
383  // CHECK(buffer_end == Approx(23999));
384 
385  Matrix<Real> values;
386  values.resize(sge.pset_elec_.getTotalNum(), num_values);
387 
388  for (int ip = 0; ip < sge.pset_elec_.getTotalNum(); ++ip)
389  for (int iv = 0; iv < num_values; ++iv)
390  values(ip, iv) = ip + 0.1 * iv;
391 
392  const int ei_tid = sge.pset_elec_.addTable(sge.pset_ions_);
393  sge.pset_elec_.update();
394  sge.pset_ions_.update();
395 
396  // set a position outside of the cell
397  sge.pset_elec_.R[2] = {1.451870349, 4.381521229, 1.165202269};
398 
399  std::vector<bool> p_outside(8, false);
400 
401  CHECK_THROWS_AS(space_grid.accumulate(sge.pset_elec_.R, values, p_outside, sge.pset_elec_.getDistTableAB(ei_tid)),
402  std::runtime_error);
403 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
#define OHMMS_DIM
Definition: config.h:64
Wrapping information on parallelism.
Definition: Communicate.h:68
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [481/537]

qmcplusplus::TEST_CASE ( "InputSection::get"  ,
""  [estimators] 
)

Definition at line 366 of file test_InputSection.cpp.

References InputSection::get(), and InputSection::init().

367 {
368  TestInputSection ti;
369  ti.init({{"name", std::string("alice")},
370  {"samples", int(10)},
371  {"kmax", Real(3.0)},
372  {"full", bool(false)},
373  {"label", std::string("relative")},
374  {"count", int(15)},
375  {"width", Real(2.5)},
376  {"rational", bool(true)},
377  {"sposets", std::vector<std::string>{"spo1", "spo2"}},
378  {"center", InputSection::Position(0.0, 0.0, 0.1)}});
379 
380  // invalid type access results in thrown exception
381  CHECK_THROWS_AS(ti.get<int>("name"), UniformCommunicateError);
382  CHECK_THROWS_AS(ti.get<Real>("samples"), UniformCommunicateError);
383  CHECK_THROWS_AS(ti.get<bool>("kmax"), UniformCommunicateError);
384  CHECK_THROWS_AS(ti.get<std::string>("full"), UniformCommunicateError);
385  CHECK_THROWS_AS(ti.get<Real>("label"), UniformCommunicateError);
386  CHECK_THROWS_AS(ti.get<bool>("count"), UniformCommunicateError);
387  CHECK_THROWS_AS(ti.get<std::string>("width"), UniformCommunicateError);
388  CHECK_THROWS_AS(ti.get<int>("rational"), UniformCommunicateError);
389  CHECK_THROWS_AS(ti.get<std::string>("sposets"), UniformCommunicateError);
390  CHECK_THROWS_AS(ti.get<Real>("center"), UniformCommunicateError);
391 }
ForceBase::Real Real
Definition: ForceBase.cpp:26

◆ TEST_CASE() [482/537]

qmcplusplus::TEST_CASE ( "ompBLAS gemv notrans"  ,
""  [OMP] 
)

Definition at line 368 of file test_ompBLAS.cpp.

References qmcplusplus::Units::force::N.

369 {
370  const int M = 137;
371  const int N = 79;
372  const int batch_count = 23;
373 
374  // Non-batched test
375  std::cout << "Testing NOTRANS gemv" << std::endl;
376  test_gemv<float>(M, N, 'N');
377  test_gemv<double>(M, N, 'N');
378 #if defined(QMC_COMPLEX)
379  test_gemv<std::complex<float>>(N, M, 'N');
380  test_gemv<std::complex<double>>(N, M, 'N');
381 #endif
382  // Batched Test
383  std::cout << "Testing NOTRANS gemv_batched" << std::endl;
384  test_gemv_batched<float>(M, N, 'N', batch_count);
385  test_gemv_batched<double>(M, N, 'N', batch_count);
386 #if defined(QMC_COMPLEX)
387  test_gemv_batched<std::complex<float>>(N, M, 'N', batch_count);
388  test_gemv_batched<std::complex<double>>(N, M, 'N', batch_count);
389 #endif
390 }

◆ TEST_CASE() [483/537]

qmcplusplus::TEST_CASE ( "LiH multi Slater dets precomputed_table_method"  ,
""  [wavefunction] 
)

Definition at line 369 of file test_multi_slater_determinant.cpp.

References app_log(), and test_LiH_msd().

370 {
371  app_log() << "-----------------------------------------------------------------" << std::endl;
372  app_log() << "LiH_msd using the table method with new optimization" << std::endl;
373  app_log() << "-----------------------------------------------------------------" << std::endl;
374  const char* spo_xml_string1_new = R"(<wavefunction name="psi0" target="e">
375  <sposet_collection type="MolecularOrbital" name="LCAOBSet" source="ion0" cuspCorrection="no" href="LiH.orbs.h5">
376  <basisset name="LCAOBSet" key="GTO" transform="yes">
377  <grid type="log" ri="1.e-6" rf="1.e2" npts="1001"/>
378  </basisset>
379  <sposet basisset="LCAOBSet" name="spo-up" size="85">
380  <occupation mode="ground"/>
381  <coefficient size="85" spindataset="0"/>
382  </sposet>
383  <sposet basisset="LCAOBSet" name="spo-dn" size="85">
384  <occupation mode="ground"/>
385  <coefficient size="85" spindataset="0"/>
386  </sposet>
387  </sposet_collection>
388  <determinantset>
389  <multideterminant optimize="yes" spo_up="spo-up" spo_dn="spo-dn" algorithm="precomputed_table_method">
390  <detlist size="1487" type="DETS" cutoff="1e-20" href="LiH.orbs.h5"/>
391  </multideterminant>
392  </determinantset>
393 </wavefunction>
394 )";
395  test_LiH_msd(spo_xml_string1_new, "spo-up", 85, 105, true, true);
396 }
std::ostream & app_log()
Definition: OutputManager.h:65
void test_LiH_msd(const std::string &spo_xml_string, const std::string &check_sponame, int check_spo_size, int check_basisset_size, int test_nlpp_algorithm_batched, int test_batched_api)

◆ TEST_CASE() [484/537]

qmcplusplus::TEST_CASE ( "Spline applyRotation two rotations"  ,
""  [wavefunction] 
)

Definition at line 375 of file test_spline_applyrotation.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), CHECK(), CHECKED_ELSE(), checkMatrix(), OHMMS::Controller, ParticleSet::create(), EinsplineSetBuilder::createSPOSetFromXML(), doc, qmcplusplus::Units::charge::e, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), lattice, norm(), okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), Vector< T, Alloc >::size(), and sqrt().

376 {
377  // How to get rid of all this annoying boilerplate?
379 
380  // diamondC_1x1x1
381  ParticleSet::ParticleLayout lattice;
382  lattice.R = {3.37316115, 3.37316115, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
383 
384  ParticleSetPool ptcl = ParticleSetPool(c);
385  ptcl.setSimulationCell(lattice);
386  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
387  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
388  ParticleSet& ions_(*ions_uptr);
389  ParticleSet& elec_(*elec_uptr);
390 
391  ions_.setName("ion");
392  ptcl.addParticleSet(std::move(ions_uptr));
393  ions_.create({2});
394  ions_.R[0] = {0.0, 0.0, 0.0};
395  ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
396 
397  elec_.setName("elec");
398  ptcl.addParticleSet(std::move(elec_uptr));
399  elec_.create({2});
400  elec_.R[0] = {0.0, 0.0, 0.0};
401  elec_.R[1] = {0.0, 1.0, 0.0};
402 
403  SpeciesSet& tspecies = elec_.getSpeciesSet();
404  int upIdx = tspecies.addSpecies("u");
405  int chargeIdx = tspecies.addAttribute("charge");
406  tspecies(chargeIdx, upIdx) = -1;
407 
408  // Load diamondC_1x1x1 wfn and explicitly construct a SplineC2C object with 7 orbitals
409  // This results in padding of the spline coefs table and thus is a more stringent test.
410  const char* particles = R"(<tmp>
411 <determinantset type="einspline" href="diamondC_1x1x1.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion" gpu="no" precision="double" size="7"/>
412 </tmp>)";
413 
415  bool okay = doc.parseFromString(particles);
416  REQUIRE(okay);
417  xmlNodePtr root = doc.getRoot();
418  xmlNodePtr ein1 = xmlFirstElementChild(root);
419  EinsplineSetBuilder einSet(elec_, ptcl.getPool(), c, ein1);
420  auto spo = einSet.createSPOSetFromXML(ein1);
421  REQUIRE(spo);
422 
423  const auto orbitalsetsize = spo->getOrbitalSetSize();
424  REQUIRE(orbitalsetsize == 7);
425  SPOSet::ValueMatrix psiM_bare(elec_.R.size(), orbitalsetsize);
426  SPOSet::GradMatrix dpsiM_bare(elec_.R.size(), orbitalsetsize);
427  SPOSet::ValueMatrix d2psiM_bare(elec_.R.size(), orbitalsetsize);
428  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM_bare, dpsiM_bare, d2psiM_bare);
429 
430  // Check before rotation is applied. From 'test_einset.cpp'
431  CHECK(std::real(psiM_bare[1][0]) == Approx(-0.8886948824));
432  CHECK(std::real(psiM_bare[1][1]) == Approx(1.4194120169));
433  // grad
434  CHECK(std::real(dpsiM_bare[1][0][0]) == Approx(-0.0000183403));
435  CHECK(std::real(dpsiM_bare[1][0][1]) == Approx(0.1655139178));
436  CHECK(std::real(dpsiM_bare[1][0][2]) == Approx(-0.0000193077));
437  CHECK(std::real(dpsiM_bare[1][1][0]) == Approx(-1.3131694794));
438  CHECK(std::real(dpsiM_bare[1][1][1]) == Approx(-1.1174004078));
439  CHECK(std::real(dpsiM_bare[1][1][2]) == Approx(-0.8462534547));
440  // lapl
441  CHECK(std::real(d2psiM_bare[1][0]) == Approx(1.3313053846));
442  CHECK(std::real(d2psiM_bare[1][1]) == Approx(-4.712583065));
443 
444  /* Apply a rotation, U = exp(-K) as shown below, to the splines.
445  Because K = -K.T, U is unitary.
446  K=
447  0.00000000e+00 -2.33449314e-01 5.21735139e-01 1.67744276e-01 -1.68565994e-01 1.26632312e-02 2.29272040e-01
448  2.33449314e-01 0.00000000e+00 -3.81982621e-01 -6.76995896e-01 7.15727948e-02 9.10926961e-01 -6.94864205e-01
449  -5.21735139e-01 3.81982621e-01 0.00000000e+00 2.37433139e-01 -7.09878105e-01 -6.33841289e-01 -7.49009582e-01
450  -1.67744276e-01 6.76995896e-01 -2.37433139e-01 0.00000000e+00 -6.72002172e-01 4.27152921e-01 -4.82983743e-03
451  1.68565994e-01 -7.15727948e-02 7.09878105e-01 6.72002172e-01 0.00000000e+00 -7.93860012e-01 -7.76624731e-01
452  -1.26632312e-02 -9.10926961e-01 6.33841289e-01 -4.27152921e-01 7.93860012e-01 0.00000000e+00 -2.74931052e-01
453  -2.29272040e-01 6.94864205e-01 7.49009582e-01 4.82983743e-03 7.76624731e-01 2.74931052e-01 0.00000000e+00
454  U=
455  8.06061880e-01 3.54921598e-01 -3.40706426e-01 -5.90163619e-02 1.11650454e-01 -1.99768450e-01 -2.28818375e-01
456  1.58069821e-02 2.10363421e-01 2.74922448e-01 2.12581764e-01 2.64602356e-01 -6.34971914e-01 6.01265560e-01
457  4.43696646e-01 -6.06912539e-02 2.61413193e-01 -1.98368802e-01 -6.43234645e-02 5.75880430e-01 5.96646495e-01
458  1.45865363e-01 -5.16577220e-01 -2.09866367e-01 5.55699395e-01 5.73062990e-01 1.74778224e-01 8.77170506e-03
459  -3.24609748e-01 2.89664179e-01 -7.50613752e-01 -1.63060005e-01 1.70803377e-01 1.63784167e-01 4.05850414e-01
460  1.32570771e-03 3.80299846e-01 -5.08439810e-02 7.59141791e-01 -4.77844928e-01 2.12149087e-01 5.60882349e-02
461  1.62781208e-01 -5.75073150e-01 -3.60485665e-01 -1.70070331e-02 -5.72251258e-01 -3.50549638e-01 2.49394158e-01
462  UU.T=
463  1.00000000e+00 -2.77555756e-17 5.55111512e-17 -8.67361738e-18 -1.11022302e-16 -6.07153217e-17 6.93889390e-17
464  -2.77555756e-17 1.00000000e+00 5.55111512e-17 -1.84748050e-16 5.55111512e-17 -6.93889390e-18 8.32667268e-17
465  5.55111512e-17 5.55111512e-17 1.00000000e+00 1.45716772e-16 -5.55111512e-17 1.38777878e-16 5.55111512e-17
466  -8.67361738e-18 -1.84748050e-16 1.45716772e-16 1.00000000e+00 -1.95156391e-17 1.80411242e-16 8.02309608e-17
467  -1.11022302e-16 5.55111512e-17 -5.55111512e-17 -1.95156391e-17 1.00000000e+00 7.28583860e-17 1.11022302e-16
468  -6.07153217e-17 -6.93889390e-18 1.38777878e-16 1.80411242e-16 7.28583860e-17 1.00000000e+00 -1.12757026e-16
469  6.93889390e-17 8.32667268e-17 5.55111512e-17 8.02309608e-17 1.11022302e-16 -1.12757026e-16 1.00000000e+00
470 
471  NB: There's nothing special about this rotation. I purposefully made something 'ugly' to make a worst case scenario...
472  */
473  SPOSet::ValueMatrix rot_mat1(orbitalsetsize, orbitalsetsize);
474  rot_mat1[0][0] = 8.06061880e-01;
475  rot_mat1[0][1] = 3.54921598e-01;
476  rot_mat1[0][2] = -3.40706426e-01;
477  rot_mat1[0][3] = -5.90163619e-02;
478  rot_mat1[0][4] = 1.11650454e-01;
479  rot_mat1[0][5] = -1.99768450e-01;
480  rot_mat1[0][6] = -2.28818375e-01;
481  rot_mat1[1][0] = 1.58069821e-02;
482  rot_mat1[1][1] = 2.10363421e-01;
483  rot_mat1[1][2] = 2.74922448e-01;
484  rot_mat1[1][3] = 2.12581764e-01;
485  rot_mat1[1][4] = 2.64602356e-01;
486  rot_mat1[1][5] = -6.34971914e-01;
487  rot_mat1[1][6] = 6.01265560e-01;
488  rot_mat1[2][0] = 4.43696646e-01;
489  rot_mat1[2][1] = -6.06912539e-02;
490  rot_mat1[2][2] = 2.61413193e-01;
491  rot_mat1[2][3] = -1.98368802e-01;
492  rot_mat1[2][4] = -6.43234645e-02;
493  rot_mat1[2][5] = 5.75880430e-01;
494  rot_mat1[2][6] = 5.96646495e-01;
495  rot_mat1[3][0] = 1.45865363e-01;
496  rot_mat1[3][1] = -5.16577220e-01;
497  rot_mat1[3][2] = -2.09866367e-01;
498  rot_mat1[3][3] = 5.55699395e-01;
499  rot_mat1[3][4] = 5.73062990e-01;
500  rot_mat1[3][5] = 1.74778224e-01;
501  rot_mat1[3][6] = 8.77170506e-03;
502  rot_mat1[4][0] = -3.24609748e-01;
503  rot_mat1[4][1] = 2.89664179e-01;
504  rot_mat1[4][2] = -7.50613752e-01;
505  rot_mat1[4][3] = -1.63060005e-01;
506  rot_mat1[4][4] = 1.70803377e-01;
507  rot_mat1[4][5] = 1.63784167e-01;
508  rot_mat1[4][6] = 4.05850414e-01;
509  rot_mat1[5][0] = 1.32570771e-03;
510  rot_mat1[5][1] = 3.80299846e-01;
511  rot_mat1[5][2] = -5.08439810e-02;
512  rot_mat1[5][3] = 7.59141791e-01;
513  rot_mat1[5][4] = -4.77844928e-01;
514  rot_mat1[5][5] = 2.12149087e-01;
515  rot_mat1[5][6] = 5.60882349e-02;
516  rot_mat1[6][0] = 1.62781208e-01;
517  rot_mat1[6][1] = -5.75073150e-01;
518  rot_mat1[6][2] = -3.60485665e-01;
519  rot_mat1[6][3] = -1.70070331e-02;
520  rot_mat1[6][4] = -5.72251258e-01;
521  rot_mat1[6][5] = -3.50549638e-01;
522  rot_mat1[6][6] = 2.49394158e-01;
523  spo->storeParamsBeforeRotation(); // avoids coefs_copy_ nullptr segfault
524  spo->applyRotation(rot_mat1, false); // Apply rotation 1
525 
526 
527  /* Apply another rotation, U = exp(-K) as shown below, to the splines.
528  Because K = -K.T, U is unitary.
529  K=
530  0.00000000e+00 3.08898211e-01 9.70811450e-01 9.96582440e-01 2.59290113e-01 9.08544511e-01 7.47970513e-01
531  -3.08898211e-01 0.00000000e+00 4.90958419e-01 7.98394113e-01 9.02926177e-01 3.24156332e-01 1.83039207e-01
532  -9.70811450e-01 -4.90958419e-01 0.00000000e+00 7.73447329e-01 2.71156433e-01 2.18009012e-01 1.75304629e-01
533  -9.96582440e-01 -7.98394113e-01 -7.73447329e-01 0.00000000e+00 9.27679516e-01 8.09853231e-01 7.71485500e-01
534  -2.59290113e-01 -9.02926177e-01 -2.71156433e-01 -9.27679516e-01 0.00000000e+00 6.19032776e-01 6.05979744e-02
535  -9.08544511e-01 -3.24156332e-01 -2.18009012e-01 -8.09853231e-01 -6.19032776e-01 0.00000000e+00 7.91708106e-01
536  -7.47970513e-01 -1.83039207e-01 -1.75304629e-01 -7.71485500e-01 -6.05979744e-02 -7.91708106e-01 0.00000000e+00
537 
538  U=
539  -2.98194829e-02 -6.14346084e-01 -6.43923495e-01 -1.18552217e-01 3.77244445e-01 -2.06047353e-01 9.07122365e-02
540  -3.48818370e-01 4.38506143e-01 -5.57140467e-01 -3.70956624e-01 -2.23467853e-01 3.80270838e-01 2.08518583e-01
541  1.87644050e-01 -1.34182635e-01 3.74618322e-01 -8.74132032e-01 1.57504581e-01 4.78555353e-02 1.23455215e-01
542  -7.68247448e-02 -2.48006571e-01 -7.30866440e-02 -2.06817660e-01 -7.99320897e-01 -4.53458397e-01 -1.99842648e-01
543  2.59360916e-02 5.64417889e-01 -1.05874452e-01 -1.09701962e-01 2.76429977e-01 -7.59899812e-01 6.04531910e-02
544  3.50608068e-01 1.58922313e-01 -2.49914906e-01 -1.49783413e-01 1.03865829e-01 1.56180926e-01 -8.55420691e-01
545  8.44230723e-01 8.33975900e-02 -2.35816939e-01 8.35859456e-02 -2.38381031e-01 5.64243083e-02 3.97132056e-01
546 
547  UU.T=
548  1.00000000e+00 1.97376302e-16 2.32170398e-16 8.48209595e-17 1.52095225e-16 1.20549468e-16 -6.20012223e-17
549  1.97376302e-16 1.00000000e+00 2.49491048e-16 -1.32824448e-16 -2.95131454e-17 1.89706297e-17 -9.33948863e-17
550  2.32170398e-16 2.49491048e-16 1.00000000e+00 -1.53719614e-16 -1.07440039e-16 1.11845140e-17 1.25992152e-16
551  8.48209595e-17 -1.32824448e-16 -1.53719614e-16 1.00000000e+00 3.98945291e-17 8.97184517e-17 -1.23231760e-16
552  1.52095225e-16 -2.95131454e-17 -1.07440039e-16 3.98945291e-17 1.00000000e+00 2.40723889e-17 3.26140430e-17
553  1.20549468e-16 1.89706297e-17 1.11845140e-17 8.97184517e-17 2.40723889e-17 1.00000000e+00 2.75131978e-17
554  -6.20012223e-17 -9.33948863e-17 1.25992152e-16 -1.23231760e-16 3.26140430e-17 2.75131978e-17 1.00000000e+00
555 
556  NB: There's nothing special about this rotation. I purposefully made something 'ugly' to make a worst case scenario...
557  */
558  SPOSet::ValueMatrix rot_mat2(orbitalsetsize, orbitalsetsize);
559  rot_mat2[0][0] = -2.98194829e-02;
560  rot_mat2[0][1] = -6.14346084e-01;
561  rot_mat2[0][2] = -6.43923495e-01;
562  rot_mat2[0][3] = -1.18552217e-01;
563  rot_mat2[0][4] = 3.77244445e-01;
564  rot_mat2[0][5] = -2.06047353e-01;
565  rot_mat2[0][6] = 9.07122365e-02;
566  rot_mat2[1][0] = -3.48818370e-01;
567  rot_mat2[1][1] = 4.38506143e-01;
568  rot_mat2[1][2] = -5.57140467e-01;
569  rot_mat2[1][3] = -3.70956624e-01;
570  rot_mat2[1][4] = -2.23467853e-01;
571  rot_mat2[1][5] = 3.80270838e-01;
572  rot_mat2[1][6] = 2.08518583e-01;
573  rot_mat2[2][0] = 1.87644050e-01;
574  rot_mat2[2][1] = -1.34182635e-01;
575  rot_mat2[2][2] = 3.74618322e-01;
576  rot_mat2[2][3] = -8.74132032e-01;
577  rot_mat2[2][4] = 1.57504581e-01;
578  rot_mat2[2][5] = 4.78555353e-02;
579  rot_mat2[2][6] = 1.23455215e-01;
580  rot_mat2[3][0] = -7.68247448e-02;
581  rot_mat2[3][1] = -2.48006571e-01;
582  rot_mat2[3][2] = -7.30866440e-02;
583  rot_mat2[3][3] = -2.06817660e-01;
584  rot_mat2[3][4] = -7.99320897e-01;
585  rot_mat2[3][5] = -4.53458397e-01;
586  rot_mat2[3][6] = -1.99842648e-01;
587  rot_mat2[4][0] = 2.59360916e-02;
588  rot_mat2[4][1] = 5.64417889e-01;
589  rot_mat2[4][2] = -1.05874452e-01;
590  rot_mat2[4][3] = -1.09701962e-01;
591  rot_mat2[4][4] = 2.76429977e-01;
592  rot_mat2[4][5] = -7.59899812e-01;
593  rot_mat2[4][6] = 6.04531910e-02;
594  rot_mat2[5][0] = 3.50608068e-01;
595  rot_mat2[5][1] = 1.58922313e-01;
596  rot_mat2[5][2] = -2.49914906e-01;
597  rot_mat2[5][3] = -1.49783413e-01;
598  rot_mat2[5][4] = 1.03865829e-01;
599  rot_mat2[5][5] = 1.56180926e-01;
600  rot_mat2[5][6] = -8.55420691e-01;
601  rot_mat2[6][0] = 8.44230723e-01;
602  rot_mat2[6][1] = 8.33975900e-02;
603  rot_mat2[6][2] = -2.35816939e-01;
604  rot_mat2[6][3] = 8.35859456e-02;
605  rot_mat2[6][4] = -2.38381031e-01;
606  rot_mat2[6][5] = 5.64243083e-02;
607  rot_mat2[6][6] = 3.97132056e-01;
608  spo->storeParamsBeforeRotation(); // avoids coefs_copy_ nullptr segfault
609  spo->applyRotation(rot_mat2, false); // Apply rotation2
610 
611  // Total rotation is product of rot_mat1 and rot_mat2
612  SPOSet::ValueMatrix rot_mat_tot(orbitalsetsize, orbitalsetsize);
613  for (int i = 0; i < orbitalsetsize; i++)
614  for (int j = 0; j < orbitalsetsize; j++)
615  {
616  rot_mat_tot[i][j] = 0;
617  for (int k = 0; k < orbitalsetsize; k++)
618  rot_mat_tot[i][j] += rot_mat1[i][k] * rot_mat2[k][j];
619  }
620 
621  // Get the data for rotated orbitals
622  SPOSet::ValueMatrix psiM_rot(elec_.R.size(), orbitalsetsize);
623  SPOSet::GradMatrix dpsiM_rot(elec_.R.size(), orbitalsetsize);
624  SPOSet::ValueMatrix d2psiM_rot(elec_.R.size(), orbitalsetsize);
625  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM_rot, dpsiM_rot, d2psiM_rot);
626 
627  // Compute the expected value, gradient, and laplacian by hand using the transformation above
628  // Check value
629  SPOSet::ValueMatrix psiM_rot_manual(elec_.R.size(), orbitalsetsize);
630  for (int i = 0; i < elec_.R.size(); i++)
631  for (int j = 0; j < orbitalsetsize; j++)
632  {
633  psiM_rot_manual[i][j] = 0.;
634  for (int k = 0; k < orbitalsetsize; k++)
635  psiM_rot_manual[i][j] += psiM_bare[i][k] * rot_mat_tot[k][j];
636  }
637  auto check = checkMatrix(psiM_rot_manual, psiM_rot, true);
638  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
639 
640  // Check grad
641  SPOSet::GradMatrix dpsiM_rot_manual(elec_.R.size(), orbitalsetsize);
642  for (int i = 0; i < elec_.R.size(); i++)
643  for (int j = 0; j < orbitalsetsize; j++)
644  {
645  dpsiM_rot_manual[i][j][0] = 0.;
646  dpsiM_rot_manual[i][j][1] = 0.;
647  dpsiM_rot_manual[i][j][2] = 0.;
648  for (int k = 0; k < orbitalsetsize; k++)
649  for (int l = 0; l < 3; l++)
650  dpsiM_rot_manual[i][j][l] += dpsiM_bare[i][k][l] * rot_mat_tot[k][j];
651  }
652 
653  // No checkMatrix for tensors? Gotta do it by hand...
654  double res = 0.;
655  for (int i = 0; i < elec_.R.size(); i++)
656  for (int j = 0; j < orbitalsetsize; j++)
657  for (int k = 0; k < 3; k++)
658  res += std::sqrt(std::norm(dpsiM_rot_manual[i][j][k] - dpsiM_rot[i][j][k]));
659 
660  CHECK(res == Approx(0.).epsilon(2e-4)); // increase threshold to accomodate mixed precision.
661 
662  // Check laplacian
663  SPOSet::ValueMatrix d2psiM_rot_manual(elec_.R.size(), orbitalsetsize);
664  for (int i = 0; i < elec_.R.size(); i++)
665  for (int j = 0; j < orbitalsetsize; j++)
666  {
667  d2psiM_rot_manual[i][j] = 0.;
668  for (int k = 0; k < orbitalsetsize; k++)
669  d2psiM_rot_manual[i][j] += d2psiM_bare[i][k] * rot_mat_tot[k][j];
670  }
671  check = checkMatrix(d2psiM_rot_manual, d2psiM_rot, true, 2e-4);
672  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
673 
674 } // TEST_CASE
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
CHECKED_ELSE(check_matrix_result.result)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
double norm(const zVec &c)
Definition: VectorOps.h:118
REQUIRE(std::filesystem::exists(filename))
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [485/537]

qmcplusplus::TEST_CASE ( "AC Force"  ,
""  [hamiltonian] 
)

Definition at line 376 of file test_force.cpp.

References ACForce::add2Hamiltonian(), SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), CHECK(), clone, ACForce::compute_regularizer_f(), ParticleSet::create(), ACForce::evaluate(), ACForce::get(), Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), ParticleSet::getTotalNum(), ACForce::makeClone(), Libxml2Document::parseFromString(), ACForce::put(), ParticleSet::R, REQUIRE(), ParticleSet::resetGroups(), ACForce::resetTargetParticleSet(), ParticleSet::setName(), sqrt(), and ParticleSet::update().

377 {
378  using Real = QMCTraits::RealType;
379  const SimulationCell simulation_cell;
380  ParticleSet ions(simulation_cell);
381  ParticleSet elec(simulation_cell);
382 
383  ions.setName("ion");
384  ions.create({1});
385  ions.R[0] = {0.0, 0.0, 0.0};
386  elec.setName("elec");
387  elec.create({2});
388  elec.R[0] = {0.0, 1.0, 0.0};
389  elec.R[1] = {0.4, 0.3, 0.0};
390  SpeciesSet& tspecies = elec.getSpeciesSet();
391  int upIdx = tspecies.addSpecies("u");
392  //int chargeIdx = tspecies.addAttribute("charge");
393  int massIdx = tspecies.addAttribute("mass");
394  int eChargeIdx = tspecies.addAttribute("charge");
395  tspecies(eChargeIdx, upIdx) = -1.0;
396  tspecies(massIdx, upIdx) = 1.0;
397 
398 
399  // The call to resetGroups is needed transfer the SpeciesSet
400  // settings to the ParticleSet
401  elec.resetGroups();
402 
403  SpeciesSet& ion_species = ions.getSpeciesSet();
404  int pIdx = ion_species.addSpecies("H");
405  int pChargeIdx = ion_species.addAttribute("charge");
406  ion_species(pChargeIdx, pIdx) = 1;
407 
408  ions.resetGroups();
409  // Must update ions first in SoA so ions.coordinates_ is valid
410  ions.update();
411 
412  elec.addTable(ions);
413  elec.update();
414 
415  // defaults
416  RuntimeOptions runtime_options;
417  TrialWaveFunction psi(runtime_options);
418  QMCHamiltonian qmcHamiltonian;
419 
420  //This is redundant code, but necessary to avoid adding API's to
421  //modify internal state. Avoid constructor+put() complexities for now.
422  //Revisit in future.
423  //
424  //Old algorithm is the legacy force path, new is the fast force derivative path.
425  ACForce force_old(ions, elec, psi, qmcHamiltonian);
426  ACForce force_new(ions, elec, psi, qmcHamiltonian);
427  const std::string acforceXMLold = R"(<tmp>
428  <acforce spacewarp="no" swpow="2." delta="1.e-3">
429  </acforce>
430  </tmp>
431  )";
432 
433  const std::string acforceXMLnew = R"(<tmp>
434  <acforce spacewarp="no" swpow="2." delta="1.e-3" fast_derivatives="yes">
435  </acforce>
436  </tmp>
437  )";
438 
439  ParticleSet::ParticleGradient g(elec.getTotalNum());
440  //Let magnitude be 1
441  g[0][0] = std::sqrt(1.0 / 2.0);
442  g[1][2] = std::sqrt(1.0 / 2.0);
443 
444  //Epsilon = 2 places this within the regularizer threshold of x < 1.
445  Real regval = ACForce::compute_regularizer_f(g, 2);
446  CHECK(regval == Approx(1.421875));
447  //Epsilon = 0.001 places this way outside of regularizer threshold.
448  //Should return 1.
449  regval = ACForce::compute_regularizer_f(g, 0.001);
450  CHECK(regval == Approx(1.0));
451  //Epsilon = 0.0 indicates the regularizer is not used. Return 1.
452  regval = ACForce::compute_regularizer_f(g, 0.0);
453  CHECK(regval == Approx(1.0));
454 
455  Libxml2Document olddoc;
456  Libxml2Document newdoc;
457  bool oldokay = olddoc.parseFromString(acforceXMLold);
458  REQUIRE(oldokay);
459  bool newokay = newdoc.parseFromString(acforceXMLnew);
460  REQUIRE(newokay);
461 
462  xmlNodePtr oldroot = olddoc.getRoot();
463  xmlNodePtr oldh1 = xmlFirstElementChild(oldroot);
464  xmlNodePtr newroot = newdoc.getRoot();
465  xmlNodePtr newh1 = xmlFirstElementChild(newroot);
466 
467  force_old.put(oldh1);
468  force_new.put(newh1);
469  const auto vold = force_old.evaluate(elec);
470  const auto vnew = force_new.evaluate(elec);
471  force_old.resetTargetParticleSet(elec); // does nothing?
472 
473  CHECK(vold == Approx(0));
474  CHECK(vnew == Approx(0));
475  REQUIRE(force_old.get(std::cout) == true);
476 
477  force_old.add2Hamiltonian(elec, psi, qmcHamiltonian);
478 
479  auto clone = force_old.makeClone(elec, psi, qmcHamiltonian);
480  REQUIRE(clone);
481 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ForceBase::Real Real
Definition: ForceBase.cpp:26
REQUIRE(std::filesystem::exists(filename))
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [486/537]

qmcplusplus::TEST_CASE ( "OneBodyDensityMatrices::accumulate"  ,
""  [estimators] 
)

Definition at line 382 of file test_OneBodyDensityMatrices.cpp.

References ProjectData::BATCH, comm, OHMMS::Controller, convertUPtrToRefVector(), doc, dump_obdm, OneBodyDensityMatricesTests< T >::dumpData(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), StdRandom< T >::init(), MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), node, obdmi, okay, Libxml2Document::parseFromString(), particle_pool, pset_target, species_set, spomap, test_project, OneBodyDensityMatricesTests< T >::testAccumulate(), walker, qmcplusplus::hdf::walkers, and wavefunction_pool.

383 {
384  using Input = testing::ValidOneBodyDensityMatricesInput;
386 
387  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
389 
391  bool okay = doc.parseFromString(Input::xml[Input::valid::VANILLA]);
392  if (!okay)
393  throw std::runtime_error("cannot parse OneBodyDensitMatricesInput section");
394  xmlNodePtr node = doc.getRoot();
395  OneBodyDensityMatricesInput obdmi(node);
396  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
397  auto wavefunction_pool =
398  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
399  auto& spomap = wavefunction_pool.getWaveFunction("wavefunction")->getSPOMap();
400  auto& pset_target = *(particle_pool.getParticleSet("e"));
401  auto& pset_source = *(particle_pool.getParticleSet("ion"));
402  auto& species_set = pset_target.getSpeciesSet();
403  OneBodyDensityMatrices obdm(std::move(obdmi), pset_target.getLattice(), species_set, spomap, pset_target);
404 
405  std::vector<MCPWalker> walkers;
406  int nwalkers = 3;
407  for (int iw = 0; iw < nwalkers; ++iw)
408  walkers.emplace_back(8);
409 
410  std::vector<ParticleSet::ParticlePos> deterministic_rs = {{
411  {-0.6759092808, 0.835668385, 1.985307097},
412  {0.09710352868, -0.76751858, -1.89306891},
413  {-0.5605484247, -0.9578875303, 1.476860642},
414  {2.585144997, 1.862680197, 3.282609463},
415  {-0.1961335093, 1.111888766, -0.578481257},
416  {1.794641614, 1.6000278, -0.9474347234},
417  {2.157717228, 0.9254754186, 2.263158321},
418  {1.883366346, 2.136350632, 3.188981533},
419  },
420  {
421  {-0.2079261839, -0.2796236873, 0.5512072444},
422  {-0.2823159397, 0.7537326217, 0.01526880637},
423  {3.533515453, 2.433290243, 0.9281452894},
424  {2.051767349, 2.312927485, 0.7089259624},
425  {-1.043096781, 0.8190526962, -0.1958218962},
426  {0.9210210443, 0.7726522088, 0.3962054551},
427  {2.043324947, 0.3482068777, 3.39059639},
428  {0.9103830457, 2.167978764, 2.341906071},
429  },
430  {
431  {-0.466550231, 0.09173964709, -0.3779250085},
432  {-0.4211375415, -2.017466068, -1.691870451},
433  {2.090800285, 1.88529861, 2.152359247},
434  {2.973145723, 1.718174577, 3.822324753},
435  {-0.8552014828, -0.3484517336, -0.2870049179},
436  {0.2349359095, -0.5025780797, 0.2305756211},
437  {-0.03547382355, 2.279159069, 3.057915211},
438  {2.535993099, 1.637133598, 3.689830303},
439  }};
440  std::vector<ParticleSet> psets =
441  testing::generateRandomParticleSets<generate_test_data>(pset_target, pset_source, deterministic_rs, nwalkers);
442 
443  auto& trial_wavefunction = *(wavefunction_pool.getPrimary());
444  std::vector<UPtr<TrialWaveFunction>> twfcs(nwalkers);
445  for (int iw = 0; iw < nwalkers; ++iw)
446  twfcs[iw] = trial_wavefunction.makeClone(psets[iw]);
447 
448  StdRandom<OneBodyDensityMatrices::FullPrecRealType> rng;
449  rng.init(101);
450 
451  auto updateWalker = [](auto& walker, auto& pset_target, auto& trial_wavefunction) {
452  pset_target.update(true);
453  pset_target.donePbyP();
454  trial_wavefunction.evaluateLog(pset_target);
455  pset_target.saveWalker(walker);
456  };
457 
458  for (int iw = 0; iw < nwalkers; ++iw)
459  updateWalker(walkers[iw], psets[iw], *(twfcs[iw]));
460 
461  auto ref_walkers(makeRefVector<MCPWalker>(walkers));
462  auto ref_psets(makeRefVector<ParticleSet>(psets));
463  auto ref_twfcs(convertUPtrToRefVector(twfcs));
464 
465  testing::OneBodyDensityMatricesTests<QMCTraits::FullPrecRealType> obdmt;
466  obdmt.testAccumulate(obdm, ref_walkers, ref_psets, ref_twfcs, rng);
467 
468  if constexpr (dump_obdm)
469  obdmt.dumpData(obdm);
470 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
const char walkers[]
Definition: HDFVersion.h:36
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
static RefVector< T > convertUPtrToRefVector(const UPtrVector< T > &ptr_list)
convert a vector of std::unique_ptrs<T> to a refvector<T>
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
OneBodyDensityMatricesInput obdmi(node)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker
Definition: test_walker.cpp:31

◆ TEST_CASE() [487/537]

qmcplusplus::TEST_CASE ( "Cartesian Tensor evaluateThirdDerivOnly subset"  ,
""  [numerics] 
)

Definition at line 391 of file test_cartesian_tensor.cpp.

References CHECK(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::evaluateThirdDerivOnly(), and CartesianTensor< T, Point_t, Tensor_t, GGG_t >::getGGGYlm().

392 {
394 
395  TinyVector<double, 3> pt(1.3, 1.2, -0.5);
396  ct.evaluateThirdDerivOnly(pt);
397 
398  CHECK(ct.getGGGYlm(14)[0](0, 0) == Approx(0));
399  CHECK(ct.getGGGYlm(14)[0](0, 1) == Approx(0));
400  CHECK(ct.getGGGYlm(14)[0](0, 2) == Approx(3.33779058906));
401  CHECK(ct.getGGGYlm(14)[0](1, 0) == Approx(0));
402  CHECK(ct.getGGGYlm(14)[0](1, 1) == Approx(0));
403  CHECK(ct.getGGGYlm(14)[0](1, 2) == Approx(0));
404  CHECK(ct.getGGGYlm(14)[0](2, 0) == Approx(3.33779058906));
405  CHECK(ct.getGGGYlm(14)[0](2, 1) == Approx(0));
406  CHECK(ct.getGGGYlm(14)[0](2, 2) == Approx(0));
407  CHECK(ct.getGGGYlm(14)[1](0, 0) == Approx(0));
408  CHECK(ct.getGGGYlm(14)[1](0, 1) == Approx(0));
409  CHECK(ct.getGGGYlm(14)[1](0, 2) == Approx(0));
410  CHECK(ct.getGGGYlm(14)[1](1, 0) == Approx(0));
411  CHECK(ct.getGGGYlm(14)[1](1, 1) == Approx(0));
412  CHECK(ct.getGGGYlm(14)[1](1, 2) == Approx(0));
413  CHECK(ct.getGGGYlm(14)[1](2, 0) == Approx(0));
414  CHECK(ct.getGGGYlm(14)[1](2, 1) == Approx(0));
415  CHECK(ct.getGGGYlm(14)[1](2, 2) == Approx(0));
416  CHECK(ct.getGGGYlm(14)[2](0, 0) == Approx(3.33779058906));
417  CHECK(ct.getGGGYlm(14)[2](0, 1) == Approx(0));
418  CHECK(ct.getGGGYlm(14)[2](0, 2) == Approx(0));
419  CHECK(ct.getGGGYlm(14)[2](1, 0) == Approx(0));
420  CHECK(ct.getGGGYlm(14)[2](1, 1) == Approx(0));
421  CHECK(ct.getGGGYlm(14)[2](1, 2) == Approx(0));
422  CHECK(ct.getGGGYlm(14)[2](2, 0) == Approx(0));
423  CHECK(ct.getGGGYlm(14)[2](2, 1) == Approx(0));
424  CHECK(ct.getGGGYlm(14)[2](2, 2) == Approx(0));
425 
426 
427  CHECK(ct.getGGGYlm(33)[0](0, 0) == Approx(0));
428  CHECK(ct.getGGGYlm(33)[0](0, 1) == Approx(0));
429  CHECK(ct.getGGGYlm(33)[0](0, 2) == Approx(0));
430  CHECK(ct.getGGGYlm(33)[0](1, 0) == Approx(0));
431  CHECK(ct.getGGGYlm(33)[0](1, 1) == Approx(-5.00668588359));
432  CHECK(ct.getGGGYlm(33)[0](1, 2) == Approx(12.0160461206));
433  CHECK(ct.getGGGYlm(33)[0](2, 0) == Approx(0));
434  CHECK(ct.getGGGYlm(33)[0](2, 1) == Approx(12.0160461206));
435  CHECK(ct.getGGGYlm(33)[0](2, 2) == Approx(0));
436  CHECK(ct.getGGGYlm(33)[1](0, 0) == Approx(0));
437  CHECK(ct.getGGGYlm(33)[1](0, 1) == Approx(-5.00668588359));
438  CHECK(ct.getGGGYlm(33)[1](0, 2) == Approx(12.0160461206));
439  CHECK(ct.getGGGYlm(33)[1](1, 0) == Approx(-5.00668588359));
440  CHECK(ct.getGGGYlm(33)[1](1, 1) == Approx(0));
441  CHECK(ct.getGGGYlm(33)[1](1, 2) == Approx(13.0173832973));
442  CHECK(ct.getGGGYlm(33)[1](2, 0) == Approx(12.0160461206));
443  CHECK(ct.getGGGYlm(33)[1](2, 1) == Approx(13.0173832973));
444  CHECK(ct.getGGGYlm(33)[1](2, 2) == Approx(0));
445  CHECK(ct.getGGGYlm(33)[2](0, 0) == Approx(0));
446  CHECK(ct.getGGGYlm(33)[2](0, 1) == Approx(12.0160461206));
447  CHECK(ct.getGGGYlm(33)[2](0, 2) == Approx(0));
448  CHECK(ct.getGGGYlm(33)[2](1, 0) == Approx(12.0160461206));
449  CHECK(ct.getGGGYlm(33)[2](1, 1) == Approx(13.0173832973));
450  CHECK(ct.getGGGYlm(33)[2](1, 2) == Approx(0));
451  CHECK(ct.getGGGYlm(33)[2](2, 0) == Approx(0));
452  CHECK(ct.getGGGYlm(33)[2](2, 1) == Approx(0));
453  CHECK(ct.getGGGYlm(33)[2](2, 2) == Approx(0));
454 
455 
456  CHECK(ct.getGGGYlm(80)[0](0, 0) == Approx(0));
457  CHECK(ct.getGGGYlm(80)[0](0, 1) == Approx(0));
458  CHECK(ct.getGGGYlm(80)[0](0, 2) == Approx(0));
459  CHECK(ct.getGGGYlm(80)[0](1, 0) == Approx(0));
460  CHECK(ct.getGGGYlm(80)[0](1, 1) == Approx(27.8256449422));
461  CHECK(ct.getGGGYlm(80)[0](1, 2) == Approx(-66.7815478613));
462  CHECK(ct.getGGGYlm(80)[0](2, 0) == Approx(0));
463  CHECK(ct.getGGGYlm(80)[0](2, 1) == Approx(-66.7815478613));
464  CHECK(ct.getGGGYlm(80)[0](2, 2) == Approx(53.425238289));
465  CHECK(ct.getGGGYlm(80)[1](0, 0) == Approx(0));
466  CHECK(ct.getGGGYlm(80)[1](0, 1) == Approx(27.8256449422));
467  CHECK(ct.getGGGYlm(80)[1](0, 2) == Approx(-66.7815478613));
468  CHECK(ct.getGGGYlm(80)[1](1, 0) == Approx(27.8256449422));
469  CHECK(ct.getGGGYlm(80)[1](1, 1) == Approx(30.1444486874));
470  CHECK(ct.getGGGYlm(80)[1](1, 2) == Approx(-144.6933537));
471  CHECK(ct.getGGGYlm(80)[1](2, 0) == Approx(-66.7815478613));
472  CHECK(ct.getGGGYlm(80)[1](2, 1) == Approx(-144.6933537));
473  CHECK(ct.getGGGYlm(80)[1](2, 2) == Approx(173.632024439));
474  CHECK(ct.getGGGYlm(80)[2](0, 0) == Approx(0));
475  CHECK(ct.getGGGYlm(80)[2](0, 1) == Approx(-66.7815478613));
476  CHECK(ct.getGGGYlm(80)[2](0, 2) == Approx(53.425238289));
477  CHECK(ct.getGGGYlm(80)[2](1, 0) == Approx(-66.7815478613));
478  CHECK(ct.getGGGYlm(80)[2](1, 1) == Approx(-144.6933537));
479  CHECK(ct.getGGGYlm(80)[2](1, 2) == Approx(173.632024439));
480  CHECK(ct.getGGGYlm(80)[2](2, 0) == Approx(53.425238289));
481  CHECK(ct.getGGGYlm(80)[2](2, 1) == Approx(173.632024439));
482  CHECK(ct.getGGGYlm(80)[2](2, 2) == Approx(0));
483 }
The template parameters.
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [488/537]

qmcplusplus::TEST_CASE ( "test setup timers"  ,
""  [utilities] 
)

Definition at line 399 of file test_timer.cpp.

References CHECK(), convert_to_ns(), MyTimer1, REQUIRE(), qmcplusplus::Units::time::s, TestTimerNames, and timer_level_coarse.

400 {
401  FakeTimerManager tm;
402  // Create a list of timers and initialize it
403  TimerList Timers(tm, TestTimerNames, timer_level_coarse);
404 
405  FakeChronoClock::fake_chrono_clock_increment = convert_to_ns(1.0s);
406  Timers[MyTimer1].get().start();
407  Timers[MyTimer1].get().stop();
408 
409 #ifdef ENABLE_TIMERS
410  CHECK(Timers[MyTimer1].get().get_total() == Approx(1.0));
411  REQUIRE(Timers[MyTimer1].get().get_num_calls() == 1);
412 #endif
413 }
FakeChronoClock::duration convert_to_ns(T in)
REQUIRE(std::filesystem::exists(filename))
TimerNameList_t< TestTimer > TestTimerNames
Definition: test_timer.cpp:397
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
TimerManager< FakeTimer > FakeTimerManager
Definition: test_timer.cpp:23

◆ TEST_CASE() [489/537]

qmcplusplus::TEST_CASE ( "SpaceGrid::hdf5"  ,
""  [estimators] 
)
Todo:
add additional hdf5 output checks

Definition at line 405 of file test_NESpaceGrid.cpp.

References ParticleSet::addTable(), CHECK(), hdf_archive::close(), comm, OHMMS::Controller, hdf_archive::create(), ParticleSet::getDistTableAB(), ParticleSet::getTotalNum(), OHMMS_DIM, okay, hdf_archive::open(), SpaceGridEnv< VALID >::pset_elec_, SpaceGridEnv< VALID >::pset_ions_, hdf_archive::push(), ParticleSet::R, hdf_archive::readEntry(), SpaceGridEnv< VALID >::ref_points_, REQUIRE(), Matrix< T, Alloc >::resize(), SpaceGridEnv< VALID >::sgi_, and ParticleSet::update().

406 {
407  using Input = testing::ValidSpaceGridInput;
408  Communicate* comm;
410  testing::SpaceGridEnv<Input::valid::ORIGIN> sge(comm);
411  int num_values = 3;
412  NESpaceGrid<Real> space_grid(*(sge.sgi_), sge.ref_points_->get_points(), num_values, false);
413  using NES = testing::NESpaceGridTests<double>;
414  auto buffer_start = NES::getBufferStart(space_grid);
415  auto buffer_end = NES::getBufferEnd(space_grid);
416  space_grid.write_description(std::cout, std::string(""));
417  auto& sgi = *(sge.sgi_);
418  auto& agr = sgi.get_axis_grids();
419  for (int id = 0; id < OHMMS_DIM; ++id)
420  CHECK(NES::getOdu(space_grid)[id] == agr[id].odu);
421  //CHECK(buffer_start == 0);
422  //CHECK(buffer_end == 23999);
423 
424  Matrix<Real> values;
425  values.resize(sge.pset_elec_.getTotalNum(), num_values);
426 
427  for (int ip = 0; ip < sge.pset_elec_.getTotalNum(); ++ip)
428  for (int iv = 0; iv < num_values; ++iv)
429  values(ip, iv) = ip + 0.1 * iv;
430 
431  const int ei_tid = sge.pset_elec_.addTable(sge.pset_ions_);
432  sge.pset_elec_.update();
433  sge.pset_ions_.update();
434 
435  std::vector<bool> p_outside(8, false);
436  space_grid.accumulate(sge.pset_elec_.R, values, p_outside, sge.pset_elec_.getDistTableAB(ei_tid));
437 
438  hdf_archive hd;
439  std::string test_file{"spacegrid_test.hdf"};
440  bool okay = hd.create(test_file);
441  REQUIRE(okay);
442 
443  std::vector<ObservableHelper> h5desc;
444  space_grid.registerGrid(hd, 0);
445 
446  space_grid.write(hd);
447 
448  hd.close();
449 
450  hdf_archive hd_read;
451  bool okay_read = hd.open(test_file);
452  hd.push("spacegrid1");
453  //hdf5 values always end up as doubles
454  Matrix<double> read_values(1, 24000);
455  hd.readEntry(read_values, "value");
456 
457  auto tensorAccessor = [](const auto& grid_data, int i, int j, int k, int iv) -> double {
458  return grid_data.data()[1200 * i + 60 * j + 3 * k + iv];
459  };
460 
461  auto value = tensorAccessor(read_values, 10, 17, 9, 0);
462 
463  CHECK(tensorAccessor(read_values, 10, 17, 9, 0) == Approx(2.0));
464  CHECK(tensorAccessor(read_values, 10, 17, 9, 1) == Approx(2.1));
465  CHECK(tensorAccessor(read_values, 10, 17, 9, 2) == Approx(2.2));
466  CHECK(tensorAccessor(read_values, 12, 15, 7, 0) == Approx(4.0));
467  CHECK(tensorAccessor(read_values, 12, 15, 7, 1) == Approx(4.1));
468  CHECK(tensorAccessor(read_values, 12, 15, 7, 2) == Approx(4.2));
469  CHECK(tensorAccessor(read_values, 12, 16, 11, 0) == Approx(3.0));
470  CHECK(tensorAccessor(read_values, 12, 16, 11, 1) == Approx(3.1));
471  CHECK(tensorAccessor(read_values, 12, 16, 11, 2) == Approx(3.2));
472  CHECK(tensorAccessor(read_values, 13, 11, 15, 0) == Approx(6.0));
473  CHECK(tensorAccessor(read_values, 13, 11, 15, 1) == Approx(6.1));
474  CHECK(tensorAccessor(read_values, 13, 11, 15, 2) == Approx(6.2));
475  CHECK(tensorAccessor(read_values, 14, 13, 13, 0) == Approx(1.0));
476  CHECK(tensorAccessor(read_values, 14, 13, 13, 1) == Approx(1.2));
477  CHECK(tensorAccessor(read_values, 14, 13, 13, 2) == Approx(1.4));
478  CHECK(tensorAccessor(read_values, 15, 11, 10, 0) == Approx(7.0));
479  CHECK(tensorAccessor(read_values, 15, 11, 10, 1) == Approx(7.1));
480  CHECK(tensorAccessor(read_values, 15, 11, 10, 2) == Approx(7.2));
481  CHECK(tensorAccessor(read_values, 17, 12, 9, 0) == Approx(5.0));
482  CHECK(tensorAccessor(read_values, 17, 12, 9, 1) == Approx(5.1));
483  CHECK(tensorAccessor(read_values, 17, 12, 9, 2) == Approx(5.2));
484 
485  /// \todo add additional hdf5 output checks
486 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
#define OHMMS_DIM
Definition: config.h:64
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [490/537]

qmcplusplus::TEST_CASE ( "Ethanol MO with cusp"  ,
""  [wavefunction] 
)

Definition at line 410 of file test_soa_cusp_corr.cpp.

References castCharToXMLChar(), CHECK(), OHMMS::Controller, SPOSetBuilderFactory::createSPOSetBuilder(), doc, Libxml2Document::getRoot(), Libxml2Document::getXPathContext(), okay, Libxml2Document::parse(), XMLParticleParser::readXML(), and REQUIRE().

411 {
413 
415  bool okay = doc.parse("ethanol.structure.xml");
416  REQUIRE(okay);
417  xmlNodePtr root = doc.getRoot();
418 
419  const SimulationCell simulation_cell;
420  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
421  auto& ions(*ions_ptr);
422  XMLParticleParser parse_ions(ions);
423  OhmmsXPathObject particleset_ion("//particleset[@name='ion0']", doc.getXPathContext());
424  REQUIRE(particleset_ion.size() == 1);
425  parse_ions.readXML(particleset_ion[0]);
426 
427  REQUIRE(ions.groups() == 3);
428  REQUIRE(ions.R.size() == 9);
429  ions.update();
430 
431  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
432  auto& elec(*elec_ptr);
433  XMLParticleParser parse_elec(elec);
434  OhmmsXPathObject particleset_elec("//particleset[@name='e']", doc.getXPathContext());
435  REQUIRE(particleset_elec.size() == 1);
436  parse_elec.readXML(particleset_elec[0]);
437 
438  REQUIRE(elec.groups() == 2);
439  REQUIRE(elec.R.size() == 26);
440 
441  elec.R = 0.0;
442 
443  elec.addTable(ions);
444  elec.update();
445 
446  Libxml2Document doc2;
447  okay = doc2.parse("ethanol.wfnoj.xml");
448  REQUIRE(okay);
449  xmlNodePtr root2 = doc2.getRoot();
450 
451  WaveFunctionComponentBuilder::PSetMap particle_set_map;
452  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
453  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
454 
455  SPOSetBuilderFactory bf(c, elec, particle_set_map);
456 
457  OhmmsXPathObject MO_base("//determinantset", doc2.getXPathContext());
458  REQUIRE(MO_base.size() == 1);
459 
460  xmlSetProp(MO_base[0], castCharToXMLChar("cuspCorrection"), castCharToXMLChar("yes"));
461 
462  const auto bb_ptr = bf.createSPOSetBuilder(MO_base[0]);
463  auto& bb(*bb_ptr);
464 
465  OhmmsXPathObject slater_base("//determinant", doc2.getXPathContext());
466  auto sposet = bb.createSPOSet(slater_base[0]);
467 
468  SPOSet::ValueVector values;
469  SPOSet::GradVector dpsi;
470  SPOSet::ValueVector d2psi;
471  values.resize(13);
472  dpsi.resize(13);
473  d2psi.resize(13);
474 
475  elec.R = 0.0;
476  // Put electron near O atom
477  elec.R[0][0] = -2.10;
478  elec.R[0][1] = 0.50;
479 
480  elec.update();
481  ParticleSet::SingleParticlePos newpos;
482  elec.makeMove(0, newpos);
483 
484  sposet->evaluateValue(elec, 0, values);
485 
486  // Values from gen_cusp_corr.py
487  CHECK(values[0] == Approx(4.3617329704));
488  CHECK(values[1] == Approx(0.0014119853));
489  CHECK(values[2] == Approx(0.0001156461));
490  CHECK(values[3] == Approx(-0.6722670611));
491  CHECK(values[4] == Approx(0.2762949842));
492  CHECK(values[5] == Approx(0.2198735778));
493  CHECK(values[6] == Approx(0.0659454461));
494  CHECK(values[7] == Approx(0.2952071056));
495  CHECK(values[8] == Approx(0.0322071389));
496  CHECK(values[9] == Approx(0.0877981239));
497  CHECK(values[10] == Approx(-0.2151873873));
498  CHECK(values[11] == Approx(0.4250074750));
499  CHECK(values[12] == Approx(0.0767950823));
500 
501  sposet->evaluateVGL(elec, 0, values, dpsi, d2psi);
502 
503  CHECK(values[0] == Approx(4.3617329704));
504  CHECK(values[1] == Approx(0.0014119853));
505  CHECK(values[2] == Approx(0.0001156461));
506  CHECK(values[3] == Approx(-0.6722670611));
507  CHECK(values[4] == Approx(0.2762949842));
508  CHECK(values[5] == Approx(0.2198735778));
509  CHECK(values[6] == Approx(0.0659454461));
510  CHECK(values[7] == Approx(0.2952071056));
511  CHECK(values[8] == Approx(0.0322071389));
512  CHECK(values[9] == Approx(0.0877981239));
513  CHECK(values[10] == Approx(-0.2151873873));
514  CHECK(values[11] == Approx(0.4250074750));
515  CHECK(values[12] == Approx(0.0767950823));
516 
517  CHECK(dpsi[0][0] == Approx(-27.2844138432));
518  CHECK(dpsi[0][1] == Approx(15.9958208598));
519  CHECK(dpsi[0][2] == Approx(0.0195317131));
520  CHECK(d2psi[0] == Approx(-293.2869628790));
521 
522  CHECK(dpsi[12][0] == Approx(1.7548511775));
523  CHECK(dpsi[12][1] == Approx(2.2759333828));
524  CHECK(dpsi[12][2] == Approx(-1.4878277937));
525  CHECK(d2psi[12] == Approx(-4.3399821309));
526 
527 
528  SPOSet::ValueMatrix all_values;
529  SPOSet::GradMatrix all_grad;
530  SPOSet::ValueMatrix all_lap;
531  all_values.resize(10, 13);
532  all_grad.resize(10, 13);
533  all_lap.resize(10, 13);
534 
535  sposet->evaluate_notranspose(elec, 0, 7, all_values, all_grad, all_lap);
536 
537  CHECK(all_values[0][0] == Approx(4.3617329704));
538  CHECK(all_grad[0][0][0] == Approx(-27.2844138432));
539  CHECK(all_grad[0][0][1] == Approx(15.9958208598));
540  CHECK(all_grad[0][0][2] == Approx(0.0195317131));
541  CHECK(all_lap[0][0] == Approx(-293.2869628790));
542 
543  CHECK(all_values[0][11] == Approx(0.4250074750));
544  CHECK(all_grad[0][11][0] == Approx(-0.3947036210));
545  CHECK(all_grad[0][11][1] == Approx(0.9883840215));
546  CHECK(all_grad[0][11][2] == Approx(1.7863218842));
547  CHECK(all_lap[0][11] == Approx(-33.5202249813));
548 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180
xmlChar * castCharToXMLChar(char *c)
unsafe char* to xmlChar* cast
Definition: libxmldefs.h:70

◆ TEST_CASE() [491/537]

qmcplusplus::TEST_CASE ( "RotatedSPOs log matrix"  ,
""  [wavefunction] 
)

Definition at line 424 of file test_RotatedSPOs.cpp.

References CHECK(), CHECKED_ELSE(), checkMatrix(), RotatedSPOs::log_antisym_matrix(), CheckMatrixResult::result, and CheckMatrixResult::result_message.

425 {
427  using ValueMatrix = SPOSet::ValueMatrix;
428  using RealType = SPOSet::RealType;
429 
430  std::vector<SPOSet::ValueType> mat1_data = {1.0};
431  SPOSet::ValueMatrix m1(mat1_data.data(), 1, 1);
432  SPOSet::ValueMatrix out_m1(1, 1);
433  RotatedSPOs::log_antisym_matrix(m1, out_m1);
434  // Should always be 1.0 (the only possible anti-symmetric 1x1 matrix is 0)
435  CHECK(out_m1(0, 0) == ValueApprox(0.0));
436 
437  // clang-format off
438  std::vector<ValueType> start_rot2 = { 0.995004165278026, -0.0998334166468282,
439  0.0998334166468282, 0.995004165278026 };
440 
441  std::vector<SPOSet::ValueType> mat2_data = { 0.0, -0.1,
442  0.1, 0.0 };
443  // clang-format on
444 
445  ValueMatrix rot_m2(start_rot2.data(), 2, 2);
446  ValueMatrix out_m2(2, 2);
447  RotatedSPOs::log_antisym_matrix(rot_m2, out_m2);
448 
449  SPOSet::ValueMatrix m2(mat2_data.data(), 2, 2);
450  CheckMatrixResult check_matrix_result2 = checkMatrix(m2, out_m2, true);
451  CHECKED_ELSE(check_matrix_result2.result) { FAIL(check_matrix_result2.result_message); }
452 
453  // clang-format off
454  std::vector<ValueType> start_rot3 = { 0.950580617906092, -0.302932713402637, -0.0680313164049401,
455  0.283164960565074, 0.935754803277919, -0.210191705950743,
456  0.127334574917630, 0.180540076694398, 0.975290308953046 };
457 
458  std::vector<ValueType> m3_input_data = { 0.0, -0.3, -0.1,
459  0.3, 0.0, -0.2,
460  0.1, 0.2, 0.0 };
461  // clang-format on
462  ValueMatrix rot_m3(start_rot3.data(), 3, 3);
463  ValueMatrix out_m3(3, 3);
464  RotatedSPOs::log_antisym_matrix(rot_m3, out_m3);
465 
466  SPOSet::ValueMatrix m3(m3_input_data.data(), 3, 3);
467  CheckMatrixResult check_matrix_result3 = checkMatrix(m3, out_m3, true);
468  CHECKED_ELSE(check_matrix_result3.result) { FAIL(check_matrix_result3.result_message); }
469 
470 #ifdef QMC_COMPLEX
471  using cmplx_t = std::complex<RealType>;
472  std::vector<cmplx_t> m3_input_data_cplx = {cmplx_t(0, 0), cmplx_t(0.3, 0.1), cmplx_t(0.1, -0.3),
473  cmplx_t(-0.3, 0.1), cmplx_t(0, 0), cmplx_t(0.2, 0.01),
474  cmplx_t(-0.1, -0.3), cmplx_t(-0.2, 0.01), cmplx_t(0, 0)};
475 
476  std::vector<cmplx_t> start_rot_cmplx = {cmplx_t(0.90198269, -0.00652118), cmplx_t(0.27999104, 0.12545423),
477  cmplx_t(0.12447606, -0.27704993), cmplx_t(-0.29632557, 0.06664911),
478  cmplx_t(0.93133822, -0.00654092), cmplx_t(0.19214149, 0.05828413),
479  cmplx_t(-0.06763124, -0.29926537), cmplx_t(-0.19210869, -0.03907491),
480  cmplx_t(0.93133822, -0.00654092)};
481 
482  //packing vector data into matrix form.
483  Matrix<std::complex<RealType>> m3_cmplx_rot(start_rot_cmplx.data(), 3, 3);
484  Matrix<std::complex<RealType>> m3_cmplx_ref_data(m3_input_data_cplx.data(), 3, 3);
485  Matrix<std::complex<RealType>> result_matrix(3, 3);
486  RotatedSPOs::log_antisym_matrix(m3_cmplx_rot, result_matrix);
487 
488  CheckMatrixResult check_matrix_result4 = checkMatrix(result_matrix, m3_cmplx_ref_data, true);
489  CHECKED_ELSE(check_matrix_result4.result) { FAIL(check_matrix_result4.result_message); }
490 #endif
491 }
CHECKED_ELSE(check_matrix_result.result)
QMCTraits::RealType RealType
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [492/537]

qmcplusplus::TEST_CASE ( "AccelBLAS"  ,
""  [BLAS] 
)

Definition at line 434 of file test_AccelBLAS.cpp.

435 {
436  SECTION("gemm")
437  {
438 #if defined(ENABLE_CUDA)
439  std::cout << "Testing gemm<PlatformKind::CUDA>" << std::endl;
440  test_gemm_cases<PlatformKind::CUDA>();
441 #endif
442 #if defined(ENABLE_SYCL)
443  std::cout << "Testing gemm<PlatformKind::SYCL>" << std::endl;
444  test_gemm_cases<PlatformKind::SYCL>();
445 #endif
446 #if defined(ENABLE_OFFLOAD)
447  std::cout << "Testing gemm<PlatformKind::OMPTARGET>" << std::endl;
448  test_gemm_cases<PlatformKind::OMPTARGET>();
449 #endif
450  }
451 
452  SECTION("gemv")
453  {
454 #if defined(ENABLE_CUDA)
455  std::cout << "Testing gemm<PlatformKind::CUDA>" << std::endl;
456  test_gemv_cases<PlatformKind::CUDA>();
457 #endif
458 #if defined(ENABLE_SYCL)
459  std::cout << "Testing gemm<PlatformKind::SYCL>" << std::endl;
460  test_gemv_cases<PlatformKind::SYCL>();
461 #endif
462 #if defined(ENABLE_OFFLOAD)
463  std::cout << "Testing gemm<PlatformKind::OMPTARGET>" << std::endl;
464  test_gemv_cases<PlatformKind::OMPTARGET>();
465 #endif
466  }
467 
468  SECTION("ger")
469  {
470 #if defined(ENABLE_CUDA)
471  std::cout << "Testing ger<PlatformKind::CUDA>" << std::endl;
472  test_ger_cases<PlatformKind::CUDA>();
473 #endif
474 #if defined(ENABLE_SYCL)
475  std::cout << "Testing ger<PlatformKind::SYCL>" << std::endl;
476  test_ger_cases<PlatformKind::SYCL>();
477 #endif
478 #if defined(ENABLE_OFFLOAD)
479  std::cout << "Testing ger<PlatformKind::OMPTARGET>" << std::endl;
480  test_ger_cases<PlatformKind::OMPTARGET>();
481 #endif
482  }
483 }

◆ TEST_CASE() [493/537]

qmcplusplus::TEST_CASE ( "BSpline builder Jastrow J1"  ,
""  [wavefunction] 
)

Definition at line 437 of file test_J1_bspline.cpp.

References DC_POS, DC_POS_OFFLOAD, and test_J1_spline().

438 {
439  test_J1_spline(DynamicCoordinateKind::DC_POS);
440  test_J1_spline(DynamicCoordinateKind::DC_POS_OFFLOAD);
441 }
void test_J1_spline(const DynamicCoordinateKind kind_selected)

◆ TEST_CASE() [494/537]

qmcplusplus::TEST_CASE ( "distance_pbc_z"  ,
""  [distance_table][xml] 
)

Definition at line 444 of file test_distance_table.cpp.

References ParticleSet::accept_rejectMove(), ParticleSet::acceptMove(), ParticleSet::addTable(), CHECK(), ParticleSet::getDistTableAA(), ParticleSet::getDistTableAB(), ParticleSet::getTotalNum(), ParticleSet::makeMove(), parse_electron_ion_pbc_z(), parse_pbc_lattice(), ParticleSet::rejectMove(), and ParticleSet::update().

445 {
446  // test that particle distances are properly calculated under periodic boundary condition
447  // There are many details in this example, but the main idea is simple: When a particle is moved by a full lattice vector, no distance should change.
448 
449  const SimulationCell simulation_cell(parse_pbc_lattice());
450  ParticleSet ions(simulation_cell), electrons(simulation_cell);
451  parse_electron_ion_pbc_z(ions, electrons);
452 
453  // calculate particle distances
454  const int ei_tid = electrons.addTable(ions);
455  electrons.update();
456  ions.update();
457 
458  // get target particle set's distance table data
459  const auto& ei_dtable = electrons.getDistTableAB(ei_tid);
460  CHECK(ei_dtable.getName() == "ion0_e");
461 
462  CHECK(ei_dtable.sources() == ions.getTotalNum());
463  CHECK(ei_dtable.targets() == electrons.getTotalNum());
464 
465  int num_src = ions.getTotalNum();
466  int num_tar = electrons.getTotalNum();
467  std::vector<double> expect;
468  expect.resize(num_src * num_tar);
469  int idx(0);
470  for (int iat = 0; iat < num_src; iat++)
471  {
472  for (int jat = 0; jat < num_tar; jat++, idx++)
473  {
474  double dist = ei_dtable.getDistRow(jat)[iat];
475  expect[idx] = dist;
476  }
477  }
478 
479  // move a particle by a lattice vector
480  ParticleSet::SingleParticlePos disp(6.0, 0, 0);
481  electrons.makeMove(0, disp); // temporary change written in distance table
482  electrons.acceptMove(0); // update distance table with temporary change
483 
484  // move some more
485  disp[1] = -6.0;
486  electrons.makeMove(1, disp);
487  electrons.acceptMove(1);
488 
489  idx = 0;
490  for (int iat = 0; iat < num_src; iat++)
491  {
492  for (int jat = 0; jat < num_tar; jat++, idx++)
493  {
494  double dist = ei_dtable.getDistRow(jat)[iat];
495  CHECK(expect[idx] == Approx(dist));
496  }
497  }
498 
499  const int ee_tid = electrons.addTable(electrons);
500  // get target particle set's distance table data
501  const auto& ee_dtable = electrons.getDistTableAA(ee_tid);
502  CHECK(ee_dtable.getName() == "e_e");
503  electrons.update();
504 
505  // shift electron 0 a bit to avoid box edges.
506  ParticleSet::SingleParticlePos shift(0.1, 0.2, -0.1);
507  electrons.makeMove(0, shift);
508  electrons.acceptMove(0);
509 
510  disp[0] = 0.2;
511  disp[1] = 0.1;
512  disp[2] = 0.3;
513 
514  electrons.makeMove(0, disp, false);
515  CHECK(ee_dtable.getTempDists()[1] == Approx(2.7239676944));
516  CHECK(ee_dtable.getTempDispls()[1][0] == Approx(2.7));
517  CHECK(ee_dtable.getTempDispls()[1][1] == Approx(-0.3));
518  CHECK(ee_dtable.getTempDispls()[1][2] == Approx(-0.2));
519  CHECK(ee_dtable.getDistRow(1)[0] == Approx(2.908607914));
520  CHECK(ee_dtable.getDisplRow(1)[0][0] == Approx(-2.9));
521  CHECK(ee_dtable.getDisplRow(1)[0][1] == Approx(0.2));
522  CHECK(ee_dtable.getDisplRow(1)[0][2] == Approx(-0.1));
523  electrons.rejectMove(0);
524 
525  electrons.makeMove(0, disp);
526  CHECK(ee_dtable.getTempDists()[1] == Approx(2.7239676944));
527  CHECK(ee_dtable.getTempDispls()[1][0] == Approx(2.7));
528  CHECK(ee_dtable.getTempDispls()[1][1] == Approx(-0.3));
529  CHECK(ee_dtable.getTempDispls()[1][2] == Approx(-0.2));
530  CHECK(ee_dtable.getOldDists()[1] == Approx(2.908607914));
531  CHECK(ee_dtable.getOldDispls()[1][0] == Approx(2.9));
532  CHECK(ee_dtable.getOldDispls()[1][1] == Approx(-0.2));
533  CHECK(ee_dtable.getOldDispls()[1][2] == Approx(0.1));
534  CHECK(ee_dtable.getDistRow(1)[0] == Approx(2.908607914));
535  CHECK(ee_dtable.getDisplRow(1)[0][0] == Approx(-2.9));
536  CHECK(ee_dtable.getDisplRow(1)[0][1] == Approx(0.2));
537  CHECK(ee_dtable.getDisplRow(1)[0][2] == Approx(-0.1));
538  electrons.acceptMove(0);
539 
540  CHECK(ee_dtable.getDistRow(1)[0] == Approx(2.7239676944));
541  CHECK(ee_dtable.getDisplRow(1)[0][0] == Approx(-2.7));
542  CHECK(ee_dtable.getDisplRow(1)[0][1] == Approx(0.3));
543  CHECK(ee_dtable.getDisplRow(1)[0][2] == Approx(0.2));
544 
545  // revert previous move
546  electrons.makeMove(0, -disp);
547  electrons.acceptMove(0);
548 
549  // test forward mode
550  electrons.makeMove(0, disp);
551  electrons.accept_rejectMove(0, true, true);
552 
553  CHECK(ee_dtable.getDistRow(1)[0] == Approx(2.908607914));
554  CHECK(ee_dtable.getDisplRow(1)[0][0] == Approx(-2.9));
555  CHECK(ee_dtable.getDisplRow(1)[0][1] == Approx(0.2));
556  CHECK(ee_dtable.getDisplRow(1)[0][2] == Approx(-0.1));
557 
558  electrons.makeMove(1, disp);
559  electrons.accept_rejectMove(1, false, true);
560  CHECK(ee_dtable.getDistRow(1)[0] == Approx(2.7239676944));
561  CHECK(ee_dtable.getDisplRow(1)[0][0] == Approx(-2.7));
562  CHECK(ee_dtable.getDisplRow(1)[0][1] == Approx(0.3));
563  CHECK(ee_dtable.getDisplRow(1)[0][2] == Approx(0.2));
564 } // TEST_CASE distance_pbc_z
SimulationCell parse_pbc_lattice()
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void parse_electron_ion_pbc_z(ParticleSet &ions, ParticleSet &electrons)

◆ TEST_CASE() [495/537]

qmcplusplus::TEST_CASE ( "DiracDeterminant_delayed_update"  ,
""  [wavefunction][fermion] 
)

Definition at line 444 of file test_DiracDeterminant.cpp.

References ACCEL, and HOST.

445 {
446  test_DiracDeterminant_delayed_update<DiracDeterminant<>>(DetMatInvertor::HOST);
447  test_DiracDeterminant_delayed_update<DiracDeterminant<>>(DetMatInvertor::ACCEL);
448 #if defined(ENABLE_CUDA)
449  test_DiracDeterminant_delayed_update<DiracDeterminant<DelayedUpdateCUDA<ValueType, QMCTraits::QTFull::ValueType>>>(
450  DetMatInvertor::HOST);
451  test_DiracDeterminant_delayed_update<DiracDeterminant<DelayedUpdateCUDA<ValueType, QMCTraits::QTFull::ValueType>>>(
452  DetMatInvertor::ACCEL);
453 #elif defined(ENABLE_SYCL)
454  test_DiracDeterminant_delayed_update<DiracDeterminant<DelayedUpdateSYCL<ValueType, QMCTraits::QTFull::ValueType>>>(
455  DetMatInvertor::HOST);
456 #endif
457 }

◆ TEST_CASE() [496/537]

qmcplusplus::TEST_CASE ( "EinsplineSetBuilder CheckLattice"  ,
""  [wavefunction] 
)

Definition at line 458 of file test_einset.cpp.

References EinsplineSetBuilder::CheckLattice(), OHMMS::Controller, lattice, REQUIRE(), and EinsplineSetBuilder::SuperLattice.

459 {
461 
462  ParticleSet::ParticleLayout lattice;
463  lattice.R = 0.0;
464  lattice.R(0, 0) = 1.0;
465  lattice.R(1, 1) = 1.0;
466  lattice.R(2, 2) = 1.0;
467 
468  const SimulationCell simulation_cell(lattice);
469  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
470  auto& elec(*elec_ptr);
471 
472  elec.setName("elec");
473  std::vector<int> agroup(2);
474  agroup[0] = 1;
475  agroup[1] = 1;
476  elec.create(agroup);
477  elec.R[0] = {0.0, 0.0, 0.0};
478  elec.R[1] = {0.0, 1.0, 0.0};
479 
480  EinsplineSetBuilder::PSetMap ptcl_map;
481  ptcl_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
482 
483  xmlNodePtr cur = NULL;
484  EinsplineSetBuilder esb(elec, ptcl_map, c, cur);
485 
486  esb.SuperLattice = 0.0;
487  esb.SuperLattice(0, 0) = 1.0;
488  esb.SuperLattice(1, 1) = 1.0;
489  esb.SuperLattice(2, 2) = 1.0;
490 
491  REQUIRE(esb.CheckLattice());
492 
493  esb.SuperLattice(0, 0) = 1.1;
494  REQUIRE_FALSE(esb.CheckLattice());
495 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))

◆ TEST_CASE() [497/537]

qmcplusplus::TEST_CASE ( "cuBLAS_LU::getri_batched"  ,
""  [wavefunction][CUDA] 
)

Definition at line 460 of file test_cuBLAS_LU.cpp.

References qmcplusplus::Units::distance::A, B(), batch_size, CHECK(), check_matrix_result, checkArray, CHECKED_ELSE(), checkMatrix(), qmcplusplus::cuBLAS_LU::computeGetri_batched(), cudaErrorCheck(), cudaMemcpyAsync, cudaMemcpyDeviceToHost, cudaMemcpyHostToDevice, cudaStreamSynchronize, dev_infos(), dev_pivots(), devM_vec(), devMs(), hstream, infos(), lda, M_vec, Ms, n, and pivots.

461 {
462  auto cuda_handles = std::make_unique<testing::CUDAHandles>();
463  int n = 4;
464  int lda = 4;
465  auto& hstream = cuda_handles->hstream;
466  int batch_size = 1;
467 
468  // clang-format off
469  std::vector<double, CUDAHostAllocator<double>> M_vec{7., 0.28571429, 0.71428571, 0.71428571,
470  5., 3.57142857, 0.12, -0.44,
471  6., 6.28571429, -1.04, -0.46153846,
472  6., 5.28571429, 3.08, 7.46153846};
473  std::vector<double, CUDAAllocator<double>> devM_vec(M_vec.size());
474 
475  std::vector<double*, CUDAHostAllocator<double*>> Ms{devM_vec.data()};
476  std::vector<double*, CUDAAllocator<double*>> devMs(Ms.size());
477 
478  std::vector<double, CUDAHostAllocator<double>> invM_vec{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
479  std::vector<double, CUDAHostAllocator<double>> dev_invM_vec(invM_vec.size());
480 
481  std::vector<double*, CUDAHostAllocator<double*>> invMs{dev_invM_vec.data()};
482  std::vector<double*, CUDAAllocator<double*>> dev_invMs(invMs.size());
483 
484  std::vector<int, CUDAHostAllocator<int>> pivots{3, 3, 4, 4};
485  std::vector<int, CUDAAllocator<int>> dev_pivots(pivots.size());
486 
487  std::vector<int, CUDAHostAllocator<int>> infos(4, 1.0);
488  std::vector<int, CUDAAllocator<int>> dev_infos(pivots.size());
489 
490  cudaErrorCheck(cudaMemcpyAsync(devM_vec.data(), M_vec.data(), sizeof(decltype(M_vec)::value_type) * M_vec.size(), cudaMemcpyHostToDevice, hstream),
491  "cudaMemcpyAsync failed copying M to device");
492  cudaErrorCheck(cudaMemcpyAsync(devMs.data(), Ms.data(), sizeof(double*), cudaMemcpyHostToDevice, hstream),
493  "cudaMemcpyAsync failed copying Ms to device");
494  cudaErrorCheck(cudaMemcpyAsync(dev_invMs.data(), invMs.data(), sizeof(double*), cudaMemcpyHostToDevice, hstream),
495  "cudaMemcpyAsync failed copying invMs to device");
497  "cudaMemcpyAsync failed copying pivots to device");
498  cuBLAS_LU::computeGetri_batched(cuda_handles->h_cublas, cuda_handles->hstream, n, lda, devMs.data(), invMs.data(), dev_pivots.data(), infos.data(), dev_infos.data(), batch_size);
499 
500  cudaErrorCheck(cudaMemcpyAsync(invM_vec.data(), dev_invM_vec.data(), sizeof(double) * 16, cudaMemcpyDeviceToHost, hstream),
501  "cudaMemcpyAsync failed copying invM from device");
502  cudaErrorCheck(cudaMemcpyAsync(infos.data(), dev_infos.data(), sizeof(int) * 4, cudaMemcpyDeviceToHost, hstream),
503  "cudaMemcpyAsync failed copying infos from device");
504  cudaErrorCheck(cudaStreamSynchronize(hstream), "cudaStreamSynchronize failed!");
505 
506  // clang-format off
507  std::vector<double> invA{-0.08247423, -0.26804124, 0.26804124, 0.05154639,
508  0.18556701, -0.89690722, 0.39690722, 0.13402062,
509  0.24742268, -0.19587629, 0.19587629, -0.15463918,
510  -0.29896907, 1.27835052, -0.77835052, 0.06185567};
511  // clang-format on
512 
513  auto checkArray = [](auto A, auto B, int n) {
514  for (int i = 0; i < n; ++i)
515  {
516  CHECK(A[i] == Approx(B[i]));
517  }
518  };
519 
520  testing::MatrixAccessor<double> invA_mat(invA.data(), 4, 4);
521  testing::MatrixAccessor<double> invM_mat(invM_vec.data(), 4, 4);
522 
523  auto check_matrix_result = checkMatrix(invA_mat, invM_mat);
524  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
525 }
#define cudaErrorCheck(ans, cause)
Definition: CUDAerror.h:21
CHECK(log_values[1]==ComplexApprox(std::complex< double >{ 5.531331998282581, -8.805487075984523 }))
CHECKED_ELSE(check_matrix_result.result)
std::vector< double *, CUDAAllocator< double * > > devMs(Ms.size())
auto check_matrix_result
std::vector< int, CUDAAllocator< int > > dev_infos(pivots.size())
std::vector< double, CUDAHostAllocator< double > > M_vec
std::vector< int, CUDAHostAllocator< int > > pivots(8, -1.0)
std::vector< int, CUDAHostAllocator< int > > infos(8, 1.0)
#define cudaMemcpyDeviceToHost
Definition: cuda2hip.h:138
std::vector< double *, CUDAHostAllocator< double * > > Ms
#define cudaStreamSynchronize
Definition: cuda2hip.h:152
#define cudaMemcpyHostToDevice
Definition: cuda2hip.h:139
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
checkArray(real_pivot, pivots, 8)
double B(double x, int k, int i, const std::vector< double > &t)
std::vector< int, CUDAAllocator< int > > dev_pivots(pivots.size())
QMCTraits::FullPrecRealType value_type
void computeGetri_batched(cublasHandle_t &h_cublas, cudaStream_t &hstream, const int n, const int lda, T *Ms[], T *Cs[], int *pivots, int *host_infos, int *infos, const int batch_size)
std::vector< double, CUDAAllocator< double > > devM_vec(M_vec.size())
#define cudaMemcpyAsync
Definition: cuda2hip.h:136

◆ TEST_CASE() [498/537]

qmcplusplus::TEST_CASE ( "mw_evaluate Numerical EtOH"  ,
""  [wavefunction] 
)

Definition at line 462 of file test_MO.cpp.

References test_EtOH_mw().

462 { test_EtOH_mw(true); }
void test_EtOH_mw(bool transform)
Definition: test_MO.cpp:285

◆ TEST_CASE() [499/537]

qmcplusplus::TEST_CASE ( "mw_evaluate GTO EtOH"  ,
""  [wavefunction] 
)

Definition at line 463 of file test_MO.cpp.

References test_EtOH_mw().

463 { test_EtOH_mw(false); }
void test_EtOH_mw(bool transform)
Definition: test_MO.cpp:285

◆ TEST_CASE() [500/537]

qmcplusplus::TEST_CASE ( "InputSection::custom"  ,
""  [estimators] 
)

Definition at line 470 of file test_InputSection.cpp.

References CHECK(), doc, InputSection::get(), Libxml2Document::getRoot(), okay, Libxml2Document::parseFromString(), InputSection::readXML(), and CustomTestInput::report().

471 {
472  std::string_view xml = R"XML(
473 <test name="alice" samples="10" kmax="3.0" full="no" custom_attribute="for the section">
474  <parameter name="label" > relative </parameter>
475  <parameter name="count" > 15 </parameter>
476  <weird_stuff name="weird"> XQ 10 20 10 </weird_stuff>
477  <Repeater> first:something </Repeater>
478  <Repeater> second:else </Repeater>
479  <parameter name="with_custom" custom_attribute="This is a custom attribute."/>
480 </test>
481 )XML";
482 
484  bool okay = doc.parseFromString(xml);
485  xmlNodePtr cur = doc.getRoot();
486  CustomTestInput cti;
487  cti.readXML(cur);
488 
489  auto ws = cti.get<decltype(cti)::WeirdStuff>("weird");
490  CHECK(ws.letters == "XQ");
491  std::array<int, 3> exp_numbers{10, 20, 10};
492  CHECK(ws.numbers == exp_numbers);
493 
494  cti.report(std::cout);
495  std::string custom_attribute = cti.get<std::string>("with_custom::custom_attribute");
496  CHECK(custom_attribute == "This is a custom attribute.");
497  custom_attribute = cti.get<std::string>("custom_attribute");
498  CHECK(custom_attribute == "for the section");
499 
500  auto repeater = cti.get<decltype(cti)::Repeater>("repeater");
501  decltype(cti)::Repeater exp_repeater{{"first", "something"}, {"second", "else"}};
502  CHECK(repeater == exp_repeater);
503 
504  FailCustomTestInput fcti;
505  CHECK_THROWS_AS(fcti.readXML(cur), std::runtime_error);
506 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [501/537]

qmcplusplus::TEST_CASE ( "OneBodyDensityMatrices::evaluateMatrix"  ,
""  [estimators] 
)

Definition at line 472 of file test_OneBodyDensityMatrices.cpp.

References ProjectData::BATCH, comm, OHMMS::Controller, doc, dump_obdm, OneBodyDensityMatricesTests< T >::dumpData(), OneBodyDensityMatricesInput::get_integrator(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), StdRandom< T >::init(), OneBodyDensityMatricesInput::lookup_input_enum_value, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), node, obdmi, okay, Libxml2Document::parseFromString(), particle_pool, pset_target, InputSection::reverseLookupInputEnumMap(), species_set, spomap, test_project, OneBodyDensityMatricesTests< T >::testEvaluateMatrix(), walker, and wavefunction_pool.

473 {
474  using Input = testing::ValidOneBodyDensityMatricesInput;
476 
477  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
479 
480  for (auto valid_integrator :
481  std::vector<Input::valid>{Input::valid::VANILLA, Input::valid::SCALE, Input::valid::GRID})
482  {
484  bool okay = doc.parseFromString(Input::xml[valid_integrator]);
485  if (!okay)
486  throw std::runtime_error("cannot parse OneBodyDensitMatricesInput section");
487  xmlNodePtr node = doc.getRoot();
488  OneBodyDensityMatricesInput obdmi(node);
489 
490  std::string integrator_str =
491  InputSection::reverseLookupInputEnumMap(obdmi.get_integrator(), testing::OBDMI::lookup_input_enum_value);
492  std::cout << "Test evaluateMatrix for: " << integrator_str << '\n';
493 
494  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
495  auto wavefunction_pool =
496  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
497  auto& spomap = wavefunction_pool.getWaveFunction("wavefunction")->getSPOMap();
498  auto& pset_target = *(particle_pool.getParticleSet("e"));
499  auto& species_set = pset_target.getSpeciesSet();
500  OneBodyDensityMatrices obdm(std::move(obdmi), pset_target.getLattice(), species_set, spomap, pset_target);
501  auto& trial_wavefunction = *(wavefunction_pool.getPrimary());
502 
503  // Because we can't control or consistent know the global random state we must initialize particle positions to known values.
504  pset_target.R = ParticleSet::ParticlePos{
505  {4.120557308, 2.547962427, 2.11555481}, {2.545657158, 2.021627665, 3.17555666},
506  {1.251996636, 1.867651463, 0.7268046737}, {4.749059677, 5.845647812, 3.871560574},
507  {5.18129015, 4.168475151, 2.748870373}, {6.24560833, 4.087143421, 4.187825203},
508  {3.173382998, 3.651777267, 2.970916748}, {1.576967478, 2.874752045, 3.687536716},
509  };
510 
511  StdRandom<OneBodyDensityMatrices::FullPrecRealType> rng;
512  rng.init(101);
514  // Now we have to bring the pset, trial_wavefunction and walker to valid state.
515  //pset.loadWalker(walker, false);
516  pset_target.update(true);
517  pset_target.donePbyP();
518  trial_wavefunction.evaluateLog(pset_target);
519  pset_target.saveWalker(walker);
520  testing::OneBodyDensityMatricesTests<QMCTraits::FullPrecRealType> obdmt;
521  obdmt.testEvaluateMatrix(obdm, pset_target, trial_wavefunction, walker, rng);
522  if constexpr (dump_obdm)
523  obdmt.dumpData(obdm);
524  }
525 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
std::unordered_map< std::string, std::any > lookup_input_enum_value
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
OneBodyDensityMatricesInput obdmi(node)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker
Definition: test_walker.cpp:31

◆ TEST_CASE() [502/537]

qmcplusplus::TEST_CASE ( "Rotated LCAO  WF1,
MO coeff  rotated,
zero angle"  ,
""  [qmcapp] 
)

Definition at line 475 of file test_RotatedSPOs_LCAO.cpp.

References ProjectData::BATCH, CHECK(), TrialWaveFunction::checkInVariables(), TrialWaveFunction::checkOutVariables(), coeff_rot_by_point1, coeff_rot_by_point2, OHMMS::Controller, doc, TrialWaveFunction::evaluateDerivatives(), TrialWaveFunction::evaluateLog(), ParticleSet::G, TrialWaveFunction::getOrbitals(), ParticleSetPool::getParticleSet(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), ParticleSet::L, okay, Libxml2Document::parseFromString(), REQUIRE(), TrialWaveFunction::resetParameters(), setupParticleSetPool(), setupRotationXML(), test_project, and ParticleSet::update().

476 {
477  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
478  Communicate* c;
479  c = OHMMS::Controller;
480 
481  ParticleSetPool pp(c);
483 
484  WaveFunctionPool wp(test_project.getRuntimeOptions(), pp, c);
485 
486  REQUIRE(wp.empty() == true);
487 
488  std::string wf_input = setupRotationXML("", "", coeff_rot_by_point1, coeff_rot_by_point2);
489 
491  bool okay = doc.parseFromString(wf_input);
492  REQUIRE(okay);
493 
494  xmlNodePtr root = doc.getRoot();
495 
496  wp.put(root);
497 
498  TrialWaveFunction* psi = wp.getWaveFunction("psi0");
499  REQUIRE(psi != nullptr);
500  REQUIRE(psi->getOrbitals().size() == 1);
501 
502  opt_variables_type opt_vars;
503  psi->checkInVariables(opt_vars);
504  opt_vars.resetIndex();
505  psi->checkOutVariables(opt_vars);
506  psi->resetParameters(opt_vars);
507 
508  ParticleSet* elec = pp.getParticleSet("e");
509  elec->update();
510 
511  double logval = psi->evaluateLog(*elec);
512  CHECK(logval == Approx(-9.26625670653773));
513 
514  CHECK(elec->G[0][0] == ValueApprox(-0.2758747113720909));
515  CHECK(elec->L[0] == ValueApprox(-0.316459652026054));
516  CHECK(elec->L[1] == ValueApprox(-0.6035591598540904));
517 
519  Vector<ValueType> dlogpsi(2);
520  Vector<ValueType> dhpsioverpsi(2);
521  psi->evaluateDerivatives(*elec, opt_vars, dlogpsi, dhpsioverpsi);
522 
523 
524  CHECK(dlogpsi[0] == ValueApprox(7.58753078998516));
525  CHECK(dlogpsi[1] == ValueApprox(2.58896036829191));
526  CHECK(dhpsioverpsi[0] == ValueApprox(2.59551625714144));
527  CHECK(dhpsioverpsi[1] == ValueApprox(1.70071425070404));
528 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
void resetIndex()
reset Index
const std::string coeff_rot_by_point1
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
const std::string coeff_rot_by_point2
REQUIRE(std::filesystem::exists(filename))
void setupParticleSetPool(ParticleSetPool &pp)
optimize::VariableSet opt_variables_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType
std::string setupRotationXML(const std::string &rot_angle_up, const std::string &rot_angle_down, const std::string &coeff_up, const std::string &coeff_down)

◆ TEST_CASE() [503/537]

qmcplusplus::TEST_CASE ( "DiracDeterminantBatched_delayed_update"  ,
""  [wavefunction][fermion] 
)

Definition at line 477 of file test_DiracDeterminantBatched.cpp.

References ACCEL, and HOST.

478 {
479  // maximum delay 2
480 #if defined(ENABLE_OFFLOAD) && defined(ENABLE_CUDA)
481  test_DiracDeterminantBatched_delayed_update<PlatformKind::CUDA>(2, DetMatInvertor::ACCEL);
482  test_DiracDeterminantBatched_delayed_update<PlatformKind::CUDA>(2, DetMatInvertor::HOST);
483 #endif
484 #if defined(ENABLE_OFFLOAD) && defined(ENABLE_SYCL)
485  //test_DiracDeterminantBatched_delayed_update<PlatformKind::SYCL>(2, DetMatInvertor::ACCEL);
486  test_DiracDeterminantBatched_delayed_update<PlatformKind::SYCL>(2, DetMatInvertor::HOST);
487 #endif
488  test_DiracDeterminantBatched_delayed_update<PlatformKind::OMPTARGET>(2, DetMatInvertor::ACCEL);
489  test_DiracDeterminantBatched_delayed_update<PlatformKind::OMPTARGET>(2, DetMatInvertor::HOST);
490 }

◆ TEST_CASE() [504/537]

qmcplusplus::TEST_CASE ( "RotatedSPOs exp-log matrix"  ,
""  [wavefunction] 
)

Definition at line 497 of file test_RotatedSPOs.cpp.

References CHECK(), CHECKED_ELSE(), checkMatrix(), RotatedSPOs::constructAntiSymmetricMatrix(), RotatedSPOs::createRotationIndices(), RotatedSPOs::exponentiate_antisym_matrix(), RotatedSPOs::extractParamsFromAntiSymmetricMatrix(), RotatedSPOs::log_antisym_matrix(), CheckMatrixResult::result, and CheckMatrixResult::result_message.

498 {
500  using ValueMatrix = SPOSet::ValueMatrix;
501 
502  RotatedSPOs::RotationIndices rot_ind;
503  int nel = 2;
504  int nmo = 4;
505  RotatedSPOs::createRotationIndices(nel, nmo, rot_ind);
506 
507  ValueMatrix rot_m4(nmo, nmo);
508  rot_m4 = ValueType(0);
509 
510  std::vector<ValueType> params4 = {-1.1, 1.5, 0.2, -0.15};
511 
512  RotatedSPOs::constructAntiSymmetricMatrix(rot_ind, params4, rot_m4);
513  ValueMatrix orig_rot_m4 = rot_m4;
514  ValueMatrix out_m4(nmo, nmo);
515 
516  RotatedSPOs::exponentiate_antisym_matrix(rot_m4);
517 
518  RotatedSPOs::log_antisym_matrix(rot_m4, out_m4);
519 
520  CheckMatrixResult check_matrix_result4 = checkMatrix(out_m4, orig_rot_m4, true);
521  CHECKED_ELSE(check_matrix_result4.result) { FAIL(check_matrix_result4.result_message); }
522 
523  std::vector<ValueType> params4out(4);
524  RotatedSPOs::extractParamsFromAntiSymmetricMatrix(rot_ind, out_m4, params4out);
525  for (int i = 0; i < params4.size(); i++)
526  {
527  CHECK(std::real(params4[i]) == Approx(std::real(params4out[i])));
528  }
529 
530 #ifdef QMC_COMPLEX
531  ValueMatrix rot_m4_cmplx(nmo, nmo);
532  rot_m4_cmplx = ValueType(0);
533 
534  //We have to be careful with the size of the components here. Exponentiate has
535  //a nice modulo 2pi property in it, and so log(A) is not uniquely defined without
536  //specifying a branch in the complex plane. Verified that the exp() and log() are one-to-one
537  //in this little regime.
538  std::vector<ValueType> params4_cmplx = {ValueType(-1.1, 0.3), ValueType(0.5, -0.2), ValueType(0.2, 1.1),
539  ValueType(-0.15, -.3)};
540 
541  RotatedSPOs::constructAntiSymmetricMatrix(rot_ind, params4_cmplx, rot_m4_cmplx);
542  ValueMatrix orig_rot_m4_cmplx = rot_m4_cmplx;
543  ValueMatrix out_m4_cmplx(nmo, nmo);
544 
545  RotatedSPOs::exponentiate_antisym_matrix(rot_m4_cmplx);
546  RotatedSPOs::log_antisym_matrix(rot_m4_cmplx, out_m4_cmplx);
547  CheckMatrixResult check_matrix_result5 = checkMatrix(out_m4_cmplx, orig_rot_m4_cmplx, true);
548  CHECKED_ELSE(check_matrix_result5.result) { FAIL(check_matrix_result5.result_message); }
549 
550  std::vector<ValueType> params4out_cmplx(4);
551  RotatedSPOs::extractParamsFromAntiSymmetricMatrix(rot_ind, out_m4_cmplx, params4out_cmplx);
552  for (int i = 0; i < params4_cmplx.size(); i++)
553  {
554  CHECK(params4_cmplx[i] == ValueApprox(params4out_cmplx[i]));
555  }
556 
557 
558 #endif
559 }
QMCTraits::RealType real
CHECKED_ELSE(check_matrix_result.result)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [505/537]

qmcplusplus::TEST_CASE ( "Eloc_Derivatives:multislater_noj"  ,
""  [hamiltonian] 
)

Definition at line 500 of file test_ion_derivs.cpp.

References app_log(), WaveFunctionFactory::buildTWF(), CHECK(), OHMMS::Controller, convertToReal(), create_CN_Hamiltonian(), create_CN_particlesets(), qmcplusplus::Units::charge::e, TrialWaveFunction::evalGradSource(), QMCHamiltonian::evaluateDeterministic(), TrialWaveFunction::evaluateLog(), QMCHamiltonian::getObservable(), QMCHamiltonian::getObservableName(), Libxml2Document::getRoot(), ham, Libxml2Document::parse(), REQUIRE(), Vector< T, Alloc >::resize(), and QMCHamiltonian::sizeOfObservables().

500  :multislater_noj", "[hamiltonian]")
501 {
502  app_log() << "====Ion Derivative Test: Multislater No Jastrow====\n";
503  using RealType = QMCTraits::RealType;
504 
505  Communicate* c = OHMMS::Controller;
506 
507  const SimulationCell simulation_cell;
508  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
509  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
510  auto &ions(*ions_ptr), elec(*elec_ptr);
511 
512  create_CN_particlesets(elec, ions);
513 
514  int Nions = ions.getTotalNum();
515  int Nelec = elec.getTotalNum();
516 
517  HamiltonianFactory::PSetMap particle_set_map;
518  particle_set_map.emplace("e", std::move(elec_ptr));
519  particle_set_map.emplace("ion0", std::move(ions_ptr));
520 
521  WaveFunctionFactory wff(elec, particle_set_map, c);
522 
523  Libxml2Document wfdoc;
524  bool wfokay = wfdoc.parse("cn.msd-wfnoj.xml");
525  REQUIRE(wfokay);
526 
527  RuntimeOptions runtime_options;
528  xmlNodePtr wfroot = wfdoc.getRoot();
529  HamiltonianFactory::PsiPoolType psi_map;
530  psi_map.emplace("psi0", wff.buildTWF(wfroot, runtime_options));
531 
532  TrialWaveFunction* psi = psi_map["psi0"].get();
533  REQUIRE(psi != nullptr);
534 
535  HamiltonianFactory hf("h0", elec, particle_set_map, psi_map, c);
536 
537  //Output of WFTester Eloc test for this ion/electron configuration.
538  //Logpsi: (-1.411499619826623686e+01,0.000000000000000000e+00)
539  //HamTest Total -1.597690575658561407e+01
540  //HamTest Kinetic 1.053500867576629574e+01
541  //HamTest ElecElec 1.901556057075800865e+01
542  //HamTest IonIon 9.621404531608845900e+00
543  //HamTest LocalECP -6.783942829945100073e+01
544  //HamTest NonLocalECP 1.269054876473223636e+01
545 
546  RealType logpsi = psi->evaluateLog(elec);
547  CHECK(logpsi == Approx(-1.41149961982e+01));
548 
549  QMCHamiltonian& ham = create_CN_Hamiltonian(hf);
550 
551  RealType eloc = ham.evaluateDeterministic(elec);
552  enum observ_id
553  {
554  KINETIC = 0,
555  LOCALECP,
556  NONLOCALECP,
557  ELECELEC,
558  IONION
559  };
560  CHECK(eloc == Approx(-1.59769057565e+01));
561  CHECK(ham.getObservable(ELECELEC) == Approx(1.90155605707e+01));
562  CHECK(ham.getObservable(IONION) == Approx(9.62140453161e+00));
563  CHECK(ham.getObservable(LOCALECP) == Approx(-6.78394282995e+01));
564  CHECK(ham.getObservable(KINETIC) == Approx(1.05350086757e+01));
565  CHECK(ham.getObservable(NONLOCALECP) == Approx(1.26905487647e+01));
566 
567  for (int i = 0; i < ham.sizeOfObservables(); i++)
568  app_log() << " HamTest " << ham.getObservableName(i) << " " << ham.getObservable(i) << std::endl;
569 
570  //Now for the derivative tests
571  ParticleSet::ParticleGradient wfgradraw;
572  ParticleSet::ParticlePos hf_term;
573  ParticleSet::ParticlePos pulay_term;
574  ParticleSet::ParticlePos wf_grad;
575 
576  wfgradraw.resize(Nions);
577  wf_grad.resize(Nions);
578  hf_term.resize(Nions);
579  pulay_term.resize(Nions);
580 
581  wfgradraw[0] = psi->evalGradSource(elec, ions, 0); //On the C atom.
582  wfgradraw[1] = psi->evalGradSource(elec, ions, 1); //On the N atom.
583 
584  convertToReal(wfgradraw[0], wf_grad[0]);
585  convertToReal(wfgradraw[1], wf_grad[1]);
586 
587  //This is not implemented yet. Uncomment to perform check after implementation.
588  //Reference from finite differences on this configuration.
589  /* CHECK( wf_grad[0][0] == Approx(-1.7045200053189544));
590  CHECK( wf_grad[0][1] == Approx( 2.6980932676501368));
591  CHECK( wf_grad[0][2] == Approx( 6.5358393587011667));
592  CHECK( wf_grad[1][0] == Approx( 1.6322817486980055));
593  CHECK( wf_grad[1][1] == Approx( 0.0091648450606385));
594  CHECK( wf_grad[1][2] == Approx( 0.1031883398283639)); */
595 
596 
597  //This is not implemented yet. Uncomment to perform check after implementation.
598  //Kinetic Force
599  /* hf_term=0.0;
600  pulay_term=0.0;
601  (ham.getHamiltonian(KINETIC))->evaluateWithIonDerivsDeterministic(elec, ions, *psi, hf_term, pulay_term);
602 #if defined(MIXED_PRECISION)
603  CHECK( hf_term[0][0]+pulay_term[0][0] == Approx( 7.4631825180304636).epsilon(1e-4));
604  CHECK( hf_term[0][1]+pulay_term[0][1] == Approx( 26.0975954772035799).epsilon(1e-4));
605  CHECK( hf_term[0][2]+pulay_term[0][2] == Approx( 90.1646424427582218).epsilon(1e-4));
606  CHECK( hf_term[1][0]+pulay_term[1][0] == Approx( 3.8414153131327562).epsilon(1e-4));
607  CHECK( hf_term[1][1]+pulay_term[1][1] == Approx(-2.3504392874684754).epsilon(1e-4));
608  CHECK( hf_term[1][2]+pulay_term[1][2] == Approx( 4.7454048248241065) .epsilon(1e-4));
609 #else
610  CHECK( hf_term[0][0]+pulay_term[0][0] == Approx( 7.4631825180304636));
611  CHECK( hf_term[0][1]+pulay_term[0][1] == Approx( 26.0975954772035799));
612  CHECK( hf_term[0][2]+pulay_term[0][2] == Approx( 90.1646424427582218));
613  CHECK( hf_term[1][0]+pulay_term[1][0] == Approx( 3.8414153131327562));
614  CHECK( hf_term[1][1]+pulay_term[1][1] == Approx(-2.3504392874684754));
615  CHECK( hf_term[1][2]+pulay_term[1][2] == Approx( 4.7454048248241065));
616 #endif */
617  //This is not implemented yet. Uncomment to perform check after implementation.
618  //NLPP Force
619  /* hf_term=0.0;
620  pulay_term=0.0;
621  double val=(ham.getHamiltonian(NONLOCALECP))->evaluateWithIonDerivsDeterministic(elec, ions, *psi, hf_term, pulay_term);
622 #if defined(MIXED_PRECISION)
623  CHECK( hf_term[0][0]+pulay_term[0][0] == Approx( 18.9414437404167302).epsilon(2e-4));
624  CHECK( hf_term[0][1]+pulay_term[0][1] == Approx(-42.9017371899931277).epsilon(2e-4));
625  CHECK( hf_term[0][2]+pulay_term[0][2] == Approx(-78.3304792483008328).epsilon(2e-4));
626  CHECK( hf_term[1][0]+pulay_term[1][0] == Approx( 1.2122162598160457).epsilon(2e-4));
627  CHECK( hf_term[1][1]+pulay_term[1][1] == Approx(-0.6163169101291999).epsilon(2e-4));
628  CHECK( hf_term[1][2]+pulay_term[1][2] == Approx(-3.2996553033015625).epsilon(2e-4));
629 #else
630  CHECK( hf_term[0][0]+pulay_term[0][0] == Approx( 18.9414437404167302));
631  CHECK( hf_term[0][1]+pulay_term[0][1] == Approx(-42.9017371899931277));
632  CHECK( hf_term[0][2]+pulay_term[0][2] == Approx(-78.3304792483008328));
633  CHECK( hf_term[1][0]+pulay_term[1][0] == Approx( 1.2122162598160457));
634  CHECK( hf_term[1][1]+pulay_term[1][1] == Approx(-0.6163169101291999));
635  CHECK( hf_term[1][2]+pulay_term[1][2] == Approx(-3.2996553033015625));
636 #endif */
637 }

◆ TEST_CASE() [506/537]

qmcplusplus::TEST_CASE ( "OneBodyDensityMatrices::registerAndWrite"  ,
""  [estimators] 
)

Definition at line 527 of file test_OneBodyDensityMatrices.cpp.

References ProjectData::BATCH, comm, OHMMS::Controller, doc, OneBodyDensityMatricesInput::get_integrator(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), OneBodyDensityMatricesInput::lookup_input_enum_value, MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_diamondC_1x1x1(), node, obdmi, okay, Libxml2Document::parseFromString(), particle_pool, pset_target, InputSection::reverseLookupInputEnumMap(), species_set, spomap, test_project, OneBodyDensityMatricesTests< T >::testRegisterAndWrite(), and wavefunction_pool.

528 {
529  using Input = testing::ValidOneBodyDensityMatricesInput;
531 
532  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
534 
536  bool okay = doc.parseFromString(Input::xml[Input::valid::VANILLA]);
537  if (!okay)
538  throw std::runtime_error("cannot parse OneBodyDensitMatricesInput section");
539  xmlNodePtr node = doc.getRoot();
540  OneBodyDensityMatricesInput obdmi(node);
541 
542  std::string integrator_str =
543  InputSection::reverseLookupInputEnumMap(obdmi.get_integrator(), testing::OBDMI::lookup_input_enum_value);
544  std::cout << "Test registerAndWrite for: " << integrator_str << '\n';
545 
546  auto particle_pool = MinimalParticlePool::make_diamondC_1x1x1(comm);
547  auto wavefunction_pool =
548  MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool);
549  auto& spomap = wavefunction_pool.getWaveFunction("wavefunction")->getSPOMap();
550  auto& pset_target = *(particle_pool.getParticleSet("e"));
551  auto& species_set = pset_target.getSpeciesSet();
552  OneBodyDensityMatrices obdm(std::move(obdmi), pset_target.getLattice(), species_set, spomap, pset_target);
553 
554  testing::OneBodyDensityMatricesTests<QMCTraits::FullPrecRealType> obdmt;
555  obdmt.testRegisterAndWrite(obdm);
556 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
if(!okay) throw std xmlNodePtr node
std::unordered_map< std::string, std::any > lookup_input_enum_value
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
OneBodyDensityMatricesInput obdmi(node)
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
Walker< QMCTraits, PtclOnLatticeTraits > MCPWalker
Definition: test_walker.cpp:31

◆ TEST_CASE() [507/537]

qmcplusplus::TEST_CASE ( "ompBLAS ger"  ,
""  [OMP] 
)

Definition at line 531 of file test_ompBLAS.cpp.

References qmcplusplus::Units::force::N.

532 {
533  const int M = 137;
534  const int N = 79;
535  const int batch_count = 23;
536 
537  // Non-batched test
538  std::cout << "Testing ger" << std::endl;
539  test_ger<float>(M, N);
540  test_ger<double>(M, N);
541 #if defined(QMC_COMPLEX)
542  test_ger<std::complex<float>>(N, M);
543  test_ger<std::complex<double>>(N, M);
544 #endif
545  // Batched Test
546  std::cout << "Testing ger_batched" << std::endl;
547  test_ger_batched<float>(M, N, batch_count);
548  test_ger_batched<double>(M, N, batch_count);
549 #if defined(QMC_COMPLEX)
550  test_ger_batched<std::complex<float>>(N, M, batch_count);
551  test_ger_batched<std::complex<double>>(N, M, batch_count);
552 #endif
553 }

◆ TEST_CASE() [508/537]

qmcplusplus::TEST_CASE ( "Rotated LCAO WF1 MO coeff  rotated,
half angle"  ,
""  [qmcapp] 
)

Definition at line 539 of file test_RotatedSPOs_LCAO.cpp.

References ProjectData::BATCH, CHECK(), TrialWaveFunction::checkInVariables(), TrialWaveFunction::checkOutVariables(), coeff_rot_by_point05, coeff_rot_by_point1, OHMMS::Controller, doc, TrialWaveFunction::evaluateDerivatives(), TrialWaveFunction::evaluateLog(), ParticleSet::G, TrialWaveFunction::getOrbitals(), ParticleSetPool::getParticleSet(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), ParticleSet::L, okay, Libxml2Document::parseFromString(), REQUIRE(), TrialWaveFunction::resetParameters(), setupParticleSetPool(), setupRotationXML(), test_project, and ParticleSet::update().

540 {
541  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
542  Communicate* c;
543  c = OHMMS::Controller;
544 
545  ParticleSetPool pp(c);
547 
548  WaveFunctionPool wp(test_project.getRuntimeOptions(), pp, c);
549 
550  REQUIRE(wp.empty() == true);
551 
552  std::string wf_input = setupRotationXML("0.05", "0.1", coeff_rot_by_point05, coeff_rot_by_point1);
553 
555  bool okay = doc.parseFromString(wf_input);
556  REQUIRE(okay);
557 
558  xmlNodePtr root = doc.getRoot();
559 
560  wp.put(root);
561 
562  TrialWaveFunction* psi = wp.getWaveFunction("psi0");
563  REQUIRE(psi != nullptr);
564  REQUIRE(psi->getOrbitals().size() == 1);
565 
566  opt_variables_type opt_vars;
567  psi->checkInVariables(opt_vars);
568  opt_vars.resetIndex();
569  psi->checkOutVariables(opt_vars);
570  psi->resetParameters(opt_vars);
571 
572  ParticleSet* elec = pp.getParticleSet("e");
573  elec->update();
574 
575  double logval = psi->evaluateLog(*elec);
576  CHECK(logval == Approx(-9.26625670653773));
577 
578  CHECK(elec->G[0][0] == ValueApprox(-0.2758747113720909));
579  CHECK(elec->L[0] == ValueApprox(-0.316459652026054));
580  CHECK(elec->L[1] == ValueApprox(-0.6035591598540904));
581 
583  Vector<ValueType> dlogpsi(2);
584  Vector<ValueType> dhpsioverpsi(2);
585  psi->evaluateDerivatives(*elec, opt_vars, dlogpsi, dhpsioverpsi);
586 
587 
588  CHECK(dlogpsi[0] == ValueApprox(7.58753078998516));
589  CHECK(dlogpsi[1] == ValueApprox(2.58896036829191));
590  CHECK(dhpsioverpsi[0] == ValueApprox(2.59551625714144));
591  CHECK(dhpsioverpsi[1] == ValueApprox(1.70071425070404));
592 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
const std::string coeff_rot_by_point05
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
void resetIndex()
reset Index
const std::string coeff_rot_by_point1
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
void setupParticleSetPool(ParticleSetPool &pp)
optimize::VariableSet opt_variables_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType
std::string setupRotationXML(const std::string &rot_angle_up, const std::string &rot_angle_down, const std::string &coeff_up, const std::string &coeff_down)

◆ TEST_CASE() [509/537]

qmcplusplus::TEST_CASE ( "broadcastCuspInfo"  ,
""  [wavefunction] 
)

Definition at line 551 of file test_soa_cusp_corr.cpp.

References CuspCorrectionParameters::alpha, broadcastCuspInfo(), CuspCorrectionParameters::C, CHECK(), OHMMS::Controller, Communicate::rank(), CuspCorrectionParameters::Rc, CuspCorrectionParameters::redo, REQUIRE(), and CuspCorrectionParameters::sg.

552 {
554  CuspCorrectionParameters cp;
555  int root = 0;
556  if (c->rank() == root)
557  {
558  cp.Rc = 2.0;
559  cp.C = 3.0;
560  cp.sg = -1.0;
561  cp.alpha[0] = 1.1;
562  cp.alpha[1] = 1.2;
563  cp.alpha[2] = 1.3;
564  cp.alpha[3] = 1.4;
565  cp.alpha[4] = 1.5;
566  cp.redo = 1;
567  }
568 
569  broadcastCuspInfo(cp, *c, root);
570 
571  CHECK(cp.Rc == Approx(2.0));
572  CHECK(cp.C == Approx(3.0));
573  CHECK(cp.sg == Approx(-1.0));
574  CHECK(cp.alpha[0] == Approx(1.1));
575  CHECK(cp.alpha[1] == Approx(1.2));
576  CHECK(cp.alpha[2] == Approx(1.3));
577  CHECK(cp.alpha[3] == Approx(1.4));
578  CHECK(cp.alpha[4] == Approx(1.5));
579  REQUIRE(cp.redo == 1);
580 }
int rank() const
return the rank
Definition: Communicate.h:116
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
void broadcastCuspInfo(CuspCorrectionParameters &param, Communicate &Comm, int root)
Broadcast cusp correction parameters.
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [510/537]

qmcplusplus::TEST_CASE ( "RotatedSPOs hcpBe"  ,
""  [wavefunction] 
)

Definition at line 561 of file test_RotatedSPOs.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), CHECK(), OHMMS::Controller, ParticleSet::create(), EinsplineSetBuilder::createSPOSetFromXML(), doc, qmcplusplus::Units::charge::e, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), lattice, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), VariableSet::resetIndex(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), and Vector< T, Alloc >::size().

562 {
563  //until the parameter passing issue gets worked out, we won't do this test, since ostensibly
564  //theres a rotation coming from somewhere.
567 
568  ParticleSet::ParticleLayout lattice;
569  lattice.R = {4.32747284, 0.00000000, 0.00000000, -2.16373642, 3.74770142,
570  0.00000000, 0.00000000, 0.00000000, 6.78114995};
571 
572  ParticleSetPool ptcl = ParticleSetPool(c);
573  ptcl.setSimulationCell(lattice);
574  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
575  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
576  ParticleSet& ions(*ions_uptr);
577  ParticleSet& elec(*elec_uptr);
578 
579  ions.setName("ion");
580  ptcl.addParticleSet(std::move(ions_uptr));
581  ions.create({1});
582  ions.R[0] = {0.0, 0.0, 0.0};
583 
584  elec.setName("elec");
585  ptcl.addParticleSet(std::move(elec_uptr));
586  elec.create({1});
587  elec.R[0] = {0.0, 0.0, 0.0};
588 
589  SpeciesSet& tspecies = elec.getSpeciesSet();
590  int upIdx = tspecies.addSpecies("u");
591  int chargeIdx = tspecies.addAttribute("charge");
592  tspecies(chargeIdx, upIdx) = -1;
593 
594  // Add the attribute save_coefs="yes" to the sposet_builder tag to generate the
595  // spline file for use in eval_bspline_spo.py
596 
597  const char* particles = R"(<tmp>
598 <sposet_builder type="bspline" href="hcpBe.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.0" precision="double" gpu="no">
599  <sposet type="bspline" name="spo_ud" spindataset="0" size="2"/>
600 </sposet_builder>
601 </tmp>)";
602 
604  bool okay = doc.parseFromString(particles);
605  REQUIRE(okay);
606 
607  xmlNodePtr root = doc.getRoot();
608 
609  xmlNodePtr sposet_builder = xmlFirstElementChild(root);
610  xmlNodePtr sposet_ptr = xmlFirstElementChild(sposet_builder);
611 
612  EinsplineSetBuilder einSet(elec, ptcl.getPool(), c, sposet_builder);
613  auto spo = einSet.createSPOSetFromXML(sposet_ptr);
614  REQUIRE(spo);
615 
616  spo->storeParamsBeforeRotation();
617  auto rot_spo = std::make_unique<RotatedSPOs>("one_rotated_set", std::move(spo));
618 
619  // Sanity check for orbs. Expect 1 electron, 2 orbitals
620  const auto orbitalsetsize = rot_spo->getOrbitalSetSize();
621  REQUIRE(orbitalsetsize == 2);
622 
623  rot_spo->buildOptVariables(elec.R.size());
624 
625  SPOSet::ValueMatrix psiM_bare(elec.R.size(), orbitalsetsize);
626  SPOSet::GradMatrix dpsiM_bare(elec.R.size(), orbitalsetsize);
627  SPOSet::ValueMatrix d2psiM_bare(elec.R.size(), orbitalsetsize);
628  rot_spo->evaluate_notranspose(elec, 0, elec.R.size(), psiM_bare, dpsiM_bare, d2psiM_bare);
629 
630  // Values generated from eval_bspline_spo.py, the generate_point_values_hcpBe function
631  CHECK(std::real(psiM_bare[0][0]) == Approx(0.210221765375514));
632  CHECK(std::real(psiM_bare[0][1]) == Approx(-2.984345024542937e-06));
633 
634  CHECK(std::real(d2psiM_bare[0][0]) == Approx(5.303848362116568));
635 
636  opt_variables_type opt_vars;
637  rot_spo->checkInVariablesExclusive(opt_vars);
638  opt_vars.resetIndex();
639  rot_spo->checkOutVariables(opt_vars);
640  rot_spo->resetParametersExclusive(opt_vars);
641 
643  size_t dim = IsComplex_t<ValueType>::value ? 2 : 1;
644  Vector<ValueType> dlogpsi(dim);
645  Vector<ValueType> dhpsioverpsi(dim);
646  rot_spo->evaluateDerivatives(elec, opt_vars, dlogpsi, dhpsioverpsi, 0, 1);
647 
648  CHECK(std::real(dlogpsi[0]) == Approx(-1.41961753e-05));
649 #ifndef QMC_COMPLEX
650  //This one value is off by 8e-5 (real part) with a 1e-5 imaginary component. Not sure what's going on.
651  //Maybe stretched the "take the real part" assumption past its limit. Some testing is better than no
652  //testing.
653  CHECK(std::real(dhpsioverpsi[0]) == Approx(-0.00060853));
654 #endif
655 
656  std::vector<ValueType> params = {0.1};
657  rot_spo->apply_rotation(params, false);
658 
659  rot_spo->evaluate_notranspose(elec, 0, elec.R.size(), psiM_bare, dpsiM_bare, d2psiM_bare);
660  CHECK(std::real(psiM_bare[0][0]) == Approx(0.20917123424337608));
661  CHECK(std::real(psiM_bare[0][1]) == Approx(-0.02099012652669549));
662 
663  CHECK(std::real(d2psiM_bare[0][0]) == Approx(5.277362065087747));
664 
665  dlogpsi[0] = 0.0;
666  dhpsioverpsi[0] = 0.0;
667 
668  rot_spo->evaluateDerivatives(elec, opt_vars, dlogpsi, dhpsioverpsi, 0, 1);
669  CHECK(std::real(dlogpsi[0]) == Approx(-0.10034901119468914));
670  CHECK(std::real(dhpsioverpsi[0]) == Approx(32.96939041498753));
671 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
void resetIndex()
reset Index
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [511/537]

qmcplusplus::TEST_CASE ( "TrialWaveFunction_diamondC_2x1x1"  ,
""  [wavefunction] 
)

Definition at line 564 of file test_TrialWaveFunction_diamondC_2x1x1.cpp.

565 {
566  using VT = QMCTraits::ValueType;
567  using FPVT = QMCTraits::QTFull::ValueType;
568 
569 #if defined(ENABLE_CUDA) && defined(ENABLE_OFFLOAD)
570  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<CUDA>>")
571  {
572  using Det = DiracDeterminantBatched<PlatformKind::CUDA, VT, FPVT>;
573  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{false, false});
574  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{false, false});
575  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{false, false});
576  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{false, false});
577  }
578  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<CUDA>>_offload_spo")
579  {
580  using Det = DiracDeterminantBatched<PlatformKind::CUDA, VT, FPVT>;
581  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{true, false});
582  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{true, false});
583  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{true, false});
584  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{true, false});
585  }
586  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<CUDA>>_offload_jas")
587  {
588  using Det = DiracDeterminantBatched<PlatformKind::CUDA, VT, FPVT>;
589  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{false, true});
590  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{false, true});
591  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{false, true});
592  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{false, true});
593  }
594  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<CUDA>>_offload_spo_jas")
595  {
596  using Det = DiracDeterminantBatched<PlatformKind::CUDA, VT, FPVT>;
597  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{true, true});
598  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{true, true});
599  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{true, true});
600  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{true, true});
601  }
602 #endif
603 
604  // DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>
605  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>")
606  {
607  using Det = DiracDeterminantBatched<PlatformKind::OMPTARGET, VT, FPVT>;
608  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{false, false});
609  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{false, false});
610  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{false, false});
611  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{false, false});
612  }
613  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>_offload_spo")
614  {
615  using Det = DiracDeterminantBatched<PlatformKind::OMPTARGET, VT, FPVT>;
616  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{true, false});
617  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{true, false});
618  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{true, false});
619  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{true, false});
620  }
621  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>_offload_jas")
622  {
623  using Det = DiracDeterminantBatched<PlatformKind::OMPTARGET, VT, FPVT>;
624  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{false, true});
625  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{false, true});
626  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{false, true});
627  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{false, true});
628  }
629  SECTION("DiracDeterminantBatched<DelayedUpdateBatched<OMPTarget>>_offload_spo_jas")
630  {
631  using Det = DiracDeterminantBatched<PlatformKind::OMPTARGET, VT, FPVT>;
632  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{true, true});
633  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{true, true});
634  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{true, true});
635  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{true, true});
636  }
637 
638  // DiracDeterminant<DelayedUpdate>
639  SECTION("DiracDeterminant<DelayedUpdate>")
640  {
641  using Det = DiracDeterminant<DelayedUpdate<VT, FPVT>>;
642  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{false, false});
643  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{false, false});
644  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{false, false});
645  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{false, false});
646  }
647  SECTION("DiracDeterminant<DelayedUpdate>_offload_spo")
648  {
649  using Det = DiracDeterminant<DelayedUpdate<VT, FPVT>>;
650  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{true, false});
651  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{true, false});
652  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{true, false});
653  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{true, false});
654  }
655  SECTION("DiracDeterminant<DelayedUpdate>_offload_Jas")
656  {
657  using Det = DiracDeterminant<DelayedUpdate<VT, FPVT>>;
658  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{false, true});
659  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{false, true});
660  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{false, true});
661  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{false, true});
662  }
663  SECTION("DiracDeterminant<DelayedUpdate>_offload_spo_jas")
664  {
665  using Det = DiracDeterminant<DelayedUpdate<VT, FPVT>>;
666  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(1, OffloadSwitches{true, true});
667  testTrialWaveFunction_diamondC_2x1x1<Det, float_tag>(2, OffloadSwitches{true, true});
668  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(1, OffloadSwitches{true, true});
669  testTrialWaveFunction_diamondC_2x1x1<Det, double_tag>(2, OffloadSwitches{true, true});
670  }
671 }
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [512/537]

qmcplusplus::TEST_CASE ( "ReadMolecularOrbital GTO Ne"  ,
""  [wavefunction] 
)

Definition at line 589 of file test_MO.cpp.

References test_Ne().

589 { test_Ne(false); }
void test_Ne(bool transform)
Definition: test_MO.cpp:465

◆ TEST_CASE() [513/537]

qmcplusplus::TEST_CASE ( "ReadMolecularOrbital Numerical Ne"  ,
""  [wavefunction] 
)

Definition at line 591 of file test_MO.cpp.

References test_Ne().

591 { test_Ne(true); }
void test_Ne(bool transform)
Definition: test_MO.cpp:465

◆ TEST_CASE() [514/537]

qmcplusplus::TEST_CASE ( "ReadMolecularOrbital HCN"  ,
""  [wavefunction] 
)

Definition at line 593 of file test_MO.cpp.

593 {}

◆ TEST_CASE() [515/537]

qmcplusplus::TEST_CASE ( "InputSection::Delegate"  ,
""  [estimators] 
)

Definition at line 595 of file test_InputSection.cpp.

References CHECK(), doc, DelegatingInput::get(), Libxml2Document::getRoot(), DelegatingInput::has(), okay, Libxml2Document::parseFromString(), and REQUIRE().

596 {
597  std::string_view xml = R"XML(
598 <delegatetest name="alice" full="no">
599  <parameter name="label" > relative </parameter>
600  <parameter name="count" > 15 </parameter>
601  <AnotherInput name="ainput"> XQ 10 20 10 </AnotherInput>
602 </delegatetest>
603 )XML";
604 
606  bool okay = doc.parseFromString(xml);
607  REQUIRE(okay);
608  xmlNodePtr cur = doc.getRoot();
609 
610  DelegatingInput dti(cur);
611 
612  CHECK(dti.has("ainput"));
613  AnotherInput ai(dti.get<AnotherInput>("ainput"));
614  std::vector<std::string_view> ref_tokens{"XQ", "10", "20", "10"};
615  CHECK(ai.getTokens() == ref_tokens);
616 
617 
618  std::string_view xml_duplicate_delegate_name = R"XML(
619 <test name="alice" full="no">
620  <parameter name="label" > relative </parameter>
621  <parameter name="count" > 15 </parameter>
622  <AnotherInput name="ainput"> XQ 10 20 10 </AnotherInput>
623  <AnotherInput name="ainput"> XQ 10 20 10 </AnotherInput>
624 </test>
625 )XML";
626 
627  okay = doc.parseFromString(xml_duplicate_delegate_name);
628  REQUIRE(okay);
629  cur = doc.getRoot();
630 
631  CHECK_THROWS_AS(dti = DelegatingInput(cur), UniformCommunicateError);
632 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [516/537]

qmcplusplus::TEST_CASE ( "Rotated LCAO rotation consistency"  ,
""  [qmcapp] 
)

Definition at line 596 of file test_RotatedSPOs_LCAO.cpp.

References RotatedSPOs::apply_rotation(), RotatedSPOs::applyDeltaRotation(), ProjectData::BATCH, LCAOrbitalSet::C, CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), OHMMS::Controller, doc, TrialWaveFunction::getOrbitals(), SlaterDet::getPhi(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), okay, Libxml2Document::parseFromString(), RotatedSPOs::Phi_, REQUIRE(), CheckMatrixResult::result, CheckMatrixResult::result_message, setupParticleSetPool(), and test_project.

597 {
600  using ValueMatrix = SPOSet::ValueMatrix;
601 
602  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
603  Communicate* c;
604  c = OHMMS::Controller;
605 
606  ParticleSetPool pp(c);
608 
609  WaveFunctionPool wp(test_project.getRuntimeOptions(), pp, c);
610  REQUIRE(wp.empty() == true);
611 
612  // Only care that this wavefunction has 3 SPOs and a 3x3 coefficient matrix
613  const char* wf_input = R"(<wavefunction target='e'>
614 
615  <sposet_collection type="MolecularOrbital">
616  <!-- Use a single Slater Type Orbital (STO) for the basis. Cusp condition is correct. -->
617  <basisset keyword="STO" transform="no">
618  <atomicBasisSet type="STO" elementType="He" normalized="no">
619  <basisGroup rid="R0" l="0" m="0" type="Slater">
620  <radfunc n="1" exponent="2.0"/>
621  </basisGroup>
622  <basisGroup rid="R1" l="0" m="0" type="Slater">
623  <radfunc n="2" exponent="1.0"/>
624  </basisGroup>
625  <basisGroup rid="R2" l="0" m="0" type="Slater">
626  <radfunc n="3" exponent="1.0"/>
627  </basisGroup>
628  </atomicBasisSet>
629  </basisset>
630  <rotated_sposet name="rot-spo-up">
631  <sposet basisset="LCAOBSet" name="spo-up">
632  <coefficient id="updetC" type="Array" size="3">
633  1.0 0.0 0.0
634  0.0 1.0 0.0
635  0.0 0.0 1.0
636  </coefficient>
637  </sposet>
638  </rotated_sposet>
639  <rotated_sposet name="rot-spo-down">
640  <sposet basisset="LCAOBSet" name="spo-down">
641  <coefficient id="updetC" type="Array" size="3">
642  1.0 0.0 0.0
643  0.0 1.0 0.0
644  0.0 0.0 1.0
645  </coefficient>
646  </sposet>
647  </rotated_sposet>
648  </sposet_collection>
649  <determinantset type="MO" key="STO" transform="no" source="ion0">
650  <slaterdeterminant>
651  <determinant id="rot-spo-up"/>
652  <determinant id="rot-spo-down"/>
653  </slaterdeterminant>
654  </determinantset>
655  </wavefunction>)";
656 
658  bool okay = doc.parseFromString(wf_input);
659  REQUIRE(okay);
660 
661  xmlNodePtr root = doc.getRoot();
662 
663  wp.put(root);
664 
665  TrialWaveFunction* psi = wp.getWaveFunction("psi0");
666  REQUIRE(psi != nullptr);
667  REQUIRE(psi->getOrbitals().size() == 1);
668 
669  // Type should be pointer to SlaterDet
670  auto orb1 = psi->getOrbitals()[0].get();
671  SlaterDet* sdet = dynamic_cast<SlaterDet*>(orb1);
672  REQUIRE(sdet != nullptr);
673 
674  // Use the SPOs from different spins to separately track rotation applied using the stored coefficients
675  // versus the regular coefficients.
676  // The coefficient matrices should match after the same rotations are applied to each.
677  SPOSetPtr spoptr = sdet->getPhi(0);
678  RotatedSPOs* rot_spo = dynamic_cast<RotatedSPOs*>(spoptr);
679  REQUIRE(rot_spo != nullptr);
680 
681  SPOSetPtr spoptr1 = sdet->getPhi(1);
682  RotatedSPOs* global_rot_spo = dynamic_cast<RotatedSPOs*>(spoptr1);
683  REQUIRE(global_rot_spo != nullptr);
684 
685  std::vector<RealType> params1 = {0.1, 0.2};
686 
687  // Apply against the existing coefficients
688  rot_spo->apply_rotation(params1, false);
689 
690  // Apply against the stored coefficients
691  global_rot_spo->apply_rotation(params1, true);
692 
693  // Value after first rotation, computed from gen_matrix_ops.py
694  // clang-format off
695  std::vector<ValueType> rot_data0 =
696  { 0.975103993210479, 0.0991687475215628, 0.198337495043126,
697  -0.0991687475215628, 0.995020798642096, -0.00995840271580824,
698  -0.198337495043126, -0.00995840271580824, 0.980083194568384 };
699  // clang-format on
700 
701  ValueMatrix new_rot_m0(rot_data0.data(), 3, 3);
702 
703  LCAOrbitalSet* lcao1 = dynamic_cast<LCAOrbitalSet*>(rot_spo->Phi_.get());
704  LCAOrbitalSet* lcao_global = dynamic_cast<LCAOrbitalSet*>(global_rot_spo->Phi_.get());
705 
706  CheckMatrixResult check_matrix_result = checkMatrix(*lcao1->C, *lcao_global->C, true);
707  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
708 
709  CheckMatrixResult check_matrix_result0 = checkMatrix(*lcao_global->C, new_rot_m0, true);
710  CHECKED_ELSE(check_matrix_result0.result) { FAIL(check_matrix_result0.result_message); }
711 
712  std::vector<RealType> old_params = {0.0, 0.0, 0.0};
713  std::vector<RealType> new_params(3);
714  global_rot_spo->applyDeltaRotation(params1, old_params, new_params);
715 
716  std::vector<RealType> params2 = {0.3, 0.15};
717  rot_spo->apply_rotation(params2, false);
718 
719  std::vector<RealType> new_params2(3);
720  global_rot_spo->applyDeltaRotation(params2, new_params, new_params2);
721  CheckMatrixResult check_matrix_result2 = checkMatrix(*lcao1->C, *lcao_global->C, true);
722  CHECKED_ELSE(check_matrix_result2.result) { FAIL(check_matrix_result2.result_message); }
723 
724  // Value after two rotations, computed from gen_matrix_ops.py
725  // clang-format off
726  std::vector<ValueType> rot_data3 =
727  { 0.862374825309137, 0.38511734273482, 0.328624851461217,
728  -0.377403929117215, 0.921689108007811, -0.0897522281988318,
729  -0.337455085840952, -0.046624248032951, 0.940186281826872 };
730  // clang-format on
731 
732  ValueMatrix new_rot_m3(rot_data3.data(), 3, 3);
733 
734  CheckMatrixResult check_matrix_result3 = checkMatrix(*lcao1->C, new_rot_m3, true);
735  CHECKED_ELSE(check_matrix_result3.result) { FAIL(check_matrix_result3.result_message); }
736 
737  // Need to flip the sign on the first two entries to match the output from gen_matrix_ops.py
738  std::vector<ValueType> expected_param = {0.3998099017676912, 0.34924318065960236, -0.02261313113492491};
739  for (int i = 0; i < expected_param.size(); i++)
740  CHECK(new_params2[i] == Approx(expected_param[i]));
741 }
SPOSet * SPOSetPtr
Definition: SPOSet.h:573
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
CHECKED_ELSE(check_matrix_result.result)
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
auto check_matrix_result
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
void setupParticleSetPool(ParticleSetPool &pp)
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [517/537]

qmcplusplus::TEST_CASE ( "Eloc_Derivatives:multislater_wj"  ,
""  [hamiltonian] 
)

Definition at line 639 of file test_ion_derivs.cpp.

References app_log(), WaveFunctionFactory::buildTWF(), CHECK(), OHMMS::Controller, convertToReal(), create_CN_Hamiltonian(), create_CN_particlesets(), qmcplusplus::Units::charge::e, TrialWaveFunction::evalGradSource(), QMCHamiltonian::evaluateDeterministic(), TrialWaveFunction::evaluateLog(), QMCHamiltonian::getObservable(), QMCHamiltonian::getObservableName(), Libxml2Document::getRoot(), ham, Libxml2Document::parse(), REQUIRE(), Vector< T, Alloc >::resize(), and QMCHamiltonian::sizeOfObservables().

639  :multislater_wj", "[hamiltonian]")
640 {
641  app_log() << "====Ion Derivative Test: Multislater+Jastrow====\n";
642  using RealType = QMCTraits::RealType;
643 
644  Communicate* c = OHMMS::Controller;
645 
646  const SimulationCell simulation_cell;
647  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
648  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
649  auto &ions(*ions_ptr), elec(*elec_ptr);
650 
651  create_CN_particlesets(elec, ions);
652 
653  int Nions = ions.getTotalNum();
654  int Nelec = elec.getTotalNum();
655 
656  HamiltonianFactory::PSetMap particle_set_map;
657  particle_set_map.emplace("e", std::move(elec_ptr));
658  particle_set_map.emplace("ion0", std::move(ions_ptr));
659 
660  WaveFunctionFactory wff(elec, particle_set_map, c);
661 
662  Libxml2Document wfdoc;
663  bool wfokay = wfdoc.parse("cn.msd-wfj.xml");
664  REQUIRE(wfokay);
665 
666  RuntimeOptions runtime_options;
667  xmlNodePtr wfroot = wfdoc.getRoot();
668  HamiltonianFactory::PsiPoolType psi_map;
669  psi_map.emplace("psi0", wff.buildTWF(wfroot, runtime_options));
670 
671  TrialWaveFunction* psi = psi_map["psi0"].get();
672  REQUIRE(psi != nullptr);
673 
674  HamiltonianFactory hf("h0", elec, particle_set_map, psi_map, c);
675 
676  //Output of WFTester Eloc test for this ion/electron configuration.
677  //Logpsi: (-8.693299948465634586e+00,0.000000000000000000e+00)
678  //HamTest Total -1.752111246795173116e+01
679  //HamTest Kinetic 9.187721666379577101e+00
680  //HamTest ElecElec 1.901556057075800865e+01
681  //HamTest IonIon 9.621404531608845900e+00
682  //HamTest LocalECP -6.783942829945100073e+01
683  //HamTest NonLocalECP 1.249362906275283969e+01
684 
685 
686  RealType logpsi = psi->evaluateLog(elec);
687  CHECK(logpsi == Approx(-8.69329994846e+00));
688 
689  QMCHamiltonian& ham = create_CN_Hamiltonian(hf);
690 
691  RealType eloc = ham.evaluateDeterministic(elec);
692  enum observ_id
693  {
694  KINETIC = 0,
695  LOCALECP,
696  NONLOCALECP,
697  ELECELEC,
698  IONION
699  };
700  CHECK(eloc == Approx(-1.75211124679e+01));
701  CHECK(ham.getObservable(ELECELEC) == Approx(1.90155605707e+01));
702  CHECK(ham.getObservable(IONION) == Approx(9.62140453161e+00));
703  CHECK(ham.getObservable(LOCALECP) == Approx(-6.78394282995e+01));
704  CHECK(ham.getObservable(KINETIC) == Approx(9.18772166638e+00));
705  CHECK(ham.getObservable(NONLOCALECP) == Approx(1.24936290628e+01));
706 
707  for (int i = 0; i < ham.sizeOfObservables(); i++)
708  app_log() << " HamTest " << ham.getObservableName(i) << " " << ham.getObservable(i) << std::endl;
709 
710  //Now for the derivative tests
711  ParticleSet::ParticleGradient wfgradraw;
712  ParticleSet::ParticlePos hf_term;
713  ParticleSet::ParticlePos pulay_term;
714  ParticleSet::ParticlePos wf_grad;
715 
716  wfgradraw.resize(Nions);
717  wf_grad.resize(Nions);
718  hf_term.resize(Nions);
719  pulay_term.resize(Nions);
720 
721  wfgradraw[0] = psi->evalGradSource(elec, ions, 0); //On the C atom.
722  wfgradraw[1] = psi->evalGradSource(elec, ions, 1); //On the N atom.
723 
724  convertToReal(wfgradraw[0], wf_grad[0]);
725  convertToReal(wfgradraw[1], wf_grad[1]);
726 
727  //This is not implemented yet. Uncomment to perform check after implementation.
728  //Reference from finite differences on this configuration.
729  /* CHECK( wf_grad[0][0] == Approx(-1.7052805961093040));
730  CHECK( wf_grad[0][1] == Approx( 2.8914116872336133));
731  CHECK( wf_grad[0][2] == Approx( 7.3963610874194776));
732  CHECK( wf_grad[1][0] == Approx( 2.0450537814298286));
733  CHECK( wf_grad[1][1] == Approx( 0.0742023428479399));
734  CHECK( wf_grad[1][2] == Approx(-1.6411356565271260)); */
735 
736  //This is not implemented yet. Uncomment to perform check after implementation.
737  //Kinetic Force
738  /* hf_term=0.0;
739  pulay_term=0.0;
740  (ham.getHamiltonian(KINETIC))->evaluateWithIonDerivsDeterministic(elec, ions, *psi, hf_term, pulay_term);
741 #if defined(MIXED_PRECISION)
742  CHECK( hf_term[0][0]+pulay_term[0][0] == Approx( 4.1783687883878429).epsilon(1e-4));
743  CHECK( hf_term[0][1]+pulay_term[0][1] == Approx( 32.2193450745800192).epsilon(1e-4));
744  CHECK( hf_term[0][2]+pulay_term[0][2] == Approx(102.0214857307521896).epsilon(1e-4));
745  CHECK( hf_term[1][0]+pulay_term[1][0] == Approx( 4.5063296809644271).epsilon(1e-4));
746  CHECK( hf_term[1][1]+pulay_term[1][1] == Approx( -2.3360060461996568).epsilon(1e-4));
747  CHECK( hf_term[1][2]+pulay_term[1][2] == Approx( 2.9502526588842666).epsilon(1e-4));
748 #else
749  CHECK( hf_term[0][0]+pulay_term[0][0] == Approx( 4.1783687883878429));
750  CHECK( hf_term[0][1]+pulay_term[0][1] == Approx( 32.2193450745800192));
751  CHECK( hf_term[0][2]+pulay_term[0][2] == Approx(102.0214857307521896));
752  CHECK( hf_term[1][0]+pulay_term[1][0] == Approx( 4.5063296809644271));
753  CHECK( hf_term[1][1]+pulay_term[1][1] == Approx( -2.3360060461996568));
754  CHECK( hf_term[1][2]+pulay_term[1][2] == Approx( 2.9502526588842666));
755 #endif */
756  //This is not implemented yet. Uncomment to perform check after implementation.
757  //NLPP Force
758  /* hf_term=0.0;
759  pulay_term=0.0;
760  double val=(ham.getHamiltonian(NONLOCALECP))->evaluateWithIonDerivsDeterministic(elec, ions, *psi, hf_term, pulay_term);
761 #if defined(MIXED_PRECISION)
762  CHECK( hf_term[0][0]+pulay_term[0][0] == Approx( 21.6829856774403140).epsilon(2e-4));
763  CHECK( hf_term[0][1]+pulay_term[0][1] == Approx(-43.4432406419382673).epsilon(2e-4));
764  CHECK( hf_term[0][2]+pulay_term[0][2] == Approx(-80.1356331911584618).epsilon(2e-4));
765  CHECK( hf_term[1][0]+pulay_term[1][0] == Approx( 0.9915030925178313).epsilon(2e-4));
766  CHECK( hf_term[1][1]+pulay_term[1][1] == Approx( -0.6012127592214256).epsilon(2e-4));
767  CHECK( hf_term[1][2]+pulay_term[1][2] == Approx( -2.7937129314814508).epsilon(2e-4));
768 #else
769  CHECK( hf_term[0][0]+pulay_term[0][0] == Approx( 21.6829856774403140));
770  CHECK( hf_term[0][1]+pulay_term[0][1] == Approx(-43.4432406419382673));
771  CHECK( hf_term[0][2]+pulay_term[0][2] == Approx(-80.1356331911584618));
772  CHECK( hf_term[1][0]+pulay_term[1][0] == Approx( 0.9915030925178313));
773  CHECK( hf_term[1][1]+pulay_term[1][1] == Approx( -0.6012127592214256));
774  CHECK( hf_term[1][2]+pulay_term[1][2] == Approx( -2.7937129314814508));
775 #endif */
776 }

◆ TEST_CASE() [518/537]

qmcplusplus::TEST_CASE ( "distance_pbc_z batched APIs"  ,
""  [distance_table][xml] 
)

Definition at line 658 of file test_distance_table.cpp.

References DC_POS, DC_POS_OFFLOAD, test_distance_fcc_pbc_z_batched_APIs(), and test_distance_pbc_z_batched_APIs().

659 {
660  test_distance_pbc_z_batched_APIs(DynamicCoordinateKind::DC_POS);
661  test_distance_pbc_z_batched_APIs(DynamicCoordinateKind::DC_POS_OFFLOAD);
662  test_distance_fcc_pbc_z_batched_APIs(DynamicCoordinateKind::DC_POS);
663  test_distance_fcc_pbc_z_batched_APIs(DynamicCoordinateKind::DC_POS_OFFLOAD);
664 }
void test_distance_pbc_z_batched_APIs(DynamicCoordinateKind test_kind)
void test_distance_fcc_pbc_z_batched_APIs(DynamicCoordinateKind test_kind)

◆ TEST_CASE() [519/537]

qmcplusplus::TEST_CASE ( "RotatedSPOs construct delta matrix"  ,
""  [wavefunction] 
)

Definition at line 674 of file test_RotatedSPOs.cpp.

References CHECK(), CHECKED_ELSE(), checkMatrix(), RotatedSPOs::constructDeltaRotation(), RotatedSPOs::createRotationIndices(), and RotatedSPOs::createRotationIndicesFull().

675 {
677  using ValueMatrix = SPOSet::ValueMatrix;
678 
679  int nel = 2;
680  int nmo = 4;
681  RotatedSPOs::RotationIndices rot_ind;
682  RotatedSPOs::createRotationIndices(nel, nmo, rot_ind);
683  RotatedSPOs::RotationIndices full_rot_ind;
684  RotatedSPOs::createRotationIndicesFull(nel, nmo, full_rot_ind);
685  // rot_ind size is 4 and full rot_ind size is 6
686 
687  ValueMatrix rot_m4(nmo, nmo);
688  rot_m4 = ValueType(0);
689 
690  // When comparing with gen_matrix_ops.py, be aware of the order of indices
691  // in full_rot
692  // rot_ind is (0,2) (0,3) (1,2) (1,3)
693  // full_rot_ind is (0,2) (0,3) (1,2) (1,3) (0,1) (2,3)
694  // The extra indices go at the back
695  std::vector<ValueType> old_params = {1.5, 0.2, -0.15, 0.03, -1.1, 0.05};
696  std::vector<ValueType> delta_params = {0.1, 0.3, 0.2, -0.1};
697  std::vector<ValueType> new_params(6);
698 
699  RotatedSPOs::constructDeltaRotation(delta_params, old_params, rot_ind, full_rot_ind, new_params, rot_m4);
700 
701  // clang-format off
702  std::vector<ValueType> rot_data4 =
703  { -0.371126931484737, 0.491586564957393, -0.784780958819798, 0.0687480658200083,
704  -0.373372784561548, 0.66111547793048, 0.610450337985578, 0.225542620014052,
705  0.751270334458895, 0.566737323353515, -0.0297901110611425, -0.336918744155143,
706  0.398058348785074, 0.00881931472604944, -0.102867783149713, 0.911531672428406 };
707  // clang-format on
708 
709  ValueMatrix new_rot_m4(rot_data4.data(), 4, 4);
710 
711  CheckMatrixResult check_matrix_result4 = checkMatrix(rot_m4, new_rot_m4, true);
712  CHECKED_ELSE(check_matrix_result4.result) { FAIL(check_matrix_result4.result_message); }
713 
714  // Reminder: Ordering!
715  std::vector<ValueType> expected_new_param = {1.6813965019790489, 0.3623564254653294, -0.05486544454559908,
716  -0.20574472941408453, -0.9542513302873077, 0.27497788909911774};
717  for (int i = 0; i < new_params.size(); i++)
718  CHECK(new_params[i] == ValueApprox(expected_new_param[i]));
719 
720 
721  // Rotated back to original position
722 
723  std::vector<ValueType> new_params2(6);
724  std::vector<ValueType> reverse_delta_params = {-0.1, -0.3, -0.2, 0.1};
725  RotatedSPOs::constructDeltaRotation(reverse_delta_params, new_params, rot_ind, full_rot_ind, new_params2, rot_m4);
726  for (int i = 0; i < new_params2.size(); i++)
727  CHECK(new_params2[i] == ValueApprox(old_params[i]));
728 }
CHECKED_ELSE(check_matrix_result.result)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [520/537]

qmcplusplus::TEST_CASE ( "distance_pbc_z batched APIs ee NEED_TEMP_DATA_ON_HOST"  ,
""  [distance_table][xml] 
)

Definition at line 728 of file test_distance_table.cpp.

References DC_POS, DC_POS_OFFLOAD, and test_distance_pbc_z_batched_APIs_ee_NEED_TEMP_DATA_ON_HOST().

729 {
730  test_distance_pbc_z_batched_APIs_ee_NEED_TEMP_DATA_ON_HOST(DynamicCoordinateKind::DC_POS);
731  test_distance_pbc_z_batched_APIs_ee_NEED_TEMP_DATA_ON_HOST(DynamicCoordinateKind::DC_POS_OFFLOAD);
732 }
void test_distance_pbc_z_batched_APIs_ee_NEED_TEMP_DATA_ON_HOST(DynamicCoordinateKind test_kind)

◆ TEST_CASE() [521/537]

qmcplusplus::TEST_CASE ( "test_distance_pbc_diamond"  ,
""  [distance_table][xml] 
)

Definition at line 734 of file test_distance_table.cpp.

References OHMMS::Controller, and MinimalParticlePool::make_diamondC_1x1x1().

735 {
736  auto pset_pool = MinimalParticlePool::make_diamondC_1x1x1(OHMMS::Controller);
737 
738  auto& ions = *pset_pool.getParticleSet("ion");
739  auto& elecs = *pset_pool.getParticleSet("e");
740 
741  ions.addTable(ions);
742  ions.update();
743  elecs.addTable(ions);
744  elecs.addTable(elecs);
745  elecs.update();
746 }
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35

◆ TEST_CASE() [522/537]

qmcplusplus::TEST_CASE ( "RotatedSPOs read and write parameters"  ,
""  [wavefunction] 
)

Definition at line 738 of file test_RotatedSPOs.cpp.

References RotatedSPOs::buildOptVariables(), CHECK(), RotatedSPOs::checkInVariablesExclusive(), qmcplusplus::testing::getMyVars(), qmcplusplus::testing::getMyVarsFull(), VariableSet::readFromHDF(), RotatedSPOs::readVariationalParameters(), RotatedSPOs::resetParametersExclusive(), VariableSet::size(), VariableSet::writeToHDF(), and RotatedSPOs::writeVariationalParameters().

739 {
740  //There is an issue with the real<->complex parameter parsing to h5 in QMC_COMPLEX.
741  //This needs to be fixed in a future PR.
742  auto fake_spo = std::make_unique<FakeSPO>();
743  fake_spo->setOrbitalSetSize(4);
744  RotatedSPOs rot("fake_rot", std::move(fake_spo));
745  int nel = 2;
746  rot.buildOptVariables(nel);
747 
748  std::vector<SPOSet::ValueType> vs_values{0.1, 0.15, 0.2, 0.25};
749 
751  rot.checkInVariablesExclusive(vs);
752  auto* vs_values_data_real = (SPOSet::RealType*)vs_values.data();
753  for (size_t i = 0; i < vs.size(); i++)
754  vs[i] = vs_values_data_real[i];
755  rot.resetParametersExclusive(vs);
756 
757  {
758  hdf_archive hout;
759  vs.writeToHDF("rot_vp.h5", hout);
760 
761  rot.writeVariationalParameters(hout);
762  }
763 
764  auto fake_spo2 = std::make_unique<FakeSPO>();
765  fake_spo2->setOrbitalSetSize(4);
766 
767  RotatedSPOs rot2("fake_rot", std::move(fake_spo2));
768  rot2.buildOptVariables(nel);
769 
771  rot2.checkInVariablesExclusive(vs2);
772 
773  hdf_archive hin;
774  vs2.readFromHDF("rot_vp.h5", hin);
775  rot2.readVariationalParameters(hin);
776 
778  for (size_t i = 0; i < vs.size(); i++)
779  CHECK(var[i] == Approx(vs[i]));
780 
781  //add extra parameters for full set
782  vs_values.push_back(0.0);
783  vs_values.push_back(0.0);
784  std::vector<SPOSet::ValueType>& full_var = testing::getMyVarsFull(rot2);
785  for (size_t i = 0; i < full_var.size(); i++)
786  CHECK(full_var[i] == ValueApprox(vs_values[i]));
787 }
void writeToHDF(const std::string &filename, qmcplusplus::hdf_archive &hout) const
void readFromHDF(const std::string &filename, qmcplusplus::hdf_archive &hin)
Read variational parameters from an HDF file.
std::vector< QMCTraits::ValueType > & getMyVarsFull(RotatedSPOs &rot)
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
optimize::VariableSet opt_variables_type
opt_variables_type & getMyVars(SPOSet &spo)
size_type size() const
return the size
Definition: VariableSet.h:88
QMCTraits::RealType RealType
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [523/537]

qmcplusplus::TEST_CASE ( "Rotated LCAO Be single determinant"  ,
""  [qmcapp] 
)

Definition at line 745 of file test_RotatedSPOs_LCAO.cpp.

References ProjectData::BATCH, CHECK(), TrialWaveFunction::checkInVariables(), TrialWaveFunction::checkOutVariables(), OHMMS::Controller, doc, TrialWaveFunction::evaluateDerivatives(), TrialWaveFunction::evaluateLog(), TrialWaveFunction::getOrbitals(), ParticleSetPool::getParticleSet(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), okay, Libxml2Document::parse(), REQUIRE(), TrialWaveFunction::resetParameters(), setupParticleSetPoolBe(), test_project, and ParticleSet::update().

746 {
747  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
748  Communicate* c;
749  c = OHMMS::Controller;
750 
751  ParticleSetPool pp(c);
753 
754  WaveFunctionPool wp(test_project.getRuntimeOptions(), pp, c);
755 
756  REQUIRE(wp.empty() == true);
757 
759  bool okay = doc.parse("rot_Be_STO.wfnoj.xml");
760  REQUIRE(okay);
761  xmlNodePtr root = doc.getRoot();
762 
763  wp.put(xmlFirstElementChild(root));
764 
765 
766  TrialWaveFunction* psi = wp.getWaveFunction("psi0");
767  REQUIRE(psi != nullptr);
768  REQUIRE(psi->getOrbitals().size() == 1);
769 
770  opt_variables_type opt_vars;
771  psi->checkInVariables(opt_vars);
772  opt_vars.resetIndex();
773  psi->checkOutVariables(opt_vars);
774  psi->resetParameters(opt_vars);
775 
776  ParticleSet* elec = pp.getParticleSet("e");
777  elec->update();
778 
779 
780  double logval = psi->evaluateLog(*elec);
781  CHECK(logval == Approx(-17.768474132175342));
782 
784  Vector<ValueType> dlogpsi(10);
785  Vector<ValueType> dhpsioverpsi(10);
786  psi->evaluateDerivatives(*elec, opt_vars, dlogpsi, dhpsioverpsi);
787 
788  CHECK(dlogpsi[0] == ValueApprox(0.24797938203759148));
789  CHECK(dlogpsi[1] == ValueApprox(0.41454059122930453));
790  CHECK(dlogpsi[2] == ValueApprox(0.7539626161586822));
791  CHECK(dlogpsi[3] == ValueApprox(3.13489394217799));
792  CHECK(dlogpsi[4] == ValueApprox(8.47176722646749));
793  CHECK(dlogpsi[5] == ValueApprox(-0.48182453464906033));
794  CHECK(dlogpsi[6] == ValueApprox(2.269206401396164));
795  CHECK(dlogpsi[7] == ValueApprox(-1.883221269688377));
796  CHECK(dlogpsi[8] == ValueApprox(-19.450964163527598));
797  CHECK(dlogpsi[9] == ValueApprox(-47.28198556252034));
798 
799  CHECK(dhpsioverpsi[0] == ValueApprox(0.3662586398420111));
800  CHECK(dhpsioverpsi[1] == ValueApprox(-5.544323554018982));
801  CHECK(dhpsioverpsi[2] == ValueApprox(-0.7790656028274846));
802  CHECK(dhpsioverpsi[3] == ValueApprox(24.930187483208087));
803  CHECK(dhpsioverpsi[4] == ValueApprox(71.30301022344871));
804  CHECK(dhpsioverpsi[5] == ValueApprox(-1.1614358798793771));
805  CHECK(dhpsioverpsi[6] == ValueApprox(17.678711245652913));
806  CHECK(dhpsioverpsi[7] == ValueApprox(2.491238469662668));
807  CHECK(dhpsioverpsi[8] == ValueApprox(-79.37464297365679));
808  CHECK(dhpsioverpsi[9] == ValueApprox(-227.0976672502695));
809 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
void resetIndex()
reset Index
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
void setupParticleSetPoolBe(ParticleSetPool &pp)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [524/537]

qmcplusplus::TEST_CASE ( "ReadMolecularOrbital GTO spinor"  ,
""  [wavefunction] 
)

Definition at line 764 of file test_MO_spinor.cpp.

References test_lcao_spinor().

764 { test_lcao_spinor(); }
void test_lcao_spinor()

◆ TEST_CASE() [525/537]

qmcplusplus::TEST_CASE ( "ReadMolecularOrbital GTO spinor with excited"  ,
""  [wavefunction] 
)

Definition at line 765 of file test_MO_spinor.cpp.

References test_lcao_spinor_excited().

void test_lcao_spinor_excited()

◆ TEST_CASE() [526/537]

qmcplusplus::TEST_CASE ( "spinor ion derivatives for molecule"  ,
""  [wavefunction] 
)

Definition at line 766 of file test_MO_spinor.cpp.

References test_lcao_spinor_ion_derivs().

void test_lcao_spinor_ion_derivs()

◆ TEST_CASE() [527/537]

qmcplusplus::TEST_CASE ( "Eloc_Derivatives:proto_sd_noj"  ,
""  [hamiltonian] 
)

Definition at line 778 of file test_ion_derivs.cpp.

References app_log(), B(), WaveFunctionFactory::buildTWF(), CHECK(), OHMMS::Controller, convertToReal(), create_CN_Hamiltonian(), create_CN_particlesets(), qmcplusplus::Units::charge::e, OperatorBase::evaluateOneBodyOpMatrix(), OperatorBase::evaluateOneBodyOpMatrixForceDeriv(), QMCHamiltonian::getHamiltonian(), Libxml2Document::getRoot(), ham, TrialWaveFunction::initializeTWFFastDerivWrapper(), OHMMS_DIM, okay, Libxml2Document::parse(), REQUIRE(), and twf.

778  :proto_sd_noj", "[hamiltonian]")
779 {
780  app_log() << "========================================================================================\n";
781  app_log() << "========================================================================================\n";
782  app_log() << "====================Ion Derivative Test: Prototype Single Slater+ No Jastrow===========\n";
783  app_log() << "========================================================================================\n";
784  app_log() << "========================================================================================\n";
785  using RealType = QMCTraits::RealType;
786  using ValueType = QMCTraits::ValueType;
787 
788  Communicate* c = OHMMS::Controller;
789 
790  const SimulationCell simulation_cell;
791  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
792  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
793  auto &ions(*ions_ptr), elec(*elec_ptr);
794 
795  //Build a CN test molecule.
796  create_CN_particlesets(elec, ions);
797  //////////////////////////////////
798  /////////////////////////////////
799  //Incantation to read and build a TWF from cn.wfnoj//
800  Libxml2Document doc2;
801  bool okay = doc2.parse("cn.wfnoj.xml");
802  REQUIRE(okay);
803  xmlNodePtr root2 = doc2.getRoot();
804 
805  WaveFunctionComponentBuilder::PSetMap particle_set_map;
806  particle_set_map.emplace("e", std::move(elec_ptr));
807  particle_set_map.emplace("ion0", std::move(ions_ptr));
808 
809  RuntimeOptions runtime_options;
810  WaveFunctionFactory wff(elec, particle_set_map, c);
811  HamiltonianFactory::PsiPoolType psi_map;
812  psi_map.emplace("psi0", wff.buildTWF(root2, runtime_options));
813 
814  TrialWaveFunction* psi = psi_map["psi0"].get();
815  REQUIRE(psi != nullptr);
816  //end incantation
817 
818  TWFFastDerivWrapper twf;
819 
820  psi->initializeTWFFastDerivWrapper(elec, twf);
821  SPOSet::ValueVector values;
822  SPOSet::GradVector dpsi;
823  SPOSet::ValueVector d2psi;
824  values.resize(9);
825  dpsi.resize(9);
826  d2psi.resize(9);
827 
828  HamiltonianFactory hf("h0", elec, particle_set_map, psi_map, c);
829 
830  QMCHamiltonian& ham = create_CN_Hamiltonian(hf);
831 
832  //Enum to give human readable indexing into QMCHamiltonian.
833  enum observ_id
834  {
835  KINETIC = 0,
836  LOCALECP,
837  NONLOCALECP,
838  ELECELEC,
839  IONION
840  };
841 
842  using ValueMatrix = SPOSet::ValueMatrix;
843 
844  //This builds and initializes all the auxiliary matrices needed to do fast derivative evaluation.
845  //These matrices are not necessarily square to accomodate orb opt and multidets.
846 
847  ValueMatrix upmat; //Up slater matrix.
848  ValueMatrix dnmat; //Down slater matrix.
849  int Nup = 5; //These are hard coded until the interface calls get implemented/cleaned up.
850  int Ndn = 4;
851  int Norb = 14;
852  upmat.resize(Nup, Norb);
853  dnmat.resize(Ndn, Norb);
854 
855  //The first two lines consist of vectors of matrices. The vector index corresponds to the species ID.
856  //For example, matlist[0] will be the slater matrix for up electrons, matlist[1] will be for down electrons.
857  std::vector<ValueMatrix> matlist; //Vector of slater matrices.
858  std::vector<ValueMatrix> B, X; //Vector of B matrix, and auxiliary X matrix.
859 
860  //The first index corresponds to the x,y,z force derivative. Current interface assumes that the ion index is fixed,
861  // so these vectors of vectors of matrices store the derivatives of the M and B matrices.
862  // dB[0][0] is the x component of the iat force derivative of the up B matrix, dB[0][1] is for the down B matrix.
863 
864  std::vector<std::vector<ValueMatrix>> dM; //Derivative of slater matrix.
865  std::vector<std::vector<ValueMatrix>> dB; //Derivative of B matrices.
866  matlist.push_back(upmat);
867  matlist.push_back(dnmat);
868 
869  dM.push_back(matlist);
870  dM.push_back(matlist);
871  dM.push_back(matlist);
872 
873  dB.push_back(matlist);
874  dB.push_back(matlist);
875  dB.push_back(matlist);
876 
877  B.push_back(upmat);
878  B.push_back(dnmat);
879 
880  X.push_back(upmat);
881  X.push_back(dnmat);
882 
883  twf.getM(elec, matlist);
884 
885  OperatorBase* kinop = ham.getHamiltonian(KINETIC);
886 
887  kinop->evaluateOneBodyOpMatrix(elec, twf, B);
888 
889 
890  std::vector<ValueMatrix> minv;
891  std::vector<ValueMatrix> B_gs, M_gs; //We are creating B and M matrices for assumed ground-state occupations.
892  //These are N_s x N_s square matrices (N_s is number of particles for species s).
893  B_gs.push_back(upmat);
894  B_gs.push_back(dnmat);
895  M_gs.push_back(upmat);
896  M_gs.push_back(dnmat);
897  minv.push_back(upmat);
898  minv.push_back(dnmat);
899 
900 
901  // twf.getM(elec, matlist);
902  std::vector<std::vector<ValueMatrix>> dB_gs;
903  std::vector<std::vector<ValueMatrix>> dM_gs;
904  std::vector<ValueMatrix> tmp_gs;
905  twf.getGSMatrices(B, B_gs);
906  twf.getGSMatrices(matlist, M_gs);
907  twf.invertMatrices(M_gs, minv);
908  twf.buildX(minv, B_gs, X);
909  for (int id = 0; id < matlist.size(); id++)
910  {
911  // int ptclnum = twf.numParticles(id);
912  int ptclnum = (id == 0 ? Nup : Ndn); //hard coded until twf interface comes online.
913  ValueMatrix gs_m;
914  gs_m.resize(ptclnum, ptclnum);
915  tmp_gs.push_back(gs_m);
916  }
917 
918 
919  dB_gs.push_back(tmp_gs);
920  dB_gs.push_back(tmp_gs);
921  dB_gs.push_back(tmp_gs);
922 
923  dM_gs.push_back(tmp_gs);
924  dM_gs.push_back(tmp_gs);
925  dM_gs.push_back(tmp_gs);
926 
927  //Finally, we have all the data structures with the right dimensions. Continue.
928 
929  ParticleSet::ParticleGradient fkin_complex(ions.getTotalNum());
930  ParticleSet::ParticlePos fkin(ions.getTotalNum());
931 
932 
933  for (int ionid = 0; ionid < ions.getTotalNum(); ionid++)
934  {
935  for (int idim = 0; idim < OHMMS_DIM; idim++)
936  {
937  twf.wipeMatrices(dB[idim]);
938  twf.wipeMatrices(dM[idim]);
939  }
940 
941  twf.getIonGradM(elec, ions, ionid, dM);
942  kinop->evaluateOneBodyOpMatrixForceDeriv(elec, ions, twf, ionid, dB);
943 
944  for (int idim = 0; idim < OHMMS_DIM; idim++)
945  {
946  twf.getGSMatrices(dB[idim], dB_gs[idim]);
947  twf.getGSMatrices(dM[idim], dM_gs[idim]);
948  fkin_complex[ionid][idim] = twf.computeGSDerivative(minv, X, dM_gs[idim], dB_gs[idim]);
949  }
950  convertToReal(fkin_complex[ionid], fkin[ionid]);
951  }
952 
953 
954  ValueType keval = 0.0;
955  RealType keobs = 0.0;
956  keval = twf.trAB(minv, B_gs);
957  convertToReal(keval, keobs);
958  CHECK(keobs == Approx(9.1821937928e+00));
959 #if defined(MIXED_PRECISION)
960  CHECK(fkin[0][0] == Approx(1.0852823603357820).epsilon(1e-4));
961  CHECK(fkin[0][1] == Approx(24.2154119471038562).epsilon(1e-4));
962  CHECK(fkin[0][2] == Approx(111.8849364775797852).epsilon(1e-4));
963  CHECK(fkin[1][0] == Approx(2.1572063443997536).epsilon(1e-4));
964  CHECK(fkin[1][1] == Approx(-3.3743242489947529).epsilon(1e-4));
965  CHECK(fkin[1][2] == Approx(7.5625192454964454).epsilon(1e-4));
966 #else
967  CHECK(fkin[0][0] == Approx(1.0852823603357820));
968  CHECK(fkin[0][1] == Approx(24.2154119471038562));
969  CHECK(fkin[0][2] == Approx(111.8849364775797852));
970  CHECK(fkin[1][0] == Approx(2.1572063443997536));
971  CHECK(fkin[1][1] == Approx(-3.3743242489947529));
972  CHECK(fkin[1][2] == Approx(7.5625192454964454));
973 #endif
974 
975  app_log() << " KEVal = " << keval << std::endl;
976 
977  app_log() << " Now evaluating nonlocalecp\n";
978  OperatorBase* nlppop = ham.getHamiltonian(NONLOCALECP);
979  app_log() << "nlppop = " << nlppop << std::endl;
980  app_log() << " Evaluated. Calling evaluteOneBodyOpMatrix\n";
981 
982 
983  twf.wipeMatrices(B);
984  twf.wipeMatrices(B_gs);
985  twf.wipeMatrices(X);
986  nlppop->evaluateOneBodyOpMatrix(elec, twf, B);
987  twf.getGSMatrices(B, B_gs);
988  twf.buildX(minv, B_gs, X);
989 
990  ValueType nlpp = 0.0;
991  RealType nlpp_obs = 0.0;
992  nlpp = twf.trAB(minv, B_gs);
993  convertToReal(nlpp, nlpp_obs);
994 
995  app_log() << "NLPP = " << nlpp << std::endl;
996 
997  CHECK(nlpp_obs == Approx(1.3849558361e+01));
998 
999  ParticleSet::ParticleGradient fnlpp_complex(ions.getTotalNum());
1000  ParticleSet::ParticlePos fnlpp(ions.getTotalNum());
1001  for (int ionid = 0; ionid < ions.getTotalNum(); ionid++)
1002  {
1003  for (int idim = 0; idim < OHMMS_DIM; idim++)
1004  {
1005  twf.wipeMatrices(dB[idim]);
1006  twf.wipeMatrices(dM[idim]);
1007  }
1008 
1009  twf.getIonGradM(elec, ions, ionid, dM);
1010  nlppop->evaluateOneBodyOpMatrixForceDeriv(elec, ions, twf, ionid, dB);
1011 
1012  for (int idim = 0; idim < OHMMS_DIM; idim++)
1013  {
1014  twf.getGSMatrices(dB[idim], dB_gs[idim]);
1015  twf.getGSMatrices(dM[idim], dM_gs[idim]);
1016  fnlpp_complex[ionid][idim] = twf.computeGSDerivative(minv, X, dM_gs[idim], dB_gs[idim]);
1017  }
1018  convertToReal(fnlpp_complex[ionid], fnlpp[ionid]);
1019  }
1020 
1021 #if defined(MIXED_PRECISION)
1022  CHECK(fnlpp[0][0] == Approx(24.2239540340527491).epsilon(2e-4));
1023  CHECK(fnlpp[0][1] == Approx(-41.9981344310649263).epsilon(2e-4));
1024  CHECK(fnlpp[0][2] == Approx(-98.9123955744908159).epsilon(2e-4));
1025  CHECK(fnlpp[1][0] == Approx(2.5105943834091704).epsilon(2e-4));
1026  CHECK(fnlpp[1][1] == Approx(1.1345766918857692).epsilon(2e-4));
1027  CHECK(fnlpp[1][2] == Approx(-5.2293234395150989).epsilon(2e-4));
1028 #else
1029  CHECK(fnlpp[0][0] == Approx(24.2239540340527491));
1030  CHECK(fnlpp[0][1] == Approx(-41.9981344310649263));
1031  CHECK(fnlpp[0][2] == Approx(-98.9123955744908159));
1032  CHECK(fnlpp[1][0] == Approx(2.5105943834091704));
1033  CHECK(fnlpp[1][1] == Approx(1.1345766918857692));
1034  CHECK(fnlpp[1][2] == Approx(-5.2293234395150989));
1035 #endif
1036 }

◆ TEST_CASE() [528/537]

qmcplusplus::TEST_CASE ( "RotatedSPOs read and write parameters history"  ,
""  [wavefunction] 
)

Definition at line 790 of file test_RotatedSPOs.cpp.

References RotatedSPOs::buildOptVariables(), CHECK(), RotatedSPOs::checkInVariablesExclusive(), qmcplusplus::testing::getHistoryParams(), qmcplusplus::testing::getMyVars(), VariableSet::readFromHDF(), RotatedSPOs::readVariationalParameters(), REQUIRE(), RotatedSPOs::resetParametersExclusive(), RotatedSPOs::set_use_global_rotation(), VariableSet::size(), VariableSet::writeToHDF(), and RotatedSPOs::writeVariationalParameters().

791 {
792  //Problem with h5 parameter parsing for complex build. To be fixed in future PR.
793  auto fake_spo = std::make_unique<FakeSPO>();
794  fake_spo->setOrbitalSetSize(4);
795  RotatedSPOs rot("fake_rot", std::move(fake_spo));
796  rot.set_use_global_rotation(false);
797  int nel = 2;
798  rot.buildOptVariables(nel);
799 
800  std::vector<SPOSet::ValueType> vs_values{0.1, 0.15, 0.2, 0.25};
801 
803  rot.checkInVariablesExclusive(vs);
804  auto* vs_values_data_real = (SPOSet::RealType*)vs_values.data();
805  for (size_t i = 0; i < vs.size(); i++)
806  vs[i] = vs_values_data_real[i];
807  rot.resetParametersExclusive(vs);
808 
809  {
810  hdf_archive hout;
811  vs.writeToHDF("rot_vp_hist.h5", hout);
812 
813  rot.writeVariationalParameters(hout);
814  }
815 
816  auto fake_spo2 = std::make_unique<FakeSPO>();
817  fake_spo2->setOrbitalSetSize(4);
818 
819  RotatedSPOs rot2("fake_rot", std::move(fake_spo2));
820  rot2.buildOptVariables(nel);
821 
823  rot2.checkInVariablesExclusive(vs2);
824 
825  hdf_archive hin;
826  vs2.readFromHDF("rot_vp_hist.h5", hin);
827  rot2.readVariationalParameters(hin);
828 
830  for (size_t i = 0; i < var.size(); i++)
831  CHECK(var[i] == Approx(vs[i]));
832 
833  auto hist = testing::getHistoryParams(rot2);
834  REQUIRE(hist.size() == 1);
835  REQUIRE(hist[0].size() == 4);
836 }
void writeToHDF(const std::string &filename, qmcplusplus::hdf_archive &hout) const
void readFromHDF(const std::string &filename, qmcplusplus::hdf_archive &hin)
Read variational parameters from an HDF file.
REQUIRE(std::filesystem::exists(filename))
class to handle a set of variables that can be modified during optimizations
Definition: VariableSet.h:49
optimize::VariableSet opt_variables_type
opt_variables_type & getMyVars(SPOSet &spo)
size_type size() const
return the size
Definition: VariableSet.h:88
QMCTraits::RealType RealType
std::vector< std::vector< QMCTraits::ValueType > > & getHistoryParams(RotatedSPOs &rot)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ TEST_CASE() [529/537]

qmcplusplus::TEST_CASE ( "Rotated LCAO Be multi determinant with one determinant"  ,
""  [qmcapp] 
)

Definition at line 813 of file test_RotatedSPOs_LCAO.cpp.

References ProjectData::BATCH, CHECK(), TrialWaveFunction::checkInVariables(), TrialWaveFunction::checkOutVariables(), OHMMS::Controller, doc, TrialWaveFunction::evaluateDerivatives(), TrialWaveFunction::evaluateLog(), TrialWaveFunction::getOrbitals(), ParticleSetPool::getParticleSet(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), okay, Libxml2Document::parse(), REQUIRE(), TrialWaveFunction::resetParameters(), setupParticleSetPoolBe(), test_project, and ParticleSet::update().

814 {
815  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
816  Communicate* c;
817  c = OHMMS::Controller;
818 
819  ParticleSetPool pp(c);
821 
822  WaveFunctionPool wp(test_project.getRuntimeOptions(), pp, c);
823 
824  REQUIRE(wp.empty() == true);
825 
827  bool okay = doc.parse("rot_multi_1det_Be_STO.wfnoj.xml");
828  REQUIRE(okay);
829  xmlNodePtr root = doc.getRoot();
830 
831  wp.put(xmlFirstElementChild(root));
832 
833  TrialWaveFunction* psi = wp.getWaveFunction("psi0");
834  REQUIRE(psi != nullptr);
835  REQUIRE(psi->getOrbitals().size() == 1);
836 
837  opt_variables_type opt_vars;
838  psi->checkInVariables(opt_vars);
839  opt_vars.resetIndex();
840  psi->checkOutVariables(opt_vars);
841  psi->resetParameters(opt_vars);
842 
843  ParticleSet* elec = pp.getParticleSet("e");
844  elec->update();
845 
846 
847  double logval = psi->evaluateLog(*elec);
848  CHECK(logval == Approx(-17.768474132175342));
849 
851  Vector<ValueType> dlogpsi(10);
852  Vector<ValueType> dhpsioverpsi(10);
853  psi->evaluateDerivatives(*elec, opt_vars, dlogpsi, dhpsioverpsi);
854 
855  CHECK(dlogpsi[0] == ValueApprox(0.24797938203759148));
856  CHECK(dlogpsi[1] == ValueApprox(0.41454059122930453));
857  CHECK(dlogpsi[2] == ValueApprox(0.7539626161586822));
858  CHECK(dlogpsi[3] == ValueApprox(3.13489394217799));
859  CHECK(dlogpsi[4] == ValueApprox(8.47176722646749));
860  CHECK(dlogpsi[5] == ValueApprox(-0.48182453464906033));
861  CHECK(dlogpsi[6] == ValueApprox(2.269206401396164));
862  CHECK(dlogpsi[7] == ValueApprox(-1.883221269688377));
863  CHECK(dlogpsi[8] == ValueApprox(-19.450964163527598));
864  CHECK(dlogpsi[9] == ValueApprox(-47.28198556252034));
865 
866  CHECK(dhpsioverpsi[0] == ValueApprox(0.3662586398420111));
867  CHECK(dhpsioverpsi[1] == ValueApprox(-5.544323554018982));
868  CHECK(dhpsioverpsi[2] == ValueApprox(-0.7790656028274846));
869  CHECK(dhpsioverpsi[3] == ValueApprox(24.930187483208087));
870  CHECK(dhpsioverpsi[4] == ValueApprox(71.30301022344871));
871  CHECK(dhpsioverpsi[5] == ValueApprox(-1.1614358798793771));
872  CHECK(dhpsioverpsi[6] == ValueApprox(17.678711245652913));
873  CHECK(dhpsioverpsi[7] == ValueApprox(2.491238469662668));
874  CHECK(dhpsioverpsi[8] == ValueApprox(-79.37464297365679));
875  CHECK(dhpsioverpsi[9] == ValueApprox(-227.0976672502695));
876 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
void resetIndex()
reset Index
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
void setupParticleSetPoolBe(ParticleSetPool &pp)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [530/537]

qmcplusplus::TEST_CASE ( "ReadMolecularOrbital GTO Carbon Diamond"  ,
""  [wavefunction] 
)

Definition at line 878 of file test_pyscf_complex_MO.cpp.

References test_C_diamond().

878 { test_C_diamond(); }

◆ TEST_CASE() [531/537]

qmcplusplus::TEST_CASE ( "Rotated LCAO Be two determinant"  ,
""  [qmcapp] 
)

Definition at line 880 of file test_RotatedSPOs_LCAO.cpp.

References ProjectData::BATCH, CHECK(), TrialWaveFunction::checkInVariables(), TrialWaveFunction::checkOutVariables(), OHMMS::Controller, doc, TrialWaveFunction::evaluateDerivatives(), TrialWaveFunction::evaluateLog(), TrialWaveFunction::getOrbitals(), ParticleSetPool::getParticleSet(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), okay, Libxml2Document::parse(), REQUIRE(), TrialWaveFunction::resetParameters(), setupParticleSetPoolBe(), test_project, and ParticleSet::update().

881 {
882  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
883  Communicate* c;
884  c = OHMMS::Controller;
885 
886  ParticleSetPool pp(c);
888 
889  WaveFunctionPool wp(test_project.getRuntimeOptions(), pp, c);
890 
891  REQUIRE(wp.empty() == true);
892 
894  bool okay = doc.parse("rot_multi_2det_Be_STO.wfnoj.xml");
895  REQUIRE(okay);
896  xmlNodePtr root = doc.getRoot();
897 
898  wp.put(xmlFirstElementChild(root));
899 
900  TrialWaveFunction* psi = wp.getWaveFunction("psi0");
901  REQUIRE(psi != nullptr);
902  REQUIRE(psi->getOrbitals().size() == 1);
903 
904  opt_variables_type opt_vars;
905  psi->checkInVariables(opt_vars);
906  opt_vars.resetIndex();
907  psi->checkOutVariables(opt_vars);
908  psi->resetParameters(opt_vars);
909 
910  ParticleSet* elec = pp.getParticleSet("e");
911  elec->update();
912 
913 
914  double logval = psi->evaluateLog(*elec);
915  CHECK(logval == Approx(-17.762687110866413));
916 
918  Vector<ValueType> dlogpsi(16);
919  Vector<ValueType> dhpsioverpsi(16);
920  psi->evaluateDerivatives(*elec, opt_vars, dlogpsi, dhpsioverpsi);
921 
922  CHECK(dlogpsi[0] == ValueApprox(0.05770308755290168));
923  CHECK(dlogpsi[1] == ValueApprox(0.00593995768443123));
924  CHECK(dlogpsi[2] == ValueApprox(0.24654846443828843));
925  CHECK(dlogpsi[3] == ValueApprox(0.4214539468865001));
926  CHECK(dlogpsi[4] == ValueApprox(0.7484015451192123));
927  CHECK(dlogpsi[5] == ValueApprox(3.076586144487743));
928  CHECK(dlogpsi[6] == ValueApprox(8.329621106110908));
929  CHECK(dlogpsi[7] == ValueApprox(-0.4311398324864351));
930  CHECK(dlogpsi[8] == ValueApprox(2.2561123798306273));
931  CHECK(dlogpsi[9] == ValueApprox(-1.8723545015077454));
932  CHECK(dlogpsi[10] == ValueApprox(-19.33872609471596));
933  CHECK(dlogpsi[11] == ValueApprox(-47.00915390726143));
934  CHECK(dlogpsi[12] == ValueApprox(-0.05463186141658209));
935  CHECK(dlogpsi[13] == ValueApprox(0.045055811131004785));
936  CHECK(dlogpsi[14] == ValueApprox(0.46675941272234));
937  CHECK(dlogpsi[15] == ValueApprox(1.1352711502777513));
938 
939 
940  CHECK(dhpsioverpsi[0] == ValueApprox(0.2761674423047662));
941  CHECK(dhpsioverpsi[1] == ValueApprox(0.022999975062422046));
942  CHECK(dhpsioverpsi[2] == ValueApprox(0.3572968312376671));
943  CHECK(dhpsioverpsi[3] == ValueApprox(-5.459873357259045));
944  CHECK(dhpsioverpsi[4] == ValueApprox(-0.792225084691375));
945  CHECK(dhpsioverpsi[5] == ValueApprox(24.453138754349123));
946  CHECK(dhpsioverpsi[6] == ValueApprox(70.0280297306038));
947  CHECK(dhpsioverpsi[7] == ValueApprox(-1.0272848501840672));
948  CHECK(dhpsioverpsi[8] == ValueApprox(17.514031530576368));
949  CHECK(dhpsioverpsi[9] == ValueApprox(2.52887169464403));
950  CHECK(dhpsioverpsi[10] == ValueApprox(-78.37945447401765));
951  CHECK(dhpsioverpsi[11] == ValueApprox(-224.4814690906403));
952  CHECK(dhpsioverpsi[12] == ValueApprox(-0.6346957697642424));
953  CHECK(dhpsioverpsi[13] == ValueApprox(0.03270289146243591));
954  CHECK(dhpsioverpsi[14] == ValueApprox(3.263830358386392));
955  CHECK(dhpsioverpsi[15] == ValueApprox(8.944714289946793));
956 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
void resetIndex()
reset Index
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
void setupParticleSetPoolBe(ParticleSetPool &pp)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180
LatticeGaussianProduct::ValueType ValueType

◆ TEST_CASE() [532/537]

qmcplusplus::TEST_CASE ( "LCAOrbitalSet batched PBC DiamondC"  ,
""  [wavefunction] 
)

Definition at line 913 of file test_LCAO_diamondC_2x1x1.cpp.

References test_LCAO_DiamondC_2x1x1_cplx(), and test_LCAO_DiamondC_2x1x1_real().

914 {
915  SECTION("2x1x1 real") { test_LCAO_DiamondC_2x1x1_real(false); }
916 #ifdef QMC_COMPLEX
917  SECTION("2x1x1 cplx") { test_LCAO_DiamondC_2x1x1_cplx(false); }
918 #endif
919 }
void test_LCAO_DiamondC_2x1x1_cplx(const bool useOffload)
void test_LCAO_DiamondC_2x1x1_real(const bool useOffload)

◆ TEST_CASE() [533/537]

qmcplusplus::TEST_CASE ( "LCAOrbitalSet batched PBC DiamondC offload"  ,
""  [wavefunction] 
)

Definition at line 921 of file test_LCAO_diamondC_2x1x1.cpp.

References test_LCAO_DiamondC_2x1x1_cplx(), and test_LCAO_DiamondC_2x1x1_real().

922 {
923  SECTION("2x1x1 real offload") { test_LCAO_DiamondC_2x1x1_real(true); }
924 #ifdef QMC_COMPLEX
925  SECTION("2x1x1 cplx offload") { test_LCAO_DiamondC_2x1x1_cplx(true); }
926 #endif
927 }
void test_LCAO_DiamondC_2x1x1_cplx(const bool useOffload)
void test_LCAO_DiamondC_2x1x1_real(const bool useOffload)

◆ TEST_CASE() [534/537]

qmcplusplus::TEST_CASE ( "RotatedSPOs mw_ APIs"  ,
""  [wavefunction] 
)

Definition at line 941 of file test_RotatedSPOs.cpp.

References CHECK(), RotatedSPOs::createResource(), RotatedSPOs::evaluate_spin(), qmcplusplus::Units::distance::m, RotatedSPOs::mw_evaluateValue(), and RotatedSPOs::mw_evaluateVGLWithSpin().

942 {
943  {
944  //First check calling the mw_ APIs for RotatedSPOs, for which the
945  //underlying implementation just calls the underlying SPOSet mw_ API
946  //In the case that the underlying SPOSet doesn't specialize the mw_ API,
947  //the underlying SPOSet will fall back to the default SPOSet mw_, which is
948  //just a loop over the single walker API.
949  RotatedSPOs rot_spo0("rotated0", std::make_unique<DummySPOSetWithoutMW>("no mw 0"));
950  RotatedSPOs rot_spo1("rotated1", std::make_unique<DummySPOSetWithoutMW>("no mw 1"));
951  RefVectorWithLeader<SPOSet> spo_list(rot_spo0, {rot_spo0, rot_spo1});
952 
953  ResourceCollection spo_res("test_rot_res");
954  rot_spo0.createResource(spo_res);
955  ResourceCollectionTeamLock<SPOSet> mw_sposet_lock(spo_res, spo_list);
956 
957  const SimulationCell simulation_cell;
958  ParticleSet elec0(simulation_cell);
959  ParticleSet elec1(simulation_cell);
960  RefVectorWithLeader<ParticleSet> p_list(elec0, {elec0, elec1});
961 
962  SPOSet::ValueVector psi0(3);
963  SPOSet::ValueVector psi1(3);
964  RefVector<SPOSet::ValueVector> psi_v_list{psi0, psi1};
965 
966  rot_spo0.mw_evaluateValue(spo_list, p_list, 0, psi_v_list);
967  for (int iw = 0; iw < spo_list.size(); iw++)
968  {
969  CHECK(psi_v_list[iw].get()[0] == ValueApprox(123.));
970  CHECK(psi_v_list[iw].get()[1] == ValueApprox(456.));
971  CHECK(psi_v_list[iw].get()[2] == ValueApprox(789.));
972  }
973 #ifdef QMC_COMPLEX
974  SPOSet::GradVector dpsi0(3);
975  SPOSet::GradVector dpsi1(3);
976  RefVector<SPOSet::GradVector> dpsi_v_list{dpsi0, dpsi1};
977  SPOSet::ValueVector d2psi0(3);
978  SPOSet::ValueVector d2psi1(3);
979  SPOSet::ValueVector dspin(3);
980  RefVector<SPOSet::ValueVector> d2psi_v_list{d2psi0, d2psi1};
981  SPOSet::OffloadMatrix<SPOSet::ComplexType> mw_dspin(2, 3);
982  // check evaluate_spin, gets used by SlaterDet in evaluateVGL_spin. So checking to make sure RotatedSPO has it
983  rot_spo0.evaluate_spin(elec0, 0, psi0, dspin);
984  for (auto& m : dspin)
985  CHECK(m == ComplexApprox(SPOSet::ComplexType(0.9, 0.8)));
986  rot_spo0.mw_evaluateVGLWithSpin(spo_list, p_list, 0, psi_v_list, dpsi_v_list, d2psi_v_list, mw_dspin);
987  for (int iw = 0; iw < spo_list.size(); iw++)
988  {
989  CHECK(dpsi_v_list[iw].get()[0][0] == ValueApprox(0.123));
990  CHECK(dpsi_v_list[iw].get()[0][1] == ValueApprox(0.456));
991  CHECK(dpsi_v_list[iw].get()[0][2] == ValueApprox(0.789));
992  }
993  for (auto& m : mw_dspin)
994  CHECK(m == ComplexApprox(SPOSet::ComplexType(0.1, 0.2)));
995 #endif
996  }
997  {
998  //In the case that the underlying SPOSet DOES have mw_ specializations,
999  //we want to make sure that RotatedSPOs are triggering that appropriately
1000  //This will mean that the underlying SPOSets will do the appropriate offloading
1001  //To check this, DummySPOSetWithMW has an explicit mw_evaluateValue which sets
1002  //different values than what gets set in evaluateValue. By doing this,
1003  //we are ensuring that RotatedSPOs->mw_evaluaeValue is calling the specialization
1004  //in the underlying SPO and not using the default SPOSet implementation which
1005  //loops over single walker APIs (which have different values enforced in
1006  // DummySPOSetWithoutMW
1007 
1008  RotatedSPOs rot_spo0("rotated0", std::make_unique<DummySPOSetWithMW>("mw 0"));
1009  RotatedSPOs rot_spo1("rotated1", std::make_unique<DummySPOSetWithMW>("mw 1"));
1010  RefVectorWithLeader<SPOSet> spo_list(rot_spo0, {rot_spo0, rot_spo1});
1011 
1012  ResourceCollection spo_res("test_rot_res");
1013  rot_spo0.createResource(spo_res);
1014  ResourceCollectionTeamLock<SPOSet> mw_sposet_lock(spo_res, spo_list);
1015 
1016  const SimulationCell simulation_cell;
1017  ParticleSet elec0(simulation_cell);
1018  ParticleSet elec1(simulation_cell);
1019  RefVectorWithLeader<ParticleSet> p_list(elec0, {elec0, elec1});
1020 
1021  SPOSet::ValueVector psi0(3);
1022  SPOSet::ValueVector psi1(3);
1023  RefVector<SPOSet::ValueVector> psi_v_list{psi0, psi1};
1024 
1025  rot_spo0.mw_evaluateValue(spo_list, p_list, 0, psi_v_list);
1026  for (int iw = 0; iw < spo_list.size(); iw++)
1027  {
1028  CHECK(psi_v_list[iw].get()[0] == ValueApprox(321.));
1029  CHECK(psi_v_list[iw].get()[1] == ValueApprox(654.));
1030  CHECK(psi_v_list[iw].get()[2] == ValueApprox(987.));
1031  }
1032 #ifdef QMC_COMPLEX
1033  SPOSet::GradVector dpsi0(3);
1034  SPOSet::GradVector dpsi1(3);
1035  RefVector<SPOSet::GradVector> dpsi_v_list{dpsi0, dpsi1};
1036  SPOSet::ValueVector d2psi0(3);
1037  SPOSet::ValueVector d2psi1(3);
1038  RefVector<SPOSet::ValueVector> d2psi_v_list{d2psi0, d2psi1};
1039  SPOSet::OffloadMatrix<SPOSet::ComplexType> mw_dspin(2, 3);
1040  rot_spo0.mw_evaluateVGLWithSpin(spo_list, p_list, 0, psi_v_list, dpsi_v_list, d2psi_v_list, mw_dspin);
1041  for (int iw = 0; iw < spo_list.size(); iw++)
1042  {
1043  CHECK(dpsi_v_list[iw].get()[0][0] == ValueApprox(0.321));
1044  CHECK(dpsi_v_list[iw].get()[0][1] == ValueApprox(0.654));
1045  CHECK(dpsi_v_list[iw].get()[0][2] == ValueApprox(0.987));
1046  }
1047  for (auto& m : mw_dspin)
1048  CHECK(m == ComplexApprox(SPOSet::ComplexType(0.2, 0.1)));
1049 #endif
1050  }
1051 }
OrbitalSetTraits< ValueType >::ValueVector ValueVector
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
QMCTraits::ComplexType ComplexType

◆ TEST_CASE() [535/537]

qmcplusplus::TEST_CASE ( "ReadMolecularOrbital GTO HCN"  ,
""  [wavefunction] 
)

Definition at line 1032 of file test_MO.cpp.

References test_HCN().

1032 { test_HCN(false); }
void test_HCN(bool transform)
Definition: test_MO.cpp:595

◆ TEST_CASE() [536/537]

qmcplusplus::TEST_CASE ( "ReadMolecularOrbital Numerical HCN"  ,
""  [wavefunction] 
)

Definition at line 1034 of file test_MO.cpp.

References test_HCN().

1034 { test_HCN(true); }
void test_HCN(bool transform)
Definition: test_MO.cpp:595

◆ TEST_CASE() [537/537]

qmcplusplus::TEST_CASE ( "Eloc_Derivatives:proto_sd_wj"  ,
""  [hamiltonian] 
)

Definition at line 1038 of file test_ion_derivs.cpp.

References app_log(), B(), WaveFunctionFactory::buildTWF(), CHECK(), OHMMS::Controller, convertToReal(), create_CN_Hamiltonian(), create_CN_particlesets(), qmcplusplus::Units::charge::e, QMCHamiltonian::evaluateIonDerivsDeterministicFast(), OperatorBase::evaluateOneBodyOpMatrix(), OperatorBase::evaluateOneBodyOpMatrixForceDeriv(), QMCHamiltonian::getHamiltonian(), Libxml2Document::getRoot(), ham, TrialWaveFunction::initializeTWFFastDerivWrapper(), OHMMS_DIM, okay, Libxml2Document::parse(), REQUIRE(), and twf.

1038  :proto_sd_wj", "[hamiltonian]")
1039 {
1040  app_log() << "========================================================================================\n";
1041  app_log() << "========================================================================================\n";
1042  app_log() << "====================Ion Derivative Test: Prototype Single Slater+Jastrow===========\n";
1043  app_log() << "========================================================================================\n";
1044  app_log() << "========================================================================================\n";
1045  using RealType = QMCTraits::RealType;
1046  using ValueType = QMCTraits::ValueType;
1047 
1048  Communicate* c = OHMMS::Controller;
1049 
1050  const SimulationCell simulation_cell;
1051  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
1052  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
1053  auto &ions(*ions_ptr), elec(*elec_ptr);
1054 
1055  //Build a CN test molecule.
1056  create_CN_particlesets(elec, ions);
1057  //////////////////////////////////
1058  /////////////////////////////////
1059  //Incantation to read and build a TWF from cn.wfnoj//
1060  Libxml2Document doc2;
1061  bool okay = doc2.parse("cn.wfj.xml");
1062  REQUIRE(okay);
1063  xmlNodePtr root2 = doc2.getRoot();
1064 
1065  WaveFunctionComponentBuilder::PSetMap particle_set_map;
1066  particle_set_map.emplace("e", std::move(elec_ptr));
1067  particle_set_map.emplace("ion0", std::move(ions_ptr));
1068 
1069  RuntimeOptions runtime_options;
1070  WaveFunctionFactory wff(elec, particle_set_map, c);
1071  HamiltonianFactory::PsiPoolType psi_map;
1072  psi_map.emplace("psi0", wff.buildTWF(root2, runtime_options));
1073 
1074  TrialWaveFunction* psi = psi_map["psi0"].get();
1075  REQUIRE(psi != nullptr);
1076  //end incantation
1077 
1078  TWFFastDerivWrapper twf;
1079 
1080  psi->initializeTWFFastDerivWrapper(elec, twf);
1081  SPOSet::ValueVector values;
1082  SPOSet::GradVector dpsi;
1083  SPOSet::ValueVector d2psi;
1084  values.resize(9);
1085  dpsi.resize(9);
1086  d2psi.resize(9);
1087 
1088  HamiltonianFactory hf("h0", elec, particle_set_map, psi_map, c);
1089 
1090  QMCHamiltonian& ham = create_CN_Hamiltonian(hf);
1091 
1092  //This is already defined in QMCHamiltonian, but keep it here for easy access.
1093  enum observ_id
1094  {
1095  KINETIC = 0,
1096  LOCALECP,
1097  NONLOCALECP,
1098  ELECELEC,
1099  IONION
1100  };
1101 
1102  using ValueMatrix = SPOSet::ValueMatrix;
1103 
1104  //This builds and initializes all the auxiliary matrices needed to do fast derivative evaluation.
1105  //These matrices are not necessarily square to accomodate orb opt and multidets.
1106 
1107  ValueMatrix upmat; //Up slater matrix.
1108  ValueMatrix dnmat; //Down slater matrix.
1109  int Nup = 5; //These are hard coded until the interface calls get implemented/cleaned up.
1110  int Ndn = 4;
1111  int Norb = 14;
1112  upmat.resize(Nup, Norb);
1113  dnmat.resize(Ndn, Norb);
1114 
1115  //The first two lines consist of vectors of matrices. The vector index corresponds to the species ID.
1116  //For example, matlist[0] will be the slater matrix for up electrons, matlist[1] will be for down electrons.
1117  std::vector<ValueMatrix> matlist; //Vector of slater matrices.
1118  std::vector<ValueMatrix> B, X; //Vector of B matrix, and auxiliary X matrix.
1119 
1120  //The first index corresponds to the x,y,z force derivative. Current interface assumes that the ion index is fixed,
1121  // so these vectors of vectors of matrices store the derivatives of the M and B matrices.
1122  // dB[0][0] is the x component of the iat force derivative of the up B matrix, dB[0][1] is for the down B matrix.
1123 
1124  std::vector<std::vector<ValueMatrix>> dM; //Derivative of slater matrix.
1125  std::vector<std::vector<ValueMatrix>> dB; //Derivative of B matrices.
1126  matlist.push_back(upmat);
1127  matlist.push_back(dnmat);
1128 
1129  dM.push_back(matlist);
1130  dM.push_back(matlist);
1131  dM.push_back(matlist);
1132 
1133  dB.push_back(matlist);
1134  dB.push_back(matlist);
1135  dB.push_back(matlist);
1136 
1137  B.push_back(upmat);
1138  B.push_back(dnmat);
1139 
1140  X.push_back(upmat);
1141  X.push_back(dnmat);
1142 
1143  twf.getM(elec, matlist);
1144 
1145  OperatorBase* kinop = ham.getHamiltonian(KINETIC);
1146 
1147  kinop->evaluateOneBodyOpMatrix(elec, twf, B);
1148 
1149 
1150  std::vector<ValueMatrix> minv;
1151  std::vector<ValueMatrix> B_gs, M_gs; //We are creating B and M matrices for assumed ground-state occupations.
1152  //These are N_s x N_s square matrices (N_s is number of particles for species s).
1153  B_gs.push_back(upmat);
1154  B_gs.push_back(dnmat);
1155  M_gs.push_back(upmat);
1156  M_gs.push_back(dnmat);
1157  minv.push_back(upmat);
1158  minv.push_back(dnmat);
1159 
1160 
1161  // twf.getM(elec, matlist);
1162  std::vector<std::vector<ValueMatrix>> dB_gs;
1163  std::vector<std::vector<ValueMatrix>> dM_gs;
1164  std::vector<ValueMatrix> tmp_gs;
1165  twf.getGSMatrices(B, B_gs);
1166  twf.getGSMatrices(matlist, M_gs);
1167  twf.invertMatrices(M_gs, minv);
1168  twf.buildX(minv, B_gs, X);
1169  for (int id = 0; id < matlist.size(); id++)
1170  {
1171  // int ptclnum = twf.numParticles(id);
1172  int ptclnum = (id == 0 ? Nup : Ndn); //hard coded until twf interface comes online.
1173  ValueMatrix gs_m;
1174  gs_m.resize(ptclnum, ptclnum);
1175  tmp_gs.push_back(gs_m);
1176  }
1177 
1178 
1179  dB_gs.push_back(tmp_gs);
1180  dB_gs.push_back(tmp_gs);
1181  dB_gs.push_back(tmp_gs);
1182 
1183  dM_gs.push_back(tmp_gs);
1184  dM_gs.push_back(tmp_gs);
1185  dM_gs.push_back(tmp_gs);
1186 
1187  //Finally, we have all the data structures with the right dimensions. Continue.
1188 
1189  ParticleSet::ParticleGradient fkin_complex(ions.getTotalNum());
1190  ParticleSet::ParticlePos fkin(ions.getTotalNum());
1191 
1192 
1193  for (int ionid = 0; ionid < ions.getTotalNum(); ionid++)
1194  {
1195  for (int idim = 0; idim < OHMMS_DIM; idim++)
1196  {
1197  twf.wipeMatrices(dB[idim]);
1198  twf.wipeMatrices(dM[idim]);
1199  }
1200 
1201  twf.getIonGradM(elec, ions, ionid, dM);
1202  kinop->evaluateOneBodyOpMatrixForceDeriv(elec, ions, twf, ionid, dB);
1203 
1204  for (int idim = 0; idim < OHMMS_DIM; idim++)
1205  {
1206  twf.getGSMatrices(dB[idim], dB_gs[idim]);
1207  twf.getGSMatrices(dM[idim], dM_gs[idim]);
1208  fkin_complex[ionid][idim] = twf.computeGSDerivative(minv, X, dM_gs[idim], dB_gs[idim]);
1209  }
1210  convertToReal(fkin_complex[ionid], fkin[ionid]);
1211  }
1212 
1213 
1214  ValueType keval = 0.0;
1215  RealType keobs = 0.0;
1216  keval = twf.trAB(minv, B_gs);
1217  convertToReal(keval, keobs);
1218  CHECK(keobs == Approx(7.6732404154e+00));
1219 
1220 #if defined(MIXED_PRECISION)
1221  CHECK(fkin[0][0] == Approx(-3.3359153349010735).epsilon(1e-4));
1222  CHECK(fkin[0][1] == Approx(30.0487085581835309).epsilon(1e-4));
1223  CHECK(fkin[0][2] == Approx(126.5885230360197369).epsilon(1e-4));
1224  CHECK(fkin[1][0] == Approx(2.7271604366774223).epsilon(1e-4));
1225  CHECK(fkin[1][1] == Approx(-3.5321234918228579).epsilon(1e-4));
1226  CHECK(fkin[1][2] == Approx(5.8844148870917925).epsilon(1e-4));
1227 #else
1228  CHECK(fkin[0][0] == Approx(-3.3359153349010735));
1229  CHECK(fkin[0][1] == Approx(30.0487085581835309));
1230  CHECK(fkin[0][2] == Approx(126.5885230360197369));
1231  CHECK(fkin[1][0] == Approx(2.7271604366774223));
1232  CHECK(fkin[1][1] == Approx(-3.5321234918228579));
1233  CHECK(fkin[1][2] == Approx(5.8844148870917925));
1234 #endif
1235  app_log() << " KEVal = " << keval << std::endl;
1236 
1237  app_log() << " Now evaluating nonlocalecp\n";
1238  OperatorBase* nlppop = ham.getHamiltonian(NONLOCALECP);
1239  app_log() << "nlppop = " << nlppop << std::endl;
1240  app_log() << " Evaluated. Calling evaluteOneBodyOpMatrix\n";
1241 
1242 
1243  twf.wipeMatrices(B);
1244  twf.wipeMatrices(B_gs);
1245  twf.wipeMatrices(X);
1246  nlppop->evaluateOneBodyOpMatrix(elec, twf, B);
1247  twf.getGSMatrices(B, B_gs);
1248  twf.buildX(minv, B_gs, X);
1249 
1250  ValueType nlpp = 0.0;
1251  RealType nlpp_obs = 0.0;
1252  nlpp = twf.trAB(minv, B_gs);
1253  convertToReal(nlpp, nlpp_obs);
1254 
1255  app_log() << "NLPP = " << nlpp << std::endl;
1256 
1257  CHECK(nlpp_obs == Approx(1.37365415248e+01));
1258 
1259  ParticleSet::ParticleGradient fnlpp_complex(ions.getTotalNum());
1260  ParticleSet::ParticlePos fnlpp(ions.getTotalNum());
1261  for (int ionid = 0; ionid < ions.getTotalNum(); ionid++)
1262  {
1263  for (int idim = 0; idim < OHMMS_DIM; idim++)
1264  {
1265  twf.wipeMatrices(dB[idim]);
1266  twf.wipeMatrices(dM[idim]);
1267  }
1268 
1269  twf.getIonGradM(elec, ions, ionid, dM);
1270  nlppop->evaluateOneBodyOpMatrixForceDeriv(elec, ions, twf, ionid, dB);
1271 
1272  for (int idim = 0; idim < OHMMS_DIM; idim++)
1273  {
1274  twf.getGSMatrices(dB[idim], dB_gs[idim]);
1275  twf.getGSMatrices(dM[idim], dM_gs[idim]);
1276  fnlpp_complex[ionid][idim] = twf.computeGSDerivative(minv, X, dM_gs[idim], dB_gs[idim]);
1277  }
1278  convertToReal(fnlpp_complex[ionid], fnlpp[ionid]);
1279  }
1280 
1281 #if defined(MIXED_PRECISION)
1282  CHECK(fnlpp[0][0] == Approx(27.1517161490208956).epsilon(2e-4));
1283  CHECK(fnlpp[0][1] == Approx(-42.8268964286715459).epsilon(2e-4));
1284  CHECK(fnlpp[0][2] == Approx(-101.5046844660360961).epsilon(2e-4));
1285  CHECK(fnlpp[1][0] == Approx(2.2255825024686260).epsilon(2e-4));
1286  CHECK(fnlpp[1][1] == Approx(1.1362118534918864).epsilon(2e-4));
1287  CHECK(fnlpp[1][2] == Approx(-4.5825638607333019).epsilon(2e-4));
1288 #else
1289  CHECK(fnlpp[0][0] == Approx(27.1517161490208956));
1290  CHECK(fnlpp[0][1] == Approx(-42.8268964286715459));
1291  CHECK(fnlpp[0][2] == Approx(-101.5046844660360961));
1292  CHECK(fnlpp[1][0] == Approx(2.2255825024686260));
1293  CHECK(fnlpp[1][1] == Approx(1.1362118534918864));
1294  CHECK(fnlpp[1][2] == Approx(-4.5825638607333019));
1295 #endif
1296  //This is to test the fast force API in QMCHamiltonian.
1297  ParticleSet::ParticlePos dedr(ions.getTotalNum());
1298  ParticleSet::ParticlePos dpsidr(ions.getTotalNum());
1299  ham.evaluateIonDerivsDeterministicFast(elec, ions, *psi, twf, dedr, dpsidr);
1300 }

◆ test_CoulombPBCAA_3p()

void qmcplusplus::test_CoulombPBCAA_3p ( DynamicCoordinateKind  kind)

Definition at line 196 of file test_coulomb_pbcAA.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), LRCoulombSingleton::CoulombHandler, ParticleSet::create(), CoulombPBCAA::createResource(), ParticleSet::createResource(), ParticleSet::createSK(), DC_POS_OFFLOAD, CoulombPBCAA::get_madelung_constant(), ParticleSet::getSpeciesSet(), OperatorBase::getValue(), lattice, CoulombPBCAA::mw_evaluate(), ParticleSet::mw_update(), ParticleSet::R, and ParticleSet::setName().

Referenced by TEST_CASE().

197 {
198  const double alat = 1.0;
199  const double vmad_bcc = -1.819616724754322 / alat;
200  LRCoulombSingleton::CoulombHandler = 0;
201 
202  CrystalLattice<OHMMS_PRECISION, OHMMS_DIM> lattice;
203  lattice.BoxBConds = true; // periodic
204  lattice.R = 0.5 * alat;
205  lattice.R(0, 0) = -0.5 * alat;
206  lattice.R(1, 1) = -0.5 * alat;
207  lattice.R(2, 2) = -0.5 * alat;
208  lattice.reset();
209 
210  const SimulationCell simulation_cell(lattice);
211  ParticleSet elec(simulation_cell, kind);
212 
213  elec.setName("elec");
214  elec.create({1, 2});
215  elec.R[0] = {0.0, 0.0, 0.0};
216  elec.R[1] = {0.1, 0.2, 0.3};
217  elec.R[2] = {0.3, 0.1, 0.2};
218 
219  SpeciesSet& tspecies = elec.getSpeciesSet();
220  int upIdx = tspecies.addSpecies("u");
221  int dnIdx = tspecies.addSpecies("d");
222  int chargeIdx = tspecies.addAttribute("charge");
223  int massIdx = tspecies.addAttribute("mass");
224  tspecies(chargeIdx, upIdx) = -1;
225  tspecies(chargeIdx, dnIdx) = -1;
226  tspecies(massIdx, upIdx) = 1.0;
227  tspecies(massIdx, dnIdx) = 1.0;
228 
229  elec.createSK();
230 
231  CoulombPBCAA caa(elec, true, false, kind == DynamicCoordinateKind::DC_POS_OFFLOAD);
232 
233  ParticleSet elec_clone(elec);
234  CoulombPBCAA caa_clone(caa);
235 
236  elec_clone.R[2] = {0.2, 0.3, 0.0};
237 
238  // testing batched interfaces
239  ResourceCollection pset_res("test_pset_res");
240  ResourceCollection caa_res("test_caa_res");
241  elec.createResource(pset_res);
242  caa.createResource(caa_res);
243 
244  // testing batched interfaces
245  RefVectorWithLeader<ParticleSet> p_ref_list(elec, {elec, elec_clone});
246  RefVectorWithLeader<OperatorBase> caa_ref_list(caa, {caa, caa_clone});
247 
248  // dummy psi
249  RuntimeOptions runtime_options;
250  TrialWaveFunction psi(runtime_options);
251  TrialWaveFunction psi_clone(runtime_options);
252  RefVectorWithLeader<TrialWaveFunction> psi_ref_list(psi, {psi, psi_clone});
253 
254  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_ref_list);
255  ResourceCollectionTeamLock<OperatorBase> mw_caa_lock(caa_res, caa_ref_list);
256 
257  ParticleSet::mw_update(p_ref_list);
258  caa.mw_evaluate(caa_ref_list, psi_ref_list, p_ref_list);
259 
260  CHECK(caa.getValue() == Approx(-5.4954533536));
261  CHECK(caa_clone.getValue() == Approx(-6.329373489));
262 
263  CHECK(caa.get_madelung_constant() == Approx(vmad_bcc));
264  CHECK(caa_clone.get_madelung_constant() == Approx(vmad_bcc));
265 }
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ test_diamond_2x1x1_xml_input()

void qmcplusplus::test_diamond_2x1x1_xml_input ( const std::string &  spo_xml_string)

Definition at line 30 of file test_spo_collection_input_spline.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), CHECK(), OHMMS::Controller, ParticleSet::create(), doc, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), imag(), lattice, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), and Vector< T, Alloc >::size().

Referenced by TEST_CASE().

31 {
33 
34  // diamondC_2x1x1
35  ParticleSet::ParticleLayout lattice;
36  lattice.R = {6.7463223, 6.7463223, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
37 
38  ParticleSetPool ptcl = ParticleSetPool(c);
39  ptcl.setSimulationCell(lattice);
40  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
41  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
42  ParticleSet& ions_(*ions_uptr);
43  ParticleSet& elec_(*elec_uptr);
44 
45  ions_.setName("ion");
46  ptcl.addParticleSet(std::move(ions_uptr));
47  ions_.create({4});
48  ions_.R[0] = {0.0, 0.0, 0.0};
49  ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
50  ions_.R[2] = {3.37316115, 3.37316115, 0.0};
51  ions_.R[3] = {5.05974173, 5.05974173, 1.68658058};
52  elec_.setName("elec");
53  ptcl.addParticleSet(std::move(elec_uptr));
54  elec_.create({2});
55  elec_.R[0] = {0.0, 0.0, 0.0};
56  elec_.R[1] = {0.0, 1.0, 0.0};
57  SpeciesSet& tspecies = elec_.getSpeciesSet();
58  int upIdx = tspecies.addSpecies("u");
59  int chargeIdx = tspecies.addAttribute("charge");
60  tspecies(chargeIdx, upIdx) = -1;
61 
63  bool okay = doc.parseFromString(spo_xml_string);
64  REQUIRE(okay);
65 
66  xmlNodePtr ein_xml = doc.getRoot();
67 
68  WaveFunctionFactory wf_factory(elec_, ptcl.getPool(), c);
69  RuntimeOptions runtime_options;
70  auto twf_ptr = wf_factory.buildTWF(ein_xml, runtime_options);
71 
72  std::unique_ptr<SPOSet> spo(twf_ptr->getSPOSet("spo").makeClone());
73 
74  // for vgl
75  SPOSet::ValueMatrix psiM(elec_.R.size(), spo->getOrbitalSetSize());
76  SPOSet::GradMatrix dpsiM(elec_.R.size(), spo->getOrbitalSetSize());
77  SPOSet::ValueMatrix d2psiM(elec_.R.size(), spo->getOrbitalSetSize());
78  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM, dpsiM, d2psiM);
79 
80  // real part
81  // due to the different ordering of bands skip the tests on CUDA+Real builds
82  // checking evaluations, reference values are not independently generated.
83  // value
84  CHECK(std::real(psiM[1][0]) == Approx(0.9008999467));
85  CHECK(std::real(psiM[1][1]) == Approx(1.2383049726));
86  // grad
87  CHECK(std::real(dpsiM[1][0][0]) == Approx(0.0025820041));
88  CHECK(std::real(dpsiM[1][0][1]) == Approx(-0.1880052537));
89  CHECK(std::real(dpsiM[1][0][2]) == Approx(-0.0025404284));
90  CHECK(std::real(dpsiM[1][1][0]) == Approx(0.1069662273));
91  CHECK(std::real(dpsiM[1][1][1]) == Approx(-0.4364597797));
92  CHECK(std::real(dpsiM[1][1][2]) == Approx(-0.106951952));
93  // lapl
94  CHECK(std::real(d2psiM[1][0]) == Approx(-1.3757134676));
95  CHECK(std::real(d2psiM[1][1]) == Approx(-2.4803137779));
96 
97 #if defined(QMC_COMPLEX)
98  // imaginary part
99  // value
100  CHECK(std::imag(psiM[1][0]) == Approx(0.9008999467));
101  CHECK(std::imag(psiM[1][1]) == Approx(1.2383049726));
102  // grad
103  CHECK(std::imag(dpsiM[1][0][0]) == Approx(0.0025820041));
104  CHECK(std::imag(dpsiM[1][0][1]) == Approx(-0.1880052537));
105  CHECK(std::imag(dpsiM[1][0][2]) == Approx(-0.0025404284));
106  CHECK(std::imag(dpsiM[1][1][0]) == Approx(0.1069453433));
107  CHECK(std::imag(dpsiM[1][1][1]) == Approx(-0.43649593));
108  CHECK(std::imag(dpsiM[1][1][2]) == Approx(-0.1069145575));
109  // lapl
110  CHECK(std::imag(d2psiM[1][0]) == Approx(-1.3757134676));
111  CHECK(std::imag(d2psiM[1][1]) == Approx(-2.4919104576));
112 #endif
113 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ test_dirac_ao()

void qmcplusplus::test_dirac_ao ( )

Definition at line 94 of file test_cartesian_ao.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), CHECK(), OHMMS::Controller, SPOSetBuilderFactory::createSPOSetBuilder(), doc, Libxml2Document::getRoot(), Libxml2Document::getXPathContext(), ispecies, okay, Libxml2Document::parse(), and REQUIRE().

Referenced by TEST_CASE().

95 {
96  std::ostringstream section_name;
97  section_name << "Dirac AO ordering";
98 
99  SECTION(section_name.str())
100  {
102 
103  const SimulationCell simulation_cell;
104  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
105  auto& elec(*elec_ptr);
106  std::vector<int> agroup(2);
107  agroup[0] = 1;
108  elec.setName("e");
109  elec.create(agroup);
110  elec.R[0] = 0.0;
111 
112  SpeciesSet& tspecies = elec.getSpeciesSet();
113  int upIdx = tspecies.addSpecies("u");
114  int massIdx = tspecies.addAttribute("mass");
115  tspecies(massIdx, upIdx) = 1.0;
116 
117  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
118  auto& ions(*ions_ptr);
119  ions.setName("ion0");
120  ions.create({1});
121  ions.R[0] = 0.0;
122  SpeciesSet& ispecies = ions.getSpeciesSet();
123  int hIdx = ispecies.addSpecies("H");
124  ions.update();
125 
126  elec.addTable(ions);
127  elec.update();
128 
130  bool okay = doc.parse("dirac_order.wfnoj.xml");
131  REQUIRE(okay);
132  xmlNodePtr root = doc.getRoot();
133 
134  WaveFunctionComponentBuilder::PSetMap particle_set_map;
135  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
136  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
137 
138 
139  SPOSetBuilderFactory bf(c, elec, particle_set_map);
140 
141  OhmmsXPathObject MO_base("//determinantset", doc.getXPathContext());
142  REQUIRE(MO_base.size() == 1);
143 
144  const auto bb_ptr = bf.createSPOSetBuilder(MO_base[0]);
145  auto& bb(*bb_ptr);
146 
147  OhmmsXPathObject slater_base("//determinant", doc.getXPathContext());
148  auto sposet = bb.createSPOSet(slater_base[0]);
149 
150  SPOSet::ValueVector values;
151  values.resize(1);
152 
153  // Call makeMove to compute the distances
154  ParticleSet::SingleParticlePos newpos(0.1, -0.3, 0.2);
155  elec.makeMove(0, newpos);
156 
157  sposet->evaluateValue(elec, 0, values);
158 
159  //from ao_order_test.py
160  CHECK(values[0] == Approx(0.35953790416302006).epsilon(1E-6));
161  }
162 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180

◆ test_DiracDeterminant_delayed_update()

void qmcplusplus::test_DiracDeterminant_delayed_update ( const DetMatInvertor  inverter_kind)

Definition at line 301 of file test_DiracDeterminant.cpp.

References app_log(), CHECK(), check_matrix(), Matrix< T, Alloc >::cols(), LogToValue< T >::convert(), ParticleSet::create(), Matrix< T, Alloc >::data(), exp(), DiracMatrix< T_FP >::invert_transpose(), Matrix< T, Alloc >::resize(), Matrix< T, Alloc >::rows(), and qmcplusplus::simd::transpose().

302 {
303  auto spo_init = std::make_unique<FakeSPO>();
304  const int norb = 4;
305  spo_init->setOrbitalSetSize(norb);
306  // maximum delay 2
307  DET ddc(std::move(spo_init), 0, norb, 2, inverter_kind);
308  auto spo = dynamic_cast<FakeSPO*>(ddc.getPhi());
309 
310  // occurs in call to registerData
311  ddc.dpsiV.resize(norb);
312  ddc.d2psiV.resize(norb);
313 
314  const SimulationCell simulation_cell;
315  ParticleSet elec(simulation_cell);
316 
317  elec.create({4});
318  ddc.recompute(elec);
319 
320  Matrix<ValueType> orig_a;
321  orig_a.resize(4, 4);
322  orig_a = spo->a2;
323 
324  for (int i = 0; i < 3; i++)
325  {
326  for (int j = 0; j < norb; j++)
327  {
328  orig_a(j, i) = spo->v2(i, j);
329  }
330  }
331 
332  //check_matrix(ddc.psiM, b);
333  DiracMatrix<ValueType> dm;
334 
335  Matrix<ValueType> a_update1, scratchT;
336  scratchT.resize(4, 4);
337  a_update1.resize(4, 4);
338  a_update1 = spo->a2;
339  for (int j = 0; j < norb; j++)
340  {
341  a_update1(j, 0) = spo->v2(0, j);
342  }
343 
344  Matrix<ValueType> a_update2;
345  a_update2.resize(4, 4);
346  a_update2 = spo->a2;
347  for (int j = 0; j < norb; j++)
348  {
349  a_update2(j, 0) = spo->v2(0, j);
350  a_update2(j, 1) = spo->v2(1, j);
351  }
352 
353  Matrix<ValueType> a_update3;
354  a_update3.resize(4, 4);
355  a_update3 = spo->a2;
356  for (int j = 0; j < norb; j++)
357  {
358  a_update3(j, 0) = spo->v2(0, j);
359  a_update3(j, 1) = spo->v2(1, j);
360  a_update3(j, 2) = spo->v2(2, j);
361  }
362 
363 
365  PsiValue det_ratio = ddc.ratioGrad(elec, 0, grad);
366 
367  simd::transpose(a_update1.data(), a_update1.rows(), a_update1.cols(), scratchT.data(), scratchT.rows(),
368  scratchT.cols());
369  LogValue det_update1;
370  dm.invert_transpose(scratchT, a_update1, det_update1);
371  PsiValue det_ratio1 = LogToValue<ValueType>::convert(det_update1 - ddc.get_log_value());
372 #ifdef DUMP_INFO
373  app_log() << "det 0 = " << std::exp(ddc.get_log_value()) << std::endl;
374  app_log() << "det 1 = " << std::exp(det_update1) << std::endl;
375  app_log() << "det ratio 1 = " << det_ratio1 << std::endl;
376 #endif
377  //double det_ratio1 = 0.178276269185;
378 
379  CHECK(det_ratio1 == ValueApprox(det_ratio));
380 
381  // update of Ainv in ddc is delayed
382  ddc.acceptMove(elec, 0, true);
383  // force update Ainv in ddc using SM-1 code path
384  // also force population of dpsiM or you will have invalid grad below
385  ddc.completeUpdates();
386  check_matrix(a_update1, ddc.psiM);
387 
388  grad = ddc.evalGrad(elec, 1);
389 
390  PsiValue det_ratio2 = ddc.ratioGrad(elec, 1, grad);
391  simd::transpose(a_update2.data(), a_update2.rows(), a_update2.cols(), scratchT.data(), scratchT.rows(),
392  scratchT.cols());
393  LogValue det_update2;
394  dm.invert_transpose(scratchT, a_update2, det_update2);
395  PsiValue det_ratio2_val = LogToValue<ValueType>::convert(det_update2 - det_update1);
396 #ifdef DUMP_INFO
397  app_log() << "det 1 = " << std::exp(ddc.get_log_value()) << std::endl;
398  app_log() << "det 2 = " << std::exp(det_update2) << std::endl;
399  app_log() << "det ratio 2 = " << det_ratio2 << std::endl;
400 #endif
401  // check ratio computed directly and the one computed by ddc with no delay
402  //double det_ratio2_val = 0.178276269185;
403  CHECK(det_ratio2 == ValueApprox(det_ratio2_val));
404 
405  // update of Ainv in ddc is delayed
406  ddc.acceptMove(elec, 1, true);
407 
408  grad = ddc.evalGrad(elec, 2);
409 
410  PsiValue det_ratio3 = ddc.ratioGrad(elec, 2, grad);
411  simd::transpose(a_update3.data(), a_update3.rows(), a_update3.cols(), scratchT.data(), scratchT.rows(),
412  scratchT.cols());
413  LogValue det_update3;
414  dm.invert_transpose(scratchT, a_update3, det_update3);
415  PsiValue det_ratio3_val = LogToValue<ValueType>::convert(det_update3 - det_update2);
416 #ifdef DUMP_INFO
417  app_log() << "det 2 = " << std::exp(ddc.get_log_value()) << std::endl;
418  app_log() << "det 3 = " << std::exp(det_update3) << std::endl;
419  app_log() << "det ratio 3 = " << det_ratio3 << std::endl;
420 #endif
421  // check ratio computed directly and the one computed by ddc with 1 delay
422  CHECK(det_ratio3 == ValueApprox(det_ratio3_val));
423  //check_value(det_ratio3, det_ratio3_val);
424 
425  // maximal delay reached and Ainv is updated fully
426  ddc.acceptMove(elec, 2, true);
427  ddc.completeUpdates();
428 
429  // fresh invert orig_a
430  simd::transpose(orig_a.data(), orig_a.rows(), orig_a.cols(), scratchT.data(), scratchT.rows(), scratchT.cols());
431  dm.invert_transpose(scratchT, orig_a, det_update3);
432 
433 #ifdef DUMP_INFO
434  app_log() << "original " << std::endl;
435  app_log() << orig_a << std::endl;
436  app_log() << "delayed update " << std::endl;
437  app_log() << ddc.psiM << std::endl;
438 #endif
439 
440  // compare all the elements of psiM in ddc and orig_a
441  check_matrix(orig_a, ddc.psiM);
442 }
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
std::ostream & app_log()
Definition: OutputManager.h:65
LatticeGaussianProduct::GradType GradType
void check_matrix(Matrix< T1 > &a, Matrix< T2 > &b)
real convert(real value, units units_in, units units_out)
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
AntiSymTensor< T, D > transpose(const AntiSymTensor< T, D > &rhs)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::complex< double > LogValue

◆ test_DiracDeterminant_first()

void qmcplusplus::test_DiracDeterminant_first ( const DetMatInvertor  inverter_kind)

Definition at line 52 of file test_DiracDeterminant.cpp.

References ParticleSet::acceptMove(), CHECK(), check_matrix(), ParticleSet::create(), ParticleSet::getTotalNum(), ParticleSet::makeMove(), VirtualParticleSet::makeMoves(), ParticleSet::makeVirtualMoves(), ParticleSet::R, ParticleSet::rejectMove(), and Matrix< T, Alloc >::resize().

53 {
54  auto spo_init = std::make_unique<FakeSPO>();
55  const int norb = 3;
56  spo_init->setOrbitalSetSize(norb);
57  DET ddb(std::move(spo_init), 0, norb, 1, inverter_kind);
58  auto spo = dynamic_cast<FakeSPO*>(ddb.getPhi());
59 
60  // occurs in call to registerData
61  ddb.dpsiV.resize(norb);
62  ddb.d2psiV.resize(norb);
63 
64  const SimulationCell simulation_cell;
65  ParticleSet elec(simulation_cell);
66 
67  elec.create({3});
68  ddb.recompute(elec);
69 
70  Matrix<ValueType> b;
71  b.resize(3, 3);
72 
73  b(0, 0) = 0.6159749342;
74  b(0, 1) = -0.2408954682;
75  b(0, 2) = -0.1646081192;
76  b(1, 0) = 0.07923894288;
77  b(1, 1) = 0.1496231042;
78  b(1, 2) = -0.1428117337;
79  b(2, 0) = -0.2974298429;
80  b(2, 1) = -0.04586322768;
81  b(2, 2) = 0.3927890292;
82 
83  check_matrix(ddb.psiM, b);
84 
86  PsiValue det_ratio = ddb.ratioGrad(elec, 0, grad);
87  PsiValue det_ratio1 = 0.178276269185;
88  CHECK(det_ratio1 == ValueApprox(det_ratio));
89 
90  ddb.acceptMove(elec, 0);
91 
92  b(0, 0) = 3.455170657;
93  b(0, 1) = -1.35124809;
94  b(0, 2) = -0.9233316353;
95  b(1, 0) = 0.05476311768;
96  b(1, 1) = 0.1591951095;
97  b(1, 2) = -0.1362710138;
98  b(2, 0) = -2.235099338;
99  b(2, 1) = 0.7119205298;
100  b(2, 2) = 0.9105960265;
101 
102  check_matrix(ddb.psiM, b);
103 
104  // set virtutal particle position
105  PosType newpos(0.3, 0.2, 0.5);
106 
107  elec.makeVirtualMoves(newpos);
108  std::vector<ValueType> ratios(elec.getTotalNum());
109  ddb.evaluateRatiosAlltoOne(elec, ratios);
110 
111  CHECK(std::real(ratios[0]) == Approx(1.2070809985));
112  CHECK(std::real(ratios[1]) == Approx(0.2498726439));
113  CHECK(std::real(ratios[2]) == Approx(-1.3145695364));
114 
115  elec.makeMove(0, newpos - elec.R[0]);
116  PsiValue ratio_0 = ddb.ratio(elec, 0);
117  elec.rejectMove(0);
118 
119  CHECK(std::real(ratio_0) == Approx(-0.5343861437));
120 
121  VirtualParticleSet VP(elec, 2);
122  std::vector<PosType> newpos2(2);
123  std::vector<ValueType> ratios2(2);
124  newpos2[0] = newpos - elec.R[1];
125  newpos2[1] = PosType(0.2, 0.5, 0.3) - elec.R[1];
126  VP.makeMoves(elec, 1, newpos2);
127  ddb.evaluateRatios(VP, ratios2);
128 
129  CHECK(std::real(ratios2[0]) == Approx(0.4880285278));
130  CHECK(std::real(ratios2[1]) == Approx(0.9308456444));
131 
132  //test acceptMove
133  elec.makeMove(1, newpos - elec.R[1]);
134  PsiValue ratio_1 = ddb.ratio(elec, 1);
135  ddb.acceptMove(elec, 1);
136  elec.acceptMove(1);
137 
138  CHECK(std::real(ratio_1) == Approx(0.9308456444));
139  CHECK(std::real(ddb.get_log_value()) == Approx(1.9891064655));
140 }
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
QMCTraits::RealType real
LatticeGaussianProduct::GradType GradType
QMCTraits::PosType PosType
void check_matrix(Matrix< T1 > &a, Matrix< T2 > &b)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ test_DiracDeterminant_second()

void qmcplusplus::test_DiracDeterminant_second ( const DetMatInvertor  inverter_kind)

Definition at line 160 of file test_DiracDeterminant.cpp.

References app_log(), CHECK(), check_matrix(), Matrix< T, Alloc >::cols(), LogToValue< T >::convert(), ParticleSet::create(), Matrix< T, Alloc >::data(), exp(), DiracMatrix< T_FP >::invert_transpose(), Matrix< T, Alloc >::resize(), Matrix< T, Alloc >::rows(), and qmcplusplus::simd::transpose().

161 {
162  auto spo_init = std::make_unique<FakeSPO>();
163  const int norb = 4;
164  spo_init->setOrbitalSetSize(norb);
165  DET ddb(std::move(spo_init), 0, norb, 1, inverter_kind);
166  auto spo = dynamic_cast<FakeSPO*>(ddb.getPhi());
167 
168  // occurs in call to registerData
169  ddb.dpsiV.resize(norb);
170  ddb.d2psiV.resize(norb);
171 
172  const SimulationCell simulation_cell;
173  ParticleSet elec(simulation_cell);
174 
175  elec.create({4});
176  ddb.recompute(elec);
177 
178  Matrix<ValueType> orig_a;
179  orig_a.resize(4, 4);
180  orig_a = spo->a2;
181 
182  for (int i = 0; i < 3; i++)
183  {
184  for (int j = 0; j < norb; j++)
185  {
186  orig_a(j, i) = spo->v2(i, j);
187  }
188  }
189 
190  //check_matrix(ddb.psiM, b);
191  DiracMatrix<ValueType> dm;
192 
193  Matrix<ValueType> a_update1, scratchT;
194  a_update1.resize(4, 4);
195  scratchT.resize(4, 4);
196  a_update1 = spo->a2;
197  for (int j = 0; j < norb; j++)
198  {
199  a_update1(j, 0) = spo->v2(0, j);
200  }
201 
202  Matrix<ValueType> a_update2;
203  a_update2.resize(4, 4);
204  a_update2 = spo->a2;
205  for (int j = 0; j < norb; j++)
206  {
207  a_update2(j, 0) = spo->v2(0, j);
208  a_update2(j, 1) = spo->v2(1, j);
209  }
210 
211  Matrix<ValueType> a_update3;
212  a_update3.resize(4, 4);
213  a_update3 = spo->a2;
214  for (int j = 0; j < norb; j++)
215  {
216  a_update3(j, 0) = spo->v2(0, j);
217  a_update3(j, 1) = spo->v2(1, j);
218  a_update3(j, 2) = spo->v2(2, j);
219  }
220 
222  PsiValue det_ratio = ddb.ratioGrad(elec, 0, grad);
223 
224  simd::transpose(a_update1.data(), a_update1.rows(), a_update1.cols(), scratchT.data(), scratchT.rows(),
225  scratchT.cols());
226  LogValue det_update1;
227  dm.invert_transpose(scratchT, a_update1, det_update1);
228  PsiValue det_ratio1 = LogToValue<ValueType>::convert(det_update1 - ddb.get_log_value());
229 #ifdef DUMP_INFO
230  app_log() << "det 0 = " << std::exp(ddb.get_log_value()) << std::endl;
231  app_log() << "det 1 = " << std::exp(det_update1) << std::endl;
232  app_log() << "det ratio 1 = " << det_ratio1 << std::endl;
233 #endif
234  //double det_ratio1 = 0.178276269185;
235 
236  CHECK(det_ratio1 == ValueApprox(det_ratio));
237 
238  ddb.acceptMove(elec, 0);
239 
240  PsiValue det_ratio2 = ddb.ratioGrad(elec, 1, grad);
241  LogValue det_update2;
242  simd::transpose(a_update2.data(), a_update2.rows(), a_update2.cols(), scratchT.data(), scratchT.rows(),
243  scratchT.cols());
244  dm.invert_transpose(scratchT, a_update2, det_update2);
245  PsiValue det_ratio2_val = LogToValue<ValueType>::convert(det_update2 - det_update1);
246 #ifdef DUMP_INFO
247  app_log() << "det 1 = " << std::exp(ddb.get_log_value()) << std::endl;
248  app_log() << "det 2 = " << std::exp(det_update2) << std::endl;
249  app_log() << "det ratio 2 = " << det_ratio2 << std::endl;
250 #endif
251  //double det_ratio2_val = 0.178276269185;
252  CHECK(det_ratio2 == ValueApprox(det_ratio2_val));
253 
254  ddb.acceptMove(elec, 1);
255 
256  PsiValue det_ratio3 = ddb.ratioGrad(elec, 2, grad);
257  LogValue det_update3;
258  simd::transpose(a_update3.data(), a_update3.rows(), a_update3.cols(), scratchT.data(), scratchT.rows(),
259  scratchT.cols());
260  dm.invert_transpose(scratchT, a_update3, det_update3);
261  PsiValue det_ratio3_val = LogToValue<ValueType>::convert(det_update3 - det_update2);
262 #ifdef DUMP_INFO
263  app_log() << "det 2 = " << std::exp(ddb.get_log_value()) << std::endl;
264  app_log() << "det 3 = " << std::exp(det_update3) << std::endl;
265  app_log() << "det ratio 3 = " << det_ratio3 << std::endl;
266 #endif
267  CHECK(det_ratio3 == ValueApprox(det_ratio3_val));
268  //check_value(det_ratio3, det_ratio3_val);
269 
270  ddb.acceptMove(elec, 2);
271 
272  simd::transpose(orig_a.data(), orig_a.rows(), orig_a.cols(), scratchT.data(), scratchT.rows(), scratchT.cols());
273  dm.invert_transpose(scratchT, orig_a, det_update3);
274 
275 #ifdef DUMP_INFO
276  app_log() << "original " << std::endl;
277  app_log() << orig_a << std::endl;
278  app_log() << "block update " << std::endl;
279  app_log() << ddb.psiM << std::endl;
280 #endif
281 
282  check_matrix(orig_a, ddb.psiM);
283 }
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
std::ostream & app_log()
Definition: OutputManager.h:65
LatticeGaussianProduct::GradType GradType
void check_matrix(Matrix< T1 > &a, Matrix< T2 > &b)
real convert(real value, units units_in, units units_out)
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
AntiSymTensor< T, D > transpose(const AntiSymTensor< T, D > &rhs)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::complex< double > LogValue

◆ test_DiracDeterminantBatched_delayed_update()

void qmcplusplus::test_DiracDeterminantBatched_delayed_update ( int  delay_rank,
DetMatInvertor  matrix_inverter_kind 
)

Definition at line 275 of file test_DiracDeterminantBatched.cpp.

References app_log(), CHECK(), CHECKED_ELSE(), checkMatrix(), Matrix< T, Alloc >::cols(), LogToValue< T >::convert(), ParticleSet::create(), ParticleSet::createResource(), Matrix< T, Alloc >::data(), exp(), DiracMatrix< T_FP >::invert_transpose(), ParticleSet::mw_update(), Matrix< T, Alloc >::resize(), Matrix< T, Alloc >::rows(), and qmcplusplus::simd::transpose().

276 {
277  using DetType = DiracDeterminantBatched<PL, ValueType, QMCTraits::QTFull::ValueType>;
278  auto spo_init = std::make_unique<FakeSPO>();
279  const int norb = 4;
280  spo_init->setOrbitalSetSize(norb);
281  DetType ddc(std::move(spo_init), 0, norb, delay_rank, matrix_inverter_kind);
282  auto spo = dynamic_cast<FakeSPO*>(ddc.getPhi());
283 
284  const SimulationCell simulation_cell;
285  ParticleSet elec(simulation_cell);
286 
287  elec.create({4});
288  ddc.recompute(elec);
289 
290  Matrix<ValueType> orig_a;
291  orig_a.resize(4, 4);
292  orig_a = spo->a2;
293 
294  for (int i = 0; i < 3; i++)
295  {
296  for (int j = 0; j < norb; j++)
297  {
298  orig_a(j, i) = spo->v2(i, j);
299  }
300  }
301 
302  //check_matrix(ddc.getPsiMinv(), b);
303  DiracMatrix<ValueType> dm;
304 
305  Matrix<ValueType> a_update1, scratchT;
306  scratchT.resize(4, 4);
307  a_update1.resize(4, 4);
308  a_update1 = spo->a2;
309  for (int j = 0; j < norb; j++)
310  {
311  a_update1(j, 0) = spo->v2(0, j);
312  }
313 
314  Matrix<ValueType> a_update2;
315  a_update2.resize(4, 4);
316  a_update2 = spo->a2;
317  for (int j = 0; j < norb; j++)
318  {
319  a_update2(j, 0) = spo->v2(0, j);
320  a_update2(j, 1) = spo->v2(1, j);
321  }
322 
323  Matrix<ValueType> a_update3;
324  a_update3.resize(4, 4);
325  a_update3 = spo->a2;
326  for (int j = 0; j < norb; j++)
327  {
328  a_update3(j, 0) = spo->v2(0, j);
329  a_update3(j, 1) = spo->v2(1, j);
330  a_update3(j, 2) = spo->v2(2, j);
331  }
332 
333 
335  PsiValue det_ratio = ddc.ratioGrad(elec, 0, grad);
336 
337  simd::transpose(a_update1.data(), a_update1.rows(), a_update1.cols(), scratchT.data(), scratchT.rows(),
338  scratchT.cols());
339  LogValue det_update1;
340  dm.invert_transpose(scratchT, a_update1, det_update1);
341  PsiValue det_ratio1 = LogToValue<ValueType>::convert(det_update1 - ddc.get_log_value());
342 #ifdef DUMP_INFO
343  app_log() << "det 0 = " << std::exp(ddc.get_log_value()) << std::endl;
344  app_log() << "det 1 = " << std::exp(det_update1) << std::endl;
345  app_log() << "det ratio 1 = " << det_ratio1 << std::endl;
346 #endif
347  //double det_ratio1 = 0.178276269185;
348 
349  CHECK(det_ratio1 == ValueApprox(det_ratio));
350 
351  // update of Ainv in ddc is delayed
352  ddc.acceptMove(elec, 0, true);
353  // force update Ainv in ddc using SM-1 code path
354  ddc.completeUpdates();
355 
356  auto check = checkMatrix(a_update1, ddc.get_psiMinv());
357  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
358 
359  grad = ddc.evalGrad(elec, 1);
360 
361  PsiValue det_ratio2 = ddc.ratioGrad(elec, 1, grad);
362  simd::transpose(a_update2.data(), a_update2.rows(), a_update2.cols(), scratchT.data(), scratchT.rows(),
363  scratchT.cols());
364  LogValue det_update2;
365  dm.invert_transpose(scratchT, a_update2, det_update2);
366  PsiValue det_ratio2_val = LogToValue<ValueType>::convert(det_update2 - det_update1);
367 #ifdef DUMP_INFO
368  app_log() << "det 1 = " << std::exp(ddc.get_log_value()) << std::endl;
369  app_log() << "det 2 = " << std::exp(det_update2) << std::endl;
370  app_log() << "det ratio 2 = " << det_ratio2 << std::endl;
371 #endif
372  // check ratio computed directly and the one computed by ddc with no delay
373  //double det_ratio2_val = 0.178276269185;
374  CHECK(det_ratio2 == ValueApprox(det_ratio2_val));
375 
376  // update of Ainv in ddc is delayed
377  ddc.acceptMove(elec, 1, true);
378 
379  grad = ddc.evalGrad(elec, 2);
380 
381  PsiValue det_ratio3 = ddc.ratioGrad(elec, 2, grad);
382  simd::transpose(a_update3.data(), a_update3.rows(), a_update3.cols(), scratchT.data(), scratchT.rows(),
383  scratchT.cols());
384  LogValue det_update3;
385  dm.invert_transpose(scratchT, a_update3, det_update3);
386  PsiValue det_ratio3_val = LogToValue<ValueType>::convert(det_update3 - det_update2);
387 #ifdef DUMP_INFO
388  app_log() << "det 2 = " << std::exp(ddc.get_log_value()) << std::endl;
389  app_log() << "det 3 = " << std::exp(det_update3) << std::endl;
390  app_log() << "det ratio 3 = " << det_ratio3 << std::endl;
391 #endif
392  // check ratio computed directly and the one computed by ddc with 1 delay
393  CHECK(det_ratio3 == ValueApprox(det_ratio3_val));
394  //check_value(det_ratio3, det_ratio3_val);
395 
396  // maximal delay reached and Ainv is updated fully
397  ddc.acceptMove(elec, 2, true);
398  ddc.completeUpdates();
399 
400  // fresh invert orig_a
401  simd::transpose(orig_a.data(), orig_a.rows(), orig_a.cols(), scratchT.data(), scratchT.rows(), scratchT.cols());
402  dm.invert_transpose(scratchT, orig_a, det_update3);
403 
404 #ifdef DUMP_INFO
405  app_log() << "original " << std::endl;
406  app_log() << orig_a << std::endl;
407  app_log() << "delayed update " << std::endl;
408  app_log() << ddc.getPsiMinv() << std::endl;
409 #endif
410 
411  // compare all the elements of get_ref_psiMinv() in ddc and orig_a
412  check = checkMatrix(orig_a, ddc.get_psiMinv());
413  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
414 
415  // testing batched interfaces
416  ResourceCollection pset_res("test_pset_res");
417  ResourceCollection wfc_res("test_wfc_res");
418 
419  elec.createResource(pset_res);
420  ddc.createResource(wfc_res);
421 
422  // make a clones
423  ParticleSet elec_clone(elec);
424  std::unique_ptr<WaveFunctionComponent> ddc_clone(ddc.makeCopy(ddc.getPhi()->makeClone()));
425  auto& ddc_clone_ref = dynamic_cast<DetType&>(*ddc_clone);
426 
427  // testing batched interfaces
428  RefVectorWithLeader<ParticleSet> p_ref_list(elec, {elec, elec_clone});
429  RefVectorWithLeader<WaveFunctionComponent> ddc_ref_list(ddc, {ddc, *ddc_clone});
430 
431  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_ref_list);
432  ResourceCollectionTeamLock<WaveFunctionComponent> mw_wfc_lock(wfc_res, ddc_ref_list);
433 
434  std::vector<bool> isAccepted(2, true);
435  ParticleSet::mw_update(p_ref_list);
436  ddc.mw_recompute(ddc_ref_list, p_ref_list, isAccepted);
437 
438  std::vector<PsiValue> ratios(2);
439  std::vector<GradType> grad_new(2);
440  ddc.mw_ratioGrad(ddc_ref_list, p_ref_list, 0, ratios, grad_new);
441 
442  CHECK(det_ratio1 == ValueApprox(ratios[0]));
443  CHECK(det_ratio1 == ValueApprox(ratios[1]));
444 
445  ddc.mw_accept_rejectMove(ddc_ref_list, p_ref_list, 0, isAccepted, true);
446  ddc.mw_completeUpdates(ddc_ref_list);
447 
448  check = checkMatrix(a_update1, ddc.get_psiMinv());
449  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
450 
451  check = checkMatrix(a_update1, ddc_clone_ref.get_psiMinv());
452  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
453 
454  ddc.mw_evalGrad(ddc_ref_list, p_ref_list, 1, grad_new);
455  ddc.mw_ratioGrad(ddc_ref_list, p_ref_list, 1, ratios, grad_new);
456 
457  CHECK(det_ratio2 == ValueApprox(ratios[0]));
458  CHECK(det_ratio2 == ValueApprox(ratios[1]));
459 
460  ddc.mw_accept_rejectMove(ddc_ref_list, p_ref_list, 1, isAccepted, true);
461  ddc.mw_evalGrad(ddc_ref_list, p_ref_list, 2, grad_new);
462  ddc.mw_ratioGrad(ddc_ref_list, p_ref_list, 2, ratios, grad_new);
463 
464  CHECK(det_ratio3 == ValueApprox(ratios[0]));
465  CHECK(det_ratio3 == ValueApprox(ratios[1]));
466 
467  ddc.mw_accept_rejectMove(ddc_ref_list, p_ref_list, 2, isAccepted, true);
468  ddc.mw_completeUpdates(ddc_ref_list);
469 
470  check = checkMatrix(orig_a, ddc.get_psiMinv());
471  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
472 
473  check = checkMatrix(orig_a, ddc_clone_ref.get_psiMinv());
474  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
475 }
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
std::ostream & app_log()
Definition: OutputManager.h:65
CHECKED_ELSE(check_matrix_result.result)
LatticeGaussianProduct::GradType GradType
real convert(real value, units units_in, units units_out)
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
AntiSymTensor< T, D > transpose(const AntiSymTensor< T, D > &rhs)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::complex< double > LogValue

◆ test_DiracDeterminantBatched_first()

void qmcplusplus::test_DiracDeterminantBatched_first ( )

Definition at line 37 of file test_DiracDeterminantBatched.cpp.

References ParticleSet::acceptMove(), CHECK(), CHECKED_ELSE(), checkMatrix(), ParticleSet::create(), ParticleSet::getTotalNum(), ParticleSet::makeMove(), VirtualParticleSet::makeMoves(), ParticleSet::makeVirtualMoves(), ParticleSet::R, ParticleSet::rejectMove(), and Matrix< T, Alloc >::resize().

38 {
39  using DetType = DiracDeterminantBatched<PL, ValueType, QMCTraits::QTFull::ValueType>;
40  auto spo_init = std::make_unique<FakeSPO>();
41  const int norb = 3;
42  spo_init->setOrbitalSetSize(norb);
43  DetType ddb(std::move(spo_init), 0, norb);
44  auto spo = dynamic_cast<FakeSPO*>(ddb.getPhi());
45 
46  const SimulationCell simulation_cell;
47  ParticleSet elec(simulation_cell);
48 
49  elec.create({3});
50  ddb.recompute(elec);
51 
52  Matrix<ValueType> b;
53  b.resize(3, 3);
54 
55  b(0, 0) = 0.6159749342;
56  b(0, 1) = -0.2408954682;
57  b(0, 2) = -0.1646081192;
58  b(1, 0) = 0.07923894288;
59  b(1, 1) = 0.1496231042;
60  b(1, 2) = -0.1428117337;
61  b(2, 0) = -0.2974298429;
62  b(2, 1) = -0.04586322768;
63  b(2, 2) = 0.3927890292;
64 
65  auto check = checkMatrix(b, ddb.get_psiMinv());
66  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
67 
69  PsiValue det_ratio = ddb.ratioGrad(elec, 0, grad);
70  PsiValue det_ratio1 = 0.178276269185;
71  CHECK(det_ratio1 == ValueApprox(det_ratio));
72 
73  ddb.acceptMove(elec, 0);
74 
75  b(0, 0) = 3.455170657;
76  b(0, 1) = -1.35124809;
77  b(0, 2) = -0.9233316353;
78  b(1, 0) = 0.05476311768;
79  b(1, 1) = 0.1591951095;
80  b(1, 2) = -0.1362710138;
81  b(2, 0) = -2.235099338;
82  b(2, 1) = 0.7119205298;
83  b(2, 2) = 0.9105960265;
84 
85  check = checkMatrix(b, ddb.get_psiMinv());
86  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
87 
88  // set virtutal particle position
89  PosType newpos(0.3, 0.2, 0.5);
90 
91  elec.makeVirtualMoves(newpos);
92  std::vector<ValueType> ratios(elec.getTotalNum());
93  ddb.evaluateRatiosAlltoOne(elec, ratios);
94 
95  CHECK(std::real(ratios[0]) == Approx(1.2070809985));
96  CHECK(std::real(ratios[1]) == Approx(0.2498726439));
97  CHECK(std::real(ratios[2]) == Approx(-1.3145695364));
98 
99  elec.makeMove(0, newpos - elec.R[0]);
100  PsiValue ratio_0 = ddb.ratio(elec, 0);
101  elec.rejectMove(0);
102 
103  CHECK(std::real(ratio_0) == Approx(-0.5343861437));
104 
105  VirtualParticleSet VP(elec, 2);
106  std::vector<PosType> newpos2(2);
107  std::vector<ValueType> ratios2(2);
108  newpos2[0] = newpos - elec.R[1];
109  newpos2[1] = PosType(0.2, 0.5, 0.3) - elec.R[1];
110  VP.makeMoves(elec, 1, newpos2);
111  ddb.evaluateRatios(VP, ratios2);
112 
113  CHECK(std::real(ratios2[0]) == Approx(0.4880285278));
114  CHECK(std::real(ratios2[1]) == Approx(0.9308456444));
115 
116  //test acceptMove
117  elec.makeMove(1, newpos - elec.R[1]);
118  PsiValue ratio_1 = ddb.ratio(elec, 1);
119  ddb.acceptMove(elec, 1);
120  elec.acceptMove(1);
121 
122  CHECK(std::real(ratio_1) == Approx(0.9308456444));
123  CHECK(std::real(ddb.get_log_value()) == Approx(1.9891064655));
124 }
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
QMCTraits::RealType real
CHECKED_ELSE(check_matrix_result.result)
LatticeGaussianProduct::GradType GradType
QMCTraits::PosType PosType
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ test_DiracDeterminantBatched_second()

void qmcplusplus::test_DiracDeterminantBatched_second ( )

Definition at line 140 of file test_DiracDeterminantBatched.cpp.

References app_log(), CHECK(), CHECKED_ELSE(), checkMatrix(), Matrix< T, Alloc >::cols(), LogToValue< T >::convert(), ParticleSet::create(), Matrix< T, Alloc >::data(), exp(), DiracMatrix< T_FP >::invert_transpose(), Matrix< T, Alloc >::resize(), Matrix< T, Alloc >::rows(), and qmcplusplus::simd::transpose().

141 {
142  using DetType = DiracDeterminantBatched<PL, ValueType, QMCTraits::QTFull::ValueType>;
143  auto spo_init = std::make_unique<FakeSPO>();
144  const int norb = 4;
145  spo_init->setOrbitalSetSize(norb);
146  DetType ddb(std::move(spo_init), 0, norb);
147  auto spo = dynamic_cast<FakeSPO*>(ddb.getPhi());
148 
149  const SimulationCell simulation_cell;
150  ParticleSet elec(simulation_cell);
151 
152  elec.create({4});
153  ddb.recompute(elec);
154 
155  Matrix<ValueType> orig_a;
156  orig_a.resize(4, 4);
157  orig_a = spo->a2;
158 
159  for (int i = 0; i < 3; i++)
160  {
161  for (int j = 0; j < norb; j++)
162  {
163  orig_a(j, i) = spo->v2(i, j);
164  }
165  }
166 
167  //check_matrix(ddb.getPsiMinv(), b);
168  DiracMatrix<ValueType> dm;
169 
170  Matrix<ValueType> a_update1, scratchT;
171  a_update1.resize(4, 4);
172  scratchT.resize(4, 4);
173  a_update1 = spo->a2;
174  for (int j = 0; j < norb; j++)
175  {
176  a_update1(j, 0) = spo->v2(0, j);
177  }
178 
179  Matrix<ValueType> a_update2;
180  a_update2.resize(4, 4);
181  a_update2 = spo->a2;
182  for (int j = 0; j < norb; j++)
183  {
184  a_update2(j, 0) = spo->v2(0, j);
185  a_update2(j, 1) = spo->v2(1, j);
186  }
187 
188  Matrix<ValueType> a_update3;
189  a_update3.resize(4, 4);
190  a_update3 = spo->a2;
191  for (int j = 0; j < norb; j++)
192  {
193  a_update3(j, 0) = spo->v2(0, j);
194  a_update3(j, 1) = spo->v2(1, j);
195  a_update3(j, 2) = spo->v2(2, j);
196  }
197 
199  PsiValue det_ratio = ddb.ratioGrad(elec, 0, grad);
200 
201  simd::transpose(a_update1.data(), a_update1.rows(), a_update1.cols(), scratchT.data(), scratchT.rows(),
202  scratchT.cols());
203  LogValue det_update1;
204  dm.invert_transpose(scratchT, a_update1, det_update1);
205  PsiValue det_ratio1 = LogToValue<ValueType>::convert(det_update1 - ddb.get_log_value());
206 #ifdef DUMP_INFO
207  app_log() << "det 0 = " << std::exp(ddb.get_log_value()) << std::endl;
208  app_log() << "det 1 = " << std::exp(det_update1) << std::endl;
209  app_log() << "det ratio 1 = " << det_ratio1 << std::endl;
210 #endif
211  //double det_ratio1 = 0.178276269185;
212 
213  CHECK(det_ratio1 == ValueApprox(det_ratio));
214 
215  ddb.acceptMove(elec, 0);
216 
217  PsiValue det_ratio2 = ddb.ratioGrad(elec, 1, grad);
218  LogValue det_update2;
219  simd::transpose(a_update2.data(), a_update2.rows(), a_update2.cols(), scratchT.data(), scratchT.rows(),
220  scratchT.cols());
221  dm.invert_transpose(scratchT, a_update2, det_update2);
222  PsiValue det_ratio2_val = LogToValue<ValueType>::convert(det_update2 - det_update1);
223 #ifdef DUMP_INFO
224  app_log() << "det 1 = " << std::exp(ddb.get_log_value()) << std::endl;
225  app_log() << "det 2 = " << std::exp(det_update2) << std::endl;
226  app_log() << "det ratio 2 = " << det_ratio2 << std::endl;
227 #endif
228  //double det_ratio2_val = 0.178276269185;
229  CHECK(det_ratio2 == ValueApprox(det_ratio2_val));
230 
231  ddb.acceptMove(elec, 1);
232 
233  PsiValue det_ratio3 = ddb.ratioGrad(elec, 2, grad);
234  LogValue det_update3;
235  simd::transpose(a_update3.data(), a_update3.rows(), a_update3.cols(), scratchT.data(), scratchT.rows(),
236  scratchT.cols());
237  dm.invert_transpose(scratchT, a_update3, det_update3);
238  PsiValue det_ratio3_val = LogToValue<ValueType>::convert(det_update3 - det_update2);
239 #ifdef DUMP_INFO
240  app_log() << "det 2 = " << std::exp(ddb.get_log_value()) << std::endl;
241  app_log() << "det 3 = " << std::exp(det_update3) << std::endl;
242  app_log() << "det ratio 3 = " << det_ratio3 << std::endl;
243 #endif
244  CHECK(det_ratio3 == ValueApprox(det_ratio3_val));
245  //check_value(det_ratio3, det_ratio3_val);
246 
247  ddb.acceptMove(elec, 2);
248 
249  simd::transpose(orig_a.data(), orig_a.rows(), orig_a.cols(), scratchT.data(), scratchT.rows(), scratchT.cols());
250  dm.invert_transpose(scratchT, orig_a, det_update3);
251 
252 #ifdef DUMP_INFO
253  app_log() << "original " << std::endl;
254  app_log() << orig_a << std::endl;
255  app_log() << "block update " << std::endl;
256  app_log() << ddb.getPsiMinv() << std::endl;
257 #endif
258 
259  auto check = checkMatrix(orig_a, ddb.get_psiMinv());
260  CHECKED_ELSE(check.result) { FAIL(check.result_message); }
261 }
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
std::ostream & app_log()
Definition: OutputManager.h:65
CHECKED_ELSE(check_matrix_result.result)
LatticeGaussianProduct::GradType GradType
real convert(real value, units units_in, units units_out)
MakeReturn< UnaryNode< FnExp, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t exp(const Vector< T1, C1 > &l)
AntiSymTensor< T, D > transpose(const AntiSymTensor< T, D > &rhs)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
std::complex< double > LogValue

◆ test_distance_fcc_pbc_z_batched_APIs()

void qmcplusplus::test_distance_fcc_pbc_z_batched_APIs ( DynamicCoordinateKind  test_kind)

Definition at line 612 of file test_distance_table.cpp.

References ParticleSet::accept_rejectMove(), ParticleSet::addTable(), CHECK(), ParticleSet::createResource(), ParticleSet::donePbyP(), ParticleSet::getDistTableAA(), ParticleSet::makeMove(), ParticleSet::mw_accept_rejectMove(), ParticleSet::mw_donePbyP(), ParticleSet::mw_makeMove(), NEED_FULL_TABLE_ON_HOST_AFTER_DONEPBYP, parse_electron_ion_pbc_z(), parse_pbc_fcc_lattice(), and ParticleSet::update().

Referenced by TEST_CASE().

613 {
614  // test that particle distances are properly calculated under periodic boundary condition
615  // There are many details in this example, but the main idea is simple: When a particle is moved by a full lattice vector, no distance should change.
616 
617  const SimulationCell simulation_cell(parse_pbc_fcc_lattice());
618  ParticleSet ions(simulation_cell), electrons(simulation_cell, test_kind);
619  parse_electron_ion_pbc_z(ions, electrons);
620 
621  // calculate particle distances
622  ions.update();
623  const int ee_tid = electrons.addTable(electrons, DTModes::NEED_FULL_TABLE_ON_HOST_AFTER_DONEPBYP);
624  // get target particle set's distance table data
625  const auto& ee_dtable = electrons.getDistTableAA(ee_tid);
626  CHECK(ee_dtable.getName() == "e_e");
627  electrons.update();
628 
629  // shift electron 0 a bit to avoid box edges.
630  ParticleSet::SingleParticlePos shift(0.1, 0.2, -0.1);
631  electrons.makeMove(0, shift);
632  electrons.accept_rejectMove(0, true, false);
633  electrons.donePbyP();
634 
635  ParticleSet electrons_clone(electrons);
636  RefVectorWithLeader<ParticleSet> p_list(electrons);
637  p_list.push_back(electrons);
638  p_list.push_back(electrons_clone);
639 
640  ResourceCollection pset_res("test_pset_res");
641  electrons.createResource(pset_res);
642  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
643 
644  std::vector<ParticleSet::SingleParticlePos> disp{{0.2, 0.1, 0.3}, {0.2, 0.1, 0.3}};
645 
646  ParticleSet::mw_makeMove(p_list, 0, disp);
647  ParticleSet::mw_accept_rejectMove(p_list, 0, {true, true}, true);
648  ParticleSet::mw_makeMove(p_list, 1, disp);
649  ParticleSet::mw_accept_rejectMove(p_list, 1, {false, false}, true);
650 
651  ParticleSet::mw_donePbyP(p_list);
652  CHECK(ee_dtable.getDistRow(1)[0] == Approx(2.7239676944));
653  CHECK(ee_dtable.getDisplRow(1)[0][0] == Approx(-2.7));
654  CHECK(ee_dtable.getDisplRow(1)[0][1] == Approx(0.3));
655  CHECK(ee_dtable.getDisplRow(1)[0][2] == Approx(0.2));
656 } // test_distance_pbc_z_batched_APIs
SimulationCell parse_pbc_fcc_lattice()
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void parse_electron_ion_pbc_z(ParticleSet &ions, ParticleSet &electrons)

◆ test_distance_pbc_z_batched_APIs()

void qmcplusplus::test_distance_pbc_z_batched_APIs ( DynamicCoordinateKind  test_kind)

Definition at line 566 of file test_distance_table.cpp.

References ParticleSet::accept_rejectMove(), ParticleSet::addTable(), CHECK(), ParticleSet::createResource(), ParticleSet::donePbyP(), ParticleSet::getDistTableAA(), ParticleSet::makeMove(), ParticleSet::mw_accept_rejectMove(), ParticleSet::mw_donePbyP(), ParticleSet::mw_makeMove(), NEED_FULL_TABLE_ON_HOST_AFTER_DONEPBYP, parse_electron_ion_pbc_z(), parse_pbc_lattice(), and ParticleSet::update().

Referenced by TEST_CASE().

567 {
568  // test that particle distances are properly calculated under periodic boundary condition
569  // There are many details in this example, but the main idea is simple: When a particle is moved by a full lattice vector, no distance should change.
570 
571  const SimulationCell simulation_cell(parse_pbc_lattice());
572  ParticleSet ions(simulation_cell), electrons(simulation_cell, test_kind);
573  parse_electron_ion_pbc_z(ions, electrons);
574 
575  // calculate particle distances
576  ions.update();
577  const int ee_tid = electrons.addTable(electrons, DTModes::NEED_FULL_TABLE_ON_HOST_AFTER_DONEPBYP);
578  // get target particle set's distance table data
579  const auto& ee_dtable = electrons.getDistTableAA(ee_tid);
580  CHECK(ee_dtable.getName() == "e_e");
581  electrons.update();
582 
583  // shift electron 0 a bit to avoid box edges.
584  ParticleSet::SingleParticlePos shift(0.1, 0.2, -0.1);
585  electrons.makeMove(0, shift);
586  electrons.accept_rejectMove(0, true, false);
587  electrons.donePbyP();
588 
589  ParticleSet electrons_clone(electrons);
590  RefVectorWithLeader<ParticleSet> p_list(electrons);
591  p_list.push_back(electrons);
592  p_list.push_back(electrons_clone);
593 
594  ResourceCollection pset_res("test_pset_res");
595  electrons.createResource(pset_res);
596  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
597 
598  std::vector<ParticleSet::SingleParticlePos> disp{{0.2, 0.1, 0.3}, {0.2, 0.1, 0.3}};
599 
600  ParticleSet::mw_makeMove(p_list, 0, disp);
601  ParticleSet::mw_accept_rejectMove(p_list, 0, {true, true}, true);
602  ParticleSet::mw_makeMove(p_list, 1, disp);
603  ParticleSet::mw_accept_rejectMove(p_list, 1, {false, false}, true);
604 
605  ParticleSet::mw_donePbyP(p_list);
606  CHECK(ee_dtable.getDistRow(1)[0] == Approx(2.7239676944));
607  CHECK(ee_dtable.getDisplRow(1)[0][0] == Approx(-2.7));
608  CHECK(ee_dtable.getDisplRow(1)[0][1] == Approx(0.3));
609  CHECK(ee_dtable.getDisplRow(1)[0][2] == Approx(0.2));
610 } // test_distance_pbc_z_batched_APIs
SimulationCell parse_pbc_lattice()
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void parse_electron_ion_pbc_z(ParticleSet &ions, ParticleSet &electrons)

◆ test_distance_pbc_z_batched_APIs_ee_NEED_TEMP_DATA_ON_HOST()

void qmcplusplus::test_distance_pbc_z_batched_APIs_ee_NEED_TEMP_DATA_ON_HOST ( DynamicCoordinateKind  test_kind)

Definition at line 666 of file test_distance_table.cpp.

References ParticleSet::accept_rejectMove(), ParticleSet::addTable(), CHECK(), ParticleSet::createResource(), ParticleSet::donePbyP(), ParticleSet::getDistTableAA(), ParticleSet::makeMove(), ParticleSet::mw_accept_rejectMove(), ParticleSet::mw_makeMove(), NEED_TEMP_DATA_ON_HOST, parse_electron_ion_pbc_z(), parse_pbc_lattice(), and ParticleSet::update().

Referenced by TEST_CASE().

667 {
668  // test that particle distances are properly calculated under periodic boundary condition
669  // There are many details in this example, but the main idea is simple: When a particle is moved by a full lattice vector, no distance should change.
670 
671  const SimulationCell simulation_cell(parse_pbc_lattice());
672  ParticleSet ions(simulation_cell), electrons(simulation_cell, test_kind);
673  parse_electron_ion_pbc_z(ions, electrons);
674 
675  // calculate particle distances
676  ions.update();
677  const int ee_tid = electrons.addTable(electrons, DTModes::NEED_TEMP_DATA_ON_HOST);
678  // get target particle set's distance table data
679  const auto& ee_dtable = electrons.getDistTableAA(ee_tid);
680  CHECK(ee_dtable.getName() == "e_e");
681  electrons.update();
682 
683  // shift electron 0 a bit to avoid box edges.
684  ParticleSet::SingleParticlePos shift(0.1, 0.2, -0.1);
685  electrons.makeMove(0, shift);
686  electrons.accept_rejectMove(0, true, false);
687  electrons.donePbyP();
688 
689  ParticleSet electrons_clone(electrons);
690  RefVectorWithLeader<ParticleSet> p_list(electrons);
691  p_list.push_back(electrons);
692  p_list.push_back(electrons_clone);
693 
694  ResourceCollection pset_res("test_pset_res");
695  electrons.createResource(pset_res);
696  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
697 
698  std::vector<ParticleSet::SingleParticlePos> disp{{0.2, 0.1, 0.3}, {0.2, 0.1, 0.3}};
699 
700  ParticleSet::mw_makeMove(p_list, 0, disp);
701  CHECK(ee_dtable.getTempDists()[1] == Approx(2.7239676944));
702  CHECK(ee_dtable.getTempDispls()[1][0] == Approx(2.7));
703  CHECK(ee_dtable.getTempDispls()[1][1] == Approx(-0.3));
704  CHECK(ee_dtable.getTempDispls()[1][2] == Approx(-0.2));
705  CHECK(ee_dtable.getOldDists()[1] == Approx(2.908607914));
706  CHECK(ee_dtable.getOldDispls()[1][0] == Approx(2.9));
707  CHECK(ee_dtable.getOldDispls()[1][1] == Approx(-0.2));
708  CHECK(ee_dtable.getOldDispls()[1][2] == Approx(0.1));
709  CHECK(ee_dtable.getDistRow(1)[0] == Approx(2.908607914));
710  CHECK(ee_dtable.getDisplRow(1)[0][0] == Approx(-2.9));
711  CHECK(ee_dtable.getDisplRow(1)[0][1] == Approx(0.2));
712  CHECK(ee_dtable.getDisplRow(1)[0][2] == Approx(-0.1));
713  ParticleSet::mw_accept_rejectMove(p_list, 0, {true, true}, true);
714 
715  CHECK(ee_dtable.getDistRow(1)[0] == Approx(2.908607914));
716  CHECK(ee_dtable.getDisplRow(1)[0][0] == Approx(-2.9));
717  CHECK(ee_dtable.getDisplRow(1)[0][1] == Approx(0.2));
718  CHECK(ee_dtable.getDisplRow(1)[0][2] == Approx(-0.1));
719 
720  ParticleSet::mw_makeMove(p_list, 1, disp);
721  ParticleSet::mw_accept_rejectMove(p_list, 1, {false, false}, true);
722  CHECK(ee_dtable.getDistRow(1)[0] == Approx(2.7239676944));
723  CHECK(ee_dtable.getDisplRow(1)[0][0] == Approx(-2.7));
724  CHECK(ee_dtable.getDisplRow(1)[0][1] == Approx(0.3));
725  CHECK(ee_dtable.getDisplRow(1)[0][2] == Approx(0.2));
726 } // test_distance_pbc_z_batched_APIs_ee_NEED_TEMP_DATA_ON_HOST
SimulationCell parse_pbc_lattice()
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void parse_electron_ion_pbc_z(ParticleSet &ions, ParticleSet &electrons)

◆ test_e2iphi()

void qmcplusplus::test_e2iphi ( )

Definition at line 24 of file test_e2iphi.cpp.

References CHECK(), cos(), eval_e2iphi(), qmcplusplus::Units::force::N, and sin().

25 {
26  T phi[N];
27  T vcos[N];
28  T vsin[N];
29  for (int i = 0; i < N; i++)
30  {
31  phi[i] = 0.2 * i;
32  }
33 
34  eval_e2iphi(N, phi, vcos, vsin);
35 
36  for (int i = 0; i < N; i++)
37  {
38  CHECK(vcos[i] == Approx(std::cos(phi[i])));
39  CHECK(vsin[i] == Approx(std::sin(phi[i])));
40  }
41 }
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void eval_e2iphi(int n, const T *restrict phi, T *restrict phase_r, T *restrict phase_i)
Definition: e2iphi.h:61

◆ test_EtOH_mw()

void qmcplusplus::test_EtOH_mw ( bool  transform)

Definition at line 285 of file test_MO.cpp.

References castCharToXMLChar(), CHECK(), OHMMS::Controller, SPOSetBuilderFactory::createSPOSetBuilder(), QMCTraits::DIM, doc, qmcplusplus::Units::charge::e, Libxml2Document::getRoot(), Libxml2Document::getXPathContext(), okay, Libxml2Document::parse(), ParticleSet::R, XMLParticleParser::readXML(), REQUIRE(), and ParticleSet::update().

Referenced by TEST_CASE().

286 {
287  // set up ion particle set as normal
289 
291  bool okay = doc.parse("ethanol.structure.xml");
292  REQUIRE(okay);
293  xmlNodePtr root = doc.getRoot();
294 
295  const SimulationCell simulation_cell;
296  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
297  auto& ions(*ions_ptr);
298  XMLParticleParser parse_ions(ions);
299  OhmmsXPathObject particleset_ion("//particleset[@name='ion0']", doc.getXPathContext());
300  REQUIRE(particleset_ion.size() == 1);
301  parse_ions.readXML(particleset_ion[0]);
302 
303  REQUIRE(ions.groups() == 3);
304  REQUIRE(ions.R.size() == 9);
305  ions.update();
306 
307  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
308  auto& elec(*elec_ptr);
309  XMLParticleParser parse_elec(elec);
310  OhmmsXPathObject particleset_elec("//particleset[@name='e']", doc.getXPathContext());
311  REQUIRE(particleset_elec.size() == 1);
312  parse_elec.readXML(particleset_elec[0]);
313 
314  REQUIRE(elec.groups() == 2);
315  REQUIRE(elec.R.size() == 26);
316 
317  elec.R = 0.0;
318 
319  elec.addTable(ions);
320  elec.update();
321 
322  Libxml2Document doc2;
323  okay = doc2.parse("ethanol.wfnoj.xml");
324  REQUIRE(okay);
325  xmlNodePtr root2 = doc2.getRoot();
326 
327  WaveFunctionComponentBuilder::PSetMap particle_set_map;
328  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
329  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
330 
331  SPOSetBuilderFactory bf(c, elec, particle_set_map);
332 
333  OhmmsXPathObject MO_base("//determinantset", doc2.getXPathContext());
334  REQUIRE(MO_base.size() == 1);
335  if (!transform)
336  {
337  // input file is set to transform GTO's to numerical orbitals by default
338  // use direct evaluation of GTO's
339  xmlSetProp(MO_base[0], castCharToXMLChar("transform"), castCharToXMLChar("no"));
340  xmlSetProp(MO_base[0], castCharToXMLChar("key"), castCharToXMLChar("GTO"));
341  }
342 
343  xmlSetProp(MO_base[0], castCharToXMLChar("cuspCorrection"), castCharToXMLChar("no"));
344 
345  const auto bb_ptr = bf.createSPOSetBuilder(MO_base[0]);
346  auto& bb(*bb_ptr);
347 
348  OhmmsXPathObject slater_base("//determinant", doc2.getXPathContext());
349  auto sposet = bb.createSPOSet(slater_base[0]);
350 
351 
352  //std::cout << "basis set size = " << sposet->getBasisSetSize() << std::endl;
353  size_t n_mo = sposet->getOrbitalSetSize();
354  SPOSet::ValueVector psiref_0(n_mo);
355  SPOSet::GradVector dpsiref_0(n_mo);
356  SPOSet::ValueVector d2psiref_0(n_mo);
357  // Call makeMove to compute the distances
358  //ParticleSet::SingleParticlePos newpos(0.0001, 0.0, 0.0);
359  //elec.makeMove(0, newpos);
360  //elec.update();
361  elec.R[0] = {0.0001, 0.0, 0.0};
362  elec.update();
363  // set up second walkers
364  // auto elec2 = elec.makeClone();
365  sposet->evaluateVGL(elec, 0, psiref_0, dpsiref_0, d2psiref_0);
366 
367  CHECK(std::real(psiref_0[0]) == Approx(-0.001664403313));
368  CHECK(std::real(psiref_0[1]) == Approx(0.01579976715));
369  CHECK(std::real(dpsiref_0[0][0]) == Approx(-0.0001961749098));
370  CHECK(std::real(dpsiref_0[0][1]) == Approx(0.003340392074));
371  CHECK(std::real(dpsiref_0[0][2]) == Approx(9.461877818e-05));
372  CHECK(std::real(dpsiref_0[1][0]) == Approx(-0.005476152264));
373  CHECK(std::real(dpsiref_0[1][1]) == Approx(-0.06648077046));
374  CHECK(std::real(dpsiref_0[1][2]) == Approx(2.086541402e-05));
375  CHECK(std::real(d2psiref_0[0]) == Approx(0.01071299243));
376  CHECK(std::real(d2psiref_0[1]) == Approx(0.4121970776));
377 
378  //ParticleSet::SingleParticlePos newpos2(0.0, 0.04, 0.02);
379  //elec.makeMove(1, newpos2);
380  elec.R[1] = {0.0, 0.04, 0.02};
381  elec.update();
382  SPOSet::ValueVector psiref_1(n_mo);
383  SPOSet::GradVector dpsiref_1(n_mo);
384  SPOSet::ValueVector d2psiref_1(n_mo);
385  sposet->evaluateVGL(elec, 1, psiref_1, dpsiref_1, d2psiref_1);
386 
387  CHECK(std::real(psiref_1[0]) == Approx(-0.001528135727));
388  CHECK(std::real(psiref_1[0]) == Approx(-0.001528135727));
389  CHECK(std::real(psiref_1[1]) == Approx(0.01351541907));
390  CHECK(std::real(d2psiref_1[0]) == Approx(0.01001796854));
391  CHECK(std::real(d2psiref_1[1]) == Approx(0.2912963205));
392  CHECK(std::real(dpsiref_1[0][0]) == Approx(-0.0004235196101));
393  CHECK(std::real(dpsiref_1[0][1]) == Approx(0.003351193375));
394  CHECK(std::real(dpsiref_1[0][2]) == Approx(0.0001374796409));
395  CHECK(std::real(dpsiref_1[1][0]) == Approx(-0.003873067027));
396  CHECK(std::real(dpsiref_1[1][1]) == Approx(-0.0483167767));
397  CHECK(std::real(dpsiref_1[1][2]) == Approx(-0.0008320732335));
398 
399  // vectors of SPOSets, ParticleSets, V/G/L (leading dim of each == nwalkers)
400  RefVectorWithLeader<SPOSet> spo_list(*sposet);
401  std::unique_ptr<SPOSet> sposet_2(sposet->makeClone());
402  spo_list.push_back(*sposet_2);
403  spo_list.push_back(*sposet);
404  // second walker
405  // exchange positions
406  ParticleSet elec_2(elec);
407  elec_2.R[0] = elec.R[1];
408  elec_2.R[1] = elec.R[0];
409  elec_2.update();
410  RefVectorWithLeader<ParticleSet> P_list(elec);
411  P_list.push_back(elec);
412  P_list.push_back(elec_2);
413  // create V,G,L arrays for walker 1
414  SPOSet::ValueVector psi_1(n_mo);
415  SPOSet::GradVector dpsi_1(n_mo);
416  SPOSet::ValueVector d2psi_1(n_mo);
417  SPOSet::ValueVector psi_2(n_mo);
418  SPOSet::GradVector dpsi_2(n_mo);
419  SPOSet::ValueVector d2psi_2(n_mo);
420  RefVector<SPOSet::ValueVector> psi_list = {psi_1, psi_2};
421  RefVector<SPOSet::GradVector> dpsi_list = {dpsi_1, dpsi_2};
422  RefVector<SPOSet::ValueVector> d2psi_list = {d2psi_1, d2psi_2};
423 
424  size_t nw = psi_list.size();
425  SPOSet::ValueVector psi_v_1(n_mo);
426  SPOSet::ValueVector psi_v_2(n_mo);
427  RefVector<SPOSet::ValueVector> psi_v_list{psi_v_1, psi_v_2};
428 
429  ResourceCollection pset_res("test_pset_res");
430  ResourceCollection spo_res("test_spo_res");
431 
432  elec.createResource(pset_res);
433  sposet->createResource(spo_res);
434 
435  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, P_list);
436  ResourceCollectionTeamLock<SPOSet> mw_sposet_lock(spo_res, spo_list);
437 
438  sposet->mw_evaluateVGL(spo_list, P_list, 0, psi_list, dpsi_list, d2psi_list);
439  sposet->mw_evaluateValue(spo_list, P_list, 0, psi_v_list);
440 
441  for (size_t iorb = 0; iorb < n_mo; iorb++)
442  {
443  for (size_t iw = 0; iw < nw; iw++)
444  {
445  // test values from OffloadMWVArray impl.
446  CHECK(std::real(psi_v_list[iw].get()[iorb]) == Approx(psi_list[iw].get()[iorb]));
447  }
448  CHECK(std::real(psi_v_list[0].get()[iorb]) == Approx(psiref_0[iorb]));
449  CHECK(std::real(psi_v_list[1].get()[iorb]) == Approx(psiref_1[iorb]));
450  CHECK(std::real(psi_list[0].get()[iorb]) == Approx(psiref_0[iorb]));
451  CHECK(std::real(psi_list[1].get()[iorb]) == Approx(psiref_1[iorb]));
452  CHECK(std::real(d2psi_list[0].get()[iorb]) == Approx(d2psiref_0[iorb]));
453  CHECK(std::real(d2psi_list[1].get()[iorb]) == Approx(d2psiref_1[iorb]));
454  for (size_t idim = 0; idim < SPOSet::DIM; idim++)
455  {
456  CHECK(std::real(dpsi_list[0].get()[iorb][idim]) == Approx(dpsiref_0[iorb][idim]));
457  CHECK(std::real(dpsi_list[1].get()[iorb][idim]) == Approx(dpsiref_1[iorb][idim]));
458  }
459  }
460 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180
xmlChar * castCharToXMLChar(char *c)
unsafe char* to xmlChar* cast
Definition: libxmldefs.h:70

◆ test_gemm()

void qmcplusplus::test_gemm ( const int  M,
const int  N,
const int  K,
const char  transa,
const char  transb 
)

Definition at line 26 of file test_ompBLAS.cpp.

References qmcplusplus::Units::distance::A, B(), qmcplusplus::Units::charge::C, CHECK(), Vector< T, Alloc >::device_data(), qmcplusplus::ompBLAS::gemm(), BLAS::gemm(), qmcplusplus::ompBLAS::gemm_batched(), imag(), qmcplusplus::Units::energy::K, qmcplusplus::Units::force::N, and Vector< T, Alloc >::updateTo().

27 {
28  const int a0 = transa == 'T' ? M : K;
29  const int a1 = transa == 'T' ? K : M;
30 
31  const int b0 = transb == 'T' ? K : N;
32  const int b1 = transb == 'T' ? N : K;
33 
34  using vec_t = Vector<T, OMPallocator<T>>;
35  using mat_t = Matrix<T, OMPallocator<T>>;
36 
38 
39  mat_t A(a0, a1); // Input matrix
40  mat_t B(b0, b1); // Input matrix
41  mat_t C(N, M); // Result matrix ompBLAS
42  mat_t D(N, M); // Result matrix BLAS
43 
44  // Fill data
45  for (int j = 0; j < a0; j++)
46  for (int i = 0; i < a1; i++)
47  A[j][i] = i * 3 + j * 4;
48 
49  for (int j = 0; j < b0; j++)
50  for (int i = 0; i < b1; i++)
51  B[j][i] = i * 4 + j * 5;
52 
53  A.updateTo();
54  B.updateTo();
55 
56  T alpha(1);
57  T alpha_half(0.5);
58  T beta(0);
59  T beta1(1);
60 
61  // U[X,Y] denotes a row-major matrix U with X rows and Y cols
62  // element U(i,j) is located at: U.data() + sizeof(U_type) * (i*ldU + j)
63  //
64  // A,B,C,D are treated as row-major matrices, but the arguments to gemm are treated as col-major
65  // so the call below to ompBLAS::gemm is equivalent to one of the following (with row-major matrices)
66  // transa/transb == 'N'/'N': C[N,M] = A[K,M] * B[N,K]; C = B * A
67  // transa/transb == 'N'/'T': C[N,M] = A[K,M] * B[K,N]; C = B^t * A
68  // transa/transb == 'T'/'N': C[N,M] = A[M,K] * B[N,K]; C = B * A^t
69  // transa/transb == 'T'/'T': C[N,M] = A[M,K] * B[K,N]; C = B^t * A^t
70 
71  // alpha 0.5, beta 0
72  ompBLAS::gemm(handle, transa, transb, M, N, K, alpha_half, A.device_data(), a1, B.device_data(), b1, beta,
73  C.device_data(), M);
74  // alpha 0.5, beta 1
75  ompBLAS::gemm(handle, transa, transb, M, N, K, alpha_half, A.device_data(), a1, B.device_data(), b1, beta1,
76  C.device_data(), M);
77  C.updateFrom();
78 
79  BLAS::gemm(transa, transb, M, N, K, alpha, A.data(), a1, B.data(), b1, beta, D.data(), M);
80 
81  for (int j = 0; j < N; j++)
82  for (int i = 0; i < M; i++)
83  {
84  CHECK(std::real(C[j][i]) == Approx(std::real(D[j][i])));
85  CHECK(std::imag(C[j][i]) == Approx(std::imag(D[j][i])));
86  }
87 
88  mat_t A2(a0, a1); // Input matrix
89  mat_t B2(b0, b1); // Input matrix
90  mat_t C2(N, M); // Result matrix ompBLAS
91  mat_t D2(N, M); // Result matrix BLAS
92 
93  // Fill data
94  for (int j = 0; j < a0; j++)
95  for (int i = 0; i < a1; i++)
96  A2[j][i] = j * 3 + i * 4;
97 
98  for (int j = 0; j < b0; j++)
99  for (int i = 0; i < b1; i++)
100  B2[j][i] = j * 4 + i * 5;
101 
102  A2.updateTo();
103  B2.updateTo();
104 
105  Vector<const T*, OMPallocator<const T*>> Aarr(2), Barr(2);
106  Vector<T*, OMPallocator<T*>> Carr(2);
107 
108  Aarr[0] = A2.device_data();
109  Aarr[1] = A.device_data();
110  Barr[0] = B2.device_data();
111  Barr[1] = B.device_data();
112 
113  Carr[0] = C.device_data();
114  Carr[1] = C2.device_data();
115 
116  Aarr.updateTo();
117  Barr.updateTo();
118  Carr.updateTo();
119 
120  // alpha 0.5, beta 0
121  ompBLAS::gemm_batched(handle, transa, transb, M, N, K, alpha_half, Aarr.device_data(), a1, Barr.device_data(), b1,
122  beta, Carr.device_data(), M, 2);
123  // alpha 0.5, beta 1
124  ompBLAS::gemm_batched(handle, transa, transb, M, N, K, alpha_half, Aarr.device_data(), a1, Barr.device_data(), b1,
125  beta1, Carr.device_data(), M, 2);
126  C.updateFrom();
127  C2.updateFrom();
128 
129  BLAS::gemm(transa, transb, M, N, K, alpha, A2.data(), a1, B2.data(), b1, beta, D2.data(), M);
130 
131  for (int j = 0; j < N; j++)
132  for (int i = 0; i < M; i++)
133  {
134  CHECK(std::real(C2[j][i]) == Approx(std::real(D[j][i])));
135  CHECK(std::imag(C2[j][i]) == Approx(std::imag(D[j][i])));
136  }
137 
138  for (int j = 0; j < N; j++)
139  for (int i = 0; i < M; i++)
140  {
141  CHECK(std::real(C[j][i]) == Approx(std::real(D2[j][i])));
142  CHECK(std::imag(C[j][i]) == Approx(std::imag(D2[j][i])));
143  }
144 }
TinyVector< double, 3 > vec_t
QMCTraits::RealType real
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
void gemm_batched(BLASHandle< PlatformKind::CUDA > &handle, const char transa, const char transb, int m, int n, int k, const float &alpha, const float *const A[], int lda, const float *const B[], int ldb, const float &beta, float *const C[], int ldc, int batchCount)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
static void gemm(char Atrans, char Btrans, int M, int N, int K, double alpha, const double *A, int lda, const double *restrict B, int ldb, double beta, double *restrict C, int ldc)
Definition: BLAS.hpp:235
double B(double x, int k, int i, const std::vector< double > &t)

◆ test_gemm_cases()

void qmcplusplus::test_gemm_cases ( )

Definition at line 139 of file test_AccelBLAS.cpp.

References qmcplusplus::Units::energy::K, and qmcplusplus::Units::force::N.

140 {
141  const int M = 29;
142  const int N = 31;
143  const int K = 23;
144 
145  // Non-batched test
146  std::cout << "Testing NN gemm" << std::endl;
147  test_one_gemm<PL, float>(M, N, K, 'N', 'N');
148  test_one_gemm<PL, double>(M, N, K, 'N', 'N');
149 #if defined(QMC_COMPLEX)
150  test_one_gemm<PL, std::complex<float>>(N, M, K, 'N', 'N');
151  test_one_gemm<PL, std::complex<double>>(N, M, K, 'N', 'N');
152 #endif
153  std::cout << "Testing NT gemm" << std::endl;
154  test_one_gemm<PL, float>(M, N, K, 'N', 'T');
155  test_one_gemm<PL, double>(M, N, K, 'N', 'T');
156 #if defined(QMC_COMPLEX)
157  test_one_gemm<PL, std::complex<float>>(N, M, K, 'N', 'T');
158  test_one_gemm<PL, std::complex<double>>(N, M, K, 'N', 'T');
159 #endif
160  std::cout << "Testing TN gemm" << std::endl;
161  test_one_gemm<PL, float>(M, N, K, 'T', 'N');
162  test_one_gemm<PL, double>(M, N, K, 'T', 'N');
163 #if defined(QMC_COMPLEX)
164  test_one_gemm<PL, std::complex<float>>(N, M, K, 'T', 'N');
165  test_one_gemm<PL, std::complex<double>>(N, M, K, 'T', 'N');
166 #endif
167  std::cout << "Testing TT gemm" << std::endl;
168  test_one_gemm<PL, float>(M, N, K, 'T', 'T');
169  test_one_gemm<PL, double>(M, N, K, 'T', 'T');
170 #if defined(QMC_COMPLEX)
171  test_one_gemm<PL, std::complex<float>>(N, M, K, 'T', 'T');
172  test_one_gemm<PL, std::complex<double>>(N, M, K, 'T', 'T');
173 #endif
174 }

◆ test_gemv()

void test_gemv ( const int  M_b,
const int  N_b,
const char  trans 
)

Definition at line 184 of file test_ompBLAS.cpp.

References qmcplusplus::Units::distance::A, B(), qmcplusplus::Units::charge::C, CHECK(), TinyVector< T, D >::data(), qmcplusplus::ompBLAS::gemv(), BLAS::gemv(), BLAS::gemv_trans(), and qmcplusplus::Units::force::N.

185 {
186  const int M = trans == 'T' ? M_b : N_b;
187  const int N = trans == 'T' ? N_b : M_b;
188 
189  using vec_t = Vector<T, OMPallocator<T>>;
190  using mat_t = Matrix<T, OMPallocator<T>>;
191 
193 
194  vec_t A(N); // Input vector
195  mat_t B(M_b, N_b); // Input matrix
196  vec_t C(M); // Result vector ompBLAS
197  vec_t D(M); // Result vector BLAS
198 
199  // Fill data
200  for (int i = 0; i < N; i++)
201  A[i] = i;
202 
203  for (int j = 0; j < M_b; j++)
204  for (int i = 0; i < N_b; i++)
205  B[j][i] = i + j * 2;
206 
207  // Fill C and D with 0
208  for (int i = 0; i < M; i++)
209  C[i] = D[i] = T(0);
210 
211  A.updateTo();
212  B.updateTo();
213  C.updateTo();
214 
215  T alpha(1);
216  T beta(0);
217 
218  // in Fortran, B[M][N] is viewed as B^T
219  // when trans == 'T', the actual calculation is B * A[N] = C[M]
220  // when trans == 'N', the actual calculation is B^T * A[M] = C[N]
221  ompBLAS::gemv(handle, trans, N_b, M_b, alpha, B.device_data(), N_b, A.device_data(), 1, beta, C.device_data(), 1);
222  C.updateFrom();
223 
224  if (trans == 'T')
225  BLAS::gemv_trans(M_b, N_b, B.data(), A.data(), D.data());
226  else
227  BLAS::gemv(M_b, N_b, B.data(), A.data(), D.data());
228 
229  for (int index = 0; index < M; index++)
230  CHECK(C[index] == D[index]);
231 }
static void gemv_trans(int n, int m, const double *restrict amat, const double *restrict x, double *restrict y)
Definition: BLAS.hpp:147
TinyVector< double, 3 > vec_t
static void gemv(int n, int m, const double *restrict amat, const double *restrict x, double *restrict y)
Definition: BLAS.hpp:118
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
double B(double x, int k, int i, const std::vector< double > &t)

◆ test_gemv_batched()

void test_gemv_batched ( const int  M_b,
const int  N_b,
const char  trans,
const int  batch_count 
)

Definition at line 234 of file test_ompBLAS.cpp.

References CHECK(), Vector< T, Alloc >::data(), Vector< T, Alloc >::device_data(), BLAS::gemv(), qmcplusplus::ompBLAS::gemv_batched(), BLAS::gemv_trans(), qmcplusplus::Units::force::N, Vector< T, Alloc >::resize(), and Vector< T, Alloc >::updateTo().

235 {
236  const int M = trans == 'T' ? M_b : N_b;
237  const int N = trans == 'T' ? N_b : M_b;
238 
239  using vec_t = Vector<T, OMPallocator<T>>;
240  using mat_t = Matrix<T, OMPallocator<T>>;
241 
243 
244  // Create input vector
245  std::vector<vec_t> As;
246  Vector<const T*, OMPallocator<const T*>> Aptrs;
247 
248  // Create input matrix
249  std::vector<mat_t> Bs;
250  Vector<const T*, OMPallocator<const T*>> Bptrs;
251 
252  // Create output vector (ompBLAS)
253  std::vector<vec_t> Cs;
254  Vector<T*, OMPallocator<T*>> Cptrs;
255 
256  // Create output vector (BLAS)
257  std::vector<vec_t> Ds;
258  Vector<T*, OMPallocator<T*>> Dptrs;
259 
260  // Resize pointer vectors
261  Aptrs.resize(batch_count);
262  Bptrs.resize(batch_count);
263  Cptrs.resize(batch_count);
264  Dptrs.resize(batch_count);
265 
266  // Resize data vectors
267  As.resize(batch_count);
268  Bs.resize(batch_count);
269  Cs.resize(batch_count);
270  Ds.resize(batch_count);
271 
272  // Fill data
273  for (int batch = 0; batch < batch_count; batch++)
274  {
275  handle = batch;
276 
277  As[batch].resize(N);
278  Aptrs[batch] = As[batch].device_data();
279 
280  Bs[batch].resize(M_b, N_b);
281  Bptrs[batch] = Bs[batch].device_data();
282 
283  Cs[batch].resize(M);
284  Cptrs[batch] = Cs[batch].device_data();
285 
286  Ds[batch].resize(M);
287  Dptrs[batch] = Ds[batch].data();
288 
289  for (int i = 0; i < N; i++)
290  As[batch][i] = i;
291 
292  for (int j = 0; j < M_b; j++)
293  for (int i = 0; i < N_b; i++)
294  Bs[batch][j][i] = i + j * 2;
295 
296  for (int i = 0; i < M; i++)
297  Cs[batch][i] = Ds[batch][i] = T(0);
298 
299  As[batch].updateTo();
300  Bs[batch].updateTo();
301  }
302 
303  Aptrs.updateTo();
304  Bptrs.updateTo();
305  Cptrs.updateTo();
306 
307  // Run tests
308  Vector<T, OMPallocator<T>> alpha(batch_count);
309  Vector<T, OMPallocator<T>> beta(batch_count);
310  Vector<T, OMPallocator<T>> beta1(batch_count);
311 
312  for (int batch = 0; batch < batch_count; batch++)
313  {
314  alpha[batch] = T(0.5);
315  beta[batch] = T(0);
316  beta1[batch] = T(1);
317  }
318 
319  alpha.updateTo();
320  beta.updateTo();
321  beta1.updateTo();
322 
323  // alpha 0.5, beta 0
324  ompBLAS::gemv_batched(handle, trans, N_b, M_b, alpha.device_data(), Bptrs.device_data(), N_b, Aptrs.device_data(), 1,
325  beta.device_data(), Cptrs.device_data(), 1, batch_count);
326  // alpha 0.5, beta 1
327  ompBLAS::gemv_batched(handle, trans, N_b, M_b, alpha.device_data(), Bptrs.device_data(), N_b, Aptrs.device_data(), 1,
328  beta1.device_data(), Cptrs.device_data(), 1, batch_count);
329 
330  for (int batch = 0; batch < batch_count; batch++)
331  {
332  Cs[batch].updateFrom();
333  if (trans == 'T')
334  BLAS::gemv_trans(M_b, N_b, Bs[batch].data(), As[batch].data(), Ds[batch].data());
335  else
336  BLAS::gemv(M_b, N_b, Bs[batch].data(), As[batch].data(), Ds[batch].data());
337 
338  // Check results
339  for (int index = 0; index < M; index++)
340  CHECK(Cs[batch][index] == Ds[batch][index]);
341  }
342 }
static void gemv_trans(int n, int m, const double *restrict amat, const double *restrict x, double *restrict y)
Definition: BLAS.hpp:147
TinyVector< double, 3 > vec_t
static void gemv(int n, int m, const double *restrict amat, const double *restrict x, double *restrict y)
Definition: BLAS.hpp:118
void gemv_batched(BLASHandle< PlatformKind::CUDA > &handle, const char trans, const int m, const int n, const T *alpha, const T *const A[], const int lda, const T *const x[], const int incx, const T *beta, T *const y[], const int incy, const int batch_count)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ test_gemv_cases()

void qmcplusplus::test_gemv_cases ( )

Definition at line 295 of file test_AccelBLAS.cpp.

References qmcplusplus::Units::force::N.

296 {
297  const int M = 137;
298  const int N = 79;
299 
300  std::cout << "Testing NOTRANS gemv" << std::endl;
301  test_one_gemv<PL, float>(M, N, 'N');
302  test_one_gemv<PL, double>(M, N, 'N');
303 #if defined(QMC_COMPLEX)
304  test_one_gemv<PL, std::complex<float>>(N, M, 'N');
305  test_one_gemv<PL, std::complex<double>>(N, M, 'N');
306 #endif
307  std::cout << "Testing TRANS gemv" << std::endl;
308  test_one_gemv<PL, float>(M, N, 'T');
309  test_one_gemv<PL, double>(M, N, 'T');
310 #if defined(QMC_COMPLEX)
311  test_one_gemv<PL, std::complex<float>>(N, M, 'T');
312  test_one_gemv<PL, std::complex<double>>(N, M, 'T');
313 #endif
314 }

◆ test_ger()

void qmcplusplus::test_ger ( const int  M,
const int  N 
)

Definition at line 393 of file test_ompBLAS.cpp.

References CHECK(), TinyVector< T, D >::data(), qmcplusplus::ompBLAS::ger(), BLAS::ger(), and qmcplusplus::Units::force::N.

394 {
395  using vec_t = Vector<T, OMPallocator<T>>;
396  using mat_t = Matrix<T, OMPallocator<T>>;
397 
399 
400  mat_t Ah(M, N); // Input matrix
401  mat_t Ad(M, N); // Input matrix
402  vec_t x(M); // Input vector
403  vec_t y(N); // Input vector
404 
405  // Fill data
406  for (int i = 0; i < M; i++)
407  x[i] = i;
408  for (int i = 0; i < N; i++)
409  y[i] = N - i;
410 
411  for (int j = 0; j < M; j++)
412  for (int i = 0; i < N; i++)
413  {
414  Ah[j][i] = i + j * 2;
415  Ad[j][i] = i + j * 2;
416  }
417 
418  Ad.updateTo();
419  x.updateTo();
420  y.updateTo();
421 
422  T alpha(1);
423 
424  // in Fortran, B[M][N] is viewed as B^T
425  ompBLAS::ger(handle, M, N, alpha, x.device_data(), 1, y.device_data(), 1, Ad.device_data(), M);
426  Ad.updateFrom();
427 
428  BLAS::ger(M, N, alpha, x.data(), 1, y.data(), 1, Ah.data(), M);
429 
430  for (int j = 0; j < M; j++)
431  for (int i = 0; i < N; i++)
432  CHECK(Ah[j][i] == Ad[j][i]);
433 }
TinyVector< double, 3 > vec_t
static void ger(int m, int n, double alpha, const double *x, int incx, const double *y, int incy, double *a, int lda)
Definition: BLAS.hpp:437
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ test_ger_batched()

void test_ger_batched ( const int  M,
const int  N,
const int  batch_count 
)

Definition at line 436 of file test_ompBLAS.cpp.

References CHECK(), Vector< T, Alloc >::data(), Vector< T, Alloc >::device_data(), BLAS::ger(), qmcplusplus::ompBLAS::ger_batched(), qmcplusplus::Units::force::N, Vector< T, Alloc >::resize(), and Vector< T, Alloc >::updateTo().

437 {
438  using vec_t = Vector<T, OMPallocator<T>>;
439  using mat_t = Matrix<T, OMPallocator<T>>;
440 
442 
443  // Create input vector
444  std::vector<vec_t> Xs;
445  Vector<const T*, OMPallocator<const T*>> Xptrs;
446  std::vector<vec_t> Ys;
447  Vector<const T*, OMPallocator<const T*>> Yptrs;
448 
449  // Create input matrix
450  std::vector<mat_t> Ahs;
451  Vector<T*, OMPallocator<T*>> Ahptrs;
452  std::vector<mat_t> Ads;
453  Vector<T*, OMPallocator<T*>> Adptrs;
454 
455  // Resize pointer vectors
456  Xptrs.resize(batch_count);
457  Yptrs.resize(batch_count);
458  Ahptrs.resize(batch_count);
459  Adptrs.resize(batch_count);
460 
461  // Resize data vectors
462  Xs.resize(batch_count);
463  Ys.resize(batch_count);
464  Ahs.resize(batch_count);
465  Ads.resize(batch_count);
466 
467  // Fill data
468  for (int batch = 0; batch < batch_count; batch++)
469  {
470  handle = batch;
471 
472  Xs[batch].resize(M);
473  Xptrs[batch] = Xs[batch].device_data();
474 
475  Ys[batch].resize(N);
476  Yptrs[batch] = Ys[batch].device_data();
477 
478  Ads[batch].resize(M, N);
479  Adptrs[batch] = Ads[batch].device_data();
480 
481  Ahs[batch].resize(M, N);
482  Ahptrs[batch] = Ahs[batch].data();
483 
484  // Fill data
485  for (int i = 0; i < M; i++)
486  Xs[batch][i] = i;
487  for (int i = 0; i < N; i++)
488  Ys[batch][i] = N - i;
489 
490  for (int j = 0; j < M; j++)
491  for (int i = 0; i < N; i++)
492  {
493  Ads[batch][j][i] = i + j * 2;
494  Ahs[batch][j][i] = i + j * 2;
495  }
496 
497  Xs[batch].updateTo();
498  Ys[batch].updateTo();
499  Ads[batch].updateTo();
500  }
501 
502  Adptrs.updateTo();
503  Xptrs.updateTo();
504  Yptrs.updateTo();
505 
506  // Run tests
507  Vector<T, OMPallocator<T>> alpha(batch_count);
508 
509  for (int batch = 0; batch < batch_count; batch++)
510  {
511  alpha[batch] = T(1);
512  }
513 
514  alpha.updateTo();
515 
516  ompBLAS::ger_batched(handle, M, N, alpha.device_data(), Xptrs.device_data(), 1, Yptrs.device_data(), 1,
517  Adptrs.device_data(), M, batch_count);
518 
519  for (int batch = 0; batch < batch_count; batch++)
520  {
521  Ads[batch].updateFrom();
522  BLAS::ger(M, N, alpha[batch], Xs[batch].data(), 1, Ys[batch].data(), 1, Ahs[batch].data(), M);
523 
524  // Check results
525  for (int j = 0; j < M; j++)
526  for (int i = 0; i < N; i++)
527  CHECK(Ads[batch][j][i] == Ahs[batch][j][i]);
528  }
529 }
TinyVector< double, 3 > vec_t
static void ger(int m, int n, double alpha, const double *x, int incx, const double *y, int incy, double *a, int lda)
Definition: BLAS.hpp:437
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void ger_batched(BLASHandle< PlatformKind::CUDA > &handle, const int m, const int n, const T *alpha, const T *const x[], const int incx, const T *const y[], const int incy, T *const A[], const int lda, const int batch_count)

◆ test_ger_cases()

void qmcplusplus::test_ger_cases ( )

Definition at line 419 of file test_AccelBLAS.cpp.

References qmcplusplus::Units::force::N.

420 {
421  const int M = 137;
422  const int N = 79;
423 
424  // Batched Test
425  std::cout << "Testing ger_batched" << std::endl;
426  test_one_ger<PL, float>(M, N);
427  test_one_ger<PL, double>(M, N);
428 #if defined(QMC_COMPLEX)
429  test_one_ger<PL, std::complex<float>>(N, M);
430  test_one_ger<PL, std::complex<double>>(N, M);
431 #endif
432 }

◆ test_HCN()

void qmcplusplus::test_HCN ( bool  transform)

Definition at line 595 of file test_MO.cpp.

References castCharToXMLChar(), CHECK(), OHMMS::Controller, SPOSetBuilderFactory::createSPOSetBuilder(), doc, qmcplusplus::Units::charge::e, Libxml2Document::getRoot(), Libxml2Document::getXPathContext(), okay, Libxml2Document::parse(), XMLParticleParser::readXML(), and REQUIRE().

Referenced by TEST_CASE().

596 {
597  std::ostringstream section_name;
598  section_name << "HCN, transform orbitals to grid: " << (transform ? "T" : "F");
599 
600  SECTION(section_name.str())
601  {
603 
605  bool okay = doc.parse("hcn.structure.xml");
606  REQUIRE(okay);
607  xmlNodePtr root = doc.getRoot();
608 
609  const SimulationCell simulation_cell;
610  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
611  auto& ions(*ions_ptr);
612  XMLParticleParser parse_ions(ions);
613  OhmmsXPathObject particleset_ion("//particleset[@name='ion0']", doc.getXPathContext());
614  REQUIRE(particleset_ion.size() == 1);
615  parse_ions.readXML(particleset_ion[0]);
616 
617  REQUIRE(ions.groups() == 3);
618  REQUIRE(ions.R.size() == 3);
619  ions.update();
620 
621  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
622  auto& elec(*elec_ptr);
623  XMLParticleParser parse_elec(elec);
624  OhmmsXPathObject particleset_elec("//particleset[@name='e']", doc.getXPathContext());
625  REQUIRE(particleset_elec.size() == 1);
626  parse_elec.readXML(particleset_elec[0]);
627 
628  REQUIRE(elec.groups() == 2);
629  REQUIRE(elec.R.size() == 14);
630 
631  elec.R = 0.0;
632 
633  elec.addTable(ions);
634  elec.update();
635 
636  Libxml2Document doc2;
637  okay = doc2.parse("hcn.wfnoj.xml");
638  REQUIRE(okay);
639  xmlNodePtr root2 = doc2.getRoot();
640 
641  WaveFunctionComponentBuilder::PSetMap particle_set_map;
642  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
643  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
644 
645  SPOSetBuilderFactory bf(c, elec, particle_set_map);
646 
647  OhmmsXPathObject MO_base("//determinantset", doc2.getXPathContext());
648  REQUIRE(MO_base.size() == 1);
649 
650  if (!transform)
651  {
652  // input file is set to transform GTO's to numerical orbitals by default
653  // use direct evaluation of GTO's
654  xmlSetProp(MO_base[0], castCharToXMLChar("transform"), castCharToXMLChar("no"));
655  xmlSetProp(MO_base[0], castCharToXMLChar("key"), castCharToXMLChar("GTO"));
656  }
657 
658  const auto bb_ptr = bf.createSPOSetBuilder(MO_base[0]);
659  auto& bb(*bb_ptr);
660 
661  OhmmsXPathObject slater_base("//determinant", doc2.getXPathContext());
662  auto sposet = bb.createSPOSet(slater_base[0]);
663 
664 
665  SPOSet::ValueVector values;
666  SPOSet::GradVector dpsi;
667  SPOSet::ValueVector d2psi;
668  values.resize(7);
669  dpsi.resize(7);
670  d2psi.resize(7);
671 
672  ParticleSet::SingleParticlePos newpos;
673  elec.makeMove(0, newpos);
674 
675  sposet->evaluateValue(elec, 0, values);
676 
677  CHECK(values[0] == Approx(0.009452265234));
678  CHECK(values[1] == Approx(0.02008357407));
679  CHECK(values[2] == Approx(0.4163749594));
680  CHECK(values[3] == Approx(-0.08854428343));
681  CHECK(values[4] == Approx(0.273158705));
682  CHECK(values[5] == Approx(0));
683  CHECK(values[6] == Approx(0));
684 
685  sposet->evaluateVGL(elec, 0, values, dpsi, d2psi);
686 
687 
688  // Generated form gen_mo.py for position [0.0, 0.0, 0.0]
689  CHECK(values[0] == Approx(0.009452265234));
690  CHECK(dpsi[0][0] == Approx(-0.05400764372));
691  CHECK(dpsi[0][1] == Approx(0));
692  CHECK(dpsi[0][2] == Approx(0));
693  CHECK(d2psi[0] == Approx(0.2532157143));
694 
695  CHECK(values[1] == Approx(0.02008357407));
696  CHECK(dpsi[1][0] == Approx(0.1009262252));
697  CHECK(dpsi[1][1] == Approx(0));
698  CHECK(dpsi[1][2] == Approx(0));
699  CHECK(d2psi[1] == Approx(0.3423520138));
700 
701  CHECK(values[2] == Approx(0.4163749594));
702  CHECK(dpsi[2][0] == Approx(-0.1202256419));
703  CHECK(dpsi[2][1] == Approx(0));
704  CHECK(dpsi[2][2] == Approx(0));
705  CHECK(d2psi[2] == Approx(-1.178149899));
706 
707  CHECK(values[3] == Approx(-0.08854428343));
708  CHECK(dpsi[3][0] == Approx(-0.004505552544));
709  CHECK(dpsi[3][1] == Approx(0));
710  CHECK(dpsi[3][2] == Approx(0));
711  CHECK(d2psi[3] == Approx(0.2838238091));
712 
713  CHECK(values[4] == Approx(0.273158705));
714  CHECK(dpsi[4][0] == Approx(-0.01125044248));
715  CHECK(dpsi[4][1] == Approx(0));
716  CHECK(dpsi[4][2] == Approx(0));
717  CHECK(d2psi[4] == Approx(-0.9173261582));
718 
719  CHECK(values[5] == Approx(0));
720  CHECK(dpsi[5][0] == Approx(0));
721  CHECK(dpsi[5][1] == Approx(0.4221165864));
722  CHECK(dpsi[5][2] == Approx(-0.08191634629));
723  CHECK(d2psi[5] == Approx(0));
724 
725  CHECK(values[6] == Approx(0));
726  CHECK(dpsi[6][0] == Approx(0));
727  CHECK(dpsi[6][1] == Approx(0.08191634629));
728  CHECK(dpsi[6][2] == Approx(0.4221165864));
729  CHECK(d2psi[6] == Approx(0));
730 
731  //==========Hessian and Grad Hessian Test==========
732  SPOSet::HessVector dhpsi;
733  dhpsi.resize(7);
734 
735  sposet->evaluateVGH(elec, 0, values, dpsi, dhpsi);
736 
737  // Generated from gen_mo.py for position [0.0, 0.0, 0.0]
738  CHECK(values[0] == Approx(0.009452265234));
739  CHECK(dpsi[0][0] == Approx(-0.05400764372));
740  CHECK(dpsi[0][1] == Approx(0));
741  CHECK(dpsi[0][2] == Approx(0));
742  //Hessian (xx,xy,xz,yy,yz,zz)
743  CHECK(dhpsi[0](0, 0) == Approx(0.3523924743));
744  CHECK(dhpsi[0](0, 1) == Approx(0));
745  CHECK(dhpsi[0](0, 2) == Approx(0));
746  CHECK(dhpsi[0](1, 1) == Approx(-0.04958838002));
747  CHECK(dhpsi[0](1, 2) == Approx(0));
748  CHECK(dhpsi[0](2, 2) == Approx(-0.04958838002));
749 
750  /////////////////////////////////////////////////////////////////////////////
751  //Now we're going to test the API's called by SPOSet for higher derivatives//
752  /////////////////////////////////////////////////////////////////////////////
753  SPOSet::ValueMatrix psiM(elec.R.size(), sposet->getOrbitalSetSize());
754  SPOSet::GradMatrix dpsiM(elec.R.size(), sposet->getOrbitalSetSize());
755  SPOSet::HessMatrix hesspsiV(elec.R.size(), sposet->getOrbitalSetSize());
756  SPOSet::GGGMatrix d3psiV(elec.R.size(), sposet->getOrbitalSetSize());
757 
758  sposet->evaluate_notranspose(elec, 0, elec.R.size(), psiM, dpsiM, hesspsiV, d3psiV);
759 
760 
761  // Generated from gen_mo.py for position [0.0, 0.0, 0.0]
762  CHECK(psiM[0][0] == Approx(0.009452265234));
763  CHECK(dpsiM[0][0][0] == Approx(-0.05400764372));
764  CHECK(dpsiM[0][0][1] == Approx(0));
765  CHECK(dpsiM[0][0][2] == Approx(0));
766  //Hessian (xx,xy,xz,yy,yz,zz)
767  CHECK(hesspsiV[0][0](0, 0) == Approx(0.3523924743));
768  CHECK(hesspsiV[0][0](0, 1) == Approx(0));
769  CHECK(hesspsiV[0][0](0, 2) == Approx(0));
770  CHECK(hesspsiV[0][0](1, 1) == Approx(-0.04958838002));
771  CHECK(hesspsiV[0][0](1, 2) == Approx(0));
772  CHECK(hesspsiV[0][0](2, 2) == Approx(-0.04958838002));
773 
774  //GradHessian (xxx,xxy,xxz,xyy,xyz,xzz,yyy,yyz,yzz,zzz)
775  CHECK(d3psiV[0][0][0](0, 0) == Approx(-2.241965465));
776  CHECK(d3psiV[0][0][0](0, 1) == Approx(0));
777  CHECK(d3psiV[0][0][0](0, 2) == Approx(0));
778  CHECK(d3psiV[0][0][0](1, 1) == Approx(0.3714481861));
779  CHECK(d3psiV[0][0][0](1, 2) == Approx(0));
780  CHECK(d3psiV[0][0][0](2, 2) == Approx(0.3714481861));
781  CHECK(d3psiV[0][0][1](1, 1) == Approx(0));
782  CHECK(d3psiV[0][0][1](1, 2) == Approx(0));
783  CHECK(d3psiV[0][0][1](2, 2) == Approx(0));
784  CHECK(d3psiV[0][0][2](2, 2) == Approx(0));
785 
786  // Generated from gen_mo.py for position [0.0, 0.0, 0.0]
787  CHECK(psiM[0][1] == Approx(0.02008357407));
788  CHECK(dpsiM[0][1][0] == Approx(0.1009262252));
789  CHECK(dpsiM[0][1][1] == Approx(0));
790  CHECK(dpsiM[0][1][2] == Approx(0));
791  //Hessian (xx,xy,xz,yy,yz,zz)
792  CHECK(hesspsiV[0][1](0, 0) == Approx(0.5298289497));
793  CHECK(hesspsiV[0][1](0, 1) == Approx(0));
794  CHECK(hesspsiV[0][1](0, 2) == Approx(0));
795  CHECK(hesspsiV[0][1](1, 1) == Approx(-0.09373846794));
796  CHECK(hesspsiV[0][1](1, 2) == Approx(0));
797  CHECK(hesspsiV[0][1](2, 2) == Approx(-0.09373846794));
798 
799  //GradHessian (xxx,xxy,xxz,xyy,xyz,xzz,yyy,yyz,yzz,zzz)
800  CHECK(d3psiV[0][1][0](0, 0) == Approx(2.594787656));
801  CHECK(d3psiV[0][1][0](0, 1) == Approx(0));
802  CHECK(d3psiV[0][1][0](0, 2) == Approx(0));
803  CHECK(d3psiV[0][1][0](1, 1) == Approx(-0.5720485625));
804  CHECK(d3psiV[0][1][0](1, 2) == Approx(0));
805  CHECK(d3psiV[0][1][0](2, 2) == Approx(-0.5720485625));
806  CHECK(d3psiV[0][1][1](1, 1) == Approx(0));
807  CHECK(d3psiV[0][1][1](1, 2) == Approx(0));
808  CHECK(d3psiV[0][1][1](2, 2) == Approx(0));
809  CHECK(d3psiV[0][1][2](2, 2) == Approx(0));
810  // Generated from gen_mo.py for position [0.0, 0.0, 0.0]
811  CHECK(psiM[0][2] == Approx(0.4163749594));
812  CHECK(dpsiM[0][2][0] == Approx(-0.1202256419));
813  CHECK(dpsiM[0][2][1] == Approx(0));
814  CHECK(dpsiM[0][2][2] == Approx(0));
815  //Hessian (xx,xy,xz,yy,yz,zz)
816  CHECK(hesspsiV[0][2](0, 0) == Approx(-0.02607695984));
817  CHECK(hesspsiV[0][2](0, 1) == Approx(0));
818  CHECK(hesspsiV[0][2](0, 2) == Approx(0));
819  CHECK(hesspsiV[0][2](1, 1) == Approx(-0.5760364698));
820  CHECK(hesspsiV[0][2](1, 2) == Approx(0));
821  CHECK(hesspsiV[0][2](2, 2) == Approx(-0.5760364698));
822  //GradHessian (xxx,xxy,xxz,xyy,xyz,xzz,yyy,yyz,yzz,zzz)
823  CHECK(d3psiV[0][2][0](0, 0) == Approx(-0.227147312));
824  CHECK(d3psiV[0][2][0](0, 1) == Approx(0));
825  CHECK(d3psiV[0][2][0](0, 2) == Approx(0));
826  CHECK(d3psiV[0][2][0](1, 1) == Approx(0.2992015499));
827  CHECK(d3psiV[0][2][0](1, 2) == Approx(0));
828  CHECK(d3psiV[0][2][0](2, 2) == Approx(0.2992015499));
829  CHECK(d3psiV[0][2][1](1, 1) == Approx(0));
830  CHECK(d3psiV[0][2][1](1, 2) == Approx(0));
831  CHECK(d3psiV[0][2][1](2, 2) == Approx(0));
832  CHECK(d3psiV[0][2][2](2, 2) == Approx(0));
833 
834 
835  //Move electron 0 to some nontrivial position:
836  ParticleSet::SingleParticlePos disp(0.02, -0.1, 0.05);
837  elec.makeMove(0, disp);
838 
839 
840  SPOSet::GradMatrix dionpsi(elec.R.size(), sposet->getOrbitalSetSize());
841  SPOSet::HessMatrix diongradpsi(elec.R.size(), sposet->getOrbitalSetSize());
842  SPOSet::GradMatrix dionlaplpsi(elec.R.size(), sposet->getOrbitalSetSize());
843 
844  sposet->evaluateGradSource(elec, 0, elec.R.size(), ions, 0, dionpsi, diongradpsi, dionlaplpsi);
845 
846  //============== Ion 0 Component 0 ===================
847  CHECK(dionpsi[0][0][0] == Approx(0.0453112082));
848  CHECK(diongradpsi[0][0](0, 0) == Approx(-0.2943513994));
849  CHECK(diongradpsi[0][0](0, 1) == Approx(0.030468047));
850  CHECK(diongradpsi[0][0](0, 2) == Approx(-0.0152340235));
851  CHECK(dionlaplpsi[0][0][0] == Approx(1.333755581));
852  CHECK(dionpsi[0][1][0] == Approx(-0.0006473819623));
853  CHECK(diongradpsi[0][1](0, 0) == Approx(0.0004713407512));
854  CHECK(diongradpsi[0][1](0, 1) == Approx(-0.0001254975603));
855  CHECK(diongradpsi[0][1](0, 2) == Approx(6.274878013e-05));
856  CHECK(dionlaplpsi[0][1][0] == Approx(0.001057940846));
857  CHECK(dionpsi[0][2][0] == Approx(0.265578336));
858  CHECK(diongradpsi[0][2](0, 0) == Approx(-0.08685804115));
859  CHECK(diongradpsi[0][2](0, 1) == Approx(0.05438178417));
860  CHECK(diongradpsi[0][2](0, 2) == Approx(-0.02719089209));
861  CHECK(dionlaplpsi[0][2][0] == Approx(-1.882489819));
862  CHECK(dionpsi[0][3][0] == Approx(-0.06444305979));
863  CHECK(diongradpsi[0][3](0, 0) == Approx(-0.002013151923));
864  CHECK(diongradpsi[0][3](0, 1) == Approx(-0.002535923431));
865  CHECK(diongradpsi[0][3](0, 2) == Approx(0.001267961716));
866  CHECK(dionlaplpsi[0][3][0] == Approx(0.4547401581));
867  CHECK(dionpsi[0][4][0] == Approx(0.1454357726));
868  CHECK(diongradpsi[0][4](0, 0) == Approx(-0.2330499431));
869  CHECK(diongradpsi[0][4](0, 1) == Approx(0.09667641762));
870  CHECK(diongradpsi[0][4](0, 2) == Approx(-0.04833820881));
871  CHECK(dionlaplpsi[0][4][0] == Approx(-0.9197558839));
872  CHECK(dionpsi[0][5][0] == Approx(-0.04329985085));
873  CHECK(diongradpsi[0][5](0, 0) == Approx(0.09051993304));
874  CHECK(diongradpsi[0][5](0, 1) == Approx(0.382375474));
875  CHECK(diongradpsi[0][5](0, 2) == Approx(-0.07043361927));
876  CHECK(dionlaplpsi[0][5][0] == Approx(0.2201672051));
877  CHECK(dionpsi[0][6][0] == Approx(0.01207541177));
878  CHECK(diongradpsi[0][6](0, 0) == Approx(-0.02524405435));
879  CHECK(diongradpsi[0][6](0, 1) == Approx(0.0800332842));
880  CHECK(diongradpsi[0][6](0, 2) == Approx(0.3929818664));
881  CHECK(dionlaplpsi[0][6][0] == Approx(-0.0614000824));
882 
883 
884  sposet->evaluateGradSource(elec, 0, elec.R.size(), ions, 1, dionpsi, diongradpsi, dionlaplpsi);
885 
886  //============== Ion 1 Component 1 ===================
887  CHECK(dionpsi[0][0][1] == Approx(0.0001412373768));
888  CHECK(diongradpsi[0][0](1, 0) == Approx(0.0001124265646));
889  CHECK(diongradpsi[0][0](1, 1) == Approx(-0.001383378615));
890  CHECK(diongradpsi[0][0](1, 2) == Approx(-1.449757545e-05));
891  CHECK(dionlaplpsi[0][0][1] == Approx(-0.001252043663));
892  CHECK(dionpsi[0][1][1] == Approx(-0.01029290716));
893  CHECK(diongradpsi[0][1](1, 0) == Approx(-0.06178485148));
894  CHECK(diongradpsi[0][1](1, 1) == Approx(0.0971577216));
895  CHECK(diongradpsi[0][1](1, 2) == Approx(0.002885675005));
896  CHECK(dionlaplpsi[0][1][1] == Approx(-0.1403103458));
897  CHECK(dionpsi[0][2][1] == Approx(-0.0230872583));
898  CHECK(diongradpsi[0][2](1, 0) == Approx(-0.02537847709));
899  CHECK(diongradpsi[0][2](1, 1) == Approx(0.2268946564));
900  CHECK(diongradpsi[0][2](1, 2) == Approx(0.001988963201));
901  CHECK(dionlaplpsi[0][2][1] == Approx(0.2028851421));
902  CHECK(dionpsi[0][3][1] == Approx(0.01850231814));
903  CHECK(diongradpsi[0][3](1, 0) == Approx(0.05709948475));
904  CHECK(diongradpsi[0][3](1, 1) == Approx(-0.1776515965));
905  CHECK(diongradpsi[0][3](1, 2) == Approx(-0.003685792479));
906  CHECK(dionlaplpsi[0][3][1] == Approx(-0.1280699725));
907  CHECK(dionpsi[0][4][1] == Approx(-0.02136209962));
908  CHECK(diongradpsi[0][4](1, 0) == Approx(-0.03836586276));
909  CHECK(diongradpsi[0][4](1, 1) == Approx(0.2084578148));
910  CHECK(diongradpsi[0][4](1, 2) == Approx(0.002581590766));
911  CHECK(dionlaplpsi[0][4][1] == Approx(0.1792683544));
912  CHECK(dionpsi[0][5][1] == Approx(-0.1942343714));
913  CHECK(diongradpsi[0][5](1, 0) == Approx(-0.3037357197));
914  CHECK(diongradpsi[0][5](1, 1) == Approx(-0.09561978734));
915  CHECK(diongradpsi[0][5](1, 2) == Approx(0.02118492506));
916  CHECK(dionlaplpsi[0][5][1] == Approx(0.6410434658));
917  CHECK(dionpsi[0][6][1] == Approx(-0.03930992259));
918  CHECK(diongradpsi[0][6](1, 0) == Approx(-0.06331544695));
919  CHECK(diongradpsi[0][6](1, 1) == Approx(-0.002807368817));
920  CHECK(diongradpsi[0][6](1, 2) == Approx(-0.02801340823));
921  CHECK(dionlaplpsi[0][6][1] == Approx(0.1369061053));
922 
923  sposet->evaluateGradSource(elec, 0, elec.R.size(), ions, 2, dionpsi, diongradpsi, dionlaplpsi);
924 
925  //============== Ion 2 Component 2 ===================
926  CHECK(dionpsi[0][0][2] == Approx(1.302648961e-06));
927  CHECK(diongradpsi[0][0](2, 0) == Approx(1.865129579e-06));
928  CHECK(diongradpsi[0][0](2, 1) == Approx(6.142092043e-08));
929  CHECK(diongradpsi[0][0](2, 2) == Approx(2.602225618e-05));
930  CHECK(dionlaplpsi[0][0][2] == Approx(1.234692903e-06));
931  CHECK(dionpsi[0][1][2] == Approx(3.248738084e-07));
932  CHECK(diongradpsi[0][1](2, 0) == Approx(-2.044420189e-06));
933  CHECK(diongradpsi[0][1](2, 1) == Approx(-7.011145137e-08));
934  CHECK(diongradpsi[0][1](2, 2) == Approx(6.532522353e-06));
935  CHECK(dionlaplpsi[0][1][2] == Approx(-6.10958506e-06));
936  CHECK(dionpsi[0][2][2] == Approx(3.264249981e-06));
937  CHECK(diongradpsi[0][2](2, 0) == Approx(2.820971234e-05));
938  CHECK(diongradpsi[0][2](2, 1) == Approx(9.405184964e-07));
939  CHECK(diongradpsi[0][2](2, 2) == Approx(6.481420782e-05));
940  CHECK(dionlaplpsi[0][2][2] == Approx(5.73961989e-05));
941  CHECK(dionpsi[0][3][2] == Approx(0.0001288974413));
942  CHECK(diongradpsi[0][3](2, 0) == Approx(0.0002840756879));
943  CHECK(diongradpsi[0][3](2, 1) == Approx(9.281700408e-06));
944  CHECK(diongradpsi[0][3](2, 2) == Approx(0.002573308008));
945  CHECK(dionlaplpsi[0][3][2] == Approx(0.0003025314443));
946  CHECK(dionpsi[0][4][2] == Approx(-7.300043903e-05));
947  CHECK(diongradpsi[0][4](2, 0) == Approx(-0.0001000016834));
948  CHECK(diongradpsi[0][4](2, 1) == Approx(-3.233243534e-06));
949  CHECK(diongradpsi[0][4](2, 2) == Approx(-0.001458391774));
950  CHECK(dionlaplpsi[0][4][2] == Approx(-3.546690719e-05));
951  CHECK(dionpsi[0][5][2] == Approx(2.910525987e-06));
952  CHECK(diongradpsi[0][5](2, 0) == Approx(1.307065133e-05));
953  CHECK(diongradpsi[0][5](2, 1) == Approx(1.560390706e-06));
954  CHECK(diongradpsi[0][5](2, 2) == Approx(-2.92731811e-06));
955  CHECK(dionlaplpsi[0][5][2] == Approx(3.797816228e-05));
956  CHECK(dionpsi[0][6][2] == Approx(-1.56074936e-05));
957  CHECK(diongradpsi[0][6](2, 0) == Approx(-7.009049656e-05));
958  CHECK(diongradpsi[0][6](2, 1) == Approx(-2.048666792e-06));
959  CHECK(diongradpsi[0][6](2, 2) == Approx(2.967709412e-06));
960  CHECK(dionlaplpsi[0][6][2] == Approx(-0.0002018111858));
961 
962  //Same tests as before, but for the gradient only.
963 
964  sposet->evaluateGradSource(elec, 0, elec.R.size(), ions, 0, dionpsi);
965  //============== Ion 0 Component 0 ===================
966  CHECK(dionpsi[0][0][0] == Approx(0.0453112082));
967  CHECK(dionpsi[0][1][0] == Approx(-0.0006473819623));
968  CHECK(dionpsi[0][2][0] == Approx(0.265578336));
969  CHECK(dionpsi[0][3][0] == Approx(-0.06444305979));
970  CHECK(dionpsi[0][4][0] == Approx(0.1454357726));
971  CHECK(dionpsi[0][5][0] == Approx(-0.04329985085));
972  CHECK(dionpsi[0][6][0] == Approx(0.01207541177));
973 
974  sposet->evaluateGradSource(elec, 0, elec.R.size(), ions, 1, dionpsi);
975  //============== Ion 1 Component 1 ===================
976  CHECK(dionpsi[0][0][1] == Approx(0.0001412373768));
977  CHECK(dionpsi[0][1][1] == Approx(-0.01029290716));
978  CHECK(dionpsi[0][2][1] == Approx(-0.0230872583));
979  CHECK(dionpsi[0][3][1] == Approx(0.01850231814));
980  CHECK(dionpsi[0][4][1] == Approx(-0.02136209962));
981  CHECK(dionpsi[0][5][1] == Approx(-0.1942343714));
982  CHECK(dionpsi[0][6][1] == Approx(-0.03930992259));
983 
984  sposet->evaluateGradSource(elec, 0, elec.R.size(), ions, 2, dionpsi);
985  //============== Ion 2 Component 2 ===================
986  CHECK(dionpsi[0][0][2] == Approx(1.302648961e-06));
987  CHECK(dionpsi[0][1][2] == Approx(3.248738084e-07));
988  CHECK(dionpsi[0][2][2] == Approx(3.264249981e-06));
989  CHECK(dionpsi[0][3][2] == Approx(0.0001288974413));
990  CHECK(dionpsi[0][4][2] == Approx(-7.300043903e-05));
991  CHECK(dionpsi[0][5][2] == Approx(2.910525987e-06));
992  CHECK(dionpsi[0][6][2] == Approx(-1.56074936e-05));
993 
994 
995  //Finally, going to test evaluateGradSourceRow. Same template and reference
996  //values as above.
997  SPOSet::GradVector dionpsivec;
998  dionpsivec.resize(7);
999 
1000  sposet->evaluateGradSourceRow(elec, 0, ions, 0, dionpsivec);
1001  //============== Ion 0 Component 0 ===================
1002  CHECK(dionpsivec[0][0] == Approx(0.0453112082));
1003  CHECK(dionpsivec[1][0] == Approx(-0.0006473819623));
1004  CHECK(dionpsivec[2][0] == Approx(0.265578336));
1005  CHECK(dionpsivec[3][0] == Approx(-0.06444305979));
1006  CHECK(dionpsivec[4][0] == Approx(0.1454357726));
1007  CHECK(dionpsivec[5][0] == Approx(-0.04329985085));
1008  CHECK(dionpsivec[6][0] == Approx(0.01207541177));
1009 
1010  sposet->evaluateGradSourceRow(elec, 0, ions, 1, dionpsivec);
1011  //============== Ion 1 Component 1 ===================
1012  CHECK(dionpsivec[0][1] == Approx(0.0001412373768));
1013  CHECK(dionpsivec[1][1] == Approx(-0.01029290716));
1014  CHECK(dionpsivec[2][1] == Approx(-0.0230872583));
1015  CHECK(dionpsivec[3][1] == Approx(0.01850231814));
1016  CHECK(dionpsivec[4][1] == Approx(-0.02136209962));
1017  CHECK(dionpsivec[5][1] == Approx(-0.1942343714));
1018  CHECK(dionpsivec[6][1] == Approx(-0.03930992259));
1019 
1020  sposet->evaluateGradSourceRow(elec, 0, ions, 2, dionpsivec);
1021  //============== Ion 2 Component 2 ===================
1022  CHECK(dionpsivec[0][2] == Approx(1.302648961e-06));
1023  CHECK(dionpsivec[1][2] == Approx(3.248738084e-07));
1024  CHECK(dionpsivec[2][2] == Approx(3.264249981e-06));
1025  CHECK(dionpsivec[3][2] == Approx(0.0001288974413));
1026  CHECK(dionpsivec[4][2] == Approx(-7.300043903e-05));
1027  CHECK(dionpsivec[5][2] == Approx(2.910525987e-06));
1028  CHECK(dionpsivec[6][2] == Approx(-1.56074936e-05));
1029  }
1030 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180
xmlChar * castCharToXMLChar(char *c)
unsafe char* to xmlChar* cast
Definition: libxmldefs.h:70

◆ test_hcpBe_rotation()

void qmcplusplus::test_hcpBe_rotation ( bool  use_single_det,
bool  use_nlpp_batched 
)

Definition at line 38 of file test_RotatedSPOs_NLPP.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ProjectData::BATCH, CHECK(), TrialWaveFunction::checkInVariables(), TrialWaveFunction::checkOutVariables(), OHMMS::Controller, doc, qmcplusplus::Units::charge::e, OperatorBase::evaluate(), QMCHamiltonian::evaluate(), TrialWaveFunction::evaluateDerivatives(), TrialWaveFunction::evaluateLog(), QMCHamiltonian::evaluateValueAndDerivatives(), QMCHamiltonian::getHamiltonian(), QMCHamiltonian::getKineticEnergy(), QMCHamiltonian::getLocalEnergy(), TrialWaveFunction::getOrbitals(), ParticleSetPool::getPool(), Libxml2Document::getRoot(), ProjectData::getRuntimeOptions(), ParticleSetPool::getSimulationCell(), lattice, TrialWaveFunction::mw_evaluateParameterDerivatives(), QMCHamiltonian::mw_evaluateValueAndDerivatives(), okay, Libxml2Document::parseFromString(), REQUIRE(), VariableSet::resetIndex(), TrialWaveFunction::resetParameters(), QMCHamiltonian::setRandomGenerator(), ParticleSetPool::setSimulationCell(), and test_project.

Referenced by TEST_CASE().

39 {
41 
42  /*
43  BEGIN Boilerplate stuff to make a simple SPOSet. Copied from test_einset.cpp
44  */
45  ProjectData test_project("test", ProjectData::DriverVersion::BATCH);
47 
48  ParticleSetPool pp(c);
49 
50  ParticleSet::ParticleLayout lattice;
51  lattice.R(0, 0) = 4.32747284;
52  lattice.R(0, 1) = 0.00000000;
53  lattice.R(0, 2) = 0.00000000;
54  lattice.R(1, 0) = -2.16373642;
55  lattice.R(1, 1) = 3.74770142;
56  lattice.R(1, 2) = 0.00000000;
57  lattice.R(2, 0) = 0.00000000;
58  lattice.R(2, 1) = 0.00000000;
59  lattice.R(2, 2) = 6.78114995;
60 
61 
62  const SimulationCell simulation_cell(lattice);
63  pp.setSimulationCell(simulation_cell);
64  auto elec_ptr = std::make_unique<ParticleSet>(pp.getSimulationCell());
65  auto& elec(*elec_ptr);
66  auto ions_uptr = std::make_unique<ParticleSet>(pp.getSimulationCell());
67  ParticleSet& ions(*ions_uptr);
68 
69  elec.setName("e");
70  elec.create({1, 1});
71  elec.R[0] = {0.1, 0.2, 0.3};
72  elec.R[1] = {1.0, 1.0, 1.0};
73 
74  SpeciesSet& especies = elec.getSpeciesSet();
75  int upIdx = especies.addSpecies("u");
76  int chargeIdx = especies.addAttribute("charge");
77  int massIdx = especies.addAttribute("mass");
78  especies(chargeIdx, upIdx) = -1;
79  especies(massIdx, upIdx) = 1.0;
80  int dnIdx = especies.addSpecies("d");
81  especies(chargeIdx, dnIdx) = -1;
82  especies(massIdx, dnIdx) = 1.0;
83  elec.resetGroups(); // need to set Mass so
84 
85 
86  pp.addParticleSet(std::move(elec_ptr));
87 
88  ions.setName("ion0");
89  ions.create({1});
90  ions.R[0] = {0.0, 0.0, 0.0};
91  SpeciesSet& tspecies = ions.getSpeciesSet();
92  int CIdx = tspecies.addSpecies("Be");
93  int CchargeIdx = tspecies.addAttribute("charge");
94  int CatomicnumberIdx = tspecies.addAttribute("atomicnumber");
95  tspecies(CchargeIdx, CIdx) = 2;
96  tspecies(CatomicnumberIdx, CIdx) = 4;
97 
98 
99  pp.addParticleSet(std::move(ions_uptr));
100 
101  WaveFunctionPool wp(test_project.getRuntimeOptions(), pp, c);
102  REQUIRE(wp.empty() == true);
103 
104  const char* wf_input_multi_det = R"(
105  <wavefunction name="psi0" target="e">
106  <sposet_builder type="bspline" href="hcpBe.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion0" version="0.10" meshfactor="1.0" precision="double" truncate="no" save_coefs="no">
107  <sposet type="bspline" name="spo_up" size="2" spindataset="0" optimize="yes">
108  </sposet>
109  <sposet type="bspline" name="spo_down" size="2" spindataset="0" optimize="yes">
110  </sposet>
111  </sposet_builder>
112  <determinantset>
113  <multideterminant optimize="no" spo_0="spo_up" spo_1="spo_down" algorithm="precomputed_table_method">
114  <detlist size="1" type="DETS" nc0="0" ne0="1" nc1="0" ne1="1" nstates="2" cutoff="1e-20">
115  <ci coeff="1.0" occ0="10" occ1="10"/>
116  </detlist>
117  </multideterminant>
118  </determinantset>
119  </wavefunction>)";
120 
121  const char* wf_input_single_det = R"(
122  <wavefunction name="psi0" target="e">
123  <sposet_builder type="bspline" href="hcpBe.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion0" version="0.10" meshfactor="1.0" precision="double" truncate="no" save_coefs="no">
124  <sposet type="bspline" name="spo_up" size="2" spindataset="0" optimize="yes">
125  </sposet>
126  <sposet type="bspline" name="spo_down" size="2" spindataset="0" optimize="yes">
127  </sposet>
128  </sposet_builder>
129  <determinantset>
130  <slaterdeterminant>
131  <determinant id="spo_up" size="1">
132  <occupation mode="ground" spindataset="0"/>
133  </determinant>
134  <determinant id="spo_down" size="1">
135  <occupation mode="ground" spindataset="0"/>
136  </determinant>
137  </slaterdeterminant>
138  </determinantset>
139  </wavefunction>)";
140 
141  const char* wf_input = wf_input_multi_det;
142  if (use_single_det)
143  wf_input = wf_input_single_det;
144 
146  bool okay = doc.parseFromString(wf_input);
147  REQUIRE(okay);
148 
149  xmlNodePtr root = doc.getRoot();
150 
151  wp.put(root);
152  TrialWaveFunction* psi = wp.getWaveFunction("psi0");
153  REQUIRE(psi != nullptr);
154  REQUIRE(psi->getOrbitals().size() == 1);
155 
156 
157  // Note the pbc="no" setting to turn off long-range summation.
158  const char* ham_input_nlpp_nonbatched = R"(
159  <hamiltonian name="h0" type="generic" target="e">
160  <pairpot type="pseudo" name="PseudoPot" source="ion0" wavefunction="psi0" format="xml" algorithm="non-batched" pbc="no">
161  <pseudo elementType="Be" href="Be.BFD.xml" nrule="2" disable_randomize_grid="yes"/>
162  </pairpot>
163  </hamiltonian>)";
164 
165  const char* ham_input_nlpp_batched = R"(
166  <hamiltonian name="h0" type="generic" target="e">
167  <pairpot type="pseudo" name="PseudoPot" source="ion0" wavefunction="psi0" format="xml" algorithm="batched" pbc="no">
168  <pseudo elementType="Be" href="Be.BFD.xml" nrule="2" disable_randomize_grid="yes"/>
169  </pairpot>
170  </hamiltonian>)";
171 
172  const char* ham_input = ham_input_nlpp_nonbatched;
173  if (use_nlpp_batched)
174  ham_input = ham_input_nlpp_batched;
175 
176  HamiltonianFactory hf("h0", elec, pp.getPool(), wp.getPool(), c);
177 
178  Libxml2Document doc2;
179  bool okay2 = doc2.parseFromString(ham_input);
180  REQUIRE(okay2);
181 
182  xmlNodePtr root2 = doc2.getRoot();
183  hf.put(root2);
184 
185  opt_variables_type opt_vars;
186  psi->checkInVariables(opt_vars);
187  opt_vars.resetIndex();
188  psi->checkOutVariables(opt_vars);
189  psi->resetParameters(opt_vars);
190 
191  elec.update();
192 
193  double logval = psi->evaluateLog(elec);
194  CHECK(logval == Approx(-1.2865633501081344));
195 
196  CHECK(elec.G[0][0] == ValueApprox(0.54752651));
197  CHECK(elec.L[0] == ValueApprox(11.066512459947848));
198 #if defined(MIXED_PRECISION)
199  CHECK(elec.L[1] == ValueApprox(-0.4830868071).epsilon(1e-3));
200 #else
201  CHECK(elec.L[1] == ValueApprox(-0.4831061477045371));
202 #endif
203 
204  // Parameter derivatives of just the wavefunction
205  // Values come from QMCWaveFunctions/tests/eval_bspline_spo.py
207  Vector<ValueType> dlogpsi(2);
208  Vector<ValueType> dhpsioverpsi(2);
209  psi->evaluateDerivatives(elec, opt_vars, dlogpsi, dhpsioverpsi);
210 
211  CHECK(dlogpsi[0] == ValueApprox(-2.97750823));
212  CHECK(dlogpsi[1] == ValueApprox(-1.06146356));
213  CHECK(dhpsioverpsi[0] == ValueApprox(-36.71707483));
214  CHECK(dhpsioverpsi[1] == ValueApprox(-0.35274333));
215 
216  RefVectorWithLeader<TrialWaveFunction> wf_list(*psi, {*psi});
217  RefVectorWithLeader<ParticleSet> p_list(elec, {elec});
218 
219  // Test list with one wavefunction
220 
221  int nparam = 2;
222  int nentry = 1;
223  RecordArray<ValueType> dlogpsi_list(nentry, nparam);
224  RecordArray<ValueType> dhpsi_over_psi_list(nentry, nparam);
225 
226  TrialWaveFunction::mw_evaluateParameterDerivatives(wf_list, p_list, opt_vars, dlogpsi_list, dhpsi_over_psi_list);
227 
228  CHECK(dlogpsi_list[0][0] == Approx(dlogpsi[0]));
229  CHECK(dlogpsi_list[0][1] == Approx(dlogpsi[1]));
230  CHECK(dhpsi_over_psi_list[0][0] == Approx(dhpsioverpsi[0]));
231  CHECK(dhpsi_over_psi_list[0][1] == Approx(dhpsioverpsi[1]));
232 
233 
234  QMCHamiltonian* h = hf.getH();
235  RandomGenerator myrng;
236  h->setRandomGenerator(&myrng);
237 
238  h->evaluate(elec);
239  double loc_e = h->getLocalEnergy();
240  double ke = h->getKineticEnergy();
241  CHECK(ke == Approx(-6.818620576308302));
242  CHECK(loc_e == Approx(-3.562354739253797));
243 
244  auto* localECP_H = h->getHamiltonian("LocalECP");
245  double local_pp = localECP_H->evaluate(elec);
246 
247  Vector<ValueType> dlogpsi2(2);
248  Vector<ValueType> dhpsioverpsi2(2);
249 
250  h->evaluateValueAndDerivatives(elec, opt_vars, dlogpsi2, dhpsioverpsi2);
251  // Derivative the wavefunction is unchanged by NLPP
252  CHECK(dlogpsi2[0] == Approx(dlogpsi[0]));
253  CHECK(dlogpsi2[1] == Approx(dlogpsi[1]));
254 
255  // Derivative of H is different with NLPP included
256  CHECK(dhpsioverpsi2[0] == ValueApprox(-5.45054261));
257  CHECK(dhpsioverpsi2[1] == ValueApprox(-0.34818307));
258 
259  // batched interface
260  RefVectorWithLeader<QMCHamiltonian> h_list(*h, {*h});
261 
262  RecordArray<ValueType> dlogpsi_list2(nentry, nparam);
263  RecordArray<ValueType> dhpsi_over_psi_list2(nentry, nparam);
264 
265  h->mw_evaluateValueAndDerivatives(h_list, wf_list, p_list, opt_vars, dlogpsi_list2, dhpsi_over_psi_list2);
266 
267  CHECK(dlogpsi_list2[0][0] == Approx(dlogpsi2[0]));
268  CHECK(dlogpsi_list2[0][1] == Approx(dlogpsi2[1]));
269 
270  CHECK(dhpsi_over_psi_list2[0][0] == Approx(dhpsioverpsi2[0]));
271  CHECK(dhpsi_over_psi_list2[0][1] == Approx(dhpsioverpsi2[1]));
272 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
StdRandom< OHMMS_PRECISION_FULL > RandomGenerator
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
void resetIndex()
reset Index
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ test_He()

void qmcplusplus::test_He ( bool  transform)

Definition at line 26 of file test_MO.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), castCharToXMLChar(), CHECK(), OHMMS::Controller, SPOSetBuilderFactory::createSPOSetBuilder(), doc, Libxml2Document::getRoot(), Libxml2Document::getXPathContext(), ispecies, okay, Libxml2Document::parse(), and REQUIRE().

Referenced by TEST_CASE().

27 {
28  std::ostringstream section_name;
29  section_name << "He, transform orbitals to grid: " << (transform ? "T" : "F");
30 
31  SECTION(section_name.str())
32  {
34 
35  const SimulationCell simulation_cell;
36  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
37  auto& elec(*elec_ptr);
38  std::vector<int> agroup(2);
39  agroup[0] = 1;
40  agroup[1] = 1;
41  elec.setName("e");
42  elec.create(agroup);
43  elec.R[0] = 0.0;
44 
45  SpeciesSet& tspecies = elec.getSpeciesSet();
46  int upIdx = tspecies.addSpecies("u");
47  int downIdx = tspecies.addSpecies("d");
48  int massIdx = tspecies.addAttribute("mass");
49  tspecies(massIdx, upIdx) = 1.0;
50  tspecies(massIdx, downIdx) = 1.0;
51 
52  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
53  auto& ions(*ions_ptr);
54  ions.setName("ion0");
55  ions.create({1});
56  ions.R[0] = 0.0;
57  SpeciesSet& ispecies = ions.getSpeciesSet();
58  int heIdx = ispecies.addSpecies("He");
59  ions.update();
60 
61  elec.addTable(ions);
62  elec.update();
63 
65  bool okay = doc.parse("he_sto3g.wfj.xml");
66  REQUIRE(okay);
67  xmlNodePtr root = doc.getRoot();
68 
69  WaveFunctionComponentBuilder::PSetMap particle_set_map;
70  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
71  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
72 
73  SPOSetBuilderFactory bf(c, elec, particle_set_map);
74 
75  OhmmsXPathObject MO_base("//determinantset", doc.getXPathContext());
76  REQUIRE(MO_base.size() == 1);
77  if (!transform)
78  {
79  // input file is set to transform GTO's to numerical orbitals by default
80  // use direct evaluation of GTO's
81  xmlSetProp(MO_base[0], castCharToXMLChar("transform"), castCharToXMLChar("no"));
82  xmlSetProp(MO_base[0], castCharToXMLChar("key"), castCharToXMLChar("GTO"));
83  }
84 
85  const auto bb_ptr = bf.createSPOSetBuilder(MO_base[0]);
86  auto& bb(*bb_ptr);
87 
88  OhmmsXPathObject slater_base("//determinant", doc.getXPathContext());
89  auto sposet = bb.createSPOSet(slater_base[0]);
90 
91  //std::cout << "basis set size = " << sposet->getBasisSetSize() << std::endl;
92 
93  SPOSet::ValueVector values;
94  SPOSet::GradVector dpsi;
95  SPOSet::ValueVector d2psi;
96  values.resize(1);
97  dpsi.resize(1);
98  d2psi.resize(1);
99 
100  // Call makeMove to compute the distances
101  ParticleSet::SingleParticlePos newpos(0.0001, 0.0, 0.0);
102  elec.makeMove(0, newpos);
103 
104  sposet->evaluateValue(elec, 0, values);
105 
106  // Generated from gen_mo.py for position [0.0001, 0.0, 0.0]
107  CHECK(values[0] == Approx(0.9996037001));
108 
109  sposet->evaluateVGL(elec, 0, values, dpsi, d2psi);
110 
111  // Generated from gen_mo.py for position [0.0001, 0.0, 0.0]
112  CHECK(values[0] == Approx(0.9996037001));
113  CHECK(dpsi[0][0] == Approx(-0.0006678035459));
114  CHECK(dpsi[0][1] == Approx(0));
115  CHECK(dpsi[0][2] == Approx(0));
116  CHECK(d2psi[0] == Approx(-20.03410564));
117 
118 
119  ParticleSet::SingleParticlePos disp(1.0, 0.0, 0.0);
120  elec.makeMove(0, disp);
121 
122  sposet->evaluateVGL(elec, 0, values, dpsi, d2psi);
123  // Generated from gen_mo.py for position [1.0, 0.0, 0.0]
124  CHECK(values[0] == Approx(0.2315567641));
125  CHECK(dpsi[0][0] == Approx(-0.3805431885));
126  CHECK(dpsi[0][1] == Approx(0));
127  CHECK(dpsi[0][2] == Approx(0));
128  CHECK(d2psi[0] == Approx(-0.2618497452));
129  }
130 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180
xmlChar * castCharToXMLChar(char *c)
unsafe char* to xmlChar* cast
Definition: libxmldefs.h:70

◆ test_He_mw()

void qmcplusplus::test_He_mw ( bool  transform)

Definition at line 136 of file test_MO.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), castCharToXMLChar(), CHECK(), OHMMS::Controller, SPOSetBuilderFactory::createSPOSetBuilder(), doc, Libxml2Document::getRoot(), Libxml2Document::getXPathContext(), ispecies, ParticleSet::makeMove(), okay, Libxml2Document::parse(), ParticleSet::R, REQUIRE(), and ParticleSet::update().

Referenced by TEST_CASE().

137 {
138  // set up ion particle set as normal
140 
141  const SimulationCell simulation_cell;
142  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
143  auto& elec(*elec_ptr);
144  std::vector<int> agroup(2);
145  agroup[0] = 1;
146  agroup[1] = 1;
147  elec.setName("e");
148  elec.create(agroup);
149  elec.R[0] = 0.0;
150 
151  SpeciesSet& tspecies = elec.getSpeciesSet();
152  int upIdx = tspecies.addSpecies("u");
153  int downIdx = tspecies.addSpecies("d");
154  int massIdx = tspecies.addAttribute("mass");
155  tspecies(massIdx, upIdx) = 1.0;
156  tspecies(massIdx, downIdx) = 1.0;
157 
158  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
159  auto& ions(*ions_ptr);
160  ions.setName("ion0");
161  ions.create({1});
162  ions.R[0] = 0.0;
163  SpeciesSet& ispecies = ions.getSpeciesSet();
164  int heIdx = ispecies.addSpecies("He");
165  ions.update();
166 
167  elec.addTable(ions);
168  elec.update();
169 
171  bool okay = doc.parse("he_sto3g.wfj.xml");
172  REQUIRE(okay);
173  xmlNodePtr root = doc.getRoot();
174 
175  WaveFunctionComponentBuilder::PSetMap particle_set_map;
176  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
177  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
178 
179  SPOSetBuilderFactory bf(c, elec, particle_set_map);
180 
181  OhmmsXPathObject MO_base("//determinantset", doc.getXPathContext());
182  REQUIRE(MO_base.size() == 1);
183  if (!transform)
184  {
185  // input file is set to transform GTO's to numerical orbitals by default
186  // use direct evaluation of GTO's
187  xmlSetProp(MO_base[0], castCharToXMLChar("transform"), castCharToXMLChar("no"));
188  xmlSetProp(MO_base[0], castCharToXMLChar("key"), castCharToXMLChar("GTO"));
189  }
190 
191  const auto bb_ptr = bf.createSPOSetBuilder(MO_base[0]);
192  auto& bb(*bb_ptr);
193 
194  OhmmsXPathObject slater_base("//determinant", doc.getXPathContext());
195  auto sposet = bb.createSPOSet(slater_base[0]);
196 
197  //std::cout << "basis set size = " << sposet->getBasisSetSize() << std::endl;
198 
200  SPOSet::GradVector dpsi;
201  SPOSet::ValueVector d2psi;
202  psi.resize(1);
203  dpsi.resize(1);
204  d2psi.resize(1);
205 
206  // Call makeMove to compute the distances
207  ParticleSet::SingleParticlePos newpos(0.0001, 0.0, 0.0);
208  elec.makeMove(0, newpos);
209  // set up second walkers
210  // auto elec2 = elec.makeClone();
211 
212  sposet->evaluateVGL(elec, 0, psi, dpsi, d2psi);
213  CHECK(std::real(psi[0]) == Approx(0.9996037001));
214  CHECK(std::real(dpsi[0][0]) == Approx(-0.000667803579));
215  CHECK(std::real(dpsi[0][1]) == Approx(0));
216  CHECK(std::real(dpsi[0][2]) == Approx(0));
217  CHECK(std::real(d2psi[0]) == Approx(-20.0342132));
218 
219 
220  // vectors of SPOSets, ParticleSets, V/G/L (leading dim of each == nwalkers)
221  RefVectorWithLeader<SPOSet> spo_list(*sposet);
222  spo_list.push_back(*sposet);
223 
224  RefVectorWithLeader<ParticleSet> P_list(elec);
225  P_list.push_back(elec);
226 
227  RefVector<SPOSet::ValueVector> psi_list;
228  RefVector<SPOSet::GradVector> dpsi_list;
229  RefVector<SPOSet::ValueVector> d2psi_list;
230 
231  // create V,G,L arrays for walker 1
232  SPOSet::ValueVector psi_1(sposet->getOrbitalSetSize());
233  SPOSet::GradVector dpsi_1(sposet->getOrbitalSetSize());
234  SPOSet::ValueVector d2psi_1(sposet->getOrbitalSetSize());
235 
236  psi_list.push_back(psi_1);
237  dpsi_list.push_back(dpsi_1);
238  d2psi_list.push_back(d2psi_1);
239 
240  //second walker
241  // interchange positions and shift y instead of x
242  ParticleSet::SingleParticlePos dy(0.0, 0.0001, 0.0);
243  ParticleSet elec_2(elec);
244  elec_2.R[0] = elec.R[1];
245  elec_2.R[1] = elec.R[0];
246  elec_2.update();
247  elec_2.makeMove(0, dy);
248 
249  std::unique_ptr<SPOSet> sposet_2(sposet->makeClone());
250  SPOSet::ValueVector psi_2(sposet->getOrbitalSetSize());
251  SPOSet::GradVector dpsi_2(sposet->getOrbitalSetSize());
252  SPOSet::ValueVector d2psi_2(sposet->getOrbitalSetSize());
253  spo_list.push_back(*sposet_2);
254  P_list.push_back(elec_2);
255  psi_list.push_back(psi_2);
256  dpsi_list.push_back(dpsi_2);
257  d2psi_list.push_back(d2psi_2);
258 
259  ResourceCollection pset_res("test_pset_res");
260  ResourceCollection spo_res("test_spo_res");
261 
262  elec.createResource(pset_res);
263  sposet->createResource(spo_res);
264 
265  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, P_list);
266  ResourceCollectionTeamLock<SPOSet> mw_sposet_lock(spo_res, spo_list);
267 
268  sposet->mw_evaluateVGL(spo_list, P_list, 0, psi_list, dpsi_list, d2psi_list);
269 
270  CHECK(std::real(psi_list[0].get()[0]) == Approx(psi[0]));
271  CHECK(std::real(dpsi_list[0].get()[0][0]) == Approx(dpsi[0][0]));
272  CHECK(std::real(dpsi_list[0].get()[0][1]) == Approx(dpsi[0][1]));
273  CHECK(std::real(dpsi_list[0].get()[0][2]) == Approx(dpsi[0][2]));
274  CHECK(std::real(d2psi_list[0].get()[0]) == Approx(d2psi[0]));
275 
276  CHECK(std::real(psi_list[1].get()[0]) == Approx(psi[0]));
277  CHECK(std::real(dpsi_list[1].get()[0][0]) == Approx(dpsi[0][1])); // x, y switched here
278  CHECK(std::real(dpsi_list[1].get()[0][1]) == Approx(dpsi[0][0]));
279  CHECK(std::real(dpsi_list[1].get()[0][2]) == Approx(dpsi[0][2]));
280  CHECK(std::real(d2psi_list[1].get()[0]) == Approx(d2psi[0]));
281 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180
xmlChar * castCharToXMLChar(char *c)
unsafe char* to xmlChar* cast
Definition: libxmldefs.h:70

◆ test_He_sto3g_xml_input()

void qmcplusplus::test_He_sto3g_xml_input ( const std::string &  spo_xml_string)

Definition at line 30 of file test_spo_collection_input_LCAO_xml.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), CHECK(), OHMMS::Controller, ParticleSet::create(), doc, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), ispecies, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), and ParticleSet::update().

Referenced by TEST_CASE().

31 {
33 
34  ParticleSetPool ptcl = ParticleSetPool(c);
35  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
36  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
37  ParticleSet& elec(*elec_uptr);
38  ParticleSet& ions(*ions_uptr);
39 
40  elec.setName("e");
41  ptcl.addParticleSet(std::move(elec_uptr));
42  elec.create({1, 1});
43  elec.R[0] = 0.0;
44 
45  SpeciesSet& tspecies = elec.getSpeciesSet();
46  int upIdx = tspecies.addSpecies("u");
47  int downIdx = tspecies.addSpecies("d");
48  int massIdx = tspecies.addAttribute("mass");
49  tspecies(massIdx, upIdx) = 1.0;
50  tspecies(massIdx, downIdx) = 1.0;
51 
52  ions.setName("ion0");
53  ptcl.addParticleSet(std::move(ions_uptr));
54  ions.create({1});
55  ions.R[0] = 0.0;
56  SpeciesSet& ispecies = ions.getSpeciesSet();
57  int heIdx = ispecies.addSpecies("He");
58  ions.update();
59 
60  elec.addTable(ions);
61  elec.update();
62 
64  bool okay = doc.parseFromString(spo_xml_string);
65  REQUIRE(okay);
66 
67  xmlNodePtr ein_xml = doc.getRoot();
68 
69  WaveFunctionFactory wf_factory(elec, ptcl.getPool(), c);
70  RuntimeOptions runtime_options;
71  auto twf_ptr = wf_factory.buildTWF(ein_xml, runtime_options);
72 
73  std::unique_ptr<SPOSet> sposet(twf_ptr->getSPOSet("spo").makeClone());
74 
75  SPOSet::ValueVector values;
76  SPOSet::GradVector dpsi;
77  SPOSet::ValueVector d2psi;
78  values.resize(1);
79  dpsi.resize(1);
80  d2psi.resize(1);
81 
82  // Call makeMove to compute the distances
83  ParticleSet::SingleParticlePos newpos(0.0001, 0.0, 0.0);
84  elec.makeMove(0, newpos);
85 
86  sposet->evaluateValue(elec, 0, values);
87 
88  // Generated from gen_mo.py for position [0.0001, 0.0, 0.0]
89  CHECK(values[0] == ValueApprox(0.9996037001));
90 
91  sposet->evaluateVGL(elec, 0, values, dpsi, d2psi);
92 
93  // Generated from gen_mo.py for position [0.0001, 0.0, 0.0]
94  CHECK(values[0] == ValueApprox(0.9996037001));
95  CHECK(dpsi[0][0] == ValueApprox(-0.0006678035459));
96  CHECK(dpsi[0][1] == ValueApprox(0.0));
97  CHECK(dpsi[0][2] == ValueApprox(0.0));
98  CHECK(d2psi[0] == ValueApprox(-20.03410564));
99 
100 
101  ParticleSet::SingleParticlePos disp(1.0, 0.0, 0.0);
102  elec.makeMove(0, disp);
103 
104  sposet->evaluateVGL(elec, 0, values, dpsi, d2psi);
105  // Generated from gen_mo.py for position [1.0, 0.0, 0.0]
106  CHECK(values[0] == ValueApprox(0.2315567641));
107  CHECK(dpsi[0][0] == ValueApprox(-0.3805431885));
108  CHECK(dpsi[0][1] == ValueApprox(0.0));
109  CHECK(dpsi[0][2] == ValueApprox(0.0));
110  CHECK(d2psi[0] == ValueApprox(-0.2618497452));
111 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ test_inverse()

void qmcplusplus::test_inverse ( const std::int64_t  N)

Definition at line 24 of file test_syclSolverInverter.cpp.

References CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), getSYCLDefaultDeviceDefaultQueue(), syclSolverInverter< T_FP >::invert_transpose(), DiracMatrix< T_FP >::invert_transpose(), qmcplusplus::Units::distance::m, qmcplusplus::testing::makeRngSpdMatrix(), qmcplusplus::Units::force::N, queue, and Matrix< T, Alloc >::resize().

25 {
26  sycl::queue m_queue = getSYCLDefaultDeviceDefaultQueue();
27 
28  syclSolverInverter<T_FP> solver;
29 
30  Matrix<T> m(N, N);
31  Matrix<T> m_invT(N, N);
32  Matrix<T> m_invT_CPU(N, N);
33  Matrix<T, SYCLAllocator<T>> m_invGPU;
34  m_invGPU.resize(N, N);
35 
36  std::complex<double> log_value, log_value_cpu;
37  testing::MakeRngSpdMatrix<T> makeRngSpdMatrix{};
39 
40  solver.invert_transpose(m, m_invT, m_invGPU, log_value, m_queue);
41  m_queue.wait();
42 
43  DiracMatrix<T_FP> dmat;
44  dmat.invert_transpose(m, m_invT_CPU, log_value_cpu);
45 
46  CHECK(log_value == ComplexApprox(log_value_cpu));
47 
48  auto check_matrix_result = checkMatrix(m_invT, m_invT_CPU);
49  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
50 }
sycl::queue & getSYCLDefaultDeviceDefaultQueue()
return a reference to the per-device default queue
Definition: SYCLruntime.cpp:18
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
void makeRngSpdMatrix(testing::RandomForTest< RngValueType< T >> &rng, Matrix< T > &mat_spd)
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ test_isnan()

void qmcplusplus::test_isnan ( )

Definition at line 22 of file test_math.cpp.

References CHECK(), isnan(), and sqrt().

23 {
24  const T one(1);
25  T a = std::sqrt(-one);
26  T b = -a;
30 }
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool isnan(float a)
return true if the value is NaN.
Definition: math.cpp:18

◆ test_J1_spline()

void qmcplusplus::test_J1_spline ( const DynamicCoordinateKind  kind_selected)

Definition at line 61 of file test_J1_bspline.cpp.

References ParticleSet::acceptMove(), SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), RadialJastrowBuilder::buildComponent(), CHECK(), OHMMS::Controller, ParticleSet::create(), ParticleSet::createResource(), BsplineFunctor< REAL >::CuspValue, DC_POS_OFFLOAD, BsplineFunctor< REAL >::DeltaR, doc, BsplineFunctor< REAL >::evaluate(), ParticleSet::G, ParticleSet::getDistTableAB(), Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), ParticleSet::getTotalNum(), ispecies, ParticleSet::L, qmcplusplus::Units::distance::m, ParticleSet::makeMove(), ParticleSet::makeVirtualMoves(), VirtualParticleSet::mw_makeMoves(), ParticleSet::mw_update(), qmcplusplus::Units::force::N, n, BsplineFunctor< REAL >::NumParams, OHMMS_DIM, okay, Libxml2Document::parseFromString(), ParticleSet::R, ParticleSet::rejectMove(), REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), and ParticleSet::update().

Referenced by TEST_CASE().

62 {
64 
65  const SimulationCell simulation_cell;
66  ParticleSet ions_(simulation_cell, kind_selected);
67  ParticleSet elec_(simulation_cell);
68 
69  ions_.setName("ion");
70  ions_.create({1});
71  ions_.R[0] = {2.0, 0.0, 0.0};
72  SpeciesSet& ispecies = ions_.getSpeciesSet();
73  int CIdx = ispecies.addSpecies("C");
74  int ichargeIdx = ispecies.addAttribute("charge");
75  ispecies(ichargeIdx, CIdx) = 4;
76  ions_.resetGroups();
77  ions_.update();
78 
79  elec_.setName("elec");
80  elec_.create({1, 1});
81  elec_.R[0] = {1.00, 0.0, 0.0};
82  elec_.R[1] = {0.0, 0.0, 0.0};
83  SpeciesSet& tspecies = elec_.getSpeciesSet();
84  int upIdx = tspecies.addSpecies("u");
85  int downIdx = tspecies.addSpecies("d");
86  int chargeIdx = tspecies.addAttribute("charge");
87  tspecies(chargeIdx, upIdx) = -1;
88  tspecies(chargeIdx, downIdx) = -1;
89  elec_.resetGroups();
90 
91  const char* j1_xml_char = R"XML(<tmp>
92  <jastrow type="One-Body" name="J1" function="bspline" source="ion" print="yes" gpu="no">
93  <correlation elementType="C" rcut="10" size="8" cusp="0.0">
94  <coefficients id="eC" type="Array">
95 -0.2032153051 -0.1625595974 -0.143124599 -0.1216434956 -0.09919771951 -0.07111729038 -0.04445345869 -0.02135082917
96  </coefficients>
97  </correlation>
98  </jastrow>
99 </tmp>)XML";
100 
101  const char* j1_omptarget_xml_char = R"XML(<tmp>
102  <jastrow type="One-Body" name="J1" function="bspline" source="ion" print="yes" gpu="omptarget">
103  <correlation elementType="C" rcut="10" size="8" cusp="0.0">
104  <coefficients id="eC" type="Array">
105 -0.2032153051 -0.1625595974 -0.143124599 -0.1216434956 -0.09919771951 -0.07111729038 -0.04445345869 -0.02135082917
106  </coefficients>
107  </correlation>
108  </jastrow>
109 </tmp>)XML";
110 
112  bool okay =
113  doc.parseFromString(kind_selected == DynamicCoordinateKind::DC_POS_OFFLOAD ? j1_omptarget_xml_char : j1_xml_char);
114  REQUIRE(okay);
115 
116  xmlNodePtr root = doc.getRoot();
117 
118  xmlNodePtr jas1 = xmlFirstElementChild(root);
119 
120  RadialJastrowBuilder jastrow(c, elec_, ions_);
121 
122  using J1Type = J1OrbitalSoA<BsplineFunctor<RealType>>;
123  auto j1_uptr = jastrow.buildComponent(jas1);
124  J1Type* j1 = dynamic_cast<J1Type*>(j1_uptr.get());
125  REQUIRE(j1);
126 
127  // update all distance tables
128  elec_.update();
129 
130  double logpsi_real = std::real(j1->evaluateLog(elec_, elec_.G, elec_.L));
131  CHECK(logpsi_real == Approx(0.3160552244)); // note: number not validated
132 
133  //Ionic Derivative Test.
134  QMCTraits::GradType gsource(0.0);
137  int nelecs = elec_.getTotalNum();
138 
139  for (int dim = 0; dim < OHMMS_DIM; dim++)
140  {
141  grad_grad_source[dim].resize(nelecs);
142  lapl_grad_source[dim].resize(nelecs);
143  }
144 
145  /////////////////////////////////////////
146  //Testing the ion gradient w.r.t. ion # 0
147  /////////////////////////////////////////
148  //NOTE: All test values in this section are validated against finite differences
149  // for this configuration.
150 
151  //First we test evalGradSource(P,ions,ionid);
152 
153  gsource = j1->evalGradSource(elec_, ions_, 0);
154 
155  //Gradient comparison
156  CHECK(std::real(gsource[0]) == Approx(-0.04695203659));
157  CHECK(std::real(gsource[1]) == Approx(0.00000000000));
158  CHECK(std::real(gsource[2]) == Approx(0.00000000000));
159 
160  //Now we test evalGradSource that returns higher order derivatives.
161  gsource = j1->evalGradSource(elec_, ions_, 0, grad_grad_source, lapl_grad_source);
162 
163  //Gradient comparison
164  CHECK(std::real(gsource[0]) == Approx(-0.04695203659));
165  CHECK(std::real(gsource[1]) == Approx(0.00000000000));
166  CHECK(std::real(gsource[2]) == Approx(0.00000000000));
167 
168  //Ion gradient of electron gradient comparison.
169  CHECK(std::real(grad_grad_source[0][0][0]) == Approx(-0.008883672));
170  CHECK(std::real(grad_grad_source[0][1][0]) == Approx(-0.002111879));
171  CHECK(std::real(grad_grad_source[1][0][1]) == Approx(0.028489287));
172  CHECK(std::real(grad_grad_source[1][1][1]) == Approx(0.009231375));
173  CHECK(std::real(grad_grad_source[2][0][2]) == Approx(0.028489287));
174  CHECK(std::real(grad_grad_source[2][1][2]) == Approx(0.009231375));
175 
176  //Ion gradient of electron laplacians.
177  CHECK(std::real(lapl_grad_source[0][0]) == Approx(0.1494918378));
178  CHECK(std::real(lapl_grad_source[0][1]) == Approx(-0.0056182539));
179  CHECK(std::real(lapl_grad_source[1][0]) == Approx(0.0000000000));
180  CHECK(std::real(lapl_grad_source[1][1]) == Approx(0.0000000000));
181  CHECK(std::real(lapl_grad_source[2][0]) == Approx(0.0000000000));
182  CHECK(std::real(lapl_grad_source[2][1]) == Approx(0.0000000000));
183 
184 
185  // now test evaluateHessian
186  WaveFunctionComponent::HessVector grad_grad_psi;
187  grad_grad_psi.resize(elec_.getTotalNum());
188  grad_grad_psi = 0.0;
189 
190  j1->evaluateHessian(elec_, grad_grad_psi);
191 
192  std::vector<double> hess_values = {
193  0.00888367, 0, 0, 0, -0.0284893, 0, 0, 0, -0.0284893, 0.00211188, 0, 0, 0, -0.00923137, 0, 0, 0, -0.00923137,
194  };
195 
196  int m = 0;
197  for (int n = 0; n < elec_.getTotalNum(); n++)
198  for (int i = 0; i < OHMMS_DIM; i++)
199  for (int j = 0; j < OHMMS_DIM; j++, m++)
200  {
201  CHECK(std::real(grad_grad_psi[n](i, j)) == Approx(hess_values[m]));
202  }
203 
204  j1->evaluateLog(elec_, elec_.G, elec_.L); // evaluateHessian has side effects
205 
206 
207  struct JValues
208  {
209  double r;
210  double u;
211  double du;
212  double ddu;
213  };
214 
215  // Cut and paste from output of gen_bspline_jastrow.py
216  const int N = 20;
217  JValues Vals[N] = {{0.00, -0.1896634025, 0, 0.06586224647},
218  {0.60, -0.1804990512, 0.02606308248, 0.02101469513},
219  {1.20, -0.1637586749, 0.0255799351, -0.01568108497},
220  {1.80, -0.1506226948, 0.01922435549, -0.005504180392},
221  {2.40, -0.1394848415, 0.01869442683, 0.001517191423},
222  {3.00, -0.128023472, 0.01946283614, 0.00104417293},
223  {3.60, -0.1161729491, 0.02009651096, 0.001689229059},
224  {4.20, -0.1036884223, 0.02172284322, 0.003731878464},
225  {4.80, -0.08992443283, 0.0240346508, 0.002736384838},
226  {5.40, -0.07519614609, 0.02475121662, -0.000347832122},
227  {6.00, -0.06054074137, 0.02397053075, -0.001842295859},
228  {6.60, -0.04654631918, 0.0225837382, -0.002780345968},
229  {7.20, -0.03347994129, 0.02104406699, -0.00218107833},
230  {7.80, -0.0211986378, 0.01996899618, -0.00173646255},
231  {8.40, -0.01004416026, 0.01635533409, -0.01030907776},
232  {9.00, -0.002594125744, 0.007782377232, -0.01556475446},
233  {9.60, -0.0001660240476, 0.001245180357, -0.006225901786},
234  {10.20, 0, 0, 0},
235  {10.80, 0, 0, 0},
236  {11.40, 0, 0, 0}};
237 
238  BsplineFunctor<RealType>* bf = j1->getFunctors()[0];
239 
240  for (int i = 0; i < N; i++)
241  {
242  RealType dv = 0.0;
243  RealType ddv = 0.0;
244  RealType val = bf->evaluate(Vals[i].r, dv, ddv);
245  CHECK(Vals[i].u == Approx(val));
246  CHECK(Vals[i].du == Approx(dv));
247  CHECK(Vals[i].ddu == Approx(ddv));
248  }
249 
250 #ifdef PRINT_SPLINE_DATA
251  // write out values of the Bspline functor
252  //BsplineFunctor<double> *bf = j1->J1Functors[0];
253  printf("NumParams = %d\n", bf->NumParams);
254  printf("CuspValue = %g\n", bf->CuspValue);
255  printf("DeltaR = %g\n", bf->DeltaR);
256  printf("SplineCoeffs size = %d\n", bf->SplineCoefs.size());
257  for (int j = 0; j < bf->SplineCoefs.size(); j++)
258  {
259  printf("%d %g\n", j, bf->SplineCoefs[j]);
260  }
261  printf("\n");
262 
263  for (int i = 0; i < 20; i++)
264  {
265  double r = 0.6 * i;
266  elec_.R[0][0] = r;
267  elec_.update();
268  double logpsi_real = std::real(j1->evaluateLog(elec_, elec_.G, elec_.L));
269  //double alt_val = bf->evaluate(r);
270  double dv = 0.0;
271  double ddv = 0.0;
272  double alt_val = bf->evaluate(r, dv, ddv);
273  printf("%g %g %g %g %g\n", r, logpsi_real, alt_val, dv, ddv);
274  }
275 #endif
276 
278  using PosType = QMCTraits::PosType;
279 
280  // set virtutal particle position
281  PosType newpos(0.3, 0.2, 0.5);
282 
283  elec_.makeVirtualMoves(newpos);
284  std::vector<ValueType> ratios(elec_.getTotalNum());
285  j1->evaluateRatiosAlltoOne(elec_, ratios);
286 
287  CHECK(std::real(ratios[0]) == Approx(0.9819208747));
288  CHECK(std::real(ratios[1]) == Approx(1.0040884258));
289 
290  elec_.makeMove(0, newpos - elec_.R[0]);
291  PsiValue ratio_0 = j1->ratio(elec_, 0);
292  elec_.rejectMove(0);
293 
294  CHECK(std::real(ratio_0) == Approx(0.9819208747));
295 
296  // test acceptMove results
297  elec_.makeMove(1, newpos - elec_.R[1]);
298  PsiValue ratio_1 = j1->ratio(elec_, 1);
299  j1->acceptMove(elec_, 1);
300  elec_.acceptMove(1);
301 
302  CHECK(std::real(ratio_1) == Approx(1.0040884258));
303  CHECK(std::real(j1->get_log_value()) == Approx(0.32013531536));
304 
305  // test to make sure that setting cusp for J1 works properly
306  const char* j1_xml_char_2 = R"XML(<tmp>
307 <jastrow type="One-Body" name="J1" function="bspline" source="ion" print="yes" gpu="no">
308  <correlation elementType="C" rcut="10" size="8" cusp="2.0">
309  <coefficients id="eC" type="Array">
310  -0.2032153051 -0.1625595974 -0.143124599 -0.1216434956 -0.09919771951 -0.07111729038 -0.04445345869 -0.02135082917
311  </coefficients>
312  </correlation>
313 </jastrow>
314 </tmp>)XML";
315 
316  const char* j1_omptarget_xml_char_2 = R"XML(<tmp>
317 <jastrow type="One-Body" name="J1" function="bspline" source="ion" print="yes" gpu="omptarget">
318  <correlation elementType="C" rcut="10" size="8" cusp="2.0">
319  <coefficients id="eC" type="Array">
320  -0.2032153051 -0.1625595974 -0.143124599 -0.1216434956 -0.09919771951 -0.07111729038 -0.04445345869 -0.02135082917
321  </coefficients>
322  </correlation>
323 </jastrow>
324 </tmp>)XML";
325 
326  Libxml2Document doc2;
327  bool okay2 = doc2.parseFromString(kind_selected == DynamicCoordinateKind::DC_POS_OFFLOAD ? j1_omptarget_xml_char_2
328  : j1_xml_char_2);
329  REQUIRE(okay2);
330 
331  xmlNodePtr root2 = doc2.getRoot();
332 
333  xmlNodePtr jas2 = xmlFirstElementChild(root2);
334 
335  RadialJastrowBuilder jastrow2(c, elec_, ions_);
336 
337  auto j12_uptr = jastrow2.buildComponent(jas2);
338  J1Type* j12 = dynamic_cast<J1Type*>(j12_uptr.get());
339  REQUIRE(j12);
340 
341  // Cut and paste from output of gen_bspline_jastrow.py
342  // note only the first two rows should change from above
343  const int N2 = 20;
344  JValues Vals2[N2] = {{0.00, -0.9304041433, 2, -3.534137754},
345  {0.60, -0.252599792, 0.4492630825, -1.634985305},
346  {1.20, -0.1637586749, 0.0255799351, -0.01568108497},
347  {1.80, -0.1506226948, 0.01922435549, -0.005504180392},
348  {2.40, -0.1394848415, 0.01869442683, 0.001517191423},
349  {3.00, -0.128023472, 0.01946283614, 0.00104417293},
350  {3.60, -0.1161729491, 0.02009651096, 0.001689229059},
351  {4.20, -0.1036884223, 0.02172284322, 0.003731878464},
352  {4.80, -0.08992443283, 0.0240346508, 0.002736384838},
353  {5.40, -0.07519614609, 0.02475121662, -0.000347832122},
354  {6.00, -0.06054074137, 0.02397053075, -0.001842295859},
355  {6.60, -0.04654631918, 0.0225837382, -0.002780345968},
356  {7.20, -0.03347994129, 0.02104406699, -0.00218107833},
357  {7.80, -0.0211986378, 0.01996899618, -0.00173646255},
358  {8.40, -0.01004416026, 0.01635533409, -0.01030907776},
359  {9.00, -0.002594125744, 0.007782377232, -0.01556475446},
360  {9.60, -0.0001660240476, 0.001245180357, -0.006225901786},
361  {10.20, 0, 0, 0},
362  {10.80, 0, 0, 0},
363  {11.40, 0, 0, 0}};
364 
365  BsplineFunctor<RealType>* bf2 = j12->getFunctors()[0];
366 
367  for (int i = 0; i < N2; i++)
368  {
369  RealType dv = 0.0;
370  RealType ddv = 0.0;
371  RealType val = bf2->evaluate(Vals2[i].r, dv, ddv);
372  CHECK(Vals2[i].du == Approx(dv));
373  CHECK(Vals2[i].u == Approx(val));
374  CHECK(Vals2[i].ddu == Approx(ddv));
375  }
376 
377  UniqueOptObjRefs opt_obj_refs;
378  j12->extractOptimizableObjectRefs(opt_obj_refs);
379  REQUIRE(opt_obj_refs.size() == 1);
380 
381  // testing batched interfaces
382  ResourceCollection pset_res("test_pset_res");
383  ResourceCollection wfc_res("test_wfc_res");
384 
385  elec_.createResource(pset_res);
386  j12->createResource(wfc_res);
387 
388  // make a clones
389  ParticleSet elec_clone(elec_);
390  auto j12_clone = j12->makeClone(elec_clone);
391 
392  // testing batched interfaces
393  RefVectorWithLeader<ParticleSet> p_ref_list(elec_, {elec_, elec_clone});
394  RefVectorWithLeader<WaveFunctionComponent> j1_ref_list(*j12, {*j12, *j12_clone});
395 
396  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_ref_list);
397  ResourceCollectionTeamLock<WaveFunctionComponent> mw_wfc_lock(wfc_res, j1_ref_list);
398 
399  std::vector<bool> isAccepted(2, true);
400  ParticleSet::mw_update(p_ref_list);
401  j12->mw_recompute(j1_ref_list, p_ref_list, isAccepted);
402 
403  // test NLPP related APIs
404  const int nknot = 3;
405  VirtualParticleSet vp(elec_, nknot), vp_clone(elec_clone, nknot);
406  RefVectorWithLeader<VirtualParticleSet> vp_list(vp, {vp, vp_clone});
407  ResourceCollection vp_res("test_vp_res");
408  vp.createResource(vp_res);
409  ResourceCollectionTeamLock<VirtualParticleSet> mw_vp_lock(vp_res, vp_list);
410 
411  const int ei_table_index = elec_.addTable(ions_);
412  const auto& ei_table1 = elec_.getDistTableAB(ei_table_index);
413  // make virtual move of elec 0, reference ion 1
414  NLPPJob<RealType> job1(1, 0, ei_table1.getDistances()[0][1], -ei_table1.getDisplacements()[0][1]);
415  const auto& ei_table2 = elec_clone.getDistTableAB(ei_table_index);
416  // make virtual move of elec 1, reference ion 3
417  NLPPJob<RealType> job2(3, 1, ei_table2.getDistances()[1][3], -ei_table2.getDisplacements()[1][3]);
418 
419  std::vector<PosType> deltaV1{{0.1, 0.2, 0.3}, {0.1, 0.3, 0.2}, {0.2, 0.1, 0.3}};
420  std::vector<PosType> deltaV2{{0.02, 0.01, 0.03}, {0.02, 0.03, 0.01}, {0.03, 0.01, 0.02}};
421 
422  VirtualParticleSet::mw_makeMoves(vp_list, p_ref_list, {deltaV1, deltaV2}, {job1, job2}, false);
423 
424  std::vector<std::vector<ValueType>> nlpp_ratios(2);
425  nlpp_ratios[0].resize(nknot);
426  nlpp_ratios[1].resize(nknot);
427  j12->mw_evaluateRatios(j1_ref_list, RefVectorWithLeader<const VirtualParticleSet>(vp, {vp, vp_clone}), nlpp_ratios);
428 
429  CHECK(ValueApprox(nlpp_ratios[0][0]) == ValueType(1.0016646504));
430  CHECK(ValueApprox(nlpp_ratios[0][1]) == ValueType(1.0016646504));
431  CHECK(ValueApprox(nlpp_ratios[0][2]) == ValueType(1.011890802));
432  CHECK(ValueApprox(nlpp_ratios[1][0]) == ValueType(1.0001773019));
433  CHECK(ValueApprox(nlpp_ratios[1][1]) == ValueType(1.000242931));
434  CHECK(ValueApprox(nlpp_ratios[1][2]) == ValueType(1.0004189199));
435 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
QMCTraits::RealType real
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
LatticeGaussianProduct::GradType GradType
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
#define OHMMS_DIM
Definition: config.h:64
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ test_J3_polynomial3D()

void qmcplusplus::test_J3_polynomial3D ( const DynamicCoordinateKind  kind_selected)

Definition at line 46 of file test_polynomial_eeI_jastrow.cpp.

References SpeciesSet::addSpecies(), ParticleSet::addTable(), app_log(), eeI_JastrowBuilder::buildComponent(), CHECK(), WaveFunctionComponent::checkOutVariables(), OHMMS::Controller, ParticleSet::create(), WaveFunctionComponent::createResource(), ParticleSet::createResource(), doc, Dot(), qmcplusplus::Units::charge::e, WaveFunctionComponent::evaluateDerivatives(), WaveFunctionComponent::evaluateDerivativesWF(), WaveFunctionComponent::evaluateDerivRatios(), WaveFunctionComponent::evaluateLog(), WaveFunctionComponent::evaluateRatios(), WaveFunctionComponent::evaluateRatiosAlltoOne(), WaveFunctionComponent::extractOptimizableObjectRefs(), ParticleSet::G, ParticleSet::getDistTableAB(), Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), ParticleSet::getTotalNum(), ParticleSet::L, WaveFunctionComponent::makeClone(), ParticleSet::makeMove(), VirtualParticleSet::makeMoves(), ParticleSet::makeVirtualMoves(), WaveFunctionComponent::mw_evaluateRatios(), VirtualParticleSet::mw_makeMoves(), WaveFunctionComponent::mw_recompute(), ParticleSet::mw_update(), okay, Libxml2Document::parseFromString(), ParticleSet::R, WaveFunctionComponent::ratio(), ParticleSet::rejectMove(), REQUIRE(), Vector< T, Alloc >::resize(), ParticleSet::setName(), Sum(), and ParticleSet::update().

Referenced by TEST_CASE().

47 {
49 
50  const SimulationCell simulation_cell;
51  ParticleSet ions_(simulation_cell, kind_selected);
52  ParticleSet elec_(simulation_cell, kind_selected);
53 
54  ions_.setName("ion");
55  ions_.create({2});
56  ions_.R[0] = {2.0, 0.0, 0.0};
57  ions_.R[1] = {-2.0, 0.0, 0.0};
58  SpeciesSet& source_species(ions_.getSpeciesSet());
59  source_species.addSpecies("O");
60  ions_.update();
61 
62  elec_.setName("elec");
63  elec_.create({2, 2});
64  elec_.R[0] = {1.00, 0.0, 0.0};
65  elec_.R[1] = {0.0, 0.0, 0.0};
66  elec_.R[2] = {-1.00, 0.0, 0.0};
67  elec_.R[3] = {0.0, 0.0, 2.0};
68  SpeciesSet& target_species(elec_.getSpeciesSet());
69  int upIdx = target_species.addSpecies("u");
70  int downIdx = target_species.addSpecies("d");
71  int chargeIdx = target_species.addAttribute("charge");
72  target_species(chargeIdx, upIdx) = -1;
73  target_species(chargeIdx, downIdx) = -1;
74  //elec_.resetGroups();
75 
76  const char* particles = R"(<tmp>
77  <jastrow name="J3" type="eeI" function="polynomial" source="ion" print="yes">
78  <correlation ispecies="O" especies="u" isize="3" esize="3" rcut="10">
79  <coefficients id="uuO" type="Array" optimize="yes"> 8.227710241e-06 2.480817653e-06 -5.354068112e-06 -1.112644787e-05 -2.208006078e-06 5.213121933e-06 -1.537865869e-05 8.899030233e-06 6.257255156e-06 3.214580988e-06 -7.716743107e-06 -5.275682077e-06 -1.778457637e-06 7.926231121e-06 1.767406868e-06 5.451359059e-08 2.801423724e-06 4.577282736e-06 7.634608083e-06 -9.510673173e-07 -2.344131575e-06 -1.878777219e-06 3.937363358e-07 5.065353773e-07 5.086724869e-07 -1.358768154e-07</coefficients>
80  </correlation>
81  <correlation ispecies="O" especies1="u" especies2="d" isize="3" esize="3" rcut="10">
82  <coefficients id="udO" type="Array" optimize="yes"> -6.939530224e-06 2.634169299e-05 4.046077477e-05 -8.002682388e-06 -5.396795988e-06 6.697370507e-06 5.433953051e-05 -6.336849668e-06 3.680471431e-05 -2.996059772e-05 1.99365828e-06 -3.222705626e-05 -8.091669063e-06 4.15738535e-06 4.843939112e-06 3.563650208e-07 3.786332474e-05 -1.418336941e-05 2.282691374e-05 1.29239286e-06 -4.93580873e-06 -3.052539228e-06 9.870288001e-08 1.844286407e-06 2.970561871e-07 -4.364303677e-08</coefficients>
83  </correlation>
84  </jastrow>
85 </tmp>
86 )";
88  bool okay = doc.parseFromString(particles);
89  REQUIRE(okay);
90 
91  xmlNodePtr root = doc.getRoot();
92 
93  xmlNodePtr jas_eeI = xmlFirstElementChild(root);
94 
95  eeI_JastrowBuilder jastrow(c, elec_, ions_);
96  std::unique_ptr<WaveFunctionComponent> jas(jastrow.buildComponent(jas_eeI));
97 
98  using J3Type = JeeIOrbitalSoA<PolynomialFunctor3D>;
99  auto j3_uptr = jastrow.buildComponent(jas_eeI);
100  WaveFunctionComponent* j3 = dynamic_cast<J3Type*>(j3_uptr.get());
101  REQUIRE(j3 != nullptr);
102 
103  // update all distance tables
104  elec_.update();
105 
106  double logpsi_real = std::real(j3->evaluateLog(elec_, elec_.G, elec_.L));
107  CHECK(logpsi_real == Approx(-1.193457749)); // note: number not validated
108 
109  double KE = -0.5 * (Dot(elec_.G, elec_.G) + Sum(elec_.L));
110  CHECK(KE == Approx(-0.058051245)); // note: number not validated
111 
113  using PosType = QMCTraits::PosType;
114 
115  // set virtutal particle position
116  PosType newpos(0.3, 0.2, 0.5);
117 
118  elec_.makeVirtualMoves(newpos);
119  std::vector<ValueType> ratios(elec_.getTotalNum());
120  j3->evaluateRatiosAlltoOne(elec_, ratios);
121 
122  CHECK(std::real(ratios[0]) == Approx(0.8744938582));
123  CHECK(std::real(ratios[1]) == Approx(1.0357541137));
124  CHECK(std::real(ratios[2]) == Approx(0.8302245609));
125  CHECK(std::real(ratios[3]) == Approx(0.7987703724));
126 
127  elec_.makeMove(0, newpos - elec_.R[0]);
128  PsiValue ratio_0 = j3->ratio(elec_, 0);
129  elec_.rejectMove(0);
130 
131  elec_.makeMove(1, newpos - elec_.R[1]);
132  PsiValue ratio_1 = j3->ratio(elec_, 1);
133  elec_.rejectMove(1);
134 
135  elec_.makeMove(2, newpos - elec_.R[2]);
136  PsiValue ratio_2 = j3->ratio(elec_, 2);
137  elec_.rejectMove(2);
138 
139  elec_.makeMove(3, newpos - elec_.R[3]);
140  PsiValue ratio_3 = j3->ratio(elec_, 3);
141  elec_.rejectMove(3);
142 
143  CHECK(std::real(ratio_0) == Approx(0.8744938582));
144  CHECK(std::real(ratio_1) == Approx(1.0357541137));
145  CHECK(std::real(ratio_2) == Approx(0.8302245609));
146  CHECK(std::real(ratio_3) == Approx(0.7987703724));
147 
148  UniqueOptObjRefs opt_obj_refs;
149  j3->extractOptimizableObjectRefs(opt_obj_refs);
150  REQUIRE(opt_obj_refs.size() == 2);
151 
152  opt_variables_type optvars;
153  Vector<WaveFunctionComponent::ValueType> dlogpsi;
154  Vector<WaveFunctionComponent::ValueType> dhpsioverpsi;
155 
156  for (OptimizableObject& obj : opt_obj_refs)
157  obj.checkInVariablesExclusive(optvars);
158  optvars.resetIndex();
159  const int NumOptimizables(optvars.size());
160  j3->checkOutVariables(optvars);
161  dlogpsi.resize(NumOptimizables);
162  dhpsioverpsi.resize(NumOptimizables);
163  j3->evaluateDerivatives(elec_, optvars, dlogpsi, dhpsioverpsi);
164 
165  app_log() << std::endl << "reporting dlogpsi and dhpsioverpsi" << std::scientific << std::endl;
166  for (int iparam = 0; iparam < NumOptimizables; iparam++)
167  app_log() << "param=" << iparam << " : " << dlogpsi[iparam] << " " << dhpsioverpsi[iparam] << std::endl;
168  app_log() << std::endl;
169 
170  CHECK(std::real(dlogpsi[43]) == Approx(1.3358726814e+05));
171  CHECK(std::real(dhpsioverpsi[43]) == Approx(-2.3246270644e+05));
172 
173  Vector<WaveFunctionComponent::ValueType> dlogpsiWF;
174  dlogpsiWF.resize(NumOptimizables);
175  j3->evaluateDerivativesWF(elec_, optvars, dlogpsiWF);
176  for (int i = 0; i < NumOptimizables; i++)
177  CHECK(dlogpsi[i] == ValueApprox(dlogpsiWF[i]));
178 
179  VirtualParticleSet VP(elec_, 2);
180  std::vector<PosType> newpos2(2);
181  std::vector<ValueType> ratios2(2);
182  newpos2[0] = newpos - elec_.R[1];
183  newpos2[1] = PosType(0.2, 0.5, 0.3) - elec_.R[1];
184  VP.makeMoves(elec_, 1, newpos2);
185  j3->evaluateRatios(VP, ratios2);
186 
187  CHECK(std::real(ratios2[0]) == Approx(1.0357541137));
188  CHECK(std::real(ratios2[1]) == Approx(1.0257141422));
189 
190  std::fill(ratios2.begin(), ratios2.end(), 0);
191  Matrix<ValueType> dratio(2, NumOptimizables);
192  j3->evaluateDerivRatios(VP, optvars, ratios2, dratio);
193 
194  CHECK(std::real(ratios2[0]) == Approx(1.0357541137));
195  CHECK(std::real(ratios2[1]) == Approx(1.0257141422));
196  CHECK(std::real(dratio[0][43]) == Approx(-1.4282569e+03));
197 
198  // testing batched interfaces
199  ResourceCollection pset_res("test_pset_res");
200  ResourceCollection wfc_res("test_wfc_res");
201 
202  elec_.createResource(pset_res);
203  j3->createResource(wfc_res);
204 
205  // make a clones
206  ParticleSet elec_clone(elec_);
207  auto j3_clone = j3->makeClone(elec_clone);
208 
209  // testing batched interfaces
210  RefVectorWithLeader<ParticleSet> p_ref_list(elec_, {elec_, elec_clone});
211  RefVectorWithLeader<WaveFunctionComponent> j3_ref_list(*j3, {*j3, *j3_clone});
212 
213  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_ref_list);
214  ResourceCollectionTeamLock<WaveFunctionComponent> mw_wfc_lock(wfc_res, j3_ref_list);
215 
216  std::vector<bool> isAccepted(2, true);
217  ParticleSet::mw_update(p_ref_list);
218  j3->mw_recompute(j3_ref_list, p_ref_list, isAccepted);
219 
220  // test NLPP related APIs
221  const int nknot = 3;
222  VirtualParticleSet vp(elec_, nknot), vp_clone(elec_clone, nknot);
223  RefVectorWithLeader<VirtualParticleSet> vp_list(vp, {vp, vp_clone});
224  ResourceCollection vp_res("test_vp_res");
225  vp.createResource(vp_res);
226  ResourceCollectionTeamLock<VirtualParticleSet> mw_vp_lock(vp_res, vp_list);
227 
228  const int ei_table_index = elec_.addTable(ions_);
229  const auto& ei_table1 = elec_.getDistTableAB(ei_table_index);
230  // make virtual move of elec 0, reference ion 1
231  NLPPJob<RealType> job1(1, 0, ei_table1.getDistances()[0][1], -ei_table1.getDisplacements()[0][1]);
232  const auto& ei_table2 = elec_clone.getDistTableAB(ei_table_index);
233  // make virtual move of elec 1, reference ion 3
234  NLPPJob<RealType> job2(3, 1, ei_table2.getDistances()[1][3], -ei_table2.getDisplacements()[1][3]);
235 
236  std::vector<PosType> deltaV1{{0.1, 0.2, 0.3}, {0.1, 0.3, 0.2}, {0.2, 0.1, 0.3}};
237  std::vector<PosType> deltaV2{{0.02, 0.01, 0.03}, {0.02, 0.03, 0.01}, {0.03, 0.01, 0.02}};
238 
239  VirtualParticleSet::mw_makeMoves(vp_list, p_ref_list, {deltaV1, deltaV2}, {job1, job2}, false);
240 
241  std::vector<std::vector<ValueType>> nlpp_ratios(2);
242  nlpp_ratios[0].resize(nknot);
243  nlpp_ratios[1].resize(nknot);
244  j3->mw_evaluateRatios(j3_ref_list, RefVectorWithLeader<const VirtualParticleSet>(vp, {vp, vp_clone}), nlpp_ratios);
245 
246  CHECK(ValueApprox(nlpp_ratios[0][0]) == ValueType(1.0273599625));
247  CHECK(ValueApprox(nlpp_ratios[0][1]) == ValueType(1.0227555037));
248  CHECK(ValueApprox(nlpp_ratios[0][2]) == ValueType(1.0473958254));
249  CHECK(ValueApprox(nlpp_ratios[1][0]) == ValueType(1.0013145208));
250  CHECK(ValueApprox(nlpp_ratios[1][1]) == ValueType(1.0011137724));
251  CHECK(ValueApprox(nlpp_ratios[1][2]) == ValueType(1.0017225742));
252 }
T Sum(const ParticleAttrib< T > &pa)
class that handles xmlDoc
Definition: Libxml2Doc.h:76
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
QMCTraits::RealType real
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
void resetIndex()
reset Index
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
T Dot(const ParticleAttrib< TinyVector< T, D >> &pa, const ParticleAttrib< TinyVector< T, D >> &pb)
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ test_LCAO_DiamondC_2x1x1_cplx()

void qmcplusplus::test_LCAO_DiamondC_2x1x1_cplx ( const bool  useOffload)

Definition at line 454 of file test_LCAO_diamondC_2x1x1.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), app_log(), CHECK(), OHMMS::Controller, ParticleSet::create(), VirtualParticleSet::createResource(), ParticleSet::createResource(), LCAOrbitalBuilder::createSPOSetFromXML(), QMCTraits::DIM, doc, ParticleSet::getDistTableAB(), Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), imag(), ispecies, lattice, VirtualParticleSet::mw_makeMoves(), ParticleSet::mw_update(), okay, Libxml2Document::parseFromString(), ParticleSet::print(), LatticeParser::put(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), and ParticleSet::update().

Referenced by TEST_CASE().

455 {
456  using VT = SPOSet::ValueType;
458 
459  const char* particles = R"(<simulationcell>
460  <parameter name="lattice" units="bohr">
461  6.7463223 6.7463223 0.0
462  0.0 3.37316115 3.37316115
463  3.37316115 0.0 3.37316115
464  </parameter>
465  <parameter name="bconds">
466  p p p
467  </parameter>
468  </simulationcell>
469 )";
470 
471  Libxml2Document doc_lattice;
472  REQUIRE(doc_lattice.parseFromString(particles));
473 
474  // read lattice
475  ParticleSet::ParticleLayout lattice;
476  LatticeParser lp(lattice);
477  lp.put(doc_lattice.getRoot());
478  lattice.print(app_log(), 0);
479 
480  SimulationCell simcell(lattice);
481  ParticleSet ions_(simcell);
482 
483  ions_.setName("ion0");
484  ions_.create({4});
485  ions_.R[0] = {0.0, 0.0, 0.0};
486  ions_.R[1] = {1.686580575, 1.686580575, 1.686580575};
487  ions_.R[2] = {3.37316115, 3.37316115, 0.0};
488  ions_.R[3] = {5.059741726, 5.059741726, 1.686580575};
489  SpeciesSet& ispecies = ions_.getSpeciesSet();
490  const int Cidx = ispecies.addSpecies("C");
491 
492  ions_.print(app_log());
493  ions_.update(); // propagate SoA.
494 
495  ParticleSet elec_(simcell);
496  elec_.setName("elec");
497  elec_.create({8, 8});
498  elec_.R[0] = {0.0, 1.0, 0.0};
499  elec_.R[1] = {0.0, 1.1, 0.0};
500  elec_.R[2] = {0.0, 1.2, 0.0};
501  elec_.R[3] = {0.0, 1.3, 0.0};
502 
503  SpeciesSet& tspecies = elec_.getSpeciesSet();
504  const int upIdx = tspecies.addSpecies("u");
505  const int downIdx = tspecies.addSpecies("d");
506  const int chargeIdx = tspecies.addAttribute("charge");
507  tspecies(chargeIdx, upIdx) = -1;
508  tspecies(chargeIdx, downIdx) = -1;
509  const int ei_table_index = elec_.addTable(ions_);
510 
511  // diamondC_2x1x1
512  // from tests/solids/diamondC_2x1x1-Gaussian_pp_cplx/C_Diamond-tiled-cplx.wfj.xml
513  const std::string wf_xml_str = R"(
514  <sposet_collection type="molecularorbital" name="LCAOBSet" source="ion0" transform="yes" twist="0.07761248 0.07761248 -0.07761248" href="C_Diamond_2x1x1-Gaussian-tiled-cplx.h5" PBCimages="5 5 5" gpu="no">
515  <basisset name="LCAOBSet" key="GTO" transform="yes">
516  <grid type="log" ri="1.e-6" rf="1.e2" npts="1001"/>
517  </basisset>
518  <sposet name="spoud" size="8" >
519  <occupation mode="ground"/>
520  <coefficient size="52" spindataset="0"/>
521  </sposet>
522  </sposet_collection>
523  )";
524  const std::string wf_omp_xml_str = R"(
525  <sposet_collection type="molecularorbital" name="LCAOBSet" source="ion0" transform="yes" twist="0.07761248 0.07761248 -0.07761248" href="C_Diamond_2x1x1-Gaussian-tiled-cplx.h5" PBCimages="5 5 5" gpu="omptarget">
526  <basisset name="LCAOBSet" key="GTO" transform="yes">
527  <grid type="log" ri="1.e-6" rf="1.e2" npts="1001"/>
528  </basisset>
529  <sposet name="spoud" size="8" >
530  <occupation mode="ground"/>
531  <coefficient size="52" spindataset="0"/>
532  </sposet>
533  </sposet_collection>
534  )";
536  bool okay = doc.parseFromString(useOffload ? wf_omp_xml_str : wf_xml_str);
537  REQUIRE(okay);
538 
539  xmlNodePtr root = doc.getRoot();
540  xmlNodePtr bset_xml = xmlFirstElementChild(root);
541  xmlNodePtr sposet_xml = xmlNextElementSibling(bset_xml);
542 
543  LCAOrbitalBuilder lcaoSet(elec_, ions_, c, root);
544  auto spo = lcaoSet.createSPOSetFromXML(sposet_xml);
545  REQUIRE(spo);
546  auto& lcao_spos = dynamic_cast<const LCAOrbitalSet&>(*spo);
547  CHECK(!lcao_spos.isIdentity());
548 
549  const int norb = spo->getOrbitalSetSize();
550  app_log() << "norb: " << norb << std::endl;
551 
552  // test batched interfaces with 2 walkers
553  const size_t nw = 2;
554 
555  ParticleSet elec_2(elec_);
556  // interchange positions
557  elec_2.R[0] = elec_.R[1];
558  elec_2.R[1] = elec_.R[0];
559 
560  RefVectorWithLeader<ParticleSet> p_list(elec_, {elec_, elec_2});
561 
562  std::unique_ptr<SPOSet> spo_2(spo->makeClone());
563  RefVectorWithLeader<SPOSet> spo_list(*spo, {*spo, *spo_2});
564 
565  ResourceCollection pset_res("test_pset_res");
566  ResourceCollection spo_res("test_spo_res");
567 
568  elec_.createResource(pset_res);
569  spo->createResource(spo_res);
570 
571  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
572  ResourceCollectionTeamLock<SPOSet> mw_sposet_lock(spo_res, spo_list);
573  ParticleSet::mw_update(p_list);
574 
575  SECTION("LCAOrbitalSet::mw_evaluateVGL")
576  {
577  SPOSet::ValueVector psiref_0(norb);
578  SPOSet::GradVector dpsiref_0(norb);
579  SPOSet::ValueVector d2psiref_0(norb);
580  SPOSet::ValueVector psiref_1(norb);
581  SPOSet::GradVector dpsiref_1(norb);
582  SPOSet::ValueVector d2psiref_1(norb);
583 
584  spo_2->evaluateVGL(elec_2, 0, psiref_1, dpsiref_1, d2psiref_1);
585  spo->evaluateVGL(elec_, 0, psiref_0, dpsiref_0, d2psiref_0);
586  SECTION("single-walker VGL")
587  {
588  CHECK(Approx(std::real(psiref_0[0])) == 0.10394953298732);
589  CHECK(Approx(std::real(d2psiref_0[0])) == -0.15355833615767);
590  CHECK(Approx(std::real(dpsiref_0[0][0])) == -0.00066360565262);
591  CHECK(Approx(std::real(dpsiref_0[0][1])) == -0.03040447635885);
592  CHECK(Approx(std::real(dpsiref_0[0][2])) == 0.00066400579544);
593  CHECK(Approx(std::real(psiref_0[1])) == 0.04007076321982);
594  CHECK(Approx(std::real(d2psiref_0[1])) == -0.13347762878346);
595  CHECK(Approx(std::real(dpsiref_0[1][0])) == 0.06427121424074);
596  CHECK(Approx(std::real(dpsiref_0[1][1])) == -0.03145499248870);
597  CHECK(Approx(std::real(dpsiref_0[1][2])) == 0.09703977123104);
598 
599  CHECK(Approx(std::real(psiref_1[0])) == 0.10041826765555);
600  CHECK(Approx(std::real(d2psiref_1[0])) == -0.11271657756448);
601  CHECK(Approx(std::real(dpsiref_1[0][0])) == -0.00056949645372);
602  CHECK(Approx(std::real(dpsiref_1[0][1])) == -0.03940982127946);
603  CHECK(Approx(std::real(dpsiref_1[0][2])) == 0.00056995118020);
604  CHECK(Approx(std::real(psiref_1[1])) == 0.03692120161253);
605  CHECK(Approx(std::real(d2psiref_1[1])) == -0.10225156633271);
606  CHECK(Approx(std::real(dpsiref_1[1][0])) == 0.05862729651642);
607  CHECK(Approx(std::real(dpsiref_1[1][1])) == -0.03141220770622);
608  CHECK(Approx(std::real(dpsiref_1[1][2])) == 0.08454924955444);
609 
610  CHECK(Approx(std::imag(psiref_0[0])) == 0.00920567821605);
611  CHECK(Approx(std::imag(d2psiref_0[0])) == -0.01897980702117);
612  CHECK(Approx(std::imag(dpsiref_0[0][0])) == 0.00599757336742);
613  CHECK(Approx(std::imag(dpsiref_0[0][1])) == 0.00009471083794);
614  CHECK(Approx(std::imag(dpsiref_0[0][2])) == -0.00599734141981);
615  CHECK(Approx(std::imag(psiref_0[1])) == -0.07297020296665);
616  CHECK(Approx(std::imag(d2psiref_0[1])) == 0.24972839540365);
617  CHECK(Approx(std::imag(dpsiref_0[1][0])) == -0.14785027769482);
618  CHECK(Approx(std::imag(dpsiref_0[1][1])) == 0.05546078377043);
619  CHECK(Approx(std::imag(dpsiref_0[1][2])) == -0.19276310593334);
620 
621  CHECK(Approx(std::imag(psiref_1[0])) == 0.00921878891696);
622  CHECK(Approx(std::imag(d2psiref_1[0])) == -0.01501853597019);
623  CHECK(Approx(std::imag(dpsiref_1[0][0])) == 0.00531194469490);
624  CHECK(Approx(std::imag(dpsiref_1[0][1])) == 0.00017539927704);
625  CHECK(Approx(std::imag(dpsiref_1[0][2])) == -0.00531168663225);
626  CHECK(Approx(std::imag(psiref_1[1])) == -0.06736883166719);
627  CHECK(Approx(std::imag(d2psiref_1[1])) == 0.19452200419216);
628  CHECK(Approx(std::imag(dpsiref_1[1][0])) == -0.13949226666533);
629  CHECK(Approx(std::imag(dpsiref_1[1][1])) == 0.05635953434634);
630  CHECK(Approx(std::imag(dpsiref_1[1][2])) == -0.17227552311686);
631  }
632 
633  SPOSet::ValueVector psi_v_1(norb);
634  SPOSet::ValueVector psi_v_2(norb);
635  RefVector<SPOSet::ValueVector> psi_v_list{psi_v_1, psi_v_2};
636  spo->mw_evaluateValue(spo_list, p_list, 0, psi_v_list);
637  SECTION("multi-walker V")
638  {
639  CHECK(Approx(std::real(psi_v_list[0].get()[0])) == 0.10394953298732);
640  CHECK(Approx(std::real(psi_v_list[0].get()[1])) == 0.04007076321982);
641  CHECK(Approx(std::real(psi_v_list[1].get()[0])) == 0.10041826765555);
642  CHECK(Approx(std::real(psi_v_list[1].get()[1])) == 0.03692120161253);
643 
644  CHECK(Approx(std::imag(psi_v_list[0].get()[0])) == 0.00920567821605);
645  CHECK(Approx(std::imag(psi_v_list[0].get()[1])) == -0.07297020296665);
646  CHECK(Approx(std::imag(psi_v_list[1].get()[0])) == 0.00921878891696);
647  CHECK(Approx(std::imag(psi_v_list[1].get()[1])) == -0.06736883166719);
648  }
649 
650 
651  SPOSet::ValueVector psi_1(norb);
652  SPOSet::GradVector dpsi_1(norb);
653  SPOSet::ValueVector d2psi_1(norb);
654  SPOSet::ValueVector psi_2(norb);
655  SPOSet::GradVector dpsi_2(norb);
656  SPOSet::ValueVector d2psi_2(norb);
657  RefVector<SPOSet::ValueVector> psi_list = {psi_1, psi_2};
658  RefVector<SPOSet::GradVector> dpsi_list = {dpsi_1, dpsi_2};
659  RefVector<SPOSet::ValueVector> d2psi_list = {d2psi_1, d2psi_2};
660  spo->mw_evaluateVGL(spo_list, p_list, 0, psi_list, dpsi_list, d2psi_list);
661  SECTION("multi-walker VGL")
662  {
663  CHECK(Approx(std::real(psi_list[0].get()[0])) == 0.10394953298732);
664  CHECK(Approx(std::real(d2psi_list[0].get()[0])) == -0.15355833615767);
665  CHECK(Approx(std::real(dpsi_list[0].get()[0][0])) == -0.00066360565262);
666  CHECK(Approx(std::real(dpsi_list[0].get()[0][1])) == -0.03040447635885);
667  CHECK(Approx(std::real(dpsi_list[0].get()[0][2])) == 0.00066400579544);
668  CHECK(Approx(std::real(psi_list[0].get()[1])) == 0.04007076321982);
669  CHECK(Approx(std::real(d2psi_list[0].get()[1])) == -0.13347762878346);
670  CHECK(Approx(std::real(dpsi_list[0].get()[1][0])) == 0.06427121424074);
671  CHECK(Approx(std::real(dpsi_list[0].get()[1][1])) == -0.03145499248870);
672  CHECK(Approx(std::real(dpsi_list[0].get()[1][2])) == 0.09703977123104);
673 
674  CHECK(Approx(std::real(psi_list[1].get()[0])) == 0.10041826765555);
675  CHECK(Approx(std::real(d2psi_list[1].get()[0])) == -0.11271657756448);
676  CHECK(Approx(std::real(dpsi_list[1].get()[0][0])) == -0.00056949645372);
677  CHECK(Approx(std::real(dpsi_list[1].get()[0][1])) == -0.03940982127946);
678  CHECK(Approx(std::real(dpsi_list[1].get()[0][2])) == 0.00056995118020);
679  CHECK(Approx(std::real(psi_list[1].get()[1])) == 0.03692120161253);
680  CHECK(Approx(std::real(d2psi_list[1].get()[1])) == -0.10225156633271);
681  CHECK(Approx(std::real(dpsi_list[1].get()[1][0])) == 0.05862729651642);
682  CHECK(Approx(std::real(dpsi_list[1].get()[1][1])) == -0.03141220770622);
683  CHECK(Approx(std::real(dpsi_list[1].get()[1][2])) == 0.08454924955444);
684 
685  CHECK(Approx(std::imag(psi_list[0].get()[0])) == 0.00920567821605);
686  CHECK(Approx(std::imag(d2psi_list[0].get()[0])) == -0.01897980702117);
687  CHECK(Approx(std::imag(dpsi_list[0].get()[0][0])) == 0.00599757336742);
688  CHECK(Approx(std::imag(dpsi_list[0].get()[0][1])) == 0.00009471083794);
689  CHECK(Approx(std::imag(dpsi_list[0].get()[0][2])) == -0.00599734141981);
690  CHECK(Approx(std::imag(psi_list[0].get()[1])) == -0.07297020296665);
691  CHECK(Approx(std::imag(d2psi_list[0].get()[1])) == 0.24972839540365);
692  CHECK(Approx(std::imag(dpsi_list[0].get()[1][0])) == -0.14785027769482);
693  CHECK(Approx(std::imag(dpsi_list[0].get()[1][1])) == 0.05546078377043);
694  CHECK(Approx(std::imag(dpsi_list[0].get()[1][2])) == -0.19276310593334);
695 
696  CHECK(Approx(std::imag(psi_list[1].get()[0])) == 0.00921878891696);
697  CHECK(Approx(std::imag(d2psi_list[1].get()[0])) == -0.01501853597019);
698  CHECK(Approx(std::imag(dpsi_list[1].get()[0][0])) == 0.00531194469490);
699  CHECK(Approx(std::imag(dpsi_list[1].get()[0][1])) == 0.00017539927704);
700  CHECK(Approx(std::imag(dpsi_list[1].get()[0][2])) == -0.00531168663225);
701  CHECK(Approx(std::imag(psi_list[1].get()[1])) == -0.06736883166719);
702  CHECK(Approx(std::imag(d2psi_list[1].get()[1])) == 0.19452200419216);
703  CHECK(Approx(std::imag(dpsi_list[1].get()[1][0])) == -0.13949226666533);
704  CHECK(Approx(std::imag(dpsi_list[1].get()[1][1])) == 0.05635953434634);
705  CHECK(Approx(std::imag(dpsi_list[1].get()[1][2])) == -0.17227552311686);
706  }
707 
708 
709  SECTION("compare MW/SW V/VGL")
710  {
711  //real
712  for (size_t iorb = 0; iorb < norb; iorb++)
713  {
714  CHECK(Approx(std::real(psi_list[0].get()[iorb])) == std::real(psiref_0[iorb]));
715  CHECK(Approx(std::real(psi_list[1].get()[iorb])) == std::real(psiref_1[iorb]));
716  CHECK(Approx(std::real(d2psi_list[0].get()[iorb])) == std::real(d2psiref_0[iorb]));
717  CHECK(Approx(std::real(d2psi_list[1].get()[iorb])) == std::real(d2psiref_1[iorb]));
718  for (size_t idim = 0; idim < SPOSet::DIM; idim++)
719  {
720  CHECK(Approx(std::real(dpsi_list[0].get()[iorb][idim])) == std::real(dpsiref_0[iorb][idim]));
721  CHECK(Approx(std::real(dpsi_list[1].get()[iorb][idim])) == std::real(dpsiref_1[iorb][idim]));
722  }
723  }
724  for (size_t iorb = 0; iorb < norb; iorb++)
725  for (size_t iw = 0; iw < nw; iw++)
726  CHECK(Approx(std::real(psi_v_list[iw].get()[iorb])) == std::real(psi_list[iw].get()[iorb]));
727  //imag
728  for (size_t iorb = 0; iorb < norb; iorb++)
729  {
730  CHECK(Approx(std::imag(psi_list[0].get()[iorb])) == std::imag(psiref_0[iorb]));
731  CHECK(Approx(std::imag(psi_list[1].get()[iorb])) == std::imag(psiref_1[iorb]));
732  CHECK(Approx(std::imag(d2psi_list[0].get()[iorb])) == std::imag(d2psiref_0[iorb]));
733  CHECK(Approx(std::imag(d2psi_list[1].get()[iorb])) == std::imag(d2psiref_1[iorb]));
734  for (size_t idim = 0; idim < SPOSet::DIM; idim++)
735  {
736  CHECK(Approx(std::imag(dpsi_list[0].get()[iorb][idim])) == std::imag(dpsiref_0[iorb][idim]));
737  CHECK(Approx(std::imag(dpsi_list[1].get()[iorb][idim])) == std::imag(dpsiref_1[iorb][idim]));
738  }
739  }
740  for (size_t iorb = 0; iorb < norb; iorb++)
741  for (size_t iw = 0; iw < nw; iw++)
742  CHECK(Approx(std::imag(psi_v_list[iw].get()[iorb])) == std::imag(psi_list[iw].get()[iorb]));
743  }
744  // app_log() << "vgl_refvalues: \n" << std::setprecision(14);
745  // for (int iorb = 0; iorb < 2; iorb++)
746  // {
747  // app_log() << "CHECK(Approx(std::real(psiref_0[" << iorb << "])) == " << std::real(psiref_0[iorb]) << ");\n";
748  // app_log() << "CHECK(Approx(std::real(d2psiref_0[" << iorb << "])) == " << std::real(d2psiref_0[iorb]) << ");\n";
749  // for (int idim = 0; idim < 3; idim++)
750  // app_log() << "CHECK(Approx(std::real(dpsiref_0[" << iorb << "][" << idim
751  // << "])) == " << std::real(dpsiref_0[iorb][idim]) << ");\n";
752  // }
753  // for (int iorb = 0; iorb < 2; iorb++)
754  // {
755  // app_log() << "CHECK(Approx(std::real(psiref_1[" << iorb << "])) == " << std::real(psiref_1[iorb]) << ");\n";
756  // app_log() << "CHECK(Approx(std::real(d2psiref_1[" << iorb << "])) == " << std::real(d2psiref_1[iorb]) << "));\n";
757  // for (int idim = 0; idim < 3; idim++)
758  // app_log() << "CHECK(Approx(std::real(dpsiref_1[" << iorb << "][" << idim
759  // << "])) == " << std::real(dpsiref_1[iorb][idim]) << ");\n";
760  // }
761  // app_log() << "vgl_refvalues: \n" << std::setprecision(14);
762  // for (int iorb = 0; iorb < 2; iorb++)
763  // {
764  // app_log() << "CHECK(Approx(std::imag(psiref_0[" << iorb << "])) == " << std::imag(psiref_0[iorb]) << ");\n";
765  // app_log() << "CHECK(Approx(std::imag(d2psiref_0[" << iorb << "])) == " << std::imag(d2psiref_0[iorb]) << ");\n";
766  // for (int idim = 0; idim < 3; idim++)
767  // app_log() << "CHECK(Approx(std::imag(dpsiref_0[" << iorb << "][" << idim
768  // << "])) == " << std::imag(dpsiref_0[iorb][idim]) << ");\n";
769  // }
770  // for (int iorb = 0; iorb < 2; iorb++)
771  // {
772  // app_log() << "CHECK(Approx(std::imag(psiref_1[" << iorb << "])) == " << std::imag(psiref_1[iorb]) << ");\n";
773  // app_log() << "CHECK(Approx(std::imag(d2psiref_1[" << iorb << "])) == " << std::imag(d2psiref_1[iorb]) << "));\n";
774  // for (int idim = 0; idim < 3; idim++)
775  // app_log() << "CHECK(Approx(std::imag(dpsiref_1[" << iorb << "][" << idim
776  // << "])) == " << std::imag(dpsiref_1[iorb][idim]) << ");" << std::endl;
777  // }
778  }
779 
780  SECTION("LCAOrbitalSet::mw_evaluateDetRatios")
781  {
782  // make VPs
783  const size_t nvp_ = 4;
784  const size_t nvp_2 = 3;
785  const std::vector<size_t> nvp_list = {nvp_, nvp_2};
786  VirtualParticleSet VP_(elec_, nvp_);
787  VirtualParticleSet VP_2(elec_2, nvp_2);
788 
789  // move VPs
790  std::vector<ParticleSet::SingleParticlePos> newpos_vp_(nvp_);
791  std::vector<ParticleSet::SingleParticlePos> newpos_vp_2(nvp_2);
792  for (int i = 0; i < nvp_; i++)
793  {
794  newpos_vp_[i][0] = 0.1 * i;
795  newpos_vp_[i][1] = 0.2 * i;
796  newpos_vp_[i][2] = 0.3 * i;
797  }
798  for (int i = 0; i < nvp_2; i++)
799  {
800  newpos_vp_2[i][0] = 0.2 * i;
801  newpos_vp_2[i][1] = 0.3 * i;
802  newpos_vp_2[i][2] = 0.4 * i;
803  }
804 
805  const auto& ei_table_ = elec_.getDistTableAB(ei_table_index);
806  const auto& ei_table_2 = elec_2.getDistTableAB(ei_table_index);
807  // make virtual move of elec 0, reference ion 1
808  NLPPJob<SPOSet::RealType> job_(1, 0, ei_table_.getDistances()[0][1], -ei_table_.getDisplacements()[0][1]);
809  // make virtual move of elec 1, reference ion 3
810  NLPPJob<SPOSet::RealType> job_2(3, 1, ei_table_2.getDistances()[1][3], -ei_table_2.getDisplacements()[1][3]);
811 
812  // make VP refvec
813  RefVectorWithLeader<VirtualParticleSet> vp_list(VP_, {VP_, VP_2});
814 
815  ResourceCollection vp_res("test_vp_res");
816  VP_.createResource(vp_res);
817  ResourceCollectionTeamLock<VirtualParticleSet> mw_vpset_lock(vp_res, vp_list);
818  VirtualParticleSet::mw_makeMoves(vp_list, p_list, {newpos_vp_, newpos_vp_2}, {job_, job_2}, false);
819 
820  // fill invrow with dummy data for each walker
821  OffloadVector<SPOSet::ValueType> psiMinv_data_0(norb), psiMinv_data_1(norb);
822  LCAOrbitalSet::ValueVector psiMinv_ref_0(psiMinv_data_0.data(), norb), psiMinv_ref_1(psiMinv_data_1.data(), norb);
823  for (int i = 0; i < norb; i++)
824  {
825  psiMinv_data_0[i] = 0.1 * i;
826  psiMinv_data_1[i] = 0.2 * i;
827  }
828  psiMinv_data_0.updateTo();
829  psiMinv_data_1.updateTo();
830 
831  std::vector<const SPOSet::ValueType*> invRow_ptr_list;
832  if (spo->isOMPoffload())
833  invRow_ptr_list = {psiMinv_data_0.device_data(), psiMinv_data_1.device_data()};
834  else
835  invRow_ptr_list = {psiMinv_data_0.data(), psiMinv_data_1.data()};
836 
837  // ratios_list
838  std::vector<std::vector<SPOSet::ValueType>> ratios_list(nw);
839  for (size_t iw = 0; iw < nw; iw++)
840  ratios_list[iw].resize(nvp_list[iw]);
841 
842  // just need dummy refvec with correct size
843  SPOSet::ValueVector tmp_psi0(norb), tmp_psi1(norb);
844  RefVector<SPOSet::ValueVector> tmp_psi_list{tmp_psi0, tmp_psi1};
845  spo->mw_evaluateDetRatios(spo_list, RefVectorWithLeader<const VirtualParticleSet>(VP_, {VP_, VP_2}), tmp_psi_list,
846  invRow_ptr_list, ratios_list);
847 
848  std::vector<SPOSet::ValueType> ratios_ref_0(nvp_);
849  std::vector<SPOSet::ValueType> ratios_ref_1(nvp_2);
850  // single-walker functions for reference
851  spo->evaluateDetRatios(VP_, tmp_psi0, psiMinv_ref_0, ratios_ref_0);
852  spo_2->evaluateDetRatios(VP_2, tmp_psi1, psiMinv_ref_1, ratios_ref_1);
853 
854  for (int ivp = 0; ivp < nvp_; ivp++)
855  CHECK(Approx(std::real(ratios_list[0][ivp])) == std::real(ratios_ref_0[ivp]));
856  for (int ivp = 0; ivp < nvp_2; ivp++)
857  CHECK(Approx(std::real(ratios_list[1][ivp])) == std::real(ratios_ref_1[ivp]));
858  for (int ivp = 0; ivp < nvp_; ivp++)
859  CHECK(Approx(std::imag(ratios_list[0][ivp])) == std::imag(ratios_ref_0[ivp]));
860  for (int ivp = 0; ivp < nvp_2; ivp++)
861  CHECK(Approx(std::imag(ratios_list[1][ivp])) == std::imag(ratios_ref_1[ivp]));
862 
863  CHECK(Approx(std::real(ratios_ref_0[0])) == 0.0963445284);
864  CHECK(Approx(std::real(ratios_ref_0[1])) == 0.0784621772);
865  CHECK(Approx(std::real(ratios_ref_0[2])) == 0.0312479567);
866  CHECK(Approx(std::real(ratios_ref_0[3])) == -0.0240189529);
867  CHECK(Approx(std::real(ratios_ref_1[0])) == 0.1926890568);
868  CHECK(Approx(std::real(ratios_ref_1[1])) == 0.1037508495);
869  CHECK(Approx(std::real(ratios_ref_1[2])) == -0.0747915097);
870 
871  CHECK(Approx(std::real(ratios_list[0][0])) == 0.0963445284);
872  CHECK(Approx(std::real(ratios_list[0][1])) == 0.0784621772);
873  CHECK(Approx(std::real(ratios_list[0][2])) == 0.0312479567);
874  CHECK(Approx(std::real(ratios_list[0][3])) == -0.0240189529);
875  CHECK(Approx(std::real(ratios_list[1][0])) == 0.1926890568);
876  CHECK(Approx(std::real(ratios_list[1][1])) == 0.1037508495);
877  CHECK(Approx(std::real(ratios_list[1][2])) == -0.0747915097);
878 
879  CHECK(Approx(std::imag(ratios_ref_0[0])) == -0.0090812301);
880  CHECK(Approx(std::imag(ratios_ref_0[1])) == -0.0385825385);
881  CHECK(Approx(std::imag(ratios_ref_0[2])) == -0.0610830209);
882  CHECK(Approx(std::imag(ratios_ref_0[3])) == -0.0809775403);
883  CHECK(Approx(std::imag(ratios_ref_1[0])) == -0.0181624602);
884  CHECK(Approx(std::imag(ratios_ref_1[1])) == -0.0856868673);
885  CHECK(Approx(std::imag(ratios_ref_1[2])) == -0.1487774316);
886 
887  CHECK(Approx(std::imag(ratios_list[0][0])) == -0.0090812301);
888  CHECK(Approx(std::imag(ratios_list[0][1])) == -0.0385825385);
889  CHECK(Approx(std::imag(ratios_list[0][2])) == -0.0610830209);
890  CHECK(Approx(std::imag(ratios_list[0][3])) == -0.0809775403);
891  CHECK(Approx(std::imag(ratios_list[1][0])) == -0.0181624602);
892  CHECK(Approx(std::imag(ratios_list[1][1])) == -0.0856868673);
893  CHECK(Approx(std::imag(ratios_list[1][2])) == -0.1487774316);
894 
895  // // print SW ref values
896  // for (int ivp = 0; ivp < nvp_; ivp++)
897  // app_log() << "CHECK(Approx(std::real(ratios_ref_0[" << ivp << "])) == " << std::real(ratios_ref_0[ivp]) << ");\n";
898  // for (int ivp = 0; ivp < nvp_2; ivp++)
899  // app_log() << "CHECK(Approx(std::real(ratios_ref_1[" << ivp << "])) == " << std::real(ratios_ref_1[ivp]) << ");\n";
900 
901  // // print MW ref values
902  // for (int iw = 0; iw < nw; iw++)
903  // for (int ivp = 0; ivp < nvp_list[iw]; ivp++)
904  // app_log() << "CHECK(Approx(std::real(ratios_list[" << iw << "][" << ivp
905  // << "])) == " << std::real(ratios_list[iw][ivp]) << ");\n";
906  // for (int iw = 0; iw < nw; iw++)
907  // for (int ivp = 0; ivp < nvp_list[iw]; ivp++)
908  // app_log() << "CHECK(Approx(std::imag(ratios_list[" << iw << "][" << ivp
909  // << "])) == " << std::imag(ratios_list[iw][ivp]) << ");\n";
910  }
911 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ test_LCAO_DiamondC_2x1x1_real()

void qmcplusplus::test_LCAO_DiamondC_2x1x1_real ( const bool  useOffload)

Definition at line 37 of file test_LCAO_diamondC_2x1x1.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), app_log(), CHECK(), OHMMS::Controller, ParticleSet::create(), VirtualParticleSet::createResource(), ParticleSet::createResource(), LCAOrbitalBuilder::createSPOSetFromXML(), Vector< T, Alloc >::data(), Vector< T, Alloc >::device_data(), QMCTraits::DIM, QMCTraits::DIM_VGL, doc, ParticleSet::getDistTableAB(), Libxml2Document::getRoot(), ParticleSet::getSpeciesSet(), imag(), ispecies, lattice, VirtualParticleSet::mw_makeMoves(), ParticleSet::mw_update(), okay, Libxml2Document::parseFromString(), ParticleSet::print(), LatticeParser::put(), ParticleSet::R, REQUIRE(), Array< T, D, ALLOC >::resize(), ParticleSet::setName(), ParticleSet::update(), and Vector< T, Alloc >::updateTo().

Referenced by TEST_CASE().

38 {
39  using VT = SPOSet::ValueType;
41 
42  const char* particles = R"(<simulationcell>
43  <parameter name="lattice" units="bohr">
44  6.7463223 6.7463223 0.0
45  0.0 3.37316115 3.37316115
46  3.37316115 0.0 3.37316115
47  </parameter>
48  <parameter name="bconds">
49  p p p
50  </parameter>
51  </simulationcell>
52 )";
53 
54  Libxml2Document doc_lattice;
55  REQUIRE(doc_lattice.parseFromString(particles));
56 
57  // read lattice
58  ParticleSet::ParticleLayout lattice;
59  LatticeParser lp(lattice);
60  lp.put(doc_lattice.getRoot());
61  lattice.print(app_log(), 0);
62 
63  SimulationCell simcell(lattice);
64  ParticleSet ions_(simcell);
65 
66  ions_.setName("ion0");
67  ions_.create({4});
68  ions_.R[0] = {0.0, 0.0, 0.0};
69  ions_.R[1] = {1.686580575, 1.686580575, 1.686580575};
70  ions_.R[2] = {3.37316115, 3.37316115, 0.0};
71  ions_.R[3] = {5.059741726, 5.059741726, 1.686580575};
72  SpeciesSet& ispecies = ions_.getSpeciesSet();
73  const int Cidx = ispecies.addSpecies("C");
74 
75  ions_.print(app_log());
76  ions_.update(); // propagate SoA.
77 
78  ParticleSet elec_(simcell);
79  elec_.setName("elec");
80  elec_.create({8, 8});
81  elec_.R[0] = {0.0, 1.0, 0.0};
82  elec_.R[1] = {0.0, 1.1, 0.0};
83  elec_.R[2] = {0.0, 1.2, 0.0};
84  elec_.R[3] = {0.0, 1.3, 0.0};
85 
86  SpeciesSet& tspecies = elec_.getSpeciesSet();
87  const int upIdx = tspecies.addSpecies("u");
88  const int downIdx = tspecies.addSpecies("d");
89  const int chargeIdx = tspecies.addAttribute("charge");
90  tspecies(chargeIdx, upIdx) = -1;
91  tspecies(chargeIdx, downIdx) = -1;
92  const int ei_table_index = elec_.addTable(ions_);
93 
94  // diamondC_2x1x1
95  // from tests/solids/diamondC_2x1x1-Gaussian_pp/C_Diamond-Twist0.wfj.xml
96  const std::string wf_xml_str = R"(
97  <sposet_collection type="molecularorbital" name="LCAOBSet" source="ion0" transform="yes" twist="0 0 0" href="C_Diamond_2x1x1-Gaussian.h5" PBCimages="5 5 5" gpu="no">
98  <basisset name="LCAOBSet" key="GTO" transform="yes">
99  <grid type="log" ri="1.e-6" rf="1.e2" npts="1001"/>
100  </basisset>
101  <sposet name="spoud" size="8">
102  <occupation mode="ground"/>
103  <coefficient size="116" spindataset="0"/>
104  </sposet>
105  </sposet_collection>
106  )";
107  const std::string wf_omp_xml_str = R"(
108  <sposet_collection type="molecularorbital" name="LCAOBSet" source="ion0" transform="yes" twist="0 0 0" href="C_Diamond_2x1x1-Gaussian.h5" PBCimages="5 5 5" gpu="omptarget">
109  <basisset name="LCAOBSet" key="GTO" transform="yes">
110  <grid type="log" ri="1.e-6" rf="1.e2" npts="1001"/>
111  </basisset>
112  <sposet name="spoud" size="8">
113  <occupation mode="ground"/>
114  <coefficient size="116" spindataset="0"/>
115  </sposet>
116  </sposet_collection>
117  )";
119  bool okay = doc.parseFromString(useOffload ? wf_omp_xml_str : wf_xml_str);
120  REQUIRE(okay);
121 
122  xmlNodePtr root = doc.getRoot();
123  xmlNodePtr bset_xml = xmlFirstElementChild(root);
124  xmlNodePtr sposet_xml = xmlNextElementSibling(bset_xml);
125 
126  LCAOrbitalBuilder lcaoSet(elec_, ions_, c, root);
127  auto spo = lcaoSet.createSPOSetFromXML(sposet_xml);
128  REQUIRE(spo);
129  auto& lcao_spos = dynamic_cast<const LCAOrbitalSet&>(*spo);
130  CHECK(!lcao_spos.isIdentity());
131 
132  const int norb = spo->getOrbitalSetSize();
133  app_log() << "norb: " << norb << std::endl;
134 
135  // test batched interfaces with 2 walkers
136  const size_t nw = 2;
137 
138  ParticleSet elec_2(elec_);
139  // interchange positions
140  elec_2.R[0] = elec_.R[1];
141  elec_2.R[1] = elec_.R[0];
142 
143  RefVectorWithLeader<ParticleSet> p_list(elec_, {elec_, elec_2});
144 
145  std::unique_ptr<SPOSet> spo_2(spo->makeClone());
146  RefVectorWithLeader<SPOSet> spo_list(*spo, {*spo, *spo_2});
147 
148  ResourceCollection pset_res("test_pset_res");
149  ResourceCollection spo_res("test_spo_res");
150 
151  elec_.createResource(pset_res);
152  spo->createResource(spo_res);
153 
154  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
155  ResourceCollectionTeamLock<SPOSet> mw_sposet_lock(spo_res, spo_list);
156  ParticleSet::mw_update(p_list);
157 
158  SECTION("LCAOrbitalSet::mw_evaluateVGL")
159  {
160  SPOSet::ValueVector psiref_0(norb);
161  SPOSet::GradVector dpsiref_0(norb);
162  SPOSet::ValueVector d2psiref_0(norb);
163  SPOSet::ValueVector psiref_1(norb);
164  SPOSet::GradVector dpsiref_1(norb);
165  SPOSet::ValueVector d2psiref_1(norb);
166 
167  spo_2->evaluateVGL(elec_2, 0, psiref_1, dpsiref_1, d2psiref_1);
168  spo->evaluateVGL(elec_, 0, psiref_0, dpsiref_0, d2psiref_0);
169  SECTION("single-walker VGL")
170  {
171  CHECK(Approx(std::real(psiref_0[0])) == 0.10203360788082);
172  CHECK(Approx(std::real(d2psiref_0[0])) == -0.14269632514649);
173  CHECK(Approx(std::real(dpsiref_0[0][0])) == 0.00031796000022);
174  CHECK(Approx(std::real(dpsiref_0[0][1])) == -0.01951178212495);
175  CHECK(Approx(std::real(dpsiref_0[0][2])) == -0.00031738324507);
176  CHECK(Approx(std::real(psiref_0[1])) == 0.14111282090404);
177  CHECK(Approx(std::real(d2psiref_0[1])) == -0.28230884342631);
178  CHECK(Approx(std::real(dpsiref_0[1][0])) == 0.01205368790709);
179  CHECK(Approx(std::real(dpsiref_0[1][1])) == -0.04876640907938);
180  CHECK(Approx(std::real(dpsiref_0[1][2])) == -0.01205402562448);
181 
182  CHECK(Approx(std::real(psiref_1[0])) == 0.09954792826469);
183  CHECK(Approx(std::real(d2psiref_1[0])) == -0.10799468581785);
184  CHECK(Approx(std::real(dpsiref_1[0][0])) == 0.00024577684629);
185  CHECK(Approx(std::real(dpsiref_1[0][1])) == -0.02943596305516);
186  CHECK(Approx(std::real(dpsiref_1[0][2])) == -0.00024512723822);
187  CHECK(Approx(std::real(psiref_1[1])) == 0.13558495733438);
188  CHECK(Approx(std::real(d2psiref_1[1])) == -0.21885179829267);
189  CHECK(Approx(std::real(dpsiref_1[1][0])) == 0.00738771300147);
190  CHECK(Approx(std::real(dpsiref_1[1][1])) == -0.06080141726019);
191  CHECK(Approx(std::real(dpsiref_1[1][2])) == -0.00738811343748);
192  }
193 
194  SPOSet::ValueVector psi_v_1(norb);
195  SPOSet::ValueVector psi_v_2(norb);
196  RefVector<SPOSet::ValueVector> psi_v_list{psi_v_1, psi_v_2};
197  spo->mw_evaluateValue(spo_list, p_list, 0, psi_v_list);
198  SECTION("multi-walker V")
199  {
200  CHECK(Approx(std::real(psi_v_list[0].get()[0])) == 0.10203360788082);
201  CHECK(Approx(std::real(psi_v_list[0].get()[1])) == 0.14111282090404);
202  CHECK(Approx(std::real(psi_v_list[1].get()[0])) == 0.09954792826469);
203  CHECK(Approx(std::real(psi_v_list[1].get()[1])) == 0.13558495733438);
204  }
205 
206 
207  SPOSet::ValueVector psi_1(norb);
208  SPOSet::GradVector dpsi_1(norb);
209  SPOSet::ValueVector d2psi_1(norb);
210  SPOSet::ValueVector psi_2(norb);
211  SPOSet::GradVector dpsi_2(norb);
212  SPOSet::ValueVector d2psi_2(norb);
213  RefVector<SPOSet::ValueVector> psi_list = {psi_1, psi_2};
214  RefVector<SPOSet::GradVector> dpsi_list = {dpsi_1, dpsi_2};
215  RefVector<SPOSet::ValueVector> d2psi_list = {d2psi_1, d2psi_2};
216  spo->mw_evaluateVGL(spo_list, p_list, 0, psi_list, dpsi_list, d2psi_list);
217  SECTION("multi-walker VGL")
218  {
219  CHECK(Approx(std::real(psi_list[0].get()[0])) == 0.10203360788082);
220  CHECK(Approx(std::real(d2psi_list[0].get()[0])) == -0.14269632514649);
221  CHECK(Approx(std::real(dpsi_list[0].get()[0][0])) == 0.00031796000022);
222  CHECK(Approx(std::real(dpsi_list[0].get()[0][1])) == -0.01951178212495);
223  CHECK(Approx(std::real(dpsi_list[0].get()[0][2])) == -0.00031738324507);
224  CHECK(Approx(std::real(psi_list[0].get()[1])) == 0.14111282090404);
225  CHECK(Approx(std::real(d2psi_list[0].get()[1])) == -0.28230884342631);
226  CHECK(Approx(std::real(dpsi_list[0].get()[1][0])) == 0.01205368790709);
227  CHECK(Approx(std::real(dpsi_list[0].get()[1][1])) == -0.04876640907938);
228  CHECK(Approx(std::real(dpsi_list[0].get()[1][2])) == -0.01205402562448);
229 
230  CHECK(Approx(std::real(psi_list[1].get()[0])) == 0.09954792826469);
231  CHECK(Approx(std::real(d2psi_list[1].get()[0])) == -0.10799468581785);
232  CHECK(Approx(std::real(dpsi_list[1].get()[0][0])) == 0.00024577684629);
233  CHECK(Approx(std::real(dpsi_list[1].get()[0][1])) == -0.02943596305516);
234  CHECK(Approx(std::real(dpsi_list[1].get()[0][2])) == -0.00024512723822);
235  CHECK(Approx(std::real(psi_list[1].get()[1])) == 0.13558495733438);
236  CHECK(Approx(std::real(d2psi_list[1].get()[1])) == -0.21885179829267);
237  CHECK(Approx(std::real(dpsi_list[1].get()[1][0])) == 0.00738771300147);
238  CHECK(Approx(std::real(dpsi_list[1].get()[1][1])) == -0.06080141726019);
239  CHECK(Approx(std::real(dpsi_list[1].get()[1][2])) == -0.00738811343748);
240  }
241 
242 
243  SECTION("compare MW/SW V/VGL")
244  {
245  for (size_t iorb = 0; iorb < norb; iorb++)
246  {
247  CHECK(Approx(std::real(psi_list[0].get()[iorb])) == std::real(psiref_0[iorb]));
248  CHECK(Approx(std::real(psi_list[1].get()[iorb])) == std::real(psiref_1[iorb]));
249  CHECK(Approx(std::real(d2psi_list[0].get()[iorb])) == std::real(d2psiref_0[iorb]));
250  CHECK(Approx(std::real(d2psi_list[1].get()[iorb])) == std::real(d2psiref_1[iorb]));
251  for (size_t idim = 0; idim < SPOSet::DIM; idim++)
252  {
253  CHECK(Approx(std::real(dpsi_list[0].get()[iorb][idim])) == std::real(dpsiref_0[iorb][idim]));
254  CHECK(Approx(std::real(dpsi_list[1].get()[iorb][idim])) == std::real(dpsiref_1[iorb][idim]));
255  }
256  }
257  for (size_t iorb = 0; iorb < norb; iorb++)
258  for (size_t iw = 0; iw < nw; iw++)
259  CHECK(Approx(std::real(psi_v_list[iw].get()[iorb])) == std::real(psi_list[iw].get()[iorb]));
260 #ifdef QMC_COMPLEX
261  for (size_t iorb = 0; iorb < norb; iorb++)
262  {
263  CHECK(Approx(std::imag(psi_list[0].get()[iorb])) == std::imag(psiref_0[iorb]));
264  CHECK(Approx(std::imag(psi_list[1].get()[iorb])) == std::imag(psiref_1[iorb]));
265  CHECK(Approx(std::imag(d2psi_list[0].get()[iorb])) == std::imag(d2psiref_0[iorb]));
266  CHECK(Approx(std::imag(d2psi_list[1].get()[iorb])) == std::imag(d2psiref_1[iorb]));
267  for (size_t idim = 0; idim < SPOSet::DIM; idim++)
268  {
269  CHECK(Approx(std::imag(dpsi_list[0].get()[iorb][idim])) == std::imag(dpsiref_0[iorb][idim]));
270  CHECK(Approx(std::imag(dpsi_list[1].get()[iorb][idim])) == std::imag(dpsiref_1[iorb][idim]));
271  }
272  }
273  for (size_t iorb = 0; iorb < norb; iorb++)
274  for (size_t iw = 0; iw < nw; iw++)
275  CHECK(Approx(std::imag(psi_v_list[iw].get()[iorb])) == std::imag(psi_list[iw].get()[iorb]));
276 #endif
277  }
278  // app_log() << "vgl_refvalues: \n" << std::setprecision(14);
279  // for (int iorb = 0; iorb < 2; iorb++)
280  // {
281  // app_log() << "CHECK(Approx(std::real(psiref_0[" << iorb << "])) == " << psiref_0[iorb] << ");\n";
282  // app_log() << "CHECK(Approx(std::real(d2psiref_0[" << iorb << "])) == " << d2psiref_0[iorb] << ");\n";
283  // for (int idim = 0; idim < 3; idim++)
284  // app_log() << "CHECK(Approx(std::real(dpsiref_0[" << iorb << "][" << idim << "])) == " << dpsiref_0[iorb][idim] << ");\n";
285  // }
286  // for (int iorb = 0; iorb < 2; iorb++)
287  // {
288  // app_log() << "CHECK(Approx(std::real(psiref_1[" << iorb << "])) == " << psiref_1[iorb] << ");\n";
289  // app_log() << "CHECK(Approx(std::real(d2psiref_1[" << iorb << "])) == " << d2psiref_1[iorb] << "));\n";
290  // for (int idim = 0; idim < 3; idim++)
291  // app_log() << "CHECK(Approx(std::real(dpsiref_1[" << iorb << "][" << idim << "])) == " << dpsiref_1[iorb][idim] << ");\n";
292  // }
293 
294  // fill invrow with dummy data for each walker
295  OffloadVector<SPOSet::ValueType> psiMinv_data_0(norb), psiMinv_data_1(norb);
296  LCAOrbitalSet::ValueVector psiMinv_ref_0(psiMinv_data_0.data(), norb), psiMinv_ref_1(psiMinv_data_1.data(), norb);
297  for (int i = 0; i < norb; i++)
298  {
299  psiMinv_data_0[i] = 0.1 * i;
300  psiMinv_data_1[i] = 0.2 * i;
301  }
302  psiMinv_data_0.updateTo();
303  psiMinv_data_1.updateTo();
304 
305  std::vector<const SPOSet::ValueType*> invRow_ptr_list;
306  if (spo->isOMPoffload())
307  invRow_ptr_list = {psiMinv_data_0.device_data(), psiMinv_data_1.device_data()};
308  else
309  invRow_ptr_list = {psiMinv_data_0.data(), psiMinv_data_1.data()};
310 
311  SPOSet::OffloadMWVGLArray phi_vgl_v;
312  std::vector<SPOSet::ValueType> ratios(nw);
313  std::vector<SPOSet::GradType> grads(nw);
314  phi_vgl_v.resize(QMCTraits::DIM_VGL, nw, norb);
315 
316  spo->mw_evaluateVGLandDetRatioGrads(spo_list, p_list, 0, invRow_ptr_list, phi_vgl_v, ratios, grads);
317 
318  SECTION("multi-walker VGLandDetRatioGrads")
319  {
320  CHECK(Approx(std::real(ratios[0])) == 0.193096895);
321  CHECK(Approx(std::real(grads[0][0])) == 0.5969699486);
322  CHECK(Approx(std::real(grads[0][1])) == -0.776008772);
323  CHECK(Approx(std::real(grads[0][2])) == 0.7457653703);
324  CHECK(Approx(std::real(ratios[1])) == 0.3558058932);
325  CHECK(Approx(std::real(grads[1][0])) == 0.5857037763);
326  CHECK(Approx(std::real(grads[1][1])) == -0.8617132632);
327  CHECK(Approx(std::real(grads[1][2])) == 0.7299292825);
328  }
329  }
330 
331  SECTION("LCAOrbitalSet::mw_evaluateDetRatios")
332  {
333  // make VPs
334  const size_t nvp_ = 4;
335  const size_t nvp_2 = 3;
336  const std::vector<size_t> nvp_list = {nvp_, nvp_2};
337  VirtualParticleSet VP_(elec_, nvp_);
338  VirtualParticleSet VP_2(elec_2, nvp_2);
339 
340  // move VPs
341  std::vector<ParticleSet::SingleParticlePos> newpos_vp_(nvp_);
342  std::vector<ParticleSet::SingleParticlePos> newpos_vp_2(nvp_2);
343  for (int i = 0; i < nvp_; i++)
344  {
345  newpos_vp_[i][0] = 0.1 * i;
346  newpos_vp_[i][1] = 0.2 * i;
347  newpos_vp_[i][2] = 0.3 * i;
348  }
349  for (int i = 0; i < nvp_2; i++)
350  {
351  newpos_vp_2[i][0] = 0.2 * i;
352  newpos_vp_2[i][1] = 0.3 * i;
353  newpos_vp_2[i][2] = 0.4 * i;
354  }
355 
356  const auto& ei_table_ = elec_.getDistTableAB(ei_table_index);
357  const auto& ei_table_2 = elec_2.getDistTableAB(ei_table_index);
358  // make virtual move of elec 0, reference ion 1
359  NLPPJob<SPOSet::RealType> job_(1, 0, ei_table_.getDistances()[0][1], -ei_table_.getDisplacements()[0][1]);
360  // make virtual move of elec 1, reference ion 3
361  NLPPJob<SPOSet::RealType> job_2(3, 1, ei_table_2.getDistances()[1][3], -ei_table_2.getDisplacements()[1][3]);
362 
363  // make VP refvec
364  RefVectorWithLeader<VirtualParticleSet> vp_list(VP_, {VP_, VP_2});
365 
366  ResourceCollection vp_res("test_vp_res");
367  VP_.createResource(vp_res);
368  ResourceCollectionTeamLock<VirtualParticleSet> mw_vpset_lock(vp_res, vp_list);
369  VirtualParticleSet::mw_makeMoves(vp_list, p_list, {newpos_vp_, newpos_vp_2}, {job_, job_2}, false);
370 
371  // fill invrow with dummy data for each walker
372  OffloadVector<SPOSet::ValueType> psiMinv_data_0(norb), psiMinv_data_1(norb);
373  LCAOrbitalSet::ValueVector psiMinv_ref_0(psiMinv_data_0.data(), norb), psiMinv_ref_1(psiMinv_data_1.data(), norb);
374  for (int i = 0; i < norb; i++)
375  {
376  psiMinv_data_0[i] = 0.1 * i;
377  psiMinv_data_1[i] = 0.2 * i;
378  }
379  psiMinv_data_0.updateTo();
380  psiMinv_data_1.updateTo();
381 
382  std::vector<const SPOSet::ValueType*> invRow_ptr_list;
383  if (spo->isOMPoffload())
384  invRow_ptr_list = {psiMinv_data_0.device_data(), psiMinv_data_1.device_data()};
385  else
386  invRow_ptr_list = {psiMinv_data_0.data(), psiMinv_data_1.data()};
387 
388  // ratios_list
389  std::vector<std::vector<SPOSet::ValueType>> ratios_list(nw);
390  for (size_t iw = 0; iw < nw; iw++)
391  ratios_list[iw].resize(nvp_list[iw]);
392 
393  // just need dummy refvec with correct size
394  SPOSet::ValueVector tmp_psi0(norb), tmp_psi1(norb);
395  RefVector<SPOSet::ValueVector> tmp_psi_list{tmp_psi0, tmp_psi1};
396  spo->mw_evaluateDetRatios(spo_list, RefVectorWithLeader<const VirtualParticleSet>(VP_, {VP_, VP_2}), tmp_psi_list,
397  invRow_ptr_list, ratios_list);
398 
399  std::vector<SPOSet::ValueType> ratios_ref_0(nvp_);
400  std::vector<SPOSet::ValueType> ratios_ref_1(nvp_2);
401  // single-walker functions for reference
402  spo->evaluateDetRatios(VP_, tmp_psi0, psiMinv_ref_0, ratios_ref_0);
403  spo_2->evaluateDetRatios(VP_2, tmp_psi1, psiMinv_ref_1, ratios_ref_1);
404 
405  for (int ivp = 0; ivp < nvp_; ivp++)
406  CHECK(Approx(std::real(ratios_list[0][ivp])) == std::real(ratios_ref_0[ivp]));
407  for (int ivp = 0; ivp < nvp_2; ivp++)
408  CHECK(Approx(std::real(ratios_list[1][ivp])) == std::real(ratios_ref_1[ivp]));
409 #ifdef QMC_COMPLEX
410  for (int ivp = 0; ivp < nvp_; ivp++)
411  {
412  CHECK(Approx(std::imag(ratios_list[0][ivp])) == std::imag(ratios_ref_0[ivp]));
413  CHECK(Approx(std::imag(ratios_list[0][ivp])) == 0.0);
414  }
415  for (int ivp = 0; ivp < nvp_2; ivp++)
416  {
417  CHECK(Approx(std::imag(ratios_list[1][ivp])) == std::imag(ratios_ref_1[ivp]));
418  CHECK(Approx(std::imag(ratios_list[1][ivp])) == 0.0);
419  }
420 #endif
421 
422  CHECK(Approx(std::real(ratios_list[0][0])) == 0.19309684969511);
423  CHECK(Approx(std::real(ratios_list[0][1])) == 0.19743141486366);
424  CHECK(Approx(std::real(ratios_list[0][2])) == 0.17884881050205);
425  CHECK(Approx(std::real(ratios_list[0][3])) == 0.15105783567230);
426  CHECK(Approx(std::real(ratios_list[1][0])) == 0.38619369939021);
427  CHECK(Approx(std::real(ratios_list[1][1])) == 0.38429955941922);
428  CHECK(Approx(std::real(ratios_list[1][2])) == 0.32071997896196);
429 
430  CHECK(Approx(std::real(ratios_ref_0[0])) == 0.1930968497);
431  CHECK(Approx(std::real(ratios_ref_0[1])) == 0.1974314149);
432  CHECK(Approx(std::real(ratios_ref_0[2])) == 0.1788488105);
433  CHECK(Approx(std::real(ratios_ref_0[3])) == 0.1510578357);
434  CHECK(Approx(std::real(ratios_ref_1[0])) == 0.3861936994);
435  CHECK(Approx(std::real(ratios_ref_1[1])) == 0.3842995594);
436  CHECK(Approx(std::real(ratios_ref_1[2])) == 0.3207199790);
437 
438  //// print SW ref values
439  // for (int ivp = 0; ivp < nvp_; ivp++)
440  // app_log() << "CHECK(Approx(std::real(ratios_ref_0[" << ivp << "])) == " << std::real(ratios_ref_0[ivp]) << ");\n";
441  // for (int ivp = 0; ivp < nvp_2; ivp++)
442  // app_log() << "CHECK(Approx(std::real(ratios_ref_1[" << ivp << "])) == " << std::real(ratios_ref_1[ivp]) << ");\n";
443 
444  //// print MW ref values
445  // for (int iw = 0; iw < nw; iw++)
446  // for (int ivp = 0; ivp < nvp_list[iw]; ivp++)
447  // app_log() << "CHECK(Approx(std::real(ratios_list[" << iw << "][" << ivp << "])) == " << std::real(ratios_list[iw][ivp]) << ");\n";
448  // for (int iw = 0; iw < nw; iw++)
449  // for (int ivp = 0; ivp < nvp_list[iw]; ivp++)
450  // app_log() << "CHECK(Approx(std::imag(ratios_list[" << iw << "][" << ivp << "])) == " << std::imag(ratios_list[iw][ivp]) << ");\n";
451  }
452 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
QMCTraits::RealType real
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ test_lcao_spinor()

void qmcplusplus::test_lcao_spinor ( )

this is a somewhat simple example. We have an ion at the origin and a gaussian basis function centered on the ion as a orbital. In this case, the ion derivative is actually just the negative of the electron gradient.

Definition at line 26 of file test_MO_spinor.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ParticleSet::addTable(), app_log(), CHECK(), OHMMS::Controller, ParticleSet::create(), ParticleSet::createResource(), SPOSetBuilderFactory::createSPOSetBuilder(), doc, qmcplusplus::Units::charge::e, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), ispecies, SpinorSet::isResourceOwned(), ParticleSet::makeMove(), ParticleSet::mw_accept_rejectMove(), ParticleSet::mw_makeMove(), ParticleSet::mw_update(), okay, Libxml2Document::parseFromString(), POS_SPIN, MCCoords< CoordsType::POS_SPIN >::positions, processChildren(), ParticleSet::R, ParticleSet::rejectMove(), REQUIRE(), Matrix< T, Alloc >::resize(), Vector< T, Alloc >::resize(), ParticleSet::setName(), ParticleSet::setSpinor(), MCCoords< CoordsType::POS_SPIN >::spins, ParticleSet::spins, and ParticleSet::update().

Referenced by TEST_CASE().

27 {
28  app_log() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
29  app_log() << "!!!!!!! LCAO SpinorSet from HDF !!!!!!!\n";
30  app_log() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
31 
33  using RealType = SPOSet::RealType;
35 
36  ParticleSetPool ptcl = ParticleSetPool(c);
37  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
38  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
39  ParticleSet& ions_(*ions_uptr);
40  ParticleSet& elec_(*elec_uptr);
41 
42  ions_.setName("ion");
43  ptcl.addParticleSet(std::move(ions_uptr));
44  ions_.create({1});
45 
46  ions_.R[0] = {0.00000000, 0.00000000, 0.00000000};
47  SpeciesSet& ispecies = ions_.getSpeciesSet();
48  int hIdx = ispecies.addSpecies("H");
49  ions_.update();
50 
51  elec_.setName("elec");
52  ptcl.addParticleSet(std::move(elec_uptr));
53  elec_.create({1});
54  elec_.R[0] = {0.1, -0.3, 1.7};
55  elec_.spins[0] = 0.6;
56  elec_.setSpinor(true);
57 
58  SpeciesSet& tspecies = elec_.getSpeciesSet();
59  int upIdx = tspecies.addSpecies("u");
60  int chargeIdx = tspecies.addAttribute("charge");
61  tspecies(chargeIdx, upIdx) = -1;
62 
63 
64  elec_.addTable(ions_);
65  elec_.update();
66 
67  const char* particles = R"XML(<tmp>
68  <sposet_builder name="spinorbuilder" type="molecularorbital" href="lcao_spinor.h5" source="ion" precision="float">
69  <basisset transform="yes"/>
70  <sposet name="myspo" size="2"/>
71  </sposet_builder>
72  </tmp>)XML";
73 
75  bool okay = doc.parseFromString(particles);
76  REQUIRE(okay);
77 
78  xmlNodePtr root = doc.getRoot();
79 
80  xmlNodePtr bnode = xmlFirstElementChild(root);
81  SPOSetBuilderFactory fac(c, elec_, ptcl.getPool());
82  const auto spo_builder_ptr = fac.createSPOSetBuilder(bnode);
83  auto& bb = *spo_builder_ptr;
84 
85  // only pick up the last sposet
86  std::unique_ptr<SPOSet> spo;
87  processChildren(bnode, [&](const std::string& cname, const xmlNodePtr element) {
88  if (cname == "sposet")
89  spo = bb.createSPOSet(element);
90  });
91  REQUIRE(spo);
92 
93  //For this test, we are making the number of total orbitals in the SPOSet larger
94  //than what is requested for all SPOSet calls.
95  //That will allow us to check the behavior of SpinorSet doing the right thing if
96  //OrbitalSetSize > norbs_requested. This is necessary for things like orb opt with single determinants
97  SPOSet::ValueMatrix psiM(elec_.R.size(), elec_.R.size());
98  SPOSet::GradMatrix dpsiM(elec_.R.size(), elec_.R.size());
99  SPOSet::ValueMatrix dspsiM(elec_.R.size(), elec_.R.size()); //spin gradient
100  SPOSet::ValueMatrix d2psiM(elec_.R.size(), elec_.R.size());
101 
102  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM, dpsiM, d2psiM);
103 
104  ValueType val(5.584596565578567e-05, 0.0012321335483993093);
105  ValueType vdx(-2.7922982853738495e-05, -0.0006160667747698895);
106  ValueType vdy(8.376894847079449e-05, 0.0018482003223147029);
107  ValueType vdz(-0.00047469070804637896, -0.010473135160780798);
108  ValueType vlp(0.0033369958606517744, 0.07362437917398082);
109  ValueType vds(1.0474021389417806e-05, -0.00040482519442528657);
110  const RealType eps = 1e-4;
111 
112  for (unsigned int iat = 0; iat < 1; iat++)
113  {
114  CHECK(psiM[iat][0] == ComplexApprox(val).epsilon(eps));
115  CHECK(dpsiM[iat][0][0] == ComplexApprox(vdx).epsilon(eps));
116  CHECK(dpsiM[iat][0][1] == ComplexApprox(vdy).epsilon(eps));
117  CHECK(dpsiM[iat][0][2] == ComplexApprox(vdz).epsilon(eps));
118  CHECK(d2psiM[iat][0] == ComplexApprox(vlp).epsilon(eps));
119  }
120 
121  /** this is a somewhat simple example. We have an ion at the origin
122  * and a gaussian basis function centered on the ion as a orbital.
123  * In this case, the ion derivative is actually just the negative of
124  * the electron gradient.
125  */
126  SPOSet::GradMatrix gradIon(elec_.R.size(), elec_.R.size());
127  spo->evaluateGradSource(elec_, 0, elec_.R.size(), ions_, 0, gradIon);
128  for (int iat = 0; iat < 1; iat++)
129  {
130  CHECK(gradIon[iat][0][0] == ComplexApprox(-vdx).epsilon(eps));
131  CHECK(gradIon[iat][0][1] == ComplexApprox(-vdy).epsilon(eps));
132  CHECK(gradIon[iat][0][2] == ComplexApprox(-vdz).epsilon(eps));
133  }
134 
135  //temporary arrays for holding the values of the up and down channels respectively.
136  SPOSet::ValueVector psi_work;
137 
138  //temporary arrays for holding the gradients of the up and down channels respectively.
139  SPOSet::GradVector dpsi_work;
140 
141  //temporary arrays for holding the laplacians of the up and down channels respectively.
142  SPOSet::ValueVector d2psi_work;
143 
144  //temporary arrays for holding spin gradient
145  SPOSet::ValueVector dspsi_work;
146 
147  psi_work.resize(elec_.R.size());
148  dpsi_work.resize(elec_.R.size());
149  d2psi_work.resize(elec_.R.size());
150  dspsi_work.resize(elec_.R.size());
151 
152  //We worked hard to generate nice reference data above. Let's generate a test for evaluateV
153  //and evaluateVGL by perturbing the electronic configuration by dR, and then make
154  //single particle moves that bring it back to our original R reference values.
155 
156  //Our perturbation vector.
157  ParticleSet::ParticlePos dR;
158  dR.resize(1);
159  dR[0][0] = 0.1;
160  dR[0][1] = 0.2;
161  dR[0][2] = 0.1;
162 
163  //The new R of our perturbed particle set. Ma
164  ParticleSet::ParticlePos Rnew;
165  Rnew.resize(1);
166  Rnew = elec_.R + dR;
167  elec_.R = Rnew;
168  elec_.update();
169 
170  //Now we test evaluateValue()
171  for (unsigned int iat = 0; iat < 1; iat++)
172  {
173  psi_work = 0.0;
174  elec_.makeMove(iat, -dR[iat], false);
175  spo->evaluateValue(elec_, iat, psi_work);
176 
177  CHECK(psi_work[0] == ComplexApprox(val));
178  elec_.rejectMove(iat);
179  }
180 
181  //Now we test evaluateVGL()
182  for (unsigned int iat = 0; iat < 1; iat++)
183  {
184  psi_work = 0.0;
185  dpsi_work = 0.0;
186  d2psi_work = 0.0;
187  dspsi_work = 0.0;
188 
189  elec_.makeMove(iat, -dR[iat], false);
190  spo->evaluateVGL_spin(elec_, iat, psi_work, dpsi_work, d2psi_work, dspsi_work);
191 
192  CHECK(psi_work[0] == ComplexApprox(val).epsilon(eps));
193  CHECK(dpsi_work[0][0] == ComplexApprox(vdx).epsilon(eps));
194  CHECK(dpsi_work[0][1] == ComplexApprox(vdy).epsilon(eps));
195  CHECK(dpsi_work[0][2] == ComplexApprox(vdz).epsilon(eps));
196  CHECK(d2psi_work[0] == ComplexApprox(vlp).epsilon(eps));
197  CHECK(dspsi_work[0] == ComplexApprox(vds).epsilon(eps));
198  elec_.rejectMove(iat);
199  }
200 
201  //Now we test evaluateSpin:
202 
203  for (unsigned int iat = 0; iat < 1; iat++)
204  {
205  psi_work = 0.0;
206  dspsi_work = 0.0;
207 
208  elec_.makeMove(iat, -dR[iat], false);
209  spo->evaluate_spin(elec_, iat, psi_work, dspsi_work);
210 
211  CHECK(psi_work[0] == ComplexApprox(val).epsilon(eps));
212  CHECK(dspsi_work[0] == ComplexApprox(vds).epsilon(eps));
213 
214  elec_.rejectMove(iat);
215  }
216 
217  // test batched interface
218  // first move elec_ back to original positions for reference
219  Rnew = elec_.R - dR;
220  elec_.R = Rnew;
221  elec_.update();
222 
223  //make a spin displacement, just set to zero for the test
224  ParticleSet::ParticleScalar dS;
225  dS.resize(1);
226 
227  //now create second walker
228  ParticleSet elec_2(elec_);
229  elec_2.R[0] = {-0.4, 1.5, -0.2};
230  elec_2.spins[0] = -1.3;
231 
232  //create new reference values for new positions
233  ValueType val2(-0.00010787670610075059, -5.882498404872149e-05);
234  ValueType vdx2(-0.0002157534121903495, -0.00011764996809136147);
235  ValueType vdy2(0.0008090752956289096, 0.0004411873802963092);
236  ValueType vdz2(-0.00010787670612158852, -5.8824984060083926e-05);
237  ValueType vlp2(-0.004989237947754119, -0.0027206229528162103);
238  ValueType vds2(0.0001907917398151183, 0.005002478563410625);
239 
240  ResourceCollection pset_res("test_pset_res");
241  elec_.createResource(pset_res);
242  RefVectorWithLeader<ParticleSet> p_list(elec_);
243  p_list.push_back(elec_);
244  p_list.push_back(elec_2);
245 
246  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
247 
248  elec_.mw_update(p_list);
249  std::unique_ptr<SPOSet> spo_2(spo->makeClone());
250  RefVectorWithLeader<SPOSet> spo_list(*spo);
251  spo_list.push_back(*spo);
252  spo_list.push_back(*spo_2);
253 
254  //test resource APIs
255  //First resource is created, and then passed to the colleciton so it should be null
256  ResourceCollection spo_res("test_spo_res");
257  spo->createResource(spo_res);
258  SpinorSet& spinor = spo_list.getCastedLeader<SpinorSet>();
259  REQUIRE(!spinor.isResourceOwned());
260  ResourceCollectionTeamLock<SPOSet> mw_spo_lock(spo_res, spo_list);
261  REQUIRE(spinor.isResourceOwned());
262 
263  SPOSet::ValueMatrix psiM_2(elec_.R.size(), elec_.R.size());
264  SPOSet::GradMatrix dpsiM_2(elec_.R.size(), elec_.R.size());
265  SPOSet::ValueMatrix d2psiM_2(elec_.R.size(), elec_.R.size());
266 
267  RefVector<SPOSet::ValueMatrix> logdet_list;
268  RefVector<SPOSet::GradMatrix> dlogdet_list;
269  RefVector<SPOSet::ValueMatrix> d2logdet_list;
270 
271  logdet_list.push_back(psiM);
272  logdet_list.push_back(psiM_2);
273  dlogdet_list.push_back(dpsiM);
274  dlogdet_list.push_back(dpsiM_2);
275  d2logdet_list.push_back(d2psiM);
276  d2logdet_list.push_back(d2psiM_2);
277 
278  spo->mw_evaluate_notranspose(spo_list, p_list, 0, 1, logdet_list, dlogdet_list, d2logdet_list);
279  for (unsigned int iat = 0; iat < 1; iat++)
280  {
281  //walker 0
282  CHECK(logdet_list[0].get()[iat][0] == ComplexApprox(val).epsilon(eps));
283  CHECK(dlogdet_list[0].get()[iat][0][0] == ComplexApprox(vdx).epsilon(eps));
284  CHECK(dlogdet_list[0].get()[iat][0][1] == ComplexApprox(vdy).epsilon(eps));
285  CHECK(dlogdet_list[0].get()[iat][0][2] == ComplexApprox(vdz).epsilon(eps));
286  CHECK(d2logdet_list[0].get()[iat][0] == ComplexApprox(vlp).epsilon(eps));
287  //walker 1
288  CHECK(logdet_list[1].get()[iat][0] == ComplexApprox(val2).epsilon(eps));
289  CHECK(dlogdet_list[1].get()[iat][0][0] == ComplexApprox(vdx2).epsilon(eps));
290  CHECK(dlogdet_list[1].get()[iat][0][1] == ComplexApprox(vdy2).epsilon(eps));
291  CHECK(dlogdet_list[1].get()[iat][0][2] == ComplexApprox(vdz2).epsilon(eps));
292  CHECK(d2logdet_list[1].get()[iat][0] == ComplexApprox(vlp2).epsilon(eps));
293  }
294 
295  //first, lets displace all the elec in each walker
296  for (int iat = 0; iat < 1; iat++)
297  {
298  MCCoords<CoordsType::POS_SPIN> displs(2);
299  displs.positions = {dR[iat], dR[iat]};
300  displs.spins = {dS[iat], dS[iat]};
301  elec_.mw_makeMove(p_list, iat, displs);
302  std::vector<bool> accept = {true, true};
303  elec_.mw_accept_rejectMove<CoordsType::POS_SPIN>(p_list, iat, accept);
304  }
305  elec_.mw_update(p_list);
306 
307  SPOSet::ValueVector psi_work_2(elec_.R.size());
308  SPOSet::GradVector dpsi_work_2(elec_.R.size());
309  SPOSet::ValueVector d2psi_work_2(elec_.R.size());
310 
311  RefVector<SPOSet::ValueVector> psi_v_list = {psi_work, psi_work_2};
312  RefVector<SPOSet::GradVector> dpsi_v_list = {dpsi_work, dpsi_work_2};
313  RefVector<SPOSet::ValueVector> d2psi_v_list = {d2psi_work, d2psi_work_2};
314  SPOSet::OffloadMatrix<SPOSet::ComplexType> mw_dspin;
315  mw_dspin.resize(2, elec_.R.size());
316  //check mw_evaluateVGLWithSpin
317  for (int iat = 0; iat < 1; iat++)
318  {
319  //reset values to zero, updates the ref vectors to zero as well
320  psi_work = 0.0;
321  dpsi_work = 0.0;
322  d2psi_work = 0.0;
323  dspsi_work = 0.0;
324  psi_work_2 = 0.0;
325  dpsi_work_2 = 0.0;
326  d2psi_work_2 = 0.0;
327 
328  MCCoords<CoordsType::POS_SPIN> displs(2);
329  displs.positions = {-dR[iat], -dR[iat]};
330  displs.spins = {-dS[iat], -dS[iat]};
331  elec_.mw_makeMove(p_list, iat, displs);
332  spo->mw_evaluateVGLWithSpin(spo_list, p_list, iat, psi_v_list, dpsi_v_list, d2psi_v_list, mw_dspin);
333  //walker 0
334  CHECK(psi_v_list[0].get()[0] == ComplexApprox(val).epsilon(eps));
335  CHECK(dpsi_v_list[0].get()[0][0] == ComplexApprox(vdx).epsilon(eps));
336  CHECK(dpsi_v_list[0].get()[0][1] == ComplexApprox(vdy).epsilon(eps));
337  CHECK(dpsi_v_list[0].get()[0][2] == ComplexApprox(vdz).epsilon(eps));
338  CHECK(d2psi_v_list[0].get()[0] == ComplexApprox(vlp).epsilon(eps));
339  CHECK(mw_dspin(0, 0) == ComplexApprox(vds).epsilon(eps));
340  //walker 1
341  CHECK(psi_v_list[1].get()[0] == ComplexApprox(val2).epsilon(eps));
342  CHECK(dpsi_v_list[1].get()[0][0] == ComplexApprox(vdx2).epsilon(eps));
343  CHECK(dpsi_v_list[1].get()[0][1] == ComplexApprox(vdy2).epsilon(eps));
344  CHECK(dpsi_v_list[1].get()[0][2] == ComplexApprox(vdz2).epsilon(eps));
345  CHECK(d2psi_v_list[1].get()[0] == ComplexApprox(vlp2).epsilon(eps));
346  CHECK(mw_dspin(1, 0) == ComplexApprox(vds2).epsilon(eps));
347 
348  std::vector<bool> accept = {false, false};
349  elec_.mw_accept_rejectMove<CoordsType::POS_SPIN>(p_list, iat, accept);
350  }
351 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
QMCTraits::RealType RealType
void processChildren(const xmlNodePtr cur, const F &functor)
process through all the children of an XML element F is a lambda or functor void F/[](const std::stri...
Definition: libxmldefs.h:175
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ test_lcao_spinor_excited()

void qmcplusplus::test_lcao_spinor_excited ( )

this is a somewhat simple example. We have an ion at the origin and a gaussian basis function centered on the ion as a orbital. In this case, the ion derivative is actually just the negative of the electron gradient.

Definition at line 353 of file test_MO_spinor.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ParticleSet::addTable(), app_log(), CHECK(), OHMMS::Controller, ParticleSet::create(), ParticleSet::createResource(), SPOSetBuilderFactory::createSPOSetBuilder(), doc, qmcplusplus::Units::charge::e, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), ispecies, ParticleSet::makeMove(), ParticleSet::mw_accept_rejectMove(), ParticleSet::mw_makeMove(), ParticleSet::mw_update(), okay, Libxml2Document::parseFromString(), POS_SPIN, MCCoords< CoordsType::POS_SPIN >::positions, processChildren(), ParticleSet::R, ParticleSet::rejectMove(), REQUIRE(), Matrix< T, Alloc >::resize(), Vector< T, Alloc >::resize(), ParticleSet::setName(), ParticleSet::setSpinor(), MCCoords< CoordsType::POS_SPIN >::spins, ParticleSet::spins, and ParticleSet::update().

Referenced by TEST_CASE().

354 {
355  app_log() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
356  app_log() << "!! LCAO SpinorSet from HDF with excited !!\n";
357  app_log() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
358 
360  using RealType = SPOSet::RealType;
362 
363  ParticleSetPool ptcl = ParticleSetPool(c);
364  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
365  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
366  ParticleSet& ions_(*ions_uptr);
367  ParticleSet& elec_(*elec_uptr);
368 
369  ions_.setName("ion");
370  ptcl.addParticleSet(std::move(ions_uptr));
371  ions_.create({1});
372 
373  ions_.R[0] = {0.00000000, 0.00000000, 0.00000000};
374  SpeciesSet& ispecies = ions_.getSpeciesSet();
375  int hIdx = ispecies.addSpecies("H");
376  ions_.update();
377 
378  elec_.setName("elec");
379  ptcl.addParticleSet(std::move(elec_uptr));
380  elec_.create({1});
381  elec_.R[0] = {0.1, -0.3, 1.7};
382  elec_.spins[0] = 0.6;
383  elec_.setSpinor(true);
384 
385  SpeciesSet& tspecies = elec_.getSpeciesSet();
386  int upIdx = tspecies.addSpecies("u");
387  int chargeIdx = tspecies.addAttribute("charge");
388  tspecies(chargeIdx, upIdx) = -1;
389 
390 
391  elec_.addTable(ions_);
392  elec_.update();
393 
394  const char* particles = R"XML(<tmp>
395  <sposet_builder name="spinorbuilder" type="molecularorbital" href="lcao_spinor.h5" source="ion" precision="float">
396  <basisset name="myset" transform="yes"/>
397  <sposet name="myspo" basisset="myset" size="1">
398  <occupation mode="excited">
399  -1 2
400  </occupation>
401  </sposet>
402  </sposet_builder>
403  </tmp>)XML";
404 
406  bool okay = doc.parseFromString(particles);
407  REQUIRE(okay);
408 
409  xmlNodePtr root = doc.getRoot();
410 
411  xmlNodePtr bnode = xmlFirstElementChild(root);
412  SPOSetBuilderFactory fac(c, elec_, ptcl.getPool());
413  const auto sposet_builder_ptr = fac.createSPOSetBuilder(bnode);
414  auto& bb = *sposet_builder_ptr;
415 
416  // only pick up the last sposet
417  std::unique_ptr<SPOSet> spo;
418  processChildren(bnode, [&](const std::string& cname, const xmlNodePtr element) {
419  if (cname == "sposet")
420  spo = bb.createSPOSet(element);
421  });
422  REQUIRE(spo);
423 
424  const int OrbitalSetSize = spo->getOrbitalSetSize();
425  CHECK(OrbitalSetSize == 1);
426 
427  SPOSet::ValueMatrix psiM(elec_.R.size(), spo->getOrbitalSetSize());
428  SPOSet::GradMatrix dpsiM(elec_.R.size(), spo->getOrbitalSetSize());
429  SPOSet::ValueMatrix dspsiM(elec_.R.size(), spo->getOrbitalSetSize()); //spin gradient
430  SPOSet::ValueMatrix d2psiM(elec_.R.size(), spo->getOrbitalSetSize());
431 
432  spo->evaluate_notranspose(elec_, 0, elec_.R.size(), psiM, dpsiM, d2psiM);
433 
434  ValueType val(0.0008237860500019983, 1.0474021389417806e-05);
435  ValueType vdx(-0.00041189302538224967, -5.237010699556317e-06);
436  ValueType vdy(0.0012356790748129446, 1.5711032081710294e-05);
437  ValueType vdz(-0.007002181424606922, -8.90291818048377e-05);
438  ValueType vlp(0.04922415803252472, 0.0006258601782677606);
439  ValueType vds(-0.0010017050778321178, -5.584596565578559e-05);
440  const RealType eps = 1e-4;
441 
442  for (unsigned int iat = 0; iat < 1; iat++)
443  {
444  CHECK(psiM[iat][0] == ComplexApprox(val).epsilon(eps));
445  CHECK(dpsiM[iat][0][0] == ComplexApprox(vdx).epsilon(eps));
446  CHECK(dpsiM[iat][0][1] == ComplexApprox(vdy).epsilon(eps));
447  CHECK(dpsiM[iat][0][2] == ComplexApprox(vdz).epsilon(eps));
448  CHECK(d2psiM[iat][0] == ComplexApprox(vlp).epsilon(eps));
449  }
450 
451  /** this is a somewhat simple example. We have an ion at the origin
452  * and a gaussian basis function centered on the ion as a orbital.
453  * In this case, the ion derivative is actually just the negative of
454  * the electron gradient.
455  */
456  SPOSet::GradMatrix gradIon(elec_.R.size(), spo->getOrbitalSetSize());
457  spo->evaluateGradSource(elec_, 0, elec_.R.size(), ions_, 0, gradIon);
458  for (int iat = 0; iat < 1; iat++)
459  {
460  CHECK(gradIon[iat][0][0] == ComplexApprox(-vdx).epsilon(eps));
461  CHECK(gradIon[iat][0][1] == ComplexApprox(-vdy).epsilon(eps));
462  CHECK(gradIon[iat][0][2] == ComplexApprox(-vdz).epsilon(eps));
463  }
464 
465  //temporary arrays for holding the values of the up and down channels respectively.
466  SPOSet::ValueVector psi_work;
467 
468  //temporary arrays for holding the gradients of the up and down channels respectively.
469  SPOSet::GradVector dpsi_work;
470 
471  //temporary arrays for holding the laplacians of the up and down channels respectively.
472  SPOSet::ValueVector d2psi_work;
473 
474  //temporary arrays for holding spin gradient
475  SPOSet::ValueVector dspsi_work;
476 
477  psi_work.resize(OrbitalSetSize);
478  dpsi_work.resize(OrbitalSetSize);
479  d2psi_work.resize(OrbitalSetSize);
480  dspsi_work.resize(OrbitalSetSize);
481 
482  //We worked hard to generate nice reference data above. Let's generate a test for evaluateV
483  //and evaluateVGL by perturbing the electronic configuration by dR, and then make
484  //single particle moves that bring it back to our original R reference values.
485 
486  //Our perturbation vector.
487  ParticleSet::ParticlePos dR;
488  dR.resize(1);
489  dR[0][0] = 0.1;
490  dR[0][1] = 0.2;
491  dR[0][2] = 0.1;
492 
493  //The new R of our perturbed particle set. Ma
494  ParticleSet::ParticlePos Rnew;
495  Rnew.resize(1);
496  Rnew = elec_.R + dR;
497  elec_.R = Rnew;
498  elec_.update();
499 
500  //Now we test evaluateValue()
501  for (unsigned int iat = 0; iat < 1; iat++)
502  {
503  psi_work = 0.0;
504  elec_.makeMove(iat, -dR[iat], false);
505  spo->evaluateValue(elec_, iat, psi_work);
506 
507  CHECK(psi_work[0] == ComplexApprox(val));
508  elec_.rejectMove(iat);
509  }
510 
511  //Now we test evaluateVGL()
512  for (unsigned int iat = 0; iat < 1; iat++)
513  {
514  psi_work = 0.0;
515  dpsi_work = 0.0;
516  d2psi_work = 0.0;
517  dspsi_work = 0.0;
518 
519  elec_.makeMove(iat, -dR[iat], false);
520  spo->evaluateVGL_spin(elec_, iat, psi_work, dpsi_work, d2psi_work, dspsi_work);
521 
522  CHECK(psi_work[0] == ComplexApprox(val).epsilon(eps));
523  CHECK(dpsi_work[0][0] == ComplexApprox(vdx).epsilon(eps));
524  CHECK(dpsi_work[0][1] == ComplexApprox(vdy).epsilon(eps));
525  CHECK(dpsi_work[0][2] == ComplexApprox(vdz).epsilon(eps));
526  CHECK(d2psi_work[0] == ComplexApprox(vlp).epsilon(eps));
527  CHECK(dspsi_work[0] == ComplexApprox(vds).epsilon(eps));
528  elec_.rejectMove(iat);
529  }
530 
531  //Now we test evaluateSpin:
532  for (unsigned int iat = 0; iat < 1; iat++)
533  {
534  psi_work = 0.0;
535  dspsi_work = 0.0;
536 
537  elec_.makeMove(iat, -dR[iat], false);
538  spo->evaluate_spin(elec_, iat, psi_work, dspsi_work);
539 
540  CHECK(psi_work[0] == ComplexApprox(val).epsilon(eps));
541  CHECK(dspsi_work[0] == ComplexApprox(vds).epsilon(eps));
542 
543  elec_.rejectMove(iat);
544  }
545 
546  //test batched interface
547  // first move elec_ back to orginal positions for reference
548  Rnew = elec_.R - dR;
549  elec_.R = Rnew;
550  elec_.update();
551 
552  //add spin displacement, just set to zero for sake of test
553  ParticleSet::ParticleScalar dS;
554  dS.resize(1);
555 
556  //now create second walker
557  ParticleSet elec_2(elec_);
558  elec_2.R[0] = {-0.4, 1.5, -0.2};
559  elec_2.spins[0] = -1.3;
560 
561  //create new reference values for new positions
562  ValueType val2(0.0026291910291941015, 0.00019079173981511807);
563  ValueType vdx2(0.005258382058116388, 0.00038158347961051147);
564  ValueType vdy2(-0.019718932715867252, -0.0014309380483892627);
565  ValueType vdz2(0.002629191029701947, 0.00019079173985197097);
566  ValueType vlp2(0.1215986298515522, 0.008824012363842379);
567  ValueType vds2(0.004256243259981321, 0.00010787670610075102);
568 
569  ResourceCollection pset_res("test_pset_res");
570  elec_.createResource(pset_res);
571  RefVectorWithLeader<ParticleSet> p_list(elec_);
572  p_list.push_back(elec_);
573  p_list.push_back(elec_2);
574 
575 
576  ResourceCollection spo_res("test_spo_res");
577  spo->createResource(spo_res);
578  std::unique_ptr<SPOSet> spo_2(spo->makeClone());
579  RefVectorWithLeader<SPOSet> spo_list(*spo);
580  spo_list.push_back(*spo);
581  spo_list.push_back(*spo_2);
582 
583  SPOSet::ValueMatrix psiM_2(elec_.R.size(), spo->getOrbitalSetSize());
584  SPOSet::GradMatrix dpsiM_2(elec_.R.size(), spo->getOrbitalSetSize());
585  SPOSet::ValueMatrix d2psiM_2(elec_.R.size(), spo->getOrbitalSetSize());
586 
587  RefVector<SPOSet::ValueMatrix> logdet_list;
588  RefVector<SPOSet::GradMatrix> dlogdet_list;
589  RefVector<SPOSet::ValueMatrix> d2logdet_list;
590 
591  logdet_list.push_back(psiM);
592  logdet_list.push_back(psiM_2);
593  dlogdet_list.push_back(dpsiM);
594  dlogdet_list.push_back(dpsiM_2);
595  d2logdet_list.push_back(d2psiM);
596  d2logdet_list.push_back(d2psiM_2);
597 
598  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_list);
599  ResourceCollectionTeamLock<SPOSet> mw_spo_lock(spo_res, spo_list);
600 
601  elec_.mw_update(p_list);
602  spo->mw_evaluate_notranspose(spo_list, p_list, 0, 1, logdet_list, dlogdet_list, d2logdet_list);
603  for (unsigned int iat = 0; iat < 1; iat++)
604  {
605  //walker 0
606  CHECK(logdet_list[0].get()[iat][0] == ComplexApprox(val).epsilon(eps));
607  CHECK(dlogdet_list[0].get()[iat][0][0] == ComplexApprox(vdx).epsilon(eps));
608  CHECK(dlogdet_list[0].get()[iat][0][1] == ComplexApprox(vdy).epsilon(eps));
609  CHECK(dlogdet_list[0].get()[iat][0][2] == ComplexApprox(vdz).epsilon(eps));
610  CHECK(d2logdet_list[0].get()[iat][0] == ComplexApprox(vlp).epsilon(eps));
611  //walker 1
612  CHECK(logdet_list[1].get()[iat][0] == ComplexApprox(val2).epsilon(eps));
613  CHECK(dlogdet_list[1].get()[iat][0][0] == ComplexApprox(vdx2).epsilon(eps));
614  CHECK(dlogdet_list[1].get()[iat][0][1] == ComplexApprox(vdy2).epsilon(eps));
615  CHECK(dlogdet_list[1].get()[iat][0][2] == ComplexApprox(vdz2).epsilon(eps));
616  CHECK(d2logdet_list[1].get()[iat][0] == ComplexApprox(vlp2).epsilon(eps));
617  }
618 
619  //first, lets displace all the elec in each walker
620  for (int iat = 0; iat < 1; iat++)
621  {
622  MCCoords<CoordsType::POS_SPIN> displs(2);
623  displs.positions = {dR[iat], dR[iat]};
624  displs.spins = {dS[iat], dS[iat]};
625  elec_.mw_makeMove(p_list, iat, displs);
626  std::vector<bool> accept = {true, true};
627  elec_.mw_accept_rejectMove<CoordsType::POS_SPIN>(p_list, iat, accept);
628  }
629  elec_.mw_update(p_list);
630 
631  SPOSet::ValueVector psi_work_2(OrbitalSetSize);
632  SPOSet::GradVector dpsi_work_2(OrbitalSetSize);
633  SPOSet::ValueVector d2psi_work_2(OrbitalSetSize);
634 
635  RefVector<SPOSet::ValueVector> psi_v_list = {psi_work, psi_work_2};
636  RefVector<SPOSet::GradVector> dpsi_v_list = {dpsi_work, dpsi_work_2};
637  RefVector<SPOSet::ValueVector> d2psi_v_list = {d2psi_work, d2psi_work_2};
638  SPOSet::OffloadMatrix<SPOSet::ComplexType> mw_dspin;
639  mw_dspin.resize(2, OrbitalSetSize); //two walkers
640  //check mw_evaluateVGLWithSpin
641  for (int iat = 0; iat < 1; iat++)
642  {
643  //reset values to zero, updates the ref vectors to zero as well
644  psi_work = 0.0;
645  dpsi_work = 0.0;
646  d2psi_work = 0.0;
647  dspsi_work = 0.0;
648  psi_work_2 = 0.0;
649  dpsi_work_2 = 0.0;
650  d2psi_work_2 = 0.0;
651 
652  MCCoords<CoordsType::POS_SPIN> displs(2);
653  displs.positions = {-dR[iat], -dR[iat]};
654  displs.spins = {-dS[iat], -dS[iat]};
655  elec_.mw_makeMove(p_list, iat, displs);
656  spo->mw_evaluateVGLWithSpin(spo_list, p_list, iat, psi_v_list, dpsi_v_list, d2psi_v_list, mw_dspin);
657  //walker 0
658  CHECK(psi_v_list[0].get()[0] == ComplexApprox(val).epsilon(eps));
659  CHECK(dpsi_v_list[0].get()[0][0] == ComplexApprox(vdx).epsilon(eps));
660  CHECK(dpsi_v_list[0].get()[0][1] == ComplexApprox(vdy).epsilon(eps));
661  CHECK(dpsi_v_list[0].get()[0][2] == ComplexApprox(vdz).epsilon(eps));
662  CHECK(d2psi_v_list[0].get()[0] == ComplexApprox(vlp).epsilon(eps));
663  CHECK(mw_dspin(0, 0) == ComplexApprox(vds).epsilon(eps));
664  //walker 1
665  CHECK(psi_v_list[1].get()[0] == ComplexApprox(val2).epsilon(eps));
666  CHECK(dpsi_v_list[1].get()[0][0] == ComplexApprox(vdx2).epsilon(eps));
667  CHECK(dpsi_v_list[1].get()[0][1] == ComplexApprox(vdy2).epsilon(eps));
668  CHECK(dpsi_v_list[1].get()[0][2] == ComplexApprox(vdz2).epsilon(eps));
669  CHECK(d2psi_v_list[1].get()[0] == ComplexApprox(vlp2).epsilon(eps));
670  CHECK(mw_dspin(1, 0) == ComplexApprox(vds2).epsilon(eps));
671  std::vector<bool> accept = {false, false};
672  elec_.mw_accept_rejectMove<CoordsType::POS_SPIN>(p_list, iat, accept);
673  }
674 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
QMCTraits::RealType RealType
void processChildren(const xmlNodePtr cur, const F &functor)
process through all the children of an XML element F is a lambda or functor void F/[](const std::stri...
Definition: libxmldefs.h:175
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ test_lcao_spinor_ion_derivs()

void qmcplusplus::test_lcao_spinor_ion_derivs ( )

Definition at line 676 of file test_MO_spinor.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ParticleSet::addTable(), app_log(), CHECK(), OHMMS::Controller, ParticleSet::create(), SPOSetBuilderFactory::createSPOSetBuilder(), doc, qmcplusplus::Units::charge::e, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), ispecies, okay, Libxml2Document::parseFromString(), processChildren(), ParticleSet::R, REQUIRE(), ParticleSet::setName(), ParticleSet::setSpinor(), ParticleSet::spins, and ParticleSet::update().

Referenced by TEST_CASE().

677 {
678  app_log() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
679  app_log() << "!!!! LCAO SpinorSet from HDF (ion derivatives) !!!!\n";
680  app_log() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
681 
683  using RealType = SPOSet::RealType;
685 
686  ParticleSetPool ptcl = ParticleSetPool(c);
687  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
688  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
689  ParticleSet& ions_(*ions_uptr);
690  ParticleSet& elec_(*elec_uptr);
691 
692  ions_.setName("ion");
693  ptcl.addParticleSet(std::move(ions_uptr));
694  ions_.create({2});
695 
696  ions_.R[0] = {0.10000000, 0.20000000, 0.30000000};
697  ions_.R[1] = {-0.30000000, -0.20000000, -0.10000000};
698  SpeciesSet& ispecies = ions_.getSpeciesSet();
699  int hIdx = ispecies.addSpecies("H");
700  ions_.update();
701 
702  elec_.setName("elec");
703  ptcl.addParticleSet(std::move(elec_uptr));
704  elec_.create({1});
705  elec_.R[0] = {0.01, -0.02, 0.03};
706  elec_.spins[0] = 0.6;
707  elec_.setSpinor(true);
708 
709  SpeciesSet& tspecies = elec_.getSpeciesSet();
710  int upIdx = tspecies.addSpecies("u");
711  int chargeIdx = tspecies.addAttribute("charge");
712  tspecies(chargeIdx, upIdx) = -1;
713 
714 
715  elec_.addTable(ions_);
716  elec_.update();
717 
718  const char* particles = R"XML(<tmp>
719  <sposet_builder name="spinorbuilder" type="molecularorbital" href="lcao_spinor_molecule.h5" source="ion" precision="float">
720  <basisset transform="yes"/>
721  <sposet name="myspo" size="1"/>
722  </sposet_builder>
723  </tmp>)XML";
724 
726  bool okay = doc.parseFromString(particles);
727  REQUIRE(okay);
728 
729  xmlNodePtr root = doc.getRoot();
730 
731  xmlNodePtr bnode = xmlFirstElementChild(root);
732  SPOSetBuilderFactory fac(c, elec_, ptcl.getPool());
733  const auto spo_builder_ptr = fac.createSPOSetBuilder(bnode);
734  auto& bb = *spo_builder_ptr;
735 
736  // only pick up the last sposet
737  std::unique_ptr<SPOSet> spo;
738  processChildren(bnode, [&](const std::string& cname, const xmlNodePtr element) {
739  if (cname == "sposet")
740  spo = bb.createSPOSet(element);
741  });
742  REQUIRE(spo);
743 
744  //reference values from finite difference in lcao_spinor_molecule_test.py
745  ValueType dx0(-0.0492983, -0.3192778);
746  ValueType dy0(-0.1205071, -0.7804567);
747  ValueType dz0(-0.1478950, -0.9578333);
748  ValueType dx1(-0.0676367, 1.0506422);
749  ValueType dy1(-0.0392729, 0.6100503);
750  ValueType dz1(-0.0283638, 0.4405919);
751 
752  const RealType eps = 1e-4;
753  SPOSet::GradMatrix gradIon(elec_.R.size(), spo->getOrbitalSetSize());
754  spo->evaluateGradSource(elec_, 0, elec_.R.size(), ions_, 0, gradIon);
755  CHECK(gradIon[0][0][0] == ComplexApprox(dx0).epsilon(eps));
756  CHECK(gradIon[0][0][1] == ComplexApprox(dy0).epsilon(eps));
757  CHECK(gradIon[0][0][2] == ComplexApprox(dz0).epsilon(eps));
758  spo->evaluateGradSource(elec_, 0, elec_.R.size(), ions_, 1, gradIon);
759  CHECK(gradIon[0][0][0] == ComplexApprox(dx1).epsilon(eps));
760  CHECK(gradIon[0][0][1] == ComplexApprox(dy1).epsilon(eps));
761  CHECK(gradIon[0][0][2] == ComplexApprox(dz1).epsilon(eps));
762 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
QMCTraits::RealType RealType
void processChildren(const xmlNodePtr cur, const F &functor)
process through all the children of an XML element F is a lambda or functor void F/[](const std::stri...
Definition: libxmldefs.h:175
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ test_LiH_msd()

void qmcplusplus::test_LiH_msd ( const std::string &  spo_xml_string,
const std::string &  check_sponame,
int  check_spo_size,
int  check_basisset_size,
int  test_nlpp_algorithm_batched,
int  test_batched_api 
)

Definition at line 40 of file test_multi_slater_determinant.cpp.

References ParticleSet::acceptMove(), SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), app_log(), CHECK(), OHMMS::Controller, ParticleSet::create(), ParticleSet::createResource(), doc, ParticleSet::G, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), TWFGrads< CoordsType::POS >::grads_positions, ispecies, ParticleSet::L, ParticleSet::makeMove(), VirtualParticleSet::makeMoves(), ParticleSet::mw_accept_rejectMove(), TrialWaveFunction::mw_accept_rejectMove(), TrialWaveFunction::mw_calcRatio(), TrialWaveFunction::mw_calcRatioGrad(), TrialWaveFunction::mw_evalGrad(), TrialWaveFunction::mw_evaluateLog(), ParticleSet::mw_makeMove(), TrialWaveFunction::mw_prepareGroup(), ParticleSet::mw_update(), okay, Libxml2Document::parseFromString(), ParticleSet::R, ParticleSet::rejectMove(), REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), VariableSet::size_of_active(), twf, and ParticleSet::update().

Referenced by TEST_CASE().

46 {
48 
49  ParticleSetPool ptcl = ParticleSetPool(c);
50  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
51  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
52  ParticleSet& ions_(*ions_uptr);
53  ParticleSet& elec_(*elec_uptr);
54 
55  ions_.setName("ion0");
56  ptcl.addParticleSet(std::move(ions_uptr));
57  ions_.create({1, 1});
58  ions_.R[0] = {0.0, 0.0, 0.0};
59  ions_.R[1] = {0.0, 0.0, 3.0139239693};
60  SpeciesSet& ispecies = ions_.getSpeciesSet();
61  int LiIdx = ispecies.addSpecies("Li");
62  int HIdx = ispecies.addSpecies("H");
63 
64  elec_.setName("elec");
65  ptcl.addParticleSet(std::move(elec_uptr));
66  elec_.create({2, 2});
67  elec_.R[0] = {0.5, 0.5, 0.5};
68  elec_.R[1] = {0.1, 0.1, 1.1};
69  elec_.R[2] = {-0.5, -0.5, -0.5};
70  elec_.R[3] = {-0.1, -0.1, 1.5};
71 
72  SpeciesSet& tspecies = elec_.getSpeciesSet();
73  int upIdx = tspecies.addSpecies("u");
74  int downIdx = tspecies.addSpecies("d");
75  int massIdx = tspecies.addAttribute("mass");
76  tspecies(massIdx, upIdx) = 1.0;
77  tspecies(massIdx, downIdx) = 1.0;
78  // Necessary to set mass
79  elec_.resetGroups();
80 
82  bool okay = doc.parseFromString(spo_xml_string);
83  REQUIRE(okay);
84 
85  xmlNodePtr ein_xml = doc.getRoot();
86 
87  WaveFunctionFactory wf_factory(elec_, ptcl.getPool(), c);
88  RuntimeOptions runtime_options;
89  auto twf_ptr = wf_factory.buildTWF(ein_xml, runtime_options);
90 
91  auto& spo = dynamic_cast<const LCAOrbitalSet&>(twf_ptr->getSPOSet(check_sponame));
92  CHECK(spo.getOrbitalSetSize() == check_spo_size);
93  CHECK(spo.getBasisSetSize() == check_basisset_size);
94 
95  ions_.update();
96  elec_.update();
97 
98  auto& twf(*twf_ptr);
99  auto msd_refvec = twf.findMSD();
100  CHECK(msd_refvec.size() == 1);
101  MultiSlaterDetTableMethod& msd = msd_refvec[0];
102 
103  twf.setMassTerm(elec_);
104  twf.evaluateLog(elec_);
105 
106  app_log() << "twf.evaluateLog logpsi " << std::setprecision(16) << twf.getLogPsi() << " " << twf.getPhase()
107  << std::endl;
108  CHECK(std::complex<double>(twf.getLogPsi(), twf.getPhase()) ==
109  LogComplexApprox(std::complex<double>(-7.646027846242066, 3.141592653589793)));
110  CHECK(elec_.G[0][0] == ValueApprox(-2.181896934));
111  CHECK(elec_.G[1][1] == ValueApprox(0.120821033));
112  CHECK(elec_.G[2][2] == ValueApprox(1.2765987657));
113  CHECK(elec_.L[0] == ValueApprox(-15.460736911));
114  CHECK(elec_.L[3] == ValueApprox(-0.328013327566));
115 
116  Vector<ValueType> individual_det_ratios;
117  msd.calcIndividualDetRatios(individual_det_ratios);
118  CHECK(individual_det_ratios[0] == ValueApprox(-1.4357837882));
119  CHECK(individual_det_ratios[3] == ValueApprox(-0.013650987));
120 
121  twf.prepareGroup(elec_, 0);
122  auto grad_old = twf.evalGrad(elec_, 1);
123  app_log() << "twf.evalGrad grad_old " << std::setprecision(16) << grad_old << std::endl;
124  CHECK(grad_old[0] == ValueApprox(0.1204183219));
125  CHECK(grad_old[1] == ValueApprox(0.120821033));
126  CHECK(grad_old[2] == ValueApprox(2.05904174));
127 
128  PosType delta(0.1, 0.1, 0.2);
129  elec_.makeMove(1, delta);
130 
131  ParticleSet::GradType grad_new;
132  auto ratio = twf.calcRatioGrad(elec_, 1, grad_new);
133  app_log() << "twf.calcRatioGrad ratio " << ratio << " grad_new " << grad_new << std::endl;
134  CHECK(ratio == ValueApprox(1.374307585));
135  CHECK(grad_new[0] == ValueApprox(0.05732804333));
136  CHECK(grad_new[1] == ValueApprox(0.05747775029));
137  CHECK(grad_new[2] == ValueApprox(1.126889742));
138 
139  ratio = twf.calcRatio(elec_, 1);
140  app_log() << "twf.calcRatio ratio " << ratio << std::endl;
141  CHECK(ratio == ValueApprox(1.374307585));
142 
143 
144  opt_variables_type active;
145  twf.checkInVariables(active);
146 
147  const int nparam = active.size_of_active();
148  REQUIRE(nparam == 1486);
149 
151  Vector<ValueType> dlogpsi(nparam);
152  Vector<ValueType> dhpsioverpsi(nparam);
153  twf.evaluateDerivatives(elec_, active, dlogpsi, dhpsioverpsi);
154 
155  // Numbers not validated
156  CHECK(dlogpsi[0] == ValueApprox(0.006449058893092842));
157  CHECK(dlogpsi[1] == ValueApprox(-0.01365690177395768));
158  CHECK(dlogpsi[nparam - 1] == ValueApprox(0.1641910574099575));
159 
160  CHECK(dhpsioverpsi[0] == ValueApprox(0.2207480131794138));
161  CHECK(dhpsioverpsi[1] == ValueApprox(0.009316665149067847));
162  CHECK(dhpsioverpsi[nparam - 1] == ValueApprox(0.982665984797896));
163 
164  if (test_nlpp_algorithm_batched)
165  {
166  // set virtutal particle position
167  PosType newpos(0.3, 0.2, 0.5);
168 
169  //elec_.makeVirtualMoves(newpos);
170  //std::vector<ValueType> ratios(elec_.getTotalNum());
171  //twf.evaluateRatiosAlltoOne(elec_, ratios);
172 
173  //CHECK(std::real(ratios[0]) == Approx());
174  //CHECK(std::real(ratios[1]) == Approx());
175  //CHECK(std::real(ratios[2]) == Approx());
176 
177  elec_.makeMove(0, newpos - elec_.R[0]);
178  ValueType ratio_0 = twf.calcRatio(elec_, 0);
179  elec_.rejectMove(0);
180 
181  CHECK(std::real(ratio_0) == Approx(2.350046921));
182 
183  VirtualParticleSet VP(elec_, 2);
184  std::vector<PosType> newpos2(2);
185  std::vector<ValueType> ratios2(2);
186  newpos2[0] = newpos - elec_.R[1];
187  newpos2[1] = PosType(0.2, 0.5, 0.3) - elec_.R[1];
188  VP.makeMoves(elec_, 1, newpos2);
189  twf.evaluateRatios(VP, ratios2);
190 
191  CHECK(std::real(ratios2[0]) == Approx(-0.8544310407));
192  CHECK(std::real(ratios2[1]) == Approx(-1.0830708458));
193 
194  std::fill(ratios2.begin(), ratios2.end(), 0);
195  Matrix<ValueType> dratio(2, nparam);
196  twf.evaluateDerivRatios(VP, active, ratios2, dratio);
197 
198  CHECK(std::real(ratios2[0]) == Approx(-0.8544310407));
199  CHECK(std::real(ratios2[1]) == Approx(-1.0830708458));
200 
201  CHECK(std::real(dratio[0][0]) == Approx(0.248887465));
202  CHECK(std::real(dratio[0][1]) == Approx(0.135021218));
203  }
204 
205  //test acceptMove
206  {
207  PosType newpos(0.3, 0.2, 0.5);
208  elec_.makeMove(1, newpos - elec_.R[1]);
209  ValueType ratio_1 = twf.calcRatio(elec_, 1);
210  twf.acceptMove(elec_, 1);
211  elec_.acceptMove(1);
212 
213  CHECK(std::real(ratio_1) == Approx(-0.8544310407));
214  CHECK(twf.getLogPsi() == Approx(-7.8033473273));
215 
216  twf.evaluateLog(elec_);
217 
218  app_log() << "twf.evaluateLog logpsi " << std::setprecision(16) << twf.getLogPsi() << " " << twf.getPhase()
219  << std::endl;
220  CHECK(std::complex<double>(twf.getLogPsi(), twf.getPhase()) ==
221  LogComplexApprox(std::complex<double>(-7.803347327300154, 0.0)));
222  CHECK(elec_.G[0][0] == ValueApprox(1.63020975849953));
223  CHECK(elec_.G[1][1] == ValueApprox(-1.795375999646262));
224  CHECK(elec_.G[2][2] == ValueApprox(1.215768958589418));
225  CHECK(elec_.L[0] == ValueApprox(-21.84021387509693));
226  CHECK(elec_.L[3] == ValueApprox(-1.332448295858972));
227  }
228 
229  // testing batched interfaces
230  if (test_batched_api)
231  {
232  ParticleSet elec_clone(elec_);
233  elec_clone.update();
234 
235  std::unique_ptr<TrialWaveFunction> twf_clone(twf.makeClone(elec_clone));
236 
237  std::vector<PosType> displ(2);
238  displ[0] = {0.1, 0.2, 0.3};
239  displ[1] = {-0.2, -0.3, 0.0};
240 
241  // testing batched interfaces
242  ResourceCollection pset_res("test_pset_res");
243  ResourceCollection twf_res("test_twf_res");
244 
245  elec_.createResource(pset_res);
246  twf.createResource(twf_res);
247 
248  // testing batched interfaces
249  RefVectorWithLeader<ParticleSet> p_ref_list(elec_, {elec_, elec_clone});
250  RefVectorWithLeader<TrialWaveFunction> wf_ref_list(twf, {twf, *twf_clone});
251 
252  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_ref_list);
253  ResourceCollectionTeamLock<TrialWaveFunction> mw_twf_lock(twf_res, wf_ref_list);
254 
255  ParticleSet::mw_update(p_ref_list);
256  TrialWaveFunction::mw_evaluateLog(wf_ref_list, p_ref_list);
257  app_log() << "before YYY [0] getLogPsi getPhase " << std::setprecision(16) << wf_ref_list[0].getLogPsi() << " "
258  << wf_ref_list[0].getPhase() << std::endl;
259  app_log() << "before YYY [1] getLogPsi getPhase " << std::setprecision(16) << wf_ref_list[1].getLogPsi() << " "
260  << wf_ref_list[1].getPhase() << std::endl;
261  CHECK(std::complex<RealType>(wf_ref_list[0].getLogPsi(), wf_ref_list[0].getPhase()) ==
262  LogComplexApprox(std::complex<RealType>(-7.803347327300153, 0.0)));
263  CHECK(std::complex<RealType>(wf_ref_list[1].getLogPsi(), wf_ref_list[1].getPhase()) ==
264  LogComplexApprox(std::complex<RealType>(-7.803347327300153, 0.0)));
265 
266  TrialWaveFunction::mw_prepareGroup(wf_ref_list, p_ref_list, 0);
267 
268  TWFGrads<CoordsType::POS> grad_old(2);
269 
270  const int moved_elec_id = 1;
271  TrialWaveFunction::mw_evalGrad(wf_ref_list, p_ref_list, moved_elec_id, grad_old);
272 
273  CHECK(grad_old.grads_positions[0][0] == ValueApprox(-2.6785305398));
274  CHECK(grad_old.grads_positions[0][1] == ValueApprox(-1.7953759996));
275  CHECK(grad_old.grads_positions[0][2] == ValueApprox(-5.8209379274));
276  CHECK(grad_old.grads_positions[1][0] == ValueApprox(-2.6785305398));
277  CHECK(grad_old.grads_positions[1][1] == ValueApprox(-1.7953759996));
278  CHECK(grad_old.grads_positions[1][2] == ValueApprox(-5.8209379274));
279 
280  TWFGrads<CoordsType::POS> grad_new(2);
281  std::vector<PsiValue> ratios(2);
282 
283  ParticleSet::mw_makeMove(p_ref_list, moved_elec_id, displ);
284  TrialWaveFunction::mw_calcRatio(wf_ref_list, p_ref_list, moved_elec_id, ratios);
285 
286  CHECK(ratios[0] == ValueApprox(PsiValue(-0.6181619459)));
287  CHECK(ratios[1] == ValueApprox(PsiValue(1.6186330488)));
288 
289  TrialWaveFunction::mw_calcRatioGrad(wf_ref_list, p_ref_list, moved_elec_id, ratios, grad_new);
290 
291  CHECK(ratios[0] == ValueApprox(PsiValue(-0.6181619459)));
292  CHECK(ratios[1] == ValueApprox(PsiValue(1.6186330488)));
293 
294  CHECK(grad_new.grads_positions[0][0] == ValueApprox(1.2418467899));
295  CHECK(grad_new.grads_positions[0][1] == ValueApprox(1.2425653495));
296  CHECK(grad_new.grads_positions[0][2] == ValueApprox(4.4273237873));
297  CHECK(grad_new.grads_positions[1][0] == ValueApprox(-0.8633778143));
298  CHECK(grad_new.grads_positions[1][1] == ValueApprox(0.8245347691));
299  CHECK(grad_new.grads_positions[1][2] == ValueApprox(-5.1513380151));
300 
301  std::vector<bool> isAccepted{false, true};
302  TrialWaveFunction::mw_accept_rejectMove(wf_ref_list, p_ref_list, moved_elec_id, isAccepted);
303  ParticleSet::mw_accept_rejectMove(p_ref_list, moved_elec_id, isAccepted);
304 
305  CHECK(wf_ref_list[0].getLogPsi() == Approx(-7.803347327300152));
306  CHECK(wf_ref_list[1].getLogPsi() == Approx(-7.321765331299484));
307 
308  // move the next electron
309  TrialWaveFunction::mw_prepareGroup(wf_ref_list, p_ref_list, 1);
310  const int moved_elec_id_next = 2;
311  TrialWaveFunction::mw_evalGrad(wf_ref_list, p_ref_list, moved_elec_id_next, grad_old);
312 
313  CHECK(grad_old.grads_positions[0][0] == ValueApprox(1.3325558736));
314  CHECK(grad_old.grads_positions[0][1] == ValueApprox(1.3327966725));
315  CHECK(grad_old.grads_positions[0][2] == ValueApprox(1.2157689586));
316  CHECK(grad_old.grads_positions[1][0] == ValueApprox(1.3222514142));
317  CHECK(grad_old.grads_positions[1][1] == ValueApprox(1.3230108868));
318  CHECK(grad_old.grads_positions[1][2] == ValueApprox(1.2035047435));
319 
320  ParticleSet::mw_makeMove(p_ref_list, moved_elec_id_next, displ);
321  TrialWaveFunction::mw_calcRatio(wf_ref_list, p_ref_list, moved_elec_id_next, ratios);
322 
323  CHECK(ratios[0] == ValueApprox(PsiValue(2.1080036144)));
324  CHECK(ratios[1] == ValueApprox(PsiValue(0.4947158435)));
325 
326  TrialWaveFunction::mw_calcRatioGrad(wf_ref_list, p_ref_list, moved_elec_id_next, ratios, grad_new);
327 
328  CHECK(ratios[0] == ValueApprox(PsiValue(2.1080036144)));
329  CHECK(ratios[1] == ValueApprox(PsiValue(0.4947158435)));
330 
331  CHECK(grad_new.grads_positions[0][0] == ValueApprox(1.8412365668));
332  CHECK(grad_new.grads_positions[0][1] == ValueApprox(1.3736370007));
333  CHECK(grad_new.grads_positions[0][2] == ValueApprox(0.8043818454));
334  CHECK(grad_new.grads_positions[1][0] == ValueApprox(1.3553132105));
335  CHECK(grad_new.grads_positions[1][1] == ValueApprox(1.5552132255));
336  CHECK(grad_new.grads_positions[1][2] == ValueApprox(0.804301246));
337  }
338 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
QMCTraits::RealType real
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
LatticeGaussianProduct::GradType GradType
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Catch::Detail::LogComplexApprox LogComplexApprox
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
optimize::VariableSet opt_variables_type
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType

◆ test_LiH_msd_xml_input()

void qmcplusplus::test_LiH_msd_xml_input ( const std::string &  spo_xml_string,
const std::string &  check_sponame,
int  check_spo_size,
int  check_basisset_size 
)

Definition at line 31 of file test_spo_collection_input_MSD_LCAO_h5.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), OHMMS::Controller, ParticleSet::create(), doc, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), ispecies, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), and ParticleSet::setName().

Referenced by TEST_CASE().

35 {
37 
38  ParticleSetPool ptcl = ParticleSetPool(c);
39  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
40  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
41  ParticleSet& ions_(*ions_uptr);
42  ParticleSet& elec_(*elec_uptr);
43 
44  ions_.setName("ion0");
45  ptcl.addParticleSet(std::move(ions_uptr));
46  ions_.create({1, 1});
47  ions_.R[0] = {0.0, 0.0, 0.0};
48  ions_.R[1] = {0.0, 0.0, 3.0139239693};
49  SpeciesSet& ispecies = ions_.getSpeciesSet();
50  int LiIdx = ispecies.addSpecies("Li");
51  int HIdx = ispecies.addSpecies("H");
52 
53  elec_.setName("elec");
54  ptcl.addParticleSet(std::move(elec_uptr));
55  elec_.create({2, 2});
56  elec_.R[0] = {0.5, 0.5, 0.5};
57  elec_.R[1] = {0.1, 0.1, 1.1};
58  elec_.R[2] = {-0.5, -0.5, -0.5};
59  elec_.R[3] = {-0.1, -0.1, 1.5};
60 
61  SpeciesSet& tspecies = elec_.getSpeciesSet();
62  int upIdx = tspecies.addSpecies("u");
63  int downIdx = tspecies.addSpecies("d");
64  int massIdx = tspecies.addAttribute("mass");
65  tspecies(massIdx, upIdx) = 1.0;
66  tspecies(massIdx, downIdx) = 1.0;
67 
69  bool okay = doc.parseFromString(spo_xml_string);
70  REQUIRE(okay);
71 
72  xmlNodePtr ein_xml = doc.getRoot();
73 
74  WaveFunctionFactory wf_factory(elec_, ptcl.getPool(), c);
75  RuntimeOptions runtime_options;
76  auto twf_ptr = wf_factory.buildTWF(ein_xml, runtime_options);
77 
78  auto& spo = dynamic_cast<const LCAOrbitalSet&>(twf_ptr->getSPOSet(check_sponame));
79  REQUIRE(spo.getOrbitalSetSize() == check_spo_size);
80  REQUIRE(spo.getBasisSetSize() == check_basisset_size);
81 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ test_LiH_msd_xml_input_with_positron()

void qmcplusplus::test_LiH_msd_xml_input_with_positron ( const std::string &  spo_xml_string,
const std::string &  check_sponame,
int  check_spo_size,
int  check_basisset_size 
)

Definition at line 194 of file test_spo_collection_input_MSD_LCAO_h5.cpp.

References SpeciesSet::addAttribute(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), OHMMS::Controller, ParticleSet::create(), doc, ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), ispecies, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), and ParticleSet::setName().

Referenced by TEST_CASE().

198 {
200 
201  ParticleSetPool ptcl = ParticleSetPool(c);
202  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
203  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell());
204  ParticleSet& ions_(*ions_uptr);
205  ParticleSet& elec_(*elec_uptr);
206 
207  ions_.setName("ion0");
208  ptcl.addParticleSet(std::move(ions_uptr));
209  ions_.create({1, 1});
210  ions_.R[0] = {0.0, 0.0, 0.0};
211  ions_.R[1] = {0.0, 0.0, 3.0139239693};
212  SpeciesSet& ispecies = ions_.getSpeciesSet();
213  int LiIdx = ispecies.addSpecies("Li");
214  int HIdx = ispecies.addSpecies("H");
215 
216  elec_.setName("elec");
217  ptcl.addParticleSet(std::move(elec_uptr));
218  elec_.create({2, 2, 1});
219  elec_.R[0] = {0.5, 0.5, 0.5};
220  elec_.R[1] = {0.1, 0.1, 1.1};
221  elec_.R[2] = {-0.5, -0.5, -0.5};
222  elec_.R[3] = {-0.1, -0.1, 1.5};
223  elec_.R[4] = {0.0, -1.0, 2};
224 
225  SpeciesSet& tspecies = elec_.getSpeciesSet();
226  int upIdx = tspecies.addSpecies("u");
227  int downIdx = tspecies.addSpecies("d");
228  int positronIdx = tspecies.addSpecies("pos");
229  int massIdx = tspecies.addAttribute("mass");
230  int chargeIdx = tspecies.addAttribute("charge");
231  tspecies(massIdx, upIdx) = 1.0;
232  tspecies(massIdx, downIdx) = 1.0;
233  tspecies(massIdx, positronIdx) = 1.0;
234  tspecies(chargeIdx, upIdx) = -1.0;
235  tspecies(chargeIdx, downIdx) = -1.0;
236  tspecies(chargeIdx, positronIdx) = 1.0;
237 
239  bool okay = doc.parseFromString(spo_xml_string);
240  REQUIRE(okay);
241 
242  xmlNodePtr ein_xml = doc.getRoot();
243 
244  WaveFunctionFactory wf_factory(elec_, ptcl.getPool(), c);
245  RuntimeOptions runtime_options;
246  auto twf_ptr = wf_factory.buildTWF(ein_xml, runtime_options);
247 
248  auto& spo = dynamic_cast<const LCAOrbitalSet&>(twf_ptr->getSPOSet(check_sponame));
249  REQUIRE(spo.getOrbitalSetSize() == check_spo_size);
250  REQUIRE(spo.getBasisSetSize() == check_basisset_size);
251 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204

◆ test_Ne()

void qmcplusplus::test_Ne ( bool  transform)

Definition at line 465 of file test_MO.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), castCharToXMLChar(), CHECK(), OHMMS::Controller, SPOSetBuilderFactory::createSPOSetBuilder(), doc, Libxml2Document::getRoot(), Libxml2Document::getXPathContext(), ispecies, VirtualParticleSet::makeMoves(), okay, Libxml2Document::parse(), and REQUIRE().

Referenced by TEST_CASE().

466 {
467  std::ostringstream section_name;
468  section_name << "Neon, transform orbitals to grid: " << (transform ? "T" : "F");
469 
470  SECTION(section_name.str())
471  {
473 
474  const SimulationCell simulation_cell;
475  auto elec_ptr = std::make_unique<ParticleSet>(simulation_cell);
476  auto& elec(*elec_ptr);
477 
478  std::vector<int> agroup(2);
479  agroup[0] = 1;
480  agroup[1] = 1;
481  elec.setName("e");
482  elec.create(agroup);
483  elec.R[0] = 0.0;
484 
485  SpeciesSet& tspecies = elec.getSpeciesSet();
486  int upIdx = tspecies.addSpecies("u");
487  int downIdx = tspecies.addSpecies("d");
488  int massIdx = tspecies.addAttribute("mass");
489  tspecies(massIdx, upIdx) = 1.0;
490  tspecies(massIdx, downIdx) = 1.0;
491 
492  auto ions_ptr = std::make_unique<ParticleSet>(simulation_cell);
493  auto& ions(*ions_ptr);
494  ions.setName("ion0");
495  ions.create({1});
496  ions.R[0] = {0.0, 0.0, 0.0};
497  SpeciesSet& ispecies = ions.getSpeciesSet();
498  int heIdx = ispecies.addSpecies("Ne");
499  ions.update();
500 
501 
502  elec.addTable(ions);
503  elec.update();
504 
506  bool okay = doc.parse("ne_def2_svp.wfnoj.xml");
507  REQUIRE(okay);
508  xmlNodePtr root = doc.getRoot();
509 
510  WaveFunctionComponentBuilder::PSetMap particle_set_map;
511  particle_set_map.emplace(elec_ptr->getName(), std::move(elec_ptr));
512  particle_set_map.emplace(ions_ptr->getName(), std::move(ions_ptr));
513 
514  SPOSetBuilderFactory bf(c, elec, particle_set_map);
515 
516  OhmmsXPathObject MO_base("//determinantset", doc.getXPathContext());
517  REQUIRE(MO_base.size() == 1);
518 
519  if (!transform)
520  {
521  // input file is set to transform GTO's to numerical orbitals by default
522  // use direct evaluation of GTO's
523  xmlSetProp(MO_base[0], castCharToXMLChar("transform"), castCharToXMLChar("no"));
524  xmlSetProp(MO_base[0], castCharToXMLChar("key"), castCharToXMLChar("GTO"));
525  }
526 
527  const auto bb_ptr = bf.createSPOSetBuilder(MO_base[0]);
528  auto& bb(*bb_ptr);
529 
530  OhmmsXPathObject slater_base("//determinant", doc.getXPathContext());
531  auto sposet = bb.createSPOSet(slater_base[0]);
532 
533  //std::cout << "basis set size = " << sposet->getBasisSetSize() << std::endl;
534 
535  const int norbs = 5;
536  SPOSet::ValueVector values;
537  SPOSet::GradVector dpsi;
538  SPOSet::ValueVector d2psi;
539  values.resize(norbs);
540  dpsi.resize(norbs);
541  d2psi.resize(norbs);
542 
543  ParticleSet::SingleParticlePos newpos(0.00001, 0.0, 0.0);
544  elec.makeMove(0, newpos);
545 
546  sposet->evaluateValue(elec, 0, values);
547 
548  // Generated from gen_mo.py for position [1e-05, 0.0, 0.0]
549  CHECK(values[0] == Approx(-16.11819042));
550 
551  sposet->evaluateVGL(elec, 0, values, dpsi, d2psi);
552  // Generated from gen_mo.py for position [1e-05, 0.0, 0.0]
553  CHECK(values[0] == Approx(-16.11819042));
554  CHECK(dpsi[0][0] == Approx(0.1747261458));
555  CHECK(dpsi[0][1] == Approx(0));
556  CHECK(dpsi[0][2] == Approx(0));
557 
558 
559  ParticleSet::SingleParticlePos disp(1.0, 0.0, 0.0);
560  elec.makeMove(0, disp);
561  sposet->evaluateValue(elec, 0, values);
562  // Generated from gen_mo.py for position [1.0, 0.0, 0.0]
563  CHECK(values[0] == Approx(-0.005041631374));
564 
565 
566  sposet->evaluateVGL(elec, 0, values, dpsi, d2psi);
567  // Generated from gen_mo.py for position [1.0, 0.0, 0.0]
568  CHECK(values[0] == Approx(-0.005041631374));
569  CHECK(dpsi[0][0] == Approx(0.01862216578));
570  CHECK(dpsi[0][1] == Approx(0));
571  CHECK(dpsi[0][2] == Approx(0));
572  CHECK(d2psi[0] == Approx(-0.01551755818));
573 
574  // when a determinant only contains a single particle.
575  SPOSet::ValueVector phi(1), phiinv(1);
576  phiinv[0] = 100;
577  VirtualParticleSet VP(elec, 2);
578  std::vector<ParticleSet::SingleParticlePos> newpos2(2);
579  std::vector<SPOSet::ValueType> ratios2(2);
580  newpos2[0] = disp;
581  newpos2[1] = -disp;
582  VP.makeMoves(elec, 0, newpos2);
583  sposet->evaluateDetRatios(VP, phi, phiinv, ratios2);
584  CHECK(ratios2[0] == Approx(-0.504163137)); // values[0] * phiinv[0]
585  CHECK(ratios2[1] == Approx(-0.504163137)); // symmetric move
586  }
587 }
class that handles xmlDoc
Definition: Libxml2Doc.h:76
xmlXPathContextPtr getXPathContext()
Definition: Libxml2Doc.cpp:100
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
OrbitalSetTraits< ValueType >::ValueVector ValueVector
class to handle xmlXPathObject
Definition: Libxml2Doc.h:26
Wrapping information on parallelism.
Definition: Communicate.h:68
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
Definition: Libxml2Doc.cpp:180
xmlChar * castCharToXMLChar(char *c)
unsafe char* to xmlChar* cast
Definition: libxmldefs.h:70

◆ test_one_gemm()

void qmcplusplus::test_one_gemm ( const int  M,
const int  N,
const int  K,
const char  transa,
const char  transb 
)

Definition at line 23 of file test_AccelBLAS.cpp.

References qmcplusplus::Units::distance::A, B(), qmcplusplus::Units::charge::C, CHECK(), Vector< T, Alloc >::device_data(), qmcplusplus::compute::BLAS::gemm(), BLAS::gemm(), qmcplusplus::compute::BLAS::gemm_batched(), imag(), qmcplusplus::Units::energy::K, qmcplusplus::Units::force::N, queue, and Vector< T, Alloc >::updateTo().

24 {
25  const int a0 = transa == 'T' ? M : K;
26  const int a1 = transa == 'T' ? K : M;
27 
28  const int b0 = transb == 'T' ? K : N;
29  const int b1 = transb == 'T' ? N : K;
30 
31  using vec_t = Vector<T, PinnedDualAllocator<T>>;
32  using mat_t = Matrix<T, PinnedDualAllocator<T>>;
33 
34  mat_t A(a0, a1); // Input matrix
35  mat_t B(b0, b1); // Input matrix
36  mat_t C(N, M); // Result matrix AccelBLAS
37  mat_t D(N, M); // Result matrix BLAS
38 
39  // Fill data
40  for (int j = 0; j < a0; j++)
41  for (int i = 0; i < a1; i++)
42  A[j][i] = i * 3 + j * 4;
43 
44  for (int j = 0; j < b0; j++)
45  for (int i = 0; i < b1; i++)
46  B[j][i] = i * 4 + j * 5;
47 
48  A.updateTo();
49  B.updateTo();
50  C.updateTo();
51 
52  T alpha(1);
53  T beta(0);
54 
55  // U[X,Y] denotes a row-major matrix U with X rows and Y cols
56  // element U(i,j) is located at: U.data() + sizeof(U_type) * (i*ldU + j)
57  //
58  // A,B,C,D are treated as row-major matrices, but the arguments to gemm are treated as col-major
59  // so the call below to AccelBLAS::gemm is equivalent to one of the following (with row-major matrices)
60  // transa/transb == 'N'/'N': C[N,M] = A[K,M] * B[N,K]; C = B * A
61  // transa/transb == 'N'/'T': C[N,M] = A[K,M] * B[K,N]; C = B^t * A
62  // transa/transb == 'T'/'N': C[N,M] = A[M,K] * B[N,K]; C = B * A^t
63  // transa/transb == 'T'/'T': C[N,M] = A[M,K] * B[K,N]; C = B^t * A^t
64 
65  compute::Queue<PL> queue;
66  compute::BLASHandle<PL> h_blas(queue);
67  compute::BLAS::gemm(h_blas, transa, transb, M, N, K, alpha, A.device_data(), a1, B.device_data(), b1, beta,
68  C.device_data(), M);
69  queue.sync();
70 
71  C.updateFrom();
72 
73  BLAS::gemm(transa, transb, M, N, K, alpha, A.data(), a1, B.data(), b1, beta, D.data(), M);
74 
75  for (int j = 0; j < N; j++)
76  for (int i = 0; i < M; i++)
77  {
78  CHECK(std::real(C[j][i]) == Approx(std::real(D[j][i])));
79  CHECK(std::imag(C[j][i]) == Approx(std::imag(D[j][i])));
80  }
81 
82  mat_t A2(a0, a1); // Input matrix
83  mat_t B2(b0, b1); // Input matrix
84  mat_t C2(N, M); // Result matrix AccelBLAS
85  mat_t D2(N, M); // Result matrix BLAS
86 
87  // Fill data
88  for (int j = 0; j < a0; j++)
89  for (int i = 0; i < a1; i++)
90  A2[j][i] = j * 3 + i * 4;
91 
92  for (int j = 0; j < b0; j++)
93  for (int i = 0; i < b1; i++)
94  B2[j][i] = j * 4 + i * 5;
95 
96  A2.updateTo();
97  B2.updateTo();
98 
99  Vector<const T*, PinnedDualAllocator<const T*>> Aarr(2), Barr(2);
100  Vector<T*, PinnedDualAllocator<T*>> Carr(2);
101 
102  Aarr[0] = A2.device_data();
103  Aarr[1] = A.device_data();
104  Barr[0] = B2.device_data();
105  Barr[1] = B.device_data();
106 
107  Carr[0] = C.device_data();
108  Carr[1] = C2.device_data();
109 
110  Aarr.updateTo();
111  Barr.updateTo();
112  Carr.updateTo();
113 
114  compute::BLAS::gemm_batched(h_blas, transa, transb, M, N, K, alpha, Aarr.device_data(), a1, Barr.device_data(), b1,
115  beta, Carr.device_data(), M, 2);
116  queue.sync();
117 
118  C.updateFrom();
119  C2.updateFrom();
120 
121  BLAS::gemm(transa, transb, M, N, K, alpha, A2.data(), a1, B2.data(), b1, beta, D2.data(), M);
122 
123  for (int j = 0; j < N; j++)
124  for (int i = 0; i < M; i++)
125  {
126  CHECK(std::real(C2[j][i]) == Approx(std::real(D[j][i])));
127  CHECK(std::imag(C2[j][i]) == Approx(std::imag(D[j][i])));
128  }
129 
130  for (int j = 0; j < N; j++)
131  for (int i = 0; i < M; i++)
132  {
133  CHECK(std::real(C[j][i]) == Approx(std::real(D2[j][i])));
134  CHECK(std::imag(C[j][i]) == Approx(std::imag(D2[j][i])));
135  }
136 }
TinyVector< double, 3 > vec_t
QMCTraits::RealType real
float imag(const float &c)
imaginary part of a scalar. Cannot be replaced by std::imag due to AFQMC specific needs...
void gemm_batched(BLASHandle< PlatformKind::CUDA > &handle, const char transa, const char transb, int m, int n, int k, const float &alpha, const float *const A[], int lda, const float *const B[], int ldb, const float &beta, float *const C[], int ldc, int batchCount)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
static void gemm(char Atrans, char Btrans, int M, int N, int K, double alpha, const double *A, int lda, const double *restrict B, int ldb, double beta, double *restrict C, int ldc)
Definition: BLAS.hpp:235
double B(double x, int k, int i, const std::vector< double > &t)

◆ test_one_gemv()

void qmcplusplus::test_one_gemv ( const int  M_b,
const int  N_b,
const char  trans 
)

Definition at line 177 of file test_AccelBLAS.cpp.

References qmcplusplus::Units::distance::A, B(), qmcplusplus::Units::charge::C, CHECK(), TinyVector< T, D >::data(), Vector< T, Alloc >::device_data(), BLAS::gemv(), qmcplusplus::compute::BLAS::gemv(), qmcplusplus::compute::BLAS::gemv_batched(), BLAS::gemv_trans(), qmcplusplus::Units::force::N, queue, and Vector< T, Alloc >::updateTo().

178 {
179  const int M = trans == 'T' ? M_b : N_b;
180  const int N = trans == 'T' ? N_b : M_b;
181 
182  using vec_t = Vector<T, PinnedDualAllocator<T>>;
183  using mat_t = Matrix<T, PinnedDualAllocator<T>>;
184 
185  vec_t A(N); // Input vector
186  mat_t B(M_b, N_b); // Input matrix
187  vec_t C(M); // Result vector AccelBLAS
188  vec_t D(M); // Result vector BLAS
189 
190  // Fill data
191  for (int i = 0; i < N; i++)
192  A[i] = i;
193 
194  for (int j = 0; j < M_b; j++)
195  for (int i = 0; i < N_b; i++)
196  B[j][i] = i + j * 2;
197 
198  // Fill C and D with 0
199  for (int i = 0; i < M; i++)
200  C[i] = D[i] = T(0);
201 
202  A.updateTo();
203  B.updateTo();
204  C.updateTo();
205 
206  T alpha(0.5);
207  T beta(0);
208 
209  compute::Queue<PL> queue;
210  compute::BLASHandle<PL> h_blas(queue);
211  // in Fortran, B[M][N] is viewed as B^T
212  // when trans == 'T', the actual calculation is B * A[N] = C[M]
213  // when trans == 'N', the actual calculation is B^T * A[M] = C[N]
214  compute::BLAS::gemv(h_blas, trans, N_b, M_b, alpha, B.device_data(), N_b, A.device_data(), 1, beta, C.device_data(),
215  1);
216  queue.sync();
217 
218  C.updateFrom();
219 
220  if (trans == 'T')
221  BLAS::gemv_trans(M_b, N_b, B.data(), A.data(), D.data());
222  else
223  BLAS::gemv(M_b, N_b, B.data(), A.data(), D.data());
224 
225  for (int index = 0; index < M; index++)
226  CHECK(C[index] == D[index] * alpha);
227 
228  vec_t A2(N); // Input vector
229  mat_t B2(M_b, N_b); // Input matrix
230  vec_t C2(M); // Result vector AccelBLAS
231  vec_t D2(M); // Result vector BLAS
232 
233  // Fill data
234  for (int i = 0; i < N; i++)
235  A2[i] = i + 1;
236 
237  for (int j = 0; j < M_b; j++)
238  for (int i = 0; i < N_b; i++)
239  B2[j][i] = i * 2 + j;
240 
241  // Fill C and D with 0
242  for (int i = 0; i < M; i++)
243  C2[i] = D2[i] = T(0);
244 
245  A2.updateTo();
246  B2.updateTo();
247  C2.updateTo();
248 
249  Vector<const T*, PinnedDualAllocator<const T*>> Aarr(2), Barr(2);
250  Vector<T*, PinnedDualAllocator<T*>> Carr(2);
251  Vector<T, PinnedDualAllocator<T>> alpha_arr(2), beta_arr(2);
252 
253  Aarr[0] = A2.device_data();
254  Aarr[1] = A.device_data();
255  Barr[0] = B2.device_data();
256  Barr[1] = B.device_data();
257 
258  Carr[0] = C2.device_data();
259  Carr[1] = C.device_data();
260 
261  alpha_arr[0] = 2;
262  alpha_arr[1] = 0.5;
263  beta_arr[0] = 0;
264  beta_arr[1] = 1;
265 
266  Aarr.updateTo();
267  Barr.updateTo();
268  Carr.updateTo();
269  alpha_arr.updateTo();
270  beta_arr.updateTo();
271 
272  // in Fortran, B[M][N] is viewed as B^T
273  // when trans == 'T', the actual calculation is B * A[N] = C[M]
274  // when trans == 'N', the actual calculation is B^T * A[M] = C[N]
275  compute::BLAS::gemv_batched(h_blas, trans, N_b, M_b, alpha_arr.device_data(), Barr.device_data(), N_b,
276  Aarr.device_data(), 1, beta_arr.device_data(), Carr.device_data(), 1, 2);
277  queue.sync();
278 
279  C.updateFrom();
280  C2.updateFrom();
281 
282  if (trans == 'T')
283  BLAS::gemv_trans(M_b, N_b, B2.data(), A2.data(), D2.data());
284  else
285  BLAS::gemv(M_b, N_b, B2.data(), A2.data(), D2.data());
286 
287  for (int index = 0; index < M; index++)
288  {
289  CHECK(C[index] == D[index]);
290  CHECK(C2[index] == D2[index] * alpha_arr[0]);
291  }
292 }
static void gemv_trans(int n, int m, const double *restrict amat, const double *restrict x, double *restrict y)
Definition: BLAS.hpp:147
TinyVector< double, 3 > vec_t
static void gemv(int n, int m, const double *restrict amat, const double *restrict x, double *restrict y)
Definition: BLAS.hpp:118
void gemv_batched(BLASHandle< PlatformKind::CUDA > &handle, const char trans, const int m, const int n, const T *alpha, const T *const A[], const int lda, const T *const x[], const int incx, const T *beta, T *const y[], const int incy, const int batch_count)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
double B(double x, int k, int i, const std::vector< double > &t)

◆ test_one_ger()

void qmcplusplus::test_one_ger ( const int  M,
const int  N 
)

Definition at line 317 of file test_AccelBLAS.cpp.

References CHECK(), TinyVector< T, D >::data(), Vector< T, Alloc >::device_data(), qmcplusplus::compute::BLAS::ger(), BLAS::ger(), qmcplusplus::compute::BLAS::ger_batched(), qmcplusplus::Units::force::N, queue, and Vector< T, Alloc >::updateTo().

318 {
319  using vec_t = Vector<T, PinnedDualAllocator<T>>;
320  using mat_t = Matrix<T, PinnedDualAllocator<T>>;
321 
322  mat_t Ah(M, N); // Input matrix
323  mat_t Ad(M, N); // Input matrix
324  vec_t x(M); // Input vector
325  vec_t y(N); // Input vector
326 
327  // Fill data
328  for (int i = 0; i < M; i++)
329  x[i] = i;
330  for (int i = 0; i < N; i++)
331  y[i] = N - i;
332 
333  for (int j = 0; j < M; j++)
334  for (int i = 0; i < N; i++)
335  {
336  Ah[j][i] = i + j * 2;
337  Ad[j][i] = i + j * 2;
338  }
339 
340  Ad.updateTo();
341  x.updateTo();
342  y.updateTo();
343 
344  T alpha(0.5);
345 
346  compute::Queue<PL> queue;
347  compute::BLASHandle<PL> h_blas(queue);
348  // in Fortran, B[M][N] is viewed as B^T
349  compute::BLAS::ger(h_blas, M, N, alpha, x.device_data(), 1, y.device_data(), 1, Ad.device_data(), M);
350  queue.sync();
351  Ad.updateFrom();
352 
353  BLAS::ger(M, N, alpha, x.data(), 1, y.data(), 1, Ah.data(), M);
354 
355  for (int j = 0; j < M; j++)
356  for (int i = 0; i < N; i++)
357  CHECK(Ah[j][i] == Ad[j][i]);
358 
359  mat_t Ah2(M, N); // Input matrix
360  mat_t Ad2(M, N); // Input matrix
361  vec_t x2(M); // Input vector
362  vec_t y2(N); // Input vector
363 
364  // Fill data
365  for (int i = 0; i < M; i++)
366  x2[i] = i - 1;
367  for (int i = 0; i < N; i++)
368  y2[i] = N + i;
369 
370  for (int j = 0; j < M; j++)
371  for (int i = 0; i < N; i++)
372  {
373  Ah2[j][i] = j + i * 2;
374  Ad2[j][i] = j + i * 2;
375  }
376 
377  Ad2.updateTo();
378  x2.updateTo();
379  y2.updateTo();
380 
381  Vector<T*, PinnedDualAllocator<T*>> Aarr(2);
382  Vector<const T*, PinnedDualAllocator<const T*>> Xarr(2), Yarr(2);
383  Vector<T, PinnedDualAllocator<T>> alpha_arr(2);
384 
385  Aarr[0] = Ad2.device_data();
386  Aarr[1] = Ad.device_data();
387  Xarr[0] = x2.device_data();
388  Xarr[1] = x.device_data();
389  Yarr[0] = y2.device_data();
390  Yarr[1] = y.device_data();
391 
392  alpha_arr[0] = 2;
393  alpha_arr[1] = 0.5;
394 
395  Aarr.updateTo();
396  Xarr.updateTo();
397  Yarr.updateTo();
398  alpha_arr.updateTo();
399 
400  // in Fortran, B[M][N] is viewed as B^T
401  compute::BLAS::ger_batched(h_blas, M, N, alpha_arr.device_data(), Xarr.device_data(), 1, Yarr.device_data(), 1,
402  Aarr.device_data(), M, 2);
403  queue.sync();
404  Ad.updateFrom();
405  Ad2.updateFrom();
406 
407  BLAS::ger(M, N, alpha_arr[1], x.data(), 1, y.data(), 1, Ah.data(), M);
408  BLAS::ger(M, N, alpha_arr[0], x2.data(), 1, y2.data(), 1, Ah2.data(), M);
409 
410  for (int j = 0; j < M; j++)
411  for (int i = 0; i < N; i++)
412  {
413  CHECK(Ah[j][i] == Ad[j][i]);
414  CHECK(Ah2[j][i] == Ad2[j][i]);
415  }
416 }
TinyVector< double, 3 > vec_t
static void ger(int m, int n, double alpha, const double *x, int incx, const double *y, int incy, double *a, int lda)
Definition: BLAS.hpp:437
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void ger_batched(BLASHandle< PlatformKind::CUDA > &handle, const int m, const int n, const T *alpha, const T *const x[], const int incx, const T *const y[], const int incy, T *const A[], const int lda, const int batch_count)

◆ test_real_accumulator()

void qmcplusplus::test_real_accumulator ( )

Definition at line 59 of file test_accumulator.cpp.

References CHECK(), accumulator_set< T, typename >::count(), accumulator_set< T, typename >::mean(), mean(), accumulator_set< T, typename >::mean2(), accumulator_set< T, typename >::mean_and_variance(), accumulator_set< T, typename >::result(), accumulator_set< T, typename >::result2(), and accumulator_set< T, typename >::variance().

60 {
62  a(2.0);
63  a(3.1);
64  a(-1.1);
65  a(4.8);
66  CHECK(a.count() == Approx(4.0));
67 
68  CHECK(a.result() == Approx(8.8));
69  CHECK(a.result2() == Approx(37.86));
70  CHECK(a.mean() == Approx(2.2));
71  CHECK(a.mean2() == Approx(9.465));
72  CHECK(a.variance() == Approx(4.625));
73 
74  std::pair<T, T> mv = a.mean_and_variance();
75  CHECK(mv.first == Approx(a.mean()));
76  CHECK(mv.second == Approx(a.variance()));
77 
78  CHECK(mean(a) == Approx(a.mean()));
79 
80  // check that this doesn't crash
81  std::stringstream o;
82  o << a;
83 }
std::pair< return_type, return_type > mean_and_variance() const
Definition: accumulators.h:118
return_type mean2() const
return the mean of squared values
Definition: accumulators.h:129
generic accumulator of a scalar type
Definition: accumulators.h:32
return_type mean() const
return the mean
Definition: accumulators.h:126
return_type result() const
return the sum
Definition: accumulators.h:108
return_type result2() const
return the sum of value squared
Definition: accumulators.h:111
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
return_type count() const
return the count
Definition: accumulators.h:116
return_type variance() const
Definition: accumulators.h:131
ACC::value_type mean(const ACC &ac)
Definition: accumulators.h:147

◆ test_real_accumulator_basic()

void qmcplusplus::test_real_accumulator_basic ( )

Definition at line 26 of file test_accumulator.cpp.

References accumulator_set< T, typename >::bad(), CHECK(), accumulator_set< T, typename >::count(), accumulator_set< T, typename >::good(), accumulator_set< T, typename >::mean(), accumulator_set< T, typename >::mean2(), REQUIRE(), and accumulator_set< T, typename >::variance().

27 {
28  //std::cout << "int eps = " << std::numeric_limits<T>::epsilon() << std::endl;
29  //std::cout << "int max = " << std::numeric_limits<T::max() << std::endl;
31  REQUIRE(a1.count() == 0);
32  REQUIRE(a1.good() == false);
33  REQUIRE(a1.bad() == true);
34  CHECK(a1.mean() == Approx(0.0));
35  CHECK(a1.mean2() == Approx(0.0));
36  CHECK(a1.variance() == Approx(std::numeric_limits<T>::max()));
37 
38  a1(2.0);
39  REQUIRE(a1.count() == 1);
40  REQUIRE(a1.good() == true);
41  REQUIRE(a1.bad() == false);
42  CHECK(a1.result() == Approx(2.0));
43  CHECK(a1.result2() == Approx(4.0));
44  CHECK(a1.mean() == Approx(2.0));
45  CHECK(a1.mean2() == Approx(4.0));
46  CHECK(a1.variance() == Approx(0.0));
47 
48  a1.clear();
49  REQUIRE(a1.count() == 0);
50  CHECK(a1.result() == Approx(0.0));
51  CHECK(a1.result2() == Approx(0.0));
52 }
return_type mean2() const
return the mean of squared values
Definition: accumulators.h:129
bool good() const
return true if Weight!= 0
Definition: accumulators.h:103
bool bad() const
return true if Weight== 0
Definition: accumulators.h:105
generic accumulator of a scalar type
Definition: accumulators.h:32
REQUIRE(std::filesystem::exists(filename))
return_type mean() const
return the mean
Definition: accumulators.h:126
return_type result() const
return the sum
Definition: accumulators.h:108
return_type result2() const
return the sum of value squared
Definition: accumulators.h:111
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
return_type count() const
return the count
Definition: accumulators.h:116
return_type variance() const
Definition: accumulators.h:131

◆ test_real_accumulator_weights()

void qmcplusplus::test_real_accumulator_weights ( )

Definition at line 90 of file test_accumulator.cpp.

References CHECK(), accumulator_set< T, typename >::count(), accumulator_set< T, typename >::mean(), accumulator_set< T, typename >::mean2(), accumulator_set< T, typename >::mean_and_variance(), accumulator_set< T, typename >::result(), accumulator_set< T, typename >::result2(), and accumulator_set< T, typename >::variance().

91 {
93  a(2.0, 1.0);
94  a(3.1, 2.4);
95  a(-1.1, 2.1);
96  a(4.8, 3.3);
97  CHECK(a.count() == Approx(8.8));
98 
99  CHECK(a.result() == Approx(22.97));
100  CHECK(a.result2() == Approx(105.637));
101  CHECK(a.mean() == Approx(2.6102272727));
102  CHECK(a.mean2() == Approx(12.004204545));
103  CHECK(a.variance() == Approx(5.1909181302));
104 
105  std::pair<T, T> mv = a.mean_and_variance();
106  CHECK(mv.first == Approx(a.mean()));
107  CHECK(mv.second == Approx(a.variance()));
108 }
std::pair< return_type, return_type > mean_and_variance() const
Definition: accumulators.h:118
return_type mean2() const
return the mean of squared values
Definition: accumulators.h:129
generic accumulator of a scalar type
Definition: accumulators.h:32
return_type mean() const
return the mean
Definition: accumulators.h:126
return_type result() const
return the sum
Definition: accumulators.h:108
return_type result2() const
return the sum of value squared
Definition: accumulators.h:111
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
return_type count() const
return the count
Definition: accumulators.h:116
return_type variance() const
Definition: accumulators.h:131

◆ test_spline_bounds()

void qmcplusplus::test_spline_bounds ( )

Definition at line 19 of file test_SplineBound.cpp.

References CHECK(), getSplineBound(), and REQUIRE().

20 {
21  T x = 2.2;
22  T dx;
23  int ind;
24  int ng = 10;
25  getSplineBound(x, ng, ind, dx);
26  CHECK(dx == Approx(0.2));
27  REQUIRE(ind == 2);
28 
29  // check clamping to a maximum index value
30  x = 10.5;
31  getSplineBound(x, ng, ind, dx);
32  CHECK(dx == Approx(0.5));
33  REQUIRE(ind == 10);
34 
35  x = 11.5;
36  getSplineBound(x, ng, ind, dx);
37  CHECK(dx == Approx(1.0));
38  REQUIRE(ind == 10);
39 
40  // check clamping to a zero index value
41  x = -1.3;
42  getSplineBound(x, ng, ind, dx);
43  CHECK(dx == Approx(0.0));
44  REQUIRE(ind == 0);
45 }
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void getSplineBound(const T x, const int nmax, int &ind, TRESIDUAL &dx)
break x into the integer part and residual part and apply bounds
Definition: SplineBound.hpp:37

◆ test_tiny_vector()

void qmcplusplus::test_tiny_vector ( )

Definition at line 28 of file test_TinyVector.cpp.

References CHECK(), dot(), and REQUIRE().

29 {
31 
32  vec_t v1;
33  // default constructor sets elements to zero
34  for (int i = 0; i < D; i++)
35  {
36  CHECK(v1[i] == Approx(0.0));
37  }
38 
39  vec_t v2(1.0);
40  // single constructor sets all the elements to that value
41  for (int i = 0; i < D; i++)
42  {
43  CHECK(v2[i] == Approx(1.0));
44  }
45 
46  // TODO: add optional bounds checks to element access methods
47  vec_t v4;
48  double sum = 0;
49  for (int i = 0; i < D; i++)
50  {
51  sum += 1.0 * i;
52  v4[i] = 1.0 * i;
53  }
54 
55  // Dot product
56  double dotp = dot(v2, v4);
57  CHECK(sum == Approx(dotp));
58 
59  // Multiply add
60  v1 += 2.0 * v4;
61  REQUIRE(2.0 * sum == dot(v2, v1));
62 }
T dot(T *a, T *b)
TinyVector< double, 3 > vec_t
REQUIRE(std::filesystem::exists(filename))
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ test_tiny_vector_size_two()

void qmcplusplus::test_tiny_vector_size_two ( )

Definition at line 65 of file test_TinyVector.cpp.

References CHECK().

66 {
68  vec_t v3(1.0, 2.0);
69  CHECK(v3[0] == Approx(1.0));
70  CHECK(v3[1] == Approx(2.0));
71  // problem: elements past those explicitly set are undefined
72  // in this case, vectors with D > 2 will have undefined elements.
73 }
TinyVector< double, 3 > vec_t
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

◆ testCopyConstructor()

sdnt qmcplusplus::testCopyConstructor ( sdn  )

◆ testDualAllocator()

void qmcplusplus::testDualAllocator ( )

Definition at line 40 of file test_dual_allocators_ohmms_containers.cpp.

References CHECK(), check_matrix_result, CHECKED_ELSE(), checkMatrix(), qmcplusplus::syclBLAS::copy_n(), VectorSoaContainer< T, D, Alloc >::copyDeviceDataByIndex(), Matrix< T, Alloc >::data(), VectorSoaContainer< T, D, Alloc >::data(), Matrix< T, Alloc >::device_data(), VectorSoaContainer< T, D, Alloc >::device_data(), qmcplusplus::testing::makeRngSpdMatrix(), n, Array< T, D, ALLOC >::resize(), Matrix< T, Alloc >::resize(), VectorSoaContainer< T, D, Alloc >::resize(), Array< T, D, ALLOC >::size(), VectorSoaContainer< T, D, Alloc >::updateFrom(), and VectorSoaContainer< T, D, Alloc >::updateTo().

41 {
42  constexpr int nd = 3;
43  using Value = typename OPA::value_type;
44  VectorSoaContainer<Value, nd, OPA> vcsoa;
45 
46  int n = 12;
47  Matrix<Value> mat_spd;
48  mat_spd.resize(n, n);
49  // Resize so each "dimension" can hold an n x n matrix
50  vcsoa.resize(n * n);
51 
52  testing::MakeRngSpdMatrix<Value> makeRngSpdMatrix;
53 
54  for (int iw = 0; iw < nd; ++iw)
55  {
56  makeRngSpdMatrix(mat_spd);
57  std::copy_n(mat_spd.data(), n * n, vcsoa.data(iw));
58  }
59 
60  vcsoa.updateTo();
61 
62  Matrix<Value, OPA> matrix_view(vcsoa, vcsoa.data(0), n, n);
63  Matrix<Value, OPA> matrix_view2(vcsoa, vcsoa.data(1), n, n);
64  Matrix<Value, OPA> matrix_view3(vcsoa, vcsoa.data(2), n, n);
65 
66 
67  // Without copying allocator this causes a segfault.
68  auto device_ptr = matrix_view.device_data();
69  auto device_ptr2 = matrix_view2.device_data();
70  auto device_ptr3 = matrix_view3.device_data();
71 
72  CHECK(device_ptr != nullptr);
73  CHECK(device_ptr2 != nullptr);
74  CHECK(device_ptr3 != nullptr);
75 
76  std::ptrdiff_t distance_host = matrix_view.data() - vcsoa.data();
77  std::ptrdiff_t distance_device = matrix_view.device_data() - vcsoa.device_data();
78  CHECK(distance_host == distance_device);
79 
80  distance_host = matrix_view2.data() - vcsoa.data();
81  distance_device = matrix_view2.device_data() - vcsoa.device_data();
82  CHECK(distance_host == distance_device);
83 
84  distance_host = matrix_view3.data() - vcsoa.data();
85  distance_device = matrix_view3.device_data() - vcsoa.device_data();
86  CHECK(distance_host == distance_device);
87 
88  int ifrom = 2;
89  int ito = 0;
90 
91  vcsoa.copyDeviceDataByIndex(0, 2);
92  vcsoa.updateFrom();
93 
94  auto check_matrix_result = checkMatrix(mat_spd, matrix_view);
95  CHECKED_ELSE(check_matrix_result.result) { FAIL(check_matrix_result.result_message); }
96 
97  matrix_view2(0, 0) = 0.0;
98  matrix_view2(1, 0) = 1.0;
99 
100  matrix_view2.updateTo();
101  vcsoa.copyDeviceDataByIndex(0, 1);
102  matrix_view(0, 1) = 3.0;
103  matrix_view.updateTo(1, 1);
104  matrix_view.updateFrom();
105  CHECK(matrix_view(0, 0) == 0.0);
106  CHECK(matrix_view(0, 1) == 3.0);
107  CHECK(matrix_view(1, 0) == 1.0);
108 
110  aa.resize(2, 2, 3);
111  CHECK(aa.size() == 12);
112 }
CHECKED_ELSE(check_matrix_result.result)
auto check_matrix_result
void resize(const std::array< SIZET, D > &dims)
Resize the container.
Definition: OhmmsArray.h:65
void makeRngSpdMatrix(testing::RandomForTest< RngValueType< T >> &rng, Matrix< T > &mat_spd)
size_t size() const
Definition: OhmmsArray.h:57
sycl::event copy_n(sycl::queue &aq, const T1 *restrict VA, size_t array_size, T2 *restrict VC, const std::vector< sycl::event > &events)
Definition: syclBLAS.cpp:548
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
Definition: checkMatrix.hpp:63
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
A D-dimensional Array class based on PETE.
Definition: OhmmsArray.h:25
QMCTraits::FullPrecRealType value_type

◆ testElecCase()

void qmcplusplus::testElecCase ( double  mass_up,
double  mass_dn 
)

Provide a test scope parameterized on electron species mass that then can run a set of tests using its objects.

I couldn't see a easier solution to deal with all the setup to get both coverage of this interesting feature considering various approaches to copy constructors the objects in the testing scope take.

Definition at line 230 of file test_bare_kinetic.cpp.

References SpeciesSet::addAttribute(), SpeciesSet::addSpecies(), ParticleSet::addTable(), ParticleSet::create(), BareKineticEnergy::createResource(), ParticleSet::createResource(), qmcplusplus::testing::getParticularListener(), ParticleSet::getSpeciesSet(), ParticleSet::L, ParticleSet::R, ParticleSet::setName(), and ParticleSet::update().

Referenced by TEST_CASE().

238 {
240 
241  const SimulationCell simulation_cell;
242 
243  ParticleSet ions(simulation_cell);
244 
245  ions.setName("ion");
246  ions.create({1});
247  ions.R[0] = {0.0, 0.0, 0.0};
248  Matrix<Real> kinetic_energies(2);
249 
250  ParticleSet elec(simulation_cell);
251 
252  elec.setName("elec");
253  elec.create({1, 1});
254  elec.R[0] = {0.0, 1.0, 0.0};
255  elec.R[1] = {1.0, 1.0, 0.0};
256  SpeciesSet& tspecies = elec.getSpeciesSet();
257  int upIdx = tspecies.addSpecies("u");
258  int downIdx = tspecies.addSpecies("d");
259  int chargeIdx = tspecies.addAttribute("charge");
260  int massIdx = tspecies.addAttribute("mass");
261  tspecies(chargeIdx, upIdx) = -1;
262  tspecies(chargeIdx, downIdx) = -1;
263  tspecies(massIdx, upIdx) = mass_up;
264  tspecies(massIdx, downIdx) = mass_dn;
265 
266  elec.addTable(ions);
267  elec.update();
268 
269  ParticleSet elec2(elec);
270  elec2.R[1][2] = 1.0;
271  elec2.update();
272 
273  RuntimeOptions runtime_options;
274  TrialWaveFunction psi(runtime_options);
275  TrialWaveFunction psi_clone(runtime_options);
276 
277  RefVector<ParticleSet> ptcls{elec, elec2};
278  RefVectorWithLeader<ParticleSet> p_list(elec, ptcls);
279 
280  BareKineticEnergy bare_ke(elec, psi);
281  BareKineticEnergy bare_ke2(elec, psi_clone);
282 
283  RefVector<OperatorBase> bare_kes{bare_ke, bare_ke2};
284  RefVectorWithLeader<OperatorBase> o_list(bare_ke, bare_kes);
285  elec.L[0] = 1.0;
286  elec.L[1] = 0.0;
287  elec2.L[0] = 1.0;
288  elec2.L[1] = 0.0;
289 
290  RefVectorWithLeader<TrialWaveFunction> twf_list(psi, {psi, psi_clone});
291 
292  ResourceCollection bare_ke_res("test_bare_ke_res");
293  bare_ke.createResource(bare_ke_res);
294  ResourceCollectionTeamLock<OperatorBase> bare_ke_lock(bare_ke_res, o_list);
295 
296  ResourceCollection pset_res("test_pset_res");
297  elec.createResource(pset_res);
298  ResourceCollectionTeamLock<ParticleSet> pset_lock(pset_res, p_list);
299 
300  std::vector<ListenerVector<Real>> listeners;
301  listeners.emplace_back("kinetic", getParticularListener(kinetic_energies));
302 
303  std::vector<ListenerVector<Real>> ion_listeners;
304 
305  tests(o_list, twf_list, p_list, kinetic_energies, listeners, ion_listeners);
306 }
auto getParticularListener(Matrix< T > &local_pots)

◆ testMakeBlockAverages()

embt qmcplusplus::testMakeBlockAverages ( )

◆ testReduceOperatorEstimators()

embt qmcplusplus::testReduceOperatorEstimators ( )

◆ TestTask()

void qmcplusplus::TestTask ( const int  ip,
std::atomic< int > &  counter 
)

Definition at line 22 of file test_ParallelExecutorSTD.cpp.

Referenced by TEST_CASE().

22 { ++counter; }

◆ TestTaskOMP()

void qmcplusplus::TestTaskOMP ( const int  ip,
int &  counter 
)

Openmp generally works but is not guaranteed with std::atomic.

Definition at line 20 of file test_ParallelExecutorOPENMP.cpp.

Referenced by TEST_CASE().

21 {
22 #pragma omp atomic update
23  counter++;
24 }

◆ testTrialWaveFunction_diamondC_2x1x1()

void qmcplusplus::testTrialWaveFunction_diamondC_2x1x1 ( const int  ndelay,
const OffloadSwitches offload_switches 
)

Templated test of TrialWF with different DiracDet flavors.

Definition at line 51 of file test_TrialWaveFunction_diamondC_2x1x1.cpp.

References TrialWaveFunction::acceptMove(), SpeciesSet::addAttribute(), TrialWaveFunction::addComponent(), ParticleSetPool::addParticleSet(), SpeciesSet::addSpecies(), ParticleSet::addTable(), app_log(), RadialJastrowBuilder::buildComponent(), TrialWaveFunction::calcRatio(), CHECK(), OHMMS::Controller, ParticleSet::create(), TrialWaveFunction::createResource(), ParticleSet::createSK(), EinsplineSetBuilder::createSPOSetFromXML(), DC_POS, DC_POS_OFFLOAD, doc, qmcplusplus::Units::charge::e, TrialWaveFunction::evaluateGL(), TrialWaveFunction::evaluateLog(), TrialWaveFunction::FERMIONIC, ParticleSet::getDistTableAB(), TrialWaveFunction::getLogPsi(), TrialWaveFunction::getPhase(), ParticleSetPool::getPool(), Libxml2Document::getRoot(), ParticleSetPool::getSimulationCell(), ParticleSet::getSpeciesSet(), TWFGrads< CoordsType::POS >::grads_positions, OffloadSwitches::jas, lattice, log_values(), TrialWaveFunction::makeClone(), ParticleSet::mw_accept_rejectMove(), TrialWaveFunction::mw_accept_rejectMove(), TrialWaveFunction::mw_calcRatio(), TrialWaveFunction::mw_calcRatioGrad(), TrialWaveFunction::mw_completeUpdates(), TrialWaveFunction::mw_evalGrad(), TrialWaveFunction::mw_evaluateGL(), TrialWaveFunction::mw_evaluateLog(), TrialWaveFunction::mw_evaluateRatios(), ParticleSet::mw_makeMove(), VirtualParticleSet::mw_makeMoves(), ParticleSet::mw_update(), TrialWaveFunction::NONFERMIONIC, okay, Libxml2Document::parseFromString(), ParticleSet::R, REQUIRE(), ParticleSet::resetGroups(), ParticleSet::setName(), ParticleSetPool::setSimulationCell(), OffloadSwitches::spo, and ParticleSet::update().

52 {
53 #if defined(MIXED_PRECISION)
54  const double grad_precision = 1.3e-4;
55  const double ratio_precision = 2e-4;
56 #else
57  const double grad_precision = std::is_same<SPO_precision, float_tag>::value ? 1.3e-4 : 1e-8;
58  const double ratio_precision = std::is_same<SPO_precision, float_tag>::value ? 2e-4 : 1e-5;
59 #endif
61 
62  const DynamicCoordinateKind kind_selected =
63  offload_switches.jas ? DynamicCoordinateKind::DC_POS_OFFLOAD : DynamicCoordinateKind::DC_POS;
64 
65  // diamondC_2x1x1
66  ParticleSet::ParticleLayout lattice;
67  lattice.R = {6.7463223, 6.7463223, 0.0, 0.0, 3.37316115, 3.37316115, 3.37316115, 0.0, 3.37316115};
68  lattice.BoxBConds = {1, 1, 1};
69  lattice.reset();
70 
71  ParticleSetPool ptcl = ParticleSetPool(c);
72  ptcl.setSimulationCell(lattice);
73  auto ions_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell(), kind_selected);
74  auto elec_uptr = std::make_unique<ParticleSet>(ptcl.getSimulationCell(), kind_selected);
75  ParticleSet& ions_(*ions_uptr);
76  ParticleSet& elec_(*elec_uptr);
77 
78  ions_.setName("ion");
79  ptcl.addParticleSet(std::move(ions_uptr));
80  ions_.create({4});
81  ions_.R[0] = {0.0, 0.0, 0.0};
82  ions_.R[1] = {1.68658058, 1.68658058, 1.68658058};
83  ions_.R[2] = {3.37316115, 3.37316115, 0.0};
84  ions_.R[3] = {5.05974173, 5.05974173, 1.68658058};
85  ions_.update();
86 
87 
88  elec_.setName("elec");
89  ptcl.addParticleSet(std::move(elec_uptr));
90  elec_.create({2, 2});
91  elec_.R[0] = {0.0, 0.0, 0.0};
92  elec_.R[1] = {0.0, 1.0, 1.0};
93  elec_.R[2] = {1.0, 1.0, 0.0};
94  elec_.R[3] = {1.0, 0.0, 1.0};
95 
96  SpeciesSet& tspecies = elec_.getSpeciesSet();
97  int upIdx = tspecies.addSpecies("u");
98  int downIdx = tspecies.addSpecies("d");
99  int chargeIdx = tspecies.addAttribute("charge");
100  tspecies(chargeIdx, upIdx) = -1;
101  tspecies(chargeIdx, downIdx) = -1;
102 
103  const int ei_table_index = elec_.addTable(ions_);
104  elec_.resetGroups();
105  elec_.createSK(); // needed by AoS J2 for ChiesaKEcorrection
106 
107  // make a ParticleSet Clone
108  ParticleSet elec_clone(elec_);
109 
110  //diamondC_1x1x1
111  std::string spo_xml = R"XML(<tmp> \
112  <determinantset type="einspline" href="diamondC_2x1x1.pwscf.h5" tilematrix="2 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.5" precision="float" size="2" gpu="no"/> \
113  </tmp>)XML";
114  std::string spo_omp_xml = R"XML(<tmp> \
115  <determinantset type="einspline" href="diamondC_2x1x1.pwscf.h5" tilematrix="2 0 0 0 1 0 0 0 1" twistnum="0" source="ion" meshfactor="1.5" precision="float" size="2" gpu="omptarget"/> \
116  </tmp>)XML";
117 #ifndef MIXED_PRECISION
118  if (std::is_same<SPO_precision, double_tag>::value)
119  {
120  spo_xml = std::regex_replace(spo_xml, std::regex("float"), "double");
121  spo_omp_xml = std::regex_replace(spo_omp_xml, std::regex("float"), "double");
122  }
123 #endif
125  bool okay = doc.parseFromString(offload_switches.spo ? spo_omp_xml : spo_xml);
126  REQUIRE(okay);
127 
128  xmlNodePtr spo_root = doc.getRoot();
129  xmlNodePtr ein1 = xmlFirstElementChild(spo_root);
130 
131  EinsplineSetBuilder einSet(elec_, ptcl.getPool(), c, ein1);
132  auto spo = einSet.createSPOSetFromXML(ein1);
133  REQUIRE(spo != nullptr);
134 
135  std::vector<std::unique_ptr<DiracDeterminantBase>> dets;
136  auto det_up_ptr = std::make_unique<DiracDet>(spo->makeClone(), 0, 2, ndelay);
137  auto det_up = det_up_ptr.get();
138  dets.push_back(std::move(det_up_ptr));
139  dets.push_back(std::make_unique<DiracDet>(spo->makeClone(), 2, 4, ndelay));
140 
141  auto slater_det = std::make_unique<SlaterDet>(elec_, std::move(dets));
142 
143  RuntimeOptions runtime_options;
144  TrialWaveFunction psi(runtime_options);
145  psi.addComponent(std::move(slater_det));
146 
147  const char* jas_input = R"XML(<tmp>
148 <jastrow name="J2" type="Two-Body" function="Bspline" print="yes" gpu="no">
149  <correlation size="10" speciesA="u" speciesB="u">
150  <coefficients id="uu" type="Array"> 0.02904699284 -0.1004179 -0.1752703883 -0.2232576505 -0.2728029201 -0.3253286875 -0.3624525145 -0.3958223107 -0.4268582166 -0.4394531176</coefficients>
151  </correlation>
152 </jastrow>
153 </tmp>)XML";
154 
155  const char* jas_omp_input = R"XML(<tmp>
156 <jastrow name="J2" type="Two-Body" function="Bspline" print="yes" gpu="omptarget">
157  <correlation size="10" speciesA="u" speciesB="u">
158  <coefficients id="uu" type="Array"> 0.02904699284 -0.1004179 -0.1752703883 -0.2232576505 -0.2728029201 -0.3253286875 -0.3624525145 -0.3958223107 -0.4268582166 -0.4394531176</coefficients>
159  </correlation>
160 </jastrow>
161 </tmp>)XML";
162 
163  Libxml2Document doc_jas;
164  okay = doc.parseFromString(offload_switches.jas ? jas_omp_input : jas_input);
165  REQUIRE(okay);
166 
167  xmlNodePtr jas_root = doc.getRoot();
168  xmlNodePtr jas1 = xmlFirstElementChild(jas_root);
169 
170  RadialJastrowBuilder jb(c, elec_);
171  psi.addComponent(jb.buildComponent(jas1));
172 
173  // initialize distance tables.
174  elec_.update();
175  double logpsi = psi.evaluateLog(elec_);
176 
177  app_log() << "debug before YYY logpsi " << std::setprecision(16) << psi.getLogPsi() << " " << psi.getPhase()
178  << std::endl;
179 #if defined(QMC_COMPLEX)
180  CHECK(logpsi == Approx(-4.546410485374186));
181 #else
182  CHECK(logpsi == Approx(-5.932711221043984));
183 #endif
184 
185  auto logpsi_cplx = psi.evaluateGL(elec_, false);
186 #if defined(QMC_COMPLEX)
187  CHECK(std::real(logpsi_cplx) == Approx(-4.546410485374186));
188 #else
189  CHECK(std::real(logpsi_cplx) == Approx(-5.932711221043984));
190 #endif
191 
192  logpsi_cplx = psi.evaluateGL(elec_, true);
193 #if defined(QMC_COMPLEX)
194  CHECK(std::real(logpsi_cplx) == Approx(-4.546410485374186));
195 #else
196  CHECK(std::real(logpsi_cplx) == Approx(-5.932711221043984));
197 #endif
198 
199  // make a TrialWaveFunction Clone
200  std::unique_ptr<TrialWaveFunction> psi_clone(psi.makeClone(elec_clone));
201 
202  elec_clone.update();
203  double logpsi_clone = psi_clone->evaluateLog(elec_clone);
204 #if defined(QMC_COMPLEX)
205  CHECK(logpsi_clone == Approx(-4.546410485374186));
206 #else
207  CHECK(logpsi_clone == Approx(-5.932711221043984));
208 #endif
209 
210  const int moved_elec_id = 0;
211 
212  using PosType = QMCTraits::PosType;
215  PosType delta(0.1, 0.1, 0.2);
216 
217  elec_.makeMove(moved_elec_id, delta);
218 
219  ValueType r_all_val = psi.calcRatio(elec_, moved_elec_id);
220  ValueType r_fermionic_val = psi.calcRatio(elec_, moved_elec_id, TrialWaveFunction::ComputeType::FERMIONIC);
221  ValueType r_bosonic_val = psi.calcRatio(elec_, moved_elec_id, TrialWaveFunction::ComputeType::NONFERMIONIC);
222 
223  app_log() << "YYY r_all_val " << std::setprecision(16) << r_all_val << std::endl;
224  app_log() << "YYY r_fermionic_val " << std::setprecision(16) << r_fermionic_val << std::endl;
225  app_log() << "YYY r_bosonic_val " << std::setprecision(16) << r_bosonic_val << std::endl;
226 #if defined(QMC_COMPLEX)
227  CHECK(r_all_val == ComplexApprox(std::complex<RealType>(0.1248738460467855, 0)).epsilon(2e-5));
228  CHECK(r_fermionic_val == ComplexApprox(std::complex<RealType>(0.1362181543980086, 0)).epsilon(2e-5));
229 #else
230  CHECK(r_all_val == Approx(0.1248738460469678));
231  CHECK(r_fermionic_val == ValueApprox(0.1362181543982075));
232 #endif
233  CHECK(r_bosonic_val == ValueApprox(0.9167195562048454));
234 
235  psi.acceptMove(elec_, moved_elec_id);
236  elec_.acceptMove(moved_elec_id);
237  app_log() << "before YYY getLogPsi " << std::setprecision(16) << psi.getLogPsi() << " " << psi.getPhase()
238  << std::endl;
239 #if defined(QMC_COMPLEX)
240  CHECK(psi.getLogPsi() == Approx(-6.626861768296886).epsilon(5e-5));
241 #else
242  CHECK(psi.getLogPsi() == Approx(-8.013162503965223));
243 #endif
244 
245  elec_.update(true);
246  psi.evaluateLog(elec_);
247 #if defined(QMC_COMPLEX)
248  CHECK(psi.getLogPsi() == Approx(-6.626861768296886).epsilon(5e-5));
249 #else
250  CHECK(psi.getLogPsi() == Approx(-8.013162503965223));
251 #endif
252 
253  // testing batched interfaces
254  ResourceCollection pset_res("test_pset_res");
255  ResourceCollection twf_res("test_twf_res");
256 
257  elec_.createResource(pset_res);
258  psi.createResource(twf_res);
259 
260  // testing batched interfaces
261  RefVectorWithLeader<ParticleSet> p_ref_list(elec_, {elec_, elec_clone});
262  RefVectorWithLeader<TrialWaveFunction> wf_ref_list(psi, {psi, *psi_clone});
263 
264  ResourceCollectionTeamLock<ParticleSet> mw_pset_lock(pset_res, p_ref_list);
265  ResourceCollectionTeamLock<TrialWaveFunction> mw_twf_lock(twf_res, wf_ref_list);
266 
267  ParticleSet::mw_update(p_ref_list);
268  TrialWaveFunction::mw_evaluateLog(wf_ref_list, p_ref_list);
269  app_log() << "before YYY [0] getLogPsi getPhase " << std::setprecision(16) << wf_ref_list[0].getLogPsi() << " "
270  << wf_ref_list[0].getPhase() << std::endl;
271  app_log() << "before YYY [1] getLogPsi getPhase " << std::setprecision(16) << wf_ref_list[1].getLogPsi() << " "
272  << wf_ref_list[1].getPhase() << std::endl;
273 #if defined(QMC_COMPLEX)
274  REQUIRE(std::complex<RealType>(wf_ref_list[0].getLogPsi(), wf_ref_list[0].getPhase()) ==
275  LogComplexApprox(std::complex<RealType>(-6.626861768296848, -3.141586279082042)));
276  REQUIRE(std::complex<RealType>(wf_ref_list[1].getLogPsi(), wf_ref_list[1].getPhase()) ==
277  LogComplexApprox(std::complex<RealType>(-4.546410485374186, -3.141586279080522)));
278 #else
279  REQUIRE(std::complex<RealType>(wf_ref_list[0].getLogPsi(), wf_ref_list[0].getPhase()) ==
280  LogComplexApprox(std::complex<RealType>(-8.013162503965042, 6.283185307179586)));
281  REQUIRE(std::complex<RealType>(wf_ref_list[1].getLogPsi(), wf_ref_list[1].getPhase()) ==
282  LogComplexApprox(std::complex<RealType>(-5.932711221043984, 6.283185307179586)));
283 #endif
284 
285  TWFGrads<CoordsType::POS> grad_old(2);
286 
287  grad_old.grads_positions[0] = wf_ref_list[0].evalGrad(p_ref_list[0], moved_elec_id);
288  grad_old.grads_positions[1] = wf_ref_list[1].evalGrad(p_ref_list[1], moved_elec_id);
289 
290  app_log() << "evalGrad " << std::setprecision(14) << grad_old.grads_positions[0][0] << " "
291  << grad_old.grads_positions[0][1] << " " << grad_old.grads_positions[0][2] << " "
292  << grad_old.grads_positions[1][0] << " " << grad_old.grads_positions[1][1] << " "
293  << grad_old.grads_positions[1][2] << std::endl;
294 
295  TrialWaveFunction::mw_evalGrad(wf_ref_list, p_ref_list, moved_elec_id, grad_old);
296 
297 #if defined(QMC_COMPLEX)
298  CHECK(grad_old.grads_positions[0][0] ==
299  ComplexApprox(ValueType(713.71203320653, 0.020838031926441)).epsilon(grad_precision));
300  CHECK(grad_old.grads_positions[0][1] ==
301  ComplexApprox(ValueType(713.71203320654, 0.020838031928415)).epsilon(grad_precision));
302  CHECK(grad_old.grads_positions[0][2] ==
303  ComplexApprox(ValueType(-768.42842826889, -0.020838032018344)).epsilon(grad_precision));
304  CHECK(grad_old.grads_positions[1][0] ==
305  ComplexApprox(ValueType(118.02653358655, -0.0022419843505538)).epsilon(grad_precision));
306  CHECK(grad_old.grads_positions[1][1] ==
307  ComplexApprox(ValueType(118.02653358655, -0.0022419843498631)).epsilon(grad_precision));
308  CHECK(grad_old.grads_positions[1][2] ==
309  ComplexApprox(ValueType(-118.46325895634, 0.0022419843493758)).epsilon(grad_precision));
310 #else
311  CHECK(grad_old.grads_positions[0][0] == Approx(713.69119517454).epsilon(2. * grad_precision));
312  CHECK(grad_old.grads_positions[0][1] == Approx(713.69119517455).epsilon(2. * grad_precision));
313  CHECK(grad_old.grads_positions[0][2] == Approx(-768.40759023681).epsilon(2. * grad_precision));
314  CHECK(grad_old.grads_positions[1][0] == Approx(118.0287755709).epsilon(grad_precision));
315  CHECK(grad_old.grads_positions[1][1] == Approx(118.0287755709).epsilon(grad_precision));
316  CHECK(grad_old.grads_positions[1][2] == Approx(-118.46550094069).epsilon(grad_precision));
317 #endif
318  PosType delta_sign_changed(0.1, 0.1, -0.2);
319  std::vector<PosType> displs{delta_sign_changed, delta_sign_changed};
320  ParticleSet::mw_makeMove(p_ref_list, moved_elec_id, displs);
321 
322  if (kind_selected != DynamicCoordinateKind::DC_POS_OFFLOAD)
323  {
324  ValueType r_0 = wf_ref_list[0].calcRatio(p_ref_list[0], moved_elec_id);
325  GradType grad_temp;
326  ValueType r_1 = wf_ref_list[1].calcRatioGrad(p_ref_list[1], moved_elec_id, grad_temp);
327  app_log() << "calcRatio calcRatioGrad " << std::setprecision(14) << r_0 << " " << r_1 << " " << grad_temp[0] << " "
328  << grad_temp[1] << " " << grad_temp[2] << std::endl;
329 #if defined(QMC_COMPLEX)
330  CHECK(r_0 == ComplexApprox(ValueType(253.71869245791, -0.00034808849808193)).epsilon(1e-4));
331  CHECK(r_1 == ComplexApprox(ValueType(36.915636007059, -6.4240180082292e-05)).epsilon(1e-5));
332  CHECK(grad_temp[0] == ComplexApprox(ValueType(1.4567170375539, 0.00027263382943948)));
333  CHECK(grad_temp[1] == ComplexApprox(ValueType(1.4567170375539, 0.00027263382945093)));
334  CHECK(grad_temp[2] == ComplexApprox(ValueType(-1.2930978490431, -0.00027378452214318)));
335 #else
336  CHECK(r_0 == Approx(253.71904054638).epsilon(2e-4));
337  CHECK(r_1 == Approx(36.915700247239));
338  CHECK(grad_temp[0] == Approx(1.4564444046733));
339  CHECK(grad_temp[1] == Approx(1.4564444046734));
340  CHECK(grad_temp[2] == Approx(-1.2928240654738));
341 #endif
342  }
343 
344  PosType delta_zero(0, 0, 0);
345  displs = {delta_zero, delta};
346  ParticleSet::mw_makeMove(p_ref_list, moved_elec_id, displs);
347 
348  std::vector<PsiValue> ratios(2);
349  TrialWaveFunction::mw_calcRatio(wf_ref_list, p_ref_list, moved_elec_id, ratios);
350  app_log() << "mixed move calcRatio " << std::setprecision(14) << ratios[0] << " " << ratios[1] << std::endl;
351 
352 #if defined(QMC_COMPLEX)
353  CHECK(ratios[0] == ComplexApprox(PsiValue(1, 0)).epsilon(5e-4));
354  CHECK(ratios[1] == ComplexApprox(PsiValue(0.12487384604679, 0)).epsilon(5e-5));
355 #else
356  CHECK(ratios[0] == Approx(1).epsilon(5e-5));
357 #if defined(MIXED_PRECISION)
358  CHECK(ratios[1] == Approx(0.12487384604697).epsilon(5e-5));
359 #else
360  CHECK(ratios[1] == Approx(0.12487384604697));
361 #endif
362 #endif
363 
364  std::fill(ratios.begin(), ratios.end(), 0);
365  TWFGrads<CoordsType::POS> grad_new(2);
366 
367  if (kind_selected != DynamicCoordinateKind::DC_POS_OFFLOAD)
368  {
369  ratios[0] = wf_ref_list[0].calcRatioGrad(p_ref_list[0], moved_elec_id, grad_new.grads_positions[0]);
370  ratios[1] = wf_ref_list[1].calcRatioGrad(p_ref_list[1], moved_elec_id, grad_new.grads_positions[1]);
371 
372  app_log() << "calcRatioGrad " << std::setprecision(14) << ratios[0] << " " << ratios[1] << std::endl
373  << grad_new.grads_positions[0][0] << " " << grad_new.grads_positions[0][1] << " "
374  << grad_new.grads_positions[0][2] << " " << grad_new.grads_positions[1][0] << " "
375  << grad_new.grads_positions[1][1] << " " << grad_new.grads_positions[1][2] << std::endl;
376  }
377  //Temporary as switch to std::reference_wrapper proceeds
378  // testing batched interfaces
379  TrialWaveFunction::mw_calcRatioGrad(wf_ref_list, p_ref_list, moved_elec_id, ratios, grad_new);
380  app_log() << "flex_calcRatioGrad " << std::setprecision(14) << ratios[0] << " " << ratios[1] << std::endl
381  << grad_new.grads_positions[0][0] << " " << grad_new.grads_positions[0][1] << " "
382  << grad_new.grads_positions[0][2] << " " << grad_new.grads_positions[1][0] << " "
383  << grad_new.grads_positions[1][1] << " " << grad_new.grads_positions[1][2] << std::endl;
384 #if defined(QMC_COMPLEX)
385  CHECK(ratios[0] == ComplexApprox(ValueType(1, 0)).epsilon(5e-5));
386  CHECK(grad_new.grads_positions[0][0] ==
387  ComplexApprox(ValueType(713.71203320653, 0.020838031942702)).epsilon(grad_precision));
388  CHECK(grad_new.grads_positions[0][1] ==
389  ComplexApprox(ValueType(713.71203320654, 0.020838031944677)).epsilon(grad_precision));
390  CHECK(grad_new.grads_positions[0][2] ==
391  ComplexApprox(ValueType(-768.42842826889, -0.020838032035842)).epsilon(grad_precision));
392  CHECK(ratios[1] == ComplexApprox(ValueType(0.12487384604679, 0)).epsilon(5e-5));
393  CHECK(grad_new.grads_positions[1][0] ==
394  ComplexApprox(ValueType(713.71203320656, 0.020838031892613)).epsilon(grad_precision));
395  CHECK(grad_new.grads_positions[1][1] ==
396  ComplexApprox(ValueType(713.71203320657, 0.020838031894628)).epsilon(grad_precision));
397  CHECK(grad_new.grads_positions[1][2] ==
398  ComplexApprox(ValueType(-768.42842826892, -0.020838031981896)).epsilon(grad_precision));
399 #else
400  CHECK(ratios[0] == Approx(1).epsilon(5e-5));
401  CHECK(grad_new.grads_positions[0][0] == Approx(713.69119517463).epsilon(grad_precision));
402  CHECK(grad_new.grads_positions[0][1] == Approx(713.69119517463).epsilon(grad_precision));
403  CHECK(grad_new.grads_positions[0][2] == Approx(-768.40759023689).epsilon(grad_precision));
404  CHECK(ratios[1] == Approx(0.12487384604697).epsilon(5e-5));
405  CHECK(grad_new.grads_positions[1][0] == Approx(713.69119517467).epsilon(grad_precision));
406  CHECK(grad_new.grads_positions[1][1] == Approx(713.69119517468).epsilon(grad_precision));
407  CHECK(grad_new.grads_positions[1][2] == Approx(-768.40759023695).epsilon(grad_precision));
408 #endif
409 
410  std::vector<bool> isAccepted(2, true);
411  TrialWaveFunction::mw_accept_rejectMove(wf_ref_list, p_ref_list, moved_elec_id, isAccepted, true);
412  app_log() << "flex_acceptMove WF_list[0] getLogPsi getPhase " << std::setprecision(16) << wf_ref_list[0].getLogPsi()
413  << " " << wf_ref_list[0].getPhase() << std::endl;
414  app_log() << "flex_acceptMove WF_list[1] getLogPsi getPhase " << std::setprecision(16) << wf_ref_list[1].getLogPsi()
415  << " " << wf_ref_list[1].getPhase() << std::endl;
416 #if defined(QMC_COMPLEX)
417  REQUIRE(std::complex<RealType>(wf_ref_list[0].getLogPsi(), wf_ref_list[0].getPhase()) ==
418  LogComplexApprox(std::complex<RealType>(-6.626861768296848, -3.141586279082065)));
419  REQUIRE(std::complex<RealType>(wf_ref_list[1].getLogPsi(), wf_ref_list[1].getPhase()) ==
420  LogComplexApprox(std::complex<RealType>(-6.626861768296886, -3.141586279081995)));
421 #else
422  REQUIRE(std::complex<RealType>(wf_ref_list[0].getLogPsi(), wf_ref_list[0].getPhase()) ==
423  LogComplexApprox(std::complex<RealType>(-8.013162503965155, 6.283185307179586)));
424  REQUIRE(std::complex<RealType>(wf_ref_list[1].getLogPsi(), wf_ref_list[1].getPhase()) ==
425  LogComplexApprox(std::complex<RealType>(-8.013162503965223, 6.283185307179586)));
426 #endif
427 
428  ParticleSet::mw_accept_rejectMove(p_ref_list, moved_elec_id, isAccepted, true);
429 
430  const int moved_elec_id_next = 1;
431  TrialWaveFunction::mw_evalGrad(wf_ref_list, p_ref_list, moved_elec_id_next, grad_old);
432  app_log() << "evalGrad next electron " << std::setprecision(14) << grad_old.grads_positions[0][0] << " "
433  << grad_old.grads_positions[0][1] << " " << grad_old.grads_positions[0][2] << " "
434  << grad_old.grads_positions[1][0] << " " << grad_old.grads_positions[1][1] << " "
435  << grad_old.grads_positions[1][2] << std::endl;
436 #if defined(QMC_COMPLEX)
437  CHECK(grad_old.grads_positions[0][0] ==
438  ComplexApprox(ValueType(-114.82740072726, -7.605305979232e-05)).epsilon(grad_precision));
439  CHECK(grad_old.grads_positions[0][1] ==
440  ComplexApprox(ValueType(-93.980772428401, -7.605302517238e-05)).epsilon(grad_precision));
441  CHECK(grad_old.grads_positions[0][2] ==
442  ComplexApprox(ValueType(64.050803536571, 7.6052975324197e-05)).epsilon(grad_precision));
443  CHECK(grad_old.grads_positions[1][0] ==
444  ComplexApprox(ValueType(-114.82740072726, -7.605305979232e-05)).epsilon(grad_precision));
445  CHECK(grad_old.grads_positions[1][1] ==
446  ComplexApprox(ValueType(-93.980772428401, -7.605302517238e-05)).epsilon(grad_precision));
447  CHECK(grad_old.grads_positions[1][2] ==
448  ComplexApprox(ValueType(64.050803536571, 7.6052975324197e-05)).epsilon(grad_precision));
449 #else
450  CHECK(grad_old.grads_positions[0][0] == Approx(-114.82732467419).epsilon(grad_precision));
451  CHECK(grad_old.grads_positions[0][1] == Approx(-93.98069637537).epsilon(grad_precision));
452  CHECK(grad_old.grads_positions[0][2] == Approx(64.050727483593).epsilon(grad_precision));
453  CHECK(grad_old.grads_positions[1][0] == Approx(-114.82732467419).epsilon(grad_precision));
454  CHECK(grad_old.grads_positions[1][1] == Approx(-93.98069637537).epsilon(grad_precision));
455  CHECK(grad_old.grads_positions[1][2] == Approx(64.050727483593).epsilon(grad_precision));
456 #endif
457 
458  std::vector<PosType> displ(2);
459  displ[0] = displ[1] = {0.1, 0.2, 0.3};
460 
461  ParticleSet::mw_makeMove(p_ref_list, moved_elec_id_next, displ);
462  TrialWaveFunction::mw_calcRatioGrad(wf_ref_list, p_ref_list, moved_elec_id_next, ratios, grad_new);
463  app_log() << "ratioGrad next electron " << std::setprecision(14) << grad_new.grads_positions[0][0] << " "
464  << grad_new.grads_positions[0][1] << " " << grad_new.grads_positions[0][2] << " "
465  << grad_new.grads_positions[1][0] << " " << grad_new.grads_positions[1][1] << " "
466  << grad_new.grads_positions[1][2] << std::endl;
467 #if defined(QMC_COMPLEX)
468  CHECK(grad_new.grads_positions[0][0] ==
469  ComplexApprox(ValueType(9.6073058494562, -1.4375146770852e-05)).epsilon(8e-5));
470  CHECK(grad_new.grads_positions[0][1] ==
471  ComplexApprox(ValueType(6.3111018321898, -1.4375146510386e-05)).epsilon(8e-5));
472  CHECK(grad_new.grads_positions[0][2] ==
473  ComplexApprox(ValueType(-3.2027658046121, 1.4375146020225e-05)).epsilon(8e-5));
474  CHECK(grad_new.grads_positions[1][0] ==
475  ComplexApprox(ValueType(9.6073058494562, -1.4375146770852e-05)).epsilon(8e-5));
476  CHECK(grad_new.grads_positions[1][1] ==
477  ComplexApprox(ValueType(6.3111018321898, -1.4375146510386e-05)).epsilon(8e-5));
478  CHECK(grad_new.grads_positions[1][2] ==
479  ComplexApprox(ValueType(-3.2027658046121, 1.4375146020225e-05)).epsilon(8e-5));
480 #else
481  CHECK(grad_new.grads_positions[0][0] == Approx(9.607320224603).epsilon(1e-4));
482  CHECK(grad_new.grads_positions[0][1] == Approx(6.3111162073363).epsilon(1e-4));
483  CHECK(grad_new.grads_positions[0][2] == Approx(-3.2027801797581).epsilon(1e-4));
484  CHECK(grad_new.grads_positions[1][0] == Approx(9.607320224603).epsilon(1e-4));
485  CHECK(grad_new.grads_positions[1][1] == Approx(6.3111162073363).epsilon(1e-4));
486  CHECK(grad_new.grads_positions[1][2] == Approx(-3.2027801797581).epsilon(1e-4));
487 #endif
488 
489  isAccepted[0] = true;
490  isAccepted[1] = false;
491  TrialWaveFunction::mw_accept_rejectMove(wf_ref_list, p_ref_list, moved_elec_id_next, isAccepted, true);
492  ParticleSet::mw_accept_rejectMove(p_ref_list, moved_elec_id_next, isAccepted, true);
493 
494  TrialWaveFunction::mw_completeUpdates(wf_ref_list);
495  TrialWaveFunction::mw_evaluateGL(wf_ref_list, p_ref_list, false);
496 #ifndef NDEBUG
497  app_log() << "invMat next electron " << std::setprecision(14) << det_up->getPsiMinv()[0][0] << " "
498  << det_up->getPsiMinv()[0][1] << " " << det_up->getPsiMinv()[1][0] << " " << det_up->getPsiMinv()[1][1]
499  << " " << std::endl;
500 #if defined(QMC_COMPLEX)
501  CHECK(det_up->getPsiMinv()[0][0] == ComplexApprox(ValueType(38.503358805635, -38.503358805645)).epsilon(1e-4));
502  CHECK(det_up->getPsiMinv()[0][1] == ComplexApprox(ValueType(-31.465077529568, 31.465077529576)).epsilon(1e-4));
503  CHECK(det_up->getPsiMinv()[1][0] == ComplexApprox(ValueType(-27.188228530061, 27.188228530068)).epsilon(1e-4));
504  CHECK(det_up->getPsiMinv()[1][1] == ComplexApprox(ValueType(22.759962501254, -22.75996250126)).epsilon(1e-4));
505 #else
506  CHECK(det_up->getPsiMinv()[0][0] == Approx(77.0067176113).epsilon(1e-4));
507  CHECK(det_up->getPsiMinv()[0][1] == Approx(-62.9301550592).epsilon(1e-4));
508  CHECK(det_up->getPsiMinv()[1][0] == Approx(-54.376457060136).epsilon(1e-4));
509  CHECK(det_up->getPsiMinv()[1][1] == Approx(45.51992500251).epsilon(1e-4));
510 #endif
511 #endif // NDEBUG
512  std::vector<LogValue> log_values(wf_ref_list.size());
513  TrialWaveFunction::mw_evaluateGL(wf_ref_list, p_ref_list, false);
514  for (int iw = 0; iw < log_values.size(); iw++)
515  log_values[iw] = {wf_ref_list[iw].getLogPsi(), wf_ref_list[iw].getPhase()};
516 #if defined(QMC_COMPLEX)
517  CHECK(LogComplexApprox(log_values[0]) == LogValue{-4.1148130068943, -6.2831779860047});
518  CHECK(LogComplexApprox(log_values[1]) == LogValue{-6.6269077659586, -3.1416312090662});
519 #else
520  CHECK(LogComplexApprox(log_values[0]) == LogValue{-5.5011162672993, 9.4247779607694});
521  CHECK(LogComplexApprox(log_values[1]) == LogValue{-8.0131646238354, 6.2831853071796});
522 #endif
523 
524  // This test has 4 electrons but only 2 particle moves are attempted.
525  // Force update of all distance tables before mw_evaluateGL with recompute
526  // needed as the above ParticleSet::mw_accept_rejectMove calls are in forward mode.
527  ParticleSet::mw_update(p_ref_list);
528  TrialWaveFunction::mw_evaluateGL(wf_ref_list, p_ref_list, true);
529  for (int iw = 0; iw < log_values.size(); iw++)
530  CHECK(LogComplexApprox(log_values[iw]) == LogValue{wf_ref_list[iw].getLogPsi(), wf_ref_list[iw].getPhase()});
531 
532  // test NLPP related APIs
533  const int nknot = 3;
534  VirtualParticleSet vp(elec_, nknot), vp_clone(elec_clone, nknot);
535  RefVectorWithLeader<VirtualParticleSet> vp_list(vp, {vp, vp_clone});
536  ResourceCollection vp_res("test_vp_res");
537  vp.createResource(vp_res);
538  ResourceCollectionTeamLock<VirtualParticleSet> mw_vp_lock(vp_res, vp_list);
539 
540  const auto& ei_table1 = elec_.getDistTableAB(ei_table_index);
541  // make virtual move of elec 0, reference ion 1
542  NLPPJob<RealType> job1(1, 0, ei_table1.getDistances()[0][1], -ei_table1.getDisplacements()[0][1]);
543  const auto& ei_table2 = elec_clone.getDistTableAB(ei_table_index);
544  // make virtual move of elec 1, reference ion 3
545  NLPPJob<RealType> job2(3, 1, ei_table2.getDistances()[1][3], -ei_table2.getDisplacements()[1][3]);
546 
547  std::vector<PosType> deltaV1{{0.1, 0.2, 0.3}, {0.1, 0.3, 0.2}, {0.2, 0.1, 0.3}};
548  std::vector<PosType> deltaV2{{0.02, 0.01, 0.03}, {0.02, 0.03, 0.01}, {0.03, 0.01, 0.02}};
549 
550  VirtualParticleSet::mw_makeMoves(vp_list, p_ref_list, {deltaV1, deltaV2}, {job1, job2}, false);
551 
552  std::vector<ValueType> nlpp1_ratios(nknot), nlpp2_ratios(nknot);
553  TrialWaveFunction::mw_evaluateRatios(wf_ref_list, RefVectorWithLeader<const VirtualParticleSet>(vp, {vp, vp_clone}),
554  {nlpp1_ratios, nlpp2_ratios});
555 
556  CHECK(ValueApprox(nlpp1_ratios[0]).epsilon(ratio_precision) == ValueType(2.4229926733));
557  CHECK(ValueApprox(nlpp1_ratios[1]).epsilon(ratio_precision) == ValueType(-3.2054654296));
558  CHECK(ValueApprox(nlpp1_ratios[2]).epsilon(ratio_precision) == ValueType(2.3982171406));
559  CHECK(ValueApprox(nlpp2_ratios[0]).epsilon(ratio_precision) == ValueType(-0.3505144708));
560  CHECK(ValueApprox(nlpp2_ratios[1]).epsilon(ratio_precision) == ValueType(-3.350712448));
561  CHECK(ValueApprox(nlpp2_ratios[2]).epsilon(ratio_precision) == ValueType(-2.0885822923));
562 }
DynamicCoordinateKind
enumerator for DynamicCoordinates kinds
class that handles xmlDoc
Definition: Libxml2Doc.h:76
WaveFunctionComponent::PsiValue PsiValue
Definition: SlaterDet.cpp:25
QMCTraits::RealType real
std::vector< StdComp, CUDAHostAllocator< StdComp > > log_values(batch_size)
std::ostream & app_log()
Definition: OutputManager.h:65
xmlNodePtr getRoot()
Definition: Libxml2Doc.h:88
LatticeGaussianProduct::GradType GradType
Communicate * Controller
Global Communicator for a process.
Definition: Communicate.cpp:35
Catch::Detail::LogComplexApprox LogComplexApprox
QMCTraits::PosType PosType
Wrapping information on parallelism.
Definition: Communicate.h:68
CrystalLattice< OHMMS_PRECISION, OHMMS_DIM > lattice
REQUIRE(std::filesystem::exists(filename))
QMCTraits::RealType RealType
bool parseFromString(const std::string_view data)
Definition: Libxml2Doc.cpp:204
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
LatticeGaussianProduct::ValueType ValueType
std::complex< double > LogValue

◆ trace() [1/4]

T qmcplusplus::trace ( const SymTensor< T, D > &  rhs)

Definition at line 321 of file SymTensor.h.

322 {
323  T result = 0.0;
324  for (int i = 0; i < D; i++)
325  result += rhs(i, i);
326  return result;
327 }

◆ trace() [2/4]

T qmcplusplus::trace ( const Tensor< T, D > &  rhs)
inline

trace $ result = \sum_k rhs(k,k)$

Parameters
rhsa tensor

Definition at line 326 of file Tensor.h.

327 {
328  T result = 0.0;
329  for (int i = 0; i < D; i++)
330  result += rhs(i, i);
331  return result;
332 }

◆ trace() [3/4]

T1 qmcplusplus::trace ( const Tensor< T1, D > &  a,
const Tensor< T2, D > &  b 
)
inline

Tr(a*b), $ \sum_i\sum_j a(i,j)*b(j,i) $.

Definition at line 349 of file Tensor.h.

350 {
351  T1 result = 0.0;
352  for (int i = 0; i < D; i++)
353  for (int j = 0; j < D; j++)
354  result += a(i, j) * b(j, i);
355  return result;
356 }

◆ trace() [4/4]

T qmcplusplus::trace ( const AntiSymTensor< T, D > &  )

Definition at line 468 of file AntiSymTensor.h.

Referenced by CountingGaussian::evaluate(), CountingGaussian::evaluate_print(), and CountingGaussian::evaluateLog().

469 {
470  return T(0.0);
471 }

◆ traceAtB() [1/2]

T qmcplusplus::traceAtB ( const Tensor< T, D > &  a,
const Tensor< T, D > &  b 
)
inline

Tr(a^t *b), $ \sum_i\sum_j a(i,j)*b(i,j) $.

Definition at line 361 of file Tensor.h.

Referenced by DiracDeterminantWithBackflow::dummyEvalLi(), DiracDeterminantWithBackflow::evaluateDerivatives(), and DiracDeterminantWithBackflow::evaluateLog().

362 {
363  T result = 0.0;
364  for (int i = 0; i < D * D; i++)
365  result += a(i) * b(i);
366  return result;
367 }

◆ traceAtB() [2/2]

BinaryReturn<T1, T2, OpMultiply>::Type_t qmcplusplus::traceAtB ( const Tensor< T1, D > &  a,
const Tensor< T2, D > &  b 
)
inline

Tr(a^t *b), $ \sum_i\sum_j a(i,j)*b(i,j) $.

Definition at line 372 of file Tensor.h.

373 {
374  using T = typename BinaryReturn<T1, T2, OpMultiply>::Type_t;
375  T result = 0.0;
376  for (int i = 0; i < D * D; i++)
377  result += a(i) * b(i);
378  return result;
379 }

◆ TraceSample_comp()

bool qmcplusplus::TraceSample_comp ( TraceSample< T > *  left,
TraceSample< T > *  right 
)

Definition at line 744 of file TraceManager.h.

References TraceSample< T >::data_size.

745 {
746  return left->data_size < right->data_size;
747 }

◆ transpose() [1/3]

SymTensor<T, D> qmcplusplus::transpose ( const SymTensor< T, D > &  rhs)

Definition at line 330 of file SymTensor.h.

331 {
332  return rhs;
333 }

◆ transpose() [2/3]

Tensor<T, D> qmcplusplus::transpose ( const Tensor< T, D > &  rhs)
inline

transpose a tensor

Definition at line 337 of file Tensor.h.

338 {
339  Tensor<T, D> result; // = Tensor<T,D>::DontInitialize();
340  for (int j = 0; j < D; j++)
341  for (int i = 0; i < D; i++)
342  result(i, j) = rhs(j, i);
343  return result;
344 }

◆ transpose() [3/3]

◆ TrialWaveFunction::mw_calcRatioGrad< CoordsType::POS >()

template void qmcplusplus::TrialWaveFunction::mw_calcRatioGrad< CoordsType::POS > ( const RefVectorWithLeader< TrialWaveFunction > &  wf_list,
const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
std::vector< PsiValue > &  ratios,
TWFGrads< CoordsType::POS > &  grads 
)

◆ TrialWaveFunction::mw_calcRatioGrad< CoordsType::POS_SPIN >()

template void qmcplusplus::TrialWaveFunction::mw_calcRatioGrad< CoordsType::POS_SPIN > ( const RefVectorWithLeader< TrialWaveFunction > &  wf_list,
const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
std::vector< PsiValue > &  ratios,
TWFGrads< CoordsType::POS_SPIN > &  grads 
)

◆ TrialWaveFunction::mw_evalGrad< CoordsType::POS >()

template void qmcplusplus::TrialWaveFunction::mw_evalGrad< CoordsType::POS > ( const RefVectorWithLeader< TrialWaveFunction > &  wf_list,
const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
TWFGrads< CoordsType::POS > &  grads 
)

◆ TrialWaveFunction::mw_evalGrad< CoordsType::POS_SPIN >()

◆ TWFdispatcher::flex_calcRatioGrad< CoordsType::POS >()

template void qmcplusplus::TWFdispatcher::flex_calcRatioGrad< CoordsType::POS > ( const RefVectorWithLeader< TrialWaveFunction > &  wf_list,
const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
std::vector< PsiValue > &  ratios,
TWFGrads< CoordsType::POS > &  grads 
) const

◆ TWFdispatcher::flex_calcRatioGrad< CoordsType::POS_SPIN >()

template void qmcplusplus::TWFdispatcher::flex_calcRatioGrad< CoordsType::POS_SPIN > ( const RefVectorWithLeader< TrialWaveFunction > &  wf_list,
const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
std::vector< PsiValue > &  ratios,
TWFGrads< CoordsType::POS_SPIN > &  grads 
) const

◆ TWFdispatcher::flex_evalGrad< CoordsType::POS >()

template void qmcplusplus::TWFdispatcher::flex_evalGrad< CoordsType::POS > ( const RefVectorWithLeader< TrialWaveFunction > &  wf_list,
const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
TWFGrads< CoordsType::POS > &  grads 
) const

◆ TWFdispatcher::flex_evalGrad< CoordsType::POS_SPIN >()

template void qmcplusplus::TWFdispatcher::flex_evalGrad< CoordsType::POS_SPIN > ( const RefVectorWithLeader< TrialWaveFunction > &  wf_list,
const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
TWFGrads< CoordsType::POS_SPIN > &  grads 
) const

◆ unpack4fftw()

void qmcplusplus::unpack4fftw ( const Vector< std::complex< T >> &  cG,
const std::vector< TinyVector< int, 3 >> &  gvecs,
const TinyVector< int, 3 > &  maxg,
Array< std::complex< T >, 3 > &  fftbox 
)
inline

unpack packed cG to fftbox

Parameters
cGpacked vector
gvecsg-coordinate for cG[i]
maxgfft grid
fftboxunpacked data to be transformed

Definition at line 34 of file einspline_helper.hpp.

References lower_bound(), and upper_bound().

Referenced by OneSplineOrbData::fft_spline().

38 {
39  fftbox = std::complex<T>();
40  const int upper_bound[3] = {(maxg[0] - 1) / 2, (maxg[1] - 1) / 2, (maxg[2] - 1) / 2};
41  const int lower_bound[3] = {upper_bound[0] - maxg[0] + 1, upper_bound[1] - maxg[1] + 1, upper_bound[2] - maxg[2] + 1};
42  //only coefficient indices between [lower_bound,upper_bound] are taken for FFT.
43  //this is rather unsafe
44  //#pragma omp parallel for
45  for (int iG = 0; iG < cG.size(); iG++)
46  {
47  if (gvecs[iG][0] > upper_bound[0] || gvecs[iG][0] < lower_bound[0] || gvecs[iG][1] > upper_bound[1] ||
48  gvecs[iG][1] < lower_bound[1] || gvecs[iG][2] > upper_bound[2] || gvecs[iG][2] < lower_bound[2])
49  {
50  //std::cout << "Warning: cG out of bound "
51  // << "x " << gvecs[iG][0] << " y " << gvecs[iG][1] << " z " << gvecs[iG][2] << std::endl
52  // << "xu " << upper_bound[0] << " yu " << upper_bound[1] << " zu " << upper_bound[2] << std::endl
53  // << "xd " << lower_bound[0] << " yd " << lower_bound[1] << " zd " << lower_bound[2] << std::endl;
54  continue;
55  }
56  fftbox((gvecs[iG][0] + maxg[0]) % maxg[0], (gvecs[iG][1] + maxg[1]) % maxg[1], (gvecs[iG][2] + maxg[2]) % maxg[2]) =
57  cG[iG];
58  }
59 }
TinyVector< T, 3 > lower_bound(const TinyVector< T, 3 > &a, const TinyVector< T, 3 > &b)
helper function to determine the lower bound of a domain (need to move up)
TinyVector< T, 3 > upper_bound(const TinyVector< T, 3 > &a, const TinyVector< T, 3 > &b)
helper function to determine the upper bound of a domain (need to move up)

◆ upper_bound()

TinyVector<T, 3> qmcplusplus::upper_bound ( const TinyVector< T, 3 > &  a,
const TinyVector< T, 3 > &  b 
)
inline

helper function to determine the upper bound of a domain (need to move up)

Definition at line 208 of file InitMolecularSystem.cpp.

Referenced by HEGGrid< T >::getShellIndex(), InitMolecularSystem::initWithVolume(), and unpack4fftw().

209 {
210  return TinyVector<T, 3>(std::max(a[0], b[0]), std::max(a[1], b[1]), std::max(a[2], b[2]));
211 }

◆ v_m_v()

T qmcplusplus::v_m_v ( h00,
h01,
h02,
h11,
h12,
h22,
g1x,
g1y,
g1z,
g2x,
g2y,
g2z 
)

compute vector[3]^T x matrix[3][3] x vector[3]

Definition at line 54 of file contraction_helper.hpp.

Referenced by SplineC2R< ST >::assign_vgh(), SplineR2R< ST >::assign_vgh(), SplineC2C< ST >::assign_vgh(), SplineC2COMPTarget< ST >::assign_vgh(), SplineC2ROMPTarget< ST >::assign_vgh(), SplineC2R< ST >::assign_vghgh(), SplineR2R< ST >::assign_vghgh(), SplineC2C< ST >::assign_vghgh(), SplineC2COMPTarget< ST >::assign_vghgh(), and SplineC2ROMPTarget< ST >::assign_vghgh().

55 {
56  return g1x * g2x * h00 + g1x * g2y * h01 + g1x * g2z * h02 + g1y * g2x * h01 + g1y * g2y * h11 + g1y * g2z * h12 +
57  g1z * g2x * h02 + g1z * g2y * h12 + g1z * g2z * h22;
58 }

◆ VMCBatched::advanceWalkers< CoordsType::POS >()

template void qmcplusplus::VMCBatched::advanceWalkers< CoordsType::POS > ( const StateForThread &  sft,
Crowd crowd,
QMCDriverNew::DriverTimers timers,
ContextForSteps step_context,
bool  recompute,
bool  accumulate_this_step 
)

◆ VMCBatched::advanceWalkers< CoordsType::POS_SPIN >()

template void qmcplusplus::VMCBatched::advanceWalkers< CoordsType::POS_SPIN > ( const StateForThread &  sft,
Crowd crowd,
QMCDriverNew::DriverTimers timers,
ContextForSteps step_context,
bool  recompute,
bool  accumulate_this_step 
)

◆ WaveFunctionComponent::mw_evalGrad< CoordsType::POS >()

template void qmcplusplus::WaveFunctionComponent::mw_evalGrad< CoordsType::POS > ( const RefVectorWithLeader< WaveFunctionComponent > &  wfc_list,
const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
TWFGrads< CoordsType::POS > &  grad_now 
) const

◆ WaveFunctionComponent::mw_evalGrad< CoordsType::POS_SPIN >()

◆ WaveFunctionComponent::mw_ratioGrad< CoordsType::POS >()

template void qmcplusplus::WaveFunctionComponent::mw_ratioGrad< CoordsType::POS > ( const RefVectorWithLeader< WaveFunctionComponent > &  wfc_list,
const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
std::vector< PsiValue > &  ratios,
TWFGrads< CoordsType::POS > &  grad_new 
) const

◆ WaveFunctionComponent::mw_ratioGrad< CoordsType::POS_SPIN >()

template void qmcplusplus::WaveFunctionComponent::mw_ratioGrad< CoordsType::POS_SPIN > ( const RefVectorWithLeader< WaveFunctionComponent > &  wfc_list,
const RefVectorWithLeader< ParticleSet > &  p_list,
int  iat,
std::vector< PsiValue > &  ratios,
TWFGrads< CoordsType::POS_SPIN > &  grad_new 
) const

◆ where() [1/4]

MakeReturn<TrinaryNode<FnWhere, typename CreateLeaf<Matrix<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t, typename CreateLeaf<T3>::Leaf_t> >::Expression_t qmcplusplus::where ( const Matrix< T1, C1 > &  c,
const T2 &  t,
const T3 &  f 
)
inline

Definition at line 454 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

455 {
456  typedef TrinaryNode<FnWhere, typename CreateLeaf<Matrix<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t,
457  typename CreateLeaf<T3>::Leaf_t>
458  Tree_t;
459  return MakeReturn<Tree_t>::make(
460  Tree_t(CreateLeaf<Matrix<T1, C1>>::make(c), CreateLeaf<T2>::make(t), CreateLeaf<T3>::make(f)));
461 }

◆ where() [2/4]

MakeReturn<TrinaryNode<FnWhere, typename CreateLeaf<ParticleAttrib<T1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t, typename CreateLeaf<T3>::Leaf_t> >::Expression_t qmcplusplus::where ( const ParticleAttrib< T1 > &  c,
const T2 &  t,
const T3 &  f 
)
inline

Definition at line 487 of file ParticleAttrib.cpp.

References MakeReturn< T >::make().

488 {
489  typedef TrinaryNode<FnWhere, typename CreateLeaf<ParticleAttrib<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t,
490  typename CreateLeaf<T3>::Leaf_t>
491  Tree_t;
492  return MakeReturn<Tree_t>::make(
493  Tree_t(CreateLeaf<ParticleAttrib<T1>>::make(c), CreateLeaf<T2>::make(t), CreateLeaf<T3>::make(f)));
494 }

◆ where() [3/4]

MakeReturn< TrinaryNode< FnWhere, typename CreateLeaf< Expression< T1 > >::Leaf_t, typename CreateLeaf< T2 >::Leaf_t, typename CreateLeaf< T3 >::Leaf_t > >::Expression_t where ( const Expression< T1 > &  c,
const T2 &  t,
const T3 &  f 
)
inline

Definition at line 725 of file OhmmsMatrixOperators.h.

References MakeReturn< T >::make().

726 {
727  typedef TrinaryNode<FnWhere, typename CreateLeaf<Expression<T1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t,
728  typename CreateLeaf<T3>::Leaf_t>
729  Tree_t;
730  return MakeReturn<Tree_t>::make(
731  Tree_t(CreateLeaf<Expression<T1>>::make(c), CreateLeaf<T2>::make(t), CreateLeaf<T3>::make(f)));
732 }

◆ where() [4/4]

MakeReturn<TrinaryNode<FnWhere, typename CreateLeaf<Vector<T1, C1> >::Leaf_t, typename CreateLeaf<T2>::Leaf_t, typename CreateLeaf<T3>::Leaf_t> >::Expression_t qmcplusplus::where ( const Vector< T1, C1 > &  c,
const T2 &  t,
const T3 &  f 
)
inline

Definition at line 1367 of file OhmmsVectorOperators.h.

References MakeReturn< T >::make().

1368 {
1369  typedef TrinaryNode<FnWhere, typename CreateLeaf<Vector<T1, C1>>::Leaf_t, typename CreateLeaf<T2>::Leaf_t,
1370  typename CreateLeaf<T3>::Leaf_t>
1371  Tree_t;
1372  return MakeReturn<Tree_t>::make(
1373  Tree_t(CreateLeaf<Vector<T1, C1>>::make(c), CreateLeaf<T2>::make(t), CreateLeaf<T3>::make(f)));
1374 }

◆ whitespace()

bool qmcplusplus::whitespace ( char  c)
inline

Definition at line 54 of file string_utils.h.

Referenced by split().

54 { return (c == ' ' || c == '\n' || c == '\t'); }

◆ wrapAroundBox()

void qmcplusplus::wrapAroundBox ( const PL &  lat,
const PV &  pin,
PV &  pout 
)

Definition at line 78 of file ParticleUtility.h.

79 {
80  if (pin.InUnit)
81  {
82  if (pout.InUnit)
83  {
84  for (int i = 0; i < pin.size(); i++)
85  {
86  pout[i] = lat.BConds.wrap(pin[i]); //unit -> unit
87  }
88  }
89  else
90  {
91  for (int i = 0; i < pin.size(); i++)
92  pout[i] = lat.toCart(lat.BConds.wrap(pin[i])); //unit -> cart
93  }
94  }
95  else
96  {
97  if (pout.InUnit)
98  {
99  for (int i = 0; i < pin.size(); i++)
100  pout[i] = lat.BConds.wrap(lat.toUnit(pin[i])); //cart -> unit
101  }
102  else
103  {
104  for (int i = 0; i < pin.size(); i++)
105  pout[i] = lat.toCart(lat.BConds.wrap(lat.toUnit(pin[i]))); //cart -> cart
106  }
107  }
108 }

◆ X2alpha()

void X2alpha ( const TinyVector< ValueType, 5 > &  X,
RealType  Rc,
TinyVector< ValueType, 5 > &  alpha 
)

Convert constraints to polynomial parameters.

Parameters
Xinput from evalX
Rccutoff radius
alphaoutput the polynomial parameters for the correction

Definition at line 348 of file CuspCorrectionConstruction.cpp.

Referenced by evaluateForPhi0Body().

349 {
350  RealType RcInv = 1.0 / Rc, RcInv2 = RcInv * RcInv;
351  alpha[0] = X[4];
352  alpha[1] = X[3];
353  alpha[2] = 6.0 * X[0] * RcInv2 - 3.0 * X[1] * RcInv + X[2] * 0.5 - 3.0 * X[3] * RcInv - 6.0 * X[4] * RcInv2 -
354  0.5 * X[1] * X[1];
355  alpha[3] = -8.0 * X[0] * RcInv2 * RcInv + 5.0 * X[1] * RcInv2 - X[2] * RcInv + 3.0 * X[3] * RcInv2 +
356  8.0 * X[4] * RcInv2 * RcInv + X[1] * X[1] * RcInv;
357  alpha[4] = 3.0 * X[0] * RcInv2 * RcInv2 - 2.0 * X[1] * RcInv2 * RcInv + 0.5 * X[2] * RcInv2 - X[3] * RcInv2 * RcInv -
358  3.0 * X[4] * RcInv2 * RcInv2 - 0.5 * X[1] * X[1] * RcInv2;
359 }
QMCTraits::RealType RealType

◆ Xgetrf() [1/4]

int qmcplusplus::Xgetrf ( int  n,
int  m,
float *restrict  a,
int  lda,
int *restrict  piv 
)
inline

wrappers around xgetrf lapack routines

Parameters
[in]nrows
[in]mcols
[in,out]amatrix contains LU matrix after call
[in]ldaleading dimension of a
[out]pivpivot vector

Definition at line 31 of file DiracMatrix.h.

References lda, qmcplusplus::Units::distance::m, n, and sgetrf().

Referenced by DiracMatrixComputeOMPTarget< VALUE_FP >::computeInvertAndLog(), DiracMatrix< VALUE_FP >::computeInvertAndLog(), and TEST_CASE().

32 {
33  int status;
34  sgetrf(n, m, a, lda, piv, status);
35  return status;
36 }
void sgetrf(const int &n, const int &m, float *a, const int &n0, int *piv, int &st)

◆ Xgetrf() [2/4]

int qmcplusplus::Xgetrf ( int  n,
int  m,
std::complex< float > *restrict  a,
int  lda,
int *restrict  piv 
)
inline

Definition at line 38 of file DiracMatrix.h.

References cgetrf(), lda, qmcplusplus::Units::distance::m, and n.

39 {
40  int status;
41  cgetrf(n, m, a, lda, piv, status);
42  return status;
43 }
void cgetrf(const int &n, const int &m, std::complex< float > *a, const int &n0, int *piv, int &st)

◆ Xgetrf() [3/4]

int qmcplusplus::Xgetrf ( int  n,
int  m,
double *restrict  a,
int  lda,
int *restrict  piv 
)
inline

Definition at line 45 of file DiracMatrix.h.

References dgetrf(), lda, qmcplusplus::Units::distance::m, and n.

46 {
47  int status;
48  dgetrf(n, m, a, lda, piv, status);
49  return status;
50 }
void dgetrf(const int &n, const int &m, double *a, const int &n0, int *piv, int &st)

◆ Xgetrf() [4/4]

int qmcplusplus::Xgetrf ( int  n,
int  m,
std::complex< double > *restrict  a,
int  lda,
int *restrict  piv 
)
inline

Definition at line 52 of file DiracMatrix.h.

References lda, qmcplusplus::Units::distance::m, n, and zgetrf().

53 {
54  int status;
55  zgetrf(n, m, a, lda, piv, status);
56  return status;
57 }
void zgetrf(const int &n, const int &m, std::complex< double > *a, const int &n0, int *piv, int &st)

◆ Xgetri() [1/4]

int qmcplusplus::Xgetri ( int  n,
float *restrict  a,
int  lda,
int *restrict  piv,
float *restrict  work,
int &  lwork 
)
inline

inversion of a float matrix after lu factorization

Definition at line 60 of file DiracMatrix.h.

References lda, n, and sgetri().

Referenced by DiracMatrixComputeOMPTarget< VALUE_FP >::computeInvertAndLog(), DiracMatrix< VALUE_FP >::computeInvertAndLog(), DiracMatrixComputeOMPTarget< VALUE_FP >::reset(), and DiracMatrix< VALUE_FP >::reset().

61 {
62  int status;
63  sgetri(n, a, lda, piv, work, lwork, status);
64  return status;
65 }
void sgetri(const int &n, float *a, const int &n0, int const *piv, float *work, const int &, int &st)

◆ Xgetri() [2/4]

int qmcplusplus::Xgetri ( int  n,
std::complex< float > *restrict  a,
int  lda,
int *restrict  piv,
std::complex< float > *restrict  work,
int &  lwork 
)
inline

Definition at line 67 of file DiracMatrix.h.

References cgetri(), lda, and n.

73 {
74  int status;
75  cgetri(n, a, lda, piv, work, lwork, status);
76  return status;
77 }
void cgetri(const int &n, std::complex< float > *a, const int &n0, int const *piv, std::complex< float > *work, const int &, int &st)

◆ Xgetri() [3/4]

int qmcplusplus::Xgetri ( int  n,
double *restrict  a,
int  lda,
int *restrict  piv,
double *restrict  work,
int &  lwork 
)
inline

Definition at line 79 of file DiracMatrix.h.

References dgetri(), lda, and n.

80 {
81  int status;
82  dgetri(n, a, lda, piv, work, lwork, status);
83  return status;
84 }
void dgetri(const int &n, double *a, const int &n0, int const *piv, double *work, const int &, int &st)

◆ Xgetri() [4/4]

int qmcplusplus::Xgetri ( int  n,
std::complex< double > *restrict  a,
int  lda,
int *restrict  piv,
std::complex< double > *restrict  work,
int &  lwork 
)
inline

inversion of a std::complex<double> matrix after lu factorization

Definition at line 87 of file DiracMatrix.h.

References lda, n, and zgetri().

93 {
94  int status;
95  zgetri(n, a, lda, piv, work, lwork, status);
96  return status;
97 }
void zgetri(const int &n, std::complex< double > *a, const int &n0, int const *piv, std::complex< double > *work, const int &, int &st)

◆ Ylm()

std::complex<T> qmcplusplus::Ylm ( int  l,
int  m,
const TinyVector< T, 3 > &  r 
)
inline

calculates Ylm param[in] l angular momentum param[in] m magnetic quantum number param[in] r position vector.

Note: This must be a unit vector and in the order [z,x,y] to be correct

Definition at line 89 of file Ylm.h.

References atan2(), cos(), LegendrePlm(), qmcplusplus::Units::distance::m, sin(), and sqrt().

Referenced by SoaSphericalTensor< ST >::batched_evaluateV(), Gvectors< ST, LT >::calc_Ylm_G(), Quadrature3D< T >::CheckQuadratureRule(), Quadrature3D< T >::CheckQuadratureRuleReal(), HybridRepSetReader< SA >::create_atomic_centers_Gspace(), derivYlmSpherical(), SoaSphericalTensor< ST >::evaluateV(), sphericalHarmonic(), and TEST_CASE().

90 {
91  T costheta = r[0];
92  T phi = std::atan2(r[2], r[1]);
93  int lmm = l - m;
94  int lpm = l + m;
95  T mfact = 1.0;
96  T pfact = 1.0;
97  for (int i = lmm; i > 0; i--)
98  mfact *= static_cast<T>(i);
99  for (int i = lpm; i > 0; i--)
100  pfact *= static_cast<T>(i);
101  T prefactor = std::sqrt(static_cast<T>(2 * l + 1) * mfact / (4.0 * M_PI * pfact));
102  prefactor *= LegendrePlm(l, m, costheta);
103  return std::complex<T>(prefactor * std::cos(m * phi), prefactor * std::sin(m * phi));
104 }
T LegendrePlm(int l, int m, T x)
Definition: Ylm.h:45
MakeReturn< UnaryNode< FnSin, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sin(const Vector< T1, C1 > &l)
MakeReturn< UnaryNode< FnCos, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t cos(const Vector< T1, C1 > &l)
MakeReturn< BinaryNode< FnArcTan2, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t, typename CreateLeaf< Vector< T2, C2 > >::Leaf_t > >::Expression_t atan2(const Vector< T1, C1 > &l, const Vector< T2, C2 > &r)
MakeReturn< UnaryNode< FnSqrt, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t sqrt(const Vector< T1, C1 > &l)

Variable Documentation

◆ app_out

std::ostringstream app_out
static

Definition at line 21 of file test_output_manager.cpp.

Referenced by init_string_output(), reset_string_output(), and TEST_CASE().

◆ batch_size

int batch_size = 2

◆ check_matrix_result

check_matrix_result = checkMatrix(lu_mat, M_mat)

◆ checkArray

auto checkArray
Initial value:
= [](auto A, auto B, int n) {
for (int i = 0; i < n; ++i)
{
CHECK(A[i] == Approx(B[i]));
}
}
CHECK(log_values[1]==ComplexApprox(std::complex< double >{ 5.531331998282581, -8.805487075984523 }))
double B(double x, int k, int i, const std::vector< double > &t)

Definition at line 441 of file test_cuBLAS_LU.cpp.

Referenced by TestFillBufferRngReal< T >::operator()(), TestFillVecRngReal< T >::operator()(), TestGetVecRngReal< T >::operator()(), TestFillBufferRngComplex< T >::operator()(), TestFillVecRngComplex< T >::operator()(), TestGetVecRngComplex< T >::operator()(), and TEST_CASE().

◆ checkRs

auto checkRs
Initial value:
= [&](auto& rs) {
for (int i = 0; i < size_test; ++i)
{
CHECK(Approx(gauss_random_vals[3 * i]) == rs[i][0]);
CHECK(Approx(gauss_random_vals[3 * i + 1]) == rs[i][1]);
CHECK(Approx(gauss_random_vals[3 * i + 2]) == rs[i][2]);
}
}
std::vector< double > gauss_random_vals(size_test *3+(size_test *3) % 2+size_test)
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))

Definition at line 117 of file test_random_seq.cpp.

◆ clone

◆ coeff_rot_by_point05

const std::string coeff_rot_by_point05
Initial value:
= R"(
0.998750260394966 0.0499791692706783
-0.0499791692706783 0.998750260394966
)"

Definition at line 534 of file test_RotatedSPOs_LCAO.cpp.

Referenced by TEST_CASE().

◆ coeff_rot_by_point1

const std::string coeff_rot_by_point1
Initial value:
= R"(
0.995004165278026 0.0998334166468282
-0.0998334166468282 0.995004165278026
)"

Definition at line 465 of file test_RotatedSPOs_LCAO.cpp.

Referenced by TEST_CASE().

◆ coeff_rot_by_point2

const std::string coeff_rot_by_point2
Initial value:
= R"(
0.980066577841242 0.198669330795061
-0.198669330795061 0.980066577841242
)"

Definition at line 470 of file test_RotatedSPOs_LCAO.cpp.

Referenced by TEST_CASE().

◆ comm

Definition at line 50 of file test_EstimatorManagerNew.cpp.

Referenced by QMCDriverNew::adjustGlobalWalkerCount(), HybridRepCplx< SPLINEBASE >::bcast_tables(), HybridRepReal< SPLINEBASE >::bcast_tables(), AtomicOrbitals< ST >::bcast_tables(), SplineC2R< ST >::bcast_tables(), SplineR2R< ST >::bcast_tables(), SplineC2C< ST >::bcast_tables(), SplineC2COMPTarget< ST >::bcast_tables(), SplineC2ROMPTarget< ST >::bcast_tables(), HybridRepCenterOrbitals< SPLINEBASE::DataType >::bcast_tables(), TimerManager< qmcplusplus::TimerType< CLOCK > >::collate_flat_profile(), DMCFactory::create(), RMCFactory::create(), VMCFactory::create(), DMCFactoryNew::create(), VMCFactoryNew::create(), qmcplusplus::testing::createDriver(), QMCDriverFactory::createQMCDriver(), createWalkerController(), fill_from_text(), HybridRepCenterOrbitals< SPLINEBASE::DataType >::gather_atomic_tables(), HybridRepCplx< SPLINEBASE >::gather_tables(), HybridRepReal< SPLINEBASE >::gather_tables(), AtomicOrbitals< ST >::gather_tables(), SplineC2R< ST >::gather_tables(), SplineR2R< ST >::gather_tables(), SplineC2C< ST >::gather_tables(), SplineC2COMPTarget< ST >::gather_tables(), SplineC2ROMPTarget< ST >::gather_tables(), BsplineReader::initialize_spo2band(), MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalHamiltonianPool::make_hamWithEE(), MinimalWaveFunctionPool::make_O2_spinor(), MinimalWaveFunctionPool::make_O2_spinor_J12(), MinimalHamiltonianPool::makeHamWithEEEI(), makePsets(), MCPopulation::measureGlobalEnergyVariance(), mpiTestFunctionWrapped(), output_hardware_info(), TimerManager< qmcplusplus::TimerType< CLOCK > >::output_timing(), TimerManager< qmcplusplus::TimerType< CLOCK > >::print(), TimerManager< qmcplusplus::TimerType< CLOCK > >::print_flat(), TimerManager< qmcplusplus::TimerType< CLOCK > >::print_stack(), PWOrbitalSetBuilder::PWOrbitalSetBuilder(), QMCDriverNew::QMCDriverNew(), QMCWFOptLinearFactoryNew(), RandomNumberControl::read(), RandomNumberControl::read_parallel(), RandomNumberControl::read_rank_0(), hdf_archive::set_access_plist(), SetupSFNBranch::SetupSFNBranch(), SetupSimpleFixedNodeBranch::SetupSimpleFixedNodeBranch(), QMCDriverNew::setWalkerOffsets(), WalkerControl::syncFutureWalkersPerRank(), MCPopulation::syncWalkersPerRank(), TEST_CASE(), TraceManager::TraceManager(), WalkerLogManager::WalkerLogManager(), RandomNumberControl::write(), RandomNumberControl::write_parallel(), and RandomNumberControl::write_rank_0().

◆ CUDAallocator_device_mem_allocated

std::atomic<size_t> CUDAallocator_device_mem_allocated

◆ debug_out

std::ostringstream debug_out
static

Definition at line 23 of file test_output_manager.cpp.

Referenced by init_string_output(), reset_string_output(), and TEST_CASE().

◆ dims

◆ DMAX

const unsigned int DMAX = 4

Definition at line 47 of file TraceManager.h.

Referenced by TraceSample< TraceReal >::check_shape().

◆ DMCMPITimerNames

TimerNameList_t<DMC_MPI_Timers> DMCMPITimerNames
Initial value:
= {{DMC_MPI_branch, "WalkerControlMPI::branch"},
{DMC_MPI_imbalance, "WalkerControlMPI::imbalance"},
{DMC_MPI_prebalance, "WalkerControlMPI::pre-loadbalance"},
{DMC_MPI_copyWalkers, "WalkerControlMPI::copyWalkers"},
{DMC_MPI_allreduce, "WalkerControlMPI::allreduce"},
{DMC_MPI_loadbalance, "WalkerControlMPI::loadbalance"},
{DMC_MPI_send, "WalkerControlMPI::send"},
{DMC_MPI_recv, "WalkerControlMPI::recv"}}

Definition at line 41 of file WalkerControlMPI.cpp.

◆ DMCTimerNames

TimerNameList_t< DMCTimers > DMCTimerNames
Initial value:
= {{DMC_buffer, "DMCUpdatePbyP::Buffer"},
{DMC_movePbyP, "DMCUpdatePbyP::movePbyP"},
{DMC_hamiltonian, "DMCUpdatePbyP::Hamiltonian"},
{DMC_collectables, "DMCUpdatePbyP::Collectables"},
{DMC_tmoves, "DMCUpdatePbyP::Tmoves"}}

Definition at line 35 of file DMCUpdatePbyPFast.cpp.

◆ DMTimerNames

const TimerNameList_t<DMTimers> DMTimerNames
static
Initial value:
=
{{DM_eval, "DensityMatrices1B::evaluate"},
{DM_gen_samples, "DensityMatrices1B::generate_samples"},
{DM_gen_sample_basis, "DensityMatrices1B::generate_sample_basis"},
{DM_gen_sample_ratios, "DensityMatrices1B::generate_sample_ratios"},
{DM_gen_particle_basis, "DensityMatrices1B::generate_particle_basis"},
{DM_matrix_products, "DensityMatrices1B::evaluate_matrix_products"},
{DM_accumulate, "DensityMatrices1B::evaluate_matrix_accum"}}

Definition at line 39 of file DensityMatrices1B.cpp.

◆ doc

Definition at line 368 of file test_OneBodyDensityMatrices.cpp.

Referenced by create_CN_Hamiltonian(), create_CN_particlesets(), qmcplusplus::testing::createEstimatorManagerNewGlobalInputXML(), qmcplusplus::testing::createEstimatorManagerNewInputXML(), qmcplusplus::testing::createEstimatorManagerNewVMCInputXML(), doSOECPotentialTest(), QMCGaussianParserBase::dump(), RMGParser::dumpPBC(), QMCGaussianParserBase::dumpPBC(), MinimalWaveFunctionPool::make_diamondC_1x1x1(), MinimalParticlePool::make_H2(), MinimalHamiltonianPool::make_hamWithEE(), MinimalWaveFunctionPool::make_O2_spinor(), MinimalWaveFunctionPool::make_O2_spinor_J12(), MinimalHamiltonianPool::makeHamWithEEEI(), makeTestRPI(), output_hardware_info(), ParticleSetPool::output_particleset_info(), TimerManager< qmcplusplus::TimerType< CLOCK > >::output_timing(), parse_electron_ion_pbc_z(), parse_pbc_fcc_lattice(), parse_pbc_lattice(), MinimalParticlePool::parseParticleSetXML(), saveCusp(), HamiltonianPool::setDocument(), setup_He_wavefunction(), setupParticleSetPool(), setupParticleSetPoolBe(), SpaceGridEnv< VALID >::SpaceGridEnv(), SpaceGridEnv< ValidSpaceGridInput::valid::CYLINDRICAL >::SpaceGridEnv(), test_C_diamond(), test_cartesian_ao(), TEST_CASE(), TEST_CASE(), test_diamond_2x1x1_xml_input(), test_dirac_ao(), test_EtOH_mw(), test_HCN(), test_hcpBe_rotation(), test_He(), test_He_mw(), test_He_sto3g_xml_input(), test_J1_spline(), test_J3_polynomial3D(), test_LCAO_DiamondC_2x1x1_cplx(), test_LCAO_DiamondC_2x1x1_real(), test_lcao_spinor(), test_lcao_spinor_excited(), test_lcao_spinor_ion_derivs(), test_LiH_msd(), test_LiH_msd_xml_input(), test_LiH_msd_xml_input_with_positron(), test_Ne(), VMCBatchedTest::testCalcDefaultLocalWalkers(), and testTrialWaveFunction_diamondC_2x1x1().

◆ dual_device_mem_allocated

◆ dump_obdm

constexpr bool dump_obdm = false

Definition at line 51 of file test_OneBodyDensityMatrices.cpp.

Referenced by TEST_CASE().

◆ embt

testing::EstimatorManagerNewTest embt ( ham  ,
,
 
)

Referenced by if(), and TEST_CASE().

◆ emn

EstimatorManagerNew emn(comm, std::move(emi), ham, pset, twf)

Referenced by TEST_CASE().

◆ emn2

EstimatorManagerNew emn2(comm, std::move(emi2), ham, pset, twf)

◆ emnta

◆ emnta2

◆ err_out

std::ostringstream err_out
static

Definition at line 22 of file test_output_manager.cpp.

Referenced by init_string_output(), reset_string_output(), and TEST_CASE().

◆ estimators_doc

◆ estimators_doc2

Libxml2Document estimators_doc2 = createEstimatorManagerNewInputXML()

Definition at line 77 of file test_EstimatorManagerNew.cpp.

◆ fake_random_global

RNGThreadSafe<FakeRandom<OHMMS_PRECISION_FULL> > fake_random_global

Definition at line 36 of file RandomGenerator.cpp.

◆ generate_test_data

constexpr bool generate_test_data = false

set to true to generate new random R for particles.

EXPECT all tests to fail in this case!

Definition at line 32 of file test_QMCHamiltonian.cpp.

Referenced by TEST_CASE(), OneBodyDensityMatricesTests< T >::testAccumulate(), and OneBodyDensityMatricesTests< T >::testEvaluateMatrix().

◆ good_data

std::vector<QMCTraits::RealType> good_data = embt.generateGoodOperatorData(num_ranks)

Definition at line 97 of file test_manager_mpi.cpp.

◆ ham

◆ hamiltonian_pool

◆ hFile

hdf_archive hFile
Initial value:
{
std::filesystem::path filename("tmp_ObservableHelper2.h5")

Definition at line 45 of file test_ObservableHelper.cpp.

◆ hide_hdf_errors

hdf_error_suppression hide_hdf_errors

Suppress HDF5 warning and error messages.

Definition at line 23 of file hdf_archive.cpp.

◆ hstream

auto & hstream = cuda_handles->hstream

Definition at line 218 of file test_cuBLAS_LU.cpp.

Referenced by TEST_CASE().

◆ iattribute

int iattribute = species_set.addAttribute("membersize")

Definition at line 138 of file test_SpinDensityNew.cpp.

Referenced by qmcplusplus::testing::makeSpeciesSet(), and TEST_CASE().

◆ identity_coeff

const std::string identity_coeff
Initial value:
= R"(
1.0 0.0
0.0 1.0
)"

Definition at line 218 of file test_RotatedSPOs_LCAO.cpp.

Referenced by TEST_CASE().

◆ inone

const int inone = std::numeric_limits<int>::min()

Definition at line 23 of file SPOSetInputInfo.cpp.

Referenced by SPOSetInputInfo::put(), and SPOSetInputInfo::reset().

◆ ispecies

◆ lattice

◆ lda

int lda = 4

Definition at line 217 of file test_cuBLAS_LU.cpp.

Referenced by qmcplusplus::compute::applyW_batched(), qmcplusplus::SYCL::applyW_batched(), DiracMatrixComputeOMPTarget< VALUE_FP >::computeInvertAndLog(), DiracMatrix< VALUE_FP >::computeInvertAndLog(), computeLogDet_sycl(), qmcplusplus::SYCL::copyAinvRow_saveGL_batched(), qmcplusplus::compute::copyAinvRow_saveGL_batched(), qmcplusplus::cuBLAS::geam(), LAPACK::geev(), qmcplusplus::compute::BLAS::gemm(), BLAS::gemm(), qmcplusplus::syclBLAS::gemm(), qmcplusplus::ompBLAS::gemm< double >(), qmcplusplus::ompBLAS::gemm< float >(), qmcplusplus::ompBLAS::gemm< std::complex< double > >(), qmcplusplus::ompBLAS::gemm< std::complex< float > >(), qmcplusplus::compute::BLAS::gemm_batched(), qmcplusplus::ompBLAS::gemm_batched< double >(), qmcplusplus::ompBLAS::gemm_batched< float >(), qmcplusplus::ompBLAS::gemm_batched< std::complex< double > >(), qmcplusplus::ompBLAS::gemm_batched< std::complex< float > >(), qmcplusplus::ompBLAS::gemm_batched_impl(), qmcplusplus::ompBLAS::gemm_impl(), qmcplusplus::syclBLAS::gemv(), qmcplusplus::compute::BLAS::gemv(), BLAS::gemv(), qmcplusplus::ompBLAS::gemv< double >(), qmcplusplus::ompBLAS::gemv< float >(), qmcplusplus::ompBLAS::gemv< std::complex< double > >(), qmcplusplus::ompBLAS::gemv< std::complex< float > >(), qmcplusplus::compute::BLAS::gemv_batched(), qmcplusplus::syclBLAS::gemv_batched< double >(), qmcplusplus::ompBLAS::gemv_batched< double >(), qmcplusplus::syclBLAS::gemv_batched< float >(), qmcplusplus::ompBLAS::gemv_batched< float >(), qmcplusplus::syclBLAS::gemv_batched< std::complex< double > >(), qmcplusplus::ompBLAS::gemv_batched< std::complex< double > >(), qmcplusplus::syclBLAS::gemv_batched< std::complex< float > >(), qmcplusplus::ompBLAS::gemv_batched< std::complex< float > >(), qmcplusplus::ompBLAS::gemv_batched_impl(), qmcplusplus::ompBLAS::gemv_impl(), qmcplusplus::compute::BLAS::ger(), BLAS::ger(), qmcplusplus::ompBLAS::ger< double >(), qmcplusplus::ompBLAS::ger< float >(), qmcplusplus::ompBLAS::ger< std::complex< double > >(), qmcplusplus::ompBLAS::ger< std::complex< float > >(), qmcplusplus::compute::BLAS::ger_batched(), qmcplusplus::syclBLAS::ger_batched< double >(), qmcplusplus::ompBLAS::ger_batched< double >(), qmcplusplus::syclBLAS::ger_batched< float >(), qmcplusplus::ompBLAS::ger_batched< float >(), qmcplusplus::syclBLAS::ger_batched< std::complex< double > >(), qmcplusplus::ompBLAS::ger_batched< std::complex< double > >(), qmcplusplus::syclBLAS::ger_batched< std::complex< float > >(), qmcplusplus::ompBLAS::ger_batched< std::complex< float > >(), qmcplusplus::syclBLAS::ger_batched_impl(), qmcplusplus::ompBLAS::ger_batched_impl(), qmcplusplus::ompBLAS::ger_impl(), LAPACK::gesvd(), qmcplusplus::cusolver::getrf(), qmcplusplus::rocsolver::getrf(), qmcplusplus::cuBLAS::getrf_batched(), qmcplusplus::cusolver::getrf_bufferSize(), qmcplusplus::rocsolver::getri(), qmcplusplus::cuBLAS::getri_batched(), qmcplusplus::cusolver::getrs(), qmcplusplus::rocsolver::getrs(), LAPACK::ggev(), LAPACK::heev(), hipblasCgemmBatched(), hipblasCgetrfBatched_(), hipblasCgetriBatched_(), hipblasDgetrfBatched_(), hipblasDgetriBatched_(), hipblasSgetrfBatched_(), hipblasSgetriBatched_(), hipblasZgemmBatched(), hipblasZgetrfBatched_(), hipblasZgetriBatched_(), DiracMatrixComputeOMPTarget< VALUE_FP >::invert_transpose(), DiracMatrix< VALUE_FP >::invert_transpose(), DiracMatrixComputeCUDA< VALUE_FP >::invert_transpose(), DelayedUpdateBatched< PL, VALUE >::mw_accept_rejectRow(), DiracMatrixComputeCUDA< VALUE_FP >::mw_computeInvertAndLog(), DiracMatrixComputeCUDA< VALUE_FP >::mw_computeInvertAndLog_stride(), DiracMatrixComputeCUDA< VALUE_FP >::mw_invertTranspose(), DelayedUpdateBatched< PL, VALUE >::mw_updateInvMat(), DelayedUpdateBatched< PL, VALUE >::mw_updateRow(), PosSoA2AoS(), qmcplusplus::simd::remapCopy(), DiracMatrixComputeOMPTarget< VALUE_FP >::reset(), DiracMatrix< VALUE_FP >::reset(), TEST_CASE(), qmcplusplus::simd::transpose(), qmcplusplus::syclBLAS::transpose(), DelayedUpdateBatched< PL, VALUE >::updateRow(), Xgetrf(), and Xgetri().

◆ lookup_input_enum_value

std::unordered_map<std::string, std::any> lookup_input_enum_value
Initial value:
{{"testenum1-value1", TestEnum1::VALUE1},
{"testenum1-value2", TestEnum1::VALUE2},
{"testenum2-value1", TestEnum2::VALUE1},
{"testenum2-value2", TestEnum2::VALUE2}}

Definition at line 43 of file test_InputSection.cpp.

Referenced by TestInputSection::assignAnyEnum().

◆ lu

std::vector< double > lu
Initial value:
= {{8.0, 0.5},
{0.8793774319066148, 0.07003891050583658},
{0.24980544747081712, -0.0031128404669260694},
{0.6233463035019455, -0.026459143968871595},
{2.0, 0.1},
{6.248249027237354, 0.2719844357976654},
{0.7194170575332381, -0.01831314754114669},
{0.1212375092639108, 0.02522449751055713},
{6.0, -0.2},
{0.7097276264591441, -0.4443579766536965},
{4.999337315778741, 0.6013141870887196},
{0.26158183940834034, 0.23245112532996867},
{4.0, -0.6},
{4.440466926070039, -1.7525291828793774},
{0.840192589866152, 1.5044529443071093},
{1.0698651110730424, -0.10853319738453365}}

Definition at line 224 of file test_cuBLAS_LU.cpp.

Referenced by TEST_CASE().

◆ lu2

std::vector< double > lu2
Initial value:
= {{8.0, 0.5},
{0.8793774319066148, 0.07003891050583658},
{0.49883268482490273, -0.01867704280155642},
{0.24980544747081712, -0.0031128404669260694},
{2.0, 0.1},
{6.248249027237354, 0.2719844357976654},
{0.800088933543564, -0.004823898651572499},
{0.2401906003014191, 0.0025474386841018853},
{3.0, -0.2},
{3.3478599221789884, -0.23424124513618677},
{0.8297816353227319, 1.3593612303468308},
{0.6377685195602139, -0.6747848919351336},
{4.0, -0.6},
{4.440466926070039, -1.7525291828793774},
{-1.5284389377713894, 1.6976073494521235},
{2.7608934839023482, -1.542084179899335}}

Definition at line 241 of file test_cuBLAS_LU.cpp.

◆ lus

lus[1] = dev_lu.data()

Definition at line 264 of file test_cuBLAS_LU.cpp.

Referenced by TEST_CASE().

◆ M2_vec

std::vector<double, CUDAHostAllocator<double> > M2_vec {6, 5, 7, 5, 2, 2, 5, 4, 8, 2, 6, 4, 3, 8, 6, 8}

Definition at line 380 of file test_cuBLAS_LU.cpp.

◆ M_vec

std::vector<double, CUDAHostAllocator<double> > M_vec {2, 5, 7, 5, 5, 2, 5, 4, 8, 2, 6, 4, 7, 8, 6, 8}

Definition at line 379 of file test_cuBLAS_LU.cpp.

Referenced by TEST_CASE().

◆ mc_coords_rs

MCCoords<CoordsType::POS> mc_coords_rs(size_test)

◆ mc_coords_rsspins

MCCoords<CoordsType::POS_SPIN> mc_coords_rsspins(size_test)

◆ Ms

std::vector<double*, CUDAHostAllocator<double*> > Ms {devM_vec.data(), devM2_vec.data()}

Definition at line 383 of file test_cuBLAS_LU.cpp.

Referenced by TEST_CASE().

◆ n

int n = 4

Definition at line 216 of file test_cuBLAS_LU.cpp.

Referenced by qmcplusplus::simd::accumulate_n(), qmcplusplus::simd::accumulate_phases(), qmcplusplus::simd::add(), EstimatorManagerBase::add(), Matrix< ST, qmcplusplus::Mallocator< ST > >::add(), SpeciesSet::addAttribute(), XmlNode::addAttribute(), XmlNode::addParameterChild(), XmlNode::addYesNoAttribute(), XmlNode::addYesNoParameterChild(), Mallocator< RealType * >::allocate(), CUDAManagedAllocator< T >::allocate(), SYCLSharedAllocator< T, ALIGN >::allocate(), DualAllocator< T, DeviceAllocator, HostAllocator >::allocate(), OMPallocator< Value >::allocate(), CUDAAllocator< T_FP >::allocate(), SYCLAllocator< std::int64_t >::allocate(), CUDAHostAllocator< T_FP >::allocate(), SYCLHostAllocator< int >::allocate(), CUDALockedPageAllocator< T, ULPHA >::allocate(), IOVarBase::Append(), DTD_BConds< T, 3, PPPO >::apply_bc(), DTD_BConds< T, D, SC >::apply_bc(), DTD_BConds< T, 2, SUPERCELL_BULK >::apply_bc(), DTD_BConds< T, 3, PPPS >::apply_bc(), DTD_BConds< T, 2, PPPS >::apply_bc(), DTD_BConds< T, 2, PPPO >::apply_bc(), DTD_BConds< T, 3, PPPG >::apply_bc(), DTD_BConds< T, 2, SUPERCELL_WIRE >::apply_bc(), DTD_BConds< T, 3, PPNG >::apply_bc(), DTD_BConds< T, 3, PPNO >::apply_bc(), DTD_BConds< T, 3, PPNS >::apply_bc(), DTD_BConds< T, 3, SUPERCELL_WIRE >::apply_bc(), DTD_BConds< T, 3, PPPX >::apply_bc(), DTD_BConds< T, 3, PPNX >::apply_bc(), assignGaussRand(), assignUniformRand(), Matrix< ST, qmcplusplus::Mallocator< ST > >::attachReference(), Vector< T, std::allocator< T > >::attachReference(), VectorSoaContainer< ST, 5 >::attachReference(), BLAS::axpy(), MultiFunctorAdapter< FN >::batched_evaluate(), Communicate::bcast(), BranchIO< SFNB >::bcast_state(), EinsplineSetBuilder::bcastSortBands(), bspline(), TestSmallMatrixDetCalculator< T >::build_interal_data(), QMCFiniteSize::build_spherical_grid(), MultiDiracDeterminant::buildTableMatrix_calculateRatios_impl(), MultiDiracDeterminant::buildTableMatrix_calculateRatiosValueMatrixOneParticle(), LPQHIBasis::c(), LPQHISRCoulombBasis::c(), qmcplusplus::compute::calcGradients_batched(), qmcplusplus::SYCL::calcGradients_batched(), calcSmallDeterminant(), ci_configuration2::calculateExcitations(), ci_configuration2::calculateNumOfExcitations(), Cartesian2Spherical(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::CartesianTensor(), J1OrbitalSoA< FT >::checkOutVariables(), WalkerLogCollector::collect(), WalkerLogBuffer< WLog::Real >::collect(), DescentEngine::computeFinalizationUncertainties(), DiracMatrixComputeOMPTarget< VALUE_FP >::computeInvertAndLog(), DiracMatrix< VALUE_FP >::computeInvertAndLog(), computeLogDet(), computeLogDet_sycl(), conjdot(), DTD_BConds< T, 3, PPPX >::convert2Cart(), DTD_BConds< T, 3, PPPX >::convert2Unit(), convertToReal(), qmcplusplus::simd::copy(), BLAS::copy(), qmcplusplus::ompBLAS::copy< double >(), qmcplusplus::ompBLAS::copy< float >(), qmcplusplus::ompBLAS::copy< std::complex< double > >(), qmcplusplus::ompBLAS::copy< std::complex< float > >(), qmcplusplus::compute::BLAS::copy_batched(), qmcplusplus::ompBLAS::copy_batched< double >(), qmcplusplus::ompBLAS::copy_batched< float >(), qmcplusplus::ompBLAS::copy_batched< std::complex< double > >(), qmcplusplus::ompBLAS::copy_batched< std::complex< float > >(), qmcplusplus::ompBLAS::copy_batched_impl(), qmcplusplus::ompBLAS::copy_batched_offset< double >(), qmcplusplus::ompBLAS::copy_batched_offset< float >(), qmcplusplus::ompBLAS::copy_batched_offset< std::complex< double > >(), qmcplusplus::ompBLAS::copy_batched_offset< std::complex< float > >(), qmcplusplus::ompBLAS::copy_batched_offset_impl(), qmcplusplus::ompBLAS::copy_impl(), qmcplusplus::SYCL::copyAinvRow_saveGL_batched(), qmcplusplus::compute::copyAinvRow_saveGL_batched(), CUDAAllocator< T_FP >::copyDeviceToDevice(), SYCLAllocator< std::int64_t >::copyDeviceToDevice(), CUDAAllocator< T_FP >::copyFromDevice(), SYCLAllocator< std::int64_t >::copyFromDevice(), CUDAAllocator< T_FP >::copyToDevice(), SYCLAllocator< std::int64_t >::copyToDevice(), SPOSetInfo::count_degeneracies(), QMCGaussianParserBase::createCenter(), QMCGaussianParserBase::createCenterH5(), QMCGaussianParserBase::createDeterminantSet(), QMCGaussianParserBase::createDeterminantSetWithHDF5(), QMCGaussianParserBase::createMultiDeterminantSetCIHDF5(), QMCGaussianParserBase::createShell(), QMCGaussianParserBase::createShellH5(), QMCGaussianParserBase::createSPOSets(), QMCGaussianParserBase::createSPOSetsH5(), WalkerConfigurations::createWalkers(), MCWalkerConfiguration::createWalkers(), CubicSplineSolve(), CUDAfill_n(), TensorSoaContainer< T, 3 >::data(), LPQHISRCoulombBasis::dc_dk(), LPQHI_BasisClass::dDminus_dk(), LPQHI_BasisClass::dDplus_dk(), Mallocator< RealType * >::deallocate(), DualAllocator< T, DeviceAllocator, HostAllocator >::deallocate(), OMPallocator< Value >::deallocate(), CUDAAllocator< T_FP >::deallocate(), SYCLAllocator< std::int64_t >::deallocate(), CUDALockedPageAllocator< T, ULPHA >::deallocate(), LPQHI_BasisClass::dEminus_dk(), LPQHI_BasisClass::dEplus_dk(), Determinant(), qmc_allocator_traits< DualAllocator< T, DeviceAllocator, HostAllocator > >::deviceSideCopyN(), qmc_allocator_traits< OMPallocator< T, HostAllocator > >::deviceSideCopyN(), LRBasis::df_dr(), LRBasis::dfk_dk(), LPQHISRCoulombBasis::dh_ddelta(), LPQHIBasis::dh_dr(), LPQHISRCoulombBasis::dh_dr(), LPQHIBasis::Dminus(), LPQHISRCoulombBasis::Dminus(), LPQHI_BasisClass::Dminus(), LPQHISRCoulombBasis::Dminus_dG(), LRBreakup< BreakupBasis >::DoAllBreakup(), LRBreakup< BreakupBasis >::DoBreakup(), LRBreakup< BreakupBasis >::DoGradBreakup(), LRBreakup< BreakupBasis >::DoStrainBreakup(), qmcplusplus::simd::dot(), BLAS::dot(), LPQHIBasis::Dplus(), LPQHISRCoulombBasis::Dplus(), LPQHI_BasisClass::Dplus(), LPQHISRCoulombBasis::Dplus_dG(), LPQHIBasis::Eminus(), LPQHISRCoulombBasis::Eminus(), LPQHI_BasisClass::Eminus(), LPQHISRCoulombBasis::Eminus_dG(), LPQHIBasis::Eplus(), LPQHISRCoulombBasis::Eplus(), LPQHI_BasisClass::Eplus(), LPQHISRCoulombBasis::Eplus_dG(), error(), eval_e2iphi(), LRRPABFeeHandlerTemp< Func, BreakupBasis >::evalFk(), LRRPAHandlerTemp< Func, BreakupBasis >::evalFk(), LRHandlerTemp< Func, BreakupBasis >::evalFk(), MultiFunctorAdapter< FN >::evaluate(), L2Potential::evaluate(), LRRPABFeeHandlerTemp< Func, BreakupBasis >::evaluate(), LRHandlerTemp< Func, BreakupBasis >::evaluate(), LRRPAHandlerTemp< Func, BreakupBasis >::evaluate(), SmallMatrixDetCalculator< ValueType >::evaluate(), ShortRangeCuspFunctor< T >::evaluate(), CustomizedMatrixDet< 1 >::evaluate(), CustomizedMatrixDet< 2 >::evaluate(), PolynomialFunctor3D::evaluate(), SHOSet::evaluate_check(), DensityMatrices1B::evaluate_check(), SHOSet::evaluate_d0(), SHOSet::evaluate_d1(), SHOSet::evaluate_d2(), SHOSet::evaluate_hermite(), DensityMatrices1B::evaluate_loop(), DensityMatrices1B::evaluate_matrix(), CompositeSPOSet::evaluate_notranspose(), DTD_BConds< T, 3, PPPO >::evaluate_rsquared(), DTD_BConds< T, D, SC >::evaluate_rsquared(), DTD_BConds< T, 3, PPPS >::evaluate_rsquared(), DTD_BConds< T, 3, PPPG >::evaluate_rsquared(), DTD_BConds< T, 3, PPNG >::evaluate_rsquared(), DTD_BConds< T, 3, PPNO >::evaluate_rsquared(), DTD_BConds< T, 3, PPNS >::evaluate_rsquared(), DTD_BConds< T, 3, SUPERCELL_WIRE >::evaluate_rsquared(), DTD_BConds< T, 3, PPPX >::evaluate_rsquared(), DTD_BConds< T, 3, PPNX >::evaluate_rsquared(), MultiSlaterDetTableMethod::evaluate_vgl_impl(), DiracDeterminantWithBackflow::evaluateDerivatives(), ShortRangeCuspFunctor< T >::evaluateDerivatives(), BsplineFunctor< REAL >::evaluateDerivatives(), PolynomialFunctor3D::evaluateDerivatives(), TwoBodyJastrow< FT >::evaluateDerivativesWF(), TwoBodyJastrow< FT >::evaluateDerivRatios(), LRHandlerTemp< Func, BreakupBasis >::evaluateLR(), LRHandlerTemp< Func, BreakupBasis >::evaluateLR_r0(), OneBodyDensityMatrices::evaluateMatrix(), kSpaceJastrow::evaluateRatiosAlltoOne(), LRHandlerSRCoulomb< Func, BreakupBasis >::evaluateSR_k0(), LRHandlerTemp< Func, BreakupBasis >::evaluateSR_k0(), LRHandlerSRCoulomb< Func, BreakupBasis >::evaluateSR_k0_dstrain(), PolynomialFunctor3D::evaluateV(), CompositeSPOSet::evaluateValue(), CompositeSPOSet::evaluateVGL(), PolynomialFunctor3D::evaluateVGL(), CompositeSPOSet::evaluateVGL_spin(), RotatedSPOs::exponentiate_antisym_matrix(), LRBasis::f(), qmc_allocator_traits< Allocator >::fill_n(), qmc_allocator_traits< DualAllocator< T, DeviceAllocator, HostAllocator > >::fill_n(), qmc_allocator_traits< OMPallocator< T, HostAllocator > >::fill_n(), qmc_allocator_traits< qmcplusplus::CUDAAllocator< T > >::fill_n(), LRBasis::fk(), flat_idx(), PooledMemory< FullPrecRealType >::forward(), Communicate::gatherv(), qmcplusplus::cuBLAS::geam(), LAPACK::geev(), qmcplusplus::compute::BLAS::gemm(), qmcplusplus::syclBLAS::gemm(), qmcplusplus::compute::BLAS::gemm_batched(), qmcplusplus::ompBLAS::gemm_batched_impl(), qmcplusplus::ompBLAS::gemm_impl(), qmcplusplus::syclBLAS::gemv(), BLAS::gemv(), qmcplusplus::compute::BLAS::gemv(), qmcplusplus::ompBLAS::gemv< double >(), qmcplusplus::ompBLAS::gemv< float >(), qmcplusplus::ompBLAS::gemv< std::complex< double > >(), qmcplusplus::ompBLAS::gemv< std::complex< float > >(), qmcplusplus::compute::BLAS::gemv_batched(), qmcplusplus::syclBLAS::gemv_batched< double >(), qmcplusplus::ompBLAS::gemv_batched< double >(), qmcplusplus::syclBLAS::gemv_batched< float >(), qmcplusplus::ompBLAS::gemv_batched< float >(), qmcplusplus::syclBLAS::gemv_batched< std::complex< double > >(), qmcplusplus::ompBLAS::gemv_batched< std::complex< double > >(), qmcplusplus::syclBLAS::gemv_batched< std::complex< float > >(), qmcplusplus::ompBLAS::gemv_batched< std::complex< float > >(), qmcplusplus::ompBLAS::gemv_batched_impl(), qmcplusplus::ompBLAS::gemv_impl(), BLAS::gemv_trans(), DensityMatrices1B::generate_density_samples(), DensityMatrices1B::generate_particle_basis(), DensityMatrices1B::generate_sample_ratios(), OneBodyDensityMatrices::generateParticleBasis(), OneBodyDensityMatrices::generateSampleRatios(), qmcplusplus::compute::BLAS::ger(), BLAS::ger(), qmcplusplus::ompBLAS::ger< double >(), qmcplusplus::ompBLAS::ger< float >(), qmcplusplus::ompBLAS::ger< std::complex< double > >(), qmcplusplus::ompBLAS::ger< std::complex< float > >(), qmcplusplus::compute::BLAS::ger_batched(), qmcplusplus::syclBLAS::ger_batched< double >(), qmcplusplus::ompBLAS::ger_batched< double >(), qmcplusplus::syclBLAS::ger_batched< float >(), qmcplusplus::ompBLAS::ger_batched< float >(), qmcplusplus::syclBLAS::ger_batched< std::complex< double > >(), qmcplusplus::ompBLAS::ger_batched< std::complex< double > >(), qmcplusplus::syclBLAS::ger_batched< std::complex< float > >(), qmcplusplus::ompBLAS::ger_batched< std::complex< float > >(), qmcplusplus::syclBLAS::ger_batched_impl(), qmcplusplus::ompBLAS::ger_batched_impl(), qmcplusplus::ompBLAS::ger_impl(), LAPACK::gesvd(), PrimeNumberSet< uint_type >::get(), CartesianTensor< T, Point_t, Tensor_t, GGG_t >::getABC(), SoaCartesianTensor< T >::getABC(), getAlignedSize(), getBestTile(), GamesAsciiParser::getCSFSign(), GaussianFCHKParser::getGaussianCenters(), DiracParser::getGaussianCenters(), LCAOHDFParser::getMO(), qmcplusplus::cusolver::getrf(), qmcplusplus::rocsolver::getrf(), LAPACK::getrf(), qmcplusplus::cuBLAS::getrf_batched(), qmcplusplus::cusolver::getrf_bufferSize(), qmcplusplus::rocsolver::getri(), LAPACK::getri(), qmcplusplus::cuBLAS::getri_batched(), qmcplusplus::cusolver::getrs(), qmcplusplus::rocsolver::getrs(), getStats(), LAPACK::ggev(), GKIntegration< F, GKRule >::GK(), GKIntegration< F, GKRule >::GKGeneral(), LPQHIBasis::h(), LPQHISRCoulombBasis::h(), LAPACK::heev(), LPQHIBasis::hintr2(), LPQHISRCoulombBasis::hintr2(), hipblasCgemmBatched(), hipblasCgetrfBatched_(), hipblasCgetriBatched_(), hipblasDgetrfBatched_(), hipblasDgetriBatched_(), hipblasSgetrfBatched_(), hipblasSgetriBatched_(), hipblasZgemmBatched(), hipblasZgetrfBatched_(), hipblasZgetriBatched_(), Crowd::incNonlocalAccept(), BsplineSet::init_base(), SHOSet::initialize(), SpaceGrid::initialize_rectilinear(), RMCUpdateAllWithDrift::initWalkers(), RMCUpdatePbyPWithDrift::initWalkers(), DensityMatrices1B::integrate(), qmcplusplus::simd::inv(), Invert(), invert_matrix(), DiracMatrixComputeOMPTarget< VALUE_FP >::invert_transpose(), DiracMatrix< VALUE_FP >::invert_transpose(), DiracMatrixComputeCUDA< VALUE_FP >::invert_transpose(), InvertLU(), InvertWithLog(), PooledMemory< FullPrecRealType >::lendReference(), Limits(), LimitsInclusive(), RotatedSPOs::log_antisym_matrix(), LRHandlerTemp< Func, BreakupBasis >::lrDf(), LUFactorization(), RandomNumberControl::make_children(), make_seed(), J1OrbitalSoA< FT >::makeClone(), qmcplusplus::testing::makeRngSpdMatrix(), qmcplusplus::testing::makeRngVector(), Matrix< ST, qmcplusplus::Mallocator< ST > >::Matrix(), MCSample::MCSample(), DescentEngine::mpi_unbiased_ratio_of_means(), DiracMatrixComputeCUDA< VALUE_FP >::mw_computeInvertAndLog(), DiracMatrixComputeCUDA< VALUE_FP >::mw_computeInvertAndLog_stride(), DiracMatrixComputeCUDA< VALUE_FP >::mw_invertTranspose(), norm(), BLAS::norm2(), Normalize(), SPOSetInputInfo::occupy_energies(), OneDimQuinticSpline< Td, Tg, CTd, CTg >::OneDimQuinticSpline(), TinyVector< T, N, base_type >::operator()(), STONorm< T >::operator()(), TestFillBufferRngReal< T >::operator()(), TestFillVecRngReal< T >::operator()(), TestGetVecRngReal< T >::operator()(), TestFillBufferRngComplex< T >::operator()(), TestFillVecRngComplex< T >::operator()(), TestGetVecRngComplex< T >::operator()(), OrthogExcluding(), OrthogLower(), Orthogonalize(), Orthogonalize2(), OutOfPlaceTranspose(), parseGridInput(), PooledData< RealType >::PooledData(), pow(), PrimeNumberSet< uint_type >::PrimeNumberSet(), print(), QMCFiniteSize::printSkRawSphAvg(), qmcplusplus::MatrixOperators::product(), OrbitalImages::put(), putContent(), LCAOSpinorBuilder::putFromH5(), LCAOrbitalBuilder::putFromH5(), LCAOrbitalBuilder::putFromXML(), LCAOrbitalBuilder::putPBCFromH5(), RecordNamedProperty< RealType >::RecordNamedProperty(), Communicate::reduce(), Communicate::reduce_in_place(), SpaceGrid::registerCollectables(), NESpaceGrid< REAL >::registerGrid(), qmcplusplus::simd::remainder(), qmcplusplus::simd::remapCopy(), OrbitalImages::report(), BlockHistogram< T >::reserve(), PooledData< RealType >::reserve(), DiracMatrixComputeOMPTarget< VALUE_FP >::reset(), GaussianTimesRN< T >::reset(), PolynomialFunctor3D::reset_gamma(), container_traits< Vector< T, ALLOC > >::resize(), container_traits< boost::multi::array< T, D, Alloc > >::resize(), RealSpacePositions::resize(), SmallMatrixDetCalculator< ValueType >::resize(), BlockHistogram< T >::resize(), RealSpacePositionsOMPTarget::resize(), container_traits< std::vector< T, ALLOC > >::resize(), container_traits< Matrix< T, ALLOC > >::resize(), TensorSoaContainer< T, 3 >::resize(), PolynomialFunctor3D::resize(), container_traits< Array< T, D > >::resize(), PooledData< RealType >::resize(), OneDimGridFunctor< T, T, Vector< T >, Vector< T > >::resize(), PairCorrEstimator::resize(), Matrix< ST, qmcplusplus::Mallocator< ST > >::resize(), BsplineFunctor< REAL >::resize(), IOVarASCII< T, RANK >::Resize(), container_proxy< std::vector< T > >::resize(), VectorSoaContainer< ST, 5 >::resize(), ConstantSizeMatrix< FullPrecRealType, std::allocator< FullPrecRealType > >::resize(), Vector< T, std::allocator< T > >::resize(), container_proxy< PooledData< T > >::resize(), RecordNamedProperty< RealType >::resize(), container_proxy< Vector< T > >::resize(), container_proxy< Matrix< T > >::resize(), NumericalGrid< T, CT >::resize(), SymmArray< T >::resize(), Vector< T, std::allocator< T > >::resize_impl(), SOECPComponent::resize_warrays(), NonLocalECPComponent::resize_warrays(), Walker< qmcplusplus::QMCTraits, qmcplusplus::PtclOnLatticeTraits >::resizeProperty(), SplineC2R< ST >::resizeStorage(), SplineR2R< ST >::resizeStorage(), SplineC2C< ST >::resizeStorage(), SplineC2COMPTarget< ST >::resizeStorage(), SplineC2ROMPTarget< ST >::resizeStorage(), SimpleGrid::ReverseMap(), LPQHISRCoulombBasis::rh(), DensityMatrices1B::same(), BLAS::scal(), STONorm< T >::set(), LogGridLight< T >::set(), OneDimQuinticSpline< Td, Tg, CTd, CTg >::set(), LinearGrid< RealType >::set(), LogGrid< T, CT >::set(), LogGridZero< T, CT >::set(), NumericalGrid< T, CT >::set(), PairCorrEstimator::set_norm_factor(), LPQHIBasis::set_NumKnots(), LPQHISRCoulombBasis::set_NumKnots(), CubicBsplineGrid< T, LINEAR_1DGRID, FIRSTDERIV_CONSTRAINTS >::setGrid(), SampleStack::setMaxSamples(), Communicate::setNumNodes(), OneDimGridFunctor< T, T, Vector< T >, Vector< T > >::setNumOfNodes(), MCWalkerConfiguration::setNumSamples(), QMCGaussianParserBase::setOccupationNumbers(), BackflowFunctionBase::setParamIndex(), RecordPropertyList::setstride(), SpeciesSet::setTotalNum(), OhmmsAsciiParser::skiplines(), SoaCartesianTensor< T >::SoaCartesianTensor(), qmcplusplus::simd::sqrt(), LRRPABFeeHandlerTemp< Func, BreakupBasis >::srDf(), LRRPAHandlerTemp< Func, BreakupBasis >::srDf(), LRHandlerTemp< Func, BreakupBasis >::srDf(), SpaceGrid::sum(), NESpaceGrid< REAL >::sum(), DescentEngine::takeSample(), TensorSoaContainer< T, 3 >::TensorSoaContainer(), RandomNumberControl::test(), TEST_CASE(), SHOSet::test_derivatives(), test_J1_spline(), SHOSet::test_overlap(), testDualAllocator(), qmcplusplus::simd::transpose(), Transpose(), qmcplusplus::syclBLAS::transpose(), EinsplineSetBuilder::TwistPair(), SHOSetBuilder::update_basis_states(), qmc_allocator_traits< DualAllocator< T, DeviceAllocator, HostAllocator > >::updateFrom(), qmc_allocator_traits< qmcplusplus::SYCLAllocator< T > >::updateFrom(), qmc_allocator_traits< DualAllocator< T, DeviceAllocator, HostAllocator > >::updateTo(), qmc_allocator_traits< qmcplusplus::SYCLAllocator< T > >::updateTo(), TraceSamples< std::complex< TraceReal > >::user_report(), Vector< T, std::allocator< T > >::Vector(), VectorSoaContainer< ST, 5 >::VectorSoaContainer(), EnergyDensityEstimator::write_nonzero_domains(), TraceRequest::write_selected(), WalkerLogManager::writeBuffers(), WalkerLogBuffer< WLog::Real >::writeSummary(), Xgetrf(), and Xgetri().

◆ no_energy_tol

constexpr RealType no_energy_tol = std::numeric_limits<RealType>::max()

Definition at line 23 of file SPOSetInfo.cpp.

Referenced by SPOSetInfo::modify().

◆ no_index

constexpr int no_index = -1

Definition at line 24 of file SPOSetInfo.cpp.

Referenced by SPOSetInfo::modify().

◆ node

◆ num_ranks

◆ obdmi

◆ oeba

oeba[0] = 1.0

Definition at line 162 of file test_SpinDensityNew.cpp.

Referenced by TEST_CASE().

◆ offset_for_rs

int offset_for_rs = (3 * size_test) + (3 * size_test) % 2

Definition at line 138 of file test_random_seq.cpp.

◆ oh

◆ okay

◆ OMPallocator_device_mem_allocated

std::atomic<size_t> OMPallocator_device_mem_allocated

◆ OptimizerNames

const std::map<std::string, OptimizerType> OptimizerNames
Initial value:
= {{"quartic", OptimizerType::QUARTIC},
{"rescale", OptimizerType::RESCALE},
{"linemin", OptimizerType::LINEMIN},
{"OneShiftOnly", OptimizerType::ONESHIFTONLY},
{"adaptive", OptimizerType::ADAPTIVE},
{"descent", OptimizerType::DESCENT},
{"hybrid", OptimizerType::HYBRID},
{"gradient_test", OptimizerType::GRADIENT_TEST}}

Definition at line 30 of file OptimizerTypes.h.

Referenced by QMCFixedSampleLinearOptimize::processOptXML(), QMCFixedSampleLinearOptimizeBatched::processOptXML(), and HybridEngine::processXML().

◆ original

SpinDensityNew original(std::move(sdi), lattice, species_set)

◆ particle_pool

◆ pivots

std::vector<int, CUDAHostAllocator<int> > pivots = {3, 4, 3, 4, 3, 4, 4, 4}

Definition at line 271 of file test_cuBLAS_LU.cpp.

Referenced by TEST_CASE().

◆ pools

SetupPools pools
Initial value:
{
using namespace testing

Definition at line 82 of file test_SFNBranch.cpp.

Referenced by CrowdWithWalkers::CrowdWithWalkers(), and TEST_CASE().

◆ propertyFloat

float propertyFloat = 10.f

Definition at line 52 of file test_ObservableHelper.cpp.

◆ propertyMatrix

Matrix<float> propertyMatrix

Definition at line 58 of file test_ObservableHelper.cpp.

◆ propertyTensor

Tensor<float, OHMMS_DIM> propertyTensor

Definition at line 55 of file test_ObservableHelper.cpp.

◆ propertyTinyVector

TinyVector<float, OHMMS_DIM> propertyTinyVector

Definition at line 61 of file test_ObservableHelper.cpp.

◆ propertyVector

std::vector<float> propertyVector

Definition at line 64 of file test_ObservableHelper.cpp.

◆ propertyVectorTinyVector

std::vector<TinyVector<float, OHMMS_DIM> > propertyVectorTinyVector

Definition at line 67 of file test_ObservableHelper.cpp.

◆ pset

auto& pset = *(particle_pool.getParticleSet("e"))

◆ pset_target

◆ qmc_common

◆ random_global

RNGThreadSafe< RandomGenerator > random_global

Definition at line 37 of file RandomGenerator.cpp.

◆ real_pivot

std::vector<int> real_pivot {3, 3, 4, 4, 3, 3, 3, 4}

Definition at line 439 of file test_cuBLAS_LU.cpp.

Referenced by TEST_CASE().

◆ rnone

const RealType rnone = std::numeric_limits<RealType>::max()

◆ run_time_manager

◆ sdi

Referenced by TEST_CASE().

◆ sdi_copy

SpinDensityInput sdi_copy = sdi

Definition at line 140 of file test_SpinDensityNew.cpp.

◆ sdn

◆ sdnt

Definition at line 163 of file test_SpinDensityNew.cpp.

◆ setup_sfnb

Initial value:
{
using namespace testing

Definition at line 112 of file test_SimpleFixedNodeBranch.cpp.

◆ sfnb

Initial value:
=
setup_sfnb(*pools.particle_pool->getParticleSet("e"), *pools.wavefunction_pool->getPrimary(),
*pools.hamiltonian_pool->getPrimary())
UPtr< ParticleSetPool > particle_pool
Definition: SetupPools.h:33
UPtr< HamiltonianPool > hamiltonian_pool
Definition: SetupPools.h:35
UPtr< WaveFunctionPool > wavefunction_pool
Definition: SetupPools.h:34
SetupPools pools
SetupSFNBranch setup_sfnb(pools.comm)

Definition at line 86 of file test_SFNBranch.cpp.

Referenced by SetupSFNBranch::createMyNode(), SetupSimpleFixedNodeBranch::createMyNode(), SetupSFNBranch::operator()(), and SetupSimpleFixedNodeBranch::operator()().

◆ snone

const std::string& snone = "none"

Definition at line 25 of file SPOSetInputInfo.cpp.

Referenced by SPOSetInputInfo::put(), and SPOSetInputInfo::reset().

◆ SODMCTimerNames

const TimerNameList_t< SODMCTimers > SODMCTimerNames
Initial value:
= {{SODMC_buffer, "SODMCUpdatePbyP::Buffer"},
{SODMC_movePbyP, "SODMCUpdatePbyP::movePbyP"},
{SODMC_hamiltonian, "SODMCUpdatePbyP::Hamiltonian"},
{SODMC_collectables, "SODMCUpdatePbyP::Collectables"},
{SODMC_tmoves, "SODMCUpdatePbyP::Tmoves"}}

Definition at line 31 of file SODMCUpdatePbyPFast.cpp.

◆ species_set

species_set = pset_target.getSpeciesSet()

◆ spomap

auto& spomap = wavefunction_pool.getWaveFunction("wavefunction")->getSPOMap()

◆ suffixes

const std::vector<std::string> suffixes
static
Initial value:
{"V", "VGL", "accept", "NLratio",
"recompute", "buffer", "derivs", "preparegroup"}

Definition at line 44 of file TrialWaveFunction.cpp.

Referenced by TrialWaveFunction::addComponent(), create_names(), and TrialWaveFunction::TrialWaveFunction().

◆ summary_out

std::ostringstream summary_out
static

Definition at line 20 of file test_output_manager.cpp.

Referenced by init_string_output(), reset_string_output(), and TEST_CASE().

◆ SYCLallocator_device_mem_allocated

std::atomic<size_t> SYCLallocator_device_mem_allocated

◆ test_project

ProjectData test_project("test", ProjectData::DriverVersion::BATCH)

◆ TestTimerNames

TimerNameList_t<TestTimer> TestTimerNames = {{MyTimer1, "Timer name 1"}, {MyTimer2, "Timer name 2"}}

Definition at line 397 of file test_timer.cpp.

Referenced by TEST_CASE().

◆ timer_max_level_exceeded

◆ twf

◆ WalkerControlTimerNames

TimerNameList_t<WC_Timers> WalkerControlTimerNames
Initial value:
= {{WC_branch, "WalkerControl::branch"},
{WC_imbalance, "WalkerControl::imbalance"},
{WC_prebalance, "WalkerControl::pre-loadbalance"},
{WC_copyWalkers, "WalkerControl::copyWalkers"},
{WC_recomputing, "WalkerControl::recomputing"},
{WC_allreduce, "WalkerControl::allreduce"},
{WC_loadbalance, "WalkerControl::loadbalance"},
{WC_send, "WalkerControl::send"},
{WC_recv, "WalkerControl::recv"}}

Definition at line 47 of file WalkerControl.cpp.

◆ wavefunction_pool

auto wavefunction_pool
Initial value:
=
MinimalWaveFunctionPool::make_diamondC_1x1x1(test_project.getRuntimeOptions(), comm, particle_pool)
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
const RuntimeOptions & getRuntimeOptions() const noexcept

Definition at line 60 of file test_EstimatorManagerNew.cpp.

Referenced by QMCDriverFactory::createQMCDriver(), MinimalHamiltonianPool::make_hamWithEE(), MinimalHamiltonianPool::makeHamWithEEEI(), TEST_CASE(), and VMCBatchedTest::testCalcDefaultLocalWalkers().