tau_square=moldyn->tau_square;
for(i=0;i<count;i++) {
+ /* check whether fixed atom */
+ if(atom[i].attr&ATOM_ATTR_FP)
+ continue;
/* new positions */
h=0.5/atom[i].mass;
v3_scale(&delta,&(atom[i].v),tau);
potential_force_calc(moldyn);
for(i=0;i<count;i++) {
+ /* check whether fixed atom */
+ if(atom[i].attr&ATOM_ATTR_FP)
+ continue;
/* again velocities [actually v(t+tau)] */
v3_scale(&delta,&(atom[i].f),0.5*tau/atom[i].mass);
v3_add(&(atom[i].v),&(atom[i].v),&delta);
//printf("\nATOM 0: %f %f %f\n\n",itom->f.x,itom->f.y,itom->f.z);
if(moldyn->time>DSTART&&moldyn->time<DEND) {
printf("force:\n");
- printf(" x: %0.40f\n",moldyn->atom[5832].f.x);
- printf(" y: %0.40f\n",moldyn->atom[5832].f.y);
- printf(" z: %0.40f\n",moldyn->atom[5832].f.z);
+ printf(" x: %0.40f\n",moldyn->atom[DATOM].f.x);
+ printf(" y: %0.40f\n",moldyn->atom[DATOM].f.y);
+ printf(" z: %0.40f\n",moldyn->atom[DATOM].f.z);
}
#endif
int fd;
int cnt,size;
+ int fsize;
+ int corr;
fd=open(file,O_RDONLY);
if(fd<0) {
return fd;
}
+ fsize=lseek(fd,0,SEEK_END);
+ lseek(fd,0,SEEK_SET);
+
size=sizeof(t_moldyn);
while(size) {
size=moldyn->count*sizeof(t_atom);
+ /* correcting possible atom data offset */
+ corr=0;
+ if(fsize!=sizeof(t_moldyn)+size) {
+ corr=fsize-sizeof(t_moldyn)-size;
+ printf("[moldyn] WARNING: lsf (illegal file size)\n");
+ printf(" moifying offset:\n");
+ printf(" - current pos: %d\n",sizeof(t_moldyn));
+ printf(" - atom size: %d\n",size);
+ printf(" - file size: %d\n",fsize);
+ printf(" => correction: %d\n",corr);
+ lseek(fd,corr,SEEK_CUR);
+ }
+
moldyn->atom=(t_atom *)malloc(size);
if(moldyn->atom==NULL) {
perror("[moldyn] load save file malloc (atoms)");