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 Jan 23, 2025
1 parent 7fe124d commit b32109a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 35 deletions.
56 changes: 29 additions & 27 deletions grits/finegrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,41 @@ def backmap_snapshot_to_compound(
):
"""Backmap a fine-grained snapshot onto a coarse one.
Creates a fine-grained compound from a coarse one using the given parameters.
Creates a fine-grained compound from a coarse one using the given parameters.
Parameters
----------
snapshot : gsd.hoomd.Frame
one frame of gsd trajectory
Parameters
----------
snapshot : gsd.hoomd.Frame
one frame of gsd trajectory
bead_mapping : string, default None
SMILES string of fine-grain monomer
bead_mapping : string, default None
SMILES string of fine-grain monomer
bond_head_index : list of int, default None
index of polymer reaction, choose head to orient chain
bond_head_index : list of int, default None
index of polymer reaction, choose head to orient chain
bond_tail_index : list of int, default None
index of polymer reaction, choose tail to orient chain
bond_tail_index : list of int, default None
index of polymer reaction, choose tail to orient chain
library_key : string, default None
key to dictionary, reactant_dict, with known bead_mapping, bond_head_index, and bond_tail_index
library_key : string, default None
key to dictionary, reactant_dict, with known bead_mapping, bond_head_index, and bond_tail_index
ref_distance : float, default None
distance between monomers
ref_distance : float, default None
distance between monomers
<<<<<<< HEAD
energy_minimize (bool) : Option to run a mbuild energy minimization.
<<<<<<< HEAD
energy_minimize (bool) : Option to run a mbuild energy minimization.
=======
energy_minimize : bool, default False
Option to run a mbuild energy minimization.
>>>>>>> 2785a5d (updating format for doc strings)
=======
energy_minimize : bool, default False
Option to run a mbuild energy minimization.
Returns
-------
:py:class:`mbuild.Compound`
The atomistic structure mapped onto the coarse-grained one.
>>>>>>> 2785a5d (updating format for doc strings)
Returns
-------
:py:class:`mbuild.Compound`
The atomistic structure mapped onto the coarse-grained one.
"""
# TODO
# assert all 3 dicts have the same keys
Expand Down Expand Up @@ -98,7 +98,9 @@ def backmap_snapshot_to_compound(
for l, particle in enumerate(comp.particles()):
if l == k:
remove_atoms.append(particle)
if len(bond_head_index[mapping]) > 1: #repeated if statement if reacting group is listed for head index
if (
len(bond_head_index[mapping]) > 1
): # repeated if statement if reacting group is listed for head index
extra_head_particles = []
extra_head_particles = bond_head_index[mapping][1:]
for k in extra_head_particles:
Expand Down
16 changes: 8 additions & 8 deletions grits/tests/test_finegrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_backmap_snap_smiles(snap):
bead_mapping = {"A": "C=CC1=CC=CC=C1"} # Mapping one A bead to 1 Polystyrene monomer
head_indices = {"A": [10]}
tail_indices = {"A": [9]}

fg_comp = backmap_snapshot_to_compound(
snapshot=snap,
bead_mapping=bead_mapping,
Expand All @@ -38,7 +38,7 @@ def test_backmap_snap_smiles(snap):
ref_distance=0.3438,
energy_minimize=False
)

assert fg_comp.particles == snap.particles
assert fg_comp.bonds == snap.bonds

Expand All @@ -49,15 +49,15 @@ def test_backmap_snap_library(snap):
ref_distance=0.3438,
energy_minimize=False
)

assert fg_comp.particles == snap.particles
assert fg_comp.bonds == snap.bonds

def test_backmap_snap_lists(snap):
bead_mapping = {"A": "C[C@@H](C(=O)O)N"} # Mapping one A bead to 1 Polyalanine monomer
head_indices = {"A":[4,10]}
tail_indices = {"A":[12]}

fg_comp = backmap_snapshot_to_compound(
snapshot=snap,
bead_mapping=bead_mapping,
Expand All @@ -66,7 +66,7 @@ def test_backmap_snap_lists(snap):
ref_distance=0.3438,
energy_minimize=False
)

assert fg_comp.particles == snap.particles
assert fg_comp.bonds == snap.bonds

Expand All @@ -75,7 +75,7 @@ def test_backmap_snap_not_int(snap):
bead_mapping = {"A": "C[C@@H](C(=O)O)N"} # Mapping one A bead to 1 Polyalanine monomer
head_indices = {"A":[4.5,10]}
tail_indices = {"A":[12]}

fg_comp = backmap_snapshot_to_compound(
snapshot=snap,
bead_mapping=bead_mapping,
Expand All @@ -84,4 +84,4 @@ def test_backmap_snap_not_int(snap):
ref_distance=0.3438,
energy_minimize=False
)
pass #non-int should break code
pass #non-int should break code

0 comments on commit b32109a

Please sign in to comment.