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

.. py:module:: IMLCV.base.MdEngine

.. autoapi-nested-parse::

   MD engine class peforms MD simulations in a given NVT/NPT ensemble.

   Currently, the MD is done with YAFF/OpenMM



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

Classes
~~~~~~~

.. autoapisummary::

   IMLCV.base.MdEngine.StaticTrajectoryInfo
   IMLCV.base.MdEngine.TrajectoryInfo
   IMLCV.base.MdEngine.MDEngine




.. py:class:: StaticTrajectoryInfo

   .. py:property:: masses


   .. py:property:: thermostat


   .. py:property:: barostat


   .. py:attribute:: _attr
      :value: ['timestep', 'r_cut', 'timecon_thermo', 'T', 'P', 'timecon_baro', 'write_step', 'equilibration',...

      

   .. py:attribute:: _arr
      :value: ['atomic_numbers']

      

   .. py:attribute:: timestep
      :type: float

      

   .. py:attribute:: T
      :type: float

      

   .. py:attribute:: timecon_thermo
      :type: float

      

   .. py:attribute:: atomic_numbers
      :type: jax.Array

      

   .. py:attribute:: r_cut
      :type: float | None

      

   .. py:attribute:: P
      :type: float | None

      

   .. py:attribute:: timecon_baro
      :type: float | None

      

   .. py:attribute:: write_step
      :type: int
      :value: 100

      

   .. py:attribute:: equilibration
      :type: float | None

      

   .. py:attribute:: screen_log
      :type: int
      :value: 1000

      

   .. py:attribute:: max_grad
      :type: float | None

      

   .. py:method:: __post_init__()


   .. py:method:: _save(hf: h5py.File)


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


   .. py:method:: _load(hf: h5py.File) -> StaticTrajectoryInfo
      :staticmethod:


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



.. py:class:: TrajectoryInfo

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


   .. py:property:: positions
      :type: Array | None


   .. py:property:: cell
      :type: Array | None


   .. py:property:: volume


   .. py:property:: charges
      :type: Array | None


   .. py:property:: e_pot
      :type: Array | None


   .. py:property:: e_pot_gpos
      :type: Array | None


   .. py:property:: e_pot_vtens
      :type: Array | None


   .. py:property:: e_bias
      :type: Array | None


   .. py:property:: e_bias_gpos
      :type: Array | None


   .. py:property:: e_bias_vtens
      :type: Array | None


   .. py:property:: cv
      :type: Array | None


   .. py:property:: T
      :type: Array | None


   .. py:property:: P
      :type: Array | None


   .. py:property:: err
      :type: Array | None


   .. py:property:: t
      :type: Array | None


   .. py:property:: shape


   .. py:property:: CV
      :type: CV | None


   .. py:attribute:: _positions
      :type: jax.Array

      

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

      

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

      

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

      

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

      

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

      

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

      

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

      

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

      

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

      

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

      

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

      

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

      

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

      

   .. py:attribute:: _items_scal
      :value: ['_t', '_e_pot', '_e_bias', '_T', '_P', '_err']

      

   .. py:attribute:: _items_vec
      :value: ['_positions', '_cell', '_e_pot_gpos', '_e_pot_vtens', '_e_bias_gpos', '_e_bias_vtens',...

      

   .. py:attribute:: _capacity
      :type: int

      

   .. py:attribute:: _size
      :type: int

      

   .. py:method:: __post_init__()


   .. py:method:: __getitem__(slices)

      gets slice from indices. the output is truncated to the to include only items wihtin _size


   .. py:method:: __add__(ti: TrajectoryInfo)


   .. py:method:: _expand_capacity()


   .. py:method:: _shrink_capacity()


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


   .. py:method:: _save(hf: h5py.File)


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


   .. py:method:: _load(hf: h5py.File)
      :staticmethod:



.. py:class:: MDEngine(bias: IMLCV.base.bias.Bias, energy: IMLCV.base.bias.Energy, static_trajectory_info: StaticTrajectoryInfo, trajectory_file=None, sp: SystemParams | None = None)

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

   Base class for MD engine.

   .. py:class:: YaffSys

      .. py:class:: YaffCell

         .. py:property:: rvecs


         .. py:property:: nvec


         .. py:property:: volume


         .. py:attribute:: _ener
            :type: IMLCV.base.bias.Energy

            

         .. py:method:: update_rvecs(rvecs)



      .. py:property:: numbers


      .. py:property:: masses


      .. py:property:: charges


      .. py:property:: cell


      .. py:property:: pos


      .. py:property:: natom


      .. py:attribute:: _ener
         :type: IMLCV.base.bias.Energy

         

      .. py:attribute:: _tic
         :type: StaticTrajectoryInfo

         

      .. py:method:: __post_init__()



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


   .. py:property:: nl
      :type: NeighbourList | None


   .. py:property:: yaff_system
      :type: MDEngine


   .. py:attribute:: keys
      :value: ['bias', 'energy', 'static_trajectory_info', 'trajectory_file']

      

   .. py:method:: save(file)


   .. py:method:: __getstate__()


   .. py:method:: __setstate__(state)


   .. py:method:: load(file, **kwargs) -> MDEngine
      :staticmethod:


   .. py:method:: new_bias(bias: IMLCV.base.bias.Bias, **kwargs) -> MDEngine


   .. py:method:: run(steps)

      run the integrator for a given number of steps.

      :param steps: number of MD steps


   .. py:method:: _run(steps)
      :abstractmethod:


   .. py:method:: get_trajectory() -> TrajectoryInfo


   .. py:method:: save_step(T=None, P=None, t=None, err=None)


   .. py:method:: get_energy(gpos: bool = False, vtens: bool = False) -> IMLCV.base.bias.EnergyResult


   .. py:method:: get_bias(gpos: bool = False, vtens: bool = False) -> tuple[IMLCV.base.CV.CV, IMLCV.base.bias.EnergyResult]



