Distances
The distance between two Atoms in a Crystal is central to many operations within Xtals.jl. The distance function calculates the Cartesian displacement between the Coords (Cart or Frac) of two points, i and j, within a given box.
xtal = Crystal("Co-MOF-74.cif")
distance(xtal.atoms.coords, xtal.box, 1, 2, false) # 23.2 ÅThe apply_pbc argument allows for calculation of distances across the periodic boundaries of the box.
distance(xtal.atoms.coords, xtal.box, 1, 2, true) # 3.34 Ådistance also works on Atoms and Charges.
distance(xtal.atoms, xtal.box, 3, 5, true)docs
Xtals.distance — Functionr = distance(coords, box, i, j, apply_pbc)
r = distance(atoms, box, i, j, apply_pbc) # atoms i and j
r = distance(charges, box, i, j, apply_pbc) # atoms i and jcalculate the (Cartesian) distance between particles i and j.
apply periodic boundary conditions if and only if apply_pbc is true.
arguments
coords::Coords: the coordinates (Frac>:CoordsorCart>:Coords)atoms::Atoms: atomscharges::charges: atomsbox::Box: unit cell informationi::Int: index of the first particlej::Int: Index of the second particleapply_pbc::Bool:trueif we wish to apply periodic boundary conditions,falseotherwise