📄 particle.h
字号:
#ifndef __PARTICLE_H#define __PARTICLE_H/* 8 Oct 91 : added member to particle structure "rmin" for use by bond.c (bond.c calculates number of atoms with bond between rmin and cutoff).*//************************************************************************Defines************************************************************************/#define TRUE 1#define FALSE 0#define X 0#define Y 1#define Z 2#define NDIR 3#define WORD unsigned int#define BYTE unsigned char#define USHORT unsigned short int#define SEL_T unsigned short#define BOOLEAN int#define COORD double (*)[NDIR]/* Voight constants */#define XX 0#define YY 1#define ZZ 2#define YZ 3#define ZX 4#define XY 5#define ZY 3#define XZ 4#define YX 5#define NVOIGHT 6/* LENGTH OF TITLE STRING */#define NTITLESTR 81/* Different type of dynamic volume conditions */#define BMG_ISOTROPIC 0#define BMG_ORTHORHOMBIC 1#define BMG_MONOCLINIC 2/* Constant pressure algorithms */#define BMA_NONE 0#define BMA_ANDERSEN 1#define BMA_CLAMP 2#define BMA_MODIFIED 3/* Repeating boundary geometries */#define BD_ORTHORHOMBIC 1 /* Standard box boundary */#define BD_MONOCLINIC 2 /* Parallel-piped boundary */#define BC_ARC 3 /* Curved "race track" boundary *//* Define number of derivatives in Gear algorithm */#define NDERIV 6/* Maximum number of type names */#define MAX_TYPE_NAMES 32/* Selection values */#define MAX_SET 12#define MASK_SELECT 0x8000#define MASK_FIX 0x4000#define MASK_CLAMP 0x3000#define NUM_CLAMP_TAG 4/*************************************************************************Macros*************************************************************************/#define CLEAR_ALL_FLAGS(INDEX) {a->Selection[INDEX]=0;}#define IS_SELECT(INDEX) ((a->Selection[INDEX] & MASK_SELECT)!=0)#define REMOVE_SELECT(INDEX) {a->Selection[INDEX] &= ~MASK_SELECT;}#define APPLY_SELECT(INDEX) {a->Selection[INDEX] |= MASK_SELECT;}#define IS_SELECT2(SEL,INDEX) ((SEL[INDEX] & MASK_SELECT)!=0)#define APPLY_SELECT2(SEL,INDEX) {SEL[INDEX] |= MASK_SELECT;}#define REMOVE_SELECT2(SEL,INDEX) {SEL[INDEX] &= ~MASK_SELECT;}#define IS_FIX(INDEX) ((a->Selection[INDEX] & MASK_FIX)!=0)#define REMOVE_FIX(INDEX) {a->Selection[INDEX] &= ~MASK_FIX;}#define APPLY_FIX(INDEX) {a->Selection[INDEX] |= MASK_FIX;}#if 0#define IS_CLAMP(INDEX) ((a->Selection[INDEX] & MASK_CLAMP1)!=0)#define REMOVE_CLAMP(INDEX) {a->Selection[INDEX] &= ~MASK_CLAMP1;}#define APPLY_CLAMP(INDEX) {a->Selection[INDEX] |= MASK_CLAMP1;}#endif#define IS_CLAMP_TAG(INDEX,TAG) \ ((a->Selection[INDEX] & MASK_CLAMP)==(TAG<<MAX_SET))#define APPLY_CLAMP_TAG(INDEX,TAG) \{ \a->Selection[INDEX] &= ~MASK_CLAMP; \a->Selection[INDEX] |= (TAG << MAX_SET); \}#define GET_CLAMP_TAG(INDEX) \((a->Selection[INDEX] & MASK_CLAMP) >> MAX_SET)#define IS_SET(INDEX,SET) ((a->Selection[INDEX] & (1<<(SET-1)))!=0)#define REMOVE_SET(INDEX,SET) {a->Selection[INDEX] &= ~(1 << (SET-1));}#define APPLY_SET(INDEX,SET) {a->Selection[INDEX] |= (1 << (SET-1));}/*************************************************************************Type Definitions*************************************************************************//* * At some point use this to replace some double * types May 19, 1998 **//* Coordinate type */typedef double Coord_t[NDIR];/* Particle constaint */typedef struct { double xd,yd,zd, xp,yp,zp; /* POINT AND DIRECTION */ int type; /* TYPE OF CONSTRAIN 0-line 1-Plane */ } Constraint_t;/*External vector and coordinate origin storageUsed for both external force and spring*/typedef struct { double Origin[NDIR]; double Vector[NDIR]; } ExternalVector_t;/* Particle Information */typedef struct { /* Particle Coordinate arrays */ double *cur, *ref, *ngh; /* current, origin, neighbor */ double *v, *f; /* velocity, force */ double *c2,*c3,*c4,*c5; /* gear integration values */ double *disp; /* Particle displacements */ /* Particle Misc Info */ double *mass; /* mass/atom */ double *eatom; /* energy/atom */ BYTE *type, *rtype; /* type */ /* Constraints */ Constraint_t **cons; /* constraint */ double CavityCenter[NDIR]; double CavityAxis [NDIR]; double CavitySpring; BOOLEAN UseCavity; /* Particle Status Arrays */ BYTE *tag;#if 0 BYTE *sel, *tag, *set, *fix;#endif SEL_T *Selection; /* Type Names (such as "Fe", "Na", etc) */ char *TypeNames[MAX_TYPE_NAMES]; double bcur [NDIR]; double bref [NDIR]; double trans[NDIR]; /* Array storing poiners to external force and spring info */ ExternalVector_t **SpringPtrList; ExternalVector_t **ForcePtrList; /* Array storing damping coefficient */ BOOLEAN UseDamp; double *Damp; /* Array for storing neighbor list */ int *NeighborListIndex; int *NeighborListLength; int *NeighborList; int TotalNumNeighbors; /* Initialization flag */ BOOLEAN IsInitializedBox; BOOLEAN IsInitializedCoord; BOOLEAN IsInitializedMass; BOOLEAN IsInitializedPotential; BOOLEAN IsInitializedSurface; BOOLEAN selkeep;#if 0 /* Flags */ BOOLEAN boxflag, coordflag, selkeep;#endif /* Neighbor List Flag */ BOOLEAN InvalidNeighborList; /* Neighbor Type Flag */ BOOLEAN CalcUniqueNeighbors; /* Surface Flag */ int surf[3]; /* Lattice Energies */ double ebath, etot, temp, epot, ekin; /* Average potential energy (used by cdmc.c) */ double epavg; long navg; /* Internal Stresses */ double Stress[NVOIGHT]; /* Variables needed for changing volume */ /* Either isotropic, othrnormal or monoclinic */ int BoxMotionGeometry; /* Either BMA_NONE, ..ANDERSEN, ..CLAMP */ int BoxMotionAlgorithm; double Pressure [NDIR]; double EkinBox [NDIR]; double EpotBox; double BoxMotion[NDIR][NDERIV]; double BoxForce [NDIR]; double BoxMass [NDIR]; /* Repeating Boundary Geometry */ int BoundaryType; /* If using monoclinic boundary type, then need metric */ double BoundaryMetric [NDIR][NDIR]; double BoundaryInvMetric[NDIR][NDIR]; /* Number of particles */ int np; /* Number of neighbors */ int ng; /* Number of selected particles */ int nsel; /* Number of fixed particles */ int nfix; int nbin; char title[8][NTITLESTR]; long run, step; int ndim; double time, tempc, dtime, size, cutoff, rmin, vibp; double rdftable[100]; /* Clamp info */ BOOLEAN UseClamp [NUM_CLAMP_TAG]; double ClampTemp[NUM_CLAMP_TAG]; double ClampStep[NUM_CLAMP_TAG]; /* Volume clamp info */ double VolClampStep; double BulkModulus; /* Allocation info */ WORD NumNeighAlloc; WORD NumPartAlloc; /* Degrees of freedom */ int DegFree; /* Thermal stress switch */ BOOLEAN stress_thermal; } Particle_t;#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -