mergeCells

mergeCells(first_configuration, second_configuration, merge_axis='A', vacuum=PhysicalQuantity(0.0, Ang))

Merge two BulkConfigurations into a single BulkConfiguration along a given merge axis and separated by a chosen amount of vacuum. The order is fixed such that the first configuration is always before the second configuration. To reverse the order, simply call this function with the two configurations swapped.

Parameters:
  • first_configuration (BulkConfiguration) – The first configuration, which is merged before the second.

  • second_configuration (BulkConfiguration) – The second configuration, which is merged after the first.

  • merge_axis (str) – The axis along which to merge. Valid values: ‘A’, ‘B’ or ‘C’.

  • vacuum (PhysicalQuantity of type length) – The amount of vacuum to put between the two configurations.

Returns:

The merged configuration.

Return type:

BulkConfiguration

Usage Examples

Merge a silver (Ag) BulkConfiguration with a palladium (Pd) BulkConfiguration.

# --- Create the two configurations ---
# Set up lattice
vector_a = [3.8903, 0.0, 0.0] * Angstrom
vector_b = [0.0, 3.8903, 0.0] * Angstrom
vector_c = [0.0, 0.0, 3.8903] * Angstrom
lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
elements = [Palladium, Palladium, Palladium, Palladium]

# Define coordinates
fractional_coordinates = [[0. ,  0. ,  0. ],
                          [0.5,  0.5,  0. ],
                          [0.5,  0. ,  0.5],
                          [0. ,  0.5,  0.5]]

# Set up configuration
first_configuration = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates
)

# Set up lattice
vector_a = [4.0857, 0.0, 0.0] * Angstrom
vector_b = [0.0, 4.0857, 0.0] * Angstrom
vector_c = [0.0, 0.0, 4.0857] * Angstrom
lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
elements = [Silver, Silver, Silver, Silver]

# Define coordinates
fractional_coordinates = [[0. ,  0. ,  0. ],
                          [0.5,  0.5,  0. ],
                          [0.5,  0. ,  0.5],
                          [0. ,  0.5,  0.5]]

# Set up configuration
second_configuration = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates
)

# Merge the first configuration with the second configuration, in that order, along the 'C' axis, separated by 0.5 Ang.
merged_configuration = mergeCells(
    first_configuration=first_configuration,
    second_configuration=second_configuration,
    merge_axis='C',
    vacuum=0.5 * Angstrom
)

mergeCells_example.py

../../../_images/Ag_Pd_merged.png

Fig. 184 Example output configuration from the mergeCells usage example, where the blue molecules are Pd and the grey molecules are Ag.

General

The function mergeCells is a simple utility which can be used to put two BulkConfiguration next to each other, when there is no need to consider atomic bonding at the interface or periodic boundary conditions not in the merge direction. This can be useful in cases where a structure such as a nanotube needs to be placed on the surface of a metal slab.

Notes

  • In the MergeCells Builder Plugin, there is the option to set the merge order such that the configuration dropped on the plugin is placed either “Before” or “After” the active configuration in the Builder stash. This option has been omitted in the functon mergeCells, as changing the merge order is equivalent to changing the order of the input.