diff --git a/CHANGES/v2.4.md b/CHANGES/v2.4.md index 5be862e9c62ef972466cb91bf3a53d66ef083452..abb0fbe0da61a8825af29ff80db24c51af906503 100644 --- a/CHANGES/v2.4.md +++ b/CHANGES/v2.4.md @@ -230,3 +230,7 @@ For users: - Added aliases for some actions/options containing dashes (`-`) in their name. This will improve backward compatibility when these actions/options will be removed (see \issue{449}). +## Version 2.4.6 () + +For users: + - Fixed a bug in \ref COORDINATIONNUMBER where derivatives where wrong when using R_POWER > 2, thanks to @MoleOrbitalHybridAnalyst for spotting and fixing diff --git a/regtest/multicolvar/rt-coordination-powers/derivatives.reference b/regtest/multicolvar/rt-coordination-powers/derivatives.reference index 5c4c73cea81fa7347ec6155c6957d0c3f1685312..b11b9df8d68e66c188553105d0846adeb6e75270 100644 --- a/regtest/multicolvar/rt-coordination-powers/derivatives.reference +++ b/regtest/multicolvar/rt-coordination-powers/derivatives.reference @@ -1,196 +1,196 @@ #! FIELDS time parameter c1.mean c1num.mean - 0.000000 0 0.3371 0.3371 - 0.000000 1 0.2309 0.2309 - 0.000000 2 0.1160 0.1160 - 0.000000 3 -0.3510 -0.3510 - 0.000000 4 0.3400 0.3400 - 0.000000 5 0.0247 0.0247 - 0.000000 6 -0.2278 -0.2278 - 0.000000 7 -0.3331 -0.3331 - 0.000000 8 0.1718 0.1718 - 0.000000 9 0.3076 0.3076 - 0.000000 10 -0.3590 -0.3590 - 0.000000 11 0.0586 0.0586 - 0.000000 12 0.3427 0.3427 - 0.000000 13 0.3101 0.3101 - 0.000000 14 -0.0220 -0.0220 - 0.000000 15 -0.3300 -0.3300 - 0.000000 16 0.2127 0.2127 - 0.000000 17 -0.1563 -0.1563 - 0.000000 18 -0.3289 -0.3289 - 0.000000 19 -0.3330 -0.3330 - 0.000000 20 -0.0762 -0.0762 - 0.000000 21 0.2298 0.2298 - 0.000000 22 -0.3172 -0.3171 - 0.000000 23 -0.1589 -0.1589 - 0.000000 24 0.2379 0.2379 - 0.000000 25 0.1246 0.1246 - 0.000000 26 -0.0916 -0.0916 - 0.000000 27 -0.2175 -0.2175 - 0.000000 28 0.1238 0.1238 - 0.000000 29 0.1339 0.1339 - 0.000000 30 1.2686 1.2686 - 0.000000 31 0.0008 0.0008 - 0.000000 32 -0.0777 -0.0777 - 0.000000 33 0.0008 0.0008 - 0.000000 34 1.1233 1.1233 - 0.000000 35 0.0031 0.0031 - 0.000000 36 -0.0777 -0.0777 - 0.000000 37 0.0031 0.0031 - 0.000000 38 2.5446 2.5446 - 0.005000 0 0.3287 0.3287 - 0.005000 1 0.2323 0.2323 - 0.005000 2 0.1100 0.1100 - 0.005000 3 -0.3587 -0.3587 - 0.005000 4 0.3367 0.3367 - 0.005000 5 0.0181 0.0181 - 0.005000 6 -0.2232 -0.2232 - 0.005000 7 -0.3296 -0.3296 - 0.005000 8 0.1699 0.1699 - 0.005000 9 0.2908 0.2908 - 0.005000 10 -0.3585 -0.3585 - 0.005000 11 0.0690 0.0690 - 0.005000 12 0.3444 0.3444 - 0.005000 13 0.2895 0.2895 - 0.005000 14 -0.0237 -0.0237 - 0.005000 15 -0.3163 -0.3163 - 0.005000 16 0.1948 0.1948 - 0.005000 17 -0.1722 -0.1722 - 0.005000 18 -0.3261 -0.3261 - 0.005000 19 -0.3198 -0.3198 - 0.005000 20 -0.0941 -0.0941 - 0.005000 21 0.2273 0.2273 - 0.005000 22 -0.2878 -0.2878 - 0.005000 23 -0.1523 -0.1523 - 0.005000 24 0.2355 0.2355 - 0.005000 25 0.1149 0.1149 - 0.005000 26 -0.0652 -0.0652 - 0.005000 27 -0.2023 -0.2023 - 0.005000 28 0.1276 0.1276 - 0.005000 29 0.1406 0.1406 - 0.005000 30 1.2983 1.2983 - 0.005000 31 0.0074 0.0074 - 0.005000 32 -0.0442 -0.0442 - 0.005000 33 0.0074 0.0074 - 0.005000 34 1.0616 1.0616 - 0.005000 35 0.0049 0.0049 - 0.005000 36 -0.0442 -0.0442 - 0.005000 37 0.0049 0.0049 - 0.005000 38 2.4949 2.4949 - 0.010000 0 0.3057 0.3057 - 0.010000 1 0.2219 0.2219 - 0.010000 2 0.1123 0.1123 - 0.010000 3 -0.3610 -0.3610 - 0.010000 4 0.3207 0.3207 - 0.010000 5 0.0249 0.0249 - 0.010000 6 -0.2431 -0.2431 - 0.010000 7 -0.3227 -0.3227 - 0.010000 8 0.1861 0.1861 - 0.010000 9 0.3110 0.3110 - 0.010000 10 -0.3230 -0.3230 - 0.010000 11 0.0536 0.0536 - 0.010000 12 0.3321 0.3321 - 0.010000 13 0.2460 0.2460 - 0.010000 14 -0.0204 -0.0204 - 0.010000 15 -0.3035 -0.3035 - 0.010000 16 0.1750 0.1750 - 0.010000 17 -0.1895 -0.1895 - 0.010000 18 -0.3215 -0.3215 - 0.010000 19 -0.3011 -0.3011 - 0.010000 20 -0.0991 -0.0991 - 0.010000 21 0.2342 0.2342 - 0.010000 22 -0.2677 -0.2677 - 0.010000 23 -0.1512 -0.1512 - 0.010000 24 0.2325 0.2325 - 0.010000 25 0.1200 0.1200 - 0.010000 26 -0.0458 -0.0458 - 0.010000 27 -0.1864 -0.1864 - 0.010000 28 0.1309 0.1309 - 0.010000 29 0.1290 0.1290 - 0.010000 30 1.3546 1.3546 - 0.010000 31 -0.0010 -0.0010 - 0.010000 32 -0.0324 -0.0324 - 0.010000 33 -0.0010 -0.0010 - 0.010000 34 0.9469 0.9469 - 0.010000 35 0.0118 0.0118 - 0.010000 36 -0.0324 -0.0324 - 0.010000 37 0.0118 0.0118 - 0.010000 38 2.4485 2.4485 - 0.015000 0 0.2784 0.2784 - 0.015000 1 0.2040 0.2040 - 0.015000 2 0.0909 0.0909 - 0.015000 3 -0.3455 -0.3455 - 0.015000 4 0.2867 0.2867 - 0.015000 5 0.0230 0.0230 - 0.015000 6 -0.2596 -0.2596 - 0.015000 7 -0.3044 -0.3044 - 0.015000 8 0.2036 0.2036 - 0.015000 9 0.3216 0.3216 - 0.015000 10 -0.2752 -0.2752 - 0.015000 11 0.0411 0.0411 - 0.015000 12 0.3142 0.3142 - 0.015000 13 0.1924 0.1924 - 0.015000 14 -0.0163 -0.0163 - 0.015000 15 -0.2939 -0.2939 - 0.015000 16 0.1585 0.1585 - 0.015000 17 -0.2068 -0.2068 - 0.015000 18 -0.3090 -0.3090 - 0.015000 19 -0.2674 -0.2674 - 0.015000 20 -0.0777 -0.0777 - 0.015000 21 0.2317 0.2317 - 0.015000 22 -0.2560 -0.2560 - 0.015000 23 -0.1327 -0.1327 - 0.015000 24 0.2310 0.2310 - 0.015000 25 0.1252 0.1252 - 0.015000 26 -0.0350 -0.0350 - 0.015000 27 -0.1689 -0.1689 - 0.015000 28 0.1363 0.1363 - 0.015000 29 0.1099 0.1099 - 0.015000 30 1.3937 1.3937 - 0.015000 31 -0.0040 -0.0040 - 0.015000 32 -0.0365 -0.0365 - 0.015000 33 -0.0040 -0.0040 - 0.015000 34 0.8269 0.8269 - 0.015000 35 -0.0103 -0.0103 - 0.015000 36 -0.0365 -0.0365 - 0.015000 37 -0.0103 -0.0103 - 0.015000 38 2.3510 2.3510 - 0.020000 0 0.2666 0.2666 - 0.020000 1 0.1869 0.1869 - 0.020000 2 0.0703 0.0703 - 0.020000 3 -0.3255 -0.3255 - 0.020000 4 0.2692 0.2692 - 0.020000 5 0.0102 0.0102 - 0.020000 6 -0.2645 -0.2645 - 0.020000 7 -0.2835 -0.2835 - 0.020000 8 0.2141 0.2141 - 0.020000 9 0.3166 0.3166 - 0.020000 10 -0.2635 -0.2635 - 0.020000 11 0.0653 0.0653 - 0.020000 12 0.3024 0.3024 - 0.020000 13 0.1976 0.1976 - 0.020000 14 -0.0355 -0.0355 - 0.020000 15 -0.2931 -0.2931 - 0.020000 16 0.1405 0.1405 - 0.020000 17 -0.2155 -0.2155 - 0.020000 18 -0.2977 -0.2977 - 0.020000 19 -0.2589 -0.2589 - 0.020000 20 -0.0579 -0.0579 - 0.020000 21 0.2223 0.2223 - 0.020000 22 -0.2595 -0.2595 - 0.020000 23 -0.1251 -0.1251 - 0.020000 24 0.2263 0.2263 - 0.020000 25 0.1348 0.1348 - 0.020000 26 -0.0242 -0.0242 - 0.020000 27 -0.1535 -0.1535 - 0.020000 28 0.1365 0.1365 - 0.020000 29 0.0982 0.0982 - 0.020000 30 1.3942 1.3942 - 0.020000 31 0.0116 0.0116 - 0.020000 32 -0.0319 -0.0319 - 0.020000 33 0.0116 0.0116 - 0.020000 34 0.8066 0.8066 - 0.020000 35 -0.0388 -0.0388 - 0.020000 36 -0.0319 -0.0319 - 0.020000 37 -0.0388 -0.0388 - 0.020000 38 2.2840 2.2840 + 0.000000 0 0.2576 0.2576 + 0.000000 1 0.1784 0.1784 + 0.000000 2 0.1148 0.1148 + 0.000000 3 -0.2848 -0.2848 + 0.000000 4 0.2573 0.2573 + 0.000000 5 0.0311 0.0311 + 0.000000 6 -0.1602 -0.1602 + 0.000000 7 -0.2576 -0.2576 + 0.000000 8 0.1443 0.1443 + 0.000000 9 0.2195 0.2195 + 0.000000 10 -0.2827 -0.2827 + 0.000000 11 0.0801 0.0801 + 0.000000 12 0.2542 0.2542 + 0.000000 13 0.2204 0.2204 + 0.000000 14 -0.0389 -0.0389 + 0.000000 15 -0.2562 -0.2562 + 0.000000 16 0.1441 0.1441 + 0.000000 17 -0.1263 -0.1263 + 0.000000 18 -0.2496 -0.2496 + 0.000000 19 -0.2380 -0.2380 + 0.000000 20 -0.0968 -0.0968 + 0.000000 21 0.1800 0.1800 + 0.000000 22 -0.2248 -0.2248 + 0.000000 23 -0.1502 -0.1502 + 0.000000 24 0.2051 0.2051 + 0.000000 25 0.0951 0.0951 + 0.000000 26 -0.0616 -0.0616 + 0.000000 27 -0.1656 -0.1656 + 0.000000 28 0.1078 0.1078 + 0.000000 29 0.1035 0.1035 + 0.000000 30 0.9771 0.9771 + 0.000000 31 -0.0025 -0.0025 + 0.000000 32 -0.0434 -0.0434 + 0.000000 33 -0.0025 -0.0025 + 0.000000 34 0.8416 0.8416 + 0.000000 35 0.0170 0.0170 + 0.000000 36 -0.0434 -0.0434 + 0.000000 37 0.0170 0.0170 + 0.000000 38 2.5110 2.5110 + 0.005000 0 0.2556 0.2556 + 0.005000 1 0.1841 0.1841 + 0.005000 2 0.1225 0.1225 + 0.005000 3 -0.3096 -0.3096 + 0.005000 4 0.2536 0.2536 + 0.005000 5 0.0116 0.0116 + 0.005000 6 -0.1518 -0.1518 + 0.005000 7 -0.2632 -0.2632 + 0.005000 8 0.1297 0.1297 + 0.005000 9 0.2044 0.2044 + 0.005000 10 -0.2823 -0.2823 + 0.005000 11 0.0947 0.0947 + 0.005000 12 0.2620 0.2620 + 0.005000 13 0.1952 0.1952 + 0.005000 14 -0.0426 -0.0426 + 0.005000 15 -0.2497 -0.2497 + 0.005000 16 0.1184 0.1184 + 0.005000 17 -0.1320 -0.1320 + 0.005000 18 -0.2566 -0.2566 + 0.005000 19 -0.2169 -0.2169 + 0.005000 20 -0.1139 -0.1139 + 0.005000 21 0.1797 0.1797 + 0.005000 22 -0.1888 -0.1888 + 0.005000 23 -0.1530 -0.1530 + 0.005000 24 0.2132 0.2132 + 0.005000 25 0.0817 0.0817 + 0.005000 26 -0.0227 -0.0227 + 0.005000 27 -0.1472 -0.1472 + 0.005000 28 0.1180 0.1180 + 0.005000 29 0.1056 0.1056 + 0.005000 30 1.0253 1.0253 + 0.005000 31 0.0065 0.0065 + 0.005000 32 0.0105 0.0105 + 0.005000 33 0.0065 0.0065 + 0.005000 34 0.7862 0.7862 + 0.005000 35 0.0302 0.0302 + 0.005000 36 0.0105 0.0105 + 0.005000 37 0.0302 0.0302 + 0.005000 38 2.4682 2.4682 + 0.010000 0 0.2377 0.2377 + 0.010000 1 0.1684 0.1684 + 0.010000 2 0.1429 0.1429 + 0.010000 3 -0.3273 -0.3273 + 0.010000 4 0.2339 0.2339 + 0.010000 5 0.0073 0.0073 + 0.010000 6 -0.1809 -0.1809 + 0.010000 7 -0.2617 -0.2617 + 0.010000 8 0.1499 0.1499 + 0.010000 9 0.2401 0.2401 + 0.010000 10 -0.2325 -0.2325 + 0.010000 11 0.0678 0.0678 + 0.010000 12 0.2520 0.2520 + 0.010000 13 0.1286 0.1286 + 0.010000 14 -0.0378 -0.0378 + 0.010000 15 -0.2463 -0.2463 + 0.010000 16 0.0987 0.0987 + 0.010000 17 -0.1384 -0.1384 + 0.010000 18 -0.2558 -0.2558 + 0.010000 19 -0.1817 -0.1817 + 0.010000 20 -0.1166 -0.1166 + 0.010000 21 0.1873 0.1873 + 0.010000 22 -0.1756 -0.1756 + 0.010000 23 -0.1491 -0.1491 + 0.010000 24 0.2139 0.2139 + 0.010000 25 0.0968 0.0968 + 0.010000 26 -0.0203 -0.0203 + 0.010000 27 -0.1205 -0.1205 + 0.010000 28 0.1250 0.1250 + 0.010000 29 0.0945 0.0945 + 0.010000 30 1.1005 1.1005 + 0.010000 31 -0.0026 -0.0026 + 0.010000 32 0.0195 0.0195 + 0.010000 33 -0.0026 -0.0026 + 0.010000 34 0.6764 0.6764 + 0.010000 35 0.0390 0.0390 + 0.010000 36 0.0195 0.0195 + 0.010000 37 0.0390 0.0390 + 0.010000 38 2.4056 2.4056 + 0.015000 0 0.2201 0.2201 + 0.015000 1 0.1468 0.1468 + 0.015000 2 0.1232 0.1232 + 0.015000 3 -0.3255 -0.3255 + 0.015000 4 0.1931 0.1931 + 0.015000 5 -0.0015 -0.0015 + 0.015000 6 -0.2162 -0.2162 + 0.015000 7 -0.2551 -0.2551 + 0.015000 8 0.1767 0.1767 + 0.015000 9 0.2721 0.2721 + 0.015000 10 -0.1773 -0.1773 + 0.015000 11 0.0444 0.0444 + 0.015000 12 0.2404 0.2404 + 0.015000 13 0.0659 0.0659 + 0.015000 14 -0.0348 -0.0348 + 0.015000 15 -0.2492 -0.2492 + 0.015000 16 0.0911 0.0911 + 0.015000 17 -0.1519 -0.1519 + 0.015000 18 -0.2516 -0.2516 + 0.015000 19 -0.1356 -0.1356 + 0.015000 20 -0.0847 -0.0847 + 0.015000 21 0.1922 0.1922 + 0.015000 22 -0.1733 -0.1733 + 0.015000 23 -0.1152 -0.1152 + 0.015000 24 0.2141 0.2141 + 0.015000 25 0.1112 0.1112 + 0.015000 26 -0.0339 -0.0339 + 0.015000 27 -0.0963 -0.0963 + 0.015000 28 0.1333 0.1333 + 0.015000 29 0.0776 0.0776 + 0.015000 30 1.1799 1.1799 + 0.015000 31 -0.0010 -0.0010 + 0.015000 32 -0.0029 -0.0029 + 0.015000 33 -0.0010 -0.0010 + 0.015000 34 0.5770 0.5770 + 0.015000 35 -0.0037 -0.0037 + 0.015000 36 -0.0029 -0.0029 + 0.015000 37 -0.0037 -0.0037 + 0.015000 38 2.2992 2.2992 + 0.020000 0 0.2204 0.2204 + 0.020000 1 0.1243 0.1243 + 0.020000 2 0.0996 0.0996 + 0.020000 3 -0.3153 -0.3153 + 0.020000 4 0.1757 0.1757 + 0.020000 5 -0.0146 -0.0146 + 0.020000 6 -0.2366 -0.2366 + 0.020000 7 -0.2451 -0.2451 + 0.020000 8 0.1915 0.1915 + 0.020000 9 0.2832 0.2832 + 0.020000 10 -0.1666 -0.1666 + 0.020000 11 0.0758 0.0758 + 0.020000 12 0.2393 0.2393 + 0.020000 13 0.0789 0.0789 + 0.020000 14 -0.0617 -0.0617 + 0.020000 15 -0.2540 -0.2540 + 0.020000 16 0.0820 0.0820 + 0.020000 17 -0.1645 -0.1645 + 0.020000 18 -0.2546 -0.2546 + 0.020000 19 -0.1308 -0.1308 + 0.020000 20 -0.0623 -0.0623 + 0.020000 21 0.1886 0.1886 + 0.020000 22 -0.1836 -0.1836 + 0.020000 23 -0.1014 -0.1014 + 0.020000 24 0.2077 0.2077 + 0.020000 25 0.1270 0.1270 + 0.020000 26 -0.0371 -0.0371 + 0.020000 27 -0.0787 -0.0787 + 0.020000 28 0.1383 0.1383 + 0.020000 29 0.0747 0.0747 + 0.020000 30 1.2233 1.2233 + 0.020000 31 0.0214 0.0214 + 0.020000 32 -0.0092 -0.0092 + 0.020000 33 0.0214 0.0214 + 0.020000 34 0.5735 0.5735 + 0.020000 35 -0.0503 -0.0503 + 0.020000 36 -0.0092 -0.0092 + 0.020000 37 -0.0503 -0.0503 + 0.020000 38 2.2551 2.2551 diff --git a/regtest/multicolvar/rt-coordination-powers/plumed.dat b/regtest/multicolvar/rt-coordination-powers/plumed.dat index ec3e4821ca5de2b98285b66e9ea0dad56959f3c9..74f3664294456c84bafa9c9fff4c13cba25a89f8 100644 --- a/regtest/multicolvar/rt-coordination-powers/plumed.dat +++ b/regtest/multicolvar/rt-coordination-powers/plumed.dat @@ -1,3 +1,3 @@ -COORDINATIONNUMBER SPECIES=1-10 R_0=1 R_POWER=2 LABEL=c1 MEAN -COORDINATIONNUMBER SPECIES=1-10 R_0=1 NUMERICAL_DERIVATIVES R_POWER=2 LABEL=c1num MEAN +COORDINATIONNUMBER SPECIES=1-10 R_0=1 R_POWER=3 LABEL=c1 MEAN +COORDINATIONNUMBER SPECIES=1-10 R_0=1 NUMERICAL_DERIVATIVES R_POWER=3 LABEL=c1num MEAN DUMPDERIVATIVES ARG=c1.*,c1num.* STRIDE=1 FILE=derivatives FMT=%8.4f diff --git a/src/multicolvar/CoordinationNumbers.cpp b/src/multicolvar/CoordinationNumbers.cpp index abbf9e6f2c5a2328d080705ffe97b7171b131b0f..973ecb497c71c8630f2c87d72a38ddb62a5e6502 100644 --- a/src/multicolvar/CoordinationNumbers.cpp +++ b/src/multicolvar/CoordinationNumbers.cpp @@ -170,8 +170,8 @@ double CoordinationNumbers::compute( const unsigned& tindex, AtomValuePack& myat if(r_power > 0) { d = sqrt(d2); raised = pow( d, r_power - 1 ); accumulateSymmetryFunction( 1, i, sw * raised * d, - (dfunc * d * raised + sw * r_power) * distance, - (-dfunc * d * raised - sw * r_power) * Tensor(distance, distance), + (dfunc * d * raised + sw * r_power * raised / d) * distance, + (-dfunc * d * raised - sw * r_power * raised / d) * Tensor(distance, distance), myatoms ); } else { accumulateSymmetryFunction( 1, i, sw, (dfunc)*distance, (-dfunc)*Tensor(distance,distance), myatoms );