Skip to content
Permalink
Browse files

core: non_bonded: Fixed asserts

  • Loading branch information...
fweik committed Aug 12, 2019
1 parent 4061149 commit de7bfe85e38447ffbf8f30c8c3234d2cf76d36dd
@@ -335,13 +335,11 @@ extern double min_global_cut;
* @return Pointer to interaction parameters for the type pair.
* */
inline IA_parameters *get_ia_param(int i, int j) {
assert(i > 0 && i < max_seen_particle_type);
assert(j > 0 && j < max_seen_particle_type);
assert((max_seen_particle_type * (max_seen_particle_type + 1)) / 2 <
ia_params.size());
assert(i >= 0 && i <= max_seen_particle_type);
assert(j >= 0 && j <= max_seen_particle_type);

return &ia_params[Utils::upper_triangular(std::min(i, j), std::max(i, j),
max_seen_particle_type)];
max_seen_particle_type + 1)];
}

/** Get interaction parameters between particle sorts i and j.
@@ -108,6 +108,8 @@ get_linear_index(const Vector3i &ind, const Vector3i &adim,
* @return linear index
*/
template <class T> T upper_triangular(T i, T j, T n) {
/* n is a valid size */
assert(n >= 0);
/* i is a valid row index */
assert((i >= 0) && (i < n));
/* j is in the upper triangle */

0 comments on commit de7bfe8

Please sign in to comment.
You can’t perform that action at this time.