@@ -294,52 +294,56 @@ def test_intra__h_migration(self):
294294
295295 def test_surface_dissociation_charge_separation (self ):
296296 """
297- Test that the Surface_Dissociation_Charge_Separation family returns a
298- properly re-labeled product structure.
299- This family is its own reverse .
297+ Test that the Surface_Dissociation_Charge_Separation family identifies
298+ reatants and labels them and reacts them properly, and check that the
299+ products are reacted to form the reactants again .
300300 """
301301 family = self .database .families ["Surface_Dissociation_Charge_Separation" ]
302- reactants = [
302+ expected_reactants = [
303303 Molecule ().from_adjacency_list (
304304 """
305- 1 *3 X u0 p0 c0 {2,S}
306- 2 *1 N u0 p0 c+1 {1,S} {3,D} {4,S}
305+ 1 X u0 p0 c0 {2,S}
306+ 2 N u0 p0 c+1 {1,S} {3,D} {4,S}
3073073 O u0 p2 c0 {2,D}
308- 4 *2 O u0 p3 c-1 {2,S}
308+ 4 O u0 p3 c-1 {2,S}
309309 """
310310 ),
311- Molecule ().from_adjacency_list ("1 *4 X u0 p0 c0" ),
311+ Molecule ().from_adjacency_list ("1 X u0 p0 c0" ),
312312 ]
313313 expected_products = [
314314 Molecule ().from_adjacency_list (
315315 """
316- 1 *3 X u0 p0 c0 {2,S}
317- 2 *1 N u0 p1 c0 {1,S} {3,D}
316+ 1 X u0 p0 c0 {2,S}
317+ 2 N u0 p1 c0 {1,S} {3,D}
3183183 O u0 p2 c0 {2,D}
319319 """
320320 ),
321321 Molecule ().from_adjacency_list (
322322 """
323- 1 *4 X u0 p0 c0 {2,D}
324- 2 *2 O u0 p2 c0 {1,D}
323+ 1 X u0 p0 c0 {2,D}
324+ 2 O u0 p2 c0 {1,D}
325325 """
326326 ),
327327 ]
328- products = family .apply_recipe (reactants )
329328
330- assert len (products ) == 2
329+ labeled_rxn = Reaction (reactants = expected_reactants , products = expected_products )
330+ family .add_atom_labels_for_reaction (labeled_rxn )
331331
332- mapping1 = {}
333- for label , atom in expected_products [0 ].get_all_labeled_atoms ().items ():
334- mapping1 [atom ] = products [0 ].get_labeled_atoms (label )[0 ]
332+ fam_products = family .apply_recipe ([m .molecule [0 ] for m in labeled_rxn .reactants ])
333+ assert len (fam_products ) == 2
334+ assert expected_products [0 ].is_isomorphic (fam_products [0 ])
335+ assert expected_products [1 ].is_isomorphic (fam_products [1 ])
335336
336- assert expected_products [0 ].is_isomorphic (products [0 ], mapping1 )
337+ fam_reactants = family .apply_recipe (fam_products , forward = False )
338+ assert len (fam_reactants ) == 2
339+ assert expected_reactants [0 ].is_isomorphic (fam_reactants [0 ])
340+ assert expected_reactants [1 ].is_isomorphic (fam_reactants [1 ])
337341
338- mapping2 = {}
339- for label , atom in expected_products [1 ].get_all_labeled_atoms ().items ():
340- mapping2 [atom ] = products [1 ].get_labeled_atoms (label )[0 ]
342+ fam_product_species = [Species (molecule = [p ]) for p in fam_products ]
343+ fam_reactant_species = [Species (molecule = [r ]) for r in fam_reactants ]
341344
342- assert expected_products [1 ].is_isomorphic (products [1 ], mapping2 )
345+ fam_rxn = Reaction (reactants = fam_reactant_species , products = fam_product_species )
346+ assert fam_rxn .is_isomorphic (labeled_rxn )
343347
344348 def test_h_abstraction (self ):
345349 """
0 commit comments