ChemicalCompositionProfile¶
- class ChemicalCompositionProfile(md_trajectory, start_time=None, end_time=None, resolution=None, direction_index=None, time_resolution=None, info_panel=None)¶
Constructor for the ChemicalCompositionProfile object.
- Parameters:
md_trajectory (
MDTrajectory
|AtomicConfiguration
) – The MDTrajectory or configuration to calculate the density profile for.start_time (PhysicalQuantity of type time) – The start time. Default:
0.0 * fs
end_time (PhysicalQuantity of the type time) – The end time. Default: the last time frame.
resolution (PhysicalQuantity of type length) – The bin size, which determines the resolution of the profile. Default:
2.0 * Angstrom
direction_index (int) – The index of the cell vector along which the profile should be calculated. Can only be an element of [0, 1, 2]. Default:
2
time_resolution (PhysicalQuantity of type time) – The time interval between snapshots in the MD trajectory that are included in the analysis.
info_panel (InfoPanel (Plot2D)) – Info panel to show the calculation progress. Default: No info panel
- data()¶
- Returns:
A dictionary containing the composition profile of each element as a percentage of the total composition
- Return type:
dict
- zValues()¶
- Returns:
The positions of the bins associated with the density profile.
- Return type:
PhysicalQuantity of type length
Usage Examples¶
Load an BulkConfiguration and calculate the chemical composition profile along the C-vector of the cell:
# Load the configuration for analysis
configuration = nlread('Si-Si3N4_interface.hdf5')[-1]
# Calculate the mass density profile along the C-vector of the cell.
composition_profile = ChemicalCompositionProfile(
configuration,
direction_index=2,
resolution=2.0 * Angstrom,
start_time=0.0 * fs
)
# Get the chemical composition and the positions of the bin centers.
chemical_composition = composition_profile.data()
bin_centers = composition_profile.zValues()
# Create the plot model
model = Plot.PlotModel(x_unit=Angstrom)
model.title().setText('Chemical composition')
model.xAxis().setLabel('C axis')
model.yAxis().setLabel('Element Percentage')
model.legend().setVisible(True)
# Add line for each element
for key in chemical_composition.keys():
line = Plot.Line(bin_centers, chemical_composition[key])
line.setLabel(f'Percentage of {key}')
model.addItem(line)
# Set different colors for each line
Plot.Colors.applyToItems(model.items(plot_item_type=Plot.Line))
# Set the ranges and show the plot
model.setLimits()
Plot.show(model)
Notes¶
The fraction of each element within a bin is given as a percentage value with respect to the total number of atoms.