maxwelllink.mxl_drivers.python.models.dummy_model module¶
- class maxwelllink.mxl_drivers.python.models.dummy_model.DummyModel[source]¶
Bases:
objectA dummy quantum dynamics model for demonstration purposes.
This class serves as a template for implementing specific quantum dynamics models. It provides the necessary interface for integration with the MaxwellLink framework.
- __init__(verbose=False, checkpoint=False, restart=False)[source]¶
Initialize the necessary parameters for the dummy quantum dynamics model.
Tips¶
The computational load of this step should be minimal.
Notes
This method should be overridden by subclasses if more member variables need to be initialized.
- param verbose:
Whether to print verbose output.
- type verbose:
bool, default: False
- param checkpoint:
Whether to enable checkpointing.
- type checkpoint:
bool, default: False
- param restart:
Whether to restart from a checkpoint if available.
- type restart:
bool, default: False
- append_additional_data()[source]¶
Append additional data to be sent back to MaxwellLink.
The data can be retrieved by the user via
MaxwellLink.Molecule.additional_data_history, whereadditional_data_historyis a list of dictionaries.Notes
This method can be optionally overridden by subclasses to send additional data to MaxwellLink. We recommend including “time_au”, “energy_au”, and dipole components “mux_au”, “muy_au”, “muz_au” in the returned dictionary. This format would allow for easy energy analysis. Dipole information is useful for debugging and also computing dipole self-energy term if needed.
- Returns:
A dictionary containing additional data.
- Return type:
dict
- calc_amp_vector()[source]¶
Update the source amplitude vector after propagating this molecule for one time step.
This method should be overridden by subclasses to implement specific source update logic.
The amplitude vector should be calculated by \(\mathrm{d}\mu/\mathrm{d}t\), where \(\mu\) is the classical dipole vector of the molecule.
Notes
This method must be overridden by subclasses.
- Returns:
Amplitude vector in the form \([\mathrm{d}\mu_x/\mathrm{d}t,\ \mathrm{d}\mu_y/\mathrm{d}t,\ \mathrm{d}\mu_z/\mathrm{d}t]\).
- Return type:
numpy.ndarray of float, shape (3,)
- commit_step()[source]¶
Commit the previewed step and return the staged amplitude.
This method applies the changes from the staged step to the internal state and returns the calculated amplitude vector.
Notes
This method should not be overridden by subclasses.
- Returns:
Amplitude vector in the form \([\mathrm{d}\mu_x/\mathrm{d}t,\ \mathrm{d}\mu_y/\mathrm{d}t,\ \mathrm{d}\mu_z/\mathrm{d}t]\).
- Return type:
numpy.ndarray of float, shape (3,)
- have_result()[source]¶
Check if a staged step is ready to be committed.
Notes
This method should not be overridden by subclasses.
- Returns:
Whether a staged step is ready.
- Return type:
bool
- initialize(dt_new, molecule_id)[source]¶
Set the time step and molecule ID for this quantum dynamics model and provide necessary initialization.
This function will be called in the driver code after the molecule ID is assigned (the INIT stage of socket communication).
Tips¶
The major computational load of initialization should be done here.
Notes
This method should be overridden by subclasses if more member variables need to be initialized.
- param dt_new:
The new time step in atomic units (a.u.).
- type dt_new:
float
- param molecule_id:
The ID of the molecule assigned by SocketHub.
- type molecule_id:
int
- propagate(effective_efield_vec)[source]¶
Propagate the quantum molecular dynamics for one FDTD step given the effective electric field vector.
This method should be overridden by subclasses to implement specific propagation logic.
Tips¶
One can implement sub-steps (running many steps for the model per FDTD call) or macrosteps (running one step for the model per few FDTD calls) within this function as needed.
Notes
This method must be overridden by subclasses.
- param effective_efield_vec:
Effective electric field vector in the form
[E_x, E_y, E_z].- type effective_efield_vec:
array-like of float, shape (3,)
- stage_step(E_vec)[source]¶
Stage a propagation step with the given effective electric field vector.
This method performs the propagation and calculates the amplitude vector, but does not commit the changes to the internal state. The result can be committed later using the
self.commit_stepmethod.Notes
This method should not be overridden by subclasses.
- Parameters:
E_vec (array-like of float, shape (3,)) – Effective electric field vector in the form
[E_x, E_y, E_z].