Skip to content
Snippets Groups Projects
Commit 9eabda30 authored by Michele Nottoli's avatar Michele Nottoli
Browse files

Update.

parent 8069bfc3
Branches
Tags
Loading
Pipeline #1960 passed
......@@ -25,6 +25,9 @@ class Extrapolator:
def __init__(self, nelectrons: int, nbasis: int, natoms: int, **kwargs):
if not (type(nelectrons) == int and type(nbasis) == int and type(natoms) == int):
raise ValueError("Dimensions are not integers")
self.nelectrons = nelectrons
self.nbasis = nbasis
self.natoms = natoms
......@@ -47,6 +50,7 @@ class Extrapolator:
descriptor_options = {}
fitting_options = {}
# set specified options
for key, value in kwargs.items():
if key in self.supported_options:
self.options[key] = value
......@@ -57,10 +61,13 @@ class Extrapolator:
else:
raise ValueError(f"Unsupported option: {key}")
# set unspecified options with defaults
for option, default_value in self.supported_options.items():
if not option in self.options:
self.options[option] = default_value
# do some check on the options, set things and pipe options
# to submodules
if self.options["nsteps"] < 1 or self.options["nsteps"] >= 100:
raise ValueError("Unsupported nsteps")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment