Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write_traj problem when selecting a mask and specific frames #1616

Open
krlitros87 opened this issue Oct 11, 2022 · 1 comment
Open

write_traj problem when selecting a mask and specific frames #1616

krlitros87 opened this issue Oct 11, 2022 · 1 comment
Labels

Comments

@krlitros87
Copy link

Hi, I'm trying to save multiple frames from a trajectory, extracting only a selection (with mask) of atoms/residues
pt.write_traj('t.pdb',traj,overwrite=True,options='multi',frame_indices=range(0,traj.n_frames,int(traj.n_frames/int(frames))))
This creates a single pdb file without problems.

But when trying to save only a selection of atoms per file,
pt.write_traj('t.pdb',traj(mask=(':1-476')),overwrite=True,options='multi',frame_indices=range(0,traj.n_frames,int(traj.n_frames/int(frames))))
it will save all the frames of the simulation, instead of the selection of frames I choose with 'frame_indices'

What could be the problem?
Thanks!

@hainm hainm added the bug label Oct 13, 2022
@hainm
Copy link
Contributor

hainm commented Oct 13, 2022

Dear @krlitros87
It's a known bug. Can you please try pytraj.iterframe instead?

pt.write_traj("abc.pdb", pt.iterframe(traj, mask='@CA', frame_indices = range(0, 8, 2)),  options='multi')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants