Simulation
==========

Entry point for simulation
--------------------------

.. autoclass:: qtealeaves.QuantumGreenTeaSimulation
   :members:

.. autoclass:: qtealeaves.ATTNSimulation
   :members:


Tensor network simulation
-------------------------

.. autoclass:: qtealeaves.simulation.tn_simulation.run_tn_simulation
   :members:

.. autoclass:: qtealeaves.simulation.tn_simulation.update_time_dependent_terms
   :members:

.. autoclass:: qtealeaves.simulation.tn_simulation.optimize
   :members:


Exact state simulation
----------------------

.. autoclass:: qtealeaves.simulation.ed_simulation.run_ed_simulation
   :members:


Quench for dynamics simulation
------------------------------

.. autoclass:: qtealeaves.DynamicsQuench
   :members:


Logging
-------

Logging is handled through python's :py:mod:`logging` module, giving the user plenty of room 
for customization on where (file, console, etc.), how (text formatting), and what to log -
see e.g. `Examples/Logging_setup.py`. Filtering is mostly based on the severity 
`level <https://docs.python.org/3/library/logging.html#logging-levels>`_ 
of the log record and on its source (from which module it was emitted). 

If no custom logging setup is provided, ``qtealeaves`` will set some defaults:
logging to the console or to a `sim.log` file in the simulation output folder, 
depending on the argument `has_log_file` passed at simulation initialization.
By default, logs with level "WARNING" or higher will be emitted, except for simulation-wide
log records coming from the `qtealeaves.simulation` sub-package, for which "INFO" or higher 
is logged. When logging to a file we also call :py:func:`logging.captureWarnings` to enable
capturing messages emitted via :py:func:`warnings.warn`.

When customizing logging, you have to explicitly set the level of the simulation-wide logger via 
`get_logger("qtealeaves.simulation").setLevel(LEVEL)` if you want something different from "INFO".
You may also want to enable capturing warnings, regardless of the value passed for `has_log_file`.
