From 41c2ea42bdac0840a9bdbc42be0bf12917050416 Mon Sep 17 00:00:00 2001 From: stefanch Date: Thu, 4 Feb 2021 14:34:17 +0100 Subject: [PATCH] bugfix --- .gitignore | 1 + README.md | 4 ++-- setup.py | 1 - sgdml/__init__.py | 2 +- sgdml/cli.py | 36 ++++++++---------------------------- sgdml/train.py | 8 +++++++- 6 files changed, 19 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index 0518e12..6a6df3b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ # Python egg metadata, regenerated from source files by setuptools. /*.egg-info /*.egg +sgdml/_bmark_cache.npz diff --git a/README.md b/README.md index d3e48a1..77b87d8 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ For more details visit: [http://sgdml.org/](http://sgdml.org/) Documentation can be found here: [http://sgdml.org/doc/](http://sgdml.org/doc/) #### Requirements: -- Python 2.7/3.7+ +- Python 3.7+ - NumPy (>=1.19) - SciPy (>=1.1) #### Optional: - PyTorch (for GPU acceleration) -- ASE (to run atomistic simulations) +- ASE (>=3.16.2) (to run atomistic simulations) ## Getting started diff --git a/setup.py b/setup.py index 2a7f949..c10ac0a 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,6 @@ def get_property(property, package): 'License :: OSI Approved :: MIT License', 'Operating System :: MacOS :: MacOS X', 'Operating System :: POSIX :: Linux', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.7', 'Topic :: Scientific/Engineering :: Chemistry', 'Topic :: Scientific/Engineering :: Physics', diff --git a/sgdml/__init__.py b/sgdml/__init__.py index d9480cf..fcda3e5 100755 --- a/sgdml/__init__.py +++ b/sgdml/__init__.py @@ -22,7 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -__version__ = '0.4.10.dev2' +__version__ = '0.4.10' MAX_PRINT_WIDTH = 100 LOG_LEVELNAME_WIDTH = 7 # do not modify diff --git a/sgdml/cli.py b/sgdml/cli.py index 94b098d..08e5e81 100644 --- a/sgdml/cli.py +++ b/sgdml/cli.py @@ -1833,34 +1833,7 @@ def _add_argument_dir_with_file_type(parser, type, or_file=False): help='user-defined model output file name', ) - for subparser in [parser_all, parser_create]: - group = subparser.add_mutually_exclusive_group() - group.add_argument( - '--cg', - dest='use_cg', - action='store_true', - help='use iterative solver (conjugate gradient) with Nystroem preconditioner', - # help=argparse.SUPPRESS - ) - subparser.add_argument( - '--ip', - dest='n_inducing_pts_init', - metavar='', - type=io.is_strict_pos_int, - help='initial number of inducing points (<= n_train) to use for preconditioner matrix (default: 25, larger value: fewer iterations, but higher per-iteration memory and processing cost)', - nargs='?', - default=25, - ) - subparser.add_argument( - '--coff', - dest='interact_cut_off', - metavar='', - type=io.is_strict_pos_int, - help='decay pairwise interactions to zero from a given distance (localizes the model)', - nargs='?', - default=None, - ) - + # train _add_argument_dir_with_file_type(parser_train, 'task', or_file=True) @@ -1935,6 +1908,13 @@ def _add_argument_dir_with_file_type(parser, type, or_file=False): args['solver'] = 'cg' args.pop('use_cg', None) + + # TODO: remove dummy variables once iterative solver ships + missing_keys = ['n_inducing_pts_init', 'interact_cut_off', 'use_cg'] + for missing_key in missing_keys: + if missing_key not in args: + args[missing_key] = None + try: getattr(sys.modules[__name__], args['command'])(**args) except AssistantError as err: diff --git a/sgdml/train.py b/sgdml/train.py index 36ca79d..97608ef 100755 --- a/sgdml/train.py +++ b/sgdml/train.py @@ -47,7 +47,13 @@ from . import __version__, DONE, NOT_DONE from .solvers.analytic import Analytic -from .solvers.iterative import Iterative + +# TODO: remove exception handling once iterative solver ships +try: + from .solvers.iterative import Iterative +except ImportError: + pass + from .predict import GDMLPredict from .utils.desc import Desc from .utils import io, perm, ui