--- rst7plugin.cvs 2020-02-23 16:04:20.126161871 -0500 +++ rst7plugin.c 2020-02-23 16:56:37.388520222 -0500 @@ -11,7 +11,7 @@ * * $RCSfile: rst7plugin.c,v $ * $Author: johns $ $Locker: $ $State: Exp $ - * $Revision: 1.21 $ $Date: 2017/08/30 17:27:29 $ + * $Revision: 1.20 $ $Date: 2016/11/28 05:01:54 $ * ***************************************************************************/ @@ -56,8 +56,10 @@ memset(data, 0, sizeof(rstdata)); #if vmdplugin_ABIVERSION > 10 data->ts_meta.count = -1; - data->ts_meta.has_velocities = 0; + data->ts_meta.has_velocities = 1; #endif + //Assume we have velocities. We'll correct the assumption if we don't. + data->has_vels=1; fgets(title, 82, fd); vmdcon_printf(VMDCON_INFO, "rst7plugin) Title: %s\n",title); @@ -67,25 +69,19 @@ /* try to read first field */ field = strtok(line, " \t"); if (field==NULL) { - continue; /* no fields at all on this line */ + continue; /* no fields at all on this line. Continue to try again. */ } numats = atoi(field); /* try to read second field will be null if not there */ field = strtok(NULL, " \t"); if (field==NULL) { - kkk=0; - vmdcon_printf(VMDCON_INFO, "rst7plugin) This file has no velocity info.\n"); - data->has_vels=0; + vmdcon_printf(VMDCON_INFO, "rst7plugin) This file has no timestep information.\n"); } else { timesteprst = strtod(field, NULL); - vmdcon_printf(VMDCON_INFO, "rst7plugin) This file contains velocity info.\n"); - data->has_vels=1; -#if vmdplugin_ABIVERSION > 10 - data->ts_meta.has_velocities = 1; -#endif - kkk=0; + vmdcon_printf(VMDCON_INFO, "rst7plugin) This file is from timestep %f.\n", timesteprst); } + kkk=0; } point2=ftell(fd); @@ -96,13 +92,38 @@ for (i=0; ihas_vels) { for (i=0; ihas_vels = 0; +#if vmdplugin_ABIVERSION > 10 + data->ts_meta.has_velocities = 0; +#endif + if (i == 2) { + vmdcon_printf(VMDCON_INFO, "rst7plugin) This file does not contain velocity info.\n"); + } + else { + vmdcon_printf(VMDCON_INFO, "rst7plugin) This file does not have the right number of entries for velocity or boxsize info.\n"); + } + break; + } } } + //Check again if we have velocity info, since it may have changed in the loop. + if (data->has_vels) { + vmdcon_printf(VMDCON_INFO, "rst7plugin) This file contains velocity info.\n"); + } j = fscanf(fd, "%f%f%f%f%f%f", &x, &y, &z,&a,&b,&c); if (j != EOF) { @@ -150,6 +171,7 @@ /* changed to i=1 BB */ j = fscanf(rst->file, "%f%f%f", &x, &y, &z); if (j == EOF) { + vmdcon_printf(VMDCON_ERROR, "rst7plugin) End of file reached before read\n"); return MOLFILE_ERROR; } else if (j <= 0) { vmdcon_printf(VMDCON_ERROR, "rst7plugin) Problem reading CRD file\n"); @@ -165,6 +187,7 @@ for (i=0; inumatoms; i++) { j = fscanf(rst->file, "%f%f%f", &x, &y, &z); if (j == EOF) { + vmdcon_printf(VMDCON_ERROR, "rst7plugin) End of file reached before read\n"); return MOLFILE_ERROR; } else if (j <= 0) { vmdcon_printf(VMDCON_ERROR, "rst7plugin) Problem reading velocities\n"); @@ -282,7 +305,7 @@ plugin.prettyname = "AMBER7 Restart"; plugin.author = "Brian Bennion, Axel Kohlmeyer"; plugin.majorv = 0; - plugin.minorv = 5; + plugin.minorv = 6; plugin.is_reentrant = VMDPLUGIN_THREADUNSAFE; plugin.filename_extension = "rst7"; plugin.open_file_read = open_rst_read;