Exemple #1
0
    def get_structuredata_ncf(self):
        """
        This routine returns an AiiDA Structure Data type produced from the ``inp.xml``
        file. not a calcfunction

        :param self: a FleurinpData instance to be parsed into a StructureData
        :returns: StructureData node, or None
        """
        from aiida.orm import StructureData
        from masci_tools.util.xml.xml_getters import get_structure_data

        xmltree, schema_dict = self.load_inpxml()

        atoms, cell, pbc = get_structure_data(xmltree,
                                              schema_dict,
                                              site_namedtuple=True)

        struc = StructureData(cell=cell, pbc=pbc)

        for atom in atoms:
            struc.append_atom(position=atom.position,
                              symbols=atom.symbol,
                              name=atom.kind)

        # TODO DATA-DATA links are not wanted, you might want to use a cf instead
        #struc.add_link_from(self, label='self.structure', link_type=LinkType.CREATE)
        # label='self.structure'
        # return {label : struc}
        return struc
Exemple #2
0
def test_get_structure_max4(load_inpxml, data_regression):

    from masci_tools.util.xml.xml_getters import get_structure_data
    from masci_tools.io.common_functions import convert_to_pystd

    xmltree, schema_dict = load_inpxml(TEST_MAX4_INPXML_PATH)

    atoms, cell, pbc = get_structure_data(xmltree, schema_dict)

    data_regression.check({
        'atoms': convert_to_pystd(atoms),
        'cell': convert_to_pystd(cell),
        'pbc': pbc
    })
Exemple #3
0
def test_get_structure_data(load_inpxml, inpxmlfilepath):
    """
    Test that get_cell works for all input files
    """
    from masci_tools.util.xml.xml_getters import get_structure_data
    import numpy as np

    xmltree, schema_dict = load_inpxml(inpxmlfilepath)

    atoms, cell, pbc = get_structure_data(xmltree, schema_dict)

    assert isinstance(atoms, list)
    assert len(atoms) != 0
    assert isinstance(cell, np.ndarray)
    assert cell.shape == (3, 3)
    assert isinstance(pbc, list)
    assert len(pbc) == 3