Changeset b8d1aeb for src/moleculelist.cpp
- Timestamp:
- Feb 2, 2010, 11:38:06 AM (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:
- 7ba324
- Parents:
- 9fe36b (diff), 2ededc2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
-
src/moleculelist.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/moleculelist.cpp
r9fe36b rb8d1aeb 4 4 * 5 5 */ 6 7 #include <cstring> 6 8 7 9 #include "atom.hpp" … … 405 407 input.open(line.c_str()); 406 408 if (input == NULL) { 407 eLog() << Verbose(0) << endl << "Unable to open " << line << ", is the directory correct?" << endl; 408 performCriticalExit(); 409 Log() << Verbose(1) << endl << "Unable to open " << line << ", is the directory correct?" << endl; 409 410 return false; 410 411 } … … 743 744 /** Dissects given \a *mol into connected subgraphs and inserts them as new molecules but with old atoms into \a this. 744 745 * \param *out output stream for debugging 745 * \param * mol molecule with atoms to dissect746 * \param *periode periodentafel 746 747 * \param *configuration config with BondGraph 747 748 */ 748 void MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs(molecule * const mol, config * const configuration) 749 { 749 void MoleculeListClass::DissectMoleculeIntoConnectedSubgraphs(const periodentafel * const periode, config * const configuration) 750 { 751 molecule *mol = new molecule(periode); 752 atom *Walker = NULL; 753 atom *Advancer = NULL; 754 bond *Binder = NULL; 755 bond *Stepper = NULL; 756 // 0. gather all atoms into single molecule 757 for (MoleculeList::iterator MolRunner = ListOfMolecules.begin(); !ListOfMolecules.empty(); MolRunner = ListOfMolecules.begin()) { 758 // shift all atoms to new molecule 759 Advancer = (*MolRunner)->start->next; 760 while (Advancer != (*MolRunner)->end) { 761 Walker = Advancer; 762 Advancer = Advancer->next; 763 Log() << Verbose(3) << "Re-linking " << *Walker << "..." << endl; 764 unlink(Walker); 765 Walker->father = Walker; 766 mol->AddAtom(Walker); // counting starts at 1 767 } 768 // remove all bonds 769 Stepper = (*MolRunner)->first->next; 770 while (Stepper != (*MolRunner)->last) { 771 Binder = Stepper; 772 Stepper = Stepper->next; 773 delete(Binder); 774 } 775 // remove the molecule 776 delete(*MolRunner); 777 ListOfMolecules.erase(MolRunner); 778 } 779 750 780 // 1. dissect the molecule into connected subgraphs 751 781 configuration->BG->ConstructBondGraph(mol); … … 763 793 // 4a. create array of molecules to fill 764 794 const int MolCount = Subgraphs->next->Count(); 795 char number[MAXSTRINGSIZE]; 765 796 molecule **molecules = Malloc<molecule *>(MolCount, "config::Load() - **molecules"); 766 797 for (int i=0;i<MolCount;i++) { 767 798 molecules[i] = (molecule*) new molecule(mol->elemente); 768 799 molecules[i]->ActiveFlag = true; 800 strncpy(molecules[i]->name, mol->name, MAXSTRINGSIZE); 801 if (MolCount > 1) { 802 sprintf(number, "-%d", i+1); 803 strncat(molecules[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1); 804 } 805 cout << "MolName is " << molecules[i]->name << endl; 769 806 insert(molecules[i]); 770 807 } … … 774 811 int *MolMap = Calloc<int>(mol->AtomCount, "config::Load() - *MolMap"); 775 812 MoleculeLeafClass *MolecularWalker = Subgraphs; 776 atom *Walker = NULL;813 Walker = NULL; 777 814 while (MolecularWalker->next != NULL) { 778 815 MolecularWalker = MolecularWalker->next; … … 803 840 } 804 841 } 805 // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain edtheir ListOfBonds, but we have to remove them from first..last list806 bond *Binder = mol->first;842 // 4d. we don't need to redo bonds, as they are connected subgraphs and still maintain their ListOfBonds, but we have to remove them from first..last list 843 Binder = mol->first; 807 844 while (mol->first->next != mol->last) { 808 845 Binder = mol->first->next;
Note:
See TracChangeset
for help on using the changeset viewer.
