MLJ Model

The MLJ model is a semiclassical model for absorption spectra. It expected a high-energy and low-energy mode.

This model represents a system with two states, a ground state and an excited state. It also expects two modes. An absorption spectrum is calculation with a summation.

More details on the calculation process can be found in the MLJ Computation Docs.

Model Name

In config files, this Model is named mlj. This can be specified in your-config.toml with:

model.name = "two-state"

In the package, this Model is named MLJModel. This can be imported with:

from quantumspectra_2024.absorption import MLJModel

Parameters

All Models have a mixture of required and optional parameters. For further explanation and expected values, see the MLJ Computation Docs.

Model Parameters

Note

All MLJ Models require these parameters on initialization.

This static integer parameter defines the size of the calculation:

MLJModel.basis_size: int = 20

size of basis set (unitless).

These scalar parameters are used in the calculation:

MLJModel.temperature_kelvin: float

system’s temperature (Kelvin).

MLJModel.energy_gap: float

energy gap between the two states (wavenumbers).

MLJModel.disorder_meV: float

disorder in the system (meV).

These vector parameters are used in the calculation, and define mode parameters. They should correspond to the number of modes in the calculation, and thus have two values. Each value should correspond to a high-energy and low-energy mode (order doesn’t matter).

MLJModel.mode_frequencies: Float[Array, '2']

frequency per mode (wavenumbers), must have exactly two.

MLJModel.mode_couplings: Float[Array, '2']

excited state coupling per mode, must have exactly two.

General Parameters

All Models have optional parameters to specify the range of their generated spectrum. By default, all Models generate 2,001 points between 0 and 20,000 wavenumbers.

MLJModel.start_energy: float = 0.0

absorption spectrum’s starting energy (wavenumbers).

MLJModel.end_energy: float = 20000.0

absorption spectrum’s ending energy (wavenumbers).

MLJModel.num_points: int = 2001

absorption spectrum’s number of points (unitless).

Examples

These examples display both types of usage for this class. Both use the same “default” parameters that appear in the given sample config.

Both of these methods will produce the following absorption spectrum:

MLJ Absorption Spectrum Output

CLI Usage

  1. First, create a config file your-config.toml that includes the required specifications, and these contents:

    model.name = "two-state"
    
    model.temperature_kelvin = 300
    model.energy_gap = 8000
    model.disorder_meV = 0
    
    model.basis_size = 20
    
    model.mode_frequencies = [1200, 100]
    model.mode_couplings = [0.7, 2.0]
    

    More information about config files can be found on the Config Files page. Sample config files can be found in the Sample Configs section of that page.

  2. Then, run the absorption spectrum command with the path to your config file.

    qs_2024 path/to/your-config.toml
    

    This will save the generated absorption spectrum to the specified output file.

Package Usage

  1. First, import the Model.

    from quantumspectra_2024.models import MLJModel
    
  2. Create an instance of the model with the desired parameters.

    model = TwoStateModel(
        temperature_kelvin=300,
        energy_gap=8000,
        disorder_meV=0,
        basis_size=20,
        mode_frequencies=[1200, 100],
        mode_couplings=[0.7, 2.0]
    )
    
  3. Run the get_absorption method to generate the absorption spectrum.

    Warning

    This is the cpu (or gpu)-intensive part of the process. Only run this method when you are ready to generate the absorption spectrum.

    spectrum = model.get_absorption()
    

    This will return an AbsorptionSpectrum instance to the spectrum variable. Details on the AbsorptionSpectrum class can be found in the Absorption Spectrum Docs.

    Accessing spectrum data:

    x, y = spectrum.energies, spectrum.intensities
    print(x)
    print(y)
    

    Saving spectrum data:

    spectrum.save_data("path/to/output/file.csv")
    spectrum.save_plot("path/to/output/plot.png")
    

Full Class

class quantumspectra_2024.models.MLJModel(*, start_energy: float = 0.0, end_energy: float = 20000.0, num_points: int = 2001, temperature_kelvin: float, energy_gap: float, disorder_meV: float, basis_size: int = 20, mode_frequencies: Float[Array, '2'], mode_couplings: Float[Array, '2'])[source]

A two-state two-mode MLJ model for absorption spectra.

Parameters:
start_energyfloat

absorption spectrum’s starting energy (wavenumbers).

end_energyfloat

absorption spectrum’s ending energy (wavenumbers).

num_pointsint

absorption spectrum’s number of points (unitless).

temperature_kelvinfloat

system’s temperature (Kelvin).

energy_gapfloat

energy gap between the two states (wavenumbers).

disorder_meVfloat

disorder in the system (meV).

basis_sizeint

size of basis set (unitless).

mode_frequenciesFloat[Array, “2”]

frequency per mode (wavenumbers).

mode_couplingsFloat[Array, “2”]

excited state coupling per mode.

Methods

apply_electric_field(field_strength, ...)

Applies an electric field to the model.

get_absorption()

Compute the absorption spectrum for the model.

get_low_high_frequency_modes()

Extracts the low and high frequency modes and mode couplings from the model.

get_absorption() AbsorptionSpectrum[source]

Compute the absorption spectrum for the model.

See docs in MLJComputation to see how this is done.

Returns:
AbsorptionSpectrum

the model’s parameterized absorption spectrum.

get_low_high_frequency_modes() tuple[float, float, float, float][source]

Extracts the low and high frequency modes and mode couplings from the model.

Model was already verified to have exactly two modes. This function sorts the modes by frequency and returns the lowest and highest frequency modes. This is useful for the calculate_mlj_spectrum function, which expects the low and high frequency modes explicitly.

Returns:
tuple[float, float, float, float]

low frequency, low coupling, high frequency, high coupling.

apply_electric_field(field_strength: float, field_delta_dipole: float, field_delta_polarizability: float) MLJModel[source]

Applies an electric field to the model. Returns a new instance of the model.

Parameters:
field_strengthfloat

the strength of the electric field.

field_delta_dipolefloat

the change in dipole moment due to the electric field.

field_delta_polarizabilityfloat

the change in polarizability due to the electric field.

Returns:
MLJModel

the model with the electric field applied.

_verify_modes()[source]

Verifies that the model has exactly two modes.

Raises:
ValueError

if the model does not have exactly two modes.