Skip to content

Commit 57efcc0

Browse files
committed
add unit tests for phosphorus atomtype
Unit test for phosphorus atomtype, test_phosphorus_types, is added. This tests all phosphorus atomtypes.
1 parent 3e5dcdf commit 57efcc0

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed

rmgpy/molecule/atomtypeTest.py

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,110 @@ def setUp(self):
506506
self.mol79 = Molecule().from_adjacency_list('''1 H u0 p0 c0 {2,S}
507507
2 Br u0 p3 c0 {1,S}''')
508508

509+
self.mol80 = Molecule().from_adjacency_list('''1 P u0 p3 c-2 {2,S}
510+
2 P u0 p0 c+1 {1,S} {3,T}
511+
3 P u0 p0 c+1 {2,T} {4,S}
512+
4 H u0 p0 c0 {3,S}''')
513+
514+
self.mol81 = Molecule().from_adjacency_list('''1 P u0 p2 c0 {2,S}
515+
2 H u0 p0 c0 {1,S}''')
516+
517+
self.mol82 = Molecule().from_adjacency_list('''1 P u0 p2 c-1 {2,S} {3,S}
518+
2 H u0 p0 c0 {1,S}
519+
3 P u0 p0 c+1 {1,S} {4,T}
520+
4 C u0 p0 c0 {3,T} {5,S}
521+
5 H u0 p0 c0 {4,S}''')
522+
523+
self.mol83 = Molecule().from_adjacency_list('''1 H u0 p0 {3,S}
524+
2 H u0 p0 {3,S}
525+
3 P u0 p0 c+1 {1,S} {2,S} {4,D}
526+
4 P u0 p2 c-1 {3,D}''')
527+
528+
self.mol84 = Molecule().from_adjacency_list('''1 P u0 p1 c0 {4,S} {7,S} {8,S}
529+
2 P u0 p1 c0 {3,D} {4,S}
530+
3 O u0 p2 c0 {2,D}
531+
4 C u0 p0 c0 {1,S} {2,S} {5,S} {6,S}
532+
5 H u0 p0 c0 {4,S}
533+
6 H u0 p0 c0 {4,S}
534+
7 H u0 p0 c0 {1,S}
535+
8 H u0 p0 c0 {1,S}''')
536+
537+
self.mol85 = Molecule().from_adjacency_list('''1 P u0 p1 c0 {2,T}
538+
2 C u0 p0 c0 {1,T} {3,S}
539+
3 H u0 p0 c0 {2,S}''')
540+
541+
self.mol86 = Molecule().from_adjacency_list('''1 P u0 p0 c+1 {2,B} {6,B} {7,S}
542+
2 C u0 p0 {1,B} {3,B} {8,S}
543+
3 C u0 p0 {2,B} {4,B} {9,S}
544+
4 C u0 p0 {3,B} {5,B} {10,S}
545+
5 C u0 p0 {4,B} {6,B} {11,S}
546+
6 P u0 p1 {1,B} {5,B}
547+
7 O u0 p3 c-1 {1,S}
548+
8 H u0 p0 {2,S}
549+
9 H u0 p0 {3,S}
550+
10 H u0 p0 {4,S}
551+
11 H u0 p0 {5,S}''')
552+
553+
self.mol87 = Molecule().from_adjacency_list('''1 P u0 p0 c0 {2,S} {3,S} {4,S} {5,S} {6,S}
554+
2 Cl u0 p3 c0 {1,S}
555+
3 Cl u0 p3 c0 {1,S}
556+
4 Cl u0 p3 c0 {1,S}
557+
5 Cl u0 p3 c0 {1,S}
558+
6 Cl u0 p3 c0 {1,S}''')
559+
560+
self.mol88 = Molecule().from_adjacency_list('''1 P u0 p0 c+1 {2,S} {3,S} {4,S} {5,S}
561+
2 O u0 p2 c0 {1,S} {6,S}
562+
3 O u0 p3 c-1 {1,S}
563+
4 H u0 p0 c0 {1,S}
564+
5 H u0 p0 c0 {1,S}
565+
6 H u0 p0 c0 {2,S}''')
566+
567+
self.mol89 = Molecule().from_adjacency_list('''1 P u0 p0 c0 {2,S} {3,S} {4,S} {5,D}
568+
2 O u0 p2 c0 {1,S} {6,S}
569+
3 O u0 p2 c0 {1,S} {7,S}
570+
4 O u0 p2 c0 {1,S} {8,S}
571+
5 O u0 p2 c0 {1,D}
572+
6 H u0 p0 c0 {2,S}
573+
7 H u0 p0 c0 {3,S}
574+
8 H u0 p0 c0 {4,S}''')
575+
576+
self.mol90 = Molecule().from_adjacency_list('''1 P u0 p0 c0 {2,D} {3,D} {4,S}
577+
2 O u0 p2 c0 {1,D}
578+
3 O u0 p2 c0 {1,D}
579+
4 C u0 p0 c0 {1,S} {5,S} {6,S} {7,S}
580+
5 H u0 p0 c0 {4,S}
581+
6 H u0 p0 c0 {4,S}
582+
7 H u0 p0 c0 {4,S}''')
583+
584+
self.mol91 = Molecule().from_adjacency_list('''1 P u0 p0 c+1 {2,D} {3,D}
585+
2 N u0 p2 c-1 {1,D}
586+
3 C u0 p0 c0 {1,D} {4,S} {5,S}
587+
4 H u0 p0 c0 {3,S}
588+
5 H u0 p0 c0 {3,S}''')
589+
590+
self.mol92 = Molecule().from_adjacency_list('''1 P u0 p0 c0 {2,T} {3,S} {4,S}
591+
2 N u0 p1 c0 {1,T}
592+
3 Cl u0 p3 c0 {1,S}
593+
4 Cl u0 p3 c0 {1,S}''')
594+
595+
self.mol93 = Molecule().from_adjacency_list('''1 P u0 p0 c0 {2,D} {3,T}
596+
2 O u0 p2 c0 {1,D}
597+
3 C u0 p0 c0 {1,T} {4,S}
598+
4 H u0 p0 c0 {3,S}''')
599+
600+
self.mol94 = Molecule().from_adjacency_list('''1 P u0 p0 {2,B} {6,B} {7,D}
601+
2 C u0 p0 {1,B} {3,B} {8,S}
602+
3 C u0 p0 {2,B} {4,B} {9,S}
603+
4 C u0 p0 {3,B} {5,B} {10,S}
604+
5 C u0 p0 {4,B} {6,B} {11,S}
605+
6 C u0 p0 {1,B} {5,B} {12,S}
606+
7 S u0 p2 {1,D}
607+
8 H u0 p0 {2,S}
608+
9 H u0 p0 {3,S}
609+
10 H u0 p0 {4,S}
610+
11 H u0 p0 {5,S}
611+
12 H u0 p0 {6,S}''')
612+
509613
def atom_type(self, mol, atom_id):
510614
atom = mol.atoms[atom_id]
511615
atom_type = get_atomtype(atom, mol.get_bonds(atom))
@@ -590,6 +694,30 @@ def test_silicon_types(self):
590694
self.assertEqual(self.atom_type(self.mol4, 4), 'Sidd')
591695
self.assertEqual(self.atom_type(self.mol4, 7), 'Sit') # todo: add in Siq unit test?
592696

697+
def test_phosphorus_types(self):
698+
"""
699+
Test that get_atomtype() returns appropriate phosphorus atom types.
700+
"""
701+
self.assertEqual(self.atom_type(self.mol80, 0), 'P0sc')
702+
self.assertEqual(self.atom_type(self.mol81, 0), 'P1s')
703+
self.assertEqual(self.atom_type(self.mol82, 0), 'P1sc')
704+
self.assertEqual(self.atom_type(self.mol83, 3), 'P1dc')
705+
self.assertEqual(self.atom_type(self.mol84, 0), 'P3s')
706+
self.assertEqual(self.atom_type(self.mol84, 1), 'P3d')
707+
self.assertEqual(self.atom_type(self.mol85, 0), 'P3t')
708+
self.assertEqual(self.atom_type(self.mol86, 5), 'P3b')
709+
self.assertEqual(self.atom_type(self.mol87, 0), 'P5s')
710+
self.assertEqual(self.atom_type(self.mol88, 0), 'P5sc')
711+
self.assertEqual(self.atom_type(self.mol89, 0), 'P5d')
712+
self.assertEqual(self.atom_type(self.mol90, 0), 'P5dd')
713+
self.assertEqual(self.atom_type(self.mol83, 2), 'P5dc')
714+
self.assertEqual(self.atom_type(self.mol91, 0), 'P5ddc')
715+
self.assertEqual(self.atom_type(self.mol92, 0), 'P5t')
716+
self.assertEqual(self.atom_type(self.mol93, 0), 'P5td')
717+
self.assertEqual(self.atom_type(self.mol80, 1), 'P5tc')
718+
self.assertEqual(self.atom_type(self.mol86, 0), 'P5b')
719+
self.assertEqual(self.atom_type(self.mol94, 0), 'P5bd')
720+
593721
def test_sulfur_types(self):
594722
"""
595723
Test that get_atomtype() returns appropriate sulfur atom types.

0 commit comments

Comments
 (0)