Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 20, 2023
1 parent e86a6c5 commit 98f04c3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
6 changes: 4 additions & 2 deletions gmso/core/atom_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

from gmso.abc.serialization_utils import unyt_to_dict
from gmso.core.parametric_potential import ParametricPotential
from gmso.utils.units import GMSO_UnitRegistry
from gmso.utils._constants import UNIT_WARNING_STRING
from gmso.utils.expression import PotentialExpression
from gmso.utils.misc import (
ensure_valid_dimensions,
unyt_compare,
unyt_to_hashable,
)
from gmso.utils.units import GMSO_UnitRegistry


class AtomType(ParametricPotential):
Expand Down Expand Up @@ -255,7 +255,9 @@ def validate_charge(cls, charge):
warnings.warn(
UNIT_WARNING_STRING.format("Charges", "elementary charge")
)
charge *= u.Unit("elementary_charge", registry=GMSO_UnitRegistry().reg_)
charge *= u.Unit(
"elementary_charge", registry=GMSO_UnitRegistry().reg_
)
else:
ensure_valid_dimensions(charge, u.elementary_charge)

Expand Down
11 changes: 5 additions & 6 deletions gmso/core/forcefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from typing import Iterable

from lxml import etree

from pydantic import ValidationError

from gmso.core.element import element_by_symbol
Expand Down Expand Up @@ -579,11 +578,11 @@ def xml_from_forcefield_utilities(cls, filename):
loader = FoyerFFs()
ff = loader.load(filename).to_gmso_ff()
ff.units = {
"energy": "kJ",
"distance": "nm",
"mass": "amu",
"charge": "elementary_charge",
}
"energy": "kJ",
"distance": "nm",
"mass": "amu",
"charge": "elementary_charge",
}
return ff

def to_xml(self, filename, overwrite=False, backend="gmso"):
Expand Down
9 changes: 7 additions & 2 deletions gmso/utils/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ def default_reg():

def register_general_units(reg: u.UnitRegistry):
"""Register units that are generally useful to a basic unyt UnitSystem."""
elementary_charge_conversion = 1 * getattr(u.physical_constants, "elementary_charge").value
elementary_charge_conversion = (
1 * getattr(u.physical_constants, "elementary_charge").value
)
charge_dim = u.dimensions.current_mks * u.dimensions.time
reg.add(
"elementary_charge",
Expand Down Expand Up @@ -111,7 +113,10 @@ def register_general_units(reg: u.UnitRegistry):
)
bohr_rad_dim = u.dimensions.length
reg.add(
"a0", base_value=bohr_rad_conversion, dimensions=bohr_rad_dim, tex_repr=r"\rm{a0}"
"a0",
base_value=bohr_rad_conversion,
dimensions=bohr_rad_dim,
tex_repr=r"\rm{a0}",
) # bohr radius

hartree_conversion = (
Expand Down

0 comments on commit 98f04c3

Please sign in to comment.