Skip to content

Commit

Permalink
Fix detection of scalar temperature to work with any scalar, since e.…
Browse files Browse the repository at this point in the history
…g. np.float64 failed with previous isinstance(float) check
  • Loading branch information
bernstei committed Oct 24, 2024
1 parent e3ecb49 commit 064a6b7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions wfl/generate/md/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,14 @@ def _get_temperature(atoms):
raise RuntimeError(f'NVE (temperature_tau is None) can only accept temperature=float for initial T, got {type(temperature_use)}')

if temperature_use is not None:
if isinstance(temperature_use, (float, int)):
# float into a list
temperature_use = [temperature_use]
# assume that dicts are already in temperature profile format
if not isinstance(temperature_use, dict):
try:
# check if it's a list, tuple, etc
len(temperature_use)
except:
# number into a list
temperature_use = [temperature_use]
if not isinstance(temperature_use[0], dict):
# create a stage dict from a constant or ramp
t_stage_data = temperature_use
Expand Down

0 comments on commit 064a6b7

Please sign in to comment.