Changeset 3c349b for src/config.cpp
- Timestamp:
- Nov 3, 2009, 4:34:31 PM (16 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, Candidate_v1.7.0, 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:
- f4e1f5
- Parents:
- ae38fb
- File:
-
- 1 edited
-
src/config.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/config.cpp
rae38fb r3c349b 1051 1051 } else { 1052 1052 cout << Verbose(0) << "Bond length table loading failed." << endl; 1053 BG->SetMaxDistanceToMaxOfCovalentRadii((ofstream *)&cout, periode);1054 1053 } 1055 1054 … … 1068 1067 delete(BackEdgeStack); 1069 1068 1070 // 6. dissect 1071 atom ***ListOfLocalAtoms = NULL; 1069 // 6. dissect (the following construct is needed to have the atoms not in the order of the DFS, but in 1070 // the original one as parsed in) 1071 // TODO: Optimize this, when molecules just contain pointer list of global atoms! 1072 1073 // 6a. create array of molecules to fill 1074 const int MolCount = Subgraphs->Count(); 1075 molecule **molecules = Malloc<molecule *>(MolCount, "config::Load() - **molecules"); 1076 for (int i=0;i<MolCount;i++) { 1077 molecules[i] = (molecule*) new molecule(periode); 1078 molecules[i]->ActiveFlag = true; 1079 MolList->insert(molecules[i]); 1080 } 1081 1082 // 6b. create and fill map of which atom is associated to which connected molecule (note, counting starts at 1) 1072 1083 int FragmentCounter = 0; 1084 int *MolMap = Calloc<int>(mol->AtomCount, "config::Load() - *MolMap"); 1073 1085 MoleculeLeafClass *MolecularWalker = Subgraphs; 1074 1086 atom *Walker = NULL; 1075 1087 while (MolecularWalker->next != NULL) { 1076 1088 MolecularWalker = MolecularWalker->next; 1077 // fill the bond structure of the individually stored subgraphs (goes through whole chained list by itself)1078 MolecularWalker->FillBondStructureFromReference((ofstream *)&cout, mol, FragmentCounter, ListOfLocalAtoms, false); // we don't want to keep the created ListOfLocalAtoms1079 FragmentCounter++;1080 MolecularWalker->Leaf->ActiveFlag = true;1081 1089 Walker = MolecularWalker->Leaf->start; 1082 1090 while (Walker->next != MolecularWalker->Leaf->end) { 1083 1091 Walker = Walker->next; 1084 Walker->father = Walker;1092 MolMap[Walker->GetTrueFather()->nr] = FragmentCounter+1; 1085 1093 } 1086 MolList->insert(MolecularWalker->Leaf); 1087 MolecularWalker->Leaf = NULL; // don't remove molecule when deleting MolecularWalker 1094 FragmentCounter++; 1095 } 1096 1097 // 6c. relocate atoms to new molecules and remove from Leafs 1098 Walker = mol->start; 1099 while (mol->start->next != mol->end) { 1100 Walker = mol->start->next; 1101 if ((Walker->nr <0) || (Walker->nr >= mol->AtomCount)) { 1102 cerr << "Index of atom " << *Walker << " is invalid!" << endl; 1103 performCriticalExit(); 1104 } 1105 FragmentCounter = MolMap[Walker->nr]; 1106 if (FragmentCounter != 0) { 1107 cout << Verbose(3) << "Re-linking " << *Walker << "..." << endl; 1108 unlink(Walker); 1109 molecules[FragmentCounter-1]->AddAtom(Walker); // counting starts at 1 1110 } else { 1111 cerr << "Atom " << *Walker << " not associated to molecule!" << endl; 1112 performCriticalExit(); 1113 } 1114 } 1115 // 6d. we don't need to redo bonds, as they are connected subgraphs and still maintained their ListOfBonds 1116 // 6e. free Leafs 1117 MolecularWalker = Subgraphs; 1118 while (MolecularWalker->next != NULL) { 1119 MolecularWalker = MolecularWalker->next; 1088 1120 delete(MolecularWalker->previous); 1089 1121 } 1090 1122 delete(MolecularWalker); 1091 for (int i=0;i<FragmentCounter;i++)1092 Free(&ListOfLocalAtoms[i]);1093 Free(& ListOfLocalAtoms);1123 delete(mol); 1124 Free(&MolMap); 1125 Free(&molecules); 1094 1126 cout << Verbose(1) << "I scanned " << FragmentCounter << " molecules." << endl; 1095 1096 // 6. free parsed in molecule1097 delete(mol);1098 1127 1099 1128 delete(FileBuffer);
Note:
See TracChangeset
for help on using the changeset viewer.
