From 0d1dfb1e5027d215fced8ca306dd658f692a2a44 Mon Sep 17 00:00:00 2001 From: hackbard Date: Tue, 29 Apr 2008 17:01:45 +0200 Subject: [PATCH] unstable but might run ... --- bond_analyze.c | 3 +++ config.default | 4 ++-- mdrun.c | 23 +++++++++++---------- moldyn.c | 18 +++++++++-------- moldyn.h | 2 ++ pair_correlation_calc.c | 3 +++ runmd | 37 ++++++++++++++++++++++++++++++++++ runmd_rx200 | 44 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 112 insertions(+), 22 deletions(-) create mode 100755 runmd create mode 100755 runmd_rx200 diff --git a/bond_analyze.c b/bond_analyze.c index cc1c318..6c46251 100644 --- a/bond_analyze.c +++ b/bond_analyze.c @@ -49,6 +49,9 @@ int main(int argc,char **argv) { set_potential(&moldyn,MOLDYN_POTENTIAL_AM); albe_mult_set_params(&moldyn,SI,C); + /* link cell init */ + link_cell_init(&moldyn,VERBOSE); + /* analyzing ... */ bond_analyze(&moldyn,quality); diff --git a/config.default b/config.default index d63e401..74e4997 100644 --- a/config.default +++ b/config.default @@ -20,7 +20,7 @@ pbc 1 1 1 ## temperature / pressure ## -temperature -273.0 +temperature 0.0 pressure 0.0 ## initial lattice ## @@ -29,7 +29,7 @@ lattice diamond #lattice zincblende element1 14 element2 6 -fill lc 9 9 9 +fill lc 9 9 9 5.429 ## atom attributes ## diff --git a/mdrun.c b/mdrun.c index 63899a6..8c5cf71 100644 --- a/mdrun.c +++ b/mdrun.c @@ -140,7 +140,7 @@ int mdrun_parse_config(t_mdrun *mdrun) { char *wptr; char word[16][32]; int wcnt; - int i; + int i,o; t_insert_atoms_params iap; t_continue_params cp; @@ -255,6 +255,7 @@ int mdrun_parse_config(t_mdrun *mdrun) { mdrun->lx=atoi(word[2]); mdrun->ly=atoi(word[3]); mdrun->lz=atoi(word[4]); + mdrun->lc=atof(word[5]); } else if(!strncmp(word[0],"aattr",5)) { // for aatrib line we need a special stage @@ -274,7 +275,7 @@ int mdrun_parse_config(t_mdrun *mdrun) { break; } } - i=1; + i=2; if(cap.type&CHAATTR_REGION) { cap.x0=atof(word[1]); cap.y0=atof(word[2]); @@ -288,9 +289,8 @@ int mdrun_parse_config(t_mdrun *mdrun) { cap.element=atoi(word[i]); i+=1; } - wptr=word[i]; - for(i=0;irelax_steps; -printf("-------> %d\n",mdrun->relax_steps); tau=mdrun->timestep; /* check whether relaxation steps are necessary */ @@ -767,8 +766,9 @@ int main(int argc,char **argv) { t_moldyn moldyn; t_3dvec o; - /* clear mdrun struct */ + /* clear structs */ memset(&mdrun,0,sizeof(t_mdrun)); + memset(&moldyn,0,sizeof(t_moldyn)); /* parse arguments */ if(mdrun_parse_argv(&mdrun,argc,argv)<0) @@ -790,7 +790,6 @@ int main(int argc,char **argv) { if(set_int_alg(&moldyn,mdrun.intalgo)<0) return -1; set_cutoff(&moldyn,mdrun.cutoff); - set_nn_dist(&moldyn,mdrun.nnd); if(set_potential(&moldyn,mdrun.potential)<0) return -1; switch(mdrun.potential) { @@ -820,22 +819,22 @@ int main(int argc,char **argv) { switch(mdrun.lattice) { case FCC: create_lattice(&moldyn,FCC,mdrun.lc,mdrun.element1, - mdrun.m1,0,0,mdrun.lx, + mdrun.m1,DEFAULT_ATOM_ATTR,0,mdrun.lx, mdrun.ly,mdrun.lz,NULL); break; case DIAMOND: create_lattice(&moldyn,DIAMOND,mdrun.lc,mdrun.element1, - mdrun.m1,0,0,mdrun.lx, + mdrun.m1,DEFAULT_ATOM_ATTR,0,mdrun.lx, mdrun.ly,mdrun.lz,NULL); break; case ZINCBLENDE: o.x=0.5*0.25*mdrun.lc; o.y=o.x; o.z=o.x; create_lattice(&moldyn,FCC,mdrun.lc,mdrun.element1, - mdrun.m1,0,0,mdrun.lx, + mdrun.m1,DEFAULT_ATOM_ATTR,0,mdrun.lx, mdrun.ly,mdrun.lz,&o); o.x+=0.25*mdrun.lc; o.y=o.x; o.z=o.x; create_lattice(&moldyn,FCC,mdrun.lc,mdrun.element2, - mdrun.m2,0,1,mdrun.lx, + mdrun.m2,DEFAULT_ATOM_ATTR,1,mdrun.lx, mdrun.ly,mdrun.lz,&o); break; default: diff --git a/moldyn.c b/moldyn.c index 6fa9df2..82ae543 100644 --- a/moldyn.c +++ b/moldyn.c @@ -574,6 +574,7 @@ int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element,double mass, t_3dvec orig; void *ptr; t_atom *atom; + char name[16]; new=a*b*c; count=moldyn->count; @@ -608,18 +609,21 @@ int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element,double mass, case CUBIC: set_nn_dist(moldyn,lc); ret=cubic_init(a,b,c,lc,atom,&orig); + strcpy(name,"cubic"); break; case FCC: if(!origin) v3_scale(&orig,&orig,0.5); set_nn_dist(moldyn,0.5*sqrt(2.0)*lc); ret=fcc_init(a,b,c,lc,atom,&orig); + strcpy(name,"fcc"); break; case DIAMOND: if(!origin) v3_scale(&orig,&orig,0.25); set_nn_dist(moldyn,0.25*sqrt(3.0)*lc); ret=diamond_init(a,b,c,lc,atom,&orig); + strcpy(name,"diamond"); break; default: printf("unknown lattice type (%02x)\n",type); @@ -636,7 +640,7 @@ int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element,double mass, } moldyn->count+=new; - printf("[moldyn] created lattice with %d atoms\n",new); + printf("[moldyn] created %s lattice with %d atoms\n",name,new); for(ret=0;retatom; /* initialize linked cell method */ -printf(" hier soll es sein\n"); link_cell_init(moldyn,VERBOSE); /* logging & visualization */ @@ -1704,7 +1707,11 @@ printf(" hier soll es sein\n"); temperature_calc(moldyn); virial_sum(moldyn); pressure_calc(moldyn); - //thermodynamic_pressure_calc(moldyn); + /* + thermodynamic_pressure_calc(moldyn); + printf("\n\nDEBUG: numeric pressure calc: %f\n\n", + moldyn->tp/BAR); + */ /* calculate fluctuations + averages */ average_and_fluctuation_calc(moldyn); @@ -2415,11 +2422,6 @@ int process_2b_bonds(t_moldyn *moldyn,void *data, t_list *this; lc=&(moldyn->lc); - - /* only init link cell if it doesn't exist! */ - HIER WEITER - link_cell_init(moldyn,VERBOSE); - itom=moldyn->atom; for(i=0;icount;i++) { diff --git a/moldyn.h b/moldyn.h index 9d49dfa..0f37a35 100644 --- a/moldyn.h +++ b/moldyn.h @@ -56,6 +56,8 @@ typedef struct s_atom { #define ATOM_ATTR_2BP 0x20 /* pair potential */ #define ATOM_ATTR_3BP 0x40 /* 3 body potential */ +#define DEFAULT_ATOM_ATTR 0x74 // 1,2,3 body interaction + visualize + /* cell lists */ typedef struct s_linkcell { int nx,ny,nz; /* amount of cells in x, y and z direction */ diff --git a/pair_correlation_calc.c b/pair_correlation_calc.c index 56369f6..efe81ad 100644 --- a/pair_correlation_calc.c +++ b/pair_correlation_calc.c @@ -64,6 +64,9 @@ int main(int argc,char **argv) { return -1; } + /* link cell init */ + link_cell_init(&moldyn,VERBOSE); + calculate_pair_correlation(&moldyn,dr,stat); fd=open("pair_corr_func.txt", diff --git a/runmd b/runmd new file mode 100755 index 0000000..c09780c --- /dev/null +++ b/runmd @@ -0,0 +1,37 @@ +if [ -z "$1" ]; then + echo "specify a directory for logging and save files" + exit +fi + +if [ ! -f ./config ]; then + echo "no config file found" + exit +fi + +[ ! -d $1 ] && mkdir $1 + +./clean $1 + +./mdrun -c ./config -s $1 + +if [ "$?" == "0" ]; then + #./perms + if [ "$1" ] ; then + # whole simulation cell + #./visualize -w 640 -h 480 -d $1 + + # center unit cell + ./visualize -w 640 -h 480 -d $1 \ + -nll -0.56 -0.56 -0.56 -fur 0.56 0.56 0.56 \ + -b -0.5 -0.5 -0.5 0.5 0.5 0.5 \ + -c -0.2 -2.0 0.6 -L 0 0 -0.1 \ + -r 0.6 -B 0.1 + + # old rasmol + #rasmol -32 -nodisplay < $1/visualize.scr > /dev/null 2>&1 + ./ppm2avi $1 + + # copy config + cp -v config $1/config + fi +fi diff --git a/runmd_rx200 b/runmd_rx200 new file mode 100755 index 0000000..1bf24f8 --- /dev/null +++ b/runmd_rx200 @@ -0,0 +1,44 @@ +if [ -z "$1" ]; then + exit +fi + +if [ ! -f ./config ]; then + exit +fi + +[ ! -d $1 ] && mkdir $1 +./clean $1 + +# create run file +rf=`basename $1` +cat > run_$rf <<-EOF +#!/bin/bash +#$ -cwd + +./mdrun -c ./config -s $1 + +EOF + +# submit job +qsub run_$rf + +if [ "$?" == "0" ]; then + #./perms + if [ "$1" ] ; then + # whole simulation cell + #./visualize -w 640 -h 480 -d $1 + + # center unit cell + #./visualize -w 640 -h 480 -d $1 \ + # -nll -2.4 -2.4 -2.4 -fur 3.8 3.8 3.8 \ + # -b -2.03 -2.03 -2.03 3.39 3.39 3.39 \ + # -r 0.6 -c 0.5 -11.0 2.5 -B 0.1 + + # old rasmol + #rasmol -32 -nodisplay < $1/visualize.scr > /dev/null 2>&1 + #./ppm2avi $1 + + # copy config and main prog + cp -v config $1/config + fi +fi -- 2.39.2