structure Modules

structure.build Module

hzdplugins.structure.build.addAdsorbates(slab, adsSiteDictionary)[source]

addAdsorbates will take care of these things:

  • Add each adsorbate to a specific site, and with optimal adsorption distance and angle

  • Put the bottom two layers of the slab fixed, other atoms can be relaxed

Parameters
  • slab (aiida.orm.StructureData object) – The slab that we want to adsorb some adsorbates on.

  • adsSiteDictionary (python dictionary object) –

    In which contains the adsorbates (for common adsorbates, I can assign the adsorption atom, geometry of the adsorbates and its adsorption angle in constants.py) and adsorption sites, also I can add new adsorbates to the adsorbates library. (Do a very simple relax simulation of a molecule in the big cell, and just output the structure and assign the adsorption site. For mono-site adsorption, it is really easy, for bi-site adsorption, it is also easy since we can get the molecule to align; for tri-site or more-site adsorption, well, we can just put the molecule closer to the surface and let the program determine how does this molecule interact with the surface, for our usual research, I don’t think this is necessary.)

    adsSiteDictionary = {
        'O': [site1, site2, site3] # each site is a 3x1 list [a, b, c]
        'F': [site1, site2, site3]
    }
    

Returns

With the adsorbates and modified constrains on all the atoms, ready for the submit functions.

Return type

aiida.orm.StructureData object

hzdplugins.structure.build.adsorptionSites(slab, **kwargs)[source]

AdsorptionSites can help us visualize the position and tag of each adsorption sites, then we can determine where we want to put the adsorbates.

Parameters
  • slab (aiida.orm.StructureData) – This is our slab, and we want to find how we can put the adsorbates on the slab.

  • kwargs

    • distance: the distance between adsorption site and the surface

    • symm_reduce: the symmetry reduce (default = 0.01)

    • near_reduce: the near reduce (default = 0.01)

Returns

Dictionary contains the dictionary of adsorption sites.

Return type

aiida.orm.Dict object

hzdplugins.structure.build.atomQuery(structure, query_dict, is_and=True)[source]

atomQuery can help us query the list of atoms that we want to manipulate later.

Parameters
  • structure (aiida.orm.StructureData) – The structure that we want to investigate.

  • query_dict (python dictionary object) –

    The query dictionary, now support these keys: (1) ‘symbol’ (2) ‘x’, ‘y’, ‘z’ (3) ‘connection’

    query_dict = {
        'symbol': ['Ni'],
        'z': {'>', 30.0},
        'connection': 25
    }
    

    which means we want to query Ni atoms, that z coordinates is larger than 30.0, also have connection to 25th atom.

  • is_and (python bool object, optional) – whether we want to and the condition in query_dict, defaults to True

Returns

index of atoms

Return type

python list object

hzdplugins.structure.build.buildMoleculeFromSMILE(smileStr)[source]

Create molecular structure by using

Parameters

smileStr (Python string) – The string of the SMILES

Returns

A molecule structure

Return type

ase.Atoms object

hzdplugins.structure.build.bulkFromFile(filename, supercell)[source]

bulkFromFile function can help us create a Bulk from the file.

Parameters
  • filename (python string object) – Usually when we create the structural file, we do it from the strcutural file such as .xyz or .cif, etc.

  • supercell (python list object) – A list that contains the dimension of supercell we would like.

Returns

A StructureData file that can be used directly in Aiida.

Return type

aiida.orm.StructurData object

hzdplugins.structure.build.bulkFromString(bulkStr, crystal_structure, a, cubic, supercell, b=None, c=None, alpha=None, covera=None, u=None, orthorhombic=None)[source]

bulkFromFile function can help us create a Bulk from the string.

Parameters
  • bulkStr (python string object) – The string for the material.

  • crystal_structure (python string object) – The crystal structure. It need to be in one of those: sc, fcc, bcc, tetragonal, bct, hcp, rhombohedral, orthorhombic, mlc, diamond, zincblende, rocksalt, cesiumchloride, fluorite or wurtzite.

  • a(/b/c) (python float object) – Lattice constants.

  • supercell (python list object) – The supercell that we want to get.

Returns

The structure of the bulk.

Return type

aiida.orm.StructureData

hzdplugins.structure.build.delAtoms(structure, atom_list)[source]

delAtoms can delete any atoms you want, and return the aiida.orm.StructureData object.

Parameters
  • structure (aiida.orm.StructureData) – The structure that we want to deal with

  • atom_list (python list object) – The list of atoms that we want to delete

Returns

A new structure where the atom in the atom_list has been deleted.

Return type

aiida.orm.StructureData

hzdplugins.structure.build.expandLayerDistance(struct, begin_end_layer, setDistance)[source]

expandLayerDistance can expand the distance between layers in the layered structure

Parameters
  • struct (python list) – The structure

  • begin_end_layer – The beginning and the ending of each layer

e.g. begin_end_layer = [[a1, b1], [a2, b2], [a3, b3]]

Parameters

setDistance (python float) – The distance between layers that we want to set

hzdplugins.structure.build.getMoleculeByName(ads_str)[source]

getMoleculeByName can return the Molecule object of a specific adsorbates, could be very useful for the simulations.

Parameters

ads_str (python string) – an index of adsorbates in the database

Returns

An atom or a molecule

Return type

pymatgen molecule object

hzdplugins.structure.build.getValue(var)[source]

getValue can help us to initialize the variables

Parameters

var (aiida.orm Types) – variable that we want to get value from.

Returns

the value of the variable.

Return type

corresponding python Types

hzdplugins.structure.build.hzd_add_adsMono(slab, molecule, ads_coord, ads_site)[source]

hzd_add_ads is a help function that can help me add adsorbates.

Parameters
  • slab (Pymatgen Molecule object.) – A slab that we are interested in.

  • molecule – The adsorbate that we want to add

  • ads_coord (python list) – The position of adsorption site

  • ads_site – The adsorption site of the molecule. If there is only 1 site in the molecule, that means it is mono-ads, if there are 2 sites in the molecule, then it can be mono-ads or bi-ads (needs to treat differently).

Returns

A modified slab with added adsorbates.

Return type

pymatgen structure object.

hzdplugins.structure.build.millerSurfaces(bulk, miller_index, layers, vacuum, get_orthogonal=False, bonds=None)[source]

millerSurfaces can help us generate a list of slab structures that we could use in future studies

Parameters
  • bulk (aiida.orm.StructureData object) – The bulk structure that we are going to use for creating the surface slabs.

  • miller_index (python list object) – The miller index that we want to get.

  • layers (python int object) – Set how many layers you want for the surface slab.

  • vacuum (python list object) – Set how many layers you want for the vacuum layer.

  • get_orthogonal (python boolean object) – Whether we want to get orthogonal slab or not

  • bonds (python dictionary object) – a dictionary which define the bond length of two atoms. e.g. {(‘P’, ‘O’):3}

Returns

A list of slabs that we generated, notice that all the slabs are orthogonal, because we use slab.get_orthogonal_c_slab() for all the slabs

Return type

pymatgen.core.structure.slab object

hzdplugins.structure.build.newStructure(structure, changeDict)[source]

newStructure will create a new structure by replacing the changeList atom to new type of atoms, very useful if there are different chemical states of the same atom in the structure.

Parameters
  • structure (aiida.orm.StructureData object) – previous structure with conventional atomic symbols

  • changeDict (python dictionary) – A dictionary where the i-th atom’s label will be replaced. e.g. ‘Fe’ to ‘Fe2’

Returns

return an object which stores the change of the label

Return type

aiida.orm.StructureData object

hzdplugins.structure.build.setFixedCoords(slab, height)[source]

setFixedCoords is a function that can return a list that shows which atom we want to freeze during the simulation

Parameters
  • slab (aiida.orm.StructureData object) – The slab that we want to fixed atoms.

  • height (float) – shows the boundary of the fixed atom. if the z-component of the position of the atom is below height, then we freeze it.

Returns

A Nx3 list which holds all the information about the fixed atoms, can be directly passed to the setting_dict.

Return type

python list

hzdplugins.structure.build.setSpinStructure(symbol, hl_spin, num_electrons)[source]

setSpinStructure can help us generate the starting_ns_eigenvalue quickly, otherwise it will take too long. Notice in here we only assume that all the symbol are d-groups (just for simplicity for now.)

Parameters
  • symbol (python string object) – The symbol of our atom, e.g. ‘Fe’

  • hl_spin (python string object) – whether we want low_spin (‘ls’) or high_spin (‘hs’)

  • num_electrons (python int object) – the number of electrons that we want to assign

Raises

ValueError – If your num_electrons is larger than 10, then it is not possible, because the maximum amount of d electrons is 10.

Returns

A list of lists which contains the information about the spin configuration.

Return type

python list object

hzdplugins.structure.build.visualizeSlab(slab, plot_adsSite=False, adsorption_sites=None, adssitetype=['ontop', 'bridge', 'hollow'], **kwargs)[source]

visualizeSlab will show the slab

Parameters
  • slab (aiida.orm.StructureData object) – The slab that we want to visualize

  • plot_adsSite (python boolean object) – If true, then add adsorption sites, if false, then adsorption site not show.

  • adsorption_sites (aiida.orm.Dict object) – Shows the adsorption sites.

  • adssitetype (python list object) – determine which adsorption site you want to plot, the default is all types of sites (ontop, bridge, hollow), but you can specify on your own. Since sometime the program tends to give us more sites, so it is not easy to see, so we can define what kind of site we want to investigate.

  • kwargs – Settings for the plot: * repeat: Int * decay: Float * scale: Float * window: Float

Returns

A graph which represents the slab surface (and the position of adsorption sites).

Return type

matplotlib.pyplot object.