You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a good question. I've not done a huge amount of analysis of MD trajectories, but when I have, I've taken the approach that you mentioned of splitting it into frames and iterating over the PDB files, which isn't ideal. We have considered MDTraj integration, as it's used pretty heavily within the group, but it's been pretty low priority, mainly because no ones asked for it!
Is the order of the atoms in the ampal object the same as in the PDB file?
I guess one could just iterate over all the atoms in the ampal and replace the _vector property from the coordinates fund in the MDtraj topology.
Although with modern SSDs splitting into PDBs should also work nicely:)
importmdtrajasmdimportampaldefupdate_ampal(assembly, traj_frame):
"""Updates ampal using coordinates from md_traj frame. Update is INPLACE"""ampal_atoms=list(assembly.get_atoms())
assertlen(ampal_atoms) ==traj_frame.n_atoms, \
f"Number of atoms in ampal {len(ampal_atoms)} and mdtraj {traj_frame.n_atoms} must be equal!"formd_at, amp_atinzip(traj_frame.xyz[0], ampal_atoms):
# mdtraj converts to nanometers. Convert back to Angstrem.amp_at._vector=md_at*10returnassembly
Probably needs some test etc... Also haven't tested for multichain assemblies.
H!
What's the best way to analyse a trajectory using ampal? Concretely I have dcd MD trajectory and I would like to analyse each frame using ampal.
I realize that a brute force approach is just to split the trajectory into pdbs and load each pdb separately.
Have you considered integration with MDtraj?
Is it perhaps possible to just update each atom coordinates in the ampal object?
The text was updated successfully, but these errors were encountered: