Write a unit cell to .xyz file with atoms on periodic boundaries?

I’m trying to convert .cif files into .xyz files that have atoms on all the periodic boundaries. Does pymatgen have any built-in methods that could help me do this?

To give an example of what I’m trying to do, consider a conventional standard .cif file of an FCC crystal, which has 4 atoms in the unit cell at the following fractional positions:

_atom_site_occupancy
Ni Ni0 1 0.00000000 0.00000000 0.00000000 1
Ni Ni1 1 0.00000000 0.50000000 0.50000000 1
Ni Ni2 1 0.50000000 0.00000000 0.50000000 1
Ni Ni3 1 0.50000000 0.50000000 0.00000000 1

As a 3D model, these 4 atoms look like this:

Ni_4_atom_unit_cell

Starting with this type of conventional .cif file, I would like to write an .xyz file that has the “full” unit cell with atoms on all periodic boundaries. Using FCC as an example, this .xyz file would have a total of 14 atoms on all periodic boundaries, like this:

14
Ni 0.000000 0.000000 0.000000
Ni 0.000000 0.000000 1.000000
Ni 0.000000 1.000000 0.000000
Ni 0.000000 1.000000 1.000000
Ni 1.000000 0.000000 0.000000
Ni 1.000000 0.000000 1.000000
Ni 1.000000 1.000000 0.000000
Ni 1.000000 1.000000 1.000000
Ni 0.000000 0.500000 0.500000
Ni 1.000000 0.500000 0.500000
Ni 0.500000 0.000000 0.500000
Ni 0.500000 1.000000 0.500000
Ni 0.500000 0.500000 0.000000
Ni 0.500000 0.500000 1.000000

A 3D model with these 14 atoms would look like the typical textbook FCC unit cell, like this:

Ni_14_atom_unit_cell

Does pymatgen have any built-in functionality to achieve this conversion from standard .cif to an .xyz file with atoms on all periodic boundaries?

Which code are you going to use?
Typically for periodic system you will use a plane waves code such as abinit/quantum-espresso.
There you don’t really have a xyz file, rather you have the unit cell (primitive or conventional) which is repeated in all directions and the atomic coordinates in that reference. The cartesian coordinate of an atom in the unit cell (the xyz coordinates) will be the vectorial product of its relative coordinates by the cell unit vectors.

In pymatgen you have (I can only find the conventional cell here):

import pymatgen.core as mg
from pymatgen.core import Structure, Lattice

lattice = mg.Lattice.cubic(4.2)
structure = Structure(lattice, ["Cs", "Cl"], [[0, 0, 0], [0.5, 0.5, 0.5]])
print(structure)
Full Formula (Cs1 Cl1)
Reduced Formula: CsCl
abc   :   4.200000   4.200000   4.200000
angles:  90.000000  90.000000  90.000000
Sites (2)
  #  SP      a    b    c
---  ----  ---  ---  ---
  0  Cs    0    0    0
  1  Cl    0.5  0.5  0.5

or equivalently:

structure.get_primitive_structure()
Structure Summary
Lattice
    abc : 4.2 4.2 4.2
 angles : 90.0 90.0 90.0
 volume : 74.08800000000001
      A : 4.2 0.0 0.0
      B : 0.0 4.2 0.0
      C : 0.0 0.0 4.2
PeriodicSite: Cs (0.0000, 0.0000, 0.0000) [0.0000, 0.0000, 0.0000]
PeriodicSite: Cl (2.1000, 2.1000, 2.1000) [0.5000, 0.5000, 0.5000]