Skip to content

Commit

Permalink
BUG: Fix cell_angles being unable to accept None
Browse files Browse the repository at this point in the history
  • Loading branch information
BvB93 committed Oct 6, 2023
1 parent b43801f commit 2db7a99
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions nanoqm/workflows/input_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,10 @@ def add_cell_parameters(self) -> None:
for s in (self.general.cp2k_settings_main, self.general.cp2k_settings_guess):
if self.general.file_cell_parameters is None:
s.cell_parameters = self.general.cell_parameters
s.cell_angles = None
s.cell_angles = self.general.cell_angles
else:
s.cell_parameters = None
s.cell_angles = None
s.cell_angles = None

def add_periodic(self) -> None:
"""Add the keyword for the periodicity of the system."""
Expand Down
5 changes: 4 additions & 1 deletion nanoqm/workflows/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ def validate(self, data: Any, **kwargs: Any) -> Any:
"periodic": any_lambda(("none", "x", "y", "z", "xy", "xy", "yz", "xyz")),

# Specify the angles between the vectors defining the unit cell
Optional("cell_angles", default=None): list,
Optional("cell_angles", default=None): Or(
None,
lambda xs: isinstance(xs, list) and len(xs) == 3 and all(isinstance(i, Real) for i in xs),
),

# Path to the folder containing the basis set specifications
Optional(
Expand Down
2 changes: 1 addition & 1 deletion test/test_files/input_fast_test_derivative_couplings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ cp2k_general_settings:
potential: "GTH-PBE"
basis: "DZVP-MOLOPT-SR-GTH"
cell_parameters: 10.0
cell_angles: [90.0, 90.0, 90.0]
cell_angles: null
periodic: none
executable: cp2k.ssmp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ cp2k_general_settings:
basis: "DZVP-MOLOPT-SR-GTH"
potential: "GTH-PBE"
cell_parameters: 28.0
cell_angles: [90.0, 90.0, 90.0]
periodic: xyz
executable: cp2k.ssmp

Expand Down

0 comments on commit 2db7a99

Please sign in to comment.