neurosnap.algos.evoef2 module#

A Python implementation of the EvoEF2 protein scoring function / force field. Ported from the native EvoEF2 reference implementation. Original Implementation: tommyhuangthu/EvoEF2

Metrics (energy terms) and implications:
  • total: Weighted sum of all terms (lower is more favorable).

  • reference_*: Per-residue reference energies that encode baseline preferences.

  • intraR_vdwatt/vdwrep/electr/deslvP/deslvH: Intra-residue nonbonded interactions (packing, electrostatics, and desolvation within a residue).

  • intraR_hbscbb_*: Intra-residue hydrogen-bond geometry terms.

  • interS_*: Same-chain (non-adjacent) interactions, capturing packing, electrostatics, desolvation, disulfides, and hydrogen-bond geometries in folded structure.

  • interD_*: Different-chain interactions for complexes (interface packing, electrostatics, desolvation, disulfides, and hydrogen-bond geometries).

  • ligand_*: Protein–ligand nonbonded and hydrogen-bond terms.

  • aapropensity: Amino-acid propensity term from phi/psi bins (sequence–structure compatibility).

  • ramachandran: Ramachandran backbone conformational preference term.

  • dunbrack: Sidechain rotamer likelihood term from the Dunbrack library.

In general, more negative terms indicate more favorable interactions, while large positive repulsive terms or unfavorable conformational terms suggest strain or clashes.

Stability metric interpretation:
  • The “stability” energy corresponds to the total energy of a single structure. Lower values indicate a more favorable (more stable) fold under this force field.

  • Binding-related metrics (interface and DG_bind) are computed as differences of stability energies; negative DG_bind implies favorable binding.

class neurosnap.algos.evoef2.AAppTable(aap)[source]#

Bases: object

Amino-acid propensity table indexed by phi/psi bins.

aap: ndarray#
class neurosnap.algos.evoef2.Atom(name, param, chain, pos, res=None, xyz=<factory>, is_xyz_valid=False, is_in_hbond=False, vdw_epsilon=0.0, vdw_radius=0.0, charge=0.0, eef1_free_dg=0.0, eef1_volume=0.0, eef1_lambda=0.0, hb_h_or_a='', hb_d_or_b='', hb_b2='', hybrid='', is_bb=False, polarity='', is_h=False, is_hbond_h=False, is_hbond_a=False)[source]#

Bases: object

Atom instance with coordinates, parameters, and per-structure state.

name#

Atom name (e.g., CA, CB, O).

param#

Parameter record used for scoring.

chain#

Chain identifier for the parent residue.

pos#

Residue index within chain (0-based in this structure).

res#

Parent residue reference (for H-bond donor/base lookup).

xyz#

Cartesian coordinate in Angstrom.

is_xyz_valid#

Whether the coordinate is present or reconstructed.

is_in_hbond#

Flag used during H-bond detection to avoid double counting.

__post_init__()[source]#

Precompute invariant properties from the atom parameters.

Return type:

None

chain: str#
charge: float = 0.0#
eef1_free_dg: float = 0.0#
eef1_lambda: float = 0.0#
eef1_volume: float = 0.0#
hb_b2: str = ''#
hb_d_or_b: str = ''#
hb_h_or_a: str = ''#
hybrid: str = ''#
is_bb: bool = False#
is_h: bool = False#
is_hbond_a: bool = False#
is_hbond_h: bool = False#
is_in_hbond: bool = False#
is_xyz_valid: bool = False#
name: str#
param: AtomParam#
polarity: str = ''#
pos: int#
res: Optional[Residue] = None#
vdw_epsilon: float = 0.0#
vdw_radius: float = 0.0#
xyz: ndarray#
class neurosnap.algos.evoef2.AtomParam(name, type, is_bb, polarity, epsilon, radius, charge, hb_h_or_a, hb_d_or_b, hb_b2, hybrid, eef1_free_dg, eef1_volume, eef1_lambda)[source]#

Bases: object

Per-atom parameter record loaded from the EvoEF2 parameter library.

name#

Atom name as defined in topology.

type#

Atom type in the parameter file.

is_bb#

Whether the atom is considered backbone for scoring.

polarity#

Polarity class used in desolvation.

epsilon#

Lennard-Jones well depth (kcal/mol).

radius#

Lennard-Jones radius (Angstrom).

charge#

Partial charge (e).

hb_h_or_a#

Hydrogen-bond role flag: H (hydrogen) or A (acceptor).

hb_d_or_b#

Hydrogen-bond donor/base classification.

hb_b2#

Secondary hydrogen-bond base flag.

hybrid#

Hybridization class (e.g., sp2/sp3).

eef1_free_dg#

EEF1 free energy parameter.

eef1_volume#

EEF1 volume parameter.

eef1_lambda#

EEF1 lambda parameter.

charge: float#
eef1_free_dg: float#
eef1_lambda: float#
eef1_volume: float#
epsilon: float#
hb_b2: str#
hb_d_or_b: str#
hb_h_or_a: str#
hybrid: str#
is_bb: bool#
property is_hbond_a: bool#
property is_hbond_h: bool#
name: str#
polarity: str#
radius: float#
type: str#
class neurosnap.algos.evoef2.Bond(a, b, bond_type=1)[source]#

Bases: object

Covalent bond between two atoms inside a residue.

a: str#
b: str#
bond_type: int = 1#
class neurosnap.algos.evoef2.Chain(name, residues=<factory>, is_protein=True)[source]#

Bases: object

Chain container for residues with an is_protein flag.

is_protein: bool = True#
name: str#
residues: List[Residue]#
class neurosnap.algos.evoef2.CharmmIC(atom_a, atom_b, atom_c, atom_d, ic_param, torsion_proper)[source]#

Bases: object

CHARMM internal coordinate (IC) entry used to build missing atoms.

atom_a: str#
atom_b: str#
atom_c: str#
atom_d: str#
ic_param: List[float]#
torsion_proper: bool#
class neurosnap.algos.evoef2.DunbrackBin(by_residue=<factory>)[source]#

Bases: object

Dunbrack bin for a phi/psi region with rotamer list.

by_residue: Dict[str, List[DunbrackRotamer]]#
class neurosnap.algos.evoef2.DunbrackLibrary(bins)[source]#

Bases: object

Full Dunbrack library indexed by residue and phi/psi bins.

bins: List[DunbrackBin]#
class neurosnap.algos.evoef2.DunbrackRotamer(torsions, deviations, probability)[source]#

Bases: object

Single Dunbrack rotamer entry with chi statistics.

deviations: List[float]#
probability: float#
torsions: List[float]#
class neurosnap.algos.evoef2.RamaTable(rama)[source]#

Bases: object

Ramachandran probability table indexed by phi/psi bins.

rama: ndarray#
class neurosnap.algos.evoef2.Residue(name, chain, pos, atoms=<factory>, bonds=<factory>, patches=<factory>, phipsi=(0.0, 0.0), n_cb_in_8a=0, is_protein=True, is_nucleic=False, xtorsions=<factory>, na_torsions=<factory>)[source]#

Bases: object

Residue instance with atoms, bonds, and cached torsions/geometry.

atoms: Dict[str, Atom]#
bonds: List[Bond]#
chain: str#
get_atom(name)[source]#

Return an atom by name if present.

Return type:

Optional[Atom]

is_nucleic: bool = False#
is_protein: bool = True#
n_cb_in_8a: int = 0#
na_torsions: Dict[str, float]#
name: str#
patches: List[str]#
phipsi: Tuple[float, float] = (0.0, 0.0)#
pos: int#
xtorsions: List[float]#
class neurosnap.algos.evoef2.ResidueTopology(name, atoms=<factory>, deletes=<factory>, bonds=<factory>, ics=<factory>)[source]#

Bases: object

Residue topology template with atoms, bonds, and ICs from library.

atoms: List[str]#
bonds: List[Bond]#
deletes: List[str]#
ics: List[CharmmIC]#
name: str#
class neurosnap.algos.evoef2.Structure(chains=<factory>)[source]#

Bases: object

Structure container holding all chains.

all_residues()[source]#

Iterate over all residues across all chains.

Return type:

Iterable[Residue]

chains: List[Chain]#
neurosnap.algos.evoef2.calculate_binding(structure, split1, split2, *, param_path=None, topo_path=None, weight_dict=None, aapropensity_path=None, ramachandran_path=None, dunbrack_path=None)[source]#

Compute interface energy and DG_bind for two chain groups.

Parameters:
  • structure (Union[Protein, str, Path]) – Protein object or PDB/mmCIF path.

  • split1 (Sequence[str]) – Chain IDs for group 1.

  • split2 (Sequence[str]) – Chain IDs for group 2.

  • param_path (Optional[Path]) – Optional parameter file override.

  • topo_path (Optional[Path]) – Optional topology file override.

  • weight_dict (Optional[Dict[str, float]]) – Weights dictionary to use.

  • aapropensity_path (Optional[Path]) – Optional AA propensity table override.

  • ramachandran_path (Optional[Path]) – Optional Ramachandran table override.

  • dunbrack_path (Optional[Path]) – Optional Dunbrack library override.

Return type:

Dict[str, Dict[str, float]]

Returns:

Dict with interface energy, complex stability, split stabilities, and DG_bind.

neurosnap.algos.evoef2.calculate_interface_energy(structure, split1, split2, *, param_path=None, topo_path=None, weight_dict=None)[source]#

Compute interface energy between two chain groups.

Parameters:
Return type:

Dict[str, float]

Returns:

Dict of weighted inter-chain energy terms plus the total.

neurosnap.algos.evoef2.calculate_stability(structure, *, param_path=None, topo_path=None, weight_dict=None, aapropensity_path=None, ramachandran_path=None, dunbrack_path=None)[source]#

Compute EvoEF2 stability energy for a structure.

Parameters:
  • structure (Union[Protein, str, Path]) – Protein object or PDB/mmCIF path.

  • param_path (Optional[Path]) – Optional parameter file override.

  • topo_path (Optional[Path]) – Optional topology file override.

  • weight_dict (Optional[Dict[str, float]]) – Weights dictionary to use.

  • aapropensity_path (Optional[Path]) – Optional AA propensity table override.

  • ramachandran_path (Optional[Path]) – Optional Ramachandran table override.

  • dunbrack_path (Optional[Path]) – Optional Dunbrack library override.

Return type:

Dict[str, float]

Returns:

Dict of all weighted energy terms plus the total.

neurosnap.algos.evoef2.load_aapropensity(path=None)[source]#

Load amino-acid propensity table for phi/psi bins.

Parameters:

path (Optional[Path]) – Optional explicit path to the table file.

Return type:

AAppTable

Returns:

AAppTable instance with a [36, 36, 20] tensor.

neurosnap.algos.evoef2.load_atom_params(param_path=None)[source]#

Load atom parameters from the EvoEF2 CHARMM19+LK parameter file.

Parameters:

param_path (Optional[Path]) – Optional explicit path to the parameter file.

Return type:

Dict[str, Dict[str, AtomParam]]

Returns:

Mapping of residue name to atom name to AtomParam.

neurosnap.algos.evoef2.load_dunbrack(path=None)[source]#

Load Dunbrack rotamer library from the EvoEF2 distribution.

Parameters:

path (Optional[Path]) – Optional explicit path to the Dunbrack library file.

Return type:

DunbrackLibrary

Returns:

DunbrackLibrary with bins indexed by phi/psi.

neurosnap.algos.evoef2.load_ramachandran(path=None)[source]#

Load Ramachandran probability table for phi/psi bins.

Parameters:

path (Optional[Path]) – Optional explicit path to the table file.

Return type:

RamaTable

Returns:

RamaTable instance with a [36, 36, 20] tensor.

neurosnap.algos.evoef2.load_topology(top_path=None)[source]#

Load CHARMM topology definitions for residues and patches.

Parameters:

top_path (Optional[Path]) – Optional explicit path to the topology file.

Return type:

Dict[str, ResidueTopology]

Returns:

Mapping of residue/patch name to topology template.

neurosnap.algos.evoef2.rebuild_missing_atoms(structure, *, param_path=None, topo_path=None)[source]#

Rebuild missing heavy atoms and hydrogens using EvoEF2 topology.

Parameters:
  • structure (Union[Protein, str, Path]) – Protein object, Structure, or PDB/mmCIF path.

  • param_path (Optional[Path]) – Optional parameter file override.

  • topo_path (Optional[Path]) – Optional topology file override.

Return type:

Structure

Returns:

Structure with missing atoms reconstructed where possible.