Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new parameters in forward function #163

Open
CalvinGe opened this issue Nov 16, 2024 · 9 comments
Open

Add new parameters in forward function #163

CalvinGe opened this issue Nov 16, 2024 · 9 comments

Comments

@CalvinGe
Copy link

Dear developers,

I was wondering if it is possible to add user-defined parameters in the forward function other than the positions or boxvectors. The parameters are not constant for different MD snapshots, thus they cannot be defined as global parameters.

@peastman
Copy link
Member

The parameters are not constant for different MD snapshots

Can you explain what you mean by that? How would they differ from global parameters?

@CalvinGe
Copy link
Author

They cannot be defined globally but are dependent on the state of the system, for example, the electrostatic potential on each atom.

@peastman
Copy link
Member

You're saying it's a per-particle parameter? And it's time-varying, so it can't be fixed in the model?

@CalvinGe
Copy link
Author

Exactly!

@CalvinGe
Copy link
Author

It would be awesome if you could give me some clues on how the positions and boxvectors are passed from OpenMM to the interface, then maybe I could try to pass other time-varying parameters in the same way.

@CalvinGe
Copy link
Author

Maybe I could make my question clearer. For example, is it possible to add the MM forces on all atoms as a new parameter to the forward function?

@peastman
Copy link
Member

The complicated part is where and how the value is stored. Anything that varies with time should be stored in the Context. It stores all the standard properties, like positions and velocities. It also has a generic mechanism for storing and updating global parameters, but only scalar valued ones. Extending it to allow storing arbitrary vector valued parameters in the Context would be a major feature.

Alternatively it could be stored in the Force, but in that case it's treated as constant. Modifying a Force doesn't affect any Contexts that have already been created for it, but it can have an updateParametersInContext() method to copy changes over to an existing Context.

@CalvinGe
Copy link
Author

Thank you! With that, is the forward function on the interface currently taking positions and boxvectors from the Context object?

@peastman
Copy link
Member

Correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants