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

Error with derived trajectories #1606

Open
thepoole opened this issue Mar 28, 2022 · 1 comment
Open

Error with derived trajectories #1606

thepoole opened this issue Mar 28, 2022 · 1 comment
Labels

Comments

@thepoole
Copy link

When using trajectories modified by strip or append, I get errors for later analysis (e.g. dssp, sander, pca) due to some type mismatch. This can be worked around either by using a deep-copy or saving and loading the trajectory to file.

Here is a snippet of code you can use for and example, in this case I have a dictionary of trajectories but this setup should work with any trajectory constructed with append, strip, or selections (i.e., traj["@ca"]):

`

Create an empty trajectory

combine = pytraj.Trajectory()

Parse the dictionary of trajectories

for item in traj_dict:
if(combine.n_atoms < 1):
combine = traj_dict[item].copy()
else:
combine.append(traj_dict[iem])

This is a work-around to some bug, I should forward it to pytraj team with love

combine = combine.copy()

Getting the delicious data

data = pytraj.pca(combine, mask="@ca", n_vecs=2)
`

@hainm
Copy link
Contributor

hainm commented Mar 30, 2022

Thank you @thepoole for your report.

@hainm hainm added the bug label Mar 30, 2022
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