problem with write_data

I am having a problem with the write_data command. When I use read_data and then later use write_data, the Improper Coeffs that were in the original data file are not in the file created by write_data. All the other data about the impropers is still there though. I am using lammps-1Feb14.

I’ve attached a simple example that duplicates this problem.
in.test is the input file
data.txt is the data file
write.txt is the file that write_data produces

-Steven

write.txt (1.23 KB)

log.lammps (785 Bytes)

in.test (202 Bytes)

data.txt (522 Bytes)

It may have to do with the IMPORTANT NOTE from its doc page:

“IMPORTANT NOTE: The write-data command is not yet fully implemented in two respects. First, most pair styles do not yet write their coefficient information into the data file. This means you will need to specify that information in your input script that reads the data file, via the pair_coeff command. ”

Ray

I don’t think that note applies to this situation, because the problem is not with a pair style’s coefficients, but with an atom style’s parameters. And I don’t think the second part of that note applies either, because the relevant atom_style is molecular, which is not one of the ones listed.
-Steven

At the moment at least, it's currently safer to keep all of your
"coeff" commands in a LAMMPS input script, and use the DATA files only
for atom coordinates, charge, and bond (angle, dihedral improper)
topology. That way when you use write_data and read_data, all of your
coeffs (being saved in a different file) are not effected.

--- why ---
It might be a long time before the "write_data" command reliably
stores coeff commands, because the syntax of these "coeff" commands is
different for each and every pair_styles, and bonded styles. This
means someone would have to dig through all of those styles (many of
which were not even written by the LAMMPS developers), and add a
"write_data()" member function to each of those C++ classes so that
the correct stuff gets written to the data file.

In fact, I admit to being too lazy to do this myself. (I've written a
dihedral_style and a pair_style. It was hard enough to get restart
files working.) I have not yet implemented "write_data()", and I sure
don't expect Steve to do it.

If you think restart files are safe, they're not, and for the same
reason. (I remember a few years ago, some of the LAMMPS angle styles
did not work with restart files. Things have improved though.)

--- sorry, end of rant ---

Anyway, If you want to be really cautious, keep all of your "coeff"
commands in a separate input script.

Cheers
Andrew

At the moment at least, it's currently safer to keep all of your
"coeff" commands in a LAMMPS input script, and use the DATA files only
for atom coordinates, charge, and bond (angle, dihedral improper)
topology. That way when you use write_data and read_data, all of your
coeffs (being saved in a different file) are not effected.

​but it is good to report these cases. if nobody mentions it, its chances
to get implemented are much smaller.​

--- why ---

It might be a long time before the "write_data" command reliably
stores coeff commands, because the syntax of these "coeff" commands is
different for each and every pair_styles, and bonded styles. This
means someone would have to dig through all of those styles (many of
which were not even written by the LAMMPS developers), and add a
"write_data()" member function to each of those C++ classes so that
the correct stuff gets written to the data file.

​it is not quite as bad. if i remember correctly, all bonds and angle
styles are completely converted and many dihedral and improper styles as
well. at least all styles that are required by msi2lmp do have a working
write_data function, since i use data files from write_data for regression
testing of the code.
also, implementing the write_data function is usually not very complicated.
but it cannot be automated, so it will only be done when necessary and
ideally by those that contributed the original code to LAMMPS.

axel.

Thanks for the advice.

This is b/c the improper umbrella style didn’t yet
have the write_data() function to write its info
to a data file.

Just added it, will be in next patch …

Steve