Hi,
When I’m using enumerate_structures to enumerate new structures, it stops working for large size range. It works well for smaller size range, but it got stuck when the size range goes beyond 14. Why is this?
Here’s the code:
db = connect(‘vasp2db.db’)
slab = bulk(‘VN’, crystalstructure=‘rocksalt’, a=4.44)
conc_restr = {‘Ti’: (0.05, 0.96),‘V’: (0.05, 0.96),‘N’: (0.45, 0.96)}
data = {‘name’: ,‘conc_Ti’: ,‘conc_V’: ,‘conc_N’: ,‘predicted_energy’: }db_pred = connect(‘predstruc.db’)
cs = ClusterSpace(structure=slab,
cutoffs=[11.5, 5.5, 3.5],
chemical_symbols=[[‘Ti’, ‘V’],[‘N’,‘X’]])sc = StructureContainer(cluster_space=cs)
for row in db.select():
sc.add_structure(structure=row.toatoms(),
properties={‘mixing_energy’: row.mixing_energy})opt = CrossValidationEstimator(fit_data=sc.get_fit_data(key=‘mixing_energy’), fit_method=‘lasso’)
opt.validate()
opt.train()
print(opt)ce = ClusterExpansion(cluster_space=cs, parameters=opt.parameters, metadata=opt.summary)
ce.write(‘mixing_energy.ce’)i=299034
for structure in enumerate_structures(structure=slab, sizes=range(14, 16), chemical_symbols=[[‘Ti’,‘V’], [‘N’,‘C’]], concentration_restrictions=conc_restr):
i = i+1
name = int(i)
conc_1 = structure.get_chemical_symbols().count(‘Ti’) / (structure.get_chemical_symbols().count(‘Ti’) + structure.get_chemical_symbols().count(‘V’))
conc_2 = structure.get_chemical_symbols().count(‘N’) / (structure.get_chemical_symbols().count(‘N’) + structure.get_chemical_symbols().count(‘C’))
with open(‘sublat.csv’,‘a+’) as f:
f.write(‘{}\t{}\t{}\t\n’.format(name,conc_1,conc_2))
structure =structure[~(structure.symbols == ‘C’)]db_pred.write(structure, name = int(i)) ideal_structure, info = map_structure_to_reference(structure, slab,inert_species=['Ti', 'V']) concTi = structure.get_chemical_symbols().count('Ti') / len(structure) concV = structure.get_chemical_symbols().count('V') / len(structure) concN = structure.get_chemical_symbols().count('N') / len(structure) data['name'].append(int(i)) data['conc_Ti'].append(concTi) data['conc_V'].append(concV) data['conc_N'].append(concN) data['predicted_energy'].append(ce.predict(ideal_structure)) with open('predstrudata.csv','a+') as f: f.write('{}\t{}\t{}\t{}\t{}\t\n'.format(name,concTi,concV,concN,ce.predict(ideal_structure)))