STORMM Source Documentation
Loading...
Searching...
No Matches
lennard_jones_analysis.h
1// -*-c++-*-
2#ifndef LENNARD_JONES_ANALYSIS_H
3#define LENNARD_JONES_ANALYSIS_H
4
5#include <map>
6#include <vector>
7#include "copyright.h"
8#include "Constants/behavior.h"
9#include "DataTypes/stormm_vector_types.h"
10#include "Potential/energy_enumerators.h"
11#include "Synthesis/atomgraph_synthesis.h"
12
13namespace stormm {
14namespace topology {
15
16using constants::ExceptionResponse;
17using energy::VdwCombiningRule;
18using synthesis::AtomGraphSynthesis;
19
23public:
24
28 PairLJInteraction(const char4 type_a_in = { ' ', ' ', ' ', ' ' },
29 const char4 type_b_in = { ' ', ' ', ' ', ' ' }, double lja_in = 0.0,
30 double ljb_in = 0.0, double lja_14_in = 0.0, double ljb_14_in = 0.0);
31
38 PairLJInteraction(const PairLJInteraction &original) = default;
39 PairLJInteraction(PairLJInteraction &&original) = default;
40 PairLJInteraction& operator=(const PairLJInteraction &original) = default;
41 PairLJInteraction& operator=(PairLJInteraction &&original) = default;
43
44 // All member variables are public.
47 double lja;
48 double ljb;
49 double lja_14;
50 double ljb_14;
51};
52
58public:
59
66 const std::vector<std::vector<char4>> &atom_type_aliases_in);
68
76 LennardJonesAnalysis(const LennardJonesAnalysis &original) = default;
77 LennardJonesAnalysis(LennardJonesAnalysis &&original) = default;
78 LennardJonesAnalysis& operator=(const LennardJonesAnalysis &original) = default;
79 LennardJonesAnalysis& operator=(LennardJonesAnalysis &&original) = default;
81
84 int getLJTypeCount() const;
85
88 int getAtomTypeCount() const;
89
92 int getSetCount() const;
93
96 VdwCombiningRule getMostPrevalentCombiningRule() const;
97
121 const std::vector<char4>& getLJAliases(int consensus_index) const;
122
123 const std::vector<char4>& getLJAliases(double sigma_query, double epsilon_query,
124 double tolerance = 1.0e-4) const;
125
126 const std::vector<char4>& getLJAliases(const char4 atom_type_query,
127 ExceptionResponse policy = ExceptionResponse::DIE) const;
129
136 double getLJSigma(int consensus_index) const;
137
141 double getLJ14Sigma(int consensus_index) const;
142
147 double getLJEpsilon(int consensus_index) const;
148
152 double getLJ14Epsilon(int consensus_index) const;
153
168 double2 getLJParameters(int consensus_index) const;
169 double2 getLJParameters(const char4 atom_type_query,
170 ExceptionResponse policy = ExceptionResponse::DIE) const;
172
179 double2 getLJ14Parameters(int consensus_index) const;
180 double2 getLJ14Parameters(const char4 atom_type_query,
181 ExceptionResponse policy = ExceptionResponse::DIE) const;
183
188 double3 getLJCoefficients(int index_i, int index_j) const;
189 double3 getLJCoefficients(const char4 atype_i, const char4 atype_j,
190 ExceptionResponse policy = ExceptionResponse::DIE) const;
192
197 double3 getLJ14Coefficients(int index_i, int index_j) const;
198 double3 getLJ14Coefficients(const char4 atype_i, const char4 atype_j,
199 ExceptionResponse policy = ExceptionResponse::DIE) const;
201
207 int getCorrespondence(int set_index, int type_index) const;
208
214 const std::vector<int>& getSetCorrespondence(int set_index) const;
215
220 const std::vector<int2>& getInputInstances(int consensus_index) const;
221
237 void addSet(const NonbondedKit<double> &nbk,
238 const std::vector<std::vector<char4>> &othr_type_aliases);
239
240private:
241
243 int lj_type_count;
244
248 int atom_type_count;
249
251 int set_count;
252
259 VdwCombiningRule prevalent_rule;
260
264 VdwCombiningRule absolute_rule;
265
268 std::vector<double> sigma;
269
272 std::vector<double> sigma_14;
273
276 std::vector<double> epsilon;
277
280 std::vector<double> epsilon_14;
281
285 std::vector<double> lja_coeff;
286 std::vector<double> ljb_coeff;
287 std::vector<double> ljc_coeff;
288 std::vector<double> lja_14_coeff;
289 std::vector<double> ljb_14_coeff;
290 std::vector<double> ljc_14_coeff;
292
295 std::vector<PairLJInteraction> edits;
296
298 std::vector<int> ag_index_origins_bounds;
299
302 std::vector<std::vector<char4>> atom_type_aliases;
303
307 std::map<uint, std::vector<int>> atom_type_map;
308
314 std::vector<std::vector<int>> set_to_consensus_map;
315
322 std::vector<std::vector<int2>> consensus_to_set_map;
323
327 void validateConsensusIndexQuery(int ljt_query) const;
328
335 void confirmDistinctType(const char4 atom_type_query,
336 const ExceptionResponse policy = ExceptionResponse::DIE,
337 const char* caller = nullptr) const;
338};
339
344std::string listAtomTypesAsString(const std::vector<char4> &atyp_list);
345
352int inferLennardJonesTypeCount(const int length_a, const int length_b,
353 const char* caller = nullptr);
354
375template <typename T>
376VdwCombiningRule inferCombiningRule(const T* lja, const T* ljb, int lj_type_count,
377 ExceptionResponse policy = ExceptionResponse::WARN,
378 bool seek_prevalent = false);
379
380template <typename T>
381VdwCombiningRule inferCombiningRule(const std::vector<T> &lja, const std::vector<T> &ljb,
382 ExceptionResponse policy = ExceptionResponse::WARN,
383 bool seek_prevalent = false);
384
385template <typename T>
386VdwCombiningRule inferCombiningRule(const Hybrid<T> &lja, const Hybrid<T> &ljb,
387 ExceptionResponse policy = ExceptionResponse::WARN,
388 bool seek_prevalent = false);
390
396template <typename T>
397std::vector<bool> findPairSpecificParticipation(const T* lja, const T* ljb, int lj_type_count);
398
399template <typename T>
400VdwCombiningRule findPairSpecificParticipation(const std::vector<T> &lja,
401 const std::vector<T> &ljb);
402
403template <typename T>
404VdwCombiningRule findPairSpecificParticipation(const Hybrid<T> &lja, const Hybrid<T> &ljb);
406
407} // namespace topology
408} // namespace stormm
409
410#include "lennard_jones_analysis.tpp"
411
412#endif
An evolution of GpuBuffer in pmemd.cuda, the Composite array has elements that are accessible from ei...
Definition hybrid.h:202
double2 getLJParameters(int consensus_index) const
Get the Lennard-Jones sigma and epsilon parameters for the self interaction of a specific interaction...
Definition lennard_jones_analysis.cpp:276
const std::vector< char4 > & getLJAliases(int consensus_index) const
Get the atom type names associated with a particular Lennard-Jones parameter set, type index in one o...
Definition lennard_jones_analysis.cpp:190
VdwCombiningRule getMostPrevalentCombiningRule() const
Get the most prevalent Lennard-Jones rule, as judged by the formula that fits the most combinations o...
Definition lennard_jones_analysis.cpp:185
LennardJonesAnalysis(const NonbondedKit< double > &nbk, const std::vector< std::vector< char4 > > &atom_type_aliases_in)
The constructor accepts a topology. Supplying additional topologies will expand the analysis to cover...
Definition lennard_jones_analysis.cpp:29
double3 getLJCoefficients(int index_i, int index_j) const
Get the Lennard-Jones A and B coefficients for the general non-bonded interaction of two Lennard-Jone...
Definition lennard_jones_analysis.cpp:302
LennardJonesAnalysis(const LennardJonesAnalysis &original)=default
const std::vector< int > & getSetCorrespondence(int set_index) const
Obtain the Lennard-Jones type correspondence for one of the underlying sets. This can be used to reco...
Definition lennard_jones_analysis.cpp:362
double2 getLJ14Parameters(int consensus_index) const
Get the Lennard-Jones sigma and epsilon parameters for 1:4 self interactions of a specific interactio...
double getLJ14Sigma(int consensus_index) const
Get the Lennard-Jones 1:4 non-bonded self interaction sigma for a particular interaction index from w...
Definition lennard_jones_analysis.cpp:261
void addSet(const NonbondedKit< double > &nbk, const std::vector< std::vector< char4 > > &othr_type_aliases)
Add a new set of Lennard-Jones interactions to the list and expand the internal tables with all uniqu...
Definition lennard_jones_analysis.cpp:381
int getSetCount() const
Get the number of Lennard-Jones parameter sets that the analysis has compiled within its data members...
Definition lennard_jones_analysis.cpp:180
double getLJSigma(int consensus_index) const
Get the Lennard-Jones self interaction sigma for a particular interaction index from within the conse...
Definition lennard_jones_analysis.cpp:256
double getLJEpsilon(int consensus_index) const
Get the Lennard-Jones self interaction epsilon for a particular interaction index from within the con...
Definition lennard_jones_analysis.cpp:266
int getAtomTypeCount() const
Get the number of atom types, including all types with equivalent Lennard-Jones parameters.
Definition lennard_jones_analysis.cpp:175
int getLJTypeCount() const
Get the number of Lennard-Jones indices, the number of distinct Lennard Jones parameter sets which ar...
Definition lennard_jones_analysis.cpp:170
double3 getLJ14Coefficients(int index_i, int index_j) const
Get the Lennard-Jones A and B coefficients for the 1:4 non-bonded interaction of two Lennard-Jones at...
Definition lennard_jones_analysis.cpp:310
int getCorrespondence(int set_index, int type_index) const
Obtain the Lennard-Jones type correspondence for an indexed Lennard-Jones type in one of the underlyi...
Definition lennard_jones_analysis.cpp:348
const std::vector< int2 > & getInputInstances(int consensus_index) const
Get the input sets and Lennard-Jones types to which one of the consensus Lennard-Jones types maps.
Definition lennard_jones_analysis.cpp:371
double getLJ14Epsilon(int consensus_index) const
Get the Lennard-Jones 1:4 non-bonded self interaction epsilon for a particular interaction index from...
Definition lennard_jones_analysis.cpp:271
Definition stormm_vector_types.h:141
Definition stormm_vector_types.h:112
Definition stormm_vector_types.h:117
PairLJInteraction(const char4 type_a_in={ ' ', ' ', ' ', ' ' }, const char4 type_b_in={ ' ', ' ', ' ', ' ' }, double lja_in=0.0, double ljb_in=0.0, double lja_14_in=0.0, double ljb_14_in=0.0)
The default constructor will initialize atom types and parameters, but they are almost certain to reg...
Definition lennard_jones_analysis.cpp:20
Information needed for non-bonded real-space calculations. Templating is used as above,...
Definition atomgraph_abstracts.h:287
char4 type_a
Atom type of the first atom in the pair.
Definition lennard_jones_analysis.h:45
PairLJInteraction(const PairLJInteraction &original)=default
The default copy and move constructions as well as assignment operators are valid,...
double ljb_14
Lennard-Jones B coefficient for 1:4 interactions.
Definition lennard_jones_analysis.h:50
PairLJInteraction(const char4 type_a_in={ ' ', ' ', ' ', ' ' }, const char4 type_b_in={ ' ', ' ', ' ', ' ' }, double lja_in=0.0, double ljb_in=0.0, double lja_14_in=0.0, double ljb_14_in=0.0)
The default constructor will initialize atom types and parameters, but they are almost certain to reg...
Definition lennard_jones_analysis.cpp:20
char4 type_b
Atom type of the second atom in the pair.
Definition lennard_jones_analysis.h:46
double lja
Lennard-Jones A coefficient for the interaction, as in U = A/r^12 - B/r^6.
Definition lennard_jones_analysis.h:47
double ljb
Lennard-Jones B coefficient for the interaction.
Definition lennard_jones_analysis.h:48
double lja_14
Lennard-Jones A coefficient for 1:4 interactions.
Definition lennard_jones_analysis.h:49