/* * data.h * * Data object contains all data needed for simulation. * In particular, the data arrays shared with front end. */ #ifndef DATA_H #define DATA_H #include "mdengine.h" #include "constant.h" #ifdef __cplusplus extern "C" { #endif /* number of trajectory arrays for shadow energy computation */ #define NUMARR 16 #define NUMARR_MINUS_1 (NUMARR-1) /* need NUMARR to be power of 2 */ /* * Indices into reduction array */ enum { PE_BOND = 0, PE_ANGLE, PE_DIHED, PE_IMPR, PE_ELEC, PE_VDW, PE_BC, PE, KE, TE, SHADOW2, SHADOW4, SHADOW6, SHADOW8, NREDUCS }; /* * forward declaration */ struct Force_Tag; /* * Data contains the state of the simulation engine */ typedef struct Data_Tag { /* force field computation */ struct Force_Tag *force; /* force field parameter arrays */ MD_Int natomprms; MD_Int nbondprms; MD_Int nangleprms; MD_Int ndihedprms; MD_Int nimprprms; MD_Int nnbfixprms; MD_Atom_Param *atomprm; MD_Bond_Param *bondprm; MD_Angle_Param *angleprm; MD_Dihed_Param *dihedprm; MD_Impr_Param *imprprm; MD_Nbfix_Param *nbfixprm; /* topology arrays */ MD_Int natoms; MD_Int nbonds; MD_Int nangles; MD_Int ndiheds; MD_Int nimprs; MD_Int nexcls; MD_Atom *atom; MD_Bond *bond; MD_Angle *angle; MD_Dihed *dihed; MD_Impr *impr; MD_Excl *excl; /* trajectory arrays, each of length natoms */ MD_Dvec *pos; MD_Dvec *vel; MD_Dvec *f; /* trajectory arrays for shadow energy computation */ MD_Dvec *posarr[NUMARR]; MD_Dvec *velarr[NUMARR]; MD_Double beta_arr[NUMARR][1]; MD_Int arr_index; MD_Int is_shadow_ready; /* error values */ MD_Errcode err_simparam; MD_Errcode err_unstable; MD_Errcode err_mgrid; MD_Errcode err_dpmta; /* reductions visible through API using units: (Kcal / mol) */ MD_Int nreducs; MD_Double reduc[NREDUCS]; MD_String reduclabel[NREDUCS]; /* energy reductions from force computation */ /* use derived units: (AMU * A^2 / fs^2) */ MD_Double energy[NREDUCS]; /* * simulation parameters */ /* basic simparams */ MD_Double timestep; MD_Double dielectric; MD_Double scaling14; MD_Double switchdist; MD_Double cutoff; MD_String exclude; MD_Int excl_policy; MD_Int is_switching; MD_Int stepnum; MD_Int firststepnum; MD_String elec_eval; MD_Int elec_eval_policy; MD_Int is_shadow; /* simparams for multigrid */ MD_Int mg_levels; MD_Int mg_divisions; MD_Double mg_gridsize; MD_Double mg_cutoff; MD_Double mg_length; MD_String mg_switchtype_string; MD_Int mg_switchtype; /* simparams for DPMTA */ MD_Int dpmta_levels; MD_Int dpmta_mpterms; MD_Int dpmta_is_fft; MD_Int dpmta_blocking_fft; MD_Double dpmta_theta; /* simparams for spherical boundary conditions */ MD_Int is_sphericalbc; MD_Dvec sphericalbc_center; MD_Double sphericalbc_r1; MD_Double sphericalbc_k1; MD_Int sphericalbc_exp1; MD_Double sphericalbc_r2; MD_Double sphericalbc_k2; MD_Int sphericalbc_exp2; /* * stuff needed for mdapi set and get */ /* need addressable variable for length (= 1) of simparam "arrays" */ MD_Int simparam_len; /* need addressable pointers for data accessed by set and get */ MD_Double *p_reduc; MD_String *p_reduclabel; MD_Double *p_timestep; MD_Double *p_dielectric; MD_Double *p_scaling14; MD_Double *p_switchdist; MD_Double *p_cutoff; MD_String *p_exclude; MD_Int *p_is_switching; MD_Int *p_stepnum; MD_Int *p_firststepnum; MD_String *p_elec_eval; MD_Int *p_is_shadow; MD_Int *p_mg_levels; MD_Int *p_mg_divisions; MD_Double *p_mg_gridsize; MD_Double *p_mg_cutoff; MD_Double *p_mg_length; MD_String *p_mg_switchtype_string; MD_Int *p_dpmta_levels; MD_Int *p_dpmta_mpterms; MD_Int *p_dpmta_is_fft; MD_Int *p_dpmta_blocking_fft; MD_Double *p_dpmta_theta; MD_Int *p_is_sphericalbc; MD_Dvec *p_sphericalbc_center; MD_Double *p_sphericalbc_r1; MD_Double *p_sphericalbc_k1; MD_Int *p_sphericalbc_exp1; MD_Double *p_sphericalbc_r2; MD_Double *p_sphericalbc_k2; MD_Int *p_sphericalbc_exp2; /* pointer back to MD_Sim */ MD_Sim *sim; } Data; /* * prototypes for Data "init" and "destroy" functions */ MD_Errcode deven_data_init(Data *data); void deven_data_destroy(Data *data); MD_Errcode deven_data_validate_simparam(Data *data); /* boolean off / on values */ #define OFF 0 #define ON 1 /* * default simparam values */ #define DEFAULT_TIMESTEP 1.0 /* femptoseconds */ #define DEFAULT_DIELECTRIC 1.0 /* unitless */ #define DEFAULT_SCALING14 1.0 /* unitless */ #define DEFAULT_SWITCHDIST 10.0 /* angstroms */ #define DEFAULT_CUTOFF 12.0 /* angstroms */ #define DEFAULT_EXCLUDE "scaled1-4" #define DEFAULT_IS_SWITCHING ON #define DEFAULT_STEPNUM 0 #define DEFAULT_FIRSTSTEPNUM DEFAULT_STEPNUM #define DEFAULT_ELEC_EVAL "Cutoff" #define DEFAULT_IS_SHADOW OFF #define DEFAULT_MG_LEVELS 0 #define DEFAULT_MG_DIVISIONS 0 #define DEFAULT_MG_GRIDSIZE 0.0 #define DEFAULT_MG_CUTOFF 0.0 #define DEFAULT_MG_LENGTH 0.0 #define DEFAULT_MG_SWITCHTYPE_STRING "C2" #define DEFAULT_DPMTA_LEVELS 5 #define DEFAULT_DPMTA_MPTERMS 8 #define DEFAULT_DPMTA_IS_FFT ON #define DEFAULT_DPMTA_BLOCKING_FFT 4 #define DEFAULT_DPMTA_THETA 0.75 #define DEFAULT_IS_SPHERICALBC OFF #define DEFAULT_SPHERICALBC_CENTER_X 0.0 #define DEFAULT_SPHERICALBC_CENTER_Y 0.0 #define DEFAULT_SPHERICALBC_CENTER_Z 0.0 #define DEFAULT_SPHERICALBC_R1 0.0 #define DEFAULT_SPHERICALBC_K1 0.0 #define DEFAULT_SPHERICALBC_EXP1 2 #define DEFAULT_SPHERICALBC_R2 0.0 #define DEFAULT_SPHERICALBC_K2 0.0 #define DEFAULT_SPHERICALBC_EXP2 2 /* * Exclusion policy numbers */ enum { EXCL_NONE = 0, /* must be first */ EXCL_12, EXCL_13, EXCL_14, SCALED_14 /* must be last */ }; /* * Electrostatic evaluation policy numbers */ enum { ELEC_EVAL_CUTOFF = 0, /* must be first */ ELEC_EVAL_MG, ELEC_EVAL_MGRID, ELEC_EVAL_DPMTA, ELEC_EVAL_FULLDIRECT /* must be last */ }; /* * MG switch type numbers */ enum { MG_SWITCH_FIRST = 0, /* must be first */ MG_SWITCH_C1, MG_SWITCH_C2, MG_SWITCH_C3, MG_SWITCH_LAST /* must be last */ }; #ifdef __cplusplus } #endif #endif /* DATA_H */