Enumerate at fixed concentration
Restrict enumerate to labelings with a prescribed concentration (e.g., 4 A + 4 B in an 8-cell binary alloy).
Setup
julia> using Enumlib
julia> p = ParentLattice([0.0 0.5 0.5; 0.5 0.0 0.5; 0.5 0.5 0.0]); # FCC
julia> sites = Sites([Site([0.0, 0.0, 0.0], [0, 1])]); # binarySteps
Pass a Concentration via the concentration kwarg. The constructor of choice depends on what you're holding in your head:
julia> c = concentration_count([4, 4]; n_total = 8); # 4 A + 4 B in an 8-cell
julia> e = enumerate(p, sites; supercells = VolumeRange(8:8), concentration = c);
julia> length(e)
94The canonical HF 2012 reference: 94 symmetry-inequivalent labelings of 8-site FCC supercells at 50/50 binary concentration.
Other constructors
When you care about a ratio rather than literal counts at a specific cell size, use concentration_ratio — scale-free, reduces the input to lowest terms:
julia> concentration_ratio([2, 4]) # 2:4 reduces to 1:2; total is 3 so 1/3:2/3
Concentration(1//3, 2//3) When you already have fractions in hand, the canonical Concentration constructor accepts them directly:
julia> Concentration([1//4, 3//4])
Concentration(1//4, 3//4)Behavior notes
Divisibility: the concentration's fractions must each multiply by the supercell volume to an integer. For example,
Concentration([1//3, 2//3])works at volumes that are multiples of 3 (3, 6, 9, …) but not at volume 4. Volumes that don't divide cleanly are silently skipped —enumeratereturns whatever structures the compatible volumes produced.Caveat: if every volume in the range is incompatible, you get back an
Enumerationof length 0 with no error raised. Callingmultiplicities(c, n)directly does throw anEmptyEnumerationError— only theenumerate(...)path catches it per-volume.:autoalgorithm dispatch picks:multinomialfor fixed concentration, or:recursive_stabilizerif the multinomial bitmap would exceedmemory_budget × 0.8. See Pick an algorithm.Super-periodic labelings are dropped by default. See Handle super-periodicity.
See also
- Reference:
Concentration,concentration_count,concentration_ratio,multiplicities. - How-to: Sweep concentration ranges, Count without enumerating, Pick an algorithm.
- Explanation: Concentration and multiplicity.