Skip to content

number of frames is 0 #43

Open
Open

Description

@sjzhao

Hi Robin,

I start Vmd and type gopython and then load a file by:
molid = molecule.load('parm7', '1BIQ_solvate.top', 'crdbox', 'prod_imaged.mdcrd')
tf = molecule.numframes(molid)
print(tf)
This will give the number of total frames of 300, it works.

However, when I put the same code in a python file like:
from vmd import *
mid = molecule.load('parm7', '1BIQ_solvate.top', 'crdbox', 'prod_imaged.mdcrd')
tf = molecule.numframes(mid)
print('Loaded mid is: ', mid)
print('Total number frames is', tf)

The total number of frames is 0.

Do you have any idea of what is wrong here?
Thanks.

Activity

  1. jvermaas commented on Sep 30, 2022

    @jvermaas
    Contributor

    Have you looked at the docs? What you are doing in VMD depends on behavior described in the user guide, where molecule.load in VMD 1.9.3 (or I think 1.9.4) will basically wait until all frames are loaded before returning. I think in the rejiggering to get this to work for python3, this side effect disappeared.

  2. sjzhao commented on Oct 2, 2022

    @sjzhao
    Author

    I just want to load the topo and mdcrd file, then get the total number of frames, and do a for loop base on the frames.
    I add a sleep(20) after the load function, but it does not work at all.

  3. sjzhao commented on Oct 3, 2022

    @sjzhao
    Author

    This is the example from the docs:
    from vmd import molecule

    molid = molecule.load("parm7", "system.prmtop")
    molecule.read(molid, "netcdf", "simulation.nc", skip=5, waitfor=-1)
    last_frame = molecule.numframes - 1
    molecule.write(molid, "pdb", "last_frame.pdb", first=last_frame)

    However, molecule.numframes is a function which require molecule id.
    I did molecule.numframes(molid), which return 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions