diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..3fd0bc3d --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,178 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + diff --git a/README.md b/README.md index 7164d0d2..e3178297 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,34 @@ # py4vasp [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -[![tests](https://github.com/martin-schlipf/py4vasp/actions/workflows/test.yml/badge.svg)](https://github.com/martin-schlipf/py4vasp/actions/workflows/test.yml) +[![tests](https://github.com/vasp-dev/py4vasp/actions/workflows/test.yml/badge.svg)](https://github.com/vasp-dev/py4vasp/actions/workflows/test.yml) + +> Please note that this document is intended mostly for developers that want to use +> the version of py4vasp provided on Github. If you just want to install py4vasp to +> use it, please follow the [official documentation](https://vasp.at/py4vasp). ## Installation -We use the [poetry dependency manager](https://python-poetry.org/) which takes care of all dependencies and maintains a virtual environment to check the code. If you want to test something in the virtual environment, just use e.g. ```poetry run jupyter-notebook```. +We use the [poetry dependency manager](https://python-poetry.org/) which takes care of +all dependencies and maintains a virtual environment to check the code. If you want to +test something in the virtual environment, just use e.g. ```poetry run jupyter-notebook```. -Using poetry installing and the code requires the following steps. The last step will test whether everything worked +Using poetry installing and the code requires the following steps. The last step will +test whether everything worked ~~~shell git clone git@github.com:vasp-dev/py4vasp.git pip install poetry poetry install poetry run pytest ~~~ - -We occasionally encountered errors when installing the *mdtraj* dependency in this fashion, in particular on MacOS and Windows. If you notice the same behavior, we recommend to manage your environment with *conda* and install *py4vasp* in the following manner +Note that this will install py4vasp into a virtual environment managed by poetry. This +isolates the code from all other packages you have installed and makes sure that when +you modify the code all the relevant dependencies are tracked. + +Occasionally, we encountered errors when installing the *mdtraj* dependency in this +fashion, in particular on MacOS and Windows. If you notice the same behavior, we +recommend to manage your environment with *conda* and install *py4vasp* in the +following manner ~~~shell git clone git@github.com:vasp-dev/py4vasp.git conda create --name py4vasp-env python=3.8 @@ -29,13 +42,22 @@ poetry run pytest ## Code style -Code style is enforced, but is not something the developer should spend time on, so we decided on using the black formatter. Just run ```black .``` before committing the code. +Code style is enforced, but is not something the developer should spend time on, so we +decided on using the black formatter. Please run ```black .``` before committing the code. + +## Contributing to py4vasp -## Development workflow +We welcome contributions to py4vasp. To improve the code please follow this workflow -* Create an issue for the bugfix or feature you are working on -* Create a branch prefixing it with the number of the issue -* Implement the bugfix or feature on the branch adding tests to check it -* Create a pull request and link it to the issue it resolves +* Create an issue for the bugfix or feature you plan to work on, this gives the option + to provide some input before work is invested. +* Implement your work in a fork of the repository and create a pull request for it. + Please make sure to test your code thoroughly and commit the tests in the pull + request in the tests directory. +* In the message to your merge request mention the issue the code attempts to solve. +* We will try to include your merge request rapidly when all the tests pass and your + code is covered by tests. -A typical pull request should have up to approximately 200 lines of code otherwise reviewing the changes gets unwieldy. +Please limit the size of a the pull request to approximately 200 lines of code +otherwise reviewing the changes gets unwieldy. Prefer splitting the work into +multiple smaller chunks if necessary. diff --git a/docs/calculation.rst b/docs/calculation.rst new file mode 100644 index 00000000..d9bb4436 --- /dev/null +++ b/docs/calculation.rst @@ -0,0 +1,7 @@ +calculation +=========== + +.. automodule:: py4vasp.calculation + +.. autoclass:: py4vasp.calculation.Calculation + :members: diff --git a/docs/calculation_api.rst b/docs/calculation_api.rst deleted file mode 100644 index 6cb88a59..00000000 --- a/docs/calculation_api.rst +++ /dev/null @@ -1,6 +0,0 @@ -Calculation -=========== - -.. automodule:: py4vasp.calculation - :members: - :inherited-members: diff --git a/docs/conf.py b/docs/conf.py index 12b5a964..5f211ae9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,11 +18,11 @@ # -- Project information ----------------------------------------------------- project = "py4vasp" -copyright = "2020, Vasp Software GmbH" +copyright = "2022, Vasp Software GmbH" author = "Vasp Software GmbH" # The full version, including alpha/beta/rc tags -release = "0.2" +release = "0.4.0" # -- General configuration --------------------------------------------------- @@ -30,7 +30,8 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon"] +extensions = ["sphinx.ext.napoleon", "sphinx_automodapi.automodapi"] +automodapi_inheritance_diagram = False # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] @@ -45,8 +46,16 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -# -html_theme = "nature" + +# default theme +# html_theme = "nature" + +# a minimal theme for the website +html_theme = "basic" +html_show_sphinx = False +html_show_copyright = False +html_domain_indices = False +html_use_index = False # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, diff --git a/docs/control.rst b/docs/control.rst new file mode 100644 index 00000000..a04b8462 --- /dev/null +++ b/docs/control.rst @@ -0,0 +1,4 @@ +control +======= + +.. automodapi:: py4vasp.control diff --git a/docs/control_api.rst b/docs/control_api.rst deleted file mode 100644 index b284c22d..00000000 --- a/docs/control_api.rst +++ /dev/null @@ -1,6 +0,0 @@ -Setting up VASP calculations -============================ - -.. automodule:: py4vasp.control - :members: - :inherited-members: diff --git a/docs/data.rst b/docs/data.rst new file mode 100644 index 00000000..98fc3b61 --- /dev/null +++ b/docs/data.rst @@ -0,0 +1,5 @@ +data +==== + +.. automodapi:: py4vasp.data + :inherited-members: diff --git a/docs/data_api.rst b/docs/data_api.rst deleted file mode 100644 index 2beddbcb..00000000 --- a/docs/data_api.rst +++ /dev/null @@ -1,6 +0,0 @@ -Refining the raw data -===================== - -.. automodule:: py4vasp.data - :members: - :inherited-members: diff --git a/docs/exceptions.rst b/docs/exceptions.rst new file mode 100644 index 00000000..a653c72a --- /dev/null +++ b/docs/exceptions.rst @@ -0,0 +1,4 @@ +exceptions +========== + +.. automodapi:: py4vasp.exceptions diff --git a/docs/exceptions_api.rst b/docs/exceptions_api.rst deleted file mode 100644 index b2abbd1e..00000000 --- a/docs/exceptions_api.rst +++ /dev/null @@ -1,6 +0,0 @@ -Exceptions -========== - -.. automodule:: py4vasp.exceptions - :members: - :inherited-members: diff --git a/docs/index.rst b/docs/index.rst index 20d440c5..2bf06255 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,29 +1,165 @@ py4vasp ======= -*py4vasp* is a python interface to extract data from Vasp calculations. It is -intended mainly to get a quick look at the data and provide functionality to +*py4vasp* is a python interface to extract data from VASP calculations. It is +intended mainly to get a quick look at the data and provide the functionality to export it into common formats that can be used by other more sophisticated -postprocessing tools. A second domain of application is for people that want to -write python scripts based on the data calculated by Vasp. This tool interfaces +postprocessing tools. The second domain of application is for people that want to +write python scripts based on the data calculated by VASP. This tool interfaces directly with the new HDF5 file format and thereby avoids parsing issues associated with the XML or OUTCAR files. For these two groups of users, we provide a different level of access. The simple routines used in the tutorials will read the data from the file directly and then generate the requested plot. For script developers, we provide an -expert interface were the data is lazily loaded as needed with some greater +expert interface where the data is lazily loaded as needed with some greater flexibility when the data file is opened and closed. +Installation +------------ +.. _PyPI: https://pypi.org/project/py4vasp + +While this is not required to be able to run *py4vasp*, you may want to consider +creating a separate environment for installation to avoid interference with other +installed packages. [#environment]_ +You can then install *py4vasp* from PyPI_ using the pip package installer + +.. code-block:: bash + + pip install py4vasp + +This will automatically download *py4vasp* as well as all the required dependencies. +However, we noticed that this approach is not fail-safe, because the installation +of the *mdtraj* dependency does not work on all operating systems. So in case +the simple installation above fails, you may need to use *conda* to install *mdtraj* + +.. code-block:: bash + + conda install -c conda-forge mdtraj + pip install py4vasp + +If these commands succeed, you should be able to use *py4vasp*. You can make a quick +test of your installation running the following command + +.. code-block:: bash + + python -c "import py4vasp; print(py4vasp.__version__)" + +This should print the version of *py4vasp* that you installed. + +.. important:: + *py4vasp* extracts all information from the HDF5 output so you need to make + sure to compile VASP adding ``-DVASP_HDF5`` to the ``CPP_OPTIONS`` in the + *makefile.include*. You will also need to add the HDF5 library to the include + (``INCS``) and linking (``LLIBS``) instructions. *py4vasp* also requires a + VASP version > 6.2 and because py4vasp is developed alongside VASP, we + recommend that you use versions of these two codes released about at the same + time for maximum compatibility. + +Quick start +----------- + +.. _Jupyter: https://jupyter.org/ + +The user interface of *py4vasp* is optimized for usage inside a Jupyter_ environment +(Jupyter notebook or Jupyter lab), though it can be used in regular Python scripts +as well. To give you an illustrative example of what *py4vasp* can do, we assume +that you created a Jupyter notebook inside the directory of your VASP calculation. +Then you access all the results of this calculation with + +>>> from py4vasp import Calculation +>>> calc = Calculation.from_path(".") + +Naturally, if you created the notebook outside of the calculation directory, you +would replace the path ``.`` with the directory of the calculation. + +The attributes of the calculation correspond to different physical quantities that +you could have calculated with VASP. If you have an interactive session you can type +``calc.`` and then hit :kbd:`Tab` to get a list of all possible quantities. However +only the ones that you computed with VASP will give you any meaningful +result. + +.. _LORBIT: https://www.vasp.at/wiki/index.php/LORBIT + +In the following, we will assume that you computed the density of states (DOS) with +orbital projections (LORBIT_ = 11). You may now want to read the data from your +VASP calculation to post-process it further with a script. This can be achieved in +a single line of code + +>>> dos = calc.dos.read() + +Under the hood, this will access the *vaspout.h5* file, because *py4vasp* knows where +the output is stored after you ran VASP. It will read the relevant tags from +the file and store them all in a Python dictionary. If you want to access particular +orbital projections, let's say the *p* orbitals, you can pass a ``select = "p"`` as +an argument to the routine. More generally, you can check how to use a function with + +>>> help(calc.dos.read) + +The most common use case for the DOS data may be to prepare a plot to get some +insight into the system of interest. Because of this, we provide an easy wrapper +for this particular functionality + +>>> calc.dos.plot() + +This will return an interactive figure that you can use to investigate the DOS. +Note that this requires a browser to work, which means it will open one if you +execute this inside a script instead of a Jupyter notebook. The *plot* command +takes the same arguments as the read command. + +The interface for the other quantities is very similar. Every quantity provides +a *read* function to get the raw data into Python and where it makes sense a +*plot* function visualizes the data. However, note that in particular, all data +visualized inside the structure require a Jupyter notebook to work. + +.. _tutorials: https://www.vasp.at/tutorials/latest + +If you want to experience more features of *py4vasp*, we highly recommend taking +a look at the tutorials_ for VASP. Many of them use *py4vasp* to plot or analyze +the data produced by VASP, so this may give you an excellent starting point to learn +how you can apply *py4vasp* in your research. + .. toctree:: - :maxdepth: 2 + :maxdepth: 1 :caption: Contents: - modules + calculation + control + raw + data + exceptions + +---------------------------------------------------------------------------------------- + +.. _venv: https://docs.python.org/3/tutorial/venv.html +.. _conda: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html + +.. [#environment] To create a separate *py4vasp* from the rest of your packages you + can create an environment with venv_ or conda_. The advantage of the former is + that it comes with your python installation, the latter requires the installation + of Miniconda or Anaconda. Nevertheless, it may be a good idea to go with *conda* + in particular on Windows and macOS, because it can help install dependencies + of *py4vasp*. Below you find the instructions on how to create the environment + depending on your environment managing tool and your operating system. + + venv (Linux / MacOS) + .. code-block:: bash + + python3 -m venv py4vasp-env + source py4vasp-env/bin/activate.sh + + venv (Windows) + .. code-block:: bash + + python3 -m venv py4vasp-env + py4vasp-env\Scripts\activate.bat + + conda (Linux / MacOS / Windows) + .. code-block:: bash -Indices and tables ------------------- + conda create --name py4vasp-env python + conda activate py4vasp-env -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` + .. note:: + You will need to run the activation part of the command again if you open a + new shell. diff --git a/docs/modules.rst b/docs/modules.rst deleted file mode 100644 index 4902e0e4..00000000 --- a/docs/modules.rst +++ /dev/null @@ -1,12 +0,0 @@ -API documentation -================= - -.. toctree:: - :maxdepth: 2 - :caption: Modules: - - calculation_api - control_api - raw_api - data_api - exceptions_api diff --git a/docs/raw.rst b/docs/raw.rst new file mode 100644 index 00000000..0e74d711 --- /dev/null +++ b/docs/raw.rst @@ -0,0 +1,4 @@ +raw +=== + +.. automodapi:: py4vasp.raw diff --git a/docs/raw_api.rst b/docs/raw_api.rst deleted file mode 100644 index cb7ee462..00000000 --- a/docs/raw_api.rst +++ /dev/null @@ -1,6 +0,0 @@ -Extracting the raw data -======================= - -.. automodule:: py4vasp.raw - :members: - :inherited-members: diff --git a/poetry.lock b/poetry.lock index 41ef193c..34b2a201 100644 --- a/poetry.lock +++ b/poetry.lock @@ -365,7 +365,7 @@ test = ["pytest (!=5.3.4)", "pytest-cov", "flaky", "nose", "ipyparallel"] [[package]] name = "ipython" -version = "7.25.0" +version = "7.31.1" description = "IPython: Productive Interactive Computing" category = "main" optional = false @@ -744,7 +744,7 @@ simpletraj = ["simpletraj"] [[package]] name = "notebook" -version = "6.4.0" +version = "6.4.8" description = "A web-based notebook environment for interactive computing" category = "main" optional = false @@ -759,9 +759,10 @@ jupyter-client = ">=5.3.4" jupyter-core = ">=4.6.1" nbconvert = "*" nbformat = "*" +nest-asyncio = ">=1.5" prometheus-client = "*" pyzmq = ">=17" -Send2Trash = ">=1.5.0" +Send2Trash = ">=1.8.0" terminado = ">=0.8.3" tornado = ">=6.1" traitlets = ">=4.2.1" @@ -860,11 +861,11 @@ python-versions = "*" [[package]] name = "pillow" -version = "8.3.1" +version = "9.0.1" description = "Python Imaging Library (Fork)" category = "main" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" [[package]] name = "plotly" @@ -1103,13 +1104,15 @@ numpy = ">=1.16.5" [[package]] name = "send2trash" -version = "1.7.1" +version = "1.8.0" description = "Send file to trash natively under Mac OS X, Windows and Linux." category = "main" optional = false python-versions = "*" [package.extras] +nativelib = ["pyobjc-framework-cocoa", "pywin32"] +objc = ["pyobjc-framework-cocoa"] win32 = ["pywin32"] [[package]] @@ -1159,6 +1162,20 @@ docs = ["sphinxcontrib-websupport"] lint = ["flake8 (>=3.5.0)", "isort", "mypy (>=0.900)", "docutils-stubs", "types-typed-ast", "types-pkg-resources", "types-requests"] test = ["pytest", "pytest-cov", "html5lib", "cython", "typed-ast"] +[[package]] +name = "sphinx-automodapi" +version = "0.14.1" +description = "Sphinx extension for auto-generating API documentation for entire modules" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +sphinx = ">=2" + +[package.extras] +test = ["pytest", "pytest-cov", "cython", "codecov", "coverage"] + [[package]] name = "sphinxcontrib-applehelp" version = "1.0.2" @@ -1377,7 +1394,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes [metadata] lock-version = "1.1" python-versions = "^3.7.1" -content-hash = "caf4692b5bb6adaee9c942c93ee54f8bc96fdae4c776201ec95122e44867fc6a" +content-hash = "3eaf699092bd1ee567af27e1a16da424a253f603001baaf2e2beea00bbec2ca9" [metadata.files] alabaster = [ @@ -1689,8 +1706,8 @@ ipykernel = [ {file = "ipykernel-6.0.1.tar.gz", hash = "sha256:a4f51c53c7be3f93d75c25839183fa2dfa24908fc650dfd023b276c7a080dc73"}, ] ipython = [ - {file = "ipython-7.25.0-py3-none-any.whl", hash = "sha256:aa21412f2b04ad1a652e30564fff6b4de04726ce875eab222c8430edc6db383a"}, - {file = "ipython-7.25.0.tar.gz", hash = "sha256:54bbd1fe3882457aaf28ae060a5ccdef97f212a741754e420028d4ec5c2291dc"}, + {file = "ipython-7.31.1-py3-none-any.whl", hash = "sha256:55df3e0bd0f94e715abd968bedd89d4e8a7bce4bf498fb123fed4f5398fea874"}, + {file = "ipython-7.31.1.tar.gz", hash = "sha256:b5548ec5329a4bcf054a5deed5099b0f9622eb9ea51aaa7104d215fece201d8c"}, ] ipython-genutils = [ {file = "ipython_genutils-0.2.0-py2.py3-none-any.whl", hash = "sha256:72dd37233799e619666c9f639a9da83c34013a73e8bbc79a7a6348d93c61fab8"}, @@ -1898,8 +1915,8 @@ nglview = [ {file = "nglview-3.0.3.tar.gz", hash = "sha256:3253c44bd071e4701c288de44997471608487d5191ab3d3b7736c8651335c1af"}, ] notebook = [ - {file = "notebook-6.4.0-py3-none-any.whl", hash = "sha256:f7f0a71a999c7967d9418272ae4c3378a220bd28330fbfb49860e46cf8a5838a"}, - {file = "notebook-6.4.0.tar.gz", hash = "sha256:9c4625e2a2aa49d6eae4ce20cbc3d8976db19267e32d2a304880e0c10bf8aef9"}, + {file = "notebook-6.4.8-py3-none-any.whl", hash = "sha256:3e702fcc54b8ae597533c3864793b7a1e971dec9e112f67235828d8a798fd654"}, + {file = "notebook-6.4.8.tar.gz", hash = "sha256:1e985c9dc6f678bdfffb9dc657306b5469bfa62d73e03f74e8defbf76d284312"}, ] numpy = [ {file = "numpy-1.21.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:38e8648f9449a549a7dfe8d8755a5979b45b3538520d1e735637ef28e8c2dc50"}, @@ -1982,40 +1999,41 @@ pickleshare = [ {file = "pickleshare-0.7.5.tar.gz", hash = "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca"}, ] pillow = [ - {file = "Pillow-8.3.1-cp36-cp36m-macosx_10_10_x86_64.whl", hash = "sha256:196560dba4da7a72c5e7085fccc5938ab4075fd37fe8b5468869724109812edd"}, - {file = "Pillow-8.3.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:29c9569049d04aaacd690573a0398dbd8e0bf0255684fee512b413c2142ab723"}, - {file = "Pillow-8.3.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c088a000dfdd88c184cc7271bfac8c5b82d9efa8637cd2b68183771e3cf56f04"}, - {file = "Pillow-8.3.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:fc214a6b75d2e0ea7745488da7da3c381f41790812988c7a92345978414fad37"}, - {file = "Pillow-8.3.1-cp36-cp36m-win32.whl", hash = "sha256:a17ca41f45cf78c2216ebfab03add7cc350c305c38ff34ef4eef66b7d76c5229"}, - {file = "Pillow-8.3.1-cp36-cp36m-win_amd64.whl", hash = "sha256:67b3666b544b953a2777cb3f5a922e991be73ab32635666ee72e05876b8a92de"}, - {file = "Pillow-8.3.1-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:ff04c373477723430dce2e9d024c708a047d44cf17166bf16e604b379bf0ca14"}, - {file = "Pillow-8.3.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9364c81b252d8348e9cc0cb63e856b8f7c1b340caba6ee7a7a65c968312f7dab"}, - {file = "Pillow-8.3.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a2f381932dca2cf775811a008aa3027671ace723b7a38838045b1aee8669fdcf"}, - {file = "Pillow-8.3.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:d0da39795049a9afcaadec532e7b669b5ebbb2a9134576ebcc15dd5bdae33cc0"}, - {file = "Pillow-8.3.1-cp37-cp37m-win32.whl", hash = "sha256:2b6dfa068a8b6137da34a4936f5a816aba0ecc967af2feeb32c4393ddd671cba"}, - {file = "Pillow-8.3.1-cp37-cp37m-win_amd64.whl", hash = "sha256:a4eef1ff2d62676deabf076f963eda4da34b51bc0517c70239fafed1d5b51500"}, - {file = "Pillow-8.3.1-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:660a87085925c61a0dcc80efb967512ac34dbb256ff7dd2b9b4ee8dbdab58cf4"}, - {file = "Pillow-8.3.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:15a2808e269a1cf2131930183dcc0419bc77bb73eb54285dde2706ac9939fa8e"}, - {file = "Pillow-8.3.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:969cc558cca859cadf24f890fc009e1bce7d7d0386ba7c0478641a60199adf79"}, - {file = "Pillow-8.3.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2ee77c14a0299d0541d26f3d8500bb57e081233e3fa915fa35abd02c51fa7fae"}, - {file = "Pillow-8.3.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:c11003197f908878164f0e6da15fce22373ac3fc320cda8c9d16e6bba105b844"}, - {file = "Pillow-8.3.1-cp38-cp38-win32.whl", hash = "sha256:3f08bd8d785204149b5b33e3b5f0ebbfe2190ea58d1a051c578e29e39bfd2367"}, - {file = "Pillow-8.3.1-cp38-cp38-win_amd64.whl", hash = "sha256:70af7d222df0ff81a2da601fab42decb009dc721545ed78549cb96e3a1c5f0c8"}, - {file = "Pillow-8.3.1-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:37730f6e68bdc6a3f02d2079c34c532330d206429f3cee651aab6b66839a9f0e"}, - {file = "Pillow-8.3.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4bc3c7ef940eeb200ca65bd83005eb3aae8083d47e8fcbf5f0943baa50726856"}, - {file = "Pillow-8.3.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c35d09db702f4185ba22bb33ef1751ad49c266534339a5cebeb5159d364f6f82"}, - {file = "Pillow-8.3.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:0b2efa07f69dc395d95bb9ef3299f4ca29bcb2157dc615bae0b42c3c20668ffc"}, - {file = "Pillow-8.3.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:cc866706d56bd3a7dbf8bac8660c6f6462f2f2b8a49add2ba617bc0c54473d83"}, - {file = "Pillow-8.3.1-cp39-cp39-win32.whl", hash = "sha256:9a211b663cf2314edbdb4cf897beeb5c9ee3810d1d53f0e423f06d6ebbf9cd5d"}, - {file = "Pillow-8.3.1-cp39-cp39-win_amd64.whl", hash = "sha256:c2a5ff58751670292b406b9f06e07ed1446a4b13ffced6b6cab75b857485cbc8"}, - {file = "Pillow-8.3.1-pp36-pypy36_pp73-macosx_10_10_x86_64.whl", hash = "sha256:c379425c2707078dfb6bfad2430728831d399dc95a7deeb92015eb4c92345eaf"}, - {file = "Pillow-8.3.1-pp36-pypy36_pp73-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:114f816e4f73f9ec06997b2fde81a92cbf0777c9e8f462005550eed6bae57e63"}, - {file = "Pillow-8.3.1-pp36-pypy36_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:8960a8a9f4598974e4c2aeb1bff9bdd5db03ee65fd1fce8adf3223721aa2a636"}, - {file = "Pillow-8.3.1-pp37-pypy37_pp73-macosx_10_10_x86_64.whl", hash = "sha256:147bd9e71fb9dcf08357b4d530b5167941e222a6fd21f869c7911bac40b9994d"}, - {file = "Pillow-8.3.1-pp37-pypy37_pp73-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:1fd5066cd343b5db88c048d971994e56b296868766e461b82fa4e22498f34d77"}, - {file = "Pillow-8.3.1-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f4ebde71785f8bceb39dcd1e7f06bcc5d5c3cf48b9f69ab52636309387b097c8"}, - {file = "Pillow-8.3.1-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:1c03e24be975e2afe70dfc5da6f187eea0b49a68bb2b69db0f30a61b7031cee4"}, - {file = "Pillow-8.3.1.tar.gz", hash = "sha256:2cac53839bfc5cece8fdbe7f084d5e3ee61e1303cccc86511d351adcb9e2c792"}, + {file = "Pillow-9.0.1-1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a5d24e1d674dd9d72c66ad3ea9131322819ff86250b30dc5821cbafcfa0b96b4"}, + {file = "Pillow-9.0.1-1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:2632d0f846b7c7600edf53c48f8f9f1e13e62f66a6dbc15191029d950bfed976"}, + {file = "Pillow-9.0.1-1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b9618823bd237c0d2575283f2939655f54d51b4527ec3972907a927acbcc5bfc"}, + {file = "Pillow-9.0.1-cp310-cp310-macosx_10_10_universal2.whl", hash = "sha256:9bfdb82cdfeccec50aad441afc332faf8606dfa5e8efd18a6692b5d6e79f00fd"}, + {file = "Pillow-9.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5100b45a4638e3c00e4d2320d3193bdabb2d75e79793af7c3eb139e4f569f16f"}, + {file = "Pillow-9.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:528a2a692c65dd5cafc130de286030af251d2ee0483a5bf50c9348aefe834e8a"}, + {file = "Pillow-9.0.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0f29d831e2151e0b7b39981756d201f7108d3d215896212ffe2e992d06bfe049"}, + {file = "Pillow-9.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:855c583f268edde09474b081e3ddcd5cf3b20c12f26e0d434e1386cc5d318e7a"}, + {file = "Pillow-9.0.1-cp310-cp310-win32.whl", hash = "sha256:d9d7942b624b04b895cb95af03a23407f17646815495ce4547f0e60e0b06f58e"}, + {file = "Pillow-9.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:81c4b81611e3a3cb30e59b0cf05b888c675f97e3adb2c8672c3154047980726b"}, + {file = "Pillow-9.0.1-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:413ce0bbf9fc6278b2d63309dfeefe452835e1c78398efb431bab0672fe9274e"}, + {file = "Pillow-9.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:80fe64a6deb6fcfdf7b8386f2cf216d329be6f2781f7d90304351811fb591360"}, + {file = "Pillow-9.0.1-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cef9c85ccbe9bee00909758936ea841ef12035296c748aaceee535969e27d31b"}, + {file = "Pillow-9.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1d19397351f73a88904ad1aee421e800fe4bbcd1aeee6435fb62d0a05ccd1030"}, + {file = "Pillow-9.0.1-cp37-cp37m-win32.whl", hash = "sha256:d21237d0cd37acded35154e29aec853e945950321dd2ffd1a7d86fe686814669"}, + {file = "Pillow-9.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:ede5af4a2702444a832a800b8eb7f0a7a1c0eed55b644642e049c98d589e5092"}, + {file = "Pillow-9.0.1-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:b5b3f092fe345c03bca1e0b687dfbb39364b21ebb8ba90e3fa707374b7915204"}, + {file = "Pillow-9.0.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:335ace1a22325395c4ea88e00ba3dc89ca029bd66bd5a3c382d53e44f0ccd77e"}, + {file = "Pillow-9.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:db6d9fac65bd08cea7f3540b899977c6dee9edad959fa4eaf305940d9cbd861c"}, + {file = "Pillow-9.0.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f154d173286a5d1863637a7dcd8c3437bb557520b01bddb0be0258dcb72696b5"}, + {file = "Pillow-9.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14d4b1341ac07ae07eb2cc682f459bec932a380c3b122f5540432d8977e64eae"}, + {file = "Pillow-9.0.1-cp38-cp38-win32.whl", hash = "sha256:effb7749713d5317478bb3acb3f81d9d7c7f86726d41c1facca068a04cf5bb4c"}, + {file = "Pillow-9.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:7f7609a718b177bf171ac93cea9fd2ddc0e03e84d8fa4e887bdfc39671d46b00"}, + {file = "Pillow-9.0.1-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:80ca33961ced9c63358056bd08403ff866512038883e74f3a4bf88ad3eb66838"}, + {file = "Pillow-9.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:1c3c33ac69cf059bbb9d1a71eeaba76781b450bc307e2291f8a4764d779a6b28"}, + {file = "Pillow-9.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:12875d118f21cf35604176872447cdb57b07126750a33748bac15e77f90f1f9c"}, + {file = "Pillow-9.0.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:514ceac913076feefbeaf89771fd6febde78b0c4c1b23aaeab082c41c694e81b"}, + {file = "Pillow-9.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d3c5c79ab7dfce6d88f1ba639b77e77a17ea33a01b07b99840d6ed08031cb2a7"}, + {file = "Pillow-9.0.1-cp39-cp39-win32.whl", hash = "sha256:718856856ba31f14f13ba885ff13874be7fefc53984d2832458f12c38205f7f7"}, + {file = "Pillow-9.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:f25ed6e28ddf50de7e7ea99d7a976d6a9c415f03adcaac9c41ff6ff41b6d86ac"}, + {file = "Pillow-9.0.1-pp37-pypy37_pp73-macosx_10_10_x86_64.whl", hash = "sha256:011233e0c42a4a7836498e98c1acf5e744c96a67dd5032a6f666cc1fb97eab97"}, + {file = "Pillow-9.0.1-pp37-pypy37_pp73-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:253e8a302a96df6927310a9d44e6103055e8fb96a6822f8b7f514bb7ef77de56"}, + {file = "Pillow-9.0.1-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6295f6763749b89c994fcb6d8a7f7ce03c3992e695f89f00b741b4580b199b7e"}, + {file = "Pillow-9.0.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:a9f44cd7e162ac6191491d7249cceb02b8116b0f7e847ee33f739d7cb1ea1f70"}, + {file = "Pillow-9.0.1.tar.gz", hash = "sha256:6c8bc8238a7dfdaf7a75f5ec5a663f4173f8c367e5a39f87e720495e1eed75fa"}, ] plotly = [ {file = "plotly-5.1.0-py2.py3-none-any.whl", hash = "sha256:d60412ee21d85102f67e5c7134d59feb5e42a5cbbfb1e580ad67cbdf7589d80c"}, @@ -2218,8 +2236,8 @@ scipy = [ {file = "scipy-1.6.1.tar.gz", hash = "sha256:c4fceb864890b6168e79b0e714c585dbe2fd4222768ee90bc1aa0f8218691b11"}, ] send2trash = [ - {file = "Send2Trash-1.7.1-py3-none-any.whl", hash = "sha256:c20fee8c09378231b3907df9c215ec9766a84ee20053d99fbad854fe8bd42159"}, - {file = "Send2Trash-1.7.1.tar.gz", hash = "sha256:17730aa0a33ab82ed6ca76be3bb25f0433d0014f1ccf63c979bab13a5b9db2b2"}, + {file = "Send2Trash-1.8.0-py3-none-any.whl", hash = "sha256:f20eaadfdb517eaca5ce077640cb261c7d2698385a6a0f072a4a5447fd49fa08"}, + {file = "Send2Trash-1.8.0.tar.gz", hash = "sha256:d2c24762fd3759860a0aff155e45871447ea58d2be6bdd39b5c8f966a0c99c2d"}, ] six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, @@ -2233,6 +2251,10 @@ sphinx = [ {file = "Sphinx-4.0.3-py3-none-any.whl", hash = "sha256:5747f3c855028076fcff1e4df5e75e07c836f0ac11f7df886747231092cfe4ad"}, {file = "Sphinx-4.0.3.tar.gz", hash = "sha256:dff357e6a208eb7edb2002714733ac21a9fe597e73609ff417ab8cf0c6b4fbb8"}, ] +sphinx-automodapi = [ + {file = "sphinx-automodapi-0.14.1.tar.gz", hash = "sha256:a2f9c0f9e2901875e6db75df6c01412875eb15f25e7db1206e1b69fedf75bbc9"}, + {file = "sphinx_automodapi-0.14.1-py3-none-any.whl", hash = "sha256:4238e131d7abc47226449661bb3cfa2bb1b5b190184ffa69d9b924b984a22753"}, +] sphinxcontrib-applehelp = [ {file = "sphinxcontrib-applehelp-1.0.2.tar.gz", hash = "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"}, {file = "sphinxcontrib_applehelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a"}, diff --git a/pyproject.toml b/pyproject.toml index 484cd515..69733335 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,20 @@ [tool.poetry] name = "py4vasp" -version = "0.3.1" +version = "0.4.0" description = "Tool for assisting with the analysis and setup of VASP calculations." authors = [ + "VASP Software GmbH ", "Martin Schlipf ", + "Henrique Miranda ", "Orest Dubay " ] +license = "Apache-2.0" +readme = "README.md" +homepage = "https://vasp.at/py4vasp" +repository = "https://github.com/vasp-dev/py4vasp" + +[tool.poetry.urls] +"Support Forum" = "https://vasp.at/forum/" [tool.poetry.dependencies] python = "^3.7.1" diff --git a/src/py4vasp/__init__.py b/src/py4vasp/__init__.py index fd0615c3..0787ba54 100644 --- a/src/py4vasp/__init__.py +++ b/src/py4vasp/__init__.py @@ -1,5 +1,7 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from .calculation import Calculation from py4vasp._third_party.interactive import set_error_handling -__version__ = "0.3.1" +__version__ = "0.4.0" set_error_handling("Minimal") diff --git a/src/py4vasp/_third_party/interactive.py b/src/py4vasp/_third_party/interactive.py index d06f256d..3c02b583 100644 --- a/src/py4vasp/_third_party/interactive.py +++ b/src/py4vasp/_third_party/interactive.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import contextlib import IPython import os diff --git a/src/py4vasp/_util/convert.py b/src/py4vasp/_util/convert.py index 474d456c..e2b5c5ee 100644 --- a/src/py4vasp/_util/convert.py +++ b/src/py4vasp/_util/convert.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import numpy as np import re diff --git a/src/py4vasp/_util/documentation.py b/src/py4vasp/_util/documentation.py index e9ac3225..1021315c 100644 --- a/src/py4vasp/_util/documentation.py +++ b/src/py4vasp/_util/documentation.py @@ -1,3 +1,7 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + + def add(doc_string): def add_documentation_to_function(func): func.__doc__ = doc_string diff --git a/src/py4vasp/_util/reader.py b/src/py4vasp/_util/reader.py index 51f0a8b5..1e6c0310 100644 --- a/src/py4vasp/_util/reader.py +++ b/src/py4vasp/_util/reader.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import py4vasp.exceptions as exception import numpy as np diff --git a/src/py4vasp/_util/sanity_check.py b/src/py4vasp/_util/sanity_check.py index 19068969..48350d69 100644 --- a/src/py4vasp/_util/sanity_check.py +++ b/src/py4vasp/_util/sanity_check.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import numbers import py4vasp.exceptions as exception diff --git a/src/py4vasp/_util/selection.py b/src/py4vasp/_util/selection.py index 59a0bffd..39b2efcd 100644 --- a/src/py4vasp/_util/selection.py +++ b/src/py4vasp/_util/selection.py @@ -1,3 +1,7 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + + range_separator = ":" all = "__all__" diff --git a/src/py4vasp/_util/version.py b/src/py4vasp/_util/version.py index 1d40c069..b2b7d021 100644 --- a/src/py4vasp/_util/version.py +++ b/src/py4vasp/_util/version.py @@ -1,9 +1,11 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.raw import RawVersion import py4vasp.exceptions as exception import functools minimal_vasp_version = RawVersion(6, 2) -current_vasp_version = RawVersion(6, 2, 1) +current_vasp_version = RawVersion(6, 3, 0) def require(version, err_msg=None): diff --git a/src/py4vasp/calculation.py b/src/py4vasp/calculation.py index e3d75d81..a113d8d7 100644 --- a/src/py4vasp/calculation.py +++ b/src/py4vasp/calculation.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Provide the tools to manage VASP calculations. This is the main user interface if you want to simply investigate the results of VASP @@ -5,15 +7,14 @@ run. Then you can access the properties of that calculation via the attributes of the object. For example you may use -.. code-block:: python - - calc = Calculation.from_path("path_to_your_calculation") - calc.dos.plot() # to plot the density of states - calc.magnetism.read() # to read the magnetic moments - calc.structure.print() # to print the structure in a POSCAR format +>>> calc = Calculation.from_path("path_to_your_calculation") +>>> calc.dos.plot() # to plot the density of states +>>> calc.magnetism.read() # to read the magnetic moments +>>> calc.structure.print() # to print the structure in a POSCAR format """ import inspect import py4vasp.data +import py4vasp.exceptions as exception import py4vasp.control import py4vasp._util.convert as _convert from pathlib import Path @@ -22,11 +23,23 @@ class Calculation: """Manage access to input and output of VASP calculations. - .. warning:: - Create new instances using the class method :meth:`from_path` and not the - constructor. Otherwise some functionality will not work as intended. + Notes + ----- + To create new instances, you should use the classmethod :meth:`from_path`. This + will ensure that the path to your VASP calculation is properly set and all features + work as intended. + + Attributes + ---------- """ + def __init__(self, *args, **kwargs): + if not kwargs.get("_internal"): + message = """\ +Please setup new Calculation instances using the classmethod Calculation.from_path() +instead of the constructor Calculation().""" + raise exception.IncorrectUsage(message) + @classmethod def from_path(cls, path_name): """Set up a Calculation for a particular path and so that all files are opened there. @@ -41,9 +54,9 @@ def from_path(cls, path_name): Calculation A calculation associated with the given path. """ - calc = cls() + calc = cls(_internal=True) calc._path = Path(path_name).expanduser().resolve() - calc = _add_all_refinement_classes(calc) + calc = _add_all_refinement_classes(calc, _add_to_instance) return _add_input_files(calc) def path(self): @@ -78,19 +91,36 @@ def POSCAR(self, poscar): self._POSCAR.write(str(poscar)) -def _add_all_refinement_classes(calc): +def _add_all_refinement_classes(calc, add_single_class): for name, class_ in inspect.getmembers(py4vasp.data, inspect.isclass): if issubclass(class_, py4vasp.data._base.DataBase): - calc = _add_refinement_class(calc, name, class_) + calc = add_single_class(calc, name, class_) return calc -def _add_refinement_class(calc, name, class_): +def _add_to_instance(calc, name, class_): instance = class_.from_file(calc.path()) setattr(calc, _convert.to_snakecase(name), instance) return calc +def _add_to_documentation(calc, name, class_): + first_line = class_.__doc__.split("\n")[0] + functions = inspect.getmembers(class_, inspect.isfunction) + names = [name for name, _ in functions if not name.startswith("_")] + calc.__doc__ += f""" + {_convert.to_snakecase(name)} + {first_line} + +""" + for name in names: + calc.__doc__ += f" * :py:meth:`py4vasp.data.{class_.__name__}.{name}`\n" + return calc + + +Calculation = _add_all_refinement_classes(Calculation, _add_to_documentation) + + def _add_input_files(calc): calc._INCAR = py4vasp.control.INCAR(calc._path) calc._KPOINTS = py4vasp.control.KPOINTS(calc._path) diff --git a/src/py4vasp/control/__init__.py b/src/py4vasp/control/__init__.py index f5c7101d..9ef66747 100644 --- a/src/py4vasp/control/__init__.py +++ b/src/py4vasp/control/__init__.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Setup input data for VASP calculations. VASP requires several input files to execute. We provide some simple helper classes and diff --git a/src/py4vasp/control/_base.py b/src/py4vasp/control/_base.py index b61cdc70..42297828 100644 --- a/src/py4vasp/control/_base.py +++ b/src/py4vasp/control/_base.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from pathlib import Path diff --git a/src/py4vasp/control/incar.py b/src/py4vasp/control/incar.py index 1672862c..00167708 100644 --- a/src/py4vasp/control/incar.py +++ b/src/py4vasp/control/incar.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.control._base import InputBase diff --git a/src/py4vasp/control/kpoints.py b/src/py4vasp/control/kpoints.py index 4da3d8b3..eb3d2a7f 100644 --- a/src/py4vasp/control/kpoints.py +++ b/src/py4vasp/control/kpoints.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.control._base import InputBase diff --git a/src/py4vasp/control/poscar.py b/src/py4vasp/control/poscar.py index 8112ef30..7af547fd 100644 --- a/src/py4vasp/control/poscar.py +++ b/src/py4vasp/control/poscar.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.control._base import InputBase from py4vasp.data import Structure diff --git a/src/py4vasp/data/__init__.py b/src/py4vasp/data/__init__.py index a2c2e9a5..f1fc0a20 100644 --- a/src/py4vasp/data/__init__.py +++ b/src/py4vasp/data/__init__.py @@ -1,19 +1,21 @@ -""" Refine the raw data produced by Vasp for plotting or analysis. +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) +""" Refine the raw data produced by VASP for plotting or analysis. -Usually one is not directly interested in the raw data that is produced, but -wants to produce either a figure for a publication or some post processing of -the data. This module contains multiple classes that enable these kind of +Usually one is not directly interested in the raw data that is produced but +wants to produce either a figure for a publication or some post-processing of +the data. This module contains multiple classes that enable these kinds of workflows by extracting the relevant data from the HDF5 file and transforming them into an accessible format. The classes also provide plotting functionality to get a quick insight about the data, which can then be refined either within -python or a different tool to obtain publication quality figures. +python or a different tool to obtain publication-quality figures. Generally, all classes provide a `read` function that extracts the data from the -HDF5 file and puts it into a python dictionary. Where it makes sense in addition +HDF5 file and puts it into a Python dictionary. Where it makes sense in addition a `plot` function is available that converts the data into a figure for Jupyter notebooks. In addition, data conversion routines `to_X` may be available transforming the data into another format or file, which may be useful to -generate plots with tools other than python. For the specifics, please refer to +generate plots with tools other than Python. For the specifics, please refer to the documentation of the individual classes. """ diff --git a/src/py4vasp/data/_base.py b/src/py4vasp/data/_base.py index 33b33838..2577891a 100644 --- a/src/py4vasp/data/_base.py +++ b/src/py4vasp/data/_base.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import contextlib import functools import pathlib @@ -37,6 +39,9 @@ def from_dict(cls, dict_): def from_file(cls, file=None): """Read the data dictionary from the given file. + You want to use this method if you want to avoid using the Calculation + wrapper, for example because you renamed the output of the VASP calculation. + Parameters ---------- file : str or Path or raw.File @@ -74,6 +79,7 @@ def _repr_pretty_(self, p, cycle): p.text(str(self)) def print(self): + "Print a string representation of this class to standard output." print(self) def _set_data_or_raise_error_if_data_is_missing(self, raw_data): diff --git a/src/py4vasp/data/_export.py b/src/py4vasp/data/_export.py index 9f3f98ec..99f7dddd 100644 --- a/src/py4vasp/data/_export.py +++ b/src/py4vasp/data/_export.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import py4vasp._util.convert as _convert @@ -12,7 +14,7 @@ def to_image(self, *args, filename=None, **kwargs): Note that the filename must be a keyword argument, i.e., you explicitly need to write *filename="name_of_file"* because the arguments are passed - on to the plot function. Please check the documentation of that function + on to the :py:meth:`plot` function. Please check the documentation of that function to learn which arguments are allowed.""" fig = self.to_plotly(*args, **kwargs) classname = _convert.to_snakecase(self.__class__.__name__).strip("_") diff --git a/src/py4vasp/data/_selection.py b/src/py4vasp/data/_selection.py index 6ac9fe5f..15f3c579 100644 --- a/src/py4vasp/data/_selection.py +++ b/src/py4vasp/data/_selection.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from typing import NamedTuple, Iterable diff --git a/src/py4vasp/data/_trajectory.py b/src/py4vasp/data/_trajectory.py index b84890d1..18e705d6 100644 --- a/src/py4vasp/data/_trajectory.py +++ b/src/py4vasp/data/_trajectory.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import copy from py4vasp.data._base import DataBase import py4vasp.exceptions as exception @@ -17,12 +19,15 @@ def trajectory_examples(instance_name, function_name=None): If you access {access}, the result will depend on {depend_on} that you selected with the [] operator. Without any selection the results from the final step will be used. + >>> calc.{instance_name}.{function_name}() To select the results for all steps, you don't specify the array boundaries. + >>> calc.{instance_name}[:].{function_name}() You can also select specific steps or a subset of steps as follows + >>> calc.{instance_name}[5].{function_name}() >>> calc.{instance_name}[1:6].{function_name}()""".strip() diff --git a/src/py4vasp/data/band.py b/src/py4vasp/data/band.py index a2ec67ba..19373132 100644 --- a/src/py4vasp/data/band.py +++ b/src/py4vasp/data/band.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import functools import itertools import numpy as np diff --git a/src/py4vasp/data/born_effective_charge.py b/src/py4vasp/data/born_effective_charge.py index 2aa8e54f..4d3603cc 100644 --- a/src/py4vasp/data/born_effective_charge.py +++ b/src/py4vasp/data/born_effective_charge.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import py4vasp.data._base as _base from py4vasp.data import Structure diff --git a/src/py4vasp/data/density.py b/src/py4vasp/data/density.py index 6b21a8a8..b23f3791 100644 --- a/src/py4vasp/data/density.py +++ b/src/py4vasp/data/density.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data import Viewer3d, Structure, Topology from py4vasp.data._base import DataBase, RefinementDescriptor from IPython.lib.pretty import pretty diff --git a/src/py4vasp/data/dielectric_function.py b/src/py4vasp/data/dielectric_function.py index f2ed6ca4..d852db66 100644 --- a/src/py4vasp/data/dielectric_function.py +++ b/src/py4vasp/data/dielectric_function.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import numpy as np import plotly.graph_objects as go import typing @@ -49,7 +51,7 @@ def _components(self): return components def _to_dict(self): - f"""Read the data into a dictionary. + """Read the data into a dictionary. Returns ------- @@ -65,7 +67,7 @@ def _to_dict(self): } def _to_plotly(self, selection=None): - f"""Read the data and generate a plotly figure. + """Read the data and generate a plotly figure. Parameters ---------- diff --git a/src/py4vasp/data/dielectric_tensor.py b/src/py4vasp/data/dielectric_tensor.py index 6adebe26..e6453d71 100644 --- a/src/py4vasp/data/dielectric_tensor.py +++ b/src/py4vasp/data/dielectric_tensor.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import py4vasp.data._base as _base import py4vasp._util.convert as _convert diff --git a/src/py4vasp/data/dos.py b/src/py4vasp/data/dos.py index 1193ab82..274714fe 100644 --- a/src/py4vasp/data/dos.py +++ b/src/py4vasp/data/dos.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import functools import itertools import numpy as np diff --git a/src/py4vasp/data/elastic_modulus.py b/src/py4vasp/data/elastic_modulus.py index 079246c5..e26f3eb3 100644 --- a/src/py4vasp/data/elastic_modulus.py +++ b/src/py4vasp/data/elastic_modulus.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import numpy as np import py4vasp.data._base as _base diff --git a/src/py4vasp/data/energy.py b/src/py4vasp/data/energy.py index b8d78f6d..d836d868 100644 --- a/src/py4vasp/data/energy.py +++ b/src/py4vasp/data/energy.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import plotly.graph_objects as go from plotly.subplots import make_subplots import functools diff --git a/src/py4vasp/data/force.py b/src/py4vasp/data/force.py index b9cf6edc..6e2dd4e1 100644 --- a/src/py4vasp/data/force.py +++ b/src/py4vasp/data/force.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import numpy as np import py4vasp.data._base as _base diff --git a/src/py4vasp/data/force_constant.py b/src/py4vasp/data/force_constant.py index 8e8623e6..44aca5c1 100644 --- a/src/py4vasp/data/force_constant.py +++ b/src/py4vasp/data/force_constant.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import itertools import py4vasp.data._base as _base from py4vasp.data import Structure diff --git a/src/py4vasp/data/internal_strain.py b/src/py4vasp/data/internal_strain.py index bfde008e..8769e8e9 100644 --- a/src/py4vasp/data/internal_strain.py +++ b/src/py4vasp/data/internal_strain.py @@ -1,8 +1,21 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import py4vasp.data._base as _base from py4vasp.data import Structure class InternalStrain(_base.DataBase): + """The internal strain + + You can use this class to extract the internal strain of a linear + response calculation. + + Parameters + ---------- + raw_internal_strain : RawInternalStrain + Dataclass containing the raw internal strain data. + """ + read = _base.RefinementDescriptor("_to_dict") to_dict = _base.RefinementDescriptor("_to_dict") __str__ = _base.RefinementDescriptor("_to_string") diff --git a/src/py4vasp/data/kpoint.py b/src/py4vasp/data/kpoint.py index e1333f78..81681fa7 100644 --- a/src/py4vasp/data/kpoint.py +++ b/src/py4vasp/data/kpoint.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data._base import DataBase, RefinementDescriptor import py4vasp._util.documentation as _documentation import py4vasp.exceptions as exception diff --git a/src/py4vasp/data/magnetism.py b/src/py4vasp/data/magnetism.py index 59b79ebb..1d53dcad 100644 --- a/src/py4vasp/data/magnetism.py +++ b/src/py4vasp/data/magnetism.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data import Structure from py4vasp.data._base import RefinementDescriptor import py4vasp.data._trajectory as _trajectory diff --git a/src/py4vasp/data/piezoelectric_tensor.py b/src/py4vasp/data/piezoelectric_tensor.py index 3c1b5b3b..52212315 100644 --- a/src/py4vasp/data/piezoelectric_tensor.py +++ b/src/py4vasp/data/piezoelectric_tensor.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import numpy as np import py4vasp.data._base as _base diff --git a/src/py4vasp/data/polarization.py b/src/py4vasp/data/polarization.py index 1df8de83..c7fe0d2d 100644 --- a/src/py4vasp/data/polarization.py +++ b/src/py4vasp/data/polarization.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import py4vasp.data._base as _base diff --git a/src/py4vasp/data/projector.py b/src/py4vasp/data/projector.py index f9c29a7d..f83133bb 100644 --- a/src/py4vasp/data/projector.py +++ b/src/py4vasp/data/projector.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from typing import NamedTuple, Iterable, Union import numpy as np import re @@ -39,12 +41,15 @@ def _selection_examples(instance_name, function_name): return f"""Examples -------- Select the p orbitals of the first atom in the POSCAR file: + >>> calc.{instance_name}.{function_name}(selection="1(p)") Select the d orbitals of Mn, Co, and Fe: + >>> calc.{instance_name}.{function_name}("d(Mn, Co, Fe)") Select the spin-up contribution of the first three atoms combined + >>> calc.{instance_name}.{function_name}("up(1{_selection.range_separator}3)") """ diff --git a/src/py4vasp/data/stress.py b/src/py4vasp/data/stress.py index 12a16729..1d1fdabd 100644 --- a/src/py4vasp/data/stress.py +++ b/src/py4vasp/data/stress.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import numpy as np import py4vasp.data._base as _base diff --git a/src/py4vasp/data/structure.py b/src/py4vasp/data/structure.py index ed285f4b..4967244a 100644 --- a/src/py4vasp/data/structure.py +++ b/src/py4vasp/data/structure.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data import Viewer3d, Topology from py4vasp.data._base import RefinementDescriptor from IPython.lib.pretty import pretty diff --git a/src/py4vasp/data/system.py b/src/py4vasp/data/system.py index b4dec61f..6b76678b 100644 --- a/src/py4vasp/data/system.py +++ b/src/py4vasp/data/system.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import py4vasp.data._base as _base import py4vasp._util.convert as _convert diff --git a/src/py4vasp/data/topology.py b/src/py4vasp/data/topology.py index 43242118..c60ab837 100644 --- a/src/py4vasp/data/topology.py +++ b/src/py4vasp/data/topology.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data._base import DataBase, RefinementDescriptor from py4vasp.data._selection import Selection as _Selection import py4vasp.exceptions as exception diff --git a/src/py4vasp/data/viewer3d.py b/src/py4vasp/data/viewer3d.py index 6f97906e..d7b2779c 100644 --- a/src/py4vasp/data/viewer3d.py +++ b/src/py4vasp/data/viewer3d.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from typing import NamedTuple import py4vasp.exceptions as exception import collections diff --git a/src/py4vasp/exceptions/__init__.py b/src/py4vasp/exceptions/__init__.py index cac607bf..42e15f5d 100644 --- a/src/py4vasp/exceptions/__init__.py +++ b/src/py4vasp/exceptions/__init__.py @@ -1,6 +1,8 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """ Deals with the possible exceptions in py4vasp. -The design goal is that all forseeable exceptions in py4vasp issue an exception +The design goal is that all foreseeable exceptions in py4vasp issue an exception of the Py4VaspException class. Any other kind of exception would indicate a bug in the code. If possible the part standard users interact with should not raise any exception, but should give advice on how to overcome the issue. diff --git a/src/py4vasp/exceptions/exceptions.py b/src/py4vasp/exceptions/exceptions.py index d931170d..86addb5f 100644 --- a/src/py4vasp/exceptions/exceptions.py +++ b/src/py4vasp/exceptions/exceptions.py @@ -1,3 +1,7 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) + + class Py4VaspError(Exception): """Base class for all exceptions raised by py4vasp""" diff --git a/src/py4vasp/raw/__init__.py b/src/py4vasp/raw/__init__.py index a4a7b49e..e65387a9 100644 --- a/src/py4vasp/raw/__init__.py +++ b/src/py4vasp/raw/__init__.py @@ -1,16 +1,18 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """ Extract the raw data from the HDF5 file and transform it into dataclasses. -In the HDF5 file, the raw data is stored with specific keys. In order to avoid +In the HDF5 file, the raw data is stored with specific keys. To avoid propagating the name of these keys to the higher tier modules, we transform -everything into dataclasses. This enables introducing new file formats by +everything into dataclasses. This enables the introduction of new file formats by replacing the `File` class. Notes ----- The data from the HDF5 file is lazily loaded except for scalars. This avoids memory issues when the HDF5 file contains a lot of data, because only what is -actually needed is read. However this has the consequence that you need to -enforce the read operation, before the file is closed. +needed is read. However, this has the consequence that you need to +enforce the read operation before the file is closed. """ from .rawdata import * diff --git a/src/py4vasp/raw/file.py b/src/py4vasp/raw/file.py index dded629a..db86de44 100644 --- a/src/py4vasp/raw/file.py +++ b/src/py4vasp/raw/file.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from contextlib import AbstractContextManager from pathlib import Path from .rawdata import * @@ -135,7 +137,9 @@ def band(self): projectors are included. """ return self._make_data_dict( - self._read_band(), kpoints_opt=self._read_band("_kpoints_opt") + self._read_band(), + kpoints_opt=self._read_band("_kpoints_opt"), + kpoints_wan=self._read_band("_kpoints_wan"), ) def _read_band(self, suffix=""): @@ -213,12 +217,18 @@ def kpoint(self): which may be useful for band structures. """ return self._make_data_dict( - self._read_kpoint(), kpoints_opt=self._read_kpoint("_kpoints_opt") + self._read_kpoint(), + kpoints_opt=self._read_kpoint("_kpoints_opt"), + kpoints_wan=self._read_kpoint("_kpoints_wan"), ) def _read_kpoint(self, suffix=""): self._raise_error_if_closed() - input = f"input/kpoints_opt" if suffix == "_kpoints_opt" else "input/kpoints" + input = { + "_kpoints_opt": f"input/kpoints_opt", + "_kpoints_wan": f"input/kpoints_wan", + "": f"input/kpoints", + }[suffix] result = f"results/electron_eigenvalues{suffix}" if input not in self._h5f or result not in self._h5f: return None diff --git a/src/py4vasp/raw/rawdata.py b/src/py4vasp/raw/rawdata.py index 0211531f..3f8372cc 100644 --- a/src/py4vasp/raw/rawdata.py +++ b/src/py4vasp/raw/rawdata.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from dataclasses import dataclass import numpy as np diff --git a/tests/_third_party/test_interactive.py b/tests/_third_party/test_interactive.py index 1a6c12f1..52359022 100644 --- a/tests/_third_party/test_interactive.py +++ b/tests/_third_party/test_interactive.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from unittest.mock import patch import py4vasp._third_party.interactive as interactive diff --git a/tests/_util/test_convert.py b/tests/_util/test_convert.py index d35d9379..6bdc7414 100644 --- a/tests/_util/test_convert.py +++ b/tests/_util/test_convert.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp._util.convert import text_to_string, to_complex import numpy as np diff --git a/tests/_util/test_documentation.py b/tests/_util/test_documentation.py index 55ea281b..a95998a9 100644 --- a/tests/_util/test_documentation.py +++ b/tests/_util/test_documentation.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import py4vasp._util.documentation as _documentation import inspect diff --git a/tests/_util/test_reader.py b/tests/_util/test_reader.py index 4ec926e8..0a8bb168 100644 --- a/tests/_util/test_reader.py +++ b/tests/_util/test_reader.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp._util.reader import Reader import py4vasp.exceptions as exception import numpy as np diff --git a/tests/_util/test_sanity_check.py b/tests/_util/test_sanity_check.py index 6c5f718f..ef27cd47 100644 --- a/tests/_util/test_sanity_check.py +++ b/tests/_util/test_sanity_check.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import py4vasp._util.sanity_check as check import py4vasp.exceptions as exception import pytest diff --git a/tests/_util/test_selection.py b/tests/_util/test_selection.py index afaac746..b5138fa2 100644 --- a/tests/_util/test_selection.py +++ b/tests/_util/test_selection.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp._util.selection import SelectionTree diff --git a/tests/_util/test_version.py b/tests/_util/test_version.py index a948debf..968d9080 100644 --- a/tests/_util/test_version.py +++ b/tests/_util/test_version.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import py4vasp._util.version as version_ from py4vasp.raw import RawVersion import py4vasp.exceptions as exception diff --git a/tests/conftest.py b/tests/conftest.py index ede1a6f1..ec8ebc26 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import itertools import numpy as np from numpy.testing import assert_array_almost_equal_nulp diff --git a/tests/control/test_base.py b/tests/control/test_base.py index ccb3739a..9eeb1737 100644 --- a/tests/control/test_base.py +++ b/tests/control/test_base.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from contextlib import redirect_stdout from io import StringIO from IPython.lib.pretty import pretty diff --git a/tests/control/test_incar.py b/tests/control/test_incar.py index fb887568..304ec280 100644 --- a/tests/control/test_incar.py +++ b/tests/control/test_incar.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from unittest.mock import patch from py4vasp.control import INCAR import py4vasp.data as data diff --git a/tests/control/test_kpoints.py b/tests/control/test_kpoints.py index c1a14f06..01c75995 100644 --- a/tests/control/test_kpoints.py +++ b/tests/control/test_kpoints.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from unittest.mock import patch from py4vasp.control import KPOINTS import py4vasp.data as data diff --git a/tests/control/test_poscar.py b/tests/control/test_poscar.py index ab9fc7f6..fe60361f 100644 --- a/tests/control/test_poscar.py +++ b/tests/control/test_poscar.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from unittest.mock import patch from py4vasp.control import POSCAR import py4vasp.data as data diff --git a/tests/data/conftest.py b/tests/data/conftest.py index 18e54b2d..e4ceb3c1 100644 --- a/tests/data/conftest.py +++ b/tests/data/conftest.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from contextlib import contextmanager from IPython.core.formatters import DisplayFormatter from unittest.mock import patch, MagicMock, PropertyMock diff --git a/tests/data/test_band.py b/tests/data/test_band.py index 76a80767..696521c1 100644 --- a/tests/data/test_band.py +++ b/tests/data/test_band.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data import Band, Kpoint, Projector from IPython.lib.pretty import pretty from unittest.mock import patch diff --git a/tests/data/test_base.py b/tests/data/test_base.py index 5a26785c..1ad66828 100644 --- a/tests/data/test_base.py +++ b/tests/data/test_base.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.raw import DataDict from py4vasp.data._base import DataBase, RefinementDescriptor from py4vasp._util.version import RawVersion, minimal_vasp_version diff --git a/tests/data/test_born_effective_charge.py b/tests/data/test_born_effective_charge.py index 241c0182..3a12447c 100644 --- a/tests/data/test_born_effective_charge.py +++ b/tests/data/test_born_effective_charge.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import pytest import types from py4vasp.data import BornEffectiveCharge, Structure diff --git a/tests/data/test_density.py b/tests/data/test_density.py index 92d2c076..424290cb 100644 --- a/tests/data/test_density.py +++ b/tests/data/test_density.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from unittest.mock import patch from py4vasp.data import Density, Structure import pytest diff --git a/tests/data/test_dielectric_function.py b/tests/data/test_dielectric_function.py index 3fd7a405..b037a3b4 100644 --- a/tests/data/test_dielectric_function.py +++ b/tests/data/test_dielectric_function.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data import DielectricFunction import dataclasses import numpy as np diff --git a/tests/data/test_dielectric_tensor.py b/tests/data/test_dielectric_tensor.py index 5f29806c..856ca6ae 100644 --- a/tests/data/test_dielectric_tensor.py +++ b/tests/data/test_dielectric_tensor.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import pytest import types from py4vasp.data import DielectricTensor diff --git a/tests/data/test_dos.py b/tests/data/test_dos.py index 569e7160..45b274d5 100644 --- a/tests/data/test_dos.py +++ b/tests/data/test_dos.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data import Dos from unittest.mock import patch import py4vasp.exceptions as exception diff --git a/tests/data/test_elastic_modulus.py b/tests/data/test_elastic_modulus.py index 227a2d84..2b50a4d0 100644 --- a/tests/data/test_elastic_modulus.py +++ b/tests/data/test_elastic_modulus.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import pytest import types from py4vasp.data import ElasticModulus diff --git a/tests/data/test_energy.py b/tests/data/test_energy.py index 8c04f8d2..2eac380c 100644 --- a/tests/data/test_energy.py +++ b/tests/data/test_energy.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data import Energy from unittest.mock import patch import pytest diff --git a/tests/data/test_force.py b/tests/data/test_force.py index b613af8a..9a79be6d 100644 --- a/tests/data/test_force.py +++ b/tests/data/test_force.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import numpy as np import pytest import types diff --git a/tests/data/test_force_constant.py b/tests/data/test_force_constant.py index 071ffed0..ff1e425e 100644 --- a/tests/data/test_force_constant.py +++ b/tests/data/test_force_constant.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import pytest import types from py4vasp.data import ForceConstant, Structure diff --git a/tests/data/test_internal_strain.py b/tests/data/test_internal_strain.py index 9e2b4dbc..1718fd57 100644 --- a/tests/data/test_internal_strain.py +++ b/tests/data/test_internal_strain.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import pytest import types from py4vasp.data import InternalStrain, Structure diff --git a/tests/data/test_kpoint.py b/tests/data/test_kpoint.py index 22a82bc1..74f0c256 100644 --- a/tests/data/test_kpoint.py +++ b/tests/data/test_kpoint.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data import Kpoint import py4vasp.exceptions as exception import pytest diff --git a/tests/data/test_magnetism.py b/tests/data/test_magnetism.py index c1b18e9c..2b2e15d8 100644 --- a/tests/data/test_magnetism.py +++ b/tests/data/test_magnetism.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data import Magnetism import py4vasp.exceptions as exception import numpy as np diff --git a/tests/data/test_piezoelectric_tensor.py b/tests/data/test_piezoelectric_tensor.py index 12222288..53a24ba6 100644 --- a/tests/data/test_piezoelectric_tensor.py +++ b/tests/data/test_piezoelectric_tensor.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import pytest import types from py4vasp.data import PiezoelectricTensor diff --git a/tests/data/test_polarization.py b/tests/data/test_polarization.py index c686369b..f654a8d4 100644 --- a/tests/data/test_polarization.py +++ b/tests/data/test_polarization.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import pytest import types from py4vasp.data import Polarization diff --git a/tests/data/test_projector.py b/tests/data/test_projector.py index c43e9c12..5bc3d0fc 100644 --- a/tests/data/test_projector.py +++ b/tests/data/test_projector.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data import Projector, Topology from py4vasp.data._selection import Selection import py4vasp._util.selection as selection diff --git a/tests/data/test_repr.py b/tests/data/test_repr.py index f4d63723..1e41c0bb 100644 --- a/tests/data/test_repr.py +++ b/tests/data/test_repr.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data import * from py4vasp.raw import * from py4vasp._util.convert import to_snakecase diff --git a/tests/data/test_stress.py b/tests/data/test_stress.py index e7355dd1..5c791d6a 100644 --- a/tests/data/test_stress.py +++ b/tests/data/test_stress.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import numpy as np import pytest import types diff --git a/tests/data/test_structure.py b/tests/data/test_structure.py index 5e7b0e4c..93880733 100644 --- a/tests/data/test_structure.py +++ b/tests/data/test_structure.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from unittest.mock import patch from py4vasp.control import POSCAR from py4vasp.data import Structure, Magnetism, Topology diff --git a/tests/data/test_system.py b/tests/data/test_system.py index 904d9404..42bf1e29 100644 --- a/tests/data/test_system.py +++ b/tests/data/test_system.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import pytest from py4vasp.data import System from py4vasp.raw import RawSystem diff --git a/tests/data/test_topology.py b/tests/data/test_topology.py index 5b726857..228bd0d2 100644 --- a/tests/data/test_topology.py +++ b/tests/data/test_topology.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data import Topology from py4vasp.data._selection import Selection import py4vasp.exceptions as exception diff --git a/tests/data/test_trajectory.py b/tests/data/test_trajectory.py index 1462935c..3de366e6 100644 --- a/tests/data/test_trajectory.py +++ b/tests/data/test_trajectory.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.data._base import RefinementDescriptor from py4vasp.data._trajectory import DataTrajectory, trajectory_examples import py4vasp.exceptions as exception diff --git a/tests/data/test_viewer3d.py b/tests/data/test_viewer3d.py index ee0946c9..e75c0aa1 100644 --- a/tests/data/test_viewer3d.py +++ b/tests/data/test_viewer3d.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from unittest.mock import patch from py4vasp.data import Structure, Viewer3d from py4vasp.data.viewer3d import _Arrow3d, _x_axis, _y_axis, _z_axis diff --git a/tests/raw/test_compatibility.py b/tests/raw/test_compatibility.py index a36522f7..25039276 100644 --- a/tests/raw/test_compatibility.py +++ b/tests/raw/test_compatibility.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import dataclasses import pytest from unittest.mock import patch, PropertyMock diff --git a/tests/raw/test_file.py b/tests/raw/test_file.py index 01687320..4b3b8239 100644 --- a/tests/raw/test_file.py +++ b/tests/raw/test_file.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from py4vasp.raw import * import py4vasp.exceptions as exception import contextlib diff --git a/tests/raw/test_raw.py b/tests/raw/test_raw.py index b21a8e75..858cdc05 100644 --- a/tests/raw/test_raw.py +++ b/tests/raw/test_raw.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from dataclasses import FrozenInstanceError from py4vasp.raw import RawVersion, DataDict from py4vasp._util.version import current_vasp_version diff --git a/tests/test_calculation.py b/tests/test_calculation.py index 24839216..943f6ac6 100644 --- a/tests/test_calculation.py +++ b/tests/test_calculation.py @@ -1,7 +1,11 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from unittest.mock import patch, mock_open from pathlib import Path +import pytest import py4vasp.data import py4vasp.control as ctrl +import py4vasp.exceptions as exception import inspect @@ -60,3 +64,12 @@ def test_input_files(): with patch("py4vasp.control._base.open", mock_open(read_data=text)) as mock: calculation.POSCAR = text assert calculation.POSCAR.read() == text + + +def test_using_constructor_raises_exception(): + with pytest.raises(exception.IncorrectUsage): + py4vasp.Calculation() + with pytest.raises(exception.IncorrectUsage): + py4vasp.Calculation("path") + with pytest.raises(exception.IncorrectUsage): + py4vasp.Calculation(key="value") diff --git a/tests/test_version.py b/tests/test_version.py index 71953187..44b6381d 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -1,3 +1,5 @@ +# Copyright © VASP Software GmbH, +# Licensed under the Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0) import pathlib import py4vasp