correct free into delete
correct dims inversion of natoms and dimension