Utilities for manipulating OpenMM objects.
Functions:
- 
            is_close–Compares if two unit wrapped values are close using numpy.is_close
- 
            all_close–Compares if all values in two unit wrapped array are close using 
- 
            assign_force_groups–Assign standard force groups to forces in a system. 
- 
            check_for_nans–Checks whether a state has NaN coordinates. 
- 
            compute_energy–Computes the potential energy of a system at a given set of positions. 
- 
            evaluate_ctx_parameters–Inspects an OpenMM system for any context parameters that contain special 
- 
            get_simulation_summary–Returns a string summarising the current energy and volume of a system being 
- 
            create_integrator–Creates an OpenMM integrator. 
- 
            create_simulation–Creates an OpenMM simulation object. 
- 
            get_pressure–Extracts the pressure from a system if it has a barostat. 
    Compares if two unit wrapped values are close using numpy.is_close
Source code in femto/md/utils/openmm.py
              
    Compares if all values in two unit wrapped array are close using
numpy.allclose
Source code in femto/md/utils/openmm.py
              
    Assign standard force groups to forces in a system.
Notes
- COM, alignment, and position restraints are detected by their name. If their
  name is not set to a OpenMMForceName, they will be assigned a force group ofOTHER.
Parameters:
- 
            system(System) –The system to modify in-place. 
Source code in femto/md/utils/openmm.py
              
    Checks whether a state has NaN coordinates.
Raises:
- 
              OpenMMException–If any of the coordinates are NaN. 
Source code in femto/md/utils/openmm.py
              
compute_energy(
    system: System,
    positions: Quantity,
    box_vectors: Quantity | None,
    context_params: dict[str, float] | None = None,
    platform: OpenMMPlatform = REFERENCE,
    groups: int | set[int] = -1,
) -> Quantity
Computes the potential energy of a system at a given set of positions.
Parameters:
- 
            system(System) –The system to compute the energy of. 
- 
            positions(Quantity) –The positions to compute the energy at. 
- 
            box_vectors(Quantity | None) –The box vectors to use if any. 
- 
            context_params(dict[str, float] | None, default:None) –Any global context parameters to set. 
- 
            platform(OpenMMPlatform, default:REFERENCE) –The platform to use. 
- 
            groups(int | set[int], default:-1) –The force groups to include in the energy calculation. 
Returns:
- 
              Quantity–The computed energy. 
Source code in femto/md/utils/openmm.py
              
    Inspects an OpenMM system for any context parameters that contain special
keywords that indicate a computed value (e.g. sqrt<bm_b0>) and injects their
values into a state dictionary.
Parameters:
- 
            state(dict[str, float]) –The core set of context parameter values that may appear in any expressions. 
- 
            system(System) –The system to inspect for context parameters. 
Returns:
- 
              dict[str, float]–The updated state dictionary. 
Source code in femto/md/utils/openmm.py
              
    Returns a string summarising the current energy and volume of a system being simulated.
Parameters:
- 
            simulation(Simulation) –The current simulation. 
- 
            groups(set[int] | int, default:-1) –The force groups to include in the energy calculation. 
Returns:
- 
              str–The formatted string. 
Source code in femto/md/utils/openmm.py
              
create_integrator(
    config: LangevinIntegrator, temperature: Quantity
) -> Integrator
Creates an OpenMM integrator.
Parameters:
- 
            config(LangevinIntegrator) –The configuration of the integrator. 
- 
            temperature(Quantity) –The temperature to simulate at. 
Returns:
- 
              Integrator–The created integrator. 
Source code in femto/md/utils/openmm.py
              
create_simulation(
    system: System,
    topology: Topology,
    coords: State | None,
    integrator: Integrator,
    state: dict[str, float] | None,
    platform: OpenMMPlatform,
) -> Simulation
Creates an OpenMM simulation object.
Parameters:
- 
            system(System) –The system to simulate 
- 
            topology(Topology) –The topology being simulated. 
- 
            coords(State | None) –The initial coordinates and box vectors. If None, the coordinates and box vectors from the topology will be used.
- 
            integrator(Integrator) –The integrator to evolve the system with. 
- 
            state(dict[str, float] | None) –The state of the system to simulate. 
- 
            platform(OpenMMPlatform) –The accelerator to run using. 
Returns:
- 
              Simulation–The created simulation. 
Source code in femto/md/utils/openmm.py
              
    Extracts the pressure from a system if it has a barostat.
Notes
- If the system has no barostat, this function will return None.
- Only the first barostat found will be used.