materialsvirtuallab / matgl

Graph deep learning library for materials
BSD 3-Clause "New" or "Revised" License
256 stars 59 forks source link

How to use the potential of a finetuned model. #217

Closed vzguille closed 7 months ago

vzguille commented 8 months ago

I have a function which compares the M3GNet ase calculator to DFT to validate the energy, forces and stresses values. Comparing the pretrained "M3GNet-MP-2021.2.8-PES" is not a problem neither comparing a model trained solely on our generated system-specific training data. But when finetuning "M3GNet-MP-2021.2.8-PES" I can't seem to obtain coherent values from the ase calculator. From another post I see it is a problem of scaling and that I need to redefine the Potential before creating the calculator but I don't see how to proceed with this... do i need to provide the mean and std for all energies, forces and stresses, or only energies?

Pretrained model validation dataset: m3gnet_nnp = matgl.load_model("M3GNet-MP-2021.2.8-PES") calc_matgl = M3GNetCalculator_matgl(m3gnet_nnp) image

After fine-tunning vaidation dataset (when val_Total_Loss=0.414): calc_matgl = M3GNetCalculator_matgl(lit_module_finetune.model) #(lit_module_finetune is as in the tutorial) image

I obtain these values by using the ase calculator function swritten here: structure_ase.calc = calc_matgl structure_ase.get_potential_energy() structure_ase.get_forces() structure_ase.get_stress()

Thanks for your time

kenko911 commented 8 months ago

Hi @vzguille, could you please share us the whole training script for further investigations?