Skip to content

Commit ff1a74b

Browse files
committed
Add energy statistics printing
1 parent e0c9520 commit ff1a74b

11 files changed

Lines changed: 466 additions & 12 deletions

File tree

example/python_pkg/Al_learn/DRAFFLE/pca.ipynb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,22 @@
212212
"print(\"Relaxed min energy: \", np.min(energies_per_atom))"
213213
]
214214
},
215+
{
216+
"cell_type": "code",
217+
"execution_count": null,
218+
"metadata": {},
219+
"outputs": [],
220+
"source": [
221+
"# print the min, max, mean, and std of the relaxed energies\n",
222+
"print(\"Relaxed energies per atom: min = {:.2f}, max = {:.2f}, mean = {:.2f}, std = {:.2f}\".format(\n",
223+
" np.min(rlxd_delta_en_per_atom), np.max(rlxd_delta_en_per_atom), \n",
224+
" np.mean(rlxd_delta_en_per_atom), np.std(rlxd_delta_en_per_atom)))\n",
225+
"# plot in latex table format\n",
226+
"print(\"Aluminium search & {:.2f} & {:.2f} & {:.2f} & {:.2f} \\\\\\\\\".format(\n",
227+
" np.min(rlxd_delta_en_per_atom), np.max(rlxd_delta_en_per_atom), \n",
228+
" np.mean(rlxd_delta_en_per_atom), np.std(rlxd_delta_en_per_atom)))"
229+
]
230+
},
215231
{
216232
"cell_type": "code",
217233
"execution_count": null,

example/python_pkg/C_learn/DRAFFLE/pca.ipynb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,22 @@
169169
" print(\"Minimum energy per atom is not zero. Check the energy calculation.\")"
170170
]
171171
},
172+
{
173+
"cell_type": "code",
174+
"execution_count": null,
175+
"metadata": {},
176+
"outputs": [],
177+
"source": [
178+
"# print the min, max, mean, and std of the relaxed energies\n",
179+
"print(\"Relaxed energies per atom: min = {:.2f}, max = {:.2f}, mean = {:.2f}, std = {:.2f}\".format(\n",
180+
" np.min(rlxd_delta_en_per_atom), np.max(rlxd_delta_en_per_atom), \n",
181+
" np.mean(rlxd_delta_en_per_atom), np.std(rlxd_delta_en_per_atom)))\n",
182+
"# plot in latex table format\n",
183+
"print(\"Diamond search & {:.2f} & {:.2f} & {:.2f} & {:.2f} \\\\\\\\\".format(\n",
184+
" np.min(rlxd_delta_en_per_atom), np.max(rlxd_delta_en_per_atom), \n",
185+
" np.mean(rlxd_delta_en_per_atom), np.std(rlxd_delta_en_per_atom)))\n"
186+
]
187+
},
172188
{
173189
"cell_type": "code",
174190
"execution_count": null,

example/python_pkg/C_learn/DRSS/pca.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,14 +434,14 @@
434434
" q2 = subset['Energy per atom'].quantile(0.5)\n",
435435
" q3 = subset['Energy per atom'].quantile(0.75)\n",
436436
" \n",
437-
" ax_kde.axvline(q1, color=colour, linestyle='--', linewidth=1.25, label=f'{source} Q1')\n",
438-
" ax_kde.axvline(q2, color=colour, linestyle=':', linewidth=1.25, label=f'{source} Q2')\n",
439-
" ax_kde.axvline(q3, color=colour, linestyle='-.', linewidth=1.25, label=f'{source} Q3')\n",
437+
" ax_kde.axvline(q1, color=colour, linestyle='--', linewidth=1.7, label=f'{source} Q1', dashes=(10, 3))\n",
438+
" ax_kde.axvline(q2, color=colour, linestyle='-.', linewidth=1.7, label=f'{source} Q2')\n",
439+
" ax_kde.axvline(q3, color=colour, linestyle=':', linewidth=1.7, label=f'{source} Q3')\n",
440440
" # plot these only to the height of the rug at that point\n",
441441
"\n",
442442
"plt.tight_layout()\n",
443443
"# Save the figure\n",
444-
"plt.savefig('C_'+identifier+'_kde_rug_rlxd_seed'+str(seed)+'.pdf', bbox_inches='tight', pad_inches=0, facecolor=fig.get_facecolor(), edgecolor='none')\n",
444+
"plt.savefig('C'+identifier+'_kde_rug_rlxd_seed'+str(seed)+'.pdf', bbox_inches='tight', pad_inches=0, facecolor=fig.get_facecolor(), edgecolor='none')\n",
445445
"\n",
446446
"plt.show()\n"
447447
]

example/python_pkg/C_learn/Dgraphite_diamond/pca.ipynb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,22 @@
168168
" print(\"Minimum energy per atom is not zero. Check the energy calculation.\")"
169169
]
170170
},
171+
{
172+
"cell_type": "code",
173+
"execution_count": null,
174+
"metadata": {},
175+
"outputs": [],
176+
"source": [
177+
"# print the min, max, mean, and std of the relaxed energies\n",
178+
"print(\"Relaxed energies per atom: min = {:.2f}, max = {:.2f}, mean = {:.2f}, std = {:.2f}\".format(\n",
179+
" np.min(rlxd_delta_en_per_atom), np.max(rlxd_delta_en_per_atom), \n",
180+
" np.mean(rlxd_delta_en_per_atom), np.std(rlxd_delta_en_per_atom)))\n",
181+
"# plot in latex table format\n",
182+
"print(\"Carbon search & {:.2f} & {:.2f} & {:.2f} & {:.2f} \\\\\\\\\".format(\n",
183+
" np.min(rlxd_delta_en_per_atom), np.max(rlxd_delta_en_per_atom), \n",
184+
" np.mean(rlxd_delta_en_per_atom), np.std(rlxd_delta_en_per_atom)))"
185+
]
186+
},
171187
{
172188
"cell_type": "code",
173189
"execution_count": null,

example/python_pkg/MoS2_learn/DRAFFLE/pca.ipynb

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"source": [
4343
"## Set the plotting parameters\n",
4444
"seed = 0\n",
45-
"identifier = \"_VASP\"\n",
45+
"identifier = \"\"\n",
4646
"output_directory_prefix = \"DResponse\"\n",
4747
"# min_energy = -"
4848
]
@@ -57,7 +57,7 @@
5757
"from agox.models.descriptors.fingerprint import Fingerprint\n",
5858
"# from agox.models.descriptors import Voronoi\n",
5959
"\n",
60-
"template = read(output_directory_prefix+identifier+\"/unrlxd_structures_seed0.xyz\")\n",
60+
"template = read(output_directory_prefix+identifier+\"/unrlxd_structures_seed0.traj\")\n",
6161
"# diamond = bulk(\"C\", \"diamond\", a=3.567) # Lattice constant for diamond cubic carbon\n",
6262
"confinement_cell = template.cell.copy()\n",
6363
"confinement_corner = np.array([0, 0, 0])\n",
@@ -97,7 +97,7 @@
9797
"outputs": [],
9898
"source": [
9999
"## Load the unrelaxed structures\n",
100-
"unrlxd_structures = read(output_directory_prefix+identifier+\"/unrlxd_structures_seed\"+str(seed)+\".xyz\", index=\":\")"
100+
"unrlxd_structures = read(output_directory_prefix+identifier+\"/unrlxd_structures_seed\"+str(seed)+\".traj\", index=\":\")"
101101
]
102102
},
103103
{
@@ -107,7 +107,7 @@
107107
"outputs": [],
108108
"source": [
109109
"## Load the relaxed structures\n",
110-
"rlxd_structures = read(output_directory_prefix+identifier+\"/rlxd_structures_seed\"+str(seed)+\".xyz\", index=\":\")"
110+
"rlxd_structures = read(output_directory_prefix+identifier+\"/rlxd_structures_seed\"+str(seed)+\".traj\", index=\":\")"
111111
]
112112
},
113113
{
@@ -174,6 +174,22 @@
174174
" print(\"Minimum energy per atom is not zero. Check the energy calculation.\")"
175175
]
176176
},
177+
{
178+
"cell_type": "code",
179+
"execution_count": null,
180+
"metadata": {},
181+
"outputs": [],
182+
"source": [
183+
"# print the min, max, mean, and std of the relaxed energies\n",
184+
"print(\"Relaxed energies per atom: min = {:.2f}, max = {:.2f}, mean = {:.2f}, std = {:.2f}\".format(\n",
185+
" np.min(rlxd_delta_en_per_atom), np.max(rlxd_delta_en_per_atom), \n",
186+
" np.mean(rlxd_delta_en_per_atom), np.std(rlxd_delta_en_per_atom)))\n",
187+
"# plot in latex table format\n",
188+
"print(\"MoS$_2$ search & {:.2f} & {:.2f} & {:.2f} & {:.2f} \\\\\\\\\".format(\n",
189+
" np.min(rlxd_delta_en_per_atom), np.max(rlxd_delta_en_per_atom), \n",
190+
" np.mean(rlxd_delta_en_per_atom), np.std(rlxd_delta_en_per_atom)))"
191+
]
192+
},
177193
{
178194
"cell_type": "code",
179195
"execution_count": null,

example/python_pkg/ScS2-Li_learn/DRAFFLE/pca.ipynb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,22 @@
161161
"print(\"Relaxed min energy: \", np.min(energies_per_atom))"
162162
]
163163
},
164+
{
165+
"cell_type": "code",
166+
"execution_count": null,
167+
"metadata": {},
168+
"outputs": [],
169+
"source": [
170+
"# print the min, max, mean, and std of the relaxed energies\n",
171+
"print(\"Relaxed energies per atom: min = {:.2f}, max = {:.2f}, mean = {:.2f}, std = {:.2f}\".format(\n",
172+
" np.min(rlxd_delta_en_per_atom), np.max(rlxd_delta_en_per_atom), \n",
173+
" np.mean(rlxd_delta_en_per_atom), np.std(rlxd_delta_en_per_atom)))\n",
174+
"# plot in latex table format\n",
175+
"print(\"ScS$_2$-Li search & {:.2f} & {:.2f} & {:.2f} & {:.2f} \\\\\\\\\".format(\n",
176+
" np.min(rlxd_delta_en_per_atom), np.max(rlxd_delta_en_per_atom), \n",
177+
" np.mean(rlxd_delta_en_per_atom), np.std(rlxd_delta_en_per_atom)))"
178+
]
179+
},
164180
{
165181
"cell_type": "code",
166182
"execution_count": null,

example/python_pkg/Si-Ge_learn/DRAFFLE/pca.ipynb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,22 @@
251251
"print(\"Relaxed min energy: \", np.min(rlxd_en_per_area))"
252252
]
253253
},
254+
{
255+
"cell_type": "code",
256+
"execution_count": null,
257+
"metadata": {},
258+
"outputs": [],
259+
"source": [
260+
"# print the min, max, mean, and std of the relaxed energies\n",
261+
"print(\"Relaxed energies per atom: min = {:.2f}, max = {:.2f}, mean = {:.2f}, std = {:.2f}\".format(\n",
262+
" np.min(rlxd_en_per_area), np.max(rlxd_en_per_area), \n",
263+
" np.mean(rlxd_en_per_area), np.std(rlxd_en_per_area)))\n",
264+
"# plot in latex table format\n",
265+
"print(\"Si|Ge search & {:.2f} & {:.2f} & {:.2f} & {:.2f} \\\\\\\\\".format(\n",
266+
" np.min(rlxd_en_per_area), np.max(rlxd_en_per_area), \n",
267+
" np.mean(rlxd_en_per_area), np.std(rlxd_en_per_area)))"
268+
]
269+
},
254270
{
255271
"cell_type": "code",
256272
"execution_count": null,

example/python_pkg/graphene_grain_boundary_learn/DRAFFLE/pca.ipynb

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
"outputs": [],
4545
"source": [
4646
"## Set the plotting parameters\n",
47-
"seed = 2\n",
47+
"seed = 0\n",
4848
"identifier = \"\"\n",
49-
"output_directory_prefix = \"DResponse\"\n",
49+
"output_directory_prefix = \"DOutput\"\n",
5050
"# min_energy = -9.064090728759766"
5151
]
5252
},
@@ -122,7 +122,7 @@
122122
"outputs": [],
123123
"source": [
124124
"# ## Load the unrelaxed structures\n",
125-
"unrlxd_structures = read(output_directory_prefix+identifier+\"/DTMP/unrlxd_structures_seed\"+str(seed)+\"_combined.traj\", index=\":\")"
125+
"unrlxd_structures = read(output_directory_prefix+identifier+\"/unrlxd_structures_seed\"+str(seed)+\".traj\", index=\":\")"
126126
]
127127
},
128128
{
@@ -132,7 +132,7 @@
132132
"outputs": [],
133133
"source": [
134134
"# ## Load the relaxed structures\n",
135-
"rlxd_structures = read(output_directory_prefix+identifier+\"/DTMP/rlxd_structures_seed\"+str(seed)+\"_combined.traj\", index=\":\")"
135+
"rlxd_structures = read(output_directory_prefix+identifier+\"/rlxd_structures_seed\"+str(seed)+\".traj\", index=\":\")"
136136
]
137137
},
138138
{
@@ -170,6 +170,22 @@
170170
" print(\"Minimum energy per atom is not zero. Check the energy calculation.\")"
171171
]
172172
},
173+
{
174+
"cell_type": "code",
175+
"execution_count": null,
176+
"metadata": {},
177+
"outputs": [],
178+
"source": [
179+
"# print the min, max, mean, and std of the relaxed energies\n",
180+
"print(\"Relaxed energies per atom: min = {:.2f}, max = {:.2f}, mean = {:.2f}, std = {:.2f}\".format(\n",
181+
" np.min(rlxd_delta_en_per_atom), np.max(rlxd_delta_en_per_atom), \n",
182+
" np.mean(rlxd_delta_en_per_atom), np.std(rlxd_delta_en_per_atom)))\n",
183+
"# plot in latex table format\n",
184+
"print(\"Graphene grain boundary search & {:.2f} & {:.2f} & {:.2f} & {:.2f} \\\\\\\\\".format(\n",
185+
" np.min(rlxd_delta_en_per_atom), np.max(rlxd_delta_en_per_atom), \n",
186+
" np.mean(rlxd_delta_en_per_atom), np.std(rlxd_delta_en_per_atom)))"
187+
]
188+
},
173189
{
174190
"cell_type": "code",
175191
"execution_count": null,

0 commit comments

Comments
 (0)