[Feature Request]: parity plot between DFT-calculated forces/energies and CHGNet-predicted values #212
Unanswered
msehabibur
asked this question in
Q&A
Replies: 2 comments 1 reply
-
The script above looks alright on my end! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Email (Optional)
[email protected]
Problem
I’m currently using CHGNet and have a question about comparing DFT and CHGNet predictions for forces and energy. I’d like to create a parity plot between DFT-calculated forces/energies and CHGNet-predicted values. Could you advise on the best way to extract the DFT and predicted forces and energies from the model output? Any tips on creating a well-structured parity plot would be greatly appreciated!
Proposed Solution
dft_forces = []
ml_forces = []
for batch in test_loader:
structures, target_data = batch
target_forces = np.array(target_data['f'])
Convert to numpy arrays for plotting
dft_forces = np.array(dft_forces)
ml_forces = np.array(ml_forces)
Plot DFT vs. ML-predicted forces
plt.figure(figsize=(6, 6))
plt.scatter(dft_forces, ml_forces, alpha=0.5, marker='o')
plt.plot([dft_forces.min(), dft_forces.max()], [dft_forces.min(), dft_forces.max()], 'k--', lw=2)
plt.xlabel("DFT Forces (eV/Å)")
plt.ylabel("ML Predicted Forces (eV/Å)")
plt.title("Comparison of DFT vs. ML Predicted Forces")
plt.grid(True)
plt.show()
Alternatives
No response
Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions