Description
Return a displaced lattice coordinate with explicit boundary handling.
Numerical grids and sampled modes require explicit coordinate, boundary and sign conventions. A staggered location, minimum-image gap or Nyquist label is one component of a discretization rather than a complete field solve or unique physical interpretation.
Return a displaced lattice coordinate with explicit boundary handling.
When to use this tool
Use Computational Physics: Lattice Periodic Neighbor when checking the stated grid-coordinate, periodic-image or sampled-mode convention.
How to use the tool and how it works
- Enter coordinate, shape, displacement, boundary. Keep parallel arrays aligned. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read result. Expand result to inspect the returned fields.
Return a displaced lattice coordinate with explicit boundary handling. Require aligned nonempty integer coordinate/shape/displacement arrays, positive bounded shape and initially in-bounds coordinates; periodic wraps each axis, reject leaves the displaced vector unchanged.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| coordinate | Coordinate | Required. Array of finite number. Implementation limit: 128 items. |
| shape | Shape | Required. Array of finite number. Implementation limit: 128 items. |
| displacement | Displacement | Required. Array of finite number. Implementation limit: 128 items. |
| boundary | Boundary | Required. Text; one of "periodic", "reject". Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Returned calculated value or nested object under the stated output convention. | Required. Object. |
| result.neighbor | Wrapped coordinate for periodic; raw displaced coordinate for reject, even when valid=false. | Calculated result member: array. |
| result.inside | Whether the raw displaced coordinate is in bounds before periodic wrapping. | Calculated result member: boolean. |
| result.valid | True for periodic handling; for reject handling equals raw in-bounds status. | Calculated result member: boolean. |
{
"input": {
"coordinate": [
0,
1
],
"shape": [
3,
4
],
"displacement": [
-1,
0
],
"boundary": "periodic"
},
"output": {
"result": {
"neighbor": [
2,
1
],
"inside": false,
"valid": true
}
}
} Limitations and assumptions
- inside describes the unwrapped vector, while valid is always true for periodic handling; reject returns an out-of-bounds vector with valid false rather than throwing.
- Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use the complete mesh, transform convention and boundary conditions for a consistent numerical simulation or physical interpretation.
References
Similar or alternative tools
- Periodic Boundary Two Image Distance
Return minimum-image signed displacement and distance.
- Periodic Image Half Cell Tie Token
Return nearest periodic displacement with an explicit half-cell tie.