Ejemplo n.º 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"
Ejemplo n.º 2
0
    def get_pao_block(self):
        """
        Returns the PAO block correspondent to the orbitals stored in this class.
        """

        pao_manager = PaoManager()
        pao_manager.set_from_ion(self)

        return pao_manager.get_pao_block()
Ejemplo n.º 3
0
    def get_pao_modifier(self):
        """
        Get the PaoModifiers, that makes available methods for the modification of
        a PAO block.
        """
        pao_manager = PaoManager()
        pao_manager.set_from_ion(self)

        return pao_manager
Ejemplo n.º 4
0
def test_set_from_ion(generate_ion_data):

    pao_man = PaoManager()

    ion = generate_ion_data('Si')

    pao_man.set_from_ion(ion)

    assert pao_man.name == "Si"
    assert pao_man._gen_dict is not None
    assert pao_man._pol_dict == {3: {1: {1: 4.0531999999999995, 2: 3.1566}}}
Ejemplo n.º 5
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()
Ejemplo n.º 6
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"
Ejemplo n.º 7
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"
Ejemplo n.º 8
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}}}
Ejemplo n.º 9
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}}}
Ejemplo n.º 10
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()
Ejemplo n.º 11
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 == {}