Changeset c82f3d
- Timestamp:
- May 8, 2008, 12:02:43 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:
- 9fcf47
- Parents:
- 8f75a4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/moleculelist.cpp
r8f75a4 rc82f3d 347 347 return false; 348 348 }; 349 350 /** Fills the bond structure of this chain list subgraphs that are derived from a complete \a *reference molecule. 351 * Calls this routine in each MoleculeLeafClass::next subgraph if it's not NULL. 352 * \param *out output stream for debugging 353 * \param *reference reference molecule with the bond structure to be copied 354 * \param &FragmentCounter Counter needed to address \a **ListOfLocalAtoms 355 * \param ***ListOfLocalAtoms Lookup table for each subgraph and index of each atom in \a *reference, may be NULL on start, then it is filled 356 * \param FreeList true - ***ListOfLocalAtoms is free'd before return, false - it is not 357 * \return true - success, false - faoilure 358 */ 359 bool MoleculeLeafClass::FillBondStructureFromReference(ofstream *out, molecule *reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList) 360 { 361 atom *Walker = NULL, *OtherWalker = NULL; 362 bond *Binder = NULL; 363 bool status = true; 364 int AtomNo; 365 366 if (ListOfLocalAtoms == NULL) { // allocated initial pointer 367 // count the number of fragments 368 MoleculeLeafClass *MolecularWalker = this; 369 while (MolecularWalker->next != NULL) { 370 MolecularWalker = MolecularWalker->next; 371 FragmentCounter++; 372 } 373 // allocate and set each field to NULL 374 ListOfLocalAtoms = (atom ***) Malloc(sizeof(atom **)*(FragmentCounter+1), "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms"); 375 if (ListOfLocalAtoms == NULL) 376 return false; 377 for (int i=0;i<=FragmentCounter;i++) 378 ListOfLocalAtoms[i] = NULL; 379 FragmentCounter = 0; 380 FreeList = FreeList && true; 381 } 382 if (ListOfLocalAtoms[FragmentCounter] == NULL) { // allocate and fill list of this fragment/subgraph 383 status = status && CreateFatherLookupTable(out, Leaf->start, Leaf->end, ListOfLocalAtoms[FragmentCounter], reference->AtomCount); 384 FreeList = FreeList && true; 385 } 386 387 if (status) { 388 *out << Verbose(1) << "Creating adjacency list for subgraph " << this << "." << endl; 389 Walker = Leaf->start; 390 while (Walker->next != Leaf->end) { 391 Walker = Walker->next; 392 AtomNo = Walker->father->nr; // global id of the current walker 393 for(int i=0;i<reference->NumberOfBondsPerAtom[AtomNo];i++) { // go through father's bonds and copy them all 394 Binder = reference->ListOfBondsPerAtom[AtomNo][i]; 395 OtherWalker = ListOfLocalAtoms[FragmentCounter][Binder->GetOtherAtom(Walker->father)->nr]; // local copy of current bond partner of walker 396 if (OtherWalker != NULL) { 397 if (OtherWalker->nr > Walker->nr) 398 Leaf->AddBond(Walker, OtherWalker, Binder->BondDegree); 399 } else { 400 *out << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << FragmentCounter << "][" << Binder->GetOtherAtom(Walker->father)->nr << "] is NULL!" << endl; 401 status = false; 402 } 403 } 404 } 405 Leaf->CreateListOfBondsPerAtom(out); 406 FragmentCounter++; 407 if (next != NULL) 408 status = next->FillBondStructureFromReference(out, reference, FragmentCounter, ListOfLocalAtoms); 409 } 410 411 if (FreeList) { 412 // free the index lookup list 413 for (int i=0;i<FragmentCounter;i++) 414 Free((void **)&ListOfLocalAtoms[i], "MoleculeLeafClass::FillBondStructureFromReference - **ListOfLocalAtoms[]"); 415 if (previous == NULL) // if we are the first in this chain list, empty initial pointer 416 Free((void **)&ListOfLocalAtoms, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms"); 417 } 418 419 return status; 420 }; 421 422
Note:
See TracChangeset
for help on using the changeset viewer.