Closed winsvern closed 4 years ago
I've never worked with NAMD, but I have successfully converted *.dcd
trajectories produced by OpenMM to Gromacs' *.xtc
format using the MDAnalysis library. The converted trajectory can then be used as input for the -f
flag of CHAP. A corresponding PDB file can be used for the -s
flag.
A conversion script might look like this:
import MDAnalysis as mda
# load NAMD trajectory, PDB file is needed to define topology
u = mda.Universe("structure.pdb", "trajectory.dcd")
# select all particles
system = u.select_atoms("all")
# write to XTC trajectory
with mda.Writer("converted_trajectory.xtc", system.n_atoms) as w:
for ts in u.trajectory:
w.write(system)
Hope this helps!
The script works perfectly (after I got openMM and MDanalysis up and running). The converted trajectory and pdb file are accepted by CHAP. Progress. Now I have to fix some problems with my NAMD run, and will be on my way. (Eventually I want to convert this project to GROMACS, and that would make everything easier, but that is for another day)
Thank you again. You saved me a huge amount of time.
Vern Winston
On Thu, Jan 23, 2020 at 7:01 AM Inniag notifications@github.com wrote:
I've never worked with NAMD, but I have successfully converted .dcd trajectories produced by OpenMM to Gromacs' .xtc format using the MDAnalysis https://www.mdanalysis.org/ library. The converted trajectory can then be used as input for the -f flag of CHAP. A corresponding PDB file can be used for the -s flag.
A conversion script might look like this:
import MDAnalysis as mda
load NAMD trajectory, PDB file is needed to define topology
u = mda.Universe("structure.pdb", "trajectory.dcd")
select all particles
system = u.select_atoms("all")
write to XTC trajectorywith mda.Writer("converted_trajectory.xtc", system.n_atoms) as w:
for ts in u.trajectory: w.write(system)
Hope this helps!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/channotation/chap/issues/24?email_source=notifications&email_token=ANLIJIES24MNLI5FHL53YIDQ7GPMLA5CNFSM4KJYHM62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJXOQ7Q#issuecomment-577693822, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANLIJIF2FXE2BZQI4KDGJGLQ7GPMLANCNFSM4KJYHM6Q .
Glad I could help! I hope CHAP proves useful for your project. Good luck with your NAMD to Gromacs migration.
I have some trajectories produced using NAMD. I have tried to convert these to a form that will work in CHAP and failed. Is there a way to convert these trajectories to a format that is readable by CHAP?
Thank you in advance.
Vern Winston