예제 #1
0
def test_validator_and_get_pao_block():

    pao_man = PaoManager()

    with pytest.raises(RuntimeError):
        pao_man.get_pao_block()

    pao_man.name = "Si"

    with pytest.raises(RuntimeError):
        pao_man.get_pao_block()

    pao_man._gen_dict = {3: {0: {1: 4.05}}}

    with pytest.raises(RuntimeError):
        pao_man.get_pao_block()

    pao_man._pol_dict = {}

    assert pao_man.get_pao_block() == "Si 1\n  n=3  0  1 \n 7.6533504667600045"

    pao_man._gen_dict = {}

    with pytest.raises(RuntimeError):
        pao_man.get_pao_block()
예제 #2
0
def test_change_all_radius():

    pao_man = PaoManager()

    pao_man.name = "Si"
    pao_man._gen_dict = {3: {0: {1: 4.05}}}
    pao_man._pol_dict = {3: {0: {1: 4.05}}}

    pao_man.change_all_radius(2)

    assert pao_man._gen_dict == {3: {0: {1: 4.131}}}
    assert pao_man._pol_dict == {3: {0: {1: 4.131}}}
예제 #3
0
def test_reset_radius():

    pao_man = PaoManager()

    pao_man.name = "Si"
    pao_man._gen_dict = {3: {0: {1: 4.05}}}
    pao_man._pol_dict = {3: {0: {1: 4.05}}}

    with pytest.raises(ValueError):
        pao_man.reset_radius("Bohr", 0.0, 3, 1, 2)

    pao_man.reset_radius("Bohr", 0.0, 3, 0, 1)
    assert pao_man._gen_dict == {3: {0: {1: 0.0}}}
    assert pao_man._pol_dict == {3: {0: {1: 0.0}}}
예제 #4
0
def test_add_polarization():

    pao_man = PaoManager()

    pao_man.name = "Si"
    pao_man._gen_dict = {3: {0: {1: 4.05}}}
    pao_man._pol_dict = {3: {0: {1: 4.05}}}

    with pytest.raises(ValueError):
        pao_man.add_polarization(3, 1)

    pao_man.add_polarization(3, 0)

    assert pao_man._pol_dict == {3: {0: {1: 4.05, 2: 0.0}}}
    assert pao_man.pao_size() == "SZDP"
예제 #5
0
def test_add_orbital():

    pao_man = PaoManager()

    pao_man.name = "Si"
    pao_man._gen_dict = {3: {0: {1: 4.05}}}
    pao_man._pol_dict = {3: {0: {1: 4.05}}}

    with pytest.raises(ValueError):
        pao_man.add_orbital("Bohr", 0.0, 3, 1, 2)

    pao_man.add_orbital("Bohr", 0.0, 3, 0, 2)

    assert pao_man._gen_dict == {3: {0: {1: 4.05, 2: 0.0}}}
    assert pao_man.pao_size() == "DZP"
예제 #6
0
def test_remove_orbital():

    pao_man = PaoManager()

    pao_man.name = "Si"
    pao_man._gen_dict = {3: {0: {1: 4.05, 2: 0.0}}}
    pao_man._pol_dict = {3: {0: {1: 4.05}}}

    with pytest.raises(ValueError):
        pao_man.remove_orbital(3, 1, 1)
    with pytest.raises(ValueError):
        pao_man.remove_orbital(3, 0, 1)

    pao_man.remove_orbital(3, 0, 2)
    assert pao_man._gen_dict == {3: {0: {1: 4.05}}}
    assert pao_man._pol_dict == {3: {0: {1: 4.05}}}
    assert pao_man.pao_size() == "SZP"

    pao_man.remove_orbital(3, 0, 1)
    assert pao_man._gen_dict == {}
    assert pao_man._pol_dict == {}