Multi Purpose Python Interface
Python package for managing computations and performing post-processing in QuantumESPRESSO and Yambo
You can read the documentation in:
https://mppi.readthedocs.io/en/latest/
The package is composed by several modules, each of which contains one or more classes:
- InputFiles : create and manage the input files of the pw.x and ph.x programs of the QuantumESPRESSO package (PwInput, PhInput) and of Yambo (YamboInput, for yambo, ypp, yambo_nl and yambo_rt).
- Calculators : prepare and run a single QuantumESPRESSO or Yambo computation, either directly or through the slurm scheduler (QeCalculator, YamboCalculator, RunRules).
- Datasets : organize and run several computations for both QuantumESPRESSO and Yambo, collect their results and perform convergence studies.
- Parsers : extract data from the output files and the databases of QuantumESPRESSO (data-file-schema.xml) and Yambo (o- files and netCDF databases, including the ndb.Nonlinear database of yambo_nl).
- Utilities : low-level functions used by the other modules (constants, Fourier transform, density of states, band structures, lattice utilities, parallel loops).
- Optics : compute the optical properties of a system from the time-dependent polarization: linear response from a delta-shaped field, non-linear susceptibilities from monochromatic fields and from the frequency mixing of two fields (pump and probe).
- Models : physical models. The module contains a tool to deal with gaussian pulses, one to analyze the time dynamics of a two-level system and the classical anharmonic oscillator, which provides both the numerical time-dependent polarization and the analytical non-linear susceptibilities.
- Bug fixes in all the modules, with a test suite (
tests/) that runs on machines with and without QuantumESPRESSO and Yambo. - YamboInput rewritten with a line based parser and a readable writer, checked on the inputs of yambo, ypp, yambo_nl and yambo_rt.
- PwInput:
force_symmorphic=Trueis now the default (needed by Yambo), quoted strings, comments,if_posflags andK_POINTS gammaare parsed correctly. - Calculators: the
pre_processingscript ofRunRules(e.g. a file that loads the modules) is also sourced before the direct runs, andshow_environment()prints the loaded modules and the executable. - Datasets: the parallel runs work with all the multiprocessing start methods, and
fetch_resultsmatches the run ids exactly. - Parsers: robust YamboNLDBParser (plain numpy arrays), parsing of the yambo_nl polarization files.
- Optics: the non-linear susceptibilities follow the standard convention of R. W. Boyd, Nonlinear Optics (complex conjugate fields for the negative frequencies, degeneracy factors documented), the linear response includes the time step in the Fourier transform.
- Models: new AnharmonicOscillator class, used to test the Optics module against the analytical susceptibilities.
- Utilities: corrected high-symmetry points of the fcc lattice, vectorized density of states with scissor.
- Tutorials rewritten, shorter, and executed with QuantumESPRESSO 7.0 and the Lumen 2.1.0 fork of Yambo.
The package requires python 3.8 or later. To install it, clone this repository in a local folder, e.g.
/home/username/Applications/MPPI, move inside the folder and run
pip install -e .
The editable -e option creates a link from the location of the package to the local python repository folder, so you do not need to reinstall the package if you make some modifications (useful for coding). The package can also be installed inside a virtual environment.
The optional dependencies needed to build the documentation and to run the tests are installed with
pip install -e ".[docs,test]"
The tests are run from the folder of the package with
python -m pytest tests
The documentation is generated by running
make html
from the folder where the package is installed (or python -m sphinx -M html sphinx_source sphinx_build, for
instance on Windows). The building of the notebooks requires pandoc. The root of the
documentation is located in the file /package_dir/sphinx_build/html/index.html
We provide many jupyter notebooks that show the functionality of each module of the package.
The tutorials are organized as Tutorial_$name_of_the_class, the notebooks Analysis_$topic show the analysis
tools (band structure, density of states, optical properties, ...) and the notebooks Model_$name the physical
models. The notebooks are also included in the documentation.
To run the notebooks you need to install the jupyter-notebook or jupyter-lab package, that can be installed as
pip3 install jupyterlab
then from the source folder of MPPI move to sphinx_source/tutorials and run the jupyter environment as
jupyter-lab &
- QuantumESPRESSO (tested with 6.6 and later versions, up to 7.0): http://www.quantum-espresso.org/
- yambo (tested with 5.1 devel and with the Lumen 2.1.0 fork): http://www.yambo-code.org/
The code is at an early stage of development, help us by sending bug reports and suggestions!