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)");
memset(&moldyn,0,sizeof(t_moldyn));
+ printf("[pair corr calc] reading save file ...\n");
ret=moldyn_read_save_file(&moldyn,argv[1]);
if(ret) {
printf("[pair corr calc] exit!\n");