OpenMD 3.2
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
EAM.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 following paper when you publish your work:
33 *
34 * [1] Drisko et al., J. Open Source Softw. 9, 7004 (2024).
35 *
36 * Good starting points for code and simulation methodology are:
37 *
38 * [2] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).
39 * [3] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).
40 * [4] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).
41 * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
42 * [6] Kuang & Gezelter, Mol. Phys., 110, 691-701 (2012).
43 * [7] Lamichhane, Gezelter & Newman, J. Chem. Phys. 141, 134109 (2014).
44 * [8] Bhattarai, Newman & Gezelter, Phys. Rev. B 99, 094106 (2019).
45 * [9] Drisko & Gezelter, J. Chem. Theory Comput. 20, 4986-4997 (2024).
46 */
47
48#ifndef NONBONDED_EAM_HPP
49#define NONBONDED_EAM_HPP
50
51#include <memory>
52
53#include "brains/ForceField.hpp"
54#include "math/CubicSpline.hpp"
55#include "math/Vector3.hpp"
56#include "nonbonded/Electrostatic.hpp"
57#include "nonbonded/NonBondedInteraction.hpp"
58#include "types/EAMAdapter.hpp"
59
60namespace OpenMD {
61
62 struct EAMAtomData {
63 CubicSplinePtr rho;
64 CubicSplinePtr F;
65 CubicSplinePtr Z;
66 CubicSplinePtr phiCC;
67 CubicSplinePtr phiCV;
68 RealType rcut;
69 RealType nValence;
70 RealType nMobile;
71 bool isFluctuatingCharge;
72 };
73
75 CubicSplinePtr phi;
76 CubicSplinePtr phiCC;
77 RealType Ci = 0.0; // to zero out the CV interaction in the eam-explict
78 // interaction for EAMTable and EAMZhou
79 RealType Cj = 0.0; // to zero out the CV interaction in the eam-explict
80 // interaction for EAMTable and EAMZhou
81 RealType rcut;
82 bool explicitlySet;
83 };
84
85 enum EAMMixingMethod {
86 eamJohnson,
87 eamDaw,
88 eamDream1,
89 eamDream2,
90 eamUnknownMix
91 };
92
93 class EAM : public MetallicInteraction {
94 public:
95 EAM();
96 void setForceField(ForceField* ff) { forceField_ = ff; };
97 void setElectrostatic(Electrostatic* el) { electrostatic_ = el; };
98 void setSimulatedAtomTypes(AtomTypeSet& simtypes) {
99 simTypes_ = simtypes;
100 initialize();
101 };
102 void addType(AtomType* atomType);
103 void addExplicitInteraction(AtomType* atype1, AtomType* atype2, RealType dr,
104 int nr, std::vector<RealType> phiAB);
105
106 void addExplicitInteraction(AtomType* atype1, AtomType* atype2, RealType re,
107 RealType alpha, RealType beta, RealType A,
108 RealType B, RealType kappa, RealType lambda);
109
110 void addExplicitInteraction(AtomType* atype1, AtomType* atype2, RealType re,
111 RealType alpha, RealType A, RealType Ci,
112 RealType Cj);
113
114 RealType fastPower(RealType x, int y);
115
116 // RealType ZhouPhiCoreCore(RealType r, RealType re, RealType A,
117 // RealType alpha, RealType kappa);
118 // RealType ZhouPhiCoreValence(RealType r, RealType re, RealType B,
119 // RealType beta, RealType lambda);
120 //
121 // RealType ZhouPhi(RealType r, RealType re, RealType A, RealType B,
122 // RealType alpha, RealType beta, RealType kappa,
123 // RealType lambda);
124 //
125 // RealType ZhouRho(RealType r, RealType re, RealType fe, RealType beta,
126 // RealType lambda);
127
128 RealType PhiCoreCore(RealType r, RealType re, RealType A, RealType alpha,
129 RealType kappa);
130 RealType PhiCoreValence(RealType r, RealType re, RealType B, RealType beta,
131 RealType lambda);
132
133 RealType Phi(RealType r, RealType re, RealType A, RealType B,
134 RealType alpha, RealType beta, RealType kappa,
135 RealType lambda);
136
137 RealType Rho(RealType r, RealType re, RealType fe, RealType beta,
138 RealType lambda);
139 RealType gFunc(RealType q, RealType nV, RealType nM);
140 RealType gPrime(RealType q, RealType nV, RealType nM);
141 RealType Zhou2001Functional(RealType rho, RealType rhoe,
142 std::vector<RealType> Fn,
143 std::vector<RealType> F, RealType Fe,
144 RealType eta);
145 RealType Zhou2004Functional(RealType rho, RealType rhoe, RealType rhos,
146 std::vector<RealType> Fn,
147 std::vector<RealType> F, RealType Fe,
148 RealType eta, RealType rhol, RealType rhoh);
149 RealType Zhou2005Functional(RealType rho, RealType rhoe, RealType rhos,
150 std::vector<RealType> Fn,
151 std::vector<RealType> F, RealType F3plus,
152 RealType F3minus, RealType Fe, RealType eta);
153 RealType Zhou2005OxygenFunctional(RealType rho,
154 std::vector<RealType> OrhoLimits,
155 std::vector<RealType> OrhoE,
156 std::vector<std::vector<RealType>> OF);
157 RealType RoseFunctional(RealType rho, RealType rhoe, RealType F0);
158
159 void calcDensity(InteractionData& idat);
160 void calcFunctional(SelfData& sdat);
161 void calcForce(InteractionData& idat);
162
163 virtual string getName() { return name_; }
164 virtual int getHash() { return EAM_INTERACTION; }
165 virtual RealType getSuggestedCutoffRadius(
166 pair<AtomType*, AtomType*> atypes);
167 void setCutoffRadius(RealType rCut);
168
169 private:
170 void initialize();
171 CubicSplinePtr getPhi(AtomType* atomType1, AtomType* atomType2);
172
173 bool initialized_;
174 bool haveCutoffRadius_;
175 set<int> EAMtypes; /**< The set of AtomType idents that are EAM types */
176 vector<int>
177 EAMtids; /**< The mapping from AtomType ident -> EAM type ident */
178 vector<EAMAtomData>
179 EAMdata; /**< The EAM atomic data indexed by EAM type ident */
180 vector<vector<EAMInteractionData>>
181 MixingMap; /**< The mixing parameters between two EAM types */
182 int nEAM_;
183
184 ForceField* forceField_;
185 Electrostatic* electrostatic_;
186 AtomTypeSet simTypes_;
187 RealType pre11_;
188 RealType eamRcut_;
189 // RealType oss_;
190 Vector3d rhat;
191
192 EAMMixingMethod mixMeth_;
193 string name_;
194 };
195} // namespace OpenMD
196
197#endif
AtomType is what OpenMD looks to for unchanging data about an atom.
Definition AtomType.hpp:69
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
The InteractionData struct.
The SelfData struct.