... | @@ -31,13 +31,12 @@ These values always follow: |
... | @@ -31,13 +31,12 @@ These values always follow: |
|
- `cut_bothsq = MIN(cut_ljsq, cut_coulsq)`
|
|
- `cut_bothsq = MIN(cut_ljsq, cut_coulsq)`
|
|
|
|
|
|
In the code, `rsq` represents the distance between atoms `i,j`. It is saved in squared form to avoid computing an expensive `sqrt`.
|
|
In the code, `rsq` represents the distance between atoms `i,j`. It is saved in squared form to avoid computing an expensive `sqrt`.
|
|
- If `rsq` is larger than `cut_bothsq`, then, no computation is required because there is no short-range interaction between the two atoms. In that case, the inner loop iteration stops here (*do nothing*).
|
|
- If `rsq` is larger than `cut_bothsq`, then, no computation is required because there is no short-range interaction between the two atoms. In that case, the inner loop iteration stops here (**do nothing**).
|
|
- If `rsq` is smaller than `tabinnersq`, then `forcecoul` is computed using a *fast* table method. If not, it is computed using a *slow* method with calls to `sqrt` and `exp` functions.
|
|
- If `rsq` is smaller than `tabinnersq`, then `forcecoul` is computed using a **fast** table method. If not, it is computed using a **slow** method with calls to `sqrt` and `exp` functions.
|
|
- If `rsq` is bigger than `cut_lj_innersq`, then `forcelj` needs a few additional computations.
|
|
- If `rsq` is bigger than `cut_lj_innersq`, then `forcelj` needs a few additional computations. This is not significant enough to be considered a code path.
|
|
|
|
|
|
The following flowchart shows the different cases based on `rsq`.
|
|
The following flowchart shows in yellow the different cases based on `rsq` (distance).
|
|
The condition on `forcelj`is not shown in order to focus on the `tabinnersq` condition.
|
|
|
|
|
|
|
|

|
|

|
|
|
|
|
|
At the end of the function, the computed `forcelj` and `forcecoul` values are used to update the `f` (force) values for both atoms `i` and `j`. |
|
At the end of the function, the computed `forcelj` and `forcecoul` are used to update the `f` (force) values for both atoms `i` and `j`. |
|
\ No newline at end of file |
|
\ No newline at end of file |