13
13
14
14
15
15
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 ,
23
23
):
24
24
# TODO
25
25
# 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." )
30
32
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" ]
34
36
if not ref_distance :
35
37
ref_distance = 1
36
38
cg_snap = snapshot
@@ -47,11 +49,11 @@ def backmap_snapshot_to_compound(
47
49
for mapping in bead_mapping :
48
50
comp = mb .load (bead_mapping [mapping ], smiles = True )
49
51
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 :
55
57
extra_tail_particles = []
56
58
extra_tail_particles = bond_tail_index [mapping ][1 :]
57
59
for k in extra_tail_particles :
@@ -136,8 +138,8 @@ def backmap_snapshot_to_compound(
136
138
temp_head = temp_comp .children [1 ]
137
139
tail_comp .xyz = temp_tail .xyz
138
140
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)"""
141
143
return fg_compound
142
144
143
145
0 commit comments