asr.relax

Summary

This is the documentation for asr.relax-recipe. This recipe is comprised of a single instruction, namely:

Run this recipe through the CLI interface

$ asr run asr.relax

or as a python module

$ python -m asr.relax

Detailed description

Relax atomic structures.

By defaults read from “unrelaxed.json” from disk and relaxes structures and saves the final relaxed structure in “structure.json”.

The relax recipe has a couple of note-worthy features:

  • It automatically handles structures of any dimensionality

  • It tries to enforce symmetries

  • It continously checks after each step that no symmetries are broken, and raises an error if this happens.

The recipe also supports relaxing structure with vdW forces using DFTD3. To install DFTD3 do

$ mkdir ~/DFTD3 && cd ~/DFTD3
$ wget chemie.uni-bonn.de/pctc/mulliken-center/software/dft-d3/dftd3.tgz
$ tar -zxf dftd3.tgz
$ make
$ echo 'export ASE_DFTD3_COMMAND=$HOME/DFTD3/dftd3' >> ~/.bashrc
$ source ~/.bashrc

Examples

Relax without using DFTD3

$ ase build -x diamond Si unrelaxed.json
$ asr run "relax --nod3"

Relax using the LDA exchange-correlation functional

$ ase build -x diamond Si unrelaxed.json
$ asr run "relax --calculator {'xc':'LDA',...}"

Steps

asr.relax

asr.relax.main(atoms, calculator={'charge': 0, 'convergence': {'forces': 0.0001}, 'kpts': {'density': 6.0, 'gamma': True}, 'mode': {'ecut': 800, 'name': 'pw'}, 'name': 'gpaw', 'occupations': {'name': 'fermi-dirac', 'width': 0.05}, 'symmetry': {'symmorphic': False}, 'txt': 'relax.txt', 'xc': 'PBE'}, tmp_atoms=None, tmp_atoms_file='relax.traj', d3=False, fixcell=False, allow_symmetry_breaking=False, fmax=0.01, enforce_symmetry=True)[source]

Relax atomic positions and unit cell.

The relaxed structure is saved to structure.json which can be processed by other recipes.

Parameters
  • atoms (ase.atoms.Atoms) – Atomic structure to relax.

  • calculator (dict) – Calculator dictionary description.

  • tmp_atoms (typing.Optional[ase.atoms.Atoms]) – Atoms from a restarted calculation.

  • tmp_atoms_file (str) – Filename to save relaxed trajectory in.

  • d3 (bool) – Relax using DFTD3.

  • fixcell (bool) – Fix cell when relaxing, thus only relaxing atomic positions.

  • allow_symmetry_breaking (bool) – Allow structure to break symmetry.

  • fmax (float) – Maximum force tolerance.

  • enforce_symmetry (bool) – Enforce symmetries. When enabled, the atomic structure, forces and stresses will be symmetrized at each step of the relaxation.

Return type

asr.relax.Result

class asr.relax.Result(b, etot, magmoms, forces, a, images, c, edft, atoms, stress, spos, alpha, beta, gamma, symbols)[source]

Result class for asr.relax.main().

Parameters
  • b (float) –

  • etot (float) –

  • magmoms (List[float]) –

  • forces (numpy.ndarray) –

  • a (float) –

  • images (List[ase.atoms.Atoms]) –

  • c (float) –

  • edft (float) –

  • atoms (ase.atoms.Atoms) –

  • stress (numpy.ndarray) –

  • spos (numpy.ndarray) –

  • alpha (float) –

  • beta (float) –

  • gamma (float) –

  • symbols (List[str]) –

property a: float

Cell parameter a [Ang]

Return type

float

property alpha: float

Cell parameter alpha [deg]

Return type

float

property atoms: ase.atoms.Atoms

Relaxed atomic structure.

Return type

ase.atoms.Atoms

property b: float

Cell parameter b [Ang]

Return type

float

property beta: float

Cell parameter beta [deg]

Return type

float

property c: float

Cell parameter c [Ang]

Return type

float

property edft: float

DFT total energy [eV]

Return type

float

property etot: float

Total energy [eV]

Return type

float

property forces: numpy.ndarray

Forces on atoms after relaxation.

Return type

numpy.ndarray

property gamma: float

Cell parameter gamma [deg]

Return type

float

property images: List[ase.atoms.Atoms]

Path taken when relaxing structure.

Return type

typing.List[ase.atoms.Atoms]

property magmoms: List[float]

Atomic magnetic moments of relaxed structure [mu_B]

Return type

typing.List[float]

property spos: numpy.ndarray

Scaled positions

Type

Array

Return type

numpy.ndarray

property stress: numpy.ndarray

Stress on cell after relaxation.

Return type

numpy.ndarray

property symbols: List[str]

Chemical symbols

Type

Array

Return type

typing.List[str]