From c5430b0a26075fe20c65fe2ad70762e113f77d55 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer <akohlmey@gmail.com> Date: Thu, 22 Jun 2017 18:41:44 -0400 Subject: [PATCH] print info messages when changing qqr2e constant in fully CHARMM compatible pair styles --- src/KSPACE/pair_lj_charmmfsw_coul_long.cpp | 12 ++++++++++-- src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp index 9ba59b6995..30d8ab64b6 100644 --- a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp @@ -65,8 +65,12 @@ PairLJCharmmfswCoulLong::PairLJCharmmfswCoulLong(LAMMPS *lmp) : Pair(lmp) // switch qqr2e from LAMMPS value to CHARMM value - if (strcmp(update->unit_style,"real") == 0) + if (strcmp(update->unit_style,"real") == 0) { + if ((comm->me == 0) && (force->qqr2e != force->qqr2e_charmm_real)) + error->message(FLERR,"Switching to CHARMM coulomb energy" + " conversion constant"); force->qqr2e = force->qqr2e_charmm_real; + } } /* ---------------------------------------------------------------------- */ @@ -96,8 +100,12 @@ PairLJCharmmfswCoulLong::~PairLJCharmmfswCoulLong() // switch qqr2e back from CHARMM value to LAMMPS value - if (strcmp(update->unit_style,"real") == 0) + if (update && strcmp(update->unit_style,"real") == 0) { + if ((comm->me == 0) && (force->qqr2e == force->qqr2e_charmm_real)) + error->message(FLERR,"Restoring original LAMMPS coulomb energy" + " conversion constant"); force->qqr2e = force->qqr2e_lammps_real; + } } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp index f1366a379d..0d2159b671 100644 --- a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp +++ b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp @@ -50,8 +50,12 @@ PairLJCharmmfswCoulCharmmfsh::PairLJCharmmfswCoulCharmmfsh(LAMMPS *lmp) : // switch qqr2e from LAMMPS value to CHARMM value - if (strcmp(update->unit_style,"real") == 0) + if (strcmp(update->unit_style,"real") == 0) { + if ((comm->me == 0) && (force->qqr2e != force->qqr2e_charmm_real)) + error->message(FLERR,"Switching to CHARMM coulomb energy" + " conversion constant"); force->qqr2e = force->qqr2e_charmm_real; + } } /* ---------------------------------------------------------------------- */ @@ -80,8 +84,12 @@ PairLJCharmmfswCoulCharmmfsh::~PairLJCharmmfswCoulCharmmfsh() // switch qqr2e back from CHARMM value to LAMMPS value - if (strcmp(update->unit_style,"real") == 0) + if (update && strcmp(update->unit_style,"real") == 0) { + if ((comm->me == 0) && (force->qqr2e == force->qqr2e_charmm_real)) + error->message(FLERR,"Restoring original LAMMPS coulomb energy" + " conversion constant"); force->qqr2e = force->qqr2e_lammps_real; + } } /* ---------------------------------------------------------------------- */ -- GitLab