OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
Integrator.hpp
1/*
2 * Copyright (c) 2004-present, The University of Notre Dame. All rights
3 * reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your
32 * research, please cite the appropriate papers when you publish your
33 * work. Good starting points are:
34 *
35 * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).
36 * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).
37 * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).
38 * [4] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
39 * [5] Kuang & Gezelter, Mol. Phys., 110, 691-701 (2012).
40 * [6] Lamichhane, Gezelter & Newman, J. Chem. Phys. 141, 134109 (2014).
41 * [7] Lamichhane, Newman & Gezelter, J. Chem. Phys. 141, 134110 (2014).
42 * [8] Bhattarai, Newman & Gezelter, Phys. Rev. B 99, 094106 (2019).
43 */
44
45#ifndef INTEGRATORS_INTEGRATOR_HPP
46#define INTEGRATORS_INTEGRATOR_HPP
47
48#include <memory>
49
51#include "brains/Stats.hpp"
52#include "brains/Velocitizer.hpp"
53#include "constraints/Rattle.hpp"
54#include "flucq/FluctuatingChargePropagator.hpp"
55#include "integrators/DLM.hpp"
56#include "integrators/RotationAlgorithm.hpp"
57#include "io/DumpWriter.hpp"
58#include "io/StatWriter.hpp"
59#include "rnemd/RNEMD.hpp"
60#include "utils/ProgressBar.hpp"
61
62namespace OpenMD {
63 /**
64 * @brief Declaration of the Integrator base class, which
65 * all other integrators inherit from.
66 *
67 * It provides an abstract integrate() function which will be called
68 * by the host application to integrate the system forward in time.
69 *
70 * Several convenience functions are also provided that are commonly
71 * needed by subclasses.
72 */
73 class Integrator {
74 public:
75 /**
76 * @brief Default Destructor
77 */
78 virtual ~Integrator();
79
80 void integrate();
81 void updateSizes();
82 void setVelocitizer(std::unique_ptr<Velocitizer> velocitizer);
83 void setFluctuatingChargePropagator(FluctuatingChargePropagator* prop);
84 void setRotationAlgorithm(RotationAlgorithm* algo);
85 void setRNEMD(std::unique_ptr<RNEMD::RNEMD> rnemd);
86
87 protected:
88 Integrator(SimInfo* info);
89
90 virtual void initialize();
91 virtual void preStep();
92 /** @brief Computes an integration step from t to t+dt
93 *
94 * This function must be implemented by any subclasses, and computes a
95 * single integration step from the current time (t) to (t+dt).
96 */
97 virtual void step() = 0;
98 virtual void calcForce();
99 virtual void postStep();
100 virtual void finalize();
101 virtual void resetIntegrator() {}
102 virtual void doUpdateSizes() {}
103 void saveConservedQuantity();
104
105 RealType dt, dt2;
106 RealType runTime;
107 RealType sampleTime;
108 RealType statusTime;
109 RealType thermalTime;
110 RealType resetTime;
111 RealType RNEMD_exchangeTime;
112 RealType currSample;
113 RealType currStatus;
114 RealType currThermal;
115 RealType currReset;
116 RealType currRNEMD;
117
118 SimInfo* info_ {nullptr};
119 Globals* simParams {nullptr};
120 ForceManager* forceMan_ {nullptr};
121 RotationAlgorithm* rotAlgo_ {nullptr};
122 FluctuatingChargePropagator* flucQ_ {nullptr};
123 Rattle* rattle_ {nullptr};
124 std::unique_ptr<Velocitizer> velocitizer_ {nullptr};
125 std::unique_ptr<RNEMD::RNEMD> rnemd_ {nullptr};
126
127 bool needPotential {false};
128 bool needVirial {false};
129 bool needReset {false};
130 bool needVelocityScaling {false};
131 bool useRNEMD {false};
132
133 RealType targetScalingTemp;
134
135 Stats* stats {nullptr};
136 DumpWriter* dumpWriter {nullptr};
137 StatWriter* statWriter {nullptr};
138 Thermo thermo;
139
140 Snapshot* snap {nullptr};
141 ProgressBarPtr progressBar {nullptr};
142
143 private:
144 virtual RealType calcConservedQuantity() = 0;
145 virtual DumpWriter* createDumpWriter();
146 virtual StatWriter* createStatWriter();
147 };
148} // namespace OpenMD
149
150#endif // INTEGRATORS_INTEGRATOR_HPP
abstract class for propagating fluctuating charge variables
ForceManager is responsible for calculating both the short range (bonded) interactions and long range...
Declaration of the Integrator base class, which all other integrators inherit from.
virtual ~Integrator()
Default Destructor.
virtual void step()=0
Computes an integration step from t to t+dt.
Velocity Verlet Constraint Algorithm.
Definition Rattle.hpp:58
abstract class for rotation
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
Definition SimInfo.hpp:93
The Snapshot class is a repository storing dynamic data during a Simulation.
Definition Snapshot.hpp:147
A configurable Statistics Writer.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.