First steps in Yambopy: Difference between revisions

From The Yambo Project
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(24 intermediate revisions by 6 users not shown)
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.
=== 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.8.


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.  
If you are not used with python environments, here two simple commands that you can use
Yambopy was born with the primary objective of making the convergence tests easier.
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`)


===Installation instructions for general users===
Then, you may install yambopy in one of the following ways.


A quick way to start using Yambopy is described here.
==== Quick installation from PyPI repository ====


* 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>.
* In order to quickly install the officially released version type:


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


<source lang="python">
==== Installation from tarball ====
git clone https://github.com/yambo-code/yambopy.git
</source>


* Enter into the yambopy folder and install
* 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>


<source lang="python">
==== Installation of latest patch ====
cd yambopy
sudo python setup.py install
</source>


If you don't have administrative privileges (for example on a computing cluster), type instead
* 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):


<source lang="python">
git clone https://github.com/yambo-code/yambopy.git
cd yambopy
cd yambopy
python setup.py install --user
pip install .
</source>


===Frequent issues===
==== Dependencies ====
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.


<source lang="python">
* 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>lxml</code>, <code>PyYAML</code> and <code>monty</code>. In case some dependency-related problem arises, you can install each of them separately beforehand with:
sudo /your/path/to/python setup.py install
</source>
or
<source lang="python">
sudo env PATH=$PATH python setup.py install
</source>


This applies only to the installation step and not to subsequent yambopy use.
pip install <code>dependency-name</code>


===Optional===
=== Tutorials ===
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).
 
===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!


<source lang="python">
cd tutorial/
cd tutorial/bn
</source>
 
And go to [[GW tutorial. Convergence and approximations (BN)]] or [[Bethe-Salpeter equation tutorial. Optical absorption (BN)]].
 
You can find all the documentation of yambopy here http://yambopy.readthedocs.io/en/latest/index.html
 
===Installation instructions for the hands-on of the 2020 Yambo school at ICTP, Trieste===
 
* Yambopy is already inside the Yambo Quantum Mobile (YQM). Start the YQM and go to the tutorial folder
 
<source lang="bash">
cd yambopy/
</source>
 
and run
<source lang="bash">
git pull
sudo python3 setup.py install --user
</source>
 
Once the installation finishes, go to [[GW tutorial. Convergence and approximations (BN)]] or [[Bethe-Salpeter equation tutorial. Optical absorption (BN)]].
 
You can find all the documentation of yambopy here http://yambopy.readthedocs.io/en/latest/index.html


<!--
On this wiki, we provide steps for the following tutorials:
* Enter in a node and create in the scratch a folder


<source lang="python">
1. Data postprocessing:
ssh -Y tutoXY@cecam; ssh -Y node0XY
* [[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)
cd /home/scratch
* [[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)
mkdir your_name; cd your_name
2. Manage QE and Yambo runs:
</source>
* [[GW tutorial. Convergence and approximations (BN)]]
-->
* [[Bethe-Salpeter equation tutorial. Optical absorption (BN)]]
3. Advanced topics:
* [[Phonon-assisted luminescence by finite atomic displacements]]

Latest revision as of 13:49, 22 November 2024

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

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 .

Dependencies

  • In principle, pip should take care of the required python dependencies. They are numpy, scipy, matplotlib, netCDF4, lxml, PyYAML and monty. In case some dependency-related problem arises, you can install each of them separately beforehand with:
pip install dependency-name

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:

3. Advanced topics: