Changeset 2459b1 for src/moleculelist.cpp
- Timestamp:
- May 5, 2008, 4:19:05 PM (17 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 3c4b08
- Parents:
- bd6579
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/moleculelist.cpp
rbd6579 r2459b1 133 133 }; 134 134 135 136 /** Store force indices, i.e. the connection between the nuclear index in the total molecule config and the respective atom in fragment config. 137 * \param *out output stream for debugging 138 * \param *path path to file 139 * \param *SortIndex Index to map from the BFS labeling to the sequence how of Ion_Type in the config 140 * \return true - file written successfully, false - writing failed 141 */ 142 bool MoleculeListClass::StoreForcesFile(ofstream *out, char *path, int *SortIndex) 143 { 144 bool status = true; 145 ofstream ForcesFile; 146 stringstream line; 147 atom *Walker = NULL; 148 element *runner = NULL; 149 150 // open file for the force factors 151 *out << Verbose(1) << "Saving force factors ... "; 152 line << path << "/" << FRAGMENTPREFIX << FORCESFILE; 153 ForcesFile.open(line.str().c_str(), ios::out); 154 if (ForcesFile != NULL) { 155 //cout << Verbose(1) << "Final AtomicForcesList: "; 156 //output << prefix << "Forces" << endl; 157 for(int j=0;j<NumberOfMolecules;j++) { 158 //if (TEList[j] != 0) { 159 runner = ListOfMolecules[j]->elemente->start; 160 while (runner->next != ListOfMolecules[j]->elemente->end) { // go through every element 161 runner = runner->next; 162 if (ListOfMolecules[j]->ElementsInMolecule[runner->Z]) { // if this element got atoms 163 Walker = ListOfMolecules[j]->start; 164 while (Walker->next != ListOfMolecules[j]->end) { // go through every atom of this element 165 Walker = Walker->next; 166 if (Walker->type->Z == runner->Z) { 167 if ((Walker->GetTrueFather() != NULL) && (Walker->GetTrueFather() != Walker)) {// if there is a rea 168 //cout << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it 169 ForcesFile << SortIndex[Walker->GetTrueFather()->nr] << "\t"; 170 } else // otherwise a -1 to indicate an added saturation hydrogen 171 ForcesFile << "-1\t"; 172 } 173 } 174 } 175 } 176 ForcesFile << endl; 177 } 178 ForcesFile.close(); 179 *out << Verbose(1) << "done." << endl; 180 } else { 181 status = false; 182 *out << Verbose(1) << "failed to open file " << line.str() << "." << endl; 183 } 184 ForcesFile.close(); 185 186 return status; 187 }; 188 135 189 /** Writes a config file for each molecule in the given \a **FragmentList. 136 190 * \param *out output stream for debugging … … 216 270 Free((void **)&FragmentNumber, "MoleculeListClass::OutputConfigForListOfFragments: *FragmentNumber"); 217 271 } 218 219 // open KeySet file 220 sprintf(FragmentName, "%s/%s%s", configuration->configpath, FRAGMENTPREFIX , KEYSETFILE); 221 output.open(FragmentName, ios::out); 222 *out << Verbose(2) << "Saving " << FRAGMENTPREFIX << " key sets of each subgraph ..."; 223 for(int j=0;j<NumberOfMolecules;j++) { 224 Walker = ListOfMolecules[j]->start; 225 while(Walker->next != ListOfMolecules[j]->end) { 226 Walker = Walker->next; 227 #ifdef ADDHYDROGEN 228 if ((Walker->GetTrueFather() != NULL) && (Walker->type->Z != 1)) // if there is a real father, prints its index 229 #else 230 if ((Walker->GetTrueFather() != NULL)) // if there is a real father, prints its index 231 #endif 232 output << Walker->GetTrueFather()->nr << "\t"; 233 #ifdef ADDHYDROGEN 234 else // otherwise a -1 to indicate an added saturation hydrogen 235 output << "-1\t"; 236 #endif 237 } 238 output << endl; 239 } 240 output.close(); 241 *out << " done." << endl; 272 cout << " done." << endl; 242 273 243 274 // printing final number
Note:
See TracChangeset
for help on using the changeset viewer.