utility
- class irrep.utility.FortranFileR(filename)[source]
Class that implements syrte/fortio package to parse long records in Abinit WFK file.
- Parameters:
filename (str) – Path to the WFK file.
- irrep.utility.compstr(string)[source]
Convers str to float or complex.
- Parameters:
string (str) – String to convert.
- Returns:
float if string does not have imaginary part, complex otherwise.
- Return type:
float or complex
- irrep.utility.format_matrix(A)[source]
Format array to print it.
- Parameters:
A (array) – Matrix that should be printed.
- Returns:
Description of the matrix. Ready to be printed.
- Return type:
str
- irrep.utility.is_round(A, prec=1e-14)[source]
Returns True if all values in A are integers.
- Parameters:
A (array) – array for which the check should be done.
prec (float, default=1e-14 (machine precision).) – Threshold to apply.
- Returns:
True if all elements are integers, False otherwise.
- Return type:
bool
- irrep.utility.log_message(msg, verbosity, level)[source]
Logger to decide if a message is printed or not
- Parameters:
msg (str) – Message to print
verbosity (int) – Verbosity set for the current run of the code
level (int) – If verbosity >= level, the message will be printed
- irrep.utility.short(x, nd=3)[source]
Format float or complex number.
Parameter
- xint, float or complex
Number to format.
- ndint, default=3
Number of decimals.
- returns:
Formatted number, with nd decimals saved.
- rtype:
str
- irrep.utility.split(l)[source]
Determine symbol used for assignment and split accordingly.
- Parameters:
l (str) – Part of a line read from .win file.
- irrep.utility.str2bool(v1)[source]
Convert str to bool.
Parameter
- v1str
String to convert.
- rtype:
bool
- raises RuntimeError:
v1 does not start with ‘F’, ‘f’, ‘T’ nor ‘t’.
- irrep.utility.str2list(string)[source]
Generate list from str, where elements are separated by ‘-‘. Used when parsing parameters set in CLI.
- Parameters:
string (str) – str to be parsed.
- Return type:
array
Notes
Ranges can be generated as part of the output array. For example, str2list(‘1,3-5,7’) will give as ouput array([1,3,4,5,7]).
- irrep.utility.str2list_space(string)[source]
Generate list from str, where elements are separated by a space ‘’. Used when parsing parameters set in CLI.
- Parameters:
string (str) – str to be parsed.
- Return type:
array
Notes
Ranges can be generated as part of the output array. For example, str2list(‘1,3-5,7’) will give as ouput array([1,3,4,5,7]).