Dumping a Transformation to JSON#

If you’re trying to run a full campaign of simulations representing an alchemical network, we generally recommend saving objects using our storage tools, when avoids saving duplicate information to disk.

However, there are situations where it is reasonable to serialize a single Transformation. For example, this can be useful when trying to compare results run on different machines. This also provides a trivial way for a user to run edges in parallel, if they don’t want to use the more sophisticated techniques we have developed.

For these cases, we have made it very easy for a user to dump a transformation to JSON. Simply use the method Transformation.to_json(). For example:

transformation.to_json("mytransformation.json")

When you do dump a single transformation, it can be reloaded into memory with the Transformation.from_json() method:

transformation = Transformation.from_json("mytransformation.json")

Once you’ve saved to it JSON, you can also run this transformation with the openfe command line tool’s quickrun command, e.g.:

$ openfe quickrun mytransformation.json -d dir_for_files -o output.json