From d0cf344f0a71297a09e6bd589bd3dc727a159d98 Mon Sep 17 00:00:00 2001 From: James Graham <james@ramos.ecs.soton.ac.uk> Date: Mon, 9 Oct 2017 13:02:37 +0100 Subject: [PATCH] Give warning when no box size set - resolves #4 --- lib/coordreaders.py | 2 +- pdb2lmp.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/coordreaders.py b/lib/coordreaders.py index ae968b4..5ef61e2 100644 --- a/lib/coordreaders.py +++ b/lib/coordreaders.py @@ -9,7 +9,7 @@ class CoordReader: def __init__(self): self.atoms = [] self.molecules = [] - self.cell = [] + self.cell = [0, 0, 0] @property def natoms(self): diff --git a/pdb2lmp.py b/pdb2lmp.py index 76a748c..a2b3844 100755 --- a/pdb2lmp.py +++ b/pdb2lmp.py @@ -167,6 +167,9 @@ class PDB2LMP: print("{0:8d} improper types".format(self.nimpropers.types), file=data) print(file=data) cell = [val / 2 for val in self.coords.cell] + if cell == [0, 0, 0]: + print("WARNING: The simulation box/unit cell size is zero.") + print(" If this is not intentional, please check your input files.") print("{0:8.3f} {1:8.3f} xlo xhi".format(-cell[0], cell[0]), file=data) print("{0:8.3f} {1:8.3f} ylo yhi".format(-cell[1], cell[1]), file=data) print("{0:8.3f} {1:8.3f} zlo zhi".format(-cell[2], cell[2]), file=data) -- GitLab