/*
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