Check q perturbation when PME on GPU is tested
[alexxy/gromacs.git] / src / gromacs / topology / topology.cpp
index f03322256729577c2ed6cf8266b9187f08072643..d82c2ac3b27fdad74cad3931de65d5fc0685f6f5 100644 (file)
@@ -251,6 +251,25 @@ bool gmx_mtop_has_charges(const gmx_mtop_t *mtop)
     return mtop->moltype.empty() || mtop->moltype[0].atoms.haveCharge;
 }
 
+bool gmx_mtop_has_perturbed_charges(const gmx_mtop_t &mtop)
+{
+    for (const gmx_moltype_t &moltype : mtop.moltype)
+    {
+        const t_atoms &atoms = moltype.atoms;
+        if (atoms.haveBState)
+        {
+            for (int a = 0; a < atoms.nr; a++)
+            {
+                if (atoms.atom[a].q != atoms.atom[a].qB)
+                {
+                    return true;
+                }
+            }
+        }
+    }
+    return false;
+}
+
 bool gmx_mtop_has_atomtypes(const gmx_mtop_t *mtop)
 {
     if (mtop == nullptr)