Skip to content

Config revised related.

Added first version of BaseProfile that can be created from the cfg object and an implementation of this for Espresso.

With these changes an Espresso calculation can be done, if a config file is specified in ASE_CONFIG_PATH, like so:

from ase.calculators.espresso import Espresso
from ase import Atoms

# Create a simple water molecule
water = Atoms('H2', positions=[[0, 0, 0], [0, 0, 1]], 
              cell=[10, 10, 10], pbc=True)

water.center()

# Set up the calculator

pseudo_potentials = {
    'H': 'H.pbe-rrkjus_psl.1.0.0.UPF'
}

parameters = {
    'ecutwfc': 64,
    'ecutrho': 576,
    'nbnd': 8,
}

calc = Espresso(pseudopotentials=pseudo_potentials, input_data=parameters)

water.calc = calc

E = water.get_potential_energy()

With a config file that is:

[general]
mpi_command_ncores = mpiexec -np {}
mpi_command = mpiexec

[espresso]
exc = pw.x
pseudo_path = /home/machri/Projects/agox/runscripts/ceria_oxide/qe_test/pseudos
ncores = 8

The same calculation can be done without the config file by creating the profile object manually:

profile = EspressoProfile(exc='pw.x', pseudo_path=path, 
                          mpi_command_ncores='mpiexec -n {}', ncores=8)

calc = Espresso(pseudopotentials=pseudo_potentials, input_data=parameters, profile=profile)

On another note: Can I get access so I can work on follow-ups to this without going through myfork? Or is it preferable to keep doing it like this?

Edited by Mads-Peter Verner Christiansen

Merge request reports