% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/predict_bonds.R
\name{crystal_nn}
\alias{crystal_nn}
\title{Identify Atomic Bonds using CrystalNN}
\usage{
crystal_nn(
  distances,
  atomic_coordinates,
  expanded_coords,
  unit_cell_metrics,
  cutoff_length = 7,
  x_diff_weight = 3,
  porosity_adjustment = TRUE,
  distance_cutoffs = c(0.5, 1)
)
}
\arguments{
\item{distances}{Ignored.}

\item{atomic_coordinates}{Primary atom set.}

\item{expanded_coords}{Expanded supercell.}

\item{unit_cell_metrics}{Cell parameters.}

\item{cutoff_length}{Voronoi cutoff. Default 7.0 matches Pymatgen CrystalNN default.}

\item{x_diff_weight}{Electronegativity weight (default 3.0).}

\item{porosity_adjustment}{Logical (default TRUE).}

\item{distance_cutoffs}{Vector c(0.5, 1.0).}
}
\value{
A \code{data.table} of bonded pairs.
}
\description{
Port of Pymatgen's \code{CrystalNN} weighting logic. Includes Porosity,
Electronegativity, and Distance penalties.
Uses specific Decision Tree logic for radii (Shannon -> Covalent -> Atomic) per
pymatgen's fallback logic.
}
\examples{
\donttest{
cif_path <- system.file("extdata", "1590946.cif", package = "crystract")
if (file.exists(cif_path)) {
  old_threads <- data.table::setDTthreads(2)
  res <- analyze_single_cif(cif_path, bonding_algorithms = "crystal_nn")
  print(head(res$bonds_crystal_nn[[1]]))
  data.table::setDTthreads(old_threads)
}
}
}
\references{
Shannon, R. D. (1976). "Revised effective ionic radii and systematic studies of
interatomic distances in halides and chalcogenides." \emph{Acta Crystallographica
Section A}, 32(5), 751-767.

Pauling, L. (1960). \emph{The Nature of the Chemical Bond and the Structure of
Molecules and Crystals: An Introduction to Modern Structural Chemistry}.
Cornell University Press.

Pan, H., Ganose, A. M., Horton, M., et al. (2021). "Benchmarking Coordination Number
Prediction Algorithms on Inorganic Crystal Structures." \emph{Inorganic Chemistry},
60(3), 1590–1603. \doi{10.1021/acs.inorgchem.0c02996}
}
\seealso{
Other bonding algorithms: 
\code{\link{brunner_nn_reciprocal}()},
\code{\link{econ_nn}()},
\code{\link{minimum_distance}()},
\code{\link{voronoi_nn}()}
}
\concept{bonding algorithms}
