Skip to content

Commit

Permalink
Merge pull request #4 from CitrineInformatics/chg-pkg-name
Browse files Browse the repository at this point in the history
Refactor package name: "dftinpgen" -> "dftinputgen"
  • Loading branch information
hegdevinayi authored Dec 8, 2020
2 parents ee5fb8b + 1105e50 commit e041123
Show file tree
Hide file tree
Showing 34 changed files with 81 additions and 77 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pytest --cov=src/ --cov-report term-missing -svv

## Coding Style

`dftinpgen` follows [PEP8](https://www.python.org/dev/peps/pep-0008/), with
`dftinputgen` follows [PEP8](https://www.python.org/dev/peps/pep-0008/), with
several docstring rules relaxed.
See `tox.ini` for a list of the ignored rules.
Docstrings must follow the
Expand All @@ -62,7 +62,7 @@ A pre-commit hook is available to auto-format code with

## PR Submission

`dftinpgen` follows the
`dftinputgen` follows the
[gitflow workflow](https://www.atlassian.com/git/tutorials/comparing-workflows#gitflow-workflow),
so all PRs must be submitted to the `develop` branch.
Versions must follow [semantic versioning](https://semver.org/).
Expand All @@ -75,7 +75,7 @@ A passing build requires the following:
* Every line of code is executed by a test (100% coverage)

It is recommended to complement any new large module(s) with
example(s) in the `dftinpgen.demo` module.
example(s) in the `dftinputgen.demo` module.


## Documentation
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# dftinpgen
# dftinputgen

[![Build Status](https://travis-ci.com/CitrineInformatics/dft-input-gen.svg?token=qbMA4N9P9kHgFLrLQ51g&branch=master)](https://travis-ci.com/CitrineInformatics/dft-input-gen)

Expand All @@ -13,10 +13,10 @@ Python >=2.7 or >=3.8, with dependencies listed in

## Installation

`dftinpgen` can be installed with `pip`:
`dftinputgen` can be installed with `pip`:

```
$ pip install dftinpgen
$ pip install dftinputgen
```


Expand All @@ -28,8 +28,8 @@ crystal structure in `my_crystal_structure.cif`, do:
**Option 1. Using the Python API**

```python
from dftinpgen.utils import read_crystal_structure
from dftinpgen.qe.pwx import PwxInputGenerator
from dftinputgen.utils import read_crystal_structure
from dftinputgen.qe.pwx import PwxInputGenerator

# read the input crystal into an `ase.Atoms` object
crystal_structure = read_crystal_structure("/path/to/my_crystal_structure.cif")
Expand All @@ -42,10 +42,10 @@ pwig = PwxInputGenerator(
pwig.write_input_files()
```

**Option 2. Using the `dftinpgen` command line tool**
**Option 2. Using the `dftinputgen` command line tool**

```bash
$ dftinpgen pw.x -i /path/to/my_crystal_structure.cif -pre scf
$ dftinputgen pw.x -i /path/to/my_crystal_structure.cif -pre scf
```

Further details of the API and examples can be found in the package
Expand Down
14 changes: 7 additions & 7 deletions docs/src/developer_notes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Developer notes
Code Organization
+++++++++++++++++

``dftinpgen`` has the following overall structure::
``dftinputgen`` has the following overall structure::

base.py
utils.py
Expand All @@ -28,21 +28,21 @@ Code Organization
...


- ``dftinpgen.base``: base interfaces to build DFT code-specific classes from
- ``dftinputgen.base``: base interfaces to build DFT code-specific classes from
(more :ref:`here <sec-base-input-generator>`)
- ``dftinpgen.qe``: derived classes that can generate input files for various
- ``dftinputgen.qe``: derived classes that can generate input files for various
DFT-based and postprocessing codes in the Quantum Espresso suite (more
:ref:`here <ssec-qe>`)
- ``dftinpgen.vasp``: [under development] derived classes that can generate
- ``dftinputgen.vasp``: [under development] derived classes that can generate
input files for the VASP package.
- ``dftinpgen.utils``: general-purpose helper functions, e.g. chemical formula
- ``dftinputgen.utils``: general-purpose helper functions, e.g. chemical formula
parser/formatter (more :ref:`here <sec-helper-utilities>`)
- ``dftinpgen.data``: non-user-specified data constants required to generate
- ``dftinputgen.data``: non-user-specified data constants required to generate
input files, e.g. standard atomic weights of all elements (more :ref:`here
<sec-data-constants>`)

Support for new DFT packages must be added as a separate module, e.g.
``dftinpgen/new_dft_package``.
``dftinputgen/new_dft_package``.
Corresponding tests must be placed in the ``tests/new_dft_package`` folder.


Expand Down
6 changes: 3 additions & 3 deletions docs/src/index.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dftinpgen
dftinputgen
+++++++++

Unopinionated input file generator for DFT codes.

``dftinpgen`` implements high-level interfaces that help generate input files
``dftinputgen`` implements high-level interfaces that help generate input files
from user-specified key-value pairs.
By design, there is no validation of input, only formatting of the key-values
pairs for the DFT code of interest.
Expand All @@ -16,7 +16,7 @@ Installation instructions can be found in the README_.
Examples of using the tool can be found in the `demo module`_.

.. _README: https://github.com/CitrineInformatics/dft-input-gen
.. _demo module: https://github.com/CitrineInformatics/dft-input-gen/tree/master/src/dftinpgen/demo
.. _demo module: https://github.com/CitrineInformatics/dft-input-gen/tree/master/src/dftinputgen/demo


.. toctree::
Expand Down
8 changes: 4 additions & 4 deletions docs/src/module_reference/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
Base input generators
+++++++++++++++++++++

``dftinpgen`` implements some high-level interfaces to build DFT
``dftinputgen`` implements some high-level interfaces to build DFT
code-specific input generator classes from.


Base DFT input generator
========================

The abstract :class:`DftInputGenerator <dftinpgen.base.DftInputGenerator>`
The abstract :class:`DftInputGenerator <dftinputgen.base.DftInputGenerator>`
class provides a common interface to model code-specific input generators.
The input crystal structure must be an `ase.Atoms`_ object obtained via,
e.g., using the `ase.io.read` module or other means.
Settings for the DFT calculation are allowed to be specified by the user
using one or more of the following inputs:

1. ``calculation_presets``: a set of default parameters to use for common
calculation types (packaged with ``dftinpgen``; see
calculation types (packaged with ``dftinputgen``; see
:ref:`sssec-qe-input-settings` for more information)
2. ``custom_sett_file``: a JSON file with parameter names and values
3. ``custom_sett_dict``: a dictionary of parameter names and values
Expand Down Expand Up @@ -62,6 +62,6 @@ the input crystal structure.
Interfaces
==========

.. automodule:: dftinpgen.base
.. automodule:: dftinputgen.base
:members:
:undoc-members:
2 changes: 1 addition & 1 deletion docs/src/module_reference/data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Standard data constants required to generate input files, e.g. standard
atomic weights of all elements for ``pw.x``, that are usually not specified
by the user.

.. automodule:: dftinpgen.data
.. automodule:: dftinputgen.data
:members:
:undoc-members:
4 changes: 2 additions & 2 deletions docs/src/module_reference/qe/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Input generators for Quantum Espresso
+++++++++++++++++++++++++++++++++++++

``dftinpgen`` provides input generator classes for codes in the `Quantum
``dftinputgen`` provides input generator classes for codes in the `Quantum
Espresso`_ suite.
Currently supported codes are:

Expand All @@ -15,7 +15,7 @@ Currently supported codes are:
.. _`bands.x`: https://www.quantum-espresso.org/Doc/INPUT_BANDS.html


.. automodule:: dftinpgen.qe
.. automodule:: dftinputgen.qe
:members:
:undoc-members:

Expand Down
6 changes: 3 additions & 3 deletions docs/src/module_reference/qe/pwx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Input for PWscf (pw.x)
++++++++++++++++++++++

The :class:`PwxInputGenerator <dftinpgen.qe.pwx.PwxInputGenerator>` class
(derived from :class:`DftInputGenerator <dftinpgen.base.DftInputGenerator>`)
The :class:`PwxInputGenerator <dftinputgen.qe.pwx.PwxInputGenerator>` class
(derived from :class:`DftInputGenerator <dftinputgen.base.DftInputGenerator>`)
implements functionality to generate input files for the `PWscf (pw.x)`_
package.

Expand Down Expand Up @@ -48,7 +48,7 @@ currently not implemented.
Interfaces
==========

.. automodule:: dftinpgen.qe.pwx
.. automodule:: dftinputgen.qe.pwx
:members:
:inherited-members:
:undoc-members:
8 changes: 4 additions & 4 deletions docs/src/module_reference/qe/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ Note that these presets are only reasonable defaults and are not meant to be
prescriptive.

.. _`Input File Description`: https://www.quantum-espresso.org/Doc/INPUT_PW.html
.. _`tags_and_groups.json`: https://github.com/CitrineInformatics/dft-input-gen/blob/master/src/dftinpgen/qe/settings/tags_and_groups.json
.. _`calculation_presets`: https://github.com/CitrineInformatics/dft-input-gen/tree/master/src/dftinpgen/qe/settings/calculation_presets
.. _`tags_and_groups.json`: https://github.com/CitrineInformatics/dft-input-gen/blob/master/src/dftinputgen/qe/settings/tags_and_groups.json
.. _`calculation_presets`: https://github.com/CitrineInformatics/dft-input-gen/tree/master/src/dftinputgen/qe/settings/calculation_presets

.. automodule:: dftinpgen.qe.settings
.. automodule:: dftinputgen.qe.settings
:members:
:undoc-members:
:special-members:

.. automodule:: dftinpgen.qe.settings.calculation_presets
.. automodule:: dftinputgen.qe.settings.calculation_presets
:members:
:undoc-members:
:special-members:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/module_reference/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Helper utilities

This module implements some helper utilities used across DFT packages.

.. automodule:: dftinpgen.utils
.. automodule:: dftinputgen.utils
:members:
:undoc-members:
8 changes: 5 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@


with open(
os.path.join(os.path.dirname(__file__), "src", "dftinpgen", "VERSION.txt")
os.path.join(
os.path.dirname(__file__), "src", "dftinputgen", "VERSION.txt"
)
) as fr:
version = fr.read().strip()


setup(
name="dftinpgen",
name="dftinputgen",
version=version,
description="Unopinionated library to generate input files for DFT codes",
url="https://github.com/CitrineInformatics/dft-input-gen",
Expand All @@ -19,7 +21,7 @@
packages=find_packages(where="src"),
package_dir={"": "src"},
install_requires=["six", "numpy", "ase <= 3.17"],
entry_points={"console_scripts": ["dftinpgen = dftinpgen.cli:driver"]},
entry_points={"console_scripts": ["dftinputgen = dftinputgen.cli:driver"]},
classifiers=[
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.8",
Expand Down
1 change: 0 additions & 1 deletion src/dftinpgen/qe/__init__.py

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion src/dftinpgen/__init__.py → src/dftinputgen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


# single-sourcing the package version
version_file = pkg_resources.resource_filename("dftinpgen", "VERSION.txt")
version_file = pkg_resources.resource_filename("dftinputgen", "VERSION.txt")
with open(version_file, "r") as fr:
__version__ = fr.read().strip()

Expand Down
2 changes: 1 addition & 1 deletion src/dftinpgen/base.py → src/dftinputgen/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(
E.g., if `dft_package` = "vasp", `calculation_presets` = "scf",
the settings in
"dftinpgen/vasp/settings/calculation_presets/scf.json" are used.
"dftinputgen/vasp/settings/calculation_presets/scf.json" are used.
custom_sett_file: str, optional
Location of a JSON file with custom calculation settings as a
Expand Down
4 changes: 2 additions & 2 deletions src/dftinpgen/cli.py → src/dftinputgen/cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import argparse

from dftinpgen.demo.pwx import build_pwx_parser
from dftinpgen.demo.pwx import generate_pwx_input_files
from dftinputgen.demo.pwx import build_pwx_parser
from dftinputgen.demo.pwx import generate_pwx_input_files


def get_parser():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"""
saw_file = pkg_resources.resource_filename(
"dftinpgen.data", "standard_atomic_weights.json"
"dftinputgen.data", "standard_atomic_weights.json"
)
with open(saw_file) as fr:
STANDARD_ATOMIC_WEIGHTS = json.load(fr)
File renamed without changes.
4 changes: 2 additions & 2 deletions src/dftinpgen/demo/pwx.py → src/dftinputgen/demo/pwx.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import json
import argparse

from dftinpgen.utils import read_crystal_structure
from dftinpgen.qe.pwx import PwxInputGenerator
from dftinputgen.utils import read_crystal_structure
from dftinputgen.qe.pwx import PwxInputGenerator


def _get_default_parser():
Expand Down
1 change: 1 addition & 0 deletions src/dftinputgen/qe/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from dftinputgen.qe.pwx import PwxInputGenerator # noqa: F401
16 changes: 8 additions & 8 deletions src/dftinpgen/qe/pwx.py → src/dftinputgen/qe/pwx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import six
import itertools

from dftinpgen.data import STANDARD_ATOMIC_WEIGHTS
from dftinpgen.utils import get_elem_symbol
from dftinpgen.utils import get_kpoint_grid_from_spacing
from dftinpgen.qe.settings import QE_TAGS
from dftinpgen.qe.settings.calculation_presets import QE_PRESETS

from dftinpgen.base import DftInputGenerator
from dftinpgen.base import DftInputGeneratorError
from dftinputgen.data import STANDARD_ATOMIC_WEIGHTS
from dftinputgen.utils import get_elem_symbol
from dftinputgen.utils import get_kpoint_grid_from_spacing
from dftinputgen.qe.settings import QE_TAGS
from dftinputgen.qe.settings.calculation_presets import QE_PRESETS

from dftinputgen.base import DftInputGenerator
from dftinputgen.base import DftInputGeneratorError


def _qe_val_formatter(val):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


tags_file = pkg_resources.resource_filename(
"dftinpgen.qe.settings", "tags_and_groups.json"
"dftinputgen.qe.settings", "tags_and_groups.json"
)
with open(tags_file, "r") as fr:
QE_TAGS = json.load(fr)
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@


preset_listdir = pkg_resources.resource_listdir(
"dftinpgen.qe.settings", "calculation_presets"
"dftinputgen.qe.settings", "calculation_presets"
)
for filename in preset_listdir:
root, ext = os.path.splitext(filename)
if not ext == ".json":
continue
resource = pkg_resources.resource_filename(
"dftinpgen.qe.settings.calculation_presets", filename
"dftinputgen.qe.settings.calculation_presets", filename
)
with open(resource, "r") as fr:
QE_PRESETS[root] = json.load(fr)
6 changes: 3 additions & 3 deletions src/dftinpgen/utils.py → src/dftinputgen/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from ase import io as ase_io

from dftinpgen.data import STANDARD_ATOMIC_WEIGHTS
from dftinputgen.data import STANDARD_ATOMIC_WEIGHTS


class DftinpgenUtilsError(Exception):
class DftInputGeneratorUtilsError(Exception):
"""Base class for errors associated with the helper utilities."""

pass
Expand All @@ -26,7 +26,7 @@ def get_elem_symbol(species_label):
if symbol in STANDARD_ATOMIC_WEIGHTS:
return symbol
msg = "No valid element symbol found"
raise DftinpgenUtilsError(msg)
raise DftInputGeneratorUtilsError(msg)


def read_crystal_structure(crystal_structure, **kwargs):
Expand Down
Loading

0 comments on commit e041123

Please sign in to comment.