From 7de16f370beb386b0cb27fd89e015f7d996c553a Mon Sep 17 00:00:00 2001 From: Shyue Ping Ong Date: Thu, 10 Aug 2023 13:52:43 -0700 Subject: [PATCH] Allow the max_abs_strain to be set. --- matcalc/eos.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/matcalc/eos.py b/matcalc/eos.py index 727c6e8..15b19ed 100644 --- a/matcalc/eos.py +++ b/matcalc/eos.py @@ -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, ): """ @@ -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 @@ -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)