Commit 8a1543b
GIST Entropy improvements (#947)
* Speed up six-dimensional entropy calculation in GIST
In GIST, the six-dimensional entropy calculation requires the
translational and orientational distance to the nearest neighbor (NN).
However, if the translational distance is larger than the 6D distance to
the current NN, the orientational distance can be skipped safely. This
is a significant speedup (about 2x in my test), since the orientational
distance contains an arccos.
* Increase cpptraj revision to 6.2.2
* Implement exact volume equations for GIST nearest-neighbor entropy.
The nearest-neighbor density is approximated by finding the distance to
the nearest neighbor of each point, computing a sphere volume from this
distance, and comparing this to the volume that is expected from a
homogeneous density. In GIST, the sphere volume in rotational space and
the combined translation+rotation space was approximated by a Taylor
expansion. This patch implements the exact volume in rotational space
analytically, and uses a tabulated correction factor for distances up to
10 Angstrom to correct the 6-D volume.
The result is a better convergence of the bulk entropy, at the cost of
about 3.4% calculation time (Action Post) in my test (a pure water box
containg 3333 water molecules, using 10000 frames). The bulk entropy
(should be zero) is reduced from 2.3e-4 to 5e-5 kcal/mol/A^3 for dTSsix
and from 7.7e-4 to 2.3e-4 for dTSorient. The individual voxel values are
almost perfectly correlated to the old results (R^2=0.99996).
* Implement generalized nearest neighbor (NN) search.
In the old algorithm, neighbors were searched in the respective voxel
and in all of its direct neighbors. The new algorithm lets the user
choose how many layers of neighboring voxels should be search. The
default is 1, which corresponds to the old behavior.
There is a tiny difference in how distances of 0 are treated. In the old
code, they were omitted. In the new code, there is a constant
(GIST_TINY) which is used if the resulting distance is 0. This leads to
numerically different values in about 0.01% of the voxels.
* Bump version (revision) number to 6.2.3.
* Update cpptrajdepend (make depend) after GIST entropy changes
* Remove declaration of unused TransEntropy function
* Fix command line parsing in GIST
In the GIST input, the gridcntr and griddim arguments were previously
parsed as positional arguments (but if the keyword was present), rather
than being parsed behind the keyword. I.e.,
gist 0.6 1.0 1.6 50 gridcntr griddim 60 70 gridspacn 0.5 out gist.dat refdens 0.0329
was valid, while
gist griddim 50 60 70 gridspacn 0.5 out gist.dat refdens 0.0329 gridcntr 0.6 1.0 1.6
was invalid (because the center values had to go first)
This commit changes the parsing to the expected bevavior, i.e., the first
example is now invalid and the second is valid.
* In GIST, omit entropy for waters if no nearest neighbor is found.
Changes:
* after the nearest neighbor (NN) search, introduces a check whether the
distance is smaller than sqrt(GIST_HUGE) (i.e., a NN has been found). If
not, this distance is omitted from the entropy calculation.
* fix a bug where some non-border voxels were omitted instead of voxels
on the border. (GIST voxels on the border of the grid are supposed to
obtain 0 entropy)
* don't look for nearest neighbors if we are on the border.
Explanation:
In GIST, the entropy is calculated per water molecule based on the
NN distance, and binned to a grid. With the recent change of the entropy
calculation, I removed some checks that:
* omit the entropy of waters if no NN distance is found. Instead, a high
value (sqrt(GIST_HUGE)) is assigned to the distance.
* omit the NN if the distance to it is numerically close to zero.
Instead, a small value (GIST_TINY) is then assigned to the distance.
The second first behavior is reasonable (omitting the NN means
that an arbitrary higher distance is chosen, and GIST_TINY is probably
smaller than that arbitrary distance, i.e., closer to the real one.
However, the first one is not so reasonable, because sqrt(GIST_HUGE) is
probably far off from the real NN distance. Therefore, I re-introduce
the old behavior in this case.
This is very relevant for the results of the cpptraj tests, since they
use very few frames, leading to many cases of high NN distances.
* Update GIST tests to new entropy calculation
* This adds 2 tests for the new flags oldnnvolume and nnsearchlayers.
The .save files for oldnnvolume (Gist6) are just renamed from the
previous Gist2 test. The other test .save files are changed to match
the new entropy results.
* Increase cpptraj version to 6.3.0
* GIST code cleanup and command line checking
* Move GistEntropyUtils functions into a GistEntropyUtils namespace
* make GIST_HUGE a const double (instead of a macro)
* add validDouble and validInteger checks for griddim and gridcntr
arguments.
Co-authored-by: Daniel R. Roe <[email protected]>1 parent 87b7175 commit 8a1543b
File tree
25 files changed
+255034
-2215
lines changed- src
- test/Test_GIST
- unitTests
- GistEntropyUtils
25 files changed
+255034
-2215
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
| |||
192 | 191 | | |
193 | 192 | | |
194 | 193 | | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
200 | 201 | | |
201 | 202 | | |
0 commit comments