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

A class that ties together all the parts of a simulation. More...

#include <simulation.h>

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

Public Member Functions

void setConfiguration (ConfigPtr _config)
 Pass in a reference to the configuration. More...
 
virtual void computeForces ()
 Call the force computer to compute the forces. More...
 
virtual void moveParticles (GPUArray< dVec > &displacements, scalar scale=1.0)
 Call the configuration to move particles around. More...
 
void performTimestep ()
 Call every updater to advance one time step. More...
 
shared_ptr< SimulationgetPointer ()
 return a shared pointer to this Simulation More...
 
void addUpdater (UpdaterPtr _upd)
 Add an updater. More...
 
void addUpdater (UpdaterPtr _upd, ConfigPtr _config)
 Add an updater with a reference to a configuration. More...
 
void addForce (ForcePtr _force)
 Add a force computer configuration. More...
 
void addForce (ForcePtr _force, ConfigPtr _config)
 Add a force computer configuration. More...
 
void clearForceComputers ()
 Clear out the vector of forceComputes. More...
 
void clearUpdaters ()
 Clear out the vector of updaters. More...
 
scalar getMaxForce ()
 A utility function that just checks the first updater for a max force. More...
 
virtual scalar computePotentialEnergy (bool verbose=false)
 compute the potential energy associated with all of the forces More...
 
virtual scalar computeKineticEnergy (bool verbose=false)
 compute the kinetic energy More...
 
virtual scalar computeEnergy (bool verbose=false)
 compute the total energy More...
 
virtual void computePressureTensor (MatrixDxD &P)
 compute the pressure tensor More...
 
void setIntegrationTimestep (scalar dt)
 Set the simulation timestep. More...
 
void setCPUOperation (bool setcpu)
 turn on CPU-only mode for all components More...
 
void setReproducible (bool reproducible)
 Enforce reproducible dynamics. More...
 
void setNThreads (int n)
 work with openMP threads More...
 
void setBox (BoxPtr _box)
 This changes the contents of the Box pointed to by Box to match that of _box. More...
 
void setSortPeriod (int sp)
 Set the time between spatial sorting operations. More...
 
virtual void setCurrentTime (scalar _cTime)
 reset the simulation clock More...
 
virtual void setCurrentTimestep (int _cTime)
 reset the simulation clock counter More...
 
virtual void sumUpdaterData (vector< scalar > &data)
 manipulate data from updaters More...
 

Public Attributes

vector< WeakUpdaterPtrupdaters
 A vector of updaters that the simulation will loop through. More...
 
vector< WeakForcePtrforceComputers
 A vector of force computes the simulation will loop through. More...
 
WeakConfigPtr configuration
 The configuration of particles. More...
 
BoxPtr Box
 The domain of the simulation. More...
 
int integerTimestep
 An integer that keeps track of how often performTimestep has been called. More...
 
scalar Time
 The current simulation time. More...
 
scalar integrationTimestep
 The dt of a time step. More...
 
bool useGPU
 A flag controlling whether to use the GPU. More...
 
int myRank
 integer for this rank More...
 
int nRanks
 total number of ranks More...
 
int NActive = 0
 some measure of the number of active degrees of freedom More...
 

Protected Attributes

int sortPeriod
 Determines how frequently the spatial sorter be called...once per sortPeriod Timesteps. When sortPeriod < 0 no sorting occurs. More...
 
bool spatialSortThisStep
 A flag that determins if a spatial sorting is due to occur this Timestep. More...
 

Detailed Description

A class that ties together all the parts of a simulation.

Simulation objects should have a configuration set, and then at least one updater (such as an equation of motion). In addition to being a centralized object controlling the progression of a simulation of cell models, the Simulation class provides some interfaces to cell configuration and updater parameter setters.

Member Function Documentation

◆ setConfiguration()

void Simulation::setConfiguration ( ConfigPtr  _config)

Pass in a reference to the configuration.

Set a pointer to the configuration

References basicSimulation::Box, and basicSimulation::configuration.

◆ computeForces()

void Simulation::computeForces ( )
virtual

Call the force computer to compute the forces.

Calls all force computers, and evaluate the self force calculation if the model demands it

Implements basicSimulation.

References basicSimulation::configuration, and forceComputers.

◆ moveParticles()

void Simulation::moveParticles ( GPUArray< dVec > &  displacements,
scalar  scale = 1.0 
)
virtual

Call the configuration to move particles around.

Calls the configuration to displace the degrees of freedom

Implements basicSimulation.

References basicSimulation::configuration.

◆ performTimestep()

void Simulation::performTimestep ( )

Call every updater to advance one time step.

Call all relevant functions to advance the system one time step; every sortPeriod also call the spatial sorting routine.

Postcondition
The simulation is advanced one time step

References basicSimulation::integerTimestep, basicSimulation::integrationTimestep, basicSimulation::Time, and updaters.

◆ getPointer()

shared_ptr<Simulation> Simulation::getPointer ( )
inline

return a shared pointer to this Simulation

Referenced by addUpdater().

◆ addUpdater() [1/2]

void Simulation::addUpdater ( UpdaterPtr  _upd)
inline

Add an updater.

References updaters.

◆ addUpdater() [2/2]

void Simulation::addUpdater ( UpdaterPtr  _upd,
ConfigPtr  _config 
)

Add an updater with a reference to a configuration.

Add a pointer to the list of updaters, and give that updater a reference to the model...

References getPointer(), and updaters.

◆ addForce() [1/2]

void Simulation::addForce ( ForcePtr  _force)
inline

Add a force computer configuration.

References forceComputers.

◆ addForce() [2/2]

void Simulation::addForce ( ForcePtr  _force,
ConfigPtr  _config 
)

Add a force computer configuration.

Add a pointer to the list of force computers, and give that FC a reference to the model...

References forceComputers.

◆ clearForceComputers()

void Simulation::clearForceComputers ( )
inline

Clear out the vector of forceComputes.

References forceComputers.

◆ clearUpdaters()

void Simulation::clearUpdaters ( )
inline

Clear out the vector of updaters.

References updaters.

◆ getMaxForce()

scalar Simulation::getMaxForce ( )
inline

A utility function that just checks the first updater for a max force.

References updaters.

◆ computePotentialEnergy()

scalar Simulation::computePotentialEnergy ( bool  verbose = false)
virtual

compute the potential energy associated with all of the forces

Reimplemented from basicSimulation.

References forceComputers, and scalar.

Referenced by computeEnergy().

◆ computeKineticEnergy()

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

compute the kinetic energy

Reimplemented from basicSimulation.

References basicSimulation::configuration.

Referenced by computeEnergy().

◆ computeEnergy()

virtual scalar Simulation::computeEnergy ( bool  verbose = false)
inlinevirtual

compute the total energy

References computeKineticEnergy(), and computePotentialEnergy().

◆ computePressureTensor()

void Simulation::computePressureTensor ( MatrixDxD P)
virtual

compute the pressure tensor

References for(), forceComputers, make_dVec(), and MatrixDxD::mat.

◆ setIntegrationTimestep()

void Simulation::setIntegrationTimestep ( scalar  dt)

Set the simulation timestep.

Postcondition
the cell configuration and e.o.m. timestep is set to the input value

References basicSimulation::integrationTimestep, and updaters.

◆ setCPUOperation()

void Simulation::setCPUOperation ( bool  setcpu)

turn on CPU-only mode for all components

Postcondition
the cell configuration and e.o.m. timestep is set to the input value

References basicSimulation::configuration, forceComputers, updaters, and basicSimulation::useGPU.

◆ setReproducible()

void Simulation::setReproducible ( bool  reproducible)

Enforce reproducible dynamics.

Precondition
the updaters already know if the GPU will be used
Postcondition
the updaters are set to be reproducible if the boolean is true, otherwise the RNG is initialized

References updaters.

◆ setNThreads()

void Simulation::setNThreads ( int  n)

work with openMP threads

References basicSimulation::configuration, forceComputers, n, and updaters.

◆ setBox()

void basicSimulation::setBox ( BoxPtr  _box)
inherited

This changes the contents of the Box pointed to by Box to match that of _box.

Set a new Box for the simulation...This is the function that should be called to propagate a change in the box dimensions throughout the simulation...

References basicSimulation::Box, and basicSimulation::configuration.

◆ setSortPeriod()

void basicSimulation::setSortPeriod ( int  sp)
inlineinherited

Set the time between spatial sorting operations.

References basicSimulation::sortPeriod.

◆ setCurrentTime()

void basicSimulation::setCurrentTime ( scalar  _cTime)
virtualinherited

reset the simulation clock

Postcondition
the cell configuration and e.o.m. timestep is set to the input value

References basicSimulation::Time.

◆ setCurrentTimestep()

virtual void basicSimulation::setCurrentTimestep ( int  _cTime)
inlinevirtualinherited

reset the simulation clock counter

References basicSimulation::integerTimestep.

◆ sumUpdaterData()

virtual void basicSimulation::sumUpdaterData ( vector< scalar > &  data)
inlinevirtualinherited

manipulate data from updaters

Reimplemented in multirankSimulation.

Member Data Documentation

◆ updaters

vector<WeakUpdaterPtr> Simulation::updaters

A vector of updaters that the simulation will loop through.

Referenced by addUpdater(), clearUpdaters(), getMaxForce(), performTimestep(), setCPUOperation(), setIntegrationTimestep(), setNThreads(), and setReproducible().

◆ forceComputers

vector<WeakForcePtr> Simulation::forceComputers

A vector of force computes the simulation will loop through.

Referenced by addForce(), clearForceComputers(), computeForces(), computePotentialEnergy(), computePressureTensor(), setCPUOperation(), and setNThreads().

◆ configuration

WeakConfigPtr basicSimulation::configuration
inherited

◆ Box

BoxPtr basicSimulation::Box
inherited

◆ integerTimestep

int basicSimulation::integerTimestep
inherited

An integer that keeps track of how often performTimestep has been called.

Referenced by performTimestep(), multirankSimulation::performTimestep(), and basicSimulation::setCurrentTimestep().

◆ Time

scalar basicSimulation::Time
inherited

◆ integrationTimestep

scalar basicSimulation::integrationTimestep
inherited

◆ useGPU

bool basicSimulation::useGPU
inherited

◆ myRank

int basicSimulation::myRank
inherited

◆ nRanks

int basicSimulation::nRanks
inherited

◆ NActive

int basicSimulation::NActive = 0
inherited

some measure of the number of active degrees of freedom

Referenced by multirankSimulation::computePotentialEnergy(), and multirankSimulation::finalizeObjects().

◆ sortPeriod

int basicSimulation::sortPeriod
protectedinherited

Determines how frequently the spatial sorter be called...once per sortPeriod Timesteps. When sortPeriod < 0 no sorting occurs.

Referenced by basicSimulation::setSortPeriod().

◆ spatialSortThisStep

bool basicSimulation::spatialSortThisStep
protectedinherited

A flag that determins if a spatial sorting is due to occur this Timestep.


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