Unverified Commit 9a6c4981 authored by Jan Janssen's avatar Jan Janssen Committed by GitHub
Browse files

Merge pull request #37 from pyiron/Removeold

Remove old notebooks 
parents 581eb17a 29fdacf5
%% Cell type:code id: tags:
``` python
import matplotlib.pyplot as plt
```
%% Cell type:code id: tags:
``` python
import numpy as np
```
%% Cell type:code id: tags:
``` python
import pyiron\nimport pyiron_contrib
```
%% Cell type:code id: tags:
``` python
import ase.db
```
%% Cell type:code id: tags:
``` python
from pyiron import Project, ase_to_pyiron
```
%% Cell type:code id: tags:
``` python
from pyiron_contrib.atomistic.atomicrex.atomicrex_job import Atomicrex
```
%% Cell type:code id: tags:
``` python
pr = pyiron.Project("import_database")
```
%% Cell type:markdown id: tags:
Copy "Cu_training_archive.tar.gz" and "export.csv" into the same folder as this notebook.
%% Cell type:code id: tags:
``` python
if len(pr.job_table()) == 0:\n pr.unpack("Cu_training_archive")
```
%% Cell type:code id: tags:
``` python
pr.job_table()
```
%% Output
id status chemicalformula job \\n0 1 finished None df1_A1_A2_A3_EV_elast_phon \n1 2 finished None df3_10k \n2 3 finished None df2_1k \n\n subjob projectpath project \\n0 /df1_A1_A2_A3_EV_elast_phon /home/jovyan/ import_database/Cu_database/ \n1 /df3_10k /home/jovyan/ import_database/Cu_database/ \n2 /df2_1k /home/jovyan/ import_database/Cu_database/ \n\n timestart timestop totalcputime computer \\n0 2021-02-08 10:33:52.341472 None None zora@cmti001#1 \n1 2021-02-08 10:33:53.993230 None None zora@cmti001#1 \n2 2021-02-08 10:33:54.435308 None None zora@cmti001#1 \n\n hamilton hamversion parentid masterid \n0 GenericJob 0.4 None None \n1 GenericJob 0.4 None None \n2 GenericJob 0.4 None None
%% Cell type:code id: tags:
``` python
j = pr.load('df2_1k')
```
%% Cell type:code id: tags:
``` python
j.to_pandas()
```
%% Output
name \\n0 A1:FHI-aims/PBE/tight:elastic:s_e_0 \n1 A1:FHI-aims/PBE/tight:murnaghan:strain_1_0 \n2 A1:FHI-aims/PBE/tight:phonon:supercell_phonon_0 \n3 A1:FHI-aims/PBE/tight:murnaghan:strain_1_02 \n4 A1:FHI-aims/PBE/tight:qha:phonopy_strain_1_02:supercell_phonon_0 \n.. ... \n995 Zr4Al3 \n996 fcc_100surf_X110_Y-110_Z001_4at_d0.95 \n997 ran2.7197 \n998 A15.shakesmallsuper2.14 \n999 A15.shakesmallsuper2corrected.26 \n\n atoms \\n0 (Atom('Cu', [0.0, 0.0, 0.0], index=0)) \n1 (Atom('Cu', [0.0, 0.0, 0.0], index=0)) \n2 (Atom('Cu', [4.3368086899420173e-19, 0.007070999999999999, 0.007070999999999999], index=0), Atom('Cu', [3.3306690738754696e-16, 1.81563, 1.8156300000000005], index=1), Atom('Cu', [7.262518, 10.893... \n3 (Atom('Cu', [0.0, 0.0, 0.0], index=0)) \n4 (Atom('Cu', [0.0, 0.007070999999999999, 0.007070999999999999], index=0), Atom('Cu', [0.0, 1.8274, 1.8274], index=1), Atom('Cu', [0.0, 3.6548, 3.6548], index=2), Atom('Cu', [0.0, 5.4822, 5.4822], i... \n.. ... \n995 (Atom('Cu', [1.397, 0.806558, 0.0], index=0), Atom('Cu', [2.794, 3.226233, 0.0], index=1), Atom('Cu', [4.191, 0.806558, 0.0], index=2), Atom('Cu', [5.588, 3.226233, 1.397], index=3), Atom('Cu', [5... \n996 (Atom('Cu', [0.0, 0.0, 0.0], index=0), Atom('Cu', [1.143, 1.143, 1.616446], index=1), Atom('Cu', [0.0, 0.0, 3.232892], index=2), Atom('Cu', [1.143, 1.143, 4.849338], index=3)) \n997 (Atom('Cu', [0.0, 0.0, 0.0], index=0), Atom('Cu', [-0.8247519999999999, 8.539541, 5.284737], index=1)) \n998 (Atom('Cu', [19.532944999999994, -0.449866, 19.143791], index=0), Atom('Cu', [2.437943, 2.3453879999999994, 2.4400769999999996], index=1), Atom('Cu', [1.263128, 2.228245, 19.507035000000002], inde... \n999 (Atom('Cu', [11.302489999999999, 10.996904, 10.695255999999999], index=0), Atom('Cu', [2.818779, 2.7324160000000006, 2.6500570000000008], index=1), Atom('Cu', [1.3972710000000002, 2.886038, 10.902... \n\n energy \\n0 -3.699843 \n1 -3.699841 \n2 -236.789603 \n3 -3.697932 \n4 -236.667372 \n.. ... \n995 -18.922813 \n996 -10.811770 \n997 -5.405739 \n998 -172.952480 \n999 -172.848259 \n\n forces \\n0 [[0.0, 0.0, 0.0]] \n1 [[0.0, 0.0, 0.0]] \n2 [[-1.13852957740976e-06, -0.0464638907314277, -0.0464636807741622], [-3.86335457040412e-06, 0.0124851330231607, 0.0124792943417333], [-1.94300535086066e-06, 6.63943441884098e-05, 6.92790474109119e... \n3 [[0.0, 0.0, 0.0]] \n4 [[-1.7950713845026e-06, -0.0426786586259085, -0.0426788121078561], [-2.57716410004614e-06, 0.0113518460490296, 0.0113462949227562], [-1.91163426088073e-06, -1.1293195658261e-05, -8.93773164041937e... \n.. ... \n995 [[-6.18422096975777e-08, 3.90650715661433e-08, 1.47017995734897e-07], [-1.08141460161261e-07, 1.42848306798042e-09, 1.33208449421711e-07], [1.74453858220392e-07, -6.50627272334328e-08, 1.766242321... \n996 [[-4.30878346990838e-07, -7.31495829958533e-08, 1.1652658274842], [9.19146530636258e-08, 7.3437277471036e-08, 0.0281190915073972], [5.69276808194065e-08, 6.81020524394929e-08, -0.0281191395865017]... \n997 [[-0.233777024216308, -0.488775610406501, 0.451270562003092], [0.233777024216308, 0.488775610406501, -0.451270562003092]] \n998 [[0.872967501214253, 0.798687481685555, 0.836501539528011], [-0.0180451951711004, 0.0546265390221465, -0.141831248405681], [-0.4156252456994, -0.0331529380226789, 1.09332664207543], [0.45544831009... \n999 [[-0.0565593911501715, 0.0441732952826791, 0.000484711694206531], [0.0174116924992595, -0.0041638289559127, 0.0173653938167792], [0.0248945042643254, 0.00557377484578537, -0.0201060590177153], [0.... \n\n number_of_atoms \n0 1.0 \n1 1.0 \n2 64.0 \n3 1.0 \n4 64.0 \n.. ... \n995 7.0 \n996 4.0 \n997 2.0 \n998 64.0 \n999 64.0 \n\n[1000 rows x 5 columns]
%% Cell type:code id: tags:
``` python
type(j.to_pandas()["atoms"].values[0])
```
%% Output
ase.atoms.Atoms
%% Cell type:code id: tags:
``` python
pr = Project("CuFit_TestHDF")\njob = pr.create_job(Atomicrex, "CuEAM_testOut2", delete_existing_job=True)
```
%% Cell type:code id: tags:
``` python
df_import = j.to_pandas()
```
%% Cell type:code id: tags:
``` python
for n, structure, e, f in zip(df_import.name.values, df_import.atoms.values, df_import.energy.values, df_import.forces.values):\n struct = ase_to_pyiron(structure)\n s = job.structures.add_structure(struct, "s" + n.replace(".", "").replace(":", "").replace("-", "").replace("/", ""))\n s.fit_properties.add_FitProperty("atomic-energy", target_value=e/len(structure))\n s.fit_properties.add_FitProperty("atomic-forces", target_value=f)
```
%% Cell type:code id: tags:
``` python
job.potential = job.factories.potentials.eam_potential()
```
%% Cell type:code id: tags:
``` python
rho = job.factories.functions.spline(identifier="CuCu_rho", cutoff=7, derivative_left=-25)\nrho.parameters.add_node(x=0.5, start_val=10, enabled=False)\nrho.parameters.add_node(x=1.0, start_val=3, enabled=True, min_val=1, max_val=3)\nrho.parameters.add_node(x=2.0, start_val=0.7, enabled=True, min_val=0.0, max_val=1)\nrho.parameters.add_node(x=3.0, start_val=0.35, enabled=True, min_val=0.0, max_val=0.8)\nrho.parameters.add_node(x=4.0, start_val=0.2, enabled=True, min_val=0.0, max_val=0.6)\nrho.parameters.add_node(x=5.0, start_val=0.1, enabled=True, min_val=0.0, max_val=0.4)\nrho.parameters.add_node(x=6.0, start_val=0.05, enabled=True, min_val=0.0, max_val=0.2)\nrho.parameters.add_node(x=7.0, start_val=0.0, enabled=False)
```
%% Cell type:code id: tags:
``` python
V = job.factories.functions.morse_B(identifier="V_CuCu", D0=1.0, r0=1.8, beta=2, S=2, delta=0)\nV.screening = job.factories.functions.exp_B_screening(identifier="V_screen", cutoff=7, rc=1, alpha=0.2, exponent=1)\nV.parameters.D0.min_val = 0\nV.parameters.D0.max_val = 3.5\nV.parameters.r0.min_val = 1.65\nV.parameters.r0.max_val = 1.95\nV.parameters.beta.min_val = 0.5\nV.parameters.beta.max_val = 4\nV.parameters.S.min_val = 1.01\nV.parameters.S.max_val = 10\nV.parameters.delta.min_val = -1\nV.parameters.delta.max_val = 1
```
%% Cell type:code id: tags:
``` python
F = job.factories.functions.spline(identifier="F_CuCu", cutoff=100)\nF.parameters.add_node(x=0.0, start_val=0, enabled=False)\nF.parameters.add_node(x=5.0, start_val=-1, enabled=True, min_val=-3.5, max_val=0)\nF.parameters.add_node(x=10, start_val=-1, enabled=True, min_val=-3.5, max_val=0)\nF.parameters.add_node(x=15, start_val=-1.6, enabled=True, min_val=-3.5, max_val=0)\nF.parameters.add_node(x=20, start_val=-1, enabled=True, min_val=-3.5, max_val=0)\nF.parameters.add_node(x=25, start_val=0.0, enabled=True, min_val=-3.5, max_val=3.5)\nF.parameters.add_node(x=30, start_val=2.0, enabled=True, min_val=-1, max_val=5)\nF.parameters.add_node(x=40, start_val=5.0, enabled=True, min_val=0, max_val=7)
```
%% Cell type:code id: tags:
``` python
job.potential.electron_densities[rho.identifier] = rho\njob.potential.pair_interactions[V.identifier] = V\njob.potential.embedding_energies[F.identifier] = F\njob.input.atom_types = {"Cu": None}\n#job.potential.export_file = F\njob.input.output_interval = 100000
```
%% Cell type:code id: tags:
``` python
job.input.fit_algorithm = job.factories.algorithms.ar_lbfgs(max_iter=500)\njob.executable.list_executables()
```
%% Output
['1.0']
%% Cell type:code id: tags:
``` python
r = np.linspace(0, 7, 304)\n\nD0=1\nr0=1.8\nbeta=0.3\nS=5\ndelta=0\nmorse = lambda r: (D0/(S-1))*np.exp(-beta*np.sqrt(2*S)*(r-r0))-(D0*S/(S-1))*np.exp(-beta*np.sqrt(2/S)*(r-r0))\n\nplt.plot(r, morse(r))\nplt.ylim(-3.5,1)
```
%% Output
(-3.5, 1.0)
%% Cell type:code id: tags:
``` python
job.run()
```
%% Output
The job CuEAM_testOut2 was saved and received the ID: 4\n
%% Cell type:code id: tags:
``` python
pr.job_table()
```
%% Output
id status chemicalformula job subjob \\n0 4 not_converged None CuEAM_testOut2 /CuEAM_testOut2 \n\n projectpath project timestart \\n0 /home/jovyan/ CuFit_TestHDF/ 2021-02-09 14:06:23.894281 \n\n timestop totalcputime \\n0 2021-02-09 14:08:15.827964 111.0 \n\n computer hamilton \\n0 pyiron@jupyter-jan-2djanssen-2dpyiron-2datomicrex-2dy00hoap7#1 atomicrex \n\n hamversion parentid masterid \n0 1.0 None None
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id:needed-commitment tags:
``` python
from pyiron_atomistics import Project
import pyiron_contrib
```
%% Cell type:code id:micro-christmas tags:
``` python
!ls
```
%% Output
append.pyprof old_Cu_df1_A1_A2_A3_EV_elast_phon
asdt.pkl old_Cu_df1_A1_A2_A3_EV_elast_phon.pckl.gzip
container_run.pyprof old_Cu_df2_1k
Cu_database old_Cu_df2_1k.pckl.gzip
Cu_df1_A1_A2_A3_EV_elast_phon old_Cu_df3_10k
Cu_df2_1k old_Cu_df3_10k.pckl.gzip
Cu_df3_10k pyiron.log
CuFitMLIP small_105
CuFitMLIP.ipynb StructureImport.ipynb
Cu_training_archive.tar.gz toy
export.csv toy_archive.tar.gz
foo.h5 toy_import
import_database training_archive.tar.gz
ImportDatabase.ipynb training_database
%% Cell type:code id:connected-stations tags:
``` python
fit_pr = Project("Cu_database")
fit_pr.job_table()
```