abipy/README.rst

282 lines
12 KiB
ReStructuredText
Raw Normal View History

2017-03-08 23:10:26 +08:00
.. :Repository: https://github.com/abinit/abipy
.. :Author: Matteo Giantomassi (http://github.com/abinit)
2013-06-26 22:47:14 +08:00
.. list-table::
:stub-columns: 1
:widths: 10 90
* - Package
- |pypi-version| |download-with-anaconda| |supported-versions|
* - Continuous Integration
- |travis-status| |coverage-status|
* - Documentation
2018-01-09 06:15:08 +08:00
- |docs-stable| |docs-devel| |launch-nbviewer| |launch-binder|
2015-04-12 22:39:58 +08:00
About
=====
2017-03-04 22:55:57 +08:00
AbiPy is a Python_ library to analyze the results produced by Abinit_,
2017-03-07 03:08:55 +08:00
an open-source program for the ab-initio calculations of the physical properties of materials
2017-03-08 23:10:26 +08:00
within Density Functional Theory and Many-Body perturbation theory.
2017-03-07 03:08:55 +08:00
It also provides tools to generate input files and workflows to automate
ab-initio calculations and typical convergence studies.
2018-01-03 09:06:51 +08:00
AbiPy is interfaced with pymatgen_ and this allows users to
benefit from the different tools and python objects available in the pymatgen ecosystem.
2017-03-04 22:55:57 +08:00
2018-01-12 02:11:43 +08:00
The official documentation of the stable version is available at the `abipy docpage`_.
2018-01-09 06:15:08 +08:00
while the documentation of the **developmental** version is hosted on `github pages <http://abinit.github.io/abipy>`_.
2017-03-09 07:17:04 +08:00
AbiPy can be used in conjunction with matplotlib_, pandas_, scipy_, seaborn_, ipython_ and jupyter_ notebooks
2017-03-10 05:13:08 +08:00
thus providing a powerful and user-friendly environment for data analysis and visualization.
2018-01-12 02:11:43 +08:00
Check out our `gallery of plotting scripts <http://abinit.github.io/abipy/gallery/index.html>`_
and the `gallery of AbiPy workflows <http://abinit.github.io/abipy/flow_gallery/index.html>`_.
To learn more about the integration between jupyter_ and AbiPy, visit `our collection of notebooks
<https://nbviewer.jupyter.org/github/abinit/abitutorials/blob/master/abitutorials/index.ipynb>`_
2018-01-12 02:11:43 +08:00
or click the **Launch Binder** badge to start a Docker image with Abinit, AbiPy and all the other python dependencies
required to run the code inside the jupyter notebooks.
The notebook will be opened in your browser after building.
2013-06-27 03:38:39 +08:00
2017-03-08 23:10:26 +08:00
AbiPy is free to use. However, we also welcome your help to improve this library by making your own contributions.
Please report any bugs and issues at AbiPy's `Github page <https://github.com/abinit/abipy>`_.
2013-06-26 22:47:14 +08:00
2018-01-12 02:11:43 +08:00
.. important::
Note that the majority of the post-processing tools available in AbiPy require output files in
netcdf_ format so we **strongly** suggest to compile Abinit with netcdf support
(use ``--with_trio_flavor="netcdf-fallback"`` at configure time to activate the internal netcdf library,
to link Abinit against an external netcdf library please consult the configuration examples provided by abiconfig_).
2016-02-14 00:35:19 +08:00
Getting AbiPy
2013-06-26 22:47:14 +08:00
=============
Stable version
--------------
2017-03-04 22:55:57 +08:00
The version at the Python Package Index (PyPI) is always the latest stable release
2017-03-07 03:08:55 +08:00
that can be installed with::
2013-06-26 22:47:14 +08:00
pip install abipy
2017-03-10 21:42:43 +08:00
Note that you may need to install pymatgen and other critical dependencies manually.
In this case, please consult the detailed installation instructions provided by the
`pymatgen howto <http://pymatgen.org/index.html#standard-install>`_ to install pymatgen
2018-03-16 18:27:22 +08:00
and then follow the instructions in `our howto <http://abinit.github.io/abipy/installation>`_.
2017-03-10 21:42:43 +08:00
2017-03-11 20:51:07 +08:00
The installation process is greatly simplified if you install the required
2018-01-03 09:06:51 +08:00
python packages through `Anaconda <https://continuum.io/downloads>`_.
2018-01-12 02:11:43 +08:00
We routinely use conda_ to test new developments with multiple Python versions and multiple virtual environments.
The anaconda distribution already provides the most critical dependencies (matplotlib_, scipy_, numpy_, netcdf4-python_)
in the form of pre-compiled packages that can be easily installed with e.g.::
conda install numpy scipy netcdf4
To install AbiPy with conda, download the `minconda installer <https://conda.io/miniconda.html>`_
(select python3.6 and the version corresponding to your operating system).
2018-03-18 06:52:56 +08:00
Create a new conda_ environment (let's call it ``abipy3.6``) based on python3.6 with::
2018-01-12 02:11:43 +08:00
2018-03-18 06:52:56 +08:00
conda create --name abipy3.6 python=3.6
2017-03-04 22:55:57 +08:00
2018-01-12 02:11:43 +08:00
and activate it with::
source activate abipy3.6
2018-03-18 06:52:56 +08:00
You should see the name of the conda environment in the shell prompt.
Now add ``conda-forge``, ``matsci`` and ``abinit`` to your conda channels with::
2018-01-12 02:11:43 +08:00
conda config --add channels conda-forge
conda config --add channels matsci
conda config --add channels abinit
2018-03-18 06:52:56 +08:00
These are the channels from which we will download pymatgen, abipy and abinit.
2018-01-12 02:11:43 +08:00
Finally, install AbiPy from the abinit-channel_ with::
conda install abipy -c abinit
One of the big advantages of conda over pip is that conda can also install
libraries and executables written in Fortran.
For example, one can easily install abinit inside the conda environment with::
conda install abinit -c abinit
abinit --version
2017-03-04 22:55:57 +08:00
2017-03-08 23:10:26 +08:00
Additional information on the steps required to install AbiPy with anaconda are available
2018-03-16 18:27:22 +08:00
in the `anaconda howto <http://abinit.github.io/abipy/installation#anaconda-howto>`_.
2018-01-12 02:11:43 +08:00
2018-03-16 18:27:22 +08:00
We are also collaborating with the spack_ community
2017-03-08 23:10:26 +08:00
to provide packages for AbiPy and Abinit in order to facilitate the installation on large supercomputing centers.
2017-03-04 22:55:57 +08:00
2018-01-12 02:11:43 +08:00
Developmental version
2017-03-10 21:42:43 +08:00
---------------------
2018-01-12 02:11:43 +08:00
Getting the developmental version of AbiPy is easy.
2018-03-16 18:27:22 +08:00
Clone the `github repository <https://github.com/abinit/abipy>`_ with::
2017-03-10 21:42:43 +08:00
2018-01-12 02:11:43 +08:00
git clone https://github.com/abinit/abipy
2017-03-10 21:42:43 +08:00
2018-01-12 02:11:43 +08:00
For pip, use::
2017-03-10 21:42:43 +08:00
2018-01-12 02:11:43 +08:00
pip install -r requirements.txt
pip install -r requirements-optional.txt
2017-03-10 21:42:43 +08:00
2018-01-12 02:11:43 +08:00
If you are using conda_, create a new environment (``abipy3.6``) based on python3.6 with::
2017-03-10 21:42:43 +08:00
2018-01-12 02:11:43 +08:00
conda create -n abipy3.6 python=3.6
source activate abipy3.6
2017-03-04 22:55:57 +08:00
2018-01-12 02:11:43 +08:00
Add ``conda-forge``, ``matsci`` and ``abinit`` to your channels with::
2013-06-26 22:47:14 +08:00
2018-01-12 02:11:43 +08:00
conda config --add channels conda-forge
conda config --add channels matsci
conda config --add channels abinit
2017-03-10 21:42:43 +08:00
2018-01-12 02:11:43 +08:00
and install the AbiPy dependencies with::
conda install --file ./requirements.txt
conda install --file ./requirements-optional.txt
2017-03-10 21:42:43 +08:00
2018-03-16 02:23:24 +08:00
Once the requirements have been installed (either with pip or conda), execute::
2013-06-26 22:47:14 +08:00
2018-01-07 02:02:42 +08:00
python setup.py install
2013-06-26 22:47:14 +08:00
2017-03-10 21:42:43 +08:00
or alternately::
2013-06-26 22:47:14 +08:00
2018-01-07 02:02:42 +08:00
python setup.py develop
2013-06-26 22:47:14 +08:00
2017-03-10 21:42:43 +08:00
to install the package in developmental mode
(this is the recommended approach, especially if you are planning to implement new features).
2017-03-04 22:55:57 +08:00
2017-03-10 21:42:43 +08:00
The Github version include test files for complete unit testing.
2018-01-03 09:06:51 +08:00
To run the suite of unit tests, make sure you have pytest_ installed and then type::
2017-02-28 00:52:24 +08:00
2018-01-07 02:02:42 +08:00
pytest
2013-10-28 13:49:58 +08:00
2017-03-07 03:08:55 +08:00
in the AbiPy root directory.
2018-01-12 02:11:43 +08:00
Unit tests require ``scripttest`` that can be installed with::
2013-10-28 13:49:58 +08:00
2018-01-12 02:11:43 +08:00
pip install scripttest
2017-03-07 03:08:55 +08:00
2017-03-11 20:51:07 +08:00
Note that several unit tests check the integration between AbiPy and Abinit.
2018-01-07 02:02:42 +08:00
In order to run the tests, you need a working set of Abinit executables and a ``manager.yml`` configuration file.
A pre-compiled sequential version of Abinit for Linux and OSx can be installed directly from the
2018-01-12 02:11:43 +08:00
abinit-channel_ with::
2017-03-11 20:51:07 +08:00
2018-01-09 06:15:08 +08:00
conda install abinit -c abinit
2017-03-11 20:51:07 +08:00
For further information on the syntax of the configuration file, please consult the
2018-03-16 18:27:22 +08:00
`workflows <http://abinit.github.io/abipy/workflows/taskmanager.html>`_ section.
2017-03-11 20:51:07 +08:00
2017-03-07 03:08:55 +08:00
Contributing to AbiPy is relatively easy.
Just send us a `pull request <https://help.github.com/articles/using-pull-requests/>`_.
When you send your request, make ``develop`` the destination branch on the repository
AbiPy uses the `Git Flow <http://nvie.com/posts/a-successful-git-branching-model/>`_ branching model.
The ``develop`` branch contains the latest contributions, and ``master`` is always tagged and points
to the latest stable release.
Using AbiPy
2013-07-11 17:22:33 +08:00
===========
Basic usage
-----------
2018-01-09 06:15:08 +08:00
There are a variety of ways to use AbiPy, and most of them are illustrated in the ``abipy/examples`` directory.
2014-10-20 19:57:44 +08:00
Below is a brief description of the different directories found there:
2013-07-11 17:22:33 +08:00
2018-03-16 18:27:22 +08:00
* `examples/plot <http://abinit.github.io/abipy/gallery/index.html>`_
2017-03-07 03:08:55 +08:00
2018-03-16 18:27:22 +08:00
Scripts showing how to read data from netcdf files and produce plots with matplotlib_
2017-03-07 03:08:55 +08:00
2018-03-16 18:27:22 +08:00
* `examples/flows <http://abinit.github.io/abipy/flow_gallery/index.html>`_.
Scripts showing how to generate an AbiPy flow, run the calculation and use ipython to analyze the data.
2017-03-07 03:08:55 +08:00
2018-03-16 18:27:22 +08:00
Additional jupyter notebooks with the Abinit tutorials written with AbiPy are available in the
`abitutorial repository <https://nbviewer.jupyter.org/github/abinit/abitutorials/blob/master/abitutorials/index.ipynb>`_
2013-07-11 17:22:33 +08:00
2018-03-16 18:27:22 +08:00
Users are strongly encouraged to explore the detailed `API docs <http://abinit.github.io/abipy/api/index.html>`_.
2018-01-12 02:11:43 +08:00
2017-03-10 21:42:43 +08:00
Command line tools
------------------
2017-03-07 03:08:55 +08:00
2017-03-10 21:42:43 +08:00
The following scripts can be invoked directly from the terminal:
* ``abiopen.py`` Open file inside ipython.
* ``abistruct.py`` Swiss knife to operate on structures.
* ``abiview.py`` Visualize results from file.
* ``abicomp.py`` Compare results extracted from multiple files.
* ``abicheck.py`` Validate integration between AbiPy and Abinit
* ``abirun.py`` Execute AbiPy flow from terminal.
* ``abidoc.py`` Document Abinit input variables and Abipy configuration files.
* ``abinp.py`` Build input files (simplified interface for the AbiPy factory functions).
2018-03-18 06:52:56 +08:00
Use ``SCRIPT --help`` to get the list of supported commands and
``SCRIPT COMMAND --help`` to get the documentation for ``COMMAND``.
2018-03-16 18:27:22 +08:00
For further information, please consult the `official documentation <http://abinit.github.io/abipy/scripts/index.html>`_.
2013-07-11 17:22:33 +08:00
License
=======
2013-06-26 22:47:14 +08:00
2017-04-02 16:50:15 +08:00
AbiPy is released under the GNU GPL license. For more details see the LICENSE file.
2016-02-10 23:00:23 +08:00
.. _Python: http://www.python.org/
.. _Abinit: https://www.abinit.org
2018-01-12 02:11:43 +08:00
.. _abinit-channel: https://anaconda.org/abinit
.. _pymatgen: http://www.pymatgen.org
2016-02-16 19:05:18 +08:00
.. _`abipy docpage` : http://pythonhosted.org/abipy
.. _matplotlib: http://matplotlib.org
.. _pandas: http://pandas.pydata.org
.. _scipy: https://www.scipy.org/
.. _seaborn: https://seaborn.pydata.org/
.. _ipython: https://ipython.org/index.html
.. _jupyter: http://jupyter.org/
.. _netcdf: https://www.unidata.ucar.edu/software/netcdf/docs/faq.html#whatisit
.. _abiconfig: https://github.com/abinit/abiconfig
.. _conda: https://conda.io/docs/
.. _netcdf4-python: http://unidata.github.io/netcdf4-python/
.. _spack: https://github.com/LLNL/spack
.. _pytest: https://docs.pytest.org/en/latest/contents.html
2018-01-07 02:02:42 +08:00
.. _numpy: http://www.numpy.org/
.. |pypi-version| image:: https://badge.fury.io/py/abipy.svg
:alt: PyPi version
:target: https://badge.fury.io/py/abipy
.. |travis-status| image:: https://travis-ci.org/abinit/abipy.svg?branch=develop
:alt: Travis status
:target: https://travis-ci.org/abinit/abipy
.. |coverage-status| image:: https://coveralls.io/repos/github/abinit/abipy/badge.svg?branch=develop
:alt: Coverage status
:target: https://coveralls.io/github/abinit/abipy?branch=develop
.. |download-with-anaconda| image:: https://anaconda.org/abinit/abipy/badges/installer/conda.svg
:alt: Download with Anaconda
:target: https://conda.anaconda.org/abinit
.. |launch-binder| image:: https://mybinder.org/badge.svg
:alt: Launch binder
:target: https://mybinder.org/v2/gh/abinit/abipy/develop
.. |launch-nbviewer| image:: https://img.shields.io/badge/render-nbviewer-orange.svg
:alt: Launch nbviewer
:target: https://nbviewer.jupyter.org/github/abinit/abitutorials/blob/master/abitutorials/index.ipynb
.. |supported-versions| image:: https://img.shields.io/pypi/pyversions/abipy.svg?style=flat
:alt: Supported versions
:target: https://pypi.python.org/pypi/abipy
.. |requires| image:: https://requires.io/github/abinit/abipy/requirements.svg?branch=develop
:target: https://requires.io/github/abinit/abipy/requirements/?branch=develop
:alt: Requirements Status
2018-01-09 06:15:08 +08:00
.. |docs-stable| image:: https://img.shields.io/badge/docs-stable_version-blue.svg
:alt: Documentation stable version
:target: http://pythonhosted.org/abipy/
.. |docs-devel| image:: https://img.shields.io/badge/docs-devel_version-ff69b4.svg
:alt: Documentation development version
:target: http://abinit.github.io/abipy