materialsvirtuallab / m3gnet

Materials graph network with 3-body interactions featuring a DFT surrogate crystal relaxer and a state-of-the-art property predictor.
BSD 3-Clause "New" or "Revised" License
242 stars 62 forks source link

M3GNet will crash if it meets some materials in Material project, here are the mp-ids, any hint to fix them? #63

Open liuxiaotong15 opened 1 year ago

liuxiaotong15 commented 1 year ago

M3GNet does not work on 'mp-20071', 'mp-21462', 'mp-1182832' with element Eu; on 'mp-1012110', 'mp-949029', 'mp-1055940', 'mp-573579', 'mp-639727', 'mp-1183897', 'mp-672241', 'mp-1', 'mp-11832', 'mp-1096915', 'mp-1007976', 'mp-1184151', 'mp-1183694', 'mp-3' with element Cs; on 'mp-867126', 'mp-1179802', 'mp-974620', 'mp-975204', 'mp-1063817', 'mp-70', 'mp-604321', 'mp-1186899', 'mp-975129', 'mp-12628', 'mp-640416', 'mp-569688', 'mp-639736', 'mp-1186853', 'mp-1018045', 'mp-975519', 'mp-656615', 'mp-1179832', 'mp-639755', 'mp-1179656' with element Rb; on 'mp-867202', 'mp-1056418', 'mp-76', 'mp-1187073', 'mp-95', 'mp-139' with element Sr; and so on...

any idea to solve them? Thanks in advance.

JiQi535 commented 1 year ago

I believe this is because these structures do not have threebody interactions in 4 Å. By design, M3GNet should still work for these structures, but current implementation is buggy in using the @tf.functions for functions of BasePotential and Potential. I have a temporary solution of commenting out the @tf.functions, which is discussed in #64, while this might not be the best solution. It would be nice if you can check it out and share your feedback.

chc273 commented 1 year ago

No the current implementation is not "buggy".

@liuxiaotong15 after loading the model run on a normal structure first to compile and then subsequent runs will be ok. If the problem persists, that's a problem of tensorflow version. See PR 52 for this and also a test case "test_single_atoms" in "m3gnet/models/tests/test_model.py"

@shyuep for awareness

shyuep commented 1 year ago

I think we shouldn't expect that a "normal" structure has to be loaded before making a prediction on a structure without 3-body terms. In any case, I am fine with leaving this problem as is since we will move to the matgl version soon. @JiQi535 make sure the matgl version does not have such problems.