model openff.nagl.features.Feature[source]

Abstract base class for atom and bond features.

Features with length one can simply inherit AtomFeature or BondFeature, implement _encode, and define name. Complex features should additionally define the _feature_length class attribute and set it to the length of the feature.

  • name (Literal[''])

field name: Literal[''] [Required]

Define a name for the feature

encode(molecule: Molecule) Tensor[source]

Encode the molecule feature into a tensor.

The output of this method must have shape tensor_shape. Subclasses may instead implement a _encode method with the same signature as this one. The default implementation of this method will call that one and guarantee an appropriate shape.

property tensor_shape

Return the shape of the feature tensor.