Example #1
0
    def test_d5h(self):
        atoms = ringhat(5, u)
        atoms = atoms[5:]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'D5h')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'C2v')
        self.assertTrue(geom.check_given_symm('C2v', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0], [1, 4], [2, 3], [5, 6]])

        atoms = ringhat(5, u)
        atoms = atoms[5:]
        atoms[1][0] = 'C1'
        gpname, orig, axes = geom.detect_symm(atoms, {'C':'ccpvdz','C1':'sto3g','N':'631g'})
        self.assertEqual(gpname, 'C2v')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'C2v')
        self.assertTrue(geom.check_given_symm('C2v', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0,2],[1],[3,4],[5,6]])
Example #2
0
    def test_detect_symm_c2h(self):
        atoms = [['H' , (1., 0., 2.)],
                 ['He', (0., 1., 0.)],
                 ['H' , (1., 0., 0.)],
                 ['H' , (-1.,0., 0.)],
                 ['H' , (-1.,0.,-2.)],
                 ['He', (0.,-1., 0.)]]
        l, orig, axes = geom.detect_symm(atoms)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(l, 'C2h')
        self.assertEqual(geom.symm_identical_atoms(l,atoms), [[0,4],[1,5],[2,3]])
        self.assertTrue(geom.check_given_symm('C2h', atoms))

        atoms = [['H' , (1., 0., 1.)],
                 ['H' , (1., 0.,-1.)],
                 ['He', (0., 0., 2.)],
                 ['He', (2., 0.,-2.)],
                 ['Li', (1., 1., 0.)],
                 ['Li', (1.,-1., 0.)]]
        l, orig, axes = geom.detect_symm(atoms)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(l, 'C2h')
        self.assertEqual(geom.symm_identical_atoms(l,atoms),
                         [[0, 1], [2, 3], [4, 5]])
        self.assertTrue(geom.check_given_symm('C2h', atoms))
Example #3
0
    def test_detect_symm_c2h(self):
        atoms = [['H' , (1., 0., 2.)],
                 ['He', (0., 1., 0.)],
                 ['H' , (1., 0., 0.)],
                 ['H' , (-1.,0., 0.)],
                 ['H' , (-1.,0.,-2.)],
                 ['He', (0.,-1., 0.)]]
        l, orig, axes = geom.detect_symm(atoms)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(l, 'C2h')
        self.assertEqual(geom.symm_identical_atoms(l,atoms), [[0,4],[1,5],[2,3]])
        self.assertTrue(geom.check_given_symm('C2h', atoms))

        atoms = [['H' , (1., 0., 1.)],
                 ['H' , (1., 0.,-1.)],
                 ['He', (0., 0., 2.)],
                 ['He', (2., 0.,-2.)],
                 ['Li', (1., 1., 0.)],
                 ['Li', (1.,-1., 0.)]]
        l, orig, axes = geom.detect_symm(atoms)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(l, 'C2h')
        self.assertEqual(geom.symm_identical_atoms(l,atoms),
                         [[0, 1], [2, 3], [4, 5]])
        self.assertTrue(geom.check_given_symm('C2h', atoms))
Example #4
0
    def test_d5h(self):
        atoms = ringhat(5, u)
        atoms = atoms[5:]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'D5h')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'C2v')
        self.assertTrue(geom.check_given_symm('C2v', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0], [1, 4], [2, 3], [5, 6]])

        atoms = ringhat(5, u)
        atoms = atoms[5:]
        atoms[1][0] = 'C1'
        gpname, orig, axes = geom.detect_symm(atoms, {
            'C': 'ccpvdz',
            'C1': 'sto3g',
            'N': '631g'
        })
        self.assertEqual(gpname, 'C2v')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'C2v')
        self.assertTrue(geom.check_given_symm('C2v', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 2], [1], [3, 4], [5, 6]])
Example #5
0
    def test_Coov(self):
        atoms = [['H', (0,0,0)], ['H', (0,0,-1)], ['H1', (0,0,1)]]
        basis = {'H':'sto3g', 'H1':'6-31g'}
        gpname, orig, axes = geom.detect_symm(atoms, basis)
        self.assertEqual(gpname, 'Coov')
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0], [1] ,[2]])

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Coov')
        self.assertTrue(geom.check_given_symm('Coov', atoms, basis))
        self.assertTrue(geom.check_given_symm('C2v', atoms, basis))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0], [1], [2]])
Example #6
0
    def test_Coov(self):
        atoms = [['H', (0, 0, 0)], ['H', (0, 0, -1)], ['H1', (0, 0, 1)]]
        basis = {'H': 'sto3g', 'H1': '6-31g'}
        gpname, orig, axes = geom.detect_symm(atoms, basis)
        self.assertEqual(gpname, 'Coov')
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0], [1], [2]])

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Coov')
        self.assertTrue(geom.check_given_symm('Coov', atoms, basis))
        self.assertTrue(geom.check_given_symm('C2v', atoms, basis))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0], [1], [2]])
Example #7
0
    def test_t(self):
        atoms = [['C', ( 1.0   ,-1.0   , 1.0   )],
                 ['O', ( 1.0-.1,-1.0+.2, 1.0   )],
                 ['O', ( 1.0   ,-1.0+.1, 1.0-.2)],
                 ['O', ( 1.0-.2,-1.0   , 1.0-.1)],
                 ['C', (-1.0   , 1.0   , 1.0   )],
                 ['O', (-1.0+.1, 1.0-.2, 1.0   )],
                 ['O', (-1.0   , 1.0-.1, 1.0-.2)],
                 ['O', (-1.0+.2, 1.0   , 1.0-.1)],
                 ['C', ( 1.0   , 1.0   ,-1.0   )],
                 ['O', ( 1.0-.2, 1.0   ,-1.0+.1)],
                 ['O', ( 1.0   , 1.0-.1,-1.0+.2)],
                 ['O', ( 1.0-.1, 1.0-.2,-1.0   )],
                 ['C', (-1.0   ,-1.0   ,-1.0   )],
                 ['O', (-1.0   ,-1.0+.1,-1.0+.2)],
                 ['O', (-1.0+.2,-1.0   ,-1.0+.1)],
                 ['O', (-1.0+.1,-1.0+.2,-1.0   )]]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'T')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'D2')
        self.assertTrue(geom.check_given_symm('D2', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 4, 8, 12], [1, 5, 11, 15],
                          [2, 6, 10, 13], [3, 7, 9, 14]])
Example #8
0
    def test_t(self):
        atoms = [['C', ( 1.0   ,-1.0   , 1.0   )],
                 ['O', ( 1.0-.1,-1.0+.2, 1.0   )],
                 ['O', ( 1.0   ,-1.0+.1, 1.0-.2)],
                 ['O', ( 1.0-.2,-1.0   , 1.0-.1)],
                 ['C', (-1.0   , 1.0   , 1.0   )],
                 ['O', (-1.0+.1, 1.0-.2, 1.0   )],
                 ['O', (-1.0   , 1.0-.1, 1.0-.2)],
                 ['O', (-1.0+.2, 1.0   , 1.0-.1)],
                 ['C', ( 1.0   , 1.0   ,-1.0   )],
                 ['O', ( 1.0-.2, 1.0   ,-1.0+.1)],
                 ['O', ( 1.0   , 1.0-.1,-1.0+.2)],
                 ['O', ( 1.0-.1, 1.0-.2,-1.0   )],
                 ['C', (-1.0   ,-1.0   ,-1.0   )],
                 ['O', (-1.0   ,-1.0+.1,-1.0+.2)],
                 ['O', (-1.0+.2,-1.0   ,-1.0+.1)],
                 ['O', (-1.0+.1,-1.0+.2,-1.0   )]]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'T')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'D2')
        self.assertTrue(geom.check_given_symm('D2', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 4, 8, 12], [1, 5, 11, 15],
                          [2, 6, 10, 13], [3, 7, 9, 14]])
Example #9
0
 def test_detect_symm_d2h_b(self):
     atoms = [['H', (1., 0., 2.)], ['He', (0., 1., 0.)],
              ['H', (-1., 0., -2.)], ['He', (0., -1., 0.)]]
     l, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(l, 'D2h')
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertTrue(geom.check_given_symm('D2h', atoms))
     self.assertEqual(geom.symm_identical_atoms(l, atoms), [[0, 2], [1, 3]])
Example #10
0
 def test_detect_symm_c1(self):
     atoms = [['H', (1., 0., 0.)], ['He', (0., 1., 0.)],
              ['Li', (0., 0., 1.)], ['Be', (.5, .5, .5)]]
     l, orig, axes = geom.detect_symm(atoms)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(l, 'C1')
     self.assertTrue(geom.check_given_symm('C1', atoms))
     self.assertEqual(geom.symm_identical_atoms(l, atoms),
                      [[0], [1], [2], [3]])
Example #11
0
 def test_d6h(self):
     atoms = ringhat(6, u)
     atoms = atoms[6:]
     gpname, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(gpname, 'D6h')
     gpname, axes = geom.subgroup(gpname, axes)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                      [[0, 3], [1, 2, 4, 5], [6, 7]])
     self.assertTrue(geom.check_given_symm('D2h', atoms))
Example #12
0
    def test_oh2(self):
        coords1 = numpy.dot(make8(1.5), u)
        atoms = [['C', c] for c in coords1]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'Oh')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'D2h')
        self.assertTrue(geom.check_given_symm('D2h', atoms))
Example #13
0
    def test_ih4(self):
        coords1 = make12(1.5)
        atoms = [['C', c] for c in coords1]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'Ih')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Ci')
        self.assertTrue(geom.check_given_symm('Ci', atoms))
Example #14
0
 def test_d6h(self):
     atoms = ringhat(6, u)
     atoms = atoms[6:]
     gpname, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(gpname, 'D6h')
     gpname, axes = geom.subgroup(gpname, axes)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                      [[0,3],[1,2,4,5],[6,7]])
     self.assertTrue(geom.check_given_symm('D2h', atoms))
Example #15
0
 def test_detect_symm_d2h_b(self):
     atoms = [['H' , (1., 0., 2.)],
              ['He', (0., 1., 0.)],
              ['H' , (-1.,0.,-2.)],
              ['He', (0.,-1., 0.)]]
     l, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(l, 'D2h')
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertTrue(geom.check_given_symm('D2h', atoms))
     self.assertEqual(geom.symm_identical_atoms(l,atoms), [[0,2],[1,3]])
Example #16
0
    def test_oh2(self):
        coords1 = numpy.dot(make8(1.5), u)
        atoms = [['C', c] for c in coords1]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'Oh')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'D2h')
        self.assertTrue(geom.check_given_symm('D2h', atoms))
Example #17
0
 def test_detect_symm_d2_a(self):
     atoms = [['H', (1., 0., 1.)], ['H', (1., 0., -1.)],
              ['He', (0., 0., 2.)], ['He', (2., 0., 2.)],
              ['He', (1., 1., -2.)], ['He', (1., -1., -2.)]]
     l, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(l, 'D2d')
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertTrue(geom.check_given_symm('D2', atoms))
     self.assertEqual(geom.symm_identical_atoms('D2', atoms),
                      [[0, 1], [2, 3, 4, 5]])
Example #18
0
    def test_ih4(self):
        coords1 = make12(1.5)
        atoms = [['C', c] for c in coords1]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'Ih')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Ci')
        self.assertTrue(geom.check_given_symm('Ci', atoms))
Example #19
0
 def test_td1(self):
     coords1 = numpy.dot(make4(1.5), u)
     atoms = [['C', c] for c in coords1]
     gpname, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(gpname, 'Td')
     gpname, axes = geom.subgroup(gpname, axes)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(gpname, 'D2')
     self.assertTrue(geom.check_given_symm('D2', atoms))
     self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                      [[0, 1, 2, 3]])
Example #20
0
    def test_c5h(self):
        atoms = ringhat(5, u)
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'C5h')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Cs')
        self.assertTrue(geom.check_given_symm('Cs', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10,11]])
Example #21
0
    def test_c5h(self):
        atoms = ringhat(5, u)
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'C5h')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Cs')
        self.assertTrue(geom.check_given_symm('Cs', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10,11]])
Example #22
0
    def test_c5v(self):
        atoms = ringhat(5, u)[5:-1]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'C5v')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Cs')
        self.assertTrue(geom.check_given_symm('Cs', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 1], [2, 4], [3], [5]])
Example #23
0
    def test_ih2(self):
        coords1 = numpy.dot(make60(1.5, 3), u)
        coords2 = numpy.dot(make12(1.1), u)
        atoms = [['C', c] for c in coords1] + [['C', c] for c in coords2]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'Ih')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Ci')
        self.assertTrue(geom.check_given_symm('Ci', atoms))
Example #24
0
 def test_td1(self):
     coords1 = numpy.dot(make4(1.5), u)
     atoms = [['C', c] for c in coords1]
     gpname, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(gpname, 'Td')
     gpname, axes = geom.subgroup(gpname, axes)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(gpname, 'D2')
     self.assertTrue(geom.check_given_symm('D2', atoms))
     self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                      [[0, 1, 2, 3]])
Example #25
0
 def test_detect_symm_ci(self):
     atoms = [['H', (1., 0., 0.)], ['He', (0., 1., 0.)],
              ['Li', (0., 0., 1.)], ['Be', (.5, .5, .5)],
              ['H', (-1., 0., 0.)], ['He', (0., -1., 0.)],
              ['Li', (0., 0., -1.)], ['Be', (-.5, -.5, -.5)]]
     l, orig, axes = geom.detect_symm(atoms)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(l, 'Ci')
     self.assertTrue(geom.check_given_symm('Ci', atoms))
     self.assertEqual(geom.symm_identical_atoms(l, atoms),
                      [[0, 4], [1, 5], [2, 6], [3, 7]])
Example #26
0
    def test_ih2(self):
        coords1 = numpy.dot(make60(1.5, 3), u)
        coords2 = numpy.dot(make12(1.1), u)
        atoms = [['C', c] for c in coords1] + [['C', c] for c in coords2]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'Ih')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Ci')
        self.assertTrue(geom.check_given_symm('Ci', atoms))
Example #27
0
 def test_detect_symm_d2_b(self):
     s2 = numpy.sqrt(.5)
     atoms = [['C', (0., 0., 1.)], ['C', (0., 0., -1.)], ['H', (1, 0., 2.)],
              ['H', (-1, 0., 2.)], ['H', (s2, s2, -2.)],
              ['H', (-s2, -s2, -2.)]]
     l, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(l, 'D2')
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertTrue(geom.check_given_symm('D2', atoms))
     self.assertEqual(geom.symm_identical_atoms(l, atoms),
                      [[0, 1], [2, 3, 4, 5]])
Example #28
0
    def test_c5v(self):
        atoms = ringhat(5, u)[5:-1]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'C5v')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Cs')
        self.assertTrue(geom.check_given_symm('Cs', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 4], [1, 3], [2], [5]])
Example #29
0
 def test_detect_symm_c1(self):
     atoms = [['H' , ( 1., 0., 0.)],
              ['He', ( 0., 1., 0.)],
              ['Li', ( 0., 0., 1.)],
              ['Be', ( .5, .5, .5)]]
     l, orig, axes = geom.detect_symm(atoms)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(l, 'C1')
     self.assertTrue(geom.check_given_symm('C1', atoms))
     self.assertEqual(geom.symm_identical_atoms(l,atoms),
                      [[0], [1], [2], [3]])
Example #30
0
 def test_s4(self):
     atoms = [['C', (0.5, 0, 1)], ['O', (0.4, 0.2, 1)], ['C', (-0.5, 0, 1)],
              ['O', (-0.4, -0.2, 1)], ['C', (0, 0.5, -1)],
              ['O', (-0.2, 0.4, -1)], ['C', (0, -0.5, -1)],
              ['O', (0.2, -0.4, -1)]]
     gpname, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(gpname, 'S4')
     gpname, axes = geom.subgroup(gpname, axes)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                      [[0, 2], [1, 3], [4, 6], [5, 7]])
     self.assertTrue(geom.check_given_symm('C2', atoms))
Example #31
0
 def test_detect_symm_cs3(self):
     atoms = [['H', (2., 1., 0.)], ['He', (0., 1., 0.)],
              ['Li', (-1., 2., 0.)], ['Be', (1., 0., 0.)],
              ['S', (.5, 1., -3)], ['S', (.5, 1., 3)]]
     coord = numpy.dot([a[1] for a in atoms], u)
     atoms = [[atoms[i][0], c] for i, c in enumerate(coord)]
     l, orig, axes = geom.detect_symm(atoms)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(l, 'Cs')
     self.assertTrue(geom.check_given_symm('Cs', atoms))
     self.assertEqual(geom.symm_identical_atoms(l, atoms),
                      [[0], [1], [2], [3], [4, 5]])
Example #32
0
 def test_c2v(self):
     atoms = ringhat(6, u)
     atoms = atoms[6:]
     atoms[1][0] = 'C1'
     atoms[2][0] = 'C1'
     basis = {'C': 'sto3g', 'N': 'sto3g', 'C1': 'ccpvdz'}
     gpname, orig, axes = geom.detect_symm(atoms, basis)
     self.assertEqual(gpname, 'C2v')
     gpname, axes = geom.subgroup(gpname, axes)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                      [[0, 3], [1, 2], [4, 5], [6, 7]])
     self.assertTrue(geom.check_given_symm('C2', atoms, basis))
Example #33
0
    def test_td2(self):
        coords1 = make4(1.5)
        coords2 = make4(1.9)
        atoms = [['C', c] for c in coords1] + [['C', c] for c in coords2]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'Td')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'D2')
        self.assertTrue(geom.check_given_symm('D2', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 1, 2, 3], [4, 5, 6, 7]])
Example #34
0
 def test_c2v(self):
     atoms = ringhat(6, u)
     atoms = atoms[6:]
     atoms[1][0] = 'C1'
     atoms[2][0] = 'C1'
     basis = {'C': 'sto3g', 'N':'sto3g', 'C1':'ccpvdz'}
     gpname, orig, axes = geom.detect_symm(atoms, basis)
     self.assertEqual(gpname, 'C2v')
     gpname, axes = geom.subgroup(gpname, axes)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                      [[0, 3], [1, 2], [4, 5], [6, 7]])
     self.assertTrue(geom.check_given_symm('C2', atoms, basis))
Example #35
0
 def test_detect_symm_d2_a(self):
     atoms = [['H' , (1., 0., 1.)],
              ['H' , (1., 0.,-1.)],
              ['He', (0., 0., 2.)],
              ['He', (2., 0., 2.)],
              ['He', (1., 1.,-2.)],
              ['He', (1.,-1.,-2.)]]
     l, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(l, 'D2')
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertTrue(geom.check_given_symm('D2', atoms))
     self.assertEqual(geom.symm_identical_atoms(l,atoms),
                      [[0, 1], [2, 3, 4, 5]])
Example #36
0
    def test_td2(self):
        coords1 = make4(1.5)
        coords2 = make4(1.9)
        atoms = [['C', c] for c in coords1] + [['C', c] for c in coords2]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'Td')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'C2v')
        self.assertTrue(geom.check_given_symm('C2v', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 1], [2, 3], [4, 5], [6, 7]])
Example #37
0
 def test_detect_symm_d2_b(self):
     s2 = numpy.sqrt(.5)
     atoms = [['C', (0., 0., 1.)],
              ['C', (0., 0.,-1.)],
              ['H', ( 1, 0., 2.)],
              ['H', (-1, 0., 2.)],
              ['H', ( s2, s2,-2.)],
              ['H', (-s2,-s2,-2.)]]
     l, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(l, 'D2')
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertTrue(geom.check_given_symm('D2', atoms))
     self.assertEqual(geom.symm_identical_atoms(l,atoms),
                      [[0, 1], [2, 3, 4, 5]])
Example #38
0
    def test_c3v(self):
        coords1 = numpy.dot(make4(1.5), u)
        coords2 = numpy.dot(make4(1.9), u)
        atoms = [['C', c] for c in coords1] + [['C', c] for c in coords2]
        atoms[2][0] = 'C1'
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'C3v')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Cs')
        self.assertTrue(geom.check_given_symm('Cs', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 1], [2], [3], [4, 5], [6], [7]])
Example #39
0
    def test_td3(self):
        coords1 = make4(1.5)
        coords2 = make4(1.9)
        atoms = [['C', c] for c in coords1] + [['C', c] for c in coords2]
        atoms[2][0] = 'C1'
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'C3v')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Cs')
        self.assertTrue(geom.check_given_symm('Cs', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0], [1, 3], [2], [4], [5, 7], [6]])
Example #40
0
    def test_c3v(self):
        coords1 = numpy.dot(make4(1.5), u)
        coords2 = numpy.dot(make4(1.9), u)
        atoms = [['C', c] for c in coords1] + [['C', c] for c in coords2]
        atoms[2][0] = 'C1'
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'C3v')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Cs')
        self.assertTrue(geom.check_given_symm('Cs', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 3], [1], [2], [4, 7], [5], [6]])
Example #41
0
 def test_detect_symm_s4(self):
     atoms = [['H', (-1,-1.,-2.)],
              ['H', ( 1, 1.,-2.)],
              ['C', (-.9,-1.,-2.)],
              ['C', (.9, 1.,-2.)],
              ['H', ( 1,-1., 2.)],
              ['H', (-1, 1., 2.)],
              ['C', ( 1,-.9, 2.)],
              ['C', (-1, .9, 2.)],]
     l, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(l, 'S4')
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertTrue(geom.check_given_symm('C2', atoms))
     self.assertEqual(geom.symm_identical_atoms('C2',atoms),
                      [[0, 1], [2, 3], [4, 5], [6, 7]])
Example #42
0
    def test_d5d(self):
        coord1 = ring(5)
        coord2 = ring(5, numpy.pi/5)
        coord1[:,2] = 1
        coord2[:,2] =-1
        atoms = [['H', c] for c in numpy.vstack((coord1,coord2))]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'D5d')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'C2h')
        self.assertTrue(geom.check_given_symm('C2h', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 3, 5, 7], [1, 2, 8, 9], [4, 6]])
Example #43
0
    def test_d5d(self):
        coord1 = ring(5)
        coord2 = ring(5, numpy.pi / 5)
        coord1[:, 2] = 1
        coord2[:, 2] = -1
        atoms = [['H', c] for c in numpy.vstack((coord1, coord2))]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'D5d')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'C2h')
        self.assertTrue(geom.check_given_symm('C2h', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 3, 5, 7], [1, 2, 8, 9], [4, 6]])
Example #44
0
 def test_detect_symm_s4(self):
     atoms = [['H', (-1,-1.,-2.)],
              ['H', ( 1, 1.,-2.)],
              ['C', (-.9,-1.,-2.)],
              ['C', (.9, 1.,-2.)],
              ['H', ( 1,-1., 2.)],
              ['H', (-1, 1., 2.)],
              ['C', ( 1,-.9, 2.)],
              ['C', (-1, .9, 2.)],]
     l, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(l, 'S4')
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertTrue(geom.check_given_symm('C2', atoms))
     self.assertEqual(geom.symm_identical_atoms('C2',atoms),
                      [[0, 1], [2, 3], [4, 5], [6, 7]])
Example #45
0
 def test_detect_symm_ci(self):
     atoms = [['H' , ( 1., 0., 0.)],
              ['He', ( 0., 1., 0.)],
              ['Li', ( 0., 0., 1.)],
              ['Be', ( .5, .5, .5)],
              ['H' , (-1., 0., 0.)],
              ['He', ( 0.,-1., 0.)],
              ['Li', ( 0., 0.,-1.)],
              ['Be', (-.5,-.5,-.5)]]
     l, orig, axes = geom.detect_symm(atoms)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(l, 'Ci')
     self.assertTrue(geom.check_given_symm('Ci', atoms))
     self.assertEqual(geom.symm_identical_atoms(l,atoms),
                      [[0, 4], [1, 5], [2, 6], [3, 7]])
Example #46
0
 def test_detect_symm_cs3(self):
     atoms = [['H' , ( 2.,1., 0.)],
              ['He', ( 0.,1., 0.)],
              ['Li', (-1.,2., 0.)],
              ['Be', ( 1.,0., 0.)],
              ['S' , ( .5,1., -3)],
              ['S' , ( .5,1.,  3)]]
     coord = numpy.dot([a[1] for a in atoms], u)
     atoms = [[atoms[i][0], c] for i,c in enumerate(coord)]
     l, orig, axes = geom.detect_symm(atoms)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(l, 'Cs')
     self.assertTrue(geom.check_given_symm('Cs', atoms))
     self.assertEqual(geom.symm_identical_atoms(l,atoms),
                      [[0], [1], [2], [3], [4, 5]])
Example #47
0
 def test_s4(self):
     atoms = [['C', (  0.5,   0    ,   1)],
              ['O', (  0.4,   0.2  ,   1)],
              ['C', ( -0.5,   0    ,   1)],
              ['O', ( -0.4,  -0.2  ,   1)],
              ['C', (  0  ,   0.5  ,  -1)],
              ['O', ( -0.2,   0.4  ,  -1)],
              ['C', (  0  ,  -0.5  ,  -1)],
              ['O', (  0.2,  -0.4  ,  -1)]]
     gpname, orig, axes = geom.detect_symm(atoms)
     self.assertEqual(gpname, 'S4')
     gpname, axes = geom.subgroup(gpname, axes)
     atoms = geom.shift_atom(atoms, orig, axes)
     self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                      [[0, 2], [1, 3], [4, 6], [5, 7]])
     self.assertTrue(geom.check_given_symm('C2', atoms))
Example #48
0
    def test_ih1(self):
        coords = numpy.dot(make60(1.5, 1), u)
        atoms = [['C', c] for c in coords]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'Ih')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Ci')
        self.assertTrue(geom.check_given_symm('Ci', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 55], [1, 56], [2, 57], [3, 58], [4, 59],
                          [5, 30], [6, 31], [7, 32], [8, 33], [9, 34],
                          [10, 35], [11, 36], [12, 37], [13, 38], [14, 39],
                          [15, 40], [16, 41], [17, 42], [18, 43], [19, 44],
                          [20, 45], [21, 46], [22, 47], [23, 48], [24, 49],
                          [25, 50], [26, 51], [27, 52], [28, 53], [29, 54]])
Example #49
0
    def test_ih1(self):
        coords = make60(1.5, 1)
        atoms = [['C', c] for c in coords]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'Ih')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Cs')
        self.assertTrue(geom.check_given_symm('Cs', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0], [1, 4], [2, 3], [5], [6, 9], [7, 8], [10, 25],
                          [11, 29], [12, 28], [13, 27], [14, 26], [15, 20],
                          [16, 24], [17, 23], [18, 22], [19, 21], [30],
                          [31, 34], [32, 33], [35, 50], [36, 54], [37, 53],
                          [38, 52], [39, 51], [40, 45], [41, 49], [42, 48],
                          [43, 47], [44, 46], [55], [56, 59], [57, 58]])
Example #50
0
    def test_ih1(self):
        coords = numpy.dot(make60(1.5, 1), u)
        atoms = [['C', c] for c in coords]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'Ih')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'Ci')
        self.assertTrue(geom.check_given_symm('Ci', atoms))
        self.assertEqual(
            geom.symm_identical_atoms(gpname, atoms),
            [[0, 55], [1, 56], [2, 57], [3, 58], [4, 59], [5, 30], [6, 31],
             [7, 32], [8, 33], [9, 34], [10, 35], [11, 36], [12, 37], [13, 38],
             [14, 39], [15, 40], [16, 41], [17, 42], [18, 43], [19, 44],
             [20, 45], [21, 46], [22, 47], [23, 48], [24, 49], [25, 50],
             [26, 51], [27, 52], [28, 53], [29, 54]])
Example #51
0
    def test_th(self):
        atoms = [['C', ( 1.0   ,-1.0   , 1.0   )],
                 ['O', ( 1.0-.1,-1.0+.2, 1.0   )],
                 ['O', ( 1.0   ,-1.0+.1, 1.0-.2)],
                 ['O', ( 1.0-.2,-1.0   , 1.0-.1)],
                 ['C', ( 1.0   , 1.0   , 1.0   )],
                 ['O', ( 1.0-.1, 1.0-.2, 1.0   )],
                 ['O', ( 1.0   , 1.0-.1, 1.0-.2)],
                 ['O', ( 1.0-.2, 1.0   , 1.0-.1)],
                 ['C', (-1.0   , 1.0   , 1.0   )],
                 ['O', (-1.0+.1, 1.0-.2, 1.0   )],
                 ['O', (-1.0   , 1.0-.1, 1.0-.2)],
                 ['O', (-1.0+.2, 1.0   , 1.0-.1)],
                 ['C', (-1.0   ,-1.0   , 1.0   )],
                 ['O', (-1.0+.1,-1.0+.2, 1.0   )],
                 ['O', (-1.0   ,-1.0+.1, 1.0-.2)],
                 ['O', (-1.0+.2,-1.0   , 1.0-.1)],
                 ['C', ( 1.0   ,-1.0   ,-1.0   )],
                 ['O', ( 1.0-.2,-1.0   ,-1.0+.1)],
                 ['O', ( 1.0   ,-1.0+.1,-1.0+.2)],
                 ['O', ( 1.0-.1,-1.0+.2,-1.0   )],
                 ['C', ( 1.0   , 1.0   ,-1.0   )],
                 ['O', ( 1.0-.2, 1.0   ,-1.0+.1)],
                 ['O', ( 1.0   , 1.0-.1,-1.0+.2)],
                 ['O', ( 1.0-.1, 1.0-.2,-1.0   )],
                 ['C', (-1.0   , 1.0   ,-1.0   )],
                 ['O', (-1.0+.2, 1.0   ,-1.0+.1)],
                 ['O', (-1.0   , 1.0-.1,-1.0+.2)],
                 ['O', (-1.0+.1, 1.0-.2,-1.0   )],
                 ['C', (-1.0   ,-1.0   ,-1.0   )],
                 ['O', (-1.0   ,-1.0+.1,-1.0+.2)],
                 ['O', (-1.0+.2,-1.0   ,-1.0+.1)],
                 ['O', (-1.0+.1,-1.0+.2,-1.0   )]]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'Th')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'D2')
        self.assertTrue(geom.check_given_symm('D2', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 8, 20, 28], [1, 9, 23, 31],
                          [2, 10, 22, 29], [3, 11, 21, 30],
                          [4, 12, 16, 24], [5, 13, 19, 27],
                          [6, 14, 18, 26], [7, 15, 17, 25]])
Example #52
0
    def test_th(self):
        atoms = [['C', ( 1.0   ,-1.0   , 1.0   )],
                 ['O', ( 1.0-.1,-1.0+.2, 1.0   )],
                 ['O', ( 1.0   ,-1.0+.1, 1.0-.2)],
                 ['O', ( 1.0-.2,-1.0   , 1.0-.1)],
                 ['C', ( 1.0   , 1.0   , 1.0   )],
                 ['O', ( 1.0-.1, 1.0-.2, 1.0   )],
                 ['O', ( 1.0   , 1.0-.1, 1.0-.2)],
                 ['O', ( 1.0-.2, 1.0   , 1.0-.1)],
                 ['C', (-1.0   , 1.0   , 1.0   )],
                 ['O', (-1.0+.1, 1.0-.2, 1.0   )],
                 ['O', (-1.0   , 1.0-.1, 1.0-.2)],
                 ['O', (-1.0+.2, 1.0   , 1.0-.1)],
                 ['C', (-1.0   ,-1.0   , 1.0   )],
                 ['O', (-1.0+.1,-1.0+.2, 1.0   )],
                 ['O', (-1.0   ,-1.0+.1, 1.0-.2)],
                 ['O', (-1.0+.2,-1.0   , 1.0-.1)],
                 ['C', ( 1.0   ,-1.0   ,-1.0   )],
                 ['O', ( 1.0-.2,-1.0   ,-1.0+.1)],
                 ['O', ( 1.0   ,-1.0+.1,-1.0+.2)],
                 ['O', ( 1.0-.1,-1.0+.2,-1.0   )],
                 ['C', ( 1.0   , 1.0   ,-1.0   )],
                 ['O', ( 1.0-.2, 1.0   ,-1.0+.1)],
                 ['O', ( 1.0   , 1.0-.1,-1.0+.2)],
                 ['O', ( 1.0-.1, 1.0-.2,-1.0   )],
                 ['C', (-1.0   , 1.0   ,-1.0   )],
                 ['O', (-1.0+.2, 1.0   ,-1.0+.1)],
                 ['O', (-1.0   , 1.0-.1,-1.0+.2)],
                 ['O', (-1.0+.1, 1.0-.2,-1.0   )],
                 ['C', (-1.0   ,-1.0   ,-1.0   )],
                 ['O', (-1.0   ,-1.0+.1,-1.0+.2)],
                 ['O', (-1.0+.2,-1.0   ,-1.0+.1)],
                 ['O', (-1.0+.1,-1.0+.2,-1.0   )]]
        gpname, orig, axes = geom.detect_symm(atoms)
        self.assertEqual(gpname, 'Th')

        gpname, axes = geom.subgroup(gpname, axes)
        atoms = geom.shift_atom(atoms, orig, axes)
        self.assertEqual(gpname, 'D2')
        self.assertTrue(geom.check_given_symm('D2', atoms))
        self.assertEqual(geom.symm_identical_atoms(gpname, atoms),
                         [[0, 8, 20, 28], [1, 9, 23, 31],
                          [2, 10, 22, 29], [3, 11, 21, 30],
                          [4, 12, 16, 24], [5, 13, 19, 27],
                          [6, 14, 18, 26], [7, 15, 17, 25]])