Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_scf_nscf_inputs(paral_kgb=0, usepaw=0):
"""Returns two input files: GS run and NSCF on a high symmetry k-mesh."""
pseudos = abidata.pseudos("14si.pspnc") if usepaw == 0 else data.pseudos("Si.GGA_PBE-JTH-paw.xml")
# Get structure from cif file.
multi = abilab.MultiDataset(structure=abidata.cif_file("si.cif"), pseudos=pseudos, ndtset=2)
# Global variables
ecut = 6
multi.set_vars(
ecut=ecut,
nband=8,
paral_kgb=paral_kgb,
iomode=3,
timopt=-1,
)
if multi.ispaw:
multi.set_vars(pawecutdg=2 * ecut)
# Dataset 1 (GS run)
multi[0].set_kmesh(ngkpt=[8, 8, 8], shiftk=[0, 0, 0])
def build_flow(options):
# Init structure and pseudos.
structure = abilab.Structure.from_file(abidata.cif_file("si.cif"))
pseudos = abidata.pseudos("14si.pspnc")
# Working directory (default is the name of the script with '.py' removed and "run_" replaced by "flow_")
if not options.workdir:
options.workdir = os.path.basename(__file__).replace(".py", "").replace("run_", "flow_")
# Initialize the flow.
flow = flowtk.Flow(options.workdir, manager=options.manager)
scf_kppa = 120
nscf_nband = 40
ecut, ecuteps, ecutsigx = 6, 2, 4
#scr_nband = 50
#sigma_nband = 50
multi = abilab.g0w0_with_ppmodel_inputs(
def make_inputs(ngkpt, paral_kgb=1):
# Crystalline silicon
# Calculation of the GW correction to the direct band gap in Gamma
# Dataset 1: ground state calculation
# Dataset 2: NSCF calculation
# Dataset 3: calculation of the screening
# Dataset 4-5-6: Self-Energy matrix elements (GW corrections) with different values of nband
multi = abilab.MultiDataset(structure=data.cif_file("si.cif"), pseudos=data.pseudos("14si.pspnc"), ndtset=6)
# This grid is the most economical, but does not contain the Gamma point.
scf_kmesh = dict(
ngkpt=ngkpt,
shiftk=[0.5, 0.5, 0.5,
0.5, 0.0, 0.0,
0.0, 0.5, 0.0,
0.0, 0.0, 0.5]
)
# This grid contains the Gamma point, which is the point at which
# we will compute the (direct) band gap.
gw_kmesh = dict(
ngkpt=ngkpt,
shiftk=[0.0, 0.0, 0.0,
0.0, 0.5, 0.5,
def make_inputs(ngkpt, paral_kgb=1):
# Crystalline silicon
# Calculation of the GW correction to the direct band gap in Gamma
# Dataset 1: ground state calculation
# Dataset 2: NSCF calculation
# Dataset 3: calculation of the screening
# Dataset 4-5-6: Self-Energy matrix elements (GW corrections) with different values of nband
multi = abilab.MultiDataset(structure=data.cif_file("si.cif"), pseudos=data.pseudos("14si.pspnc"), ndtset=6)
# This grid is the most economical, but does not contain the Gamma point.
scf_kmesh = dict(
ngkpt=ngkpt,
shiftk=[0.5, 0.5, 0.5,
0.5, 0.0, 0.0,
0.0, 0.5, 0.0,
0.0, 0.0, 0.5]
)
# This grid contains the Gamma point, which is the point at which
# we will compute the (direct) band gap.
gw_kmesh = dict(
ngkpt=ngkpt,
shiftk=[0.0, 0.0, 0.0,
0.0, 0.5, 0.5,
def make_scf_nscf_inputs(paral_kgb=1):
"""Returns two input files: GS run and NSCF on a high symmetry k-mesh."""
pseudos = abidata.pseudos("14si.pspnc")
#pseudos = data.pseudos("Si.GGA_PBE-JTH-paw.xml")
multi = abilab.MultiDataset(structure=abidata.cif_file("si.cif"), pseudos=pseudos, ndtset=2)
# Global variables
ecut = 28
global_vars = dict(ecut=ecut,
nband=8,
timopt=-1,
istwfk="*1",
nstep=15,
paral_kgb=paral_kgb,
)
if multi.ispaw:
global_vars.update(pawecutdg=2*ecut)
multi.set_vars(global_vars)
def all_inputs(paral_kgb=1):
"""
Build the input files of the calculation.
Returns: gs_input, nscf_input, scr_input, sigma_input
"""
ecut = ecutwfn = 4
global_vars = dict(
ecut=ecut,
istwfk="*1",
paral_kgb=paral_kgb,
)
multi = abilab.MultiDataset(structure=data.cif_file("si.cif"),
pseudos=data.pseudos("14si.pspnc"), ndtset=4)
multi.set_vars(global_vars)
gs, nscf, scr, sigma = multi.split_datasets()
# This grid is the most economical, but does not contain the Gamma point.
gs_kmesh = dict(
ngkpt=[2, 2, 2],
shiftk=[0.5, 0.5, 0.5,
0.5, 0.0, 0.0,
0.0, 0.5, 0.0,
0.0, 0.0, 0.5]
)
# This grid contains the Gamma point, which is the point at which
# we will compute the (direct) band gap.
def make_ion_ioncell_inputs(paral_kgb=0):
structure = abilab.Structure.from_file(abidata.cif_file("si.cif"))
# Perturb the structure (random perturbation of 0.1 Angstrom)
# then compress the volume to trigger dilatmx.
structure.perturb(distance=0.1)
structure.scale_lattice(structure.volume * 0.6)
global_vars = dict(
ecut=4,
ngkpt=[4,4,4],
shiftk=[0,0,0],
nshiftk=1,
chksymbreak=0,
paral_kgb=paral_kgb,
iomode=3,
#prtwf=0,
)
def make_inputs(paw=False):
# Crystalline silicon
# Calculation of the GW correction to the direct band gap in Gamma
# Dataset 1: ground state calculation
# Dataset 2: NSCF calculation
# Dataset 3: calculation of the screening
# Dataset 4: calculation of the Self-Energy matrix elements (GW corrections)
structure = abilab.Structure.from_file(abidata.cif_file("si.cif"))
pseudos = abidata.pseudos("14si.pspnc") if not paw else abidata.pseudos("Si.GGA_PBE-JTH-paw.xml")
multi = abilab.MultiDataset(structure, pseudos=pseudos, ndtset=4)
ecut = 24
multi.set_vars(
ecut=ecut,
pawecutdg=ecut*4 if paw else None,
timopt=-1,
istwfk="*1",
paral_kgb=0,
)
gs, nscf, scr, sigma = multi.split_datasets()
# This grid is the most economical, but does not contain the Gamma point.
def make_relax_flow():
# Structural relaxation for different k-point samplings.
ngkpt_list = [(2, 2, 2), (4, 4, 4)]
multi = abilab.MultiDataset(structure=abidata.cif_file("si.cif"),
pseudos=abidata.pseudos("14si.pspnc"), ndtset=len(ngkpt_list))
# Global variables
multi.set_vars(
ecut=10,
tolvrs=1e-9,
optcell=1,
ionmov=3,
ntime=10,
dilatmx=1.05,
ecutsm=0.5,
)
for i, ngkpt in enumerate(ngkpt_list):
multi[i].set_kmesh(ngkpt=ngkpt, shiftk=[0,0,0])
def make_scf_nscf_inputs(paral_kgb=1):
"""Returns two input files: GS run and NSCF on a high symmetry k-mesh."""
multi = abilab.MultiDataset(structure=abidata.cif_file("si.cif"),
pseudos=abidata.pseudos("14si.pspnc"), ndtset=2)
# Global variables
ecut = 6
global_vars = dict(
ecut=ecut,
nband=8,
nstep=15,
paral_kgb=paral_kgb,
)
if multi.ispaw:
global_vars.update(pawecutdg=2*ecut)
multi.set_vars(global_vars)