diff --git a/src/USER-BOCS/compute_pressure_bocs.cpp b/src/USER-BOCS/compute_pressure_bocs.cpp index 29397f1fab0b442e51b68bf3117e40ea0d464fe8..fc24efab4c52e27529b225c67f37393d7c500b01 100644 --- a/src/USER-BOCS/compute_pressure_bocs.cpp +++ b/src/USER-BOCS/compute_pressure_bocs.cpp @@ -52,6 +52,7 @@ ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) : timeflag = 1; p_match_flag = 0; + phi_coeff = NULL; // store temperature ID used by pressure computation // insure it is valid for temperature computation @@ -119,6 +120,7 @@ ComputePressureBocs::~ComputePressureBocs() delete [] id_temp; delete [] vector; delete [] vptr; + if (phi_coeff) free(phi_coeff); } /* ---------------------------------------------------------------------- */ @@ -263,6 +265,7 @@ void ComputePressureBocs::send_cg_info(int basis_type, int sent_N_basis, p_match_flag = 1; N_basis = sent_N_basis; + if (phi_coeff) free(phi_coeff); phi_coeff = ((double *) calloc(N_basis, sizeof(double)) ); for (int i=0; i<N_basis; i++) { phi_coeff[i] = sent_phi_coeff[i]; } @@ -327,10 +330,10 @@ double ComputePressureBocs::compute_scalar() if (keflag) scalar = (temperature->dof * boltz * t + virial[0] + virial[1] + virial[2]) / 3.0 * - inv_volume * nktv2p + (correction); correction + inv_volume * nktv2p + (correction); else scalar = (virial[0] + virial[1] + virial[2]) / 3.0 * - inv_volume * nktv2p + (correction); correction + inv_volume * nktv2p + (correction); } else { if (p_match_flag) { diff --git a/src/USER-BOCS/fix_bocs.cpp b/src/USER-BOCS/fix_bocs.cpp index ba74d6be1fdc4e0a4e2dacfb0b8f973854891eb7..8f1b73b78018150d32c9552262b6f8141dafd6a9 100644 --- a/src/USER-BOCS/fix_bocs.cpp +++ b/src/USER-BOCS/fix_bocs.cpp @@ -107,6 +107,8 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : id_temp = NULL; id_press = NULL; + p_match_coeffs = NULL; + // turn on tilt factor scaling, whenever applicable dimension = domain->dimension; @@ -463,6 +465,7 @@ FixBocs::~FixBocs() delete [] etap_mass; } } + if (p_match_coeffs) free(p_match_coeffs); } /* ---------------------------------------------------------------------- */