-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add NonbondedInteractionGroup potential, rename existing nonbonded potentials #578
Merged
Merged
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
fe0fe9b
Rename NonbondedDense -> NonbondedAllPairs
mcwitt 5848e88
Rename NonbondedPairs -> NonbondedPairList
mcwitt 5bf391e
Copy NonbondedInteractionGroup from NonbondedAllPairs
mcwitt b915a4e
Update interface
mcwitt 3b93f01
Copy indices to device
mcwitt 0c06115
Add wrapper for NonbondedInteractionGroup
mcwitt 6774f28
Add test for raising on invalid indices
mcwitt 71c96e3
Check for empty index set
mcwitt 980185e
Add basic correctness test
mcwitt 945e62a
Implement potential
mcwitt b532e89
Skip kernel invocation if there are no interactions
mcwitt 0f24785
Add offset to row atom indices in case NR != 0
mcwitt ecf76d8
Avoid "test_" prefix in fixtures
mcwitt fcd4199
Test with random non-contiguous row atom indices
mcwitt 4f4bc51
Remove obsolete comments
mcwitt 6185c4b
Define N as const
mcwitt efa4828
Move input validation to top
mcwitt 3b3ea55
Remove guard
mcwitt d0f154a
Add test for case with zero interactions
mcwitt 3eb51ce
Fix typo
mcwitt 0cd9168
Return early if neighborlist is empty
mcwitt 05b1b35
Attempt to clarify condition
mcwitt 43fd522
Move stray comment, stream synchronization
mcwitt 653fe4d
Remove print statements, make errors more informative
mcwitt a70a330
Add comments for clarity, remove extra placeholders
mcwitt 690a57c
Remove obsolete comment
mcwitt 1097ca4
Remove obsolete comment
mcwitt d728988
Add description to test
mcwitt eb07db3
Add test comparing with nonbonded_v3_on_specific_pairs
mcwitt 3e36b51
Improve accuracy of comments
mcwitt 2dfb18d
Rename test to something less confusing, add type annotation
mcwitt 39907d6
Account for difference with zero LJ parameters in test
mcwitt 561ce2f
Move jax reference potential out of test
mcwitt dd543ea
Test with multiple lambda values
mcwitt 25fd4f6
Move cudaStreamSynchronize after cudaMemcpyAsync
mcwitt 860dc9d
Update reference to only compute vdW force when eps_ij != 0
mcwitt b7ebc26
Rename coords -> conf
mcwitt 89ee22f
Reorder tests
mcwitt a6486c1
Add consistency test applying constant shift to one group
mcwitt 6163d3c
Rename row/col -> ligand/host in test
mcwitt 824342d
Clean up docstrings
mcwitt a986a34
Adjust test tolerances
mcwitt 91d1722
Replace itertools product with meshgrid
mcwitt efb100d
Remove unused import
mcwitt 90d0cd5
Remove obsolete comment
mcwitt 695f2c1
Remove no-op checks
mcwitt 6c5598b
Use nonzero offset indices in consistency checks
mcwitt dbf4fbe
Use nonzero planes, offsets in correctness test
mcwitt 6d199ca
Expose interpolated potential to Python API, add test
mcwitt 22f9dc9
Remove unused import
mcwitt cdd37ff
Pass tuples to silence type warnings
mcwitt 6d3ce6c
Merge branch 'master' into nonbonded-interaction-groups
mcwitt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#include "k_nonbonded.cuh" | ||
|
||
void __global__ k_coords_to_kv( | ||
const int N, | ||
const double *coords, | ||
const double *box, | ||
const unsigned int *bin_to_idx, | ||
unsigned int *keys, | ||
unsigned int *vals) { | ||
|
||
const int atom_idx = blockIdx.x * blockDim.x + threadIdx.x; | ||
|
||
if (atom_idx >= N) { | ||
return; | ||
} | ||
|
||
// these coords have to be centered | ||
double bx = box[0 * 3 + 0]; | ||
double by = box[1 * 3 + 1]; | ||
double bz = box[2 * 3 + 2]; | ||
|
||
double binWidth = max(max(bx, by), bz) / 255.0; | ||
|
||
double x = coords[atom_idx * 3 + 0]; | ||
double y = coords[atom_idx * 3 + 1]; | ||
double z = coords[atom_idx * 3 + 2]; | ||
|
||
x -= bx * floor(x / bx); | ||
y -= by * floor(y / by); | ||
z -= bz * floor(z / bz); | ||
|
||
unsigned int bin_x = x / binWidth; | ||
unsigned int bin_y = y / binWidth; | ||
unsigned int bin_z = z / binWidth; | ||
|
||
keys[atom_idx] = bin_to_idx[bin_x * 256 * 256 + bin_y * 256 + bin_z]; | ||
// uncomment below if you want to preserve the atom ordering | ||
// keys[atom_idx] = atom_idx; | ||
vals[atom_idx] = atom_idx; | ||
} | ||
|
||
// TODO: DRY with k_coords_to_kv | ||
void __global__ k_coords_to_kv_gather( | ||
const int N, | ||
const unsigned int *atom_idxs, | ||
const double *coords, | ||
const double *box, | ||
const unsigned int *bin_to_idx, | ||
unsigned int *keys, | ||
unsigned int *vals) { | ||
|
||
const int idx = blockIdx.x * blockDim.x + threadIdx.x; | ||
|
||
if (idx >= N) { | ||
return; | ||
} | ||
|
||
const int atom_idx = atom_idxs[idx]; | ||
|
||
// these coords have to be centered | ||
double bx = box[0 * 3 + 0]; | ||
double by = box[1 * 3 + 1]; | ||
double bz = box[2 * 3 + 2]; | ||
|
||
double binWidth = max(max(bx, by), bz) / 255.0; | ||
|
||
double x = coords[atom_idx * 3 + 0]; | ||
double y = coords[atom_idx * 3 + 1]; | ||
double z = coords[atom_idx * 3 + 2]; | ||
|
||
x -= bx * floor(x / bx); | ||
y -= by * floor(y / by); | ||
z -= bz * floor(z / bz); | ||
|
||
unsigned int bin_x = x / binWidth; | ||
unsigned int bin_y = y / binWidth; | ||
unsigned int bin_z = z / binWidth; | ||
|
||
keys[idx] = bin_to_idx[bin_x * 256 * 256 + bin_y * 256 + bin_z]; | ||
// uncomment below if you want to preserve the atom ordering | ||
// keys[idx] = atom_idx; | ||
vals[idx] = atom_idx; | ||
} | ||
|
||
void __global__ k_arange(int N, unsigned int *arr) { | ||
const int atom_idx = blockIdx.x * blockDim.x + threadIdx.x; | ||
if (atom_idx >= N) { | ||
return; | ||
} | ||
arr[atom_idx] = atom_idx; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
definitely DRY for this one (do this in a later PR is fine), I think you can simply implement the old version with
atom_idxs = np.arange(N)