@@ -150,15 +150,17 @@ def show_3D_mapping(
150
150
molA = mapping .componentA .to_rdkit ()
151
151
molB = mapping .componentB .to_rdkit ()
152
152
153
- mblock1 = Chem .MolToMolBlock (_translate (molA , - 1 * shift ))
154
- mblock2 = Chem .MolToMolBlock (_translate (molB , shift ))
153
+ # 0 * shift is the centrepoint
154
+ # shift either side of the mapping +- a shift to clear the centre view
155
+ lmol = _translate (molA , - 1 * shift )
156
+ rmol = _translate (molB , + 1 * shift )
155
157
156
158
view = py3Dmol .view (width = 600 , height = 600 )
157
- view .addModel (mblock1 , "molA" )
158
- view .addModel (mblock2 , "molB" )
159
+ view .addModel (Chem . MolToMolBlock ( lmol ) , "molA" )
160
+ view .addModel (Chem . MolToMolBlock ( rmol ) , "molB" )
159
161
160
162
if spheres :
161
- _add_spheres (view , molA , molB , mapping .componentA_to_componentB )
163
+ _add_spheres (view , lmol , rmol , mapping .componentA_to_componentB )
162
164
163
165
if show_atomIDs :
164
166
view .addPropertyLabels (
@@ -174,11 +176,8 @@ def show_3D_mapping(
174
176
)
175
177
176
178
# middle fig
177
- overlay_mblock1 = Chem .MolToMolBlock (_translate (molA , 1 * shift ))
178
- overlay_mblock2 = Chem .MolToMolBlock (_translate (molB , - 1 * shift ))
179
-
180
- view .addModel (overlay_mblock1 , "molA_overlay" )
181
- view .addModel (overlay_mblock2 , "molB_overlay" )
179
+ view .addModel (Chem .MolToMolBlock (molA ), "molA_overlay" )
180
+ view .addModel (Chem .MolToMolBlock (molB ), "molB_overlay" )
182
181
183
182
view .setStyle ({style : {}})
184
183
0 commit comments