> ## Documentation Index
> Fetch the complete documentation index at: https://proto.evodesign.org/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# PyRosetta Energy

> Penalize high Rosetta total energy per residue of one chain of an attached structure

![PyRosetta Energy](https://proto-bio.github.io/proto-assets/images/constraint/pyrosetta-energy/hero.png)

> [!NOTE]
>
> **License:** PyRosetta is licensed under Custom (PyRosetta Software License) and has restrictions around commercial use and may require explicit attribution when utilized. Please refer to [the license](https://www.pyrosetta.org/home/licensing-pyrosetta) for full terms.

This constraint is open source. Any third-party models, product names, or trademarks referenced are the property of their respective owners, and Proto is not affiliated with them.

***

&#x20;Tools Used Tools Used  Source Source  Cite Cite

![](https://proto-bio.github.io/proto-assets/images/tool/pyrosetta/social.png)

&#x20;Go to Tool Page

[Open](https://proto.evodesign.org/docs/tools/structure-scoring/pyrosetta.md)

![Proto](https://mintcdn.com/bio-pro/cMLt8hAqaP9M3LKy/assets/logo/logo-light.svg?fit=max\&auto=format\&n=cMLt8hAqaP9M3LKy\&q=85\&s=f5e5dfd1b8f9b9db3a0be0e2eb01f678)

evo-design/proto-language

&#x20;View source

[Open](https://github.com/evo-design/proto-language/blob/1a97e675c7e5e4ae0e92be91b1bb7b49f1331104/proto_language/constraint/protein_structure/structure_developability_constraint.py#L361)

@articlechaudhury2010pyrosetta

```bibtex theme={null}
@article{chaudhury2010pyrosetta,
  title={PyRosetta: a script-based interface for implementing molecular modeling algorithms using Rosetta},
  author={Chaudhury, Sidhartha and Lyskov, Sergey and Gray, Jeffrey J},
  journal={Bioinformatics},
  volume={26},
  number={5},
  pages={689--691},
  year={2010},
  publisher={Oxford University Press},
  doi={10.1093/bioinformatics/btq007}
}
```

&#x20;Copy citation

Constraint contributors[![](https://avatars.githubusercontent.com/u/61667248?v=4\&s=64)adititm](https://github.com/adititm)[![](https://avatars.githubusercontent.com/u/21143637?v=4\&s=64)bviggiano](https://github.com/bviggiano)
Score one chain's Rosetta total energy per residue (lower is more favourable).

`chain` is cut out of the attached structure (`Structure.select_chain`) and scored
alone, so other chains add no energy. With `e` the total energy divided by the number of
scored residues, the score is `clip((e - desired_energy_per_residue) / tolerance, 0, 1)`.

## API Reference

ConfigPyRosettaEnergyConstraintConfig[ Source](https://github.com/evo-design/proto-language/blob/1a97e675c7e5e4ae0e92be91b1bb7b49f1331104/proto_language/constraint/protein_structure/structure_developability_constraint.py#L301)

Config for the PyRosetta total-energy constraint.

Energies are in Rosetta Energy Units (REU), lower is better. `total_energy` grows with
chain length, so the constraint scores it per residue. Values depend on the score function
and on whether the structure was relaxed, so tune the thresholds per design setup.
Unlike the bare `pyrosetta-energy` tool, the constraint runs FastRelax before scoring by
default: attached structures are predicted, and the proto-tools README recommends relaxing raw
predicted structures because their steric clashes can dominate the energy. FastRelax moves
torsions, so it repairs clashes and side-chain strain but not distorted bond lengths or angles:
a structure with distorted covalent geometry keeps a high energy after relaxing.

**chain** `string`

Chain to score in the attached structure; None uses the chain matching the input.

**desired\_energy\_per\_residue** `number` (default: -2.5)

Energy per residue (REU) at or below which the score is 0.

**tolerance** `number` (default: 2.0)

REU per residue above the desired value at which the score reaches 1.

**pyrosetta\_config** `PyRosettaEnergyConfig`

Default relaxes first; a passed config is used as given. FastRelax uses relax\_config.scorefxn.

ReturnsConstraintOutput

Per-proposal score in `[0, 1]` with `pyrosetta_total_energy` /
`pyrosetta_energy_per_residue` / `pyrosetta_energy_terms` / `pyrosetta_energy_chain` metadata.

## Usage

```python python icon="python" theme={null}
>>> from proto_language.core import Constraint, Segment
>>> protein = Segment(length=80, sequence_type="protein")
>>> energy = Constraint(
...     inputs=[protein],
...     function=pyrosetta_energy_constraint,
...     function_config={"desired_energy_per_residue": -3.0, "tolerance": 1.5},
... )
```

## Metadata

| Property | Value |
| - | - |
| Key | `pyrosetta-energy` |
| Function | `pyrosetta_energy_constraint` |
| Category | `protein_structure` |
| Mode | `discrete` |
| Uses GPU | `False` |
| Supported Types | `protein` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.