Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1""" 

2This module provides the Cluster class. 

3""" 

4 

5from typing import List 

6from ase import Atoms 

7from _icet import Cluster 

8from icet.core.lattice_site import LatticeSite 

9from icet.core.structure import Structure 

10 

11__all__ = ['Cluster'] 

12 

13 

14def _from_python(ase_structure: Atoms, 

15 lattice_sites: List[LatticeSite], 

16 cluster_index: int = -1): 

17 """ 

18 Constructs a cluster from an ASE Atoms object and Python lattice sites. 

19 

20 Parameters 

21 ---------- 

22 ase_structure 

23 structure as ASE Atoms object 

24 lattice_sites 

25 lattice site objects 

26 cluster_index 

27 index used to identify cluster 

28 """ 

29 

30 structure = Structure.from_atoms(ase_structure) 

31 

32 lattice_sites_cpp = [ 

33 LatticeSite(ls.index, ls.unitcell_offset) for ls in lattice_sites] 

34 

35 return Cluster(structure, lattice_sites_cpp, cluster_index) 

36 

37 

38Cluster.from_python = _from_python