From 198d07e90570e92fc6ae1eea7723f2d203953d0d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 14 Apr 2022 11:06:35 -0400 Subject: [PATCH] print warning when fix property/atom is issues before reading a restart --- doc/src/fix_property_atom.rst | 16 +++++++++------- src/read_restart.cpp | 4 ++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/doc/src/fix_property_atom.rst b/doc/src/fix_property_atom.rst index cc92c18655..09286cca38 100644 --- a/doc/src/fix_property_atom.rst +++ b/doc/src/fix_property_atom.rst @@ -304,13 +304,15 @@ uninterrupted fashion. .. warning:: When reading data from a restart file, this fix command has to be - specified **exactly** the same was in the input script that created - the restart file. LAMMPS will only check whether a fix is of the - same style and has the same fix ID and in case of a match will then - try to initialize the fix with the data stored in the binary - restart file. If the names and associated date types in the new - fix property/atom command do not match the old one exactly, data - can be corrupted or LAMMPS may crash. + specified **after** the *read_restart* command and **exactly** the + same was in the input script that created the restart file. LAMMPS + will only check whether a fix is of the same style and has the same + fix ID and in case of a match will then try to initialize the fix + with the data stored in the binary restart file. If the names and + associated date types in the new fix property/atom command do not + match the old one exactly, data can be corrupted or LAMMPS may crash. + If the fix is specified **before** the *read_restart* command its + data will not be restored. None of the :doc:`fix_modify ` options are relevant to this fix. No global or per-atom quantities are stored by this fix for diff --git a/src/read_restart.cpp b/src/read_restart.cpp index dea062ed87..645f0c1d6d 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -118,6 +118,10 @@ void ReadRestart::command(int narg, char **arg) format_revision(); check_eof_magic(); + if ((comm->me == 0) && (modify->get_fix_by_style("property/atom").size() > 0)) + error->warning(FLERR, "Fix property/atom command must be specified after read_restart " + "to restore its data."); + // read header info which creates simulation box header();