original_docstring: Build neighbor graph from points, optionally with PBC.
  
          Args:
              pos (np.ndarray/torch.Tensor shape [N, 3]): node positions. If Tensor, must be on the CPU.
              r_max (float): neighbor cutoff radius.
              cell (ase.Cell/ndarray [3,3], optional): periodic cell for the points. Defaults to ``None``.
              pbc (bool or 3-tuple of bool, optional): whether to apply periodic boundary conditions to all or each of
              the three cell vector directions. Defaults to ``False``.
              self_interaction (bool, optional): whether to include self edges for points. Defaults to ``False``. Note
              that edges between the same atom in different periodic images are still included. (See
              ``strict_self_interaction`` to control this behaviour.)
              strict_self_interaction (bool): Whether to include *any* self interaction edges in the graph, even if the
              two instances of the atom are in different periodic images. Defaults to True, should be True for most
              applications.
              **kwargs (optional): other fields to add. Keys listed in ``AtomicDataDict.*_KEY` will be treated specially.
          
docstring: Build neighbor graph from points, optionally with PBC.
docstring_tokens: Build neighbor graph from points optionally with PBC .
code: def from_points(
          cls,
          pos=None,
          r_max: float = None,
          self_interaction: bool = False,
          strict_self_interaction: bool = True,
          cell=None,
          pbc: Optional[PBC] = None,
          **kwargs,
      ):
          """Build neighbor graph from points, optionally with PBC.
  
          Args:
              pos (np.ndarray/torch.Tensor shape [N, 3]): node positions. If Tensor, must be on the CPU.
              r_max (float): neighbor cutoff radius.
              cell (ase.Cell/ndarray [3,3], optional): periodic cell for the points. Defaults to ``None``.
              pbc (bool or 3-tuple of bool, optional): whether to apply periodic boundary conditions to all or each of
              the three cell vector directions. Defaults to ``False``.
              self_interaction (bool, optional): whether to include self edges for points. Defaults to ``False``. Note
              that edges between the same atom in different periodic images are still included. (See
              ``strict_self_interaction`` to control this behaviour.)
              strict_self_interaction (bool): Whether to include *any* self interaction edges in the graph, even if the
              two instances of the atom are in different periodic images. Defaults to True, should be True for most
              applications.
              **kwargs (optional): other fields to add. Keys listed in ``AtomicDataDict.*_KEY` will be treated specially.
          """
          if pos is None or r_max is None:
              raise ValueError("pos and r_max must be given.")
  
          if pbc is None:
              if cell is not None:
                  raise ValueError(
                      "A cell was provided, but pbc weren't. Please explicitly probide PBC."
                  )
              # there are no PBC if cell and pbc are not provided
              pbc = False
  
          if isinstance(pbc, bool):
              pbc = (pbc,) * 3
          else:
              assert len(pbc) == 3
  
          pos = torch.as_tensor(pos, dtype=torch.get_default_dtype())
  
          edge_index, edge_cell_shift, cell = neighbor_list_and_relative_vec(
              pos=pos,
              r_max=r_max,
              self_interaction=self_interaction,
              strict_self_interaction=strict_self_interaction,
              cell=cell,
              pbc=pbc,
          )
  
          # Make torch tensors for data:
          if cell is not None:
              kwargs[AtomicDataDict.CELL_KEY] = cell.view(3, 3)
              kwargs[AtomicDataDict.EDGE_CELL_SHIFT_KEY] = edge_cell_shift
          if pbc is not None:
              kwargs[AtomicDataDict.PBC_KEY] = torch.as_tensor(
                  pbc, dtype=torch.bool
              ).view(3)
  
          return cls(edge_index=edge_index, pos=torch.as_tensor(pos), **kwargs)
code_tokens: def from_points ( cls , pos = None , r_max : float = None , self_interaction : bool = False , strict_self_interaction : bool = True , cell = None , pbc : Optional [ PBC ] = None , ** kwargs , ) : if pos is None or r_max is None : raise ValueError ( "pos and r_max must be given." ) if pbc is None : if cell is not None : raise ValueError ( "A cell was provided, but pbc weren't. Please explicitly probide PBC." ) pbc = False if isinstance ( pbc , bool ) : pbc = ( pbc , ) * 3 else : assert len ( pbc ) == 3 pos = torch . as_tensor ( pos , dtype = torch . get_default_dtype ( ) ) edge_index , edge_cell_shift , cell = neighbor_list_and_relative_vec ( pos = pos , r_max = r_max , self_interaction = self_interaction , strict_self_interaction = strict_self_interaction , cell = cell , pbc = pbc , ) if cell is not None : kwargs [ AtomicDataDict . CELL_KEY ] = cell . view ( 3 , 3 ) kwargs [ AtomicDataDict . EDGE_CELL_SHIFT_KEY ] = edge_cell_shift if pbc is not None : kwargs [ AtomicDataDict . PBC_KEY ] = torch . as_tensor ( pbc , dtype = torch . bool ) . view ( 3 ) return cls ( edge_index = edge_index , pos = torch . as_tensor ( pos ) , ** kwargs )
short_docstring: Build neighbor graph from points, optionally with PBC.
short_docstring_tokens: Build neighbor graph from points optionally with PBC .
comment: """Build neighbor graph from points, optionally with PBC.
  
          Args:
              pos (np.ndarray/torch.Tensor shape [N, 3]): node positions. If Tensor, must be on the CPU.
              r_max (float): neighbor cutoff radius.
              cell (ase.Cell/ndarray [3,3], optional): periodic cell for the points. Defaults to ``None``.
              pbc (bool or 3-tuple of bool, optional): whether to apply periodic boundary conditions to all or each of
              the three cell vector directions. Defaults to ``False``.
              self_interaction (bool, optional): whether to include self edges for points. Defaults to ``False``. Note
              that edges between the same atom in different periodic images are still included. (See
              ``strict_self_interaction`` to control this behaviour.)
              strict_self_interaction (bool): Whether to include *any* self interaction edges in the graph, even if the
              two instances of the atom are in different periodic images. Defaults to True, should be True for most
              applications.
              **kwargs (optional): other fields to add. Keys listed in ``AtomicDataDict.*_KEY` will be treated specially.
          """$SEP$# there are no PBC if cell and pbc are not provided$SEP$# Make torch tensors for data: