LVC Module

class lvc.LVCHam(normal_mode, VCSystem, funct_guess=None, nepochs=2000)[source]

Bases: object

Builder and optimizer for an LVC Hamiltonian.

Parameters:
__init__(normal_mode, VCSystem, funct_guess=None, nepochs=2000)[source]

Initialize LVCHam with references to the system and its parameters.

normal_modeint

The vibrational mode to process.

VCSystemobject

The parent system containing parameters and data.

funct_guessoptional

Initial guess parameters for the diabatic functions.

nepochsint, optional

Number of optimization epochs.

Parameters:
Return type:

None

build_vcham_tensor()[source]

Assemble the final Hamiltonian tensor from diagonal and off-diagonal contributions.

tf.Tensor

The Hamiltonian eigenvalue tensor.

Return type:

Tensor

create_jt_off_diag(jt_guess=0.01)[source]

Identify JT-type off-diagonal terms (symmetry_mask == 2) and initialize JT parameters.

Parameters:

jt_guess (float) –

Return type:

None

initialize_loss_function(fn='huber', **kwargs)[source]

Initialize a TensorFlow loss function by name.

fnstr, optional

Name of the loss function (default is ‘huber’).

kwargs :

Additional keyword arguments for the loss function.

Parameters:

fn (str) –

Return type:

None

initialize_params(lambda_guess=0.1, jt_guess=0.01, kappa_guess=0.1)[source]

Collect all TF Variables that will be optimized.

This method should be called after the off-diagonal and on-diagonal parameters have been created.

Parameters:
Return type:

None

optimize()[source]

Run gradient-based optimization for the specified number of epochs or until early stopping is triggered. If the current mode is marked inactive, build the final Hamiltonian tensor directly without optimization.

Return type:

None

plot_results(final_tensor_np, loss_history)[source]

Plot the final eigenvalues vs. reference data and the loss evolution.

final_tensor_npnp.ndarray

The final Hamiltonian eigenvalues.

loss_historylist of float

The loss evolution during optimization.

Parameters:
Return type:

None

train_step()[source]

A single training step: compute loss, gradients, and update parameters.

tf.Tensor

The computed loss value.

Return type:

Tensor