Skip to content

Commit

Permalink
Fixed code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
craabreu committed Mar 21, 2024
1 parent 99baa94 commit 392dea1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cvpack/cvpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def getPeriod(self) -> t.Optional[mmunit.SerializableQuantity]:
return mmunit.SerializableQuantity(self._period, self.getUnit())

def addToSystem(
self, system: openmm.System, set_unused_force_group: bool = True
self, system: openmm.System, setUnusedForceGroup: bool = True
) -> None:
"""
Add this collective variable to an :OpenMM:`System`.
Expand All @@ -236,11 +236,11 @@ def addToSystem(
----------
system
The system to which this collective variable should be added
set_unused_force_group
setUnusedForceGroup
If True, the force group of this collective variable will be set to the
first available force group in the system
"""
if set_unused_force_group:
if setUnusedForceGroup:
self._setUnusedForceGroup(system)
system.addForce(self)

Expand Down
4 changes: 2 additions & 2 deletions cvpack/tests/test_cvpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self, first: int, second: float, third: str = "3"):

# pylint: enable=missing-class-docstring, unused-argument

args, defaults = Test._getArguments()
args, defaults = Test._getArguments() # pylint: disable=protected-access
assert args["first"] is int
assert args["second"] is float
assert args["third"] is str
Expand All @@ -82,7 +82,7 @@ def perform_common_tests(
assert unity.value_in_unit_system(unit.md_unit_system) == 1

# Class must have full type annotation (except for argument `self`)
args, _ = collectiveVariable._getArguments()
args, _ = collectiveVariable._getArguments() # pylint: disable=protected-access
for _, annotation in args.items():
assert annotation is not inspect.Parameter.empty

Expand Down
5 changes: 2 additions & 3 deletions cvpack/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

from .serializer import Serializable

# pylint: disable=protected-access,c-extension-no-member


class NonbondedForceSurrogate(
Serializable
Expand Down Expand Up @@ -210,7 +212,6 @@ def get_single_force_state(
return context.getState(
getEnergy=getEnergy, getForces=getForces, groups=1 << self_group
)
# old_group = force.getForceGroup()
new_group = force._setUnusedForceGroup(context.getSystem())
context.reinitialize(preserveState=True)
state = context.getState(
Expand All @@ -237,7 +238,6 @@ def compute_effective_mass(force: openmm.Force, context: openmm.Context) -> floa
float
The effective mass of the force at the given context
"""
# pylint: disable=protected-access,c-extension-no-member
state = get_single_force_state(force, context, getForces=True)
get_mass = functools.partial(
openmm._openmm.System_getParticleMass, context.getSystem()
Expand All @@ -249,4 +249,3 @@ def compute_effective_mass(force: openmm.Force, context: openmm.Context) -> floa
return mmunit.Quantity(np.inf, force._mass_unit)
mass_values = np.fromiter(map(get_mass, nonzeros), dtype=np.float64)
return 1.0 / np.sum(squared_forces[nonzeros] / mass_values)
# pylint: enable=protected-access,c-extension-no-member

0 comments on commit 392dea1

Please sign in to comment.