castep-outputs


Namecastep-outputs JSON
Version 0.1.8 PyPI version JSON
download
home_pageNone
SummaryA package for extracting information from castep outputs
upload_time2025-01-10 13:52:49
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseBSD-3-Clause
keywords castep dft parser
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            castep_outputs
==============

Parser for CASTEP output files

``castep_outputs`` parses the output files of `castep
<https://www.castep.org/>`__ into a standard form and is able to subsequently
dump the processed data into a standard format.

Install
-------

To install ``castep_outputs`` simply run:

::

   pip install castep_outputs

To check it is installed run:

::

   python -m castep_outputs -h

Dependencies
------------

``castep_outputs`` is designed to have no external dependencies beyond the
standard library, however, it is possible to use either `PyYAML
<https://pypi.org/project/PyYAML/>`__ or `ruamel.yaml
<https://pypi.org/project/ruamel.yaml/>`__ to dump in the YAML format.

Command-line
------------

When run as a commandline tool, it attempts to find all files for the
given seedname, filtered by ``inc`` args (default: all). Explicit
files can be passed using longname arguments. castep_outputs can parse
most human-readable castep outputs including: ``.castep``, ``.cell``,
``.param``, ``.geom``, ``.md``, ``.bands``, ``.hug``, ``.phonon``,
``.phonon_dos``, ``.efield``, ``.xrd_sf``, ``.elf_fmt``,
``.chdiff_fmt``, ``.pot_fmt``, ``.den_fmt``, ``.elastic``, ``.ts``,
``.magres``, ``.tddft``, ``.err``.

to run in basic mode:

::

   python -m castep_outputs seedname

Which will attempt to detect all found files and dump a ``.json`` to
stdout, ready for piping.

::

   python -m castep_outputs --inc-castep --inc-param seedname

Will parse only the ``seedname.castep`` and ``seedname.param`` files if
found.

::

   python -m castep_outputs seedname.castep

Will parse the single named file and again dump a ``.json`` to stdout.

::

   python -m castep_outputs --castep seedname.param

Will attempt to parse the file ``seedname.param`` as though it were a
``.castep`` file. While not ordinarily useful it can help with manually renamed
files.

::

   python -m castep_outputs -o my_file.yaml -f yaml seedname.castep

Will parse ``seedname.castep``, dump it to ``my_file.yaml`` in ``yaml`` format
using the ``PyYAML`` engine if available and the ``RUAMEL`` engine if not.

As a module
-----------

``import``\ ing ``castep_outputs`` exposes all of the parsers at the
top-level.

The simplest method to use ``castep_outputs`` in a tool is to use the
``parse_single`` method which attempts to determine the parser from the file
extension.

::

   from castep_outputs import parse_single

   my_dict = parse_single('my_file.castep')

If you need a specific parser rather than determining it by extension
it is possible to pass them as the second argument, or call them
directly.

::

   import castep_outputs as co

   my_dict = co.parse_single('my_file', co.parse_castep_file)

   with open('my_file', 'r', encoding='utf-8') as inp:
       my_dict = co.parse_castep_file(inp)

It is recommended that you use ``parse_single`` as it uses special file-handling
to give better diagnostics if it fails. It is possible to enable more detailed
logging via the `logging
<https://docs.python.org/3/library/logging.html#logging.basicConfig>`_ module:

::

   import logging
   from castep_outputs import parse_single

   my_dict = parse_single('my_file', loglevel=logging.INFO)

The available parsing functions are:

-  ``parse_bands_file``
-  ``parse_castep_file``
-  ``parse_cell_file``
-  ``parse_cell_param_file``
-  ``parse_chdiff_fmt_file``
-  ``parse_den_fmt_file``
-  ``parse_efield_file``
-  ``parse_elastic_file``
-  ``parse_elf_fmt_file``
-  ``parse_err_file``
-  ``parse_geom_file``
-  ``parse_hug_file``
-  ``parse_magres_file``
-  ``parse_md_file``
-  ``parse_md_geom_file``
-  ``parse_param_file``
-  ``parse_phonon_file``
-  ``parse_phonon_dos_file``
-  ``parse_pot_fmt_file``
-  ``parse_tddft_file``
-  ``parse_tddft_file``
-  ``parse_ts_file``
-  ``parse_xrd_sf_file``

Which return processed ``list``\ s of ``dict``\ s of data ready for use
in other applications.

See `Documentation <https://oerc0122.github.io/castep_outputs/intro.html>`_ for full layout.

Full usage
----------

::

   usage: castep_outputs [-h] [-V] [-L {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [-o OUTPUT]
                         [-f {json,ruamel,yaml,pprint,print}] [-t] [-A] [--inc-castep]
                         [--inc-cell] [--inc-param] [--inc-geom] [--inc-md]
                         [--inc-bands] [--inc-hug] [--inc-phonon_dos] [--inc-efield]
                         [--inc-xrd_sf] [--inc-elf_fmt] [--inc-chdiff_fmt]
                         [--inc-pot_fmt] [--inc-den_fmt] [--inc-elastic] [--inc-ts]
                         [--inc-magres] [--inc-tddft] [--inc-err] [--inc-phonon]
                         [--castep [CASTEP ...]] [--cell [CELL ...]]
                         [--param [PARAM ...]] [--geom [GEOM ...]] [--md [MD ...]]
                         [--bands [BANDS ...]] [--hug [HUG ...]]
                         [--phonon_dos [PHONON_DOS ...]] [--efield [EFIELD ...]]
                         [--xrd_sf [XRD_SF ...]] [--elf_fmt [ELF_FMT ...]]
                         [--chdiff_fmt [CHDIFF_FMT ...]] [--pot_fmt [POT_FMT ...]]
                         [--den_fmt [DEN_FMT ...]] [--elastic [ELASTIC ...]]
                         [--ts [TS ...]] [--magres [MAGRES ...]] [--tddft [TDDFT ...]]
                         [--err [ERR ...]] [--phonon [PHONON ...]]
                         ...

   Attempts to find all files for seedname, filtered by `inc` args (default: all).
   Explicit files can be passed using longname arguments. castep_outputs can parse most
   human-readable castep outputs including: .castep, .cell, .param, .geom, .md, .bands,
   .hug, .phonon_dos, .efield, .xrd_sf, .elf_fmt, .chdiff_fmt, .pot_fmt, .den_fmt,
   .elastic, .ts, .magres, .tddft, .err, .phonon

   positional arguments:
     seedname              Seed name for data

   options:
     -h, --help            show this help message and exit
     -V, --version         show program's version number and exit
     -L {DEBUG,INFO,WARNING,ERROR,CRITICAL}, --log {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                           Verbose output
     -o OUTPUT, --output OUTPUT
                           File to write output, default: screen
     -f {json,ruamel,yaml,pprint,print}, --out-format {json,ruamel,yaml,pprint,print}
                           Output format
     -t, --testing         Set testing mode to produce flat outputs
     -A, --inc-all         Extract all available information
     --inc-castep          Extract .castep information
     --inc-cell            Extract .cell information
     --inc-param           Extract .param information
     --inc-geom            Extract .geom information
     --inc-md              Extract .md information
     --inc-bands           Extract .bands information
     --inc-hug             Extract .hug information
     --inc-phonon_dos      Extract .phonon_dos information
     --inc-efield          Extract .efield information
     --inc-xrd_sf          Extract .xrd_sf information
     --inc-elf_fmt         Extract .elf_fmt information
     --inc-chdiff_fmt      Extract .chdiff_fmt information
     --inc-pot_fmt         Extract .pot_fmt information
     --inc-den_fmt         Extract .den_fmt information
     --inc-elastic         Extract .elastic information
     --inc-ts              Extract .ts information
     --inc-magres          Extract .magres information
     --inc-tddft           Extract .tddft information
     --inc-err             Extract .err information
     --inc-phonon          Extract .phonon information
     --castep [CASTEP ...]
                           Extract from CASTEP as .castep type
     --cell [CELL ...]     Extract from CELL as .cell type
     --param [PARAM ...]   Extract from PARAM as .param type
     --geom [GEOM ...]     Extract from GEOM as .geom type
     --md [MD ...]         Extract from MD as .md type
     --bands [BANDS ...]   Extract from BANDS as .bands type
     --hug [HUG ...]       Extract from HUG as .hug type
     --phonon_dos [PHONON_DOS ...]
                           Extract from PHONON_DOS as .phonon_dos type
     --efield [EFIELD ...]
                           Extract from EFIELD as .efield type
     --xrd_sf [XRD_SF ...]
                           Extract from XRD_SF as .xrd_sf type
     --elf_fmt [ELF_FMT ...]
                           Extract from ELF_FMT as .elf_fmt type
     --chdiff_fmt [CHDIFF_FMT ...]
                           Extract from CHDIFF_FMT as .chdiff_fmt type
     --pot_fmt [POT_FMT ...]
                           Extract from POT_FMT as .pot_fmt type
     --den_fmt [DEN_FMT ...]
                           Extract from DEN_FMT as .den_fmt type
     --elastic [ELASTIC ...]
                           Extract from ELASTIC as .elastic type
     --ts [TS ...]         Extract from TS as .ts type
     --magres [MAGRES ...]
                           Extract from MAGRES as .magres type
     --tddft [TDDFT ...]   Extract from TDDFT as .tddft type
     --err [ERR ...]       Extract from ERR as .err type
     --phonon [PHONON ...]
                           Extract from PHONON as .phonon type

Current Parsers:

-  ``.bands``
-  ``.castep``
-  ``.cell``
-  ``.chdiff_fmt``
-  ``.den_fmt``
-  ``.efield``
-  ``.elastic``
-  ``.elf_fmt``
-  ``.err``
-  ``.geom``
-  ``.hug``
-  ``.magres``
-  ``.md``
-  ``.param``
-  ``.phonon``
-  ``.phonon_dos``
-  ``.pot_fmt``
-  ``.tddft``
-  ``.ts``
-  ``.xrd_sf``

Current dumpers:

-  ``json``
-  ``ruamel.yaml``
-  ``pyyaml``
-  ``print``
-  ``pprint``

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "castep-outputs",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "castep, dft, parser",
    "author": null,
    "author_email": "Jacob Wilkins <jacob.wilkins@stfc.ac.uk>",
    "download_url": "https://files.pythonhosted.org/packages/c8/00/9d6144cfae6b66bae89013af96bc53256d44827acb777a0950054fe93fb9/castep_outputs-0.1.8.tar.gz",
    "platform": null,
    "description": "castep_outputs\n==============\n\nParser for CASTEP output files\n\n``castep_outputs`` parses the output files of `castep\n<https://www.castep.org/>`__ into a standard form and is able to subsequently\ndump the processed data into a standard format.\n\nInstall\n-------\n\nTo install ``castep_outputs`` simply run:\n\n::\n\n   pip install castep_outputs\n\nTo check it is installed run:\n\n::\n\n   python -m castep_outputs -h\n\nDependencies\n------------\n\n``castep_outputs`` is designed to have no external dependencies beyond the\nstandard library, however, it is possible to use either `PyYAML\n<https://pypi.org/project/PyYAML/>`__ or `ruamel.yaml\n<https://pypi.org/project/ruamel.yaml/>`__ to dump in the YAML format.\n\nCommand-line\n------------\n\nWhen run as a commandline tool, it attempts to find all files for the\ngiven seedname, filtered by ``inc`` args (default: all). Explicit\nfiles can be passed using longname arguments. castep_outputs can parse\nmost human-readable castep outputs including: ``.castep``, ``.cell``,\n``.param``, ``.geom``, ``.md``, ``.bands``, ``.hug``, ``.phonon``,\n``.phonon_dos``, ``.efield``, ``.xrd_sf``, ``.elf_fmt``,\n``.chdiff_fmt``, ``.pot_fmt``, ``.den_fmt``, ``.elastic``, ``.ts``,\n``.magres``, ``.tddft``, ``.err``.\n\nto run in basic mode:\n\n::\n\n   python -m castep_outputs seedname\n\nWhich will attempt to detect all found files and dump a ``.json`` to\nstdout, ready for piping.\n\n::\n\n   python -m castep_outputs --inc-castep --inc-param seedname\n\nWill parse only the ``seedname.castep`` and ``seedname.param`` files if\nfound.\n\n::\n\n   python -m castep_outputs seedname.castep\n\nWill parse the single named file and again dump a ``.json`` to stdout.\n\n::\n\n   python -m castep_outputs --castep seedname.param\n\nWill attempt to parse the file ``seedname.param`` as though it were a\n``.castep`` file. While not ordinarily useful it can help with manually renamed\nfiles.\n\n::\n\n   python -m castep_outputs -o my_file.yaml -f yaml seedname.castep\n\nWill parse ``seedname.castep``, dump it to ``my_file.yaml`` in ``yaml`` format\nusing the ``PyYAML`` engine if available and the ``RUAMEL`` engine if not.\n\nAs a module\n-----------\n\n``import``\\ ing ``castep_outputs`` exposes all of the parsers at the\ntop-level.\n\nThe simplest method to use ``castep_outputs`` in a tool is to use the\n``parse_single`` method which attempts to determine the parser from the file\nextension.\n\n::\n\n   from castep_outputs import parse_single\n\n   my_dict = parse_single('my_file.castep')\n\nIf you need a specific parser rather than determining it by extension\nit is possible to pass them as the second argument, or call them\ndirectly.\n\n::\n\n   import castep_outputs as co\n\n   my_dict = co.parse_single('my_file', co.parse_castep_file)\n\n   with open('my_file', 'r', encoding='utf-8') as inp:\n       my_dict = co.parse_castep_file(inp)\n\nIt is recommended that you use ``parse_single`` as it uses special file-handling\nto give better diagnostics if it fails. It is possible to enable more detailed\nlogging via the `logging\n<https://docs.python.org/3/library/logging.html#logging.basicConfig>`_ module:\n\n::\n\n   import logging\n   from castep_outputs import parse_single\n\n   my_dict = parse_single('my_file', loglevel=logging.INFO)\n\nThe available parsing functions are:\n\n-  ``parse_bands_file``\n-  ``parse_castep_file``\n-  ``parse_cell_file``\n-  ``parse_cell_param_file``\n-  ``parse_chdiff_fmt_file``\n-  ``parse_den_fmt_file``\n-  ``parse_efield_file``\n-  ``parse_elastic_file``\n-  ``parse_elf_fmt_file``\n-  ``parse_err_file``\n-  ``parse_geom_file``\n-  ``parse_hug_file``\n-  ``parse_magres_file``\n-  ``parse_md_file``\n-  ``parse_md_geom_file``\n-  ``parse_param_file``\n-  ``parse_phonon_file``\n-  ``parse_phonon_dos_file``\n-  ``parse_pot_fmt_file``\n-  ``parse_tddft_file``\n-  ``parse_tddft_file``\n-  ``parse_ts_file``\n-  ``parse_xrd_sf_file``\n\nWhich return processed ``list``\\ s of ``dict``\\ s of data ready for use\nin other applications.\n\nSee `Documentation <https://oerc0122.github.io/castep_outputs/intro.html>`_ for full layout.\n\nFull usage\n----------\n\n::\n\n   usage: castep_outputs [-h] [-V] [-L {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [-o OUTPUT]\n                         [-f {json,ruamel,yaml,pprint,print}] [-t] [-A] [--inc-castep]\n                         [--inc-cell] [--inc-param] [--inc-geom] [--inc-md]\n                         [--inc-bands] [--inc-hug] [--inc-phonon_dos] [--inc-efield]\n                         [--inc-xrd_sf] [--inc-elf_fmt] [--inc-chdiff_fmt]\n                         [--inc-pot_fmt] [--inc-den_fmt] [--inc-elastic] [--inc-ts]\n                         [--inc-magres] [--inc-tddft] [--inc-err] [--inc-phonon]\n                         [--castep [CASTEP ...]] [--cell [CELL ...]]\n                         [--param [PARAM ...]] [--geom [GEOM ...]] [--md [MD ...]]\n                         [--bands [BANDS ...]] [--hug [HUG ...]]\n                         [--phonon_dos [PHONON_DOS ...]] [--efield [EFIELD ...]]\n                         [--xrd_sf [XRD_SF ...]] [--elf_fmt [ELF_FMT ...]]\n                         [--chdiff_fmt [CHDIFF_FMT ...]] [--pot_fmt [POT_FMT ...]]\n                         [--den_fmt [DEN_FMT ...]] [--elastic [ELASTIC ...]]\n                         [--ts [TS ...]] [--magres [MAGRES ...]] [--tddft [TDDFT ...]]\n                         [--err [ERR ...]] [--phonon [PHONON ...]]\n                         ...\n\n   Attempts to find all files for seedname, filtered by `inc` args (default: all).\n   Explicit files can be passed using longname arguments. castep_outputs can parse most\n   human-readable castep outputs including: .castep, .cell, .param, .geom, .md, .bands,\n   .hug, .phonon_dos, .efield, .xrd_sf, .elf_fmt, .chdiff_fmt, .pot_fmt, .den_fmt,\n   .elastic, .ts, .magres, .tddft, .err, .phonon\n\n   positional arguments:\n     seedname              Seed name for data\n\n   options:\n     -h, --help            show this help message and exit\n     -V, --version         show program's version number and exit\n     -L {DEBUG,INFO,WARNING,ERROR,CRITICAL}, --log {DEBUG,INFO,WARNING,ERROR,CRITICAL}\n                           Verbose output\n     -o OUTPUT, --output OUTPUT\n                           File to write output, default: screen\n     -f {json,ruamel,yaml,pprint,print}, --out-format {json,ruamel,yaml,pprint,print}\n                           Output format\n     -t, --testing         Set testing mode to produce flat outputs\n     -A, --inc-all         Extract all available information\n     --inc-castep          Extract .castep information\n     --inc-cell            Extract .cell information\n     --inc-param           Extract .param information\n     --inc-geom            Extract .geom information\n     --inc-md              Extract .md information\n     --inc-bands           Extract .bands information\n     --inc-hug             Extract .hug information\n     --inc-phonon_dos      Extract .phonon_dos information\n     --inc-efield          Extract .efield information\n     --inc-xrd_sf          Extract .xrd_sf information\n     --inc-elf_fmt         Extract .elf_fmt information\n     --inc-chdiff_fmt      Extract .chdiff_fmt information\n     --inc-pot_fmt         Extract .pot_fmt information\n     --inc-den_fmt         Extract .den_fmt information\n     --inc-elastic         Extract .elastic information\n     --inc-ts              Extract .ts information\n     --inc-magres          Extract .magres information\n     --inc-tddft           Extract .tddft information\n     --inc-err             Extract .err information\n     --inc-phonon          Extract .phonon information\n     --castep [CASTEP ...]\n                           Extract from CASTEP as .castep type\n     --cell [CELL ...]     Extract from CELL as .cell type\n     --param [PARAM ...]   Extract from PARAM as .param type\n     --geom [GEOM ...]     Extract from GEOM as .geom type\n     --md [MD ...]         Extract from MD as .md type\n     --bands [BANDS ...]   Extract from BANDS as .bands type\n     --hug [HUG ...]       Extract from HUG as .hug type\n     --phonon_dos [PHONON_DOS ...]\n                           Extract from PHONON_DOS as .phonon_dos type\n     --efield [EFIELD ...]\n                           Extract from EFIELD as .efield type\n     --xrd_sf [XRD_SF ...]\n                           Extract from XRD_SF as .xrd_sf type\n     --elf_fmt [ELF_FMT ...]\n                           Extract from ELF_FMT as .elf_fmt type\n     --chdiff_fmt [CHDIFF_FMT ...]\n                           Extract from CHDIFF_FMT as .chdiff_fmt type\n     --pot_fmt [POT_FMT ...]\n                           Extract from POT_FMT as .pot_fmt type\n     --den_fmt [DEN_FMT ...]\n                           Extract from DEN_FMT as .den_fmt type\n     --elastic [ELASTIC ...]\n                           Extract from ELASTIC as .elastic type\n     --ts [TS ...]         Extract from TS as .ts type\n     --magres [MAGRES ...]\n                           Extract from MAGRES as .magres type\n     --tddft [TDDFT ...]   Extract from TDDFT as .tddft type\n     --err [ERR ...]       Extract from ERR as .err type\n     --phonon [PHONON ...]\n                           Extract from PHONON as .phonon type\n\nCurrent Parsers:\n\n-  ``.bands``\n-  ``.castep``\n-  ``.cell``\n-  ``.chdiff_fmt``\n-  ``.den_fmt``\n-  ``.efield``\n-  ``.elastic``\n-  ``.elf_fmt``\n-  ``.err``\n-  ``.geom``\n-  ``.hug``\n-  ``.magres``\n-  ``.md``\n-  ``.param``\n-  ``.phonon``\n-  ``.phonon_dos``\n-  ``.pot_fmt``\n-  ``.tddft``\n-  ``.ts``\n-  ``.xrd_sf``\n\nCurrent dumpers:\n\n-  ``json``\n-  ``ruamel.yaml``\n-  ``pyyaml``\n-  ``print``\n-  ``pprint``\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "A package for extracting information from castep outputs",
    "version": "0.1.8",
    "project_urls": {
        "Bug Tracker": "https://github.com/oerc0122/castep_outputs/issues",
        "Documentation": "https://oerc0122.github.io/castep_outputs/",
        "Homepage": "https://github.com/oerc0122/castep_outputs",
        "Repository": "https://github.com/oerc0122/castep_outputs.git"
    },
    "split_keywords": [
        "castep",
        " dft",
        " parser"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9365099230c4da3b0761912215ec25494bffcb103d3ab8eae8d89e2e5e2618bd",
                "md5": "c41ee2a67b76c20307e0d2c9f0a42061",
                "sha256": "e652dce84246d34141fd5a58d0ad52ba368fde5bc8f918666dd2b28ec72a43ba"
            },
            "downloads": -1,
            "filename": "castep_outputs-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c41ee2a67b76c20307e0d2c9f0a42061",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 100543,
            "upload_time": "2025-01-10T13:52:48",
            "upload_time_iso_8601": "2025-01-10T13:52:48.067361Z",
            "url": "https://files.pythonhosted.org/packages/93/65/099230c4da3b0761912215ec25494bffcb103d3ab8eae8d89e2e5e2618bd/castep_outputs-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c8009d6144cfae6b66bae89013af96bc53256d44827acb777a0950054fe93fb9",
                "md5": "245c06ab0bac205741314e88fcfc75f8",
                "sha256": "f502a887edb896b3d16d27f9c42b003ee8ca74e57a625860e4655b9fa293024d"
            },
            "downloads": -1,
            "filename": "castep_outputs-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "245c06ab0bac205741314e88fcfc75f8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 89997,
            "upload_time": "2025-01-10T13:52:49",
            "upload_time_iso_8601": "2025-01-10T13:52:49.752278Z",
            "url": "https://files.pythonhosted.org/packages/c8/00/9d6144cfae6b66bae89013af96bc53256d44827acb777a0950054fe93fb9/castep_outputs-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-10 13:52:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "oerc0122",
    "github_project": "castep_outputs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "castep-outputs"
}
        
Elapsed time: 2.96554s