Transforming a structure with site probabilities into a define structure

I have a system that has the rock salt structure with one site having 100% occupancy and the other 40% atom A, 40% atom B, 20% vacancy. What is the best way to generate a structure with definite atom types I can feed to Vasp? is the EnumerateStructureTransformation the best way to do this and are there any examples?

To my knowledge there are two methods to accomplish this:

  1. OrderDisorderedStructureTransformation which returns a list of ordered structures ranked by Ewald sum
  2. EnumerateStructureTransformation which I believe is basically the same thing but faster in some scenarios, and you must have enumlib installed and compiled on your computer to use it

You might also need DiscretizeOccupanciesTransformation as a preprocessing step.

I’d recommend using both (1) and (2) and then looking at some of the resulting structures in some visualizer to make sure they make sense. This is really only somewhat feasible if you are trying to order a single structure (which seems like your case)

You use them basically like this:

from pymatgen.core import Structure
from pymatgen.transformations.advanced_transfrormations import EnumerateStructureTransformation

# Load your file into a structure
s = Structure.from_file("my_file.cif")

est = EnumerateStructureTransformation(**your_args)
structures_ranked = est.apply_transformation(s, return_ranked_list=n_structures_to_return)

Where your_args are arguments to the __init__ of EnumerateStructureTransformation. I think you should examine min_size and max_size to pick numbers for cell sizes that make sense (i.e., greater than 1 if your site occupancies are noninteger)

The n_structures should be replaced with a number for how many ordered candidates you’d like to return.

The EnumerateStructureTransformation class can basically be replaced with most of the other structure transformations as they all work basically through the same interface. The arguments to their __init__'s will be different, but to my knowledge they are mostly the same.