Creating LAMMPS data file

Dear All,
I have three molecules in my box and filled this with water. What is your suggestion to create LAMMPS data?
for my first choice, I used top_all27_prot_lipid.rtf to create autopsf file. Unfortunately I get the error “molecules destroyed by the fatal error”.
Secondly, I used Ovito to create lammps data file. Althougth I chose full atom style but all the bonds are not available (for example between N and O, Just H-O bonds available)

What is your suggestion to create LAMMPS data file with all the available bonds?

Thanks

Hi @Nostalgic,

If I’m correct this is a VMD error. Can you confirm that you tried using VMD for your conversion? You would get better help from the VMD folks if that is the case.

The atom_style full and bond information are distinct things. The former allows to define the later (though it is not the only style that allows it), but does not make it mandatory. Same as prior, this is more an Ovito usage problem than a LAMMPS issue.

What you say about your output makes me believe that some of your input files are actually the cause of your problem.

To answer your question, the best tool to check for your input file in the end is always going through the files yourself to look at what is actually wrong.

1 Like

Yes, I used VMD autopsf bulider and used "top_all27_prot_lipid.rtf " topology file and then use the charmm2lammps.pl to create the LAMMPS data file. But, I get confused over defining atom bond for letting LAMMPS know that bond atoms.
I have not problem working with water molecules but in the case of defining other molecules I really get confused.

My strategy is the following and is based on Moltemplate.

For homogeneous mixtures, put the molecules on a low-density cubic grid using the molecule operations in Moltemplate. Then anneal at a suitable temperature and compress to the desired density, before applying a barostat.

For molecular architectures (surfaces, nanoparticles, hydrated proteins, etc.): assemble the structure with your program of choice (VMD, Packmol, GDIS, Ovito, to name a few) and export the structure as a PDB. If necessary, sort the PDB to have the same molecules in contiguous positions (e.g. the protein first, then all the water molecules, then the ions), and finally create the same molecules, and in the same order, in a Moltemplate script using that PDB as input structure.

I chose to manage my force field libraries with Moltemplate and I find very practical to manage the creation of LAMMPS input decks in this way. You can find a Moltemplate how-to section in the LAMMPS ManualTM and more examples on the website.

1 Like

Thanks. My main problem is that all repeating atoms are counted as the new atom type. In this case it’s too difficult to group C atoms in LAMMPS input files.

The LAMMPS data format is really quite self-documenting, at least to me. It is a blank-line-separated concatenation of whitespace-separated tables, each preceded by its name.

Since the first data block states the number of items in each other data block, any script for modifying a data file can very quickly determine what line number stores the information for any given atom, atomtype, bond, bondtype, etc.

The hardest thing to remember is which column of Atoms contains which information according to each distinct atom_style.

Once you know which column to rewrite, a LAMMPS data file is highly amenable to simple scripting in any language you’re comfortable with. Hell, you could probably edit one in Microsoft Excel as long as you get the import and export right. Python-Numpy is also a good option.

But it’s entirely possible (and straightforward, and I recommend learning these competencies thoroughly) to edit a LAMMPS data file entirely in Bash by combining:

  • sed to extract specified line ranges
  • for loop printing to create replacement columns
  • paste to glue the new column into the earlier sedded extract
  • and awk to transfer the new column into the old column’s position

awk can even replace an old column over a restricted range of line numbers in situ as long as the replacement values are some simple function of line number. You should learn it. I routinely rewrite an awk one-liner from scratch to calculate means, variances, and covariances.

You can even translate a macromolecule onto its centre of mass and align it along its principal axes entirely by processing the table of its particles’ masses and 3D coordinates in awk. You shouldn’t, but you can!

That means that the file(s) you are passing to the “converter” tools are already badly formed and not following the expected conventions.

Automated tools are convenient, but you still have to know what you are doing and cannot just feed them anything. The fact that you know what those files represent does not automatically mean that those tools recognize it.

This is clearly not a LAMMPS issue but a case of PEBKAC.