Exemplo n.º 1
0
import numpy as np

import abipy.data as data
from abipy.abilab import Structure, StructureModifier, AbiInput

structure = Structure.from_file(data.cif_file("si.cif"))

modifier = StructureModifier(structure)

# From 98% to 102% of the initial volume.
new_structures = modifier.scale_lattice(vol_ratios=np.arange(98, 104, 2) / 100.)

inp = AbiInput(pseudos=data.pseudos("14si.pspnc"), ndtset=len(new_structures))

for (idt, new_structure) in enumerate(new_structures):
    inp.set_structure(new_structure, dtset=idt+1)

print(inp)

# Supercell
inp = AbiInput(pseudos=data.pseudos("14si.pspnc"), ndtset=1)

new_structure = modifier.make_supercell(scaling_matrix=[1,2,3])
inp.set_structure(new_structure)

print(inp)

structure = Structure.from_abivars({
    "acell" : [10, 10, 10],
    "rprim" : np.eye(3),
    "natom" : 2,