CoMD
A Mini-app for Co-Design of Classical Molecular Dynamics.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
initAtoms.c File Reference

Initialize the atom configuration. More...

#include "initAtoms.h"
#include <math.h>
#include <assert.h>
#include "constants.h"
#include "decomposition.h"
#include "parallel.h"
#include "random.h"
#include "linkCells.h"
#include "timestep.h"
#include "memUtils.h"
#include "performanceTimers.h"
Include dependency graph for initAtoms.c:

Go to the source code of this file.

Functions

static void computeVcm (SimFlat *s, real_t vcm[3])
 Computes the center of mass velocity of the system. More...
 
AtomsinitAtoms (LinkCell *boxes)
 Allocates memory to store atom data. More...
 
void destroyAtoms (Atoms *atoms)
 
void createFccLattice (int nx, int ny, int nz, real_t lat, SimFlat *s)
 Creates atom positions on a face centered cubic (FCC) lattice with nx * ny * nz unit cells and lattice constant lat. More...
 
void setVcm (SimFlat *s, real_t newVcm[3])
 Sets the center of mass velocity of the system. More...
 
void setTemperature (SimFlat *s, real_t temperature)
 Sets the temperature of system. More...
 
void randomDisplacements (SimFlat *s, real_t delta)
 Add a random displacement to the atom positions. More...
 

Detailed Description

Initialize the atom configuration.

Definition in file initAtoms.c.

Function Documentation

void computeVcm ( SimFlat s,
real_t  vcm[3] 
)
static

Computes the center of mass velocity of the system.

Definition at line 202 of file initAtoms.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void createFccLattice ( int  nx,
int  ny,
int  nz,
real_t  lat,
SimFlat s 
)

Creates atom positions on a face centered cubic (FCC) lattice with nx * ny * nz unit cells and lattice constant lat.

Set momenta to zero.

Definition at line 64 of file initAtoms.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void destroyAtoms ( Atoms atoms)

Definition at line 52 of file initAtoms.c.

Here is the caller graph for this function:

Atoms* initAtoms ( LinkCell boxes)

Allocates memory to store atom data.

Call functions such as createFccLattice and setTemperature to set up initial atom positions and momenta.

Definition at line 23 of file initAtoms.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void randomDisplacements ( SimFlat s,
real_t  delta 
)

Add a random displacement to the atom positions.

Atoms are displaced by a random distance in the range [-delta, +delta] along each axis.

Parameters
[in]deltaThe maximum displacement (along each axis).

Definition at line 187 of file initAtoms.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void setTemperature ( SimFlat s,
real_t  temperature 
)

Sets the temperature of system.

Selects atom velocities randomly from a boltzmann (equilibrium) distribution that corresponds to the specified temperature. This random process will typically result in a small, but non zero center of mass velocity and a small difference from the specified temperature. For typical MD runs these small differences are unimportant, However, to avoid possible confusion, we set the center of mass velocity to zero and scale the velocities to exactly match the input temperature.

Definition at line 145 of file initAtoms.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void setVcm ( SimFlat s,
real_t  newVcm[3] 
)

Sets the center of mass velocity of the system.

Parameters
[in]newVcmThe desired center of mass velocity.

Definition at line 111 of file initAtoms.c.

Here is the call graph for this function:

Here is the caller graph for this function: