Skip to content

Commit

Permalink
More conservative response - block if verbosity is high enough.
Browse files Browse the repository at this point in the history
Also default to medium
  • Loading branch information
ceriottm committed Nov 23, 2023
1 parent 884c780 commit 12af057
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
14 changes: 12 additions & 2 deletions ipi/engine/motion/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,14 @@ def pstep(self, level=0):
dstrip(self.forces.vir), np.zeros(len(self.forces.vir))
):
warning(
"Seems like no stress tensor was computed by the forcefield.",
"Forcefield returned a zero stress tensor. NPT simulation will likely make no sense",
verbosity.low,
)
if verbosity.medium:
raise ValueError(
"Zero stress terminates simulation for medium verbosity and above."
)

self._stresscheck = False

self.barostat.pstep(level)
Expand Down Expand Up @@ -748,9 +753,14 @@ def pstep(self, level=0):
dstrip(self.forces.vir), np.zeros(len(self.forces.vir))
):
warning(
"Seems like no stress tensor was computed by the forcefield.",
"Forcefield returned a zero stress tensor. NPT simulation will likely make no sense",
verbosity.low,
)
if verbosity.medium:
raise ValueError(
"Zero stress terminates simulation for medium verbosity and above."
)

self._stresscheck = False

self.barostat.pstep(level)
Expand Down
4 changes: 2 additions & 2 deletions ipi/engine/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ def load_from_xml(
simulation.bind(read_only)

# echo the input file if verbose enough
if verbosity.level > 0:
if verbosity.low:
print(" # i-PI loaded input file: ", fn_input)
if verbosity.level > 1:
elif verbosity.medium:
print(" --- begin input file content ---")
ifile = open(fn_input, "r")
for line in ifile.readlines():
Expand Down
2 changes: 1 addition & 1 deletion ipi/inputs/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class InputSimulation(Input):
InputAttribute,
{
"dtype": str,
"default": "low",
"default": "medium",
"options": ["quiet", "low", "medium", "high", "debug"],
"help": "The level of output on stdout.",
},
Expand Down

0 comments on commit 12af057

Please sign in to comment.