MolecularDiffusion.modules.models.syncogen.diffusion.loss.bond_length

Bond length preservation loss operating on Coordinates objects.

Classes

BondLengthLoss

Bond length preservation loss computed from attached bonds.

Module Contents

class MolecularDiffusion.modules.models.syncogen.diffusion.loss.bond_length.BondLengthLoss(sqrd: bool = False, coef: float = 1.0, time_weighted: bool = False, square_time_weight: bool = False, t_threshold: float = None)

Bases: MolecularDiffusion.modules.models.syncogen.diffusion.loss.base.LossBase

Bond length preservation loss computed from attached bonds.

Expects pred and target as Coordinates. Assumes bonds (B, M, 3) and bonds_mask (B, M) are attached to either pred or target Coordinates. Uses LossBase.coef for weighting.

compute_loss(pred, target) torch.Tensor

Base per-graph bond-length loss (no time weighting or coef).

forward(pred, target, t: torch.Tensor = None) torch.Tensor

Compute loss -> optional time weight -> threshold -> coef.

sqrd = False