code: def scalar_potential(field, frame):
      """
      Returns the scalar potential function of a field in a given frame
      (without the added integration constant).
  
      Parameters
      ==========
  
      field : Vector
          The vector field whose scalar potential function is to be
          calculated
  
      frame : ReferenceFrame
          The frame to do the calculation in
  
      Examples
      ========
  
      >>> from sympy.physics.vector import ReferenceFrame
      >>> from sympy.physics.vector import scalar_potential, gradient
      >>> R = ReferenceFrame('R')
      >>> scalar_potential(R.z, R) == R[2]
      True
      >>> scalar_field = 2*R[0]**2*R[1]*R[2]
      >>> grad_field = gradient(scalar_field, R)
      >>> scalar_potential(grad_field, R)
      2*R_x**2*R_y*R_z
  
      """
  
      # Check whether field is conservative
      if not is_conservative(field):
          raise ValueError("Field is not conservative")
      if field == Vector(0):
          return S.Zero
      # Express the field exntirely in frame
      # Substitute coordinate variables also
      _check_frame(frame)
      field = express(field, frame, variables=True)
      # Make a list of dimensions of the frame
      dimensions = list(frame)
      # Calculate scalar potential function
      temp_function = integrate(field.dot(dimensions[0]), frame[0])
      for i, dim in enumerate(dimensions[1:]):
          partial_diff = diff(temp_function, frame[i + 1])
          partial_diff = field.dot(dim) - partial_diff
          temp_function += integrate(partial_diff, frame[i + 1])
      return temp_function
  
file_path: sympy/sympy/physics/vector/fieldfunctions.py
imports: from sympy.core.function import diff
  from sympy.core.singleton import S
  from sympy.integrals.integrals import integrate
  from sympy.physics.vector import Vector, express
  from sympy.physics.vector.frame import _check_frame
  from sympy.physics.vector.vector import _check_vector
label_desc: Use image node_id 6 for calling a global function with example usage: scalar_potential(field, frame) and returns: temp_function, S