From 0c6a7517511b348131cb803dfd6bcbd7d927c85a Mon Sep 17 00:00:00 2001
From: Axel Kohlmeyer <akohlmey@gmail.com>
Date: Wed, 21 Jun 2017 19:29:31 -0400
Subject: [PATCH] may check for 1-4 scaling factors in CHARMM dihedral styles
 only when "weightflag" is set, since they may be used with amber

---
 src/MOLECULE/dihedral_charmm.cpp    | 10 ++++++----
 src/MOLECULE/dihedral_charmmfsw.cpp | 10 ++++++----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp
index ddbce407c9..35953a6ac4 100644
--- a/src/MOLECULE/dihedral_charmm.cpp
+++ b/src/MOLECULE/dihedral_charmm.cpp
@@ -380,14 +380,16 @@ void DihedralCharmm::init_style()
                  " r-RESPA level as 'outer'");
   }
 
-  if ((force->special_lj[3] != 0.0) || (force->special_coul[3] != 0.0))
-    error->all(FLERR,"Must use 'special_bonds charmm' with"
-               " dihedral style charmm");
-
   // insure use of CHARMM pair_style if any weight factors are non-zero
   // set local ptrs to LJ 14 arrays setup by Pair
+  // also verify that the correct 1-4 scaling is set
 
   if (weightflag) {
+
+    if ((force->special_lj[3] != 0.0) || (force->special_coul[3] != 0.0))
+      error->all(FLERR,"Must use 'special_bonds charmm' with"
+                 " dihedral style charmm for use with CHARMM pair styles");
+
     int itmp;
     if (force->pair == NULL)
       error->all(FLERR,"Dihedral charmm is incompatible with Pair style");
diff --git a/src/MOLECULE/dihedral_charmmfsw.cpp b/src/MOLECULE/dihedral_charmmfsw.cpp
index 4d78630f47..feb3e02bd4 100644
--- a/src/MOLECULE/dihedral_charmmfsw.cpp
+++ b/src/MOLECULE/dihedral_charmmfsw.cpp
@@ -398,14 +398,16 @@ void DihedralCharmmfsw::init_style()
         " r-RESPA level as 'outer'");
   }
 
-  if ((force->special_lj[3] != 0.0) || (force->special_coul[3] != 0.0))
-    error->all(FLERR,"Must use 'special_bonds charmm' with"
-               " dihedral style charmmfsw");
-
   // insure use of CHARMM pair_style if any weight factors are non-zero
   // set local ptrs to LJ 14 arrays setup by Pair
+  // also verify that the correct 1-4 scaling is set
 
   if (weightflag) {
+
+    if ((force->special_lj[3] != 0.0) || (force->special_coul[3] != 0.0))
+      error->all(FLERR,"Must use 'special_bonds charmm' with"
+                 " dihedral style charmm for use with CHARMM pair styles");
+
     int itmp;
     if (force->pair == NULL)
       error->all(FLERR,"Dihedral charmmfsw is incompatible with Pair style");
-- 
GitLab