top of page
Atomic Bonds

 

Write a function called atomicbonds that determines which atoms in a list are closer than a distance called cutoff. The function should accept as input a matrix of atomic positions (x,y,z) where each row represents a different atom, ie an N by 3 matrix where N is the number of atoms.
 
The output should be a sparse connectivity matrix similar to the one discussed in the podcast, where the row and column represent atom numbers and the value for each pair is set to the separation distance between the atoms if the two are within the cutoff or 0 if they are not. To avoid redundancy only the upper triangular part of the matrix should be non-zero (those values where row < column).
bottom of page