/* potential force function and parameter pointers */
int (*func1b)(struct s_moldyn *moldyn,t_atom *ai);
int (*func2b)(struct s_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc);
- int (*func2b_post)(struct s_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc);
- int (*func3b)(struct s_moldyn *moldyn,t_atom *ai,t_atom *aj,t_atom *ak,
- u8 bck);
+ int (*func3b_j1)(struct s_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc);
+ int (*func3b_j2)(struct s_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc);
+ int (*func3b_j3)(struct s_moldyn *moldyn,t_atom *ai,t_atom *aj,u8 bc);
+ int (*func3b_k1)(struct s_moldyn *moldyn,
+ t_atom *ai,t_atom *aj,t_atom *ak,u8 bck);
+ int (*func3b_k2)(struct s_moldyn *moldyn,
+ t_atom *ai,t_atom *aj,t_atom *ak,u8 bck);
void *pot_params;
- //int (*potential_force_function)(struct s_moldyn *moldyn);
+ unsigned char run3bp;
double cutoff; /* cutoff radius */
double cutoff_square; /* square of the cutoff radius */
double t_ref; /* reference temperature */
double t; /* actual temperature */
+ double t_sum; /* sum over all t */
+ double mean_t; /* mean value of t */
+
+ t_virial virial; /* global virial (absolute coordinates) */
+ double gp; /* pressure computed from global virial */
+ double gp_sum; /* sum over all gp */
+ double mean_gp; /* mean value of gp */
double p_ref; /* reference pressure */
double p; /* actual pressure (computed by virial) */
+ double p_sum; /* sum over all p */
+ double mean_p; /* mean value of p */
t_3dvec tp; /* thermodynamic pressure dU/dV */
double dv; /* dV for thermodynamic pressure calc */
double tau; /* delta t */
double time; /* absolute time */
double tau_square; /* delta t squared */
- double elapsed; /* total elapsed time */
+ int total_steps; /* total steps */
double energy; /* potential energy */
double ekin; /* kinetic energy */
int efd; /* fd for energy log */
unsigned int mwrite; /* how often to log momentum */
int mfd; /* fd for momentum log */
+ unsigned int pwrite; /* how often to log pressure */
+ int pfd; /* fd for pressure log */
+ unsigned int twrite; /* how often to log temperature */
+ int tfd; /* fd for temperature log */
unsigned int vwrite; /* how often to visualize atom information */
unsigned int swrite; /* how often to create a save file */
int rfd; /* report file descriptor */
char rtitle[64]; /* report title */
char rauthor[64]; /* report author */
- int pfd; /* gnuplot script file descriptor */
+ int epfd; /* energy gnuplot script file descriptor */
+ int ppfd; /* pressure gnuplot script file descriptor */
+ int tpfd; /* temperature gnuplot script file descriptor */
u8 status; /* general moldyn properties */
#define P_SCALE_DIRECT 0x08 /* direct p control */
/*
- * default values
+ * default values & units
*
* - length unit: 1 A (1 A = 1e-10 m)
* - time unit: 1 fs (1 fs = 1e-15 s)
#define KILOGRAM (1.0/AMU) /* amu */
#define NEWTON (METER*KILOGRAM/(SECOND*SECOND)) /* A amu / fs^2 */
#define PASCAL (NEWTON/(METER*METER)) /* N / A^2 */
-#define ATM ((1.0133e5*PASCAL)) /* N / A^2 */
+#define BAR ((1.0e5*PASCAL)) /* N / A^2 */
+#define K_BOLTZMANN (1.380650524e-23*METER*NEWTON) /* NA/K */
+#define EV (1.6021765314e-19*METER*NEWTON) /* NA */
#define MOLDYN_TEMP 273.0
#define MOLDYN_TAU 1.0
#define LOG_TOTAL_ENERGY 0x01
#define LOG_TOTAL_MOMENTUM 0x02
-#define SAVE_STEP 0x04
-#define VISUAL_STEP 0x08
-#define CREATE_REPORT 0x10
+#define LOG_PRESSURE 0x04
+#define LOG_TEMPERATURE 0x08
+#define SAVE_STEP 0x10
+#define VISUAL_STEP 0x20
+#define CREATE_REPORT 0x40
#define TRUE 1
#define FALSE 0
#define QUIET 0
/*
- *
- * phsical values / constants
- *
+ * potential related phsical values / constants
*
*/
#define ONE_THIRD (1.0/3.0)
-#define K_BOLTZMANN (1.380650524e-23*METER*NEWTON) /* NA/K */
-#define EV (1.6021765314e-19*METER*NEWTON) /* NA */
-
#define C 0x06
+#define LC_C (0.3567e-9*METER) /* A */
#define M_C 12.011 /* amu */
#define SI 0x0e
#define LC_SI (0.543105e-9*METER) /* A */
#define M_SI 28.08553 /* amu */
+#define LC_3C_SIC (0.43596e-9*METER) /* A */
+
#define LJ_SIGMA_SI ((0.25*sqrt(3.0)*LC_SI)/1.122462) /* A */
//#define LJ_SIGMA_SI (LC_SI/1.122462) /* A */
//#define LJ_SIGMA_SI (0.5*sqrt(2.0)*LC_SI/1.122462) /* A */
#define TM_CHI_SIC 0.9776
+#define TM_LC_3C_SIC (0.432e-9*METER) /* A */
+
/*
* lattice constants
*/
*
*/
-typedef int (*pf_func1b)(t_moldyn *,t_atom *ai);
-typedef int (*pf_func2b)(t_moldyn *,t_atom *,t_atom *,u8 bc);
-typedef int (*pf_func2b_post)(t_moldyn *,t_atom *,t_atom *,u8 bc);
-typedef int (*pf_func3b)(t_moldyn *,t_atom *,t_atom *,t_atom *,u8 bc);
+typedef int (*pf_func1b)(t_moldyn *,t_atom *);
+typedef int (*pf_func2b)(t_moldyn *,t_atom *,t_atom *,u8);
+typedef int (*pf_func3b)(t_moldyn *,t_atom *,t_atom *,t_atom *,u8);
int moldyn_init(t_moldyn *moldyn,int argc,char **argv);
int moldyn_shutdown(t_moldyn *moldyn);
int set_pbc(t_moldyn *moldyn,u8 x,u8 y,u8 z);
int set_potential1b(t_moldyn *moldyn,pf_func1b func);
int set_potential2b(t_moldyn *moldyn,pf_func2b func);
-int set_potential2b_post(t_moldyn *moldyn,pf_func2b_post func);
-int set_potential3b(t_moldyn *moldyn,pf_func3b func);
+int set_potential3b_j1(t_moldyn *moldyn,pf_func2b func);
+int set_potential3b_j2(t_moldyn *moldyn,pf_func2b func);
+int set_potential3b_j3(t_moldyn *moldyn,pf_func2b func);
+int set_potential3b_k1(t_moldyn *moldyn,pf_func3b func);
+int set_potential3b_k2(t_moldyn *moldyn,pf_func3b func);
int set_potential_params(t_moldyn *moldyn,void *params);
int moldyn_set_log_dir(t_moldyn *moldyn,char *dir);
int moldyn_log_shutdown(t_moldyn *moldyn);
int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element,double mass,
- u8 attr,u8 brand,int a,int b,int c);
+ u8 attr,u8 brand,int a,int b,int c,t_3dvec *origin);
int cubic_init(int a,int b,int c,double lc,t_atom *atom,t_3dvec *origin);
int fcc_init(int a,int b,int c,double lc,t_atom *atom,t_3dvec *origin);
int diamond_init(int a,int b,int c,double lc,t_atom *atom,t_3dvec *origin);
int scale_dim(t_moldyn *moldyn,double scale,u8 x,u8 y,u8 z);
int scale_atoms(t_moldyn *moldyn,double scale,u8 x,u8 y,u8 z);
-double get_e_kin(t_moldyn *moldyn);
-double update_e_kin(t_moldyn *moldyn);
+double e_kin_calc(t_moldyn *moldyn);
double get_total_energy(t_moldyn *moldyn);
t_3dvec get_total_p(t_moldyn *moldyn);