Is there a tool (maybe a python tool) to build a simple input file to be read by read_data that obeys the canonical LAMMPS data file formatting? There didn’t appear to be anything like this in the pizza.py scripts. I’m looking at, e.g., examples/micelle/data.micelle and using that as my starting point, but it complains about my formatting and this is hard to debug. It would be nice if there was a tool available to do this with the canonical LAMMPS formatting. Not looking at putting together complicated bio-molecules… just a few particles where I want them.
I’m trying something drop-dead simple, and it doesn’t like SOMETHING about my formatting, and I don’t have time to get out the debugger and step through the code to figure out what, precisely it doesn’t like. It’s not clear to me whether I’m always required to put the moleculeID and charge if the atom style doesn’t require it. But I tried various versions with/without moleculeID and charge information.
------------------------ here’s the data file I’m trying to read with read_data ------------------
Blockquote Why not use LAMMPS itself? It has some building capabilities which allow for already complex structures. Is there a specific need for you to want to load/read the data files with some Python script?
I’m using the python interface and issuing a bunch of “create_atom single” commands, but that seems a bit kludgey. I should be able to figure out how to format a simple input file. But I guess it’s fine issuing a bunch of “create_atom single” commands, and I’ll live with it.
It’s not clear to me whether I’m always required to put the moleculeID and charge if the atom style doesn’t require it.
The required “attributes” that you need to specify in the data file depends on the style (there are different styles). In other words, each style has a different set of “attributes”, so whether you need to specify one thing or another depends on the style you intend to use. As Germain said, this information you can find in the “read_data command” page of the manual. I dont think there is a “canonical LAMMPS data formatting”, if I understood correctly what you meant by that.
Is there a tool (maybe a python tool) to build a simple input file to be read by read_data that obeys the canonical LAMMPS data file formatting?
Once you master the general formatting rules (spacings, “attributes needed” for the given style you are using, etc), you can always have your own python code to build an inital microstate cherishing the desired relative positionings + the corresponding connectivity. Then afterwards, it is just ctrl C, ctrl V.
Or, if you already have the initial microstate in another format, there are many different softwares that can read a file in format “whatever” and allow you to export it to a LAMMPS data format of different styles.
Yeah… I end up invoking the lammps python interface and calling create_atoms single a bunch of times ( I obviously want more than 2) from the python interface to put the atoms where I want and then calling write_data through the python interface. But it just seems silly/inconvenient/frustrating to me that the required input data file formatting is so finicky that I can’t just figure out what’s wrong with the formatting in my input data file.
This is just a matter of taste but I like the LAMMPS data file, because it’s human readable (ever may it be so). You don’t have to splice together little filescraps from all across your project, or reprocess it into binary gobbledygook just to change bond topology (looking at you, GROMACS).
Sure, it can be finicky with whitespace and empty lines and so on, but I think it strikes a good balance between editable and expressive. I’ve screwed around with my data files via awk a lot and never really had any adverse side effects.
I guess you could just diff the LAMMPS-generated data file with your own version and see if there’s a difference?