User Tools

Site Tools


crawdad:programming:project1:hint2.1

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;
crawdad/programming/project1/hint2.1.txt · Last modified: 2012/11/20 14:12 by crawdad