Пример #1
0
def test_pao_size(generate_ion_data):

    pao_man = PaoManager()

    ion = generate_ion_data('Si')

    pao_man.set_from_ion(ion)

    assert pao_man.pao_size() == "DZDP"
Пример #2
0
def test_remove_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, 2: 0.0}}}

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

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

    pao_man.remove_polarization(3, 0)
    assert pao_man._pol_dict == {}
    assert pao_man.pao_size() == "SZ"
Пример #3
0
    def pao_size(self):
        """
        Returns a string sumarazing the size of the basis in this class. Following the siesta convencion
        (SZ, DZ, DZP ...)
        Please note that the string is composed  checking the maximum Z registred by orbitals, for both the polarized
        and unpolarixed orbitals. This means that the algorithm is not able to actually detect if the orbitals
        here are generated by a "PAO.BasisSize" in siesta or it is a manual PAO block. Take this method carefully.
        """
        pao_manager = PaoManager()
        pao_manager.set_from_ion(self)

        return pao_manager.pao_size()
Пример #4
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"