Main Page | Class List | Directories | File List | Class Members | File Members

step.h File Reference

Time stepping library. More...

#include "mdapi/mdtypes.h"
#include "random/random.h"

Go to the source code of this file.

Classes

struct  StepParam_tag
 Helper class to configure parameters. More...
struct  StepSystem_tag
 Helper class providing system data. More...
struct  Step_tag
 Time stepping class. More...

Defines

#define STEP_FAIL   (-1)
#define STEP_TRUE   (1)
#define STEP_FALSE   (0)

Typedefs

typedef StepParam_tag StepParam
 Helper class to configure parameters.
typedef StepSystem_tag StepSystem
 Helper class providing system data.
typedef Step_tag Step
 Time stepping class.

Functions

int step_init (Step *, StepParam *param)
 Constructor.
int step_compute (Step *, StepSystem *sys, int32 numsteps)
 Perform time stepping.
int step_find_reductions (Step *, StepSystem *sys)
 Calculate reductions.
int step_set_random_velocities (Step *, StepSystem *sys, double init_temp)
 Set initial velocities.
int step_remove_com_motion (Step *, StepSystem *sys)
 Remove center of mass motion.
void step_done (Step *)
 Destructor.


Detailed Description

Time stepping library.

Author:
David J. Hardy
Date:
2005
The Step_tag class computes time integration using leapfrog (velocity Verlet) integration. Also provided are routines for random velocity initialization from an initial temperature distribution and computation of kinetic energy and temperature reductions.

Two helper classes are required. The StepParam_tag class is used for setup. Its fields are set to fixed simulation parameters that should not change during the simulation. Among these parameters is a generic force routine that should by design accept the current positions and provide the forces. The StepSystem_tag class is used for input and output data that is updated throughout the simulation. Input data includes the initial position and velocity arrays, and output data includes updated position and veolcity arrays along with current forces.

The units are as outlined by the MDAPI documentation:


Define Documentation

#define STEP_FAIL   (-1)
 

Return value indicating an error occurred.

#define STEP_FALSE   (0)
 

Indicates StepSystem_tag::is_force_valid is false.

#define STEP_TRUE   (1)
 

Indicates StepSystem_tag::is_force_valid is true.


Typedef Documentation

typedef struct Step_tag Step
 

Time stepping class.

Members should be treated as private.

typedef struct StepParam_tag StepParam
 

Helper class to configure parameters.

The user is expected to fill in these values. User retains ownership of the atom array. The only thing that might be modified as a side-effect is StepParam_tag::force_object, and that depends on the nature of the provided StepParam_tag::force_compute() routine.

typedef struct StepSystem_tag StepSystem
 

Helper class providing system data.

The user is expected to provide buffer space for the StepSystem_tag::force, StepSystem_tag::vel, and StepSystem_tag::pos arrays. They must be of length StepParam_tag::natoms. The StepSystem_tag::is_force_valid should be set to STEP_FALSE for the initial call to step_compute().


Function Documentation

int step_compute Step ,
StepSystem sys,
int32  numsteps
 

Perform time stepping.

Parameters:
[in,out] sys Contains the state of the system.
[in] numsteps Number of time steps to integrate the system.
The provided system sys is integrated for numsteps time steps using leapfrog (velocity Verlet). The force routine provided to StepParam_tag::force_compute() is called once per time step and optionally once initially depending on the value of StepSystem_tag::is_force_valid. The buffer space provided to StepSystem_tag is updated in place.

Note that calls to the force routine account for the majority of the computational cost.

Returns:
0 for success or STEP_FAIL on failure.

void step_done Step  ) 
 

Destructor.

Frees memory allocations made internally during step_init(). Call when finished using Step_tag object.

int step_find_reductions Step ,
StepSystem sys
 

Calculate reductions.

Parameters:
[in,out] sys Contains the state of the system.
Calculates updates to the kinetic energy and the temperature which are stored in StepSystem_tag.

Returns:
0 for success or STEP_FAIL on failure.

int step_init Step ,
StepParam param
 

Constructor.

Parameters:
[in] param The StepParam_tag object used for configuration.
Initializes a Step_tag object. Must call this routine first.

Returns:
0 for success or STEP_FAIL on failure.

int step_remove_com_motion Step ,
StepSystem sys
 

Remove center of mass motion.

Parameters:
[in,out] sys Contains the state of the system.
Removes the center of mass motion for the system. Doing so reduces the number of degrees of freedom of the system by 3 (i.e. one atom), so StepParam_tag::ndegfreedom should be set accordingly.

int step_set_random_velocities Step ,
StepSystem sys,
double  init_temp
 

Set initial velocities.

Parameters:
[out] sys Contains the state of the system.
[in] init_temp Initial temperature distribution.
Determines random velocities for the initial temperature distribution.

Returns:
0 for success or STEP_FAIL on failure.


Generated on Mon Sep 26 10:55:20 2005 for MDX by  doxygen 1.4.4