Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Data Management Workshop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ml4q
Data Management Workshop
Commits
1392064c
Commit
1392064c
authored
1 year ago
by
Simon Sebastian Humpohl
Browse files
Options
Downloads
Patches
Plain Diff
Split notebook in genmeration and analysis
parent
e1d20b83
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
DataAnalysis.ipynb
+75
-0
75 additions, 0 deletions
DataAnalysis.ipynb
DataGeneration.ipynb
+8
-24
8 additions, 24 deletions
DataGeneration.ipynb
requirements.txt
+2
-0
2 additions, 0 deletions
requirements.txt
simulation.py
+2
-0
2 additions, 0 deletions
simulation.py
with
87 additions
and
24 deletions
DataAnalysis.ipynb
0 → 100644
+
75
−
0
View file @
1392064c
{
"cells": [
{
"cell_type": "markdown",
"id": "b115b402-4588-49a0-b984-e8983488aebc",
"metadata": {},
"source": [
"# Data analysis"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3df6f25e-a136-4524-8081-96524ed88848",
"metadata": {},
"outputs": [],
"source": [
"import xarray as xr\n",
"\n",
"lj_data = xr.load_dataset('lj_data.ndf')\n",
"emt_data = xr.load_dataset('emt_data.ndf')\n",
"all_data = xr.concat([lj_data, emt_data], xr.Variable('Method', ['LennardJones', 'EMT']))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d9a52cce-24aa-4286-9732-6c772389425a",
"metadata": {},
"outputs": [],
"source": [
"all_data"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c5c696be-1713-4cd0-8cdf-bf890af3156b",
"metadata": {},
"outputs": [],
"source": [
"lj_data['Energy'].loc[..., 'Al', :].plot.line(x='lattice_constant')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4a51b954-c2ed-4f94-a7a6-35a45254f8c3",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
%% Cell type:markdown id:b115b402-4588-49a0-b984-e8983488aebc tags:
# Data analysis
%% Cell type:code id:3df6f25e-a136-4524-8081-96524ed88848 tags:
```
python
import
xarray
as
xr
lj_data
=
xr
.
load_dataset
(
'
lj_data.ndf
'
)
emt_data
=
xr
.
load_dataset
(
'
emt_data.ndf
'
)
all_data
=
xr
.
concat
([
lj_data
,
emt_data
],
xr
.
Variable
(
'
Method
'
,
[
'
LennardJones
'
,
'
EMT
'
]))
```
%% Cell type:code id:d9a52cce-24aa-4286-9732-6c772389425a tags:
```
python
all_data
```
%% Cell type:code id:c5c696be-1713-4cd0-8cdf-bf890af3156b tags:
```
python
lj_data
[
'
Energy
'
].
loc
[...,
'
Al
'
,
:].
plot
.
line
(
x
=
'
lattice_constant
'
)
```
%% Cell type:code id:4a51b954-c2ed-4f94-a7a6-35a45254f8c3 tags:
```
python
```
This diff is collapsed.
Click to expand it.
ML4QDM
.ipynb
→
DataGeneration
.ipynb
+
8
−
24
View file @
1392064c
...
...
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "
136f209c-91a7-4a11-8386-ef5535eeba9a
",
"id": "
524f1ba2-39ab-40a9-9cab-dd170c39bf16
",
"metadata": {},
"source": [
"# Data generation\n",
...
...
@@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count":
1
,
"execution_count":
null
,
"id": "e18e2f2d-e0da-43eb-b378-2b617dbb73fa",
"metadata": {},
"outputs": [],
...
...
@@ -26,7 +26,7 @@
},
{
"cell_type": "code",
"execution_count":
5
,
"execution_count":
null
,
"id": "eaa1b986-1329-491d-850f-4d5edefe5b14",
"metadata": {},
"outputs": [],
...
...
@@ -44,7 +44,7 @@
},
{
"cell_type": "code",
"execution_count":
3
,
"execution_count":
null
,
"id": "36aac675-21f5-4c7b-b225-416c3681b0b8",
"metadata": {},
"outputs": [],
...
...
@@ -59,26 +59,10 @@
"lj_df.to_csv('lj_data.csv')"
]
},
{
"cell_type": "markdown",
"id": "f7a5a554-26ce-4695-aa37-c787df57268d",
"metadata": {},
"source": [
"# Data analysis"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "941fe208-519d-4c9f-ab6d-1d973181c66f",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "
028e3710-8ab2-44c6-809b-f7b1ae1a3e98
",
"id": "
54f57a76-f131-459f-98d0-f16b5b59b297
",
"metadata": {},
"outputs": [],
"source": []
...
...
@@ -86,9 +70,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "P
roject (ml4q DM workshop Simulation
)",
"display_name": "P
ython 3 (ipykernel
)",
"language": "python",
"name": "
simulation_venv
"
"name": "
python3
"
},
"language_info": {
"codemirror_mode": {
...
...
@@ -100,7 +84,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.1
0.11
"
"version": "3.1
1.2
"
}
},
"nbformat": 4,
...
...
%% Cell type:markdown id:
136f209c-91a7-4a11-8386-ef5535eeba9a
tags:
%% Cell type:markdown id:
524f1ba2-39ab-40a9-9cab-dd170c39bf16
tags:
# Data generation
Create a virtual environment with the correct
%% Cell type:code id:e18e2f2d-e0da-43eb-b378-2b617dbb73fa tags:
```
python
import
simulation
import
numpy
as
np
materials
=
[
'
Au
'
,
'
Ag
'
,
'
Al
'
,
'
Cu
'
,
'
Ni
'
]
lattice_constants
=
np
.
linspace
(
3.0
,
4.5
,
100
)
```
%% Cell type:code id:eaa1b986-1329-491d-850f-4d5edefe5b14 tags:
```
python
emt_data
=
simulation
.
simulate_multi
(
materials
=
materials
,
lattice_constants
=
lattice_constants
,
# Ångstroms
calculator
=
'
EMT
'
,
pool_size
=
None
,
)
emt_data
.
to_netcdf
(
'
emt_data.ndf
'
)
emt_df
=
emt_data
.
to_dataframe
()
emt_df
.
to_csv
(
'
emt_data.csv
'
)
```
%% Cell type:code id:36aac675-21f5-4c7b-b225-416c3681b0b8 tags:
```
python
lj_data
=
simulation
.
simulate_multi
(
materials
=
materials
,
lattice_constants
=
lattice_constants
,
# Ångstroms
calculator
=
'
LennardJones
'
,
)
lj_data
.
to_netcdf
(
'
lj_data.ndf
'
)
lj_df
=
lj_data
.
to_dataframe
()
lj_df
.
to_csv
(
'
lj_data.csv
'
)
```
%% Cell type:markdown id:f7a5a554-26ce-4695-aa37-c787df57268d tags:
# Data analysis
%% Cell type:code id:941fe208-519d-4c9f-ab6d-1d973181c66f tags:
```
python
``
`
%%
Cell
type
:
code
id
:
028e3710
-
8
ab2
-
44
c6
-
809
b
-
f7b1ae1a3e98
tags
:
%% Cell type:code id:54f57a76-f131-459f-98d0-f16b5b59b297 tags:
```
python
```
...
...
This diff is collapsed.
Click to expand it.
requirements.txt
+
2
−
0
View file @
1392064c
numpy
==1.25
ase
==3.22.1
xarray
==2024.2.0
ipympl
==0.9.3
h5netcdf
==1.3.0
\ No newline at end of file
This diff is collapsed.
Click to expand it.
simulation.py
+
2
−
0
View file @
1392064c
...
...
@@ -7,12 +7,14 @@ import xarray as xr
from
ase.build
import
bulk
from
ase.calculators.emt
import
EMT
from
ase.calculators.lj
import
LennardJones
from
ase.calculators.eam
import
EAM
CALCULATORS
=
{
# Effective Medium Theory
'
EMT
'
:
EMT
,
# LennardJones potential
'
LennardJones
'
:
LennardJones
,
'
EAM
'
:
EAM
,
}
def
simulate_properties
(
material
,
lattice_constant
,
calculator
:
Literal
[
'
EMT
'
,
'
EAM
'
]):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment