materialsproject/reaction-network

Can I save and load a ReactionNetwork?

Imhaenoo opened this issue · 3 comments

Hello, a thankful developer.

I'm using reaction networks to explore synthetic pathways for various materials.
And I want to build various reaction networks by changing the entries, which can be adjust based on temperature or stability.

Even if there are only 100 entries, building a reactive network will take 1-2 hours (with about 1 million reactions).
Refer to the image (CPU is 32 cores)

image

So, I want to save the react network once it's built and load it when I need it.

Is there any way to save and load a reactive network?

Thank you !

Hi @Imhaenoo,

Can you try using monty's dumpfn and loadfn? Since switching to graphs in rustworkx, we should be able to save in a JSON-serialized form.

from monty.serialization import dumpfn, loadfn

dumpfn(MY_REACTION_NETWORK, "rn.json.gz")
test_load_rn = loadfn("rn.json.gz")

Let me know if this doesn't work and I will see if I can fix

It works very well!

Thank you very much for your quick reply.

Great!!