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:
These scalar parameters are used in the calculation:
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).
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.
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:
CLI Usage
First, create a config file
your-config.tomlthat 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.
Then, run the absorption spectrum command with the path to your config file.
qs_2024 path/to/your-config.tomlThis will save the generated absorption spectrum to the specified output file.
Package Usage
First, import the Model.
from quantumspectra_2024.models import MLJModel
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] )
Run the
get_absorptionmethod 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
AbsorptionSpectruminstance to thespectrumvariable. Details on theAbsorptionSpectrumclass 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.
Compute the absorption spectrum for the model.
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.