From a05881723d4eb16335fbe15d9e0fc7dec56a16b9 Mon Sep 17 00:00:00 2001 From: RaulPPealez Date: Wed, 29 Mar 2023 18:45:31 +0200 Subject: [PATCH] Document the constructor that takes a scripted module --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 08e752c0..0fa05951 100644 --- a/README.md +++ b/README.md @@ -116,11 +116,15 @@ module.save('model.pt') To use the exported model in a simulation, create a `TorchForce` object and add it to your `System`. The constructor takes the path to the saved model as an argument. +Alternatively, the scripted module can be provided directly. For example, ```python # Create the TorchForce from the serialized compute graph from openmmtorch import TorchForce +# Construct using a serialized module: torch_force = TorchForce('model.pt') +# or using an instance of the module: +torch_force = TorchForce(module) # Add the TorchForce to your System system.addForce(torch_force)