OpenMPCD
Classes | Functions
OpenMPCD::CUDA::MPCSolute::ImplementationDetails::StarPolymers Namespace Reference

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...
 

Detailed Description

Contains implementation details used in OpenMPCD::CUDA::MPCSolute::StarPolymers.

Function Documentation

◆ computeForceOnParticle1DueToParticle2()

template<typename T >
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.

Template Parameters
TThe underlying numeric type.
Parameters
[in]particleID1The ID of the first particle.
[in]particleID2The ID of the second particle, which must not be equal to particleID1.
[in]position1The position of the first particle.
[in]position2The position of the second particle.
[in]starCountThe number of stars in the StarPolymers instance.
[in]armCountPerStarThe number of polymer arms per star.
[in]particleCountPerArmThe number of non-magnetic particles per arm.
[in]hasMagneticParticlesWhether each arm has an additional, magnetic particle attached.
[in]WCAPotentialsThe array of allocated WCA potentials.
[in]FENEPotentialsThe array of allocated FENE potentials.
[in]magneticPotentialThe allocated magnetic potential.

Definition at line 471 of file StarPolymers_Implementation.hpp.

◆ createInteractionsOnDevice()

template<typename T >
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).

Exceptions
OpenMPCD::NULLPointerExceptionIf OPENMPCD_DEBUG is defined, throws if either of the output arguments is nullptr.
Template Parameters
TThe underlying data type.
Parameters
[in]epsilon_coreThe \( \varepsilon_C \) parameter.
[in]epsilon_armThe \( \varepsilon_A \) parameter.
[in]epsilon_magneticThe \( \varepsilon_M \) parameter.
[in]sigma_coreThe \( \sigma_C \) parameter.
[in]sigma_armThe \( \sigma_A \) parameter.
[in]sigma_magneticThe \( \sigma_M \) parameter.
[in]D_coreThe \( D_C \) parameter.
[in]D_armThe \( D_A \) parameter.
[in]D_magneticThe \( D_M \) parameter.
[in]magneticPrefactorThe prefactor argument to the magnetic interaction.
[in]dipoleOrientationNormalized vector that defines the orientation of the magnetic dipoles.
[out]WCAPotentialsReturns an array of WCA potential instance pointers on the CUDA Device. The memory allocated this way has to be freed by destroyInteractionOnDevice.
[out]FENEPotentialsReturns an array of FENE potential instance pointers on the CUDA Device. The memory allocated this way has to be freed by destroyInteractionOnDevice.
[out]magneticPotentialReturns 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.

◆ createInteractionsOnDevice_kernel()

template<typename T >
__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).

Template Parameters
TThe underlying data type.
Parameters
[in]epsilon_coreThe \( \varepsilon_C \) parameter.
[in]epsilon_armThe \( \varepsilon_A \) parameter.
[in]epsilon_magneticThe \( \varepsilon_M \) parameter.
[in]sigma_coreThe \( \sigma_C \) parameter.
[in]sigma_armThe \( \sigma_A \) parameter.
[in]sigma_magneticThe \( \sigma_M \) parameter.
[in]D_coreThe \( D_C \) parameter.
[in]D_armThe \( D_A \) parameter.
[in]D_magneticThe \( D_M \) parameter.
[in]magneticPrefactorThe prefactor argument to the magnetic interaction.
[in]dipoleOrientationNormalized vector that defines the orientation of the magnetic dipoles.
[in]WCAPotentialsWhere to construct the WCA potential instances.
[in]FENEPotentialsWhere to construct the FENE potential instances.
[in]magneticPotentialWhere to construct the magnetic potential instances.

Definition at line 251 of file StarPolymers_Implementation.hpp.

◆ destroyInteractionsOnDevice()

template<typename T >
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.

Exceptions
OpenMPCD::NULLPointerExceptionIf 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.
Parameters
[in]WCAPotentialsThe array of allocated WCA potentials on the CUDA Device.
[in]FENEPotentialsThe array of allocated FENE potentials on the CUDA Device.
[in]magneticPotentialThe allocated magnetic potential on the CUDA Device.

Definition at line 450 of file StarPolymers_Implementation.hpp.

◆ destroyInteractionsOnDevice_kernel()

template<typename T >
__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.

Parameters
[in]WCAPotentialsThe array of allocated WCA potentials on the CUDA Device.
[in]FENEPotentialsThe array of allocated FENE potentials on the CUDA Device.
[in]magneticPotentialThe allocated magnetic potential on the CUDA Device.

Definition at line 392 of file StarPolymers_Implementation.hpp.

◆ getParticleCount()

OPENMPCD_CUDA_HOST_AND_DEVICE std::size_t OpenMPCD::CUDA::MPCSolute::ImplementationDetails::StarPolymers::getParticleCount ( const std::size_t  starCount,
const std::size_t  armCountPerStar,
const std::size_t  particleCountPerArm,
const bool  hasMagneticParticles 
)
inline

Returns the total number of particles in a StarPolymers instance.

Parameters
[in]starCountThe number of stars in the StarPolymers instance.
[in]armCountPerStarThe number of polymer arms per star.
[in]particleCountPerArmThe number of non-magnetic particles per arm.
[in]hasMagneticParticlesWhether each arm has an additional, magnetic particle attached.

Definition at line 42 of file StarPolymers_Implementation.hpp.

◆ getParticleCountPerStar()

OPENMPCD_CUDA_HOST_AND_DEVICE std::size_t OpenMPCD::CUDA::MPCSolute::ImplementationDetails::StarPolymers::getParticleCountPerStar ( const std::size_t  armCountPerStar,
const std::size_t  particleCountPerArm,
const bool  hasMagneticParticles 
)
inline

Returns the total number of particles per star.

Parameters
[in]armCountPerStarThe number of polymer arms per star.
[in]particleCountPerArmThe number of non-magnetic particles per arm.
[in]hasMagneticParticlesWhether each arm has an additional, magnetic particle attached.

Definition at line 29 of file StarPolymers_Implementation.hpp.

◆ getParticleStructureIndices()

OPENMPCD_CUDA_HOST_AND_DEVICE void OpenMPCD::CUDA::MPCSolute::ImplementationDetails::StarPolymers::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 
)
inline

Computes the structure indices of the particle ID given.

The pointers given must not correspond to overlapping regions of memory.

Exceptions
OpenMPCD::NULLPointerExceptionIf OPENMPCD_DEBUG is defined, throws if either starID, isCoreParticle, armID, isMagneticParticl, or particleIDInArm is nullptr.
OpenMPCD::InvalidArgumentExceptionIf OPENMPCD_DEBUG is defined, throws if particleID is greater than or equal to the number of particles, as returned by getParticleCount.
Parameters
[in]particleIDThe particle ID to query.
[in]starCountThe number of stars in the StarPolymers instance.
[in]armCountPerStarThe number of polymer arms per star.
[in]particleCountPerArmThe number of non-magnetic particles per arm.
[in]hasMagneticParticlesWhether each arm has an additional, magnetic particle attached.
[out]starIDThe ID of the star the particle is in, running from 0 to starCount - 1, inclusive.
[out]isCoreParticleWhether the particleID corresponds to the star's core particle.
[out]armIDIf 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]isMagneticParticleWhether the particleID corresponds to a magnetic particle.
[out]particleIDInArmIf 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.

◆ getParticleType()

OPENMPCD_CUDA_HOST_AND_DEVICE ParticleType::Enum OpenMPCD::CUDA::MPCSolute::ImplementationDetails::StarPolymers::getParticleType ( const std::size_t  particleID,
const std::size_t  starCount,
const std::size_t  armCountPerStar,
const std::size_t  particleCountPerArm,
const bool  hasMagneticParticles 
)
inline

Returns the particle type that corresponds to the given ID.

Exceptions
OpenMPCD::InvalidArgumentExceptionIf OPENMPCD_DEBUG is defined, throws if particleID is greater than or equal to the number of particles, as returned by getParticleCount.
Parameters
[in]particleIDThe particle ID to query.
[in]starCountThe number of stars in the StarPolymers instance.
[in]armCountPerStarThe number of polymer arms per star.
[in]particleCountPerArmThe number of non-magnetic particles per arm.
[in]hasMagneticParticlesWhether each arm has an additional, magnetic particle attached.

Definition at line 112 of file StarPolymers_Implementation.hpp.

◆ getParticleTypeCombinationIndex()

OPENMPCD_CUDA_HOST_AND_DEVICE std::size_t OpenMPCD::CUDA::MPCSolute::ImplementationDetails::StarPolymers::getParticleTypeCombinationIndex ( const ParticleType::Enum  type1,
const ParticleType::Enum  type2 
)
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.

Parameters
[in]type1The particle type of the first particle.
[in]type2The particle type of the second particle.

Definition at line 197 of file StarPolymers_Implementation.hpp.

◆ particlesAreBonded()

OPENMPCD_CUDA_HOST_AND_DEVICE bool OpenMPCD::CUDA::MPCSolute::ImplementationDetails::StarPolymers::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 
)
inline

Returns whether the two given particles are bonded.

Exceptions
OpenMPCD::InvalidArgumentExceptionIf 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.
Parameters
[in]particleID1The ID of the first particle.
[in]particleID2The ID of the second particle, which must not be equal to particleID1.
[in]starCountThe number of stars in the StarPolymers instance.
[in]armCountPerStarThe number of polymer arms per star.
[in]particleCountPerArmThe number of non-magnetic particles per arm.
[in]hasMagneticParticlesWhether each arm has an additional, magnetic particle attached.

Definition at line 139 of file StarPolymers_Implementation.hpp.