Skip to content

Latest commit

 

History

History
22 lines (20 loc) · 715 Bytes

hint3-4.md

File metadata and controls

22 lines (20 loc) · 715 Bytes

If you print the angle between every possible combination of three atoms, you'll get lots of zeroes and angles between atoms that are far apart. To print mainly interesting angles, use if-else blocks to enforce these restrictions:

if(i!=j && i!=k && j!=k) { }  /* Skip coincidences */

and

if(i < j && j < k && R[i][j] < 4.0 && R[j][k] < 4.0) { } /* Skip atoms far apart (specifically with bond distances > 4.0 bohr) */

Alternatively, you can limit the loop structure and just filter out the bond distances:

for(int i=0; i < mol.natom; i++) {
  for(int j=0; j < i; j++) {
    for(int k=0; k < j; k++) {
      if(R[i][j] < 4.0 && R[j][k] < 4.0) {
         ...
      }
    }
  }
}