Skip to content

Commit

Permalink
Merge pull request #454 from CederGroupHub/update/pre-commit-autoupdate
Browse files Browse the repository at this point in the history
auto-update pre-commit hooks
  • Loading branch information
lbluque authored Jan 30, 2024
2 parents ca9b936 + c0b9e6c commit 68ba603
Show file tree
Hide file tree
Showing 26 changed files with 32 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
args: ['--maxkb=600']

- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.0
hooks:
- id: black

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""smol -- Statistical Mechanics On Lattices"""

import os
import platform
import shutil
Expand Down
1 change: 1 addition & 0 deletions smol/capp/generate/groundstate/upper_bound/constraints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Get constraints on variables from a processor."""

from numbers import Number
from typing import List, Tuple, Union

Expand Down
1 change: 1 addition & 0 deletions smol/capp/generate/groundstate/upper_bound/objectives.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Generate energy terms from processor to be converted into cvxpy."""

from copy import deepcopy
from itertools import product
from typing import List, Tuple, Union
Expand Down
1 change: 1 addition & 0 deletions smol/capp/generate/groundstate/upper_bound/solver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Solver class for the ground state problem of cluster expansion."""

from typing import List, NamedTuple, Union
from warnings import warn

Expand Down
1 change: 1 addition & 0 deletions smol/capp/generate/groundstate/upper_bound/terms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Handles boolean product terms in expression."""

from typing import List, Tuple

import cvxpy as cp
Expand Down
1 change: 1 addition & 0 deletions smol/capp/generate/groundstate/upper_bound/variables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Get variables from processor."""

from typing import List, Tuple

import cvxpy as cp
Expand Down
1 change: 0 additions & 1 deletion smol/cofe/extern/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
be the only term ever needed, but alas abstraction?
"""


from .ewald import EwaldTerm

__all__ = ["EwaldTerm"]
7 changes: 4 additions & 3 deletions smol/cofe/space/basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
which is defined by the allowed species at the site and their measures, i.e.
the concentration of the species in the random structure.
"""

# pylint: disable=invalid-name, too-few-public-methods

import warnings
Expand Down Expand Up @@ -323,9 +324,9 @@ def rotate(self, angle, index1=0, index2=1):
)
self._f_array[1:] = self._f_array[1:] @ rotation_mat.T
# make really small numbers zero
self._f_array[
abs(self._f_array) < EPS_MULT * np.finfo(np.float64).eps
] = 0.0
self._f_array[abs(self._f_array) < EPS_MULT * np.finfo(np.float64).eps] = (
0.0
)

self._rot_array = rotation_mat @ self._rot_array

Expand Down
8 changes: 5 additions & 3 deletions smol/cofe/space/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,11 @@ def from_dict(cls, d):
for symbols, site in zip(d["vacancy_symbols"], sites):
site.species = Composition(
{
spec
if spec.symbol not in symbols
else Vacancy(spec.symbol, spec.oxidation_state, spec.spin): val
(
spec
if spec.symbol not in symbols
else Vacancy(spec.symbol, spec.oxidation_state, spec.spin)
): val
for spec, val in site.species.items()
if spec.symbol not in symbols
}
Expand Down
1 change: 1 addition & 0 deletions smol/cofe/space/clusterspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
The PottsSubspace class is an (experimental) class that is similar, but
diverges from the CE mathematic formalism.
"""

# pylint: disable=too-many-lines


Expand Down
1 change: 0 additions & 1 deletion smol/cofe/space/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Definitions of global constants used in cofe.space module."""


# site tolerance is the absolute tolerance passed to the pymatgen coord utils
# to determine mappings and subsets. The default in pymatgen is 1E-8.
# If you want to tighten or loosen this tolerance, do it at runtime in your
Expand Down
1 change: 1 addition & 0 deletions smol/moca/composition/constraints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility manager that converts input of composition constraints to equations."""

import itertools
import re
from numbers import Number
Expand Down
6 changes: 3 additions & 3 deletions smol/moca/kernel/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,9 @@ def set_aux_state(self, occupancy, *args, **kwargs):
new_features.append(kernel.ensemble.compute_feature_vector(occupancy))
self._features = np.vstack(new_features)
else: # if only one assume it is continuing from a run...
self._features[
self._current_kernel_index, :
] = self.current_kernel.ensemble.compute_feature_vector(occupancy)
self._features[self._current_kernel_index, :] = (
self.current_kernel.ensemble.compute_feature_vector(occupancy)
)
self.current_kernel.set_aux_state(occupancy, *args, **kwargs)

def compute_initial_trace(self, occupancy):
Expand Down
1 change: 0 additions & 1 deletion smol/utils/cluster/numthreads.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Simple mixin class that has an attributed/method that runs in parallel."""


import os
import warnings

Expand Down
1 change: 0 additions & 1 deletion smol/utils/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Definitions of specific exceptions raised elsewhere."""


SYMMETRY_ERROR_MESSAGE = (
"Error in calculating symmetry operations."
"Try using a more symmetrically refined input"
Expand Down
1 change: 1 addition & 0 deletions tests/test_capp/test_solver/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Exotic cases where sub-lattices contains split and manually fixed sites."""

from itertools import product

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/test_capp/test_solver/test_constraints.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test constraints to the upper-bound problem."""

import itertools

import pytest
Expand Down
1 change: 1 addition & 0 deletions tests/test_capp/test_solver/test_objectives.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test objective functions generation."""

import numpy as np
import numpy.testing as npt

Expand Down
1 change: 1 addition & 0 deletions tests/test_capp/test_solver/test_solver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test groundstate class construction and usage."""

from itertools import permutations, product

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/test_capp/test_solver/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test utility functions for upper-bound."""

from itertools import product

import cvxpy as cp
Expand Down
1 change: 1 addition & 0 deletions tests/test_capp/test_solver/test_variables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test boolean variables' generation for upper-bound groundstate."""

import numpy as np
import numpy.testing as npt
import pytest
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cofe/test_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ def test_sinusoid_basis(site_space):
m = len(site_space)
for n in range(1, len(site_space)):
a = -(-n // 2)
f = (
lambda s: -np.sin(2 * np.pi * a * s / m)
f = lambda s: (
-np.sin(2 * np.pi * a * s / m)
if n % 2 == 0
else -np.cos(2 * np.pi * a * s / m)
)
Expand Down
1 change: 1 addition & 0 deletions tests/test_moca/test_constraint_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test utilities for managing composition constraints."""

import numpy.testing as npt
import pytest
from pymatgen.core import DummySpecies, Element, Species
Expand Down
1 change: 1 addition & 0 deletions tests/test_moca/test_occu_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test smol.moca.utils.occu_utils."""

import itertools

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/test_utils/test_math_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test smol.moca.utils.math_utils."""

from collections import Counter
from fractions import Fraction

Expand Down

0 comments on commit 68ba603

Please sign in to comment.