Basic usage#

This example shows how to enumerate all derivative structures of given crystal structure in pymatgen.Structure.

Import modules#

[1]:
import numpy as np
from pymatgen.core import Lattice, Structure

from dsenum import StructureEnumerator, ZddStructureEnumerator
[2]:
from dsenum import __version__
print(f"dsenum {__version__}")
dsenum 0.3.16.dev19+gc2b1184.d20220615

Define structure#

[3]:
# fcc
lattice = Lattice(np.array([[0, 1, 1], [1, 0, 1], [1, 1, 0]]))
species = ['Cu']
frac_coords = [[0, 0, 0]]
structure = Structure(lattice, species, frac_coords)

Enumerate binary derivative structures#

Binary derivative structures in four-times expanded supercells. The two species are interchangeble and superperiodic structures are discarded.

[4]:
se = StructureEnumerator(structure, index=4, num_types=2)
dstructs = se.generate()
assert len(dstructs) == 12
100%|██████████| 7/7 [00:00<00:00, 109.19it/s]
total: 12 (Time: 0.06884sec)

[5]:
dstructs[0]
[5]:
Structure Summary
Lattice
    abc : 1.4142135623730951 1.4142135623730951 5.656854249492381
 angles : 60.00000000000001 60.00000000000001 60.00000000000001
 volume : 8.0
      A : 0.0 1.0 1.0
      B : 1.0 0.0 1.0
      C : 4.0 4.0 0.0
PeriodicSite: 10+ (0.0000, 0.0000, 0.0000) [0.0000, 0.0000, 0.0000]
PeriodicSite: 10+ (1.0000, 1.0000, 0.0000) [0.0000, 0.0000, 0.2500]
PeriodicSite: 10+ (2.0000, 2.0000, 0.0000) [0.0000, 0.0000, 0.5000]
PeriodicSite: 20+ (3.0000, 3.0000, 0.0000) [0.0000, 0.0000, 0.7500]

ZDD acceleration#

[6]:
# Currenyly, ZDD version cannot take color_exchange symmetry.
zse = ZddStructureEnumerator(structure, index=20, num_types=2,
                             mapping_color_species=['Cu', 'Au'],
                             remove_incomplete=True,
                             remove_superperiodic=False)
poscars = zse.generate(output='poscar')  # In POSCAR format
100%|██████████| 77/77 [00:32<00:00,  2.37it/s]
total: 1723127 (Time: 32.46sec)

[7]:
print(poscars[0])
generated by dsenum 0.3.16.dev19+gc2b1184.d20220615
1.0
0.0 1.0 1.0
1.0 0.0 1.0
20.0 20.0 0.0
Cu Au
19 1
Direct
0.0 0.0 0.0
0.0 0.0 0.05
0.0 0.0 0.1
0.0 0.0 0.15000000000000002
0.0 0.0 0.2
0.0 0.0 0.25
0.0 0.0 0.30000000000000004
0.0 0.0 0.35000000000000003
0.0 0.0 0.4
0.0 0.0 0.45
0.0 0.0 0.5
0.0 0.0 0.55
0.0 0.0 0.6000000000000001
0.0 0.0 0.65
0.0 0.0 0.7000000000000001
0.0 0.0 0.75
0.0 0.0 0.8
0.0 0.0 0.8500000000000001
0.0 0.0 0.9
0.0 0.0 0.9500000000000001