|
39 | 39 | { |
40 | 40 | "cell_type": "code", |
41 | 41 | "source": [ |
42 | | - "DEFECT_TYPE = \"substitution\" # (e.g. \"vacancy\", \"substitution\", \"interstitial\")\n", |
43 | | - "SITE_ID = None # Site index of the defect\n", |
44 | | - "COORDINATE = None # Position of the defect in crystal coordinates\n", |
45 | | - "APPROXIMATE_COORDINATE = None # Approximate coordinates of the defect in crystal coordinates\n", |
46 | | - "CHEMICAL_ELEMENT = \"C\" # Element to be placed at the site (ignored for vacancy)\n", |
47 | | - "\n", |
| 42 | + "# Selected material will be used as a unit cell to create a supercell first.\n", |
48 | 43 | "SUPERCELL_MATRIX = [[3, 0, 0], [0, 3, 0], [0, 0, 3]]\n", |
49 | 44 | "\n", |
50 | 45 | "# List of dictionaries with defect parameters\n", |
51 | 46 | "DEFECT_CONFIGS = [\n", |
52 | 47 | " {\n", |
53 | | - " \"defect_type\": DEFECT_TYPE,\n", |
54 | | - " \"approximate_coordinate\": [0.0, 0.0, 0.0],\n", |
55 | | - " \"chemical_element\": \"C\",\n", |
56 | | - " # \"site_id\": 0,\n", |
57 | | - " # \"coordinate\": None,\n", |
| 48 | + " \"defect_type\": \"substitution\", # (e.g. \"vacancy\", \"substitution\", \"interstitial\")\n", |
| 49 | + " \"chemical_element\": \"C\", # Substitution element\n", |
| 50 | + " \"approximate_coordinate\": [0.0, 0.0, 0.0], # Approx. coord that will be resolved to the closest site\n", |
| 51 | + " \"use_cartesian_coordinates\": True, # Use cartesian or crystal coordinates\n", |
58 | 52 | " },\n", |
59 | | - " # Uncomment the following to create multiple defects\n", |
| 53 | + "\n", |
| 54 | + " # Uncomment the next lines to create more defects\n", |
60 | 55 | " # {\n", |
61 | | - " # \"defect_type\": \"vacancy\",\n", |
62 | | - " # \"site_id\": 0,\n", |
| 56 | + " # \"defect_type\": \"vacancy\", # Remove an atom at a specific site\n", |
| 57 | + " # \"site_id\": 0, # Index of the atom in the host material\n", |
63 | 58 | " # },\n", |
| 59 | + " # {\n", |
| 60 | + " # \"defect_type\": \"interstitial\", # Add an atom at an interstitial site\n", |
| 61 | + " # \"coordinate\": [0.25, 0.25, 0.25], # Exact position\n", |
| 62 | + " # \"use_cartesian_coordinates\": False, # Use cartesian or crystal coordinates\n", |
| 63 | + " # \"chemical_element\": \"N\", # Add interstitial atom\n", |
| 64 | + " # }\n", |
64 | 65 | "]" |
65 | 66 | ], |
66 | 67 | "metadata": { |
67 | | - "collapsed": false, |
68 | | - "ExecuteTime": { |
69 | | - "end_time": "2025-05-13T22:53:42.339489Z", |
70 | | - "start_time": "2025-05-13T22:53:42.334226Z" |
71 | | - } |
| 68 | + "collapsed": false |
72 | 69 | }, |
73 | 70 | "id": "9d8b1890b34d850a", |
74 | 71 | "outputs": [], |
75 | | - "execution_count": 1 |
| 72 | + "execution_count": null |
76 | 73 | }, |
77 | 74 | { |
78 | 75 | "cell_type": "markdown", |
|
100 | 97 | " await install_packages(\"create_point_defect.ipynb\")" |
101 | 98 | ], |
102 | 99 | "metadata": { |
103 | | - "collapsed": false, |
104 | | - "ExecuteTime": { |
105 | | - "end_time": "2025-05-13T22:53:42.360804Z", |
106 | | - "start_time": "2025-05-13T22:53:42.358355Z" |
107 | | - } |
| 100 | + "collapsed": false |
108 | 101 | }, |
109 | 102 | "id": "ef664b14457530fd", |
110 | 103 | "outputs": [], |
111 | | - "execution_count": 2 |
| 104 | + "execution_count": null |
112 | 105 | }, |
113 | 106 | { |
114 | 107 | "cell_type": "markdown", |
|
129 | 122 | "materials = get_materials(globals())" |
130 | 123 | ], |
131 | 124 | "metadata": { |
132 | | - "collapsed": false, |
133 | | - "ExecuteTime": { |
134 | | - "end_time": "2025-05-13T22:53:43.047946Z", |
135 | | - "start_time": "2025-05-13T22:53:42.474580Z" |
136 | | - } |
| 125 | + "collapsed": false |
137 | 126 | }, |
138 | 127 | "id": "be38fdda1984c654", |
139 | | - "outputs": [ |
140 | | - { |
141 | | - "name": "stdout", |
142 | | - "output_type": "stream", |
143 | | - "text": [ |
144 | | - "0: 0-Ni\n", |
145 | | - "1: 1-Graphene\n", |
146 | | - "2: C2(001)-Ni4(111), Interface\n", |
147 | | - "3: Ni4(001), termination Ni_P4:mmm_2, Slab\n", |
148 | | - "4: O8Zr4(011), termination O2_P2:m_1, Slab\n", |
149 | | - "Retrieved 5 materials.\n" |
150 | | - ] |
151 | | - } |
152 | | - ], |
153 | | - "execution_count": 3 |
| 128 | + "outputs": [], |
| 129 | + "execution_count": null |
154 | 130 | }, |
155 | 131 | { |
156 | 132 | "cell_type": "markdown", |
|
173 | 149 | "visualize(supercell, repetitions=[1, 1, 1], rotation=\"0x\")" |
174 | 150 | ], |
175 | 151 | "metadata": { |
176 | | - "collapsed": false, |
177 | | - "ExecuteTime": { |
178 | | - "end_time": "2025-05-13T22:53:45.847490Z", |
179 | | - "start_time": "2025-05-13T22:53:43.138551Z" |
180 | | - } |
| 152 | + "collapsed": false |
181 | 153 | }, |
182 | 154 | "id": "e2d24109d3068c9e", |
183 | | - "outputs": [ |
184 | | - { |
185 | | - "data": { |
186 | | - "text/plain": [ |
187 | | - "GridBox(children=(VBox(children=(Label(value='Ni27 - Material - rotation: 0x', layout=Layout(align_self='cente…" |
188 | | - ], |
189 | | - "application/vnd.jupyter.widget-view+json": { |
190 | | - "version_major": 2, |
191 | | - "version_minor": 0, |
192 | | - "model_id": "cdc432e2a99c46af8bad06e72d376c4a" |
193 | | - } |
194 | | - }, |
195 | | - "metadata": {}, |
196 | | - "output_type": "display_data" |
197 | | - } |
198 | | - ], |
199 | | - "execution_count": 4 |
| 155 | + "outputs": [], |
| 156 | + "execution_count": null |
200 | 157 | }, |
201 | 158 | { |
202 | 159 | "cell_type": "markdown", |
|
220 | 177 | "defect_builder_parameters = PointDefectBuilderParameters(center_defect=False)" |
221 | 178 | ], |
222 | 179 | "metadata": { |
223 | | - "collapsed": false, |
224 | | - "ExecuteTime": { |
225 | | - "end_time": "2025-05-13T22:53:45.909568Z", |
226 | | - "start_time": "2025-05-13T22:53:45.873079Z" |
227 | | - } |
| 180 | + "collapsed": false |
228 | 181 | }, |
229 | 182 | "id": "e385e50ae11ed2b9", |
230 | 183 | "outputs": [], |
231 | | - "execution_count": 5 |
| 184 | + "execution_count": null |
232 | 185 | }, |
233 | 186 | { |
234 | 187 | "cell_type": "markdown", |
|
245 | 198 | "source": [ |
246 | 199 | "from mat3ra.made.tools.build.defect import create_defects\n", |
247 | 200 | "\n", |
248 | | - "material_with_defect = create_defects(builder_parameters=defect_builder_parameters, configurations=defect_configurations)" |
| 201 | + "material_with_defect = create_defects(builder_parameters=defect_builder_parameters,\n", |
| 202 | + " configurations=defect_configurations)" |
249 | 203 | ], |
250 | 204 | "metadata": { |
251 | | - "collapsed": false, |
252 | | - "ExecuteTime": { |
253 | | - "end_time": "2025-05-13T22:53:45.966908Z", |
254 | | - "start_time": "2025-05-13T22:53:45.916257Z" |
255 | | - } |
| 205 | + "collapsed": false |
256 | 206 | }, |
257 | 207 | "id": "a990fa35742d7269", |
258 | | - "outputs": [ |
259 | | - { |
260 | | - "name": "stderr", |
261 | | - "output_type": "stream", |
262 | | - "text": [ |
263 | | - "/Users/mat3ra/code/GREEN/api-examples/.venv-3.11.2/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['international']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead\n", |
264 | | - " warnings.warn(\n", |
265 | | - "/Users/mat3ra/code/GREEN/api-examples/.venv-3.11.2/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['number']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead\n", |
266 | | - " warnings.warn(\n", |
267 | | - "/Users/mat3ra/code/GREEN/api-examples/.venv-3.11.2/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['equivalent_atoms']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead\n", |
268 | | - " warnings.warn(\n", |
269 | | - "/Users/mat3ra/code/GREEN/api-examples/.venv-3.11.2/lib/python3.11/site-packages/spglib/spglib.py:115: DeprecationWarning: dict interface (SpglibDataset['wyckoffs']) is deprecated.Use attribute interface ({self.__class__.__name__}.{key}) instead\n", |
270 | | - " warnings.warn(\n" |
271 | | - ] |
272 | | - } |
273 | | - ], |
274 | | - "execution_count": 6 |
| 208 | + "outputs": [], |
| 209 | + "execution_count": null |
275 | 210 | }, |
276 | 211 | { |
277 | 212 | "cell_type": "markdown", |
|
295 | 230 | " {\"material\": material_with_defect, \"title\": f\"Material with defect\"}])" |
296 | 231 | ], |
297 | 232 | "metadata": { |
298 | | - "collapsed": false, |
299 | | - "ExecuteTime": { |
300 | | - "end_time": "2025-05-13T22:53:46.124855Z", |
301 | | - "start_time": "2025-05-13T22:53:45.980978Z" |
302 | | - } |
| 233 | + "collapsed": false |
303 | 234 | }, |
304 | 235 | "id": "509b18661a069e42", |
305 | | - "outputs": [ |
306 | | - { |
307 | | - "data": { |
308 | | - "text/plain": [ |
309 | | - "GridBox(children=(VBox(children=(Label(value='Ni27 - Original material - rotation: -90x', layout=Layout(align_…" |
310 | | - ], |
311 | | - "application/vnd.jupyter.widget-view+json": { |
312 | | - "version_major": 2, |
313 | | - "version_minor": 0, |
314 | | - "model_id": "a8f71c9f02b54a9ab51c4e9e969e56a3" |
315 | | - } |
316 | | - }, |
317 | | - "metadata": {}, |
318 | | - "output_type": "display_data" |
319 | | - }, |
320 | | - { |
321 | | - "data": { |
322 | | - "text/plain": [ |
323 | | - "GridBox(children=(VBox(children=(Label(value='Ni27 - Original material - rotation: 0x,0y,0z', layout=Layout(al…" |
324 | | - ], |
325 | | - "application/vnd.jupyter.widget-view+json": { |
326 | | - "version_major": 2, |
327 | | - "version_minor": 0, |
328 | | - "model_id": "3cd37b2b7bd646dd8922e0970a5bfe39" |
329 | | - } |
330 | | - }, |
331 | | - "metadata": {}, |
332 | | - "output_type": "display_data" |
333 | | - } |
334 | | - ], |
335 | | - "execution_count": 7 |
| 236 | + "outputs": [], |
| 237 | + "execution_count": null |
336 | 238 | }, |
337 | 239 | { |
338 | 240 | "cell_type": "markdown", |
|
352 | 254 | "set_materials([material_with_defect])" |
353 | 255 | ], |
354 | 256 | "metadata": { |
355 | | - "collapsed": false, |
356 | | - "ExecuteTime": { |
357 | | - "end_time": "2025-05-13T22:53:46.138694Z", |
358 | | - "start_time": "2025-05-13T22:53:46.134037Z" |
359 | | - } |
| 257 | + "collapsed": false |
360 | 258 | }, |
361 | 259 | "id": "61daa5afcbc078a9", |
362 | | - "outputs": [ |
363 | | - { |
364 | | - "name": "stdout", |
365 | | - "output_type": "stream", |
366 | | - "text": [ |
367 | | - "Data for materials written to uploads/Ni26 C1, Substitution C Defect.json\n" |
368 | | - ] |
369 | | - } |
370 | | - ], |
371 | | - "execution_count": 8 |
| 260 | + "outputs": [], |
| 261 | + "execution_count": null |
372 | 262 | } |
373 | 263 | ], |
374 | 264 | "metadata": { |
|
0 commit comments