Skip to content

Commit

Permalink
some minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
PicoCentauri authored and GardevoirX committed Jan 19, 2025
1 parent 0d335c7 commit 7b36cf1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/torchpme/calculators/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def __init__(
):
super().__init__()

assert isinstance(potential, Potential), (
f"Potential must be an instance of Potential, got {type(potential)}"
)
assert isinstance(
potential, Potential
), f"Potential must be an instance of Potential, got {type(potential)}"

self.device = "cpu" if device is None else device
self.dtype = torch.get_default_dtype() if dtype is None else dtype
Expand Down
6 changes: 2 additions & 4 deletions src/torchpme/tuning/ewald.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from ..utils import _validate_parameters
from .tuner import GridSearchTuner, TuningErrorBounds

TWO_PI = 2 * math.pi


def tune_ewald(
charges: torch.Tensor,
Expand Down Expand Up @@ -162,8 +160,8 @@ def err_kspace(
return (
self.prefac**0.5
/ smearing
/ torch.sqrt(TWO_PI**2 * self.volume / (lr_wavelength) ** 0.5)
* torch.exp(-(TWO_PI**2) * smearing**2 / (lr_wavelength))
/ torch.sqrt((2 * torch.pi) ** 2 * self.volume / (lr_wavelength) ** 0.5)
* torch.exp(-((2 * torch.pi) ** 2) * smearing**2 / (lr_wavelength))
)

def err_rspace(self, smearing: torch.Tensor, cutoff: torch.Tensor) -> torch.Tensor:
Expand Down
2 changes: 0 additions & 2 deletions src/torchpme/tuning/p3m.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from ..utils import _validate_parameters
from .tuner import GridSearchTuner, TuningErrorBounds

TWO_PI = 2 * math.pi

# Coefficients for the P3M Fourier error,
# see Table II of http://dx.doi.org/10.1063/1.477415
A_COEF = [
Expand Down
2 changes: 0 additions & 2 deletions src/torchpme/tuning/pme.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from ..utils import _validate_parameters
from .tuner import GridSearchTuner, TuningErrorBounds

TWO_PI = 2 * math.pi


def tune_pme(
charges: torch.Tensor,
Expand Down

0 comments on commit 7b36cf1

Please sign in to comment.