Skip to content

Commit

Permalink
Increase fmax to 0.03 if NEB + fix problem with get_Stress with voigt
Browse files Browse the repository at this point in the history
  • Loading branch information
gmatteo committed Nov 10, 2023
1 parent 1bc50d5 commit 726ef59
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
9 changes: 5 additions & 4 deletions abipy/flowtk/qutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from pymatgen.core.units import Time, Memory
from abipy.tools.typing import PathLike
from abipy.tools import duck
from abipy.tools.text import rm_multiple_spaces


def slurm_parse_timestr(s: str) -> Time:
Expand Down Expand Up @@ -196,11 +197,11 @@ class SlurmJobArray:
queue_id = job_array.sbatch("job.sh")
"""

def __init__(self, header, command, arr_options):
self.command = str(command)
self.header = str(header)
def __init__(self, header: str, command: str, arr_options: list[str]):
self.command = command
if not self.command.endswith(" "): self.command += " "
self.header = header
self.arr_options = arr_options
from abipy.tools.text import rm_multiple_spaces
self.arr_options_str = rm_multiple_spaces("\n".join(arr_options))

def __str__(self):
Expand Down
8 changes: 7 additions & 1 deletion abipy/ml/aseml.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,15 @@ def from_atoms(cls, atoms: Atoms, calc=None) -> AseResults:
"""Build the object from an atoms instance with a calculator."""
if calc is not None:
atoms.calc = calc

from ase.stress import voigt_6_to_full_3x3_strain
stress_voigt = atoms.get_stress()
print(stress_voigt)
stress = voigt_6_to_full_3x3_strain(stress_voigt)

results = cls(atoms=atoms.copy(),
ene=float(atoms.get_potential_energy()),
stress=atoms.get_stress(voigt=False),
stress=stress,
forces=atoms.get_forces())
if calc is not None:
atoms.calc = None
Expand Down
4 changes: 2 additions & 2 deletions abipy/scripts/abiml.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def wrapper(*args, **kw):
print("Command line options:")
print(json.dumps(kw, indent=4), end="\n")

# Set OMP_NUM_THREADS to 1 if env var is not defined.
# IMPORTANT: Set OMP_NUM_THREADS to 1 if env variable is not defined.
num_threads = cli.fix_omp_num_threads()

t_start = time()
Expand Down Expand Up @@ -118,7 +118,7 @@ def add_neb_opts(f):
f = click.option("--relax-mode", "-r", default="ions", show_default=True, type=click.Choice(["no", "ions", "cell"]),
help="Relax initial and final structure. Use `cell` to relax ions and cell, " +
"`ions` to relax atomic positions only, `no` to disable relaxation")(f)
f = click.option("--fmax", default=0.01, type=float, show_default=True, help='Stopping criterion.')(f)
f = click.option("--fmax", default=0.03, type=float, show_default=True, help='Stopping criterion.')(f)
f = click.option("--pressure", default=0.0, type=float, show_default=True, help='Scalar pressure')(f)
f = click.option("--optimizer", "-o", default="BFGS", show_default=True, type=click.Choice(ASE_OPTIMIZERS),
help="ASE optimizer class.")(f)
Expand Down

0 comments on commit 726ef59

Please sign in to comment.