27template <
typename floatType = 
double, 
typename intType = 
unsigned long>
 
   93  void addMolType(
const intType molId, 
const std::vector<intType> siteIds,
 
   94                  const std::vector<std::array<floatType, 3>> relPos, 
const std::array<floatType, 3> momentOfInertia);
 
  117#if MD_FLEXIBLE_MODE == SINGLESITE 
  120        "ParticlePropertiesLibrary::getNumberRegisteredMolTypes(): trying to get the number of registered multi-site" 
  121        "molecule types when md-flexible has been compiled without support for multi-site molecules. Please compile " 
  122        "with the CMake argument '-DMD_FLEXIBLE_MODE=MULTISITE'.");
 
  124    return _numRegisteredMolTypes;
 
  225    return _computedLJMixingData[i * _numRegisteredSiteTypes + j].epsilon24;
 
  234  auto getLJMixingData(intType i, intType j)
 const { 
return _computedLJMixingData[i * _numRegisteredSiteTypes + j]; }
 
  243    return reinterpret_cast<const double *
>(&_computedLJMixingData[i * _numRegisteredSiteTypes + j]);
 
  253    return _computedLJMixingData[i * _numRegisteredSiteTypes + j].sigmaSquared;
 
  263    return _computedLJMixingData[i * _numRegisteredSiteTypes + j].shift6;
 
  274  static double calcShift6(
double epsilon24, 
double sigmaSquared, 
double cutoffSquared);
 
  284    return _computedATMixingData[i * _numRegisteredSiteTypes * _numRegisteredSiteTypes + j * _numRegisteredSiteTypes +
 
  297    return _computedATMixingData[i * _numRegisteredSiteTypes * _numRegisteredSiteTypes + j * _numRegisteredSiteTypes +
 
  302  intType _numRegisteredSiteTypes{0};
 
  303  intType _numRegisteredMolTypes{0};
 
  304  const double _cutoff;
 
  306  std::vector<floatType> _epsilons;
 
  307  std::vector<floatType> _sigmas;
 
  308  std::vector<floatType> _siteMasses;
 
  309  std::vector<floatType> _nus;  
 
  312  std::vector<std::vector<intType>> _siteIds;
 
  314  std::vector<std::vector<std::array<floatType, 3>>> _relativeSitePositions;
 
  315  std::vector<floatType> _molMasses;
 
  316  std::vector<std::array<floatType, 3>> _momentOfInertias;
 
  317  std::vector<size_t> _numSites;
 
  318  std::vector<floatType> _moleculesLargestSigma;
 
  321  bool _storeLJData{
false};
 
  322  bool _storeATData{
false};
 
  324  struct PackedLJMixingData {
 
  326    floatType sigmaSquared;
 
  330  struct PackedATMixingData {
 
  334  std::vector<PackedLJMixingData, autopas::AlignedAllocator<PackedLJMixingData>> _computedLJMixingData;
 
  335  std::vector<PackedATMixingData, autopas::AlignedAllocator<PackedATMixingData>> _computedATMixingData;
 
  338template <
typename floatType, 
typename intType>
 
  340  if (_numRegisteredSiteTypes != siteID) {
 
  342        "ParticlePropertiesLibrary::addSiteType(): trying to register a site type with id {}. Please " 
  344        "consecutively, starting at id 0. Currently there are {} registered types.",
 
  345        siteID, _numRegisteredSiteTypes);
 
  347  ++_numRegisteredSiteTypes;
 
  348  _siteMasses.emplace_back(mass);
 
  352    _sigmas.emplace_back(0.0);
 
  353    _epsilons.emplace_back(0.0);
 
  356    _nus.emplace_back(0.0);
 
  360template <
typename floatType, 
typename intType>
 
  363  if (siteID >= _numRegisteredSiteTypes) {
 
  365        "ParticlePropertiesLibrary::addLJParametersToSite(): Trying to set lennard-jones parameters for a site type " 
  367        " which has not been registered yet. Currently there are {} registered types.",
 
  368        siteID, _numRegisteredSiteTypes);
 
  371  if (_epsilons.size() != _numRegisteredSiteTypes) {
 
  372    _epsilons.resize(_numRegisteredSiteTypes);
 
  373    _sigmas.resize(_numRegisteredSiteTypes);
 
  375  _epsilons[siteID] = epsilon;
 
  376  _sigmas[siteID] = sigma;
 
  379template <
typename floatType, 
typename intType>
 
  381  if (siteID >= _numRegisteredSiteTypes) {
 
  383        "ParticlePropertiesLibrary::addATParametersToSite(): Trying to set the axilrod-teller parameter for a site " 
  385        " which has not been registered yet. Currently there are {} registered types.",
 
  386        siteID, _numRegisteredSiteTypes);
 
  389  if (_nus.size() != _numRegisteredSiteTypes) {
 
  390    _nus.resize(_numRegisteredSiteTypes);
 
  395template <
typename floatType, 
typename intType>
 
  397                                                               const std::vector<std::array<floatType, 3>> relPos,
 
  398                                                               const std::array<floatType, 3> momentOfInertia) {
 
  400#if MD_FLEXIBLE_MODE == SINGLESITE 
  402             "ParticlePropertiesLibrary::addMolType(): trying to register a multi-site molecule type when md-flexible " 
  403             "has been compiled without support for multi-site molecules. Please compile with the CMake argument " 
  404             "'-DMD_FLEXIBLE_MODE=MULTISITE'.");
 
  406  if (_numRegisteredMolTypes != molId) {
 
  408        "ParticlePropertiesLibrary::addMolType(): trying to register a molecule type with id {}. Please register types " 
  409        "consecutively, starting at id 0. Currently there are {} registered types.",
 
  410        molId, _numRegisteredSiteTypes);
 
  412  if (std::any_of(siteIds.cbegin(), siteIds.cend(), [
this](intType i) { return i >= this->_numRegisteredSiteTypes; })) {
 
  414        "ParticlePropertiesLibrary::addMolType(): trying to register a molecule type with an unregistered site type " 
  417  if (siteIds.size() != relPos.size()) {
 
  419        "ParticlePropertiesLibrary::addMolType(): trying to register a molecule type with vectors of site IDs and site" 
  420        "positions that do not match in size.");
 
  424  ++_numRegisteredMolTypes;
 
  425  _siteIds.emplace_back(siteIds);
 
  426  _relativeSitePositions.emplace_back(relPos);
 
  427  _numSites.emplace_back(siteIds.size());
 
  428  floatType molMass{0.};
 
  429  for (intType site = 0; site < siteIds.size(); ++site) {
 
  430    molMass += _siteMasses[siteIds[site]];
 
  432  _molMasses.emplace_back(molMass);
 
  433  _momentOfInertias.emplace_back(momentOfInertia);
 
  435  floatType molLargestSigma{0.};
 
  436  for (
size_t site = 0; site < siteIds.size(); site++) {
 
  437    molLargestSigma = std::max(molLargestSigma, _sigmas[siteIds[site]]);
 
  439  _moleculesLargestSigma.emplace_back(molLargestSigma);
 
  442template <
typename floatType, 
typename intType>
 
  444  if (_numRegisteredSiteTypes == 0) {
 
  446        "ParticlePropertiesLibrary::calculateMixingCoefficients was called without any site types being registered!");
 
  451    const auto cutoffSquared = _cutoff * _cutoff;
 
  452    _computedLJMixingData.resize(_numRegisteredSiteTypes * _numRegisteredSiteTypes);
 
  454    for (
size_t firstIndex = 0ul; firstIndex < _numRegisteredSiteTypes; ++firstIndex) {
 
  455      for (
size_t secondIndex = 0ul; secondIndex < _numRegisteredSiteTypes; ++secondIndex) {
 
  456        auto globalIndex = _numRegisteredSiteTypes * firstIndex + secondIndex;
 
  459        const floatType epsilon24 = 24 * sqrt(_epsilons[firstIndex] * _epsilons[secondIndex]);
 
  460        _computedLJMixingData[globalIndex].epsilon24 = epsilon24;
 
  463        const floatType sigma = (_sigmas[firstIndex] + _sigmas[secondIndex]) / 2.0;
 
  464        const floatType sigmaSquared = sigma * sigma;
 
  465        _computedLJMixingData[globalIndex].sigmaSquared = sigmaSquared;
 
  468        const floatType shift6 = calcShift6(epsilon24, sigmaSquared, cutoffSquared);
 
  469        _computedLJMixingData[globalIndex].shift6 = shift6;
 
  475    _computedATMixingData.resize(_numRegisteredSiteTypes * _numRegisteredSiteTypes * _numRegisteredSiteTypes);
 
  476    for (
size_t firstIndex = 0ul; firstIndex < _numRegisteredSiteTypes; ++firstIndex) {
 
  477      for (
size_t secondIndex = 0ul; secondIndex < _numRegisteredSiteTypes; ++secondIndex) {
 
  478        for (
size_t thirdIndex = 0ul; thirdIndex < _numRegisteredSiteTypes; ++thirdIndex) {
 
  479          const auto globalIndex3B = _numRegisteredSiteTypes * _numRegisteredSiteTypes * firstIndex +
 
  480                                     _numRegisteredSiteTypes * secondIndex + thirdIndex;
 
  482          const floatType mixedNu = cbrt(_nus[firstIndex] * _nus[secondIndex] * _nus[thirdIndex]);
 
  483          _computedATMixingData[globalIndex3B].nu = mixedNu;
 
  490template <
typename floatType, 
typename intType>
 
  492  return _siteMasses[i];
 
  495template <
typename floatType, 
typename intType>
 
  497#if MD_FLEXIBLE_MODE == MULTISITE 
  498  return _molMasses[i];
 
  500  return _siteMasses[i];
 
  504template <
typename floatType, 
typename intType>
 
  506#if MD_FLEXIBLE_MODE == SINGLESITE 
  508             "ParticlePropertiesLibrary::getMomentOfInertia(): trying to get the Moment of Inertia of a multi-site " 
  509             "molecule type when md-flexible has been compiled without support for multi-site molecules. Please " 
  510             "compile with the CMake argument '-DMD_FLEXIBLE_MODE=MULTISITE'.");
 
  512  return _momentOfInertias[i];
 
  515template <
typename floatType, 
typename intType>
 
  517#if MD_FLEXIBLE_MODE == SINGLESITE 
  519             "ParticlePropertiesLibrary::getSitePositions(): trying to get the site positions of a multi-site molecule " 
  520             "type when md-flexible has been compiled without support for multi-site molecules. Please compile with " 
  521             "the CMake argument '-DMD_FLEXIBLE_MODE=MULTISITE'.");
 
  523  return _relativeSitePositions[i];
 
  526template <
typename floatType, 
typename intType>
 
  528#if MD_FLEXIBLE_MODE == SINGLESITE 
  530             "ParticlePropertiesLibrary::getSiteTypes(): trying to get the site types of a multi-site molecule type " 
  531             "when md-flexible has been compiled without support for multi-site molecules. Please compile with the " 
  532             "CMake argument '-DMD_FLEXIBLE_MODE=MULTISITE'.");
 
  537template <
typename floatType, 
typename intType>
 
  542template <
typename floatType, 
typename intType>
 
  547template <
typename floatType, 
typename intType>
 
  552template <
typename floatType, 
typename intType>
 
  554#if MD_FLEXIBLE_MODE == SINGLESITE 
  556             "ParticlePropertiesLibrary::getNumSites(): trying to get the number of sites of a multi-site molecule " 
  557             "type when md-flexible has been compiled without support for multi-site molecules. Please compile with " 
  558             "the CMake argument '-DMD_FLEXIBLE_MODE=MULTISITE'.");
 
  563template <
typename floatType, 
typename intType>
 
  565#if MD_FLEXIBLE_MODE == SINGLESITE 
  567             "ParticlePropertiesLibrary::getNumSites(): trying to get the number of sites of a multi-site molecule " 
  568             "type when md-flexible has been compiled without support for multi-site molecules. Please compile with " 
  569             "the CMake argument '-DMD_FLEXIBLE_MODE=MULTISITE'.");
 
  571  return _moleculesLargestSigma[i];
 
  574template <
typename floatType, 
typename intType>
 
  576                                                                 double cutoffSquared) {
 
  577  const auto sigmaDivCutoffPow2 = sigmaSquared / cutoffSquared;
 
  578  const auto sigmaDivCutoffPow6 = sigmaDivCutoffPow2 * sigmaDivCutoffPow2 * sigmaDivCutoffPow2;
 
  579  const auto shift6 = epsilon24 * (sigmaDivCutoffPow6 - sigmaDivCutoffPow6 * sigmaDivCutoffPow6);
 
#define AutoPasLog(lvl, fmt,...)
Macro for logging providing common meta information without filename.
Definition: Logger.h:24
 
This class stores the (physical) properties of molecule types, and, in the case of multi-site molecul...
Definition: ParticlePropertiesLibrary.h:28
 
floatType getMolMass(intType i) const
Getter for a molecules' mass.
Definition: ParticlePropertiesLibrary.h:496
 
floatType getMoleculesLargestSigma(intType i) const
Get the largest sigma of any site of a multi-site molecule.
Definition: ParticlePropertiesLibrary.h:564
 
floatType getMixingShift6(intType i, intType j) const
Returns precomputed mixed shift * 6 for one pair of site types.
Definition: ParticlePropertiesLibrary.h:262
 
void calculateMixingCoefficients()
Calculates the actual mixing coefficients.
Definition: ParticlePropertiesLibrary.h:443
 
ParticlePropertiesLibrary & operator=(const ParticlePropertiesLibrary &particlePropertiesLibrary)=default
Copy assignment operator.
 
int getNumberRegisteredMolTypes() const
Returns the number of registered multi-site molecule types.
Definition: ParticlePropertiesLibrary.h:116
 
void addLJParametersToSite(const intType siteId, const floatType epsilon, const floatType sigma)
Adds the LJ properties of a single site type to the library.
Definition: ParticlePropertiesLibrary.h:361
 
intType getNumSites(intType i) const
Get number of sites of a multi-site molecule.
Definition: ParticlePropertiesLibrary.h:553
 
std::vector< std::array< floatType, 3 > > getSitePositions(intType i) const
Get relative site positions to a multi-site molecule's center-of-mass.
Definition: ParticlePropertiesLibrary.h:516
 
auto getATMixingData(intType i, intType j, intType k) const
Get complete mixing data for one triplet of AT site types.
Definition: ParticlePropertiesLibrary.h:296
 
void addATParametersToSite(const intType siteId, const floatType nu)
Adds the AT properties of a single site type to the library.
Definition: ParticlePropertiesLibrary.h:380
 
void addMolType(const intType molId, const std::vector< intType > siteIds, const std::vector< std::array< floatType, 3 > > relPos, const std::array< floatType, 3 > momentOfInertia)
Adds the properties of a molecule type to the library including: position and type of all sites,...
Definition: ParticlePropertiesLibrary.h:396
 
floatType getMixingSigmaSquared(intType i, intType j) const
Returns precomputed mixed squared sigma for one pair of site types.
Definition: ParticlePropertiesLibrary.h:252
 
floatType getEpsilon(intType i) const
Getter for the site's epsilon.
Definition: ParticlePropertiesLibrary.h:538
 
void addSiteType(const intType siteId, const floatType mass)
Registers a new single site type to the library with a given mass.
Definition: ParticlePropertiesLibrary.h:339
 
ParticlePropertiesLibrary(const double cutoff)
Constructor.
Definition: ParticlePropertiesLibrary.h:34
 
std::array< floatType, 3 > getMomentOfInertia(intType i) const
Getter for the multi-site molecule's diagonalized Moment of Inertia.
Definition: ParticlePropertiesLibrary.h:505
 
ParticlePropertiesLibrary(const ParticlePropertiesLibrary &particlePropertiesLibrary)=default
Copy Constructor.
 
floatType getSiteMass(intType i) const
Getter for the site's mass.
Definition: ParticlePropertiesLibrary.h:491
 
floatType getNu(intType i) const
Getter for the site's nu.
Definition: ParticlePropertiesLibrary.h:548
 
const double * getLJMixingDataPtr(intType i, intType j)
Get a pointer to Mixing Data for one pair of LJ site types.
Definition: ParticlePropertiesLibrary.h:242
 
floatType getMixing24Epsilon(intType i, intType j) const
Returns the precomputed mixed epsilon * 24.
Definition: ParticlePropertiesLibrary.h:224
 
static double calcShift6(double epsilon24, double sigmaSquared, double cutoffSquared)
Calculate the shift multiplied 6 of the lennard jones potential from given cutoff,...
Definition: ParticlePropertiesLibrary.h:575
 
auto getLJMixingData(intType i, intType j) const
Get complete mixing data for one pair of LJ site types.
Definition: ParticlePropertiesLibrary.h:234
 
floatType getSigma(intType i) const
Getter for the site's sigma.
Definition: ParticlePropertiesLibrary.h:543
 
std::vector< intType > getSiteTypes(intType i) const
Get site types of a multi-site molecule.
Definition: ParticlePropertiesLibrary.h:527
 
int getNumberRegisteredSiteTypes() const
Returns the number of registered site / single-site molecule types.
Definition: ParticlePropertiesLibrary.h:107
 
floatType getMixingNu(intType i, intType j, intType k) const
Returns the precomputed mixed epsilon * 24.
Definition: ParticlePropertiesLibrary.h:283
 
Default exception class for autopas exceptions.
Definition: ExceptionHandler.h:115
 
static void exception(const Exception e)
Handle an exception derived by std::exception.
Definition: ExceptionHandler.h:63