[go: up one dir, main page]

Menu

[r4]: / trunk / src / cdsubs.h  Maximize  Restore  History

Download this file

338 lines (282 with data), 9.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
/*
xmd - molecular dynamics for metals and ceramics
By Jonathan Rifkin <jon.rifkin@uconn.edu>
Copyright 1995-2004 Jonathan Rifkin
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __CDSUBS_H
#define __CDSUBS_H
/*
************************************************************************
Includes
************************************************************************
*/
#include <stdio.h>
#include "particle.h"
/*
************************************************************************
Defines
************************************************************************
*/
#define FALSE 0
#define TRUE 1
#define NFILE 10
#define NPL 20 /* INITIAL MAXIMUM NUMBER OF PARTICLES */
#define NGL 100 /* INITIAL MAXIMUM LENGTH OF NEIGHBOR LIST */
#define NTYPE 10 /* MAXIMUM NUMBER OF PARTICLE TYPES */
#define NSTR 256
/* BOLTZMANN'S CONSTANT (IN ergs/K) */
#define BK 1.38e-16
/* 1/BK */
#define K 7.246377e15
/* Atoms per mole */
#define AVAG 6.022e23
/* Cm per Angstom */
#define ANGS 1.0e-8
/* Angstroms per Cm */
#define CM 1.0e+8
/* Ergs to Joules */
#define JOULE 1.0e-7
/* Ergs to Electron Volts */
#define EV 6.24196e11
/* Ergs to Hartrees */
#define HARTREE (1.0/4.3596e-11)
/* erg/cm^3 to MBAR */
#define MBAR 1e-12
/* Constraint types */
#define CONSTR_LINE 0
#define CONSTR_PLANE 1
/* Neighbor Search Types */
#define NEIGH_SEARCH_SORT 0
#define NEIGH_SEARCH_CELL 1
#define NEIGH_SEARCH_CELL2 2
/*
************************************************************************
Type Definitions
************************************************************************
*/
/* Structure for printing output every n steps */
typedef struct
{
char FileName[80];
FILE *File;
BOOLEAN Save;
BOOLEAN IsFileNew;
int StepIncrement;
int CurrentStep;
}
StepOutput_t;
/* SIMULATION CONTROL */
typedef struct
{
double tempc, cutoff, cutmin, uratio, size;
double dtime, cstep;
int nrej, nacc, nstep;
int quench, echo;
char eulabel[20];
double eunit;
unsigned seed;
int nsearch;
/* esave flag and file */
#if 0
char ename[80];
int eflag, estep, eistep, efilenew;
#endif
/* Periodic Step Output */
StepOutput_t EnergyStepOutput;
StepOutput_t BoxStepOutput;
StepOutput_t StressStepOutput;
StepOutput_t TrajectoryStepOutput;
/* force, integrate and energy subroutine pointers */
void *forcepnt;
void *energylistpnt;
void *FreePotPtr;
/* Debug flag */
int debug;
/* Stop signal */
int signal;
/* Potential Name */
char pottype[10];
/* Compare Info */
BOOLEAN UseCompare;
BOOLEAN UseInverseCompare;
BOOLEAN NewCompareFile;
char CompareFileName[NSTR];
double CompareRadius;
double CompareEnergy;
/* Calculate stress of selected atoms only */
BOOLEAN UseSelectStress;
/* Have WRITE ?? commands omitt comments in output stream */
BOOLEAN UseVerboseOutputFile;
/* Shut off non-critical messages like *** NUMBER SELECT */
BOOLEAN PrintInfo;
}
Simulation_t;
/* Function type for passing algorithm routines (through simulation) */
typedef void PotFree_f (void);
typedef void PotForce_f (Particle_t *, Simulation_t * );
typedef void PotEnergy_f (Particle_t *, Simulation_t *, int);
/*
************************************************************************
Function Prototypes
************************************************************************
*/
void initrand (unsigned);
double randfloat(void );
void init(void);
/* 27 Mar 1992 - replaced with call to sortfx in sortsub.c */
/*
void sort (double *, int *, int, int);
*/
#if 0
double sqr (double);
void copy_coord (int, double *, double *);
#endif
void PrintWrapWarning(int);
void energy_all (Particle_t *, Simulation_t *, int);
void runmc (Particle_t *, Simulation_t *, int, double);
void runcmd (Particle_t *, Simulation_t *, int );
/* Kinetic Energy (from cdmd.c) */
void CalcKineticEnergy (Particle_t *, Simulation_t *);
double GetTemperature (Particle_t *, Simulation_t *, BOOLEAN );
double GetKE (Particle_t *, Simulation_t *, BOOLEAN );
/* Simulation Statistics */
long GetNumberOfMDSteps(void);
double GetElapsedMDTime (void);
long GetNumNeighborSearchCalls (void);
double GetElapsedNeighborSearchTime (void);
/* STATE FUNCTIONS */
void writestate (Particle_t *, Simulation_t *, char *);
int readstate (Particle_t **, Simulation_t *, char *);
void dumpstate (char *);
/* Quartic Potential Routines */
void qu_energy_list (Particle_t *, Simulation_t *, int);
void qu_calcforc (Particle_t *, Simulation_t * );
void qu_read_potential (char *, char *);
/* Tersoff Potential Routines */
void csi_energy_list (Particle_t *, Simulation_t *, int);
void csi_calcforc (Particle_t *, Simulation_t * );
void csi_read_potential (char *, char *);
/* Stillinger-Weber Potential Routines */
void stil_energy_list (Particle_t *, Simulation_t *, int);
void stil_calcforc (Particle_t *, Simulation_t * );
void stil_read_potential (char *, char *);
void STILL_Parse (char *);
void STILL_Init (char *);
/* EAM Potential Routines */
void em_energy_list (Particle_t *, Simulation_t *, int);
void em_calcforc (Particle_t *, Simulation_t * );
void em_read_potential (char *, char *);
/* PAIR Potential Routines */
void pr_energy_list (Particle_t *, Simulation_t *, int);
void pr_calcforc (Particle_t *, Simulation_t * );
void pr_read_potential (char *, char *);
/* ION Potential Routines */
void io_energy_list (Particle_t *, Simulation_t *, int);
void io_calcforc (Particle_t *, Simulation_t * );
void io_read_potential (char *, char *);
void read_command (char *, int *);
int GetNumberOfCommandErrors (void);
int GetNumberOfWarnings (void);
void IncrementNumberOfWarnings(void);
/* Vector functions */
#if 0
double GetMagnitude(double [NDIR]);
double GetDot (double [NDIR], double [NDIR]);
void Normalize (double [NDIR]);
void CalcCross (double [NDIR], double [NDIR], double [NDIR]);
void Orthogonalize (double [NDIR], double [NDIR]);
#endif
void read_allocate (char *);
void read_bond (char *);
void read_box (char *);
void read_bsave (char *);
void read_calc (char *);
void read_clamp (char *);
void read_cmd (char *);
void read_compare (char *);
void read_constrain (char *);
void read_cor (char *);
void read_damp (char *);
void read_debug (char *);
void read_disp (char *);
void read_dtime (char *);
void read_dup (char *);
void read_echo (char *);
void read_erase (char *);
void read_esave (char *);
void read_eunit (char *);
void read_extforce (char *);
void read_extspring (char *);
void read_fill (char *);
void read_fix (char *);
void read_itemp (char *);
void read_label (char *);
void read_macro (char *);
void read_macrof (char *);
void read_mass (char *);
void read_mc (char *);
void read_move (char *);
void read_nrange (char *);
void read_nsearch (char *);
void read_particle (char *);
void read_posvel (char *);
void read_potential (char *);
void read_pressure (char *);
void read_pstrain (char *);
void read_quench (char *);
void read_rcv (char *);
void read_read (char *);
void read_refstep (char *);
void read_remove (char *);
void read_repeat (char *);
void read_rotate (char *);
void read_run (char *);
void read_scale (char *);
void read_screw (char *);
void read_seed (char *);
void read_select (char *);
void read_set (char *);
void read_size (char *);
void read_ssave (char *);
void read_state (char *);
void read_step (char *);
void read_surface (char *);
void read_velocity (char *);
void read_tag (char *);
void read_tsave (char *);
void read_type (char *);
void read_typelist (char *);
void read_typename (char *);
void read_verbose (char *);
void read_wave (char *);
void read_write (char *);
void error_msg (int, char *);
void x (char *, ...);
void CheckForNoneSelected(void);
/* Function for including atom coordinates symbollically */
void EvaluateFormula
(
char *InputFormula,
double *InputValues,
double InputConversion,
double *OutputValues,
double OutputConversion,
int NumOutput
);
void UpdateNeighborList(Particle_t *);
void AddMacro (char *, char *);
void ReplaceMacro (char *OutputStr, int MaxLen);
int GetTotalDOF (Particle_t *);
void GetMinMaxCoord(Particle_t *, double[NDIR], double[NDIR], BOOLEAN, BOOLEAN);
#endif