ldos_aligner

Align LDOS vectors to a reference.

class LDOSAligner(parameters: Parameters, target_calculator=None, descriptor_calculator=None)[source]

Bases: DataHandlerBase

Align LDOS vectors based on when they first become non-zero.

Optionally truncates from the left and right-side to remove redundant data.

Parameters:
add_snapshot(output_file, output_directory, snapshot_type='numpy')[source]

Add a snapshot to the data pipeline.

Parameters:
  • output_file (string) – File with saved numpy output array.

  • output_directory (string) – Directory containing output_npy_file.

  • snapshot_type (string) – Must be numpy, openPMD is not yet available for LDOS alignment.

align_ldos_to_ref(save_path=None, save_name=None, save_path_ext='aligned/', reference_index=0, zero_tol=1e-05, left_truncate=False, right_truncate_value=None, number_of_electrons=None, n_shift_mse=None)[source]

Add a snapshot to the data pipeline.

Parameters:
  • save_path (string) – path to save the aligned LDOS vectors

  • save_name (string) – naming convention for the aligned LDOS vectors

  • save_path_ext (string) – additional path for the LDOS vectors (useful if save_path is left as default None)

  • reference_index (int) – the snapshot number (in the snapshot directory list) to which all other LDOS vectors are aligned

  • zero_tol (float) – the “zero” value for alignment / left side truncation always scaled by norm of reference LDOS mean

  • left_truncate (bool) – whether to truncate the zero values on the LHS

  • right_truncate_value (float) – right-hand energy value (based on reference LDOS vector) to which truncate LDOS vectors if None, no right-side truncation

  • egrid_spacing_ev (float) – spacing of energy grid

  • egrid_offset_ev (float) – original offset of energy grid

  • number_of_electrons (float / int) – if not None, computes the energy shift relative to QE energies

  • n_shift_mse (int) – how many energy grid points to consider when aligning LDOS vectors based on mean-squared error computed automatically if None

static calc_optimal_ldos_shift(e_grid, ldos_mean, ldos_mean_ref, left_index, left_index_ref, n_shift_mse)[source]

Calculate the optimal amount by which to align the LDOS with reference.

‘Optimized’ is currently based on minimizing the mean-square error with the reference, up to a cut-off (typically 10% of the full LDOS length).

Parameters:
  • e_grid (array_like) – energy grid

  • ldos_mean (array_like) – mean of LDOS vector for shifting

  • ldos_mean_ref (array_like) – mean of LDOS reference vector

  • left_index (int) – index at which LDOS for shifting becomes non-zero

  • left_index_ref (int) – index at which reference LDOS becomes non-zero

  • n_shift_mse (int) – number of points to account for in MSE calculation for optimal LDOS shift

Returns:

optimal_shift – the optimized number of egrid points to shift the LDOS vector by, based on minimization of MSE with reference

Return type:

int