class_docstr: Unit tests for the ``rydberg_interaction`` function.
docstr: Test that specifying a maximum distance affects the number of elements in the interaction term
  as expected.
docstr_tok: ["Test","that","specifying","a","maximum","distance","affects","the","number","of","elements","in","the","interaction","term","as","expected","."]
code: def test_max_distance(self):
      """Test that specifying a maximum distance affects the number of elements in the interaction term
      as expected."""
      # This threshold will remove interactions between atoms more than 5 micrometers away from each other
      max_distance = 5
      coords = [[0, 0], [2.5, 0], [5, 0], [6, 6]]
      h_wires = [1, 0, 2, 3]
  
      # Set interaction_coeff to one for easier comparison
      # factor (2 * np.pi) to convert between angular and standard frequency
      H_res = rydberg_interaction(
          register=coords,
          wires=h_wires,
          interaction_coeff=1 / (2 * np.pi),
          max_distance=max_distance,
      )
      H_exp = rydberg_interaction(
          register=coords[:3],
          wires=h_wires[:3],
          interaction_coeff=1 / (2 * np.pi),
      )
  
      # Only 3 of the interactions will be non-negligible
      assert H_res.coeffs == [2.5**-6, 5**-6, 2.5**-6]
      assert qml.equal(H_res([], t=5), H_exp([], t=5))
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane.pulse import rydberg_interaction, rydberg_drive
  from pennylane.pulse.hardware_hamiltonian import HardwareHamiltonian, HardwarePulse, AmplitudeAndPhase
  from pennylane.wires import Wires
  from pennylane.pulse.rydberg import RydbergSettings
label_desc: Use image node_id 6 for calling the TestRydbergInteraction obj's underlying member method code with example usage: obj.test_max_distance() without return types