OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
ForceManager.hpp
Go to the documentation of this file.
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/**
46 * @file ForceManager.hpp
47 * @author tlin
48 * @date 11/09/2004
49 * @version 1.0
50 */
51
52#ifndef BRAINS_FORCEMANAGER_HPP
53#define BRAINS_FORCEMANAGER_HPP
54
55#include "brains/ForceModifier.hpp"
56#include "brains/SimInfo.hpp"
57#include "brains/Thermo.hpp"
58#include "nonbonded/Cutoffs.hpp"
59#include "nonbonded/InteractionManager.hpp"
60#include "nonbonded/SwitchingFunction.hpp"
61#include "parallel/ForceDecomposition.hpp"
63#include "selection/SelectionEvaluator.hpp"
64#include "selection/SelectionManager.hpp"
65
66#define PREPAIR_LOOP 0
67#define PAIR_LOOP 1
68
69using namespace std;
70namespace OpenMD {
71 /**
72 * @class ForceManager ForceManager.hpp "brains/ForceManager.hpp"
73 * ForceManager is responsible for calculating both the short range
74 * (bonded) interactions and long range (non-bonded) interactions.
75 *
76 * @note the reason we delay some of the setup is that
77 * initialization must wait until after the force field has been
78 * parsed so that the atom types are known.
79 */
81 public:
82 ForceManager(SimInfo* info);
83 virtual ~ForceManager();
84 virtual void calcForces();
85 virtual void calcSelectedForces(Molecule* mol1, Molecule* mol2);
86 void setDoElectricField(bool def) { doElectricField_ = def; }
87 void initialize();
88
89 protected:
90 bool initialized_ {false};
91 bool doParticlePot_ {false};
92 bool doElectricField_ {false};
93 bool doSitePotential_ {false};
94 bool doHeatFlux_ {false};
95 bool doLongRangeCorrections_ {false};
96 bool usePeriodicBoundaryConditions_ {false};
97 bool useSurfaceTerm_ {false};
98 bool useSlabGeometry_ {false};
99 int axis_ {false};
100
101 virtual void setupCutoffs();
102 virtual void preCalculation();
103 virtual void shortRangeInteractions();
104 virtual void longRangeInteractions();
105 virtual void postCalculation();
106
107 virtual void selectedPreCalculation(Molecule* mol1, Molecule* mol2);
108 virtual void selectedShortRangeInteractions(Molecule* mol1, Molecule* mol2);
109 virtual void selectedLongRangeInteractions(Molecule* mol1, Molecule* mol2);
110 virtual void selectedPostCalculation(Molecule* mol1, Molecule* mol2);
111
112 SimInfo* info_ {nullptr};
113 ForceField* forceField_ {nullptr};
114 InteractionManager* interactionMan_ {nullptr};
115 ForceDecomposition* fDecomp_ {nullptr};
116 SwitchingFunction* switcher_ {nullptr};
117 Thermo* thermo {nullptr};
118
119 SwitchingFunctionType sft_; /**< Type of switching function in use */
120 RealType rCut_; /**< cutoff radius for non-bonded interactions */
121 RealType rCutSq_;
122 RealType rSwitch_; /**< inner radius of switching function */
123 CutoffMethod
124 cutoffMethod_; /**< Cutoff Method for most non-bonded interactions */
125
126 AtomTypeSet atomTypes_;
127 std::vector<pair<AtomType*, AtomType*>> interactions_;
128 std::map<Bend*, BendDataSet> bendDataSets;
129 std::map<Torsion*, TorsionDataSet> torsionDataSets;
130 std::map<Inversion*, InversionDataSet> inversionDataSets;
131 std::vector<int> neighborList_;
132 std::vector<int> point_;
133 std::vector<Vector3d> savedPositions_;
134
135 std::vector<RealType> vdwScale_;
136 std::vector<RealType> electrostaticScale_;
137
138 Mat3x3d virialTensor;
139
140 std::vector<ForceModifier*> forceModifiers_;
141
142 bool doPotentialSelection_ {false};
143 std::string selectionScript_;
144 SelectionManager seleMan_;
145 SelectionEvaluator evaluator_;
146
147 // And all of the variables and structures for long range interactions:
148 InteractionData idat;
149 SelfData sdat;
150 };
151} // namespace OpenMD
152
153#endif // BRAINS_FORCEMANAGER_HPP
ForceDecomposition is an interface for passing out and collecting information from many processors at...
ForceManager is responsible for calculating both the short range (bonded) interactions and long range...
virtual void setupCutoffs()
setupCutoffs
SwitchingFunctionType sft_
Type of switching function in use.
RealType rCut_
cutoff radius for non-bonded interactions
CutoffMethod cutoffMethod_
Cutoff Method for most non-bonded interactions.
RealType rSwitch_
inner radius of switching function
InteractionManager is responsible for keeping track of the non-bonded interactions (C++)
"selection/SelectionEvaluator"
One of the heavy-weight classes of OpenMD, SimInfo maintains objects and variables relating to the cu...
Definition SimInfo.hpp:93
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
The InteractionData struct.
The SelfData struct.