parameters.reweight submodule

cg_openmm.parameters.reweight.bin_samples(sample_kn, n_bins)[source]
cg_openmm.parameters.reweight.get_decorrelated_samples(replica_positions, replica_energies, temperature_list)[source]

Given a set of replica exchange trajectories, energies, and associated temperatures, this function returns decorrelated samples, as obtained from pymbar with timeseries.subsampleCorrelatedData.

Parameters
  • replica_positions (Quantity() ( np.array( [n_replicas,cgmodel.num_beads,3] ), simtk.unit )) – Positions array for the replica exchange data for which we will write PDB files

  • replica_energies (List( List( float * simtk.unit.energy for simulation_steps ) for num_replicas )) – List of dimension num_replicas X simulation_steps, which gives the energies for all replicas at all simulation steps

  • temperature_list (List( float * simtk.unit.temperature )) – List of temperatures for the simulation data.

Returns

  • configurations ( List( Quantity() (n_decorrelated_samples,cgmodel.num_beads,3), simtk.unit ) ) - A list of decorrelated samples

  • energies ( List( Quantity() ) ) - The energies for the decorrelated samples (configurations)

cg_openmm.parameters.reweight.get_enthalpy_differences(mbar)[source]

Given an MBAR class object, this function computes the enthalpy differences for the states defined within.

Parameters

mbar – An MBAR() class object (from the ‘pymbar’ package)

Returns

  • Delta_u ( np.array( n_mbar_states x n_thermo_states ) - Enthalpy differences for the thermodynamic states in ‘mbar’

  • dDelta_u ( np.array( n_mbar_states x n_thermo_states ) - Uncertainty in the enthalpy differences for the thermodynamic states in ‘mbar’

cg_openmm.parameters.reweight.get_entropy_differences(mbar)[source]

Given an MBAR class object, this function computes the entropy differences for the states defined within.

Parameters

mbar – An MBAR() class object (from the ‘pymbar’ package)

Returns

  • Delta_s ( np.array( n_mbar_states x n_thermo_states ) - Entropy differences for the thermodynamic states in ‘mbar’

  • dDelta_s ( np.array( n_mbar_states x n_thermo_states ) - Uncertainty in the entropy differences for the thermodynamic states in ‘mbar’

cg_openmm.parameters.reweight.get_free_energy_differences(mbar)[source]

Given an MBAR class object, this function computes the free energy differences for the states defined within.

Parameters

mbar – An MBAR() class object (from the ‘pymbar’ package)

Returns

  • df_ij ( np.array( n_mbar_states x n_thermo_states ) - Free energy differences for the thermodynamic states in ‘mbar’

  • ddf_ij ( np.array( n_mbar_states x n_thermo_states ) - Uncertainty in the free energy differences for the thermodynamic states in ‘mbar’

cg_openmm.parameters.reweight.get_intermediate_temperatures(T_from_file, NumIntermediates)[source]

Given a list of temperatures and a number of intermediate states as input, this function calculates the values for temperatures intermediate between those in this list, as the mean between values in the list.

Parameters
  • T_from_file (List( float * simtk.unit.temperature )) – List of temperatures

  • NumIntermediates (int) – The number of states to insert between existing states in ‘T_from_file’

Returns

  • Temp_k ( List( float * simtk.unit.temperature ) ) - A new list of temperatures that includes the inserted intermediates.

cg_openmm.parameters.reweight.get_mbar_expectation(E_kln, temperature_list, NumIntermediates, output=None, mbar=None)[source]

Given a properly-formatted matrix of energies with associated temperatures this function reweights with MBAR (if ‘mbar’=None), and can also compute the expectation value for any property of interest.

Warning

This function accepts an input matrix thtat has either ‘E_kln’ or ‘E_kn’ format, but always provides an ‘E_kn’-formatted matrix in return.

Parameters
  • E_kln (List( List( float * simtk.unit.energy for simulation_steps ) for num_replicas ) OR List( List( List( float * simtk.unit.energy for simulation_steps ) for num_replicas ) for num_replicas )) – A matrix of energies or samples for a property that we would like to use to make predictions with MBAR.

  • temperature_list (List( float * simtk.unit.temperature )) – List of temperatures for the simulation data.

  • NumIntermediates (int) – The number of states to insert between existing states in ‘T_from_file’

  • output (str) – The ‘output’ option to use when calling MBAR, default = ‘differences’

  • mbar – An MBAR() class object (from the ‘pymbar’ package), default = None

Returns

  • mbar ( MBAR ) - An MBAR() class object (from the ‘pymbar’ package)

  • E_kn ( List( List( float * simtk.unit.energy for num_samples ) for num_replicas ) ) - A matrix of energies or samples for a property that we would like to use to make predictions with MBAR.

  • result ( List( List( float for num_samples ) for num_replicas ) - The MBAR expectation value for the energies and/or other samples that were provided.

  • dresult ( List( List( float for num_samples ) for num_replicas ) - The MBAR expectation value for the energies and/or other samples that were provided.

  • Temp_k ( List( float * simtk.unit.temperature ) ) - A new list of temperatures that includes the inserted intermediates.

cg_openmm.parameters.reweight.get_opt_temperature_list(temperature_list_init, C_v, number_intermediate_states=0, plotfile=None, verbose=True)[source]

Given an initial temperature list, and heat capacity curve that resulted from a replica exchange simulation using those temperatures, computes a revised temperature list satisfying the constant entropy increase (CEI) method

Parameters
  • temperature_list_init (1D numpy array ( float * simtk.unit.temperature )) – List of temperatures for initial replica exchange run

  • C_v (1D numpy array [ Quantity ]) – List of heat capacities evaluated at each temperature in temperature_list_init

  • number_intermediate_states (int) – number of unsampled states between each pair of sampled states (default=0)

  • plotfile (str) – path to filename for plotting spline fit to C_v/T vs. T (default=None)

  • verbose (bool) – option to print final output of scipy optimization routines

Returns

  • T_opt_list ( 1D numpy array ( float * simtk.unit.temperature ) ) - New optimally spaced temperature list

  • deltaS_list ( 1D numpy array ( float * simtk.unit ) ) - Actual entropy increases for adjacent temperatures in T_opt_list

cg_openmm.parameters.reweight.get_temperature_list(min_temp, max_temp, num_replicas)[source]

Given the parameters to define a temperature range as input, this function uses logarithmic spacing to generate a list of intermediate temperatures.

Parameters
  • min_temp – The minimum temperature in the temperature list.

  • max_temp – The maximum temperature in the temperature list.

  • num_replicas (int) – The number of temperatures in the list.

Returns

  • temperature_list ( 1D numpy array ( float * simtk.unit.temperature ) ) - List of temperatures