Skip to content

Commit

Permalink
Merge pull request #63 from pyiron/axes_tuple
Browse files Browse the repository at this point in the history
energy volume curve - use axes = ("x", "y", "z") rather than axes = ["x", "y", "z"]
  • Loading branch information
jan-janssen authored Nov 18, 2023
2 parents 864f9f4 + c24c209 commit 4e59102
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
9 changes: 5 additions & 4 deletions atomistics/workflows/evcurve/workflow.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import numpy as np
from ase.atoms import Atoms
from typing import Literal
from collections import OrderedDict

from atomistics.workflows.evcurve.fit import EnergyVolumeFit
from atomistics.workflows.shared.workflow import Workflow


def _strain_axes(
structure: Atoms, axes: Literal["x", "y", "z"], volume_strain: float
structure: Atoms, volume_strain: float, axes: tuple[str, str, str] = ("x", "y", "z")
) -> Atoms:
"""
Strain box along given axes to achieve given *volumetric* strain.
Expand Down Expand Up @@ -75,7 +74,7 @@ def __init__(
fit_type="polynomial",
fit_order=3,
vol_range=0.05,
axes=["x", "y", "z"],
axes=("x", "y", "z"),
strains=None,
):
self.structure = structure
Expand Down Expand Up @@ -106,7 +105,9 @@ def generate_structures(self):
int(self.num_points),
)
for strain in strains:
basis = _strain_axes(self.structure, self.axes, strain)
basis = _strain_axes(
structure=self.structure, axes=self.axes, volume_strain=strain
)
self._structure_dict[1 + np.round(strain, 7)] = basis
return {"calc_energy": self._structure_dict}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_evcurve_abinit.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_calc_evcurve(self):
fit_type='polynomial',
fit_order=3,
vol_range=0.05,
axes=['x', 'y', 'z'],
axes=('x', 'y', 'z'),
strains=None,
)
task_dict = workflow.generate_structures()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_evcurve_emt.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_calc_evcurve(self):
fit_type='polynomial',
fit_order=3,
vol_range=0.05,
axes=['x', 'y', 'z'],
axes=('x', 'y', 'z'),
strains=None,
)
task_dict = workflow.generate_structures()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_evcurve_gpaw.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_calc_evcurve(self):
fit_type='polynomial',
fit_order=3,
vol_range=0.05,
axes=['x', 'y', 'z'],
axes=('x', 'y', 'z'),
strains=None,
)
task_dict = workflow.generate_structures()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_evcurve_lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_calc_evcurve(self):
fit_type='polynomial',
fit_order=3,
vol_range=0.05,
axes=['x', 'y', 'z'],
axes=('x', 'y', 'z'),
strains=None,
)
task_dict = workflow.generate_structures()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_evcurve_qe.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_calc_evcurve(self):
fit_type='polynomial',
fit_order=3,
vol_range=0.05,
axes=['x', 'y', 'z'],
axes=('x', 'y', 'z'),
strains=None,
)
task_dict = workflow.generate_structures()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_evcurve_siesta.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_calc_evcurve(self):
fit_type='polynomial',
fit_order=3,
vol_range=0.05,
axes=['x', 'y', 'z'],
axes=('x', 'y', 'z'),
strains=None,
)
task_dict = workflow.generate_structures()
Expand Down

0 comments on commit 4e59102

Please sign in to comment.