Changeset db3ea3 for molecuilder/src/joiner.cpp
- Timestamp:
- Jul 24, 2008, 2:00:19 PM (17 years ago)
- Children:
- 747b10
- Parents:
- b3eb8e
- File:
-
- 1 edited
-
molecuilder/src/joiner.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/joiner.cpp
rb3eb8e rdb3ea3 19 19 periodentafel *periode = NULL; // and a period table of all elements 20 20 EnergyMatrix Energy; 21 EnergyMatrix Hcorrection; 21 22 ForceMatrix Force; 22 23 EnergyMatrix EnergyFragments; 24 EnergyMatrix HcorrectionFragments; 23 25 ForceMatrix ForceFragments; 24 26 ForceMatrix Shielding; … … 28 30 KeySetsContainer KeySet; 29 31 stringstream prefix; 32 char *dir = NULL; 33 bool Hcorrected = true; 30 34 31 35 cout << "Joiner" << endl; … … 39 43 cout << "[elementsdb]\tpath to elements database, needed for shieldings." << endl; 40 44 return 1; 45 } else { 46 dir = (char *) Malloc(sizeof(char)*(strlen(argv[2])+2), "main: *dir"); 47 strcpy(dir, "/"); 48 strcat(dir, argv[2]); 41 49 } 42 50 if (argc > 3) { … … 52 60 53 61 // ------------- Parse through all Fragment subdirs -------- 54 if (!Energy.ParseMatrix(argv[1], argv[2], EnergySuffix, 0,0)) return 1; 55 if (!Force.ParseMatrix(argv[1], argv[2], ForcesSuffix, 0,0)) return 1; 62 if (!Energy.ParseMatrix(argv[1], dir, EnergySuffix, 0,0)) return 1; 63 Hcorrected = Hcorrection.ParseMatrix(argv[1], "", HCORRECTIONSUFFIX, 0,0); 64 if (!Force.ParseMatrix(argv[1], dir, ForcesSuffix, 0,0)) return 1; 56 65 if (periode != NULL) { // also look for PAS values 57 if (!Shielding.ParseMatrix(argv[1], argv[2], ShieldingSuffix, 1, 0)) return 1;58 if (!ShieldingPAS.ParseMatrix(argv[1], argv[2], ShieldingPASSuffix, 1, 0)) return 1;66 if (!Shielding.ParseMatrix(argv[1], dir, ShieldingSuffix, 1, 0)) return 1; 67 if (!ShieldingPAS.ParseMatrix(argv[1], dir, ShieldingPASSuffix, 1, 0)) return 1; 59 68 } 60 69 61 70 // ---------- Parse the TE Factors into an array ----------------- 62 71 if (!Energy.ParseIndices()) return 1; 72 if (Hcorrected) Hcorrection.ParseIndices(); 63 73 64 74 // ---------- Parse the Force indices into an array --------------- … … 76 86 if (!KeySet.ParseManyBodyTerms()) return 1; 77 87 if (!EnergyFragments.AllocateMatrix(Energy.Header, Energy.MatrixCounter, Energy.RowCounter, Energy.ColumnCounter)) return 1; 88 if (Hcorrected) HcorrectionFragments.AllocateMatrix(Hcorrection.Header, Hcorrection.MatrixCounter, Hcorrection.RowCounter, Hcorrection.ColumnCounter); 78 89 if (!ForceFragments.AllocateMatrix(Force.Header, Force.MatrixCounter, Force.RowCounter, Force.ColumnCounter)) return 1; 79 90 if (periode != NULL) { // also look for PAS values … … 86 97 if(!Force.SetLastMatrix(0., 2)) return 1; 87 98 if (periode != NULL) { // also look for PAS values 88 if(!Shielding.SetLastMatrix(0., 0)) return 1;99 if(!Shielding.SetLastMatrix(0., 2)) return 1; 89 100 if(!ShieldingPAS.SetLastMatrix(0., 2)) return 1; 90 101 } … … 97 108 cout << "Summing energy of order " << BondOrder+1 << " ..." << endl; 98 109 if (!EnergyFragments.SumSubManyBodyTerms(Energy, KeySet, BondOrder)) return 1; 99 if (!Energy.SumSubEnergy(EnergyFragments, KeySet, BondOrder)) return 1; 110 if (Hcorrected) { 111 HcorrectionFragments.SumSubManyBodyTerms(Hcorrection, KeySet, BondOrder); 112 if (!Energy.SumSubEnergy(EnergyFragments, &HcorrectionFragments, KeySet, BondOrder, 1.)) return 1; 113 if (Hcorrected) Hcorrection.SumSubEnergy(HcorrectionFragments, NULL, KeySet, BondOrder, 1.); 114 } else 115 if (!Energy.SumSubEnergy(EnergyFragments, NULL, KeySet, BondOrder, 1.)) return 1; 100 116 // --------- sum up Forces -------------------- 101 117 cout << "Summing forces of order " << BondOrder+1 << " ..." << endl; 102 118 if (!ForceFragments.SumSubManyBodyTerms(Force, KeySet, BondOrder)) return 1; 103 if (!Force.SumSubForces(ForceFragments, KeySet, BondOrder )) return 1;119 if (!Force.SumSubForces(ForceFragments, KeySet, BondOrder, 1.)) return 1; 104 120 if (periode != NULL) { // also look for PAS values 105 121 cout << "Summing shieldings of order " << BondOrder+1 << " ..." << endl; 106 122 if (!ShieldingFragments.SumSubManyBodyTerms(Shielding, KeySet, BondOrder)) return 1; 107 if (!Shielding.SumSubForces(ShieldingFragments, KeySet, BondOrder )) return 1;123 if (!Shielding.SumSubForces(ShieldingFragments, KeySet, BondOrder, 1.)) return 1; 108 124 if (!ShieldingPASFragments.SumSubManyBodyTerms(ShieldingPAS, KeySet, BondOrder)) return 1; 109 if (!ShieldingPAS.SumSubForces(ShieldingPASFragments, KeySet, BondOrder )) return 1;125 if (!ShieldingPAS.SumSubForces(ShieldingPASFragments, KeySet, BondOrder, 1.)) return 1; 110 126 } 111 127 112 128 // --------- write the energy and forces file -------------------- 113 129 prefix.str(" "); 114 prefix << argv[2]<< OrderSuffix << (BondOrder+1);130 prefix << dir << OrderSuffix << (BondOrder+1); 115 131 cout << "Writing files " << argv[1] << prefix.str() << ". ..." << endl; 116 132 // energy … … 126 142 // fragments 127 143 prefix.str(" "); 128 prefix << argv[2]<< EnergyFragmentSuffix;144 prefix << dir << EnergyFragmentSuffix; 129 145 if (!EnergyFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1; 146 if (Hcorrected) { 147 prefix.str(" "); 148 prefix << dir << HcorrectionFragmentSuffix; 149 if (!HcorrectionFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1; 150 } 130 151 prefix.str(" "); 131 prefix << argv[2]<< ForceFragmentSuffix;152 prefix << dir << ForceFragmentSuffix; 132 153 if (!ForceFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1; 133 154 if (!CreateDataFragment(EnergyFragments, KeySet, argv[1], FRAGMENTPREFIX ENERGYPERFRAGMENT, "fragment energy versus the Fragment No", "today", CreateEnergy)) return 1; 134 155 if (periode != NULL) { // also look for PAS values 135 156 prefix.str(" "); 136 prefix << argv[2]<< ShieldingFragmentSuffix;157 prefix << dir << ShieldingFragmentSuffix; 137 158 if (!ShieldingFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1; 138 159 prefix.str(" "); 139 prefix << argv[2]<< ShieldingPASFragmentSuffix;160 prefix << dir << ShieldingPASFragmentSuffix; 140 161 if (!ShieldingPASFragments.WriteTotalFragments(argv[1], (prefix.str()).c_str())) return 1; 141 162 } 142 163 143 164 // write last matrices as fragments into central dir (not subdir as above), for analyzer to know index bounds 144 if (!Energy.WriteLastMatrix(argv[1], argv[2], EnergyFragmentSuffix)) return 1; 145 if (!Force.WriteLastMatrix(argv[1], argv[2], ForceFragmentSuffix)) return 1; 165 if (!Energy.WriteLastMatrix(argv[1], dir, EnergyFragmentSuffix)) return 1; 166 if (Hcorrected) Hcorrection.WriteLastMatrix(argv[1], dir, HcorrectionFragmentSuffix); 167 if (!Force.WriteLastMatrix(argv[1], dir, ForceFragmentSuffix)) return 1; 146 168 if (periode != NULL) { // also look for PAS values 147 if (!Shielding.WriteLastMatrix(argv[1], argv[2], ShieldingFragmentSuffix)) return 1;148 if (!ShieldingPAS.WriteLastMatrix(argv[1], argv[2], ShieldingPASFragmentSuffix)) return 1;169 if (!Shielding.WriteLastMatrix(argv[1], dir, ShieldingFragmentSuffix)) return 1; 170 if (!ShieldingPAS.WriteLastMatrix(argv[1], dir, ShieldingPASFragmentSuffix)) return 1; 149 171 } 150 172 151 173 // exit 152 174 delete(periode); 175 Free((void **)&dir, "main: *dir"); 153 176 cout << "done." << endl; 154 177 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.
