Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pyiron
Potentials Workshop 2021
Commits
a761f1e5
Commit
a761f1e5
authored
Mar 07, 2021
by
Sudarsan Surendralal
Browse files
More changes
parent
006043d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
day_3/ex_xx_validation.ipynb
View file @
a761f1e5
{
"cells": [
{
"cell_type": "markdown",
"id": "powerful-hazard",
"metadata": {},
"source": [
"# [**Workflows for atomistic simulations**](http://potentials.rub.de/) "
]
},
{
"cell_type": "markdown",
"id": "royal-latter",
"metadata": {},
"source": [
"## **Day 3 - Validation of various potentials**\n",
"\n",
"\n",
"### **Exercise 1: Validation of generated potentials using pyiron based workflows**\n",
"\n",
"Before the excercise, you should:\n",
"\n",
"* Have run the notebooks from day 1 and day2\n",
"* Familiarized yourself with working with pyiron and the \n",
"\n",
"The aim of this exercise is to make you familiar with:\n",
"\n",
"* A general overview of what pyiron can do\n",
"* How to set up atomic structures and run atomistic simulation codes through pyiron"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "
decreased-jumping
",
"id": "
passive-europe
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -16,7 +45,7 @@
{
"cell_type": "code",
"execution_count": 2,
"id": "
monetary-county
",
"id": "
false-christopher
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -26,7 +55,7 @@
{
"cell_type": "code",
"execution_count": 3,
"id": "
based-croati
a",
"id": "
formed-plasm
a",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -37,7 +66,7 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "
deluxe-fight
",
"id": "
pleasant-restriction
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -48,7 +77,7 @@
{
"cell_type": "code",
"execution_count": 5,
"id": "
atmospheric-harbor
",
"id": "
whole-cement
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -58,7 +87,7 @@
{
"cell_type": "code",
"execution_count": 6,
"id": "
s
ea
sonal-truck
",
"id": "ea
rly-industry
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -69,7 +98,7 @@
{
"cell_type": "code",
"execution_count": 7,
"id": "
elect-opt
ic
s
",
"id": "
amino-lyr
ic",
"metadata": {},
"outputs": [
{
...
...
@@ -221,7 +250,7 @@
{
"cell_type": "code",
"execution_count": 8,
"id": "
alpha-plant
",
"id": "
modified-slope
",
"metadata": {},
"outputs": [
{
...
...
@@ -242,7 +271,7 @@
{
"cell_type": "code",
"execution_count": 9,
"id": "
p
re
scribed-bacteria
",
"id": "re
quested-clock
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -271,7 +300,7 @@
{
"cell_type": "code",
"execution_count": 10,
"id": "
respiratory-killing
",
"id": "
owned-cooperation
",
"metadata": {},
"outputs": [
{
...
...
@@ -404,7 +433,7 @@
{
"cell_type": "code",
"execution_count": 11,
"id": "
prepared-antenna
",
"id": "
meaningful-event
",
"metadata": {},
"outputs": [
{
...
...
@@ -475,7 +504,7 @@
{
"cell_type": "code",
"execution_count": 12,
"id": "
humanitarian-insured
",
"id": "
rapid-morris
",
"metadata": {},
"outputs": [
{
...
...
@@ -498,7 +527,7 @@
{
"cell_type": "code",
"execution_count": 13,
"id": "
typical-executive
",
"id": "
suspected-blink
",
"metadata": {},
"outputs": [
{
...
...
@@ -527,7 +556,7 @@
{
"cell_type": "code",
"execution_count": 14,
"id": "
informational-brunei
",
"id": "
republican-covering
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -541,7 +570,7 @@
{
"cell_type": "code",
"execution_count": 15,
"id": "
contrary-lightning
",
"id": "
furnished-david
",
"metadata": {},
"outputs": [
{
...
...
@@ -654,7 +683,7 @@
{
"cell_type": "code",
"execution_count": 16,
"id": "
rural-claim
",
"id": "
marked-hunger
",
"metadata": {},
"outputs": [
{
...
...
@@ -820,7 +849,7 @@
{
"cell_type": "code",
"execution_count": 17,
"id": "s
ystematic-decimal
",
"id": "s
uperb-bermuda
",
"metadata": {},
"outputs": [
{
...
...
@@ -913,7 +942,7 @@
{
"cell_type": "code",
"execution_count": 18,
"id": "
floppy-holly
",
"id": "
amazing-hopkins
",
"metadata": {},
"outputs": [
{
...
...
@@ -955,7 +984,7 @@
{
"cell_type": "code",
"execution_count": 19,
"id": "
functional-injury
",
"id": "
empty-exception
",
"metadata": {},
"outputs": [
{
...
...
@@ -976,7 +1005,7 @@
{
"cell_type": "code",
"execution_count": 20,
"id": "
broke-armenia
",
"id": "
artistic-profit
",
"metadata": {},
"outputs": [
{
...
...
@@ -1013,7 +1042,7 @@
{
"cell_type": "code",
"execution_count": 21,
"id": "
available-valley
",
"id": "
lasting-editing
",
"metadata": {},
"outputs": [
{
...
...
@@ -1034,7 +1063,7 @@
{
"cell_type": "code",
"execution_count": 22,
"id": "
grateful-composite
",
"id": "
confidential-index
",
"metadata": {},
"outputs": [
{
...
...
@@ -1084,7 +1113,7 @@
{
"cell_type": "code",
"execution_count": 23,
"id": "
swedish-seve
n",
"id": "
advisory-revelatio
n",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1107,7 +1136,7 @@
{
"cell_type": "code",
"execution_count": 24,
"id": "
listed-basis
",
"id": "
seventh-disabled
",
"metadata": {},
"outputs": [
{
...
...
@@ -1128,7 +1157,7 @@
{
"cell_type": "code",
"execution_count": 25,
"id": "
accredited-progressive
",
"id": "
technological-satin
",
"metadata": {},
"outputs": [
{
...
...
@@ -1323,7 +1352,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "
covered-watson
",
"id": "
green-establishment
",
"metadata": {},
"outputs": [],
"source": []
...
...
@@ -1331,7 +1360,7 @@
{
"cell_type": "code",
"execution_count": 26,
"id": "
nervous-bishop
",
"id": "
homeless-throw
",
"metadata": {},
"outputs": [
{
...
...
@@ -1557,7 +1586,7 @@
{
"cell_type": "code",
"execution_count": 27,
"id": "
special-halloween
",
"id": "
noted-offer
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1567,7 +1596,7 @@
{
"cell_type": "code",
"execution_count": 28,
"id": "
inner-regular
",
"id": "
undefined-communist
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1577,7 +1606,7 @@
{
"cell_type": "code",
"execution_count": 29,
"id": "
confidential-aging
",
"id": "
opening-deputy
",
"metadata": {},
"outputs": [
{
...
...
@@ -1832,7 +1861,7 @@
},
{
"cell_type": "markdown",
"id": "
electric-marriage
",
"id": "
declared-animation
",
"metadata": {},
"source": [
"## Finite temperature thermodynamics (Harmonic approximation)"
...
...
@@ -1841,7 +1870,7 @@
{
"cell_type": "code",
"execution_count": 30,
"id": "
green-organizat
io
n
",
"id": "
rubber-super
io
r
",
"metadata": {},
"outputs": [
{
...
...
@@ -1876,7 +1905,7 @@
{
"cell_type": "code",
"execution_count": 31,
"id": "
muslim-letter
",
"id": "
iraqi-retention
",
"metadata": {},
"outputs": [
{
...
...
@@ -1897,7 +1926,7 @@
{
"cell_type": "code",
"execution_count": 35,
"id": "
approximate-medicare
",
"id": "
failing-provider
",
"metadata": {},
"outputs": [
{
...
...
@@ -1947,14 +1976,14 @@
{
"cell_type": "code",
"execution_count": null,
"id": "
biological-mongolia
",
"id": "
destroyed-keyboard
",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "
colonial-services
",
"id": "
virtual-publication
",
"metadata": {},
"source": [
"## **Validating against datasets**"
...
...
@@ -1963,7 +1992,7 @@
{
"cell_type": "code",
"execution_count": 36,
"id": "
rubber-stuar
t",
"id": "
manual-draf
t",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1975,7 +2004,7 @@
{
"cell_type": "code",
"execution_count": 37,
"id": "
similar-beijing
",
"id": "
fuzzy-monte
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1985,7 +2014,7 @@
{
"cell_type": "code",
"execution_count": 38,
"id": "
intimate-int
roduc
tion
",
"id": "
global-p
roduc
er
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -1995,7 +2024,7 @@
{
"cell_type": "code",
"execution_count": 39,
"id": "
independent-electric
",
"id": "
entertaining-particle
",
"metadata": {},
"outputs": [
{
...
...
@@ -2201,7 +2230,7 @@
{
"cell_type": "code",
"execution_count": 40,
"id": "o
pponent-assembly
",
"id": "o
rganized-wilson
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -2211,7 +2240,7 @@
{
"cell_type": "code",
"execution_count": 41,
"id": "
handmade-track
",
"id": "
partial-drama
",
"metadata": {},
"outputs": [],
"source": [
...
...
@@ -2226,7 +2255,7 @@
{
"cell_type": "code",
"execution_count": 42,
"id": "
general-soundtrack
",
"id": "
matched-arrow
",
"metadata": {},
"outputs": [
{
...
...
@@ -2309,7 +2338,7 @@
{
"cell_type": "code",
"execution_count": 43,
"id": "
private-ethernet
",
"id": "
therapeutic-physics
",
"metadata": {},
"outputs": [
{
...
...
@@ -2373,7 +2402,23 @@
{
"cell_type": "code",
"execution_count": null,
"id": "involved-request",
"id": "fitted-configuration",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "seven-twist",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "essential-guinea",
"metadata": {},
"outputs": [],
"source": []
...
...
@@ -2381,7 +2426,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "
animal-reply
",
"id": "
dated-favor
",
"metadata": {},
"outputs": [],
"source": []
...
...
@@ -2389,7 +2434,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "
integrated-complex
",
"id": "
expired-tuesday
",
"metadata": {},
"outputs": [],
"source": []
...
...
@@ -2411,7 +2456,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.
5
"
"version": "3.8.
8
"
}
},
"nbformat": 4,
...
...
%% Cell type:code id:decreased-jumping tags:
%% Cell type:markdown id:powerful-hazard tags:
# [**Workflows for atomistic simulations**](http://potentials.rub.de/)
%% Cell type:markdown id:royal-latter tags:
## **Day 3 - Validation of various potentials**
### **Exercise 1: Validation of generated potentials using pyiron based workflows**
Before the excercise, you should:
*
Have run the notebooks from day 1 and day2
*
Familiarized yourself with working with pyiron and the
The aim of this exercise is to make you familiar with:
*
A general overview of what pyiron can do
*
How to set up atomic structures and run atomistic simulation codes through pyiron
%% Cell type:code id:passive-europe tags:
```
python
import
numpy
as
np
%
matplotlib
inline
import
matplotlib.pylab
as
plt
import
pandas
as
pd
```
%% Cell type:code id:
monetary-county
tags:
%% Cell type:code id:
false-christopher
tags:
```
python
from
pyiron
import
Project
```
%% Cell type:code id:
based-croati
a tags:
%% Cell type:code id:
formed-plasm
a tags:
```
python
pr
=
Project
(
"validation"
)
#pr.remove_jobs(recursive=True)
```
%% Cell type:code id:
deluxe-fight
tags:
%% Cell type:code id:
pleasant-restriction
tags:
```
python
# The list of potentials to iterate over
potential_list
=
[
'2012--Mendelev-M-I--Cu--LAMMPS--ipr1'
,
'2004--Zhou-X-W--Cu-Ag-Au--LAMMPS--ipr2'
,
'1985--Foiles-S-M--Ni-Cu--LAMMPS--ipr1'
]
```
%% Cell type:code id:
atmospheric-harbor
tags:
%% Cell type:code id:
whole-cement
tags:
```
python
# Do Murnaghan, ElasticMatrix job, vac formation energy, binding energy, surface energies, comparison with dataset forces, energies
```
%% Cell type:code id:
s
ea
sonal-truck
tags:
%% Cell type:code id:ea
rly-industry
tags:
```
python
def
clean_project_name
(
name
):
return
name
.
replace
(
"-"
,
"_"
)
```
%% Cell type:code id:
elect-opt
ic
s
tags:
%% Cell type:code id:
amino-lyr
ic tags:
```
python
%%
time
for
pot
in
potential_list
:
group_name
=
clean_project_name
(
pot
)
pr_pot
=
pr
.
create_group
(
pot
)
job_ref
=
pr_pot
.
create_job
(
pr_pot
.
job_type
.
Lammps
,
"ref_job"
)
job_ref
.
structure
=
pr_pot
.
create_ase_bulk
(
"Cu"
)
job_ref
.
potential
=
pot
job_ref
.
calc_minimize
()
murn_job
=
job_ref
.
create_job
(
pr_pot
.
job_type
.
Murnaghan
,
"murn_job"
)
murn_job
.
run
()
murn_job
.
plot
()
```
%%%% Output: stream
The job murn_job was saved and received the ID: 3880
The job strain_0_9 was saved and received the ID: 3881
The job strain_0_92 was saved and received the ID: 3882
The job strain_0_94 was saved and received the ID: 3883
The job strain_0_96 was saved and received the ID: 3884
The job strain_0_98 was saved and received the ID: 3885
The job strain_1_0 was saved and received the ID: 3886
The job strain_1_02 was saved and received the ID: 3887
The job strain_1_04 was saved and received the ID: 3888
The job strain_1_06 was saved and received the ID: 3889
The job strain_1_08 was saved and received the ID: 3890
The job strain_1_1 was saved and received the ID: 3891
job_id: 3881 finished
job_id: 3882 finished
job_id: 3883 finished
job_id: 3884 finished
job_id: 3885 finished
job_id: 3886 finished
job_id: 3887 finished
job_id: 3888 finished
job_id: 3889 finished
job_id: 3890 finished
job_id: 3891 finished
%%%% Output: display_data
%%%% Output: stream
The job murn_job was saved and received the ID: 3892
The job strain_0_9 was saved and received the ID: 3893
The job strain_0_92 was saved and received the ID: 3894
The job strain_0_94 was saved and received the ID: 3895
The job strain_0_96 was saved and received the ID: 3896
The job strain_0_98 was saved and received the ID: 3897
The job strain_1_0 was saved and received the ID: 3898
The job strain_1_02 was saved and received the ID: 3899
The job strain_1_04 was saved and received the ID: 3900
The job strain_1_06 was saved and received the ID: 3901
The job strain_1_08 was saved and received the ID: 3902
The job strain_1_1 was saved and received the ID: 3903
job_id: 3893 finished
job_id: 3894 finished
job_id: 3895 finished
job_id: 3896 finished
job_id: 3897 finished
job_id: 3898 finished
job_id: 3899 finished
job_id: 3900 finished
job_id: 3901 finished
job_id: 3902 finished
job_id: 3903 finished
%%%% Output: display_data
%%%% Output: stream
The job murn_job was saved and received the ID: 3904
The job strain_0_9 was saved and received the ID: 3905
The job strain_0_92 was saved and received the ID: 3906
The job strain_0_94 was saved and received the ID: 3907
The job strain_0_96 was saved and received the ID: 3908
The job strain_0_98 was saved and received the ID: 3909
The job strain_1_0 was saved and received the ID: 3910
The job strain_1_02 was saved and received the ID: 3911
The job strain_1_04 was saved and received the ID: 3912
The job strain_1_06 was saved and received the ID: 3913
The job strain_1_08 was saved and received the ID: 3914
The job strain_1_1 was saved and received the ID: 3915
job_id: 3905 finished
job_id: 3906 finished
job_id: 3907 finished
job_id: 3908 finished
job_id: 3909 finished
job_id: 3910 finished
job_id: 3911 finished
job_id: 3912 finished
job_id: 3913 finished
job_id: 3914 finished
job_id: 3915 finished
%%%% Output: display_data
%%%% Output: stream
CPU times: user 1min 23s, sys: 54 s, total: 2min 17s
Wall time: 2min 30s
%% Cell type:code id:
alpha-plant
tags:
%% Cell type:code id:
modified-slope
tags:
```
python
murn_job
[
"output/equilibrium_energy"
]
```
%%%% Output: execute_result
-3.540132976728019
%% Cell type:code id:
p
re
scribed-bacteria
tags:
%% Cell type:code id:re
quested-clock
tags:
```
python
def
get_only_murn
(
job_table
):
return
job_table
.
hamilton
==
"Murnaghan"
def
get_eq_vol
(
job_path
):
return
job_path
[
"output/equilibrium_volume"
]
def
get_eq_lp
(
job_path
):
return
np
.
linalg
.
norm
(
job_path
[
"output/structure/cell/cell"
][
0
])
*
np
.
sqrt
(
2
)
def
get_eq_bm
(
job_path
):
return
job_path
[
"output/equilibrium_bulk_modulus"
]
def
get_potential
(
job_path
):
return
job_path
[
"ref_job/input/potential/Name"
]
def
get_eq_energy
(
job_path
):
return
job_path
[
"output/equilibrium_energy"
]
def
get_n_atoms
(
job_path
):
return
len
(
job_path
[
"output/structure/positions"
])
```
%% Cell type:code id:
respiratory-killing
tags:
%% Cell type:code id:
owned-cooperation
tags:
```
python
%%
time
table
=
pr
.
create_table
(
"table_murn"
,
delete_existing_job
=
True
)
table
.
db_filter_function
=
get_only_murn
table
.
add
[
"potential"
]
=
get_potential
table
.
add
[
"a"
]
=
get_eq_lp
table
.
add
[
"eq_vol"
]
=
get_eq_vol
table
.
add
[
"eq_bm"
]
=
get_eq_bm
table
.
add
[
"eq_energy"
]
=
get_eq_energy
table
.
add
[
"n_atoms"
]
=
get_n_atoms
table
.
run
()
data_murn
=
table
.
get_dataframe
()
data_murn
```
%%%% Output: stream
100%|██████████| 3/3 [00:00<00:00, 405.55it/s]
0%| | 0/3 [00:00<?, ?it/s]
%%%% Output: stream
The job table_murn was saved and received the ID: 3916
%%%% Output: stream
100%|██████████| 3/3 [00:00<00:00, 13.59it/s]
%%%% Output: stream
CPU times: user 359 ms, sys: 266 ms, total: 625 ms
Wall time: 673 ms
%%%% Output: execute_result
job_id potential a eq_vol \
0 3880 Cu_Mendelev_eam 3.637410 12.031420
1 3892 2004--Zhou-X-W--Cu-Ag-Au--LAMMPS--ipr2 3.614942 11.809844
2 3904 1985--Foiles-S-M--Ni-Cu--LAMMPS--ipr1 3.614840 11.808844
eq_bm eq_energy n_atoms
0 151.879230 -3.422980 1
1 135.774799 -3.539942 1
2 141.746540 -3.540133 1
%% Cell type:code id:
prepared-antenna
tags:
%% Cell type:code id:
meaningful-event
tags:
```
python
%%
time
for
pot
in
data_murn
.
potential
.
to_list
():
group_name
=
clean_project_name
(
pot
)
pr_pot
=
pr
.
create_group
(
pot
)
job_id
=
int
(
data_murn
[
data_murn
.
potential
==
pot
].
job_id
)
job_ref
=
pr_pot
.
create_job
(
pr_pot
.
job_type
.
Lammps
,
"ref_job"
)
job_ref
.
structure
=
pr_pot
.
inspect
(
job_id
)[
"output/structure"
].
to_object
()
job_ref
.
potential
=
pot
job_ref
.
calc_minimize
()
elastic_job
=
job_ref
.
create_job
(
pr_pot
.
job_type
.
ElasticMatrixJob
,
"elastic_job"
)
elastic_job
.
run
()
```
%%%% Output: stream
The job elastic_job was saved and received the ID: 3917
The job s_e_0 was saved and received the ID: 3918
The job s_01_e_m0_00500 was saved and received the ID: 3919
The job s_01_e_m0_00250 was saved and received the ID: 3920
The job s_01_e_0_00250 was saved and received the ID: 3921
The job s_01_e_0_00500 was saved and received the ID: 3922
The job s_08_e_m0_00500 was saved and received the ID: 3923
The job s_08_e_m0_00250 was saved and received the ID: 3924
The job s_08_e_0_00250 was saved and received the ID: 3925
The job s_08_e_0_00500 was saved and received the ID: 3926
The job s_23_e_m0_00500 was saved and received the ID: 3927
The job s_23_e_m0_00250 was saved and received the ID: 3928
The job s_23_e_0_00250 was saved and received the ID: 3929
The job s_23_e_0_00500 was saved and received the ID: 3930
The job elastic_job was saved and received the ID: 3931
The job s_e_0 was saved and received the ID: 3932
The job s_01_e_m0_00500 was saved and received the ID: 3933
The job s_01_e_m0_00250 was saved and received the ID: 3934
The job s_01_e_0_00250 was saved and received the ID: 3935
The job s_01_e_0_00500 was saved and received the ID: 3936
The job s_08_e_m0_00500 was saved and received the ID: 3937
The job s_08_e_m0_00250 was saved and received the ID: 3938
The job s_08_e_0_00250 was saved and received the ID: 3939
The job s_08_e_0_00500 was saved and received the ID: 3940
The job s_23_e_m0_00500 was saved and received the ID: 3941
The job s_23_e_m0_00250 was saved and received the ID: 3942
The job s_23_e_0_00250 was saved and received the ID: 3943
The job s_23_e_0_00500 was saved and received the ID: 3944
The job elastic_job was saved and received the ID: 3945
The job s_e_0 was saved and received the ID: 3946
The job s_01_e_m0_00500 was saved and received the ID: 3947
The job s_01_e_m0_00250 was saved and received the ID: 3948
The job s_01_e_0_00250 was saved and received the ID: 3949
The job s_01_e_0_00500 was saved and received the ID: 3950
The job s_08_e_m0_00500 was saved and received the ID: 3951
The job s_08_e_m0_00250 was saved and received the ID: 3952
The job s_08_e_0_00250 was saved and received the ID: 3953
The job s_08_e_0_00500 was saved and received the ID: 3954
The job s_23_e_m0_00500 was saved and received the ID: 3955
The job s_23_e_m0_00250 was saved and received the ID: 3956
The job s_23_e_0_00250 was saved and received the ID: 3957
The job s_23_e_0_00500 was saved and received the ID: 3958
CPU times: user 1min 26s, sys: 59.8 s, total: 2min 25s
Wall time: 2min 15s
%% Cell type:code id:
humanitarian-insured
tags:
%% Cell type:code id:
rapid-morris
tags:
```
python
plt
.
matshow
(
elastic_job
[
"output/elasticmatrix"
][
"C"
]);
```
%%%% Output: display_data
%% Cell type:code id:
typical-executive
tags:
%% Cell type:code id:
suspected-blink
tags:
```
python
elastic_job
[
"output/elasticmatrix"
][
"C"
].
flatten
()
```
%%%% Output: execute_result
array([168.78653632, 123.56991384, 123.56991384, 0. ,
0. , 0. , 123.56991384, 168.78653632,
123.56991384, 0. , 0. , 0. ,
123.56991384, 123.56991384, 168.78653632, 0. ,
0. , 0. , 0. , 0. ,
0. , 76.69333175, 0. , 0. ,
0. , 0. , 0. , 0. ,
76.69333175, 0. , 0. , 0. ,
0. , 0. , 0. , 76.69333175])
%% Cell type:code id:
informational-brunei
tags:
%% Cell type:code id:
republican-covering
tags:
```
python
def
get_elastic_constants
(
job_path
):
return
job_path
[
"output/elasticmatrix"
][
"C"
].
flatten
()
def
get_only_elastic
(
job_table
):
return
job_table
.
hamilton
==
"ElasticMatrixJob"
```
%% Cell type:code id:
contrary-lightning
tags:
%% Cell type:code id:
furnished-david
tags:
```
python
%%
time
table
=
pr
.
create_table
(
"table_elastic"
,
delete_existing_job
=
True
)
table
.
db_filter_function
=
get_only_elastic
table
.
add
[
"potential"
]
=
get_potential
table
.
add
[
"C_list"
]
=
get_elastic_constants
table
.
run
()
data_elastic
=
table
.
get_dataframe
()
data_elastic
```
%%%% Output: stream
100%|██████████| 3/3 [00:00<00:00, 204.45it/s]
0%| | 0/3 [00:00<?, ?it/s]
%%%% Output: stream
The job table_elastic was saved and received the ID: 3959
%%%% Output: stream
100%|██████████| 3/3 [00:00<00:00, 7.88it/s]
%%%% Output: stream
CPU times: user 531 ms, sys: 172 ms, total: 703 ms
Wall time: 861 ms
%%%% Output: execute_result
job_id potential \
0 3917 Cu_Mendelev_eam
1 3931 2004--Zhou-X-W--Cu-Ag-Au--LAMMPS--ipr2
2 3945 1985--Foiles-S-M--Ni-Cu--LAMMPS--ipr1
C_list
0 [175.61911929994824, 127.95837093157049, 127.95837093157049, 0.0, 0.0, 0.0, 127.95837093157049, 175.61911929994824, 127.95837093157049, 0.0, 0.0, 0.0, 127.95837093157049, 127.95837093157049, 175.6...
1 [169.92737971608926, 121.8273484849514, 121.8273484849514, 0.0, 0.0, 0.0, 121.8273484849514, 169.92737971608926, 121.8273484849514, 0.0, 0.0, 0.0, 121.8273484849514, 121.8273484849514, 169.9273797...
2 [168.78653632020246, 123.56991383768599, 123.56991383768599, 0.0, 0.0, 0.0, 123.56991383768599, 168.78653632020246, 123.56991383768599, 0.0, 0.0, 0.0, 123.56991383768599, 123.56991383768599, 168.7...
%% Cell type:code id:
rural-claim
tags:
%% Cell type:code id:
marked-hunger
tags:
```
python
# Maybe too complex and intimidating for new python users
elastic_matrix
=
data_elastic
.
C_list
.
apply
(
pd
.
Series
,
index
=
[
"c{}{}"
.
format
(
i
,
j
)
for
i
in
range
(
1
,
7
)
for
j
in
range
(
1
,
7
)])
data_elastic_matrix
=
pd
.
concat
([
elastic_matrix
,
data_elastic
],
axis
=
1
)
data_elastic_matrix
```
%%%% Output: execute_result
c11 c12 c13 c14 c15 c16 c21 c22 \
0 175.619119 127.958371 127.958371 0.0 0.0 0.0 127.958371 175.619119
1 169.927380 121.827348 121.827348 0.0 0.0 0.0 121.827348 169.927380
2 168.786536 123.569914 123.569914 0.0 0.0 0.0 123.569914 168.786536
c23 c24 ... c56 c61 c62 c63 c64 c65 c66 job_id \
0 127.958371 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 84.313524 3917
1 121.827348 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 75.880308 3931
2 123.569914 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 76.693332 3945
potential \
0 Cu_Mendelev_eam
1 2004--Zhou-X-W--Cu-Ag-Au--LAMMPS--ipr2
2 1985--Foiles-S-M--Ni-Cu--LAMMPS--ipr1
C_list
0 [175.61911929994824, 127.95837093157049, 127.95837093157049, 0.0, 0.0, 0.0, 127.95837093157049, 175.61911929994824, 127.95837093157049, 0.0, 0.0, 0.0, 127.95837093157049, 127.95837093157049, 175.6...
1 [169.92737971608926, 121.8273484849514, 121.8273484849514, 0.0, 0.0, 0.0, 121.8273484849514, 169.92737971608926, 121.8273484849514, 0.0, 0.0, 0.0, 121.8273484849514, 121.8273484849514, 169.9273797...
2 [168.78653632020246, 123.56991383768599, 123.56991383768599, 0.0, 0.0, 0.0, 123.56991383768599, 168.78653632020246, 123.56991383768599, 0.0, 0.0, 0.0, 123.56991383768599, 123.56991383768599, 168.7...
[3 rows x 39 columns]
%% Cell type:code id:s
ystematic-decimal
tags:
%% Cell type:code id:s
uperb-bermuda
tags:
```
python
data_elastic_matrix_short
=
data_elastic_matrix
[[
'potential'
,
'c11'
,
'c12'
,
'c13'
,
'c33'
,
'c44'
,
'c66'
]]
data_elastic_matrix_short
```
%%%% Output: execute_result
potential c11 c12 c13 \
0 Cu_Mendelev_eam 175.619119 127.958371 127.958371
1 2004--Zhou-X-W--Cu-Ag-Au--LAMMPS--ipr2 169.927380 121.827348 121.827348
2 1985--Foiles-S-M--Ni-Cu--LAMMPS--ipr1 168.786536 123.569914 123.569914
c33 c44 c66
0 175.619119 84.313524 84.313524