]> hackdaworld.org Git - physik/posic.git/commitdiff
unstable but might run ...
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Tue, 29 Apr 2008 15:01:45 +0000 (17:01 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Tue, 29 Apr 2008 15:01:45 +0000 (17:01 +0200)
bond_analyze.c
config.default
mdrun.c
moldyn.c
moldyn.h
pair_correlation_calc.c
runmd [new file with mode: 0755]
runmd_rx200 [new file with mode: 0755]

index cc1c3189e155c2e181bc13579684bdba5ae554db..6c46251f14dd4ecd2b18a1bbb94c76f1a9028757 100644 (file)
@@ -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);
 
index d63e401f69e88679b86546c496c1c97df505b59e..74e49975b68232e457c10b66168557239b47e274 100644 (file)
@@ -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 63899a6a60e9ed72dfd07591792c486ccb6ef2a6..8c5cf71c974f8816c58ee97805a9189d69ea7daa 100644 (file)
--- 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;i<strlen(wptr);i++) {
-                               switch(word[2][i]) {
+                       for(o=0;o<strlen(word[i]);o++) {
+                               switch(word[i][o]) {
                                        case 'b':
                                                cap.attr|=ATOM_ATTR_VB;
                                                break;
@@ -674,7 +674,6 @@ int mdrun_hook(void *ptr1,void *ptr2) {
 
        /* default steps and tau values */
        steps=mdrun->relax_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:
index 6fa9df25c008ac26c5e12e30a1ca66095b3a600f..82ae543c073457a47372253f6c238f76d1bfe6b5 100644 (file)
--- 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;ret<new;ret++) {
                atom[ret].element=element;
@@ -1635,7 +1639,6 @@ int moldyn_integrate(t_moldyn *moldyn) {
        atom=moldyn->atom;
 
        /* 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;i<moldyn->count;i++) {
index 9d49dfa809468f8d8b77fbe59fb08cc6bbc2ee2b..0f37a35cb15d6796663b12a8fb20b271fde13981 100644 (file)
--- 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 */
index 56369f64d092492058e08946de595870e45a6392..efe81ad64b9f85c6bae270acc937a0cb6015496e 100644 (file)
@@ -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 (executable)
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 (executable)
index 0000000..1bf24f8
--- /dev/null
@@ -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