itcsimlib.model_drakon module

Helper classes and functions that permit use of DRAKON to build statistical thermodynamics models.

class itcsimlib.model_drakon.DRAKONIsingModel[source]

Bases: itcsimlib.model_ising.Ising

A wrapper/simplification interface for an Ising model for use in DRAKON flow diagram-based models.

setup()[source]

Runs any necessary setup actions prior to execution. Valid child models should overwrite this.

initialize(*args, **kwargs)[source]

Alias for the parent class constructor, used to explicity call init in DRAKON. See the Ising parent __init__() method for the argument list.

add_parameter(name, type, **kwargs)[source]

Alias for the ITCModel add_parameter() method. This method also adds the parameter to the class attributes.

See the ITCModel parent method for the argument list.

Notes

It’s usually bad practice to pollute the namespace with random attributes, but here it’s a calculated risk for more grokable DRAKON diagrams.

set_param(name, value)[source]

Alias for the ITCModel set_parameter() method. Updates the class attribute value as well.

See the ITCModel.add_parameter() method for the argument list.

count_occupied(i)[source]

Convenience function for DRAKON models - getter for bound[].

Parameters:i (integer) – The index of the configuration.
Returns:integer
Return type:the number of occupied sites in the configuration.
set_energies(T0, T)[source]

Set the gibbs and enthalpic energy of each lattice configuration using the DRAKON site() method.

Parameters:
  • T0 (float) – The reference temperature of the simulation.
  • T (float) – The current temperature of the system.
Returns:

Return type:

None

add_dG(i, dG, dH=None, dCp=None)[source]

Convenience function for DRAKON models to increment the gibbs free energy of a configuration. This function also permits temperature-dependent van’t Hoff correction, if dH and dCp are not None. Alternatively, an expression consisting of existing model parameters may be provided for each argument, but this will result in (even slower) model evaluation as the expression will need to be eval()’d for every configuration.

Parameters:
  • i (integer) – The index of the configuration
  • dG (string) – The name of the free energy change parameter to add to the configuration, the reference free energy change if dH and dCp are provided, or an expression of other existing model parameters.
  • dH (string or None) – The name of the enthalpy change parameter to use in the van’t Hoff correction.
  • dCp (string or None) – The name of the heat capacity change parameter to use in the van’t Hoff correction.
add_dH(i, dH, dCp=None)[source]

Convenience function for DRAKON models to increment the enthalpy of a configuration. This function permits temperature-dependent van’t Hoff correction, if dCp is not None. Alternatively, an expression consisting of existing model parameters may be provided, but this may result in (even slower) model execution, as the expression will need to be eval()’d for every configuration.

Parameters:
  • i (integer) – The index of the configuration
  • dH (string) – The name of the enthalpy change parameter to add to the configuration, the reference enthalpy if dCp is provided, or an expression of other existing model parameters.
  • dCp (string or None) – The name of the heat capacity change parameter to use in the van’t Hoff correction.