@@ -35,7 +35,7 @@ enum INTERACTION_TYPES {HH = 0, HG, GG};
3535enum RESTART_FILE_TYPES {RASPA_RESTART = 0 , LAMMPS_DATA};
3636
3737// Zhao's note: For the stage of evaluating total energy of the system//
38- enum ENERGYEVALSTAGE {INITIAL = 0 , CREATEMOL, FINAL, CREATEMOL_DELTA, DELTA, CREATEMOL_DELTA_CHECK, DELTA_CHECK, DRIFT, GPU_DRIFT, AVERAGE, AVERAGE_ERR};
38+ enum ENERGYEVALSTAGE {INITIAL = 0 , CREATEMOL, FINAL, CREATEMOL_DELTA, DELTA, CREATEMOL_DELTA_CHECK, DELTA_CHECK, DRIFT, GPU_DRIFT, AVERAGE, AVERAGE_ERR, WIDOM_AVG, WIDOM_ERR };
3939
4040struct EnergyComplex
4141{
@@ -409,6 +409,82 @@ struct TMMC
409409 }
410410};
411411
412+ // Temporary energies for a move//
413+ // Zhao's note: consider making this the default return variable for moves, like RASPA-3?//
414+ struct MoveEnergy
415+ {
416+ double storedHGVDW=0.0 ;
417+ double storedHGReal=0.0 ;
418+ double storedHGEwaldE=0.0 ;
419+ // van der Waals //
420+ double HHVDW=0.0 ;
421+ double HGVDW=0.0 ;
422+ double GGVDW=0.0 ;
423+ // Real Part of Coulomb //
424+ double HHReal=0.0 ;
425+ double HGReal=0.0 ;
426+ double GGReal=0.0 ;
427+ // Long-Range Ewald Energy //
428+ double HHEwaldE=0.0 ;
429+ double HGEwaldE=0.0 ;
430+ double GGEwaldE=0.0 ;
431+ // Other Energies //
432+ double TailE =0.0 ;
433+ double DNN_E =0.0 ;
434+ double total ()
435+ {
436+ return HHVDW + HGVDW + GGVDW +
437+ HHReal + HGReal + GGReal +
438+ HHEwaldE + HGEwaldE + GGEwaldE +
439+ TailE + DNN_E;
440+ };
441+ void take_negative ()
442+ {
443+ storedHGVDW *= -1.0 ;
444+ storedHGReal*= -1.0 ;
445+ storedHGEwaldE *= -1.0 ;
446+ HHVDW *= -1.0 ; HHReal *= -1.0 ;
447+ HGVDW *= -1.0 ; HGReal *= -1.0 ;
448+ GGVDW *= -1.0 ; GGReal *= -1.0 ;
449+ HHEwaldE *= -1.0 ; HGEwaldE *= -1.0 ; GGEwaldE *= -1.0 ;
450+ TailE *= -1.0 ;
451+ DNN_E *= -1.0 ;
452+ };
453+ void zero ()
454+ {
455+ storedHGVDW =0.0 ;
456+ storedHGReal=0.0 ;
457+ storedHGEwaldE=0.0 ;
458+ HHVDW=0.0 ; HHReal=0.0 ;
459+ HGVDW=0.0 ; HGReal=0.0 ;
460+ GGVDW=0.0 ; GGReal=0.0 ;
461+ HHEwaldE =0.0 ;
462+ HGEwaldE =0.0 ;
463+ GGEwaldE =0.0 ;
464+ TailE =0.0 ;
465+ DNN_E =0.0 ;
466+ };
467+ void print ()
468+ {
469+ printf (" HHVDW: %.5f, HHReal: %.5f, HGVDW: %.5f, HGReal: %.5f, GGVDW: %.5f, GGReal: %.5f, HHEwaldE: %.5f,\n HGEwaldE: %.5f,\n GGEwaldE: %.5f, TailE: %.5f, DNN_E: %.5f\n " , HHVDW, HHReal, HGVDW, HGReal, GGVDW, GGReal, HHEwaldE, HGEwaldE, GGEwaldE, TailE, DNN_E);
470+ printf (" Stored HGVDW: %.5f, Stored HGReal: %.5f, Stored HGEwaldE: %.5f\n " , storedHGVDW, storedHGReal, storedHGEwaldE);
471+ };
472+ void DNN_Replace_Energy ()
473+ {
474+ storedHGVDW = HGVDW;
475+ storedHGReal= HGReal;
476+ storedHGEwaldE = HGEwaldE;
477+ HGVDW = 0.0 ;
478+ HGReal= 0.0 ;
479+ HGEwaldE = 0.0 ;
480+ }
481+ double DNN_Correction () // Using DNN energy to replace HGVDW, HGReal and HGEwaldE//
482+ {
483+ double correction = DNN_E - storedHGVDW - storedHGReal - storedHGEwaldE;
484+ return correction;
485+ };
486+ };
487+
412488// Zhao's note: keep track of the Rosenbluth weights during the simulation//
413489struct RosenbluthWeight
414490{
@@ -417,6 +493,7 @@ struct RosenbluthWeight
417493 double3 Insertion = {0.0 , 0.0 , 0.0 };
418494 double3 Deletion = {0.0 , 0.0 , 0.0 };
419495 // NOTE: DO NOT RECORD FOR REINSERTIONS, SINCE THE DELETION PART OF REINSERTION IS MODIFIED//
496+ MoveEnergy widom_energy;
420497};
421498
422499struct Move_Statistics
@@ -483,6 +560,10 @@ struct Move_Statistics
483560 std::vector<std::vector<double >>MolSQPerComponent;
484561 // x: average; y: average^2; z: Number of Widom insertion performed//
485562 std::vector<RosenbluthWeight>Rosen; // vector over Nblocks//
563+
564+ MoveEnergy WidomEnergy;
565+ MoveEnergy WidomEnergy_ERR;
566+
486567 void NormalizeProbabilities ()
487568 {
488569 // Zhao's note: the probabilities here are what we defined in simulation.input, raw values//
@@ -640,81 +721,7 @@ struct Tail
640721 double Energy = {0.0 };
641722};
642723
643- // Temporary energies for a move//
644- // Zhao's note: consider making this the default return variable for moves, like RASPA-3?//
645- struct MoveEnergy
646- {
647- double storedHGVDW=0.0 ;
648- double storedHGReal=0.0 ;
649- double storedHGEwaldE=0.0 ;
650- // van der Waals //
651- double HHVDW=0.0 ;
652- double HGVDW=0.0 ;
653- double GGVDW=0.0 ;
654- // Real Part of Coulomb //
655- double HHReal=0.0 ;
656- double HGReal=0.0 ;
657- double GGReal=0.0 ;
658- // Long-Range Ewald Energy //
659- double HHEwaldE=0.0 ;
660- double HGEwaldE=0.0 ;
661- double GGEwaldE=0.0 ;
662- // Other Energies //
663- double TailE =0.0 ;
664- double DNN_E =0.0 ;
665- double total ()
666- {
667- return HHVDW + HGVDW + GGVDW +
668- HHReal + HGReal + GGReal +
669- HHEwaldE + HGEwaldE + GGEwaldE +
670- TailE + DNN_E;
671- };
672- void take_negative ()
673- {
674- storedHGVDW *= -1.0 ;
675- storedHGReal*= -1.0 ;
676- storedHGEwaldE *= -1.0 ;
677- HHVDW *= -1.0 ; HHReal *= -1.0 ;
678- HGVDW *= -1.0 ; HGReal *= -1.0 ;
679- GGVDW *= -1.0 ; GGReal *= -1.0 ;
680- HHEwaldE *= -1.0 ; HGEwaldE *= -1.0 ; GGEwaldE *= -1.0 ;
681- TailE *= -1.0 ;
682- DNN_E *= -1.0 ;
683- };
684- void zero ()
685- {
686- storedHGVDW =0.0 ;
687- storedHGReal=0.0 ;
688- storedHGEwaldE=0.0 ;
689- HHVDW=0.0 ; HHReal=0.0 ;
690- HGVDW=0.0 ; HGReal=0.0 ;
691- GGVDW=0.0 ; GGReal=0.0 ;
692- HHEwaldE =0.0 ;
693- HGEwaldE =0.0 ;
694- GGEwaldE =0.0 ;
695- TailE =0.0 ;
696- DNN_E =0.0 ;
697- };
698- void print ()
699- {
700- printf (" HHVDW: %.5f, HHReal: %.5f, HGVDW: %.5f, HGReal: %.5f, GGVDW: %.5f, GGReal: %.5f, HHEwaldE: %.5f,\n HGEwaldE: %.5f,\n GGEwaldE: %.5f, TailE: %.5f, DNN_E: %.5f\n " , HHVDW, HHReal, HGVDW, HGReal, GGVDW, GGReal, HHEwaldE, HGEwaldE, GGEwaldE, TailE, DNN_E);
701- printf (" Stored HGVDW: %.5f, Stored HGReal: %.5f, Stored HGEwaldE: %.5f\n " , storedHGVDW, storedHGReal, storedHGEwaldE);
702- };
703- void DNN_Replace_Energy ()
704- {
705- storedHGVDW = HGVDW;
706- storedHGReal= HGReal;
707- storedHGEwaldE = HGEwaldE;
708- HGVDW = 0.0 ;
709- HGReal= 0.0 ;
710- HGEwaldE = 0.0 ;
711- }
712- double DNN_Correction () // Using DNN energy to replace HGVDW, HGReal and HGEwaldE//
713- {
714- double correction = DNN_E - storedHGVDW - storedHGReal - storedHGEwaldE;
715- return correction;
716- };
717- };
724+
718725/*
719726__host__ MoveEnergy MoveEnergy_Multiply(MoveEnergy A, MoveEnergy B)
720727{
0 commit comments