コード例 #1
0
    def testAtomSymmetryNumberEthanewithDeuteriumTritium(self):
        """
        Test the Molecule.calculateAtomSymmetryNumber() on CC(D)(T)

        This is meant to test whether chirality is accounted for, which
        should half the symmetry term.

        The total number is 1.5 because the methyl group contributes *3 and
        the chiral center contributes *0.5
        """
        molecule = Molecule().fromAdjacencyList(
"""
1 C u0 p0 c0 {2,S} {3,S} {4,S} {5,S}
2 C u0 p0 c0 {1,S} {6,S} {7,S} {8,S}
3 D u0 p0 c0 {1,S}
4 T u0 p0 c0 {1,S}
5 H u0 p0 c0 {1,S}
6 H u0 p0 c0 {2,S}
7 H u0 p0 c0 {2,S}
8 H u0 p0 c0 {2,S}

""")
        symmetryNumber = 1
        for atom in molecule.atoms:
            if not molecule.isAtomInCycle(atom):
                symmetryNumber *= calculateAtomSymmetryNumber(molecule, atom)
        self.assertAlmostEqual(symmetryNumber, 1.5)
コード例 #2
0
    def testAtomSymmetryNumberEthanewithDeuteriumTritium(self):
        """
        Test the Molecule.calculateAtomSymmetryNumber() on CC(D)(T)

        This is meant to test whether chirality is accounted for, which
        should half the symmetry term.

        The total number is 1.5 because the methyl group contributes *3 and
        the chiral center contributes *0.5
        """
        molecule = Molecule().fromAdjacencyList("""
1 C u0 p0 c0 {2,S} {3,S} {4,S} {5,S}
2 C u0 p0 c0 {1,S} {6,S} {7,S} {8,S}
3 D u0 p0 c0 {1,S}
4 T u0 p0 c0 {1,S}
5 H u0 p0 c0 {1,S}
6 H u0 p0 c0 {2,S}
7 H u0 p0 c0 {2,S}
8 H u0 p0 c0 {2,S}

""")
        symmetryNumber = 1
        for atom in molecule.atoms:
            if not molecule.isAtomInCycle(atom):
                symmetryNumber *= calculateAtomSymmetryNumber(molecule, atom)
        self.assertAlmostEqual(symmetryNumber, 1.5)
コード例 #3
0
ファイル: moleculeTest.py プロジェクト: comocheng/RMG-Py
 def testIsInCycleCyclohexane(self):
     """
     Test the Molecule.isInCycle() method with ethane.
     """
     molecule = Molecule().fromInChI('InChI=1/C6H12/c1-2-4-6-5-3-1/h1-6H2')
     for atom in molecule.atoms:
         if atom.isHydrogen():
             self.assertFalse(molecule.isAtomInCycle(atom))
         elif atom.isCarbon():
             self.assertTrue(molecule.isAtomInCycle(atom))
     for atom1 in molecule.atoms:
         for atom2, bond in atom1.bonds.items():
             if atom1.isCarbon() and atom2.isCarbon():
                 self.assertTrue(molecule.isBondInCycle(bond))
             else:
                 self.assertFalse(molecule.isBondInCycle(bond))
コード例 #4
0
 def testIsInCycleCyclohexane(self):
     """
     Test the Molecule.isInCycle() method with ethane.
     """
     molecule = Molecule().fromInChI('InChI=1/C6H12/c1-2-4-6-5-3-1/h1-6H2')
     for atom in molecule.atoms:
         if atom.isHydrogen():
             self.assertFalse(molecule.isAtomInCycle(atom))
         elif atom.isCarbon():
             self.assertTrue(molecule.isAtomInCycle(atom))
     for atom1 in molecule.atoms:
         for atom2, bond in atom1.bonds.items():
             if atom1.isCarbon() and atom2.isCarbon():
                 self.assertTrue(molecule.isBondInCycle(bond))
             else:
                 self.assertFalse(molecule.isBondInCycle(bond))
コード例 #5
0
 def testAtomSymmetryNumberEthane(self):
     """
     Test the Molecule.calculateAtomSymmetryNumber() on CC
     """
     molecule = Molecule().fromSMILES('CC')
     symmetryNumber = 1
     for atom in molecule.atoms:
         if not molecule.isAtomInCycle(atom):
             symmetryNumber *= calculateAtomSymmetryNumber(molecule, atom)
     self.assertEqual(symmetryNumber, 9)
コード例 #6
0
 def testAtomSymmetryNumberMethyl(self):
     """
     Test the Molecule.calculateAtomSymmetryNumber() on [CH3]
     """
     molecule = Molecule().fromSMILES('[CH3]')
     symmetryNumber = 1
     for atom in molecule.atoms:
         if not molecule.isAtomInCycle(atom):
             symmetryNumber *= calculateAtomSymmetryNumber(molecule, atom)
     self.assertEqual(symmetryNumber, 6)
コード例 #7
0
ファイル: symmetryTest.py プロジェクト: yplitw/RMG-Py
 def testAtomSymmetryNumberIsobutane(self):
     """
     Test the Molecule.calculateAtomSymmetryNumber() on CC(C)C
     """
     molecule = Molecule().fromSMILES('CC(C)C')
     symmetryNumber = 1
     for atom in molecule.atoms:
         if not molecule.isAtomInCycle(atom):
             symmetryNumber *= calculateAtomSymmetryNumber(molecule, atom)
     self.assertEqual(symmetryNumber, 81)
コード例 #8
0
ファイル: symmetryTest.py プロジェクト: yplitw/RMG-Py
 def testAtomSymmetryNumberMethyl(self):
     """
     Test the Molecule.calculateAtomSymmetryNumber() on [CH3]
     """
     molecule = Molecule().fromSMILES('[CH3]')
     symmetryNumber = 1
     for atom in molecule.atoms:
         if not molecule.isAtomInCycle(atom):
             symmetryNumber *= calculateAtomSymmetryNumber(molecule, atom)
     self.assertEqual(symmetryNumber, 6)
コード例 #9
0
ファイル: moleculeTest.py プロジェクト: comocheng/RMG-Py
 def testIsInCycleEthane(self):
     """
     Test the Molecule.isInCycle() method with ethane.
     """
     molecule = Molecule().fromSMILES('CC')
     for atom in molecule.atoms:
         self.assertFalse(molecule.isAtomInCycle(atom))
     for atom1 in molecule.atoms:
         for atom2, bond in atom1.bonds.items():
             self.assertFalse(molecule.isBondInCycle(bond))
コード例 #10
0
 def testIsInCycleEthane(self):
     """
     Test the Molecule.isInCycle() method with ethane.
     """
     molecule = Molecule().fromSMILES('CC')
     for atom in molecule.atoms:
         self.assertFalse(molecule.isAtomInCycle(atom))
     for atom1 in molecule.atoms:
         for atom2, bond in atom1.bonds.items():
             self.assertFalse(molecule.isBondInCycle(bond))
コード例 #11
0
    def testAtomSymmetryNumberWithTwoChiralCenters(self):
        """
        Test the Molecule.calculateAtomSymmetryNumber() on [CH2]CC([CH2])C(C)C=C

        This is meant to test whether chirality is accounted for, which
        should half the symmetry term.

        The molecule has one methyl group (*3), two CH2dot groups (*2 each), and
        two chiral centers (*0.5), leading to a total atom symmetry number of 3
        """
        molecule = Molecule().fromAdjacencyList(
"""
multiplicity 3
1  C u1 p0 c0 {2,S} {3,S} {4,S}
2  H u0 p0 c0 {1,S}
3  H u0 p0 c0 {1,S}
4  C u0 p0 c0 {1,S} {5,S} {13,S} {14,S}
5  C u0 p0 c0 {4,S} {6,S} {9,S} {15,S}
6  C u1 p0 c0 {5,S} {7,S} {8,S}
7  H u0 p0 c0 {6,S}
8  H u0 p0 c0 {6,S}
9  C u0 p0 c0 {5,S} {10,S} {11,S} {16,S}
10 C u0 p0 c0 {9,S} {17,S} {18,S} {19,S}
11 C u0 p0 c0 {9,S} {12,D} {20,S}
12 C u0 p0 c0 {11,D} {21,S} {22,S}
13 H u0 p0 c0 {4,S}
14 H u0 p0 c0 {4,S}
15 H u0 p0 c0 {5,S}
16 H u0 p0 c0 {9,S}
17 H u0 p0 c0 {10,S}
18 H u0 p0 c0 {10,S}
19 H u0 p0 c0 {10,S}
20 H u0 p0 c0 {11,S}
21 H u0 p0 c0 {12,S}
22 H u0 p0 c0 {12,S}
""")
        symmetryNumber = 1
        for atom in molecule.atoms:
            if not molecule.isAtomInCycle(atom):
                symmetryNumber *= calculateAtomSymmetryNumber(molecule, atom)
        self.assertAlmostEqual(symmetryNumber, 3)
コード例 #12
0
ファイル: symmetryTest.py プロジェクト: DrDew2/RMG-Py
    def testAtomSymmetryNumberWithTwoChiralCenters(self):
        """
        Test the Molecule.calculateAtomSymmetryNumber() on [CH2]CC([CH2])C(C)C=C

        This is meant to test whether chirality is accounted for, which
        should half the symmetry term.

        The molecule has one methyl group (*3), two CH2dot groups (*2 each), and
        two chiral centers (*0.5), leading to a total atom symmetry number of 3
        """
        molecule = Molecule().fromAdjacencyList(
"""
multiplicity 3
1  C u1 p0 c0 {2,S} {3,S} {4,S}
2  H u0 p0 c0 {1,S}
3  H u0 p0 c0 {1,S}
4  C u0 p0 c0 {1,S} {5,S} {13,S} {14,S}
5  C u0 p0 c0 {4,S} {6,S} {9,S} {15,S}
6  C u1 p0 c0 {5,S} {7,S} {8,S}
7  H u0 p0 c0 {6,S}
8  H u0 p0 c0 {6,S}
9  C u0 p0 c0 {5,S} {10,S} {11,S} {16,S}
10 C u0 p0 c0 {9,S} {17,S} {18,S} {19,S}
11 C u0 p0 c0 {9,S} {12,D} {20,S}
12 C u0 p0 c0 {11,D} {21,S} {22,S}
13 H u0 p0 c0 {4,S}
14 H u0 p0 c0 {4,S}
15 H u0 p0 c0 {5,S}
16 H u0 p0 c0 {9,S}
17 H u0 p0 c0 {10,S}
18 H u0 p0 c0 {10,S}
19 H u0 p0 c0 {10,S}
20 H u0 p0 c0 {11,S}
21 H u0 p0 c0 {12,S}
22 H u0 p0 c0 {12,S}
""")
        symmetryNumber = 1
        for atom in molecule.atoms:
            if not molecule.isAtomInCycle(atom):
                symmetryNumber *= calculateAtomSymmetryNumber(molecule, atom)
        self.assertAlmostEqual(symmetryNumber, 3)