physics module

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

Layers for physical operations

class AlphaScreening(alpha)[source]

Bases: Module

class CombineEnergy[source]

Bases: Module

Combines the energies (molecular and atom energies) from two different nodes, e.g. HEnergy, Coulomb, or ScreenedCoulomb Energy Nodes.

forward(atom_energy_1, atom_energy_2, mol_index, n_molecules)[source]
Param:

atom_energy_1 per-atom energy from first node.

Param:

atom_energy_2 per atom energy from second node.

Param:

mol_index the molecular index for atoms in the batch

Param:

total number of molecules in the batch

Returns:

Total Energy

class CombineScreenings(screening_list)[source]

Bases: Module

Returns products of different screenings for Screened Coulomb Interactions.

forward(pair_dist, radius)[source]

Product of different screenings applied to pair_dist upto radius.

Parameters:
  • pair_dist – torch.tensor, dtype=float64: ‘Neighborlist’ distances for coulomb energies.

  • radius – Maximum radius that Screened-Coulomb is evaluated upto.

Return screening:

Weights for screening for all pair_dist.

class CoulombEnergy(energy_conversion_factor)[source]

Bases: Module

Computes the Coulomb Energy of the molecule/configuration.

Coulomb energies is defined for pairs of atoms. Here, we adopt the convention that the Coulomby energy for a pair of atoms is evenly partitioned to both atoms as the ‘per-atom energies’. Therefore, the atom energies sum to the molecular energy; similar to the HEnergy.

forward(charges, pair_dist, pair_first, pair_second, mol_index, n_molecules)[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 Dipole[source]

Bases: Module

forward(charges: Tensor, positions: Tensor, mol_index: Tensor, n_molecules: int)[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 EwaldRealSpaceScreening(alpha)[source]

Bases: AlphaScreening

forward(pair_dist, radius)[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 LocalDampingCosine(alpha)[source]

Bases: AlphaScreening

Local damping using complement of the hipnn cutoff function. (‘glue-on’ method) g = 1 if pair_dist > R_cutoff, 1 - [cos(pi/2 * dist * R_cutoff)]^2 otherwise

forward(pair_dist, radius)[source]
Parameters:
  • pair_dist – torch.tensor, dtype=float64: ‘Neighborlist’ distances for coulomb energies.

  • radius – Maximum radius that Screened-Coulomb is evaluated upto.

Return screening:

Weights for screening for each pair.

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 PerAtom(*args, **kwargs)[source]

Bases: Module

forward(features, species)[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 QScreening(p_value)[source]

Bases: Module

forward(pair_dist, radius)[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.

property p_value
class Quadrupole(**kwargs)[source]

Bases: Module

Computes quadrupoles as a flattened (n_molecules,9) array. NOTE: Uses normalization sum_a q_a (r_a,i*r_a,j - 1/3 delta_ij r_a^2)

forward(charges, positions, mol_index, n_molecules)[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 ScreenedCoulombEnergy(energy_conversion_factor, screening, radius=None)[source]

Bases: CoulombEnergy

Computes the Coulomb Energy of the molecule/configuration.

The convention for the atom energies is the same as CoulombEnergy and the HEnergy.

forward(charges, pair_dist, pair_first, pair_second, mol_index, n_molecules)[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 VecMag(*args, **kwargs)[source]

Bases: Module

forward(vector_feature)[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 WolfScreening(alpha)[source]

Bases: AlphaScreening

forward(pair_dist, radius)[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.