Introduction to atomman: DFT reference crystal loading

Lucas M. Hale, lucas.hale@nist.gov, Materials Science and Engineering Division, NIST.

Disclaimers

1. Introduction

In addition to the crystal structures in the NIST Repository, crystal structures can also be obtained directly from the Materials Project and OQMD DFT databases. This provides a means of performing direct comparisons of crystal structure predictions between DFT and classical potentials and offers the opportunity to explore more proposed crystal structures.

Added version 1.4.0

NOTE: Fetching records from Materials Project requires that pymatgen be installed.

Library Imports

[1]:
# Standard Python libraries
import datetime

# http://www.numpy.org/
import numpy as np

import atomman as am
import atomman.unitconvert as uc

# Show atomman version
print('atomman version =', am.__version__)

# Show date of Notebook execution
print('Notebook executed on', datetime.date.today())
atomman version = 1.4.10
Notebook executed on 2023-07-28

2. atomman.load(‘prototype’)

Accesses the potentials database to retrieve a crystal_prototype record and generate a unit cell System based on it.

Query parameters

  • id (str) The reference crystal’s unique id. Combines a database tag “mp-” or “oqmd-” and the DFT database’s entry id.

  • api_key (str, optional) The user’s Materials Project API key or path to a file containing the key. Only needed for fetching structures from Materials Project and if the key is not set to the “MAPI_KEY” environment variable.

Database option parameters

  • database (atomman.library.Database, optional) A pre-defined Database object to use. If not given, will initialize a new Database object. Passing in a database can save time if multiple calls are made for the same record type.

  • local (bool, optional) Indicates if the Database object is to look for local records. Default is True. Ignored if database is given.

  • remote (bool, optional) Indicates if the Database object is to look for remote records. Default is True. Ignored if database is given.

  • refresh_cache (bool, optional) If the local database is of style “local”, indicates if the metadata cache file is to be refreshed. If False, metadata for new records will be added but the old record metadata fields will not be updated. If True, then the metadata for all records will be regenerated, which is needed to update the metadata for modified records.

  • verbose (bool, optional) If True, info messages will be printed during operations. Default value is False.

Returns

  • system (atomman.System) The system object generated from the crystal prototype.

Fetch the relaxed fcc Au structure from both databases

[2]:
mp_api_key = 'C:/Users/lmh1/Documents/Materials Project/API key.txt'

ucell = am.load('dft_reference', 'mp-81', api_key=mp_api_key, verbose=True)
print(ucell)
Matching record retrieved from local
avect =  [ 4.171,  0.000,  0.000]
bvect =  [ 0.000,  4.171,  0.000]
cvect =  [ 0.000,  0.000,  4.171]
origin = [ 0.000,  0.000,  0.000]
natoms = 4
natypes = 1
symbols = ('Au',)
pbc = [ True  True  True]
per-atom properties = ['atype', 'pos']
     id   atype  pos[0]  pos[1]  pos[2]
      0       1   0.000   0.000   0.000
      1       1   0.000   2.086   2.086
      2       1   2.086   0.000   2.086
      3       1   2.086   2.086   0.000
[3]:
ucell = am.load('dft_reference', 'oqmd-592562', verbose=True)
print(ucell)
Matching record retrieved from local
avect =  [ 4.125,  0.000,  0.000]
bvect =  [ 0.000,  4.125,  0.000]
cvect =  [ 0.000,  0.000,  4.125]
origin = [ 0.000,  0.000,  0.000]
natoms = 4
natypes = 1
symbols = ('Au',)
pbc = [ True  True  True]
per-atom properties = ['atype', 'pos']
     id   atype  pos[0]  pos[1]  pos[2]
      0       1   0.000   0.000   0.000
      1       1   2.063   2.063   0.000
      2       1   2.063   0.000   2.063
      3       1   0.000   2.063   2.063