Skip to content

Commit 05fcd7f

Browse files
committed
Pre-commit hooks formatting
1 parent bdce03b commit 05fcd7f

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

src/fes_ml/alchemical/alchemist.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ def add_modification_to_graph(
100100
The value of the alchemical state parameter.
101101
"""
102102
if modification.NAME in self._graph.nodes and lambda_value is None:
103-
lambda_value = self._graph.nodes[modification.NAME].get("lambda_value", None)
104-
103+
lambda_value = self._graph.nodes[modification.NAME].get(
104+
"lambda_value", None
105+
)
106+
105107
self._graph.add_node(
106108
modification.NAME, modification=modification, lambda_value=lambda_value
107109
)

src/fes_ml/alchemical/modifications/custom_lj.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
from .lj_softcore import LJSoftCoreModification
2-
import openmm.unit as _unit
1+
import logging
2+
from typing import List, Optional, Union
3+
34
import openmm as _mm
4-
from openff.toolkit.typing.engines.smirnoff import ForceField as _ForceField
5+
import openmm.unit as _unit
56
from openff.toolkit.topology import Topology as _Topology
7+
from openff.toolkit.typing.engines.smirnoff import ForceField as _ForceField
68

79
from .base_modification import BaseModification, BaseModificationFactory
8-
import logging
9-
from typing import List, Optional, Union
10+
from .lj_softcore import LJSoftCoreModification
1011

1112
logger = logging.getLogger(__name__)
1213

14+
1315
class CustomLJModificationFactory(BaseModificationFactory):
1416
"""Factory for creating CustomLJModification instances."""
1517

@@ -54,7 +56,7 @@ def apply(
5456
alchemical_atoms : List[int]
5557
A list of the indices of the alchemical atoms.
5658
lambda_value : float
57-
The value of the alchemical state parameter.
59+
The value of the alchemical state parameter.
5860
original_offxml : List[str]
5961
A list of paths to the original OFFXML files.
6062
lj_offxml : str
@@ -77,21 +79,26 @@ def apply(
7779
opt_params = {}
7880
for p in force_field_opt.get_parameter_handler("vdW"):
7981
opt_params[p.id] = {
80-
"epsilon": p.epsilon.to_openmm().value_in_unit(_unit.kilojoules_per_mole),
81-
"sigma": p.sigma.to_openmm().value_in_unit(_unit.nanometer)
82-
}
82+
"epsilon": p.epsilon.to_openmm().value_in_unit(
83+
_unit.kilojoules_per_mole
84+
),
85+
"sigma": p.sigma.to_openmm().value_in_unit(_unit.nanometer),
86+
}
8387

84-
# Update the Lennard-Jones parameters in the CustomNonbondedForce
88+
# Update the Lennard-Jones parameters in the CustomNonbondedForce
8589
force_field = _ForceField(*original_offxml)
8690
labels = force_field.label_molecules(topology_off)
8791
index = 0
8892
for mol in labels:
8993
for _, val in mol["vdW"].items():
9094
atom_type = val.id
9195
# Get the original Lennard-Jones parameters
92-
parameters = [opt_params[atom_type]["sigma"], opt_params[atom_type]["epsilon"]]
96+
parameters = [
97+
opt_params[atom_type]["sigma"],
98+
opt_params[atom_type]["epsilon"],
99+
]
93100
# Update the Lennard-Jones parameters
94101
custom_nb_force.setParticleParameters(index, parameters)
95102
index += 1
96103

97-
return system
104+
return system

0 commit comments

Comments
 (0)