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

A base interfacing class that defines common operations. More...

#include <simpleModel.h>

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

Public Member Functions

 simpleModel (int n, bool _useGPU=false, bool _neverGPU=false)
 The base constructor requires the number of particles. More...
 
 simpleModel ()
 a blank default constructor 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 moveParticles (GPUArray< dVec > &displacements, scalar scale=1.)
 move the degrees of freedom 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 displaceBoundaryObject (int objectIndex, int motionDirection, int magnitude)
 
virtual void freeGPUArrays (bool freeVelocities, bool freeRadii, bool freeMasses)
 some situations do not require us to maintain various data structures More...
 
virtual scalar getClassSize ()
 return size of data in class in GB More...
 

Public Attributes

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 Attributes

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

A base interfacing class that defines common operations.

This provides an interface, guaranteeing that SimpleModel S will provide access to S.setGPU(); S.getNumberOfParticles(); S.computeForces(); S.moveParticles(); S.returnForces(); S.returnPositions(); S.returnVelocities(); S.returnRadii(); S.returnMasses(); S.returnTypes(); S.spatialSorting(); S.returnAdditionalData();

Constructor & Destructor Documentation

◆ simpleModel() [1/2]

simpleModel::simpleModel ( int  n,
bool  _useGPU = false,
bool  _neverGPU = false 
)

The base constructor requires the number of particles.

Set the size of basic data structures...

References Box, initializeSimpleModel(), n, and N.

◆ simpleModel() [2/2]

simpleModel::simpleModel ( )
inline

a blank default constructor

Member Function Documentation

◆ initializeSimpleModel()

void simpleModel::initializeSimpleModel ( int  n)

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 defectMeasures, forces, make_dVec(), n, N, neverGPU, GPUArray< T >::noGPU, positions, GPUArray< T >::resize(), selfForceCompute, types, and velocities.

Referenced by cubicLattice::initializeNSites(), setParticlePositions(), and simpleModel().

◆ setGPU()

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

Enforce GPU operation.

References useGPU.

◆ getNumberOfParticles()

virtual int simpleModel::getNumberOfParticles ( )
inlinevirtual

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

References N.

◆ moveParticles()

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

move the degrees of freedom

move particles on either CPU or gpu

Reimplemented in qTensorLatticeModel, and cubicLattice.

References Box, ArrayHandle< T >::data, access_location::device, forcesComputed, gpu_move_particles(), access_location::host, N, positions, access_mode::read, access_mode::readwrite, and useGPU.

◆ computeForces()

void simpleModel::computeForces ( bool  zeroOutForces = false)
virtual

do everything unusual to compute additional forces... by default, sets forces to zero

References ArrayHandle< T >::data, forces, gpu_set_array(), N, and useGPU.

◆ setParticlePositions() [1/2]

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

◆ setParticlePositions() [2/2]

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

◆ setParticlePositionsRandomly()

void simpleModel::setParticlePositionsRandomly ( noiseSource noise)

◆ setVelocitiesMaxwellBoltzmann()

scalar simpleModel::setVelocitiesMaxwellBoltzmann ( scalar  T,
noiseSource noise 
)

Set velocities via a temperature. The return value is the total kinetic energy.

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

◆ computeKineticEnergy()

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

compute the current KE

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

◆ computeInstantaneousTemperature()

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

compute the dimension-dependent instantaneous temperature

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

◆ spatialSorting()

virtual void simpleModel::spatialSorting ( )
inlinevirtual

do everything necessary to perform a Hilbert sort

◆ returnPositions()

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

return a reference to the GPUArray of positions

References positions.

◆ returnForces()

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

return a reference to the GPUArray of the current forces

References forces.

◆ returnTypes()

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

return a reference to the GPUArray of the integer types

References types.

◆ returnVelocities()

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

return a reference to the GPUArray of the current velocities

References velocities.

◆ returnDefectMeasures()

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

return a reference to the GPUArray of the current defects

◆ setNThreads()

virtual void simpleModel::setNThreads ( int  n)
inlinevirtual

allow for setting multiple threads

References n, and nThreads.

◆ displaceBoundaryObject()

virtual void simpleModel::displaceBoundaryObject ( int  objectIndex,
int  motionDirection,
int  magnitude 
)
inlinevirtual

Reimplemented in cubicLattice.

◆ freeGPUArrays()

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

some situations do not require us to maintain various data structures

◆ getClassSize()

virtual scalar simpleModel::getClassSize ( )
inlinevirtual

Member Data Documentation

◆ selfForceCompute

bool simpleModel::selfForceCompute

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

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

◆ Box

BoxPtr simpleModel::Box

◆ forcesComputed

bool simpleModel::forcesComputed

Are the forces current? set to false after every call to moveParticles. set to true after the SIMULATION calls computeForces.

Referenced by moveParticles().

◆ defectMeasures

GPUArray<scalar> simpleModel::defectMeasures

◆ neverGPU

bool simpleModel::neverGPU

◆ N

int simpleModel::N
protected

◆ nThreads

int simpleModel::nThreads =1
protected

number of threads to use

Referenced by setNThreads().

◆ positions

GPUArray<dVec> simpleModel::positions
protected

◆ velocities

GPUArray<dVec> simpleModel::velocities
protected

◆ forces

GPUArray<dVec> simpleModel::forces
protected

◆ types

GPUArray<int> simpleModel::types
protected

◆ useGPU

bool simpleModel::useGPU
protected

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