divelab / DIG

A library for graph deep learning research
https://diveintographs.readthedocs.io/
GNU General Public License v3.0
1.85k stars 281 forks source link

Questions about the ComENet #233

Closed StefanIsSmart closed 9 months ago

StefanIsSmart commented 9 months ago
  1. Can ComENet distinguish chiral conformations?
  2. Why is ComENet's more complete representation not as good as SphereNet? It stands to reason that ComENet contains a larger amount of information.
limei0307 commented 9 months ago

Hi @StefanIsSmart,

Thanks for your interest in our work.

  1. Yes, ComENet can distinguish chiral conformations since it also considers the angle $\phi$, similar to SphereNet. Table 6 of our new survey paper shows the difference between SphereNet and ComENet.
  2. About the experimental performance: This is a very good point. We were thinking about this. I think there are several reasons.
    • Datasets: We tested ComENet on three datasets - QM9, Molecule3D, and OC20. Among these three datasets, only OC20 contains different conformers for the same molecule, as shown in Section 6.4 of our paper, and ComENet performs better than SphereNet on this dataset.
    • Practically, we use cutoff (e.g. 5A) to define edges, therefore, we consider more edges than chemical bonds. If we consider a large number of edges, SphereNet is already complete in many cases. Theoretically, we have to emphasize that, there are some cases that SphereNet can not distinguish, but ComENet is complete and can distinguish all cases.
    • Edge-based vs node-based message passing: SphereNet uses directional message passing (update message on each edge, high complexity) while ComENet uses node-based message passing. In ComENet, edge features are fixed and not learned. This may limit the model's performance but can improve efficiency.

Let us know if you have other questions. Thanks.

StefanIsSmart commented 9 months ago

Thank you for your reply! Also thank you for your work! It is really useful for me!

But I have one more question:

When I use the ComENet to do some tasks. For example, I use a learnable token to mask some position information as the input position Info. for ComENet. That means the input position Info. will require grads. The first iteration is okay, but after we did the backward() and step() , the nan will happen. This question only happened when I used ComENet, the other networks like EGNN did nothing wrong.

I don't know why, could you give me a favor?

limei0307 commented 9 months ago

Hi @StefanIsSmart,

Based on my experience, in most cases, nan happens when divided by zero. dist_ji here is used as the denominator in lines 375 and 383, so please try to add a small eps (e.g. 1e-6) to dist_ji to make sure the value is larger than 0.

Another difference between ComENet and other methods is that it selects some reference nodes based on distance values as shown here. I am not sure if this affects your method.

Let us know if you have other questions. Thanks.

StefanIsSmart commented 9 months ago

Hi @StefanIsSmart,

Based on my experience, in most cases, nan happens when divided by zero. dist_ji here is used as the denominator in lines 375 and 383, so please try to add a small eps (e.g. 1e-6) to dist_ji to make sure the value is larger than 0.

Another difference between ComENet and other methods is that it selects some reference nodes based on distance values as shown here. I am not sure if this affects your method.

Let us know if you have other questions. Thanks.

I find the calculation of phi and tau will get the nan number in the backward() grad. The distance and the theta calculation is nothing wrong. I have no idea how to solve this bug....

limei0307 commented 9 months ago

Have you tried to add a small eps (e.g. 1e-6) to dist_ji to make sure the value is larger than 0?