mirror of https://github.com/abinit/abipy.git
rename make_wfk_kerange_input to make_wfk_kerange_inputs as we are returning a MultDataset object
This commit is contained in:
parent
52d7abe24d
commit
084fa939a0
|
@ -1857,28 +1857,29 @@ with the Abinit version you are using. Please contact the AbiPy developers.""" %
|
|||
|
||||
return multi
|
||||
|
||||
def make_wfk_kerange_input(self, sigma_kerange, sigma_ngkpt, einterp=(1, 5, 0, 0)):
|
||||
def make_wfk_kerange_inputs(self, sigma_kerange, sigma_ngkpt, einterp=(1, 5, 0, 0)):
|
||||
"""
|
||||
Return |MultiDataset| inputs for a WFK calculation using the kerange trick.
|
||||
Return a |MultiDataset| with two inputs for performing a WFK calculation with the kerange trick.
|
||||
This method should be called with the input associated to the NSCF run that produces
|
||||
the WFK file used for the interpolation
|
||||
the WFK file used for the interpolation.
|
||||
|
||||
Args:
|
||||
sigma_kerange: The energy window for the WFK generation.
|
||||
sigma_ngkpt: The fine grid of kpt inside the sigma interval.
|
||||
sigma_ngkpt: The fine grid of kpt inside the sigma_kerange interval.
|
||||
einterp: The interpolation used. By default it is a star-function interpolation.
|
||||
"""
|
||||
|
||||
# Create a MultiDataset from the nscf input
|
||||
multi = MultiDataset.from_inputs([self, self])
|
||||
|
||||
# Modify the first nscf input to get a task that calculate the kpt in the sigma interval (Kerange.nc file)
|
||||
# Activate the options needed to calculates the kpts within the sigma interval (Kerange.nc file)
|
||||
multi[0].set_vars(optdriver=8, wfk_task='"wfk_kpts_erange"', kptopt=1,
|
||||
sigma_ngkpt=sigma_ngkpt, sigma_nshiftk=1, sigma_shiftk=[0,0,0],
|
||||
sigma_ngkpt=sigma_ngkpt, sigma_nshiftk=1, sigma_shiftk=[0, 0, 0],
|
||||
einterp=einterp, sigma_erange=sigma_kerange, prtwf=0)
|
||||
multi[0].pop_vars(["iscf","tolwfr","prtden"])
|
||||
|
||||
# Modify the third nscf input to get a task that add the kpt of Kerange.nc to the WFK file
|
||||
# Modify the second nscf input to get a task that adds the kpt from Kerange.nc to the input file
|
||||
# used to compute the WFK file.
|
||||
multi[1].set_vars(optdriver=0, iscf=-2, kptopt=0, ngkpt=sigma_ngkpt)
|
||||
|
||||
return multi
|
||||
|
@ -1887,7 +1888,7 @@ with the Abinit version you are using. Please contact the AbiPy developers.""" %
|
|||
mixprec=1, boxcutmin=1.1, ibte_prep=0, ibte_niter=200, ibte_abs_tol=1e-3):
|
||||
"""
|
||||
Return an |AbinitInput| to perform phonon-limited transport calculations.
|
||||
This method is usually called with with the input associated to the NSCF run that produces
|
||||
This method is usually called with the input associated to the NSCF run that produces
|
||||
the WFK file used to start the EPH run so that we can directly inherit the k-mesh
|
||||
|
||||
Args:
|
||||
|
@ -1898,14 +1899,14 @@ with the Abinit version you are using. Please contact the AbiPy developers.""" %
|
|||
boxcutmin: For the last task only, 1.1 is often used to decrease memory and is faster over the Abinit default of 2.
|
||||
mixprec: For the last task only, 1 is often used to make the EPH calculation faster. Note that Abinit default is 0.
|
||||
ibte_prep: Set it to 1 to activate the iterative Boltzmann equation. Default is RTA.
|
||||
ibte_niter: Number of iterations to solve the Boltzmann equation.
|
||||
ibte_niter: Number of iterations to solve the Boltzmann equation.
|
||||
ibte_abs_tol: Stopping criterion for the IBTE.
|
||||
"""
|
||||
eph_ngqpt_fine = self.get("ngkpt") if eph_ngqpt_fine is None else eph_ngqpt_fine
|
||||
nbdbuf = 0 if self.get("nbdbuf") is None else self.get("nbdbuf")
|
||||
nband = self.get("nband")-nbdbuf # If nbdbuf is used in the NSCF computation,
|
||||
# it cannot be used in the EPH driver and should
|
||||
# be removed
|
||||
nband = self.get("nband") - nbdbuf # If nbdbuf is used in the NSCF computation,
|
||||
# it cannot be used in the EPH driver and should
|
||||
# be removed
|
||||
new = self.new_with_vars(
|
||||
optdriver=7, # Enter EPH driver.
|
||||
eph_task=-4, # Compute imag part of sigma_eph.
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
#!/usr/bin/env python
|
||||
r"""
|
||||
Flow for E-PH calculations
|
||||
==========================
|
||||
Flow for phonon-limited mobilities in semiconductors
|
||||
====================================================
|
||||
|
||||
This flow computes the phonon-limited mobility for different dense k/q meshes in AlAs.
|
||||
This flow computes the phonon-limited mobility in AlAs.
|
||||
using different dense k/q meshes
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
import abipy.data as abidata
|
||||
import abipy.abilab as abilab
|
||||
import abipy.flowtk as flowtk
|
||||
from abipy.abilab import abiopen
|
||||
import abipy.core.abinit_units as abu
|
||||
|
||||
from abipy.abilab import abiopen
|
||||
|
||||
|
||||
def build_flow(options):
|
||||
# Working directory (default is the name of the script with '.py' removed and "run_" replaced by "flow_")
|
||||
if not options.workdir:
|
||||
|
@ -22,11 +25,11 @@ def build_flow(options):
|
|||
flow = flowtk.Flow(workdir=options.workdir, manager=options.manager)
|
||||
|
||||
# Initialize the tmesh, sigma_kerange, sigma_erange and dense meshes for the eph integrations
|
||||
tmesh = [300,300,1]
|
||||
sigma_kerange = [0, 0.5*abu.eV_Ha] # 0.5 eV range for the WFK of electrons
|
||||
sigma_erange = [0, 0.25*abu.eV_Ha] # 0.25 eV range for the EPH computation for electrons
|
||||
dense_meshes = [[30,30,30],
|
||||
[40,40,40]]
|
||||
tmesh = [300, 300, 1]
|
||||
sigma_kerange = [0, 0.5 * abu.eV_Ha] # 0.5 eV range for the WFK of electrons
|
||||
sigma_erange = [0, 0.25 * abu.eV_Ha] # 0.25 eV range for the EPH computation for electrons
|
||||
dense_meshes = [[30, 30, 30],
|
||||
[40, 40, 40]]
|
||||
|
||||
# Initialize the structure and pseudos
|
||||
structure = abidata.structure_from_ucell("AlAs")
|
||||
|
@ -48,15 +51,15 @@ def build_flow(options):
|
|||
)
|
||||
|
||||
# Initialize the first work and add the ground-state task
|
||||
work_init = flowtk.Work()
|
||||
work_init.register_scf_task(scf_input)
|
||||
work0 = flowtk.Work()
|
||||
work0.register_scf_task(scf_input)
|
||||
|
||||
# Band structure calculation to make sure everything is ok
|
||||
# Also allows to compare the results obtained with abitk to
|
||||
# Also allows to compare the results obtained with abitk to
|
||||
# check the SKW interpolation works as needed
|
||||
bs_input = scf_input.make_ebands_input(tolwfr=1e-12, ndivsm=10, nb_extra=5)
|
||||
bs_input.set_vars(nstep=100,nbdbuf=1)
|
||||
work_init.register_nscf_task(bs_input, deps={work_init[0]: "DEN"})
|
||||
bs_input.set_vars(nstep=100, nbdbuf=1)
|
||||
work0.register_nscf_task(bs_input, deps={work0[0]: "DEN"})
|
||||
|
||||
# NSCF input for the WFK needed to interpolate with kerange
|
||||
nscf_input = abilab.AbinitInput(structure, pseudos)
|
||||
|
@ -70,35 +73,36 @@ def build_flow(options):
|
|||
shiftk=[0.0, 0.0, 0.0],
|
||||
)
|
||||
|
||||
work_init.register_nscf_task(nscf_input, deps={work_init[0]: "DEN"})
|
||||
flow.register_work(work_init)
|
||||
work0.register_nscf_task(nscf_input, deps={work0[0]: "DEN"})
|
||||
flow.register_work(work0)
|
||||
|
||||
# Add the phonon work to the flow
|
||||
ddb_ngqpt = [4, 4, 4]
|
||||
ph_work = flowtk.PhononWork.from_scf_task(work_init[0], qpoints=ddb_ngqpt, is_ngqpt=True, with_becs=True)
|
||||
ph_work = flowtk.PhononWork.from_scf_task(work0[0], qpoints=ddb_ngqpt,
|
||||
is_ngqpt=True, with_becs=True)
|
||||
flow.register_work(ph_work)
|
||||
|
||||
# We loop over the dense meshes
|
||||
for i, sigma_ngkpt in enumerate(dense_meshes):
|
||||
# Use the kerange trick to generate a WFK file
|
||||
kerange_input, wfk_input = nscf_input.make_wfk_kerange_input(sigma_kerange=sigma_kerange, sigma_ngkpt=sigma_ngkpt).split_datasets()
|
||||
multi = nscf_input.make_wfk_kerange_inputs(sigma_kerange=sigma_kerange, sigma_ngkpt=sigma_ngkpt)
|
||||
kerange_input, wfk_input = multi.split_datasets()
|
||||
|
||||
work_eph = flowtk.Work()
|
||||
work_eph.register_kerange_task(kerange_input, deps={work_init[2]: "WFK"})
|
||||
work_eph.register_nscf_task(wfk_input, deps={work_init[0]: "DEN", work_eph[0]: "KERANGE.nc"})
|
||||
work_eph.register_kerange_task(kerange_input, deps={work0[2]: "WFK"})
|
||||
work_eph.register_nscf_task(wfk_input, deps={work0[0]: "DEN", work_eph[0]: "KERANGE.nc"})
|
||||
|
||||
# Generate the input file for the transport calculation
|
||||
eph_input = wfk_input.make_eph_transport_input(ddb_ngqpt=ddb_ngqpt, sigma_erange=sigma_erange,
|
||||
tmesh=tmesh, eph_ngqpt_fine=sigma_ngkpt, ibte_prep=1)
|
||||
eph_input = wfk_input.make_eph_transport_inputs(ddb_ngqpt=ddb_ngqpt, sigma_erange=sigma_erange,
|
||||
tmesh=tmesh, eph_ngqpt_fine=sigma_ngkpt, ibte_prep=1)
|
||||
|
||||
# We compute the phonon dispersion to be able to check they are ok
|
||||
if i==0:
|
||||
if i == 0:
|
||||
eph_input.set_qpath(20)
|
||||
|
||||
work_eph.register_eph_task(eph_input, deps={work_eph[1]: "WFK", ph_work: ["DDB", "DVDB"]})
|
||||
|
||||
flow.register_work(work_eph)
|
||||
|
||||
|
||||
flow.allocate(use_smartio=True)
|
||||
|
||||
|
@ -121,7 +125,7 @@ def main(options):
|
|||
flow_main is a decorator implementing the command line interface.
|
||||
Command line args are stored in `options`.
|
||||
"""
|
||||
|
||||
|
||||
return build_flow(options)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue