sponge.core.RunOneStepCell

View Source On Gitee
class sponge.core.RunOneStepCell(energy: WithEnergyCell = None, force: WithForceCell = None, optimizer: Optimizer = None, steps: int = 1, sens: float = 1.0, **kwargs)[source]

Cell to run one step simulation. This Cell wraps the energy and force with the optimizer. The backward graph will be created in the construct function to update the atomic coordinates of the simulation system.

Parameters
  • energy (WithEnergyCell) – Cell that wraps the simulation system with the potential energy function. Defatul: None

  • force (WithForceCell) – Cell that wraps the simulation system with the atomic force function. Defatul: None

  • optimizer (Optimizer) – Optimizer for simulation. Defatul: None

  • steps (int) – Steps for JIT. Default: 1

  • sens (float) – The scaling number to be filled as the input of backpropagation. Default: 1.0

  • kwargs (dict) – other args

Inputs:
  • *inputs (Tuple(Tensor)) - Tuple of input tensors of WithEnergyCell.

Outputs:
  • energy, Tensor of shape (B, 1). Data type is float. Total potential energy.

  • force, Tensor of shape (B, A, D). Data type is float. Atomic force.

Note

B: Batchsize, i.e. number of walkers of the simulation. A: Number of the atoms in the simulation system. D: Spatial dimension of the simulation system. Usually is 3.

Supported Platforms:

Ascend GPU

property bias: mindspore.common.tensor.Tensor

Tensor of the total bias potential.

Returns

Tensor, Tensor of shape (B, 1). Data type is float.

property bias_function: mindspore.nn.cell.Cell

Cell of bias potential function.

Returns

Cell, bias potential function.

property bias_names: List[str]

name of bias potential energies.

Returns

list[str], the bias potential energies.

property biases: mindspore.common.tensor.Tensor

Tensor of bias potential components.

Returns

Tensor, Tensor of shape (B, V). Data type is float.

property energies: mindspore.common.tensor.Tensor

Tensor of potential energy components.

Returns

Tensor, Tensor of shape (B, U). Data type is float.

property energy_cutoff: mindspore.common.tensor.Tensor

cutoff distance for neighbour list in WithEnergyCell.

Returns

Tensor, cutoff distance for neighbour list in WithEnergyCell.

property energy_names

names of energy terms.

Returns

list[str], names of energy terms.

property energy_unit: str

energy unit.

Returns

str, energy unit.

property force_cutoff: mindspore.common.tensor.Tensor

cutoff distance for neighbour list in WithForceCell.

Returns

Tensor, cutoff distance for neighbour list in WithForceCell.

property length_unit: str

length unit.

Returns

str, length unit.

property neighbour_list_pace: int

update step for neighbour list.

Returns

int, the number of steps needed for neighbour list updating.

property num_biases: int

number of bias potential energies \(V\).

Returns

int, number of bias potential energies.

property num_energies: int

number of energy terms \(U\).

Returns

int, number of energy terms.

set_pbc_grad(value: bool)[source]

set whether to calculate the gradient of PBC box.

Parameters

value (bool) – Flag to judge whether to calculate the gradient of PBC box.

set_steps(steps: int)[source]

set steps for JIT.

Parameters

steps (int) – Simulation step for JIT.

update_bias(step: int)[source]

update bias potential.

Parameters

step (int) – Simulation step to update bias potential.

update_modifier(step: int)[source]

update force modifier.

Parameters

step (int) – Simulation step to update force modifier.

update_neighbour_list()[source]

update neighbour list.

update_wrapper(step: int)[source]

update energy wrapper.

Parameters

step (int) – Simulation step to update energy wrapper.