Changeset 9d83b6 for src/molecule.cpp


Ignore:
Timestamp:
Feb 24, 2011, 6:51:32 PM (15 years ago)
Author:
Frederik Heber <heber@…>
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:
a2bdbe
Parents:
c0d9eb
git-author:
Frederik Heber <heber@…> (02/24/11 14:41:13)
git-committer:
Frederik Heber <heber@…> (02/24/11 18:51:32)
Message:

BondedParticleInfo now has vector<BondList>

  • vector<BondList> ListOfBonds is private, getter for (non-)const access.
  • Access everywhere to ListOfBonds replaced by respective getter.
  • Access is as of now always to time step zero.
  • greatest impact is on molecule... files, and ListOfBondsUnitTest.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/molecule.cpp

    rc0d9eb r9d83b6  
    2626#include <gsl/gsl_heapsort.h>
    2727
    28 #include "World.hpp"
    2928#include "atom.hpp"
    3029#include "bond.hpp"
     30#include "Box.hpp"
     31#include "CodePatterns/enumeration.hpp"
     32#include "CodePatterns/Log.hpp"
    3133#include "config.hpp"
    3234#include "element.hpp"
     35#include "Exceptions/LinearDependenceException.hpp"
    3336#include "graph.hpp"
    3437#include "Helpers/helpers.hpp"
    3538#include "LinearAlgebra/leastsquaremin.hpp"
     39#include "LinearAlgebra/Plane.hpp"
     40#include "LinearAlgebra/RealSpaceMatrix.hpp"
     41#include "LinearAlgebra/Vector.hpp"
    3642#include "linkedcell.hpp"
    3743#include "lists.hpp"
    38 #include "CodePatterns/Log.hpp"
    3944#include "molecule.hpp"
    40 
    4145#include "periodentafel.hpp"
    4246#include "tesselation.hpp"
    43 #include "LinearAlgebra/Vector.hpp"
    44 #include "LinearAlgebra/RealSpaceMatrix.hpp"
    4547#include "World.hpp"
    46 #include "Box.hpp"
    47 #include "LinearAlgebra/Plane.hpp"
    48 #include "Exceptions/LinearDependenceException.hpp"
    49 
    50 #include "CodePatterns/enumeration.hpp"
     48#include "WorldTime.hpp"
     49
    5150
    5251/************************************* Functions for class molecule *********************************/
     
    383382      break;
    384383    case 2:
    385       // determine two other bonds (warning if there are more than two other) plus valence sanity check
    386       for (BondList::const_iterator Runner = TopOrigin->ListOfBonds.begin(); Runner != TopOrigin->ListOfBonds.end(); (++Runner)) {
    387         if ((*Runner) != TopBond) {
    388           if (FirstBond == NULL) {
    389             FirstBond = (*Runner);
    390             FirstOtherAtom = (*Runner)->GetOtherAtom(TopOrigin);
    391           } else if (SecondBond == NULL) {
    392             SecondBond = (*Runner);
    393             SecondOtherAtom = (*Runner)->GetOtherAtom(TopOrigin);
    394           } else {
    395             DoeLog(2) && (eLog()<< Verbose(2) << "Detected more than four bonds for atom " << TopOrigin->getName());
     384      {
     385        // determine two other bonds (warning if there are more than two other) plus valence sanity check
     386        const BondList& ListOfBonds = TopOrigin->getListOfBonds();
     387        for (BondList::const_iterator Runner = ListOfBonds.begin();
     388            Runner != ListOfBonds.end();
     389            ++Runner) {
     390          if ((*Runner) != TopBond) {
     391            if (FirstBond == NULL) {
     392              FirstBond = (*Runner);
     393              FirstOtherAtom = (*Runner)->GetOtherAtom(TopOrigin);
     394            } else if (SecondBond == NULL) {
     395              SecondBond = (*Runner);
     396              SecondOtherAtom = (*Runner)->GetOtherAtom(TopOrigin);
     397            } else {
     398              DoeLog(2) && (eLog()<< Verbose(2) << "Detected more than four bonds for atom " << TopOrigin->getName());
     399            }
    396400          }
    397401        }
     
    642646
    643647  // copy all bonds
    644   for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner)
    645     for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner)
     648  for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) {
     649    const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds();
     650    for(BondList::const_iterator BondRunner = ListOfBonds.begin();
     651        BondRunner != ListOfBonds.end();
     652        ++BondRunner)
    646653      if ((*BondRunner)->leftatom == *AtomRunner) {
    647654        bond *Binder = (*BondRunner);
     
    660667        NewBond->Type = Binder->Type;
    661668      }
     669  }
    662670  // correct fathers
    663671  for_each(atoms.begin(),atoms.end(),mem_fun(&atom::CorrectFather));
     
    749757  //DoeLog(1) && (eLog()<< Verbose(1) << "molecule::RemoveBond: Function not implemented yet." << endl);
    750758  BondList::const_iterator ForeRunner;
    751   while (!BondPartner->ListOfBonds.empty()) {
    752     ForeRunner = BondPartner->ListOfBonds.begin();
     759  BondList& ListOfBonds = BondPartner->getListOfBonds();
     760  while (!ListOfBonds.empty()) {
     761    ForeRunner = ListOfBonds.begin();
    753762    RemoveBond(*ForeRunner);
    754763  }
Note: See TracChangeset for help on using the changeset viewer.