projwfc
Classes for reading/manipulating Projwfc.x files.
Projwfc(parameters, filename, proj_source, structure=None, atomic_states=None, k=None, k_weights=None, eigenvals=None)
Bases: MSONable
Class to parse projwfc.x output. Supports parsing from projwfc.out (projwfc.x's stdout), filproj, and atomic_proj.xml files. filproj is recommended for parsing, as it is the most complete source of data. See this page for a comparison of the three files.
ATTRIBUTE | DESCRIPTION |
---|---|
parameters |
Parameters parsed from the header of the file. Contents depend on the source of the data.
TYPE:
|
structure |
Structure object parsed from the file.
TYPE:
|
lspinorb |
Whether the calculation includes spin-orbit coupling.
TYPE:
|
noncolin |
Whether the calculation is noncolinear.
TYPE:
|
lsda |
Whether the calculation is spin-polarized.
TYPE:
|
nstates |
Number of atomic states parsed from the file.
TYPE:
|
atomic_states |
List of AtomicState objects parsed from the file. Ordered in the same way projwfc.x orders them.
TYPE:
|
nk |
Number of k-points parsed from the file.
TYPE:
|
nbands |
Number of bands parsed from the file.
TYPE:
|
k |
k-points parsed from the file. Shape is (nkstot, 3).
TYPE:
|
k_weights |
k-point weights parsed from the file. Shape is (nkstot,).
TYPE:
|
eigenvals |
Eigenvalues parsed from the file. Shape is (nkstot, nbnd).
TYPE:
|
proj_source |
Source of the data. One of "projwfc.out", "filproj", or "atomic_proj.xml".
TYPE:
|
A lot of arguments and parameters can be none since not all the files contain the same information. The parameters dictionary is parsed from the header of the file and can contain some or all of the following keys:
natomwfc
: Number of atomic statesnr1x, nr2x, nr3x
: Number of grid points on the coarse gridnr1, nr2, nr3
: Number of grid points on the fine gridgcutm
: plane wave cutoff as a g-vectordual
: ratio between charge density and plane wave cutoffsnkstot
: Number of k-pointsnbnd
: Number of bandsnine
: Always the number 9lsda
: Whether the calculation is spin-polarizedlspinorb
: Whether the calculation includes spin-orbit couplingnoncolin
: Whether the calculation is noncolinear
PARAMETER | DESCRIPTION |
---|---|
parameters
|
Parameters parsed from the header of the file. Contents depend on the source of the data.
TYPE:
|
filename
|
Path to the file
TYPE:
|
proj_source
|
Source of the data. One of "projwfc.out", "filproj", or "atomic_proj.xml".
TYPE:
|
structure
|
Structure object parsed from the file.
TYPE:
|
atomic_states
|
List of AtomicState objects parsed from the file. Ordered in the same way projwfc.x orders them.
TYPE:
|
k
|
k-points parsed from the file. Shape is (nkstot, 3).
TYPE:
|
k_weights
|
k-point weights parsed from the file. Shape is (nkstot,).
TYPE:
|
eigenvals
|
Eigenvalues parsed from the file. Shape is (nkstot, nbnd).
TYPE:
|
Source code in pymatgen/io/espresso/outputs/projwfc.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|
__eq__(other)
Equality test. Meant for checking that the two objects come from
the same calculation, not that they are identical. It also assumes that the atomic states are ordered identically, and it checks them against each other using the AtomicState.__eq__
method (see that method for a description of how the comparison is done).
This dunder method is really only intended as a check before adding two Projwfc objects together. See the Projwfc.__add__
method for more information.
Source code in pymatgen/io/espresso/outputs/projwfc.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
__add__(other)
Combine two Projwfc objects. This is intended for combining one object with the spin up channel and another with the spin down. This is only ever necessary when parsing filproj for a spin-polarized calculation, since the two channels are stored in separate files.
Before addition, this method checks that the two objects must come from
the same calculation see the Projwfc.__eq__
method for more information.
This check is guaranteed to pass if the two objects are parsed from two filproj
files produced by the same calculation. Returns a new Projwfc object with the
combined data.
Source code in pymatgen/io/espresso/outputs/projwfc.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
__str__()
String representation of the object. This is intended to be a human-readable summary of the data parsed from the file. It includes the header information, a summary of the structure, and a summary of the atomic states. It also includes information about which data was parsed and which was not.
Source code in pymatgen/io/espresso/outputs/projwfc.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
|
from_projwfcout(filename, parse_projections=True)
classmethod
Initialize from a projwfc.out file (stdout of projwfc.x)
PARAMETER | DESCRIPTION |
---|---|
filename
|
Path to the file
TYPE:
|
parse_projections
|
Whether to parse the projections. If False, only the header of the file is parsed.
TYPE:
|
Source code in pymatgen/io/espresso/outputs/projwfc.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
|
from_filproj(filename, parse_projections=True)
classmethod
Construct a Projwfc object from a filproj file. This is the file
generated by projwfc.x and is called filproj.projwfc_up
by default.
Spin-polarized calculations will also have a filproj.projwfc_down
file. This method is intended to parse only one of the two files. If you want to parse both, you should parse them separately and then add them together as
projwfc_total = projwfc_up + projwfc_down
See the docstring of the Projwfc.__add__
method for more information.
PARAMETER | DESCRIPTION |
---|---|
filename
|
Path to the file
TYPE:
|
parse_projections
|
Whether to parse the projections. If False, only the header of the file is read.
TYPE:
|
Source code in pymatgen/io/espresso/outputs/projwfc.py
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
|
from_xml(filename, parse_eigenvals=True, parse_k=True, parse_projections=True, selection=None, store_phi_psi=False)
classmethod
Constructs a Projwfc object from an atomic_proj.xml file. This uses a selective parsing method, where only the data requested is parsed. This is useful for large files where only a subset of the data is needed. However, please note that projwfc XML files are not symmetrized. Please see this page for a comparison of the three files and some important details.
PARAMETER | DESCRIPTION |
---|---|
filename
|
Path to the file
TYPE:
|
parse_eigenvals
|
Whether to parse the eigenvalues
TYPE:
|
parse_k
|
Whether to parse the k-points
TYPE:
|
parse_projections
|
Whether to parse the projections. Note that the XML does not actually contain the projections, but \(\langle \phi | \psi \rangle\) where \(\phi\) is the local orbital and \(\psi\) is the Bloch function. The projections are computed as \(|\langle \phi | \psi\rangle|^2\).
TYPE:
|
selection
|
List of atomic states to parse. If None, all states are parsed. One indexed list (just like projwfc.x's ouptut)
TYPE:
|
store_phi_psi
|
Whether to store the raw data in the AtomicState objects. This will increase memory usage.
TYPE:
|
Source code in pymatgen/io/espresso/outputs/projwfc.py
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
|
AtomicState(parameters, projections=None, phi_psi=None, pdos=None, energies=None)
Bases: MSONable
Class to store information about a single atomic state from projwfc.x or dox.x
An atomic state is defined as an orbital one specific atom. The orbital is: - Defined by (n, l, m) if the calculation is colinear and not spin-polarized - Defined by (n, l, m) if the calculation is colinear spin-polarized. In this case, the spin up and spin down states are included in the same object. - Defined by (n, l, j, s_z) if the calculation is noncolinear without SOC. - Defined by (n, l, j, mj) if the calculation is noncolinear with SOC.
Where:
- n is the principal quantum number
- l is the orbital or angular quantum number
- m is the magnetic quantum number
- j is the total angular momentum quantum number
- m_j is the magnetic quantum number of the total angular momentum
- s_z is the z component of the local spin (+- 1/2)
QE also uses the notation of "wfc" to index the wavefunctions coming from a specific atom's pseudopotential. So these are unique l's or unique (l, j) pairs.
ATTRIBUTE | DESCRIPTION |
---|---|
state_i |
Index of this state, as indexed by projwfc.x
TYPE:
|
wfc_i |
Index of the wavefunction in the calculation
TYPE:
|
l |
Orbital angular momentum quantum number
TYPE:
|
j |
Total angular momentum quantum number
TYPE:
|
mj |
Magnetic quantum number of the total angular momentum
TYPE:
|
s_z |
S_z projection on a local z-axis (NCL calcs without SOC)
TYPE:
|
m |
Magnetic quantum number
TYPE:
|
n |
Principal quantum number
TYPE:
|
site |
Site object for the atom
TYPE:
|
orbital |
Orbital object
TYPE:
|
projections |
Projections of the state onto the atomic orbitals
TYPE:
|
phi_psi |
Overlap of the state with the wavefunction
TYPE:
|
pdos |
Projected density of states of the state
TYPE:
|
energies |
Energies for the PDOS
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
parameters
|
Dictionary with the following keys
TYPE:
|
projections
|
Projections from every band and k-point onto this atomic orbital.
TYPE:
|
phi_psi
|
Overlaps
TYPE:
|
pdos
|
Projected density of states
TYPE:
|
orbital
|
(pymatgen.electronic_structure.core.Orbital): Orbital object Undefined for calculations with SOC.
|
Source code in pymatgen/io/espresso/outputs/projwfc.py
860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 |
|
__eq__(other)
Equality test. This tests that the two objects represent the same state, i.e., same quantum numbers, state index, etc.
Source code in pymatgen/io/espresso/outputs/projwfc.py
912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 |
|
ProjwfcParserError
Bases: Exception
Exception class for Projwfc parsing.
InconsistentProjwfcDataError
Bases: Exception
Exception class for Projwfc addition.