Esempio n. 1
0
    def setUp(self):
        """Sets up a few nodes to play around with."""
        from aiida.orm.data.singlefile import SinglefileData
        import tempfile

        file_content = '''file-with-contents'''

        with tempfile.NamedTemporaryFile() as f:
            f.write(file_content)
            f.flush()
            node = SinglefileData(file=f.name)
            node.store()

        self.node = node
        self.file_content = file_content

        self.runner = CliRunner()
print 'StructureData of elemental Pd obtained from Pd.cif has pk = {}\n'.format(
    str(n.pk))

# Add structure of Pd atom in AiiDA group
g, _ = Group.get_or_create(name='Isolated_atoms')
atoms = read('{}/Pd_isolated-atom.cif'.format(mypath))
structure = StructureData(ase=atoms)
n = structure.store()
g.add_nodes(n)
print "Added structure (pk = {}) obtained from Pd_isolated-atom.cif to AiiDA group 'Isolated_atoms'\n".format(
    n.pk)

# Store SinglefileData with Wien2k results for the equations of states
f = SinglefileData()
f.set_file('{}/WIEN2k.txt'.format(mypath))
f.store()
print 'SinglefileData obtained from text file WIEN2k.txt has pk = {}\n'.format(
    str(f.pk))

# Store KpointsData for band structure
k = KpointsData()
k.set_kpoints_mesh([6, 6, 6], [0.0, 0.0, 0.0])
k.store()
print 'KpointsData for band structure has pk = {}\n'.format(str(k.pk))

#from aiida.orm.data.singlefile import SinglefileData
#try:
#    g = Group.get_or_create(name='pslib.0.3.1_PBE_PAW', type_string='UpfData')
#except UniquenessError:
#    g = Group.get(name='pslib.0.3.1PBE_PAW', type_string='UpfData')
#u = UpfData()