Skip to content

Commit 99e00ac

Browse files
authored
Merge pull request #175 from Exabyte-io/feature/SOF-7510
Feature/SOF-7510 Gold clusters
2 parents 549d116 + 7b5f97b commit 99e00ac

File tree

5 files changed

+531
-31
lines changed

5 files changed

+531
-31
lines changed

other/materials_designer/Introduction.ipynb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@
2828
"\n",
2929
"### 1.4. 0D Structures.\n",
3030
"#### [1.4.1. Spherical Cluster. Create a spherical cluster from a bulk material.](create_cluster_sphere.ipynb)\n",
31-
"#### [1.4.2. Custom Shape Cluster. Create a cluster with a custom shape.](create_cluster_custom_shape.ipynb)\n",
32-
"#### [1.4.3. Box-cutout. Create a slab with a box cutout](create_cutout_box.ipynb)\n",
33-
"#### [1.4.4. Custom Shape Cutout. Create a slab with a custom shape cutout.](create_cutout_custom_shape.ipynb)\n",
31+
"#### [1.4.2. Custom Shape Cluster. Create a cluster by cutting it out of a slab.](create_cluster_custom_shape.ipynb)\n",
32+
"#### [1.4.3. Specific Shape Cluster. Create a cluster by building up a specific shape.](create_cluster_specific_shape.ipynb)\n",
33+
"#### [1.4.4. Box-cutout. Create a slab with a box cutout](create_cutout_box.ipynb)\n",
34+
"#### [1.4.5. Custom Shape Cutout. Create a slab with a custom shape cutout.](create_cutout_custom_shape.ipynb)\n",
3435
"\n",
3536
"\n",
3637
"## 2. Multi-Material Structures.\n",

other/materials_designer/create_cluster_custom_shape.ipynb

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@
132132
" return False\n",
133133
" return True\n",
134134
" \n",
135+
" \n",
135136
"condition = CustomCoordinateCondition(radius=RADIUS).condition"
136137
],
137138
"metadata": {
@@ -167,61 +168,50 @@
167168
{
168169
"cell_type": "markdown",
169170
"source": [
170-
"### 1.4. Create a slab of sufficient size"
171+
"## 2. Create the Target Material\n",
172+
"### 2.1. Set the cluster configuration\n"
171173
],
172174
"metadata": {
173175
"collapsed": false
174176
},
175-
"id": "a132fe0ef8bbf0d0"
177+
"id": "690241d87e7bbbe0"
176178
},
177179
{
178180
"cell_type": "code",
179181
"outputs": [],
180182
"source": [
181-
"from mat3ra.made.tools.build.supercell import create_supercell\n",
182-
"from mat3ra.made.tools.build.slab import create_slab, SlabConfiguration\n",
183-
"from utils.visualize import visualize_materials as visualize\n",
184-
"\n",
185-
"slab_config = SlabConfiguration(\n",
186-
" bulk=materials[0],\n",
187-
" miller_indices=Z_ORIENTATION,\n",
188-
" thickness=SUPERCELL_SIZE,\n",
189-
" vacuum=0,\n",
190-
" use_orthogonal_z=True,\n",
191-
" xy_supercell_matrix=[[SUPERCELL_SIZE, 0], [0, SUPERCELL_SIZE]],\n",
192-
")\n",
183+
"from mat3ra.made.tools.build.nanoparticle import ASEBasedNanoparticleConfiguration\n",
184+
"from mat3ra.made.tools.build.nanoparticle.enums import ASENanoparticleShapesEnum\n",
193185
"\n",
194-
"slab = create_slab(slab_config)\n",
195186
"\n",
196-
"visualize([{\"material\": slab, \"title\": \"Original material\"}])\n",
197-
"visualize([{\"material\": slab, \"title\": \"Original material\"}], rotation=\"-90x\")"
187+
"config = ASEBasedNanoparticleConfiguration(\n",
188+
" material=materials[0],\n",
189+
" supercell_size=SUPERCELL_SIZE,\n",
190+
" vacuum=VACUUM,\n",
191+
" z_orientation=Z_ORIENTATION,\n",
192+
" coordinate_condition=condition\n",
193+
")\n"
198194
],
199195
"metadata": {
200196
"collapsed": false
201197
},
202-
"id": "7fcb1e02e84c5f35",
203-
"execution_count": null
198+
"id": "8fbe260fa14db47a"
204199
},
205200
{
206201
"cell_type": "markdown",
207202
"source": [
208-
"## 2. Create the Target Material\n",
209-
"### 2.1. Create spherical cluster\n"
203+
"#### 2.2. Create the cluster"
210204
],
211205
"metadata": {
212206
"collapsed": false
213207
},
214-
"id": "690241d87e7bbbe0"
208+
"id": "10799f3efede924d"
215209
},
216210
{
217211
"cell_type": "code",
218212
"outputs": [],
219213
"source": [
220-
"from mat3ra.made.tools.modify import add_vacuum, add_vacuum_sides, filter_by_condition_on_coordinates\n",
221-
"\n",
222-
"cluster = filter_by_condition_on_coordinates(slab, condition)\n",
223-
"cluster = add_vacuum(cluster, VACUUM, to_bottom=True, on_top=True)\n",
224-
"cluster = add_vacuum_sides(cluster, VACUUM, on_x=True, on_y=True)"
214+
"from mat3ra.made.tools.build.nanoparticle import ASEBasedNanoparticleBuilder"
225215
],
226216
"metadata": {
227217
"collapsed": false
Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"source": [
6+
"# Create a nanocluster with a specific shape.\n",
7+
"\n",
8+
"Create a nanocluster using the ASE-based nanoparticle builder.\n",
9+
"\n",
10+
"<h2 style=\"color:green\">Usage</h2>\n",
11+
"\n",
12+
"1. Make sure to select Input Materials (in the outer runtime) before running the notebook.\n",
13+
"1. Set notebook parameters in cell 1.2. below (or use the default values).\n",
14+
"1. Click “Run” > “Run All” to run all cells. \n",
15+
"1. Scroll down to view results. \n",
16+
"\n",
17+
"\n",
18+
"## Notes\n",
19+
"\n",
20+
"1. For more information, see [Introduction](Introduction.ipynb)\n",
21+
"<!-- # TODO: use a hashtag-based anchor link to interface creation documention above -->\n"
22+
],
23+
"metadata": {
24+
"collapsed": false
25+
},
26+
"id": "f2e1e795020d7b3f"
27+
},
28+
{
29+
"cell_type": "markdown",
30+
"source": [
31+
"## 1. Prepare the Environment\n"
32+
],
33+
"metadata": {
34+
"collapsed": false
35+
},
36+
"id": "5e43ff288847b784"
37+
},
38+
{
39+
"cell_type": "markdown",
40+
"source": [
41+
"### 1.1. Install Packages\n",
42+
"The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))."
43+
],
44+
"metadata": {
45+
"collapsed": false
46+
},
47+
"id": "9adf37a8d2620dc4"
48+
},
49+
{
50+
"cell_type": "code",
51+
"outputs": [],
52+
"source": [
53+
"import sys\n",
54+
"\n",
55+
"if sys.platform == \"emscripten\":\n",
56+
" import micropip\n",
57+
"\n",
58+
" await micropip.install('mat3ra-api-examples', deps=False)\n",
59+
" from utils.jupyterlite import install_packages\n",
60+
"\n",
61+
" await install_packages(\"\")"
62+
],
63+
"metadata": {
64+
"collapsed": false
65+
},
66+
"id": "d9e6be14343d00a1",
67+
"execution_count": null
68+
},
69+
{
70+
"cell_type": "markdown",
71+
"source": [
72+
"### 1.2. Set up cluster parameters\n",
73+
"Parameters for the cuboctahedron and icosahedron shapes can be found at [ASE Clusters](https://wiki.fysik.dtu.dk/ase/ase/cluster/cluster.html#ase.cluster.Cluster)."
74+
],
75+
"metadata": {
76+
"collapsed": false
77+
},
78+
"id": "26066db067a41c93"
79+
},
80+
{
81+
"cell_type": "code",
82+
"outputs": [],
83+
"source": [
84+
"from mat3ra.made.tools.build.nanoparticle.enums import ASENanoparticleShapesEnum\n",
85+
"\n",
86+
"shape = ASENanoparticleShapesEnum.OCTAHEDRON\n",
87+
"parameters = {\n",
88+
" \"length\": 5,\n",
89+
" \"cutoff\": 2\n",
90+
"}"
91+
],
92+
"metadata": {
93+
"collapsed": false
94+
},
95+
"id": "9d8b1890b34d850a",
96+
"execution_count": null
97+
},
98+
{
99+
"cell_type": "markdown",
100+
"source": [
101+
"### 1.3. Get input material"
102+
],
103+
"metadata": {
104+
"collapsed": false
105+
},
106+
"id": "919ad7af8dceeedd"
107+
},
108+
{
109+
"cell_type": "code",
110+
"outputs": [],
111+
"source": [
112+
"from utils.jupyterlite import get_materials\n",
113+
"\n",
114+
"materials = get_materials(globals())"
115+
],
116+
"metadata": {
117+
"collapsed": false
118+
},
119+
"id": "be38fdda1984c654",
120+
"execution_count": null
121+
},
122+
{
123+
"cell_type": "markdown",
124+
"source": [
125+
"## 2. Create the Target Material\n",
126+
"### 2.1. Set the cluster configuration\n"
127+
],
128+
"metadata": {
129+
"collapsed": false
130+
},
131+
"id": "690241d87e7bbbe0"
132+
},
133+
{
134+
"cell_type": "code",
135+
"outputs": [],
136+
"source": [
137+
"from mat3ra.made.tools.build.nanoparticle import ASEBasedNanoparticleConfiguration, ASEBasedNanoparticleBuilder\n",
138+
"\n",
139+
"config = ASEBasedNanoparticleConfiguration(\n",
140+
" material=materials[0],\n",
141+
" shape=shape,\n",
142+
" parameters=parameters\n",
143+
")\n",
144+
"\n",
145+
"builder = ASEBasedNanoparticleBuilder()\n"
146+
],
147+
"metadata": {
148+
"collapsed": false
149+
},
150+
"id": "8fbe260fa14db47a",
151+
"execution_count": null
152+
},
153+
{
154+
"cell_type": "markdown",
155+
"source": [
156+
"#### 2.2. Create the cluster"
157+
],
158+
"metadata": {
159+
"collapsed": false
160+
},
161+
"id": "10799f3efede924d"
162+
},
163+
{
164+
"cell_type": "code",
165+
"outputs": [],
166+
"source": [
167+
"from mat3ra.made.tools.build.nanoparticle import create_nanoparticle\n",
168+
"\n",
169+
"cluster = create_nanoparticle(config, builder)"
170+
],
171+
"metadata": {
172+
"collapsed": false
173+
},
174+
"id": "a990fa35742d7269",
175+
"execution_count": null
176+
},
177+
{
178+
"cell_type": "markdown",
179+
"source": [
180+
"## 3. Visualize the Result(s)"
181+
],
182+
"metadata": {
183+
"collapsed": false
184+
},
185+
"id": "462549d016073446"
186+
},
187+
{
188+
"cell_type": "code",
189+
"outputs": [],
190+
"source": [
191+
"from utils.visualize import visualize_materials\n",
192+
"\n",
193+
"visualize_materials([{\"material\": cluster}, {\"material\": cluster, \"rotation\": \"-90x\"}])"
194+
],
195+
"metadata": {
196+
"collapsed": false
197+
},
198+
"id": "509b18661a069e42",
199+
"execution_count": null
200+
},
201+
{
202+
"cell_type": "markdown",
203+
"source": [
204+
"## 4. Pass data to the outside runtime"
205+
],
206+
"metadata": {
207+
"collapsed": false
208+
},
209+
"id": "d381df29a6bbdd82"
210+
},
211+
{
212+
"cell_type": "code",
213+
"outputs": [],
214+
"source": [
215+
"from utils.jupyterlite import set_materials\n",
216+
"\n",
217+
"cluster.name = f\"{materials[0].name} {shape.name.capitalize()} cluster\"\n",
218+
"set_materials(cluster)"
219+
],
220+
"metadata": {
221+
"collapsed": false
222+
},
223+
"id": "61daa5afcbc078a9",
224+
"execution_count": null
225+
}
226+
],
227+
"metadata": {
228+
"kernelspec": {
229+
"display_name": "Python 3",
230+
"language": "python",
231+
"name": "python3"
232+
},
233+
"language_info": {
234+
"codemirror_mode": {
235+
"name": "ipython",
236+
"version": 2
237+
},
238+
"file_extension": ".py",
239+
"mimetype": "text/x-python",
240+
"name": "python",
241+
"nbconvert_exporter": "python",
242+
"pygments_lexer": "ipython2",
243+
"version": "2.7.6"
244+
}
245+
},
246+
"nbformat": 4,
247+
"nbformat_minor": 5
248+
}

other/materials_designer/create_cluster_sphere.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"source": [
9898
"from utils.jupyterlite import get_materials\n",
9999
"\n",
100-
"materials = get_materials(globals())"
100+
"materials = get_materials(globals())\n"
101101
],
102102
"metadata": {
103103
"collapsed": false

0 commit comments

Comments
 (0)