-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add NonbondedInteractionGroup potential, rename existing nonbonded po…
…tentials (#578)
- Loading branch information
Showing
16 changed files
with
1,369 additions
and
138 deletions.
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.