Open Qmin  0.8.0
GPU-accelerated Q-tensor-based liquid crystal simulations
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
cubicLattice Class Reference

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>

Inheritance diagram for cubicLattice:
Inheritance graph
[legend]
Collaboration diagram for cubicLattice:
Collaboration graph
[legend]

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< boundaryObjectboundaries
 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< scalar3boundaryForce
 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< scalardefectMeasures
 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< kernelTunermoveParticlesTuner
 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...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ cubicLattice() [1/2]

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() [2/2]

cubicLattice::cubicLattice ( int  lx,
int  ly,
int  lz,
bool  _slice = false,
bool  _useGPU = false,
bool  _neverGPU = false 
)

Member Function Documentation

◆ moveParticles() [1/2]

void cubicLattice::moveParticles ( GPUArray< dVec > &  displacements,
scalar  scale = 1. 
)
virtual

◆ moveParticles() [2/2]

void cubicLattice::moveParticles ( GPUArray< dVec > &  dofs,
GPUArray< dVec > &  displacements,
scalar  scale = 1. 
)
virtual

◆ setSpinsRandomly()

void cubicLattice::setSpinsRandomly ( noiseSource noise)

◆ getNeighbors()

int cubicLattice::getNeighbors ( int  target,
vector< int > &  neighbors,
int &  neighs,
int  stencilType = 0 
)
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().

◆ sliceIndices()

void cubicLattice::sliceIndices ( bool  _s = true)
inline

decide to slice sites

References sliceSites.

◆ latticeSiteToLinearIndex()

int cubicLattice::latticeSiteToLinearIndex ( const int3 &  target)

given a triple, determine what

References latticeIndex, and sliceSites.

◆ fillNeighborLists()

void cubicLattice::fillNeighborLists ( int  stencilType = 0)
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().

◆ averagePosition()

virtual dVec cubicLattice::averagePosition ( )
inlinevirtual

◆ displaceBoundaryObject()

void cubicLattice::displaceBoundaryObject ( int  objectIndex,
int  motionDirection,
int  magnitude 
)
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

Parameters
objectIndexThe position in the vector of boundarySites and surfaceSites that the desired object to move is in
motionDirectionWhich way to move the object. Follows same convention as lattice neighbors for stencilType=0
magnitudenumber 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.

◆ createBoundaryObject()

void cubicLattice::createBoundaryObject ( vector< int > &  latticeSites,
boundaryType  _type,
scalar  Param1,
scalar  Param2 
)

◆ getClassSize()

virtual scalar cubicLattice::getClassSize ( )
inlinevirtual

◆ initializeNSites()

void cubicLattice::initializeNSites ( )
protected

◆ initializeSimpleModel()

void simpleModel::initializeSimpleModel ( int  n)
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().

◆ setGPU()

virtual void simpleModel::setGPU ( bool  _useGPU = true)
inlinevirtualinherited

Enforce GPU operation.

References simpleModel::useGPU.

◆ getNumberOfParticles()

virtual int simpleModel::getNumberOfParticles ( )
inlinevirtualinherited

get the number of degrees of freedom, defaulting to the number of cells

References simpleModel::N.

◆ computeForces()

void simpleModel::computeForces ( bool  zeroOutForces = false)
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.

◆ setParticlePositions() [1/2]

void simpleModel::setParticlePositions ( GPUArray< dVec > &  newPositions)
inherited

◆ setParticlePositions() [2/2]

void simpleModel::setParticlePositions ( vector< dVec > &  newPositions)
inherited

◆ setParticlePositionsRandomly()

void simpleModel::setParticlePositionsRandomly ( noiseSource noise)
inherited

◆ setVelocitiesMaxwellBoltzmann()

scalar simpleModel::setVelocitiesMaxwellBoltzmann ( scalar  T,
noiseSource noise 
)
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.

◆ computeKineticEnergy()

scalar simpleModel::computeKineticEnergy ( bool  verbose = false)
virtualinherited

compute the current KE

References ArrayHandle< T >::data, dot(), simpleModel::N, scalar, and simpleModel::velocities.

◆ computeInstantaneousTemperature()

scalar simpleModel::computeInstantaneousTemperature ( bool  fixedMomentum = true)
virtualinherited

compute the dimension-dependent instantaneous temperature

References ArrayHandle< T >::data, dot(), simpleModel::N, scalar, and simpleModel::velocities.

◆ spatialSorting()

virtual void simpleModel::spatialSorting ( )
inlinevirtualinherited

do everything necessary to perform a Hilbert sort

◆ returnPositions()

virtual GPUArray<dVec>& simpleModel::returnPositions ( )
inlinevirtualinherited

return a reference to the GPUArray of positions

References simpleModel::positions.

◆ returnForces()

virtual GPUArray<dVec>& simpleModel::returnForces ( )
inlinevirtualinherited

return a reference to the GPUArray of the current forces

References simpleModel::forces.

◆ returnTypes()

virtual GPUArray<int>& simpleModel::returnTypes ( )
inlinevirtualinherited

return a reference to the GPUArray of the integer types

References simpleModel::types.

◆ returnVelocities()

virtual GPUArray<dVec>& simpleModel::returnVelocities ( )
inlinevirtualinherited

return a reference to the GPUArray of the current velocities

References simpleModel::velocities.

◆ returnDefectMeasures()

virtual GPUArray<scalar>& simpleModel::returnDefectMeasures ( )
inlinevirtualinherited

return a reference to the GPUArray of the current defects

◆ setNThreads()

virtual void simpleModel::setNThreads ( int  n)
inlinevirtualinherited

allow for setting multiple threads

References n, and simpleModel::nThreads.

◆ freeGPUArrays()

virtual void simpleModel::freeGPUArrays ( bool  freeVelocities,
bool  freeRadii,
bool  freeMasses 
)
inlinevirtualinherited

some situations do not require us to maintain various data structures

Member Data Documentation

◆ latticeIndex

Index3D cubicLattice::latticeIndex

◆ neighborIndex

Index2D cubicLattice::neighborIndex

indexer for neighbors

Referenced by displaceBoundaryObject(), and fillNeighborLists().

◆ neighboringSites

GPUArray<int> cubicLattice::neighboringSites

List of neighboring lattice sites.

Referenced by displaceBoundaryObject(), fillNeighborLists(), getClassSize(), and initializeNSites().

◆ boundaries

GPUArray<boundaryObject> cubicLattice::boundaries

list of the non-bulk objects in the simulations

Referenced by createBoundaryObject(), and initializeNSites().

◆ boundarySites

vector<GPUArray<int> > cubicLattice::boundarySites

A vector that keeps track of the sites associated with each boundary object.

Referenced by createBoundaryObject(), displaceBoundaryObject(), and getClassSize().

◆ surfaceSites

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

◆ boundaryState

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

◆ boundaryForce

vector<scalar3> cubicLattice::boundaryForce

The force (from integrating the stress tensor) on each object.

Referenced by createBoundaryObject().

◆ boundaryMoveAssist1

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

◆ boundaryMoveAssist2

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

◆ sliceSites

bool cubicLattice::sliceSites
protected

should we use a memory-efficient slicing scheme?

Referenced by cubicLattice(), getNeighbors(), multirankQTensorLatticeModel::getNeighbors(), latticeSiteToLinearIndex(), and sliceIndices().

◆ L

int cubicLattice::L
protected

lattice sites per edge

Referenced by cubicLattice().

◆ normalizeSpins

bool cubicLattice::normalizeSpins
protected

normalize vector length when moving spins?

Referenced by cubicLattice(), moveParticles(), and qTensorLatticeModel::qTensorLatticeModel().

◆ moveParticlesTuner

shared_ptr<kernelTuner> cubicLattice::moveParticlesTuner
protected

performance for the moveParticles kernel

Referenced by initializeNSites(), and qTensorLatticeModel::moveParticles().

◆ selfForceCompute

bool simpleModel::selfForceCompute
inherited

Does this model have a special force it needs to compute itself?

Referenced by cubicLattice(), and simpleModel::initializeSimpleModel().

◆ Box

BoxPtr simpleModel::Box
inherited

◆ forcesComputed

bool simpleModel::forcesComputed
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().

◆ defectMeasures

GPUArray<scalar> simpleModel::defectMeasures
inherited

◆ neverGPU

bool simpleModel::neverGPU
inherited

◆ N

int simpleModel::N
protectedinherited

◆ nThreads

int simpleModel::nThreads =1
protectedinherited

number of threads to use

Referenced by simpleModel::setNThreads().

◆ positions

GPUArray<dVec> simpleModel::positions
protectedinherited

◆ velocities

GPUArray<dVec> simpleModel::velocities
protectedinherited

◆ forces

GPUArray<dVec> simpleModel::forces
protectedinherited

◆ types

GPUArray<int> simpleModel::types
protectedinherited

◆ useGPU

bool simpleModel::useGPU
protectedinherited

The documentation for this class was generated from the following files: