How to Obtain a Prototype Name for an Arbitrary Bulk Structure

Some house-keeping

In [1]:
import ase.build
import ase.io
import requests
import json
import pprint
try:
    import io
except ImportError:
    import StringIO as io
WYCKOFF_URL = 'https://api.catalysis-hub.org/apps/bulkEnumerator/get_wyckoff_from_structure'

Generate a Bulk Structure

First we just create a simple bulk structure, in this case Pd face-centered cubic.

In [2]:
bulk = ase.build.bulk('Pd', 'fcc')

Next, we write the bulk structure into a temporary file in memory in CIF format which is understood by the API. We send the file to the backend. The filename a.cif is a dummy name, but necessary to signal that the provided input format is cif. If our file is in a different format, we could state this here as well.

In [3]:
with io.StringIO() as cif_file:
    ase.io.write(cif_file, bulk, format='cif')
    response = requests.post(WYCKOFF_URL, files={'file': ('a.cif', cif_file.getvalue())})

We can now extract the requested information about spacegroup, wyckoff sites from the return JSON payload.

In [4]:
pprint.pprint(response.json())
{'cif': 'data_image0\n'
        '_cell_length_a       3.89001\n'
        '_cell_length_b       3.89001\n'
        '_cell_length_c       3.89001\n'
        '_cell_angle_alpha    90\n'
        '_cell_angle_beta     90\n'
        '_cell_angle_gamma    90\n'
        '\n'
        '_symmetry_space_group_name_H-M    "P 1"\n'
        '_symmetry_int_tables_number       1\n'
        '\n'
        'loop_\n'
        '  _symmetry_equiv_pos_as_xyz\n'
        "  'x, y, z'\n"
        '\n'
        'loop_\n'
        '  _atom_site_label\n'
        '  _atom_site_occupancy\n'
        '  _atom_site_fract_x\n'
        '  _atom_site_fract_y\n'
        '  _atom_site_fract_z\n'
        '  _atom_site_thermal_displace_type\n'
        '  _atom_site_B_iso_or_equiv\n'
        '  _atom_site_type_symbol\n'
        '  Pd1      1.0000 0.00000  0.00000  0.00000  Biso   1.000  Pd\n'
        '  Pd2      1.0000 0.00000  0.50000  0.50000  Biso   1.000  Pd\n'
        '  Pd3      1.0000 0.50000  0.00000  0.50000  Biso   1.000  Pd\n'
        '  Pd4      1.0000 0.50000  0.50000  0.00000  Biso   1.000  Pd\n',
 'name': "b'A_a_225'",
 'parameter_values': [{'name': "b'a'", 'value': 3.8900065353415534}],
 'poscar': 'Auto-generated \n'
           '1.0\n'
           '3.89001\t0\t0\t\n'
           '0\t3.89001\t0\t\n'
           '0\t0\t3.89001\t\n'
           'Pd\t\n'
           '4\t\n'
           'Direct\n'
           '0 0 0 \n'
           '0 0.5 0.5 \n'
           '0.5 0 0.5 \n'
           '0.5 0.5 0 \n',
 'runtime': 0.035282135009765625,
 'spacegroup': 225,
 'species': ["b'Pd'"],
 'species_permutations': ["b'Pd'"],
 'wyckoff': ["b'a'"],
 'wyckoff_list': [{'if_repeatable': 1, 'multiplicity': 192, 'symbol': "b'l'"},
                  {'if_repeatable': 1, 'multiplicity': 96, 'symbol': "b'k'"},
                  {'if_repeatable': 1, 'multiplicity': 96, 'symbol': "b'j'"},
                  {'if_repeatable': 1, 'multiplicity': 48, 'symbol': "b'i'"},
                  {'if_repeatable': 1, 'multiplicity': 48, 'symbol': "b'h'"},
                  {'if_repeatable': 1, 'multiplicity': 48, 'symbol': "b'g'"},
                  {'if_repeatable': 1, 'multiplicity': 32, 'symbol': "b'f'"},
                  {'if_repeatable': 1, 'multiplicity': 24, 'symbol': "b'e'"},
                  {'if_repeatable': -1, 'multiplicity': 24, 'symbol': "b'd'"},
                  {'if_repeatable': -1, 'multiplicity': 8, 'symbol': "b'c'"},
                  {'if_repeatable': -1, 'multiplicity': 4, 'symbol': "b'b'"},
                  {'if_repeatable': -1, 'multiplicity': 4, 'symbol': "b'a'"}]}