diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index c693b7d565..24c49d8f12 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -196,7 +196,7 @@ class Atom(object): :type: float """ - return self.get("mass", self.index) + return self.get("mass", self.type) @property def radius(self): @@ -532,6 +532,18 @@ class PyLammps(object): """ self._cmd_history = [] + + def append_cmd_history(self, cmd): + """ + Commands will be added to the command history but not executed. + + Add `commands` only to the command history, but do not execute them, so that you can + conveniently create Lammps input files, using + :py:meth:`PyLammps.write_script()`. + """ + self._cmd_history.append(cmd) + + def command(self, cmd): """ Execute LAMMPS command