Skip to content

Commit

Permalink
bug fixes in input
Browse files Browse the repository at this point in the history
  • Loading branch information
srmnitc committed Sep 11, 2023
1 parent ccda67b commit fcfb4ae
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions calphy/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import itertools
import shutil
import numpy as np
import datetime

def read_report(folder):
"""
Expand Down Expand Up @@ -735,9 +736,10 @@ def generate(cls, indata):
calc = cls()
calc.element = indata["element"]
calc.mass = indata["mass"]
calc.script_mode = indata["script_mode"]
calc.lammps_executable = indata["lammps_executable"]
calc.mpi_executable = indata["mpi_executable"]

calc.script_mode = check_dict(indata, "script_mode", retval=False)
calc.lammps_executable = check_dict(indata, "lammps_executable")
calc.mpi_executable = check_dict(indata, "mpi_executable")

if "md" in indata.keys():
calc.md.add_from_dict(indata["md"])
Expand Down Expand Up @@ -853,3 +855,8 @@ def load_job(filename):
job = np.load(filename, allow_pickle=True).flatten()[0]
return job

def check_dict(indict, key, retval=None):
if key in indict.items():
return indict[key]
else:
return retval

0 comments on commit fcfb4ae

Please sign in to comment.