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

defn.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2006 by David J. Hardy.  All rights reserved.
00003  */
00004 
00011 #ifndef DEFN_H
00012 #define DEFN_H
00013 
00014 #ifdef __cplusplus
00015 extern "C" {
00016 #endif
00017 
00018   /*
00019    * cells for geometric hashing, implement as cursor link list
00020    *
00021    * parameterize shell thickness and neighborlist length
00022    * keep only half-shell of neighbors, including self
00023    */
00024 
00025   /* maximum shell thickness */
00026 #define FORCE_SHELLMAX  3
00027 
00028   /* number of neighbors */
00029 #define FORCE_NBRLISTLEN \
00030   ( (2*FORCE_SHELLMAX + 1)*(2*FORCE_SHELLMAX + 1)*(2*FORCE_SHELLMAX + 1) )
00031 
00032   typedef struct ForceCell_t {
00033     int32 head;         /* index of first atom/hgroup in this cell */
00034     int32 cnt;          /* count number of atoms/hgroups in this cell */
00035     int32 nnbrs;        /* number of neighbor cells in list */
00036 
00037     int32 nbr[FORCE_NBRLISTLEN/2 + 1];
00038     /* up to half-shell of neighbor cells, include self */
00039 
00040     char offset[FORCE_NBRLISTLEN/2 + 1];
00041     /* index into offset table for periodic image neighbor cells */
00042   } ForceCell;
00043 
00044 
00045   typedef struct ForcePairlist_t {
00046     int32 *index;       /* array of atom indices giving interactions */
00047     char *offset;       /* index into table of periodic image offsets */
00048     int32 len;          /* used length of array */
00049     int32 max;          /* maximum array elements allocated */
00050   } ForcePairlist;
00051 
00052 
00053   typedef struct ForceVdwparam_t {
00054     double a;
00055     double b;
00056     double a14;
00057     double b14;
00058     double rmin2;
00059   } ForceVdwparam;
00060 
00061 
00062   /* constants for safe extension of Buckingham */
00063   typedef struct ForceBucksafe_t {
00064     double a;
00065     double b;
00066     double rinner2;
00067   } ForceBucksafe;
00068 
00069 
00070   enum ForceBoundary_t {
00071     FORCE_NONPERIODIC = 0x000,  
00072     FORCE_X_PERIODIC  = 0x001,  
00073     FORCE_Y_PERIODIC  = 0x002,  
00074     FORCE_Z_PERIODIC  = 0x004,  
00075     FORCE_PERIODIC = (FORCE_X_PERIODIC | FORCE_Y_PERIODIC | FORCE_Z_PERIODIC)
00077   };
00078 
00079 
00080   enum ForceIndex_t {
00081     FORCE_INDEX_ASET  = 0x001,  
00082     FORCE_INDEX_BSET  = 0x002,  
00083     FORCE_INDEX_BOND  = 0x004,  
00085     FORCE_INDEX_ANGLE = 0x008,  
00087     FORCE_INDEX_DIHED = 0x010,  
00089     FORCE_INDEX_IMPR  = 0x020,  
00091     FORCE_INDEX_BRES  = 0x040,  
00092     FORCE_INDEX_TOTAL = 0x080   
00093   };
00094 
00095 
00096   enum ForceVirial_t {
00097     FORCE_VIRIAL_XX = 0,  
00098     FORCE_VIRIAL_XY,      
00099     FORCE_VIRIAL_XZ,      
00100     FORCE_VIRIAL_YX,      
00101     FORCE_VIRIAL_YY,      
00102     FORCE_VIRIAL_YZ,      
00103     FORCE_VIRIAL_ZX,      
00104     FORCE_VIRIAL_ZY,      
00105     FORCE_VIRIAL_ZZ       
00106   };
00107 
00108 
00111   struct Force_t {
00112     ForceParam *param;        
00113     ForceSelect *select;      
00114     ForceDomain *domain;      
00116     /* needed to support efficient atom selection */
00117     int32 *idmap;             
00120     int32 *mapnb;             
00125     int32 *atom_bond_sel;     
00126     int32 *atom_angle_sel;    
00127     int32 *atom_dihed_sel;    
00128     int32 *atom_impr_sel;     
00129     int32 *abset_sel;         
00130     int32 *total_sel;         
00132     int32 atom_bond_sel_len;  
00133     int32 atom_angle_sel_len; 
00134     int32 atom_dihed_sel_len; 
00135     int32 atom_impr_sel_len;  
00136     int32 abset_sel_len;      
00137     int32 total_sel_len;      
00139     int32 is_alloc_sel;       
00141     /* alternate buffer space */
00142     double u_buffer;          
00143     double *e_buffer;         
00146     MD_Dvec *f_buffer;        
00148     /* arrays for transformed positions and periodic image wrapping */
00149     MD_Dvec *trpos;           
00153     MD_Dvec *poswrap;         
00158     /* constants derived from ForceParam object */
00159     double elec_const;        
00160     double elec_cutoff2;      
00161     double inv_elec_cutoff2;  
00162     double ewald_grad_coef;   
00163     double vdw_cutoff2;       
00164     double switch_dist2;      
00165     double inv_denom_switch;  
00167     ForceVdwparam *vdwparam;  
00170     ForceBucksafe *bucksafe;  
00174     /* define domain for system */
00175     MD_Dvec v1, v2, v3;       
00176     double lv1, lv2, lv3;     
00177     MD_Dvec nv1, nv2, nv3;    
00179     MD_Dvec center;           
00180     MD_Dvec lowerc;           
00182     MD_Dvec ta1, ta2, ta3;    
00185     MD_Dvec offset_table[27]; 
00188     double volume;            
00190     int32 is_periodic;        
00191     int32 is_orthogonal;      
00194     /* algorithmically motivated parameters */
00195     double domain_len_frac;   
00200     int32 max_steps;          
00202     int32 cnt_steps;          
00204     int32 is_domain_update;   
00208     /* compute min/max for scaled coordinates */
00209     int32 is_minmax;
00210     MD_Dvec smin, smax;
00211 
00212     /* using a lattice fixed in space */
00213     int32 is_fixed_lattice;   
00214     int32 k1, k2, k3;         
00216     MD_Dvec dv1, dv2, dv3;    
00218     MD_Dvec tb1, tb2, tb3;    
00221     /* for geometric hashing to grid cells */
00222     double ucellsize;         /* grid cell length along u vector */
00223     double vcellsize;         /* grid cell length along v vector */
00224     double wcellsize;         /* grid cell length along w vector */
00225     double inv_ucellsize;     /* 1/ucellsize */
00226     double inv_vcellsize;     /* 1/vcellsize */
00227     double inv_wcellsize;     /* 1/wcellsize */
00228 
00229     MD_Dvec lowcell;   
00232     MD_Dvec delta;     
00234     MD_Dvec gscale;    
00237     ForceCell *cell;   /* array of grid cells */
00238     int32 maxcells;    /* maximum allocation for optimal resizing */
00239     int32 ncells;      /* number of cells in array: nucells*nvcells*nwcells */
00240     int32 nucells;     /* number of cells in u direction */
00241     int32 nvcells;     /* number of cells in v direction */
00242     int32 nwcells;     /* number of cells in w direction */
00243 
00244     int32 *next;       /* array of next atoms/hgroups for cursor link list */
00245 
00246     /* for using pairlists */
00247     double outer_cutoff2;
00248     double delta_dis2;
00249     MD_Dvec *pos_init;
00250     MD_Dvec *wrap_save;
00251     ForcePairlist *pairlist;
00252     int32 pairlist_set_id;
00253     int32 need_pairlist_regen;
00254 
00255     /* for nonbonded pairwise interaction exclusions */
00256     int32 **excl_list;        
00257     int32 **scaled14_list;    
00259     /* helper arrays for building exclusion lists */
00260     int32 **exclx;     
00261     int32 **excl12;    
00262     int32 **excl13;    
00263     int32 **excl14;    
00264     int32 **scaled14;  
00265     int32 *lenx;       
00266     int32 *len12;      
00267     int32 *len13;      
00268     int32 *accum;      
00269     int32 *dest;       
00271     /* for boundary restraints */
00272     int32 is_bres_term1;  
00273     int32 is_bres_term2;  
00274     double sq_minradius;  
00275     double minlength;     
00277   };
00278 
00279 
00280 #ifdef __cplusplus
00281 }
00282 #endif
00283 
00284 #endif /* DEFN_H */

Generated on Thu Feb 7 18:11:40 2008 for MDX by  doxygen 1.3.9.1