source: src/Dynamics/VerletForceIntegration.hpp@ 51cdfd

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
Last change on this file since 51cdfd was 51cdfd, checked in by Frederik Heber <heber@…>, 10 years ago

Extracted common functions from VerletForceIntegration into AtomicForceManipulator.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1/*
2 * VerletForceIntegration.hpp
3 *
4 * Created on: Feb 23, 2011
5 * Author: heber
6 */
7
8#ifndef VERLETFORCEINTEGRATION_HPP_
9#define VERLETFORCEINTEGRATION_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include "Atom/atom.hpp"
17#include "Atom/AtomSet.hpp"
18#include "CodePatterns/Assert.hpp"
19#include "CodePatterns/Info.hpp"
20#include "CodePatterns/Log.hpp"
21#include "CodePatterns/Verbose.hpp"
22#include "Dynamics/AtomicForceManipulator.hpp"
23#include "Fragmentation/ForceMatrix.hpp"
24#include "Helpers/helpers.hpp"
25#include "Helpers/defs.hpp"
26#include "LinearAlgebra/Vector.hpp"
27#include "Thermostats/ThermoStatContainer.hpp"
28#include "Thermostats/Thermostat.hpp"
29#include "World.hpp"
30
31template <class T>
32class VerletForceIntegration : public AtomicForceManipulator<T>
33{
34public:
35 /** Constructor of class VerletForceIntegration.
36 *
37 * \param _atoms set of atoms to integrate
38 * \param _Deltat time step width in atomic units
39 * \param _IsAngstroem whether length units are in angstroem or bohr radii
40 */
41 VerletForceIntegration(AtomSetMixin<T> &_atoms, double _Deltat, bool _IsAngstroem) :
42 AtomicForceManipulator<T>(_atoms, _Deltat, _IsAngstroem)
43 {}
44 /** Destructor of class VerletForceIntegration.
45 *
46 */
47 ~VerletForceIntegration()
48 {}
49
50 /** Performs Verlet integration.
51 *
52 * We assume that forces have just been calculated. Then, we perform the velocity
53 * and the position calculation for \f$ t + \Delta t \f$, such that forces may be
54 * again calculated with respect to the new position.
55 *
56 * \param NextStep current time step (i.e. \f$ t + \Delta t \f$ in the sense of the velocity verlet)
57 * \param offset offset in matrix file to the first force component
58 * \param DoConstrainedMD whether a constrained MD shall be done
59 * \param FixedCenterOfMass whether forces and velocities are correct to have fixed center of mass
60 * \return true - file found and parsed, false - no atoms, file not found or imparsable
61 * \todo This is not yet checked if it is correctly working with DoConstrainedMD set >0.
62 */
63 bool operator()(const int NextStep, const size_t offset, const int DoConstrainedMD, const bool FixedCenterOfMass)
64 {
65 Info FunctionInfo(__func__);
66
67 // make sum of forces equal zero
68 if (FixedCenterOfMass)
69 AtomicForceManipulator<T>::correctForceMatrixForFixedCenterOfMass(offset,NextStep-1);
70
71 // solve a constrained potential if we are meant to
72// if (DoConstrainedMD)
73// performConstraintMinimization(DoConstrainedMD,NextStep-1);
74
75 if (NextStep > 0) {
76 for(typename AtomSetMixin<T>::iterator iter = AtomicForceManipulator<T>::atoms.begin();
77 iter != AtomicForceManipulator<T>::atoms.end(); ++iter) {
78 //std::cout << "Id of atom is " << (*iter)->getId() << std::endl;
79 (*iter)->VelocityVerletUpdateU(
80 (*iter)->getId(),
81 NextStep-1,
82 AtomicForceManipulator<T>::Deltat,
83 AtomicForceManipulator<T>::IsAngstroem);
84 }
85
86 // make sum of velocities equal zero
87 if (FixedCenterOfMass)
88 AtomicForceManipulator<T>::correctVelocitiesForFixedCenterOfMass(NextStep-1);
89
90 // thermostat
91 AtomicForceManipulator<T>::performThermostatControl(NextStep-1);
92 }
93
94 //std::cout << "Force before velocity verlet, " << Force << std::endl;
95 // and perform Verlet integration for each atom with position, velocity and force vector
96 // check size of vectors
97 for(typename AtomSetMixin<T>::iterator iter = AtomicForceManipulator<T>::atoms.begin();
98 iter != AtomicForceManipulator<T>::atoms.end(); ++iter) {
99 //std::cout << "Id of atom is " << (*iter)->getId() << std::endl;
100 (*iter)->VelocityVerletUpdateX(
101 (*iter)->getId(),
102 NextStep,
103 AtomicForceManipulator<T>::Deltat,
104 AtomicForceManipulator<T>::IsAngstroem);
105 }
106
107 // exit
108 return true;
109 }
110};
111
112#endif /* VERLETFORCEINTEGRATION_HPP_ */
Note: See TracBrowser for help on using the repository browser.