RASPA3 3.0.12
A molecular simulation code for computing adsorption and diffusion in nanoporous materials
|
Represents the force field used in simulations. More...
Classes | |
struct | InsensitiveCompare |
Comparator for case-insensitive string comparison. More... | |
Public Types | |
enum class | ChargeMethod : int { Ewald = 0 , Coulomb = 1 , Wolf = 2 , ModifiedWolf = 3 } |
Enumeration of methods used for electrostatic interactions. More... | |
enum class | MixingRule : int { Lorentz_Berthelot = 0 , Jorgensen = 1 } |
Enumeration of mixing rules for cross interactions. More... | |
enum class | PotentialEnergySurfaceType : std::size_t { None = 0 , SecondOrderPolynomialTestFunction = 1 , ThirdOrderPolynomialTestFunction = 2 , FourthOrderPolynomialTestFunction = 3 , FifthOrderPolynomialTestFunction = 4 , SixthOrderPolynomialTestFunction = 5 , ExponentialNonPolynomialTestFunction = 6 , MullerBrown = 7 , Eckhardt = 8 , GonzalezSchlegel = 9 } |
enum class | InterpolationGridType : std::size_t { LennardJones = 0 , LennardJonesRepulsion = 1 , LennardJonesAttraction = 2 , EwaldReal = 3 } |
enum class | InterpolationScheme : std::size_t { Polynomial = 1 , Tricubic = 8 , Triquintic = 27 } |
Public Member Functions | |
ForceField () noexcept=default | |
Default constructor for the ForceField struct. | |
ForceField (std::vector< PseudoAtom > pseudoAtoms, std::vector< VDWParameters > parameters, MixingRule mixingRule, double cutOffFrameworkVDW, double cutOffMoleculeVDW, double cutOffCoulomb, bool shifted, bool tailCorrections, bool useCharge=true) noexcept(false) | |
Constructs a ForceField with specified parameters. | |
ForceField (std::string filePath) noexcept(false) | |
Constructs a ForceField by reading parameters from a file. | |
VDWParameters & | operator() (std::size_t row, std::size_t col) |
const VDWParameters & | operator[] (std::size_t row) const |
const VDWParameters & | operator() (std::size_t row, std::size_t col) const |
bool | operator== (const ForceField &other) const |
void | applyMixingRule () |
Applies the mixing rule to compute cross-interaction parameters. | |
double | cutOffVDW (std::size_t i, std::size_t j) const |
Returns the cut-off distance for van der Waals interactions between two pseudo-atoms. | |
void | preComputePotentialShift () |
Pre-computes the potential shift for interactions. | |
void | preComputeTailCorrection () |
Pre-computes the tail corrections for interactions. | |
std::string | printPseudoAtomStatus () const |
Returns a string representation of the pseudo-atom status. | |
std::string | printCutOffAutoStatus () const |
std::string | printForceFieldStatus () const |
Returns a string representation of the force field status. | |
std::vector< nlohmann::json > | jsonPseudoAtomStatus () const |
Returns a JSON representation of the pseudo-atom status. | |
nlohmann::json | jsonForceFieldStatus () const |
Returns a JSON representation of the force field status. | |
std::optional< std::size_t > | findPseudoAtom (const std::string &name) const |
Finds the index of a pseudo-atom by name. | |
void | initializeEwaldParameters (const SimulationBox &simulationBox) |
Initializes the Ewald parameters based on the simulation box. | |
void | initializeAutomaticCutOff (const SimulationBox &simulationBox) |
std::string | repr () const |
Returns a string representation of the ForceField. | |
void | validateInput (const nlohmann::basic_json< nlohmann::raspa_map > &parsed_data) |
Static Public Member Functions | |
static std::optional< ForceField > | readForceField (std::optional< std::string > directoryName, std::string forceFieldFileName) noexcept(false) |
Reads a ForceField from a file. | |
static std::optional< std::size_t > | findPseudoAtom (const std::vector< PseudoAtom > pseudoAtoms, const std::string &name) |
Finds the index of a pseudo-atom by name in a given list. | |
Public Attributes | |
std::uint64_t | versionNumber {1} |
Version number of the force field format. | |
std::vector< VDWParameters > | data {} |
Interaction parameters between pseudo-atoms; size is numberOfPseudoAtoms squared. | |
std::vector< bool > | shiftPotentials {} |
Indicates if potential shift is applied between pairs of atoms. | |
std::vector< bool > | tailCorrections {} |
Indicates if tail corrections are applied between pairs of atoms. | |
MixingRule | mixingRule {MixingRule::Lorentz_Berthelot} |
Mixing rule used for cross interactions. | |
bool | cutOffFrameworkVDWAutomatic {false} |
double | cutOffFrameworkVDW {12.0} |
Cut-off distance for VDW interactions between framework and molecules. | |
bool | cutOffMoleculeVDWAutomatic {false} |
double | cutOffMoleculeVDW {12.0} |
Cut-off distance for VDW interactions between molecules. | |
bool | cutOffCoulombAutomatic {true} |
double | cutOffCoulomb {12.0} |
Cut-off distance for Coulomb interactions. | |
double | dualCutOff {6.0} |
Inner cut-off distance when using dual cut-off scheme. | |
std::size_t | numberOfPseudoAtoms {0} |
Number of pseudo-atoms defined in the force field. | |
std::vector< PseudoAtom > | pseudoAtoms {} |
List of pseudo-atoms in the force field. | |
ChargeMethod | chargeMethod {ChargeMethod::Ewald} |
Method used for calculating electrostatic interactions. | |
double | EwaldPrecision {1e-6} |
Desired precision for Ewald summation. | |
double | EwaldAlpha {0.265058} |
Ewald convergence parameter alpha. | |
int3 | numberOfWaveVectors {8, 8, 8} |
Number of wave vectors in each direction for Ewald summation. | |
std::size_t | reciprocalIntegerCutOffSquared |
Squared integer cut-off in reciprocal space. | |
double | reciprocalCutOffSquared |
Squared cut-off distance in reciprocal space. | |
bool | automaticEwald {true} |
Indicates if Ewald parameters are computed automatically. | |
bool | useCharge {true} |
Indicates if charges are used in calculations. | |
bool | omitEwaldFourier {false} |
If true, omits the Fourier component in Ewald summation. | |
double | energyOverlapCriteria {1e6} |
Energy criteria for considering overlaps. | |
std::size_t | numberOfTrialDirections { 10 } |
std::size_t | numberOfTorsionTrialDirections { 100 } |
std::size_t | numberOfFirstBeadPositions { 10 } |
double | minimumRosenbluthFactor {1e-150} |
Minimum allowed Rosenbluth factor. | |
bool | useDualCutOff {false} |
Indicates if dual cut-off scheme is used. | |
bool | omitInterInteractions {false} |
If true, omits interactions between molecules. | |
bool | computePolarization {false} |
Indicates if polarization effects are computed. | |
bool | omitInterPolarization {true} |
If true, omits polarization between molecules. | |
bool | hasExternalField {false} |
PotentialEnergySurfaceType | potentialEnergySurfaceType {PotentialEnergySurfaceType::SecondOrderPolynomialTestFunction} |
double3 | potentialEnergySurfaceOrigin {0.0, 0.0, 0.0} |
std::vector< std::size_t > | gridPseudoAtomIndices |
double | spacingVDWGrid {0.15} |
double | spacingCoulombGrid {0.15} |
std::optional< int3 > | numberOfVDWGridPoints {} |
std::optional< int3 > | numberOfCoulombGridPoints {} |
std::size_t | numberOfGridTestPoints {100000} |
bool | interpolationSchemeAuto {true} |
InterpolationScheme | interpolationScheme {InterpolationScheme::Polynomial} |
Static Public Attributes | |
static const std::set< std::string, InsensitiveCompare > | options |
Set of general option keys accepted in the input data. | |
Friends | |
Archive< std::ofstream > & | operator<< (Archive< std::ofstream > &archive, const ForceField &f) |
Archive< std::ifstream > & | operator>> (Archive< std::ifstream > &archive, ForceField &f) |
Represents the force field used in simulations.
The ForceField struct contains all parameters and methods related to force field calculations, including van der Waals interactions, electrostatics, Ewald summation parameters, mixing rules, and methods to initialize and compute these parameters.
|
strong |
|
strong |
ForceField::ForceField | ( | std::vector< PseudoAtom > | pseudoAtoms, |
std::vector< VDWParameters > | parameters, | ||
MixingRule | mixingRule, | ||
double | cutOffFrameworkVDW, | ||
double | cutOffMoleculeVDW, | ||
double | cutOffCoulomb, | ||
bool | shifted, | ||
bool | tailCorrections, | ||
bool | useCharge = true |
||
) |
Constructs a ForceField with specified parameters.
Initializes the force field using the provided pseudo-atoms, van der Waals parameters, mixing rule, cut-off distances, and flags for shifting potentials and tail corrections.
pseudoAtoms | Vector of pseudo-atoms. |
parameters | Vector of van der Waals self-interaction parameters. |
mixingRule | The mixing rule to use for cross interactions. |
cutOffFrameworkVDW | Cut-off distance for VDW interactions between framework and molecules. |
cutOffMoleculeVDW | Cut-off distance for VDW interactions between molecules. |
cutOffCoulomb | Cut-off distance for Coulomb interactions. |
shifted | If true, applies potential shift to interactions. |
tailCorrections | If true, applies tail corrections to interactions. |
useCharge | If true, includes electrostatic interactions. |
ForceField::ForceField | ( | std::string | filePath | ) |
Constructs a ForceField by reading parameters from a file.
Initializes the force field by parsing a force field file specified by the file path.
filePath | Path to the force field file. |
void ForceField::applyMixingRule | ( | ) |
Applies the mixing rule to compute cross-interaction parameters.
Calculates the interaction parameters between different pseudo-atoms using the specified mixing rule.
double ForceField::cutOffVDW | ( | std::size_t | i, |
std::size_t | j | ||
) | const |
Returns the cut-off distance for van der Waals interactions between two pseudo-atoms.
i | Index of the first pseudo-atom. |
j | Index of the second pseudo-atom. |
std::optional< std::size_t > ForceField::findPseudoAtom | ( | const std::string & | name | ) | const |
Finds the index of a pseudo-atom by name.
Searches for a pseudo-atom with the given name and returns its index if found.
name | Name of the pseudo-atom. |
|
static |
Finds the index of a pseudo-atom by name in a given list.
Searches for a pseudo-atom with the given name in the provided vector and returns its index if found.
pseudoAtoms | Vector of pseudo-atoms to search. |
name | Name of the pseudo-atom. |
void ForceField::initializeEwaldParameters | ( | const SimulationBox & | simulationBox | ) |
Initializes the Ewald parameters based on the simulation box.
Calculates the Ewald alpha parameter and the number of wave vectors required for the desired precision.
simulationBox | The simulation box to use for initialization. |
nlohmann::json ForceField::jsonForceFieldStatus | ( | ) | const |
Returns a JSON representation of the force field status.
Generates a JSON object containing information about the force field parameters.
std::vector< nlohmann::json > ForceField::jsonPseudoAtomStatus | ( | ) | const |
Returns a JSON representation of the pseudo-atom status.
Generates a JSON array containing information about the pseudo-atoms.
void ForceField::preComputePotentialShift | ( | ) |
Pre-computes the potential shift for interactions.
Calculates the potential shift for each pair of pseudo-atoms if shifting is enabled.
void ForceField::preComputeTailCorrection | ( | ) |
Pre-computes the tail corrections for interactions.
Calculates the tail correction energy for each pair of pseudo-atoms if tail corrections are enabled.
std::string ForceField::printForceFieldStatus | ( | ) | const |
Returns a string representation of the force field status.
Generates a detailed string containing information about the force field parameters.
std::string ForceField::printPseudoAtomStatus | ( | ) | const |
Returns a string representation of the pseudo-atom status.
Generates a detailed string containing information about the pseudo-atoms.
|
static |
Reads a ForceField from a file.
Attempts to read the force field parameters from the specified file.
directoryName | Optional directory name where the file is located. |
forceFieldFileName | Name of the force field file. |
|
inline |
Returns a string representation of the ForceField.
Combines the pseudo-atom status and force field status into a single string.
|
static |
Set of general option keys accepted in the input data.
This set contains all the general configuration keys that are recognized at the top level of the input JSON. It is used to validate the presence of only known keys.
double ForceField::reciprocalCutOffSquared |
Squared cut-off distance in reciprocal space.
std::size_t ForceField::reciprocalIntegerCutOffSquared |
Squared integer cut-off in reciprocal space.