Changeset cbd409 for src/molecule.cpp
- Timestamp:
- Feb 11, 2016, 8:06:48 AM (9 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:
- 687ef1
- Parents:
- d93d2c
- git-author:
- Frederik Heber <heber@…> (01/20/16 20:02:03)
- git-committer:
- Frederik Heber <heber@…> (02/11/16 08:06:48)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule.cpp
rd93d2c rcbd409 72 72 73 73 // static entities 74 static Observable::channels_t get BoundingBoxChannels()74 static Observable::channels_t getAtomPositionsChannels() 75 75 { 76 76 Observable::channels_t channels; … … 96 96 BoundingBoxSweepingAxis(std::vector<AtomDistanceMap_t>(NDIM)), 97 97 _lastchangedatomid(-1), 98 last_atom(0) 98 last_atom(0), 99 molcenter(zeroVec) 99 100 { 100 101 // add specific channels … … 107 108 BoundingBox.reset( 108 109 new Cacheable<BoundingBoxInfo>( 109 this, boost::bind(&molecule::updateBoundingBox, this), "molecule_BoundingBox", getBoundingBoxChannels())); 110 this, boost::bind(&molecule::updateBoundingBox, this), "molecule_BoundingBox", getAtomPositionsChannels())); 111 MoleculeCenter.reset( 112 new Cacheable<Vector>( 113 this, boost::bind(&molecule::updateMoleculeCenter, this), "molecule_center", getAtomPositionsChannels())); 110 114 111 115 strcpy(name,World::getInstance().getDefaultName().c_str()); … … 272 276 } 273 277 { 278 molcenter -= _atom->getPosition(); 279 } 280 { 274 281 NOTIFY(AtomNrChanged); 275 282 atomIdPool.releaseId(_atom->getNr()); … … 306 313 if (oldinfo != newinfo) 307 314 NOTIFY(BoundingBoxChanged); 315 } 316 { 317 molcenter += key->getPosition(); 308 318 } 309 319 NOTIFY(AtomNrChanged); … … 1092 1102 } 1093 1103 1104 Vector molecule::updateMoleculeCenter() const 1105 { 1106 return (1./(double)getAtomCount())*molcenter; 1107 } 1108 1094 1109 molecule::BoundingBoxInfo molecule::getBoundingBox() const 1095 1110 { 1096 1111 return **BoundingBox; 1112 } 1113 1114 Vector molecule::getMoleculeCenter() const 1115 { 1116 return **MoleculeCenter; 1097 1117 } 1098 1118 … … 1116 1136 // emit others about one of our atoms moved 1117 1137 _lastchangedatomid = _atom->getId(); 1118 // update entry in map 1138 // update entry in map and also molecule center 1119 1139 BoundingBoxInfo oldinfo = updateBoundingBox(); 1120 1140 for (int i=0;i<NDIM;++i) { … … 1123 1143 "molecule::recieveNotification() - could not find atom "+toString(_atom->getId()) 1124 1144 +" in BoundingBoxSweepingAxis."); 1145 molcenter[i] -= iter->second; 1125 1146 BoundingBoxSweepingAxis[i].left.erase(iter); 1147 const Vector &position = _atom->getPosition(); 1126 1148 BoundingBoxSweepingAxis[i].left.insert( 1127 std::make_pair(_atom->getId(), _atom->getPosition()[i]) ); 1149 std::make_pair(_atom->getId(), position[i]) ); 1150 molcenter[i] += position[i]; 1128 1151 } 1129 1152 BoundingBoxInfo newinfo = updateBoundingBox(); 1130 1153 OBSERVE; 1131 1154 NOTIFY(AtomMoved); 1155 NOTIFY(MoleculeCenterChanged); 1132 1156 if (oldinfo != newinfo) 1133 1157 NOTIFY(BoundingBoxChanged);
Note:
See TracChangeset
for help on using the changeset viewer.