hsd


Namehsd JSON
Version 0.1 PyPI version JSON
download
home_pagehttps://github.com/dftbplus/hsd-python
SummaryTools for reading, writing and manipulating data stored in the human-friendly structured data (HSD) format
upload_time2021-11-11 09:41:24
maintainer
docs_urlNone
authorDFTB+ developers group
requires_python
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            **********************************************
HSD — Make your structured data human friendly
**********************************************

Utilities to read and write files in the Human-friendly Structured Data (HSD)
format.

The HSD-format is very similar to both JSON and YAML, but tries to minimize the
effort for **humans** to read and write it. It ommits special characters as much
as possible (in contrast to JSON) and is not indentation dependent (in contrast
to YAML). It was developed originally as the input format for the scientific
simulation tool (`DFTB+ <https://github.com/dftbplus/dftbplus>`_), but is
of general purpose. Data stored in HSD can be easily mapped to a subset of JSON
or XML and vica versa.

Detailed `documentation <https://hsd-python.readthedocs.io/>`_ can be found on
`Read the Docs <https://hsd-python.readthedocs.io/>`_.


Installation
============

The package can be installed via conda-forge::

  conda install --channel "conda-forge" hsd-python

Alternatively, the package can be downloaded and installed via pip into the
active Python interpreter (preferably using a virtual python environment) by ::

  pip install hsd

or into the user space issueing ::

  pip install --user hsd


Quick tutorial
==============

A typical, self-explaining input written in HSD looks like ::

  driver {
    conjugate_gradients {
      moved_atoms = 1 2 "7:19"
      max_steps = 100
    }
  }

  hamiltonian {
    dftb {
      scc = yes
      scc_tolerance = 1e-10
      mixer {
        broyden {}
      }
      filling {
        fermi {
          # This is comment which will be ignored
          # Note the attribute (unit) of the field below
          temperature [kelvin] = 100
        }
      }
      k_points_and_weights {
        supercell_folding {
          2   0   0
          0   2   0
          0   0   2
          0.5 0.5 0.5
        }
      }
    }
  }

The above input can be parsed into a Python dictionary with::

  import hsd
  hsdinput = hsd.load("test.hsd")

The dictionary ``hsdinput`` will then look as::

  {
      "driver": {
          "conjugate_gradients" {
              "moved_atoms": [1, 2, "7:19"],
              "max_steps": 100
          }
      },
      "hamiltonian": {
          "dftb": {
              "scc": True,
              "scc_tolerance": 1e-10,
              "mixer": {
                  "broyden": {}
              },
              "filling": {
                  "fermi": {
                      "temperature": 100,
                      "temperature.attrib": "kelvin"
                  }
              }
              "k_points_and_weights": {
                  "supercell_folding": [
                      [2, 0, 0],
                      [0, 2, 0],
                      [0, 0, 2],
                      [0.5, 0.5, 0.5]
                  ]
              }
          }
      }
  }

Being a simple Python dictionary, it can be easily queried and manipulated in
Python ::

  hsdinput["driver"]["conjugate_gradients"]["max_steps"] = 200

and then stored again in HSD format ::

    hsd.dump(hsdinput, "test2.hsd")


License
========

The hsd-python package is licensed under the `BSD 2-clause license <LICENSE>`_.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dftbplus/hsd-python",
    "name": "hsd",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "DFTB+ developers group",
    "author_email": "info@dftbplus.org",
    "download_url": "https://files.pythonhosted.org/packages/62/d2/56f61a461789f4e6ffc4a63d3420ebc9f93ab18c1c7fc0f7a9cee51ccd3d/hsd-0.1.tar.gz",
    "platform": "any",
    "description": "**********************************************\nHSD \u2014 Make your structured data human friendly\n**********************************************\n\nUtilities to read and write files in the Human-friendly Structured Data (HSD)\nformat.\n\nThe HSD-format is very similar to both JSON and YAML, but tries to minimize the\neffort for **humans** to read and write it. It ommits special characters as much\nas possible (in contrast to JSON) and is not indentation dependent (in contrast\nto YAML). It was developed originally as the input format for the scientific\nsimulation tool (`DFTB+ <https://github.com/dftbplus/dftbplus>`_), but is\nof general purpose. Data stored in HSD can be easily mapped to a subset of JSON\nor XML and vica versa.\n\nDetailed `documentation <https://hsd-python.readthedocs.io/>`_ can be found on\n`Read the Docs <https://hsd-python.readthedocs.io/>`_.\n\n\nInstallation\n============\n\nThe package can be installed via conda-forge::\n\n  conda install --channel \"conda-forge\" hsd-python\n\nAlternatively, the package can be downloaded and installed via pip into the\nactive Python interpreter (preferably using a virtual python environment) by ::\n\n  pip install hsd\n\nor into the user space issueing ::\n\n  pip install --user hsd\n\n\nQuick tutorial\n==============\n\nA typical, self-explaining input written in HSD looks like ::\n\n  driver {\n    conjugate_gradients {\n      moved_atoms = 1 2 \"7:19\"\n      max_steps = 100\n    }\n  }\n\n  hamiltonian {\n    dftb {\n      scc = yes\n      scc_tolerance = 1e-10\n      mixer {\n        broyden {}\n      }\n      filling {\n        fermi {\n          # This is comment which will be ignored\n          # Note the attribute (unit) of the field below\n          temperature [kelvin] = 100\n        }\n      }\n      k_points_and_weights {\n        supercell_folding {\n          2   0   0\n          0   2   0\n          0   0   2\n          0.5 0.5 0.5\n        }\n      }\n    }\n  }\n\nThe above input can be parsed into a Python dictionary with::\n\n  import hsd\n  hsdinput = hsd.load(\"test.hsd\")\n\nThe dictionary ``hsdinput`` will then look as::\n\n  {\n      \"driver\": {\n          \"conjugate_gradients\" {\n              \"moved_atoms\": [1, 2, \"7:19\"],\n              \"max_steps\": 100\n          }\n      },\n      \"hamiltonian\": {\n          \"dftb\": {\n              \"scc\": True,\n              \"scc_tolerance\": 1e-10,\n              \"mixer\": {\n                  \"broyden\": {}\n              },\n              \"filling\": {\n                  \"fermi\": {\n                      \"temperature\": 100,\n                      \"temperature.attrib\": \"kelvin\"\n                  }\n              }\n              \"k_points_and_weights\": {\n                  \"supercell_folding\": [\n                      [2, 0, 0],\n                      [0, 2, 0],\n                      [0, 0, 2],\n                      [0.5, 0.5, 0.5]\n                  ]\n              }\n          }\n      }\n  }\n\nBeing a simple Python dictionary, it can be easily queried and manipulated in\nPython ::\n\n  hsdinput[\"driver\"][\"conjugate_gradients\"][\"max_steps\"] = 200\n\nand then stored again in HSD format ::\n\n    hsd.dump(hsdinput, \"test2.hsd\")\n\n\nLicense\n========\n\nThe hsd-python package is licensed under the `BSD 2-clause license <LICENSE>`_.\n\n\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Tools for reading, writing and manipulating data stored in the human-friendly structured data (HSD) format",
    "version": "0.1",
    "project_urls": {
        "Homepage": "https://github.com/dftbplus/hsd-python"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4803e46d7b901cdc5ee561bae5bc244435f268ee2f379322379d0d2777fd5879",
                "md5": "0bf0f66299f37d93688fdf3bd8a6c983",
                "sha256": "1f67e5ea0348776a2355c8e8c003d5dd632a7cea7c3062fc45e423ddbc4297e8"
            },
            "downloads": -1,
            "filename": "hsd-0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0bf0f66299f37d93688fdf3bd8a6c983",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 15210,
            "upload_time": "2021-11-11T09:41:22",
            "upload_time_iso_8601": "2021-11-11T09:41:22.406206Z",
            "url": "https://files.pythonhosted.org/packages/48/03/e46d7b901cdc5ee561bae5bc244435f268ee2f379322379d0d2777fd5879/hsd-0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "62d256f61a461789f4e6ffc4a63d3420ebc9f93ab18c1c7fc0f7a9cee51ccd3d",
                "md5": "37b245f8d3dc87918b149e12d455b39a",
                "sha256": "95861b9ff8ddb7e0e10d4afe44630058178902b6690e8e376ce418415c82184e"
            },
            "downloads": -1,
            "filename": "hsd-0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "37b245f8d3dc87918b149e12d455b39a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 15922,
            "upload_time": "2021-11-11T09:41:24",
            "upload_time_iso_8601": "2021-11-11T09:41:24.046923Z",
            "url": "https://files.pythonhosted.org/packages/62/d2/56f61a461789f4e6ffc4a63d3420ebc9f93ab18c1c7fc0f7a9cee51ccd3d/hsd-0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-11-11 09:41:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dftbplus",
    "github_project": "hsd-python",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "hsd"
}
        
Elapsed time: 0.20943s