Changeset f429d7
- Timestamp:
- Jun 30, 2010, 3:39:55 PM (15 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:
- 89e820
- Parents:
- 3dcb1f
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Box.cpp
r3dcb1f rf429d7 9 9 10 10 #include "Box.hpp" 11 12 #include <cmath> 11 13 12 14 #include "Matrix.hpp" … … 57 59 } 58 60 61 Vector Box::WrapPeriodically(const Vector &point){ 62 Vector helper = translateOut(point); 63 for(int i=NDIM;i--;){ 64 double intpart,fracpart; 65 fracpart = modf(helper.at(i),&intpart); 66 if(fracpart<0.) 67 fracpart+=1.; 68 helper.at(i)=fracpart; 69 } 70 return translateIn(helper); 71 } 72 59 73 Box &Box::operator=(const Box &src){ 60 74 if(&src!=this){ -
src/Box.hpp
r3dcb1f rf429d7 29 29 Vector translateOut(const Vector &point); 30 30 31 Vector WrapPeriodically(const Vector &point); 32 31 33 private: 32 34 Matrix *M; //!< Defines the layout of the box -
src/molecule_geometry.cpp
r3dcb1f rf429d7 35 35 const Vector *Center = DetermineCenterOfAll(); 36 36 const Vector *CenterBox = DetermineCenterOfBox(); 37 const Matrix &M = World::getInstance().getDomain().getM(); 38 const Matrix &Minv = World::getInstance().getDomain().getMinv(); 37 Box &domain = World::getInstance().getDomain(); 39 38 40 39 // go through all atoms … … 42 41 ActOnAllVectors( &Vector::SubtractVector, *CenterBox); 43 42 BOOST_FOREACH(atom* iter, atoms){ 44 iter->node->WrapPeriodically(M, Minv);43 *iter->node = domain.WrapPeriodically(*iter->node); 45 44 } 46 45 … … 56 55 { 57 56 bool status = true; 58 const Matrix &M = World::getInstance().getDomain().getM(); 59 const Matrix &Minv = World::getInstance().getDomain().getMinv(); 57 Box &domain = World::getInstance().getDomain(); 60 58 61 59 // go through all atoms 62 60 BOOST_FOREACH(atom* iter, atoms){ 63 iter->node->WrapPeriodically(M, Minv);61 *iter->node = domain.WrapPeriodically(*iter->node); 64 62 } 65 63 … … 239 237 void molecule::TranslatePeriodically(const Vector *trans) 240 238 { 241 const Matrix &M = World::getInstance().getDomain().getM(); 242 const Matrix &Minv = World::getInstance().getDomain().getMinv(); 239 Box &domain = World::getInstance().getDomain(); 243 240 244 241 // go through all atoms 245 242 ActOnAllVectors( &Vector::AddVector, *trans); 246 243 BOOST_FOREACH(atom* iter, atoms){ 247 iter->node->WrapPeriodically(M, Minv);244 *iter->node = domain.WrapPeriodically(*iter->node); 248 245 } 249 246 -
src/vector.cpp
r3dcb1f rf429d7 458 458 { 459 459 gsl_vector_scale(content,factor); 460 };461 462 /** Given a box by its matrix \a *M and its inverse *Minv the vector is made to point within that box.463 * \param *M matrix of box464 * \param *Minv inverse matrix465 */466 void Vector::WrapPeriodically(const Matrix &M, const Matrix &Minv)467 {468 *this *= Minv;469 // truncate to [0,1] for each axis470 for (int i=0;i<NDIM;i++) {471 //at(i) += 0.5; // set to center of box472 while (at(i) >= 1.)473 at(i) -= 1.;474 while (at(i) < 0.)475 at(i) += 1.;476 }477 *this *= M;478 460 }; 479 461 -
src/vector.hpp
r3dcb1f rf429d7 62 62 bool MakeNormalTo(const Vector &y1); 63 63 bool IsInParallelepiped(const Vector &offset, const Matrix& _parallelepiped) const; 64 void WrapPeriodically(const Matrix &M, const Matrix &Minv);65 64 std::pair<Vector,Vector> partition(const Vector&) const; 66 65 std::pair<pointset,Vector> partition(const pointset&) const;
Note:
See TracChangeset
for help on using the changeset viewer.