% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/calculate_properties.R
\name{filter_by_wyckoff_symbol}
\alias{filter_by_wyckoff_symbol}
\title{Filter Data by Wyckoff Symbol}
\usage{
filter_by_wyckoff_symbol(
  data_table,
  atomic_coordinates,
  atom_col,
  wyckoff_symbols
)
}
\arguments{
\item{data_table}{A \code{data.table} object, such as one produced by
\code{minimum_distance} or
\code{calculate_angles}.}

\item{atomic_coordinates}{A \code{data.table} from \code{extract_atomic_coordinates}
containing \code{WyckoffMultiplicity} and \code{WyckoffSymbol} columns.}

\item{atom_col}{A character string specifying the column in \code{data_table}
that contains the atom labels to filter by (e.g., "Atom1", "CentralAtom").}

\item{wyckoff_symbols}{A character vector of the full Wyckoff symbols to
keep (e.g., \code{c("4c")} or \code{c("6c", "16i", "24k")}).}
}
\value{
A \code{data.table} filtered to include only rows where the specified
atom occupies one of the desired Wyckoff sites.
}
\description{
Filters a data table (e.g., bonds or angles) to include only
entries where a specified atom occupies one of the given 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:
\enumerate{
\item Creating a full Wyckoff label (e.g., "4c", "24k") by combining the
\code{WyckoffMultiplicity} and \code{WyckoffSymbol} columns from the
\code{atomic_coordinates} table.
\item Identifying the parent atom for each entry in the \code{data_table}.
\item Merging this Wyckoff information into the results table.
\item Filtering to keep only rows where the atom's full Wyckoff label matches
one of the symbols provided in the \code{wyckoff_symbols} vector.
}
}
\examples{
cif_file <- system.file("extdata", "1590946.cif", package = "crystract")
if (file.exists(cif_file)) {
  old_threads <- data.table::setDTthreads(2)
  # 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")
  data.table::setDTthreads(old_threads)
}
}
\seealso{
Other property calculators: 
\code{\link{calculate_angles}()},
\code{\link{calculate_distances}()},
\code{\link{calculate_neighbor_counts}()},
\code{\link{calculate_weighted_neighbor_counts}()},
\code{\link{filter_atoms_by_symbol}()},
\code{\link{filter_by_elements}()}
}
\concept{property calculators}
