From f5bd7ba077b7e328131888134ceaaff379523f8a Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Thu, 6 Jun 2024 18:49:10 +0000 Subject: [PATCH] build based on aff98c8 --- dev/api/convention/index.html | 2 +- dev/api/epw/index.html | 12 +-- dev/api/index.html | 2 +- dev/api/qe/index.html | 6 +- dev/api/util/index.html | 24 ++--- dev/api/volumetric/index.html | 12 +-- dev/api/w90/index.html | 185 +++++++++++++++++++++++++--------- dev/index.html | 2 +- dev/search/index.html | 2 +- dev/search_index.js | 2 +- 10 files changed, 171 insertions(+), 78 deletions(-) diff --git a/dev/api/convention/index.html b/dev/api/convention/index.html index 30d45a4..a094e7f 100644 --- a/dev/api/convention/index.html +++ b/dev/api/convention/index.html @@ -17,4 +17,4 @@ julia> header "Created on 9Sep2022 at 16:41: 5"

Note that usually the high-level function directly returns the quantities, e.g., a single A to avoid the user unpacking return values; however, often the low-level functions return a NamedTuple of all the quantities, for the sake of clarity.

julia> amn = read_amn("si2.amn", WannierIO.FortranText())
 julia> typeof(amn)
-NamedTuple{(:A, :header), Tuple{Vector{Matrix{ComplexF64}}, SubString{String}}}

Of course, when using low-level functions you can also directly access the quantity without unpacking by

julia> A = read_amn("si2.amn", WannierIO.FortranText()).A

When writing files, the user can specify whether to write in text or binary by a keyword argument binary of the high-level function

julia> write_amn("si2.amn", A; binary=true)

The binary keyword argument avoids the user specifying the file type when calling the low-level functions, e.g.,

julia> write_amn("si2.amn", A, WannierIO.FortranBinaryStream())
+NamedTuple{(:A, :header), Tuple{Vector{Matrix{ComplexF64}}, SubString{String}}}

Of course, when using low-level functions you can also directly access the quantity without unpacking by

julia> A = read_amn("si2.amn", WannierIO.FortranText()).A

When writing files, the user can specify whether to write in text or binary by a keyword argument binary of the high-level function

julia> write_amn("si2.amn", A; binary=true)

The binary keyword argument avoids the user specifying the file type when calling the low-level functions, e.g.,

julia> write_amn("si2.amn", A, WannierIO.FortranBinaryStream())
diff --git a/dev/api/epw/index.html b/dev/api/epw/index.html index 198fadd..d0fa42f 100644 --- a/dev/api/epw/index.html +++ b/dev/api/epw/index.html @@ -1,5 +1,5 @@ -EPW · WannierIO.jl

EPW files

WannierIO.UkkType

Struct for the EPW .ukk file.

Similar to the W90 .chk file.

struct Ukk{T<:Real}

Fields

  • ibndstart: index of the first band

  • ibndend: index of the last band

  • n_kpts: number of kpoints

  • n_bands: number of bands

  • n_wann: number of wannier functions

  • U: gauge matrices, length-n_kpts vector, each element is a n_bands * n_wann matrix

  • frozen_bands: flag for frozen bands, length-n_kpts vector, each element is a length-n_bands vector

  • excluded_bands: flag for excluded bands, length-n_bands + n_excl_bands vector, where n_excl_bands is the number of excluded bands

  • centers: centers of WFs, length-n_wann vector of Vec3. Note that EPW uses Cartesian coordinates w.r.t the QE alat, so it is dimensionless.

source
WannierIO.UkkMethod
Ukk(chk, alat)
+EPW · WannierIO.jl

EPW files

WannierIO.UkkType

Struct for the EPW .ukk file.

Similar to the W90 .chk file.

struct Ukk{T<:Real}

Fields

  • ibndstart: index of the first band

  • ibndend: index of the last band

  • n_kpts: number of kpoints

  • n_bands: number of bands

  • n_wann: number of wannier functions

  • U: gauge matrices, length-n_kpts vector, each element is a n_bands * n_wann matrix

  • frozen_bands: flag for frozen bands, length-n_kpts vector, each element is a length-n_bands vector

  • excluded_bands: flag for excluded bands, length-n_bands + n_excl_bands vector, where n_excl_bands is the number of excluded bands

  • centers: centers of WFs, length-n_wann vector of Vec3. Note that EPW uses Cartesian coordinates w.r.t the QE alat, so it is dimensionless.

source
WannierIO.UkkMethod
Ukk(chk, alat)
 

Construct a EPW Ukk from a W90 Chk.

Arguments

  • chk: the Chk struct
  • alat: the QE alat in Å unit. Note that the alat from QE stdout file is in Bohr unit, you need to do the conversion by multiplying it with Bohr_QE.

Examples

Convert a W90 .chk file to a EPW .ukk file:

using WannierIO
 chk = read_chk("BN.chk")
 # Note we need QE `alat` for ukk. You can get it
@@ -12,8 +12,8 @@
 # - or better by parsing the QE xml file, and the unit conversion is done automatically
 alat = read_qe_xml("BN.xml").alat
 ukk = Ukk(chk, alat)
-WannierIO.write_epw_ukk("BN.ukk", ukk)
source
WannierIO.read_epw_mmnMethod
read_epw_mmn(filename; n_kpts, n_bvecs, n_bands)
-

Read the EPW mmn file.

The EPW mmn format is different from that of W90. It does not contain the number of kpoints/bvectors/bands, so they need to be provided as keyword arguments.

Arguments

  • filename: the mmn file name

Keyword arguments

  • n_kpts: number of kpoints
  • n_bvecs: number of bvectors
  • n_bands: number of bands

Return

  • M: length-n_kpts vector of length-n_bvecs vector of n_bands * n_bands matrices
source
+WannierIO.write_epw_ukk("BN.ukk", ukk)
source
WannierIO.read_epw_mmnMethod
read_epw_mmn(filename; n_kpts, n_bvecs, n_bands)
+

Read the EPW mmn file.

The EPW mmn format is different from that of W90. It does not contain the number of kpoints/bvectors/bands, so they need to be provided as keyword arguments.

Arguments

  • filename: the mmn file name

Keyword arguments

  • n_kpts: number of kpoints
  • n_bvecs: number of bvectors
  • n_bands: number of bands

Return

  • M: length-n_kpts vector of length-n_bvecs vector of n_bands * n_bands matrices
source
diff --git a/dev/api/index.html b/dev/api/index.html index 25331a8..7bb1be3 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -1,2 +1,2 @@ -Index · WannierIO.jl

Index of all functions and types

+Index · WannierIO.jl

Index of all functions and types

diff --git a/dev/api/qe/index.html b/dev/api/qe/index.html index f3038c7..b43b518 100644 --- a/dev/api/qe/index.html +++ b/dev/api/qe/index.html @@ -1,11 +1,11 @@ Quantum ESPRESSO · WannierIO.jl

Quantum ESPRESSO files

WannierIO.guess_kpathMethod
guess_kpath(kpoints; atol)
-

Guess high symmetry points from kpoint coordinates.

If there is angle between two consecutive kpoints, then it is labeled as a high-symmetry point.

Arguments

  • kpoints: Vector of Vector or Vec3, in Cartesian coordinates

Keyword Arguments

  • atol: Absolute tolerance for checking cross product of two vectors

Returns

  • symm_point_indices: Vector of indices of high-symmetry points
  • symm_point_labels: Vector of labels of high-symmetry points, for the moment it is empty
source
WannierIO.read_qe_bandMethod
read_qe_band(filename)
+

Guess high symmetry points from kpoint coordinates.

If there is angle between two consecutive kpoints, then it is labeled as a high-symmetry point.

Arguments

  • kpoints: Vector of Vector or Vec3, in Cartesian coordinates

Keyword Arguments

  • atol: Absolute tolerance for checking cross product of two vectors

Returns

  • symm_point_indices: Vector of indices of high-symmetry points
  • symm_point_labels: Vector of labels of high-symmetry points, for the moment it is empty
source
WannierIO.read_qe_bandMethod
read_qe_band(filename)
 

Read Quantum ESPRESSO bands.x output data file.

The data file has format

 &plot nbnd=  20, nks=   380 /
            -0.500000  0.500000  0.500000
    -3.320   -0.666    5.173    5.173    7.994    9.725    9.725   14.147   16.993   16.993
    17.841   17.841   17.902   19.666   25.961   26.563   28.186   28.186   28.368   28.368
            -0.495000  0.495000  0.495000
    -3.322   -0.664    5.173    5.173    7.994    9.725    9.725   14.148   16.980   16.980
-...
source
WannierIO.read_qe_xmlMethod
read_qe_xml(filename)
-

Read atomic structure and band structure from QE's XML output.

Return

  • lattice: 3 * 3, Å, each column is a lattice vector
  • atom_positions: length-n_atoms vector, each element is a fractional position
  • atom_labels: length-n_atoms vector, each element is the label of the corresponding atom
  • recip_lattice: 3 * 3, Å⁻¹, each column is a reciprocal lattice vector
  • kpoints: length-n_kpts vector, each element is a fractional kpoint
  • fermi_energy: eV
  • alat: the alat of QE in Å
  • eigenvalues: length-n_kpts vector, each element is a length-n_bands vector of eigenvalue in eV. For spin-polarized but without SOC calculations, return two arries of eigenvalues_up and eigenvalues_dn for the two spin channels.
source
+...source
WannierIO.read_qe_xmlMethod
read_qe_xml(filename)
+

Read atomic structure and band structure from QE's XML output.

Return

  • lattice: 3 * 3, Å, each column is a lattice vector
  • atom_positions: length-n_atoms vector, each element is a fractional position
  • atom_labels: length-n_atoms vector, each element is the label of the corresponding atom
  • recip_lattice: 3 * 3, Å⁻¹, each column is a reciprocal lattice vector
  • kpoints: length-n_kpts vector, each element is a fractional kpoint
  • fermi_energy: eV
  • alat: the alat of QE in Å
  • eigenvalues: length-n_kpts vector, each element is a length-n_bands vector of eigenvalue in eV. For spin-polarized but without SOC calculations, return two arries of eigenvalues_up and eigenvalues_dn for the two spin channels.
source
diff --git a/dev/api/util/index.html b/dev/api/util/index.html index 6998564..e60d51a 100644 --- a/dev/api/util/index.html +++ b/dev/api/util/index.html @@ -1,13 +1,13 @@ Utilities · WannierIO.jl

Utility

Some simple convenience functions for development.

Lattice

Types

WannierIO.FortranBinaryStreamType

Fortran unformatted IO with stream access.

For example, file written using these Fortran code:

OPEN(UNIT=11, FILE="ustream.demo", STATUS="NEW", ACCESS="STREAM", FORM="UNFORMATTED")
source
WannierIO.Wannier90TextType

Plain text format for Wannier90 win and nnkp files.

The W90 default win or nnkp are plain text files but are not simple arrays of numbers that can be read by readdlm, therefore this struct is used to indicate that the file is plain text but need to be handled by corresponding functions, e.g., read_win, read_nnkp, etc.

This somewhat overlaps with FortranText, but this one is only used for small input parameter files e.g. win and nnkp (in comparison with the Wannier90Toml format), while the FortranText (in comparison with the FortranBinary format) is used for large matrices e.g. amn, mmn, eig, etc.

source
WannierIO.Wannier90TomlType

TOML file format for Wannier90 win and nnkp files.

Here we introduce a TOML format for win and nnkp, so that once the win or nnkp files are converted into TOML, the TOML files can be loaded by standard TOML parsers without the headache of writing custom parsers in other Julia packages.

See also write_win, write_nnkp, etc.

source

Constants

WannierIO.BohrConstant

Bohr radius in Angstrom unit.

This is the default CODATA2006 value in W90 src/constants.F90.

source
WannierIO.Bohr_QEConstant

Bohr radius in Angstrom unit.

This is the default (Physical constants, SI (NIST 2018)) value in QE Modules/constants.f90.

source

Misc

WannierIO.write_tomlMethod
write_toml(io; kwargs...)
-

Write kwargs into io as a TOML file.

Do some type conversion before writing.

source
WannierIO.parse_boolMethod
parse_bool(s)
-

Parse a string as bool.

This is capable of parsing Fortran outputs, e.g., .true., .false., true, T.

source
WannierIO.parse_floatMethod
parse_float(s)
-

Parse a string as Float64.

The is capable of parsing Fortran outputs, e.g. 1.0D-10, to the ordinary 1e-10.

source

Lattice

Types

WannierIO.FortranBinaryStreamType

Fortran unformatted IO with stream access.

For example, file written using these Fortran code:

OPEN(UNIT=11, FILE="ustream.demo", STATUS="NEW", ACCESS="STREAM", FORM="UNFORMATTED")
source
WannierIO.Wannier90TextType

Plain text format for Wannier90 win and nnkp files.

The W90 default win or nnkp are plain text files but are not simple arrays of numbers that can be read by readdlm, therefore this struct is used to indicate that the file is plain text but need to be handled by corresponding functions, e.g., read_win, read_nnkp, etc.

This somewhat overlaps with FortranText, but this one is only used for small input parameter files e.g. win and nnkp (in comparison with the Wannier90Toml format), while the FortranText (in comparison with the FortranBinary format) is used for large matrices e.g. amn, mmn, eig, etc.

source
WannierIO.Wannier90TomlType

TOML file format for Wannier90 win and nnkp files.

Here we introduce a TOML format for win and nnkp, so that once the win or nnkp files are converted into TOML, the TOML files can be loaded by standard TOML parsers without the headache of writing custom parsers in other Julia packages.

See also write_win, write_nnkp, etc.

source

Constants

WannierIO.BohrConstant

Bohr radius in Angstrom unit.

This is the default CODATA2006 value in W90 src/constants.F90.

source
WannierIO.Bohr_QEConstant

Bohr radius in Angstrom unit.

This is the default (Physical constants, SI (NIST 2018)) value in QE Modules/constants.f90.

source

Misc

WannierIO.write_tomlMethod
write_toml(io; kwargs...)
+

Write kwargs into io as a TOML file.

Do some type conversion before writing.

source
WannierIO.parse_boolMethod
parse_bool(s)
+

Parse a string as bool.

This is capable of parsing Fortran outputs, e.g., .true., .false., true, T.

source
WannierIO.parse_floatMethod
parse_float(s)
+

Parse a string as Float64.

The is capable of parsing Fortran outputs, e.g. 1.0D-10, to the ordinary 1e-10.

source
WannierIO.parse_indicesMethod
parse_indices(str)
 

Parse a string of comma-separated indices or range into a vector of integers.

E.g., the exclude_bands tag of win file.

Examples

julia> parse_indices("1-2, 5,8 -10")
 6-element Vector{Int64}:
   1
@@ -15,16 +15,16 @@
   5
   8
   9
- 10
source
WannierIO.parse_vectorMethod
parse_vector(io, T, n_elements)
 

Parse a vector of n_elements elements of type T from io.

Arguments

  • io: input stream
  • T: type of elements
  • n_elements::Int: total number of elements

Examples

Suppose a file demo.txt has the following content:

1  2  3  4  5  6  7  8  9  10
 11 12 13 14 15 16 17 18 19 20
 21 22 23

Then the following code parses the file and return a vector filled with 1 to 23:

julia> vector = open("demo.txt") do io
     parse_vector(io, Int, 23)
-end

The number of elements in each line can be different.

source
WannierIO.WannierIOModule

WannierIO.jl: a package for reading and writing Wannier90 file formats.


WannierIO.jl

Stable Dev CI codecov

A Julia package for reading/writing Wannier90 file formats.

The package is designed to be minimalistic to allow easy reuse in other packages.

Quick examples

using WannierIO
+end

The number of elements in each line can be different.

source
WannierIO.WannierIOModule

WannierIO.jl: a package for reading and writing Wannier90 file formats.


WannierIO.jl

Stable Dev CI codecov

A Julia package for reading/writing Wannier90 file formats.

The package is designed to be minimalistic to allow easy reuse in other packages.

Quick examples

using WannierIO
 
 A = read_amn("silicon.amn")
 write_amn("silicon_2.amn", A)
 
 chk = read_chk("silicon.chk")
-write_chk("silicon_2.chk", chk; binary=true)

Related packages

  • Wannier.jl: Wannierization and Wannier interpolation. The IO part of Wannier.jl was isolated and moved into this package.

Exported functions:

source
+write_chk("silicon_2.chk", chk; binary=true)

Related packages


Exported functions:

source diff --git a/dev/api/volumetric/index.html b/dev/api/volumetric/index.html index dd7fe00..6beb4de 100644 --- a/dev/api/volumetric/index.html +++ b/dev/api/volumetric/index.html @@ -1,6 +1,6 @@ Volumetric data · WannierIO.jl

Volumetric data files

Read/write

WannierIO.read_xsfMethod
read_xsf(filename)
-

Read xsf file.

Return

  • primvec: 3 * 3, Å, each column is a primitive lattice vector
  • convvec: 3 * 3, Å, each column is a conventional lattice vector
  • atoms: n_atoms String, atomic symbols or numbers
  • atom_positions: length-n_atoms vector, Å, cartesian coordinates
  • origin: 3, Å, origin of the grid
  • span_vectors: 3 * 3, Å, each column is a spanning vector
  • X: nx, fractional coordinate of grid points along the first spanning vector
  • Y: ny, fractional coordinate of grid points along the second spanning vector
  • Z: nz, fractional coordinate of grid points along the third spanning vector
  • W: nx * ny * nz, volumetric data
Note

Only support reading 1 datagrid in BLOCK_DATAGRID_3D.

source
WannierIO.write_xsfMethod
write_xsf(
+

Read xsf file.

Return

  • primvec: 3 * 3, Å, each column is a primitive lattice vector
  • convvec: 3 * 3, Å, each column is a conventional lattice vector
  • atoms: n_atoms String, atomic symbols or numbers
  • atom_positions: length-n_atoms vector, Å, cartesian coordinates
  • origin: 3, Å, origin of the grid
  • span_vectors: 3 * 3, Å, each column is a spanning vector
  • X: nx, fractional coordinate of grid points along the first spanning vector
  • Y: ny, fractional coordinate of grid points along the second spanning vector
  • Z: nz, fractional coordinate of grid points along the third spanning vector
  • W: nx * ny * nz, volumetric data
Note

Only support reading 1 datagrid in BLOCK_DATAGRID_3D.

source
WannierIO.write_xsfMethod
write_xsf(
     filename,
     lattice,
     atom_positions,
@@ -9,10 +9,10 @@
     span_vectors,
     W
 )
-

Write xsf file.

Arguments

  • lattice: 3 * 3, Å, each column is a lattice vector
  • atom_positions: length-n_atoms vector, fractional coordinates
  • atom_numbers: n_atoms, atomic numbers
  • origin: 3, Å, origin of the grid
  • span_vectors: 3 * 3, Å, each column is a spanning vector
  • W: nx * ny * nz, volumetric data
source
WannierIO.read_bxsfMethod
read_bxsf(filename)
-

Read bxsf file.

Return

  • fermi_energy: Fermi energy in eV
  • origin: 3, Å⁻¹, origin of the grid
  • span_vectors: 3 * 3, Å⁻¹, each column is a spanning vector
  • X: nx, fractional coordinate of grid points along the first spanning vector
  • Y: ny, fractional coordinate of grid points along the second spanning vector
  • Z: nz, fractional coordinate of grid points along the third spanning vector
  • E: n_bands * nx * ny * nz, eigenvalues at each grid point
source
WannierIO.write_bxsfMethod
write_bxsf(filename, fermi_energy, origin, span_vectors, E)
-

Write bxsf file.

Arguments

  • fermi_energy: Fermi energy in eV
  • origin: 3, Å⁻¹, origin of the grid
  • span_vectors: 3 * 3, Å⁻¹, each column is a spanning vector
  • E: n_bands * nx * ny * nz, eigenvalues at each grid point
source
WannierIO.read_cubeMethod
read_cube(filename)
-

Read cube file.

Note

By default, cube use Bohr unit, here all returns are in Cartesian coordinates, Å unit.

source
WannierIO.write_cubeMethod
write_cube(
+

Write xsf file.

Arguments

  • lattice: 3 * 3, Å, each column is a lattice vector
  • atom_positions: length-n_atoms vector, fractional coordinates
  • atom_numbers: n_atoms, atomic numbers
  • origin: 3, Å, origin of the grid
  • span_vectors: 3 * 3, Å, each column is a spanning vector
  • W: nx * ny * nz, volumetric data
source
WannierIO.read_bxsfMethod
read_bxsf(filename)
+

Read bxsf file.

Return

  • fermi_energy: Fermi energy in eV
  • origin: 3, Å⁻¹, origin of the grid
  • span_vectors: 3 * 3, Å⁻¹, each column is a spanning vector
  • X: nx, fractional coordinate of grid points along the first spanning vector
  • Y: ny, fractional coordinate of grid points along the second spanning vector
  • Z: nz, fractional coordinate of grid points along the third spanning vector
  • E: n_bands * nx * ny * nz, eigenvalues at each grid point
source
WannierIO.write_bxsfMethod
write_bxsf(filename, fermi_energy, origin, span_vectors, E)
+

Write bxsf file.

Arguments

  • fermi_energy: Fermi energy in eV
  • origin: 3, Å⁻¹, origin of the grid
  • span_vectors: 3 * 3, Å⁻¹, each column is a spanning vector
  • E: n_bands * nx * ny * nz, eigenvalues at each grid point
source
WannierIO.read_cubeMethod
read_cube(filename)
+

Read cube file.

Note

By default, cube use Bohr unit, here all returns are in Cartesian coordinates, Å unit.

source
WannierIO.write_cubeMethod
write_cube(
     filename,
     atom_positions,
     atom_numbers,
@@ -20,4 +20,4 @@
     voxel_vectors,
     W
 )
-

Write cube file.

Arguments

  • atom_positions: 3 * n_atoms, Å, cartesian coordinates
  • atom_numbers: n_atoms, atomic numbers
  • origin: 3, Å, origin of the grid
  • voxel_vectors: 3 * 3, Å, each column is a voxel vector
  • W: nx * ny * nz, volumetric data
source
+

Write cube file.

Arguments

source diff --git a/dev/api/w90/index.html b/dev/api/w90/index.html index fe1fa96..1811529 100644 --- a/dev/api/w90/index.html +++ b/dev/api/w90/index.html @@ -1,13 +1,13 @@ Wannier90 · WannierIO.jl

Wannier90 files

Warning

Some of the functions, e.g. read_amn, write_amn, read_chk, write_chk, etc., support reading/writing Fortran unformatted files. However, the Fortran unformatted files are machine and compiler dependent. Therefore, it is not guaranteed that these functions work for all the cases. Currently, the functions are tested on the following platforms:

  • Linux + gfortran 11.2

Public API

WannierIO.read_amnFunction
read_amn(filename)
 read_amn(filename, ::FortranText)
-read_amn(filename, ::FortranBinaryStream)

Read wannier90 amn file.

Return

  • A: length-n_kpts vector, each element is a n_bands * n_wann matrix.
  • header: first line of the file

Note there are three versions of this function: the 1st one is a wrapper function that automatically detect the format (text or binary) of the file, and does some additional pretty printing to give user a quick hint of the dimensions of the A matrix; it internally calls the 2nd or the 3rd version for actual reading.

Wannier90 only has Fortran text format for amn, however I wrote a custom version of QE pw2wannier90.x that can output Fortran binary format (using Fortran stream IO) to save some disk space. The 1st function auto detect the file format so it is transparent to the user.

source
WannierIO.write_amnFunction
write_amn(filename, A; header=default_header(), binary=false)
+read_amn(filename, ::FortranBinaryStream)

Read wannier90 amn file.

Return

  • A: length-n_kpts vector, each element is a n_bands * n_wann matrix.
  • header: first line of the file

Note there are three versions of this function: the 1st one is a wrapper function that automatically detect the format (text or binary) of the file, and does some additional pretty printing to give user a quick hint of the dimensions of the A matrix; it internally calls the 2nd or the 3rd version for actual reading.

Wannier90 only has Fortran text format for amn, however I wrote a custom version of QE pw2wannier90.x that can output Fortran binary format (using Fortran stream IO) to save some disk space. The 1st function auto detect the file format so it is transparent to the user.

source
WannierIO.write_amnFunction
write_amn(filename, A; header=default_header(), binary=false)
 write_amn(filename, A, ::FortranText; header=default_header())
-write_amn(filename, A, ::FortranBinaryStream; header=default_header())

Write wannier90 amn file.

Arguments

  • filename: output filename
  • A: a length-n_kpts vector, each element is a n_bands * n_wann matrix

Keyword arguments

  • header: 1st line of the file
  • binary: write as Fortran unformatted file, which is the Wannier90 default. Here the binary kwargs is provided for convenience.

Same as read_amn there are three versions of this function, the 1st one is a wrapper function, it calls the 2nd or the 3rd version depending on the binary kwargs.

source
WannierIO.read_w90_bandMethod
read_w90_band(prefix)
-

Read prefix_band.dat, prefix_band.kpt, prefix_band.labelinfo.dat.

Arguments

  • prefix: prefix of the filenames (or called seedname in wannier90), NOT the full filename.

Return

  • x: n_kpts, x axis value of kpath, in cartesian length
  • eigenvalues: length-n_kpts vector, each element is a length-n_bands vector of band energies
  • kpoints: a vector of length n_kpts, fractional coordinates
  • kweights: a vector of length n_kpts, weights of kpoints
  • symm_point_indices: index of high-symmetry points in prefix_band.dat
  • symm_point_labels: name of high-symmetry points
source
WannierIO.read_w90_band_datMethod
read_w90_band_dat(filename)
-

Read prefix_band.dat file generated by wannier90.x, or prefix-band.dat file generated by postw90.x.

Return

  • x: n_kpts, x axis value of kpath, in cartesian length
  • eigenvalues: length-n_kpts vector, each elemnt is a length-n_bands vector of band energies
  • extras: optional (the postw90.x might generate a file with a third column), same size as eigenvalues, often the color of each eigenvalue, e.g., spin projection
source
WannierIO.read_w90_band_kptMethod
read_w90_band_kpt(filename)
-

Read a prefix_band.kpt file.

Return

  • kpoints: a vector of length n_kpts, fractional coordinates
  • kweights: a vector of length n_kpts, weights of kpoints
source
WannierIO.read_w90_band_labelinfoMethod
read_w90_band_labelinfo(filename)
-

Read prefix_band.labelinfo file.

Return

  • symm_point_indices: index of high-symmetry points in prefix_band.dat
  • symm_point_labels: name of high-symmetry points
source
WannierIO.write_w90_bandMethod
write_w90_band(
+write_amn(filename, A, ::FortranBinaryStream; header=default_header())

Write wannier90 amn file.

Arguments

  • filename: output filename
  • A: a length-n_kpts vector, each element is a n_bands * n_wann matrix

Keyword arguments

  • header: 1st line of the file
  • binary: write as Fortran unformatted file, which is the Wannier90 default. Here the binary kwargs is provided for convenience.

Same as read_amn there are three versions of this function, the 1st one is a wrapper function, it calls the 2nd or the 3rd version depending on the binary kwargs.

source
WannierIO.read_w90_bandMethod
read_w90_band(prefix)
+

Read prefix_band.dat, prefix_band.kpt, prefix_band.labelinfo.dat.

Arguments

  • prefix: prefix of the filenames (or called seedname in wannier90), NOT the full filename.

Return

  • x: n_kpts, x axis value of kpath, in cartesian length
  • eigenvalues: length-n_kpts vector, each element is a length-n_bands vector of band energies
  • kpoints: a vector of length n_kpts, fractional coordinates
  • kweights: a vector of length n_kpts, weights of kpoints
  • symm_point_indices: index of high-symmetry points in prefix_band.dat
  • symm_point_labels: name of high-symmetry points
source
WannierIO.read_w90_band_datMethod
read_w90_band_dat(filename)
+

Read prefix_band.dat file generated by wannier90.x, or prefix-band.dat file generated by postw90.x.

Return

  • x: n_kpts, x axis value of kpath, in cartesian length
  • eigenvalues: length-n_kpts vector, each elemnt is a length-n_bands vector of band energies
  • extras: optional (the postw90.x might generate a file with a third column), same size as eigenvalues, often the color of each eigenvalue, e.g., spin projection
source
WannierIO.read_w90_band_kptMethod
read_w90_band_kpt(filename)
+

Read a prefix_band.kpt file.

Return

  • kpoints: a vector of length n_kpts, fractional coordinates
  • kweights: a vector of length n_kpts, weights of kpoints
source
WannierIO.read_w90_band_labelinfoMethod
read_w90_band_labelinfo(filename)
+

Read prefix_band.labelinfo file.

Return

  • symm_point_indices: index of high-symmetry points in prefix_band.dat
  • symm_point_labels: name of high-symmetry points
source
WannierIO.write_w90_bandMethod
write_w90_band(
     prefix;
     x,
     eigenvalues,
@@ -16,42 +16,42 @@
     symm_point_indices,
     symm_point_labels
 )
-

Write prefix_band.dat, prefix_band.kpt, prefix_band.labelinfo.dat.

Arguments

  • prefix: prefix of prefix_band.dat, prefix_band.kpt, prefix_band.labelinfo.dat

Keyword Arguments

  • x: n_kpts, x axis value, in cartesian length
  • eigenvalues: length-n_kpts vector, each element is a length-n_bands vector of band energies
  • kpoints: length-n_kpts vector, fractional coordinates
  • kweights: a vector of length n_kpts, weights of kpoints
  • symm_point_indices: index of high-symmetry points in prefix_band.dat
  • symm_point_labels: name of high-symmetry points
source
WannierIO.write_w90_band_datMethod
write_w90_band_dat(filename; x, eigenvalues, extras)
-

Write prefix_band.dat file.

Arguments

  • filename: filename of prefix_band.dat

Keyword Arguments

  • x: n_kpts, x axis value, in cartesian length
  • eigenvalues: length-n_kpts vector, each element is a length-n_bands vector of band energies
  • extras: optional, same size as eigenvalues, will be written as the third column of prefix_band.dat. The prefix-band.dat file generated by postw90.x sometimes has a third column for e.g. the color of the eigenvalues
source
WannierIO.write_w90_band_kptMethod
write_w90_band_kpt(filename; kpoints, kweights)
-

Write prefix_band.kpt file.

Arguments

  • filename: filename of prefix_band.kpt

Keyword Arguments

  • kpoints: length-n_kpts vector, fractional coordinates
  • kweights: n_kpts, optional, weights of kpoints, default to 1.0.
source
WannierIO.write_w90_band_labelinfoMethod
write_w90_band_labelinfo(
+

Write prefix_band.dat, prefix_band.kpt, prefix_band.labelinfo.dat.

Arguments

  • prefix: prefix of prefix_band.dat, prefix_band.kpt, prefix_band.labelinfo.dat

Keyword Arguments

  • x: n_kpts, x axis value, in cartesian length
  • eigenvalues: length-n_kpts vector, each element is a length-n_bands vector of band energies
  • kpoints: length-n_kpts vector, fractional coordinates
  • kweights: a vector of length n_kpts, weights of kpoints
  • symm_point_indices: index of high-symmetry points in prefix_band.dat
  • symm_point_labels: name of high-symmetry points
source
WannierIO.write_w90_band_datMethod
write_w90_band_dat(filename; x, eigenvalues, extras)
+

Write prefix_band.dat file.

Arguments

  • filename: filename of prefix_band.dat

Keyword Arguments

  • x: n_kpts, x axis value, in cartesian length
  • eigenvalues: length-n_kpts vector, each element is a length-n_bands vector of band energies
  • extras: optional, same size as eigenvalues, will be written as the third column of prefix_band.dat. The prefix-band.dat file generated by postw90.x sometimes has a third column for e.g. the color of the eigenvalues
source
WannierIO.write_w90_band_kptMethod
write_w90_band_kpt(filename; kpoints, kweights)
+

Write prefix_band.kpt file.

Arguments

  • filename: filename of prefix_band.kpt

Keyword Arguments

  • kpoints: length-n_kpts vector, fractional coordinates
  • kweights: n_kpts, optional, weights of kpoints, default to 1.0.
source
WannierIO.write_w90_band_labelinfoMethod
write_w90_band_labelinfo(
     filename;
     x,
     kpoints,
     symm_point_indices,
     symm_point_labels
 )
-

Write prefix_band.labelinfo file.

Arguments

  • filename: filename of prefix_band.labelinfo

Keyword Arguments

  • x: n_kpts-vector, x axis value, in cartesian length
  • kpoints: length-n_kpts vector, fractional coordinates
  • symm_point_indices: index of high-symmetry points in prefix_band.dat
  • symm_point_labels: name of high-symmetry points
source
WannierIO.read_chkMethod
read_chk(filename)
+

Write prefix_band.labelinfo file.

Arguments

  • filename: filename of prefix_band.labelinfo

Keyword Arguments

  • x: n_kpts-vector, x axis value, in cartesian length
  • kpoints: length-n_kpts vector, fractional coordinates
  • symm_point_indices: index of high-symmetry points in prefix_band.dat
  • symm_point_labels: name of high-symmetry points
source
WannierIO.read_chkMethod
read_chk(filename)
 read_chk(filename, ::FortranText)
-read_chk(filename, ::FortranBinary)

Read wannier90 chk checkpoint file.

Similar to read_amn, the 1st version auto detect chk file format (binary or text) and read it.

source
WannierIO.write_chkFunction
write_chk(filename, chk::Chk; binary=false)
+read_chk(filename, ::FortranBinary)

Read wannier90 chk checkpoint file.

Similar to read_amn, the 1st version auto detect chk file format (binary or text) and read it.

source
WannierIO.write_chkFunction
write_chk(filename, chk::Chk; binary=false)
 write_chk(filename, chk::Chk, ::FortranText)
-write_chk(filename, chk::Chk, ::FortranBinary)

Write wannier90 chk file.

Similar to write_amn, the 1st version is a convenience wrapper.

Keyword arguments

  • binary: write as Fortran binary file or not. Although wannier90 default is Fortran binary format, here the default is false since Fortran binary depends on compiler and platform, so it is not guaranteed to always work.
source
WannierIO.read_eigFunction
read_eig(filename)
+write_chk(filename, chk::Chk, ::FortranBinary)

Write wannier90 chk file.

Similar to write_amn, the 1st version is a convenience wrapper.

Keyword arguments

  • binary: write as Fortran binary file or not. Although wannier90 default is Fortran binary format, here the default is false since Fortran binary depends on compiler and platform, so it is not guaranteed to always work.
source
WannierIO.read_eigFunction
read_eig(filename)
 read_eig(filename, ::FortranText)
-read_eig(filename, ::FortranBinaryStream)

Read the wannier90 eig file.

Return

  • eigenvalues: a lenth-n_kpts vector, each element is a length-n_bands vector

The 1st version is a convenience wrapper function for the 2nd and 3rd versions.

source
WannierIO.write_eigFunction
write_eig(filename, eigenvalues; binary=false)
+read_eig(filename, ::FortranBinaryStream)

Read the wannier90 eig file.

Return

  • eigenvalues: a lenth-n_kpts vector, each element is a length-n_bands vector

The 1st version is a convenience wrapper function for the 2nd and 3rd versions.

source
WannierIO.write_eigFunction
write_eig(filename, eigenvalues; binary=false)
 write_eig(filename, eigenvalues, ::FortranText)
-write_eig(filename, eigenvalues, ::FortranBinaryStream)

Write eig file.

Arguments

  • eigenvalues: a length-n_kpts vector, each element is a length-n_bands vector

Keyword arguments

  • binary: if true write in Fortran binary format.
source
WannierIO.read_w90_hrdatMethod
read_w90_hrdat(filename)
-

Read prefix_hr.dat.

Return

  • Rvectors: $\mathbf{R}$-vectors on which operators are defined
  • Rdegens: degeneracies of each $\mathbf{R}$-vector
  • H: Hamiltonian $\mathbf{H}(\mathbf{R})$
  • header: the first line of the file
source
WannierIO.read_mmnFunction
read_mmn(filename)
+write_eig(filename, eigenvalues, ::FortranBinaryStream)

Write eig file.

Arguments

  • eigenvalues: a length-n_kpts vector, each element is a length-n_bands vector

Keyword arguments

  • binary: if true write in Fortran binary format.
source
WannierIO.read_w90_hrdatMethod
read_w90_hrdat(filename)
+

Read prefix_hr.dat.

Return

  • Rvectors: $\mathbf{R}$-vectors on which operators are defined
  • Rdegens: degeneracies of each $\mathbf{R}$-vector
  • H: Hamiltonian $\mathbf{H}(\mathbf{R})$
  • header: the first line of the file
source
WannierIO.read_mmnFunction
read_mmn(filename)
 read_mmn(filename, ::FortranText)
-read_mmn(filename, ::FortranBinaryStream)

Read wannier90 mmn file.

Return

  • M: length-n_kpts vector, each element is a length-n_bvecs vector, then each element is a n_bands * n_bands matrix
  • kpb_k: length-n_kpts vector, each element is a length-n_bvecs vector of integers for the indices of the neighboring kpoints
  • kpb_G: length-n_kpts vector, each element is a lenght-n_bvecs vector of of Vec3{Int}, which are the translation vectors
  • header: 1st line of the file

The translation vector G is defined as b = kpoints[kpb_k[ik][ib]] + kpb_G[ik][ib] - kpoints[ik], where b is the ib-th bvector of the ik-th kpoint.

The 1st version is a convenience wrapper for the other two.

source
WannierIO.write_mmnFunction
write_mmn(filename; M, kpb_k, kpb_G; header=default_header(), binary=false)
+read_mmn(filename, ::FortranBinaryStream)

Read wannier90 mmn file.

Return

  • M: length-n_kpts vector, each element is a length-n_bvecs vector, then each element is a n_bands * n_bands matrix
  • kpb_k: length-n_kpts vector, each element is a length-n_bvecs vector of integers for the indices of the neighboring kpoints
  • kpb_G: length-n_kpts vector, each element is a lenght-n_bvecs vector of of Vec3{Int}, which are the translation vectors
  • header: 1st line of the file

The translation vector G is defined as b = kpoints[kpb_k[ik][ib]] + kpb_G[ik][ib] - kpoints[ik], where b is the ib-th bvector of the ik-th kpoint.

The 1st version is a convenience wrapper for the other two.

source
WannierIO.write_mmnFunction
write_mmn(filename; M, kpb_k, kpb_G; header=default_header(), binary=false)
 write_mmn(filename; M, kpb_k, kpb_G, ::FortranText; header=default_header(), binary=false)
-write_mmn(filename; M, kpb_k, kpb_G, ::FortranBinaryStream; header=default_header(), binary=false)

Write wannier90 mmn file.

Arguments

  • filename: output file name
  • M: length-n_kpts vector of n_bands * n_bands * n_bvecs arrays
  • kpb_k: length-n_kpts vector of length-n_bvecs vector of integers
  • kpb_G: length-n_kpts vector of length-n_bvecs vector of Vec3{Int} for bvectors

Keyword arguments

  • header: header string
  • binary: if true write in Fortran binary format

The 1st version is a convenience wrapper for the other two.

source
WannierIO.read_nnkpFunction
read_nnkp(filename)
+write_mmn(filename; M, kpb_k, kpb_G, ::FortranBinaryStream; header=default_header(), binary=false)

Write wannier90 mmn file.

Arguments

  • filename: output file name
  • M: length-n_kpts vector of n_bands * n_bands * n_bvecs arrays
  • kpb_k: length-n_kpts vector of length-n_bvecs vector of integers
  • kpb_G: length-n_kpts vector of length-n_bvecs vector of Vec3{Int} for bvectors

Keyword arguments

  • header: header string
  • binary: if true write in Fortran binary format

The 1st version is a convenience wrapper for the other two.

source
WannierIO.read_nnkpFunction
read_nnkp(filename)
 read_nnkp(filename, ::Wannier90Text)
-read_nnkp(filename, ::Wannier90Toml)

Read wannier90 nnkp file.

Return

  • lattice: each column is a lattice vector
  • recip_lattice: each column is a reciprocal lattice vector
  • kpoints: length-n_kpts vector, each element is Vec3, in fractional coordinates
  • kpb_k: length-n_kpts vector, each element is a length-n_bvecs vector of integers, index of kpoints
  • kpb_G: length-n_kpts vector, each element is a length-n_bvecs vector, then each element is Vec3 for translations, fractional w.r.t recip_lattice

Wannier90 nnkp file is a plain text format, the 2nd version reads nnkp file in Wannier90 format. The thrid version read a TOML-format nnkp file, which is defined by this package, see write_nnkp. The 1st version auto detects the format and parse it.

source
WannierIO.write_nnkpFunction
write_nnkp(filename; toml=false, kwargs...)
+read_nnkp(filename, ::Wannier90Toml)

Read wannier90 nnkp file.

Return

  • lattice: each column is a lattice vector
  • recip_lattice: each column is a reciprocal lattice vector
  • kpoints: length-n_kpts vector, each element is Vec3, in fractional coordinates
  • kpb_k: length-n_kpts vector, each element is a length-n_bvecs vector of integers, index of kpoints
  • kpb_G: length-n_kpts vector, each element is a length-n_bvecs vector, then each element is Vec3 for translations, fractional w.r.t recip_lattice

Wannier90 nnkp file is a plain text format, the 2nd version reads nnkp file in Wannier90 format. The thrid version read a TOML-format nnkp file, which is defined by this package, see write_nnkp. The 1st version auto detects the format and parse it.

source
WannierIO.write_nnkpFunction
write_nnkp(filename; toml=false, kwargs...)
 write_nnkp(filename, ::Wannier90Text; kwargs...)
-write_nnkp(filename, ::Wannier90Toml; kwargs...)

Write a nnkp file that can be used by DFT codes, e.g., QE pw2wannier90.

Keyword Arguments

  • toml: write to a TOML file, otherwise write to a Wannier90 text file format
  • recip_lattice: each column is a reciprocal lattice vector
  • kpoints: length-n_kpts vector of Vec3, in fractional coordinates
  • kpb_k: length-n_kpts vector, each element is a length-n_bvecs vector of integers, index of kpoints
  • kpb_G: length-n_kpts vector, each element is a length-n_bvecs vector, then each element is a Vec3 for translation vector, fractional w.r.t. recip_lattice
  • n_wann: if given, write an auto_projections block
  • exclude_bands: if given, write the specified band indices in the exclude_bands block
  • header: first line of the file
Note

Only use auto_projections, the projections block is not supported.

source
WannierIO.read_w90_rdatMethod
read_w90_rdat(filename)
-

Read prefix_r.dat.

Return

  • Rvectors: $\mathbf{R}$-vectors on which operators are defined
  • r_x: $x$-component of position operator
  • r_y: $y$-component of position operator
  • r_z: $z$-component of position operator
  • header: the first line of the file
source
WannierIO.read_spnFunction
read_spn(filename)
+write_nnkp(filename, ::Wannier90Toml; kwargs...)

Write a nnkp file that can be used by DFT codes, e.g., QE pw2wannier90.

Keyword Arguments

  • toml: write to a TOML file, otherwise write to a Wannier90 text file format
  • recip_lattice: each column is a reciprocal lattice vector
  • kpoints: length-n_kpts vector of Vec3, in fractional coordinates
  • kpb_k: length-n_kpts vector, each element is a length-n_bvecs vector of integers, index of kpoints
  • kpb_G: length-n_kpts vector, each element is a length-n_bvecs vector, then each element is a Vec3 for translation vector, fractional w.r.t. recip_lattice
  • n_wann: if given, write an auto_projections block
  • exclude_bands: if given, write the specified band indices in the exclude_bands block
  • header: first line of the file
Note

Only use auto_projections, the projections block is not supported.

source
WannierIO.read_w90_rdatMethod
read_w90_rdat(filename)
+

Read prefix_r.dat.

Return

  • Rvectors: $\mathbf{R}$-vectors on which operators are defined
  • r_x: $x$-component of position operator
  • r_y: $y$-component of position operator
  • r_z: $z$-component of position operator
  • header: the first line of the file
source
WannierIO.read_spnFunction
read_spn(filename)
 read_spn(filename, ::FortranText)
-read_spn(filename, ::FortranBinary)

Read the wannier90 spn file.

Return

  • Sx: spin x, a length-n_kpts vector, each element is a n_bands-by-n_bands matrix
  • Sy: spin y, a length-n_kpts vector, each element is a n_bands-by-n_bands matrix
  • Sz: spin z, a length-n_kpts vector, each element is a n_bands-by-n_bands matrix
  • header: 1st line of the file
source
WannierIO.write_spnFunction
write_spn(filename, Sx, Sy, Sz; binary=false, header)
+read_spn(filename, ::FortranBinary)

Read the wannier90 spn file.

Return

  • Sx: spin x, a length-n_kpts vector, each element is a n_bands-by-n_bands matrix
  • Sy: spin y, a length-n_kpts vector, each element is a n_bands-by-n_bands matrix
  • Sz: spin z, a length-n_kpts vector, each element is a n_bands-by-n_bands matrix
  • header: 1st line of the file
source
WannierIO.write_spnFunction
write_spn(filename, Sx, Sy, Sz; binary=false, header)
 write_spn(filename, Sx, Sy, Sz, ::FortranText; header)
-write_spn(filename, Sx, Sy, Sz, ::FortranBinary; header)

Write the spn file.

source
WannierIO.read_w90_tbdatMethod
read_w90_tbdat(filename)
-

Read prefix_tb.dat.

Return

  • lattice: each column is a lattice vector in Å
  • Rvectors: $\mathbf{R}$-vectors on which operators are defined
  • Rdegens: degeneracies of each $\mathbf{R}$-vector
  • H: Hamiltonian $\mathbf{H}(\mathbf{R})$
  • r_x: $x$-component of position operator
  • r_x: $y$-component of position operator
  • r_x: $z$-component of position operator
  • header: the first line of the file
source
WannierIO.read_w90_tbdatMethod
read_w90_tbdat(filename)
+

Read prefix_tb.dat.

Return

  • lattice: each column is a lattice vector in Å
  • Rvectors: $\mathbf{R}$-vectors on which operators are defined
  • Rdegens: degeneracies of each $\mathbf{R}$-vector
  • H: Hamiltonian $\mathbf{H}(\mathbf{R})$
  • r_x: $x$-component of position operator
  • r_x: $y$-component of position operator
  • r_x: $z$-component of position operator
  • header: the first line of the file
source
WannierIO.read_uHuFunction
read_uHu(filename)
 read_uHu(filename, ::FortranText; transpose_band_indices=true)
-read_uHu(filename, ::FortranBinary; transpose_band_indices=true)

Read the wannier90 uHu file.

Keyword Arguments

  • transpose_band_indices: QE pw2wannier90.x writes the matrix in a strange transposed manner; if reading a QE-generated uHu file, this flag should be true to restore the band indices order, so that the returned matrix has the correct order, i.e., uHu[ik][ib1, ib2][m, n] is $\langle u_{m, k + b_1}| H | u_{n, k + b_2} \rangle$

Return

  • uHu: a length-n_kpts vector, each element is a n_bvecs * n_bvecs matrix, then each element is a n_bands * n_bands matrix
  • header: 1st line of the file
source
WannierIO.write_uHuFunction
write_uHu(filename, uHu; binary=false, header)
+read_uHu(filename, ::FortranBinary; transpose_band_indices=true)

Read the wannier90 uHu file.

Keyword Arguments

  • transpose_band_indices: QE pw2wannier90.x writes the matrix in a strange transposed manner; if reading a QE-generated uHu file, this flag should be true to restore the band indices order, so that the returned matrix has the correct order, i.e., uHu[ik][ib1, ib2][m, n] is $\langle u_{m, k + b_1}| H | u_{n, k + b_2} \rangle$

Return

  • uHu: a length-n_kpts vector, each element is a n_bvecs * n_bvecs matrix, then each element is a n_bands * n_bands matrix
  • header: 1st line of the file
source
WannierIO.write_uHuFunction
write_uHu(filename, uHu; binary=false, header)
 write_uHu(filename, uHu, ::FortranText; header)
-write_uHu(filename, uHu, ::FortranBinary; header)

Write the uHu file.

Keyword Arguments

source
WannierIO.read_unkFunction
read_unk(filename)
+write_uHu(filename, uHu, ::FortranBinary; header)

Write the uHu file.

Keyword Arguments

source
WannierIO.read_unkFunction
read_unk(filename)
 read_unk(filename, ::FortranText)
-read_unk(filename, ::FortranBinary)

Read wannier90 UNK file for the periodic part of Bloch wavefunctions.

Return

  • ik: k-point index, start from 1
  • Ψ: periodic part of Bloch wavefunctions in real space, size = (n_gx, n_gy, n_gz, n_bands, n_spin)
source
WannierIO.write_unkFunction
write_unk(filename, ik, Ψ; binary=false)
+read_unk(filename, ::FortranBinary)

Read wannier90 UNK file for the periodic part of Bloch wavefunctions.

Return

  • ik: k-point index, start from 1
  • Ψ: periodic part of Bloch wavefunctions in real space, size = (n_gx, n_gy, n_gz, n_bands, n_spin)
source
WannierIO.write_unkFunction
write_unk(filename, ik, Ψ; binary=false)
 write_unk(filename, ik, Ψ, ::FortranText)
-write_unk(filename, ik, Ψ, ::FortranBinary)

Write UNK file for the periodic part of Bloch wavefunctions.

Arguments

  • ik: at which kpoint? start from 1
  • Ψ: Bloch wavefunctions, size(Ψ) = (n_gx, n_gy, n_gz, n_bands, n_spin)

Keyword arguments

  • binary: write as Fortran unformatted file
source
WannierIO.read_winFunction
read_win(filename; fix_inputs=true)
+write_unk(filename, ik, Ψ, ::FortranBinary)

Write UNK file for the periodic part of Bloch wavefunctions.

Arguments

  • ik: at which kpoint? start from 1
  • Ψ: Bloch wavefunctions, size(Ψ) = (n_gx, n_gy, n_gz, n_bands, n_spin)

Keyword arguments

  • binary: write as Fortran unformatted file
source
WannierIO.read_winFunction
read_win(filename; fix_inputs=true)
 read_win(filename, ::Wannier90Text; fix_inputs=true)
-read_win(filename, ::Wannier90Toml; fix_inputs=true)

Read wannier90 input win file.

Arguments

  • filename: The name of the input file.

Keyword Arguments

  • fix_inputs: sanity check and fix the input parameters, e.g., set num_bands = num_wann if num_bands is not specified, convert atoms_cart always to atoms_frac, etc. See also fix_win!.
source
WannierIO.write_winFunction
write_win(filename; toml=false, kwargs...)
+read_win(filename, ::Wannier90Toml; fix_inputs=true)

Read wannier90 input win file.

Arguments

  • filename: The name of the input file.

Keyword Arguments

  • fix_inputs: sanity check and fix the input parameters, e.g., set num_bands = num_wann if num_bands is not specified, convert atoms_cart always to atoms_frac, etc. See also fix_win!.
source
WannierIO.write_winFunction
write_win(filename; toml=false, kwargs...)
 write_win(filename, ::Wannier90Text; kwargs...)
 write_win(filename, ::Wannier90Toml; kwargs...)

Write input parameters into a wannier90 win file.

The input parameters are keyword arguments, with key names same as that of wannier90.

Examples

using WannierIO
 
@@ -115,9 +115,9 @@
     ],
     # additional parameters can be passed as keyword arguments, e.g.,
     num_iter=500,
-)
source
WannierIO.read_woutMethod
read_wout(filename)
-

Parse wannire90 wout file.

Return

  • lattice: each column is a lattice vector in Å
  • recip_lattice: each column is a reciprocal lattice vector in Å⁻¹
  • atom_labels: atomic symbols
  • atom_positions: in fractional coordinates
  • centers: final each WF centers in Å
  • spreads: final each WF spreads in Ų
  • ΩI, ΩD, ΩOD, Ωtotal: final spread (components) in Ų
source
WannierIO.read_w90_wsvecMethod
read_w90_wsvec(filename)
-

Read prefix_wsvec.dat.

Return

  • mdrs: whether use MDRS interpolation, i.e. the use_ws_distance in the header
  • Rvectors: the $\mathbf{R}$-vectors
  • Tvectors: the $\mathbf{T}_{m n \mathbf{R}}$-vectors. Returned only mdrs = true.
  • Tdegens: the degeneracies of $\mathbf{T}_{m n \mathbf{R}}$-vectors. Returned only mdrs = true.
  • n_wann: number of WFs
  • header: the first line of the file
source
WannierIO.read_woutMethod
read_wout(filename; iterations)
+

Parse wannire90 wout file.

Keyword Arguments

  • iterations: if true, parse all the iterations of disentanglement and maximal localization. Default is false.

Return

  • lattice: each column is a lattice vector in Å
  • recip_lattice: each column is a reciprocal lattice vector in Å⁻¹
  • atom_labels: atomic symbols
  • atom_positions: in fractional coordinates
  • centers: final each WF centers in Å
  • spreads: final each WF spreads in Ų
  • ΩI, ΩD, ΩOD, Ωtotal: final spread (components) in Ų
source
WannierIO.read_w90_wsvecMethod
read_w90_wsvec(filename)
+

Read prefix_wsvec.dat.

Return

  • mdrs: whether use MDRS interpolation, i.e. the use_ws_distance in the header
  • Rvectors: the $\mathbf{R}$-vectors
  • Tvectors: the $\mathbf{T}_{m n \mathbf{R}}$-vectors. Returned only mdrs = true.
  • Tdegens: the degeneracies of $\mathbf{T}_{m n \mathbf{R}}$-vectors. Returned only mdrs = true.
  • n_wann: number of WFs
  • header: the first line of the file
source
WannierIO.write_w90_wsvecMethod
write_w90_wsvec(
     filename;
     Rvectors,
     n_wann,
@@ -125,8 +125,8 @@
     Tdegens,
     header
 )
-

Write prefix_wsvec.dat.

Keyword Arguments

  • n_wann: for Wigner-Seitz Rvectors, needs to provide a n_wann for number of Wannier functions; for MDRS Rvectors, the n_wann is optional and can be automatically determined from the Tvectors
  • Tvectors and Tdegens: if provided, write in MDRS format; otherwise, write in Wigner-Seitz format

Also see the return values of read_w90_wsvec.

source

Private API

These are some lower-level types/functions that are (probably) less used, thus not exported. Of course, you can still use them by prefixing WannierIO., e.g., WannierIO.read_w90_band_dat(filename).

WannierIO.ChkType

Struct for storing matrices in prefix.chk file.

struct Chk{T<:Real}

One-to-one mapping to the wannier90 chk file, but renaming the variable names so that they are consistent with the rest of the code.

Fields

  • header: The header line, usually contains date and time

  • n_bands: number of bands, can be auto set in constructor according to dimensions of other variables

  • n_exclude_bands: number of excluded bands, can be auto set in constructor

  • exclude_bands: Indices of excluded bands, starts from 1. Vector of integers, size: n_exclude_bands

  • lattice: Matrix of size 3 x 3, each column is a lattice vector in Å unit

  • recip_lattice: Matrix of size 3 x 3, each column is a reciprocal lattice vector in Å⁻¹ unit

  • n_kpts: number of kpoints, can be auto set in constructor

  • kgrid: dimensions of kpoint grid, 3 integers

  • kpoints: kpoint coordinates, fractional, length-n_kpts vector

  • n_bvecs: number of b-vectors, can be auto set in constructor

  • n_wann: number of Wannier functions, can be auto set in constructor

  • checkpoint: a string to indicate the current step (after disentanglement, after maximal localization, ...) in wannier90

  • have_disentangled: Have finished disentanglement or not

  • ΩI: Omega invariant part of MV spreads, in Ų unit

  • dis_bands: Indices of bands taking part in disentanglement, not frozen bands! length-n_kpts vector, each element is a length-n_bands vector of bool.

    This is needed since W90 puts all the disentanglement bands in the first several rows of Udis, (and the first few columns of Udis are the frozen bands) so directly multiplying eigenvalues e.g. (Udis * U)' * diag(eigenvalues) * (Udis * U) is wrong!

  • n_dis: number of bands taking part in disentanglement at each kpoint. can be auto set in constructor from dis_bands

  • Udis: Semi-unitary matrix for disentanglement, length-n_kpts vector, each elment has size: n_bands x n_wann, i.e., the u_matrix_opt in wannier90

  • Uml: Unitary matrix for maximal localization, length-n_kpts vector, each element has size: n_wann x n_wann, i.e., the u_matrix in wannier90. The abbreviation ml stands for maximal localization, so as to differentiate from the (combined) unitary matrix U = Udis * Uml.

  • M: Wannier-gauge overlap matrix, length-n_kpts vector of length-n_bvecs vector, each element is a matrix of size n_wann x n_wann, i.e., the m_matrix in wannier90

  • r: Wannier function centers, length-n_wann vector, Cartesian coordinates in Å unit, i.e., the wannier_centres variable in wannier90

  • ω: Wannier function spreads, length-n_wann vector, Ų unit, i.e., the wannier_spreads variable in wannier90

source
WannierIO.ChkMethod
Chk(
+

Write prefix_wsvec.dat.

Keyword Arguments

  • n_wann: for Wigner-Seitz Rvectors, needs to provide a n_wann for number of Wannier functions; for MDRS Rvectors, the n_wann is optional and can be automatically determined from the Tvectors
  • Tvectors and Tdegens: if provided, write in MDRS format; otherwise, write in Wigner-Seitz format

Also see the return values of read_w90_wsvec.

source

Private API

These are some lower-level types/functions that are (probably) less used, thus not exported. Of course, you can still use them by prefixing WannierIO., e.g., WannierIO.read_w90_band_dat(filename).

WannierIO.ChkType

Struct for storing matrices in prefix.chk file.

struct Chk{T<:Real}

One-to-one mapping to the wannier90 chk file, but renaming the variable names so that they are consistent with the rest of the code.

Fields

  • header: The header line, usually contains date and time

  • n_bands: number of bands, can be auto set in constructor according to dimensions of other variables

  • n_exclude_bands: number of excluded bands, can be auto set in constructor

  • exclude_bands: Indices of excluded bands, starts from 1. Vector of integers, size: n_exclude_bands

  • lattice: Matrix of size 3 x 3, each column is a lattice vector in Å unit

  • recip_lattice: Matrix of size 3 x 3, each column is a reciprocal lattice vector in Å⁻¹ unit

  • n_kpts: number of kpoints, can be auto set in constructor

  • kgrid: dimensions of kpoint grid, 3 integers

  • kpoints: kpoint coordinates, fractional, length-n_kpts vector

  • n_bvecs: number of b-vectors, can be auto set in constructor

  • n_wann: number of Wannier functions, can be auto set in constructor

  • checkpoint: a string to indicate the current step (after disentanglement, after maximal localization, ...) in wannier90

  • have_disentangled: Have finished disentanglement or not

  • ΩI: Omega invariant part of MV spreads, in Ų unit

  • dis_bands: Indices of bands taking part in disentanglement, not frozen bands! length-n_kpts vector, each element is a length-n_bands vector of bool.

    This is needed since W90 puts all the disentanglement bands in the first several rows of Udis, (and the first few columns of Udis are the frozen bands) so directly multiplying eigenvalues e.g. (Udis * U)' * diag(eigenvalues) * (Udis * U) is wrong!

  • n_dis: number of bands taking part in disentanglement at each kpoint. can be auto set in constructor from dis_bands

  • Udis: Semi-unitary matrix for disentanglement, length-n_kpts vector, each elment has size: n_bands x n_wann, i.e., the u_matrix_opt in wannier90

  • Uml: Unitary matrix for maximal localization, length-n_kpts vector, each element has size: n_wann x n_wann, i.e., the u_matrix in wannier90. The abbreviation ml stands for maximal localization, so as to differentiate from the (combined) unitary matrix U = Udis * Uml.

  • M: Wannier-gauge overlap matrix, length-n_kpts vector of length-n_bvecs vector, each element is a matrix of size n_wann x n_wann, i.e., the m_matrix in wannier90

  • r: Wannier function centers, length-n_wann vector, Cartesian coordinates in Å unit, i.e., the wannier_centres variable in wannier90

  • ω: Wannier function spreads, length-n_wann vector, Ų unit, i.e., the wannier_spreads variable in wannier90

source
WannierIO.ChkMethod
Chk(
     header,
     exclude_bands,
     lattice,
@@ -143,12 +143,105 @@
     r,
     ω
 )
-

Convenience constructor of Chk struct that auto set some fields.

source
WannierIO._check_eig_orderMethod
_check_eig_order(eigenvalues; digits)
-

Check that eigenvalues are in order.

Some times there are small noises, use digits to set the number of digits for comparisons.

source
WannierIO._reshape_eigMethod
_reshape_eig(idx_b, idx_k, eig)
-

Reshape a vector of eigenvalues into a matrix of eigenvalues.

Auto detect the number of bands and kpoints.

source
WannierIO.write_HH_RMethod
write_HH_R(filename, H, R; N, header)
-

Write the real space Hamiltonian to a prefix_HH_R.dat file.

Arguments

  • filename: usually prefix_HH_R.dat
  • H: a n_wann * n_wann * n_rvecs array of Hamiltonian
  • R: a n_rvecs * 3 array of integers

Keyword arguments

  • N: a n_rvecs vector of integers, the degeneracy of each R vector
  • header: a string, the header of the file
Note

Wanier90 postw90.x has a hidden input parameter effective_model, setting it to true and postw90.x will read this HH_R.dat to fill the real space Hamiltonian, and do subsequent Wannier interpolation, e.g., in BoltzWann. However, the vanila postw90.x code does not take into account the degeneracy of R vectors, and also does not use MDRS interpolation. I have modified the postw90.x code to use MDRS, and also changed a bit the number of digits for the Hamiltonian in HH_R.dat, so that it is the same as the prefix_tb.dat file, i.e., from Fortran F12.6 to E15.8.

source
WannierIO.read_u_matMethod
read_u_mat(filename)

Read wannier90 prefix_u.mat or prefix_u_dis.mat file.

Arguments

  • filename: the input file name

Return

  • U: Udis (for disentanglement) or U (for maximal localization) matrices
  • kpoints: fractional kpoint coordinates
  • header: 1st line of the file
Warning

The wannier90 output prefix_u_dis.mat internally sorts the band indices according to the disnentanglement window, therefore it can be different from the original Bloch states, see the code and comments in get_Udis.

source
WannierIO.write_u_matMethod
write_u_mat(filename, U, kpoints; header=default_header())

Write wannier90 prefix_u.mat or prefix_u_dis.mat file.

Arguments

  • filename: the input file name
  • U: Udis (for disentanglement) or U (for maximal localization) matrices
  • kpoints: fractional kpoint coordinates

Keyword arguments

  • header: 1st line of the file, optional
Warning

The wannier90 output prefix_u_dis.mat internally sorts the band indices according to the disnentanglement window, therefore it can be different from the original Bloch states, see the code and comments in get_Udis. This function just writes whatever is inside the input U matrix, without consider the order of disentanglement window.

source
+

Convenience constructor of Chk struct that auto set some fields.

source
Base.isapproxMethod
isapprox(a, b)
+

Compare two Chk objects.

source
WannierIO._check_eig_orderMethod
_check_eig_order(eigenvalues; digits)
+

Check that eigenvalues are in order.

Some times there are small noises, use digits to set the number of digits for comparisons.

source
WannierIO._reshape_eigMethod
_reshape_eig(idx_b, idx_k, eig)
+

Reshape a vector of eigenvalues into a matrix of eigenvalues.

Auto detect the number of bands and kpoints.

source
WannierIO.write_HH_RMethod
write_HH_R(filename, H, R; N, header)
+

Write the real space Hamiltonian to a prefix_HH_R.dat file.

Arguments

  • filename: usually prefix_HH_R.dat
  • H: a n_wann * n_wann * n_rvecs array of Hamiltonian
  • R: a n_rvecs * 3 array of integers

Keyword arguments

  • N: a n_rvecs vector of integers, the degeneracy of each R vector
  • header: a string, the header of the file
Note

Wanier90 postw90.x has a hidden input parameter effective_model, setting it to true and postw90.x will read this HH_R.dat to fill the real space Hamiltonian, and do subsequent Wannier interpolation, e.g., in BoltzWann. However, the vanila postw90.x code does not take into account the degeneracy of R vectors, and also does not use MDRS interpolation. I have modified the postw90.x code to use MDRS, and also changed a bit the number of digits for the Hamiltonian in HH_R.dat, so that it is the same as the prefix_tb.dat file, i.e., from Fortran F12.6 to E15.8.

source
WannierIO._check_dimensions_M_kpbMethod
_check_dimensions_M_kpb(M, kpb_k, kpb_G)
+
source
WannierIO._check_dimensions_kpbMethod

Check the dimensions between the quantities are consistent.

source
WannierIO._check_dimensions_Sx_Sy_SzMethod
_check_dimensions_Sx_Sy_Sz(Sx, Sy, Sz)
+
source
WannierIO.read_u_matMethod
read_u_mat(filename)

Read wannier90 prefix_u.mat or prefix_u_dis.mat file.

Arguments

  • filename: the input file name

Return

  • U: Udis (for disentanglement) or U (for maximal localization) matrices
  • kpoints: fractional kpoint coordinates
  • header: 1st line of the file
Warning

The wannier90 output prefix_u_dis.mat internally sorts the band indices according to the disnentanglement window, therefore it can be different from the original Bloch states, see the code and comments in get_Udis.

source
WannierIO.write_u_matMethod
write_u_mat(filename, U, kpoints; header=default_header())

Write wannier90 prefix_u.mat or prefix_u_dis.mat file.

Arguments

  • filename: the input file name
  • U: Udis (for disentanglement) or U (for maximal localization) matrices
  • kpoints: fractional kpoint coordinates

Keyword arguments

  • header: 1st line of the file, optional
Warning

The wannier90 output prefix_u_dis.mat internally sorts the band indices according to the disnentanglement window, therefore it can be different from the original Bloch states, see the code and comments in get_Udis. This function just writes whatever is inside the input U matrix, without consider the order of disentanglement window.

source
WannierIO._check_win_required_paramsMethod
_check_win_required_params(kwargs)
+
source
WannierIO.fix_win!Method
fix_win!(params)
+

Sanity check and add missing input parameters from a win file.

See also read_win.

source
WannierIO._parse_wout_atomsMethod

Parse block

|   Site       Fractional Coordinate          Cartesian Coordinate (Ang)     |
++----------------------------------------------------------------------------+
+| Si   1   0.00000   0.00000   0.00000   |    0.00000   0.00000   0.00000    |
+| Si   2   0.25000   0.25000   0.25000   |    1.35763   1.35763   1.35763    |
+*----------------------------------------------------------------------------*
source
WannierIO._parse_wout_disentangleMethod

Parse block

                  Extraction of optimally-connected subspace
+                  ------------------------------------------
++---------------------------------------------------------------------+<-- DIS
+|  Iter     Omega_I(i-1)      Omega_I(i)      Delta (frac.)    Time   |<-- DIS
++---------------------------------------------------------------------+<-- DIS
+      1      25.38943399      21.32896063       1.904E-01      0.00    <-- DIS
+      2      21.53095611      20.16097533       6.795E-02      0.01    <-- DIS
+      3      20.40788223      19.35260423       5.453E-02      0.01    <-- DIS
+      4      19.53883989      18.75563591       4.176E-02      0.02    <-- DIS
+...
+    341      16.22884440      16.22884440      -1.883E-10      2.43    <-- DIS
+    342      16.22884440      16.22884440      -1.799E-10      2.44    <-- DIS
+
+            <<<      Delta < 2.000E-10  over  3 iterations     >>>
+            <<< Disentanglement convergence criteria satisfied >>>
+
+        Final Omega_I    16.22884440 (Ang^2)
+
++----------------------------------------------------------------------------+
+
+Time to disentangle bands      2.546 (sec)
source
WannierIO._parse_wout_latticeMethod

Parse block

Lattice Vectors (Ang)
+a_1     0.000000   2.715265   2.715265
+a_2     2.715265   0.000000   2.715265
+a_3     2.715265   2.715265   0.000000
source
WannierIO._parse_wout_recip_latticeMethod

Parse block

Reciprocal-Space Vectors (Ang^-1)
+b_1    -1.157011   1.157011   1.157011
+b_2     1.157011  -1.157011   1.157011
+b_3     1.157011   1.157011  -1.157011
source
WannierIO._parse_wout_wannierizeMethod

Parse block

*------------------------------- WANNIERISE ---------------------------------*
++--------------------------------------------------------------------+<-- CONV
+| Iter  Delta Spread     RMS Gradient      Spread (Ang^2)      Time  |<-- CONV
++--------------------------------------------------------------------+<-- CONV
+
+------------------------------------------------------------------------------
+Initial State
+ WF centre and spread    1  ( -0.000005,  0.000021,  0.000023 )     2.56218734
+ WF centre and spread    2  (  0.000013, -0.000054,  0.000016 )     3.19493515
+ WF centre and spread    3  ( -0.000005, -0.000054, -0.000055 )     3.19482997
+ WF centre and spread    4  (  0.000012,  0.000015, -0.000058 )     3.19526437
+ WF centre and spread    5  (  1.357637,  1.357611,  1.357610 )     2.56218214
+ WF centre and spread    6  (  1.357619,  1.357684,  1.357617 )     3.19532825
+ WF centre and spread    7  (  1.357638,  1.357687,  1.357686 )     3.19513205
+ WF centre and spread    8  (  1.357620,  1.357617,  1.357694 )     3.19460833
+ Sum of centres and spreads (  5.430528,  5.430529,  5.430534 )    24.29446759
+
+     0     0.243E+02     0.0000000000       24.2944680346       2.48  <-- CONV
+       O_D=      0.2135529 O_OD=      7.8520707 O_TOT=     24.2944680 <-- SPRD
+------------------------------------------------------------------------------
+Cycle:      1
+ WF centre and spread    1  ( -0.000005,  0.000020,  0.000022 )     2.46316318
+ WF centre and spread    2  (  0.000014, -0.000057,  0.000015 )     3.19187236
+ WF centre and spread    3  ( -0.000005, -0.000057, -0.000058 )     3.19179103
+ WF centre and spread    4  (  0.000012,  0.000014, -0.000061 )     3.19222621
+ WF centre and spread    5  (  1.357637,  1.357612,  1.357611 )     2.46315800
+ WF centre and spread    6  (  1.357618,  1.357687,  1.357618 )     3.19226713
+ WF centre and spread    7  (  1.357637,  1.357690,  1.357689 )     3.19209166
+ WF centre and spread    8  (  1.357619,  1.357619,  1.357697 )     3.19156919
+ Sum of centres and spreads (  5.430528,  5.430529,  5.430534 )    24.07813875
+
+     1    -0.216E+00     0.2558717278       24.0781391952       2.49  <-- CONV
+       O_D=      0.2218113 O_OD=      7.6274835 O_TOT=     24.0781392 <-- SPRD
+Delta: O_D=  0.8258326E-02 O_OD= -0.2245872E+00 O_TOT= -0.2163288E+00 <-- DLTA
+------------------------------------------------------------------------------
+Cycle:      2
+...
+------------------------------------------------------------------------------
+Cycle:     45
+WF centre and spread    1  (  0.000001,  0.000006,  0.000006 )     1.95373328
+WF centre and spread    2  (  0.000016, -0.000065,  0.000019 )     3.27910139
+WF centre and spread    3  ( -0.000008, -0.000065, -0.000066 )     3.27921479
+WF centre and spread    4  (  0.000014,  0.000016, -0.000070 )     3.27965818
+WF centre and spread    5  (  1.357631,  1.357627,  1.357627 )     1.95372427
+WF centre and spread    6  (  1.357616,  1.357695,  1.357615 )     3.27949625
+WF centre and spread    7  (  1.357641,  1.357699,  1.357697 )     3.27951005
+WF centre and spread    8  (  1.357617,  1.357616,  1.357707 )     3.27899768
+Sum of centres and spreads (  5.430528,  5.430529,  5.430534 )    23.58343588
+
+   45    -0.186E-09     0.0000077396       23.5834363262       2.88  <-- CONV
+      O_D=      0.2612087 O_OD=      7.0933833 O_TOT=     23.5834363 <-- SPRD
+Delta: O_D=  0.2557594E-06 O_OD= -0.2559458E-06 O_TOT= -0.1863789E-09 <-- DLTA
+------------------------------------------------------------------------------
+
+           <<<     Delta < 2.000E-10  over  3 iterations     >>>
+           <<< Wannierisation convergence criteria satisfied >>>
source
WannierIO._parse_wout_wf_center_spreadMethod

Parse block

WF centre and spread    1  ( -0.000005,  0.000021,  0.000023 )     2.56218734
+WF centre and spread    2  (  0.000013, -0.000054,  0.000016 )     3.19493515
+WF centre and spread    3  ( -0.000005, -0.000054, -0.000055 )     3.19482997
+WF centre and spread    4  (  0.000012,  0.000015, -0.000058 )     3.19526437
+WF centre and spread    5  (  1.357637,  1.357611,  1.357610 )     2.56218214
+WF centre and spread    6  (  1.357619,  1.357684,  1.357617 )     3.19532825
+WF centre and spread    7  (  1.357638,  1.357687,  1.357686 )     3.19513205
+WF centre and spread    8  (  1.357620,  1.357617,  1.357694 )     3.19460833
+Sum of centres and spreads (  5.430528,  5.430529,  5.430534 )    24.29446759
source
diff --git a/dev/index.html b/dev/index.html index 58501ac..cd7c93b 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · WannierIO.jl

WannierIO.jl

A Julia package for reading/writing Wannier90 files.

The package is designed to be minimalistic to allow easy reuse in other packages.

This package originates from the IO part of the Wannier.jl package.

Wannier90 files

Input files:

  • amn
  • mmn
  • eig
  • chk
  • UNK
  • spn

Also support parsing both plain text and binary formats (in Fortran language, called formatted and unformatted IO, respectively) for some files, e.g., chk and UNK.

Output files:

  • *_band.dat
  • *_tb.dat
  • *_wsvec.dat
  • *_hr.dat
  • *_r.dat
  • xsf
  • cube
  • ...

Quantum ESPRESSO files

To support comparing Wannier-interpolated band structures with density function theory (DFT) bands, there are also some functions to parse Quantum ESPRESSO (QE) output files:

  • xml
  • bands.dat generated by QE bands.x
+Home · WannierIO.jl

WannierIO.jl

A Julia package for reading/writing Wannier90 files.

The package is designed to be minimalistic to allow easy reuse in other packages.

This package originates from the IO part of the Wannier.jl package.

Wannier90 files

Input files:

  • amn
  • mmn
  • eig
  • chk
  • UNK
  • spn

Also support parsing both plain text and binary formats (in Fortran language, called formatted and unformatted IO, respectively) for some files, e.g., chk and UNK.

Output files:

  • *_band.dat
  • *_tb.dat
  • *_wsvec.dat
  • *_hr.dat
  • *_r.dat
  • xsf
  • cube
  • ...

Quantum ESPRESSO files

To support comparing Wannier-interpolated band structures with density function theory (DFT) bands, there are also some functions to parse Quantum ESPRESSO (QE) output files:

  • xml
  • bands.dat generated by QE bands.x
diff --git a/dev/search/index.html b/dev/search/index.html index 09cbbc5..40e7355 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · WannierIO.jl

Loading search...

    +Search · WannierIO.jl

    Loading search...

      diff --git a/dev/search_index.js b/dev/search_index.js index c224296..282d49e 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"api/w90/#Wannier90-files","page":"Wannier90","title":"Wannier90 files","text":"","category":"section"},{"location":"api/w90/","page":"Wannier90","title":"Wannier90","text":"CurrentModule = WannierIO","category":"page"},{"location":"api/w90/","page":"Wannier90","title":"Wannier90","text":"warning: Warning\nSome of the functions, e.g. read_amn, write_amn, read_chk, write_chk, etc., support reading/writing Fortran unformatted files. However, the Fortran unformatted files are machine and compiler dependent. Therefore, it is not guaranteed that these functions work for all the cases. Currently, the functions are tested on the following platforms:Linux + gfortran 11.2","category":"page"},{"location":"api/w90/#Public-API","page":"Wannier90","title":"Public API","text":"","category":"section"},{"location":"api/w90/","page":"Wannier90","title":"Wannier90","text":"Modules = [WannierIO]\nPrivate = false\nPages = map(file -> joinpath(\"w90\", file), readdir(\"../src/w90\"))","category":"page"},{"location":"api/w90/#WannierIO.read_amn","page":"Wannier90","title":"WannierIO.read_amn","text":"read_amn(filename)\nread_amn(filename, ::FortranText)\nread_amn(filename, ::FortranBinaryStream)\n\nRead wannier90 amn file.\n\nReturn\n\nA: length-n_kpts vector, each element is a n_bands * n_wann matrix.\nheader: first line of the file\n\nNote there are three versions of this function: the 1st one is a wrapper function that automatically detect the format (text or binary) of the file, and does some additional pretty printing to give user a quick hint of the dimensions of the A matrix; it internally calls the 2nd or the 3rd version for actual reading.\n\nWannier90 only has Fortran text format for amn, however I wrote a custom version of QE pw2wannier90.x that can output Fortran binary format (using Fortran stream IO) to save some disk space. The 1st function auto detect the file format so it is transparent to the user.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_amn","page":"Wannier90","title":"WannierIO.write_amn","text":"write_amn(filename, A; header=default_header(), binary=false)\nwrite_amn(filename, A, ::FortranText; header=default_header())\nwrite_amn(filename, A, ::FortranBinaryStream; header=default_header())\n\nWrite wannier90 amn file.\n\nArguments\n\nfilename: output filename\nA: a length-n_kpts vector, each element is a n_bands * n_wann matrix\n\nKeyword arguments\n\nheader: 1st line of the file\nbinary: write as Fortran unformatted file, which is the Wannier90 default. Here the binary kwargs is provided for convenience.\n\nSame as read_amn there are three versions of this function, the 1st one is a wrapper function, it calls the 2nd or the 3rd version depending on the binary kwargs.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_w90_band-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_band","text":"read_w90_band(prefix)\n\n\nRead prefix_band.dat, prefix_band.kpt, prefix_band.labelinfo.dat.\n\nArguments\n\nprefix: prefix of the filenames (or called seedname in wannier90), NOT the full filename.\n\nReturn\n\nx: n_kpts, x axis value of kpath, in cartesian length\neigenvalues: length-n_kpts vector, each element is a length-n_bands vector of band energies\nkpoints: a vector of length n_kpts, fractional coordinates\nkweights: a vector of length n_kpts, weights of kpoints\nsymm_point_indices: index of high-symmetry points in prefix_band.dat\nsymm_point_labels: name of high-symmetry points\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_w90_band_dat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_band_dat","text":"read_w90_band_dat(filename)\n\n\nRead prefix_band.dat file generated by wannier90.x, or prefix-band.dat file generated by postw90.x.\n\nReturn\n\nx: n_kpts, x axis value of kpath, in cartesian length\neigenvalues: length-n_kpts vector, each elemnt is a length-n_bands vector of band energies\nextras: optional (the postw90.x might generate a file with a third column), same size as eigenvalues, often the color of each eigenvalue, e.g., spin projection\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_w90_band_kpt-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_band_kpt","text":"read_w90_band_kpt(filename)\n\n\nRead a prefix_band.kpt file.\n\nReturn\n\nkpoints: a vector of length n_kpts, fractional coordinates\nkweights: a vector of length n_kpts, weights of kpoints\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_w90_band_labelinfo-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_band_labelinfo","text":"read_w90_band_labelinfo(filename)\n\n\nRead prefix_band.labelinfo file.\n\nReturn\n\nsymm_point_indices: index of high-symmetry points in prefix_band.dat\nsymm_point_labels: name of high-symmetry points\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_band-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_band","text":"write_w90_band(\n prefix;\n x,\n eigenvalues,\n kpoints,\n kweights,\n symm_point_indices,\n symm_point_labels\n)\n\n\nWrite prefix_band.dat, prefix_band.kpt, prefix_band.labelinfo.dat.\n\nArguments\n\nprefix: prefix of prefix_band.dat, prefix_band.kpt, prefix_band.labelinfo.dat\n\nKeyword Arguments\n\nx: n_kpts, x axis value, in cartesian length\neigenvalues: length-n_kpts vector, each element is a length-n_bands vector of band energies\nkpoints: length-n_kpts vector, fractional coordinates\nkweights: a vector of length n_kpts, weights of kpoints\nsymm_point_indices: index of high-symmetry points in prefix_band.dat\nsymm_point_labels: name of high-symmetry points\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_band_dat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_band_dat","text":"write_w90_band_dat(filename; x, eigenvalues, extras)\n\n\nWrite prefix_band.dat file.\n\nArguments\n\nfilename: filename of prefix_band.dat\n\nKeyword Arguments\n\nx: n_kpts, x axis value, in cartesian length\neigenvalues: length-n_kpts vector, each element is a length-n_bands vector of band energies\nextras: optional, same size as eigenvalues, will be written as the third column of prefix_band.dat. The prefix-band.dat file generated by postw90.x sometimes has a third column for e.g. the color of the eigenvalues\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_band_kpt-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_band_kpt","text":"write_w90_band_kpt(filename; kpoints, kweights)\n\n\nWrite prefix_band.kpt file.\n\nArguments\n\nfilename: filename of prefix_band.kpt\n\nKeyword Arguments\n\nkpoints: length-n_kpts vector, fractional coordinates\nkweights: n_kpts, optional, weights of kpoints, default to 1.0.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_band_labelinfo-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_band_labelinfo","text":"write_w90_band_labelinfo(\n filename;\n x,\n kpoints,\n symm_point_indices,\n symm_point_labels\n)\n\n\nWrite prefix_band.labelinfo file.\n\nArguments\n\nfilename: filename of prefix_band.labelinfo\n\nKeyword Arguments\n\nx: n_kpts-vector, x axis value, in cartesian length\nkpoints: length-n_kpts vector, fractional coordinates\nsymm_point_indices: index of high-symmetry points in prefix_band.dat\nsymm_point_labels: name of high-symmetry points\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.get_U-Tuple{WannierIO.Chk}","page":"Wannier90","title":"WannierIO.get_U","text":"get_U(chk)\n\n\nExtract the combined U = Udis * Uml matrices from Chk.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.get_Udis-Tuple{WannierIO.Chk}","page":"Wannier90","title":"WannierIO.get_Udis","text":"get_Udis(chk)\n\n\nExtract disentanglement Udis matrices from Chk.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_chk-Tuple{AbstractString, WannierIO.FortranText}","page":"Wannier90","title":"WannierIO.read_chk","text":"read_chk(filename)\nread_chk(filename, ::FortranText)\nread_chk(filename, ::FortranBinary)\n\nRead wannier90 chk checkpoint file.\n\nSimilar to read_amn, the 1st version auto detect chk file format (binary or text) and read it.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_chk","page":"Wannier90","title":"WannierIO.write_chk","text":"write_chk(filename, chk::Chk; binary=false)\nwrite_chk(filename, chk::Chk, ::FortranText)\nwrite_chk(filename, chk::Chk, ::FortranBinary)\n\nWrite wannier90 chk file.\n\nSimilar to write_amn, the 1st version is a convenience wrapper.\n\nKeyword arguments\n\nbinary: write as Fortran binary file or not. Although wannier90 default is Fortran binary format, here the default is false since Fortran binary depends on compiler and platform, so it is not guaranteed to always work.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_eig","page":"Wannier90","title":"WannierIO.read_eig","text":"read_eig(filename)\nread_eig(filename, ::FortranText)\nread_eig(filename, ::FortranBinaryStream)\n\nRead the wannier90 eig file.\n\nReturn\n\neigenvalues: a lenth-n_kpts vector, each element is a length-n_bands vector\n\nThe 1st version is a convenience wrapper function for the 2nd and 3rd versions.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_eig","page":"Wannier90","title":"WannierIO.write_eig","text":"write_eig(filename, eigenvalues; binary=false)\nwrite_eig(filename, eigenvalues, ::FortranText)\nwrite_eig(filename, eigenvalues, ::FortranBinaryStream)\n\nWrite eig file.\n\nArguments\n\neigenvalues: a length-n_kpts vector, each element is a length-n_bands vector\n\nKeyword arguments\n\nbinary: if true write in Fortran binary format.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_w90_hrdat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_hrdat","text":"read_w90_hrdat(filename)\n\n\nRead prefix_hr.dat.\n\nReturn\n\nRvectors: mathbfR-vectors on which operators are defined\nRdegens: degeneracies of each mathbfR-vector\nH: Hamiltonian mathbfH(mathbfR)\nheader: the first line of the file\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_hrdat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_hrdat","text":"write_w90_hrdat(filename; Rvectors, Rdegens, H, header)\n\n\nWrite prefix_hr.dat.\n\nKeyword arguments\n\nSee the return values of read_w90_hrdat.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_mmn","page":"Wannier90","title":"WannierIO.read_mmn","text":"read_mmn(filename)\nread_mmn(filename, ::FortranText)\nread_mmn(filename, ::FortranBinaryStream)\n\nRead wannier90 mmn file.\n\nReturn\n\nM: length-n_kpts vector, each element is a length-n_bvecs vector, then each element is a n_bands * n_bands matrix\nkpb_k: length-n_kpts vector, each element is a length-n_bvecs vector of integers for the indices of the neighboring kpoints\nkpb_G: length-n_kpts vector, each element is a lenght-n_bvecs vector of of Vec3{Int}, which are the translation vectors\nheader: 1st line of the file\n\nThe translation vector G is defined as b = kpoints[kpb_k[ik][ib]] + kpb_G[ik][ib] - kpoints[ik], where b is the ib-th bvector of the ik-th kpoint.\n\nThe 1st version is a convenience wrapper for the other two.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_mmn","page":"Wannier90","title":"WannierIO.write_mmn","text":"write_mmn(filename; M, kpb_k, kpb_G; header=default_header(), binary=false)\nwrite_mmn(filename; M, kpb_k, kpb_G, ::FortranText; header=default_header(), binary=false)\nwrite_mmn(filename; M, kpb_k, kpb_G, ::FortranBinaryStream; header=default_header(), binary=false)\n\nWrite wannier90 mmn file.\n\nArguments\n\nfilename: output file name\nM: length-n_kpts vector of n_bands * n_bands * n_bvecs arrays\nkpb_k: length-n_kpts vector of length-n_bvecs vector of integers\nkpb_G: length-n_kpts vector of length-n_bvecs vector of Vec3{Int} for bvectors\n\nKeyword arguments\n\nheader: header string\nbinary: if true write in Fortran binary format\n\nThe 1st version is a convenience wrapper for the other two.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_nnkp","page":"Wannier90","title":"WannierIO.read_nnkp","text":"read_nnkp(filename)\nread_nnkp(filename, ::Wannier90Text)\nread_nnkp(filename, ::Wannier90Toml)\n\nRead wannier90 nnkp file.\n\nReturn\n\nlattice: each column is a lattice vector\nrecip_lattice: each column is a reciprocal lattice vector\nkpoints: length-n_kpts vector, each element is Vec3, in fractional coordinates\nkpb_k: length-n_kpts vector, each element is a length-n_bvecs vector of integers, index of kpoints\nkpb_G: length-n_kpts vector, each element is a length-n_bvecs vector, then each element is Vec3 for translations, fractional w.r.t recip_lattice\n\nWannier90 nnkp file is a plain text format, the 2nd version reads nnkp file in Wannier90 format. The thrid version read a TOML-format nnkp file, which is defined by this package, see write_nnkp. The 1st version auto detects the format and parse it.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_nnkp","page":"Wannier90","title":"WannierIO.write_nnkp","text":"write_nnkp(filename; toml=false, kwargs...)\nwrite_nnkp(filename, ::Wannier90Text; kwargs...)\nwrite_nnkp(filename, ::Wannier90Toml; kwargs...)\n\nWrite a nnkp file that can be used by DFT codes, e.g., QE pw2wannier90.\n\nKeyword Arguments\n\ntoml: write to a TOML file, otherwise write to a Wannier90 text file format\nrecip_lattice: each column is a reciprocal lattice vector\nkpoints: length-n_kpts vector of Vec3, in fractional coordinates\nkpb_k: length-n_kpts vector, each element is a length-n_bvecs vector of integers, index of kpoints\nkpb_G: length-n_kpts vector, each element is a length-n_bvecs vector, then each element is a Vec3 for translation vector, fractional w.r.t. recip_lattice\nn_wann: if given, write an auto_projections block\nexclude_bands: if given, write the specified band indices in the exclude_bands block\nheader: first line of the file\n\nnote: Note\nOnly use auto_projections, the projections block is not supported.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_w90_rdat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_rdat","text":"read_w90_rdat(filename)\n\n\nRead prefix_r.dat.\n\nReturn\n\nRvectors: mathbfR-vectors on which operators are defined\nr_x: x-component of position operator\nr_y: y-component of position operator\nr_z: z-component of position operator\nheader: the first line of the file\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_spn","page":"Wannier90","title":"WannierIO.read_spn","text":"read_spn(filename)\nread_spn(filename, ::FortranText)\nread_spn(filename, ::FortranBinary)\n\nRead the wannier90 spn file.\n\nReturn\n\nSx: spin x, a length-n_kpts vector, each element is a n_bands-by-n_bands matrix\nSy: spin y, a length-n_kpts vector, each element is a n_bands-by-n_bands matrix\nSz: spin z, a length-n_kpts vector, each element is a n_bands-by-n_bands matrix\nheader: 1st line of the file\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_spn","page":"Wannier90","title":"WannierIO.write_spn","text":"write_spn(filename, Sx, Sy, Sz; binary=false, header)\nwrite_spn(filename, Sx, Sy, Sz, ::FortranText; header)\nwrite_spn(filename, Sx, Sy, Sz, ::FortranBinary; header)\n\nWrite the spn file.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_w90_tbdat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_tbdat","text":"read_w90_tbdat(filename)\n\n\nRead prefix_tb.dat.\n\nReturn\n\nlattice: each column is a lattice vector in Å\nRvectors: mathbfR-vectors on which operators are defined\nRdegens: degeneracies of each mathbfR-vector\nH: Hamiltonian mathbfH(mathbfR)\nr_x: x-component of position operator\nr_x: y-component of position operator\nr_x: z-component of position operator\nheader: the first line of the file\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_tbdat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_tbdat","text":"write_w90_tbdat(\n filename;\n lattice,\n Rvectors,\n Rdegens,\n H,\n r_x,\n r_y,\n r_z,\n header\n)\n\n\nWrite prefix_tb.dat.\n\nKeyword arguments\n\nSee the return values of read_w90_tbdat.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_uHu","page":"Wannier90","title":"WannierIO.read_uHu","text":"read_uHu(filename)\nread_uHu(filename, ::FortranText; transpose_band_indices=true)\nread_uHu(filename, ::FortranBinary; transpose_band_indices=true)\n\nRead the wannier90 uHu file.\n\nKeyword Arguments\n\ntranspose_band_indices: QE pw2wannier90.x writes the matrix in a strange transposed manner; if reading a QE-generated uHu file, this flag should be true to restore the band indices order, so that the returned matrix has the correct order, i.e., uHu[ik][ib1, ib2][m, n] is langle u_m k + b_1 H u_n k + b_2 rangle\n\nReturn\n\nuHu: a length-n_kpts vector, each element is a n_bvecs * n_bvecs matrix, then each element is a n_bands * n_bands matrix\nheader: 1st line of the file\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_uHu","page":"Wannier90","title":"WannierIO.write_uHu","text":"write_uHu(filename, uHu; binary=false, header)\nwrite_uHu(filename, uHu, ::FortranText; header)\nwrite_uHu(filename, uHu, ::FortranBinary; header)\n\nWrite the uHu file.\n\nKeyword Arguments\n\ntranspose_band_indices: see read_uHu\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_unk","page":"Wannier90","title":"WannierIO.read_unk","text":"read_unk(filename)\nread_unk(filename, ::FortranText)\nread_unk(filename, ::FortranBinary)\n\nRead wannier90 UNK file for the periodic part of Bloch wavefunctions.\n\nReturn\n\nik: k-point index, start from 1\nΨ: periodic part of Bloch wavefunctions in real space, size = (n_gx, n_gy, n_gz, n_bands, n_spin)\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_unk","page":"Wannier90","title":"WannierIO.write_unk","text":"write_unk(filename, ik, Ψ; binary=false)\nwrite_unk(filename, ik, Ψ, ::FortranText)\nwrite_unk(filename, ik, Ψ, ::FortranBinary)\n\nWrite UNK file for the periodic part of Bloch wavefunctions.\n\nArguments\n\nik: at which kpoint? start from 1\nΨ: Bloch wavefunctions, size(Ψ) = (n_gx, n_gy, n_gz, n_bands, n_spin)\n\nKeyword arguments\n\nbinary: write as Fortran unformatted file\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_win","page":"Wannier90","title":"WannierIO.read_win","text":"read_win(filename; fix_inputs=true)\nread_win(filename, ::Wannier90Text; fix_inputs=true)\nread_win(filename, ::Wannier90Toml; fix_inputs=true)\n\nRead wannier90 input win file.\n\nArguments\n\nfilename: The name of the input file.\n\nKeyword Arguments\n\nfix_inputs: sanity check and fix the input parameters, e.g., set num_bands = num_wann if num_bands is not specified, convert atoms_cart always to atoms_frac, etc. See also fix_win!.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_win","page":"Wannier90","title":"WannierIO.write_win","text":"write_win(filename; toml=false, kwargs...)\nwrite_win(filename, ::Wannier90Text; kwargs...)\nwrite_win(filename, ::Wannier90Toml; kwargs...)\n\nWrite input parameters into a wannier90 win file.\n\nThe input parameters are keyword arguments, with key names same as that of wannier90.\n\nExamples\n\nusing WannierIO\n\nwrite_win(\n \"silicon.win\";\n num_wann=4,\n num_bands=4,\n # unit_cell_cart is a matrix, its columns are the lattice vectors in angstrom\n unit_cell_cart=[\n 0.0 2.71527 2.71527\n 2.71527 0.0 2.71527\n 2.71527 2.71527 0.0\n ],\n # atoms_frac is a vector of pairs of atom_label and fractional coordinates\n atoms_frac=[\n :Si => [0.0, 0.0, 0.0],\n :Si => [0.25, 0.25, 0.25],\n # both `:Si` and `\"Si\"` are allowed\n # \"Si\" => [0.25, 0.25, 0.25],\n ],\n # each element in projections will be written as a line in the win file\n projections=[\n \"random\",\n ]\n kpoint_path=[\n [:G => [0.0, 0.0, 0.0], :X => [0.5, 0.0, 0.5]],\n [:X => [0.5, 0.0, 0.5], :U => [0.625, 0.25, 0.625]],\n ],\n mp_grid=[2, 2, 2],\n # kpoints is a matrix, its columns are the fractional coordinates\n kpoints=[\n [0.0, 0.0, 0.0],\n [0.0, 0.0, 0.5],\n [0.0, 0.5, 0.0],\n [0.0, 0.5, 0.5],\n [0.5, 0.0, 0.0],\n [0.5, 0.0, 0.5],\n [0.5, 0.5, 0.0],\n [0.5, 0.5, 0.5],\n ],\n # additional parameters can be passed as keyword arguments, e.g.,\n num_iter=500,\n)\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_wout-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_wout","text":"read_wout(filename)\n\n\nParse wannire90 wout file.\n\nReturn\n\nlattice: each column is a lattice vector in Å\nrecip_lattice: each column is a reciprocal lattice vector in Å⁻¹\natom_labels: atomic symbols\natom_positions: in fractional coordinates\ncenters: final each WF centers in Å\nspreads: final each WF spreads in Ų\nΩI, ΩD, ΩOD, Ωtotal: final spread (components) in Ų\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_w90_wsvec-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_wsvec","text":"read_w90_wsvec(filename)\n\n\nRead prefix_wsvec.dat.\n\nReturn\n\nmdrs: whether use MDRS interpolation, i.e. the use_ws_distance in the header\nRvectors: the mathbfR-vectors\nTvectors: the mathbfT_m n mathbfR-vectors. Returned only mdrs = true.\nTdegens: the degeneracies of mathbfT_m n mathbfR-vectors. Returned only mdrs = true.\nn_wann: number of WFs\nheader: the first line of the file\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_wsvec-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_wsvec","text":"write_w90_wsvec(\n filename;\n Rvectors,\n n_wann,\n Tvectors,\n Tdegens,\n header\n)\n\n\nWrite prefix_wsvec.dat.\n\nKeyword Arguments\n\nn_wann: for Wigner-Seitz Rvectors, needs to provide a n_wann for number of Wannier functions; for MDRS Rvectors, the n_wann is optional and can be automatically determined from the Tvectors\nTvectors and Tdegens: if provided, write in MDRS format; otherwise, write in Wigner-Seitz format\n\nAlso see the return values of read_w90_wsvec.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#Private-API","page":"Wannier90","title":"Private API","text":"","category":"section"},{"location":"api/w90/","page":"Wannier90","title":"Wannier90","text":"These are some lower-level types/functions that are (probably) less used, thus not exported. Of course, you can still use them by prefixing WannierIO., e.g., WannierIO.read_w90_band_dat(filename).","category":"page"},{"location":"api/w90/","page":"Wannier90","title":"Wannier90","text":"Modules = [WannierIO]\nPublic = false\nPages = map(file -> joinpath(\"w90\", file), readdir(\"../src/w90\"))","category":"page"},{"location":"api/w90/#WannierIO.default_band_kpt_kweights-Tuple{AbstractVector}","page":"Wannier90","title":"WannierIO.default_band_kpt_kweights","text":"default_band_kpt_kweights(kpoints)\n\n\nWannier90 default kweights in prefix_band.kpt is all 1.0.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.Chk","page":"Wannier90","title":"WannierIO.Chk","text":"Struct for storing matrices in prefix.chk file.\n\nstruct Chk{T<:Real}\n\nOne-to-one mapping to the wannier90 chk file, but renaming the variable names so that they are consistent with the rest of the code.\n\nFields\n\nheader: The header line, usually contains date and time\nn_bands: number of bands, can be auto set in constructor according to dimensions of other variables\nn_exclude_bands: number of excluded bands, can be auto set in constructor\nexclude_bands: Indices of excluded bands, starts from 1. Vector of integers, size: n_exclude_bands\nlattice: Matrix of size 3 x 3, each column is a lattice vector in Å unit\nrecip_lattice: Matrix of size 3 x 3, each column is a reciprocal lattice vector in Å⁻¹ unit\nn_kpts: number of kpoints, can be auto set in constructor\nkgrid: dimensions of kpoint grid, 3 integers\nkpoints: kpoint coordinates, fractional, length-n_kpts vector\nn_bvecs: number of b-vectors, can be auto set in constructor\nn_wann: number of Wannier functions, can be auto set in constructor\ncheckpoint: a string to indicate the current step (after disentanglement, after maximal localization, ...) in wannier90\nhave_disentangled: Have finished disentanglement or not\nΩI: Omega invariant part of MV spreads, in Ų unit\ndis_bands: Indices of bands taking part in disentanglement, not frozen bands! length-n_kpts vector, each element is a length-n_bands vector of bool.\nThis is needed since W90 puts all the disentanglement bands in the first several rows of Udis, (and the first few columns of Udis are the frozen bands) so directly multiplying eigenvalues e.g. (Udis * U)' * diag(eigenvalues) * (Udis * U) is wrong!\n\nn_dis: number of bands taking part in disentanglement at each kpoint. can be auto set in constructor from dis_bands\nUdis: Semi-unitary matrix for disentanglement, length-n_kpts vector, each elment has size: n_bands x n_wann, i.e., the u_matrix_opt in wannier90\nUml: Unitary matrix for maximal localization, length-n_kpts vector, each element has size: n_wann x n_wann, i.e., the u_matrix in wannier90. The abbreviation ml stands for maximal localization, so as to differentiate from the (combined) unitary matrix U = Udis * Uml.\nM: Wannier-gauge overlap matrix, length-n_kpts vector of length-n_bvecs vector, each element is a matrix of size n_wann x n_wann, i.e., the m_matrix in wannier90\nr: Wannier function centers, length-n_wann vector, Cartesian coordinates in Å unit, i.e., the wannier_centres variable in wannier90\nω: Wannier function spreads, length-n_wann vector, Ų unit, i.e., the wannier_spreads variable in wannier90\n\n\n\n\n\n","category":"type"},{"location":"api/w90/#WannierIO.Chk-Tuple{AbstractString, AbstractVector{Int64}, AbstractMatrix, AbstractMatrix, AbstractVector{<:Integer}, AbstractVector, AbstractString, Bool, Real, AbstractVector{BitVector}, Vararg{AbstractVector, 5}}","page":"Wannier90","title":"WannierIO.Chk","text":"Chk(\n header,\n exclude_bands,\n lattice,\n recip_lattice,\n kgrid,\n kpoints,\n checkpoint,\n have_disentangled,\n ΩI,\n dis_bands,\n Udis,\n Uml,\n M,\n r,\n ω\n)\n\n\nConvenience constructor of Chk struct that auto set some fields.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#Base.isapprox-Tuple{WannierIO.Chk, WannierIO.Chk}","page":"Wannier90","title":"Base.isapprox","text":"isapprox(a, b)\n\n\nCompare two Chk objects.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._check_eig_order-Tuple{AbstractVector}","page":"Wannier90","title":"WannierIO._check_eig_order","text":"_check_eig_order(eigenvalues; digits)\n\n\nCheck that eigenvalues are in order.\n\nSome times there are small noises, use digits to set the number of digits for comparisons.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._reshape_eig-Tuple{AbstractVector, AbstractVector, AbstractVector}","page":"Wannier90","title":"WannierIO._reshape_eig","text":"_reshape_eig(idx_b, idx_k, eig)\n\n\nReshape a vector of eigenvalues into a matrix of eigenvalues.\n\nAuto detect the number of bands and kpoints.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_HH_R-Union{Tuple{IT}, Tuple{T}, Tuple{AbstractString, AbstractArray{T, 3}, AbstractMatrix{IT}}} where {T<:Complex, IT<:Integer}","page":"Wannier90","title":"WannierIO.write_HH_R","text":"write_HH_R(filename, H, R; N, header)\n\n\nWrite the real space Hamiltonian to a prefix_HH_R.dat file.\n\nArguments\n\nfilename: usually prefix_HH_R.dat\nH: a n_wann * n_wann * n_rvecs array of Hamiltonian\nR: a n_rvecs * 3 array of integers\n\nKeyword arguments\n\nN: a n_rvecs vector of integers, the degeneracy of each R vector\nheader: a string, the header of the file\n\nnote: Note\nWanier90 postw90.x has a hidden input parameter effective_model, setting it to true and postw90.x will read this HH_R.dat to fill the real space Hamiltonian, and do subsequent Wannier interpolation, e.g., in BoltzWann. However, the vanila postw90.x code does not take into account the degeneracy of R vectors, and also does not use MDRS interpolation. I have modified the postw90.x code to use MDRS, and also changed a bit the number of digits for the Hamiltonian in HH_R.dat, so that it is the same as the prefix_tb.dat file, i.e., from Fortran F12.6 to E15.8.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._check_dimensions_M_kpb-Tuple{Any, Any, Any}","page":"Wannier90","title":"WannierIO._check_dimensions_M_kpb","text":"_check_dimensions_M_kpb(M, kpb_k, kpb_G)\n\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._check_dimensions_kpb-Tuple{Any, Any}","page":"Wannier90","title":"WannierIO._check_dimensions_kpb","text":"Check the dimensions between the quantities are consistent.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._check_dimensions_Sx_Sy_Sz-Tuple{Any, Any, Any}","page":"Wannier90","title":"WannierIO._check_dimensions_Sx_Sy_Sz","text":"_check_dimensions_Sx_Sy_Sz(Sx, Sy, Sz)\n\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_u_mat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_u_mat","text":"read_u_mat(filename)\n\nRead wannier90 prefix_u.mat or prefix_u_dis.mat file.\n\nArguments\n\nfilename: the input file name\n\nReturn\n\nU: Udis (for disentanglement) or U (for maximal localization) matrices\nkpoints: fractional kpoint coordinates\nheader: 1st line of the file\n\nwarning: Warning\nThe wannier90 output prefix_u_dis.mat internally sorts the band indices according to the disnentanglement window, therefore it can be different from the original Bloch states, see the code and comments in get_Udis.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_u_mat-Tuple{AbstractString, AbstractVector, AbstractVector}","page":"Wannier90","title":"WannierIO.write_u_mat","text":"write_u_mat(filename, U, kpoints; header=default_header())\n\nWrite wannier90 prefix_u.mat or prefix_u_dis.mat file.\n\nArguments\n\nfilename: the input file name\nU: Udis (for disentanglement) or U (for maximal localization) matrices\nkpoints: fractional kpoint coordinates\n\nKeyword arguments\n\nheader: 1st line of the file, optional\n\nwarning: Warning\nThe wannier90 output prefix_u_dis.mat internally sorts the band indices according to the disnentanglement window, therefore it can be different from the original Bloch states, see the code and comments in get_Udis. This function just writes whatever is inside the input U matrix, without consider the order of disentanglement window.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._check_win_required_params-Tuple{Any}","page":"Wannier90","title":"WannierIO._check_win_required_params","text":"_check_win_required_params(kwargs)\n\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.fix_win!-Tuple{Dict}","page":"Wannier90","title":"WannierIO.fix_win!","text":"fix_win!(params)\n\n\nSanity check and add missing input parameters from a win file.\n\nSee also read_win.\n\n\n\n\n\n","category":"method"},{"location":"api/#Index-of-all-functions-and-types","page":"Index","title":"Index of all functions and types","text":"","category":"section"},{"location":"api/","page":"Index","title":"Index","text":"Modules = [WannierIO]","category":"page"},{"location":"api/util/#Utility","page":"Utilities","title":"Utility","text":"","category":"section"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"Some simple convenience functions for development.","category":"page"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"CurrentModule = WannierIO","category":"page"},{"location":"api/util/#Fortran-related","page":"Utilities","title":"Fortran related","text":"","category":"section"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"Modules = [WannierIO]\nPages = [\"util/fortran.jl\"]","category":"page"},{"location":"api/util/#WannierIO.isbinary-Tuple{AbstractString}","page":"Utilities","title":"WannierIO.isbinary","text":"isbinary(filename)\n\n\nCheck if the file is in binary format.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.isbinary-Tuple{AbstractVector{UInt8}}","page":"Utilities","title":"WannierIO.isbinary","text":"isbinary(chars)\n\n\nCheck if a sequence of chars is binary.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#Lattice","page":"Utilities","title":"Lattice","text":"","category":"section"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"Modules = [WannierIO]\nPages = [\"util/lattice.jl\"]","category":"page"},{"location":"api/util/#WannierIO.get_lattice-Tuple{StaticArraysCore.SMatrix{3, 3, T, 9} where T}","page":"Utilities","title":"WannierIO.get_lattice","text":"get_lattice(recip_lattice)\n\n\nCompute lattice from reciprocal lattice.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.get_recip_lattice-Tuple{StaticArraysCore.SMatrix{3, 3, T, 9} where T}","page":"Utilities","title":"WannierIO.get_recip_lattice","text":"get_recip_lattice(lattice)\n\n\nCompute reciprocal lattice from lattice.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#Types","page":"Utilities","title":"Types","text":"","category":"section"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"Modules = [WannierIO]\nPages = [\"common/type.jl\"]","category":"page"},{"location":"api/util/#WannierIO.FortranBinary","page":"Utilities","title":"WannierIO.FortranBinary","text":"Fortran unformatted IO.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.FortranBinaryStream","page":"Utilities","title":"WannierIO.FortranBinaryStream","text":"Fortran unformatted IO with stream access.\n\nFor example, file written using these Fortran code:\n\nOPEN(UNIT=11, FILE=\"ustream.demo\", STATUS=\"NEW\", ACCESS=\"STREAM\", FORM=\"UNFORMATTED\")\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.FortranText","page":"Utilities","title":"WannierIO.FortranText","text":"Fortran formatted IO.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.Mat3","page":"Utilities","title":"WannierIO.Mat3","text":"3 x 3 matrix type.\n\nFor lattice and recip_lattice.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.Mat3-Tuple{AbstractVector}","page":"Utilities","title":"WannierIO.Mat3","text":"Vector{Vector} -> Mat3\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.SymbolVec3","page":"Utilities","title":"WannierIO.SymbolVec3","text":"Pair type associating a Symbol with a Vec3.\n\nFor win file atoms_frac and kpoint_path.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.Vec3","page":"Utilities","title":"WannierIO.Vec3","text":"Length-3 vector type.\n\nFor atom posistions, kpoints, etc.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.Vec3-Tuple{StaticArraysCore.SMatrix{3, 3, T, 9} where T}","page":"Utilities","title":"WannierIO.Vec3","text":"Mat3 -> Vec3{Vec3}\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.Wannier90Text","page":"Utilities","title":"WannierIO.Wannier90Text","text":"Plain text format for Wannier90 win and nnkp files.\n\nThe W90 default win or nnkp are plain text files but are not simple arrays of numbers that can be read by readdlm, therefore this struct is used to indicate that the file is plain text but need to be handled by corresponding functions, e.g., read_win, read_nnkp, etc.\n\nThis somewhat overlaps with FortranText, but this one is only used for small input parameter files e.g. win and nnkp (in comparison with the Wannier90Toml format), while the FortranText (in comparison with the FortranBinary format) is used for large matrices e.g. amn, mmn, eig, etc.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.Wannier90Toml","page":"Utilities","title":"WannierIO.Wannier90Toml","text":"TOML file format for Wannier90 win and nnkp files.\n\nHere we introduce a TOML format for win and nnkp, so that once the win or nnkp files are converted into TOML, the TOML files can be loaded by standard TOML parsers without the headache of writing custom parsers in other Julia packages.\n\nSee also write_win, write_nnkp, etc.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#Constants","page":"Utilities","title":"Constants","text":"","category":"section"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"Modules = [WannierIO]\nPages = [\"common/const.jl\"]","category":"page"},{"location":"api/util/#WannierIO.Bohr","page":"Utilities","title":"WannierIO.Bohr","text":"Bohr radius in Angstrom unit.\n\nThis is the default CODATA2006 value in W90 src/constants.F90.\n\n\n\n\n\n","category":"constant"},{"location":"api/util/#WannierIO.Bohr_QE","page":"Utilities","title":"WannierIO.Bohr_QE","text":"Bohr radius in Angstrom unit.\n\nThis is the default (Physical constants, SI (NIST 2018)) value in QE Modules/constants.f90.\n\n\n\n\n\n","category":"constant"},{"location":"api/util/#Misc","page":"Utilities","title":"Misc","text":"","category":"section"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"Modules = [WannierIO]\nPages = [\"util/header.jl\", \"util/toml.jl\", \"util/parser.jl\", \"util/compare.jl\", \"WannierIO.jl\"]","category":"page"},{"location":"api/util/#WannierIO.default_header-Tuple{}","page":"Utilities","title":"WannierIO.default_header","text":"Default header for writing wannier90 files.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.write_toml-Tuple{Any}","page":"Utilities","title":"WannierIO.write_toml","text":"write_toml(io; kwargs...)\n\n\nWrite kwargs into io as a TOML file.\n\nDo some type conversion before writing.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.parse_bool-Tuple{AbstractString}","page":"Utilities","title":"WannierIO.parse_bool","text":"parse_bool(s)\n\n\nParse a string as bool.\n\nThis is capable of parsing Fortran outputs, e.g., .true., .false., true, T.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.parse_bool-Tuple{Integer}","page":"Utilities","title":"WannierIO.parse_bool","text":"parse_bool(i)\n\n\nParse an integer as bool.\n\n0: false\n1 or -1: true\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.parse_float-Tuple{AbstractString}","page":"Utilities","title":"WannierIO.parse_float","text":"parse_float(s)\n\n\nParse a string as Float64.\n\nThe is capable of parsing Fortran outputs, e.g. 1.0D-10, to the ordinary 1e-10.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.parse_indices-Tuple{AbstractString}","page":"Utilities","title":"WannierIO.parse_indices","text":"parse_indices(str)\n\n\nParse a string of comma-separated indices or range into a vector of integers.\n\nE.g., the exclude_bands tag of win file.\n\nExamples\n\njulia> parse_indices(\"1-2, 5,8 -10\")\n6-element Vector{Int64}:\n 1\n 2\n 5\n 8\n 9\n 10\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.parse_vector-Tuple{IO, Type, Integer}","page":"Utilities","title":"WannierIO.parse_vector","text":"parse_vector(io, T, n_elements)\n\n\nParse a vector of n_elements elements of type T from io.\n\nArguments\n\nio: input stream\nT: type of elements\nn_elements::Int: total number of elements\n\nExamples\n\nSuppose a file demo.txt has the following content:\n\n1 2 3 4 5 6 7 8 9 10\n11 12 13 14 15 16 17 18 19 20\n21 22 23\n\nThen the following code parses the file and return a vector filled with 1 to 23:\n\njulia> vector = open(\"demo.txt\") do io\n parse_vector(io, Int, 23)\nend\n\nThe number of elements in each line can be different.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO._isapprox-Union{Tuple{T}, Tuple{T, T}} where T","page":"Utilities","title":"WannierIO._isapprox","text":"_isapprox(a, b)\n\n\nCompare two (same-type) structs.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.WannierIO","page":"Utilities","title":"WannierIO.WannierIO","text":"WannierIO.jl: a package for reading and writing Wannier90 file formats.\n\n\n\nWannierIO.jl\n\n(Image: Stable) (Image: Dev) (Image: CI) (Image: codecov)\n\nA Julia package for reading/writing Wannier90 file formats.\n\nThe package is designed to be minimalistic to allow easy reuse in other packages.\n\nQuick examples\n\nusing WannierIO\n\nA = read_amn(\"silicon.amn\")\nwrite_amn(\"silicon_2.amn\", A)\n\nchk = read_chk(\"silicon.chk\")\nwrite_chk(\"silicon_2.chk\", chk; binary=true)\n\nRelated packages\n\nWannier.jl: Wannierization and Wannier interpolation. The IO part of Wannier.jl was isolated and moved into this package.\n\n\n\nExported functions:\n\nget_U\nget_Udis\nread_amn\nread_bxsf\nread_chk\nread_cube\nread_eig\nread_mmn\nread_nnkp\nread_spn\nread_uHu\nread_unk\nread_w90_band\nread_w90_band_dat\nread_w90_band_kpt\nread_w90_band_labelinfo\nread_w90_hrdat\nread_w90_rdat\nread_w90_tbdat\nread_w90_wsvec\nread_win\nread_wout\nread_xsf\nwrite_amn\nwrite_bxsf\nwrite_chk\nwrite_cube\nwrite_eig\nwrite_mmn\nwrite_nnkp\nwrite_spn\nwrite_uHu\nwrite_unk\nwrite_w90_band\nwrite_w90_band_dat\nwrite_w90_band_kpt\nwrite_w90_band_labelinfo\nwrite_w90_hrdat\nwrite_w90_tbdat\nwrite_w90_wsvec\nwrite_win\nwrite_xsf\n\n\n\n\n\n","category":"module"},{"location":"api/convention/#Conventions","page":"Convention","title":"Conventions","text":"","category":"section"},{"location":"api/convention/#Units","page":"Convention","title":"Units","text":"","category":"section"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"In most cases, the units of the function arguments and returned values are in angstrom for lattice, and fractional (w.r.t. lattice) for atomic positions, etc.","category":"page"},{"location":"api/convention/#Variables","page":"Convention","title":"Variables","text":"","category":"section"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Here are some variable conventions used throughout the code and documentation.","category":"page"},{"location":"api/convention/#Names","page":"Convention","title":"Names","text":"","category":"section"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"U: unitary transformation matrices\nA: to differentiate between U, some times we use A specifically for the initial projection matrix, i.e., amn of Wannier90\nM: overlap matrices between neighboring kpoints, i.e., mmn of Wannier90","category":"page"},{"location":"api/convention/#Dimensions","page":"Convention","title":"Dimensions","text":"","category":"section"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Prefixed by n_, indicating this is an integer specifying the length of some quantities; then followed by a short acronym of the quantity, to avoid typing long names repeatedly.","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"n_bands: number of bands\nn_wann: number of WFs\nn_kpts: number of kpoints\nn_bvecs: number of b-vectors\nn_atoms: number of atoms","category":"page"},{"location":"api/convention/#Indices","page":"Convention","title":"Indices","text":"","category":"section"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Usually, the returned quantities are Vectors of some types (Matrix{Float64}, Vector{Float64}, etc), and the indices follow the order of","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"kpoints\nb-vectors (if needed)\nbands\nWannier functions","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"For instance, the energy eigenvalues eigenvalues is a length-n_kpts vector, with each element a length-n_bands vector of floats, i.e., eigenvalues[ik][ib] is the ib-th eigenvalue at ik-th kpoint.","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Here are some examples of indexing the vectors:","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"eigenvalues[ik][m] for energy eigenvalues varepsilon_m mathbfk\nU[ik][m, n] for the gauge matrix U_mn mathbfk\nM[ik][ib][m, n] for the overlap matrix M_mn mathbfk mathbfk + mathbfb","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"where","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"ik: index of kpoints\nib: index of b-vectors\nm: index of bands\nn: index of Wannier functions","category":"page"},{"location":"api/convention/#Functions","page":"Convention","title":"Functions","text":"","category":"section"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"In most cases, there are some multiple dispatches for the same function. For instance, there are three functions for reading the chk file:","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"read_chk(filename::AbstractString)\nread_chk(filename::AbstractString, ::FortranText)\nread_chk(filename::AbstractString, ::FortranBinary)","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Why do we need several functions for reading the same format? The reasons are:","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Wannier90 is a Fortran code that accepts both Fortran text format and binary format (or called Fortran formatted and unformatted file, respectively). To avoid introducing lots of different function names for reading text or binary files, we use multiple dispatch to distinguish them: the type of the 2nd argument (FortranText or FortranBinary) is used to distinguish the file type we want to read.\nHowever, asking the user to manually specify the file format is tedious, therefore, we provide a high-level user-friendly function (the 1st one), which\nautomatically detects the file format and calls the corresponding low-level (2nd or 3rd) function\nprints some information of key quantities of the file, e.g., number of kpoints, number of Wannier functions, etc., to give user a hint of what have been parsed\nhides some irrelevant return values, e.g., the header (the 1st line) of the file, since it has been printed in the stdout\nThe low-level functions parse everything in the file, while the high-level function aims at user ergonomics.","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Thus,","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"In most cases using the high-level function is enough, e.g.,\njulia> using WannierIO\njulia> A = read_amn(\"si2.amn\")\n┌ Info: Reading amn file\n│ filename = \"si2.amn\"\n│ header = \"Created on 9Sep2022 at 16:41: 5\"\n│ n_kpts = 8\n│ n_bands = 4\n└ n_wann = 4\n8-element Vector{Matrix{ComplexF64}}:\n [...]\nUse the low-level functions if you\nwant to get the header of the file (or quantities not returned by high-level function)\ndo not want stdout to be \"polluted\"\njulia> using WannierIO\njulia> A, header = read_amn(\"si2.amn\", WannierIO.FortranText())\njulia> typeof(A)\nVector{Matrix{ComplexF64}} (alias for Array{Array{Complex{Float64}, 2}, 1})\njulia> header\n\"Created on 9Sep2022 at 16:41: 5\"","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Note that usually the high-level function directly returns the quantities, e.g., a single A to avoid the user unpacking return values; however, often the low-level functions return a NamedTuple of all the quantities, for the sake of clarity.","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"julia> amn = read_amn(\"si2.amn\", WannierIO.FortranText())\njulia> typeof(amn)\nNamedTuple{(:A, :header), Tuple{Vector{Matrix{ComplexF64}}, SubString{String}}}","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Of course, when using low-level functions you can also directly access the quantity without unpacking by","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"julia> A = read_amn(\"si2.amn\", WannierIO.FortranText()).A","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"When writing files, the user can specify whether to write in text or binary by a keyword argument binary of the high-level function","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"julia> write_amn(\"si2.amn\", A; binary=true)","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"The binary keyword argument avoids the user specifying the file type when calling the low-level functions, e.g.,","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"julia> write_amn(\"si2.amn\", A, WannierIO.FortranBinaryStream())","category":"page"},{"location":"api/qe/#Quantum-ESPRESSO-files","page":"Quantum ESPRESSO","title":"Quantum ESPRESSO files","text":"","category":"section"},{"location":"api/qe/","page":"Quantum ESPRESSO","title":"Quantum ESPRESSO","text":"CurrentModule = WannierIO","category":"page"},{"location":"api/qe/","page":"Quantum ESPRESSO","title":"Quantum ESPRESSO","text":"Modules = [WannierIO]\nPages = [\n \"qe/band.jl\",\n \"qe/xml.jl\",\n]","category":"page"},{"location":"api/qe/#WannierIO.guess_kpath-Tuple{AbstractVector{<:AbstractVector}}","page":"Quantum ESPRESSO","title":"WannierIO.guess_kpath","text":"guess_kpath(kpoints; atol)\n\n\nGuess high symmetry points from kpoint coordinates.\n\nIf there is angle between two consecutive kpoints, then it is labeled as a high-symmetry point.\n\nArguments\n\nkpoints: Vector of Vector or Vec3, in Cartesian coordinates\n\nKeyword Arguments\n\natol: Absolute tolerance for checking cross product of two vectors\n\nReturns\n\nsymm_point_indices: Vector of indices of high-symmetry points\nsymm_point_labels: Vector of labels of high-symmetry points, for the moment it is empty\n\n\n\n\n\n","category":"method"},{"location":"api/qe/#WannierIO.read_qe_band-Tuple{AbstractString}","page":"Quantum ESPRESSO","title":"WannierIO.read_qe_band","text":"read_qe_band(filename)\n\n\nRead Quantum ESPRESSO bands.x output data file.\n\nThe data file has format\n\n &plot nbnd= 20, nks= 380 /\n -0.500000 0.500000 0.500000\n -3.320 -0.666 5.173 5.173 7.994 9.725 9.725 14.147 16.993 16.993\n 17.841 17.841 17.902 19.666 25.961 26.563 28.186 28.186 28.368 28.368\n -0.495000 0.495000 0.495000\n -3.322 -0.664 5.173 5.173 7.994 9.725 9.725 14.148 16.980 16.980\n...\n\n\n\n\n\n","category":"method"},{"location":"api/qe/#WannierIO.read_qe_xml-Tuple{AbstractString}","page":"Quantum ESPRESSO","title":"WannierIO.read_qe_xml","text":"read_qe_xml(filename)\n\n\nRead atomic structure and band structure from QE's XML output.\n\nReturn\n\nlattice: 3 * 3, Å, each column is a lattice vector\natom_positions: length-n_atoms vector, each element is a fractional position\natom_labels: length-n_atoms vector, each element is the label of the corresponding atom\nrecip_lattice: 3 * 3, Å⁻¹, each column is a reciprocal lattice vector\nkpoints: length-n_kpts vector, each element is a fractional kpoint\nfermi_energy: eV\nalat: the alat of QE in Å\neigenvalues: length-n_kpts vector, each element is a length-n_bands vector of eigenvalue in eV. For spin-polarized but without SOC calculations, return two arries of eigenvalues_up and eigenvalues_dn for the two spin channels.\n\n\n\n\n\n","category":"method"},{"location":"#WannierIO.jl","page":"Home","title":"WannierIO.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"A Julia package for reading/writing Wannier90 files.","category":"page"},{"location":"","page":"Home","title":"Home","text":"The package is designed to be minimalistic to allow easy reuse in other packages.","category":"page"},{"location":"","page":"Home","title":"Home","text":"This package originates from the IO part of the Wannier.jl package.","category":"page"},{"location":"#Wannier90-files","page":"Home","title":"Wannier90 files","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Input files:","category":"page"},{"location":"","page":"Home","title":"Home","text":"amn\nmmn\neig\nchk\nUNK\nspn","category":"page"},{"location":"","page":"Home","title":"Home","text":"Also support parsing both plain text and binary formats (in Fortran language, called formatted and unformatted IO, respectively) for some files, e.g., chk and UNK.","category":"page"},{"location":"","page":"Home","title":"Home","text":"Output files:","category":"page"},{"location":"","page":"Home","title":"Home","text":"*_band.dat\n*_tb.dat\n*_wsvec.dat\n*_hr.dat\n*_r.dat\nxsf\ncube\n...","category":"page"},{"location":"#Quantum-ESPRESSO-files","page":"Home","title":"Quantum ESPRESSO files","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"To support comparing Wannier-interpolated band structures with density function theory (DFT) bands, there are also some functions to parse Quantum ESPRESSO (QE) output files:","category":"page"},{"location":"","page":"Home","title":"Home","text":"xml\nbands.dat generated by QE bands.x","category":"page"},{"location":"api/volumetric/#Volumetric-data-files","page":"Volumetric data","title":"Volumetric data files","text":"","category":"section"},{"location":"api/volumetric/","page":"Volumetric data","title":"Volumetric data","text":"CurrentModule = WannierIO","category":"page"},{"location":"api/volumetric/#Read/write","page":"Volumetric data","title":"Read/write","text":"","category":"section"},{"location":"api/volumetric/","page":"Volumetric data","title":"Volumetric data","text":"Modules = [WannierIO]\nPages = [\n \"volume/xsf.jl\",\n \"volume/bxsf.jl\",\n \"volume/cube.jl\",\n]","category":"page"},{"location":"api/volumetric/#WannierIO.read_xsf-Tuple{AbstractString}","page":"Volumetric data","title":"WannierIO.read_xsf","text":"read_xsf(filename)\n\n\nRead xsf file.\n\nReturn\n\nprimvec: 3 * 3, Å, each column is a primitive lattice vector\nconvvec: 3 * 3, Å, each column is a conventional lattice vector\natoms: n_atoms String, atomic symbols or numbers\natom_positions: length-n_atoms vector, Å, cartesian coordinates\norigin: 3, Å, origin of the grid\nspan_vectors: 3 * 3, Å, each column is a spanning vector\nX: nx, fractional coordinate of grid points along the first spanning vector\nY: ny, fractional coordinate of grid points along the second spanning vector\nZ: nz, fractional coordinate of grid points along the third spanning vector\nW: nx * ny * nz, volumetric data\n\nnote: Note\nOnly support reading 1 datagrid in BLOCK_DATAGRID_3D.\n\n\n\n\n\n","category":"method"},{"location":"api/volumetric/#WannierIO.write_xsf-Union{Tuple{T}, Tuple{AbstractString, AbstractMatrix{T}, Array{StaticArraysCore.SVector{3, T}, 1}, AbstractVector{Int64}, AbstractVector{T}, AbstractMatrix{T}, AbstractArray{T, 3}}} where T<:Real","page":"Volumetric data","title":"WannierIO.write_xsf","text":"write_xsf(\n filename,\n lattice,\n atom_positions,\n atom_numbers,\n origin,\n span_vectors,\n W\n)\n\n\nWrite xsf file.\n\nArguments\n\nlattice: 3 * 3, Å, each column is a lattice vector\natom_positions: length-n_atoms vector, fractional coordinates\natom_numbers: n_atoms, atomic numbers\norigin: 3, Å, origin of the grid\nspan_vectors: 3 * 3, Å, each column is a spanning vector\nW: nx * ny * nz, volumetric data\n\n\n\n\n\n","category":"method"},{"location":"api/volumetric/#WannierIO.read_bxsf-Tuple{AbstractString}","page":"Volumetric data","title":"WannierIO.read_bxsf","text":"read_bxsf(filename)\n\n\nRead bxsf file.\n\nReturn\n\nfermi_energy: Fermi energy in eV\norigin: 3, Å⁻¹, origin of the grid\nspan_vectors: 3 * 3, Å⁻¹, each column is a spanning vector\nX: nx, fractional coordinate of grid points along the first spanning vector\nY: ny, fractional coordinate of grid points along the second spanning vector\nZ: nz, fractional coordinate of grid points along the third spanning vector\nE: n_bands * nx * ny * nz, eigenvalues at each grid point\n\n\n\n\n\n","category":"method"},{"location":"api/volumetric/#WannierIO.write_bxsf-Union{Tuple{T}, Tuple{AbstractString, T, AbstractVector{T}, AbstractMatrix{T}, AbstractArray{T, 4}}} where T<:Real","page":"Volumetric data","title":"WannierIO.write_bxsf","text":"write_bxsf(filename, fermi_energy, origin, span_vectors, E)\n\n\nWrite bxsf file.\n\nArguments\n\nfermi_energy: Fermi energy in eV\norigin: 3, Å⁻¹, origin of the grid\nspan_vectors: 3 * 3, Å⁻¹, each column is a spanning vector\nE: n_bands * nx * ny * nz, eigenvalues at each grid point\n\n\n\n\n\n","category":"method"},{"location":"api/volumetric/#WannierIO.read_cube-Tuple{AbstractString}","page":"Volumetric data","title":"WannierIO.read_cube","text":"read_cube(filename)\n\n\nRead cube file.\n\nnote: Note\nBy default, cube use Bohr unit, here all returns are in Cartesian coordinates, Å unit.\n\n\n\n\n\n","category":"method"},{"location":"api/volumetric/#WannierIO.write_cube-Union{Tuple{T}, Tuple{AbstractString, AbstractMatrix{T}, AbstractVector{Int64}, AbstractVector{T}, AbstractMatrix{T}, AbstractArray{T, 3}}} where T<:Real","page":"Volumetric data","title":"WannierIO.write_cube","text":"write_cube(\n filename,\n atom_positions,\n atom_numbers,\n origin,\n voxel_vectors,\n W\n)\n\n\nWrite cube file.\n\nArguments\n\natom_positions: 3 * n_atoms, Å, cartesian coordinates\natom_numbers: n_atoms, atomic numbers\norigin: 3, Å, origin of the grid\nvoxel_vectors: 3 * 3, Å, each column is a voxel vector\nW: nx * ny * nz, volumetric data\n\n\n\n\n\n","category":"method"},{"location":"api/epw/#EPW-files","page":"EPW","title":"EPW files","text":"","category":"section"},{"location":"api/epw/","page":"EPW","title":"EPW","text":"CurrentModule = WannierIO","category":"page"},{"location":"api/epw/","page":"EPW","title":"EPW","text":"Modules = [WannierIO]\nPages = [\n \"misc/epw.jl\",\n]","category":"page"},{"location":"api/epw/#WannierIO.Ukk","page":"EPW","title":"WannierIO.Ukk","text":"Struct for the EPW .ukk file.\n\nSimilar to the W90 .chk file.\n\nstruct Ukk{T<:Real}\n\nFields\n\nibndstart: index of the first band\nibndend: index of the last band\nn_kpts: number of kpoints\nn_bands: number of bands\nn_wann: number of wannier functions\nU: gauge matrices, length-n_kpts vector, each element is a n_bands * n_wann matrix\nfrozen_bands: flag for frozen bands, length-n_kpts vector, each element is a length-n_bands vector\nexcluded_bands: flag for excluded bands, length-n_bands + n_excl_bands vector, where n_excl_bands is the number of excluded bands\ncenters: centers of WFs, length-n_wann vector of Vec3. Note that EPW uses Cartesian coordinates w.r.t the QE alat, so it is dimensionless.\n\n\n\n\n\n","category":"type"},{"location":"api/epw/#WannierIO.Ukk-Tuple{WannierIO.Chk, Real}","page":"EPW","title":"WannierIO.Ukk","text":"Ukk(chk, alat)\n\n\nConstruct a EPW Ukk from a W90 Chk.\n\nArguments\n\nchk: the Chk struct\nalat: the QE alat in Å unit. Note that the alat from QE stdout file is in Bohr unit, you need to do the conversion by multiplying it with Bohr_QE.\n\nExamples\n\nConvert a W90 .chk file to a EPW .ukk file:\n\nusing WannierIO\nchk = read_chk(\"BN.chk\")\n# Note we need QE `alat` for ukk. You can get it\n# - either by inspecting the QE stdout file, from line like\n# lattice parameter (alat) = 6.8330 a.u.\n# where the 6.8330 is the alat in Bohr unit. However, the Bohr constant\n# in W90 and QE are slightly different, to be exact we need to do the unit\n# conversion using QE constant:\nalat = 6.8330 * WannierIO.Bohr_QE\n# - or better by parsing the QE xml file, and the unit conversion is done automatically\nalat = read_qe_xml(\"BN.xml\").alat\nukk = Ukk(chk, alat)\nWannierIO.write_epw_ukk(\"BN.ukk\", ukk)\n\n\n\n\n\n","category":"method"},{"location":"api/epw/#Base.isapprox-Tuple{WannierIO.Ukk, WannierIO.Ukk}","page":"EPW","title":"Base.isapprox","text":"isapprox(a, b)\n\n\nCompare two Ukk structs.\n\n\n\n\n\n","category":"method"},{"location":"api/epw/#WannierIO.read_epw_mmn-Tuple{AbstractString}","page":"EPW","title":"WannierIO.read_epw_mmn","text":"read_epw_mmn(filename; n_kpts, n_bvecs, n_bands)\n\n\nRead the EPW mmn file.\n\nThe EPW mmn format is different from that of W90. It does not contain the number of kpoints/bvectors/bands, so they need to be provided as keyword arguments.\n\nArguments\n\nfilename: the mmn file name\n\nKeyword arguments\n\nn_kpts: number of kpoints\nn_bvecs: number of bvectors\nn_bands: number of bands\n\nReturn\n\nM: length-n_kpts vector of length-n_bvecs vector of n_bands * n_bands matrices\n\n\n\n\n\n","category":"method"},{"location":"api/epw/#WannierIO.read_epw_ukk-Tuple{AbstractString}","page":"EPW","title":"WannierIO.read_epw_ukk","text":"read_epw_ukk(filename)\n\n\nRead the EPW .ukk file.\n\nArguments\n\nfilename: the output file name\n\nReturn\n\nukk: the Ukk struct\n\n\n\n\n\n","category":"method"},{"location":"api/epw/#WannierIO.write_epw_ukk-Tuple{AbstractString, WannierIO.Ukk}","page":"EPW","title":"WannierIO.write_epw_ukk","text":"write_epw_ukk(filename, ukk)\n\n\nWrite the EPW .ukk file.\n\nArguments\n\nfilename: the output file name\nukk: the Ukk struct\n\nExamples\n\nSee Ukk(chk::Chk, alat::Real) for how to construct a Ukk from a Chk.\n\n\n\n\n\n","category":"method"}] +[{"location":"api/w90/#Wannier90-files","page":"Wannier90","title":"Wannier90 files","text":"","category":"section"},{"location":"api/w90/","page":"Wannier90","title":"Wannier90","text":"CurrentModule = WannierIO","category":"page"},{"location":"api/w90/","page":"Wannier90","title":"Wannier90","text":"warning: Warning\nSome of the functions, e.g. read_amn, write_amn, read_chk, write_chk, etc., support reading/writing Fortran unformatted files. However, the Fortran unformatted files are machine and compiler dependent. Therefore, it is not guaranteed that these functions work for all the cases. Currently, the functions are tested on the following platforms:Linux + gfortran 11.2","category":"page"},{"location":"api/w90/#Public-API","page":"Wannier90","title":"Public API","text":"","category":"section"},{"location":"api/w90/","page":"Wannier90","title":"Wannier90","text":"Modules = [WannierIO]\nPrivate = false\nPages = map(file -> joinpath(\"w90\", file), readdir(\"../src/w90\"))","category":"page"},{"location":"api/w90/#WannierIO.read_amn","page":"Wannier90","title":"WannierIO.read_amn","text":"read_amn(filename)\nread_amn(filename, ::FortranText)\nread_amn(filename, ::FortranBinaryStream)\n\nRead wannier90 amn file.\n\nReturn\n\nA: length-n_kpts vector, each element is a n_bands * n_wann matrix.\nheader: first line of the file\n\nNote there are three versions of this function: the 1st one is a wrapper function that automatically detect the format (text or binary) of the file, and does some additional pretty printing to give user a quick hint of the dimensions of the A matrix; it internally calls the 2nd or the 3rd version for actual reading.\n\nWannier90 only has Fortran text format for amn, however I wrote a custom version of QE pw2wannier90.x that can output Fortran binary format (using Fortran stream IO) to save some disk space. The 1st function auto detect the file format so it is transparent to the user.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_amn","page":"Wannier90","title":"WannierIO.write_amn","text":"write_amn(filename, A; header=default_header(), binary=false)\nwrite_amn(filename, A, ::FortranText; header=default_header())\nwrite_amn(filename, A, ::FortranBinaryStream; header=default_header())\n\nWrite wannier90 amn file.\n\nArguments\n\nfilename: output filename\nA: a length-n_kpts vector, each element is a n_bands * n_wann matrix\n\nKeyword arguments\n\nheader: 1st line of the file\nbinary: write as Fortran unformatted file, which is the Wannier90 default. Here the binary kwargs is provided for convenience.\n\nSame as read_amn there are three versions of this function, the 1st one is a wrapper function, it calls the 2nd or the 3rd version depending on the binary kwargs.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_w90_band-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_band","text":"read_w90_band(prefix)\n\n\nRead prefix_band.dat, prefix_band.kpt, prefix_band.labelinfo.dat.\n\nArguments\n\nprefix: prefix of the filenames (or called seedname in wannier90), NOT the full filename.\n\nReturn\n\nx: n_kpts, x axis value of kpath, in cartesian length\neigenvalues: length-n_kpts vector, each element is a length-n_bands vector of band energies\nkpoints: a vector of length n_kpts, fractional coordinates\nkweights: a vector of length n_kpts, weights of kpoints\nsymm_point_indices: index of high-symmetry points in prefix_band.dat\nsymm_point_labels: name of high-symmetry points\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_w90_band_dat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_band_dat","text":"read_w90_band_dat(filename)\n\n\nRead prefix_band.dat file generated by wannier90.x, or prefix-band.dat file generated by postw90.x.\n\nReturn\n\nx: n_kpts, x axis value of kpath, in cartesian length\neigenvalues: length-n_kpts vector, each elemnt is a length-n_bands vector of band energies\nextras: optional (the postw90.x might generate a file with a third column), same size as eigenvalues, often the color of each eigenvalue, e.g., spin projection\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_w90_band_kpt-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_band_kpt","text":"read_w90_band_kpt(filename)\n\n\nRead a prefix_band.kpt file.\n\nReturn\n\nkpoints: a vector of length n_kpts, fractional coordinates\nkweights: a vector of length n_kpts, weights of kpoints\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_w90_band_labelinfo-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_band_labelinfo","text":"read_w90_band_labelinfo(filename)\n\n\nRead prefix_band.labelinfo file.\n\nReturn\n\nsymm_point_indices: index of high-symmetry points in prefix_band.dat\nsymm_point_labels: name of high-symmetry points\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_band-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_band","text":"write_w90_band(\n prefix;\n x,\n eigenvalues,\n kpoints,\n kweights,\n symm_point_indices,\n symm_point_labels\n)\n\n\nWrite prefix_band.dat, prefix_band.kpt, prefix_band.labelinfo.dat.\n\nArguments\n\nprefix: prefix of prefix_band.dat, prefix_band.kpt, prefix_band.labelinfo.dat\n\nKeyword Arguments\n\nx: n_kpts, x axis value, in cartesian length\neigenvalues: length-n_kpts vector, each element is a length-n_bands vector of band energies\nkpoints: length-n_kpts vector, fractional coordinates\nkweights: a vector of length n_kpts, weights of kpoints\nsymm_point_indices: index of high-symmetry points in prefix_band.dat\nsymm_point_labels: name of high-symmetry points\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_band_dat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_band_dat","text":"write_w90_band_dat(filename; x, eigenvalues, extras)\n\n\nWrite prefix_band.dat file.\n\nArguments\n\nfilename: filename of prefix_band.dat\n\nKeyword Arguments\n\nx: n_kpts, x axis value, in cartesian length\neigenvalues: length-n_kpts vector, each element is a length-n_bands vector of band energies\nextras: optional, same size as eigenvalues, will be written as the third column of prefix_band.dat. The prefix-band.dat file generated by postw90.x sometimes has a third column for e.g. the color of the eigenvalues\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_band_kpt-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_band_kpt","text":"write_w90_band_kpt(filename; kpoints, kweights)\n\n\nWrite prefix_band.kpt file.\n\nArguments\n\nfilename: filename of prefix_band.kpt\n\nKeyword Arguments\n\nkpoints: length-n_kpts vector, fractional coordinates\nkweights: n_kpts, optional, weights of kpoints, default to 1.0.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_band_labelinfo-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_band_labelinfo","text":"write_w90_band_labelinfo(\n filename;\n x,\n kpoints,\n symm_point_indices,\n symm_point_labels\n)\n\n\nWrite prefix_band.labelinfo file.\n\nArguments\n\nfilename: filename of prefix_band.labelinfo\n\nKeyword Arguments\n\nx: n_kpts-vector, x axis value, in cartesian length\nkpoints: length-n_kpts vector, fractional coordinates\nsymm_point_indices: index of high-symmetry points in prefix_band.dat\nsymm_point_labels: name of high-symmetry points\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.get_U-Tuple{WannierIO.Chk}","page":"Wannier90","title":"WannierIO.get_U","text":"get_U(chk)\n\n\nExtract the combined U = Udis * Uml matrices from Chk.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.get_Udis-Tuple{WannierIO.Chk}","page":"Wannier90","title":"WannierIO.get_Udis","text":"get_Udis(chk)\n\n\nExtract disentanglement Udis matrices from Chk.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_chk-Tuple{AbstractString, WannierIO.FortranText}","page":"Wannier90","title":"WannierIO.read_chk","text":"read_chk(filename)\nread_chk(filename, ::FortranText)\nread_chk(filename, ::FortranBinary)\n\nRead wannier90 chk checkpoint file.\n\nSimilar to read_amn, the 1st version auto detect chk file format (binary or text) and read it.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_chk","page":"Wannier90","title":"WannierIO.write_chk","text":"write_chk(filename, chk::Chk; binary=false)\nwrite_chk(filename, chk::Chk, ::FortranText)\nwrite_chk(filename, chk::Chk, ::FortranBinary)\n\nWrite wannier90 chk file.\n\nSimilar to write_amn, the 1st version is a convenience wrapper.\n\nKeyword arguments\n\nbinary: write as Fortran binary file or not. Although wannier90 default is Fortran binary format, here the default is false since Fortran binary depends on compiler and platform, so it is not guaranteed to always work.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_eig","page":"Wannier90","title":"WannierIO.read_eig","text":"read_eig(filename)\nread_eig(filename, ::FortranText)\nread_eig(filename, ::FortranBinaryStream)\n\nRead the wannier90 eig file.\n\nReturn\n\neigenvalues: a lenth-n_kpts vector, each element is a length-n_bands vector\n\nThe 1st version is a convenience wrapper function for the 2nd and 3rd versions.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_eig","page":"Wannier90","title":"WannierIO.write_eig","text":"write_eig(filename, eigenvalues; binary=false)\nwrite_eig(filename, eigenvalues, ::FortranText)\nwrite_eig(filename, eigenvalues, ::FortranBinaryStream)\n\nWrite eig file.\n\nArguments\n\neigenvalues: a length-n_kpts vector, each element is a length-n_bands vector\n\nKeyword arguments\n\nbinary: if true write in Fortran binary format.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_w90_hrdat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_hrdat","text":"read_w90_hrdat(filename)\n\n\nRead prefix_hr.dat.\n\nReturn\n\nRvectors: mathbfR-vectors on which operators are defined\nRdegens: degeneracies of each mathbfR-vector\nH: Hamiltonian mathbfH(mathbfR)\nheader: the first line of the file\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_hrdat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_hrdat","text":"write_w90_hrdat(filename; Rvectors, Rdegens, H, header)\n\n\nWrite prefix_hr.dat.\n\nKeyword arguments\n\nSee the return values of read_w90_hrdat.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_mmn","page":"Wannier90","title":"WannierIO.read_mmn","text":"read_mmn(filename)\nread_mmn(filename, ::FortranText)\nread_mmn(filename, ::FortranBinaryStream)\n\nRead wannier90 mmn file.\n\nReturn\n\nM: length-n_kpts vector, each element is a length-n_bvecs vector, then each element is a n_bands * n_bands matrix\nkpb_k: length-n_kpts vector, each element is a length-n_bvecs vector of integers for the indices of the neighboring kpoints\nkpb_G: length-n_kpts vector, each element is a lenght-n_bvecs vector of of Vec3{Int}, which are the translation vectors\nheader: 1st line of the file\n\nThe translation vector G is defined as b = kpoints[kpb_k[ik][ib]] + kpb_G[ik][ib] - kpoints[ik], where b is the ib-th bvector of the ik-th kpoint.\n\nThe 1st version is a convenience wrapper for the other two.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_mmn","page":"Wannier90","title":"WannierIO.write_mmn","text":"write_mmn(filename; M, kpb_k, kpb_G; header=default_header(), binary=false)\nwrite_mmn(filename; M, kpb_k, kpb_G, ::FortranText; header=default_header(), binary=false)\nwrite_mmn(filename; M, kpb_k, kpb_G, ::FortranBinaryStream; header=default_header(), binary=false)\n\nWrite wannier90 mmn file.\n\nArguments\n\nfilename: output file name\nM: length-n_kpts vector of n_bands * n_bands * n_bvecs arrays\nkpb_k: length-n_kpts vector of length-n_bvecs vector of integers\nkpb_G: length-n_kpts vector of length-n_bvecs vector of Vec3{Int} for bvectors\n\nKeyword arguments\n\nheader: header string\nbinary: if true write in Fortran binary format\n\nThe 1st version is a convenience wrapper for the other two.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_nnkp","page":"Wannier90","title":"WannierIO.read_nnkp","text":"read_nnkp(filename)\nread_nnkp(filename, ::Wannier90Text)\nread_nnkp(filename, ::Wannier90Toml)\n\nRead wannier90 nnkp file.\n\nReturn\n\nlattice: each column is a lattice vector\nrecip_lattice: each column is a reciprocal lattice vector\nkpoints: length-n_kpts vector, each element is Vec3, in fractional coordinates\nkpb_k: length-n_kpts vector, each element is a length-n_bvecs vector of integers, index of kpoints\nkpb_G: length-n_kpts vector, each element is a length-n_bvecs vector, then each element is Vec3 for translations, fractional w.r.t recip_lattice\n\nWannier90 nnkp file is a plain text format, the 2nd version reads nnkp file in Wannier90 format. The thrid version read a TOML-format nnkp file, which is defined by this package, see write_nnkp. The 1st version auto detects the format and parse it.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_nnkp","page":"Wannier90","title":"WannierIO.write_nnkp","text":"write_nnkp(filename; toml=false, kwargs...)\nwrite_nnkp(filename, ::Wannier90Text; kwargs...)\nwrite_nnkp(filename, ::Wannier90Toml; kwargs...)\n\nWrite a nnkp file that can be used by DFT codes, e.g., QE pw2wannier90.\n\nKeyword Arguments\n\ntoml: write to a TOML file, otherwise write to a Wannier90 text file format\nrecip_lattice: each column is a reciprocal lattice vector\nkpoints: length-n_kpts vector of Vec3, in fractional coordinates\nkpb_k: length-n_kpts vector, each element is a length-n_bvecs vector of integers, index of kpoints\nkpb_G: length-n_kpts vector, each element is a length-n_bvecs vector, then each element is a Vec3 for translation vector, fractional w.r.t. recip_lattice\nn_wann: if given, write an auto_projections block\nexclude_bands: if given, write the specified band indices in the exclude_bands block\nheader: first line of the file\n\nnote: Note\nOnly use auto_projections, the projections block is not supported.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_w90_rdat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_rdat","text":"read_w90_rdat(filename)\n\n\nRead prefix_r.dat.\n\nReturn\n\nRvectors: mathbfR-vectors on which operators are defined\nr_x: x-component of position operator\nr_y: y-component of position operator\nr_z: z-component of position operator\nheader: the first line of the file\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_spn","page":"Wannier90","title":"WannierIO.read_spn","text":"read_spn(filename)\nread_spn(filename, ::FortranText)\nread_spn(filename, ::FortranBinary)\n\nRead the wannier90 spn file.\n\nReturn\n\nSx: spin x, a length-n_kpts vector, each element is a n_bands-by-n_bands matrix\nSy: spin y, a length-n_kpts vector, each element is a n_bands-by-n_bands matrix\nSz: spin z, a length-n_kpts vector, each element is a n_bands-by-n_bands matrix\nheader: 1st line of the file\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_spn","page":"Wannier90","title":"WannierIO.write_spn","text":"write_spn(filename, Sx, Sy, Sz; binary=false, header)\nwrite_spn(filename, Sx, Sy, Sz, ::FortranText; header)\nwrite_spn(filename, Sx, Sy, Sz, ::FortranBinary; header)\n\nWrite the spn file.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_w90_tbdat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_tbdat","text":"read_w90_tbdat(filename)\n\n\nRead prefix_tb.dat.\n\nReturn\n\nlattice: each column is a lattice vector in Å\nRvectors: mathbfR-vectors on which operators are defined\nRdegens: degeneracies of each mathbfR-vector\nH: Hamiltonian mathbfH(mathbfR)\nr_x: x-component of position operator\nr_x: y-component of position operator\nr_x: z-component of position operator\nheader: the first line of the file\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_tbdat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_tbdat","text":"write_w90_tbdat(\n filename;\n lattice,\n Rvectors,\n Rdegens,\n H,\n r_x,\n r_y,\n r_z,\n header\n)\n\n\nWrite prefix_tb.dat.\n\nKeyword arguments\n\nSee the return values of read_w90_tbdat.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_uHu","page":"Wannier90","title":"WannierIO.read_uHu","text":"read_uHu(filename)\nread_uHu(filename, ::FortranText; transpose_band_indices=true)\nread_uHu(filename, ::FortranBinary; transpose_band_indices=true)\n\nRead the wannier90 uHu file.\n\nKeyword Arguments\n\ntranspose_band_indices: QE pw2wannier90.x writes the matrix in a strange transposed manner; if reading a QE-generated uHu file, this flag should be true to restore the band indices order, so that the returned matrix has the correct order, i.e., uHu[ik][ib1, ib2][m, n] is langle u_m k + b_1 H u_n k + b_2 rangle\n\nReturn\n\nuHu: a length-n_kpts vector, each element is a n_bvecs * n_bvecs matrix, then each element is a n_bands * n_bands matrix\nheader: 1st line of the file\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_uHu","page":"Wannier90","title":"WannierIO.write_uHu","text":"write_uHu(filename, uHu; binary=false, header)\nwrite_uHu(filename, uHu, ::FortranText; header)\nwrite_uHu(filename, uHu, ::FortranBinary; header)\n\nWrite the uHu file.\n\nKeyword Arguments\n\ntranspose_band_indices: see read_uHu\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_unk","page":"Wannier90","title":"WannierIO.read_unk","text":"read_unk(filename)\nread_unk(filename, ::FortranText)\nread_unk(filename, ::FortranBinary)\n\nRead wannier90 UNK file for the periodic part of Bloch wavefunctions.\n\nReturn\n\nik: k-point index, start from 1\nΨ: periodic part of Bloch wavefunctions in real space, size = (n_gx, n_gy, n_gz, n_bands, n_spin)\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_unk","page":"Wannier90","title":"WannierIO.write_unk","text":"write_unk(filename, ik, Ψ; binary=false)\nwrite_unk(filename, ik, Ψ, ::FortranText)\nwrite_unk(filename, ik, Ψ, ::FortranBinary)\n\nWrite UNK file for the periodic part of Bloch wavefunctions.\n\nArguments\n\nik: at which kpoint? start from 1\nΨ: Bloch wavefunctions, size(Ψ) = (n_gx, n_gy, n_gz, n_bands, n_spin)\n\nKeyword arguments\n\nbinary: write as Fortran unformatted file\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_win","page":"Wannier90","title":"WannierIO.read_win","text":"read_win(filename; fix_inputs=true)\nread_win(filename, ::Wannier90Text; fix_inputs=true)\nread_win(filename, ::Wannier90Toml; fix_inputs=true)\n\nRead wannier90 input win file.\n\nArguments\n\nfilename: The name of the input file.\n\nKeyword Arguments\n\nfix_inputs: sanity check and fix the input parameters, e.g., set num_bands = num_wann if num_bands is not specified, convert atoms_cart always to atoms_frac, etc. See also fix_win!.\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.write_win","page":"Wannier90","title":"WannierIO.write_win","text":"write_win(filename; toml=false, kwargs...)\nwrite_win(filename, ::Wannier90Text; kwargs...)\nwrite_win(filename, ::Wannier90Toml; kwargs...)\n\nWrite input parameters into a wannier90 win file.\n\nThe input parameters are keyword arguments, with key names same as that of wannier90.\n\nExamples\n\nusing WannierIO\n\nwrite_win(\n \"silicon.win\";\n num_wann=4,\n num_bands=4,\n # unit_cell_cart is a matrix, its columns are the lattice vectors in angstrom\n unit_cell_cart=[\n 0.0 2.71527 2.71527\n 2.71527 0.0 2.71527\n 2.71527 2.71527 0.0\n ],\n # atoms_frac is a vector of pairs of atom_label and fractional coordinates\n atoms_frac=[\n :Si => [0.0, 0.0, 0.0],\n :Si => [0.25, 0.25, 0.25],\n # both `:Si` and `\"Si\"` are allowed\n # \"Si\" => [0.25, 0.25, 0.25],\n ],\n # each element in projections will be written as a line in the win file\n projections=[\n \"random\",\n ]\n kpoint_path=[\n [:G => [0.0, 0.0, 0.0], :X => [0.5, 0.0, 0.5]],\n [:X => [0.5, 0.0, 0.5], :U => [0.625, 0.25, 0.625]],\n ],\n mp_grid=[2, 2, 2],\n # kpoints is a matrix, its columns are the fractional coordinates\n kpoints=[\n [0.0, 0.0, 0.0],\n [0.0, 0.0, 0.5],\n [0.0, 0.5, 0.0],\n [0.0, 0.5, 0.5],\n [0.5, 0.0, 0.0],\n [0.5, 0.0, 0.5],\n [0.5, 0.5, 0.0],\n [0.5, 0.5, 0.5],\n ],\n # additional parameters can be passed as keyword arguments, e.g.,\n num_iter=500,\n)\n\n\n\n\n\n","category":"function"},{"location":"api/w90/#WannierIO.read_wout-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_wout","text":"read_wout(filename; iterations)\n\n\nParse wannire90 wout file.\n\nKeyword Arguments\n\niterations: if true, parse all the iterations of disentanglement and maximal localization. Default is false.\n\nReturn\n\nlattice: each column is a lattice vector in Å\nrecip_lattice: each column is a reciprocal lattice vector in Å⁻¹\natom_labels: atomic symbols\natom_positions: in fractional coordinates\ncenters: final each WF centers in Å\nspreads: final each WF spreads in Ų\nΩI, ΩD, ΩOD, Ωtotal: final spread (components) in Ų\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_w90_wsvec-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_w90_wsvec","text":"read_w90_wsvec(filename)\n\n\nRead prefix_wsvec.dat.\n\nReturn\n\nmdrs: whether use MDRS interpolation, i.e. the use_ws_distance in the header\nRvectors: the mathbfR-vectors\nTvectors: the mathbfT_m n mathbfR-vectors. Returned only mdrs = true.\nTdegens: the degeneracies of mathbfT_m n mathbfR-vectors. Returned only mdrs = true.\nn_wann: number of WFs\nheader: the first line of the file\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_w90_wsvec-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.write_w90_wsvec","text":"write_w90_wsvec(\n filename;\n Rvectors,\n n_wann,\n Tvectors,\n Tdegens,\n header\n)\n\n\nWrite prefix_wsvec.dat.\n\nKeyword Arguments\n\nn_wann: for Wigner-Seitz Rvectors, needs to provide a n_wann for number of Wannier functions; for MDRS Rvectors, the n_wann is optional and can be automatically determined from the Tvectors\nTvectors and Tdegens: if provided, write in MDRS format; otherwise, write in Wigner-Seitz format\n\nAlso see the return values of read_w90_wsvec.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#Private-API","page":"Wannier90","title":"Private API","text":"","category":"section"},{"location":"api/w90/","page":"Wannier90","title":"Wannier90","text":"These are some lower-level types/functions that are (probably) less used, thus not exported. Of course, you can still use them by prefixing WannierIO., e.g., WannierIO.read_w90_band_dat(filename).","category":"page"},{"location":"api/w90/","page":"Wannier90","title":"Wannier90","text":"Modules = [WannierIO]\nPublic = false\nPages = map(file -> joinpath(\"w90\", file), readdir(\"../src/w90\"))","category":"page"},{"location":"api/w90/#WannierIO.default_band_kpt_kweights-Tuple{AbstractVector}","page":"Wannier90","title":"WannierIO.default_band_kpt_kweights","text":"default_band_kpt_kweights(kpoints)\n\n\nWannier90 default kweights in prefix_band.kpt is all 1.0.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.Chk","page":"Wannier90","title":"WannierIO.Chk","text":"Struct for storing matrices in prefix.chk file.\n\nstruct Chk{T<:Real}\n\nOne-to-one mapping to the wannier90 chk file, but renaming the variable names so that they are consistent with the rest of the code.\n\nFields\n\nheader: The header line, usually contains date and time\nn_bands: number of bands, can be auto set in constructor according to dimensions of other variables\nn_exclude_bands: number of excluded bands, can be auto set in constructor\nexclude_bands: Indices of excluded bands, starts from 1. Vector of integers, size: n_exclude_bands\nlattice: Matrix of size 3 x 3, each column is a lattice vector in Å unit\nrecip_lattice: Matrix of size 3 x 3, each column is a reciprocal lattice vector in Å⁻¹ unit\nn_kpts: number of kpoints, can be auto set in constructor\nkgrid: dimensions of kpoint grid, 3 integers\nkpoints: kpoint coordinates, fractional, length-n_kpts vector\nn_bvecs: number of b-vectors, can be auto set in constructor\nn_wann: number of Wannier functions, can be auto set in constructor\ncheckpoint: a string to indicate the current step (after disentanglement, after maximal localization, ...) in wannier90\nhave_disentangled: Have finished disentanglement or not\nΩI: Omega invariant part of MV spreads, in Ų unit\ndis_bands: Indices of bands taking part in disentanglement, not frozen bands! length-n_kpts vector, each element is a length-n_bands vector of bool.\nThis is needed since W90 puts all the disentanglement bands in the first several rows of Udis, (and the first few columns of Udis are the frozen bands) so directly multiplying eigenvalues e.g. (Udis * U)' * diag(eigenvalues) * (Udis * U) is wrong!\n\nn_dis: number of bands taking part in disentanglement at each kpoint. can be auto set in constructor from dis_bands\nUdis: Semi-unitary matrix for disentanglement, length-n_kpts vector, each elment has size: n_bands x n_wann, i.e., the u_matrix_opt in wannier90\nUml: Unitary matrix for maximal localization, length-n_kpts vector, each element has size: n_wann x n_wann, i.e., the u_matrix in wannier90. The abbreviation ml stands for maximal localization, so as to differentiate from the (combined) unitary matrix U = Udis * Uml.\nM: Wannier-gauge overlap matrix, length-n_kpts vector of length-n_bvecs vector, each element is a matrix of size n_wann x n_wann, i.e., the m_matrix in wannier90\nr: Wannier function centers, length-n_wann vector, Cartesian coordinates in Å unit, i.e., the wannier_centres variable in wannier90\nω: Wannier function spreads, length-n_wann vector, Ų unit, i.e., the wannier_spreads variable in wannier90\n\n\n\n\n\n","category":"type"},{"location":"api/w90/#WannierIO.Chk-Tuple{AbstractString, AbstractVector{Int64}, AbstractMatrix, AbstractMatrix, AbstractVector{<:Integer}, AbstractVector, AbstractString, Bool, Real, AbstractVector{BitVector}, Vararg{AbstractVector, 5}}","page":"Wannier90","title":"WannierIO.Chk","text":"Chk(\n header,\n exclude_bands,\n lattice,\n recip_lattice,\n kgrid,\n kpoints,\n checkpoint,\n have_disentangled,\n ΩI,\n dis_bands,\n Udis,\n Uml,\n M,\n r,\n ω\n)\n\n\nConvenience constructor of Chk struct that auto set some fields.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#Base.isapprox-Tuple{WannierIO.Chk, WannierIO.Chk}","page":"Wannier90","title":"Base.isapprox","text":"isapprox(a, b)\n\n\nCompare two Chk objects.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._check_eig_order-Tuple{AbstractVector}","page":"Wannier90","title":"WannierIO._check_eig_order","text":"_check_eig_order(eigenvalues; digits)\n\n\nCheck that eigenvalues are in order.\n\nSome times there are small noises, use digits to set the number of digits for comparisons.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._reshape_eig-Tuple{AbstractVector, AbstractVector, AbstractVector}","page":"Wannier90","title":"WannierIO._reshape_eig","text":"_reshape_eig(idx_b, idx_k, eig)\n\n\nReshape a vector of eigenvalues into a matrix of eigenvalues.\n\nAuto detect the number of bands and kpoints.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_HH_R-Union{Tuple{IT}, Tuple{T}, Tuple{AbstractString, AbstractArray{T, 3}, AbstractMatrix{IT}}} where {T<:Complex, IT<:Integer}","page":"Wannier90","title":"WannierIO.write_HH_R","text":"write_HH_R(filename, H, R; N, header)\n\n\nWrite the real space Hamiltonian to a prefix_HH_R.dat file.\n\nArguments\n\nfilename: usually prefix_HH_R.dat\nH: a n_wann * n_wann * n_rvecs array of Hamiltonian\nR: a n_rvecs * 3 array of integers\n\nKeyword arguments\n\nN: a n_rvecs vector of integers, the degeneracy of each R vector\nheader: a string, the header of the file\n\nnote: Note\nWanier90 postw90.x has a hidden input parameter effective_model, setting it to true and postw90.x will read this HH_R.dat to fill the real space Hamiltonian, and do subsequent Wannier interpolation, e.g., in BoltzWann. However, the vanila postw90.x code does not take into account the degeneracy of R vectors, and also does not use MDRS interpolation. I have modified the postw90.x code to use MDRS, and also changed a bit the number of digits for the Hamiltonian in HH_R.dat, so that it is the same as the prefix_tb.dat file, i.e., from Fortran F12.6 to E15.8.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._check_dimensions_M_kpb-Tuple{Any, Any, Any}","page":"Wannier90","title":"WannierIO._check_dimensions_M_kpb","text":"_check_dimensions_M_kpb(M, kpb_k, kpb_G)\n\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._check_dimensions_kpb-Tuple{Any, Any}","page":"Wannier90","title":"WannierIO._check_dimensions_kpb","text":"Check the dimensions between the quantities are consistent.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._check_dimensions_Sx_Sy_Sz-Tuple{Any, Any, Any}","page":"Wannier90","title":"WannierIO._check_dimensions_Sx_Sy_Sz","text":"_check_dimensions_Sx_Sy_Sz(Sx, Sy, Sz)\n\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.read_u_mat-Tuple{AbstractString}","page":"Wannier90","title":"WannierIO.read_u_mat","text":"read_u_mat(filename)\n\nRead wannier90 prefix_u.mat or prefix_u_dis.mat file.\n\nArguments\n\nfilename: the input file name\n\nReturn\n\nU: Udis (for disentanglement) or U (for maximal localization) matrices\nkpoints: fractional kpoint coordinates\nheader: 1st line of the file\n\nwarning: Warning\nThe wannier90 output prefix_u_dis.mat internally sorts the band indices according to the disnentanglement window, therefore it can be different from the original Bloch states, see the code and comments in get_Udis.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.write_u_mat-Tuple{AbstractString, AbstractVector, AbstractVector}","page":"Wannier90","title":"WannierIO.write_u_mat","text":"write_u_mat(filename, U, kpoints; header=default_header())\n\nWrite wannier90 prefix_u.mat or prefix_u_dis.mat file.\n\nArguments\n\nfilename: the input file name\nU: Udis (for disentanglement) or U (for maximal localization) matrices\nkpoints: fractional kpoint coordinates\n\nKeyword arguments\n\nheader: 1st line of the file, optional\n\nwarning: Warning\nThe wannier90 output prefix_u_dis.mat internally sorts the band indices according to the disnentanglement window, therefore it can be different from the original Bloch states, see the code and comments in get_Udis. This function just writes whatever is inside the input U matrix, without consider the order of disentanglement window.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._check_win_required_params-Tuple{Any}","page":"Wannier90","title":"WannierIO._check_win_required_params","text":"_check_win_required_params(kwargs)\n\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO.fix_win!-Tuple{Dict}","page":"Wannier90","title":"WannierIO.fix_win!","text":"fix_win!(params)\n\n\nSanity check and add missing input parameters from a win file.\n\nSee also read_win.\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._parse_wout_atoms-Tuple{Any}","page":"Wannier90","title":"WannierIO._parse_wout_atoms","text":"Parse block\n\n| Site Fractional Coordinate Cartesian Coordinate (Ang) |\n+----------------------------------------------------------------------------+\n| Si 1 0.00000 0.00000 0.00000 | 0.00000 0.00000 0.00000 |\n| Si 2 0.25000 0.25000 0.25000 | 1.35763 1.35763 1.35763 |\n*----------------------------------------------------------------------------*\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._parse_wout_disentangle-Tuple{Any}","page":"Wannier90","title":"WannierIO._parse_wout_disentangle","text":"Parse block\n\n Extraction of optimally-connected subspace\n ------------------------------------------\n+---------------------------------------------------------------------+<-- DIS\n| Iter Omega_I(i-1) Omega_I(i) Delta (frac.) Time |<-- DIS\n+---------------------------------------------------------------------+<-- DIS\n 1 25.38943399 21.32896063 1.904E-01 0.00 <-- DIS\n 2 21.53095611 20.16097533 6.795E-02 0.01 <-- DIS\n 3 20.40788223 19.35260423 5.453E-02 0.01 <-- DIS\n 4 19.53883989 18.75563591 4.176E-02 0.02 <-- DIS\n...\n 341 16.22884440 16.22884440 -1.883E-10 2.43 <-- DIS\n 342 16.22884440 16.22884440 -1.799E-10 2.44 <-- DIS\n\n <<< Delta < 2.000E-10 over 3 iterations >>>\n <<< Disentanglement convergence criteria satisfied >>>\n\n Final Omega_I 16.22884440 (Ang^2)\n\n+----------------------------------------------------------------------------+\n\nTime to disentangle bands 2.546 (sec)\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._parse_wout_lattice-Tuple{Any}","page":"Wannier90","title":"WannierIO._parse_wout_lattice","text":"Parse block\n\nLattice Vectors (Ang)\na_1 0.000000 2.715265 2.715265\na_2 2.715265 0.000000 2.715265\na_3 2.715265 2.715265 0.000000\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._parse_wout_recip_lattice-Tuple{Any}","page":"Wannier90","title":"WannierIO._parse_wout_recip_lattice","text":"Parse block\n\nReciprocal-Space Vectors (Ang^-1)\nb_1 -1.157011 1.157011 1.157011\nb_2 1.157011 -1.157011 1.157011\nb_3 1.157011 1.157011 -1.157011\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._parse_wout_wannierize-Tuple{Any}","page":"Wannier90","title":"WannierIO._parse_wout_wannierize","text":"Parse block\n\n*------------------------------- WANNIERISE ---------------------------------*\n+--------------------------------------------------------------------+<-- CONV\n| Iter Delta Spread RMS Gradient Spread (Ang^2) Time |<-- CONV\n+--------------------------------------------------------------------+<-- CONV\n\n------------------------------------------------------------------------------\nInitial State\n WF centre and spread 1 ( -0.000005, 0.000021, 0.000023 ) 2.56218734\n WF centre and spread 2 ( 0.000013, -0.000054, 0.000016 ) 3.19493515\n WF centre and spread 3 ( -0.000005, -0.000054, -0.000055 ) 3.19482997\n WF centre and spread 4 ( 0.000012, 0.000015, -0.000058 ) 3.19526437\n WF centre and spread 5 ( 1.357637, 1.357611, 1.357610 ) 2.56218214\n WF centre and spread 6 ( 1.357619, 1.357684, 1.357617 ) 3.19532825\n WF centre and spread 7 ( 1.357638, 1.357687, 1.357686 ) 3.19513205\n WF centre and spread 8 ( 1.357620, 1.357617, 1.357694 ) 3.19460833\n Sum of centres and spreads ( 5.430528, 5.430529, 5.430534 ) 24.29446759\n\n 0 0.243E+02 0.0000000000 24.2944680346 2.48 <-- CONV\n O_D= 0.2135529 O_OD= 7.8520707 O_TOT= 24.2944680 <-- SPRD\n------------------------------------------------------------------------------\nCycle: 1\n WF centre and spread 1 ( -0.000005, 0.000020, 0.000022 ) 2.46316318\n WF centre and spread 2 ( 0.000014, -0.000057, 0.000015 ) 3.19187236\n WF centre and spread 3 ( -0.000005, -0.000057, -0.000058 ) 3.19179103\n WF centre and spread 4 ( 0.000012, 0.000014, -0.000061 ) 3.19222621\n WF centre and spread 5 ( 1.357637, 1.357612, 1.357611 ) 2.46315800\n WF centre and spread 6 ( 1.357618, 1.357687, 1.357618 ) 3.19226713\n WF centre and spread 7 ( 1.357637, 1.357690, 1.357689 ) 3.19209166\n WF centre and spread 8 ( 1.357619, 1.357619, 1.357697 ) 3.19156919\n Sum of centres and spreads ( 5.430528, 5.430529, 5.430534 ) 24.07813875\n\n 1 -0.216E+00 0.2558717278 24.0781391952 2.49 <-- CONV\n O_D= 0.2218113 O_OD= 7.6274835 O_TOT= 24.0781392 <-- SPRD\nDelta: O_D= 0.8258326E-02 O_OD= -0.2245872E+00 O_TOT= -0.2163288E+00 <-- DLTA\n------------------------------------------------------------------------------\nCycle: 2\n...\n------------------------------------------------------------------------------\nCycle: 45\nWF centre and spread 1 ( 0.000001, 0.000006, 0.000006 ) 1.95373328\nWF centre and spread 2 ( 0.000016, -0.000065, 0.000019 ) 3.27910139\nWF centre and spread 3 ( -0.000008, -0.000065, -0.000066 ) 3.27921479\nWF centre and spread 4 ( 0.000014, 0.000016, -0.000070 ) 3.27965818\nWF centre and spread 5 ( 1.357631, 1.357627, 1.357627 ) 1.95372427\nWF centre and spread 6 ( 1.357616, 1.357695, 1.357615 ) 3.27949625\nWF centre and spread 7 ( 1.357641, 1.357699, 1.357697 ) 3.27951005\nWF centre and spread 8 ( 1.357617, 1.357616, 1.357707 ) 3.27899768\nSum of centres and spreads ( 5.430528, 5.430529, 5.430534 ) 23.58343588\n\n 45 -0.186E-09 0.0000077396 23.5834363262 2.88 <-- CONV\n O_D= 0.2612087 O_OD= 7.0933833 O_TOT= 23.5834363 <-- SPRD\nDelta: O_D= 0.2557594E-06 O_OD= -0.2559458E-06 O_TOT= -0.1863789E-09 <-- DLTA\n------------------------------------------------------------------------------\n\n <<< Delta < 2.000E-10 over 3 iterations >>>\n <<< Wannierisation convergence criteria satisfied >>>\n\n\n\n\n\n","category":"method"},{"location":"api/w90/#WannierIO._parse_wout_wf_center_spread-Tuple{Any}","page":"Wannier90","title":"WannierIO._parse_wout_wf_center_spread","text":"Parse block\n\nWF centre and spread 1 ( -0.000005, 0.000021, 0.000023 ) 2.56218734\nWF centre and spread 2 ( 0.000013, -0.000054, 0.000016 ) 3.19493515\nWF centre and spread 3 ( -0.000005, -0.000054, -0.000055 ) 3.19482997\nWF centre and spread 4 ( 0.000012, 0.000015, -0.000058 ) 3.19526437\nWF centre and spread 5 ( 1.357637, 1.357611, 1.357610 ) 2.56218214\nWF centre and spread 6 ( 1.357619, 1.357684, 1.357617 ) 3.19532825\nWF centre and spread 7 ( 1.357638, 1.357687, 1.357686 ) 3.19513205\nWF centre and spread 8 ( 1.357620, 1.357617, 1.357694 ) 3.19460833\nSum of centres and spreads ( 5.430528, 5.430529, 5.430534 ) 24.29446759\n\n\n\n\n\n","category":"method"},{"location":"api/#Index-of-all-functions-and-types","page":"Index","title":"Index of all functions and types","text":"","category":"section"},{"location":"api/","page":"Index","title":"Index","text":"Modules = [WannierIO]","category":"page"},{"location":"api/util/#Utility","page":"Utilities","title":"Utility","text":"","category":"section"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"Some simple convenience functions for development.","category":"page"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"CurrentModule = WannierIO","category":"page"},{"location":"api/util/#Fortran-related","page":"Utilities","title":"Fortran related","text":"","category":"section"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"Modules = [WannierIO]\nPages = [\"util/fortran.jl\"]","category":"page"},{"location":"api/util/#WannierIO.isbinary-Tuple{AbstractString}","page":"Utilities","title":"WannierIO.isbinary","text":"isbinary(filename)\n\n\nCheck if the file is in binary format.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.isbinary-Tuple{AbstractVector{UInt8}}","page":"Utilities","title":"WannierIO.isbinary","text":"isbinary(chars)\n\n\nCheck if a sequence of chars is binary.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#Lattice","page":"Utilities","title":"Lattice","text":"","category":"section"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"Modules = [WannierIO]\nPages = [\"util/lattice.jl\"]","category":"page"},{"location":"api/util/#WannierIO.get_lattice-Tuple{StaticArraysCore.SMatrix{3, 3, T, 9} where T}","page":"Utilities","title":"WannierIO.get_lattice","text":"get_lattice(recip_lattice)\n\n\nCompute lattice from reciprocal lattice.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.get_recip_lattice-Tuple{StaticArraysCore.SMatrix{3, 3, T, 9} where T}","page":"Utilities","title":"WannierIO.get_recip_lattice","text":"get_recip_lattice(lattice)\n\n\nCompute reciprocal lattice from lattice.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#Types","page":"Utilities","title":"Types","text":"","category":"section"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"Modules = [WannierIO]\nPages = [\"common/type.jl\"]","category":"page"},{"location":"api/util/#WannierIO.FortranBinary","page":"Utilities","title":"WannierIO.FortranBinary","text":"Fortran unformatted IO.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.FortranBinaryStream","page":"Utilities","title":"WannierIO.FortranBinaryStream","text":"Fortran unformatted IO with stream access.\n\nFor example, file written using these Fortran code:\n\nOPEN(UNIT=11, FILE=\"ustream.demo\", STATUS=\"NEW\", ACCESS=\"STREAM\", FORM=\"UNFORMATTED\")\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.FortranText","page":"Utilities","title":"WannierIO.FortranText","text":"Fortran formatted IO.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.Mat3","page":"Utilities","title":"WannierIO.Mat3","text":"3 x 3 matrix type.\n\nFor lattice and recip_lattice.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.Mat3-Tuple{AbstractVector}","page":"Utilities","title":"WannierIO.Mat3","text":"Vector{Vector} -> Mat3\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.SymbolVec3","page":"Utilities","title":"WannierIO.SymbolVec3","text":"Pair type associating a Symbol with a Vec3.\n\nFor win file atoms_frac and kpoint_path.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.Vec3","page":"Utilities","title":"WannierIO.Vec3","text":"Length-3 vector type.\n\nFor atom posistions, kpoints, etc.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.Vec3-Tuple{StaticArraysCore.SMatrix{3, 3, T, 9} where T}","page":"Utilities","title":"WannierIO.Vec3","text":"Mat3 -> Vec3{Vec3}\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.Wannier90Text","page":"Utilities","title":"WannierIO.Wannier90Text","text":"Plain text format for Wannier90 win and nnkp files.\n\nThe W90 default win or nnkp are plain text files but are not simple arrays of numbers that can be read by readdlm, therefore this struct is used to indicate that the file is plain text but need to be handled by corresponding functions, e.g., read_win, read_nnkp, etc.\n\nThis somewhat overlaps with FortranText, but this one is only used for small input parameter files e.g. win and nnkp (in comparison with the Wannier90Toml format), while the FortranText (in comparison with the FortranBinary format) is used for large matrices e.g. amn, mmn, eig, etc.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#WannierIO.Wannier90Toml","page":"Utilities","title":"WannierIO.Wannier90Toml","text":"TOML file format for Wannier90 win and nnkp files.\n\nHere we introduce a TOML format for win and nnkp, so that once the win or nnkp files are converted into TOML, the TOML files can be loaded by standard TOML parsers without the headache of writing custom parsers in other Julia packages.\n\nSee also write_win, write_nnkp, etc.\n\n\n\n\n\n","category":"type"},{"location":"api/util/#Constants","page":"Utilities","title":"Constants","text":"","category":"section"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"Modules = [WannierIO]\nPages = [\"common/const.jl\"]","category":"page"},{"location":"api/util/#WannierIO.Bohr","page":"Utilities","title":"WannierIO.Bohr","text":"Bohr radius in Angstrom unit.\n\nThis is the default CODATA2006 value in W90 src/constants.F90.\n\n\n\n\n\n","category":"constant"},{"location":"api/util/#WannierIO.Bohr_QE","page":"Utilities","title":"WannierIO.Bohr_QE","text":"Bohr radius in Angstrom unit.\n\nThis is the default (Physical constants, SI (NIST 2018)) value in QE Modules/constants.f90.\n\n\n\n\n\n","category":"constant"},{"location":"api/util/#Misc","page":"Utilities","title":"Misc","text":"","category":"section"},{"location":"api/util/","page":"Utilities","title":"Utilities","text":"Modules = [WannierIO]\nPages = [\"util/header.jl\", \"util/toml.jl\", \"util/parser.jl\", \"util/compare.jl\", \"WannierIO.jl\"]","category":"page"},{"location":"api/util/#WannierIO.default_header-Tuple{}","page":"Utilities","title":"WannierIO.default_header","text":"Default header for writing wannier90 files.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.write_toml-Tuple{Any}","page":"Utilities","title":"WannierIO.write_toml","text":"write_toml(io; kwargs...)\n\n\nWrite kwargs into io as a TOML file.\n\nDo some type conversion before writing.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.parse_bool-Tuple{AbstractString}","page":"Utilities","title":"WannierIO.parse_bool","text":"parse_bool(s)\n\n\nParse a string as bool.\n\nThis is capable of parsing Fortran outputs, e.g., .true., .false., true, T.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.parse_bool-Tuple{Integer}","page":"Utilities","title":"WannierIO.parse_bool","text":"parse_bool(i)\n\n\nParse an integer as bool.\n\n0: false\n1 or -1: true\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.parse_float-Tuple{AbstractString}","page":"Utilities","title":"WannierIO.parse_float","text":"parse_float(s)\n\n\nParse a string as Float64.\n\nThe is capable of parsing Fortran outputs, e.g. 1.0D-10, to the ordinary 1e-10.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.parse_indices-Tuple{AbstractString}","page":"Utilities","title":"WannierIO.parse_indices","text":"parse_indices(str)\n\n\nParse a string of comma-separated indices or range into a vector of integers.\n\nE.g., the exclude_bands tag of win file.\n\nExamples\n\njulia> parse_indices(\"1-2, 5,8 -10\")\n6-element Vector{Int64}:\n 1\n 2\n 5\n 8\n 9\n 10\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.parse_vector-Tuple{IO, Type, Integer}","page":"Utilities","title":"WannierIO.parse_vector","text":"parse_vector(io, T, n_elements)\n\n\nParse a vector of n_elements elements of type T from io.\n\nArguments\n\nio: input stream\nT: type of elements\nn_elements::Int: total number of elements\n\nExamples\n\nSuppose a file demo.txt has the following content:\n\n1 2 3 4 5 6 7 8 9 10\n11 12 13 14 15 16 17 18 19 20\n21 22 23\n\nThen the following code parses the file and return a vector filled with 1 to 23:\n\njulia> vector = open(\"demo.txt\") do io\n parse_vector(io, Int, 23)\nend\n\nThe number of elements in each line can be different.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO._isapprox-Union{Tuple{T}, Tuple{T, T}} where T","page":"Utilities","title":"WannierIO._isapprox","text":"_isapprox(a, b)\n\n\nCompare two (same-type) structs.\n\n\n\n\n\n","category":"method"},{"location":"api/util/#WannierIO.WannierIO","page":"Utilities","title":"WannierIO.WannierIO","text":"WannierIO.jl: a package for reading and writing Wannier90 file formats.\n\n\n\nWannierIO.jl\n\n(Image: Stable) (Image: Dev) (Image: CI) (Image: codecov)\n\nA Julia package for reading/writing Wannier90 file formats.\n\nThe package is designed to be minimalistic to allow easy reuse in other packages.\n\nQuick examples\n\nusing WannierIO\n\nA = read_amn(\"silicon.amn\")\nwrite_amn(\"silicon_2.amn\", A)\n\nchk = read_chk(\"silicon.chk\")\nwrite_chk(\"silicon_2.chk\", chk; binary=true)\n\nRelated packages\n\nWannier.jl: Wannierization and Wannier interpolation. The IO part of Wannier.jl was isolated and moved into this package.\n\n\n\nExported functions:\n\nget_U\nget_Udis\nread_amn\nread_bxsf\nread_chk\nread_cube\nread_eig\nread_mmn\nread_nnkp\nread_spn\nread_uHu\nread_unk\nread_w90_band\nread_w90_band_dat\nread_w90_band_kpt\nread_w90_band_labelinfo\nread_w90_hrdat\nread_w90_rdat\nread_w90_tbdat\nread_w90_wsvec\nread_win\nread_wout\nread_xsf\nwrite_amn\nwrite_bxsf\nwrite_chk\nwrite_cube\nwrite_eig\nwrite_mmn\nwrite_nnkp\nwrite_spn\nwrite_uHu\nwrite_unk\nwrite_w90_band\nwrite_w90_band_dat\nwrite_w90_band_kpt\nwrite_w90_band_labelinfo\nwrite_w90_hrdat\nwrite_w90_tbdat\nwrite_w90_wsvec\nwrite_win\nwrite_xsf\n\n\n\n\n\n","category":"module"},{"location":"api/convention/#Conventions","page":"Convention","title":"Conventions","text":"","category":"section"},{"location":"api/convention/#Units","page":"Convention","title":"Units","text":"","category":"section"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"In most cases, the units of the function arguments and returned values are in angstrom for lattice, and fractional (w.r.t. lattice) for atomic positions, etc.","category":"page"},{"location":"api/convention/#Variables","page":"Convention","title":"Variables","text":"","category":"section"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Here are some variable conventions used throughout the code and documentation.","category":"page"},{"location":"api/convention/#Names","page":"Convention","title":"Names","text":"","category":"section"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"U: unitary transformation matrices\nA: to differentiate between U, some times we use A specifically for the initial projection matrix, i.e., amn of Wannier90\nM: overlap matrices between neighboring kpoints, i.e., mmn of Wannier90","category":"page"},{"location":"api/convention/#Dimensions","page":"Convention","title":"Dimensions","text":"","category":"section"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Prefixed by n_, indicating this is an integer specifying the length of some quantities; then followed by a short acronym of the quantity, to avoid typing long names repeatedly.","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"n_bands: number of bands\nn_wann: number of WFs\nn_kpts: number of kpoints\nn_bvecs: number of b-vectors\nn_atoms: number of atoms","category":"page"},{"location":"api/convention/#Indices","page":"Convention","title":"Indices","text":"","category":"section"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Usually, the returned quantities are Vectors of some types (Matrix{Float64}, Vector{Float64}, etc), and the indices follow the order of","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"kpoints\nb-vectors (if needed)\nbands\nWannier functions","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"For instance, the energy eigenvalues eigenvalues is a length-n_kpts vector, with each element a length-n_bands vector of floats, i.e., eigenvalues[ik][ib] is the ib-th eigenvalue at ik-th kpoint.","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Here are some examples of indexing the vectors:","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"eigenvalues[ik][m] for energy eigenvalues varepsilon_m mathbfk\nU[ik][m, n] for the gauge matrix U_mn mathbfk\nM[ik][ib][m, n] for the overlap matrix M_mn mathbfk mathbfk + mathbfb","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"where","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"ik: index of kpoints\nib: index of b-vectors\nm: index of bands\nn: index of Wannier functions","category":"page"},{"location":"api/convention/#Functions","page":"Convention","title":"Functions","text":"","category":"section"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"In most cases, there are some multiple dispatches for the same function. For instance, there are three functions for reading the chk file:","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"read_chk(filename::AbstractString)\nread_chk(filename::AbstractString, ::FortranText)\nread_chk(filename::AbstractString, ::FortranBinary)","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Why do we need several functions for reading the same format? The reasons are:","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Wannier90 is a Fortran code that accepts both Fortran text format and binary format (or called Fortran formatted and unformatted file, respectively). To avoid introducing lots of different function names for reading text or binary files, we use multiple dispatch to distinguish them: the type of the 2nd argument (FortranText or FortranBinary) is used to distinguish the file type we want to read.\nHowever, asking the user to manually specify the file format is tedious, therefore, we provide a high-level user-friendly function (the 1st one), which\nautomatically detects the file format and calls the corresponding low-level (2nd or 3rd) function\nprints some information of key quantities of the file, e.g., number of kpoints, number of Wannier functions, etc., to give user a hint of what have been parsed\nhides some irrelevant return values, e.g., the header (the 1st line) of the file, since it has been printed in the stdout\nThe low-level functions parse everything in the file, while the high-level function aims at user ergonomics.","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Thus,","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"In most cases using the high-level function is enough, e.g.,\njulia> using WannierIO\njulia> A = read_amn(\"si2.amn\")\n┌ Info: Reading amn file\n│ filename = \"si2.amn\"\n│ header = \"Created on 9Sep2022 at 16:41: 5\"\n│ n_kpts = 8\n│ n_bands = 4\n└ n_wann = 4\n8-element Vector{Matrix{ComplexF64}}:\n [...]\nUse the low-level functions if you\nwant to get the header of the file (or quantities not returned by high-level function)\ndo not want stdout to be \"polluted\"\njulia> using WannierIO\njulia> A, header = read_amn(\"si2.amn\", WannierIO.FortranText())\njulia> typeof(A)\nVector{Matrix{ComplexF64}} (alias for Array{Array{Complex{Float64}, 2}, 1})\njulia> header\n\"Created on 9Sep2022 at 16:41: 5\"","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Note that usually the high-level function directly returns the quantities, e.g., a single A to avoid the user unpacking return values; however, often the low-level functions return a NamedTuple of all the quantities, for the sake of clarity.","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"julia> amn = read_amn(\"si2.amn\", WannierIO.FortranText())\njulia> typeof(amn)\nNamedTuple{(:A, :header), Tuple{Vector{Matrix{ComplexF64}}, SubString{String}}}","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"Of course, when using low-level functions you can also directly access the quantity without unpacking by","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"julia> A = read_amn(\"si2.amn\", WannierIO.FortranText()).A","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"When writing files, the user can specify whether to write in text or binary by a keyword argument binary of the high-level function","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"julia> write_amn(\"si2.amn\", A; binary=true)","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"The binary keyword argument avoids the user specifying the file type when calling the low-level functions, e.g.,","category":"page"},{"location":"api/convention/","page":"Convention","title":"Convention","text":"julia> write_amn(\"si2.amn\", A, WannierIO.FortranBinaryStream())","category":"page"},{"location":"api/qe/#Quantum-ESPRESSO-files","page":"Quantum ESPRESSO","title":"Quantum ESPRESSO files","text":"","category":"section"},{"location":"api/qe/","page":"Quantum ESPRESSO","title":"Quantum ESPRESSO","text":"CurrentModule = WannierIO","category":"page"},{"location":"api/qe/","page":"Quantum ESPRESSO","title":"Quantum ESPRESSO","text":"Modules = [WannierIO]\nPages = [\n \"qe/band.jl\",\n \"qe/xml.jl\",\n]","category":"page"},{"location":"api/qe/#WannierIO.guess_kpath-Tuple{AbstractVector{<:AbstractVector}}","page":"Quantum ESPRESSO","title":"WannierIO.guess_kpath","text":"guess_kpath(kpoints; atol)\n\n\nGuess high symmetry points from kpoint coordinates.\n\nIf there is angle between two consecutive kpoints, then it is labeled as a high-symmetry point.\n\nArguments\n\nkpoints: Vector of Vector or Vec3, in Cartesian coordinates\n\nKeyword Arguments\n\natol: Absolute tolerance for checking cross product of two vectors\n\nReturns\n\nsymm_point_indices: Vector of indices of high-symmetry points\nsymm_point_labels: Vector of labels of high-symmetry points, for the moment it is empty\n\n\n\n\n\n","category":"method"},{"location":"api/qe/#WannierIO.read_qe_band-Tuple{AbstractString}","page":"Quantum ESPRESSO","title":"WannierIO.read_qe_band","text":"read_qe_band(filename)\n\n\nRead Quantum ESPRESSO bands.x output data file.\n\nThe data file has format\n\n &plot nbnd= 20, nks= 380 /\n -0.500000 0.500000 0.500000\n -3.320 -0.666 5.173 5.173 7.994 9.725 9.725 14.147 16.993 16.993\n 17.841 17.841 17.902 19.666 25.961 26.563 28.186 28.186 28.368 28.368\n -0.495000 0.495000 0.495000\n -3.322 -0.664 5.173 5.173 7.994 9.725 9.725 14.148 16.980 16.980\n...\n\n\n\n\n\n","category":"method"},{"location":"api/qe/#WannierIO.read_qe_xml-Tuple{AbstractString}","page":"Quantum ESPRESSO","title":"WannierIO.read_qe_xml","text":"read_qe_xml(filename)\n\n\nRead atomic structure and band structure from QE's XML output.\n\nReturn\n\nlattice: 3 * 3, Å, each column is a lattice vector\natom_positions: length-n_atoms vector, each element is a fractional position\natom_labels: length-n_atoms vector, each element is the label of the corresponding atom\nrecip_lattice: 3 * 3, Å⁻¹, each column is a reciprocal lattice vector\nkpoints: length-n_kpts vector, each element is a fractional kpoint\nfermi_energy: eV\nalat: the alat of QE in Å\neigenvalues: length-n_kpts vector, each element is a length-n_bands vector of eigenvalue in eV. For spin-polarized but without SOC calculations, return two arries of eigenvalues_up and eigenvalues_dn for the two spin channels.\n\n\n\n\n\n","category":"method"},{"location":"#WannierIO.jl","page":"Home","title":"WannierIO.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"A Julia package for reading/writing Wannier90 files.","category":"page"},{"location":"","page":"Home","title":"Home","text":"The package is designed to be minimalistic to allow easy reuse in other packages.","category":"page"},{"location":"","page":"Home","title":"Home","text":"This package originates from the IO part of the Wannier.jl package.","category":"page"},{"location":"#Wannier90-files","page":"Home","title":"Wannier90 files","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Input files:","category":"page"},{"location":"","page":"Home","title":"Home","text":"amn\nmmn\neig\nchk\nUNK\nspn","category":"page"},{"location":"","page":"Home","title":"Home","text":"Also support parsing both plain text and binary formats (in Fortran language, called formatted and unformatted IO, respectively) for some files, e.g., chk and UNK.","category":"page"},{"location":"","page":"Home","title":"Home","text":"Output files:","category":"page"},{"location":"","page":"Home","title":"Home","text":"*_band.dat\n*_tb.dat\n*_wsvec.dat\n*_hr.dat\n*_r.dat\nxsf\ncube\n...","category":"page"},{"location":"#Quantum-ESPRESSO-files","page":"Home","title":"Quantum ESPRESSO files","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"To support comparing Wannier-interpolated band structures with density function theory (DFT) bands, there are also some functions to parse Quantum ESPRESSO (QE) output files:","category":"page"},{"location":"","page":"Home","title":"Home","text":"xml\nbands.dat generated by QE bands.x","category":"page"},{"location":"api/volumetric/#Volumetric-data-files","page":"Volumetric data","title":"Volumetric data files","text":"","category":"section"},{"location":"api/volumetric/","page":"Volumetric data","title":"Volumetric data","text":"CurrentModule = WannierIO","category":"page"},{"location":"api/volumetric/#Read/write","page":"Volumetric data","title":"Read/write","text":"","category":"section"},{"location":"api/volumetric/","page":"Volumetric data","title":"Volumetric data","text":"Modules = [WannierIO]\nPages = [\n \"volume/xsf.jl\",\n \"volume/bxsf.jl\",\n \"volume/cube.jl\",\n]","category":"page"},{"location":"api/volumetric/#WannierIO.read_xsf-Tuple{AbstractString}","page":"Volumetric data","title":"WannierIO.read_xsf","text":"read_xsf(filename)\n\n\nRead xsf file.\n\nReturn\n\nprimvec: 3 * 3, Å, each column is a primitive lattice vector\nconvvec: 3 * 3, Å, each column is a conventional lattice vector\natoms: n_atoms String, atomic symbols or numbers\natom_positions: length-n_atoms vector, Å, cartesian coordinates\norigin: 3, Å, origin of the grid\nspan_vectors: 3 * 3, Å, each column is a spanning vector\nX: nx, fractional coordinate of grid points along the first spanning vector\nY: ny, fractional coordinate of grid points along the second spanning vector\nZ: nz, fractional coordinate of grid points along the third spanning vector\nW: nx * ny * nz, volumetric data\n\nnote: Note\nOnly support reading 1 datagrid in BLOCK_DATAGRID_3D.\n\n\n\n\n\n","category":"method"},{"location":"api/volumetric/#WannierIO.write_xsf-Union{Tuple{T}, Tuple{AbstractString, AbstractMatrix{T}, Array{StaticArraysCore.SVector{3, T}, 1}, AbstractVector{Int64}, AbstractVector{T}, AbstractMatrix{T}, AbstractArray{T, 3}}} where T<:Real","page":"Volumetric data","title":"WannierIO.write_xsf","text":"write_xsf(\n filename,\n lattice,\n atom_positions,\n atom_numbers,\n origin,\n span_vectors,\n W\n)\n\n\nWrite xsf file.\n\nArguments\n\nlattice: 3 * 3, Å, each column is a lattice vector\natom_positions: length-n_atoms vector, fractional coordinates\natom_numbers: n_atoms, atomic numbers\norigin: 3, Å, origin of the grid\nspan_vectors: 3 * 3, Å, each column is a spanning vector\nW: nx * ny * nz, volumetric data\n\n\n\n\n\n","category":"method"},{"location":"api/volumetric/#WannierIO.read_bxsf-Tuple{AbstractString}","page":"Volumetric data","title":"WannierIO.read_bxsf","text":"read_bxsf(filename)\n\n\nRead bxsf file.\n\nReturn\n\nfermi_energy: Fermi energy in eV\norigin: 3, Å⁻¹, origin of the grid\nspan_vectors: 3 * 3, Å⁻¹, each column is a spanning vector\nX: nx, fractional coordinate of grid points along the first spanning vector\nY: ny, fractional coordinate of grid points along the second spanning vector\nZ: nz, fractional coordinate of grid points along the third spanning vector\nE: n_bands * nx * ny * nz, eigenvalues at each grid point\n\n\n\n\n\n","category":"method"},{"location":"api/volumetric/#WannierIO.write_bxsf-Union{Tuple{T}, Tuple{AbstractString, T, AbstractVector{T}, AbstractMatrix{T}, AbstractArray{T, 4}}} where T<:Real","page":"Volumetric data","title":"WannierIO.write_bxsf","text":"write_bxsf(filename, fermi_energy, origin, span_vectors, E)\n\n\nWrite bxsf file.\n\nArguments\n\nfermi_energy: Fermi energy in eV\norigin: 3, Å⁻¹, origin of the grid\nspan_vectors: 3 * 3, Å⁻¹, each column is a spanning vector\nE: n_bands * nx * ny * nz, eigenvalues at each grid point\n\n\n\n\n\n","category":"method"},{"location":"api/volumetric/#WannierIO.read_cube-Tuple{AbstractString}","page":"Volumetric data","title":"WannierIO.read_cube","text":"read_cube(filename)\n\n\nRead cube file.\n\nnote: Note\nBy default, cube use Bohr unit, here all returns are in Cartesian coordinates, Å unit.\n\n\n\n\n\n","category":"method"},{"location":"api/volumetric/#WannierIO.write_cube-Union{Tuple{T}, Tuple{AbstractString, AbstractMatrix{T}, AbstractVector{Int64}, AbstractVector{T}, AbstractMatrix{T}, AbstractArray{T, 3}}} where T<:Real","page":"Volumetric data","title":"WannierIO.write_cube","text":"write_cube(\n filename,\n atom_positions,\n atom_numbers,\n origin,\n voxel_vectors,\n W\n)\n\n\nWrite cube file.\n\nArguments\n\natom_positions: 3 * n_atoms, Å, cartesian coordinates\natom_numbers: n_atoms, atomic numbers\norigin: 3, Å, origin of the grid\nvoxel_vectors: 3 * 3, Å, each column is a voxel vector\nW: nx * ny * nz, volumetric data\n\n\n\n\n\n","category":"method"},{"location":"api/epw/#EPW-files","page":"EPW","title":"EPW files","text":"","category":"section"},{"location":"api/epw/","page":"EPW","title":"EPW","text":"CurrentModule = WannierIO","category":"page"},{"location":"api/epw/","page":"EPW","title":"EPW","text":"Modules = [WannierIO]\nPages = [\n \"misc/epw.jl\",\n]","category":"page"},{"location":"api/epw/#WannierIO.Ukk","page":"EPW","title":"WannierIO.Ukk","text":"Struct for the EPW .ukk file.\n\nSimilar to the W90 .chk file.\n\nstruct Ukk{T<:Real}\n\nFields\n\nibndstart: index of the first band\nibndend: index of the last band\nn_kpts: number of kpoints\nn_bands: number of bands\nn_wann: number of wannier functions\nU: gauge matrices, length-n_kpts vector, each element is a n_bands * n_wann matrix\nfrozen_bands: flag for frozen bands, length-n_kpts vector, each element is a length-n_bands vector\nexcluded_bands: flag for excluded bands, length-n_bands + n_excl_bands vector, where n_excl_bands is the number of excluded bands\ncenters: centers of WFs, length-n_wann vector of Vec3. Note that EPW uses Cartesian coordinates w.r.t the QE alat, so it is dimensionless.\n\n\n\n\n\n","category":"type"},{"location":"api/epw/#WannierIO.Ukk-Tuple{WannierIO.Chk, Real}","page":"EPW","title":"WannierIO.Ukk","text":"Ukk(chk, alat)\n\n\nConstruct a EPW Ukk from a W90 Chk.\n\nArguments\n\nchk: the Chk struct\nalat: the QE alat in Å unit. Note that the alat from QE stdout file is in Bohr unit, you need to do the conversion by multiplying it with Bohr_QE.\n\nExamples\n\nConvert a W90 .chk file to a EPW .ukk file:\n\nusing WannierIO\nchk = read_chk(\"BN.chk\")\n# Note we need QE `alat` for ukk. You can get it\n# - either by inspecting the QE stdout file, from line like\n# lattice parameter (alat) = 6.8330 a.u.\n# where the 6.8330 is the alat in Bohr unit. However, the Bohr constant\n# in W90 and QE are slightly different, to be exact we need to do the unit\n# conversion using QE constant:\nalat = 6.8330 * WannierIO.Bohr_QE\n# - or better by parsing the QE xml file, and the unit conversion is done automatically\nalat = read_qe_xml(\"BN.xml\").alat\nukk = Ukk(chk, alat)\nWannierIO.write_epw_ukk(\"BN.ukk\", ukk)\n\n\n\n\n\n","category":"method"},{"location":"api/epw/#Base.isapprox-Tuple{WannierIO.Ukk, WannierIO.Ukk}","page":"EPW","title":"Base.isapprox","text":"isapprox(a, b)\n\n\nCompare two Ukk structs.\n\n\n\n\n\n","category":"method"},{"location":"api/epw/#WannierIO.read_epw_mmn-Tuple{AbstractString}","page":"EPW","title":"WannierIO.read_epw_mmn","text":"read_epw_mmn(filename; n_kpts, n_bvecs, n_bands)\n\n\nRead the EPW mmn file.\n\nThe EPW mmn format is different from that of W90. It does not contain the number of kpoints/bvectors/bands, so they need to be provided as keyword arguments.\n\nArguments\n\nfilename: the mmn file name\n\nKeyword arguments\n\nn_kpts: number of kpoints\nn_bvecs: number of bvectors\nn_bands: number of bands\n\nReturn\n\nM: length-n_kpts vector of length-n_bvecs vector of n_bands * n_bands matrices\n\n\n\n\n\n","category":"method"},{"location":"api/epw/#WannierIO.read_epw_ukk-Tuple{AbstractString}","page":"EPW","title":"WannierIO.read_epw_ukk","text":"read_epw_ukk(filename)\n\n\nRead the EPW .ukk file.\n\nArguments\n\nfilename: the output file name\n\nReturn\n\nukk: the Ukk struct\n\n\n\n\n\n","category":"method"},{"location":"api/epw/#WannierIO.write_epw_ukk-Tuple{AbstractString, WannierIO.Ukk}","page":"EPW","title":"WannierIO.write_epw_ukk","text":"write_epw_ukk(filename, ukk)\n\n\nWrite the EPW .ukk file.\n\nArguments\n\nfilename: the output file name\nukk: the Ukk struct\n\nExamples\n\nSee Ukk(chk::Chk, alat::Real) for how to construct a Ukk from a Chk.\n\n\n\n\n\n","category":"method"}] }