smc_lammps.generate.lammps package

Submodules

smc_lammps.generate.lammps.parameterfile module

smc_lammps.generate.lammps.parameterfile.get_def_dynamically(name: str, value: Any) str

Generates a LAMMPS variable definition based on the type of value.

Parameters:
  • name – LAMMPS variable name (not checked for validity).

  • value – Value to assign to LAMMPS variable.

Returns:

String containing LAMMPS variable definition.

Raises:

TypeError – Unsupported type.

smc_lammps.generate.lammps.parameterfile.get_equal_def(name: str, value: int | float) str

Generates a LAMMPS equal style variable definition.

Parameters:
  • name – LAMMPS variable name.

  • value – Integer or float value.

Returns:

String containing LAMMPS variable definition.

smc_lammps.generate.lammps.parameterfile.get_index_def(name: str, values: Sequence[Any]) str

Generates a LAMMPS index definition.

Parameters:
  • name – LAMMPS variable name.

  • values – Index values. Values should contain no spaces, since they will not be quoted.

Returns:

String containing LAMMPS variable definition.

smc_lammps.generate.lammps.parameterfile.get_string_def(name: str, value: str) str

Generates a LAMMPS string definition.

Parameters:
  • name – LAMMPS variable name.

  • value – String value, will be quoted with ".

Returns:

String containing LAMMPS variable definition.

smc_lammps.generate.lammps.parameterfile.get_universe_def(name: str, values: Sequence[Any]) str

Generates a LAMMPS universe definition.

Parameters:
  • name – LAMMPS variable name.

  • values – Universe values. Each individual value will be quoted with ".

Returns:

String containing LAMMPS variable definition.

smc_lammps.generate.lammps.parameterfile.list_to_space_str(lst: Sequence[Any], surround: str = '') str

Converts a list into a space separated string.

Example:
>>> from smc_lammps.generate.lammps.parameterfile import list_to_space_str
>>> list_to_space_str(["hello", 1, 2.4])
'hello 1 2.4'
Example:
>>> from smc_lammps.generate.lammps.parameterfile import list_to_space_str
>>> list_to_space_str([1, 2, 3], surround="'")
"'1' '2' '3'"
Parameters:
  • lst – List of values.

  • surround – Used to surround each converted value in lst.

Returns:

Space separated string.

smc_lammps.generate.lammps.parameterfile.prepend_or_empty(string: str, prepend: str) str

Prepends something if the string is non-empty, otherwise returns the string “empty”.

Note

This is used when passing potentially unset values to LAMMPS.

Parameters:
  • string – If this is not empty, prepend is prepended to this.

  • prepend – String to prepend.

Returns:

Prepended string or “empty”.

smc_lammps.generate.lammps.runtimes module

smc_lammps.generate.lammps.runtimes.get_times(apo: int, atp1: int, atp2: int, adp: int, rng_gen: Generator) list[int]

Returns a list of runtimes for each SMC state [APO, ATP1, ATP2, ADP] sampled from an exponential distribution.

smc_lammps.generate.lammps.runtimes.get_times_with_max_steps(parameters: Parameters, rng_gen: Generator | None) list[int]

Returns a list of runtimes for a certain number of SMC cycles that fit within the maximum number of steps.

smc_lammps.generate.lammps.util module

smc_lammps.generate.lammps.util.atomIds_to_LAMMPS_ids(gen: Generator, atomIds: Sequence[tuple[AtomGroup, int]]) list[int]