Scoring
This module consists of several built in scoring functions as well as helper functions to setup scoring. In addition to the built in scoring functions, users can also define their own scoring functions. The only requirements are that the scoring function accepts a RotamerEnsemble or SpinLabel object and outputs an energy score for each rotamer in the ensemble. The energy score should be in kcal/mol.
- get_lj_energy(r, rmin, eps, forgive=1, cap=10, rmax=10)[source]
Return a vector with the energy values for the flat bottom lennard-jones potential from a set of atom pairs with distance
r, rmin values ofrminand epsilon values ofeps.- Parameters:
r (numpy.ndarray) – Vector of inter-atomic distances between non-bonded atoms of a system.
rmin (numpy.ndarray) – Vector of rmin parameters, in angstroms, corresponding to atoms pairs of
r.eps (numpy.ndarray) – Vector of epsilon parameters corresponding to atom pairs of
rforgive (numpy.ndarray) – The
forgivefactor is a softening term to mitigate rigid body artifacts. It is set to a value between 0 and 1 and modifies therminparameter of all atom pairs inrto be the fraction,forgiveof the original value. This allows atoms to be closer than otherwise allowed to prevent explosion of the Lennard-jones repulsion in situations that would otherwise be resolved with minor atomic displacements.cap (float) – Maximum allowed energy factor. Sets a cap on the maximum energy contribution of one atom pair interaction as another mechanism for softening.
capis sets the actual max value as a multiple of theepsparameter. i.e. the maximum allowed energy from a single atom pair interaction is theepsparameter multiplied bycap.rmax (float) – Maximum distance to consider for potential calculation. Any atom pairs with
r>rmaxwill be set to 0.
- Returns:
lj_energy – Vector of atom pair energies calculated using the modified lj potential function.
- Return type:
numpy.ndarray
- get_lj_scwrl(r, rmin, eps, forgive=1)[source]
Calculate a scwrl-like lennard-jones potential from a set of atom pairs with distance
r, rmin values ofrminand epsilon values ofeps.- Parameters:
r (numpy.ndarray) – Vector of inter-atomic distances between non-bonded atoms of a system.
rmin (numpy.ndarray) – Vector of rmin parameters, in angstroms, corresponding to atoms pairs of
r.eps (numpy.ndarray) – Vector of epsilon parameters corresponding to atom pairs of
r.forgive (numpy.ndarray) – The
forgivefactor is a softening term to mitigate rigid body artifacts. It is set to a value between 0 and 1 and modifies therminparameter of all atom pairs inrto be the fraction,forgiveof the original value. This allows atoms to be closer than otherwise allowed to prevent explosion of the Lennard-jones repulsion in situations that would otherwise be resolved with minor atomic displacements.
- Returns:
lj_energy – Vector of atom pair energies calculated using the modified lj potential function.
- Return type:
numpy.ndarray
- get_lj_rep(r, rmin, eps, forgive=0.9, cap=10)[source]
Calculate only the repulsive terms of the lennard-jones potential from a set of atom pairs with distance
r, rmin values ofrminand epsilon values ofeps.- Parameters:
r (numpy.ndarray) – Vector of inter-atomic distances between non-bonded atoms of a system.
rmin (numpy.ndarray) – Vector of
rminparameters, in angstroms, corresponding to atoms pairs ofr.eps (numpy.ndarray) – Vector of epsilon parameters corresponding to atom pairs of
r.forgive (numpy.ndarray) – The
forgivefactor is a softening term to mitigate rigid body artifacts. It is set to a value between 0 and 1 and modifies therminparameter of all atom pairs inrto be the fraction,forgiveof the original value. This allows atoms to be closer than otherwise allowed to prevent explosion of the Lennard-jones repulsion in situations that would otherwise be resolved with minor atomic displacements.cap (float) – Maximum allowed energy factor. Sets a cap on the maximum energy contribution of one atom pair interaction as another mechanism for softening.
capis sets the actual max value as a multiple of theepsparameter. i.e. the maximum allowed energy from a single atom pair interaction is theepsparameter multiplied bycap.
- Returns:
lj_energy – Vector of atom pair energies calculated using the modified lj potential function.
- Return type:
numpy.ndarray
- get_lj_attr(r, rmin, eps, forgive=0.9, floor=-2)[source]
Calculate only the attractive terms of the lennard-jones potential from a set of atom pairs with distance
r,rminvalues of rmin and epsilon values of eps.- Parameters:
r (numpy.ndarray) – Vector of inter-atomic distances between non-bonded atoms of a system.
rmin (numpy.ndarray) – Vector of rmin parameters, in angstroms, corresponding to atoms pairs of
r.eps (numpy.ndarray) – Vector of epsilon parameters corresponding to atom pairs of
rforgive (numpy.ndarray) – The forgive factor is a softening term to mitigate rigid body artifacts. It is set to a value between 0 and 1 and modifies the
rminparameter of all atom pairs inrto be the fraction,forgiveof the original value. This allows atoms to be closer than otherwise allowed to prevent explosion of the Lennard-jones repulsion in situations that would otherwise be resolved with minor atomic displacements.cap (flaat) – Maximum allowed energy factor. Sets a cap on the maximum energy contribution of one atom pair interaction as another mechanism for softening.
capis sets the actual max value as a multiple of theepsparameter. i.e. the maximum allowed energy from a single atom pair interaction is theepsparameter multiplied bycap.
- Returns:
lj_energy – Vector of atom pair energies calculated using the modified lj potential function.
- Return type:
numpy.ndarray
- reweight_rotamers(energies, temp, weights)[source]
Adjust rotamer population weights based on external energies (from clash evaluations).
- Parameters:
energies (numpy.ndarray) – Array of external energies, in kcal/mol
temp (scalar) – Temperature, in kelvin
weights (numpy.ndarray) – Current weights of rotamers
return_partition (bool) – If True, return the value of the partition function an additional argument; see below
- Returns:
new_weights (numpy.ndarray) – Adjusted weights
partition (float (optional)) – The partition function relative to the free label. A small partition function suggests the interactions with neighboring atoms are unfavorable while a large partition function suggests the opposite.
- join_geom(a, b, flat=False)[source]
Function to join Lennard-Jones parameters (
rminoreps) using their geometric mean. Parameters can be joined in two different ways (see keyword argumentflat)- Parameters:
a (numpy.ndarray) – Single atom parameters of atoms of group a
b (numpy.ndarray) – Single atom parameters of atoms of group b
flat (bool) – Only join parameters i of group a and j of group b if i=j. If false all combinations of i,j are computed.
- Returns:
param – The joined parameters of group a and b
- Return type:
numpy.ndarray
- join_arith(a, b, flat=False)[source]
Function to join Lennard-Jones parameters (
rminoreps) using their arithmatic mean. Parameters can be joined in two different ways (see keyword argumentflat)- Parameters:
a (numpy.ndarray) – Single atom parameters of atoms of group a
b (numpy.ndarray) – Single atom parameters of atoms of group b
flat (bool) – Only join parameters i of group a and j of group b if i=j. If false all combinations of i,j are computed.
- Returns:
param – The joined parameters of group a and b
- Return type:
numpy.ndarray