OSDN Git Service

Handling of flexible cells were still inconsistent.
authortoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Thu, 5 Jul 2012 00:13:56 +0000 (00:13 +0000)
committertoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Thu, 5 Jul 2012 00:13:56 +0000 (00:13 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@258 a2be9bc6-48de-4e38-9406-05402d4bc13c

MolLib/Molecule.c
MolLib/Ruby_bind/ruby_bind.c

index 9a38856..6c91daa 100755 (executable)
@@ -1191,7 +1191,7 @@ MoleculeLoadMbsfFile(Molecule *mp, const char *fname, char *errbuf, int errbufsi
                                        continue;
                                if (buf[0] == '\n')
                                        break;
-                               if (sscanf(buf, "%lf %lf %f", &dbuf[0], &dbuf[1], &dbuf[2]) < 3) {
+                               if (sscanf(buf, "%lf %lf %lf", &dbuf[0], &dbuf[1], &dbuf[2]) < 3) {
                                        snprintf(errbuf, errbufsize, "line %d: bad frame_periodic_box format", lineNumber);
                                        goto exit;
                                }
@@ -9603,12 +9603,14 @@ MoleculeRemoveFrames(Molecule *mp, IntGroup *inGroup, Vector *outFrame, Vector *
                        } else {
                                free(mp->frame_cells);
                                mp->frame_cells = NULL;
+                               mp->nframe_cells = 0;
                        }
                } else {
                        if (i < mp->natoms)
                                ap->frames = (Vector *)realloc(ap->frames, sizeof(Vector) * s);
                        else {
                                AssignArray(&mp->frame_cells, &mp->nframe_cells, sizeof(Vector) * 4, s - 1, NULL);
+                               mp->nframe_cells = s;
                        }
                }
        }
index 2ed7e2b..b5cd6b0 100644 (file)
@@ -6986,7 +6986,7 @@ s_Molecule_GetCoordFromFrame(int argc, VALUE *argv, VALUE self)
                if (nn > 0)
                        MolActionCreateAndPerform(mol, gMolActionSetAtomPositions, ig, n, vp);
                free(vp);
-               if (RTEST(cval) && mol->cell != NULL && mol->frame_cells != NULL) {
+               if (RTEST(cval) && mol->cell != NULL && mol->frame_cells != NULL && index < mol->nframe_cells) {
                        vp = mol->frame_cells + index * 4;
                        MolActionCreateAndPerform(mol, gMolActionSetBox, vp, vp + 1, vp + 2, vp + 3, mol->cell->flags);
                }