Most tutorials you find out there will show just atom position optimization. Depending on where you got your input CIF, this is likely wrong.
Let's look at an example from my new crystal generation API with PyXtal.
On the left we keep the cell fixed and optimize only the atomic positions.
Ionic relaxation with Orb v3; 0.03 eV/Å threshold; final energy = -116.0608 eV; energy change = -0.4659 eV; symmetry: P6_3/mcm → P6_3/mcm
On the right we optimize both cell parameters and atomic positions.
Cell + Ionic relaxation with Orb v3; 0.03 eV/Å threshold; final energy = -120.9063 eV; energy change = -5.3118 eV; symmetry: P6_3/mcm → C2/m
Same starting crystal, but a different end result (structure optimization is an energy minimization task, so the less negative here the better).
First: -116.060 eV
Second: -120.90 eV
The only difference was the relaxation configuration. In the first we keep the cell fixed and optimize only the atomic positions. In the second we optimize both cell parameters and atomic positions.
If you only optimize atomic positions, you're essentially forcing atoms to find their "best" arrangement within a box that might be the wrong size or shape. You could be relaxing positions already within a constrained unit, increasing potential energy and perhaps falsely indicating a structure's lack of stability.
This could lead to:
Discard a perfectly stable material as "unstable"
Get completely wrong band gaps (metallic vs semiconducting)
Calculate incorrect formation energies for phase stability
Generate invalid phonon spectra showing imaginary frequencies
When we generate a candidate structure via random search, ML model, or any of the other options out there, we're getting a structure that needs optimization on both cell and atoms.
Fixed cell (atoms only): When you have known experimental cell parameters, studying defects/surfaces with bulk constraints, or intentionally investigating strain effects
Full relaxation (atoms + cell): Everything else – especially any generated or predicted structures
I've updated the relaxation endpoints in my Materials API to do this by default now. Give them a try here:
Relax a crystal structure
Relax a crystal structure with animation
Unfortunately, I think a lot of the work we've done so far has been affected by the subtle difference of not relaxing cell params. Not every structure, but I bet a lot of them. All these structures we've seen with really high formation energies and assumed unstable, might actually be more stable than we thought! By doing this now we are actually making the search easier for ourselves.
Moving forward, we should make sure to do full relaxation on generated structures.