Skip to content

Latest commit

 

History

History
18 lines (16 loc) · 550 Bytes

hint2-1.md

File metadata and controls

18 lines (16 loc) · 550 Bytes

If we choose to store the matrix of bond distances, we need to allocate the necessary memory, either as a static two-dimensional array:

double R[50][50];

or via dynamic allocation using the Molecule class:

double **R = new double* [mol.natom];
for(int i=0; i < mol.natom; i++)
  R[i] = new double[mol.natom];

Don't forget to delete[] the memory at the end of the program:

for(int i=0; i < mol.natom; i++)
  delete[] R[i];
delete[] R;