derivatives module

Full Documentation for hippynn.layers.physics.derivatives module. Click here for a summary page.

Layers for physical operations

class CellScaleInducer(*args, **kwargs)[source]

Bases: Module

forward(coordinates, cell)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class Gradient(sign)[source]

Bases: Module

forward(molecular_energies, positions)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class HVP(*args: Any, **kwargs: Any)[source]

Bases: Module

forward(force, coordinates, vector, padding_mask)[source]

source: (B, N_max, 3) force tensor coordinates: (B, N_max, 3), requires_grad=True vector: (B, N_max, 3), perturbation direction padding_mask: (B, N_max, 3), HVP padding mask with 3N non-zero elements Returns: (B, N_max, 3), Hessian-vector product

class HVPVector(vector_type='random')[source]

Bases: Module

forward(positions, nonblank)[source]

positions: (B, N_max, 3) nonblank: (B, N_max, 3), boolean mask Returns: (B, N_max, 3) vector (zeroed on padded atoms)

class Hessian[source]

Bases: Module

static expand_padding_mask_to_hessian_mask(padding_mask)[source]

Expand a (B, N) atom mask to a (B, 3N, 3N) Hessian mask.

Parameters:

padding_mask: Boolean tensor of shape (B, N_max)

Returns:

Boolean tensor of shape (B, 3N_max, 3N_max)

forward(source, positions, padding_mask)[source]

Computes the Hessian using second derivatives of energy or first derivatives of forces. Assumes:

  • source: either energy (B, 1) or forces (B, N_max, 3)

  • positions: (B, N_max, 3)

Returns:
  • hessians: (B, 3N_max, 3N_max)

class MultiGradient(signs)[source]

Bases: Module

forward(molecular_energies: Tensor, *generalized_coordinates: Tensor)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class StressForce(*args, **kwargs)[source]

Bases: Module

forward(energy, strain, coordinates, cell)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class TrueHVP(*args: Any, **kwargs: Any)[source]

Bases: Module

forward(hessian, vector)[source]

hessian: (B, 3N_max, 3N_max) vector: (B, N_max, 3) Returns: (B, N_max, 3)