:py:mod:`IMLCV.base.bias`
=========================

.. py:module:: IMLCV.base.bias


Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   IMLCV.base.bias.EnergyResult
   IMLCV.base.bias.BC
   IMLCV.base.bias.Energy
   IMLCV.base.bias.PlumedEnerg
   IMLCV.base.bias.Bias
   IMLCV.base.bias.CompositeBias
   IMLCV.base.bias.BiasF
   IMLCV.base.bias.NoneBias



Functions
~~~~~~~~~

.. autoapisummary::

   IMLCV.base.bias.plot_app



.. py:class:: EnergyResult

   .. py:attribute:: energy
      :type: float

      

   .. py:attribute:: gpos
      :type: Array | None

      

   .. py:attribute:: vtens
      :type: Array | None

      

   .. py:method:: __post_init__()


   .. py:method:: __add__(other) -> EnergyResult


   .. py:method:: __str__() -> EnergyResult.__str__.str

      Return str(self).



.. py:class:: BC

   base class for biased Energy of MD simulation.

   .. py:method:: save(filename: str | Path)


   .. py:method:: load(filename) -> BC
      :staticmethod:



.. py:exception:: EnergyError

   Bases: :py:obj:`Exception`

   Common base class for all non-exit exceptions.


.. py:class:: Energy

   Bases: :py:obj:`BC`

   base class for biased Energy of MD simulation.

   .. py:property:: cell
      :abstractmethod:


   .. py:property:: coordinates
      :abstractmethod:


   .. py:property:: sp
      :type: IMLCV.base.CV.SystemParams


   .. py:method:: load(filename) -> Energy
      :staticmethod:


   .. py:method:: _compute_coor(gpos=False, vir=False) -> EnergyResult
      :abstractmethod:


   .. py:method:: _handle_exception()


   .. py:method:: compute_from_system_params(gpos=False, vir=False, sp: SystemParams | None = None, nl: NeighbourList | None = None) -> EnergyResult



.. py:class:: PlumedEnerg

   Bases: :py:obj:`Energy`

   base class for biased Energy of MD simulation.


.. py:exception:: BiasError

   Bases: :py:obj:`Exception`

   Common base class for all non-exit exceptions.


.. py:class:: Bias(collective_variable: IMLCV.base.CV.CollectiveVariable, start=None, step=None)

   Bases: :py:obj:`BC`, :py:obj:`abc.ABC`

   base class for biased MD runs.

   .. py:method:: update_bias(md: IMLCV.base.MdEngine.MDEngine)

      update the bias.

      Can only change the properties from _get_args


   .. py:method:: _update_bias()

      update the bias.

      Can only change the properties from _get_args


   .. py:method:: compute_from_system_params(sp: IMLCV.base.CV.SystemParams, gpos=False, vir=False, nl: NeighbourList | None = None, jit=True) -> tuple[IMLCV.base.CV.CV, EnergyResult]

      Computes the bias, the gradient of the bias wrt the coordinates and
      the virial.


   .. py:method:: compute_from_cv(cvs: IMLCV.base.CV.CV, diff=False, jit=True) -> IMLCV.base.CV.CV

      compute the energy and derivative.

      If map==False, the cvs are assumed to be already mapped


   .. py:method:: _compute(cvs, *args)
      :abstractmethod:

      function that calculates the bias potential. CVs live in mapped space


   .. py:method:: get_args()
      :abstractmethod:

      function that return dictionary with kwargs of _compute.


   .. py:method:: finalize()

      Should be called at end of metadynamics simulation.

      Optimises compute


   .. py:method:: load(filename) -> Bias
      :staticmethod:


   .. py:method:: plot(name, x_unit: str | None = None, y_unit: str | None = None, n=50, traj: list[CV] | None = None, vmin=0, vmax=100 * kjmol, map=False, inverted=False, margin=None, x_lim=None, y_lim=None, bins=None)

      plot bias.



.. py:function:: plot_app(bias: Bias, outputs: list[parsl.data_provider.files.File], n: int = 50, vmin: float = 0, vmax: float = 100 * kjmol, map: bool = True, inverted=False, traj: list[CV] | None = None, margin=None, x_unit=None, y_unit=None, x_lim=None, y_lim=None, bins=None)


.. py:class:: CompositeBias(biases: collections.abc.Iterable[Bias], fun=jnp.sum)

   Bases: :py:obj:`Bias`

   Class that combines several biases in one single bias.

   .. py:method:: _append_bias(b: Bias)


   .. py:method:: _compute(cvs, *args)

      function that calculates the bias potential. CVs live in mapped space


   .. py:method:: finalize()

      Should be called at end of metadynamics simulation.

      Optimises compute


   .. py:method:: update_bias(md: IMLCV.base.MdEngine.MDEngine)

      update the bias.

      Can only change the properties from _get_args


   .. py:method:: get_args()

      function that return dictionary with kwargs of _compute.



.. py:class:: BiasF(cvs: IMLCV.base.CV.CollectiveVariable, g=None)

   Bases: :py:obj:`Bias`

   Bias according to CV.

   .. py:method:: _compute(cvs)

      function that calculates the bias potential. CVs live in mapped space


   .. py:method:: get_args()

      function that return dictionary with kwargs of _compute.



.. py:class:: NoneBias(cvs: IMLCV.base.CV.CollectiveVariable)

   Bases: :py:obj:`BiasF`

   dummy bias.


