Skip to content

Commit

Permalink
Update geomopt option names
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliottKasoar committed Oct 17, 2024
1 parent 9336017 commit b9b5b79
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions aiida_mlip/calculations/geomopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ def define(cls, spec: CalcJobProcessSpec) -> None:
help="Path to save optimisation frames to",
)
spec.input(
"fully_opt",
"opt_cell_fully",
valid_type=Bool,
required=False,
help="Fully optimise the cell vectors, angles, and atomic positions",
)
spec.input(
"vectors_only",
"opt_cell_lengths",
valid_type=Bool,
required=False,
help="Optimise cell vectors, as well as atomic positions",
Expand Down Expand Up @@ -116,10 +116,10 @@ def prepare_for_submission(
if "opt_kwargs" in self.inputs:
opt_kwargs = self.inputs.opt_kwargs.get_dict()
geom_opt_cmdline["opt-kwargs"] = opt_kwargs
if "fully_opt" in self.inputs:
geom_opt_cmdline["fully-opt"] = self.inputs.fully_opt.value
if "vectors_only" in self.inputs:
geom_opt_cmdline["vectors-only"] = self.inputs.vectors_only.value
if "opt_cell_fully" in self.inputs:
geom_opt_cmdline["opt-cell-fully"] = self.inputs.opt_cell_fully.value
if "opt_cell_lengths" in self.inputs:
geom_opt_cmdline["opt-cell-lengths"] = self.inputs.opt_cell_lengths.value
if "fmax" in self.inputs:
geom_opt_cmdline["fmax"] = self.inputs.fmax.value
if "steps" in self.inputs:
Expand Down
2 changes: 1 addition & 1 deletion aiida_mlip/helpers/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def convert_to_nodes(dictionary: dict, convert_all: bool = False) -> dict:
"model": lambda v: load_model(v, arch),
"arch": Str,
"ensemble": Str,
"fully_opt": Bool,
"opt_cell_fully": Bool,
}
for key, value in new_dict.items():
if key in conv:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/user_guide/calculations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Below is a usage example with some additional geometry optimisation parameters.
GeomOptCalculation = CalculationFactory("mlip.opt")
submit(GeomOptCalculation, code=InstalledCode, structure=StructureData, max_force=Float(0.1), vectors_only=Bool(True))
submit(GeomOptCalculation, code=InstalledCode, structure=StructureData, max_force=Float(0.1), opt_cell_lengths=Bool(True))
.. note::
Expand Down
2 changes: 1 addition & 1 deletion docs/source/user_guide/data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The `store_content()` method accepts the following parameters:
- `store_all` (bool):
Determines whether to store all parameters or only specific ones.
By default, it's set to `False`.
When set to `False`, only the key parameters relevant for the provenance graph are stored: `code`, `structure`, `model`, `architecture`, `fully_opt` (for GeomOpt), and `ensemble` (for MD).
When set to `False`, only the key parameters relevant for the provenance graph are stored: `code`, `structure`, `model`, `architecture`, `opt_cell_fully` (for GeomOpt), and `ensemble` (for MD).
However, all inputs can be accessed in the config file at any time (just the config file will appear in the provenance graph as JanusConfigfile).
If `store_all` is set to `True`, all inputs are stored, either as specific data types (e.g. the input 'struct' is recognised as a StructureData type) or as Str.

Expand Down
8 changes: 4 additions & 4 deletions docs/source/user_guide/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ The other inputs can be set up as AiiDA Str. There is a default for every input
"precision": Str("float64"),
"device": Str("cpu"),
"max_force": Float(0.1), # Specific to geometry optimisation: convergence criteria
"vectors_only": Bool(False), # Specific to geometry optimisation
"fully_opt": Bool(True), # Specific to geometry optimisation: to optimise the cell
"opt_cell_lengths": Bool(False), # Specific to geometry optimisation
"opt_cell_fully": Bool(True), # Specific to geometry optimisation: to optimise the cell
"metadata": {"options": {"resources": {"num_machines": 1}}},
}
Expand Down Expand Up @@ -162,14 +162,14 @@ The calculation can also be interacted with through verdi cli. Use `verdi proces
architecture 1121 Str
code 2 InstalledCode
device 1123 Str
fully_opt 1126 Bool
opt_cell_fully 1126 Bool
log_filename 1128 Str
max_force 1124 Float
model 1119 ModelData
precision 1122 Str
structure 1120 StructureData
traj 1129 Str
vectors_only 1125 Bool
opt_cell_lengths 1125 Bool
xyz_output_name 1127 Str
Outputs PK Type
Expand Down
16 changes: 8 additions & 8 deletions examples/calculations/submit_geomopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def geomopt(params: dict) -> None:
"precision": Str(params["precision"]),
"device": Str(params["device"]),
"fmax": Float(params["fmax"]),
"vectors_only": Bool(params["vectors_only"]),
"fully_opt": Bool(params["fully_opt"]),
"opt_cell_lengths": Bool(params["opt_cell_lengths"]),
"opt_cell_fully": Bool(params["opt_cell_fully"]),
# "opt_kwargs": Dict({"restart": "rest.pkl"}),
"steps": Int(params["steps"]),
}
Expand Down Expand Up @@ -83,13 +83,13 @@ def geomopt(params: dict) -> None:
)
@click.option("--fmax", default=0.1, type=float, help="Maximum force for convergence.")
@click.option(
"--vectors_only",
"--opt_cell_lengths",
default=False,
type=bool,
help="Optimise cell vectors, as well as atomic positions.",
)
@click.option(
"--fully_opt",
"--opt_cell_fully",
default=False,
type=bool,
help="Fully optimise the cell vectors, angles, and atomic positions.",
Expand All @@ -105,8 +105,8 @@ def cli(
device,
precision,
fmax,
vectors_only,
fully_opt,
opt_cell_lengths,
opt_cell_fully,
steps,
) -> None:
# pylint: disable=too-many-arguments
Expand All @@ -125,8 +125,8 @@ def cli(
"device": device,
"precision": precision,
"fmax": fmax,
"vectors_only": vectors_only,
"fully_opt": fully_opt,
"opt_cell_lengths": opt_cell_lengths,
"opt_cell_fully": opt_cell_fully,
"steps": steps,
}

Expand Down
4 changes: 2 additions & 2 deletions examples/tutorials/geometry-optimisation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@
" \"precision\": Str(\"float64\"),\n",
" \"device\": Str(\"cpu\"),\n",
" \"fmax\": Float(0.1), \n",
" \"vectors_only\": Bool(False), \n",
" \"fully_opt\": Bool(True), \n",
" \"opt_cell_lengths\": Bool(False), \n",
" \"opt_cell_fully\": Bool(True), \n",
" \"metadata\": {\"options\": {\"resources\": {\"num_machines\": 1}}},\n",
" }"
]
Expand Down
2 changes: 1 addition & 1 deletion tests/calculations/test_geomopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def test_run_opt(model_folder, janus_code):
"struct": StructureData(ase=bulk("NaCl", "rocksalt", 5.63)),
"model": ModelData.from_local(model_file, architecture="mace"),
"device": Str("cpu"),
"fully_opt": Bool(True),
"opt_cell_fully": Bool(True),
"fmax": Float(0.1),
"steps": Int(1000),
}
Expand Down

0 comments on commit b9b5b79

Please sign in to comment.