Optimize

Overview

Details

class msibi.optimize.MSIBI(nlist: NeighborList, integrator_method: Method, thermostat: Thermostat, method_kwargs: dict, thermostat_kwargs: dict, dt: float, gsd_period: int, nlist_exclusions: list[str] = ['bond', 'angle'], seed: int = 24, device: Device = None)

Management class for orchestrating an MSIBI optimization run.

Note

This package is very object oriented. This class should be created first, followed by at least one msibi.state.State instance and at least one msibi.forces.Force instance.

Then, use the methods MSIBI.add_state() and MSIBI.add_force() before beginning the optimization runs using MSIBI.run_optimization().

For detailed examples, see the Examples section in the documentation.

Note

While using MSIBI does not require thorough knowledge of HOOMD-blue’s API, some familiarity is needed to set simulation parameters such as the neighbor list, integrator method, thermostat, etc.

See the HOOMD-blue documentation: https://hoomd-blue.readthedocs.io/en/latest/

Parameters:
  • nlist (hoomd.md.nlist.NeighborList) – The type of HOOMD neighbor list to use.

  • integrator_method (hoomd.md.methods.Method) – The integrator method to use in the query simulation. The only supported options are hoomd.md.methods.ConstantVolume or hoomd.md.methods.ConstantPressure.

  • integrator_kwargs (dict) – The arguments and their values required by the integrator method chosen.

  • thermostat (hoomd.md.methods.thermostat.Thermostat) – The thermostat to be paired with the integrator method.

  • thermostat_kwargs (dict) – The arguments and their values required by the thermostat chosen.

  • dt (float, required) – The time step delta.

  • gsd_period (int) – The number of frames between snapshots written to query.gsd.

  • nlist_exclusions (list of str, default = ["1-2", "1-3"]) – Sets the pair exclusions used during the optimization simulations.

  • seed (int, default=42) – Random seed to use during the simulations.

  • device (hoomd.device.Device, default hoomd.device.auto_select.) – Set whether HOOMD will use the CPU or GPU. If left as None then hoomd.device.auto_select is used and will default to the GPU if one is available or fall back to the CPU if a GPU is not available.

add_state(state: State) None

Add a state point to be included in query simulations.

Note

At least one state point must be added before optimization can occur.

Parameters:

state (msibi.state.State) – A state point to be included in query simulations

add_force(force: Force) None

Add a force to be included in the query simulations.

Note

Only one type of force can be optimized at a time. Forces not set to be optimized are held fixed during query simulations.

Parameters:

force (msibi.forces.Force) – A force to be included in query simulations

property bonds: list

All instances of msibi.forces.Bond included in query simulations.

property angles: list

All instances of msibi.forces.Angle included in query simulations.

property pairs: list

All instances of msibi.forces.Pair included in query simulations.

property dihedrals: list

All instances of msibi.forces.Dihedral included in query simulations.

run_optimization(n_steps: int, n_iterations: int, backup_trajectories: bool = False, _dir=None) None

Runs simulations and performs MSIBI on the forces set to be optimized.

Tip

This method can be called multiple times, and the optimization will continue from the last iteration. This may be useful for inspecting the f-fit score before running more iterations, changing the state point alpha values, or smoothing the potential between iterations.

Parameters:
  • n_steps (int) – Number of simulation steps during each iteration.

  • n_iterations (int) – Number of MSIBI update iterations.

  • backup_trajectories (bool, default=False) – If True, copies of the query simulation trajectories are saved in their respective msibi.state.State directory.

pickle_forces(file_path: str) None

Save the HOOMD-Blue force objects for all forces to a single pickle file.

Tip

Use this method as a convienent way to save and use the final set of forces to be used in your own HOOMD-Blue script.

Parameters:

file_path (str) – The path and file name for the pickle file.

Modules