Hi, every one
I have a simple problem.
I have a data file for 144 carbon atoms and I want to assign a charge to each individual atoms. but when I type q x y z amounts in the data file, an error occurs and say : incorrect atom format in data file…
See the atom_style and read_data commands.
They give the format of the data file for styles
that include per-atom charge. If you don’t
follow those instuctions you will get an error.
Defintely do read that documentation. Here are the links:
Check to make sure you are using the correct atom_style (eg
"atom_style atom" or "atom_style full"). Also be sure to check that
the number of atoms declared at the top of the data file matches the
number of (non-blank) lines in the "Atoms" section.
If you are really stuck, try editing the code to the "atom.cpp"
file (from the LAMMPS source code, on lines 699, 760, and 764, so that
it prints out the line where the error occurred). Then recompile
LAMMPS and run it again using your input files. For example, replace:
error->all(FLERR,"Incorrect atom format in data file");
with something like this (I think):
sprintf(err_msg,"Incorrect atom format in data file\n\"%s\"\n", buff);
Alternately, try reading the data file in some other program which
reads data files, like topotools or moltemplate/ltemplify.
For example moltemplate comes with a data-file parser "ltemplify.py"
which can sometimes catch errors in your data file. This requires two
Step 1) importing the DATA file into moltemplate format (.LT) using
You will need an input script for this step.
Step 2) Then try running moltemplate.sh on that LT file to see if it
catches any mistakes.
For an example, see this post:
Unfortunately this will be slow and use a lot of memory on a system
with more than 200000 atoms. And I doubt moltemplate will help, given
the error message you are having.
Sometimes, I also find that using topotools in VMD to read the file
prints useful error messages:
topo readlammpsdata MY_DATA_FILE full
(You may have to replace "full" with some other atom-style-name to get
this to work. In so doing, you will figure out what's wrong.)
Firs I must say that thank you for all your kind response and excellent comments.
I saw the pages you mentioned and I found the correct way of which I must be in. Now, the error has gone and I really appreciate your notes.