First steps in Yambopy: Difference between revisions

From The Yambo Project
Jump to navigation Jump to search
 
(26 intermediate revisions by 6 users not shown)
Line 6: Line 6:
* Set up simple automatization workflows (e.g., convergence tests)
* Set up simple automatization workflows (e.g., convergence tests)


===Quick installation===
=== Setup ===
First of all, make sure that you have a suitable python environment (crated for example with [https://docs.anaconda.com/miniconda/install/ conda] or [https://docs.python.org/3/library/venv.html venv]) with python >=3.10.


A quick way to start using Yambopy is described here.
If you are not used with python environments, here two simple commands that you can use
python -m venv MYPATH/yamboenv/
(you can replace `MYPATH` with any path you prefer, e.g. `~/`)
source MYPATH/yamboenv/bin/activate
(for bash users, you can add to your .bashrt the line `. MYPATH/yamboenv/bin/activate`)


* Make sure that you are using Python 3 and that you have the following python packages: <code>numpy</code>, <code>scipy</code>, <code>matplotlib</code>, <code>netCDF4</code>, <code>lxml</code>, <code>pyyaml</code>. Optionally, you may want to have abipy [[https://abinit.github.io/abipy/index.html]] installed for band structure interpolations.
Then, you may install yambopy in one of the following ways.


* Go to a directory of your choice and clone yambopy from the git repository
==== Quick installation from PyPI repository ====


git clone https://github.com/yambo-code/yambopy.git
* In order to quickly install the officially released version type:


If you don't want to use git, you may download a tarball from the git repository instead.
pip install yambopy


* Enter into the yambopy folder and install
cd yambopy
sudo python setup.py install


If you don't have administrative privileges (for example on a computing cluster), type instead
==== Installation from tarball ====


cd yambopy
* In case you don't want to download from the pip repository and prefer to install a version of yambopy locally, you may download the appropriate tarball from the [https://github.com/yambo-code/yambopy/releases| yambopy github page]. Extract the tarball, enter the yambopy folder and type <code>pip install .</code>
python setup.py install --user


===Frequent issues===
==== Installation of latest patch ====
When running the installation you may get a <code>SyntaxError</code> related to utf-8 encoding or it may complain that module <code>setuptools</code> is not installed even though it is. In this case, it means that the <code>sudo</code> command is not preserving the correct <code>PATH</code> for your python executable.


Solve the problem by running the installation step as
* In case you want the latest version of the code including new updates and patches that might not be present in the official version, then you can clone the yambopy git repository (a basic knowledge of git may be helpful):


  sudo /your/path/to/python setup.py install
  git clone https://github.com/yambo-code/yambopy.git
or
cd yambopy
  sudo env PATH=$PATH python setup.py install
  pip install .


This applies only to the installation step and not to subsequent yambopy use.
==== Installation for developers ====
* If you want to install YamboPy in developing mode (to modify or add new functions) you have to download the code from github repository then go in the YamboPy folder and install with the command:


===Installing dependencies with Anaconda===
pip install -e .
We suggest installing yambopy using Anaconda [[https://www.anaconda.com/products/distribution]] to manage the various python packages.


In this case, you can follow these steps.
'''Important:''' if you want your changes to be included into a new patch/version of Yambopy, you need to first create your own personal fork of the git repository, make the changes there, and then create a pull request for the original repository.  


First, install the required dependencies:
==== Dependencies ====
conda install numpy scipy netcdf4 lxml pyyaml


Then we create a conda environment based on python 3.6 (this is to ensure compatibility with abipy if we want to install it later on):
* In principle, <code>pip</code> should take care of the required python dependencies. They are <code>numpy</code>, <code>scipy</code>, <code>matplotlib</code>, <code>netCDF4</code>, <code>h5py</code>, <code>lxml</code>, <code>PyYAML</code>, <code>monty</code>, <code>scikit-learn</code>, <code>tqdm</code>, <code>spglib</code>, <code>spgrep</code>, <code>pykdtree</code>, and <code>numba</code>. In case some dependency-related problem arises, you can install each of them separately beforehand with:
conda create --name NAME_ENV python=3.6
Here choose <code>NAME_ENV</code> as you want, e.g. <code>yenv</code>.  


Now, we install abipy and its dependency pymatgen using <code>pip</code>. Here make sure that you are using the <code>pip</code> version provided by Anaconda and not your system version.
pip install <code>dependency-name</code>


pip install pymatgen
* If you experience errors related to <code>NetCDF4</code> or <code>hdf5</code>, these are usually due to incompatibilities between the python modules the library in your environment. In this case, you can force the python installation to match the system library. For example, if you have an <code>hdf5</code> problem and you are using conda, you could try:
pip install abipy


Finally, we are ready to install yambopy:
conda install --force-reinstall h5py hdf5


git clone https://github.com/yambo-code/yambopy.git
=== Tutorials ===
 
(or download and extract tarball) and follow the steps outlined in the quick installation section.
 
===Setup complete===
Now yambopy is ready to use! Just go to the tutorials folder and follow the docs!
Now yambopy is ready to use! Just go to the tutorials folder and follow the docs!


Line 68: Line 59:


On this wiki, we provide steps for the following tutorials:
On this wiki, we provide steps for the following tutorials:
1. Data postprocessing:
* [[Yambopy tutorial: band structures | Database and plotting tutorial for quantum espresso: qepy]] (Get the databases: [https://media.yambo-code.eu/educational/tutorials/files/databases_qepy.tar.gz databases_qepy], 46.5MB)
* [[Yambopy tutorial: Yambo databases | Database and plotting tutorial for yambo: yambopy ]] (Get the databases: [https://media.yambo-code.eu/educational/tutorials/files/databases_yambopy.tar.gz databases_yambopy], 129MB)
2. Manage QE and Yambo runs: [WARNING: these tutorials are currently under maintenance due to updates to the scheduler class]
* [[GW tutorial. Convergence and approximations (BN)]]
* [[GW tutorial. Convergence and approximations (BN)]]
* [[Bethe-Salpeter equation tutorial. Optical absorption (BN)]]
* [[Bethe-Salpeter equation tutorial. Optical absorption (BN)]]
* [[Yambopy tutorial: band structures | Database and plotting tutorial for quantum espresso: qepy]] (Get the databases: [http://www.yambo-code.org/educational/tutorials/files/databases_qepy.tar databases_qepy], 59MB)
3. Advanced topics:
* [[Yambopy tutorial: Yambo databases | Database and plotting tutorial for yambo: yambopy ]] (Get the databases: [http://www.yambo-code.org/educational/tutorials/files/databases_yambopy.tar databases_yambopy], 226MB)
* [[Exciton-phonon coupling and luminescence]]
* [[Phonon-assisted luminescence by finite atomic displacements]]
* [[Phonon-assisted luminescence by finite atomic displacements]]
=== How to cite ===
If yambopy helped you with your data analysis, workflow management of figure preparation, you can consider citing us.
The way to do so in BibTeX format is the following:
@misc{yambopy,
      author = {Paleari, Fulvio and Molina-Sánchez, Alejandro and Nalabothula, Muralidhar and Reho, Riccardo and Bonacci, Miki and Castelo, José M. and Cervantes-Villanueva, Jorge and Pionteck, Mike and Silvetti, Martino and Attaccalite, Claudio and Pereira Coutada Miranda, Henrique},
      title = {Yambopy},
      month = mar,
      year = 2025,
      publisher = {Zenodo},
      version = {0.4.0},
      doi = {10.5281/zenodo.15012962},
      url = {[[https://doi.org/10.5281/zenodo.15012962 https://doi.org/10.5281/zenodo.15012962]]}, }

Latest revision as of 12:12, 18 November 2025

The yambopy project aims to develop python tools to:

  • Read and edit yambo and quantum espresso input files
  • Easily perform pre- and post-processing of the simulation data for these two codes - including hard-to-get, database-encoded data beyond standard outputs
  • Provide easy visualization and plotting options
  • Set up simple automatization workflows (e.g., convergence tests)

Setup

First of all, make sure that you have a suitable python environment (crated for example with conda or venv) with python >=3.10.

If you are not used with python environments, here two simple commands that you can use

python -m venv MYPATH/yamboenv/

(you can replace `MYPATH` with any path you prefer, e.g. `~/`)

source MYPATH/yamboenv/bin/activate

(for bash users, you can add to your .bashrt the line `. MYPATH/yamboenv/bin/activate`)

Then, you may install yambopy in one of the following ways.

Quick installation from PyPI repository

  • In order to quickly install the officially released version type:
pip install yambopy


Installation from tarball

  • In case you don't want to download from the pip repository and prefer to install a version of yambopy locally, you may download the appropriate tarball from the yambopy github page. Extract the tarball, enter the yambopy folder and type pip install .

Installation of latest patch

  • In case you want the latest version of the code including new updates and patches that might not be present in the official version, then you can clone the yambopy git repository (a basic knowledge of git may be helpful):
git clone https://github.com/yambo-code/yambopy.git
cd yambopy
pip install .

Installation for developers

  • If you want to install YamboPy in developing mode (to modify or add new functions) you have to download the code from github repository then go in the YamboPy folder and install with the command:
pip install -e .

Important: if you want your changes to be included into a new patch/version of Yambopy, you need to first create your own personal fork of the git repository, make the changes there, and then create a pull request for the original repository.

Dependencies

  • In principle, pip should take care of the required python dependencies. They are numpy, scipy, matplotlib, netCDF4, h5py, lxml, PyYAML, monty, scikit-learn, tqdm, spglib, spgrep, pykdtree, and numba. In case some dependency-related problem arises, you can install each of them separately beforehand with:
pip install dependency-name
  • If you experience errors related to NetCDF4 or hdf5, these are usually due to incompatibilities between the python modules the library in your environment. In this case, you can force the python installation to match the system library. For example, if you have an hdf5 problem and you are using conda, you could try:
conda install --force-reinstall h5py hdf5

Tutorials

Now yambopy is ready to use! Just go to the tutorials folder and follow the docs!

cd tutorial/

On this wiki, we provide steps for the following tutorials:

1. Data postprocessing:

2. Manage QE and Yambo runs: [WARNING: these tutorials are currently under maintenance due to updates to the scheduler class]

3. Advanced topics:

How to cite

If yambopy helped you with your data analysis, workflow management of figure preparation, you can consider citing us.

The way to do so in BibTeX format is the following:

@misc{yambopy, 
     author = {Paleari, Fulvio and Molina-Sánchez, Alejandro and Nalabothula, Muralidhar and Reho, Riccardo and Bonacci, Miki and Castelo, José M. and Cervantes-Villanueva, Jorge and Pionteck, Mike and Silvetti, Martino and Attaccalite, Claudio and Pereira Coutada Miranda, Henrique},
     title = {Yambopy},
     month = mar,
     year = 2025,
     publisher = {Zenodo},
     version = {0.4.0}, 
     doi = {10.5281/zenodo.15012962},
     url = {[https://doi.org/10.5281/zenodo.15012962]}, }