> ## Documentation Index
> Fetch the complete documentation index at: https://bagel.softnanolab.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GlobularEnergy

> Energy proportional to the moment of inertia of the structure around its centroid. This energy is minimized when the atoms belonging to a structure have the lowest possible distance from the centre, and, due to excluded volume effects that prevent collapse to a single point, helps forcing structures to be as close as possible to a spherically distributed cloud of points.

## Definition

The globular energy is the standard deviation of backbone atom distances from the group centroid, promoting spherical compactness.

$$
E_{\mathrm{glob}} = \mathrm{std}\left(\| \mathbf{x}_a - \mathbf{c} \|\right)_{a \in G}
$$

* $\mathbf{x}_a$ are backbone atom positions
* $\mathbf{c}$ is the centroid of the backbone atoms in the group
* $\mathrm{std}$ is the standard deviation over all backbone atoms in the group $G$

## Parameters

<ResponseField name="oracle" type="Oracle" required>
  The oracle to use for the energy term.
</ResponseField>

<ResponseField name="residues" type="list[Residue] | None" default="None">
  Which residues to include in the calculation. Considers all residues by default.
</ResponseField>

<ResponseField name="inheritable" type="bool" default="True">
  If a new residue is added next to a residue included in this energy term, this dictates whether that new residue could then be added to this energy term.
</ResponseField>

<ResponseField name="weight" type="float" default="1.0">
  The weight of the energy term.
</ResponseField>

<ResponseField name="name" type="str | None" default="None">
  Optional name to append to the energy term name.
</ResponseField>

## Methods

### compute

**Parameters**

<ResponseField name="oracles_result" type="OraclesResultDict" required />

## Example

```python theme={null}
import bagel as bg

# Create the folding oracle
esmfold = bg.oracles.ESMFold()

# Drive the structure toward a compact, spherical shape
globular = bg.energies.GlobularEnergy(
    oracle=esmfold,
    residues=residues,
    weight=1.0,
)

# Add to a state
state = bg.State(
    chains=[chain],
    energy_terms=[globular],
    name="my_state",
)
```
