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:
parameters (mala.common.parameters.Parameters) – Parameters used to create the data handling object.
descriptor_calculator (mala.descriptors.descriptor.Descriptor) – Used to do unit conversion on input data. If None, then one will be created by this class.
target_calculator (mala.targets.target.Target) – Used to do unit conversion on output data. If None, then one will be created by this class.
- ldos_parameters
MALA target calculation 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_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]
Align LDOS to reference.
- Parameters:
save_path_ext (string) – Extra path to be added to the input path before saving. By default, new snapshot files are saved into exactly the same directory they were read from with exactly the same name.
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
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(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:
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