Skip to content

Main content

Computational Physics: Lattice Periodic Neighbor Tool

Resolve one explicit integer lattice displacement under periodic or rejecting boundary rules, retaining whether the unwrapped neighbor was inside.

Loading tool…

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

  1. Enter coordinate, shape, displacement, boundary. Keep parallel arrays aligned. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. 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 fieldMeaning and unitsAccepted input
coordinateCoordinateRequired. Array of finite number. Implementation limit: 128 items.
shapeShapeRequired. Array of finite number. Implementation limit: 128 items.
displacementDisplacementRequired. Array of finite number. Implementation limit: 128 items.
boundaryBoundaryRequired. Text; one of "periodic", "reject". Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
Output fieldInterpretationReturned shape
resultReturned calculated value or nested object under the stated output convention.Required. Object.
result.neighborWrapped coordinate for periodic; raw displaced coordinate for reject, even when valid=false.Calculated result member: array.
result.insideWhether the raw displaced coordinate is in bounds before periodic wrapping.Calculated result member: boolean.
result.validTrue for periodic handling; for reject handling equals raw in-bounds status.Calculated result member: boolean.
json
{
  "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

  1. Calculation and input contract: computational-physics/lattice-periodic-neighbor — tool.io

Similar or alternative tools