Changes in src/joiner.cpp [437922:5bc4d0]
- File:
-
- 1 edited
-
src/joiner.cpp (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/joiner.cpp
r437922 r5bc4d0 2 2 * 3 3 * Takes evaluated fragments (energy and forces) and by reading the factors files determines total energy 4 * and each force for the whole molecule. 5 * 4 * and each force for the whole molecule. 5 * 6 6 */ 7 7 8 8 //============================ INCLUDES =========================== 9 9 10 #include "datacreator.hpp" 11 #include "helpers.hpp" 12 #include "parser.hpp" 13 #include "periodentafel.hpp" 10 #include "datacreator.hpp" 11 #include "helpers.hpp" 12 #include "parser.hpp" 13 #include "periodentafel.hpp" 14 14 15 15 //============================== MAIN ============================= … … 28 28 ForceMatrix ShieldingFragments; 29 29 ForceMatrix ShieldingPASFragments; 30 KeySetsContainer KeySet; 30 EnergyMatrix Chi; 31 EnergyMatrix ChiPAS; 32 EnergyMatrix ChiFragments; 33 EnergyMatrix ChiPASFragments; 34 KeySetsContainer KeySet; 31 35 stringstream prefix; 32 36 char *dir = NULL; … … 35 39 cout << "Joiner" << endl; 36 40 cout << "======" << endl; 37 41 38 42 // Get the command line options 39 43 if (argc < 3) { … … 52 56 periode->LoadPeriodentafel(argv[3]); 53 57 } 54 58 55 59 // Test the given directory 56 60 if (!TestParams(argc, argv)) 57 61 return 1; 58 62 59 63 // +++++++++++++++++ PARSING +++++++++++++++++++++++++++++++ 60 64 61 65 // ------------- Parse through all Fragment subdirs -------- 62 66 if (!Energy.ParseFragmentMatrix(argv[1], dir, EnergySuffix, 0,0)) return 1; … … 66 70 if (!Shielding.ParseFragmentMatrix(argv[1], dir, ShieldingSuffix, 1, 0)) return 1; 67 71 if (!ShieldingPAS.ParseFragmentMatrix(argv[1], dir, ShieldingPASSuffix, 1, 0)) return 1; 72 if (!Chi.ParseFragmentMatrix(argv[1], dir, ChiSuffix, 1, 0)) return 1; 73 if (!ChiPAS.ParseFragmentMatrix(argv[1], dir, ChiPASSuffix, 1, 0)) return 1; 68 74 } 69 75 … … 71 77 if (!Energy.ParseIndices()) return 1; 72 78 if (Hcorrected) Hcorrection.ParseIndices(); 73 79 74 80 // ---------- Parse the Force indices into an array --------------- 75 81 if (!Force.ParseIndices(argv[1])) return 1; … … 79 85 if(!Shielding.ParseIndices(argv[1])) return 1; 80 86 if(!ShieldingPAS.ParseIndices(argv[1])) return 1; 87 if(!Chi.ParseIndices()) return 1; 88 if(!ChiPAS.ParseIndices()) return 1; 81 89 } 82 90 83 91 // ---------- Parse the KeySets into an array --------------- 84 92 if (!KeySet.ParseKeySets(argv[1], Force.RowCounter, Force.MatrixCounter)) return 1; 85 86 93 if (!KeySet.ParseManyBodyTerms()) return 1; 94 87 95 if (!EnergyFragments.AllocateMatrix(Energy.Header, Energy.MatrixCounter, Energy.RowCounter, Energy.ColumnCounter)) return 1; 88 96 if (Hcorrected) HcorrectionFragments.AllocateMatrix(Hcorrection.Header, Hcorrection.MatrixCounter, Hcorrection.RowCounter, Hcorrection.ColumnCounter); … … 91 99 if (!ShieldingFragments.AllocateMatrix(Shielding.Header, Shielding.MatrixCounter, Shielding.RowCounter, Shielding.ColumnCounter)) return 1; 92 100 if (!ShieldingPASFragments.AllocateMatrix(ShieldingPAS.Header, ShieldingPAS.MatrixCounter, ShieldingPAS.RowCounter, ShieldingPAS.ColumnCounter)) return 1; 93 } 94 101 if (!ChiFragments.AllocateMatrix(Chi.Header, Chi.MatrixCounter, Chi.RowCounter, Chi.ColumnCounter)) return 1; 102 if (!ChiPASFragments.AllocateMatrix(ChiPAS.Header, ChiPAS.MatrixCounter, ChiPAS.RowCounter, ChiPAS.ColumnCounter)) return 1; 103 } 104 95 105 // ----------- Resetting last matrices (where full QM values are stored right now) 96 106 if(!Energy.SetLastMatrix(0., 0)) return 1; … … 99 109 if(!Shielding.SetLastMatrix(0., 2)) return 1; 100 110 if(!ShieldingPAS.SetLastMatrix(0., 2)) return 1; 111 if(!Chi.SetLastMatrix(0., 2)) return 1; 112 if(!ChiPAS.SetLastMatrix(0., 2)) return 1; 101 113 } 102 114 … … 108 120 cout << "Summing energy of order " << BondOrder+1 << " ..." << endl; 109 121 if (!EnergyFragments.SumSubManyBodyTerms(Energy, KeySet, BondOrder)) return 1; 110 if (Hcorrected) { 122 if (Hcorrected) { 111 123 HcorrectionFragments.SumSubManyBodyTerms(Hcorrection, KeySet, BondOrder); 112 124 if (!Energy.SumSubEnergy(EnergyFragments, &HcorrectionFragments, KeySet, BondOrder, 1.)) return 1; 113 125 if (Hcorrected) Hcorrection.SumSubEnergy(HcorrectionFragments, NULL, KeySet, BondOrder, 1.); 114 } else 126 } else 115 127 if (!Energy.SumSubEnergy(EnergyFragments, NULL, KeySet, BondOrder, 1.)) return 1; 116 128 // --------- sum up Forces -------------------- … … 119 131 if (!Force.SumSubForces(ForceFragments, KeySet, BondOrder, 1.)) return 1; 120 132 if (periode != NULL) { // also look for PAS values 121 cout << "Summing shieldings of order " << BondOrder+1 << " ..." << endl;133 cout << "Summing shieldings and susceptibilities of order " << BondOrder+1 << " ..." << endl; 122 134 if (!ShieldingFragments.SumSubManyBodyTerms(Shielding, KeySet, BondOrder)) return 1; 123 135 if (!Shielding.SumSubForces(ShieldingFragments, KeySet, BondOrder, 1.)) return 1; 124 136 if (!ShieldingPASFragments.SumSubManyBodyTerms(ShieldingPAS, KeySet, BondOrder)) return 1; 125 137 if (!ShieldingPAS.SumSubForces(ShieldingPASFragments, KeySet, BondOrder, 1.)) return 1; 138 if (!ChiFragments.SumSubManyBodyTerms(Chi, KeySet, BondOrder)) return 1; 139 if (!Chi.SumSubEnergy(ChiFragments, NULL, KeySet, BondOrder, 1.)) return 1; 140 if (!ChiPASFragments.SumSubManyBodyTerms(ChiPAS, KeySet, BondOrder)) return 1; 141 if (!ChiPAS.SumSubEnergy(ChiPASFragments, NULL,KeySet, BondOrder, 1.)) return 1; 126 142 } 127 143 … … 138 154 if (!Shielding.WriteLastMatrix(argv[1], (prefix.str()).c_str(), ShieldingSuffix)) return 1; 139 155 if (!ShieldingPAS.WriteLastMatrix(argv[1], (prefix.str()).c_str(), ShieldingPASSuffix)) return 1; 156 if (!Chi.WriteLastMatrix(argv[1], (prefix.str()).c_str(), ChiSuffix)) return 1; 157 if (!ChiPAS.WriteLastMatrix(argv[1], (prefix.str()).c_str(), ChiPASSuffix)) return 1; 140 158 } 141 159 } … … 160 178 prefix << dir << ShieldingPASFragmentSuffix; 161 179 if (!ShieldingPASFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1; 180 prefix.str(" "); 181 prefix << dir << ChiFragmentSuffix; 182 if (!ChiFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1; 183 prefix.str(" "); 184 prefix << dir << ChiPASFragmentSuffix; 185 if (!ChiPASFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1; 162 186 } 163 187 … … 169 193 if (!Shielding.WriteLastMatrix(argv[1], dir, ShieldingFragmentSuffix)) return 1; 170 194 if (!ShieldingPAS.WriteLastMatrix(argv[1], dir, ShieldingPASFragmentSuffix)) return 1; 171 } 172 173 // exit 195 if (!Chi.WriteLastMatrix(argv[1], dir, ChiFragmentSuffix)) return 1; 196 if (!ChiPAS.WriteLastMatrix(argv[1], dir, ChiPASFragmentSuffix)) return 1; 197 } 198 199 // exit 174 200 delete(periode); 175 201 Free((void **)&dir, "main: *dir");
Note:
See TracChangeset
for help on using the changeset viewer.
