I have an xyz file upon which after processing in Python, I determine bonds between different atoms. What would be the correct file type that I can write to visualize this bond information in VMD?
-
$\begingroup$ Does VMD plot different type of bonds? If not, then, any file format will be meaningless. Many visualization programs simple ignore the type of bond during visualization (Chimera is one of them, for example). $\endgroup$– Camps ♦Mar 16, 2021 at 13:12
-
$\begingroup$ @Camps I am not interested in the type of the bond. Just in an active visualization of bonds between atoms and how to create a file which can provide that information to the software $\endgroup$– fireball.1Mar 16, 2021 at 17:32
-
$\begingroup$ In that case, any molecular visualization program can visualize the bond formation. That visualization is just a geometrical calculation: if the atoms are near enough, the program will draw the bond. $\endgroup$– Camps ♦Mar 16, 2021 at 19:02
-
$\begingroup$ @Camps that is assuming a forcefield is used for the bond formation - I don't see the software forming bonds by itself. Either way I want to visualize bonds between atoms as defined by me in some sort of pair information $\endgroup$– fireball.1Mar 16, 2021 at 19:05
-
$\begingroup$ Sorry. The bonds are displayed just using geometrical data: if the distance between the atoms is lower than the sum of both atom radii, then the bond is displayed. Nothing about forcefields here.Even using a XYZ file (with no bond information inside it) the program will display them. If you use MOL2, you can force the bond information. $\endgroup$– Camps ♦Mar 17, 2021 at 11:39
2 Answers
In the VMD user guide different file formats natively handled by VMD are specified, including PSF
and PARM
that can both contain bond connectivity:
PSF and PARM files contain atoms, residues, segment names, residue types, atomic mass and charge, and the bond connectivity.
Depending on how your atoms and bonds are represented in python, you may choose to use the file input/output functions of the ParmEd library which include support for PSF files (or any other library that supports it).
-
$\begingroup$ I have been trying to write a script using parmed. I can create atoms and append them to atom lists. However, I am not sure how to add add lists as multiple time steps to
Structure
and then write it to a pdb file. DO you think you can provide some help in that respect $\endgroup$ Mar 28, 2021 at 11:16
I usually use mol2 or psf formats to explicitly include bonds. mol2 works with many other programs (Avogadro, OpenBabel), while psf files are good for anything in CHARMM world (CHARMM, NAMD). The psf capabilities of VMD are good since it lives in CHARMM world as well.