  Impurities are often driven to segregate to grain boundaries, which can
significantly alter a material's thermal stability and mechanical behavior. To
provide a comprehensive picture of this issue, the influence of a wide variety
of common nonmetal impurities (H, B, C, N, O, Si, P and S) incorporated during
service or materials processing are studied using first-principles simulations,
with a focus on identifying changes to the energetics and mechanical strength
of a Cu $\Sigma$5 (310) grain boundary. Changes to the grain boundary energy
are found to be closely correlated with the covalent radii of the impurities
and the volumetric deformations of polyhedra at the interface. The
strengthening energies of each impurity are evaluated as a function of covalent
radius and electronegativity, followed by first-principles-based tensile tests
on selected impurities. The strengthening of a B-doped grain boundary comes
from an enhancement of the charge density among the adjacent Cu atoms, which
improves the connection between the two grains. Alternatively, the detrimental
effect of O results from the reduction of charge density between the Cu atoms.
This work deepens the understanding of the possible beneficial and harmful
effects of impurities on grain boundaries, providing a guide for materials
processing studies.
