Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

energy volume curve - use axes = ("x", "y", "z") rather than axes = ["x", "y", "z"] #63

Merged
merged 1 commit into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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