OpenMPCD
|
Contains implementation details used in OpenMPCD::CUDA::MPCSolute::StarPolymers
.
More...
Classes | |
class | ParticleType |
Holds the enumeration of particle types for star polymers. More... | |
Functions | |
OPENMPCD_CUDA_HOST_AND_DEVICE std::size_t | getParticleCountPerStar (const std::size_t armCountPerStar, const std::size_t particleCountPerArm, const bool hasMagneticParticles) |
Returns the total number of particles per star. More... | |
OPENMPCD_CUDA_HOST_AND_DEVICE std::size_t | getParticleCount (const std::size_t starCount, const std::size_t armCountPerStar, const std::size_t particleCountPerArm, const bool hasMagneticParticles) |
Returns the total number of particles in a StarPolymers instance. More... | |
OPENMPCD_CUDA_HOST_AND_DEVICE void | getParticleStructureIndices (const std::size_t particleID, const std::size_t starCount, const std::size_t armCountPerStar, const std::size_t particleCountPerArm, const bool hasMagneticParticles, std::size_t *const starID, bool *const isCoreParticle, std::size_t *const armID, bool *const isMagneticParticle, std::size_t *const particleIDInArm) |
Computes the structure indices of the particle ID given. More... | |
OPENMPCD_CUDA_HOST_AND_DEVICE ParticleType::Enum | getParticleType (const std::size_t particleID, const std::size_t starCount, const std::size_t armCountPerStar, const std::size_t particleCountPerArm, const bool hasMagneticParticles) |
Returns the particle type that corresponds to the given ID. More... | |
OPENMPCD_CUDA_HOST_AND_DEVICE bool | particlesAreBonded (const std::size_t particleID1, const std::size_t particleID2, const std::size_t starCount, const std::size_t armCountPerStar, const std::size_t particleCountPerArm, const bool hasMagneticParticles) |
Returns whether the two given particles are bonded. More... | |
OPENMPCD_CUDA_HOST_AND_DEVICE std::size_t | getParticleTypeCombinationIndex (const ParticleType::Enum type1, const ParticleType::Enum type2) |
Returns a different integer, in a consecutive range starting from 0 , for every combination of particle types, except that the result is invariant under exchange of the two arguments. More... | |
template<typename T > | |
void | createInteractionsOnDevice (const T epsilon_core, const T epsilon_arm, const T epsilon_magnetic, const T sigma_core, const T sigma_arm, const T sigma_magnetic, const T D_core, const T D_arm, const T D_magnetic, const T magneticPrefactor, const Vector3D< T > dipoleOrientation, PairPotentials::WeeksChandlerAndersen_DistanceOffset< T > ***const WCAPotentials, PairPotentials::FENE< T > ***const FENEPotentials, PairPotentials::MagneticDipoleDipoleInteraction_ConstantIdenticalDipoles< T > ***const magneticPotential) |
Constructs the necessary interaction potentials in memory. More... | |
template<typename T > | |
void | destroyInteractionsOnDevice (PairPotentials::WeeksChandlerAndersen_DistanceOffset< T > **const WCAPotentials, PairPotentials::FENE< T > **const FENEPotentials, PairPotentials::MagneticDipoleDipoleInteraction_ConstantIdenticalDipoles< T > **const magneticPotential) |
Frees the memory allocated through createInteractionsOnDevice . More... | |
template<typename T > | |
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< T > | computeForceOnParticle1DueToParticle2 (const std::size_t particleID1, const std::size_t particleID2, const RemotelyStoredVector< const T > &position1, const RemotelyStoredVector< const T > &position2, const std::size_t starCount, const std::size_t armCountPerStar, const std::size_t particleCountPerArm, const bool hasMagneticParticles, PairPotentials::WeeksChandlerAndersen_DistanceOffset< T > **const WCAPotentials, PairPotentials::FENE< T > **const FENEPotentials, PairPotentials::MagneticDipoleDipoleInteraction_ConstantIdenticalDipoles< T > **const magneticPotential) |
Returns the force that is exerted on particleID1 due to particleID2 . More... | |
template<typename T > | |
__global__ void | createInteractionsOnDevice_kernel (const T epsilon_core, const T epsilon_arm, const T epsilon_magnetic, const T sigma_core, const T sigma_arm, const T sigma_magnetic, const T D_core, const T D_arm, const T D_magnetic, const T magneticPrefactor, const Vector3D< T > dipoleOrientation, PairPotentials::WeeksChandlerAndersen_DistanceOffset< T > **const WCAPotentials, PairPotentials::FENE< T > **const FENEPotentials, PairPotentials::MagneticDipoleDipoleInteraction_ConstantIdenticalDipoles< T > **const magneticPotential) |
Constructs the interaction potentials in Device memory. More... | |
template<typename T > | |
__global__ void | destroyInteractionsOnDevice_kernel (PairPotentials::WeeksChandlerAndersen_DistanceOffset< T > **const WCAPotentials, PairPotentials::FENE< T > **const FENEPotentials, PairPotentials::MagneticDipoleDipoleInteraction_ConstantIdenticalDipoles< T > **const magneticPotential) |
Frees the memory allocated through createInteractionsOnDevice_kernel . More... | |
Contains implementation details used in OpenMPCD::CUDA::MPCSolute::StarPolymers
.
const OPENMPCD_CUDA_HOST_AND_DEVICE Vector3D< T > OpenMPCD::CUDA::MPCSolute::ImplementationDetails::StarPolymers::computeForceOnParticle1DueToParticle2 | ( | const std::size_t | particleID1, |
const std::size_t | particleID2, | ||
const RemotelyStoredVector< const T > & | position1, | ||
const RemotelyStoredVector< const T > & | position2, | ||
const std::size_t | starCount, | ||
const std::size_t | armCountPerStar, | ||
const std::size_t | particleCountPerArm, | ||
const bool | hasMagneticParticles, | ||
PairPotentials::WeeksChandlerAndersen_DistanceOffset< T > **const | WCAPotentials, | ||
PairPotentials::FENE< T > **const | FENEPotentials, | ||
PairPotentials::MagneticDipoleDipoleInteraction_ConstantIdenticalDipoles< T > **const | magneticPotential | ||
) |
Returns the force that is exerted on particleID1
due to particleID2
.
The interactions passed in this function are additive, i.e. if the two particles match the criteria of multiple interactions, these matching interactions will all be applied.
T | The underlying numeric type. |
[in] | particleID1 | The ID of the first particle. |
[in] | particleID2 | The ID of the second particle, which must not be equal to particleID1 . |
[in] | position1 | The position of the first particle. |
[in] | position2 | The position of the second particle. |
[in] | starCount | The number of stars in the StarPolymers instance. |
[in] | armCountPerStar | The number of polymer arms per star. |
[in] | particleCountPerArm | The number of non-magnetic particles per arm. |
[in] | hasMagneticParticles | Whether each arm has an additional, magnetic particle attached. |
[in] | WCAPotentials | The array of allocated WCA potentials. |
[in] | FENEPotentials | The array of allocated FENE potentials. |
[in] | magneticPotential | The allocated magnetic potential. |
Definition at line 471 of file StarPolymers_Implementation.hpp.
void OpenMPCD::CUDA::MPCSolute::ImplementationDetails::StarPolymers::createInteractionsOnDevice | ( | const T | epsilon_core, |
const T | epsilon_arm, | ||
const T | epsilon_magnetic, | ||
const T | sigma_core, | ||
const T | sigma_arm, | ||
const T | sigma_magnetic, | ||
const T | D_core, | ||
const T | D_arm, | ||
const T | D_magnetic, | ||
const T | magneticPrefactor, | ||
const Vector3D< T > | dipoleOrientation, | ||
PairPotentials::WeeksChandlerAndersen_DistanceOffset< T > ***const | WCAPotentials, | ||
PairPotentials::FENE< T > ***const | FENEPotentials, | ||
PairPotentials::MagneticDipoleDipoleInteraction_ConstantIdenticalDipoles< T > ***const | magneticPotential | ||
) |
Constructs the necessary interaction potentials in memory.
The interaction parameters are described in the documentation of OpenMPCD::CUDA::MPCSolute::StarPolymers
.
The arrays returned in the output parameters WCAPotentials
and FENEPotentials
contain the interactions of particles of type type1
and type2
at the array index getParticleTypeCombinationIndex(type1, type2)
.
OpenMPCD::NULLPointerException | If OPENMPCD_DEBUG is defined, throws if either of the output arguments is nullptr . |
T | The underlying data type. |
[in] | epsilon_core | The \( \varepsilon_C \) parameter. |
[in] | epsilon_arm | The \( \varepsilon_A \) parameter. |
[in] | epsilon_magnetic | The \( \varepsilon_M \) parameter. |
[in] | sigma_core | The \( \sigma_C \) parameter. |
[in] | sigma_arm | The \( \sigma_A \) parameter. |
[in] | sigma_magnetic | The \( \sigma_M \) parameter. |
[in] | D_core | The \( D_C \) parameter. |
[in] | D_arm | The \( D_A \) parameter. |
[in] | D_magnetic | The \( D_M \) parameter. |
[in] | magneticPrefactor | The prefactor argument to the magnetic interaction. |
[in] | dipoleOrientation | Normalized vector that defines the orientation of the magnetic dipoles. |
[out] | WCAPotentials | Returns an array of WCA potential instance pointers on the CUDA Device. The memory allocated this way has to be freed by destroyInteractionOnDevice . |
[out] | FENEPotentials | Returns an array of FENE potential instance pointers on the CUDA Device. The memory allocated this way has to be freed by destroyInteractionOnDevice . |
[out] | magneticPotential | Returns a pointer to an instance pointer for the magnetic potential on the CUDA Device. The memory allocated this way has to be freed by destroyInteractionOnDevice . |
Definition at line 349 of file StarPolymers_Implementation.hpp.
__global__ void OpenMPCD::CUDA::MPCSolute::ImplementationDetails::StarPolymers::createInteractionsOnDevice_kernel | ( | const T | epsilon_core, |
const T | epsilon_arm, | ||
const T | epsilon_magnetic, | ||
const T | sigma_core, | ||
const T | sigma_arm, | ||
const T | sigma_magnetic, | ||
const T | D_core, | ||
const T | D_arm, | ||
const T | D_magnetic, | ||
const T | magneticPrefactor, | ||
const Vector3D< T > | dipoleOrientation, | ||
PairPotentials::WeeksChandlerAndersen_DistanceOffset< T > **const | WCAPotentials, | ||
PairPotentials::FENE< T > **const | FENEPotentials, | ||
PairPotentials::MagneticDipoleDipoleInteraction_ConstantIdenticalDipoles< T > **const | magneticPotential | ||
) |
Constructs the interaction potentials in Device memory.
The interaction parameters are described in the documentation of OpenMPCD::CUDA::MPCSolute::StarPolymers
.
The arrays returned in the output parameters WCAPotentials
and FENEPotentials
contain the interactions of particles of type type1
and type2
at the array index getParticleTypeCombinationIndex(type1, type2)
.
T | The underlying data type. |
[in] | epsilon_core | The \( \varepsilon_C \) parameter. |
[in] | epsilon_arm | The \( \varepsilon_A \) parameter. |
[in] | epsilon_magnetic | The \( \varepsilon_M \) parameter. |
[in] | sigma_core | The \( \sigma_C \) parameter. |
[in] | sigma_arm | The \( \sigma_A \) parameter. |
[in] | sigma_magnetic | The \( \sigma_M \) parameter. |
[in] | D_core | The \( D_C \) parameter. |
[in] | D_arm | The \( D_A \) parameter. |
[in] | D_magnetic | The \( D_M \) parameter. |
[in] | magneticPrefactor | The prefactor argument to the magnetic interaction. |
[in] | dipoleOrientation | Normalized vector that defines the orientation of the magnetic dipoles. |
[in] | WCAPotentials | Where to construct the WCA potential instances. |
[in] | FENEPotentials | Where to construct the FENE potential instances. |
[in] | magneticPotential | Where to construct the magnetic potential instances. |
Definition at line 251 of file StarPolymers_Implementation.hpp.
void OpenMPCD::CUDA::MPCSolute::ImplementationDetails::StarPolymers::destroyInteractionsOnDevice | ( | PairPotentials::WeeksChandlerAndersen_DistanceOffset< T > **const | WCAPotentials, |
PairPotentials::FENE< T > **const | FENEPotentials, | ||
PairPotentials::MagneticDipoleDipoleInteraction_ConstantIdenticalDipoles< T > **const | magneticPotential | ||
) |
Frees the memory allocated through createInteractionsOnDevice
.
OpenMPCD::NULLPointerException | If OPENMPCD_DEBUG is defined, throws if either of the arguments is nullptr , or if WCAPotentials or FENEPotentials are not arrays with non-nullptr entries at the indices returned by getParticleTypeCombinationIndex for the appropriate type combinations (all possible combinations for WCAPotentials , and Core-Arm, Arm-Arm, or Arm-Magnetic combinations for FENEPotentials ), or if the entries are non-nullptr for invalid type combination indices. |
[in] | WCAPotentials | The array of allocated WCA potentials on the CUDA Device. |
[in] | FENEPotentials | The array of allocated FENE potentials on the CUDA Device. |
[in] | magneticPotential | The allocated magnetic potential on the CUDA Device. |
Definition at line 450 of file StarPolymers_Implementation.hpp.
__global__ void OpenMPCD::CUDA::MPCSolute::ImplementationDetails::StarPolymers::destroyInteractionsOnDevice_kernel | ( | PairPotentials::WeeksChandlerAndersen_DistanceOffset< T > **const | WCAPotentials, |
PairPotentials::FENE< T > **const | FENEPotentials, | ||
PairPotentials::MagneticDipoleDipoleInteraction_ConstantIdenticalDipoles< T > **const | magneticPotential | ||
) |
Frees the memory allocated through createInteractionsOnDevice_kernel
.
[in] | WCAPotentials | The array of allocated WCA potentials on the CUDA Device. |
[in] | FENEPotentials | The array of allocated FENE potentials on the CUDA Device. |
[in] | magneticPotential | The allocated magnetic potential on the CUDA Device. |
Definition at line 392 of file StarPolymers_Implementation.hpp.
|
inline |
Returns the total number of particles in a StarPolymers
instance.
[in] | starCount | The number of stars in the StarPolymers instance. |
[in] | armCountPerStar | The number of polymer arms per star. |
[in] | particleCountPerArm | The number of non-magnetic particles per arm. |
[in] | hasMagneticParticles | Whether each arm has an additional, magnetic particle attached. |
Definition at line 42 of file StarPolymers_Implementation.hpp.
|
inline |
Returns the total number of particles per star.
[in] | armCountPerStar | The number of polymer arms per star. |
[in] | particleCountPerArm | The number of non-magnetic particles per arm. |
[in] | hasMagneticParticles | Whether each arm has an additional, magnetic particle attached. |
Definition at line 29 of file StarPolymers_Implementation.hpp.
|
inline |
Computes the structure indices of the particle ID given.
The pointers given must not correspond to overlapping regions of memory.
OpenMPCD::NULLPointerException | If OPENMPCD_DEBUG is defined, throws if either starID , isCoreParticle , armID , isMagneticParticl , or particleIDInArm is nullptr . |
OpenMPCD::InvalidArgumentException | If OPENMPCD_DEBUG is defined, throws if particleID is greater than or equal to the number of particles, as returned by getParticleCount . |
[in] | particleID | The particle ID to query. |
[in] | starCount | The number of stars in the StarPolymers instance. |
[in] | armCountPerStar | The number of polymer arms per star. |
[in] | particleCountPerArm | The number of non-magnetic particles per arm. |
[in] | hasMagneticParticles | Whether each arm has an additional, magnetic particle attached. |
[out] | starID | The ID of the star the particle is in, running from 0 to starCount - 1 , inclusive. |
[out] | isCoreParticle | Whether the particleID corresponds to the star's core particle. |
[out] | armID | If the particle is not a core particle, this is set the particle's arm's ID within the star, running from 0 to armCountPerStar - 1 , inclusive. Otherwise, the value is left unchanged. |
[out] | isMagneticParticle | Whether the particleID corresponds to a magnetic particle. |
[out] | particleIDInArm | If isCoreParticle , the value is left unchanged. Otherwise, if the particleID corresponds to a magnetic particle, this is set to particleCountPerArm . Otherwise, the particleID corresponds to an arm particle, and this value is set to the particle's ID within the arm, running from 0 to particleCountPerArm - 1 , inclusive. |
Definition at line 56 of file StarPolymers_Implementation.hpp.
|
inline |
Returns the particle type that corresponds to the given ID.
OpenMPCD::InvalidArgumentException | If OPENMPCD_DEBUG is defined, throws if particleID is greater than or equal to the number of particles, as returned by getParticleCount . |
[in] | particleID | The particle ID to query. |
[in] | starCount | The number of stars in the StarPolymers instance. |
[in] | armCountPerStar | The number of polymer arms per star. |
[in] | particleCountPerArm | The number of non-magnetic particles per arm. |
[in] | hasMagneticParticles | Whether each arm has an additional, magnetic particle attached. |
Definition at line 112 of file StarPolymers_Implementation.hpp.
|
inline |
Returns a different integer, in a consecutive range starting from 0
, for every combination of particle types, except that the result is invariant under exchange of the two arguments.
[in] | type1 | The particle type of the first particle. |
[in] | type2 | The particle type of the second particle. |
Definition at line 197 of file StarPolymers_Implementation.hpp.
|
inline |
Returns whether the two given particles are bonded.
OpenMPCD::InvalidArgumentException | If OPENMPCD_DEBUG is defined, throws if either particleID1 or particleID2 is greater than or equal to the number of particles, as returned by getParticleCount , or if particleID1 == particleID2 . |
[in] | particleID1 | The ID of the first particle. |
[in] | particleID2 | The ID of the second particle, which must not be equal to particleID1 . |
[in] | starCount | The number of stars in the StarPolymers instance. |
[in] | armCountPerStar | The number of polymer arms per star. |
[in] | particleCountPerArm | The number of non-magnetic particles per arm. |
[in] | hasMagneticParticles | Whether each arm has an additional, magnetic particle attached. |
Definition at line 139 of file StarPolymers_Implementation.hpp.