code: def xyz2mol(atoms, coordinates, use_graph=True):
      """
      Convert the given molecular geometry to a 2D molecular graph and check if it is chemically valid through valency check with the algorithm
      in `this paper <https://onlinelibrary.wiley.com/doi/abs/10.1002/bkcs.10334>`_.
  
      Args:
          atoms (numpy array): the numpy array indicating the atomic number of atoms in the molecular geometry.
          coordinates (numpy array): the numpy array indicating the coordinates of atoms in the molecular geometry.
          use_graph (bool): whether use networkx to compute the maximum-weighted matching of the graph or not. (default: :obj:`True`)
  
      :rtype:
          BO: bond order matrix.
          valid: a bool value denoting whether the molecular geometry is valid or not.
  
      """
  
      # Get atom connectivity (AC) matrix, list of atomic numbers, molecular charge,
      # and mol object with no connectivity information
      AC = xyz2AC_vdW(atoms, coordinates)
  
      # Convert AC to bond order matrix and add connectivity and charge info to
      # mol object
      BO, valid = AC2BO(AC, atoms, use_graph)
      return BO, valid
  
imports: from rdkit import Chem
  import numpy
  import networkx
  import collections
  from collections import defaultdict
  import itertools
  import copy
  from scipy.spatial import distance_matrix
label_desc: Use image node_id 15 for calling a global function with example usage: xyz2mol(atoms, coordinates, use_graph) and returns: BO,  valid