{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Creating structures in pyiron" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This section gives a brief introduction about some of the tools available in pyiron to construct atomic structures. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For the sake of compatibility, our structure class is written to be compatible with the popular Atomistic Simulation Environment package ([ASE](https://wiki.fysik.dtu.dk/ase/)). This makes it possible to use routines from ASE to help set-up structures.\n", "\n", "Furthermore, pyiron uses the [NGLview](http://nglviewer.org/nglview/latest/api.html) package to visualize the structures and trajectories interactively in 3D using NGLview-widgets." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As preparation for the following discussion we import a few python libraries" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2018-02-10T08:32:28.838135Z", "start_time": "2018-02-10T08:32:26.787708Z" } }, "outputs": [], "source": [ "import numpy as np\n", "%matplotlib inline\n", "import matplotlib.pylab as plt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "and create a pyiron project named 'structures':" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from pyiron import Project\n", "pr = Project(path='structures')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Bulk crystals" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this section we discuss various possibilities to create bulk crystal structures." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Using `create_structure()`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The simplest way to generate simple crystal structures is using the inbuilt `create_structure()` function specifying the element symbol, Bravais basis and the lattice constant(s)\n", "\n", "Note: The output gives a cubic cell rather than the smallest non-orthogonal unit cell." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2018-02-10T08:36:09.587677Z", "start_time": "2018-02-10T08:36:08.971155Z" } }, "outputs": [], "source": [ "structure = pr.create_structure('Al', \n", " bravais_basis='fcc', \n", " lattice_constant=4.05)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To plot the structure interactively in 3D simply use:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "eabfdd330846489cbfe6105da03815a7", "version_major": 2, "version_minor": 0 }, "text/plain": [] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "134cbfe57d794e68b0ec3c5994cfa205", "version_major": 2, "version_minor": 0 }, "text/plain": [ "NGLWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "structure.plot3d()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Using `create_ase_bulk()`\n", "\n", "Another convenient way to set up structures is using the `create_ase_bulk()` function which is built on top of the ASE build package for [bulk crystals](https://wiki.fysik.dtu.dk/ase/ase/build/build.html#ase.build.bulk). This function returns an object which is of the pyiron structure object type." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Example:** fcc bulk aluminum in a cubic cell" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2018-02-11T08:48:16.795460Z", "start_time": "2018-02-11T08:48:16.525956Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "ef617dcb8c4a40ac9512ceea0f43e9fd", "version_major": 2, "version_minor": 0 }, "text/plain": [ "NGLWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "structure = pr.create_ase_bulk('Al', cubic=True)\n", "structure.plot3d()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Example:** wurtzite GaN in a 3x3x3 repeated orthorhombic cell.\n", "\n", "Note: \n", "- In contrast to new_structure = structure.repeat() which creates a new object, set_repeat() modifies the existing structure object.\n", "- Setting `spacefill=False` in the `plot3d()` method changes the atomic structure style to \"ball and stick\"." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2018-02-11T08:51:10.251891Z", "start_time": "2018-02-11T08:51:09.957494Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "73301498fdba40e08395fe682e9c79b2", "version_major": 2, "version_minor": 0 }, "text/plain": [ "NGLWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "structure = pr.create_ase_bulk('AlN', \n", " crystalstructure='wurtzite', \n", " a=3.5, orthorhombic=True)\n", "structure.set_repeat([3,3,3])\n", "structure.plot3d(spacefill=False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Creating surfaces (using ASE)\n", "\n", "Surfaces can be created using the `create_surface()` function which is also built on top of the ASE build package for [surfaces](https://wiki.fysik.dtu.dk/ase/_modules/ase/build/surface.html)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Example:** Creating a 3x4 fcc Al(111) surface with 4 layers and a vacuum of 10 Ångström" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "92b3c090cb894e82b25253b58fc1d67d", "version_major": 2, "version_minor": 0 }, "text/plain": [ "NGLWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "Al_111 = pr.create_surface(\"Al\", surface_type=\"fcc111\", \n", " size=(3, 4, 4), vacuum=10, orthogonal=True)\n", "Al_111.plot3d()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Creating structures without importing the project class\n", "\n", "In all the examples shown above, the structures are create from the pyiron `Project` object. It is also possible to do this without importing/initializing this object. For this the appropriate imports must be made." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "from pyiron import create_ase_bulk, create_surface" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "72ade2f57e304bcf85b20a562b7e3e49", "version_major": 2, "version_minor": 0 }, "text/plain": [ "NGLWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "structure = create_ase_bulk('AlN', \n", " crystalstructure='wurtzite', \n", " a=3.5, orthorhombic=True)\n", "structure.set_repeat([3,3,3])\n", "structure.plot3d(spacefill=False)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "6b16b99bf9a64622956bf1de1cfe47bd", "version_major": 2, "version_minor": 0 }, "text/plain": [ "NGLWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "Al_111 = create_surface(\"Al\", surface_type=\"fcc111\", \n", " size=(3, 4, 4), vacuum=10, orthogonal=True)\n", "Al_111.plot3d()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Using the ASE spacegroup class" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "ExecuteTime": { "end_time": "2018-02-11T09:37:06.542461Z", "start_time": "2018-02-11T09:37:06.310283Z" } }, "outputs": [], "source": [ "from ase.spacegroup import crystal\n", "from pyiron import ase_to_pyiron\n", "\n", "a = 9.04\n", "skutterudite = crystal(('Co', 'Sb'),\n", " basis=[(0.25, 0.25, 0.25), (0.0, 0.335, 0.158)],\n", " spacegroup=204,\n", " cellpar=[a, a, a, 90, 90, 90])\n", "skutterudite = ase_to_pyiron(skutterudite)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "ExecuteTime": { "end_time": "2018-02-11T09:37:47.604586Z", "start_time": "2018-02-11T09:37:47.457434Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "12dd46a27c474459ba2cf729ae9b3dfb", "version_major": 2, "version_minor": 0 }, "text/plain": [ "NGLWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "skutterudite.plot3d()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Accessing the properties of the structure object" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Using the bulk aluminum fcc example from before the structure object can be created by" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "structure = pr.create_ase_bulk('Al', cubic=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A summary of the information about the structure is given by using" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Al: [0. 0. 0.]\n", "Al: [0. 2.025 2.025]\n", "Al: [2.025 0. 2.025]\n", "Al: [2.025 2.025 0. ]\n", "pbc: [ True True True]\n", "cell: \n", "Cell([4.05, 4.05, 4.05])\n", "\n" ] } ], "source": [ "print(structure)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The cell vectors of the structure object can be accessed and edited through" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Cell([4.05, 4.05, 4.05])" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "structure.cell" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The positions of the atoms in the structure object can be accessed and edited through" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[0. , 0. , 0. ],\n", " [0. , 2.025, 2.025],\n", " [2.025, 0. , 2.025],\n", " [2.025, 2.025, 0. ]])" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "structure.positions" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Point defects" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Creating a single vacancy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We start by setting up a 4x4x4 supercell" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "ExecuteTime": { "end_time": "2018-02-12T09:07:41.713136Z", "start_time": "2018-02-12T09:07:41.358933Z" } }, "outputs": [], "source": [ "structure = pr.create_ase_bulk('Al', cubic=True)\n", "structure.set_repeat([4,4,4])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To create the vacancy at position index \"0\" simply use:" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "del structure[0]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To plot the structure that now contains a vacancy run:" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "2ddd44ebaf0148c1bc4056eda628eed6", "version_major": 2, "version_minor": 0 }, "text/plain": [ "NGLWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "structure.plot3d()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Creating multiple vacancies" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "ExecuteTime": { "end_time": "2018-02-12T09:17:37.707055Z", "start_time": "2018-02-12T09:17:37.321281Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of atoms in the repeat unit: 256\n" ] } ], "source": [ "# First create a 4x4x4 supercell\n", "structure = pr.create_ase_bulk('Al', cubic=True)\n", "structure.set_repeat([4,4,4])\n", "print('Number of atoms in the repeat unit: ',structure.get_number_of_atoms())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `del` command works for passing a list of indices to the structure object. For example, a random set of n$_{\\text{vac}}$ vacancies can be created by using" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [], "source": [ "# Generate a list of indices for the vacancies\n", "n_vac = 24\n", "vac_ind_lst = np.random.permutation(len(structure))[:n_vac]\n", "\n", "# Remove atoms according to the \"vac_ind_lst\"\n", "del structure[vac_ind_lst]" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of atoms in the repeat unit: 232\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "d32a9d375575422a9129ef711e9acd52", "version_major": 2, "version_minor": 0 }, "text/plain": [ "NGLWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Visualize the structure\n", "print('Number of atoms in the repeat unit: ',structure.get_number_of_atoms())\n", "structure.plot3d()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Random substitutial alloys" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "# Create a 4x4x4 supercell\n", "structure = pr.create_ase_bulk('Al', cubic=True)\n", "structure.set_repeat([4,4,4])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Substitutional atoms can be defined by changing the atomic species accessed through its position index.\n", "\n", "Here, we set $n_{\\text{sub}}$ magnesium substitutional atoms at random positions" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "ExecuteTime": { "end_time": "2018-02-12T09:19:45.031085Z", "start_time": "2018-02-12T09:19:44.598754Z" } }, "outputs": [], "source": [ "n_sub = 24\n", "structure[np.random.permutation(len(structure))[:n_sub]] = 'Mg'" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number of atoms in the repeat unit: 256\n", "Chemical formula: Al232Mg24\n" ] }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "f09e78c3a7bc4ab995f98b5d217db1d7", "version_major": 2, "version_minor": 0 }, "text/plain": [ "NGLWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Visualize the structure and print some additional information about the structure\n", "print('Number of atoms in the repeat unit: ',structure.get_number_of_atoms())\n", "print('Chemical formula: ',structure.get_chemical_formula())\n", "structure.plot3d()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Explicit definition of the structure\n", "\n", "You can also set-up structures through the explicit input of the cell parameters and positions" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b3e708913d5d48059659503c76b861f7", "version_major": 2, "version_minor": 0 }, "text/plain": [ "NGLWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "cell = 10.0 * np.eye(3) # Specifying the cell dimensions\n", "positions = [[0.25, 0.25, 0.25], [0.75, 0.75, 0.75]]\n", "elements = ['O', 'O']\n", "\n", "# Now use the Atoms class to create the instance.\n", "O_dimer = pr.create_atoms(elements=elements, scaled_positions=positions, cell=cell)\n", "\n", "O_dimer.plot3d()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Importing from cif/other file formats\n", "\n", "Parsers from ASE can be used to import structures from other formats. In this example, we will download and import a Nepheline structure from the [Crystallography Open Database (COD)](http://www.crystallography.net/cod/index.php)" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "# The COD structures can be accessed through their unique COD identifier\n", "cod = 1008753\n", "filename = '{}.cif'.format(cod)\n", "url = 'http://www.crystallography.net/cod/{}'.format(filename)" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [], "source": [ "cif_structure = \"\"\"\\\n", "#------------------------------------------------------------------------------\n", "#$Date: 2015-01-27 21:58:39 +0200 (Tue, 27 Jan 2015) $\n", "#$Revision: 130149 $\n", "#$URL: svn://www.crystallography.net/cod/cif/1/00/87/1008753.cif $\n", "#------------------------------------------------------------------------------\n", "#\n", "# This file is available in the Crystallography Open Database (COD),\n", "# http://www.crystallography.net/\n", "#\n", "# All data on this site have been placed in the public domain by the\n", "# contributors.\n", "#\n", "data_1008753\n", "loop_\n", "_publ_author_name\n", "'Buerger, M J'\n", "'Klein, G E'\n", "'Donnay, G'\n", "_publ_section_title\n", ";\n", "Determination of the crystal structure of nepheline\n", ";\n", "_journal_coden_ASTM AMMIAY\n", "_journal_name_full 'American Mineralogist'\n", "_journal_page_first 805\n", "_journal_page_last 818\n", "_journal_volume 39\n", "_journal_year 1954\n", "_chemical_formula_structural 'K Na3 Al4 Si4 O16'\n", "_chemical_formula_sum 'Al4 K Na3 O16 Si4'\n", "_chemical_name_mineral Nepheline\n", "_chemical_name_systematic 'Potassium trisodium tetraaluminium silicate'\n", "_space_group_IT_number 173\n", "_symmetry_cell_setting hexagonal\n", "_symmetry_Int_Tables_number 173\n", "_symmetry_space_group_name_Hall 'P 6c'\n", "_symmetry_space_group_name_H-M 'P 63'\n", "_cell_angle_alpha 90\n", "_cell_angle_beta 90\n", "_cell_angle_gamma 120\n", "_cell_formula_units_Z 2\n", "_cell_length_a 10.01\n", "_cell_length_b 10.01\n", "_cell_length_c 8.405\n", "_cell_volume 729.4\n", "_cod_database_code 1008753\n", "loop_\n", "_symmetry_equiv_pos_as_xyz\n", "x,y,z\n", "-y,x-y,z\n", "y-x,-x,z\n", "-x,-y,1/2+z\n", "y,y-x,1/2+z\n", "x-y,x,1/2+z\n", "loop_\n", "_atom_site_label\n", "_atom_site_type_symbol\n", "_atom_site_symmetry_multiplicity\n", "_atom_site_Wyckoff_symbol\n", "_atom_site_fract_x\n", "_atom_site_fract_y\n", "_atom_site_fract_z\n", "_atom_site_occupancy\n", "_atom_site_attached_hydrogens\n", "_atom_site_calc_flag\n", "K1 K1+ 2 a 0. 0. 0. 1. 0 d\n", "Al1 Al3+ 2 b 0.3333 0.6667 0.18 1. 0 d\n", "Si1 Si4+ 2 b 0.3333 0.6667 0.82 1. 0 d\n", "O1 O2- 2 b 0.3333 0.6667 0. 1. 0 d\n", "Na1 Na1+ 6 c 0.008 0.432 0. 1. 0 d\n", "Al2 Al3+ 6 c 0.092 0.33 0.67 1. 0 d\n", "Si2 Si4+ 6 c 0.092 0.33 0.33 1. 0 d\n", "O2 O2- 6 c 0.02 0.33 0.5 1. 0 d\n", "O3 O2- 6 c 0.18 0.5 0.75 1. 0 d\n", "O4 O2- 6 c 0.17 0.53 0.25 1. 0 d\n", "O5 O2- 6 c 0.23 0.28 0.25 1. 0 d\n", "O6 O2- 6 c 0.23 0.28 0.75 1. 0 d\n", "loop_\n", "_atom_type_symbol\n", "_atom_type_oxidation_number\n", "K1+ 1.000\n", "Al3+ 3.000\n", "Si4+ 4.000\n", "O2- -2.000\n", "Na1+ 1.000\"\"\"" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [], "source": [ "# Download and save the structure file locally\n", "# import urllib\n", "# urllib.request.urlretrieve(url=url, filename='strucs.'+filename);\n", "with open('strucs.'+filename, \"w\") as f:\n", " f.writelines(cif_structure)" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/srv/conda/envs/notebook/lib/python3.7/site-packages/ase/io/cif.py:380: UserWarning: crystal system 'hexagonal' is not interpreted for space group Spacegroup(173, setting=1). This may result in wrong setting!\n", " setting_name, spacegroup))\n" ] } ], "source": [ "# Using ase parsers to read the structure and then convert to a pyiron instance\n", "import ase\n", "from pyiron import ase_to_pyiron\n", "\n", "structure = ase_to_pyiron(ase.io.read(filename='strucs.'+filename,\n", " format='cif'))\n", "structure.info[\"cod\"] = cod" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "73635214525a4482addb1294fe061ece", "version_major": 2, "version_minor": 0 }, "text/plain": [ "NGLWidget()" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "structure.plot3d()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Structures can be stored indepently from jobs in HDF5 by using the special `StructureContainer` job. To save to disk, call `run()`." ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The job nepheline was saved and received the ID: 1\n" ] } ], "source": [ "container = pr.create_job(pr.job_type.StructureContainer, \"nepheline\")\n", "container.structure = structure\n", "container.run()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It's also possible to store multiple structures in one container and to store directly from a job. Let's use this here to store the equilibrated structures at finite temperatures." ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This group does not exist in the HDF5 file al_temp\n", "The job T_400 was saved and received the ID: 2\n", "The job T_600 was saved and received the ID: 3\n", "The job T_800 was saved and received the ID: 4\n", "The job al_temp was saved and received the ID: 5\n" ] } ], "source": [ "al_container = pr.create_job(pr.job_type.StructureContainer, \"al_temp\", delete_existing_job=True)\n", "for T in (400, 600, 800):\n", " j = pr.create_job(pr.job_type.Lammps, \"T_{}\".format(T))\n", " j.structure = pr.create_ase_bulk(\"Al\", cubic = True)\n", " j.potential = j.list_potentials()[0]\n", " j.calc_md(temperature=T, n_ionic_steps=1000, pressure=0)\n", " j.run()\n", " structure = j.get_structure(-1)\n", " structure.info[\"T\"] = T\n", " structure.info[\"P\"] = 0\n", " al_container.append(structure)\n", " \n", "al_container.run()" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'T': 400, 'P': 0}" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "al_container.structure_lst[0].info" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [ { "data": { "application/json": [ "Al: [0.13389146 3.96541338 4.05893092]\nAl: [3.99018226 2.0071096 1.95618182]\nAl: [1.98560236 3.88778884 2.0465924 ]\nAl: [2.04906472 2.05913422 0.09311447]\npbc: [ True True True]\ncell: \nCell([[4.079370396328773, 2.497893949200251e-16, 2.497893949200251e-16], [0.0, 3.973148678151775, 2.4328519056175543e-16], [0.0, 0.0, 4.077409804014059]])\n", "Al: [0.0070279 4.03832899 0.08383998]\nAl: [4.08339864 2.06533333 2.03444326]\nAl: [2.20534808 4.07618808 1.94632881]\nAl: [1.91118709 2.15964157 0.05514228]\npbc: [ True True True]\ncell: \nCell([[4.103480856873612, 2.5126573483663535e-16, 2.5126573483663535e-16], [0.0, 4.11316398781314, 2.5185865560217624e-16], [0.0, 0.0, 4.119754328387385]])\n", "Al: [3.7382874 0.12171228 4.27645154]\nAl: [0.05199557 1.91099383 2.20493355]\nAl: [1.92074788 0.03592662 2.13915097]\nAl: [1.89264518 1.93451826 0.04368514]\npbc: [ True True True]\ncell: \nCell([[3.8018380195130206, 2.3279543807366664e-16, 2.3279543807366664e-16], [0.0, 4.003150985990483, 2.451223020748408e-16], [0.0, 0.0, 4.332110602330072]])\n" ], "text/plain": [ "InputList([Al: [0.13389146 3.96541338 4.05893092]\n", "Al: [3.99018226 2.0071096 1.95618182]\n", "Al: [1.98560236 3.88778884 2.0465924 ]\n", "Al: [2.04906472 2.05913422 0.09311447]\n", "pbc: [ True True True]\n", "cell: \n", "Cell([[4.079370396328773, 2.497893949200251e-16, 2.497893949200251e-16], [0.0, 3.973148678151775, 2.4328519056175543e-16], [0.0, 0.0, 4.077409804014059]])\n", ", Al: [0.0070279 4.03832899 0.08383998]\n", "Al: [4.08339864 2.06533333 2.03444326]\n", "Al: [2.20534808 4.07618808 1.94632881]\n", "Al: [1.91118709 2.15964157 0.05514228]\n", "pbc: [ True True True]\n", "cell: \n", "Cell([[4.103480856873612, 2.5126573483663535e-16, 2.5126573483663535e-16], [0.0, 4.11316398781314, 2.5185865560217624e-16], [0.0, 0.0, 4.119754328387385]])\n", ", Al: [3.7382874 0.12171228 4.27645154]\n", "Al: [0.05199557 1.91099383 2.20493355]\n", "Al: [1.92074788 0.03592662 2.13915097]\n", "Al: [1.89264518 1.93451826 0.04368514]\n", "pbc: [ True True True]\n", "cell: \n", "Cell([[3.8018380195130206, 2.3279543807366664e-16, 2.3279543807366664e-16], [0.0, 4.003150985990483, 2.451223020748408e-16], [0.0, 0.0, 4.332110602330072]])\n", "])" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "al_container.structure_lst" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3", "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.7.8" }, "latex_envs": { "LaTeX_envs_menu_present": true, "autocomplete": true, "bibliofile": "biblio.bib", "cite_by": "apalike", "current_citInitial": 1, "eqLabelWithNumbers": true, "eqNumInitial": 1, "hotkeys": { "equation": "Ctrl-E", "itemize": "Ctrl-I" }, "labels_anchors": false, "latex_user_defs": false, "report_style_numbering": false, "user_envs_cfg": false }, "toc": { "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "toc_cell": false, "toc_position": {}, "toc_section_display": "block", "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 4 }