]> hackdaworld.org Git - physik/posic.git/commitdiff
introduced crt type 2 (initial diplacement vector for constraints) + write out crt...
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Thu, 20 May 2010 14:54:35 +0000 (16:54 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Thu, 20 May 2010 14:54:35 +0000 (16:54 +0200)
mdrun.c
moldyn.c

diff --git a/mdrun.c b/mdrun.c
index 3266dd3804a0ac0668049988c30ecfac554a8fca..bb1cd21377ee706a31ecc489d19ac58fdf5d5450 100644 (file)
--- a/mdrun.c
+++ b/mdrun.c
@@ -1286,6 +1286,7 @@ int crt(t_moldyn *moldyn,t_mdrun *mdrun) {
                        // done reading
                        acount+=1;
                }
+               close(fd);
                // allocate trafo angles
                trafo_angle=malloc(acount*2*sizeof(double));
                if(trafo_angle==NULL) {
@@ -1296,18 +1297,39 @@ int crt(t_moldyn *moldyn,t_mdrun *mdrun) {
                crtt=crtp->type;
        }
 
+       /* write a save file s-crt_xofy.save */
+       snprintf(line,128,"%s/s-crt_%03dof%03d.save",
+                moldyn->vlsdir,crtp->count,crtp->steps);
+       fd=open(line,O_WRONLY|O_TRUNC|O_CREAT,S_IRUSR|S_IWUSR);
+       if(fd<0) perror("[mdrun] crt save fd open");
+       else {
+               write(fd,moldyn,sizeof(t_moldyn));
+               write(fd,moldyn->atom,
+                     moldyn->count*sizeof(t_atom));
+       }
+       close(fd);
+
+       /* output energy */
+       printf("  crt energy: %d - %f\n\n",
+              crtp->count,(moldyn->ekin+moldyn->energy)/EV);
+
        /* crt routines: calculate displacement + set individual constraints */
 
        printf("  crt step %d of %d in total\n\n",crtp->count+1,crtp->steps);
 
+       if((crtp->type==1)|(crtp->count==0))
+               printf("  crt angle update\n\n");
+               
        for(i=0;i<moldyn->count;i++) {
                // calc displacements
                atom=moldyn->atom;
                v3_sub(&disp,&(crtp->r_fin[i]),&(atom[i].r));
                // angles
-               trafo_angle[2*i]=atan2(disp.x,disp.y);
-               trafo_angle[2*i+1]=-atan2(disp.z,
-                                         sqrt(disp.x*disp.x+disp.y*disp.y));
+               if((crtp->type==1)|(crtp->count==0)) {
+                       trafo_angle[2*i]=atan2(disp.x,disp.y);
+                       trafo_angle[2*i+1]=-atan2(disp.z,
+                                          sqrt(disp.x*disp.x+disp.y*disp.y));
+               }
                // move atoms
                frac=1.0/(crtp->steps-crtp->count);
                v3_scale(&disp,&disp,frac);
index a6f5c4557efc68b4ff01e6996792b782b5d2bcea..d715c52a11f91aa9f43244b014c281f3c2a00cc4 100644 (file)
--- a/moldyn.c
+++ b/moldyn.c
@@ -83,9 +83,6 @@ int moldyn_init(t_moldyn *moldyn,int argc,char **argv) {
        pthread_mutex_init(&emutex,NULL);
 #endif
 
-       if(crtt)
-               printf("USING CRT\n");
-
        return 0;
 }