diff --git a/notebooks/tests_sphinx_sphinx_check_all.ipynb b/notebooks/tests_sphinx_sphinx_check_all.ipynb index 57ae457ca..9528a195b 100644 --- a/notebooks/tests_sphinx_sphinx_check_all.ipynb +++ b/notebooks/tests_sphinx_sphinx_check_all.ipynb @@ -2,25 +2,26 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:40:01.957087Z", - "start_time": "2019-08-05T13:39:56.667015Z" + "end_time": "2020-06-23T07:39:15.157443Z", + "start_time": "2020-06-23T07:39:14.154432Z" } }, "outputs": [], "source": [ - "from pyiron import Project" + "from pyiron import Project\n", + "import numpy as np" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:40:11.823729Z", - "start_time": "2019-08-05T13:40:01.959371Z" + "end_time": "2020-06-23T07:39:15.909487Z", + "start_time": "2020-06-23T07:39:15.158764Z" } }, "outputs": [], @@ -31,37 +32,29 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:40:11.831213Z", - "start_time": "2019-08-05T13:40:11.827701Z" + "end_time": "2020-06-23T07:39:15.914318Z", + "start_time": "2020-06-23T07:39:15.911912Z" } }, "outputs": [], "source": [ - "a_Fe = 2.832\n", + "a_Fe = 2.83\n", "a_Al = 4.024" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:40:18.852884Z", - "start_time": "2019-08-05T13:40:11.833338Z" + "end_time": "2020-06-23T07:39:19.363502Z", + "start_time": "2020-06-23T07:39:15.915783Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The job spx_Fe_nonmag was saved and received the ID: 1\n" - ] - } - ], + "outputs": [], "source": [ "job = pr.create_job(pr.job_type.Sphinx, 'spx_Fe_nonmag')\n", "job.structure = pr.create_structure('Fe', 'bcc', a_Fe)\n", @@ -71,22 +64,104 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:40:28.062167Z", - "start_time": "2019-08-05T13:40:18.898937Z" + "end_time": "2020-06-23T07:39:19.436394Z", + "start_time": "2020-06-23T07:39:19.410463Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The job spx_Fe_ferro was saved and received the ID: 2\n" - ] + "outputs": [], + "source": [ + "if np.linalg.norm(job['output/generic/forces'])>1.0e-4:\n", + " raise ValueError('Forces wrong')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:39:19.459790Z", + "start_time": "2020-06-23T07:39:19.437472Z" } - ], + }, + "outputs": [], + "source": [ + "if np.linalg.norm(job.structure.positions-job['output/generic/positions'][-1])>1.0e-4:\n", + " raise ValueError('Positions not correctly parsed')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:39:19.483804Z", + "start_time": "2020-06-23T07:39:19.460848Z" + } + }, + "outputs": [], + "source": [ + "if np.linalg.norm(job.structure.cell-job['output/generic/cells'][-1])>1.0e-4:\n", + " raise ValueError('Cells not correctly parsed')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:39:19.511154Z", + "start_time": "2020-06-23T07:39:19.485558Z" + } + }, + "outputs": [], + "source": [ + "if 'atom_spins' in job['output/generic/dft'].list_nodes():\n", + " raise AssertionError('spins present')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:39:19.536742Z", + "start_time": "2020-06-23T07:39:19.512721Z" + } + }, + "outputs": [], + "source": [ + "if np.abs(job['output/generic/volume']-np.linalg.det(job.structure.cell)) > 1.0e-4:\n", + " raise ValueError('Volume wrong')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:39:19.562187Z", + "start_time": "2020-06-23T07:39:19.538112Z" + } + }, + "outputs": [], + "source": [ + "if np.linalg.norm(job.structure.positions-job['output/generic/positions'][0])>1.0e-4:\n", + " raise ValueError('Positions not parsed properly')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:39:24.488908Z", + "start_time": "2020-06-23T07:39:19.563403Z" + } + }, + "outputs": [], "source": [ "job = pr.create_job(pr.job_type.Sphinx, 'spx_Fe_ferro')\n", "job.structure = pr.create_structure('Fe', 'bcc', a_Fe)\n", @@ -97,22 +172,29 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:40:50.061556Z", - "start_time": "2019-08-05T13:40:28.107028Z" + "end_time": "2020-06-23T07:39:24.599627Z", + "start_time": "2020-06-23T07:39:24.528435Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The job spx_Fe_ferro_C was saved and received the ID: 3\n" - ] + "outputs": [], + "source": [ + "if pr.inspect('spx_Fe_ferro')['output/generic/energy_tot'][0]-pr.inspect('spx_Fe_nonmag')['output/generic/energy_tot'][0]>0:\n", + " raise ValueError('BCC Fe erromagnetic state has lower energy than nonmagnetic state')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:39:33.767916Z", + "start_time": "2020-06-23T07:39:24.600821Z" } - ], + }, + "outputs": [], "source": [ "job = pr.create_job(pr.job_type.Sphinx, 'spx_Fe_ferro_C')\n", "job.structure = pr.create_structure('Fe', 'bcc', a_Fe)\n", @@ -124,22 +206,29 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:40:55.501734Z", - "start_time": "2019-08-05T13:40:50.106756Z" + "end_time": "2020-06-23T07:39:33.830513Z", + "start_time": "2020-06-23T07:39:33.807263Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The job spx_Al was saved and received the ID: 4\n" - ] + "outputs": [], + "source": [ + "if np.linalg.norm(job.structure.positions-job['output/generic/positions'][-1])>1.0e-4:\n", + " raise ValueError('Positions not correctly parsed')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:39:37.443100Z", + "start_time": "2020-06-23T07:39:33.831572Z" } - ], + }, + "outputs": [], "source": [ "job = pr.create_job(pr.job_type.Sphinx, 'spx_Al')\n", "job.structure = pr.create_structure('Al', 'fcc', a_Al)\n", @@ -149,22 +238,14 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:41:01.362212Z", - "start_time": "2019-08-05T13:40:55.546539Z" + "end_time": "2020-06-23T07:39:42.639670Z", + "start_time": "2020-06-23T07:39:37.482619Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The job spx_Al_restart was saved and received the ID: 5\n" - ] - } - ], + "outputs": [], "source": [ "job = job.restart()\n", "job.run()" @@ -172,22 +253,44 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:41:07.505810Z", - "start_time": "2019-08-05T13:41:01.407472Z" + "end_time": "2020-06-23T07:39:42.915947Z", + "start_time": "2020-06-23T07:39:42.679235Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The job spx_Al_minimize was saved and received the ID: 6\n" - ] + "outputs": [], + "source": [ + "if 'spx_Al_restart' not in list(pr.job_table().job):\n", + " raise AssertionError('restart job not found')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:39:42.991221Z", + "start_time": "2020-06-23T07:39:42.917242Z" + } + }, + "outputs": [], + "source": [ + "if np.abs(pr.inspect('spx_Al')['output/generic/energy_tot'][-1]-pr.inspect('spx_Al_restart')['output/generic/energy_tot'][-1])>1.0e-3:\n", + " raise ValueError('Energy value after restart too different')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:39:48.939072Z", + "start_time": "2020-06-23T07:39:42.992325Z" } - ], + }, + "outputs": [], "source": [ "job = pr.create_job(pr.job_type.Sphinx, 'spx_Al_minimize')\n", "job.structure = pr.create_structure('Al', 'fcc', a_Al)\n", @@ -198,22 +301,30 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:41:14.015270Z", - "start_time": "2019-08-05T13:41:07.546940Z" + "end_time": "2020-06-23T07:39:49.002875Z", + "start_time": "2020-06-23T07:39:48.979875Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The job spx_check_overlap was saved and received the ID: 7\n" - ] + "outputs": [], + "source": [ + "E = job['output/generic/energy_tot']\n", + "if E[0]-E[1]<0:\n", + " raise AssertionError('Energy not decreased')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:39:52.597218Z", + "start_time": "2020-06-23T07:39:49.003915Z" } - ], + }, + "outputs": [], "source": [ "job = pr.create_job(pr.job_type.Sphinx, 'spx_check_overlap')\n", "job.structure = pr.create_structure('Fe', 'bcc', 2.832)\n", @@ -224,22 +335,14 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:41:20.286494Z", - "start_time": "2019-08-05T13:41:14.058179Z" + "end_time": "2020-06-23T07:39:56.191615Z", + "start_time": "2020-06-23T07:39:52.638905Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The job spx_symmetry was saved and received the ID: 8\n" - ] - } - ], + "outputs": [], "source": [ "job = pr.create_job(pr.job_type.Sphinx, 'spx_symmetry')\n", "job.structure = pr.create_structure('Fe', 'bcc', 2.832)\n", @@ -250,22 +353,14 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:41:31.018747Z", - "start_time": "2019-08-05T13:41:20.328124Z" + "end_time": "2020-06-23T07:40:05.665582Z", + "start_time": "2020-06-23T07:39:56.242111Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The job spx_Fe_ferro_constraint was saved and received the ID: 9\n" - ] - } - ], + "outputs": [], "source": [ "job = pr.create_job(pr.job_type.Sphinx, 'spx_Fe_ferro_constraint')\n", "job.structure = pr.create_structure('Fe', 'bcc', a_Fe)\n", @@ -277,22 +372,29 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:41:32.936706Z", - "start_time": "2019-08-05T13:41:31.060102Z" + "end_time": "2020-06-23T07:40:05.727560Z", + "start_time": "2020-06-23T07:40:05.706075Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The job spx_Al_submit was saved and received the ID: 10\n" - ] + "outputs": [], + "source": [ + "if np.linalg.norm(job['output/generic/dft/atom_spins']-job.structure.get_initial_magnetic_moments())>1.0e-4:\n", + " raise AssertionError('Magnetic moments either not properly parsed or constraining not working')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:40:09.351266Z", + "start_time": "2020-06-23T07:40:05.728658Z" } - ], + }, + "outputs": [], "source": [ "job = pr.create_job(pr.job_type.Sphinx, 'spx_Al_submit')\n", "job.structure = pr.create_structure('Al', 'fcc', a_Al)\n", @@ -303,22 +405,14 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:41:38.933696Z", - "start_time": "2019-08-05T13:41:32.982329Z" + "end_time": "2020-06-23T07:40:12.974377Z", + "start_time": "2020-06-23T07:40:09.392430Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The job spx_Al_save_memory was saved and received the ID: 11\n" - ] - } - ], + "outputs": [], "source": [ "job = pr.create_job(pr.job_type.Sphinx, 'spx_Al_save_memory')\n", "job.structure = pr.create_structure('Al', 'fcc', a_Al)\n", @@ -329,24 +423,14 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:41:56.987598Z", - "start_time": "2019-08-05T13:41:38.996569Z" + "end_time": "2020-06-23T07:40:35.556196Z", + "start_time": "2020-06-23T07:40:13.016772Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The job sxextopt_Al was saved and received the ID: 12\n", - "The job spx_Al_interactive was saved and received the ID: 13\n", - "Ending calculation\n" - ] - } - ], + "outputs": [], "source": [ "job = pr.create_job(pr.job_type.Sphinx, 'spx_Al_interactive')\n", "job.structure = pr.create_structure('Al', 'fcc', a_Al)\n", @@ -359,38 +443,61 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:41:57.072806Z", - "start_time": "2019-08-05T13:39:56.683Z" + "end_time": "2020-06-23T07:40:39.466528Z", + "start_time": "2020-06-23T07:40:35.620516Z" } }, - "outputs": [ - { - "data": { - "text/plain": [ - "array([6.041038, 5.85493 , 5.854974, 5.854982, 5.855377, 5.855084,\n", - " 5.855078, 5.854986, 5.854775, 5.854941, 5.854247, 5.854506,\n", - " 5.841481, 5.842393, 5.854424, 5.853549, 5.853233, 5.853254])" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" + "outputs": [], + "source": [ + "job = pr.create_job(pr.job_type.Sphinx, 'nonmodal2')\n", + "job.structure = pr.create_structure('Al', 'fcc', a_Al)\n", + "job.calc_static()\n", + "job._create_job_structure()\n", + "job_reload = pr.load(job.job_name)\n", + "job_reload.run()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:40:39.532679Z", + "start_time": "2020-06-23T07:40:39.506553Z" } - ], + }, + "outputs": [], "source": [ "job['output/generic/dft/bands_e_fermi']" ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, + "metadata": { + "ExecuteTime": { + "end_time": "2020-06-23T07:42:17.863459Z", + "start_time": "2020-06-23T07:42:17.610459Z" + } + }, + "outputs": [], + "source": [ + "if not all(pr.job_table().status=='finished'):\n", + " jt = pr.job_table()\n", + " print(jt[jt.status!='finished'])\n", + " raise AssertionError('Some simulations failed')" + ] + }, + { + "cell_type": "code", + "execution_count": null, "metadata": { "ExecuteTime": { - "end_time": "2019-08-05T13:42:17.652385Z", - "start_time": "2019-08-05T13:42:09.893056Z" + "end_time": "2020-06-23T07:42:23.991721Z", + "start_time": "2020-06-23T07:42:19.768691Z" } }, "outputs": [],