diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index 08fe7de5cb4a12402698e60410e9936609d8bf49..6221e6d52c26b359d9efd7d87460a1ed3ceacaf3 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -1349,7 +1349,7 @@ void FixGCMC::attempt_molecule_insertion() MathExtra::quat_to_mat(quat,rotmat); double insertion_energy = 0.0; - bool procflag[natoms_per_molecule]; + bool *procflag = new bool[natoms_per_molecule]; for (int i = 0; i < natoms_per_molecule; i++) { MathExtra::matvec(rotmat,onemols[imol]->x[i],molcoords[i]); @@ -1472,6 +1472,7 @@ void FixGCMC::attempt_molecule_insertion() update_gas_atoms_list(); ninsertion_successes += 1.0; } + delete[] procflag; } /* ---------------------------------------------------------------------- @@ -1934,7 +1935,7 @@ void FixGCMC::attempt_molecule_deletion_full() grow_molecule_arrays(nmolq); int m = 0; - int tmpmask[atom->nlocal]; + int *tmpmask = new int[atom->nlocal]; for (int i = 0; i < atom->nlocal; i++) { if (atom->molecule[i] == deletion_molecule) { tmpmask[i] = atom->mask[i]; @@ -1982,6 +1983,7 @@ void FixGCMC::attempt_molecule_deletion_full() if (force->kspace) force->kspace->qsum_qsq(); } update_gas_atoms_list(); + delete[] tmpmask; } /* ---------------------------------------------------------------------- @@ -2426,9 +2428,9 @@ void FixGCMC::update_gas_atoms_list() for (int i = 0; i < nlocal; i++) maxmol = MAX(maxmol,molecule[i]); tagint maxmol_all; MPI_Allreduce(&maxmol,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world); - double comx[maxmol_all]; - double comy[maxmol_all]; - double comz[maxmol_all]; + double *comx = new double[maxmol_all]; + double *comy = new double[maxmol_all]; + double *comz = new double[maxmol_all]; for (int imolecule = 0; imolecule < maxmol_all; imolecule++) { for (int i = 0; i < nlocal; i++) { if (molecule[i] == imolecule) { @@ -2458,7 +2460,9 @@ void FixGCMC::update_gas_atoms_list() } } } - + delete[] comx; + delete[] comy; + delete[] comz; } else { for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) {