Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ceriottm committed Nov 29, 2024
1 parent cb4ffda commit a7fdacb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
15 changes: 11 additions & 4 deletions ipi/engine/forcefields.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
from ipi.utils.units import unit_to_internal
from ipi.utils.distance import vector_separation
from ipi.pes import __drivers__
from ipi.utils.mathtools import get_rotation_quadrature_legendre, get_rotation_quadrature_lebedev, random_rotation
from ipi.utils.mathtools import (
get_rotation_quadrature_legendre,
get_rotation_quadrature_lebedev,
random_rotation,
)

plumed = None

Expand Down Expand Up @@ -1463,7 +1467,7 @@ def __init__(
random=False,
inversion=False,
grid_order=1,
grid_mode="lebedev"
grid_mode="lebedev",
):
super(FFRotations, self).__init__(
latency,
Expand All @@ -1489,10 +1493,13 @@ def __init__(
self._rotations = get_rotation_quadrature_legendre(self.grid_order)
else:
raise ValueError(f"Invalid quadrature {self.grid_mode}")
info(f"""
info(
f"""
# Generating {self.grid_mode} rotation quadrature of order {self.grid_order}.
# Grid contains {len(self._rotations)} proper rotations.
""", verbosity.low)
""",
verbosity.low,
)

def queue(self, atoms, cell, reqid=-1):

Expand Down
1 change: 0 additions & 1 deletion ipi/inputs/forcefields.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,6 @@ class InputFFRotations(InputFFSocket):
},
)


fields["inversion"] = (
InputValue,
{
Expand Down
9 changes: 6 additions & 3 deletions ipi/utils/mathtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ def det_ut3x3(h):

MINSERIES = 1e-8


def exp_ut3x3(h):
"""Computes the matrix exponential for a 3x3 upper-triangular matrix.
Expand Down Expand Up @@ -617,7 +618,8 @@ def get_rotation_quadrature_legendre(L):

return quads

def get_rotation_quadrature_lebedev(L):

def get_rotation_quadrature_lebedev(L):
with resources.path("ipi.utils", "lebedev_grids.npy") as file_path:
lebedev = np.load(file_path, allow_pickle=True).item()
if not L in lebedev:
Expand All @@ -627,10 +629,11 @@ def get_rotation_quadrature_lebedev(L):
for theta_index in range(0, L):
theta = 2 * np.pi * theta_index / L
for w, v, weight in leb_quad:
angles = [theta, v, w] # [w, v, theta]
angles = [theta, v, w] # [w, v, theta]
rotation_matrix = euler_zxz_to_matrix(*angles)
quads.append((rotation_matrix, weight, angles))
return quads
return quads


def random_rotation(prng, improper=True):
"""Generates a (uniform) random rotation matrix"""
Expand Down

0 comments on commit a7fdacb

Please sign in to comment.