# -*- coding: utf-8 -*-
"""
Created on Tue Jun 17 11:18:13 2025

@author: ICET
"""
from ase.io import read, write
from ase.db import connect 
from icet import ClusterSpace, StructureContainer, ClusterExpansion

db = connect('FeMnO_ref_data.db')

primitive_structure = db.get(id=1).toatoms()
print(primitive_structure)
 
cs = ClusterSpace(structure=primitive_structure,
                  cutoffs=[3.70, 3.70, 0.0],
                  chemical_symbols=[["Fe", "Mn"]] * 24 + [["O"]] * 32,
                  position_tolerance = 1e-5, symprec = 1e-5)
print(cs)

sc = StructureContainer(cluster_space=cs)
for row in db.select():
    sc.add_structure(structure=row.toatoms(),
                     user_tag=row.tag,
                     properties={'mixing_energy': row.mixing_energy})
print(sc)
