Forum Navigation
You need to log in to create posts and topics.

Specifying permanent bonds

I am using xyz files to input my data and I know I can visualize bonds through a distance criterion. I would like to specify bonds between particles and have them stay the same throughout the visualization. From what I have read, it appears I cannot do this with writing permanent bond information into columns in the xyz files. I am using my own codes so I cannot utilize capability that might be in other codes like LAMMPS. From searching on the web, I have found it may be possible to do this through scripting using the topology property. Is that the only way to do it or can I specify permanent bonds more easily through the xyz files without scripting. Or do you have any suggestions for a different file type that work better for my specific needs?

Hi John,

Yes, this is simply a limitation of the XYZ file format. It was never designed to store bond topology information, only atoms/particles. You have to switch to a different file format, one that allows you to import bonds into OVITO.

Please have a look at the input file formats supported by OVITO. You should focus those formats which have a "bonds" entry in the third column of the table. I would either go with the LAMMPS data format (which is text-based) or the GSD/HOOMD format (you could use the gsd package to write this format, which makes most sense if your existing program producing the list of bonds is written in Python).

Another possibility is to create the bonds right within OVITO using its Python scripting functions. Or you can use the OVITO Python package to produce a particle model including bonds, write it to a LAMMPS data or GSD file, and then import these files in the graphical OVITO application.

See also the Bonds.create_bond() method from OVITO's Python API and this code example.


New for our users in China: OVITO on WeChat 

Official OVITO WeChat channel operated by Foshan Diesi Technology Co., Ltd.