STORMM Source Documentation
Loading...
Searching...
No Matches
mesh_forcefield.h
1// -*-c++-*-
2#ifndef STORMM_MESH_FORCEFIELD_H
3#define STORMM_MESH_FORCEFIELD_H
4
5#ifdef STORMM_USE_HPC
6# ifdef STORMM_USE_CUDA
7# include <cuda.h>
8# include <cuda_runtime.h>
9# endif
10#endif
11#include "copyright.h"
12#include "Accelerator/hybrid.h"
13#include "Constants/symbol_values.h"
14#include "Math/math_enumerators.h"
15#include "Potential/energy_enumerators.h"
16#include "Potential/soft_core_potentials.h"
17#include "Reporting/error_format.h"
18#include "Topology/atomgraph.h"
19
20namespace stormm {
21namespace structure {
22
23using card::Hybrid;
24using card::HybridKind;
25using card::HybridTargetLevel;
26using energy::cubicSoftCore;
27using energy::quinticSoftCore;
28using energy::VdwCombiningRule;
29using stmath::Interpolant;
30using symbols::amber_ancient_bioq;
31using topology::AtomGraph;
32
35template <typename T> struct MeshFFKit {
36
42 MeshFFKit(VdwCombiningRule lj_rule_in, double coulomb_in, double clash_ratio_in,
43 double clash_distance_in, const T* probe_lja_in, const T* probe_ljb_in,
44 const T* probe_ljsig_in, const T* softcore_lja_in, const T* softcore_ljb_in,
45 const T* softcore_ljc_in, const T* softcore_ljd_in, const T* softcore_lje_in,
46 const T* softcore_ljf_in, const T* softcore_qq_in);
48
54 MeshFFKit(const MeshFFKit<T> &original) = default;
55 MeshFFKit(MeshFFKit<T> &&original) = default;
57
58 // None of the member variables are mutable.
59 const VdwCombiningRule ljrule;
60 const double coulomb;
61 const float coulomb_f;
62 const double clash_ratio;
65 const float clash_ratio_f;
66 const double clash_distance;
69 const float clash_distance_f;
71 const T* probe_lja;
73 const T* probe_ljb;
75 const T* probe_ljsig;
77 const T* softcore_lja;
80 const T* softcore_ljb;
82 const T* softcore_ljc;
84 const T* softcore_ljd;
86 const T* softcore_lje;
88 const T* softcore_ljf;
90 const T* softcore_qq;
92};
93
98template <typename T> class MeshForceField {
99public:
100
107 MeshForceField(VdwCombiningRule mixing_protocol_in = VdwCombiningRule::LORENTZ_BERTHELOT,
108 double coulomb_constant_in = amber_ancient_bioq,
109 double clash_ratio_in = 0.0, double clash_distance_in = 0.0,
110 int lj_type_count_in = 0);
111
112 MeshForceField(VdwCombiningRule mixing_protocol_in, double clash_ratio_in,
113 double clash_distance_in, const AtomGraph *ag);
114
115 MeshForceField(VdwCombiningRule mixing_protocol_in, double clash_ratio_in,
116 double clash_distance_in, const AtomGraph &ag);
117
118 MeshForceField(VdwCombiningRule mixing_protocol_in, double coulomb_constant_in,
119 double clash_ratio_in, double clash_distance_in,
120 const std::vector<double> &probe_sigma,
121 const std::vector<double> &probe_epsilon);
123
132 MeshForceField& operator=(const MeshForceField<T> &other);
133 MeshForceField& operator=(MeshForceField<T> &&other);
135
137 VdwCombiningRule getCombiningRule() const;
138
141 double getClashRatio() const;
142
144 double getClashDistance() const;
145
149 const MeshFFKit<T> data(HybridTargetLevel tier = HybridTargetLevel::HOST) const;
150
154 const MeshFFKit<double> referenceData(HybridTargetLevel tier = HybridTargetLevel::HOST) const;
155
159 const MeshFFKit<void> templateFreeData(HybridTargetLevel tier = HybridTargetLevel::HOST) const;
160
161#ifdef STORMM_USE_HPC
162# ifdef STORMM_USE_CUDA
165 const MeshFFKit<T> deviceViewToHostData() const;
166
169 const MeshFFKit<double> deviceViewToReferenceHostData() const;
170
173 const MeshFFKit<void> deviceViewToTemplateFreeHostData() const;
174# endif
175
177 void upload();
178
180 void download();
181#endif
182
188 void setCombiningRule(VdwCombiningRule mixing_protocol_in);
189
195 void setClashDistance(double clash_distance_in);
196
202 void setClashRatio(double clash_ratio_in);
203
209 void setElecSoftcoreParameter(double coef, int pos);
210
220 void setElecSoftcoreParameters(Interpolant stencil_kind);
221
228 void setLJCoefficients(int index, double lja_in, double ljb_in);
229
242 void setLJCoefficients(const AtomGraph *ag, const std::vector<double> &probe_radius,
243 const std::vector<double> &probe_well_depth);
244
245 void setLJCoefficients(const AtomGraph &ag, const std::vector<double> &probe_radius,
246 const std::vector<double> &probe_well_depth);
247
248 void setLJCoefficients(const AtomGraph *ag, double probe_radius, double probe_well_depth);
249
250 void setLJCoefficients(const AtomGraph &ag, double probe_radius, double probe_well_depth);
252
259 void setLJSoftcoreParameter(int index, double coef, int pos);
260
266 void setLJSoftcoreParameters(Interpolant stencil_kind);
267
273 void reallocate(const int lj_type_count_in);
274
275private:
276
279 int lj_type_count;
280
282 VdwCombiningRule mixing_protocol;
283
286 double coulomb_constant;
287
291 double clash_ratio;
292
296 double clash_distance;
297
298 // The following arrays store atom type-specific Lennard-Jones parameters for meshes detailing
299 // steric clashes or Lennard-Jones potentials. If the combining rule is NBFIX, the pairwise
300 // parameters for interactions of the probe with each type of atom in the underlying topology
301 // must be provided. Otherwise, these parameters will be inferred based on the topology and a
302 // single set of parameters for the solvent probe using one of the other combining rules.
303 Hybrid<T> probe_lja;
306 Hybrid<T> probe_ljb;
309 Hybrid<T> probe_lj_sigma;
311 Hybrid<T> probe_softcore_lja;
317 Hybrid<T> probe_softcore_ljb;
319 Hybrid<T> probe_softcore_ljc;
321 Hybrid<T> probe_softcore_ljd;
323 Hybrid<T> probe_softcore_lje;
325 Hybrid<T> probe_softcore_ljf;
328 Hybrid<T> elec_softcore;
331
333 Hybrid<T> softcore_data;
334
341 Hybrid<double> ref_probe_lja;
342 Hybrid<double> ref_probe_ljb;
343 Hybrid<double> ref_probe_lj_sigma;
344 Hybrid<double> ref_probe_softcore_lja;
345 Hybrid<double> ref_probe_softcore_ljb;
346 Hybrid<double> ref_probe_softcore_ljc;
347 Hybrid<double> ref_probe_softcore_ljd;
348 Hybrid<double> ref_probe_softcore_lje;
349 Hybrid<double> ref_probe_softcore_ljf;
350 Hybrid<double> ref_elec_softcore;
351 Hybrid<double> ref_softcore_data;
353
360 void allocate(int lj_type_count_in);
361
363 void rebasePointers();
364
368 void validateTypeIndex(int index);
369};
370
384template <typename T> MeshFFKit<T> restoreType(const MeshFFKit<void> *rasa);
385template <typename T> MeshFFKit<T> restoreType(const MeshFFKit<void> &rasa);
387
388} // namespace structure
389} // namespace stormm
390
391#include "mesh_forcefield.tpp"
392
393#endif
An evolution of GpuBuffer in pmemd.cuda, the Composite array has elements that are accessible from ei...
Definition hybrid.h:202
void reallocate(const int lj_type_count_in)
Reallocate the object to hold a different number of Lennard-Jones types. The electrostatic softcore p...
void setElecSoftcoreParameter(double coef, int pos)
Set a specific coefficient in the softcore electrostatic polynomial.
const MeshFFKit< double > referenceData(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the refernce data in double precision, regardless of how the object is cast.
void setLJSoftcoreParameter(int index, double coef, int pos)
Set a specific softcore polynomial coefficient.
void setCombiningRule(VdwCombiningRule mixing_protocol_in)
Set the combining rule that will be used to make the probe interact with the receptor on any mesh (wi...
double getClashDistance() const
Get the absolute distance at which softcore electrostatic interactions take over.
void setClashDistance(double clash_distance_in)
Set the absolute distance at which electrostatic charges will begin to be damped according to the sof...
void setClashRatio(double clash_ratio_in)
Set the ratio of the van-der Waals (Lennard-Jones) sigma parameters at which softcore interactions ta...
void setElecSoftcoreParameters(Interpolant stencil_kind)
Compute the polynomial for an electrostatic softcore potential suitable for a certain interpolation s...
void setLJCoefficients(int index, double lja_in, double ljb_in)
Set the Lennard-Jones pairwise coefficients to describe the interaction of one atom type in the mesh'...
MeshForceField(const MeshForceField< T > &original)
The copy and move constructors as well as assignment operators must be written out to repair various ...
double getClashRatio() const
Get the ratio of the van-der Waals (Lennard-Jones) sigma parameter for interacting pairs of particles...
const MeshFFKit< T > data(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get the abstract in whatever templated type (float or double) the object is cast in.
void setLJSoftcoreParameters(Interpolant stencil_kind)
Compute softcore polynomials for the loaded Lennard-Jones parameters, ratio of the sigma parameter at...
VdwCombiningRule getCombiningRule() const
Get the Lennard-Jones mixing rule.
const MeshFFKit< void > templateFreeData(HybridTargetLevel tier=HybridTargetLevel::HOST) const
Get a template-free form of the object's abstract in its native type.
MeshForceField(VdwCombiningRule mixing_protocol_in=VdwCombiningRule::LORENTZ_BERTHELOT, double coulomb_constant_in=amber_ancient_bioq, double clash_ratio_in=0.0, double clash_distance_in=0.0, int lj_type_count_in=0)
The object is a convenient place to store constants and arrays of coefficients, nothing more....
void setLJCoefficients(const AtomGraph *ag, const std::vector< double > &probe_radius, const std::vector< double > &probe_well_depth)
Set the Lennard-Jones pairwise coefficients based on the mesh's underlying topology.
A struct to hold information relating to an Amber topology. This struct's member functions are limite...
Definition atomgraph.h:50
MeshFFKit()
The constructor takes arguments for all member variables. One additional constructor is provided to c...
An object to store the probe's specific non-bonded parameters and softcore function coefficients used...
Definition mesh_forcefield.h:35
const VdwCombiningRule ljrule
Combining rule used to determine Lennard-Jones parameters.
Definition mesh_forcefield.h:59
MeshFFKit()
The constructor takes arguments for all member variables. One additional constructor is provided to c...
MeshFFKit(const MeshFFKit< T > &original)=default
The default copy and move constructors will be valid for this object. Const members negate the use of...
const T * softcore_lja
Definition mesh_forcefield.h:77
const T * probe_ljsig
Definition mesh_forcefield.h:75
const T * softcore_ljf
Definition mesh_forcefield.h:88
const float clash_ratio_f
Single-precision variant of clash_ratio.
Definition mesh_forcefield.h:65
const T * softcore_ljb
Definition mesh_forcefield.h:80
const T * probe_ljb
Definition mesh_forcefield.h:73
const T * softcore_lje
Definition mesh_forcefield.h:86
const float coulomb_f
Single-precision variant of the Coulomb constant.
Definition mesh_forcefield.h:61
const T * softcore_ljd
Definition mesh_forcefield.h:84
const T * softcore_ljc
Definition mesh_forcefield.h:82
const double coulomb
The Coulomb constant for electrostatic interactions.
Definition mesh_forcefield.h:60
const double clash_distance
Definition mesh_forcefield.h:66
const T * probe_lja
Definition mesh_forcefield.h:71
const float clash_distance_f
Definition mesh_forcefield.h:69
const T * softcore_qq
Definition mesh_forcefield.h:90
const double clash_ratio
Definition mesh_forcefield.h:62