{ "info": { "author": "Terence Zhi Liu", "author_email": "zhi.liu@utoledo.edu", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Topic :: Scientific/Engineering :: Physics" ], "description": "pydass\\_vasp (or, badass wasp)\n==============================\n\nConvenient Python modules and wrapping script executables.\n\nExample: plotting band structure\n''''''''''''''''''''''''''''''''\n\n.. code:: python\n\n pydass_vasp.plotting.plot_bs(axis_range=[-4,6])\n\n.. figure:: http://terencezl.github.io/pydass_vasp/public/imgs/band_structure.png\n :alt: band\\_structure\n\nReturned dictionary:\n\n.. code:: python\n\n {'data': {'columns': ['k_points', \n 'band_1', 'band_2', 'band_3', 'band_4', 'band_5', 'band_6', 'band_7', 'band_8', \n 'band_9', 'band_10', 'band_11', 'band_12', 'band_13', 'band_14', 'band_15', 'band_16', \n 'band_17', 'band_18', 'band_19', 'band_20', 'band_21', 'band_22', 'band_23', 'band_24', \n 'band_25', 'band_26', 'band_27', 'band_28', 'band_29', 'band_30', 'band_31', 'band_32'],\n 'data': array(\n [[ 0. , -20.342219 , -16.616756 , ..., 5.849101 ,\n 5.855091 , 6.074841 ],\n [ 0.04558028, -20.342181 , -16.616823 , ..., 5.811826 ,\n 5.815311 , 6.060851 ],\n [ 0.09116057, -20.34223 , -16.617067 , ..., 5.730248 ,\n 5.734556 , 5.80481 ],\n ..., \n [ 2.49869989, -20.343194 , -16.628521 , ..., 5.172637 ,\n 5.204402 , 5.711173 ],\n [ 2.53591604, -20.343228 , -16.6286 , ..., 5.219897 ,\n 5.226956 , 5.730676 ],\n [ 2.57313218, -20.34319 , -16.628622 , ..., 5.234177 ,\n 5.234205 , 5.726715 ]])},\n 'reciprocal_point_locations': array([ 0. , 0.8660254 , 1.3660254 , 1.8660254 , 2.57313218]),\n 'reciprocal_points': ['R', 'G', 'X', 'M', 'G']}\n\nExample: plotting total density of states with spin polarization\n''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''\n\n.. code:: python\n\n pydass_vasp.plotting.plot_tdos(axis_range=[-15, 15, 0, 40], return_refs=True)\n\n.. figure:: http://terencezl.github.io/pydass_vasp/public/imgs/dos_combined.png\n :alt: dos\\_combined\n\n.. figure:: http://terencezl.github.io/pydass_vasp/public/imgs/dos_overlapping.png\n :alt: dos\\_overlapping\n\nReturned dictionary:\n\n.. code:: python\n\n {'ax_spin_combined': ,\n 'ax_spin_overlapping': ,\n 'data_spin_down': {'columns': ['E', 'total_down', 'integrated_down'],\n 'data': array([[-22.63140452, 0. , 0. ],\n [-22.60640452, 0. , 0. ],\n [-22.58040452, 0. , 0. ],\n ..., \n [ 15.05159548, 0. , 56. ],\n [ 15.07659548, 0. , 56. ],\n [ 15.10159548, 0. , 56. ]])},\n 'data_spin_up': {'columns': ['E', 'total_up', 'integrated_up'],\n 'data': array([[-22.63140452, 0. , 0. ],\n [-22.60640452, 0. , 0. ],\n [-22.58040452, 0. , 0. ],\n ..., \n [ 15.05159548, 0. , 56. ],\n [ 15.07659548, 0. , 56. ],\n [ 15.10159548, 0. , 56. ]])}}\n\nWhat is it?\n-----------\n\nThis Python package is the result of frustration of searching for an\norganized, straightforward and flexible approach of plotting, fitting\nand manipulation of `VASP `__ files (typically\n``POSCAR``) in a few key strokes as long as you have a terminal, and\npreferably a (S)FTP client. It has the following features:\n\n- It is a Python package with a straightforward structure. When you\n ``import pydass_vasp``, you have sub-packages\n ``pydass_vasp.plotting``, ``pydass_vasp.fitting``,\n ``pydass_vasp.manipulation``, ``pydass_vasp.xml_utils``, each\n containing a few functions to carry out your tasks, with a careful\n selection of options to choose from. Return values are Python\n dictionaries, informative enough to be flexible for post-processing.\n When there is no need for an object, don't bother creating one.\n\n- It also has scripts that utilize the main package. They are simply\n 'wrappers' to the functions that are used the most frequently,\n typically ``plotting`` and ``fitting`` functions. Instead of\n ``cd``\\ ing into a directory and launching the Python interpreter\n ``python``, making the imports and calling the functions, you just\n need to stay in your terminal shell and type ``plot_tdos.py`` to plot\n the total density of states (DOS), ``plot_ldos.py 1`` to plot the\n local projected DOS of the first atom, and ``plot_bs.py`` to plot the\n band structure. These scripts accept arguments and options as\n flexible as their function counterparts.\n\n- The defaults of the functions and wrapping scripts are sane and cater\n to the most use cases. For example, If you are in a Python\n interpreter, simply typing in ``pydass_vasp.plotting.plot_tdos()``\n will collect data to plot from ``DOSCAR`` and parameters necessary\n under the current VASP job directory, generate and **display** a\n figure (or more) but **not save** it/them on disk, and at the same\n time return a dictionary with the extracted data. It'll automatically\n obtain critical parameters such as ``ISPIN``, ``E-fermi`` first from\n VASP **output** files (e.g. ``OUTCAR``), then **input** files (e.g.\n ``INCAR``) if the first attempt fails, and decide the number of\n figures to generate. If you are just in a terminal shell, typing in\n the script ``plot_tdos.py`` will do the same, but **rather than\n display** the figure(s), instead, **save** it/them quietly and use\n matplotlib's ``Agg`` backend. This would be particularly helpful for\n terminal users who don't have X Window forwarding\n (`Xming `__ for Windows,\n `XQuartz `__ for Mac OS X)\n set up on their own local machine, or the forwarding connection is\n slow to hold the live generated figures.\n\n- The options to the functions and wrapping scripts provide you with\n room of customization from the beginning. For example, the internal\n documentation of ``pydass_vasp.plotting.plot_tdos()`` looks like\n below.\n\n .. code:: python\n\n # see the docstring\n\n # in IPython interpreter\n pydass_vasp.plotting.plot_tdos?\n\n # or in regular python interpreter\n help(pydass_vasp.plotting.plot_tdos)\n\n ::\n\n Plot the total density of states, with consideration of spin-polarization.\n Accepts input file 'DOSCAR', or 'vasprun.xml'.\n\n Parameters\n ----------\n axis_range: list\n the range of axes x and y, 4 values in a list\n ISPIN: int\n user specified ISPIN\n If not given, for DOSCAR-type input, infer from OUTCAR/INCAR.\n For vasprun.xml-type input, infer from 'vasprun.xml'.\n input_file: string\n input file name, default to 'DOSCAR'\n For DOSCAR-type, can be any string containing 'DOSCAR'.\n For vasprun.xml-type input, can be any string ending with '.xml'.\n display: bool\n Display figures or not. Default to True.\n on_figs: list/int\n the current figure numbers to plot to, default to new figures\n return_refs: bool\n Return the axes reference(s) drawing or not. Default to False.\n save_figs: bool\n Save figures or not. Default to False. \n save_data: bool\n Save data or not. Default to False.\n output_prefix: string\n prefix string before the output files, default to 'TDOS'\n return_states_at_Ef: bool\n Calculate the TDOS at Ef with a 0.4 eV window of integration or not. Default to False.\n\n Returns\n -------\n a dict, containing\n 'data': a dict that has 2D array of data,\n easily to Pandas DataFrame by pd.DataFrame(**returned_dict['data'])\n 'ax': the axes reference, if return_refs == True\n\n- The returned dictionary also leave room for adjustments. Take\n ``pydass_vasp.plotting.plot_tdos(return_refs=True)`` as an example.\n\n .. code:: python\n\n returned_dict = { \n 'data': {'columns': col_names, 'data': data}\n 'ax': ax\n }\n\n ``returned_dict['data']`` has a 2D numpy array of data, and their\n column names. This construction is prefered because if you have\n `pandas `__, you can just convert it to a\n DataFrame by ``pd.DataFrame(**returned_dict['data'])``.\n\n ``returned_dict['ax']`` is the matplotlib axes reference. When\n ``ISPIN`` is 2, they are two elements: ``'ax_spin_up'`` and\n ``'ax_spin_down'``.\n\n- It has a uniform plotting support for the Crystal Orbital Hamilton\n Populations (COHP) analysis tool `LOBSTER `__,\n function ``pydass_vasp.plotting.plot_cohp()`` and script\n ``plot_cohp.py``.\n\n- If you use matplotlib >= 1.4, and you plot with the wrapping scripts,\n you can optionally enjoy the aesthetic enhancement powered by its\n newly added sub-package\n `style `__. For\n example, ``plot_tdos.py --style=ggplot`` switches on the style of\n `ggplot `__. Read the stylesheet\n `guide `__ for more\n info, including designing and loading your own styles.\n\nMore on options\n---------------\n\nAs an example, we again consider ``pydass_vasp.plotting.plot_tdos()``,\nshortened as ``plot_tdos()``.\n\n``plot_tdos(input_file='vasprun.xml')`` switches from taking in\n``DOSCAR`` to ``vasprun.xml``. It lets you select what file you prefer\nto use. Any filename containing ``'DOSCAR'`` is considered to be of\n``DOSCAR`` type, any filename ending with ``'.xml'`` is considered to be\nof ``vasprun.xml`` type.\n\n``plot_tdos(ISPIN=2)`` lets you manually override the auto-detection of\n``ISPIN`` from files other than ``DOSCAR``. The program will skip the\ncorresponding part of work. This is helpful when you only have the major\ndata file ``DOSCAR`` transferred to you local machine, and do not have\nthe other files necessary to extract the parameters to proceed plotting.\nTo leave no confusion, when ``ISPIN`` is 2, two figures are generated,\none with spin up and down combined, the other with two overlapping\ncurves, denoting spin up and spin down separately.\n\n``plot_tdos(on_figs=1)`` creates the plot on top of an existing\nmatplotlib figure labeled as ``Figure 1``, instead of generating a whole\nnew one.\n\n``plot_tdos(on_figs=[1,2])`` when ``ISPIN`` is 2 puts the two plots\nmentioned before onto ``Figure 1`` and ``Figure 2``.\n``plot_tdos(on_figs=[1,None])`` is also valid, meaning putting the\ncombined curve to ``Figure 1``, and the two overlapping curves to a new\nfigure, which you can of course delete on its own.\n\n``plot_tdos(display=False, save_figs=True)`` replicates the behavior of\nthe corresponding wrapping script ``plot_tdos.py``.\n\n``plot_tdos(return_refs=True)`` adds the matplotlib axes reference(s) to\nthe returned dictionary, and keeps the figure(s) open to let you make\nfurther changes. Note: you don't need to switch ``display`` on to get\naxes references.\n\n``plot_tdos(save_data=True, output_prefix='TDOS')`` saves the extracted\ndata to disk, with the prefix ``'TDOS'``. The argument ``output_prefix``\nalso specifies the filenames for saved figures.\n\nThe wrapping script ``plot_tdos.py`` accepts the relevant options in the\nform of ``-i vasprun.xml``, or ``--input vasprun.xml``, ``-p`` or\n``--display``. For more readily available information, type in\n``plot_tdos.py -h`` to get help direclty from the terminal shell.\n\nDependencies\n------------\n\n- Python 2.7 (Python 3 support is currently not considered)\n- NumPy\n- SciPy\n- matplotlib\n- IPython (optional, but better to have)\n\nI highly recommend every scientist/researcher who is new to Python to\ninstall the scientific superpack\n`Anaconda `__, if you are\nusing Windows or Mac OS X. Even if you are on Linux, it is still highly\nrecommended if you don't have superuser control over the machine to\ninstall packages freely. It is often the case when you have ssh access\nto a supercomputer. In all these cases, just download the package and do\na simple local installation, and you already have everything to start\nwith, not only for ``pydass_vasp``, but also for the whole adventure of\nscientific computing.\n\nInstallation\n------------\n\n[STRIKEOUT:This package has already been registered on PyPI.] So if you\nhave `pip `__, which is a must\nhave, and should already have been included in Anaconda,\n\n[STRIKEOUT:pip install pydass\\_vasp]\n\n[STRIKEOUT:Or] if you wish to follow the more updated releases, which\nshould serve you better because small projects can fully enjoy the\nfreedom of updates on GitHub before committing to PyPI,\n\n::\n\n pip install git+https://github.com/terencezl/pydass_vasp\n\nAlternatively, if you don't have pip, [STRIKEOUT:download the\n``.tar.gz`` file from the PyPI page and decompress it in a local\ndirectory of your choice, or]\n``git clone https://github.com/terencezl/pydass_vasp``, get into the\nouter ``pydass_vasp`` directory and\n\n::\n\n python setup.py install\n\n # then you can get out of that directory and just delete it\n cd ..\n rm -r pydass_vasp\n\nHowever, ``pip`` installation is always recommended, because of the ease\nof uninstallation,\n\n::\n\n pip uninstall pydass_vasp\n\nGetting Help\n------------\n\nAn organized tutorial/documentation has not been ready yet, but the\ndocstrings of functions are fairly complete. If you use\n`IPython `__, which is also a must have, and should\nalready have been included in Anaconda,\n\n.. code:: python\n\n import pydass_vasp\n\n # in IPython interpreter\n pydass_vasp.plotting.plot_tdos?\n\n # or in regular python interpreter\n help(pydass_vasp.plotting.plot_tdos)\n\nYou will get help. Experiment on a few options and you'll be quickly on\nyour way.\n\nIn addition, the help texts of scripts (option ``-h`` when you call them\nin the terminal shell) are available as well.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://terencezl.github.io/pydass_vasp/", "keywords": "vasp plotting fitting manipulation", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pydass_vasp", "package_url": "https://pypi.org/project/pydass_vasp/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pydass_vasp/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://terencezl.github.io/pydass_vasp/" }, "release_url": "https://pypi.org/project/pydass_vasp/0.1/", "requires_dist": null, "requires_python": null, "summary": "Convenient Python modules and wrapping script executables", "version": "0.1" }, "last_serial": 1301663, "releases": { "0.1": [] }, "urls": [] }