clusterX 1.0.0.dev7__tar.gz → 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. {clusterX-1.0.0.dev7/clusterX.egg-info → clusterX-2.1.0}/PKG-INFO +4 -4
  2. {clusterX-1.0.0.dev7 → clusterX-2.1.0/clusterX.egg-info}/PKG-INFO +4 -4
  3. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterX.egg-info/SOURCES.txt +9 -7
  4. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterX.egg-info/entry_points.txt +0 -1
  5. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterX.egg-info/requires.txt +3 -1
  6. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/calculators/emt.py +2 -0
  7. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/cli/commands.py +0 -6
  8. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/cli/test.py +4 -4
  9. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/clusters/cluster.py +46 -66
  10. clusterX-2.1.0/clusterx/clusters/clusters_pool.py +1520 -0
  11. clusterX-2.1.0/clusterx/clusters_selector.py +609 -0
  12. clusterX-2.1.0/clusterx/correlations.py +481 -0
  13. clusterX-2.1.0/clusterx/derivative_structures.py +390 -0
  14. clusterX-2.1.0/clusterx/estimators/estimator_factory.py +74 -0
  15. clusterX-2.1.0/clusterx/model.py +746 -0
  16. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/parent_lattice.py +170 -33
  17. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/structure.py +157 -34
  18. clusterX-2.1.0/clusterx/structures_set.py +942 -0
  19. clusterX-2.1.0/clusterx/super_cell.py +561 -0
  20. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/symmetry.py +25 -5
  21. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_clathrate_mc.py +4 -2
  22. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_cluster.py +10 -5
  23. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_cluster_expansion.py +3 -1
  24. clusterX-2.1.0/clusterx/test/test_cluster_orbit.py +485 -0
  25. clusterX-1.0.0.dev7/clusterx/test/test_cluster_orbit.py → clusterX-2.1.0/clusterx/test/test_cluster_orbit2.py +72 -47
  26. clusterX-2.1.0/clusterx/test/test_clusters_generation.py +345 -0
  27. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_clusters_selector.py +19 -5
  28. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_clusters_selector_lasso.py +5 -4
  29. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_concentration.py +2 -2
  30. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_emt2_calculator.py +7 -8
  31. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_folders.py +4 -3
  32. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_get_unique_supercells.py +6 -3
  33. clusterX-2.1.0/clusterx/test/test_metropolis.py +403 -0
  34. clusterX-2.1.0/clusterx/test/test_predict_swap.py +105 -0
  35. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_structure_selector.py +23 -20
  36. clusterX-2.1.0/clusterx/test/test_structures_set.py +61 -0
  37. clusterX-2.1.0/clusterx/test/test_wanglandau.py +118 -0
  38. clusterX-2.1.0/clusterx/thermodynamics/__init__.py +0 -0
  39. clusterX-2.1.0/clusterx/thermodynamics/monte_carlo.py +873 -0
  40. clusterX-2.1.0/clusterx/thermodynamics/wang_landau.py +1520 -0
  41. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/utils.py +479 -231
  42. clusterX-2.1.0/clusterx/visualization.py +697 -0
  43. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/setup.py +2 -2
  44. clusterX-1.0.0.dev7/clusterx/clusters/clusters_pool.py +0 -885
  45. clusterX-1.0.0.dev7/clusterx/clusters_selector.py +0 -334
  46. clusterX-1.0.0.dev7/clusterx/clusters_selector_with_splitbregman.py +0 -392
  47. clusterX-1.0.0.dev7/clusterx/correlations.py +0 -284
  48. clusterX-1.0.0.dev7/clusterx/estimators/estimator_factory.py +0 -28
  49. clusterX-1.0.0.dev7/clusterx/estimators/split_bregman.py +0 -126
  50. clusterX-1.0.0.dev7/clusterx/model.py +0 -388
  51. clusterX-1.0.0.dev7/clusterx/monte_carlo.py +0 -595
  52. clusterX-1.0.0.dev7/clusterx/nested_sampling.py +0 -322
  53. clusterX-1.0.0.dev7/clusterx/structures_set.py +0 -732
  54. clusterX-1.0.0.dev7/clusterx/super_cell.py +0 -261
  55. clusterX-1.0.0.dev7/clusterx/test/test_cluster_selector_split_bregman.py +0 -114
  56. clusterX-1.0.0.dev7/clusterx/test/test_clusters_generation.py +0 -269
  57. clusterX-1.0.0.dev7/clusterx/test/test_metropolis.py +0 -326
  58. clusterX-1.0.0.dev7/clusterx/test/test_nested_sampling.py +0 -311
  59. clusterX-1.0.0.dev7/clusterx/visualization.py +0 -419
  60. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/COPYING +0 -0
  61. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/LICENSE.txt +0 -0
  62. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/MANIFEST.in +0 -0
  63. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/README.rst +0 -0
  64. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterX.egg-info/dependency_links.txt +0 -0
  65. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterX.egg-info/top_level.txt +0 -0
  66. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/__init__.py +0 -0
  67. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/calculators/__init__.py +0 -0
  68. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/cli/__init__.py +0 -0
  69. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/cli/main.py +0 -0
  70. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/cli/plot_clusters.py +0 -0
  71. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/cli/spacegroup.py +0 -0
  72. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/clusters/__init__.py +0 -0
  73. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/config.py +0 -0
  74. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/cross_validation.py +0 -0
  75. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/estimators/__init__.py +0 -0
  76. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/io/__init__.py +0 -0
  77. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/io/atat.py +0 -0
  78. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/io/formats.py +0 -0
  79. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/lattices.py +0 -0
  80. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/structure_selector.py +0 -0
  81. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/__init__.py +0 -0
  82. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_cluster_correlations.py +0 -0
  83. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_get_all_hnf.py +0 -0
  84. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_is_nary.py +0 -0
  85. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_lattice_representation.py +0 -0
  86. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/clusterx/test/test_parent_lattice_creation.py +0 -0
  87. {clusterX-1.0.0.dev7 → clusterX-2.1.0}/setup.cfg +0 -0
@@ -1,10 +1,10 @@
1
- Metadata-Version: 1.0
1
+ Metadata-Version: 2.1
2
2
  Name: clusterX
3
- Version: 1.0.0.dev7
3
+ Version: 2.1.0
4
4
  Summary: CELL (aka clusterX) is a python package for building Cluster Expansion models of simple and complex alloys and performing thermodynamical analyses of materials.
5
5
  Home-page: http://sol.physik.hu-berlin.de/cell/
6
6
  Author: CELL Developers
7
7
  Author-email: srigamonti@physik.hu-berlin.de
8
8
  License: http://www.apache.org/licenses/LICENSE-2.0
9
- Description: UNKNOWN
10
- Platform: UNKNOWN
9
+ License-File: LICENSE.txt
10
+ License-File: COPYING
@@ -1,10 +1,10 @@
1
- Metadata-Version: 1.0
1
+ Metadata-Version: 2.1
2
2
  Name: clusterX
3
- Version: 1.0.0.dev7
3
+ Version: 2.1.0
4
4
  Summary: CELL (aka clusterX) is a python package for building Cluster Expansion models of simple and complex alloys and performing thermodynamical analyses of materials.
5
5
  Home-page: http://sol.physik.hu-berlin.de/cell/
6
6
  Author: CELL Developers
7
7
  Author-email: srigamonti@physik.hu-berlin.de
8
8
  License: http://www.apache.org/licenses/LICENSE-2.0
9
- Description: UNKNOWN
10
- Platform: UNKNOWN
9
+ License-File: LICENSE.txt
10
+ License-File: COPYING
@@ -11,14 +11,12 @@ clusterX.egg-info/requires.txt
11
11
  clusterX.egg-info/top_level.txt
12
12
  clusterx/__init__.py
13
13
  clusterx/clusters_selector.py
14
- clusterx/clusters_selector_with_splitbregman.py
15
14
  clusterx/config.py
16
15
  clusterx/correlations.py
17
16
  clusterx/cross_validation.py
17
+ clusterx/derivative_structures.py
18
18
  clusterx/lattices.py
19
19
  clusterx/model.py
20
- clusterx/monte_carlo.py
21
- clusterx/nested_sampling.py
22
20
  clusterx/parent_lattice.py
23
21
  clusterx/structure.py
24
22
  clusterx/structure_selector.py
@@ -40,7 +38,6 @@ clusterx/clusters/cluster.py
40
38
  clusterx/clusters/clusters_pool.py
41
39
  clusterx/estimators/__init__.py
42
40
  clusterx/estimators/estimator_factory.py
43
- clusterx/estimators/split_bregman.py
44
41
  clusterx/io/__init__.py
45
42
  clusterx/io/atat.py
46
43
  clusterx/io/formats.py
@@ -50,7 +47,7 @@ clusterx/test/test_cluster.py
50
47
  clusterx/test/test_cluster_correlations.py
51
48
  clusterx/test/test_cluster_expansion.py
52
49
  clusterx/test/test_cluster_orbit.py
53
- clusterx/test/test_cluster_selector_split_bregman.py
50
+ clusterx/test/test_cluster_orbit2.py
54
51
  clusterx/test/test_clusters_generation.py
55
52
  clusterx/test/test_clusters_selector.py
56
53
  clusterx/test/test_clusters_selector_lasso.py
@@ -62,6 +59,11 @@ clusterx/test/test_get_unique_supercells.py
62
59
  clusterx/test/test_is_nary.py
63
60
  clusterx/test/test_lattice_representation.py
64
61
  clusterx/test/test_metropolis.py
65
- clusterx/test/test_nested_sampling.py
66
62
  clusterx/test/test_parent_lattice_creation.py
67
- clusterx/test/test_structure_selector.py
63
+ clusterx/test/test_predict_swap.py
64
+ clusterx/test/test_structure_selector.py
65
+ clusterx/test/test_structures_set.py
66
+ clusterx/test/test_wanglandau.py
67
+ clusterx/thermodynamics/__init__.py
68
+ clusterx/thermodynamics/monte_carlo.py
69
+ clusterx/thermodynamics/wang_landau.py
@@ -1,3 +1,2 @@
1
1
  [console_scripts]
2
2
  cell = clusterx.cli.main:main
3
-
@@ -1,6 +1,6 @@
1
1
  numpy
2
2
  scipy
3
- sklearn
3
+ scikit-learn
4
4
  matplotlib
5
5
  ase
6
6
  plac
@@ -9,3 +9,5 @@ spglib
9
9
  sympy
10
10
  nglview
11
11
  ipywidgets
12
+ pytest-html
13
+ tqdm
@@ -35,6 +35,8 @@ ase.calculators.emt.parameters.update( {
35
35
  'Ba': (-3.80, 3.00, 2.321, 1.674, 2.873, 2.182, 0.00703),#same as Au
36
36
  'He': (-4.44, 2.60, 3.673, 1.669, 2.757, 1.948, 0.01030), #same as Ni
37
37
  'Na': (-5.10, 1.88, 0.132, 1.652, 2.790, 1.892, 0.01222), #same as N
38
+ 'Zn': (-3.51, 2.77, 2.376, 1.652, 2.740, 1.976, 0.01010), #very similar to Cu
39
+ 'B': (-4.80, 1.83, 0.232, 1.652, 2.790, 1.892, 0.01252), #
38
40
  'X': (-3.50, 1.81, 0.332, 1.652, 2.790, 1.892, 0.01322) #same as C
39
41
  })
40
42
 
@@ -13,18 +13,12 @@ import plac
13
13
  from os.path import dirname, basename, isfile
14
14
  import glob
15
15
  mods = glob.glob(dirname(__file__)+"/*.py")
16
- #print('mods',mods)
17
16
 
18
17
  modules = [ basename(f)[:-3] for f in mods if isfile(f) and not f.endswith('__init__.py') and not f.endswith('main.py') and not f.endswith('commands.py')]
19
- #print('modules',modules)
20
-
21
18
 
22
19
  # Finally the functions are included here
23
20
  commands = [] # This array is needed by plac
24
21
  for module in modules:
25
- #print('#########################')
26
- #print("module in for: ", #print('#########################') odule)
27
- #print("commands: ",getattr(__import__('clusterx.cli.'+module,fromlist=[module]),'commands'))
28
22
  for command in getattr(__import__('clusterx.cli.'+module,fromlist=[module]),'commands'):
29
23
  commands.append(command)
30
24
  setattr(sys.modules[__name__], command, getattr(__import__('clusterx.cli.'+module,fromlist=[module]),command))
@@ -25,8 +25,8 @@ def test(testslist=False, name=""):
25
25
  print(path)
26
26
  else:
27
27
  path = os.path.dirname(tm.__file__)
28
-
29
- pytest.main([path,"-v","--cache-clear","--capture=no","--disable-warnings","--junit-xml=testlog.xml"])
30
- return ()
31
-
32
28
 
29
+ exit_code = pytest.main([path,"-v","--cache-clear","--capture=no","--disable-warnings","--junit-xml=testlog.xml","--html=testlog.html"])
30
+ if not exit_code == pytest.ExitCode.OK:
31
+ raise AssertionError(f"Tests have failed! pytest exit code: {exit_code}")
32
+ return ()
@@ -38,27 +38,22 @@ class Cluster():
38
38
 
39
39
  **Methods:**
40
40
  """
41
- def __new__(cls, atom_indexes, atom_numbers, super_cell=None, distances=None):
42
- for iai, ai in enumerate(atom_indexes):
43
- for _iai, _ai in enumerate(atom_indexes):
44
- if ai == _ai and atom_numbers[iai] != atom_numbers[_iai]:
45
- raise ValueError("Cluster may not have different species on the same site.")
41
+
42
+ def __init__(self, atom_indexes, atom_numbers, super_cell=None, distances=None):
46
43
 
47
44
  if len(atom_indexes) != len(atom_numbers):
48
45
  raise ValueError("Initialization error, number of sites in cluster different from number of species.")
49
46
 
50
- cl = super(Cluster,cls).__new__(cls)
51
- cl.__init__(atom_indexes, atom_numbers, super_cell, distances)
52
- return cl
53
-
54
- def __init__(self, atom_indexes, atom_numbers, super_cell=None, distances=None):
55
- #self.ais = np.array(atom_indexes)
56
- #self.ans = np.array(atom_numbers)
57
47
  if len(atom_indexes)!=0:
58
- self.ais, self.ans = (list(t) for t in zip(*sorted(zip(atom_indexes, atom_numbers))))
48
+ try:
49
+ self.ais,self.ans = list(zip(*sorted(zip(np.array(atom_indexes),np.array(atom_numbers)))))
50
+ except:
51
+ raise ValueError("Cluster initialization failed")
52
+
59
53
  else:
60
- self.ais = np.array(atom_indexes)
54
+ self.ais = np.array(atom_indexes, dtype=int)
61
55
  self.ans = np.array(atom_numbers)
56
+
62
57
  self.npoints = len(atom_numbers)
63
58
  self.positions_cartesian = None
64
59
  self.alphas = None
@@ -75,11 +70,13 @@ class Cluster():
75
70
  self.positions_cartesian = np.zeros((self.npoints,3))
76
71
  #self.positions_scaled = np.zeros((self.npoints,3))
77
72
  for ip, idx in enumerate(atom_indexes):
78
- self.positions_cartesian[ip] = super_cell.get_positions(wrap=True)[idx]
73
+ #self.positions_cartesian[ip] = super_cell.get_positions(wrap=True)[idx]
74
+ self.positions_cartesian[ip] = super_cell.get_positions()[idx]
79
75
  #self.positions_scaled[ip] = super_cell.get_scaled_positions(wrap=True)[idx]
80
76
  self.site_type[ip] = tags[idx]
81
77
  self.alphas[ip] = np.argwhere(sites[idx] == self.ans[ip])
82
78
 
79
+ """
83
80
  # Set radius
84
81
  r = 0.0
85
82
  if self.npoints > 1:
@@ -92,6 +89,27 @@ class Cluster():
92
89
  if r < d:
93
90
  r = d
94
91
  self.radius = r
92
+ """
93
+
94
+ # Set radius
95
+ # FIX this! Radius cannot be based on distance in supercell, as it will fail for small supercells and large clusters wrapped into it.
96
+ r = 0.0
97
+ if self.npoints > 1:
98
+ if distances is not None:
99
+ for i1, idx1 in enumerate(self.ais):
100
+ for idx2 in self.ais[i1+1:]:
101
+ d = distances[idx1,idx2]
102
+ if r < d:
103
+ r = d
104
+ else:
105
+ for i1 in range(self.npoints-1):
106
+ for i2 in range(i1+1, self.npoints):
107
+ d = np.linalg.norm(self.positions_cartesian[i1]-self.positions_cartesian[i2])
108
+ if r < d:
109
+ r = d
110
+ self.radius = r
111
+
112
+ self.myhash = self.__hash__()
95
113
 
96
114
  """
97
115
  def __lt__(self,other):
@@ -106,7 +124,7 @@ class Cluster():
106
124
  """
107
125
  return self.alphas
108
126
 
109
- def set_radius(self,distances):
127
+ def _compute_radius(self,distances):
110
128
  r = 0.0
111
129
  if self.npoints > 1:
112
130
  for i1, idx1 in enumerate(self.ais):
@@ -117,10 +135,13 @@ class Cluster():
117
135
  self.radius = r
118
136
 
119
137
  def get_radius(self,distances=None):
138
+ """Return cluster radius
139
+ The radius of a cluster is the maximum distance between any pair of its points.
140
+ """
120
141
  if self.radius is not None:
121
142
  return self.radius
122
143
  elif distances is not None:
123
- self.set_radius(distances)
144
+ self._compute_radius(distances)
124
145
  return self.radius
125
146
 
126
147
  def _get_idxs_norm(self):
@@ -136,45 +157,14 @@ class Cluster():
136
157
  else:
137
158
  return self.npoints < other.npoints
138
159
 
160
+ def __repr__(self):
161
+ return "Cluster["+str(list(zip(self.ais,self.ans)))+"]"
162
+
163
+ def __hash__(self):
164
+ return hash(str(list(zip(self.ais,self.ans))))
165
+
139
166
  def __eq__(self, other):
140
- if isinstance(other, self.__class__):
141
- ais = self.ais
142
- ans = self.ans
143
- oais = other.ais
144
- oans = other.ans
145
- npoints = self.npoints
146
-
147
- ns = len(ais)
148
- no = len(oais)
149
- if ns != no:
150
- return False
151
-
152
- #if Counter(ais) != Counter(oais):
153
- # return False
154
-
155
- #if sorted(ais) != sorted(oais):
156
- # return False
157
-
158
- for i in range(ns):
159
- if ais[i] != oais[i] or ans[i] != oans[i]:
160
- return False
161
-
162
- #if (ais != oais).any():
163
- # return False
164
-
165
- #if (ans != oans).any():
166
- # return False
167
-
168
- """
169
- for i in range(npoints):
170
- for j in range(npoints):
171
- if ais[i] == oais[j] and ans[i] != oans[j]:
172
- return False
173
- """
174
- return True
175
-
176
- else:
177
- return False
167
+ return self.myhash == other.myhash
178
168
 
179
169
  def __len__(self):
180
170
  return len(self.ais)
@@ -213,18 +203,8 @@ class Cluster():
213
203
  The symmetry operations ``rr`` and ``tt`` refer to scaled coordinates.
214
204
  The parameter ``cell`` contains row-wise the corresponding cartesian
215
205
  coordinates of the cell vectors.
216
-
217
- **Example:**
218
- Getting the multiplicities of clusters in a clusters pool::
219
-
220
- from clusterx.symmetry import get_spacegroup
221
- sc_sg, sc_sym = get_spacegroup(parent_lattice) # Scaled to parent_lattice
222
- m = []
223
- for cl in clusters_pool.get_cpool():
224
- m.append(cl.get_multiplicity(sc_sym["rotations"],sc_sym["translations"]))
225
-
226
206
  """
227
- from clusterx.symmetry import get_spacegroup, get_scaled_positions, get_internal_translations, wrap_scaled_positions
207
+ from clusterx.symmetry import get_scaled_positions, get_internal_translations, wrap_scaled_positions
228
208
 
229
209
  orbit = []
230
210
  for r,t in zip(rr,tt):