Skip to content

Commit

Permalink
adds black linting
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvi-ranawat committed Oct 23, 2023
1 parent e6ca774 commit 0426fe8
Show file tree
Hide file tree
Showing 21 changed files with 2,155 additions and 1,071 deletions.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ graphviz = "*"
sphinx = "*"
pytest = "*"
sphinx-rtd-theme = "*"
black = "*"

[requires]
python_version = "3.10"
924 changes: 924 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

45 changes: 24 additions & 21 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,59 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('../'))

sys.path.insert(0, os.path.abspath("../"))


# -- Project information -----------------------------------------------------

project = 'Runner'
author = 'Yashasvi S. Ranawat'
project = "Runner"
author = "Yashasvi S. Ranawat"

# The full version, including alpha/beta/rc tags
release = '0.1'
release = "0.1"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.napoleon',
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.githubpages',
'sphinx.ext.autosectionlabel']

modindex_common_prefix = ['runner.']
extensions = [
"sphinx.ext.napoleon",
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.ifconfig",
"sphinx.ext.githubpages",
"sphinx.ext.autosectionlabel",
]

modindex_common_prefix = ["runner."]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]

doctest_global_setup = """
import runner
Expand Down
5 changes: 3 additions & 2 deletions docs/examples/BFGS.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

from ase.optimize import BFGS


def main(atoms_list, fmax=0.05):
"""Does BFGS relaxations of atoms
Args:
atoms_list (list): list of atoms, as given by runner
Returns:
atoms object: relaxed atoms object"""
atoms = atoms_list[0]
opt = BFGS(atoms)
opt.run(fmax=fmax)

return atoms
19 changes: 10 additions & 9 deletions docs/examples/interaction_energy.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# interaction_energy.py


def main(atoms_list, d=1):
"""Combines atoms with a distance d
Args:
atoms_list (list): list of atoms, as given by runner
Returns:
atoms object: combined atoms with calculated energies"""

atoms0 = atoms_list[1]

atoms0.positions[:, 2] += d + 1

atoms0 += atoms_list[2]

# making sure new energies are used in the system with updated atoms
atoms0.get_potential_energy()

# adding key_value_pairs for column search in database
# these are updated to the old key_value_pairs already in database
atoms0.info['key_value_pairs'] = {'d': d}
atoms0.info["key_value_pairs"] = {"d": d}

return atoms0
11 changes: 6 additions & 5 deletions docs/examples/min_energy.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# min_energy.py


def main(atoms_list):
"""Returns atoms with the lowest energy
Args:
atoms_list (list): list of atoms, as given by runner
Returns:
atoms object: atoms with lowest calculated energies"""
import numpy as np

en_list = [atoms.get_potential_energy() for atoms in atoms_list[1:]]

indx = np.argmin(en_list)

return atoms_list[indx + 1]
4 changes: 2 additions & 2 deletions runner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
from runner.utils.runnerdata import RunnerData


__all__ = ['SlurmRunner', 'TerminalRunner', 'RunnerData', 'utils', 'Relay']
__version__ = '0.1'
__all__ = ["SlurmRunner", "TerminalRunner", "RunnerData", "utils", "Relay"]
__version__ = "0.1"
1 change: 1 addition & 0 deletions runner/__main__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from runner.cli import main

main()
Loading

0 comments on commit 0426fe8

Please sign in to comment.