Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

PR

Just a small problem.

I can fix it online!

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindsponge.metrics.within_residue_violations

View Source On Gitee
mindsponge.metrics.within_residue_violations(atom14_pred_positions, atom14_atom_exists, atom14_dists_lower_bound, atom14_dists_upper_bound, tighten_bounds_for_loss, dists_mask_i)[source]

Loss to penalize steric clashes within residues. This is a loss penalizing any steric violations or clashes of non-bonded atoms in a given peptide.

Parameters
  • atom14_pred_positions (Tensor) – predicted positions of atoms in global prediction frame. shape (Nres,14,3) .

  • atom14_atom_exists (Tensor) – mask denoting whether atom at positions exists for given amino acid type. shape (Nres,14) .

  • atom14_dists_lower_bound (Tensor) – lower bond on allowed distances. shape (Nres,14,14) .

  • atom14_dists_upper_bound (Tensor) – upper bond on allowed distances. shape (Nres,14,14) .

  • tighten_bounds_for_loss (float) – Extra factor to tighten loss. Default: 0.0.

  • dists_mask_i (Tensor) – initial distants mask, shape: (14,14) .

Returns

  • per_atom_loss_sum (Tensor) - sum of all clash losses per atom, shape (Nres,14) .

  • per_atom_violations (Tensor) - violation per atom, shape (Nres,14) .

Symbol:

Nres, number of amino acids.

Supported Platforms:

Ascend GPU

Examples

>>> import mindspore as ms
>>> from mindspore import Tensor
>>> import numpy as np
>>> from mindsponge.metrics import within_residue_violations
>>> atom14_pred_positions = Tensor(np.random.random(size=(50, 14, 3)), ms.float32)
>>> atom14_atom_exists = Tensor(np.random.random(size=(50, 14)), ms.float32)
>>> atom14_dists_lower_bound = Tensor(np.random.random(size=(50, 14, 14)), ms.float32)
>>> atom14_dists_upper_bound = Tensor(np.random.random(size=(50, 14, 14)), ms.float32)
>>> tighten_bounds_for_loss = 0.0
>>> dists_mask_i = Tensor(np.eye(14, 14), ms.int32)
>>> per_atom_loss_sum, per_atom_violations = within_residue_violations(atom14_pred_positions,
...                                                                   atom14_atom_exists,
...                                                                   atom14_dists_lower_bound,
...                                                                   atom14_dists_upper_bound,
...                                                                   tighten_bounds_for_loss,
...                                                                   dists_mask_i)
>>> print(per_atom_loss_sum.shape, per_atom_violations.shape)
(50, 14) (50, 14)