qctools


Nameqctools JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/mfsjmenger/qctools
SummaryPython tools for quantum chemists
upload_time2024-11-21 16:42:33
maintainerNone
docs_urlNone
authorMaximilian F.S.J. Menger
requires_python>=3.6
licenseApache License v2.0
keywords qctools
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            =======
qctools
=======

Python tools for quantum chemists


Features
--------

Define Event Handlers for straightforward parsing of Quantum Chemistry Output

Example:

Read natoms from Gaussian Output file:

1. Step: Define the Event
~~~~~~~~~~~~~~~~~~~~~~~~~

The number of atoms are written typically in the following way
in the Gaussian output file:

.Gaussian Log File 

::

 ...
 NAtoms=    3 NActive=    3 NUniq=    2 SFac= 2.25D+00 NAtFMM=   50 NAOKFM=F Big=F
 One-electron integrals computed using PRISM.
 ...


the event should do the following:

1. It should loop over all lines of the file, till it findes the 
   Keyword `NAtoms=`
2. It should return that line and extract the 2. element of that 
   line as a string

The corresponding event looks like:

>>> NAtoms = Event('NAtoms',
...                'grep', {'keyword': 'NAtoms=',
...                         'ilen': 1,
...                         'ishift': 0},
...                func='split',
...                func_kwargs={'idx': 1, 'typ': int}
...)

The first entry is the name of the event, and can be any name.
The second entry is the type of the event, in this case just grep.
The third entry gives the parameter to the corresponding event function:
[we want to search for 'NAtoms=' and return a single line (ilen=1) 
not shifted (ishift=0) from the keyword.]

Afterwards the line is given to a postprocessing function ('split') which
splits the line by spaces and returns the element[1] of the line as an integer.
Remember, this is Python/C notation to element[1] is the second element in the list.


For the Forces the event should look the following:

::

   -------------------------------------------------------------------
   Center     Atomic                   Forces (Hartrees/Bohr)
   Number     Number              X              Y              Z
   -------------------------------------------------------------------
        1        8           0.000000000    0.000000000    0.005485119
        2        1           0.000000000    0.017353174   -0.002742559
        3        1           0.000000000   -0.017353174   -0.002742559
   ------------------------------------------------------------------


>>> forces = Event('forces',
...                'xgrep', {'keyword': 'Forces (Hartrees/Bohr)',
...                          'ilen': 'NAtoms',
...                          'ishift': 3},
...                func='split',
...                func_kwargs={'idx': [2, 3, 4], 'typ': [float, float, float]},
...                settings={'multi': False},
...)

2. Step: Add the new event to an existing Event Handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>>> GaussianReader.add_event("NAtoms", NAtoms)
>>> GaussianReader.add_event("forces", forces)

3. Step: Use the Event Handler to parse an file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>>> gauout = GaussianReader("h2o.log", ["NAtoms", "forces"])
>>> gauout["NAtoms"] 
3
>>> gauout["forces"]
[[0.0,0.0,0.005485119],[0.0,0.017353174,-0.002742559],[0.0,-0.017353174,-0.002742559]]

=======
Credits
=======

Development Lead
----------------

* Maximilian Menger

Contributors
------------

Why not be the first?

Thanks to:
----------

* Boris Maryasin
* Gustavo Cardenas


Credits
-------

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage


=======
History
=======

0.1.0 (2019-04-12)
------------------

* First release on PyPI.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mfsjmenger/qctools",
    "name": "qctools",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "qctools",
    "author": "Maximilian F.S.J. Menger",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/d0/6c/a9cddc86e32d34d23f1aba1c6ba6390c03e61f473b4f85bafe03b0863312/qctools-0.4.0.tar.gz",
    "platform": null,
    "description": "=======\nqctools\n=======\n\nPython tools for quantum chemists\n\n\nFeatures\n--------\n\nDefine Event Handlers for straightforward parsing of Quantum Chemistry Output\n\nExample:\n\nRead natoms from Gaussian Output file:\n\n1. Step: Define the Event\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe number of atoms are written typically in the following way\nin the Gaussian output file:\n\n.Gaussian Log File \n\n::\n\n ...\n NAtoms=    3 NActive=    3 NUniq=    2 SFac= 2.25D+00 NAtFMM=   50 NAOKFM=F Big=F\n One-electron integrals computed using PRISM.\n ...\n\n\nthe event should do the following:\n\n1. It should loop over all lines of the file, till it findes the \n   Keyword `NAtoms=`\n2. It should return that line and extract the 2. element of that \n   line as a string\n\nThe corresponding event looks like:\n\n>>> NAtoms = Event('NAtoms',\n...                'grep', {'keyword': 'NAtoms=',\n...                         'ilen': 1,\n...                         'ishift': 0},\n...                func='split',\n...                func_kwargs={'idx': 1, 'typ': int}\n...)\n\nThe first entry is the name of the event, and can be any name.\nThe second entry is the type of the event, in this case just grep.\nThe third entry gives the parameter to the corresponding event function:\n[we want to search for 'NAtoms=' and return a single line (ilen=1) \nnot shifted (ishift=0) from the keyword.]\n\nAfterwards the line is given to a postprocessing function ('split') which\nsplits the line by spaces and returns the element[1] of the line as an integer.\nRemember, this is Python/C notation to element[1] is the second element in the list.\n\n\nFor the Forces the event should look the following:\n\n::\n\n   -------------------------------------------------------------------\n   Center     Atomic                   Forces (Hartrees/Bohr)\n   Number     Number              X              Y              Z\n   -------------------------------------------------------------------\n        1        8           0.000000000    0.000000000    0.005485119\n        2        1           0.000000000    0.017353174   -0.002742559\n        3        1           0.000000000   -0.017353174   -0.002742559\n   ------------------------------------------------------------------\n\n\n>>> forces = Event('forces',\n...                'xgrep', {'keyword': 'Forces (Hartrees/Bohr)',\n...                          'ilen': 'NAtoms',\n...                          'ishift': 3},\n...                func='split',\n...                func_kwargs={'idx': [2, 3, 4], 'typ': [float, float, float]},\n...                settings={'multi': False},\n...)\n\n2. Step: Add the new event to an existing Event Handler\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n>>> GaussianReader.add_event(\"NAtoms\", NAtoms)\n>>> GaussianReader.add_event(\"forces\", forces)\n\n3. Step: Use the Event Handler to parse an file\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n>>> gauout = GaussianReader(\"h2o.log\", [\"NAtoms\", \"forces\"])\n>>> gauout[\"NAtoms\"] \n3\n>>> gauout[\"forces\"]\n[[0.0,0.0,0.005485119],[0.0,0.017353174,-0.002742559],[0.0,-0.017353174,-0.002742559]]\n\n=======\nCredits\n=======\n\nDevelopment Lead\n----------------\n\n* Maximilian Menger\n\nContributors\n------------\n\nWhy not be the first?\n\nThanks to:\n----------\n\n* Boris Maryasin\n* Gustavo Cardenas\n\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n\n\n=======\nHistory\n=======\n\n0.1.0 (2019-04-12)\n------------------\n\n* First release on PyPI.\n\n\n",
    "bugtrack_url": null,
    "license": "Apache License v2.0",
    "summary": "Python tools for quantum chemists",
    "version": "0.4.0",
    "project_urls": {
        "Homepage": "https://github.com/mfsjmenger/qctools"
    },
    "split_keywords": [
        "qctools"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d06ca9cddc86e32d34d23f1aba1c6ba6390c03e61f473b4f85bafe03b0863312",
                "md5": "38e04a5b8a4f65d61592c98a9e57fd06",
                "sha256": "84b71a9e6c3efadcc982241340e5177333fdb23cf7a57d56e67ee7b56979c00e"
            },
            "downloads": -1,
            "filename": "qctools-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "38e04a5b8a4f65d61592c98a9e57fd06",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 48085,
            "upload_time": "2024-11-21T16:42:33",
            "upload_time_iso_8601": "2024-11-21T16:42:33.254378Z",
            "url": "https://files.pythonhosted.org/packages/d0/6c/a9cddc86e32d34d23f1aba1c6ba6390c03e61f473b4f85bafe03b0863312/qctools-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-21 16:42:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mfsjmenger",
    "github_project": "qctools",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "qctools"
}
        
Elapsed time: 1.68386s