@@ -4558,6 +4558,45 @@ def test_check_isomorphism(self):
45584558 mol2 = Molecule (smiles = '[N-]=[N+]=O' )
45594559 self .assertTrue (converter .check_isomorphism (mol1 , mol2 ))
45604560
4561+ def test_order_xyz_by_atom_map (self ):
4562+ """Test ordering xyz by atom map"""
4563+ xyz = {'symbols' : ('C' , 'H' , 'H' , 'H' , 'H' ),
4564+ 'isotopes' : (12 , 1 , 1 , 1 , 1 ),
4565+ 'coords' : ((0.0 , 0.0 , 0.0 ),
4566+ (0.6300326 , 0.6300326 , 0.6300326 ),
4567+ (- 0.6300326 , - 0.6300326 , 0.6300326 ),
4568+ (- 0.6300326 , 0.6300326 , - 0.6300326 ),
4569+ (0.6300326 , - 0.6300326 , - 0.6300326 ))}
4570+ atom_map = [4 , 3 , 1 , 2 , 0 ]
4571+ ordered_xyz = converter .order_xyz_by_atom_map (xyz , atom_map )
4572+ expected_xyz = {'symbols' : ('H' , 'H' , 'H' , 'H' , 'C' ),
4573+ 'isotopes' : (1 , 1 , 1 , 1 , 12 ),
4574+ 'coords' : ((0.6300326 , - 0.6300326 , - 0.6300326 ),
4575+ (- 0.6300326 , 0.6300326 , - 0.6300326 ),
4576+ (0.6300326 , 0.6300326 , 0.6300326 ),
4577+ (- 0.6300326 , - 0.6300326 , 0.6300326 ),
4578+ (0.0 , 0.0 , 0.0 ))}
4579+ self .assertEqual (ordered_xyz , expected_xyz )
4580+
4581+ xyz = {'symbols' : ('C' , 'C' , 'C' , 'H' , 'H' , 'H' , 'H' , 'H' , 'H' , 'H' ),
4582+ 'isotopes' : (12 , 12 , 12 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ),
4583+ 'coords' : ((- 0.4073569 , - 0.74240205 , - 0.34312948 ), (0.38155377 , - 0.25604705 , 0.82450968 ),
4584+ (0.54634593 , 1.25448345 , 0.81064511 ), (0.00637731 , - 1.58836501 , - 0.88041673 ),
4585+ (- 0.98617584 , - 0.01198912 , - 0.89732723 ), (- 1.29710684 , - 1.2909234 , 0.08598983 ),
4586+ (1.36955428 , - 0.72869684 , 0.81102246 ), (1.06044877 , 1.58846788 , - 0.09702437 ),
4587+ (1.13774084 , 1.57830484 , 1.67308862 ), (- 0.42424546 , 1.75989927 , 0.85794283 ))}
4588+ ordered_xyz = converter .order_xyz_by_atom_map (xyz , [0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ])
4589+ self .assertEqual (ordered_xyz , xyz )
4590+ expected_xyz = {'symbols' : ('H' , 'H' , 'H' , 'H' , 'H' , 'H' , 'H' , 'C' , 'C' , 'C' ),
4591+ 'isotopes' : (1 , 1 , 1 , 1 , 1 , 1 , 1 , 12 , 12 , 12 ),
4592+ 'coords' : ((- 0.42424546 , 1.75989927 , 0.85794283 ), (1.13774084 , 1.57830484 , 1.67308862 ),
4593+ (1.06044877 , 1.58846788 , - 0.09702437 ), (1.36955428 , - 0.72869684 , 0.81102246 ),
4594+ (- 1.29710684 , - 1.2909234 , 0.08598983 ), (- 0.98617584 , - 0.01198912 , - 0.89732723 ),
4595+ (0.00637731 , - 1.58836501 , - 0.88041673 ), (0.54634593 , 1.25448345 , 0.81064511 ),
4596+ (0.38155377 , - 0.25604705 , 0.82450968 ), (- 0.4073569 , - 0.74240205 , - 0.34312948 ))}
4597+ ordered_xyz = converter .order_xyz_by_atom_map (xyz , [9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0 ])
4598+ self .assertEqual (ordered_xyz , expected_xyz )
4599+
45614600 def test_cluster_confs_by_rmsd (self ):
45624601 nco_1 = {'symbols' : ('C' , 'H' , 'H' , 'O' , 'H' , 'N' , 'H' , 'H' ),
45634602 'isotopes' : (12 , 1 , 1 , 16 , 1 , 14 , 1 , 1 ),
0 commit comments