Package: slices
Simplified Line-Input Crystal-Encoding SystemThis software implementes Simplified Line-Input Crystal-Encoding System (SLICES), the first invertible and invariant crystal representation.It has several main functionalities:Encode crystal structures into SLICES stringsReconstruct original crystal structures from their SLICES strings (Text2Crystal)Generate crystals with desired properties using conditional RNN (Inverse Design)Developed by Hang Xiao 2023.04xiaohang07@live.cn[Paper][Data/Results][Source code]We also provide a codeocean capsule (a modular container for the software environment along with code and data, that runs in a browser), allowing one-click access to guaranteed computational reproducibility of SLICES's benchmark.[Codeocean Capsule]Table of ContentsInstallationExamplesCrystal to SLICES and SLICES to crystalAugment SLICES and canonicalize SLICESDocumentationReproduction of benchmarks and inverse design case studyGeneral setupReconstruction benchmark for MP-20Reconstruction benchmark for MP-21-40Reconstruction benchmark for QMOF-21-40Inverse design case studyMaterial generation benchmarkProperty optimization benchmarkCitationContactInstallationPrerequisites: m3gnet, pygraphviz, graphviz, smact. Tip: using pip or conda or apt install/yum install to install these packages.pipinstallslicesExamplesCrystal to SLICES and SLICES to crystalConverting a crystal structure to its SLICES string and converting this SLICES string back to its original crystal structure.
Suppose we wish to convert the crystal structure of NdSiRu (mp-5239,https://next-gen.materialsproject.org/materials/mp-5239?material_ids=mp-5239) to its SLICES string and converting this SLICES string back to its original crystal structure. The python code below accomplishes this:importosfrominvcryrep.invcryrepimportInvCryRepfrompymatgen.core.structureimportStructure# setup modified XTB's path# obtaining the pymatgen Structure instance of NdSiRuoriginal_structure=Structure.from_file(filename='NdSiRu.cif')# creating an instance of the InvCryRep Class (initialization)backend=InvCryRep()# converting a crystal structure to its SLICES stringslices_NdSiRu=backend.structure2SLICES(original_structure)# converting a SLICES string back to its original crystal structure and obtaining its M3GNet_IAP-predicted energy_per_atomreconstructed_structure,final_energy_per_atom_IAP=backend.SLICES2structure(slices_NdSiRu)print('SLICES string of NdSiRu is: ',slices_NdSiRu)print('\nReconstructed_structure is: ',reconstructed_structure)print('\nfinal_energy_per_atom_IAP is: ',final_energy_per_atom_IAP,' eV/atom')# if final_energy_per_atom_IAP is 0, it means the M3GNet_IAP refinement failed, and the reconstructed_structure is the ZL*-optimized structure.Augment SLICES and canonicalize SLICESConverting a crystal structure to its SLICES string and perform data augmentation (2000x), then reduce these 2000 SLICES to 1 canonical SLICES with get_canonical_SLICES.importosfrominvcryrep.invcryrepimportInvCryRepfrompymatgen.core.structureimportStructurefrompymatgen.analysis.structure_matcherimportStructureMatcher,ElementComparator# obtaining the pymatgen Structure instance of Sr3Ru2O7original_structure=Structure.from_file(filename='Sr3Ru2O7.cif')# creating an instance of the InvCryRep Class (initialization)backend=InvCryRep(graph_method='econnn')# converting a crystal structure to its SLICES string and perform data augmentation (2000x)slices_list=backend.structure2SLICESAug(structure=original_structure,num=2000)slices_list_unique=list(set(slices_list))cannon_slices_list=[]foriinslices_list_unique:cannon_slices_list.append(backend.get_canonical_SLICES(i))# test get_canonical_SLICESprint(len(slices_list),len(set(cannon_slices_list)))# 2000 SLICES generated by data augmentation has been reduced to 1 canonical SLICESDocumentationTheSLICESdocumentation is hosted atread-the-docs.Citation@article{xiao2023invertible,
title={An invertible, invariant crystallographic representation for inverse design of solid-state materials using generative deep learning},
author={Xiao, Hang and Li, Rong and Shi, Xiaoyang and Chen, Yan and Zhu, Liangliang and Wang, Lei and Chen, Xi},
year={2023}
}Contact and SupportStart a new discussion thread in[Discussion], or reach out to Hang Xiao (https://www.researchgate.net/profile/Hang-Xiao-8)xiaohang07@live.cnif you have any questions.