Skip to content

Commit

Permalink
Allow the max_abs_strain to be set.
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Aug 10, 2023
1 parent 7be0eb5 commit 7de16f3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion matcalc/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(
relax_structure: bool = True,
fmax: float = 0.01,
steps: int = 500,
max_abs_strain: float = 0.1,
n_points: int = 11,
):
"""
Expand All @@ -27,11 +28,14 @@ def __init__(
with the same calculator.
fmax (float): Max force for relaxation (of structure as well as atoms).
steps (int): Max number of steps for relaxation.
max_abs_strain (float): The maximum absolute strain applied to the structure. Defaults to 0.1, i.e.,
10% strain.
n_points (int): Number of points in which to compute the EOS. Defaults to 11.
"""
self.calculator = calculator
self.relax_structure = relax_structure
self.n_points = n_points
self.max_abs_strain = max_abs_strain
self.fmax = fmax
self.steps = steps

Expand All @@ -56,7 +60,7 @@ def calc(self, structure):

volumes, energies = [], []
relaxer = RelaxCalc(self.calculator, fmax=self.fmax, steps=self.steps, relax_cell=False)
for idx in np.linspace(-0.1, 0.1, self.n_points):
for idx in np.linspace(-self.max_abs_strain, self.max_abs_strain, self.n_points):
structure_strained = structure.copy()
structure_strained.apply_strain([idx, idx, idx])
result = relaxer.calc(structure_strained)
Expand Down

0 comments on commit 7de16f3

Please sign in to comment.