Skip to content

Commit

Permalink
state
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmshn committed Mar 21, 2023
1 parent b82e926 commit c56b9aa
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 54 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,6 @@ dmypy.json
_build/

docs_old/

notebooks/files/MNIST/raw/
notebooks/lightning_logs/
72 changes: 23 additions & 49 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
default_language_version:
python: python3
exclude: '^src/atomate2/vasp/schemas/calc_types/'
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.250
hooks:
- id: ruff
args: [--fix]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-yaml
- id: fix-encoding-pragma
args:
- --remove
args: [--remove]
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/myint/autoflake
rev: v1.7.7
hooks:
- id: autoflake
args:
- --in-place
- --remove-all-unused-imports
- --remove-unused-variables
- --ignore-init-module-imports
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
Expand All @@ -27,63 +25,39 @@ repos:
- id: blacken-docs
additional_dependencies: [black]
exclude: README.md
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
entry: pflake8
files: ^src/
additional_dependencies:
- pyproject-flake8==v0.0.1a4
- flake8-bugbear==22.4.25
- flake8-typing-imports==1.10.1
- pyproject-flake8==6.0.0
- flake8-bugbear==22.12.6
- flake8-typing-imports==1.14.0
- flake8-docstrings==1.6.0
- flake8-rst-docstrings==0.2.3
- flake8-rst-docstrings==0.3.0
- flake8-rst==0.8.0
- repo: https://github.com/pycqa/pydocstyle
rev: 6.1.1
hooks:
- id: pydocstyle
additional_dependencies: ["toml"]
files: ^src/
- repo: https://github.com/myint/docformatter
rev: v1.5.0
hooks:
- id: docformatter
args: [--in-place, --blank, --wrap-summaries=120, --wrap-descriptions=120]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
rev: v1.10.0
hooks:
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.990
rev: v0.991
hooks:
- id: mypy
files: ^src/
additional_dependencies:
- tokenize-rt==4.1.0
- types-pkg_resources==0.1.2
- types-paramiko
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
hooks:
- id: codespell
name: codespell
description: Checks for common misspellings in text files.
entry: codespell
language: python
types: [text]
args:
- --ignore-words-list='titel,statics,ba,nd,mater,te'
- --skip="notebooks/*"
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
hooks:
- id: nbstripout
args: []
stages: [commit, commit-msg]
args: [--ignore-words-list, 'titel,statics,ba,nd,te']
types_or: [python, rst, markdown]
2 changes: 1 addition & 1 deletion paper/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bibliography: paper.bib
# Summary

The electronic charge density is a central quantity in the field of computational material science.
Since most materials simulations codes, such as the Vienna Ab initio Simulation Package (VASP)[@Kresse1993Jan] and Quantum ESPRESSO[@Giannozzi2009Sep], assume periodic boundary conditions, the calculations usually stores the charge densities on a three-dimensional grid that is regular in the directions of the lattice parameters.
Since most materials simulations codes, such as the Vienna Ab initio Simulation Package (VASP)[@Kresse1993Jan] and Quantum ESPRESSO[@Giannozzi2009Sep], assume periodic boundary conditions, the calculations usually stores the charge densities on a three-dimensional grid that is regular in the directions of the lattice vectors.
This makes the calculations, especially performing FFT's on these charge densities straightforward.
However, these non-orthogonal, and more importantly material-specific grids, means that we cannot directly compare the charge densities from different simulations.
Despite how data-rich the charge densities are, using periodic charge densities for machine learning is difficult because:
Expand Down
36 changes: 36 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,42 @@ strict = [
homepage = "https://materialsproject.github.io/pyrho/"
repository = "https://materialsproject.github.io/pyrho"

[tool.ruff]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["E", "F"]
ignore = []

# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["E", "F"]
unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
# Same as Black.
line-length = 120


[tool.versioningit.vcs]
default-tag = "0.0.1"
method = "git"
Expand Down
1 change: 0 additions & 1 deletion src/pyrho/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
__author__ = """Jimmy Shen"""
__email__ = "[email protected]"

import os

from pkg_resources import DistributionNotFound, get_distribution

Expand Down
6 changes: 4 additions & 2 deletions src/pyrho/charge_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,10 @@ def get_transformed(
if not np.allclose(np.round(sc_mat), sc_mat):
warnings.warn(
"The `sc_mat` is not integer valued.\n"
"Non-integer valued transformations are valid but will not product periodic structures, thus we cannot define a new Structure object.\n"
"We will round the sc_mat to integer values for now but can implement functionality that returns a Molecule object in the future.",
"Non-integer valued transformations are valid but will not product periodic structures, "
"thus we cannot define a new Structure object.\n"
"We will round the sc_mat to integer values for now but can implement functionality "
"that returns a Molecule object in the future.",
)
sc_mat = np.round(sc_mat).astype(int)
new_structure = self.structure.copy()
Expand Down
2 changes: 1 addition & 1 deletion src/pyrho/vis/scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from matplotlib import pyplot as plt
from matplotlib.axes import Axes

"""Visualizaiton functions do the scatter plots in plotly since it seems to be more efficient."""
"""Visualization functions do the scatter plots in plotly since it seems to be more efficient."""


def get_scatter_plot(
Expand Down

0 comments on commit c56b9aa

Please sign in to comment.