PAOFLOW.gen.epw_inputs#
Input generation for the EPW coupling source of the PAO electron-phonon route.
epw.x with epbwrite = .true. writes the coarse Bloch-basis coupling
(PAOFLOW.elphon.qe_elph_io.read_epw_epb()) computed from the nscf
wavefunctions, i.e. in the same band gauge as PAOFLOW’s projections on that
save. This module writes what such a run needs beyond the usual QE inputs:
the explicit full k-point list of the nscf run (EPW requires the complete uniform grid with crystal coordinates in
[0, 1));a placeholder
prefix.ukk, so that EPW can run withwannierize = .false.when no Wannier functions are wanted (only the.epbfiles are used);a minimal
epw.in;the
pw.xscf / nscf andph.xinputs of the two run directories (qe/phonon/andqe/nscf/, as inexamples/elphon/<System>), derived from apw.xinput of the system.
Functions#
Full Gamma-centred k-grid in crystal coordinates, as EPW expects it. |
|
|
|
|
Parse an EPW/wannier90 band list such as |
|
EPW |
|
Write a |
|
Minimal |
|
Set, add or remove namelist variables of a |
|
Atomic masses (amu) of the |
|
|
|
|
|
|
|
|
|
|
|
|
Module Contents#
- PAOFLOW.gen.epw_inputs.uniform_kpoint_list(nk)[source]#
Full Gamma-centred k-grid in crystal coordinates, as EPW expects it.
- Parameters:
- Returns:
Columns
k1, k2, k3(crystal coordinates in[0, 1)) and the weight1 / N. The third index runs fastest, the order ofK_POINTS automaticthat PAOFLOW’s Fourier transforms assume (PAOFLOW.inputs.read_QE_xml.uniform_grid_from_kpoints()).- Return type:
NDArray[np.float64], shape
(nk1 * nk2 * nk3, 4)
- PAOFLOW.gen.epw_inputs.kpoints_card(nk)[source]#
K_POINTS crystalcard with the full grid for the nscf run.
- PAOFLOW.gen.epw_inputs.parse_exclude_bands(spec)[source]#
Parse an EPW/wannier90 band list such as
'1:5, 8'(or'1-5 8').- Parameters:
spec (str) – Comma- or space-separated 1-based band indices and
first:last(orfirst-last) ranges; an optionalexclude_bands =prefix is ignored.- Returns:
Sorted, unique 1-based band indices (empty for a blank string).
- Return type:
- Raises:
ValueError – If an entry is not an integer or a valid range.
- PAOFLOW.gen.epw_inputs.exclude_bands_string(exclude_bands)[source]#
EPW
bands_skippedvalue for a list of 1-based band indices.
- PAOFLOW.gen.epw_inputs.write_placeholder_ukk(path, nbnd, nk_total, nbndsub=None, exclude_bands=None, nelec=None, noncolin=False, wannier90_stubs=True)[source]#
Write a
prefix.ukkthat lets EPW run without a Wannierization.- Parameters:
path (str) – Output file,
prefix.ukkin the directory whereepw.xis run.nbnd (int) – Number of nscf bands.
nk_total (int) – Number of k-points of the nscf grid.
nbndsub (int, optional) – Number of “Wannier functions” declared to EPW (
nbndsubinepw.in). Defaults to the number of kept bands; must not exceed it nor EPW’s limit of 200.exclude_bands (list of int, optional) – 1-based indices of bands excluded from the electron-phonon calculation (e.g. semicore states). With
wannierize = .false.EPW reads the exclusion from this file only;bands_skippedinepw.inis used solely to write wannier90’s.win.nelec (float, optional) – Number of valence electrons; required with
exclude_bandsto count the occupied excluded bands (EPW’snbndskip).noncolin (bool, optional) – Noncollinear calculation (one electron per band in
nbndskip).wannier90_stubs (bool, optional) – Also write empty wannier90 overlap files
prefix.bvec(no b-vectors) andprefix.mmnnext topath(defaultTrue). EPW’s Wannier stage reads them unconditionally (vmebloch2wan); with zero b-vectors it completes, with zero position matrix elements, instead of stopping after the.epbfiles are written.
- Returns:
Writes
pathin the list-directed format of EPW’swrite_filukk: kept-band list, identity rotations, every kept band inside the outer window (so EPW does not pack bands in the.epbfiles), the excluded-band flags and zero centres; plus the two stub files whenwannier90_stubsis true.- Return type:
None
- Raises:
ValueError – If
nbndsubis out of range, a band index is invalid, ornelecis missing while bands are excluded.
Notes
nbndskipfollows EPW’ssetup_nnkp: the number of excluded bands with index<= nelec / 2(<= nelecif noncollinear). The rotations only enter EPW’s Wannier stage, which runs after the.epbfiles are written and whose output PAOFLOW does not use.
- PAOFLOW.gen.epw_inputs.epw_input(prefix, masses_amu, nk, nq, nbndsub, dvscf_dir='./save', outdir='./', wannierize=False, exclude_bands=None)[source]#
Minimal
epw.inthat writes the coarse Bloch coupling (epbwrite).- Parameters:
prefix (str) – Calculation prefix (same as the QE runs).
masses_amu (list of float) – Atomic mass of each species (amu), in species order.
nk (tuple of int) – Coarse k-grid (the nscf grid) and coarse q-grid (the ph.x grid);
nqmust dividenkin each direction.nq (tuple of int) – Coarse k-grid (the nscf grid) and coarse q-grid (the ph.x grid);
nqmust dividenkin each direction.nbndsub (int) – Number of Wannier functions; with
wannierize=Falseuse the value given towrite_placeholder_ukk().dvscf_dir (str, optional) – Directory prepared by EPW’s
pp.py(dvscf, patterns, dyn files).outdir (str, optional) – QE
outdirof the nscf run.wannierize (bool, optional) – Run wannier90 inside EPW (requires the usual
proj/window inputs, to be added by hand). DefaultFalseuses the.ukkfile.exclude_bands (list of int, optional) – 1-based bands to exclude, written as
bands_skipped. Withwannierize=FalseEPW takes the exclusion from the.ukkfile (write_placeholder_ukk()with the same list); the line is kept so that the input documents, and withwannierize=Trueapplies, the same choice.
- Returns:
The
&inputepwnamelist.- Return type:
- Raises:
ValueError – If the q-grid is not commensurate with the k-grid.
- PAOFLOW.gen.epw_inputs.edit_pw_input(text, values=None, remove=(), kpoints=None)[source]#
Set, add or remove namelist variables of a
pw.xinput.- Parameters:
text (str) – The
pw.xinput.values (dict, optional) –
{namelist: {variable: value}}with values already in Fortran syntax (e.g."'nscf'",'16'). An existing assignment is replaced in place; a missing one is appended to its namelist.remove (tuple of str, optional) – Variables to delete from every namelist.
kpoints (str, optional) – Replacement
K_POINTScard (header and data).
- Returns:
The edited input.
- Return type:
- PAOFLOW.gen.epw_inputs.species_masses(text)[source]#
Atomic masses (amu) of the
ATOMIC_SPECIEScard of apw.xinput.
- PAOFLOW.gen.epw_inputs.scf_input(template, prefix, pseudo_dir=None)[source]#
pw.xscf of thephonon/run directory, from apw.xinput.- Parameters:
- Returns:
The input with
calculation = 'scf',outdir = './'and the symmetry switches removed (ph.x works on the irreducible q only).- Return type:
- PAOFLOW.gen.epw_inputs.nscf_input(template, prefix, nk, nbnd, pseudo_dir=None, explicit=True)[source]#
pw.xnscf of the coarse-grid run directory: the full grid as an explicit list.- Parameters:
template (str) – A
pw.xinput of the system (usually the scf one).prefix (str) – Calculation prefix.
nk (tuple of int) – Coarse k-grid (EPW
nk1..3), written bykpoints_card().nbnd (int) – Number of bands.
pseudo_dir (str, optional) –
pseudo_dirfor the run directory (unchanged ifNone).explicit (bool, optional) – The full grid as an explicit
K_POINTS crystallist (EPW needs it);FalsewritesK_POINTS automatic(the irreducible wedge, which PAOFLOW’s native coupling unfolds by symmetry).
- Returns:
The nscf input (
verbosity = 'high', no forces or stress).- Return type:
- PAOFLOW.gen.epw_inputs.automatic_kpoints_card(nk)[source]#
K_POINTS automaticcard of a Gamma-centred grid (the irreducible wedge).
- PAOFLOW.gen.epw_inputs.hubbard_nscf_input(template, prefix, nk, nbnd, pseudo_dir=None)[source]#
pw.xnscf on the EPW k list for a DFT+U(+V) run (theHUBBARDcard kept).- Parameters:
template (str) – A
pw.xinput with the convergedHUBBARDcard (e.g. the finalscf.inof an eACBN0 loop).prefix – As
nscf_input().nk – As
nscf_input().nbnd – As
nscf_input().pseudo_dir – As
nscf_input().
- Returns:
The nscf input: the same structure and Hubbard card, the full k-grid as an explicit list. The run directory must hold the save of the Hubbard scf (charge density,
data-file-schema.xmlandoccup.txt).- Return type:
- Raises:
ValueError – If the template has no
HUBBARDcard.
- PAOFLOW.gen.epw_inputs.optics_nscf_input(template, prefix, nk, nbnd, pseudo_dir=None)[source]#
pw.xnscf of the optics (dielectric_tensor) run: automatic grid, many bands.- Parameters:
template (str) – A
pw.xinput of the system (cards other thanK_POINTS, including aHUBBARDcard, are kept).prefix (str) – Calculation prefix.
nk (tuple of int) – Monkhorst-Pack grid (
K_POINTS automatic, no shift).nbnd (int) – Number of bands (more than the orbitals of the extended PAO basis).
pseudo_dir (str, optional) –
pseudo_dirfor the run directory (unchanged ifNone).
- Returns:
The nscf input.
- Return type:
- PAOFLOW.gen.epw_inputs.ph_input(prefix, nq, title=None, epsil=False, tr2_ph=1e-14)[source]#
ph.xDFPT input on the coarse q-grid (irreducible q,fildvscffor the coupling).- Parameters:
prefix (str) – Calculation prefix.
title (str, optional) – Title line (defaults to
prefix).epsil (bool, optional) – Dielectric tensor and Born effective charges at Gamma (insulators and semiconductors: the long-range dipole model and the quadrupoles need them;
ph.xrefuses it for metals).tr2_ph (float, optional) – Self-consistency threshold.
- Returns:
The
&INPUTPHinput, run in the scf directory.- Return type: