pymatgen

Pymatgen (Python Materials Genomics) is a robust, open-source Python library for materials analysis. These are some of the main features:

  1. Highly flexible classes for the representation of Element, Site, Molecule, Structure objects.

  2. Extensive input/output support, including support for VASP (http://cms.mpi.univie.ac.at/vasp/), ABINIT (http://www.abinit.org/), CIF, Gaussian, XYZ, and many other file formats.

  3. Powerful analysis tools, including generation of phase diagrams, Pourbaix diagrams, diffusion analyses, reactions, etc.

  4. Electronic structure analyses, such as density of states and band structure.

  5. Integration with the Materials Project REST API, Crystallography Open Database and other external data sources.

Reference: https://pymatgen.org/

 

Installing the conda package manager 

To install the library we need to install the anaconda which includes conda package manager, python3.9 version and Jupyter Notebook used for scientific computing and data science.

 

* Download Anaconda installer for Linux.

 * Verify your installer hashes 

sha256sum Anaconda3-2021.11-Linux-x86_64.sh

* .Run 

/abinitio> chmod +x Anaconda3-2021.11-Linux-x86_64.sh
/abinitio> ./Anaconda3-2021.11-Linux-x86_64.sh

accept the default choices

We get the following

==> For changes to take effect, close and re-open your current shell. <==

If you'd prefer that conda's base environment not be activated on startup,
set the auto_activate_base parameter to false:

conda config --set auto_activate_base false

Thank you for installing Anaconda3!

===========================================================================

Working with Python and Jupyter notebooks is a breeze with PyCharm Pro,
designed to be used with Anaconda. Download now and have the best data
tools at your fingertips.

PyCharm Pro for Anaconda is available at: https://www.anaconda.com/pycharm


* Source the ~/.bashrc file

source ~/.bashrc

 

How to avoid conda to activate base environment?

By default conda init will add to your .bashrc file for the base environment, which will slow down your terminal.

You can remove them in your .bashrc file or answer no to that question in the last step of your anaconda installation.

And then add the following to your .bashrc file. If you changed the default installation directory, change ~/anaconda3/ to that directory.

source ~/anaconda3/etc/profile.d/conda.sh
if [[ -z ${CONDA_PREFIX+x} ]]; then
    export PATH="~/conda/bin:$PATH"
fi

To test it, open a new terminal tab or run source .bashrc. Run conda activate base, then you should see (base) in front of your Bash prompt.

Now you can create another environment and activate it using Anaconda. If you frequently use one environment, you can also add conda activate [env] to your .bashrc file.

 

NB: You can install miniconda packae which is  a minimal free Conda installer. It’s a thin, bootstrap version that contains just conda, Python, the packages they depend on, and a limited range of other helpful modules like pip, zlib, and a few others.  


Installing the  Pymatgen library

Note that you might need to ensure a relatively recent version of gcc is available to compile pymatgen. You can use conda to get that:

conda install gcc

To install the library we run the following command

pip install pymatgen

 

Pymatgen is under active development, and new features are added regularly. To upgrade pymatgen to the latest version, use the following command:

conda upgrade pymatgen


We got the following message

Successfully built pymatgen
Installing collected packages: tenacity, ruamel.yaml.clib, latexcodec, uncertainties, tabulate, spglib, ruamel.yaml, pybtex, plotly, palettable, monty, pymatgen
Successfully installed latexcodec-2.0.1 monty-2022.1.19 palettable-3.3.0 plotly-5.6.0 pybtex-0.24.0 pymatgen-2022.2.10 ruamel.yaml-0.17.21 ruamel.yaml.clib-0.2.6 spglib-1.16.3 tabulate-0.8.9 tenacity-8.0.1 uncertainties-3.1.6