X-Git-Url: https://hackdaworld.org/gitweb/?p=physik%2Fposic.git;a=blobdiff_plain;f=mdrun.c;fp=mdrun.c;h=bb1cd21377ee706a31ecc489d19ac58fdf5d5450;hp=3266dd3804a0ac0668049988c30ecfac554a8fca;hb=fe84cdc3fc897581636aff89b6f4fd12db1d2718;hpb=ff44bcba9df0d021568abcb553d1d490c442f696 diff --git a/mdrun.c b/mdrun.c index 3266dd3..bb1cd21 100644 --- 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;icount;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);