Esempio n. 1
0
    def test_normal_modes(self):
        coordinates = [[0.00000, 0.0000000, -0.0808819],
                       [-1.43262, 0.0000000, -1.2823700],
                       [1.43262, 0.0000000, -1.2823700]]

        symbols = ['O', 'H', 'H']

        normal_modes = [
            [[0., 0., -0.075], [-0.381, -0., 0.593], [0.381, -0.,
                                                      0.593]],  # mode 1
            [[-0., -0., 0.044], [-0.613, -0., -0.35], [0.613, 0.,
                                                       -0.35]],  # mode 2
            [[-0.073, -0., -0.], [0.583, 0., 0.397], [0.583, 0., -0.397]]
        ]  # mode 3

        sym_modes_gs = SymmetryModes(group='c2v',
                                     coordinates=coordinates,
                                     modes=normal_modes,
                                     symbols=symbols)

        a1 = SymmetryBase(group='c2v', rep='A1')
        a2 = SymmetryBase(group='c2v', rep='A2')
        b1 = SymmetryBase(group='c2v', rep='B1')
        b2 = SymmetryBase(group='c2v', rep='B2')

        for i, ref in enumerate([a1, a1, b1]):
            nm = sym_modes_gs.get_state_mode(i)
            self.assertCountEqual(
                np.round(nm.get_ir_representation(), decimals=2),
                np.round(ref.get_ir_representation(), decimals=2))
Esempio n. 2
0
    def test_mo_symmetry(self):
        mo_sym = [
            SymmetryFunction('C2v', mo) for mo in self.molecular_orbitals
        ]
        # print(mo_sym)

        a1 = SymmetryBase(group='c2v', rep='A1')
        a2 = SymmetryBase(group='c2v', rep='A2')
        b1 = SymmetryBase(group='c2v', rep='B1')
        b2 = SymmetryBase(group='c2v', rep='B2')

        for mo, ref in zip(mo_sym, [a1, a1, b1, a1, b2, a1, b1]):
            self.assertCountEqual(
                np.round(mo.get_ir_representation(), decimals=6),
                np.round(ref.get_ir_representation(), decimals=6))
Esempio n. 3
0
def get_symmetry_wf(occupation_alpha, occupation_beta):
    state_wf = SymmetryBase(group='D2h', rep='Ag')
    for orbital_a, occupation in zip(molsym.mo_SOEVs_a, occupation_alpha):
        if abs(occupation) > 0.1:
            state_orb = SymmetryBase(group='D2h',
                                     rep=pd.Series(np.array(orbital_a),
                                                   index=[ "E", "C2", "C2'", "C2''", "sh", "i", "sv", "sd"]))
            state_wf = state_wf * state_orb
    for orbital_b, occupation in zip(molsym.mo_SOEVs_a, occupation_beta):
        if abs(occupation) > 0.1:
            state_orb = SymmetryBase(group='D2h',
                                     rep=pd.Series(np.array(orbital_b),
                                                   index=[ "E", "C2", "C2'", "C2''", "sh", "i", "sv", "sd"]))
            state_wf = state_wf * state_orb

    return state_wf
Esempio n. 4
0
    def test_algebra(self):

        a1 = SymmetryBase(group='Td', rep='A1')
        a2 = SymmetryBase(group='Td', rep='A2')
        e = SymmetryBase(group='Td', rep='E')
        t1 = SymmetryBase(group='Td', rep='T1')
        t2 = SymmetryBase(group='Td', rep='T2')

        prod_1 = e * e + 2 * a1
        result_1 = 3 * a1 + a2 + e

        prod_2 = t1 * t1
        result_2 = a1 + e + t1 + t2

        self.assertCountEqual(prod_1.get_ir_representation(),
                              result_1.get_ir_representation())
        self.assertCountEqual(prod_2.get_ir_representation(),
                              result_2.get_ir_representation())
Esempio n. 5
0
    def test_functions(self):

        a1 = SymmetryBase(group='Td', rep='A1')
        a2 = SymmetryBase(group='Td', rep='A2')
        e = SymmetryBase(group='Td', rep='E')
        t1 = SymmetryBase(group='Td', rep='T1')
        t2 = SymmetryBase(group='Td', rep='T2')

        print('A1 . A1: ', dot(a1, a1))

        self.assertAlmostEqual(dot(e, e), 4)
        self.assertAlmostEqual(dot(t1, e), 0)
        self.assertAlmostEqual(dot(t1, t1 + e), 9.0)
        self.assertAlmostEqual(dot(t1, t1 + e, normalize=True), 0.6)
        self.assertAlmostEqual(dot(t1 + e, t1 + e), 25.0)
        self.assertAlmostEqual(dot(t1 + e, t1 + e, normalize=True), 1.0)
        self.assertAlmostEqual(dot(0.6 * t1 + e, t1), 5.4)
        self.assertAlmostEqual(dot(t1, t1, normalize=True), 1.0)
        self.assertAlmostEqual(norm(t1 + e), 5.0)
        self.assertAlmostEqual(norm(t1), 3.0)
        self.assertAlmostEqual(norm(e), 2.0)
        self.assertAlmostEqual(norm(a1), 1.0)
        self.assertAlmostEqual(norm(a1 + a2 + e + t1 + t2), 10.0)
Esempio n. 6
0
def get_orbital_state(orbital_soev):
    state_orb = SymmetryBase(group='c2v',
                             rep=pd.Series(orbital_soev,
                                           index=["E", "C2", "sv_xz",
                                                  "sd_yz"]))
    return state_orb
Esempio n. 7
0
def check_transition(transition):
    if al.dot(transition, SymmetryBase(group='C2h', rep='Ag')) > 0.1:
        return 'Allowed'
    else:
        return 'Forbidden'
Esempio n. 8
0
cis_wf_0 = get_wf_symm(
    cis_orbitals_sym,
    alpha=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
    beta=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0])
cis_wf_1 = get_wf_symm(
    cis_orbitals_sym,
    alpha=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
    beta=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0])
cis_wf_2 = get_wf_symm(
    cis_orbitals_sym,
    alpha=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0],
    beta=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0])

# print(cis_wf_0, cis_wf_1, cis_wf_2)

cis_dm = SymmetryBase(group='C2v', rep='B1') + \
         SymmetryBase(group='C2v', rep='B2') + \
         SymmetryBase(group='C2v', rep='A1')


def check_transition(transtion):
    if al.dot(transtion, SymmetryBase(group='C2v', rep='A1')) > 0.1:
        return 'Allowed'
    else:
        return 'Forbidden'


print('wf_0 -> wf_1: ', cis_wf_0 * cis_dm * cis_wf_1,
      check_transition(cis_wf_0 * cis_dm * cis_wf_1))
print('wf_0 -> wf_2: ', cis_wf_0 * cis_dm * cis_wf_2,
      check_transition(cis_wf_0 * cis_dm * cis_wf_2))
Esempio n. 9
0
from posym import PointGroup, SymmetryBase

pg = PointGroup(group='C2h')
print('\nTest Point group table')
print(pg)

bu = SymmetryBase(group='C2h', rep='Bu')
bg = SymmetryBase('C2h', 'Bg')
ag = SymmetryBase('C2h', 'Ag')

print('\nTest symmetry object operation')
print('bu * bg:', 2 * bu * bg)

print('(bu + bg) * (bu + bu + ag):', (bu + bg) * (bu + bu + ag))
state1 = (bu + bg) * (bu + bu + ag)

print('\nTest symmetry object representation')

pg = PointGroup(group='Td')
print(pg)

bg = SymmetryBase('C2h', 'Bg')
a1 = SymmetryBase(group='Td', rep='A1')
a2 = SymmetryBase(group='Td', rep='A2')
e = SymmetryBase(group='Td', rep='E')
t1 = SymmetryBase(group='Td', rep='T1')

print('e*e + a1:', e * e + 2 * a1)
print('t1*t1:', t1 * t1)

pg = PointGroup(group='C2v')