prisms-center / CASMcode_crystallography

CASM crystallography
Other
0 stars 4 forks source link

construct default structure from prim #38

Open xivh opened 8 months ago

xivh commented 8 months ago

It would be nice to have a function which constructs the default structure (first occupant at each site) from a prim.

bpuchala commented 4 months ago

Feel free to write a libcasm.xtal.make_default_structure(prim: libcasm.xtal.Prim) function. For most cases, I think it is:

default_structure = xtal.Structure(
    lattice=prim.lattice(),
    atom_coordinate_frac=prim.coordinate_frac(),
    atom_type=[x[0] for x in prim.occ_dof()],
)

Maybe you also want checks for vacancies, and a include_vacancies: bool argument.