Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to prevent collapse when desining symmetric assembly #61

Open
chiarinival opened this issue Jan 23, 2025 · 2 comments
Open

how to prevent collapse when desining symmetric assembly #61

chiarinival opened this issue Jan 23, 2025 · 2 comments

Comments

@chiarinival
Copy link

chiarinival commented Jan 23, 2025

Hi and congratulation for the chroma software!!!

I have been trying to use chroma to produce icosahedral assemblies made of heterodimer units, but in most of the cases, all chains are collapsed in a molten-globule like fashion (see attached picture).

I have been using this code as a backbone:

chroma = Chroma()

icosahedral_symmetry = conditioners.SymmetryConditioner(G="I", num_chain_neighbors=5)

composed_cond = conditioners.ComposedConditioner([icosahedral_symmetry])

heterodimer_chain_lengths = [100, 100]
num_structures = 10

for i in range(num_structures):
symm_icosahedral = chroma.sample(chain_lengths=heterodimer_chain_lengths,
conditioner=composed_cond,
langevin_factor=12,
inverse_temperature=8,
sde_func="langevin",
potts_symmetry_order=icosahedral_symmetry.potts_symmetry_order)
print(symm_icosahedral)
output_filename = f"A6_structure_{1+i}.pdb"
symm_icosahedral.to(output_filename)
print(f"Struttura {i+1} salvata in {output_filename}")

and over several runs I have tried different combinations of langevin_factor, inverse_temperature and number of steps. WHat should I try to rectify the output design? Even if everything is collapsed the presence of the symmetry is clear so I really would like to overcome this problem in order to produce fit, hollow, assemblies.

Thank you very much

Image

@wujiewang
Copy link
Member

Thanks for reporting this. Overs-quashing like happens as we have observed, and we suggest you filter out very clashy complexes before design.

Some options to consider:

  • and play with num_chain_neighbors and chose a larger number
  • build a custom conditioner to shift the the AU by some large distance to pull the chains apart.
  • choose a smaller chain size.

@chiarinival
Copy link
Author

chiarinival commented Feb 26, 2025

Hi!!!! And thanks for your help,

I have tried to play with both chain size and chain_neighbors but nothing seem to change. In particular, I don't fully understand why chain_neighbors number should increase, given that icosahedron has 5 and 3 fold simmetry axis and therefore I would expect each chain to interact with either 3 or 5 other chains.

I have also tried to build a custom conditioner to implement a "purging control" in order to prevent all those design which end up having clashes and bad contacts. here is what it looks like:

import torch
from chroma.models import Chroma
from chroma.layers.structure import conditioners

class AvoidAtomicClashesConditioner(torch.nn.Module):

def __init__(self, min_distance=1.5):
   
    super().__init__()
    self.min_distance = min_distance

def forward(self, X: torch.Tensor, C: torch.LongTensor, O: torch.Tensor, U: torch.Tensor, t: torch.Tensor):
  
    N = X.shape[0]  # Numero di atomi
    mask = torch.ones(N, dtype=torch.bool)  # Mantiene gli atomi validi

    for i in range(N):
        if not mask[i]:  
            continue  
        for j in range(i + 1, N):
            if not mask[j]:
                continue
            distance = torch.norm(X[i] - X[j])
            if distance < self.min_distance:
                mask[j] = False  # Esclude l'atomo in conflitto
    
    X = X[mask]  # Mantiene solo gli atomi validi
    return X, C, O, U, t  # Ritorna il nuovo stato del sistema

chroma = Chroma()

icosahedral_symmetry = conditioners.SymmetryConditioner(G="I", num_chain_neighbors=3)

atomic_clash_conditioner = AvoidAtomicClashesConditioner(min_distance=1.5)

composed_cond = conditioners.ComposedConditioner([icosahedral_symmetry, atomic_clash_conditioner])

heterodimer_chain_lengths = [200, 130]

symm_icosahedral = chroma.sample(
chain_lengths=heterodimer_chain_lengths,
conditioner=composed_cond,
langevin_factor=8,
inverse_temperature=8,
sde_func="langevin",
steps=5000
)

print(symm_icosahedral)

symm_icosahedral.to("A15_structure_1.pdb")

But again, little seems to happen. Could you perhaps provide some comment regarding this conditioner and if there is something to improve or correct?

Thanks again for your time.

Valerio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants