SemiGrandEnsembleSpec

class jaxrens.cli.schema.ensemble.SemiGrandEnsembleSpec(*, type='semi_grand', chemical_potentials, pressure=0.0, pressure_units='eva3')[source]

Bases: BaseEnsembleSpec

Semi-grand μPT: H = U + P·V - μ·N.

chemical_potentials is a per-species vector [μ_0, μ_1, ...]; pass a list of vectors to fan out across replicas (one μ-vector per replica). pressure is optional (default 0 → no P·V term) and may itself be a list for a pressure replica axis. When both are lists their lengths must match; a scalar/single-vector broadcasts across the other’s replicas.

The composition fluctuates here, so pair it with a move that can change species — species_swap conserves composition, alchemical_morph does not.

ensemble:
  type: semi_grand
  chemical_potentials: [0.0, 0.5]    # one vector, 2 species
  pressure: 0.0
ensemble:
  type: semi_grand
  chemical_potentials:               # 3 replicas
    - [0.0, 0.0]
    - [0.0, 0.5]
    - [0.0, 1.0]
Parameters:
cohort_size()[source]

Number of replicas this spec drives (1 = single run).

Return type:

int

to_ensemble_params(*, cohort_index=0)[source]

Return {"chemical_potentials": [...], "pressure": <eV/ų>}.

pressure is converted from GPa to eV/ų when pressure_units == "gpa". Scalar/single-vector parameters broadcast across cohort_index.

Parameters:

cohort_index (int)

Return type:

dict

model_config = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].