How to take the JSON output from the OCP demo(Open Catalyst) and visualize it in ASE?
I understand the positions are stored here but is there a direct way to visualize them?
Thank you for reading.
How to take the JSON output from the OCP demo(Open Catalyst) and visualize it in ASE?
I understand the positions are stored here but is there a direct way to visualize them?
Thank you for reading.
Hi -
You can make use of fairchem/src/fairchem/demo/ocpapi at main · FAIR-Chem/fairchem · GitHub to help you parse this. Specifically, something like this:
>>> from ocpapi import AdsorbateSlabRelaxationsResults
>>> with open("results.json", "r") as f:
... results = AdsorbateSlabRelaxationsResults.from_json(f.read())
...
>>> results.configs[0].to_ase_atoms()
Thank you it is working.
from fairchem.demo.ocpapi import AdsorbateSlabRelaxationsResults
with open("configs.json", "r") as f:
results = AdsorbateSlabRelaxationsResults.from_json(f.read())
results.configs[0].to_ase_atoms()
from ase.visualize.plot import plot_atoms
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ase_atoms=results.configs[10].to_ase_atoms()
plot_atoms(ase_atoms, ax, radii=0.8, rotation=('-90x,45y,0z'))
May I ask how to make it look like that in the OCP demo or just better than this?
Hello @mshuaibi ,
Is there a way to extract the final energy and the full energy trajectory from results.json using ocp ?
Like go through all the configs and extract the minimum energy configuration.
Hi -
From the json you’ll have to iterate over all the configs to identify the minimum. From the demo results page you can see the minimum configuration directly (for example - Open Catalyst)