Skip to content

Commit 43899cd

Browse files
committed
Fix test failures after rebase
1 parent 7d8710c commit 43899cd

File tree

2 files changed

+38
-15
lines changed

2 files changed

+38
-15
lines changed

janus_core/calculations/geom_opt.py

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
from collections.abc import Callable
66
import inspect
77
from pathlib import Path
8-
from typing import Any, Callable
9-
8+
from typing import Any
109
import warnings
1110

1211
from ase import Atoms, constraints, filters, units
@@ -125,10 +124,10 @@ def __init__(
125124
filter_class: Callable | str | None = FrechetCellFilter,
126125
filter_func: Callable | str | None = None,
127126
filter_kwargs: dict[str, Any] | None = None,
128-
optimizer: Callable | str = LBFGS,
129-
opt_kwargs: ASEOptArgs | None = None,
130127
constraint_func: Callable | str | None = None,
131128
constraint_kwargs: dict[str, Any] | None = None,
129+
optimizer: Callable | str = LBFGS,
130+
opt_kwargs: ASEOptArgs | None = None,
132131
write_results: bool = False,
133132
write_kwargs: OutputKwargs | None = None,
134133
write_traj: bool = False,
@@ -185,6 +184,11 @@ def __init__(
185184
Deprecated. Please use `filter_class`.
186185
filter_kwargs
187186
Keyword arguments to pass to filter_class. Default is {}.
187+
constraint_func
188+
Constraint function, or name of function from ase.constraints. Default is
189+
None.
190+
constraint_kwargs
191+
Keyword arguments to pass to constraint_func. Default is {}.
188192
optimizer
189193
Optimization function, or name of function from ase.optimize. Default is
190194
`LBFGS`.
@@ -202,9 +206,21 @@ def __init__(
202206
"filename" keyword is inferred from `file_prefix` if not given.
203207
Default is {}.
204208
"""
205-
read_kwargs, constraint_kwargs, filter_kwargs, opt_kwargs, write_kwargs, traj_kwargs = (
209+
(
210+
read_kwargs,
211+
constraint_kwargs,
212+
filter_kwargs,
213+
opt_kwargs,
214+
write_kwargs,
215+
traj_kwargs,
216+
) = list(
206217
none_to_dict(
207-
(read_kwargs, constraint_kwargs, filter_kwargs, opt_kwargs, write_kwargs, traj_kwargs)
218+
read_kwargs,
219+
constraint_kwargs,
220+
filter_kwargs,
221+
opt_kwargs,
222+
write_kwargs,
223+
traj_kwargs,
208224
)
209225
)
210226

@@ -220,7 +236,7 @@ def __init__(
220236
self.filter_class = filter_class
221237
self.filter_kwargs = filter_kwargs
222238
self.constraint_func = constraint_func
223-
self.constraint_kwargs = constraint_kwargs
239+
self.constraint_kwargs = constraint_kwargs
224240
self.optimizer = optimizer
225241
self.opt_kwargs = opt_kwargs
226242
self.write_results = write_results
@@ -312,7 +328,8 @@ def output_files(self) -> None:
312328
}
313329

314330
def _set_mandatory_constraint_kwargs(self) -> None:
315-
"""Inspect constraint class for mandatory arguments
331+
"""
332+
Inspect constraint class for mandatory arguments.
316333
317334
For now we are just looking for the "atoms" parameter of FixSymmetry
318335
"""
@@ -369,9 +386,11 @@ def _set_functions(self) -> None:
369386
try:
370387
self.constraint_func = getattr(constraints, self.constraint_func)
371388
except AttributeError as e:
372-
raise AttributeError(f"No such constraint: {self.constraint_func}") from e
389+
raise AttributeError(
390+
f"No such constraint: {self.constraint_func}"
391+
) from e
373392

374-
if self.filter_class is not None and isinstance(self.filter_func, str):
393+
if self.filter_class is not None and isinstance(self.filter_class, str):
375394
try:
376395
self.filter_class = getattr(filters, self.filter_class)
377396
except AttributeError as e:

janus_core/cli/geomopt.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,13 @@ def geomopt(
125125
rich_help_panel="Calculation",
126126
),
127127
] = None,
128+
filter_func: Annotated[
129+
str | None,
130+
Option(help="Deprecated. Please use --filter", rich_help_panel="Calculation"),
131+
] = None,
128132
constraint_func: Annotated[
129133
str,
130-
Option(
131-
help="Name of ASE constraint function to use."
132-
),
134+
Option(help="Name of ASE constraint function to use."),
133135
] = None,
134136
pressure: Annotated[
135137
float,
@@ -213,10 +215,12 @@ def geomopt(
213215
filter_class
214216
Name of filter from ase.filters to wrap around atoms. If using
215217
--opt-cell-lengths or --opt-cell-fully, defaults to `FrechetCellFilter`.
218+
filter_func
219+
Deprecated. Please use --filter.
216220
constraint_func
217221
Name of constraint function from ase.constraints, to apply constraints
218222
to atoms. Parameters should be included as a "constraint_kwargs" dict
219-
within "minimize_kwargs". Default is None
223+
within "minimize_kwargs". Default is None.
220224
pressure
221225
Scalar pressure when optimizing cell geometry, in GPa. Passed to the filter
222226
function if either `opt_cell_lengths` or `opt_cell_fully` is True. Default is
@@ -340,7 +344,7 @@ def geomopt(
340344
"track_carbon": tracker,
341345
"optimizer": optimizer,
342346
"fmax": fmax,
343-
"steps": steps,<<<<<< HEAD
347+
"steps": steps,
344348
"symmetrize": symmetrize,
345349
"symmetry_tolerance": symmetry_tolerance,
346350
"file_prefix": file_prefix,

0 commit comments

Comments
 (0)