@@ -47,11 +47,8 @@ def get_steinhardt_parameters(
47
47
sys = ase_to_pyscal (structure )
48
48
q = (4 , 6 ) if q is None else q
49
49
50
- sys .find_neighbors (method = neighbor_method , cutoff = cutoff )
51
-
52
- sys .calculate_q (q , averaged = averaged )
53
-
54
- sysq = np .array (sys .get_qvals (q , averaged = averaged ))
50
+ sys .find .neighbors (method = neighbor_method , cutoff = cutoff )
51
+ sysq = np .array (sys .calculate .steinhardt_parameter (q , averaged = averaged ))
55
52
56
53
if n_clusters is not None :
57
54
from sklearn import cluster
@@ -78,7 +75,7 @@ def get_centro_symmetry_descriptors(
78
75
csm (list) : list of centrosymmetry parameter
79
76
"""
80
77
sys = ase_to_pyscal (structure )
81
- return np .array (sys .calculate_centrosymmetry (nmax = num_neighbors ))
78
+ return np .array (sys .calculate . centrosymmetry (nmax = num_neighbors ))
82
79
83
80
84
81
def get_diamond_structure_descriptors (
@@ -101,43 +98,26 @@ def get_diamond_structure_descriptors(
101
98
(depends on `mode`)
102
99
"""
103
100
sys = ase_to_pyscal (structure )
104
- diamond_dict = sys .identify_diamond ()
101
+ diamond_dict = sys .analyze . diamond_structure ()
105
102
106
103
ovito_identifiers = [
104
+ "Other" ,
107
105
"Cubic diamond" ,
108
106
"Cubic diamond (1st neighbor)" ,
109
107
"Cubic diamond (2nd neighbor)" ,
110
108
"Hexagonal diamond" ,
111
109
"Hexagonal diamond (1st neighbor)" ,
112
110
"Hexagonal diamond (2nd neighbor)" ,
113
- "Other" ,
114
111
]
115
112
pyscal_identifiers = [
116
113
"others" ,
117
- "fcc" ,
118
- "hcp" ,
119
- "bcc" ,
120
- "ico" ,
121
114
"cubic diamond" ,
122
115
"cubic diamond 1NN" ,
123
116
"cubic diamond 2NN" ,
124
117
"hex diamond" ,
125
118
"hex diamond 1NN" ,
126
119
"hex diamond 2NN" ,
127
120
]
128
- convert_to_ovito = {
129
- 0 : 6 ,
130
- 1 : 6 ,
131
- 2 : 6 ,
132
- 3 : 6 ,
133
- 4 : 6 ,
134
- 5 : 0 ,
135
- 6 : 1 ,
136
- 7 : 2 ,
137
- 8 : 3 ,
138
- 9 : 4 ,
139
- 10 : 5 ,
140
- }
141
121
142
122
if mode == "total" :
143
123
if not ovito_compatibility :
@@ -158,26 +138,22 @@ def get_diamond_structure_descriptors(
158
138
"IdentifyDiamond.counts.HEX_DIAMOND_SECOND_NEIGHBOR" : diamond_dict [
159
139
"hex diamond 2NN"
160
140
],
161
- "IdentifyDiamond.counts.OTHER" : diamond_dict ["others" ]
162
- + diamond_dict ["fcc" ]
163
- + diamond_dict ["hcp" ]
164
- + diamond_dict ["bcc" ]
165
- + diamond_dict ["ico" ],
141
+ "IdentifyDiamond.counts.OTHER" : diamond_dict ["others" ],
166
142
}
167
143
elif mode == "numeric" :
168
144
if not ovito_compatibility :
169
- return np .array ([ atom . structure for atom in sys .atoms ] )
145
+ return np .array (sys .atoms . structure )
170
146
else :
171
- return np .array ([convert_to_ovito [atom .structure ] for atom in sys .atoms ])
147
+ return np .array ([6 if x == 0 else x - 1 for x in sys .atoms .structure ])
148
+
172
149
elif mode == "str" :
173
150
if not ovito_compatibility :
174
- return np .array ([pyscal_identifiers [atom .structure ] for atom in sys .atoms ])
151
+ return np .array (
152
+ [pyscal_identifiers [structure ] for structure in sys .atoms .structure ]
153
+ )
175
154
else :
176
155
return np .array (
177
- [
178
- ovito_identifiers [convert_to_ovito [atom .structure ]]
179
- for atom in sys .atoms
180
- ]
156
+ [ovito_identifiers [structure ] for structure in sys .atoms .structure ]
181
157
)
182
158
else :
183
159
raise ValueError (
@@ -217,16 +193,15 @@ def get_adaptive_cna_descriptors(
217
193
"CommonNeighborAnalysis.counts.ICO" ,
218
194
]
219
195
220
- cna = sys .calculate_cna ()
196
+ cna = sys .analyze . common_neighbor_analysis ()
221
197
222
198
if mode == "total" :
223
199
if not ovito_compatibility :
224
200
return cna
225
201
else :
226
202
return {o : cna [p ] for o , p in zip (ovito_parameter , pyscal_parameter )}
227
203
else :
228
- structure = sys .atoms
229
- cnalist = np .array ([atom .structure for atom in structure ])
204
+ cnalist = np .array (sys .atoms .structure )
230
205
if mode == "numeric" :
231
206
return cnalist
232
207
elif mode == "str" :
@@ -250,9 +225,8 @@ def get_voronoi_volumes(structure: Atoms) -> np.ndarray:
250
225
structure : (ase.atoms.Atoms): The structure to analyze.
251
226
"""
252
227
sys = ase_to_pyscal (structure )
253
- sys .find_neighbors (method = "voronoi" )
254
- structure = sys .atoms
255
- return np .array ([atom .volume for atom in structure ])
228
+ sys .find .neighbors (method = "voronoi" )
229
+ return np .array (sys .atoms .voronoi .volume )
256
230
257
231
258
232
def find_solids (
@@ -287,8 +261,8 @@ def find_solids(
287
261
pyscal system: pyscal system when return_sys=True
288
262
"""
289
263
sys = ase_to_pyscal (structure )
290
- sys .find_neighbors (method = neighbor_method , cutoff = cutoff )
291
- sys .find_solids (
264
+ sys .find . neighbors (method = neighbor_method , cutoff = cutoff )
265
+ sys .find . solids (
292
266
bonds = bonds ,
293
267
threshold = threshold ,
294
268
avgthreshold = avgthreshold ,
@@ -299,6 +273,4 @@ def find_solids(
299
273
)
300
274
if return_sys :
301
275
return sys
302
- structure = sys .atoms
303
- solids = [atom for atom in structure if atom .solid ]
304
- return len (solids )
276
+ return np .sum (sys .atoms .solid )
0 commit comments