diff --git a/janus_core/cli.py b/janus_core/cli.py index f2a7a9b8..bf6e85b6 100644 --- a/janus_core/cli.py +++ b/janus_core/cli.py @@ -82,7 +82,11 @@ def parse_dict_class(value: str): TyperDict, typer.Option( parser=parse_dict_class, - help="Keyword arguments to pass to selected calculator [default: {}]", + help=( + "Keyword arguments to pass to selected calculator. For the default " + "architecture ('mace_mp'), {'model':'small'} is set by default " + "[default: {}]" + ), metavar="DICT", ), ] @@ -92,7 +96,7 @@ def parse_dict_class(value: str): parser=parse_dict_class, help=( "Keyword arguments to pass to ase.io.write when saving " - "results [default: {}]" + "results [default: {}]" ), metavar="DICT", ), @@ -162,9 +166,7 @@ def singlepoint( calc_kwargs=calc_kwargs, log_kwargs={"filename": log_file, "filemode": "w"}, ) - s_point.run_single_point( - properties=properties, write_results=True, write_kwargs=write_kwargs - ) + s_point.run(properties=properties, write_results=True, write_kwargs=write_kwargs) @app.command() @@ -184,7 +186,13 @@ def geomopt( # pylint: disable=too-many-arguments,too-many-locals ] = False, vectors_only: Annotated[ bool, - typer.Option("--vectors-only", help="Allow only cell vectors to change"), + typer.Option( + "--vectors-only", + help=( + "Disable optimizing cell angles, so only cell vectors and atomic " + "positions are optimized. Requires --fully-opt to be set" + ), + ), ] = False, read_kwargs: ReadKwargs = None, calc_kwargs: CalcKwargs = None, diff --git a/janus_core/single_point.py b/janus_core/single_point.py index a0fd87e8..0de65070 100644 --- a/janus_core/single_point.py +++ b/janus_core/single_point.py @@ -69,7 +69,7 @@ class SinglePoint: Read structure and structure name. set_calculator(**kwargs) Configure calculator and attach to structure. - run_single_point(properties=None) + run(properties=None) Run single point calculations. """ @@ -298,7 +298,7 @@ def _clean_results( else: self._remove_invalid_props(self.struct, results, properties) - def run_single_point( + def run( self, properties: MaybeSequence[str] = (), write_results: bool = False, diff --git a/tests/test_geom_opt.py b/tests/test_geom_opt.py index b3824952..4f24f0a5 100644 --- a/tests/test_geom_opt.py +++ b/tests/test_geom_opt.py @@ -46,7 +46,7 @@ def test_optimize(architecture, struct_path, expected, kwargs): calc_kwargs={"model": MODEL_PATH}, ) - init_energy = single_point.run_single_point("energy")["energy"] + init_energy = single_point.run("energy")["energy"] atoms = optimize(single_point.struct, **kwargs) @@ -64,7 +64,7 @@ def test_saving_struct(tmp_path): calc_kwargs={"model": MODEL_PATH}, ) - init_energy = single_point.run_single_point("energy")["energy"] + init_energy = single_point.run("energy")["energy"] optimize( single_point.struct, diff --git a/tests/test_mlip_calculators.py b/tests/test_mlip_calculators.py index e458208d..760679d8 100644 --- a/tests/test_mlip_calculators.py +++ b/tests/test_mlip_calculators.py @@ -52,15 +52,3 @@ def test_model_model_paths(): model=MODEL_PATH, model_paths=MODEL_PATH, ) - with pytest.raises(ValueError): - choose_calculator( - architecture="mace_mp", - model=MODEL_PATH, - model_paths=MODEL_PATH, - ) - with pytest.raises(ValueError): - choose_calculator( - architecture="mace_off", - model=MODEL_PATH, - model_paths=MODEL_PATH, - ) diff --git a/tests/test_single_point.py b/tests/test_single_point.py index f3cf86ba..e66a39db 100644 --- a/tests/test_single_point.py +++ b/tests/test_single_point.py @@ -38,7 +38,7 @@ def test_potential_energy( single_point = SinglePoint( struct_path=struct_path, architecture="mace", calc_kwargs=calc_kwargs ) - results = single_point.run_single_point(properties)[prop_key] + results = single_point.run(properties)[prop_key] # Check correct values returned if idx is not None: @@ -60,7 +60,7 @@ def test_single_point_none(): calc_kwargs={"model": MODEL_PATH}, ) - results = single_point.run_single_point() + results = single_point.run() for prop in ["energy", "forces", "stress"]: assert prop in results @@ -73,7 +73,7 @@ def test_single_point_clean(): calc_kwargs={"model": MODEL_PATH}, ) - results = single_point.run_single_point() + results = single_point.run() for prop in ["energy", "forces"]: assert prop in results assert "stress" not in results @@ -89,7 +89,7 @@ def test_single_point_traj(): ) assert len(single_point.struct) == 2 - results = single_point.run_single_point("energy") + results = single_point.run("energy") assert results["energy"][0] == pytest.approx(-76.0605725422795) assert results["energy"][1] == pytest.approx(-74.80419118083256) @@ -107,7 +107,7 @@ def test_single_point_write(): ) assert "forces" not in single_point.struct.arrays - single_point.run_single_point(write_results=True) + single_point.run(write_results=True) atoms = read_atoms(results_path) assert atoms.get_potential_energy() is not None @@ -126,9 +126,7 @@ def test_single_point_write_kwargs(tmp_path): ) assert "forces" not in single_point.struct.arrays - single_point.run_single_point( - write_results=True, write_kwargs={"filename": results_path} - ) + single_point.run(write_results=True, write_kwargs={"filename": results_path}) atoms = read(results_path) assert atoms.get_potential_energy() is not None assert "forces" in atoms.arrays @@ -144,13 +142,11 @@ def test_single_point_write_nan(tmp_path): calc_kwargs={"model": MODEL_PATH}, ) - assert isfinite(single_point.run_single_point("energy")["energy"]).all() + assert isfinite(single_point.run("energy")["energy"]).all() with pytest.raises(ValueError): - single_point.run_single_point("stress") + single_point.run("stress") - single_point.run_single_point( - write_results=True, write_kwargs={"filename": results_path} - ) + single_point.run(write_results=True, write_kwargs={"filename": results_path}) atoms = read(results_path) assert atoms.get_potential_energy() is not None assert "forces" in atoms.calc.results @@ -165,7 +161,7 @@ def test_invalid_prop(): calc_kwargs={"model": MODEL_PATH}, ) with pytest.raises(NotImplementedError): - single_point.run_single_point("invalid") + single_point.run("invalid") def test_atoms(): @@ -178,7 +174,7 @@ def test_atoms(): calc_kwargs={"model": MODEL_PATH}, ) assert single_point.struct_name == "NaCl" - assert single_point.run_single_point("energy")["energy"] < 0 + assert single_point.run("energy")["energy"] < 0 def test_default_atoms_name(): diff --git a/tests/utils.py b/tests/utils.py index 00157afc..afcc3023 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,4 +1,4 @@ -"""Utility functions for tests""" +"""Utility functions for tests.""" from pathlib import Path from typing import Union