From: hackbard Date: Fri, 24 Nov 2006 13:43:15 +0000 (+0000) Subject: more changes ... X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c65282d51589acb2f08631c7a7920cb70a46a5c;p=physik%2Fposic.git more changes ... --- diff --git a/moldyn.c b/moldyn.c index 14ae320..8b80242 100644 --- a/moldyn.c +++ b/moldyn.c @@ -56,10 +56,6 @@ int moldyn_usage(char **argv) { int moldyn_parse_argv(t_moldyn *moldyn,int argc,char **argv) { int i; - t_ho_params hop; - t_lj_params ljp; - t_tersoff_params tp; - double s,e; memset(moldyn,0,sizeof(t_moldyn)); @@ -68,7 +64,6 @@ int moldyn_parse_argv(t_moldyn *moldyn,int argc,char **argv) { moldyn->tau=MOLDYN_TAU; moldyn->time_steps=MOLDYN_RUNS; moldyn->integrate=velocity_verlet; - moldyn->potential_force_function=lennard_jones; /* parse argv */ for(i=1;ipotential_force_function(moldyn); + for(sched=0;schedschedule.content_count;sched++) { + moldyn->tau=; + moldyn->tau_square=; + + // hier weiter ... + for(i=0;itime_steps;i++) { /* integration step */ diff --git a/moldyn.h b/moldyn.h index 0a6b4f2..1df6dfa 100644 --- a/moldyn.h +++ b/moldyn.h @@ -13,12 +13,16 @@ #include "list/list.h" -/* datatypes */ +/* + * + * datatypes + * + */ +/* general */ typedef unsigned char u8; /* the atom of the md simulation */ - typedef struct s_atom { t_3dvec r; /* position */ t_3dvec v; /* velocity */ @@ -37,7 +41,6 @@ typedef struct s_atom { #define ATOM_ATTR_3BP 0x40 /* 3 body potential */ /* cell lists */ - typedef struct s_linkcell { int nx,ny,nz; /* amount of cells in x, y and z direction */ int cells; /* total amount of cells */ @@ -50,10 +53,17 @@ typedef struct s_linkcell { #include "visual/visual.h" -# moldyn structure */ +# moldyn schedule structure */ +typedef struct s_moldyn_schedule { + int content_count; + int *runs; + int *tau; + int (*hook)(t_moldyn *,void *); + void *hook_params; +} t_moldyn_schedule; +/* moldyn main structure */ typedef struct s_moldyn { - int count; /* total amount of atoms */ t_atom *atom; /* pointer to the atoms */ @@ -75,16 +85,21 @@ typedef struct s_moldyn { double t; /* temperature */ + /* simulation schedule */ + t_moldyn_schedule schedule; + int current; /* current position in schedule */ + /* integration function pointer */ int (*integrate)(struct s_moldyn *moldyn); int time_steps; /* amount of iterations */ double tau; /* delta t */ double tau_square; /* delta t squared */ + double elapsed; /* total elapsed time */ double energy; /* energy */ t_visual vis; /* visualization/log/save interface structure */ - u8 lvstat; /* log & vis properties */ + u8 lvstat; /* log & vis properties */ unsigned int ewrite; /* how often to log energy */ char efb[64]; /* energy log filename */ int efd; /* fd for energy log */ @@ -96,7 +111,7 @@ typedef struct s_moldyn { void *visual; /* pointer (hack!) */ unsigned int swrite; /* how often to create a save file */ - u8 status; /* general moldyn properties */ + u8 status; /* general moldyn properties */ t_random random; /* random interface */ } t_moldyn; @@ -111,19 +126,37 @@ typedef struct s_moldyn { #define MOLDYN_STAT_PBY 0x10 /* y */ #define MOLDYN_STAT_PBZ 0x20 /* and z direction */ + +/* + * + * potential parameter structures + * + */ + +/* + * harmonic oscillator potential parameter structure + */ + typedef struct s_ho_params { double spring_constant; double equilibrium_distance; } t_ho_params; +/* + * lennard jones potential parameter structure + */ + typedef struct s_lj_params { double sigma6; double sigma12; double epsilon4; } t_lj_params; -/* tersoff exchange structure to exchange 2bp and 3bp calculated values */ +/* + * tersoff + */ +/* tersoff exchange structure to exchange 2bp and 3bp calculated values */ typedef struct s_tersoff_exchange { double f_c,df_c; @@ -151,7 +184,6 @@ typedef struct s_tersoff_exchange { } t_tersoff_exchange; /* tersoff multi (2!) potential parameters */ - typedef struct s_tersoff_mult_params { double S[2]; /* tersoff cutoff radii */ double R[2]; /* tersoff cutoff radii */ @@ -177,15 +209,19 @@ typedef struct s_tersoff_mult_params { t_tersoff_exchange exchange; /* exchange between 2bp and 3bp calc */ } t_tersoff_params; + + /* + * * defines + * */ -/* general defines */ +/* default values */ #define MOLDYN_TEMP 273.0 #define MOLDYN_TAU 1.0e-15 -#define MOLDYN_CUTOFF 10.0e-9 +#define MOLDYN_CUTOFF 1.0e-9 #define MOLDYN_RUNS 1000000 #define MOLDYN_INTEGRATE_VERLET 0x00 @@ -193,9 +229,18 @@ typedef struct s_tersoff_mult_params { #define MOLDYN_POTENTIAL_HO 0x00 #define MOLDYN_POTENTIAL_LJ 0x01 -#define MOLDYN_POTENTIAL_DEFAULT MOLDYN_POTENTIAL_LJ +#define MOLDYN_POTENTIAL_TM 0x02 -/* phsical values */ +#define MOLDYN_SET_POTENTIAL 0x00 +#define MOLDYN_SET_ +#define MOLDYN_SET_ +#define MOLDYN_SET_ + +/* + * + * phsical values / constants + * + */ #define K_BOLTZMANN 1.3807e-27 /* Nm/K */ #define AMU 1.660540e-27 /* kg */ @@ -212,7 +257,12 @@ typedef struct s_tersoff_mult_params { #define LJ_SIGMA_SI ((0.25*sqrt(3.0)*LC_SI)/1.122462) /* m */ #define LJ_EPSILON_SI (2.1678*1.60e-19) /* Nm */ -/* function prototypes */ + +/* + * + * function prototypes + * + */ int moldyn_usage(char **argv); int moldyn_parse_argv(t_moldyn *moldyn,int argc,char **argv); diff --git a/posic.c b/posic.c index d53af6f..cd1a2e2 100644 --- a/posic.c +++ b/posic.c @@ -18,15 +18,15 @@ int main(int argc,char **argv) { t_moldyn md; + t_lj_params lj; + t_ho_params ho; + t_tersoff_mult_params tp; + int a,b,c; double e; double help; t_3dvec p; - t_lj_params lj; - t_ho_params ho; - t_tersoff_params tp; - /* * moldyn init *