Changeset bcb593
- Timestamp:
- Jul 11, 2013, 9:43:31 PM (12 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:
- 9c1324
- Parents:
- 11f0fa
- git-author:
- Frederik Heber <heber@…> (06/18/13 14:35:36)
- git-committer:
- Frederik Heber <heber@…> (07/11/13 21:43:31)
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MoleculeAction/VerletIntegrationAction.cpp
r11f0fa rbcb593 42 42 #include "molecule.hpp" 43 43 #include "World.hpp" 44 #include "WorldTime.hpp" 44 45 45 46 #include <vector> … … 59 60 // TODO: sollte besser stream nutzen, nicht filename direkt (es sei denn, ist prefix), besser fuer unit test 60 61 AtomSetMixin<std::vector<atom *> > set(World::getInstance().getSelectedAtoms()); 61 for (unsigned int step = 0; step < params.MDSteps.get(); ++step) { 62 VerletForceIntegration<std::vector<atom *> > Verlet(set, params.Deltat.get(), false); 63 // parse forces into next step 64 if (!params.forcesfile.get().string().empty()) { 65 LOG(1, "Parsing forces file."); 66 if (!Verlet.parseForcesFile(params.forcesfile.get().string().c_str(), step)) 67 LOG(2, "File " << params.forcesfile.get() << " not found."); 68 else 69 LOG(2, "File " << params.forcesfile.get() << " found and parsed."); 70 } 71 // perform velocity verlet update 72 LOG(1, "Verlet integrating."); 73 if (!Verlet(step+1, 1, 0, params.FixedCenterOfMass.get())) 62 // we always operate relative to current time step 63 size_t CurrentStep = WorldTime::getInstance().getTime(); 64 VerletForceIntegration<std::vector<atom *> > Verlet(set, params.Deltat.get(), true); 65 // parse forces into next step 66 if (!params.forcesfile.get().string().empty()) { 67 LOG(1, "Parsing forces file."); 68 if (!Verlet.parseForcesFile(params.forcesfile.get().string().c_str(), CurrentStep)) 74 69 LOG(2, "File " << params.forcesfile.get() << " not found."); 75 70 else 76 71 LOG(2, "File " << params.forcesfile.get() << " found and parsed."); 77 72 } 73 // perform velocity verlet update 74 LOG(1, "Verlet integrating."); 75 if (!Verlet(CurrentStep+1, 1, 0, params.FixedCenterOfMass.get())) 76 ELOG(1, "Velocity verlet failed."); 77 else 78 LOG(2, "DEBUG: Successfully performed updates on velocity and position."); 79 // increment to next time step 80 World::getInstance().setTime(CurrentStep+1); 78 81 79 82 return Action::success; -
src/Actions/MoleculeAction/VerletIntegrationAction.def
r11f0fa rbcb593 17 17 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 18 18 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 19 #define paramtypes (boost::filesystem::path)(double)( unsigned int)(bool)20 #define paramtokens ("forces-file")("deltat")(" MDSteps")("keep-fixed-CenterOfMass")21 #define paramdescriptions ("file containing")("time step width")(" number of MDSteps to integrate")("whether forces and velocities shall be corrected such that center of mass remains at rest")22 #define paramdefaults (PARAM_DEFAULT(""))(NOPARAM_DEFAULT)(NOPARAM_DEFAULT) (NOPARAM_DEFAULT)23 #define paramreferences (forcesfile)(Deltat)( MDSteps)(FixedCenterOfMass)19 #define paramtypes (boost::filesystem::path)(double)(bool) 20 #define paramtokens ("forces-file")("deltat")("keep-fixed-CenterOfMass") 21 #define paramdescriptions ("file containing")("time step width")("whether forces and velocities shall be corrected such that center of mass remains at rest") 22 #define paramdefaults (PARAM_DEFAULT(""))(NOPARAM_DEFAULT)(NOPARAM_DEFAULT) 23 #define paramreferences (forcesfile)(Deltat)(FixedCenterOfMass) 24 24 #define paramvalids \ 25 25 (DummyValidator< boost::filesystem::path >()) \ 26 26 (PositiveValidator< double >()) \ 27 (NotZeroValidator< unsigned int >()) \28 27 (DummyValidator< bool >()) 29 28 -
src/Atom/atom_atominfo.cpp
r11f0fa rbcb593 279 279 { 280 280 OBSERVE; 281 NOTIFY(AtomObservable:: VelocityChanged);281 NOTIFY(AtomObservable::ForceChanged); 282 282 ASSERT(WorldTime::getTime() < AtomicForce.size(), 283 283 "AtomInfo::setAtomicForce() - Access out of range: " … … 291 291 OBSERVE; 292 292 if (WorldTime::getTime() == _step) 293 NOTIFY(AtomObservable:: VelocityChanged);293 NOTIFY(AtomObservable::ForceChanged); 294 294 const unsigned int size = AtomicForce.size(); 295 295 ASSERT(_step <= size, … … 579 579 }; 580 580 581 /** Performs a velocity verlet update of the trajectory. 582 * Parameters are according to those in configuration class. 581 /** Performs a velocity verlet update of the position at \a NextStep from \a LastStep information only. 582 * 583 * We calculate \f$x(t + \delta t) = x(t) + v(t)* \delta t + .5 * \delta t * \delta t * F(t)/m \f$. 584 * 585 * 583 586 * \param NextStep index of sequential step to set 584 587 * \param Deltat time step width 585 588 * \param IsAngstroem whether the force's underlying unit of length is angstroem or bohr radii 586 589 */ 587 void AtomInfo::VelocityVerletUpdate (int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem)590 void AtomInfo::VelocityVerletUpdateX(int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem) 588 591 { 589 592 const unsigned int LastStep = NextStep == 0 ? 0 : NextStep-1; 590 593 591 594 LOG(2, "INFO: Particle that currently " << *this); 592 LOG(2, "INFO: Integrating with mass=" << getMass() << " and Deltat="595 LOG(2, "INFO: Integrating position with mass=" << getMass() << " and Deltat=" 593 596 << Deltat << " at NextStep=" << NextStep); 594 // update force595 // (F+F_old)/2m = a and thus: v = (F+F_old)/2m * t = (F + F_old) * a596 LOG(3, "INFO: Force at step " << NextStep << " is " << getAtomicForceAtStep(NextStep));597 597 598 598 // update position … … 603 603 LOG(4, "INFO: position with velocity " << getAtomicVelocityAtStep(LastStep) << " from last step " << tempVector); 604 604 tempVector += .5*Deltat*Deltat*(getAtomicForceAtStep(LastStep))*(1./getMass()); // F = m * a and s = 605 LOG(4, "INFO: position with force " << getAtomicForceAtStep( NextStep) << " from last step " << tempVector);605 LOG(4, "INFO: position with force " << getAtomicForceAtStep(LastStep) << " from last step " << tempVector); 606 606 setPositionAtStep(NextStep, tempVector); 607 607 LOG(3, "INFO: Position at step " << NextStep << " set to " << tempVector); 608 608 } 609 }; 610 611 /** Performs a velocity verlet update of the velocity at \a NextStep. 612 * 613 * \note forces at NextStep should have been calculated based on position at NextStep prior 614 * to calling this function. 615 * 616 * We calculate \f$v(t) = v(t - \delta t) + \delta _t * .5 * (F(t - \delta t) + F(t))/m \f$. 617 * 618 * Parameters are according to those in configuration class. 619 * \param NextStep index of sequential step to set 620 * \param Deltat time step width 621 * \param IsAngstroem whether the force's underlying unit of length is angstroem or bohr radii 622 */ 623 void AtomInfo::VelocityVerletUpdateU(int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem) 624 { 625 const unsigned int LastStep = NextStep == 0 ? 0 : NextStep-1; 626 627 LOG(2, "INFO: Particle that currently " << *this); 628 LOG(2, "INFO: Integrating velocity with mass=" << getMass() << " and Deltat=" 629 << Deltat << " at NextStep=" << NextStep); 609 630 610 631 // Update U -
src/Atom/atom_atominfo.hpp
r11f0fa rbcb593 267 267 size_t getTrajectorySize() const; 268 268 void CopyStepOnStep(const unsigned int dest, const unsigned int src); 269 void VelocityVerletUpdate(int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem); 269 void VelocityVerletUpdateX(int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem); 270 void VelocityVerletUpdateU(int nr, const unsigned int NextStep, double Deltat, bool IsAngstroem); 270 271 double getKineticEnergy(const unsigned int step) const; 271 272 Vector getMomentum(const unsigned int step) const; -
src/Dynamics/VerletForceIntegration.hpp
r11f0fa rbcb593 78 78 79 79 /** Performs Verlet integration. 80 * Note that we assume the parsed forces to be in atomic units (hence, if coordinates are in angstroem, we 81 * have to transform them). 82 * This adds a new MD step \f$ t + \Delta t \f$ to the config file. 80 * 81 * We assume that forces have just been calculated. Then, we perform the velocity 82 * and the position calculation for \f$ t + \Delta t \f$, such that forces may be 83 * again calculated with respect to the new position. 84 * 83 85 * \param NextStep current time step (i.e. \f$ t + \Delta t \f$ in the sense of the velocity verlet) 84 86 * \param offset offset in matrix file to the first force component … … 100 102 // make sum of forces equal zero 101 103 if (FixedCenterOfMass) 102 correctForceMatrixForFixedCenterOfMass(offset,NextStep );104 correctForceMatrixForFixedCenterOfMass(offset,NextStep-1); 103 105 104 106 // solve a constrained potential if we are meant to 105 if (DoConstrainedMD) { 106 performConstraintMinimization(DoConstrainedMD,NextStep); 107 if (DoConstrainedMD) 108 performConstraintMinimization(DoConstrainedMD,NextStep-1); 109 110 if (NextStep > 0) { 111 for(typename AtomSetMixin<T>::iterator iter = atoms.begin(); iter != atoms.end(); ++iter) { 112 //std::cout << "Id of atom is " << (*iter)->getId() << std::endl; 113 (*iter)->VelocityVerletUpdateU((*iter)->getId(), NextStep-1, Deltat, IsAngstroem); 114 } 115 116 // make sum of velocities equal zero 117 if (FixedCenterOfMass) 118 correctVelocitiesForFixedCenterOfMass(NextStep-1); 119 120 // thermostat 121 performThermostatControl(NextStep-1); 107 122 } 108 123 … … 112 127 for(typename AtomSetMixin<T>::iterator iter = atoms.begin(); iter != atoms.end(); ++iter) { 113 128 //std::cout << "Id of atom is " << (*iter)->getId() << std::endl; 114 (*iter)->VelocityVerletUpdate((*iter)->getId(), NextStep, Deltat, IsAngstroem); 115 } 116 117 // make sum of velocities equal zero 118 if (FixedCenterOfMass) 119 correctVelocitiesForFixedCenterOfMass(NextStep); 120 121 // thermostat 122 performThermostatControl(NextStep); 129 (*iter)->VelocityVerletUpdateX((*iter)->getId(), NextStep, Deltat, IsAngstroem); 130 } 123 131 124 132 // exit -
tests/Python/AllActions/options.dat
r11f0fa rbcb593 91 91 load "test.data" 92 92 MaxDistance "-1" 93 MDSteps "1"94 93 mesh-offset "0.5,0.5,0.5" 95 94 mesh-size "10,10,10" -
tests/regression/Molecules/VerletIntegration/post/test.conf
r11f0fa rbcb593 71 71 Ion_Type2 3 6 1.0 3 3 12.01100000000 Carbon C 72 72 #Ion_TypeNr._Nr.R[0] R[1] R[2] MoveType (0 MoveIon, 1 FixedIon) 73 Ion_Type1_1 9.782085945 2.645886050 2.645886050 0 1.00 0000e-01 0.000000e+000.000000e+00 # molecule nr 074 Ion_Type1_2 9.782085945 2.645886050 4.425886024 0 1.00 0000e-01 0.000000e+000.000000e+00 # molecule nr 175 Ion_Type1_3 10.672039608 3.904536878 3.535886037 0 1.00 0000e-01 0.000000e+000.000000e+00 # molecule nr 276 Ion_Type1_4 8.532785963 4.787886018 2.645886050 0 1.00 0000e-01 0.000000e+000.000000e+00 # molecule nr 377 Ion_Type1_5 8.532785963 4.787886018 4.425886024 0 1.00 0000e-01 0.000000e+000.000000e+00 # molecule nr 478 Ion_Type1_6 6.393632318 3.904536877 3.535886037 0 1.00 0000e-01 0.000000e+000.000000e+00 # molecule nr 579 Ion_Type1_7 7.283585982 2.645886050 2.645886050 0 1.00 0000e-01 0.000000e+000.000000e+00 # molecule nr 680 Ion_Type1_8 7.283585982 2.645886050 4.425886024 0 1.00 0000e-01 0.000000e+000.000000e+00 # molecule nr 781 Ion_Type2_1 9.782085945 3.275186040 3.535886037 0 1.000000e-01 0.000000e+000.000000e+00 # molecule nr 882 Ion_Type2_2 8.532785963 4.158586027 3.535886037 0 1.000000e-01 0.000000e+000.000000e+00 # molecule nr 983 Ion_Type2_3 7.283585982 3.275186040 3.535886037 0 1.000000e-01 0.000000e+000.000000e+00 # molecule nr 1073 Ion_Type1_1 9.782085945 2.645886050 2.645886050 0 1.003242e-01 5.239287e-04 0.000000e+00 # molecule nr 0 74 Ion_Type1_2 9.782085945 2.645886050 4.425886024 0 1.003242e-01 5.239287e-04 0.000000e+00 # molecule nr 1 75 Ion_Type1_3 10.672039608 3.904536878 3.535886037 0 1.003242e-01 5.239287e-04 0.000000e+00 # molecule nr 2 76 Ion_Type1_4 8.532785963 4.787886018 2.645886050 0 1.003242e-01 5.239287e-04 0.000000e+00 # molecule nr 3 77 Ion_Type1_5 8.532785963 4.787886018 4.425886024 0 1.003242e-01 5.239287e-04 0.000000e+00 # molecule nr 4 78 Ion_Type1_6 6.393632318 3.904536877 3.535886037 0 1.003242e-01 5.239287e-04 0.000000e+00 # molecule nr 5 79 Ion_Type1_7 7.283585982 2.645886050 2.645886050 0 1.003242e-01 5.239287e-04 0.000000e+00 # molecule nr 6 80 Ion_Type1_8 7.283585982 2.645886050 4.425886024 0 1.003242e-01 5.239287e-04 0.000000e+00 # molecule nr 7 81 Ion_Type2_1 9.782085945 3.275186040 3.535886037 0 9.984420e-02 4.396970e-05 0.000000e+00 # molecule nr 8 82 Ion_Type2_2 8.532785963 4.158586027 3.535886037 0 9.984420e-02 4.396970e-05 0.000000e+00 # molecule nr 9 83 Ion_Type2_3 7.283585982 3.275186040 3.535886037 0 9.984420e-02 4.396970e-05 0.000000e+00 # molecule nr 10 84 84 85 Ion_Type1_1 9.78309 0905 2.645891010 2.645886050 0 1.002953e-01 4.950408e-04 0.000000e+00# molecule nr 086 Ion_Type1_2 9.78309 0905 2.645891010 4.425886024 0 1.002953e-01 4.950408e-04 0.000000e+00# molecule nr 187 Ion_Type1_3 10.67304 4568 3.904541838 3.535886037 0 1.002953e-01 4.950408e-04 0.000000e+00# molecule nr 288 Ion_Type1_4 8.53379 0923 4.787890978 2.645886050 0 1.002953e-01 4.950408e-04 0.000000e+00# molecule nr 389 Ion_Type1_5 8.53379 0923 4.787890978 4.425886024 0 1.002953e-01 4.950408e-04 0.000000e+00# molecule nr 490 Ion_Type1_6 6.39463 7278 3.904541837 3.535886037 0 1.002953e-01 4.950408e-04 0.000000e+00# molecule nr 591 Ion_Type1_7 7.28459 0942 2.645891010 2.645886050 0 1.002953e-01 4.950408e-04 0.000000e+00# molecule nr 692 Ion_Type1_8 7.28459 0942 2.645891010 4.425886024 0 1.002953e-01 4.950408e-04 0.000000e+00# molecule nr 793 Ion_Type2_1 9.78308 6361 3.275186456 3.535886037 0 9.984178e-02 4.154535e-05 0.000000e+00# molecule nr 894 Ion_Type2_2 8.53378 6379 4.158586443 3.535886037 0 9.984178e-02 4.154535e-05 0.000000e+00# molecule nr 995 Ion_Type2_3 7.28458 6398 3.275186456 3.535886037 0 9.984178e-02 4.154535e-05 0.000000e+00# molecule nr 1085 Ion_Type1_1 9.783091811 2.645893914 2.645886050 0 # molecule nr 0 86 Ion_Type1_2 9.783091811 2.645893914 4.425886024 0 # molecule nr 1 87 Ion_Type1_3 10.673045474 3.904544742 3.535886037 0 # molecule nr 2 88 Ion_Type1_4 8.533791829 4.787893882 2.645886050 0 # molecule nr 3 89 Ion_Type1_5 8.533791829 4.787893882 4.425886024 0 # molecule nr 4 90 Ion_Type1_6 6.394638184 3.904544741 3.535886037 0 # molecule nr 5 91 Ion_Type1_7 7.284591848 2.645893914 2.645886050 0 # molecule nr 6 92 Ion_Type1_8 7.284591848 2.645893914 4.425886024 0 # molecule nr 7 93 Ion_Type2_1 9.783084607 3.275186700 3.535886037 0 # molecule nr 8 94 Ion_Type2_2 8.533784625 4.158586687 3.535886037 0 # molecule nr 9 95 Ion_Type2_3 7.284584644 3.275186700 3.535886037 0 # molecule nr 10 -
tests/regression/Molecules/VerletIntegration/testsuite-molecules-verlet-integration.at
r11f0fa rbcb593 25 25 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Molecules/VerletIntegration/pre/test.forces .], 0) 26 26 AT_CHECK([chmod u+w $file], 0) 27 AT_CHECK([../../molecuilder -i $file --select-all-atoms --verlet-integration --forces-file test.forces -- MDSteps 1 --deltat 0.01 --keep-fixed-CenterOfMass 0], 0, [stdout], [stderr])27 AT_CHECK([../../molecuilder -i $file --select-all-atoms --verlet-integration --forces-file test.forces --deltat 0.01 --keep-fixed-CenterOfMass 0], 0, [stdout], [stderr]) 28 28 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Molecules/VerletIntegration/post/test.conf], 0, [ignore], [ignore]) 29 29
Note:
See TracChangeset
for help on using the changeset viewer.