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

Topology calculation for a complete LAMMPS data file export

Dear OVITO devs,

First a big thank you to Alexander and everyone involved with the OVITO project! It has been an invaluable tool in my work.

A couple of threads in the support forum have highlighted something that I have wanted for some time, the ability to read, generate, and write a LAMMPS data file with full topology (angles, dihedrals and impropers). I understand that there was a good reason to not include such a feature in the initial development of OVITO, but it seems that as OVITO works so well with LAMMPS, such an extension to include topology would feel very natural.

Capacity to handle the topology data for the reading and writing of LAMMPS data files, as well as a modifier for calculating these data based on particle properties would be greatly appreciated.

In my own work I typically define a particle species property, usually by guessing it from the  nearest integer of the particle mass.  Additionally, it would be nice to allow the create bonds modifier (which I presume would be the base of the topology calculation) to define cutoffs based on a species (or other) type of property.

Regards,

-Filip V.

Filip,

Thank you for describing your specific needs and expressing the general interest in this feature. I will try to work on this as soon as my time allows.

Let me ask you two more questions in order to better understand your needs:

You wrote that you define particle specifies in OVITO by guessing them from the particle mass. I am wondering why this is necessary in the first place. Is it because your LAMMPS data/dump files contain only the numeric atom type IDs and not the chemical element names?

Furthermore, I am wondering what your comment on the Create Bonds modifier of OVITO is referring to. That modifier already provides the option for you to specify individual cutoff radii for each pair of particle types in the system. Would like to have even more control of the bind creation, or would like the modifier to rather be smarter perhaps tomato the creation of bond topology easier?

-Alex

Hey Alex,

So the way I've been setting up fixed-topology simulations is that I use the LAMMPS 'atom-type' quantity to define atoms in unique chemical environments, and hence end up with many atom-types that pertain to single elements. e.g. I may have atom-types 1 through 20 be carbon, 21 and 24 as nitrogen, etc (and not necessarily ordered either). So what I end up with in a dump or data file is many atom-types and only a few elements. The result in OVITO is that I must set a large number of inter-particle cutoffs between the various types if I choose to use the create bonds functionality.

I just went back to the LAMMPS docs and it seems there is a way of outputting an 'element' string to the dump file... feel a bit silly now.

I realise there are smarter ways to visualise the trajectories with bonds OVITO, but the additional control of the create bonds modifier cutoffs may still be helpful  ¯\_(ツ)_/¯.

In short, I'm probably doing things the hard way.

Regards,

-Filip V.

Hey Filip,

I want to inform you that the latest development build of OVITO brings some support for extended molecule topology information (angles/dihedrals/impropers), which you have asked for above. The LAMMPS data file readers/writers now handle the corresponding sections of the file format. Operations in OVITO that remove atoms will update the topology information as needed to avoid dangling references, and the Replicate modifier duplicates also the topology information together with the particles. 

Please give it a try and let me know if you run into any problems. Furthermore, you've mentioned that "calculating" the topology information within OVITO would be useful. Could you please elaborate on this aspect a bit more. Not being familiar with molecular force fields I am not sure what the typical workflows are and which additions to OVITO make sense. Thanks.

-Alex

Hey Alex,

Thank you for your efforts! These additions will most certainly be useful for me (and my colleagues). I'll give them a spin in the near future. 

In regards to calculating molecular topology, I actually have some current work that would really benefit from this feature. A basic workflow I would use to generate a LAMMPS data file with the correct topology would be to generate a pdb file either graphically or manually, assigning particle types to atoms in unique chemical environments (C1,C2,C3,N1,N2,O1,H1,H2.... etc). Then the PDB file would be read into VMD and a topology would be calculated using the 'topotools' plugin, which will find angles and dihedrals (based on the bonding topology), and then would guess impropers based on the bonding along with some cutoff value. Then there will be angle, dihedral, and improper types for  all of the unique cases so that force field parameters may be set according to the elements and chemistry involved in the interaction. After this I can move back to OVITO for visualisation of the simulation trajectories but ideally I'd like to only use one visualiser for the entire workflow... and I prefer OVITO ;). I could just as easily start with a LAMMPS data file rather than a PDB, that part is fairly irrelevant. Please let me know if I should provide more specific details, either here or in via private message. 

 

Regards,

-Filip V.

Quote from Alexander Stukowski on May 5, 2020, 4:57 pm

Hey Filip,

I want to inform you that the latest development build of OVITO brings some support for extended molecule topology information (angles/dihedrals/impropers), which you have asked for above. The LAMMPS data file readers/writers now handle the corresponding sections of the file format. Operations in OVITO that remove atoms will update the topology information as needed to avoid dangling references, and the Replicate modifier duplicates also the topology information together with the particles.

Please give it a try and let me know if you run into any problems. Furthermore, you've mentioned that "calculating" the topology information within OVITO would be useful. Could you please elaborate on this aspect a bit more. Not being familiar with molecular force fields I am not sure what the typical workflows are and which additions to OVITO make sense. Thanks.

-Alex

Can you please tell me the process on how it can be done?. I built ovito in my linux. But after building, I couldn't find the option to add angles.

Dear Abdullah,

This is may be a misunderstanding. OVITO has the capability to read in angles, dihedrals or impropers that are defined in a LAMMPS data file. Within the program you can then view the list of angles imported from the data file, or export them to some output data file again. But there is no way to newly define angles or assign them to a molecular structure to set up a force field. Special tools such as Topotools are made for this particular task, but not OVITO. Sorry.

-Alex

Hello everybody,
Thank you very much for OVITO and for the support

I have been reviewing in the forum and as I understand from a certain configuration to which the bond modifier has been included, the configuration could be exported to be used with LAMMPS.

I have tried to export but I do not see the information regarding the angles appear, only the atoms and bond appear.

I tried exporting in the full format and in the angle format (both for LAMMPS)

Any advice?

Hi,

If the current dataset opened in OVITO has angles/dihedrals/impropers information associated with it, you should see them in the data inspector as shown in the attached screenshot. Note my previous post above, which says that currently the only way to get angles/dihedrals/impropers in OVITO is to import a LAMMPS data file already containing the angles/dihedrals/impropers information. OVITO 3.5.1 and previous versions cannot compute or synthesize this information by themselves.

This is in contrast to pair-wise bonds, which can be generated within OVITO using the Create Bonds modifier.

If angles/dihedrals/impropers are present, then OVITO will write corresponding sections to the LAMMPS data file during file export. The only requirement is that the output data file does not use the LAMMPS atom style "atomic". Thus, atom styles "full" or "angle" should be okay.

-Alex

Uploaded files:
  • Screenshot-2021-05-21-123744.jpg

Dear Alex,

Thanks very much for your prompt response. Now I can see. An additional question, is there a way to generate the angles with OVITO? or is it thought in the short term that this can be done?

Thanks very much

Mauricio

I have no short-term plans for this kind of feature, sorry. In the longer term, yes, I too would like to see this capability in OVITO. There seems to be demand for it.

However, I have to admit that I am not yet familiar with the typical procedures and algorithms for generating the angles/dihedrals/impropers information. I imagine it to be specific to particular force fields. Currently, OVITO does not deal with force fields at all, because they belong in the realm of the external MD simulation code employed by the user.

If you have any pointers to information that can help here, please let me know.

Dear Alexander,

Thanks for the reply.

I reformulate the question, is it possible to make a list of those atoms that are bonded to two atoms and that can be at a certain angle? That is, in other words. I have an A atom that is attached to B. The A atom can be attached to 3 or 4 B atoms and therefore if it is attached to 3 the B-A-B bonds it forms a different angle than when it is attached to 4 B atoms. For example, B-A-B angles are 120 for AB3 structures and 110 for AB4 structures. The question is whether it is possible to obtain a list of those A atoms that meet these two conditions. In other words, it would be a similar function to create atoms.

From what I understand that the inclusion of the force fields would not be necessary and from the topology you have the list of bonds, then you could calculate the angle between particles whose IDs are similar

456 2212
456 1414
456 2069
457 1897
458 1868
459 2807
459 2563
459 1595
460 2148
460 2034
461 2470
463 1484
464 2073
464 2322

This is a listing of my topology. Therefore, for example, I have that the particle 456 has attached to 2212, 1414, and 2069, what I would need to know is if that angle complies with the aforementioned restrictions.

I am new to programming in phyton but maybe you can give me some guidance for the calculation

best regards and thanks for your time

Hi Mauricio,

Yes, what you're describing is possible with a custom python modifier. The idea would be to first calculate the bond vectors from the bond topology array and then to iterate over all particles and to use the bonds_of_particle() method of the BondsEnumerator class to look up all bonds connected to each center atom, see e.g.

https://www.ovito.org/docs/current/python/modules/ovito_data.html#ovito.data.BondsEnumerator

If you are are an official licensee of OVITO Pro, I'm happy to develop and send you a ready-to-use modifier. Simply reach out through our e-mail support.

Best regards,

Constanze

新的OVITO微信频道!
New for our users in China: OVITO on WeChat 

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