diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 89d54fd5..e23f49f0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: trailing-whitespace exclude: 'setup.cfg' - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.2.0 hooks: - id: black args: [--line-length=80] diff --git a/examples/ethane.py b/examples/ethane.py index f3e72540..b7d82a05 100644 --- a/examples/ethane.py +++ b/examples/ethane.py @@ -1,4 +1,5 @@ """Example script for a parametrized ethane molecule.""" + import parmed as pmd from foyer import Forcefield diff --git a/foyer/__init__.py b/foyer/__init__.py index a8b8dd6c..c5347c10 100644 --- a/foyer/__init__.py +++ b/foyer/__init__.py @@ -1,4 +1,5 @@ """Foyer: A pacakage for atom-typing, applying and disseminating forcefields.""" + from foyer.forcefield import Forcefield from foyer.forcefields import forcefields diff --git a/foyer/atomtyper.py b/foyer/atomtyper.py index 0e9f81b2..6addcf46 100644 --- a/foyer/atomtyper.py +++ b/foyer/atomtyper.py @@ -1,4 +1,5 @@ """Determine proper atom types for chemical systems.""" + from warnings import warn import ele diff --git a/foyer/element.py b/foyer/element.py index 0f526515..516e6f68 100644 --- a/foyer/element.py +++ b/foyer/element.py @@ -1,4 +1,5 @@ """Element support in foyer.""" + import openmm.app.element as elem diff --git a/foyer/examples/files/modify_oplsa_silica.py b/foyer/examples/files/modify_oplsa_silica.py index e82fee0b..839cabab 100644 --- a/foyer/examples/files/modify_oplsa_silica.py +++ b/foyer/examples/files/modify_oplsa_silica.py @@ -1,4 +1,5 @@ """Utility to modify a silica/oplsaa xml.""" + from lxml import etree root = etree.fromstring(open("oplsaa_with_silica.xml", "r").read()) diff --git a/foyer/examples/utils.py b/foyer/examples/utils.py index c1a40792..f876d727 100644 --- a/foyer/examples/utils.py +++ b/foyer/examples/utils.py @@ -1,4 +1,5 @@ """Utility methods for foyer examples.""" + import glob from os.path import abspath, join, split diff --git a/foyer/forcefield.py b/foyer/forcefield.py index c4987091..1e02f296 100644 --- a/foyer/forcefield.py +++ b/foyer/forcefield.py @@ -1,4 +1,5 @@ """Foyer ForceField class and utility methods.""" + import collections import glob import itertools diff --git a/foyer/forcefields/__init__.py b/foyer/forcefields/__init__.py index ec17e2d4..d93cea5f 100644 --- a/foyer/forcefields/__init__.py +++ b/foyer/forcefields/__init__.py @@ -1,4 +1,5 @@ """Plugin support for forcefields.""" + from pkg_resources import iter_entry_points diff --git a/foyer/forcefields/forcefields.py b/foyer/forcefields/forcefields.py index d7ead489..f7dab0c8 100644 --- a/foyer/forcefields/forcefields.py +++ b/foyer/forcefields/forcefields.py @@ -1,4 +1,5 @@ """Support user-created forcefield XML files.""" + import glob import os import warnings diff --git a/foyer/smarts.py b/foyer/smarts.py index 82223010..620ed267 100644 --- a/foyer/smarts.py +++ b/foyer/smarts.py @@ -1,4 +1,5 @@ """Utility methods/classes for SMARTS grammar.""" + import lark from foyer.exceptions import FoyerError diff --git a/foyer/smarts_graph.py b/foyer/smarts_graph.py index a4cf33a9..febe2759 100644 --- a/foyer/smarts_graph.py +++ b/foyer/smarts_graph.py @@ -1,4 +1,5 @@ """Module for SMARTSGraph and SMARTS matching logic.""" + import itertools from collections import OrderedDict, defaultdict diff --git a/foyer/topology_graph.py b/foyer/topology_graph.py index 2fef4776..f2a7f6c3 100644 --- a/foyer/topology_graph.py +++ b/foyer/topology_graph.py @@ -1,4 +1,5 @@ """Module to represent chemical systems as graph structures.""" + from typing import TYPE_CHECKING, Optional import networkx as nx diff --git a/foyer/utils/external.py b/foyer/utils/external.py index 7cca7d34..739e5530 100644 --- a/foyer/utils/external.py +++ b/foyer/utils/external.py @@ -1,4 +1,5 @@ """Methods that require external access to function.""" + import requests diff --git a/foyer/utils/io.py b/foyer/utils/io.py index 3db357bc..94ef5e9a 100644 --- a/foyer/utils/io.py +++ b/foyer/utils/io.py @@ -1,4 +1,5 @@ """File I/O support module.""" + from __future__ import division, print_function import importlib diff --git a/foyer/utils/nbfixes.py b/foyer/utils/nbfixes.py index 6d89f7d7..cc0b50f8 100644 --- a/foyer/utils/nbfixes.py +++ b/foyer/utils/nbfixes.py @@ -1,4 +1,5 @@ """Support non-bonded fixes for various interactions.""" + from parmed import Structure diff --git a/foyer/validator.py b/foyer/validator.py index 477fd9ee..417478c1 100644 --- a/foyer/validator.py +++ b/foyer/validator.py @@ -1,4 +1,5 @@ """Validaton of force field XML files.""" + import os from collections import Counter from os.path import abspath, join, split diff --git a/foyer/xml_writer.py b/foyer/xml_writer.py index a06ac4a1..5238038f 100644 --- a/foyer/xml_writer.py +++ b/foyer/xml_writer.py @@ -1,4 +1,5 @@ """Write foyer XMLs from a parametrized structure.""" + from __future__ import division import collections @@ -313,15 +314,15 @@ def _write_periodic_torsions(root, dihedrals, unique): n = 1 while "periodicity{}".format(n) in last_dihedral_force.attrib: n += 1 - last_dihedral_force.attrib[ - "periodicity{}".format(n) - ] = dihedral_force.attrib["periodicity1"] - last_dihedral_force.attrib[ - "phase{}".format(n) - ] = dihedral_force.attrib["phase1"] - last_dihedral_force.attrib[ - "k{}".format(n) - ] = dihedral_force.attrib["k1"] + last_dihedral_force.attrib["periodicity{}".format(n)] = ( + dihedral_force.attrib["periodicity1"] + ) + last_dihedral_force.attrib["phase{}".format(n)] = ( + dihedral_force.attrib["phase1"] + ) + last_dihedral_force.attrib["k{}".format(n)] = ( + dihedral_force.attrib["k1"] + ) periodic_torsion_forces.remove(dihedral_force) else: last_dihedral_force = dihedral_force