Ejemplo n.º 1
0
    def test_shift_species_label_all_rel(self, inpxml_etree, att_name, tag):
        from aiida_fleur.tools.xml_util import shift_value_species_label, eval_xpath2
        import numpy as np
        etree = inpxml_etree(TEST_INP_XML_PATH)
        path = '/fleurInput/atomSpecies/species/' + tag + '/@' + att_name
        old_result = np.array(eval_xpath2(etree, path)).astype('float')

        shift_value_species_label(etree, 'all', att_name, 2, mode='rel')
        result = np.array(eval_xpath2(etree, path)).astype('float')

        assert np.all(np.isclose(old_result * 2, result))
Ejemplo n.º 2
0
    def test_shift_species_label(self, inpxml_etree, att_name, tag):
        from aiida_fleur.tools.xml_util import shift_value_species_label, eval_xpath2
        import math
        etree = inpxml_etree(TEST_INP_XML_PATH)
        path = '/fleurInput/atomSpecies/species[@name = "Fe-1"]/' + tag + '/@' + att_name
        old_result = eval_xpath2(etree, path)[0]

        shift_value_species_label(etree, '                 222', att_name, 3, mode='abs')
        result = eval_xpath2(etree, path)[0]

        assert math.isclose(float(result) - float(old_result), 3)
Ejemplo n.º 3
0
 def shift_value_species_label1(fleurinp_tree_copy, label, att_name,
                                value, mode):
     fleurinp_tree_copy = shift_value_species_label(
         fleurinp_tree_copy, label, att_name, value, mode)
     return fleurinp_tree_copy