Difference between revisions of "First steps in Yambopy"

From The Yambo Project
Jump to navigation Jump to search
m (Fixed makeup)
(Rewritten the installation and tutorial instructions with updated info)
Line 1: Line 1:
A typical yambo calculation proceeds as follows:
The yambopy project aims to develop python tools to:  


* Obtain the ground state properties from a DFT code (pw.x or abinit) '''[[First steps: a walk through from DFT to optical properties]]'''
* Read and edit yambo and quantum espresso input files
* Create the yambo netCDF databases using the corresponding interface: (p2y for pw.x or a2y for abinit)
* Easily perform pre- and post-processing of the simulation data for these two codes - including hard-to-get, database-encoded data beyond standard outputs
* Run yambo once to complete the database
* Provide easy visualization and plotting options
* Run yambo specifying the run-levels to generate the input file
* Set up simple automatization workflows (e.g., convergence tests)
* Edit the yambo input file
* Run various yambo simulations
* Plot the data results


Since many of the parameters of the calculation have to be converged the user might end up running the last three steps many times. This is rather time-consuming without an automatization script.
===Quick installation===
 
The yambopy project aims to provide a simple set of python scripts to (i) read and edit yambo and quantum espresso input files, and (ii) to easily perform pre- and post-processing of the simulation data for these two codes.
Yambopy was born with the primary objective of making the convergence tests easier.
 
===Installation instructions for general users===


A quick way to start using Yambopy is described here.
A quick way to start using Yambopy is described here.


* 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>.
* 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.


* Go to a directory of your choice and clone yambopy from the git repository
* Go to a directory of your choice and clone yambopy from the git repository


  git clone https://github.com/yambo-code/yambopy.git
  git clone https://github.com/yambo-code/yambopy.git
If you don't want to use git, you may download a tarball from the git repository instead.


* Enter into the yambopy folder and install
* Enter into the yambopy folder and install
Line 45: Line 39:
This applies only to the installation step and not to subsequent yambopy use.
This applies only to the installation step and not to subsequent yambopy use.


===Optional===
===Installing dependencies with Anaconda===
Install abipy [[https://abinit.github.io/abipy/index.html]] for band structure interpolations using either <code>pip install abipy</code> or <code>conda install abipy --channel abinit</code> (note that abipy does not work with python >3.6).
We suggest installing yambopy using Anaconda [[https://www.anaconda.com/products/distribution]] to manage the various python packages.
 
===Setup complete===
Now yambopy is ready to use! Just go to the tutorials folder and follow the docs!


cd tutorial/bn
In this case, you can follow these steps.


And go to [[GW tutorial. Convergence and approximations (BN)]] or [[Bethe-Salpeter equation tutorial. Optical absorption (BN)]].
First, install the required dependencies:
conda install numpy scipy netcdf4 lxml pyyaml


You can find all the documentation of yambopy here http://yambopy.readthedocs.io/en/latest/index.html
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):
conda create --name NAME_ENV python=3.6
Here choose <code>NAME_ENV</code> as you want, e.g. <code>yenv</code>.  


===Installation instructions for the hands-on of the 2020 Yambo school at ICTP, Trieste===
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.


* Yambopy is already inside the Yambo Quantum Mobile (YQM). Start the YQM and go to the tutorial folder
pip install pymatgen
pip install abipy


cd yambopy/
Finally, we are ready to install yambopy:


and run
  git clone https://github.com/yambo-code/yambopy.git
  git pull
sudo python3 setup.py install --user


Once the installation finishes, go to [[GW tutorial. Convergence and approximations (BN)]] or [[Bethe-Salpeter equation tutorial. Optical absorption (BN)]].
(or download and extract tarball) and follow the steps outlined in the quick installation section.


You can find all the documentation of yambopy here http://yambopy.readthedocs.io/en/latest/index.html
===Setup complete===
Now yambopy is ready to use! Just go to the tutorials folder and follow the docs!


<!--
cd tutorial/
* Enter in a node and create in the scratch a folder


ssh -Y tutoXY@cecam; ssh -Y node0XY
On this wiki, we provide steps for the following tutorials:
cd /home/scratch
* [[GW tutorial. Convergence and approximations (BN)]]
mkdir your_name; cd your_name
* [[Bethe-Salpeter equation tutorial. Optical absorption (BN)]]
-->
* Database and plotting tutorial for quantum espresso: qepy
* Database and plotting tutorial for yambo: yambopy

Revision as of 10:36, 31 March 2022

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)

Quick installation

A quick way to start using Yambopy is described here.

  • Make sure that you are using Python 3 and that you have the following python packages: numpy, scipy, matplotlib, netCDF4, lxml, pyyaml. Optionally, you may want to have abipy [[1]] installed for band structure interpolations.
  • Go to a directory of your choice and clone yambopy from the git repository
git clone https://github.com/yambo-code/yambopy.git

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

  • 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

cd yambopy
python setup.py install --user

Frequent issues

When running the installation you may get a SyntaxError related to utf-8 encoding or it may complain that module setuptools is not installed even though it is. In this case, it means that the sudo command is not preserving the correct PATH for your python executable.

Solve the problem by running the installation step as

sudo /your/path/to/python setup.py install

or

sudo env PATH=$PATH python setup.py install

This applies only to the installation step and not to subsequent yambopy use.

Installing dependencies with Anaconda

We suggest installing yambopy using Anaconda [[2]] to manage the various python packages.

In this case, you can follow these steps.

First, install the required 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):

conda create --name NAME_ENV python=3.6

Here choose NAME_ENV as you want, e.g. yenv.

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

pip install pymatgen
pip install abipy

Finally, we are ready to install yambopy:

git clone https://github.com/yambo-code/yambopy.git 

(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!

cd tutorial/

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