megnet icon indicating copy to clipboard operation
megnet copied to clipboard

Using megnet for systems having atoms apart from "H", "C", "N", "O", "F"

Open yudhajitp opened this issue 1 year ago • 2 comments

Is there a way to tinker with the code to work for systems with additional atoms like Cl, Br, and S.

I am hoping to use MEGNet since it adds information about atomic and bonding attributes within a molecule using openbabel library functions. These functions had worked quite satisfactorily on my .xyz files.

yudhajitp avatar Aug 02 '22 19:08 yudhajitp

@yudhajitp

Hi, megnet works on all elements. If you are refering to the MolecularGraph class, you can set the elements here https://github.com/materialsvirtuallab/megnet/blob/02e15ee1a69cbdc318965be12c6dd94b8c1cb144/megnet/data/molecule.py#L130

This may affect the node feature dimension since some of the features involve one hot encoding of atom types.

In this case, try to convert a molecule to a graph and see what is the feature dimension for node, and then in the model contruction change nfeat_node to the correct one.

chc273 avatar Aug 03 '22 18:08 chc273

@chc273

Hi, I tried it out and adjusted the feature dimension for the nodes as well as edges as required. However, on a separate note, I did not get satisfactory R2 values for training on the data in molecules.json file even after 1000-2000 epochs.

In the paper, you had mentioned that 2000-4000 epochs should be enough for convergence. I was using the notebook example with the molecules.json file as a trial-case towards the application of megnet to my dataset.

I used the same code as in the notebook for 4000 epochs. Could it possibly be due to only having 1000 data-points in the training set? I'd appreciate any help.

Yudhajit

yudhajitp avatar Aug 12 '22 19:08 yudhajitp

It is hard to tell where the issue is. It could be also from the data if you are using a different dataset. You can try to increase the number of neurons, number of convolution layers etc and see if that helps. 1000 data points can be quite small for some applications

chc273 avatar Aug 25 '22 16:08 chc273

Ok, I actually resolved this issue looking at some other example codes in the notebook folder.

Thanks for your help!

Yudhajit

yudhajitp avatar Aug 29 '22 15:08 yudhajitp