39 const char* particles = R
"(<tmp> 40 <particleset name="ion0" size="1"> 42 <parameter name="charge">2</parameter> 44 <attrib name="position" datatype="posArray"> 49 <particleset name="e" random="no"> 50 <group name="u" size="1"> 51 <parameter name="charge">-1</parameter> 52 <attrib name="position" datatype="posArray"> 56 <group name="d" size="1"> 57 <parameter name="charge">-1</parameter> 58 <attrib name="position" datatype="posArray"> 71 xmlNodePtr part_ion = xmlFirstElementChild(root);
73 xmlNodePtr part_elec = xmlNextElementSibling(part_ion);
81 const char* particles = R
"(<qmcsystem> 82 <particleset name="ion0" size="1"> 84 <parameter name="charge">4</parameter> 85 <parameter name="valence">4</parameter> 86 <parameter name="atomicnumber">4</parameter> 88 <attrib name="position" datatype="posArray"> 89 0.0000000000e+00 0.0000000000e+00 0.0000000000e+00 91 <attrib name="ionid" datatype="stringArray"> 96 <particleset name="e" random="no"> 97 <group name="u" size="2"> 98 <parameter name="charge">-1</parameter> 99 <attrib name="position" datatype="posArray"> 104 <group name="d" size="2"> 105 <parameter name="charge">-1</parameter> 106 <attrib name="position" datatype="posArray"> 121 xmlNodePtr part_ion = xmlFirstElementChild(root);
123 xmlNodePtr part_elec = xmlNextElementSibling(part_ion);
128 const std::string& rot_angle_down,
129 const std::string& coeff_up,
130 const std::string& coeff_down)
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"/> 142 <basisGroup rid="R1" l="0" m="0" type="Slater"> 143 <radfunc n="2" exponent="1.0"/> 147 <rotated_sposet name="rot-spo-up"> 148 <sposet basisset="LCAOBSet" name="spo-up">)"; 152 const std::string opt_vars_start_tag(
"<opt_vars>");
153 const std::string opt_vars_end_tag(
"</opt_vars>");
155 std::string rot_angle_up_element = opt_vars_start_tag + rot_angle_up + opt_vars_end_tag +
"\n";
162 const std::string wf_input_coeff_up_start = R
"(<coefficient id="updetC" type="Array" size="2">)"; 164 const std::string wf_input_coeff_up_end(
"</coefficient>");
166 std::string coeff_up_element = wf_input_coeff_up_start + coeff_up + wf_input_coeff_up_end;
168 const std::string sposet_end = R
"(</sposet>)"; 171 const std::string wf_input2 = R
"( 173 <rotated_sposet name="rot-spo-down"> 174 <sposet basisset="LCAOBSet" name="spo-down">)"; 178 std::string rot_angle_down_element = opt_vars_start_tag + rot_angle_down + opt_vars_end_tag +
"\n";
185 const std::string wf_input_coeff_down_start = R
"(<coefficient id="downdetC" type="Array" size="2">)"; 187 const std::string wf_input_coeff_down_end(
"</coefficient>");
189 std::string coeff_down_element = wf_input_coeff_down_start + coeff_down + wf_input_coeff_down_end;
191 const std::string wf_input3 = R
"( 194 <determinantset type="MO" key="STO" transform="no" source="ion0"> 196 <determinant sposet="rot-spo-up"/> 197 <determinant sposet="rot-spo-down"/> 204 std::string wf_input = std::string(wf_input1) +
"\n" +
205 coeff_up_element +
"\n" +
207 (rot_angle_up.empty() ? std::string() : rot_angle_up_element) +
209 coeff_down_element +
"\n" +
211 (rot_angle_down.empty() ? std::string() : rot_angle_down_element) +
212 std::string(wf_input3);
254 opt_vars.resetIndex();
263 CHECK(logval == Approx(-11.467952668216984));
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));
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));
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));
336 CHECK(logval == Approx(-9.26625670653773));
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));
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));
369 const char* wf_input = R
"(<wavefunction target='e'> 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"/> 378 <basisGroup rid="R1" l="0" m="0" type="Slater"> 379 <radfunc n="2" exponent="1.0"/> 383 <rotated_sposet name="rot-spo-up"> 384 <sposet basisset="LCAOBSet" name="spo-up" method="history"> 385 <coefficient id="updetC" type="Array" size="2"> 391 <rotated_sposet name="rot-spo-down"> 392 <sposet basisset="LCAOBSet" name="spo-down" method="history"> 393 <coefficient id="updetC" type="Array" size="2"> 400 <determinantset type="MO" key="STO" transform="no" source="ion0"> 402 <determinant sposet="rot-spo-up"/> 403 <determinant sposet="rot-spo-down"/> 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> 427 opt_vars.resetIndex();
436 CHECK(logval == Approx(-15.791249652199634));
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));
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));
456 opt_vars.insert(
"rot-spo-up_orb_rot_0000_0001", 0.0,
false);
466 0.995004165278026 0.0998334166468282 467 -0.0998334166468282 0.995004165278026 471 0.980066577841242 0.198669330795061 472 -0.198669330795061 0.980066577841242 475 TEST_CASE("Rotated LCAO WF1, MO coeff rotated, zero angle",
"[qmcapp]")
504 opt_vars.resetIndex();
512 CHECK(logval == Approx(-9.26625670653773));
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));
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));
535 0.998750260394966 0.0499791692706783 536 -0.0499791692706783 0.998750260394966 539 TEST_CASE("Rotated LCAO WF1 MO coeff rotated, half angle",
"[qmcapp]")
568 opt_vars.resetIndex();
576 CHECK(logval == Approx(-9.26625670653773));
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));
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));
596 TEST_CASE(
"Rotated LCAO rotation consistency",
"[qmcapp]")
613 const char* wf_input = R
"(<wavefunction target='e'> 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"/> 622 <basisGroup rid="R1" l="0" m="0" type="Slater"> 623 <radfunc n="2" exponent="1.0"/> 625 <basisGroup rid="R2" l="0" m="0" type="Slater"> 626 <radfunc n="3" exponent="1.0"/> 630 <rotated_sposet name="rot-spo-up"> 631 <sposet basisset="LCAOBSet" name="spo-up"> 632 <coefficient id="updetC" type="Array" size="3"> 639 <rotated_sposet name="rot-spo-down"> 640 <sposet basisset="LCAOBSet" name="spo-down"> 641 <coefficient id="updetC" type="Array" size="3"> 649 <determinantset type="MO" key="STO" transform="no" source="ion0"> 651 <determinant id="rot-spo-up"/> 652 <determinant id="rot-spo-down"/> 683 REQUIRE(global_rot_spo !=
nullptr);
685 std::vector<RealType> params1 = {0.1, 0.2};
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 };
701 ValueMatrix new_rot_m0(rot_data0.data(), 3, 3);
712 std::vector<RealType> old_params = {0.0, 0.0, 0.0};
713 std::vector<RealType> new_params(3);
716 std::vector<RealType> params2 = {0.3, 0.15};
719 std::vector<RealType> new_params2(3);
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 };
732 ValueMatrix new_rot_m3(rot_data3.data(), 3, 3);
735 CHECKED_ELSE(check_matrix_result3.result) { FAIL(check_matrix_result3.result_message); }
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]));
745 TEST_CASE(
"Rotated LCAO Be single determinant",
"[qmcapp]")
763 wp.put(xmlFirstElementChild(root));
772 opt_vars.resetIndex();
781 CHECK(logval == Approx(-17.768474132175342));
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));
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));
813 TEST_CASE(
"Rotated LCAO Be multi determinant with one determinant",
"[qmcapp]")
827 bool okay =
doc.
parse(
"rot_multi_1det_Be_STO.wfnoj.xml");
831 wp.put(xmlFirstElementChild(root));
839 opt_vars.resetIndex();
848 CHECK(logval == Approx(-17.768474132175342));
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));
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));
880 TEST_CASE(
"Rotated LCAO Be two determinant",
"[qmcapp]")
894 bool okay =
doc.
parse(
"rot_multi_2det_Be_STO.wfnoj.xml");
898 wp.put(xmlFirstElementChild(root));
906 opt_vars.resetIndex();
915 CHECK(logval == Approx(-17.762687110866413));
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));
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));
base class for Single-particle orbital sets
RealType evaluateLog(ParticleSet &P)
evalaute the log (internally gradients and laplacian) of the trial wavefunction.
class that handles xmlDoc
const std::string coeff_rot_by_point05
helper functions for EinsplineSetBuilder
void evaluateDerivatives(ParticleSet &P, const opt_variables_type &optvars, Vector< ValueType > &dlogpsi, Vector< ValueType > &dhpsioverpsi)
evaluate derivatives of KE wrt optimizable varibles
QTBase::RealType RealType
bool put(xmlNodePtr cur)
process an xml element
TEST_CASE("complex_helper", "[type_traits]")
void resetParameters(const opt_variables_type &active)
Set values of parameters in each component from the global list.
OrbitalSetTraits< ValueType >::ValueMatrix ValueMatrix
CHECKED_ELSE(check_matrix_result.result)
ProjectData test_project("test", ProjectData::DriverVersion::BATCH)
void update(bool skipSK=false)
update the internal data
const std::string coeff_rot_by_point1
Communicate * Controller
Global Communicator for a process.
ParticleLaplacian L
laplacians of the particles
const std::string identity_coeff
const RuntimeOptions & getRuntimeOptions() const noexcept
Wrapping information on parallelism.
Specialized paritlce class for atomistic simulations.
const std::string coeff_rot_by_point2
QTBase::ValueType ValueType
REQUIRE(std::filesystem::exists(filename))
SPOSetPtr getPhi(int i=0)
ParticleSet * getParticleSet(const std::string &pname)
get a named ParticleSet
void setupParticleSetPool(ParticleSetPool &pp)
static void mw_evaluateParameterDerivatives(const RefVectorWithLeader< TrialWaveFunction > &wf_list, const RefVectorWithLeader< ParticleSet > &p_list, const opt_variables_type &optvars, RecordArray< ValueType > &dlogpsi, RecordArray< ValueType > &dhpsioverpsi)
Declaration of WaveFunctionPool.
std::string result_message
void applyDeltaRotation(const std::vector< ValueType > &delta_param, const std::vector< ValueType > &old_param, std::vector< ValueType > &new_param)
Manage a collection of ParticleSet objects.
ParticleGradient G
gradients of the particles
std::shared_ptr< OffloadValueMatrix > C
pointer to matrix containing the coefficients
class to handle a set of variables that can be modified during optimizations
std::vector< std::unique_ptr< WaveFunctionComponent > > const & getOrbitals()
void checkOutVariables(const opt_variables_type &o)
Check out optimizable variables Assign index mappings from global list (o) to local values in each co...
void setupParticleSetPoolBe(ParticleSetPool &pp)
void apply_rotation(const std::vector< ValueType > ¶m, bool use_stored_copy)
Class to represent a many-body trial wave function.
bool parseFromString(const std::string_view data)
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...
std::unique_ptr< SPOSet > Phi_
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
bool parse(const std::string &fname)
LatticeGaussianProduct::ValueType ValueType
class to handle linear combinations of basis orbitals used to evaluate the Dirac determinants.
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)
Manage a collection of TrialWaveFunction objects.
Declaration of ParticleSetPool.
void checkInVariables(opt_variables_type &o)
Check in an optimizable parameter.