schrodinger.application.matsci.espresso.utils module¶
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.application.matsci.espresso.utils.
MagElement
(mag, hubb_u, hubb_j0)¶ Bases:
tuple
-
__contains__
¶ Return key in self.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
__len__
¶ Return len(self).
-
count
(value) → integer -- return number of occurrences of value¶
-
hubb_j0
¶ Alias for field number 2
-
hubb_u
¶ Alias for field number 1
-
index
(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
mag
¶ Alias for field number 0
-
-
schrodinger.application.matsci.espresso.utils.
get_shell_runner
(check_only=False, write_orig=False)¶ Get path to the shell runner script.
Parameters: - check_only (bool) – If True, only check if runner exists and return
- write_orig (bool) – If True, create original shell runner even if runner exists
Return type: (str, bool)
Returns: Path to shell runner and True if shell runner has been just created, otherwise False
-
schrodinger.application.matsci.espresso.utils.
add_qe_parallel_parser_arguments
(parser)¶ Add QE parallel arguments to the parser.
Parameters: parser ( argparse.ArgumentParser
) – The parser to add arguments to
-
schrodinger.application.matsci.espresso.utils.
get_pkeywords
(options, ncpus)¶ Validate and get string of parallel keywords for QE binaries (pw.x, etc.).
Parameters: - options (argparse Namespace object) – The input options
- ncpus (int) – Number of total requested CPUs
Return type: bool, str or list
Returns: If converted successfully, True and a list of [keyword, value] are returned, otherwise, False and error message are returned
-
schrodinger.application.matsci.espresso.utils.
get_mag_hubbu
(atom)¶ Get starting magnetization and Hubbard U parameters from atom property. If not present, return the default.
Parameters: atom ( schrodinger.structure._StructureAtom
) – Atom from which values are takenReturn type: MagElement namedtuple Returns: Tuple of starting magnetization and Hubbard parameters
-
schrodinger.application.matsci.espresso.utils.
set_mag_hubbu
(atom, mag_element)¶ Set starting magnetization and Hubbard U parameters in atom property.
Parameters: - atom (
schrodinger.structure._StructureAtom
) – Atom for which values are set - mag_element (MagElement namedtuple) – Tuple of starting magnetization and Hubbard parameters
- atom (
-
schrodinger.application.matsci.espresso.utils.
sync_pbc
(struct, lattice_params=None, chorus_params=None, prioritize_cparams=False)¶ Sync PBC properties in place (without creating a new structure) for struct. If all PBC properties are absent (both chorus and PDB) return False. It is possible to provide new lattice or chorus parameters and to prioritize one of the sets.
Type: Param: Structure to be modified
Parameters: - lattice_params (list or numpy.array or None) – contains the a, b, c, alpha, beta, and gamma lattice parameters or None. These will be used instead of ones possibly obtained from the struct
- chorus_params (list or numpy.array or None) – contains the nine chorus properties, i.e. ax, ay, az, bx, …, cz or None. These will be used instead of ones possibly obtained from the struct
Param: Prioritize chorus params over lattice params if True. If False, lattice params have priority
Return type: bool
Returns: True on syncing success, False if both sets were not provided or empty
-
schrodinger.application.matsci.espresso.utils.
get_mpircores_from_environ
()¶ Get -MPICORES flag value from SCHRODINGER_COMMANDLINE environment variable. If not found, return 1.
Return type: int Returns: MPICORES value or 1 (if not defined)
-
schrodinger.application.matsci.espresso.utils.
set_smart_distribution_from_environ
(jobq)¶ Set smart distribution of the queue to on/off based on the environment variable.
Parameters: jobq ( schrodinger.job.queue.JobDJ
) – The JobDJ object
-
schrodinger.application.matsci.espresso.utils.
get_element
(element)¶ Get element name with the removed digits from atom type. Those might be present to due starting magnetization.
Parameters: element (str) – Element Return type: str Returns: Element without digits
-
class
schrodinger.application.matsci.espresso.utils.
PPHeaderHTMLParser
(*args, **kwargs)¶ Bases:
html.parser.HTMLParser
Parse and store pp_header tag attributes.
-
PP_HEADER_TAG
= 'pp_header'¶
-
__init__
(*args, **kwargs)¶ Initialize object. See parent class for documentation.
-
handle_starttag
(tag, attrs)¶ Save PP_HEADER attributes in dictionary.
-
CDATA_CONTENT_ELEMENTS
= ('script', 'style')¶
-
check_for_whole_start_tag
(i)¶
-
clear_cdata_mode
()¶
-
close
()¶ Handle any buffered data.
-
error
(message)¶
-
feed
(data)¶ Feed data to the parser.
Call this as often as you want, with as little or as much text as you want (may include ‘n’).
-
get_starttag_text
()¶ Return full source of start tag: ‘<…>’.
-
getpos
()¶ Return current line number and offset.
-
goahead
(end)¶
-
handle_charref
(name)¶
-
handle_comment
(data)¶
-
handle_data
(data)¶
-
handle_decl
(decl)¶
-
handle_endtag
(tag)¶
-
handle_entityref
(name)¶
-
handle_pi
(data)¶
-
handle_startendtag
(tag, attrs)¶
-
parse_bogus_comment
(i, report=1)¶
-
parse_comment
(i, report=1)¶
-
parse_declaration
(i)¶
-
parse_endtag
(i)¶
-
parse_html_declaration
(i)¶
-
parse_marked_section
(i, report=1)¶
-
parse_pi
(i)¶
-
parse_starttag
(i)¶
-
reset
()¶ Reset this instance. Loses all unprocessed data.
-
set_cdata_mode
(elem)¶
-
unescape
(s)¶
-
unknown_decl
(data)¶
-
updatepos
(i, j)¶
-
-
class
schrodinger.application.matsci.espresso.utils.
UPFParser
(path)¶ Bases:
object
Class that handles UPF parsing.
-
PP_TYPE_PAW
= 'PAW'¶
-
PP_TYPES
= ('1/r', 'US', 'NC', 'PAW')¶
-
FULLY_REL
= 'full'¶
-
__init__
(path)¶ Initialize UPFParser.
Parameters: path (str) – Path to the UPF file
-
-
class
schrodinger.application.matsci.espresso.utils.
HighSymmetryKPath
(struct)¶ Bases:
object
Based on symmetry/bandstructure.py :: HighSymmKpath (MIT license)
This class looks for path along high symmetry lines in the Brillouin Zone. It is based on Setyawan, W., & Curtarolo, S. (2010). High-throughput electronic band structure calculations: Challenges and tools. Computational Materials Science, 49(2), 299-312. doi:10.1016/j.commatsci.2010.05.010
-
__init__
(struct)¶ Initialize kpath class. self.kpath will contain ‘edge’ points.
Parameters: struct ( structure.Structure
) – Structure that has space group / unit cell data
-
cubic
()¶ Generate ‘edge’ k-points for the cubic lattice.
Return type: dict Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
fcc
()¶ Generate ‘edge’ k-points for the FCC cubic lattice.
Return type: dict Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
bcc
()¶ Generate ‘edge’ k-points for the BCC cubic lattice.
Return type: dict Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
tet
()¶ Generate ‘edge’ k-points for the tetrahedral lattice.
Return type: dict Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
bctet1
(c, a)¶ Generate ‘edge’ k-points for the tetrahedral lattice with I setting.
Parameters: - c (float) – C length
- a (float) – A length
Return type: dict
Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
bctet2
(c, a)¶ Generate ‘edge’ k-points for the tetrahedral lattice with I setting.
Parameters: - c (float) – C length
- a (float) – A length
Return type: dict
Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
orc
()¶ Generate ‘edge’ k-points for the orthorhombic lattice.
Return type: dict Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
orcf1
(a, b, c)¶ Generate ‘edge’ k-points for the orthorhombic lattice with F setting.
Parameters: - a (float) – A length
- b (float) – B length
- c (float) – C length
Return type: dict
Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
orcf2
(a, b, c)¶ Generate ‘edge’ k-points for the orthorhombic lattice with F setting.
Parameters: - a (float) – A length
- b (float) – B length
- c (float) – C length
Return type: dict
Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
orcf3
(a, b, c)¶ Generate ‘edge’ k-points for the orthorhombic lattice with F setting.
Parameters: - a (float) – A length
- b (float) – B length
- c (float) – C length
Return type: dict
Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
orci
(a, b, c)¶ Generate ‘edge’ k-points for the orthorhombic lattice with I setting.
Parameters: - a (float) – A length
- b (float) – B length
- c (float) – C length
Return type: dict
Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
orcc
(a, b, c)¶ Generate ‘edge’ k-points for the orthorhombic lattice with C setting.
Parameters: - a (float) – A length
- b (float) – B length
- c (float) – C length
Return type: dict
Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
hex
()¶ Generate ‘edge’ k-points for the hexagonal lattice.
Return type: dict Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ - a list of labels from the ‘kpoints’.
-
rhl1
(alpha)¶ Generate ‘edge’ k-points for the rhombohedral lattice with alpha < 90.
Parameters: alpha (float) – Alpha cell angle in radians Return type: dict Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
rhl2
(alpha)¶ Generate ‘edge’ k-points for the rhombohedral lattice with alpha > 90.
Parameters: alpha (float) – Alpha cell angle in radians Return type: dict Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
mcl
(b, c, beta)¶ Generate ‘edge’ k-points for the monoclinic lattice.
Parameters: - b (float) – B length
- c (float) – C length
- beta (float) – Beta cell angle in radians
Return type: dict
Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
mclc1
(a, b, c, alpha)¶ Generate ‘edge’ k-points for the monoclinic lattice with C setting.
Parameters: - a (float) – A length
- b (float) – B length
- c (float) – C length
- alpha (float) – Alpha cell angle in radians
Return type: dict
Returns: keys: ‘kpoints’ is a dict with labels as keys and coordinates as values, ‘path’ is a list of labels from the ‘kpoints’ dict.
-
tria
()¶
-
-
class
schrodinger.application.matsci.espresso.utils.
MemoryEstimator
(vecs, ecutwfc, ecutrho, nproc, nks, nspin, nbnd, ntyp, nmix, lscf)¶ Bases:
object
Class to estimate RAM memory for a PW (QE) job.
-
COMPLEX_SIZE
= 16.0¶
-
REAL_SIZE
= 8.0¶
-
INT_SIZE
= 4.0¶
-
MBYTE
= 1048576.0¶
-
NFFTX
= 2049¶
-
__init__
(vecs, ecutwfc, ecutrho, nproc, nks, nspin, nbnd, ntyp, nmix, lscf)¶ Initialize MemoryEstimator object and set several attributes.
Parameters: - vecs (3 list of 3 floats) – Lattice vectors
- ecutwfc (float) – Wavefunction cutoff (Ry)
- ecutrho (float) – Density cutoff (Ry)
- nproc (int) – Number of processors
- nks (int) – Number of k-points
- nspin (int) – 1 for closed-shell, 2 for spin-polarized
- nbnd (int) – Number of bands
- ntyp (int) – Number of atom types
- nmix (int) – Beta mixing
- lscf (bool) – True if the calculation is scf/relax, False if it is nscf
-
realSpaceGridInit
(at_vecs, bg_vecs, gcutm)¶ Gets minimal 3D real-space FFT grid.
Parameters: - at_vecs (3 x 3 table of floats) – Lattice vectors in the units of alat
- bg_vecs (3 x 3 table of floats) – Reciprocal lattice vectors in the units of 1/alat
- gctum – Radius of the sphere to fit the FFT grid
Return type: list of 3 floats
Returns: FFT grid sizes
-
getGoodFFTDim
(fft_dim)¶ Get a good FFT dimension.
Parameters: fft_dim (int) – FFT dimension Return type: int Returns: Good FFT dimension, if exists
-
isGoodDim
(fft_dim)¶ Check if FFT dimension is good.
Parameters: fft_dim (int) – FFT dimension :rtype bool :return: True, if FFT dimension is good, False otherwise
-