From 9eabda30c0ccad5d6ca2f94ede33c22270c89d03 Mon Sep 17 00:00:00 2001 From: Michele Nottoli <michele.nottoli@gmail.com> Date: Tue, 7 Nov 2023 14:37:19 +0100 Subject: [PATCH] Update. --- gext/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gext/main.py b/gext/main.py index 18716ea..71de73a 100644 --- a/gext/main.py +++ b/gext/main.py @@ -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") -- GitLab