Utils package
Submodules
Utils.LJRegistry module
- Utils.LJRegistry.LJParams(material, *, epsilon_eV=None, sigma_A=None, rc_A=None, ro_A=None)[source]
Help function to set sigma, epsilon and rCutoff for the given materials in the LJ_DB dictionary. :param material: The material to set sigma, epsilon and rCutoff :type material: str :param epsilon_eV: The epsilon eVf rom the potential well :type epsilon_eV: float, optional :param sigma_A: The sigma A from the potential well :type sigma_A: float, optional :param rc_A: The cutoff radius :type rc_A: float, optional :param ro_A: The smooth of radius :type ro_A: float, optional
- Returns:
The sigma, epsilon and rCutoff values
- Return type:
dict
- Parameters:
material (str)
Utils.equilibriumCondition module
- class Utils.equilibriumCondition.EquilibriumCondition[source]
Bases:
object- static checkInternalPressureStable(list_of_internal_pressure, tol=0.001)[source]
Used to check if the difference in internal pressure is below threshold.
- Returns:
True if the difference is below threshold; False otherwise.
- Return type:
bool
- static checkStable(list_of_values, tol=1e-05)[source]
Used to check if energy oscillates around certain value, then we probably found the equilibrium, meant to input either a list of MSD values or energy, which unlike internal pressure don’t have to oscillate around 0.
- Returns:
true if the difference is below threshold false if the difference is above threshold
Utils.exportCifs module
Utils.inputParser module
Utils.logger module
- class Utils.logger.CustomFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)[source]
Bases:
Formatter- COLORS = {10: '\x1b[36m', 20: '\x1b[32m', 30: '\x1b[33m', 40: '\x1b[31m', 50: '\x1b[41m'}
- RESET = '\x1b[0m'
- format(record)[source]
Format the specified record as text.
The record’s attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.
Utils.numerics module
- Utils.numerics.numericalDerivative(x, y, deg=1)[source]
Compute the numerical derivative dy/dx given lists of x and y values. Uses central difference for interior points and forward/backward for endpoints.
- Parameters:
x (list or array) – x-values (must be increasing and same length as y)
y (list or array) – y-values
- Returns:
derivative values (same length as x)
- Return type:
list
Utils.plotting module
- Utils.plotting.numericalDerivative(x, y, deg=1)[source]
Compute the numerical derivative dy/dx given lists of x and y values. Uses central difference for interior points and forward/backward for endpoints.
- Parameters:
x (list or array) – x-values (must be increasing and same length as y)
y (list or array) – y-values
- Returns:
derivative values (same length as x)
- Return type:
list
Utils.stretchFunctions module
- Utils.stretchFunctions.secondOrderNumericalDerivative(eps_list, U)[source]
Approximate the mixed partial derivative ∂²U/(∂x ∂y) using available data.
Supported inputs:
Case A: U is a 2D grid (n×n) of energies sampled on a common 1D grid
eps_list along both axes. Then this function computes the central cross-difference mixed partial on interior points and returns its average.
Case B: U is a list/tuple of two 1D energy traces, U=[U1(x), U2(y)],
each sampled on the same grid eps_list, with x == y.
- Returns:
Average mixed partial estimate (or diagonal pure second in the identical-traces case).
- Return type:
float