Filter Data by Wyckoff Symbol
filter_by_wyckoff_symbol.RdFilters a data table (e.g., bonds or angles) to include only entries where a specified atom occupies one of the given Wyckoff sites.
Arguments
- data_table
A
data.tableobject, such as one produced byminimum_distanceorcalculate_angles.- atomic_coordinates
A
data.tablefromextract_atomic_coordinatescontainingWyckoffMultiplicityandWyckoffSymbolcolumns.- atom_col
A character string specifying the column in
data_tablethat contains the atom labels to filter by (e.g., "Atom1", "CentralAtom").- wyckoff_symbols
A character vector of the full Wyckoff symbols to keep (e.g.,
c("4c")orc("6c", "16i", "24k")).
Value
A data.table filtered to include only rows where the specified
atom occupies one of the desired Wyckoff sites.
Details
This function is designed to facilitate analysis based on crystallographic site symmetry. It is particularly useful for analyzing complex structures like clathrates where different atoms perform distinct structural roles based on their site symmetry.
The function works by:
Creating a full Wyckoff label (e.g., "4c", "24k") by combining the
WyckoffMultiplicityandWyckoffSymbolcolumns from theatomic_coordinatestable.Identifying the parent atom for each entry in the
data_table.Merging this Wyckoff information into the results table.
Filtering to keep only rows where the atom's full Wyckoff label matches one of the symbols provided in the
wyckoff_symbolsvector.
See also
Other property calculators:
calculate_angles(),
calculate_distances(),
calculate_neighbor_counts(),
calculate_weighted_neighbor_counts(),
filter_atoms_by_symbol(),
filter_by_elements()
Examples
cif_file <- system.file("extdata", "1590946.cif", package = "crystract")
if (file.exists(cif_file)) {
# 1. Perform a standard analysis to get bond and coordinate tables
cif_content <- read_cif_files(cif_file)[[1]]
atoms <- extract_atomic_coordinates(cif_content)
metrics <- extract_unit_cell_metrics(cif_content)
sym_ops <- extract_symmetry_operations(cif_content)
full_cell <- apply_symmetry_operations(atoms, sym_ops, metrics)
super_cell <- expand_transformed_coords(full_cell)
dists <- calculate_distances(atoms, super_cell, metrics)
bonds <- minimum_distance(dists)
# 2. Mock Wyckoff sites since 1590946 doesn't explicitly declare them
atoms[, WyckoffSymbol := "c"]
atoms[, WyckoffMultiplicity := 4]
print("Original atomic coordinates showing Wyckoff sites:")
print(atoms[, .(Label, WyckoffSymbol, WyckoffMultiplicity)])
filtered_bonds <- filter_by_wyckoff_symbol(
data_table = bonds,
atomic_coordinates = atoms,
atom_col = "Atom1",
wyckoff_symbols = "4c"
)
cat("\nNumber of bonds in original table:", nrow(bonds), "\n")
cat("Number of bonds after filtering for '4c' site:", nrow(filtered_bonds), "\n")
}
#> [1] "Original atomic coordinates showing Wyckoff sites:"
#> Label WyckoffSymbol WyckoffMultiplicity
#> <char> <char> <num>
#> 1: Sr1 c 4
#> 2: Sr2 c 4
#> 3: Si1 c 4
#>
#> Number of bonds in original table: 14
#> Number of bonds after filtering for '4c' site: 14