00001 /* 00002 * Copyright (C) 2005 by David J. Hardy. All rights reserved. 00003 */ 00004 00035 #ifndef STEP_H 00036 #define STEP_H 00037 00038 #include "mdapi/mdtypes.h" 00039 #include "random/random.h" 00040 00041 #ifdef __cplusplus 00042 extern "C" { 00043 #endif 00044 00045 #define STEP_FAIL (-1) 00046 00048 #define STEP_TRUE (1) 00049 00051 #define STEP_FALSE (0) 00052 00062 typedef struct StepParam_tag { 00063 unsigned long random_seed; 00065 double timestep; 00067 void *force_object; 00070 int32 (*force_compute)(void *force_object, MD_Dvec *force, MD_Dvec *pos); 00073 MD_Atom *atom; 00075 int32 natoms; 00077 int32 ndegfreedom; 00081 } StepParam; 00082 00083 00093 typedef struct StepSystem_tag { 00094 double kinetic_energy; 00097 double temperature; 00100 MD_Dvec *force; 00104 MD_Dvec *vel; 00110 MD_Dvec *pos; 00116 int32 is_force_valid; 00119 } StepSystem; 00120 00121 00126 typedef struct Step_tag { 00127 Random random; /* random number generator */ 00128 double tempkonst; /* constant needed to compute temperature */ 00129 StepParam *param; /* shallow copy of user StepParam object */ 00130 double *scal_inv_mass; /* compute array of scaled inverse mass, 00131 for efficiency */ 00132 } Step; 00133 00134 00144 int step_init(Step *, StepParam *param); 00145 00146 00164 int step_compute(Step *, StepSystem *sys, int32 numsteps); 00165 00166 00176 int step_find_reductions(Step *, StepSystem *sys); 00177 00178 00188 int step_set_random_velocities(Step *, StepSystem *sys, double init_temp); 00189 00190 00199 int step_remove_com_motion(Step *, StepSystem *sys); 00200 00201 00207 void step_done(Step *); 00208 00209 #ifdef __cplusplus 00210 } 00211 #endif 00212 00213 #endif /* STEP_H */