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

Adding a new node feature to a Spherenet model #234

Closed LeonardoBarneschi closed 9 months ago

LeonardoBarneschi commented 9 months ago

Dear developers,

I am training a Spherenet model to predict a molecular property. I was wondering if, aside from the atomic number ( as far as I understand ), it would be possible to include extra node features in the network. Could you eventually provide a minimal example?

Kindest Regards, L.

limei0307 commented 9 months ago

Hi @LeonardoBarneschi,

Thanks for your interest in our work. You can find the example code here (new commit) (code).

To include extra node features, you can provide extra node features node_feature to the model, as shown here.

When calling the SphereNet model, you need to set use_extra_node_feature=True and extra_node_feature_dim=your_dim.

For example, you can use model = SphereNet(energy_and_force=False, cutoff=5.0, num_layers=4, hidden_channels=128, out_channels=1, int_emb_size=64, basis_emb_size_dist=8, basis_emb_size_angle=8, basis_emb_size_torsion=8, out_emb_channels=256, num_spherical=3, num_radial=6, envelope_exponent=5, num_before_skip=1, num_after_skip=2, num_output_layers=3, use_node_features=True, use_extra_node_feature=True, extra_node_feature_dim=3 )

Let us know if you have other questions. Thanks.

LeonardoBarneschi commented 9 months ago

Hi @limei0307,

This is just amazing! Thank you very much, I really appreciate it.

Kindest Regards, Leonardo