quantity.property_prediction.potential_energy_prediction

quantity.property_prediction.potential_energy_prediction#

potential_energy_prediction(model=None, feature_number=0)[source]#

Initializes a prediction of the potential energy.

This wrapper allows to use the same features for the prediction of the potential energy for a simulation and for other molecular properties.

Parameters:
  • model (PropertyPredictor) – Particle property prediction model.

  • feature_number (int) – Number of the global features to interpret as potential energy.

Example:

init_property_predictor, property_predictor = neural_networks.dimenetpp_property_prediction(
    r_cutoff = 1.0, n_targets = 2, n_species = 2, n_per_atom = 0)

# Initialize the prediction of potential energy (the first global property)
potential_energy_predictor = property_prediction.potential_energy_prediction(
    model=property_predictor, feature_number=0
)

# Initialize a function to compute the potential energy for a simulator
# snapshot. The snapshot function first constructs a molecular graph
# from a provided neighbor list.
energy_snapshot_fn = property_prediction.snapshot_quantity(
    potential_energy_predictor, graph_from_neighbor_list
)

# The snapshot function can be used as learnable model or as
# compute function for traj_util.quantity_traj
def energy_fn_template(energy_params):
    def energy_fn(position, neighbor=None, **kwargs):
        # Wrap positions in pseudo simulator state
        state = force_matching.State(position)
        return energy_snapshot_fn(position, neighbor, energy_params=energy_params)
    return energy_fn
Return type:

SinglePropertyPredictor

Returns:

Returns a function to predict the potential energy from a molecular graph.