Skip to content

Commit 217d20f

Browse files
authored
Merge pull request #230 from Exabyte-io/feature/SOF-7643
feature/SOF 7643
2 parents fa70d51 + 3bd56ae commit 217d20f

File tree

5 files changed

+120
-87
lines changed

5 files changed

+120
-87
lines changed

other/materials_designer/create_adatom_defect.ipynb

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,28 @@
141141
"metadata": {},
142142
"cell_type": "code",
143143
"source": [
144-
"from mat3ra.made.tools.build.slab import SlabConfiguration, get_terminations, create_slab\n",
144+
"from mat3ra.made.tools.analyze.lattice_planes import CrystalLatticePlanesMaterialAnalyzer\n",
145+
"from mat3ra.made.tools.build.slab.helpers import create_slab\n",
145146
"from utils.visualize import visualize_materials as visualize\n",
146147
"\n",
147148
"material = materials[0]\n",
148-
"slab_config = SlabConfiguration(\n",
149-
" bulk=material,\n",
149+
"# Create analyzer to get terminations\n",
150+
"analyzer = CrystalLatticePlanesMaterialAnalyzer(material=material, miller_indices=MILLER_INDICES)\n",
151+
"slab_terminations = analyzer.terminations\n",
152+
"# Get termination from analyzer\n",
153+
"terminations = analyzer.terminations\n",
154+
"termination = terminations[0] # Use first termination\n",
155+
"\n",
156+
"slab = create_slab(\n",
157+
" crystal=material,\n",
158+
" termination=termination,\n",
150159
" miller_indices=MILLER_INDICES,\n",
151-
" number_of_layers=SLAB_THICKNESS,\n",
152-
" vacuum=VACUUM,\n",
153-
" use_orthogonal_z=True,\n",
154-
" xy_supercell_matrix=SUPERCELL_MATRIX\n",
160+
" number_of_layers=1,\n",
161+
" vacuum=0,\n",
162+
" xy_supercell_matrix=[[1, 0], [0, 1]],\n",
163+
" use_orthogonal_c=True,\n",
164+
" use_conventional_cell=True\n",
155165
")\n",
156-
"termination = get_terminations(slab_config)[0]\n",
157-
"slab = create_slab(slab_config, termination)\n",
158166
"visualize([{\"material\": slab, \"rotation\": \"0x\"}, {\"material\": slab, \"rotation\": \"-90x\"}], repetitions=[1, 1, 1])"
159167
],
160168
"id": "8ea8b4402aef0cf0",

other/materials_designer/create_cluster_sphere.ipynb

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
},
3939
{
4040
"cell_type": "code",
41-
"outputs": [],
4241
"source": [
4342
"RADIUS = 4.5 # in Angstroms\n",
4443
"VACUUM = 10.0 # in Angstroms on each side\n",
@@ -48,6 +47,7 @@
4847
"collapsed": false
4948
},
5049
"id": "9d8b1890b34d850a",
50+
"outputs": [],
5151
"execution_count": null
5252
},
5353
{
@@ -63,7 +63,6 @@
6363
},
6464
{
6565
"cell_type": "code",
66-
"outputs": [],
6766
"source": [
6867
"import sys\n",
6968
"\n",
@@ -80,6 +79,7 @@
8079
"collapsed": false
8180
},
8281
"id": "ef664b14457530fd",
82+
"outputs": [],
8383
"execution_count": null
8484
},
8585
{
@@ -94,7 +94,6 @@
9494
},
9595
{
9696
"cell_type": "code",
97-
"outputs": [],
9897
"source": [
9998
"from utils.jupyterlite import get_materials\n",
10099
"\n",
@@ -104,6 +103,7 @@
104103
"collapsed": false
105104
},
106105
"id": "be38fdda1984c654",
106+
"outputs": [],
107107
"execution_count": null
108108
},
109109
{
@@ -118,21 +118,29 @@
118118
},
119119
{
120120
"cell_type": "code",
121-
"outputs": [],
122121
"source": [
123122
"from mat3ra.made.tools.build.supercell import create_supercell\n",
124-
"from mat3ra.made.tools.build.slab import create_slab, SlabConfiguration\n",
123+
"from mat3ra.made.tools.analyze.lattice_planes import CrystalLatticePlanesMaterialAnalyzer\n",
124+
"from mat3ra.made.tools.build.slab.helpers import create_slab\n",
125125
"from utils.visualize import visualize_materials as visualize\n",
126126
"\n",
127-
"slab_config = SlabConfiguration(\n",
128-
" bulk=materials[0],\n",
127+
"# Create analyzer to get terminations\n",
128+
"analyzer = CrystalLatticePlanesMaterialAnalyzer(material=materials[0], miller_indices=Z_ORIENTATION)\n",
129+
"\n",
130+
"# Get termination from analyzer\n",
131+
"terminations = analyzer.terminations\n",
132+
"termination = terminations[0] # Use first termination\n",
133+
"\n",
134+
"slab = create_slab(\n",
135+
" crystal=materials[0],\n",
136+
" termination=termination,\n",
129137
" miller_indices=Z_ORIENTATION,\n",
130138
" number_of_layers=1,\n",
131139
" vacuum=0,\n",
132-
" use_orthogonal_z=True\n",
140+
" xy_supercell_matrix=[[1, 0], [0, 1]],\n",
141+
" use_orthogonal_c=True,\n",
142+
" use_conventional_cell=True\n",
133143
")\n",
134-
"\n",
135-
"slab = create_slab(slab_config)\n",
136144
"length = slab.lattice.a\n",
137145
"sufficient_n = int(2 * RADIUS / length) + 1\n",
138146
"\n",
@@ -145,6 +153,7 @@
145153
"collapsed": false
146154
},
147155
"id": "7fcb1e02e84c5f35",
156+
"outputs": [],
148157
"execution_count": null
149158
},
150159
{
@@ -160,7 +169,6 @@
160169
},
161170
{
162171
"cell_type": "code",
163-
"outputs": [],
164172
"source": [
165173
"from mat3ra.made.tools.modify import filter_by_sphere, add_vacuum, add_vacuum_sides\n",
166174
"\n",
@@ -172,6 +180,7 @@
172180
"collapsed": false
173181
},
174182
"id": "a990fa35742d7269",
183+
"outputs": [],
175184
"execution_count": null
176185
},
177186
{
@@ -186,11 +195,10 @@
186195
},
187196
{
188197
"cell_type": "code",
189-
"outputs": [],
190198
"source": [
191199
"from mat3ra.made.lattice import Lattice\n",
192200
"\n",
193-
"current_vector_1, current_vector_2, current_vector_3 = cluster.lattice.vectors\n",
201+
"current_vector_1, current_vector_2, current_vector_3 = cluster.lattice.vector_arrays\n",
194202
"cubic_vector_1 = [current_vector_1[0], 0, 0]\n",
195203
"cubic_vector_2 = [0, current_vector_2[1], 0]\n",
196204
"cubic_vector_3 = [0, 0, current_vector_3[2]]\n",
@@ -200,6 +208,7 @@
200208
"collapsed": false
201209
},
202210
"id": "4f78c4743b370c3b",
211+
"outputs": [],
203212
"execution_count": null
204213
},
205214
{
@@ -214,7 +223,6 @@
214223
},
215224
{
216225
"cell_type": "code",
217-
"outputs": [],
218226
"source": [
219227
"visualize([{\"material\": slab, \"title\": \"Original material\"},\n",
220228
" {\"material\": cluster, \"title\": f\"Cluster\"}])\n",
@@ -226,6 +234,7 @@
226234
"collapsed": false
227235
},
228236
"id": "509b18661a069e42",
237+
"outputs": [],
229238
"execution_count": null
230239
},
231240
{
@@ -240,7 +249,6 @@
240249
},
241250
{
242251
"cell_type": "code",
243-
"outputs": [],
244252
"source": [
245253
"from utils.jupyterlite import set_materials\n",
246254
"\n",
@@ -251,6 +259,7 @@
251259
"collapsed": false
252260
},
253261
"id": "61daa5afcbc078a9",
262+
"outputs": [],
254263
"execution_count": null
255264
}
256265
],

other/materials_designer/create_cutout_box.ipynb

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
},
4242
{
4343
"cell_type": "code",
44-
"outputs": [],
4544
"source": [
4645
"# Box cutout parameters\n",
4746
"MIN_COORDINATE = [0.25, 0.25, 0.5]\n",
@@ -53,14 +52,15 @@
5352
" \"miller_indices\": (0, 0, 1),\n",
5453
" \"thickness\": 6,\n",
5554
" \"vacuum\": 10.0,\n",
56-
" \"use_orthogonal_z\": True,\n",
55+
" \"use_orthogonal_c\": True,\n",
5756
" \"xy_supercell_matrix\": [[10, 0], [0, 10]]\n",
5857
"}"
5958
],
6059
"metadata": {
6160
"collapsed": false
6261
},
6362
"id": "9d8b1890b34d850a",
63+
"outputs": [],
6464
"execution_count": null
6565
},
6666
{
@@ -76,7 +76,6 @@
7676
},
7777
{
7878
"cell_type": "code",
79-
"outputs": [],
8079
"source": [
8180
"import sys\n",
8281
"\n",
@@ -93,6 +92,7 @@
9392
"collapsed": false
9493
},
9594
"id": "ef664b14457530fd",
95+
"outputs": [],
9696
"execution_count": null
9797
},
9898
{
@@ -107,7 +107,6 @@
107107
},
108108
{
109109
"cell_type": "code",
110-
"outputs": [],
111110
"source": [
112111
"from utils.jupyterlite import get_materials\n",
113112
"\n",
@@ -117,6 +116,7 @@
117116
"collapsed": false
118117
},
119118
"id": "be38fdda1984c654",
119+
"outputs": [],
120120
"execution_count": null
121121
},
122122
{
@@ -131,25 +131,24 @@
131131
},
132132
{
133133
"cell_type": "code",
134-
"outputs": [],
135134
"source": [
136-
"from mat3ra.made.tools.build.slab import create_slab_if_not, SlabConfiguration\n",
135+
"from mat3ra.made.tools.build.slab.helpers import create_slab\n",
137136
"\n",
138-
"default_slab_config = SlabConfiguration(\n",
139-
" bulk=materials[0],\n",
137+
"# Create analyzer to get terminations\n",
138+
"slab = create_slab(\n",
139+
" crystal=materials[0],\n",
140140
" miller_indices=DEFAULT_SLAB_PARAMETERS[\"miller_indices\"],\n",
141141
" number_of_layers=DEFAULT_SLAB_PARAMETERS[\"thickness\"],\n",
142142
" vacuum=DEFAULT_SLAB_PARAMETERS[\"vacuum\"],\n",
143-
" use_orthogonal_z=DEFAULT_SLAB_PARAMETERS[\"use_orthogonal_z\"],\n",
143+
" use_orthogonal_c=DEFAULT_SLAB_PARAMETERS[\"use_orthogonal_c\"],\n",
144144
" xy_supercell_matrix=DEFAULT_SLAB_PARAMETERS[\"xy_supercell_matrix\"]\n",
145-
")\n",
146-
"\n",
147-
"slab = create_slab_if_not(materials[0], default_slab_config)"
145+
")"
148146
],
149147
"metadata": {
150148
"collapsed": false
151149
},
152150
"id": "bfce9928ba2d0c7e",
151+
"outputs": [],
153152
"execution_count": null
154153
},
155154
{
@@ -164,7 +163,6 @@
164163
},
165164
{
166165
"cell_type": "code",
167-
"outputs": [],
168166
"source": [
169167
"from utils.visualize import visualize_materials as visualize\n",
170168
"\n",
@@ -175,6 +173,7 @@
175173
"collapsed": false
176174
},
177175
"id": "7fcb1e02e84c5f35",
176+
"outputs": [],
178177
"execution_count": null
179178
},
180179
{
@@ -190,7 +189,6 @@
190189
},
191190
{
192191
"cell_type": "code",
193-
"outputs": [],
194192
"source": [
195193
"from mat3ra.made.tools.modify import filter_by_box\n",
196194
"\n",
@@ -206,6 +204,7 @@
206204
"collapsed": false
207205
},
208206
"id": "a990fa35742d7269",
207+
"outputs": [],
209208
"execution_count": null
210209
},
211210
{
@@ -220,7 +219,6 @@
220219
},
221220
{
222221
"cell_type": "code",
223-
"outputs": [],
224222
"source": [
225223
"visualize([{\"material\": slab, \"title\": \"Original material\"},\n",
226224
" {\"material\": slab_with_box_cutout, \"title\": f\"Cluster\"}])\n",
@@ -232,6 +230,7 @@
232230
"collapsed": false
233231
},
234232
"id": "509b18661a069e42",
233+
"outputs": [],
235234
"execution_count": null
236235
},
237236
{
@@ -246,7 +245,6 @@
246245
},
247246
{
248247
"cell_type": "code",
249-
"outputs": [],
250248
"source": [
251249
"from utils.jupyterlite import set_materials\n",
252250
"\n",
@@ -257,6 +255,7 @@
257255
"collapsed": false
258256
},
259257
"id": "61daa5afcbc078a9",
258+
"outputs": [],
260259
"execution_count": null
261260
}
262261
],

0 commit comments

Comments
 (0)