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.LJRegistry.calcMaxRc(atoms, margin=0.001)[source]

Function to calculate the maximal rcutoff allowed. :param atoms: the atomobject to calculate the radius from

Returns:

The maximum rcutoff allowed

Return type:

float

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.exportCifs.get_defect_cif(host_name, defect_name, db_path='../../defect/defects.sqlite', out_dir='cif_out')[source]

Utils.inputParser module

class Utils.inputParser.InputParser(args=['/opt/hostedtoolcache/Python/3.12.12/x64/bin/sphinx-build', '-M', 'html', '.', '_build'])[source]

Bases: object

addArguments()[source]

Whenever a new setting is added, add the corresponding flag here.

parseList(arg)[source]

Help function to make sure list arguments are working.

class Utils.inputParser.SingleMetavarHelpFormatter(prog, indent_increment=2, max_help_position=24, width=None)[source]

Bases: HelpFormatter

Formatter to only get one metavar

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.logger.loggerSetup(debug)[source]

Utils.numerics module

Utils.numerics.fitter(x, y, deg=14, resolution=None)[source]
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.numerics.sortRealignAndFilter(x_list, y_list, filter=True, resolution=None)[source]

Utils.plotting module

Utils.plotting.fitter(x, y, deg=14, resolution=None)[source]
Utils.plotting.flattenDict(dict)[source]
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.plotting.plot(x, y, x_label='x', y_label='y', save_as=None)[source]
Utils.plotting.sortRealignAndFilter(x_list, y_list, filter=True, resolution=None)[source]

Utils.stretchFunctions module

Utils.stretchFunctions.calculateCMatrix(strech_sequence)[source]
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

Utils.unitConversions module

Utils.unitConversions.GPascalToAu(pressure_GPa)[source]
Utils.unitConversions.a1ToM1(length_a)[source]
Utils.unitConversions.a2ToM2(area_a2)[source]
Utils.unitConversions.a3ToM3(volume_a3)[source]
Utils.unitConversions.atomicMassTokg(mass_au)[source]
Utils.unitConversions.auToGPascal(pressure_au)[source]

Convert pressure from eV/Å^3 to GPa.

Utils.unitConversions.auToPascal(pressure_au)[source]
Utils.unitConversions.evToJ(energy_eV)[source]
Utils.unitConversions.hartreePerbohr3ToJPerM3(energy_hartreePerbohr3)[source]
Utils.unitConversions.jToEv(energy_J)[source]
Utils.unitConversions.kgToAtomicMass(mass_kg)[source]
Utils.unitConversions.m2ToA2(area_m2)[source]
Utils.unitConversions.m3ToA3(volume_m3)[source]
Utils.unitConversions.mToA(length_m)[source]
Utils.unitConversions.pascalToAu(pressure_Pa)[source]

Convert pressure from Pa to eV/Å^3.

Utils.unitConversions.selfDiffusionCoeffAuToSI(D_au)[source]
Utils.unitConversions.specificHeatAuToSI(Cv_au)[source]

Convert specific heat from eV/(amu·K) to J/(kg·K).

Module contents