Changeset af9be32


Ignore:
Timestamp:
Apr 6, 2012, 11:44:51 AM (13 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:
72e4c95
Parents:
06070b
git-author:
Frederik Heber <heber@…> (04/05/12 14:09:17)
git-committer:
Frederik Heber <heber@…> (04/06/12 11:44:51)
Message:

Added BondInfo to store bond's state information for later re-instantiation.

Location:
src
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/UndoRedoHelpers.cpp

    r06070b raf9be32  
    3636  for (; i<atoms.size(); ++i) {
    3737    // re-create the atom
    38     LOG(1, "Re-adding atom " << atoms[i].getId() << ".");
     38    LOG(3, "DEBUG: Re-adding atom " << atoms[i].getId() << ".");
    3939    atom *Walker = World::getInstance().createAtom();
    4040    if (!atoms[i].setAtom(*Walker)) {
     
    5959    World::getInstance().destroyAtom(_atom.getId());
    6060  }
     61}
     62
     63void MoleCuilder::StoreBondInformationFromAtoms(
     64    const std::vector<const atom*> &atoms,
     65    std::vector< BondInfo > &bonds)
     66{
     67  ASSERT( bonds.empty(),
     68      "StoreBondInformationFromAtoms() - give bonds vector is not empty.");
     69  bonds.reserve(atoms.size()*4);
     70  for (std::vector<const atom*>::const_iterator atomiter = atoms.begin();
     71      atomiter != atoms.end(); ++atomiter) {
     72    const BondList & _atom_bonds = (*atomiter)->getListOfBonds();
     73    for(BondList::const_iterator iter = _atom_bonds.begin(); iter != _atom_bonds.end(); ++iter)
     74      bonds.push_back( BondInfo(*iter) );
     75  }
     76}
     77
     78bool MoleCuilder::AddBondsFromBondInfo(const std::vector< BondInfo > &bonds)
     79{
     80  bool status = true;
     81  for(std::vector< BondInfo >::const_iterator iter = bonds.begin();
     82      iter != bonds.end(); ++iter)
     83    if (!(*iter).RecreateBond())
     84      status = false;
     85  return status;
    6186}
    6287
  • src/Actions/UndoRedoHelpers.hpp

    r06070b raf9be32  
    1818
    1919#include "Atom/AtomicInfo.hpp"
     20#include "Bond/BondInfo.hpp"
    2021
    2122namespace MoleCuilder {
     
    3334   */
    3435  void RemoveAtomsFromAtomicInfo(std::vector<AtomicInfo> &atoms);
     36
     37  /** Stores the required bond information in for all \a atoms in \a bonds.
     38   *
     39   * @param atoms atoms whose bonds to store
     40   * @param bonds vector with bond information on return
     41   */
     42  void StoreBondInformationFromAtoms(
     43      const std::vector<const atom*> &atoms,
     44      std::vector<BondInfo> &bonds);
     45
     46  /** Recreates bonds from information stored in \a bonds.
     47   *
     48   * @param bonds bond state information
     49   * @return true - all bonds restored, false - at least one bond could not be restored
     50   */
     51  bool AddBondsFromBondInfo(const std::vector< BondInfo > &bonds);
    3552
    3653  /** Sets atoms to state information stored as AtomicInfo.
  • src/Makefile.am

    r06070b raf9be32  
    2929        Bond/bond.cpp \
    3030        Bond/bond_observable.cpp \
     31        Bond/BondInfo.cpp \
    3132        Bond/GraphEdge.cpp
    3233
     
    3435        Bond/bond.hpp \
    3536        Bond/bond_observable.hpp \
     37        Bond/BondInfo.hpp \
    3638        Bond/GraphEdge.hpp
    3739
Note: See TracChangeset for help on using the changeset viewer.