Changeset 073a9e4


Ignore:
Timestamp:
Feb 24, 2011, 7:26:14 PM (14 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, 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:
1e6249
Parents:
d557374
git-author:
Frederik Heber <heber@…> (02/24/11 14:32:36)
git-committer:
Frederik Heber <heber@…> (02/24/11 19:26:14)
Message:

BondedParticle::(Un)RegisterBond,AddBond,IsBondedTo with step.

  • adding, removing and checking of bonds at a desired time step.
Location:
src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/FragmentationAction/ConstructBondGraphAction.cpp

    rd557374 r073a9e4  
    140140//                              Log() << Verbose(1) << "Adding Bond between " << *Walker << " and " << *OtherWalker << " in distance " << sqrt(distance) << "." << endl;
    141141                              bond * const Binder = new bond(Walker->father, OtherWalker->father, 1, BondCount++);
    142                               Walker->father->RegisterBond(Binder);
    143                               OtherWalker->father->RegisterBond(Binder);
     142                              Walker->father->RegisterBond(WorldTime::getTime(),Binder);
     143                              OtherWalker->father->RegisterBond(WorldTime::getTime(),Binder);
    144144                            } else {
    145145//                              Log() << Verbose(1) << "Not Adding: distance too great." << endl;
  • src/Parser/PdbParser.cpp

    rd557374 r073a9e4  
    2424#include "CodePatterns/toString.hpp"
    2525#include "CodePatterns/Verbose.hpp"
    26 #include "World.hpp"
    2726#include "atom.hpp"
    2827#include "bond.hpp"
     
    3231#include "Descriptors/AtomIdDescriptor.hpp"
    3332#include "Parser/PdbParser.hpp"
     33#include "World.hpp"
     34#include "WorldTime.hpp"
    3435
    3536#include <map>
     
    522523//    DoLog(1) && (Log() << Verbose(1) << "Adding Bond (" << getAtomId(id) << "," << getAtomId(*iter) << ")" << std::endl);
    523524    atom * const _Otheratom = World::getInstance().getAtom(AtomById(getSerial(*iter)));
    524     _atom->addBond(_Otheratom);
     525    _atom->addBond(WorldTime::getTime(), _Otheratom);
    525526  }
    526527}
  • src/Parser/TremoloParser.cpp

    rd557374 r073a9e4  
    458458//            << atomIdMap[*neighbor] << "|" << *neighbor << ")" << std::endl);
    459459        World::getInstance().getAtom(AtomById(currentInfo->first))
    460             ->addBond(World::getInstance().getAtom(AtomById(atomIdMap[*neighbor])));
     460            ->addBond(WorldTime::getTime(), World::getInstance().getAtom(AtomById(atomIdMap[*neighbor])));
    461461      }
    462462      currentInfo->second.neighbors_processed = true;
  • src/Parser/unittests/ParserTremoloUnitTest.cpp

    rd557374 r073a9e4  
    2424#include <cppunit/ui/text/TestRunner.h>
    2525
     26#include "atom.hpp"
     27#include "Descriptors/AtomTypeDescriptor.hpp"
     28#include "element.hpp"
    2629#include "Parser/MpqcParser.hpp"
    2730#include "Parser/PdbParser.hpp"
     
    2932#include "Parser/TremoloParser.hpp"
    3033#include "Parser/XyzParser.hpp"
     34#include "periodentafel.hpp"
    3135#include "World.hpp"
    32 #include "atom.hpp"
    33 #include "element.hpp"
    34 #include "periodentafel.hpp"
    35 #include "Descriptors/AtomTypeDescriptor.hpp"
     36#include "WorldTime.hpp"
    3637
    3738#ifdef HAVE_TESTRUNNER
     
    165166  CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
    166167  CPPUNIT_ASSERT(World::getInstance().getAtom(AtomByType(8))->
    167       IsBondedTo(World::getInstance().getAtom(AtomByType(1))));
     168      IsBondedTo(WorldTime::getTime(), World::getInstance().getAtom(AtomByType(1))));
    168169  input.clear();
    169170}
  • src/atom_bondedparticle.cpp

    rd557374 r073a9e4  
    103103 * bond already exists.
    104104 *
     105 * @param _step time step to access
    105106 * \param bonding partner
    106107 */
    107 void BondedParticle::addBond(BondedParticle* Partner) {
    108   if (IsBondedTo(Partner)) {
     108void BondedParticle::addBond(const unsigned int _step, BondedParticle* Partner) {
     109  if (IsBondedTo(_step, Partner)) {
    109110    return;
    110111  }
    111112
    112113  bond* newBond = new bond((atom*) this, (atom*) Partner, 1, 0);
    113   RegisterBond(newBond);
    114   Partner->RegisterBond(newBond);
     114  RegisterBond(_step, newBond);
     115  Partner->RegisterBond(_step, newBond);
    115116}
    116117
    117118/** Puts a given bond into atom::ListOfBonds.
     119 * @param _step time step to access
    118120 * \param *Binder bond to insert
    119121 */
    120 bool BondedParticle::RegisterBond(bond *Binder)
     122bool BondedParticle::RegisterBond(const unsigned int _step, bond *Binder)
    121123{
    122124  bool status = false;
     
    124126    if (Binder->Contains(this)) {
    125127      //LOG(3,"INFO: Registering bond "<< *Binder << " with atom " << *this << " at step " << _step);
    126       BondList& ListOfBonds = getListOfBonds();
     128      BondList& ListOfBonds = getListOfBondsAtStep(_step);
    127129      ListOfBonds.push_back(Binder);
    128130      status = true;
     
    245247
    246248/** Checks whether there is a bond between \a this atom and the given \a *BondPartner.
     249 * @param _step time step to access
    247250 * \param *BondPartner atom to check for
    248251 * \return true - bond exists, false - bond does not exist
    249252 */
    250 bool BondedParticle::IsBondedTo(BondedParticle * const BondPartner)
     253bool BondedParticle::IsBondedTo(const unsigned int _step, BondedParticle * const BondPartner) const
    251254{
    252255  bool status = false;
    253256
    254   const BondList& ListOfBonds = getListOfBonds();
    255   for (BondList::const_iterator runner = ListOfBonds.begin(); runner != ListOfBonds.end(); runner++) {
     257  const BondList& ListOfBonds = getListOfBondsAtStep(_step);
     258  for (BondList::const_iterator runner = ListOfBonds.begin();
     259      runner != ListOfBonds.end();
     260      runner++) {
    256261    status = status || ((*runner)->Contains(BondPartner));
    257262  }
  • src/atom_bondedparticle.hpp

    rd557374 r073a9e4  
    3737  virtual ~BondedParticle();
    3838
    39   void addBond(BondedParticle* Partner);
    40   bool RegisterBond(bond *Binder);
     39  void addBond(const unsigned int _step, BondedParticle* Partner);
     40  bool RegisterBond(const unsigned int _step, bond *Binder);
    4141  bool UnregisterBond(bond *Binder);
    42   bool IsBondedTo(BondedParticle * const BondPartner);
     42  bool IsBondedTo(const unsigned int _step, BondedParticle * const BondPartner) const;
    4343  void UnregisterAllBond(const unsigned int _step);
    4444  int CountBonds() const;
  • src/molecule.cpp

    rd557374 r073a9e4  
    728728
    729729  Binder = new bond(atom1, atom2, degree, BondCount++);
    730   atom1->RegisterBond(Binder);
    731   atom2->RegisterBond(Binder);
     730  atom1->RegisterBond(WorldTime::getTime(), Binder);
     731  atom2->RegisterBond(WorldTime::getTime(), Binder);
    732732  if ((atom1->getType() != NULL) && (atom1->getType()->getAtomicNumber() != 1) && (atom2->getType() != NULL) && (atom2->getType()->getAtomicNumber() != 1))
    733733    NoNonBonds++;
     
    737737
    738738/** Remove bond from bond chain list and from the both atom::ListOfBonds.
    739  * \todo Function not implemented yet
     739 * Bond::~Bond takes care of bond removal
    740740 * \param *pointer bond pointer
    741741 * \return true - bound found and removed, false - bond not found/removed
  • src/unittests/BondGraphUnitTest.cpp

    rd557374 r073a9e4  
    3030#include "CodePatterns/Assert.hpp"
    3131
    32 #include "World.hpp"
    3332#include "atom.hpp"
    3433#include "bond.hpp"
     
    3938#include "periodentafel.hpp"
    4039#include "World.hpp"
     40#include "WorldTime.hpp"
    4141
    4242#include "BondGraphUnitTest.hpp"
     
    148148  CPPUNIT_ASSERT_EQUAL( true , BG->LoadBondLengthTable(test) );
    149149  CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) );
    150   CPPUNIT_ASSERT_EQUAL( true , (*Walker)->IsBondedTo((*Runner)) );
     150  CPPUNIT_ASSERT_EQUAL( true , (*Walker)->IsBondedTo(WorldTime::getTime(), (*Runner)) );
    151151};
    152152
Note: See TracChangeset for help on using the changeset viewer.