Skip to content

Commit 53a80d5

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 1b0812d commit 53a80d5

File tree

2 files changed

+38
-24
lines changed

2 files changed

+38
-24
lines changed

grits/finegrain.py

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,26 @@
1313

1414

1515
def backmap_snapshot_to_compound(
16-
snapshot,
17-
bead_mapping=None,
18-
bond_head_index=None,
19-
bond_tail_index=None,
20-
library_key=None,
21-
ref_distance=None,
22-
energy_minimize=False
16+
snapshot,
17+
bead_mapping=None,
18+
bond_head_index=None,
19+
bond_tail_index=None,
20+
library_key=None,
21+
ref_distance=None,
22+
energy_minimize=False,
2323
):
2424
# TODO
2525
# assert all 3 dicts have the same keys
26-
if (bead_mapping is None and bond_head_index is None and bond_tail_index is None) == (library_key is None):
27-
raise ValueError(
28-
"Please provide dictionaries or library key."
29-
)
26+
if (
27+
bead_mapping is None
28+
and bond_head_index is None
29+
and bond_tail_index is None
30+
) == (library_key is None):
31+
raise ValueError("Please provide dictionaries or library key.")
3032
if library_key is not None:
31-
bead_mapping=reactant_dict[library_key]['smiles']
32-
bond_tail_index=reactant_dict[library_key]['tail_indices']
33-
bond_head_index=reactant_dict[library_key]['head_indices']
33+
bead_mapping = reactant_dict[library_key]["smiles"]
34+
bond_tail_index = reactant_dict[library_key]["tail_indices"]
35+
bond_head_index = reactant_dict[library_key]["head_indices"]
3436
if not ref_distance:
3537
ref_distance = 1
3638
cg_snap = snapshot
@@ -47,11 +49,11 @@ def backmap_snapshot_to_compound(
4749
for mapping in bead_mapping:
4850
comp = mb.load(bead_mapping[mapping], smiles=True)
4951
if bond_head_index and bond_tail_index:
50-
remove_atoms = [] # These will be removed
51-
anchor_particles = [] # Store this for making bonds later
52-
'''adding section to remove other particles in reacting group
53-
assuming input for head/tail indices is a list, with the anchor particle listed first'''
54-
if len(bond_tail_index[mapping]) > 1:
52+
remove_atoms = [] # These will be removed
53+
anchor_particles = [] # Store this for making bonds later
54+
"""adding section to remove other particles in reacting group
55+
assuming input for head/tail indices is a list, with the anchor particle listed first"""
56+
if len(bond_tail_index[mapping]) > 1:
5557
extra_tail_particles = []
5658
extra_tail_particles = bond_tail_index[mapping][1:]
5759
for k in extra_tail_particles:
@@ -136,8 +138,8 @@ def backmap_snapshot_to_compound(
136138
temp_head = temp_comp.children[1]
137139
tail_comp.xyz = temp_tail.xyz
138140
head_comp.xyz = temp_head.xyz
139-
'''maybe replace this section with just:
140-
fg_compound.energy_minimize(steps=500)'''
141+
"""maybe replace this section with just:
142+
fg_compound.energy_minimize(steps=500)"""
141143
return fg_compound
142144

143145

grits/utils.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,19 @@ def num2str(num):
476476
}
477477

478478
reactant_dict = {
479-
'pps':{'smiles':{"A":"c1ccc(S)cc1"},'head_indices':{"A":[7]}, 'tail_indices':{"A":[10]}},
480-
'polystyrene':{'smiles':{"A":"C=CC1=CC=CC=C1"}, 'head_indices':{"A":[9]}, 'tail_indices':{"A":[10]}},
481-
'polyalanine':{'smiles':{"A":"C[C@@H](C(=O)O)N"}, 'head_indices':{"A":[12]}, 'tail_indices':{"A":[4,10]}}
479+
"pps": {
480+
"smiles": {"A": "c1ccc(S)cc1"},
481+
"head_indices": {"A": [7]},
482+
"tail_indices": {"A": [10]},
483+
},
484+
"polystyrene": {
485+
"smiles": {"A": "C=CC1=CC=CC=C1"},
486+
"head_indices": {"A": [9]},
487+
"tail_indices": {"A": [10]},
488+
},
489+
"polyalanine": {
490+
"smiles": {"A": "C[C@@H](C(=O)O)N"},
491+
"head_indices": {"A": [12]},
492+
"tail_indices": {"A": [4, 10]},
493+
},
482494
}

0 commit comments

Comments
 (0)