Open Qmin
0.8.0
GPU-accelerated Q-tensor-based liquid crystal simulations
|
define a type of simple model which places all degrees of freedom (which are still d-dimensional) on a cubic lattice with nearest neighbor interactions More...
#include <cubicLattice.h>
Public Member Functions | |
cubicLattice (int l, bool _slice=false, bool _useGPU=false, bool _neverGPU=false) | |
The base constructor takes the number of lattice sites along the cubic edge. More... | |
cubicLattice (int lx, int ly, int lz, bool _slice=false, bool _useGPU=false, bool _neverGPU=false) | |
A rectilinear set of lattice sits. More... | |
virtual void | moveParticles (GPUArray< dVec > &displacements, scalar scale=1.) |
move the degrees of freedom More... | |
virtual void | moveParticles (GPUArray< dVec > &dofs, GPUArray< dVec > &displacements, scalar scale=1.) |
move a different GPU array according to the same rules More... | |
void | setSpinsRandomly (noiseSource &noise) |
initialize each d.o.f. to be a unit spin on the sphere More... | |
virtual int | getNeighbors (int target, vector< int > &neighbors, int &neighs, int stencilType=0) |
return the integer corresponding to the given site, along with the indices of the six nearest neighbors More... | |
void | sliceIndices (bool _s=true) |
decide to slice sites More... | |
int | latticeSiteToLinearIndex (const int3 &target) |
given a triple, determine what More... | |
virtual void | fillNeighborLists (int stencilType=0) |
store the neighbors of each lattice site. The i'th neighbor of site j is given by neighboringSites[neighborIndex(i,j)] More... | |
virtual dVec | averagePosition () |
return the mean spin More... | |
virtual void | displaceBoundaryObject (int objectIndex, int motionDirection, int magnitude) |
Displace a boundary object (and surface sites) by one of the six primitive cubic lattice directions. More... | |
void | createBoundaryObject (vector< int > &latticeSites, boundaryType _type, scalar Param1, scalar Param2) |
assign a collection of lattice sites to a new boundaryObject More... | |
virtual scalar | getClassSize () |
return size of data in class in GB More... | |
void | initializeSimpleModel (int n) |
initialize the size of the basic data structure arrays More... | |
virtual void | setGPU (bool _useGPU=true) |
Enforce GPU operation. More... | |
virtual int | getNumberOfParticles () |
get the number of degrees of freedom, defaulting to the number of cells More... | |
virtual void | computeForces (bool zeroOutForces=false) |
do everything unusual to compute additional forces... by default, sets forces to zero More... | |
void | setParticlePositions (GPUArray< dVec > &newPositions) |
void | setParticlePositions (vector< dVec > &newPositions) |
void | setParticlePositionsRandomly (noiseSource &noise) |
scalar | setVelocitiesMaxwellBoltzmann (scalar T, noiseSource &noise) |
Set velocities via a temperature. The return value is the total kinetic energy. More... | |
virtual scalar | computeKineticEnergy (bool verbose=false) |
compute the current KE More... | |
virtual scalar | computeInstantaneousTemperature (bool fixedMomentum=true) |
compute the dimension-dependent instantaneous temperature More... | |
virtual void | spatialSorting () |
do everything necessary to perform a Hilbert sort More... | |
virtual GPUArray< dVec > & | returnPositions () |
return a reference to the GPUArray of positions More... | |
virtual GPUArray< dVec > & | returnForces () |
return a reference to the GPUArray of the current forces More... | |
virtual GPUArray< int > & | returnTypes () |
return a reference to the GPUArray of the integer types More... | |
virtual GPUArray< dVec > & | returnVelocities () |
return a reference to the GPUArray of the current velocities More... | |
virtual GPUArray< scalar > & | returnDefectMeasures () |
return a reference to the GPUArray of the current defects More... | |
virtual void | setNThreads (int n) |
allow for setting multiple threads More... | |
virtual void | freeGPUArrays (bool freeVelocities, bool freeRadii, bool freeMasses) |
some situations do not require us to maintain various data structures More... | |
Public Attributes | |
Index3D | latticeIndex |
indexer for lattice sites More... | |
Index2D | neighborIndex |
indexer for neighbors More... | |
GPUArray< int > | neighboringSites |
List of neighboring lattice sites. More... | |
GPUArray< boundaryObject > | boundaries |
list of the non-bulk objects in the simulations More... | |
vector< GPUArray< int > > | boundarySites |
A vector that keeps track of the sites associated with each boundary object. More... | |
vector< GPUArray< int > > | surfaceSites |
A vector that keeps track of the surface sites associated with each boundary object. More... | |
vector< int > | boundaryState |
A vector of flags that specifies the state of each boundary object...most schemes will be 0 = fixed boundary, 1 = movable boudnary. More... | |
vector< scalar3 > | boundaryForce |
The force (from integrating the stress tensor) on each object. More... | |
GPUArray< pair< int, dVec > > | boundaryMoveAssist1 |
An assist vector that can keep track of changes to boundary sites during a move. First element is the index a Qtensor (second ) will move to. More... | |
GPUArray< pair< int, dVec > > | boundaryMoveAssist2 |
An assist vector that can keep track of changes to surface sites during a move. First element is the index a Qtensor (second ) will move to. More... | |
bool | selfForceCompute |
Does this model have a special force it needs to compute itself? More... | |
BoxPtr | Box |
The space in which the particles live. More... | |
bool | forcesComputed |
Are the forces current? set to false after every call to moveParticles. set to true after the SIMULATION calls computeForces. More... | |
GPUArray< scalar > | defectMeasures |
scalars that can represent different defect measures More... | |
bool | neverGPU |
Whereas useGPU can be turned on and off, neverGPU is fixed. More... | |
Protected Member Functions | |
void | initializeNSites () |
a utility function for initialization More... | |
Protected Attributes | |
bool | sliceSites |
should we use a memory-efficient slicing scheme? More... | |
int | L |
lattice sites per edge More... | |
bool | normalizeSpins |
normalize vector length when moving spins? More... | |
shared_ptr< kernelTuner > | moveParticlesTuner |
performance for the moveParticles kernel More... | |
int | N |
The number of particles. More... | |
int | nThreads =1 |
number of threads to use More... | |
GPUArray< dVec > | positions |
particle positions More... | |
GPUArray< dVec > | velocities |
particle velocities More... | |
GPUArray< dVec > | forces |
Forces on particles. More... | |
GPUArray< int > | types |
particle types More... | |
bool | useGPU |
particle radii More... | |
define a type of simple model which places all degrees of freedom (which are still d-dimensional) on a cubic lattice with nearest neighbor interactions
cubicLattice::cubicLattice | ( | int | l, |
bool | _slice = false , |
||
bool | _useGPU = false , |
||
bool | _neverGPU = false |
||
) |
The base constructor takes the number of lattice sites along the cubic edge.
References simpleModel::Box, initializeNSites(), L, latticeIndex, simpleModel::N, simpleModel::neverGPU, normalizeSpins, simpleModel::selfForceCompute, sliceSites, and simpleModel::useGPU.
cubicLattice::cubicLattice | ( | int | lx, |
int | ly, | ||
int | lz, | ||
bool | _slice = false , |
||
bool | _useGPU = false , |
||
bool | _neverGPU = false |
||
) |
A rectilinear set of lattice sits.
References simpleModel::Box, idx, initializeNSites(), L, latticeIndex, simpleModel::N, simpleModel::neverGPU, normalizeSpins, simpleModel::selfForceCompute, sliceSites, and simpleModel::useGPU.
move the degrees of freedom
Reimplemented from simpleModel.
Reimplemented in qTensorLatticeModel.
References ArrayHandle< T >::data, access_location::device, gpu_update_spins(), access_location::host, simpleModel::N, norm(), normalizeSpins, simpleModel::positions, access_mode::read, access_mode::readwrite, scalar, and simpleModel::useGPU.
|
virtual |
move a different GPU array according to the same rules
References ArrayHandle< T >::data, access_location::device, gpu_update_spins(), access_location::host, simpleModel::N, norm(), normalizeSpins, access_mode::read, access_mode::readwrite, scalar, and simpleModel::useGPU.
void cubicLattice::setSpinsRandomly | ( | noiseSource & | noise | ) |
initialize each d.o.f. to be a unit spin on the sphere
References ArrayHandle< T >::data, access_location::device, dot(), noiseSource::getRealNormal(), gpu_set_random_spins(), noiseSource::initialize(), noiseSource::initializeGPURNGs(), simpleModel::N, access_mode::overwrite, simpleModel::positions, access_mode::readwrite, noiseSource::RNGs, scalar, and simpleModel::useGPU.
|
virtual |
return the integer corresponding to the given site, along with the indices of the six nearest neighbors
returns, in the vector "neighbors" a list of lattice neighbors of the target site. If stencilType ==0 (the default), the result will be neighs = 6; neighbors = {xMinus, xPlus, yMinus, yPlus, zMinus, zPlus}; If stencilType ==1 neighbors will be suitable for computing mixed first partial derivatives \partial_a \partial b F: neighs = 18; neighbors = {xMinus, xPlus, yMinus, yPlus, zMinus, zPlus, xMinus_yMinus,xMinus_yPlus,xMinus_zMinus,xMinus_zPlus,xPlus_yMinus,xPlus_yPlus,xPlus_zMinus,xPlus_zPlus, yMinus_zMinus,yMinuz_zPlus,yPlus_zMinus,yPlus_zPlus}
Reimplemented in multirankQTensorLatticeModel.
References Index3D::inverseIndex(), latticeIndex, Index3D::sizes, sliceSites, and wrap().
Referenced by createBoundaryObject(), and fillNeighborLists().
|
inline |
decide to slice sites
References sliceSites.
int cubicLattice::latticeSiteToLinearIndex | ( | const int3 & | target | ) |
given a triple, determine what
References latticeIndex, and sliceSites.
|
virtual |
store the neighbors of each lattice site. The i'th neighbor of site j is given by neighboringSites[neighborIndex(i,j)]
stencilType here has the same meaning as in "getNeighbors" function
References ArrayHandle< T >::data, getNeighbors(), simpleModel::N, neighborIndex, neighboringSites, and GPUArray< T >::resize().
|
inlinevirtual |
return the mean spin
References ArrayHandle< T >::data, simpleModel::N, simpleModel::positions, and simpleModel::types.
|
virtual |
Displace a boundary object (and surface sites) by one of the six primitive cubic lattice directions.
This function moves an object, shifting the type of lattice sites over on the lattice. Surface sites are also moved. Sites that change from being part of the boundary to a surface site adopt the average state of the neighboring sites that weren't formerly part of the boundary object. This function makes use of the fact that primitive translations will not change the total number of boundary or surface sites associated with each object
objectIndex | The position in the vector of boundarySites and surfaceSites that the desired object to move is in |
motionDirection | Which way to move the object. Follows same convention as lattice neighbors for stencilType=0 |
magnitude | number of lattice sites to move in the given direction |
Reimplemented from simpleModel.
References boundaryMoveAssist1, boundaryMoveAssist2, boundarySites, ArrayHandle< T >::data, access_location::device, gpu_copy_boundary_object(), gpu_move_boundary_object(), access_location::host, neighborIndex, neighboringSites, access_mode::overwrite, simpleModel::positions, access_mode::read, access_mode::readwrite, surfaceSites, simpleModel::types, and simpleModel::useGPU.
void cubicLattice::createBoundaryObject | ( | vector< int > & | latticeSites, |
boundaryType | _type, | ||
scalar | Param1, | ||
scalar | Param2 | ||
) |
assign a collection of lattice sites to a new boundaryObject
References boundaries, boundaryForce, boundaryMoveAssist1, boundaryMoveAssist2, boundarySites, boundaryState, ArrayHandle< T >::data, getNeighbors(), GPUArray< T >::getNumElements(), simpleModel::neverGPU, GPUArray< T >::noGPU, GPUArray< T >::resize(), scalar3, surfaceSites, and simpleModel::types.
Referenced by qTensorLatticeModel::createBoundaryFromFile(), qTensorLatticeModel::createSimpleFlatWallNormal(), qTensorLatticeModel::createSimpleFlatWallZNormal(), and qTensorLatticeModel::createSimpleSpherialColloid().
|
inlinevirtual |
return size of data in class in GB
Reimplemented from simpleModel.
Reimplemented in qTensorLatticeModel, and multirankQTensorLatticeModel.
References boundaryMoveAssist1, boundaryMoveAssist2, boundarySites, boundaryState, simpleModel::getClassSize(), GPUArray< T >::getNumElements(), neighboringSites, scalar, and surfaceSites.
Referenced by qTensorLatticeModel::getClassSize().
|
protected |
a utility function for initialization
References boundaries, boundaryMoveAssist1, boundaryMoveAssist2, simpleModel::initializeSimpleModel(), moveParticlesTuner, simpleModel::N, neighboringSites, simpleModel::neverGPU, and GPUArray< T >::noGPU.
Referenced by cubicLattice().
|
inherited |
initialize the size of the basic data structure arrays
actually set the array sizes. positions, velocities, forces are zero masses are set to unity
References simpleModel::defectMeasures, simpleModel::forces, make_dVec(), n, simpleModel::N, simpleModel::neverGPU, GPUArray< T >::noGPU, simpleModel::positions, GPUArray< T >::resize(), simpleModel::selfForceCompute, simpleModel::types, and simpleModel::velocities.
Referenced by initializeNSites(), simpleModel::setParticlePositions(), and simpleModel::simpleModel().
|
inlinevirtualinherited |
Enforce GPU operation.
References simpleModel::useGPU.
|
inlinevirtualinherited |
get the number of degrees of freedom, defaulting to the number of cells
References simpleModel::N.
|
virtualinherited |
do everything unusual to compute additional forces... by default, sets forces to zero
References ArrayHandle< T >::data, simpleModel::forces, gpu_set_array(), simpleModel::N, and simpleModel::useGPU.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Set velocities via a temperature. The return value is the total kinetic energy.
References ArrayHandle< T >::data, dot(), noiseSource::getRealNormal(), simpleModel::N, scalar, and simpleModel::velocities.
|
virtualinherited |
compute the current KE
References ArrayHandle< T >::data, dot(), simpleModel::N, scalar, and simpleModel::velocities.
|
virtualinherited |
compute the dimension-dependent instantaneous temperature
References ArrayHandle< T >::data, dot(), simpleModel::N, scalar, and simpleModel::velocities.
|
inlinevirtualinherited |
do everything necessary to perform a Hilbert sort
|
inlinevirtualinherited |
return a reference to the GPUArray of positions
References simpleModel::positions.
|
inlinevirtualinherited |
return a reference to the GPUArray of the current forces
References simpleModel::forces.
|
inlinevirtualinherited |
return a reference to the GPUArray of the integer types
References simpleModel::types.
|
inlinevirtualinherited |
return a reference to the GPUArray of the current velocities
References simpleModel::velocities.
return a reference to the GPUArray of the current defects
|
inlinevirtualinherited |
allow for setting multiple threads
References n, and simpleModel::nThreads.
|
inlinevirtualinherited |
some situations do not require us to maintain various data structures
Index3D cubicLattice::latticeIndex |
indexer for lattice sites
Referenced by qTensorLatticeModel::createBoundaryFromFile(), qTensorLatticeModel::createSimpleFlatWallNormal(), qTensorLatticeModel::createSimpleFlatWallZNormal(), qTensorLatticeModel::createSimpleSpherialColloid(), cubicLattice(), getNeighbors(), multirankQTensorLatticeModel::getNeighbors(), multirankQTensorLatticeModel::indexToPosition(), latticeSiteToLinearIndex(), multirankQTensorLatticeModel::positionToIndex(), and multirankQTensorLatticeModel::prepareSendingBuffer().
Index2D cubicLattice::neighborIndex |
indexer for neighbors
Referenced by displaceBoundaryObject(), and fillNeighborLists().
GPUArray<int> cubicLattice::neighboringSites |
List of neighboring lattice sites.
Referenced by displaceBoundaryObject(), fillNeighborLists(), getClassSize(), and initializeNSites().
GPUArray<boundaryObject> cubicLattice::boundaries |
list of the non-bulk objects in the simulations
Referenced by createBoundaryObject(), and initializeNSites().
vector<GPUArray<int> > cubicLattice::boundarySites |
A vector that keeps track of the sites associated with each boundary object.
Referenced by createBoundaryObject(), displaceBoundaryObject(), and getClassSize().
vector<GPUArray<int> > cubicLattice::surfaceSites |
A vector that keeps track of the surface sites associated with each boundary object.
Referenced by createBoundaryObject(), displaceBoundaryObject(), and getClassSize().
vector<int> cubicLattice::boundaryState |
A vector of flags that specifies the state of each boundary object...most schemes will be 0 = fixed boundary, 1 = movable boudnary.
Referenced by createBoundaryObject(), and getClassSize().
vector<scalar3> cubicLattice::boundaryForce |
The force (from integrating the stress tensor) on each object.
Referenced by createBoundaryObject().
GPUArray<pair<int,dVec> > cubicLattice::boundaryMoveAssist1 |
An assist vector that can keep track of changes to boundary sites during a move. First element is the index a Qtensor (second ) will move to.
Referenced by createBoundaryObject(), displaceBoundaryObject(), getClassSize(), and initializeNSites().
GPUArray<pair<int,dVec> > cubicLattice::boundaryMoveAssist2 |
An assist vector that can keep track of changes to surface sites during a move. First element is the index a Qtensor (second ) will move to.
Referenced by createBoundaryObject(), displaceBoundaryObject(), getClassSize(), and initializeNSites().
|
protected |
should we use a memory-efficient slicing scheme?
Referenced by cubicLattice(), getNeighbors(), multirankQTensorLatticeModel::getNeighbors(), latticeSiteToLinearIndex(), and sliceIndices().
|
protected |
lattice sites per edge
Referenced by cubicLattice().
|
protected |
normalize vector length when moving spins?
Referenced by cubicLattice(), moveParticles(), and qTensorLatticeModel::qTensorLatticeModel().
|
protected |
performance for the moveParticles kernel
Referenced by initializeNSites(), and qTensorLatticeModel::moveParticles().
|
inherited |
Does this model have a special force it needs to compute itself?
Referenced by cubicLattice(), and simpleModel::initializeSimpleModel().
|
inherited |
The space in which the particles live.
Referenced by cubicLattice(), simpleModel::moveParticles(), simpleModel::setParticlePositions(), simpleModel::setParticlePositionsRandomly(), and simpleModel::simpleModel().
|
inherited |
Are the forces current? set to false after every call to moveParticles. set to true after the SIMULATION calls computeForces.
Referenced by simpleModel::moveParticles().
scalars that can represent different defect measures
Referenced by qTensorLatticeModel::computeDefectMeasures(), simpleModel::getClassSize(), simpleModel::initializeSimpleModel(), and qTensorLatticeModel::qTensorLatticeModel().
|
inherited |
Whereas useGPU can be turned on and off, neverGPU is fixed.
Referenced by createBoundaryObject(), cubicLattice(), initializeNSites(), simpleModel::initializeSimpleModel(), multirankQTensorLatticeModel::multirankQTensorLatticeModel(), and qTensorLatticeModel::qTensorLatticeModel().
|
protectedinherited |
The number of particles.
Referenced by averagePosition(), qTensorLatticeModel::computeDefectMeasures(), simpleModel::computeForces(), simpleModel::computeInstantaneousTemperature(), simpleModel::computeKineticEnergy(), cubicLattice(), fillNeighborLists(), qTensorLatticeModel::getAverageEigenvalues(), simpleModel::getNumberOfParticles(), multirankQTensorLatticeModel::indexToPosition(), initializeNSites(), simpleModel::initializeSimpleModel(), moveParticles(), qTensorLatticeModel::moveParticles(), simpleModel::moveParticles(), multirankQTensorLatticeModel::multirankQTensorLatticeModel(), multirankQTensorLatticeModel::positionToIndex(), qTensorLatticeModel::qTensorLatticeModel(), multirankQTensorLatticeModel::readReceivingBuffer(), qTensorLatticeModel::setNematicQTensorRandomly(), simpleModel::setParticlePositions(), simpleModel::setParticlePositionsRandomly(), setSpinsRandomly(), simpleModel::setVelocitiesMaxwellBoltzmann(), and simpleModel::simpleModel().
|
protectedinherited |
number of threads to use
Referenced by simpleModel::setNThreads().
|
protectedinherited |
particle positions
Referenced by averagePosition(), qTensorLatticeModel::computeDefectMeasures(), qTensorLatticeModel::createBoundaryFromFile(), qTensorLatticeModel::createSimpleFlatWallNormal(), qTensorLatticeModel::createSimpleFlatWallZNormal(), qTensorLatticeModel::createSimpleSpherialColloid(), displaceBoundaryObject(), qTensorLatticeModel::getAverageEigenvalues(), simpleModel::getClassSize(), simpleModel::initializeSimpleModel(), moveParticles(), qTensorLatticeModel::moveParticles(), simpleModel::moveParticles(), multirankQTensorLatticeModel::multirankQTensorLatticeModel(), multirankQTensorLatticeModel::prepareSendingBuffer(), multirankQTensorLatticeModel::readReceivingBuffer(), simpleModel::returnPositions(), qTensorLatticeModel::setNematicQTensorRandomly(), simpleModel::setParticlePositions(), simpleModel::setParticlePositionsRandomly(), and setSpinsRandomly().
|
protectedinherited |
particle velocities
Referenced by simpleModel::computeInstantaneousTemperature(), simpleModel::computeKineticEnergy(), simpleModel::getClassSize(), simpleModel::initializeSimpleModel(), multirankQTensorLatticeModel::multirankQTensorLatticeModel(), simpleModel::returnVelocities(), and simpleModel::setVelocitiesMaxwellBoltzmann().
|
protectedinherited |
Forces on particles.
Referenced by simpleModel::computeForces(), simpleModel::getClassSize(), simpleModel::initializeSimpleModel(), multirankQTensorLatticeModel::multirankQTensorLatticeModel(), and simpleModel::returnForces().
|
protectedinherited |
particle types
Referenced by averagePosition(), qTensorLatticeModel::computeDefectMeasures(), createBoundaryObject(), displaceBoundaryObject(), qTensorLatticeModel::getAverageEigenvalues(), simpleModel::getClassSize(), simpleModel::initializeSimpleModel(), multirankQTensorLatticeModel::multirankQTensorLatticeModel(), multirankQTensorLatticeModel::prepareSendingBuffer(), multirankQTensorLatticeModel::readReceivingBuffer(), simpleModel::returnTypes(), and qTensorLatticeModel::setNematicQTensorRandomly().
|
protectedinherited |
particle radii
particle masses Whether the GPU should be used to compute anything
Referenced by qTensorLatticeModel::computeDefectMeasures(), simpleModel::computeForces(), cubicLattice(), displaceBoundaryObject(), moveParticles(), qTensorLatticeModel::moveParticles(), simpleModel::moveParticles(), multirankQTensorLatticeModel::prepareSendingBuffer(), multirankQTensorLatticeModel::readReceivingBuffer(), simpleModel::setGPU(), qTensorLatticeModel::setNematicQTensorRandomly(), and setSpinsRandomly().