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"
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()
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
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}}}
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()
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"
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"
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}}}
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}}}
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()
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 == {}