src.environment.problem.SOO.PROTEIN_DOCKING.protein_docking¶
Module Contents¶
Classes¶
Introduction¶Protein-Docking benchmark, where the objective is to minimize the Gibbs free energy resulting from protein-protein interaction between a given complex and any other conformation. We select 28 protein complexes and randomly initialize 10 starting points for each complex, resulting in 280 problem instances. To simplify the problem structure, we only optimize 12 interaction points in a complex instance (12D problem). |
|
Introduction¶Represents a protein docking optimization problem using PyTorch tensors, enabling the evaluation of protein conformations based on atomic coordinates, interaction matrices, and physical potentials. This class supports both single and batch evaluations, and is designed for use in single-objective optimization (SOO) settings. |
API¶
- class src.environment.problem.SOO.PROTEIN_DOCKING.protein_docking.Protein_Docking_Numpy_Problem(coor_init, q, e, r, basis, eigval, problem_id)[source]¶
Bases:
src.environment.problem.basic_problem.Basic_ProblemIntroduction¶
Protein-Docking benchmark, where the objective is to minimize the Gibbs free energy resulting from protein-protein interaction between a given complex and any other conformation. We select 28 protein complexes and randomly initialize 10 starting points for each complex, resulting in 280 problem instances. To simplify the problem structure, we only optimize 12 interaction points in a complex instance (12D problem).
Original paper¶
“Protein–protein docking benchmark version 4.0.” Proteins: Structure, Function, and Bioinformatics 78.15 (2010): 3111-3114.
Official Implementation¶
License¶
None
Initialization
Introduction¶
Initializes the protein docking problem instance with the provided parameters.
Args:¶
coor_init (np.ndarray): Initial coordinates of atoms, shape [n_atoms, 3].
q (np.ndarray): Charge matrix, shape [n_atoms, n_atoms].
e (np.ndarray): Epsilon matrix, shape [n_atoms, n_atoms].
r (np.ndarray): Distance matrix, shape [n_atoms, n_atoms].
basis (np.ndarray): Basis vectors, shape [dim, 3*n_atoms].
eigval (np.ndarray): Eigenvalues, shape [dim].
problem_id (Any): Identifier for the problem instance.
Attributes:¶
optimum (Any or None): The optimum value, initially set to None as it is unknown.
- __str__()[source]¶
Introduction¶
Returns a string representation of the object, specifically its
problem_id.Returns:¶
str: The
problem_idattribute of the object.
- func(x)[source]¶
Introduction¶
Computes the energy of a protein docking configuration based on atomic coordinates and pairwise interactions. This function transforms the input coordinates, computes pairwise distances between atoms, applies interaction coefficients, and calculates the mean energy for each configuration in the batch.
Args:¶
x (np.ndarray): Input array of shape [NP, 3 * n_atoms], representing the coordinates for NP configurations.
Built-in Attribute:¶
self.eigval (np.ndarray): Eigenvalues used for coordinate transformation.
self.basis (np.ndarray): Basis matrix for coordinate transformation.
self.n_atoms (int): Number of atoms in the protein.
self.coor_init (np.ndarray): Initial coordinates of the atoms.
self.q (float): Charge-related coefficient for interaction energy.
self.e (float): Energy scaling factor.
self.r (float): Distance scaling factor.
Returns:¶
np.ndarray: Array of shape [NP], containing the computed energy for each configuration.
Raises:¶
ValueError: If input shapes are incompatible or required attributes are missing.
- class src.environment.problem.SOO.PROTEIN_DOCKING.protein_docking.Protein_Docking_Torch_Problem(coor_init, q, e, r, basis, eigval, problem_id)[source]¶
Bases:
src.environment.problem.basic_problem.Basic_Problem_TorchIntroduction¶
Represents a protein docking optimization problem using PyTorch tensors, enabling the evaluation of protein conformations based on atomic coordinates, interaction matrices, and physical potentials. This class supports both single and batch evaluations, and is designed for use in single-objective optimization (SOO) settings.
Original paper¶
Official Implementation¶
License¶
None
Initialization
Introduction¶
Initializes the protein docking problem instance with atomic coordinates, interaction matrices, basis, eigenvalues, and problem identifier.
Attributes:¶
coor_init (torch.Tensor): Tensor of initial atomic coordinates.
q (torch.Tensor): Tensor of atomic charges or related property.
e (torch.Tensor): Tensor of interaction energies or related property.
r (torch.Tensor): Tensor of distances or related property.
basis (torch.Tensor): Tensor of basis vectors.
eigval (torch.Tensor): Tensor of eigenvalues.
problem_id (Any): Problem identifier.
optimum (None): Placeholder for the optimum value, initially set to None.
- __str__()[source]¶
Returns a string representation of the protein docking problem instance.
Returns:¶
str: The unique identifier (`problem_id`) of the problem instance.
- eval(x)[source]¶
Introduction¶
Evaluates the objective function for a given individual or population, supporting both single and batch evaluations. Tracks and accumulates the evaluation time in milliseconds.
Args:¶
x (array-like or torch.Tensor): The input(s) to be evaluated. Can be a 1D array/tensor (single individual) or 2D array/tensor (population).
Built-in Attribute:¶
self.T1 (float): Accumulates the total evaluation time in milliseconds.
Returns:¶
torch.Tensor or float: The evaluation result(s) from the objective function. Returns a scalar for a single individual or a tensor for a population.
Raises:¶
None explicitly. Assumes
self.funchandles input shape and type errors.
- func(x)[source]¶
Introduction¶
Computes the energy of a protein conformation based on atomic coordinates, pairwise distances, and interaction coefficients. The function transforms the input coordinates, calculates pairwise distances, applies interaction masks, and computes the total energy using a combination of electrostatic and Lennard-Jones-like potentials.
Args:¶
x (torch.Tensor): Input tensor of shape [NP, 3 * n_atoms], representing the coordinates in the transformed basis.
Built-in Attribute:¶
self.eigval (torch.Tensor): Eigenvalues used for scaling the input coordinates.
self.basis (torch.Tensor): Basis matrix for coordinate transformation.
self.n_atoms (int): Number of atoms in the protein.
self.coor_init (torch.Tensor): Initial coordinates of the atoms.
self.q (float or torch.Tensor): Charge parameter for electrostatic interaction.
self.e (float or torch.Tensor): Epsilon parameter for Lennard-Jones potential.
self.r (float or torch.Tensor): Sigma parameter for Lennard-Jones potential.
Returns:¶
torch.Tensor: Tensor of shape [NP], containing the computed energy for each input conformation.
Raises:¶
None