// done reading
acount+=1;
}
+ close(fd);
// allocate trafo angles
trafo_angle=malloc(acount*2*sizeof(double));
if(trafo_angle==NULL) {
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);