Skip to content

Generate random ordered structures from disordered structure #3049

Open
@exenGT

Description

@exenGT

Problem

For molecular dynamics simulation and machine learning data generation of random structures, one might desire to have a routine that transforms a given disordered structure $S$ to a set of randomly ordered structures $\{S'_i\}$, where each randomly ordered structure $S'_i$ has the same overall composition as the disordered structure $S$.

Currently for this purpose, there exists OrderDisorderedStructureTransformation in transformations/standard_transformations.py. However, this function over-complicates the problem by using the Ewald energy to rank the generated randomly ordered structures. When the structure in question is very large (e.g. >= thousands of atoms in a typical MD simulation), this approach simply won't work due to the combinatorially increasing search space. Instead, what we actually want is very simple: a set of randomly ordered structures. The energy ranking is not of concern here.

Proposed Solution

We have implemented a new standard transformation routine, named RandomStructureTransformation. Given a disordered structure, and a number num_copies, its method apply_transformation returns a set of num_copies copies of randomly ordered structures. This routine distinguishes between inequivalent sublattices of the crystal.

Additional Info

The following example shows the usage of this routine:

from mp_api.client import MPRester

from pymatgen.transformations.standard_transformations \
  import RandomStructureTransformation

# put your api_key here
api_key = "*****"

with MPRester(api_key) as mpr:
    struct = mpr.get_structure_by_material_id("mp-2534", conventional_unit_cell=True)  # GaAs

struct[0:4] = {"Ga": 0.5, "In": 0.5}
struct[4:] = {"P": 0.5, "As": 0.5}

struct.make_supercell([3, 3, 3])

# random structure transformation
trans = RandomStructureTransformation()
new_structs = trans.apply_transformation(structure = struct,
                                         num_copies = 5)

# save structures to files
for i_struct, new_struct in enumerate(new_structs):
    new_struct.to("random_structure_{}.cif".format(i_struct))

Below are the screenshots of the generated random structures:
Screenshot 2023-06-06 at 1 37 52 AM
Screenshot 2023-06-06 at 1 37 48 AM
Screenshot 2023-06-06 at 1 37 38 AM
Screenshot 2023-06-06 at 1 37 34 AM
Screenshot 2023-06-06 at 1 37 28 AM

If this feature is desired, I can initiate a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions