pylj.model#

The physical model a simulation runs: the species and the potential between each pair of them.

Simulation models.

class pylj.model.Model(species: Sequence[Species], pair_potentials: Mapping[tuple[Species, Species], PairPotential])[source]#

Bases: object

The species in a simulation and the potential between each pair of them.

Every pair of species, including each species with itself, has one entry in pair_potentials, keyed by the two species in either order.

Parameters:
  • species – The species, assigned to the atoms in turn when a configuration is placed.

  • pair_potentials – The potential between each pair of species.

Raises:
  • ValueError – If species is empty or repeats a species, a key of pair_potentials is not a pair, an entry of pair_potentials names something that is not one of the species, a pair of species has no potential, or a cross pair is given in both orders.

  • TypeError – If species is a single Species rather than a sequence, an item of species is not a Species, pair_potentials is not a mapping, or a value in pair_potentials is not a PairPotential instance.

property species: tuple[Species, ...]#

The species, in the order they are assigned to atoms.

property pair_potentials: Mapping[tuple[Species, Species], PairPotential]#

The potential between each pair of species.

classmethod single(species: Species, potential: PairPotential) Self[source]#

Builds the model for one species.

Parameters:
  • species – The one species.

  • potential – The potential between two atoms of it.

potential(one: Species, other: Species) PairPotential[source]#

Looks up the potential between two species.

The pair may be given in either order.

Parameters:
  • one – One species of the pair.

  • other – The other species; the same one for a pair of like atoms.

Raises:

KeyError – If either species is not in the model.