aiidateam / aiida-quantumespresso

The official AiiDA plugin for Quantum ESPRESSO
https://aiida-quantumespresso.readthedocs.io
Other
53 stars 78 forks source link

`Hubbard`: add useful utility functions #996

Open bastonero opened 9 months ago

bastonero commented 9 months ago

Useful utility functions for HubbardStructureData are added:

This helps issues like #991

bastonero commented 9 months ago

For the docs probably we just need to add pymatgen to conf.py

bastonero commented 9 months ago

@mbercx @t-reents @sphuber good to have your feedbacks here.

Example of usage:

from aiida.orm import *
from ase.io import read
from aiida_quantumespresso.utils.hubbard import initialize_hubbard_parameters

atoms = read('./input.pwi') # anything ASE can parse
s = StructureData(ase=atoms)
hs = initialize_hubbard_parameters( # returns an initialized HubbardStructureData using nearest neighbours analysis
    structure=s,
    pairs={
# onsite manifold, onsite value, intersite value, dict of intersites {kind name: manifold}
        'Mn': ['3d', 4.5, 1.0e-5, {'O':'2p', 'S':'2p'}],  
        'Fe1': ['3d', 5.0, 1.0e-5, {'O1':'2p', 'S':'2p'}],  
        ...
    },
)

Cristiano and myself used it for different calculations, and the logics seem now robust. Probably not the best input API for the initialization of Hubbard parameters, but it is the price to avoid reinventing other classes which makes even more complicated to use this method, which should be easy to use and should hide the underlying complexity of the HubbardStructureData.