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:
objectThe 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
speciesis empty or repeats a species, a key ofpair_potentialsis not a pair, an entry ofpair_potentialsnames 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
speciesis a singleSpeciesrather than a sequence, an item ofspeciesis not aSpecies,pair_potentialsis not a mapping, or a value inpair_potentialsis not aPairPotentialinstance.
- 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.