sponge.potential.EnergyCell
- class sponge.potential.EnergyCell(name: str = 'energy', length_unit: str = 'nm', energy_unit: str = 'kj/mol', use_pbc: bool = None, **kwargs)[source]
Base class for energy terms. EnergyCell is usually used as a base class for individual energy terms in a classical force field. As the force field parameters usually has units, the units of the EnergyCell as an energy term should be the same as the units of the force field parameters, and not equal to the global units.
Note
B: Batchsize, i.e. number of walkers in simulation
- Parameters
name (str) – Name of energy. Default: ‘energy’
length_unit (str) – Length unit. If None is given, it will be assigned with the global length unit. Default: ‘nm’
energy_unit (str) – Energy unit. If None is given, it will be assigned with the global energy unit. Default: ‘kj/mol’
use_pbc (bool) – Whether to use periodic boundary condition. Default:
None
.kwargs (dict) – Other parameters dictionary.
- Returns
Tensor of energy, Tensor of shape (B, 1). Data type is float.
- Supported Platforms:
Ascend
GPU
- static check_system(system: Molecule)[source]
Check if the system needs to calculate this energy term
- Parameters
system (Molecule) – System.
- convert_energy_from(unit: str)[source]
Convert energy from outside unit to inside unit.
- Parameters
unit (str) – Energy unit.
- Returns
float, energy according from a specified units.
- convert_energy_to(unit: str)[source]
Convert energy from inside unit to outside unit.
- Parameters
unit (str) – Energy unit.
- Returns
float, energy according to a specified units.
- set_input_unit(length_unit: Union[str, Units, Length])[source]
Set the length unit for the input coordinates.
- set_pbc(use_pbc: bool)[source]
Set whether to use periodic boundary condition.
- Parameters
use_pbc (bool) – Whether to use periodic boundary condition.