relentless.model.Ensemble#

class relentless.model.Ensemble(T, N, V=None, P=None)#

Thermodynamic ensemble.

An ensemble is defined by:

  • The temperature T.

  • The number N for each particle type. The particle types are strings determined from the keys of N.

  • The extent V and/or pressure P.

Parameters:
  • T (float) – Temperature of the system.

  • N (dict) – Number of particles for each type.

  • V (Extent, optional) – Extent of the system.

  • P (float, optional) – Pressure of the system.

Methods

copy()

Make a copy of the ensemble.

from_file(filename)

Construct an Ensemble from a JSON file.

from_json(data)

Create from JSON data.

save(filename)

Save as a JSON file.

to_json()

Export to a JSON-compatible dictionary.

Attributes

N

FixedKeyDict: Number of particles of each type.

P

The pressure of the system.

T

The temperature.

V

The extent of the system.

rdf

PairMatrix: Radial distribution function per pair.

types

The types in the ensemble.

property N#

FixedKeyDict: Number of particles of each type.

property P#

The pressure of the system.

Type:

float

property T#

The temperature.

Type:

float

property V#

The extent of the system.

Type:

Extent

copy()#

Make a copy of the ensemble.

Returns:

A new Ensemble object having the same state.

Return type:

Ensemble

classmethod from_file(filename)#

Construct an Ensemble from a JSON file.

Parameters:

filename (str) – The name of the file from which to load data.

Returns:

An new Ensemble object.

Return type:

Ensemble

classmethod from_json(data)#

Create from JSON data.

It is assumed that the data is compatible with the object.

Parameters:

data (dict) – JSON data for ensemble.

property rdf#

PairMatrix: Radial distribution function per pair.

save(filename)#

Save as a JSON file.

Parameters:

filename (str) – The name of the file to save data in.

to_json()#

Export to a JSON-compatible dictionary.

Returns:

Ensemble.

Return type:

dict

property types#

The types in the ensemble.

Type:

tuple