# Thermodynamics: System versus Ensemble

In the context of thermodynamics, an ensemble is a hypothetical collection of identical copies of a system, each in a different state, used to represent the statistical behavior of the system.

That means I have to maintain a collection of systems inside an ensemble class.

In the book named Molecular Simulation of Fluids by Sadus, they have Ensemble class but, no System class.

Why is that?

The textbook you refer to states (p21):

The time-averaged properties of the real system are related to the ensemble average by ... the ergodic hypothesis.

That is, taking N snapshots of one system as it evolves through time (with enough time between that snapshots are not too correlated) and averaging over those is equivalent to taking one snapshot in time of N systems and taking their average.

Thus, both in molecular dynamics and Monte Carlo simulation, the "ensemble" is usually not an actual collection of a large number of macrostate-identical systems -- it usually refers to the equations of motion (MD) / choice of sampling moves (MC), and any modifications, needed to ensure that a single trajectory returns ergodically-consistent results with a hypothetical many-systems ensemble average.

EDIT, from comment: In terms of names for source code objects, we'd use Ensemble instead of System because "ensembles" refer to a set of moves that apply to any system, rather than a specific system. For example, MC for NPT must sample box size changes while MC for NVT doesn't. So you'd have NVT and NPT inherit from the Ensemble base class because they're different ensembles, while being broadly applicable across any system you want to simulate. "System" makes no sense as a substitute here (and it's too easily confused with other concepts -- such as the sys module in Python).

• Okay, then they should have had a System class rather than an Ensemble class. Jul 2, 2023 at 5:54
• I literally just explained what MD/MC programmers mean when we say Ensemble: the EOM / moves that sample one ensemble instead of another. For example, MC for NPT must sample box size changes while MC for NVT doesn't. So you'd have NVT and NPT inherit from the Ensemble base class because they're different ensembles. "System" makes no sense as a substitute here (and it's too easily confused with other concepts -- such as the sys module in Python). Jul 2, 2023 at 6:06
• Please, add the comment to the main answer body. Jul 2, 2023 at 15:22

I like how this book starts by defining all the concepts to be used after:

He defines system as:

A system is part of the physical world in which one is interested. What is not the system is the environment or the surroundings. We distinguish between several types of systems:

1. An isolated system is a system that is totally uninfluenced by the surroundings. There is no possibility of exchange of energy or matter with surroundings.
2. A closed system is a system in which energy but not matter can exchange with the surroundings.
3. An open system is a system in which both energy and matter can exchange with the surroundings

His definition of ensemble is:

During the time of measurement on a single system, the system undergoes a large number of changes from one microstate to another. The observed macroscopic properties of the system are time averages of the properties of the instantaneous microstatesâ€”that is, of the mechanical properties. Time-average calculations are virtually impossible to carry out. A way to get around this difficulty is to replace the time average of a single system by an ensemble average of a very large collection of systems. That is, instead of looking at one system over a period of time, one looks at a (mental) collection of a large number of systems (all of which are replicas of the system under consideration) at a given instance of time. Thus, in an ensemble of systems, all systems have certain properties in common (such as same N, V, E) but differ in their microscopic specifications; that is, they have different microstates.