Fix logic in init_ewald_coulomb_force_table
authorAndrey Alekseenko <al42and@gmail.com>
Mon, 5 Oct 2020 10:03:45 +0000 (12:03 +0200)
committerArtem Zhmurov <zhmurov@gmail.com>
Tue, 6 Oct 2020 10:01:53 +0000 (10:01 +0000)
Previously, destroyParamLookupTable was called only if buffer was
nullptr (uninitialized). Which looks like a typo, and leads to nothing,
because all implementation of destroyParamLookupTable would refuse to
work on nullptr. Changed the check to free the buffer only if there is
anything to free.

src/gromacs/nbnxm/nbnxm_gpu_data_mgmt.cpp

index 3fd85ae473c54b0cb36b086cc598a6a52acb9400..47cfa5b81f47c494a1a9a77caf6dc7c49e6f4aa7 100644 (file)
@@ -72,7 +72,7 @@ void init_ewald_coulomb_force_table(const EwaldCorrectionTables& tables,
                                     NBParamGpu*                  nbp,
                                     const DeviceContext&         deviceContext)
 {
-    if (!nbp->coulomb_tab)
+    if (nbp->coulomb_tab)
     {
         destroyParamLookupTable(&nbp->coulomb_tab, nbp->coulomb_tab_texobj);
     }