Ejemplo n.º 1
0
def get_structure(d=10, a=0, atom="Li"):
    species = []
    coords = []
    # does not work with cluster
    # parser = CifParser(
    #     "/home/srr70/coo2/other_compoun/group_1_atoms/test/licoo2.cif")
    # structure = parser.get_structures()[0]
    # does not work with cluster
    structure = Structure.from_file(
        "/home/srr70/coo2/other_compoun/group_1_atoms/test/licoo2.cif")
    for i in structure:
        if i.species_string == "Li":
            species.append(i.species)
            coords.append(i.coords + [0, 0, +.5 * d + a])
        else:
            species.append(i.species)
            coords.append(i.coords)
    a = structure.lattice.matrix.copy()
    a[2][2] = a[2][2] - d
    struc = Structure(Lattice(a), species, coords, coords_are_cartesian=True)
    struc.replace_species({"Li": atom})
    CifWriter(struc).write_file(f"{atom}" + 'coo2_' +
                                str(struc.lattice.c)[:4] + '.cif')
    #     CifWriter(struc).write_file(fname+'licoo2_big.cif')
    #     os.system("open "+fname+'licoo2_big.cif')
    return p2ase().get_atoms(struc)