Skip to content

Commit

Permalink
fix typos in AimsSpeciesFile and AimsOutCalcChunk
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Sep 7, 2024
1 parent 05c2e99 commit 149e115
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.0
rev: v0.6.4
hooks:
- id: ruff
args: [--fix, --unsafe-fixes]
Expand All @@ -22,7 +22,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
rev: v1.11.2
hooks:
- id: mypy

Expand Down Expand Up @@ -65,6 +65,6 @@ repos:
args: [--drop-empty-cells, --keep-output]

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.376
rev: v1.1.379
hooks:
- id: pyright
40 changes: 20 additions & 20 deletions src/pymatgen/io/aims/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,35 +705,35 @@ def __init__(self, data: str, label: str | None = None) -> None:
if "species" in line:
self.label = line.split()[1]

def __eq__(self, sepcies_2: object) -> bool:
"""Returns if two speceies are equal"""
if not isinstance(sepcies_2, AimsSpeciesFile):
def __eq__(self, other: object) -> bool:
"""True if two species are equal."""
if not isinstance(other, AimsSpeciesFile):
return NotImplemented
return self.data == sepcies_2.data
return self.data == other.data

def __lt__(self, sepcies_2: object) -> bool:
"""Returns if two speceies are equal"""
if not isinstance(sepcies_2, AimsSpeciesFile):
def __lt__(self, other: object) -> bool:
"""True if self is less than other."""
if not isinstance(other, AimsSpeciesFile):
return NotImplemented
return self.data < sepcies_2.data
return self.data < other.data

def __le__(self, sepcies_2: object) -> bool:
"""Returns if two speceies are equal"""
if not isinstance(sepcies_2, AimsSpeciesFile):
def __le__(self, other: object) -> bool:
"""True if self is less than or equal to other."""
if not isinstance(other, AimsSpeciesFile):
return NotImplemented
return self.data <= sepcies_2.data
return self.data <= other.data

def __gt__(self, sepcies_2: object) -> bool:
"""Returns if two speceies are equal"""
if not isinstance(sepcies_2, AimsSpeciesFile):
def __gt__(self, other: object) -> bool:
"""True if self is greater than other."""
if not isinstance(other, AimsSpeciesFile):
return NotImplemented
return self.data > sepcies_2.data
return self.data > other.data

def __ge__(self, sepcies_2: object) -> bool:
"""Returns if two speceies are equal"""
if not isinstance(sepcies_2, AimsSpeciesFile):
def __ge__(self, other: object) -> bool:
"""True if self is greater than or equal to other."""
if not isinstance(other, AimsSpeciesFile):
return NotImplemented
return self.data >= sepcies_2.data
return self.data >= other.data

@classmethod
def from_file(cls, filename: str, label: str | None = None) -> AimsSpeciesFile:
Expand Down
12 changes: 6 additions & 6 deletions src/pymatgen/io/aims/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from __future__ import annotations

import gzip
import warnings
from dataclasses import dataclass, field
from pathlib import Path
from typing import TYPE_CHECKING, cast
from warnings import warn

import numpy as np

Expand Down Expand Up @@ -498,7 +498,9 @@ def _parse_structure(self) -> Structure | Molecule:
if ((magmom := site_properties.get("magmom")) is not None) and np.abs(
np.sum(magmom) - properties["magmom"]
) < 1e-3:
warn("Total magenetic moment and sum of Mulliken spins are not consistent", Warning, 1)
warnings.warn(
"Total magnetic moment and sum of Mulliken spins are not consistent", UserWarning, stacklevel=1
)

if lattice is not None:
return Structure(
Expand All @@ -517,9 +519,7 @@ def _parse_structure(self) -> Structure | Molecule:
properties=properties,
)

def _parse_lattice_atom_pos(
self,
) -> tuple[list[str], list[Vector3D], list[Vector3D], Lattice | None]:
def _parse_lattice_atom_pos(self) -> tuple[list[str], list[Vector3D], list[Vector3D], Lattice | None]:
"""Parse the lattice and atomic positions of the structure.
Returns:
Expand All @@ -545,7 +545,7 @@ def _parse_lattice_atom_pos(
velocities = list(self.initial_structure.site_properties.get("velocity", []))
lattice = self.initial_lattice

return (species, coords, velocities, lattice)
return species, coords, velocities, lattice

line_start += 1

Expand Down

0 comments on commit 149e115

Please sign in to comment.