How to write trajectory out to a file and visualize in VMD

95 views
Skip to first unread message

ashan dayananda

unread,
Feb 22, 2021, 3:11:47 PM2/22/21
to MDnalysis discussion
Hello,

I am new to use MDAnalysis and I would like to know how can I write the PC outputs as in dcd format or combined pdb format so I can view in VMD.

Appreciate your help.

Thanks,
Ashan. 

Oliver Beckstein

unread,
Feb 22, 2021, 3:23:21 PM2/22/21
to mdnalysis-discussion
Hi Ashan,

Welcome to the MDAnalysis user list!

The user guide has a section on PCA https://userguide.mdanalysis.org/stable/examples/analysis/reduced_dimensions/pca.html; at the bottom it shows how to create a  universe proj1 with a PCA-filtered trajectory. You can write out this trajectory to a DCD with

proj1.atoms.write(“pca1.pdb”)
proj1.atoms.write(“pca1.dcd”, frames=“all”)

and then use the PDB and DCD file in VMD.

Oliver

p.s.: There’s also a more explicit way to write a trajectory:

with MDAnalysis.Writer(“pca1.dcd”, n_atoms=proj1.atoms.n_atoms) as W:
       for ts in proj1.trajectory:
              W.write(proj1.atoms)

   
--
Oliver Beckstein (he/his/him)







ashan dayananda

unread,
Feb 22, 2021, 5:17:52 PM2/22/21
to mdnalysis-...@googlegroups.com
Hi Oliver,

That makes sense. It worked.

Thank you,
Ashan.

--
You received this message because you are subscribed to a topic in the Google Groups "MDnalysis discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mdnalysis-discussion/rf6XAC2vwIk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mdnalysis-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mdnalysis-discussion/41AF2406-D388-4F0D-BF83-06E986D94BC4%40gmail.com.
Reply all
Reply to author
Forward
0 new messages