def METHOD_NAME(pdb_file_name,
        n_models,
        log,
        output_file_name_prefix,
        eps=1.e-7):
  pdb_inp = iotbx.pdb.input(file_name = pdb_file_name)
  pdb_hierarchy = pdb_inp.construct_hierarchy()
  asc = pdb_hierarchy.atom_selection_cache()
  cs = pdb_inp.crystal_symmetry_from_cryst1()
  tls_extract = mmtbx.tls.tools.tls_from_pdb_inp(
    remark_3_records = pdb_inp.extract_remark_iii_records(3),
    pdb_hierarchy    = pdb_hierarchy)
  for i_group, tls_params_one_group in enumerate(tls_extract.tls_params):
    selection = asc.selection(tls_params_one_group.selection_string)
    pdb_hierarchy_sel = pdb_hierarchy.select(selection)
    xrs = pdb_hierarchy_sel.extract_xray_structure(crystal_symmetry=cs)
    deg_to_rad_scale = math.pi/180
    # Units: T[A], L[deg**2], S[A*deg]
    T = matrix.sym(sym_mat3=tls_params_one_group.t)
    L = matrix.sym(sym_mat3=tls_params_one_group.l)
    S = matrix.sqr(tls_params_one_group.s)
    origin = tls_params_one_group.origin
    tlso = tools.tlso(
      t      = T.as_sym_mat3(),
      l      = L.as_sym_mat3(),
      s      = S,
      origin = origin)
    # sanity check
    if(not adptbx.is_positive_definite(tls_params_one_group.t, eps)):
      raise Sorry("T matrix is not positive definite.")
    if(not adptbx.is_positive_definite(tls_params_one_group.l, eps)):
      raise Sorry("L matrix is not positive definite.")
    r = analysis.METHOD_NAME(T=T, L=L*(deg_to_rad_scale**2), S=S*deg_to_rad_scale,
      log=log).self_check()
    ensemble_generator_obj = ensemble_generator(
      tls_from_motions_object = r,
      pdb_hierarchy           = pdb_hierarchy_sel,
      xray_structure          = xrs,
      n_models                = n_models,
      origin                  = origin,
      log                     = log)
    ensemble_generator_obj.write_pdb_file(
      file_name=output_file_name_prefix+"_ensemble_%s.pdb"%str(i_group))
    # get U from TLS
    u_from_tls = tools.uaniso_from_tls_one_group(
      tlso          = tlso,
      sites_cart    = xrs.sites_cart(),
      zeroize_trace = False)
    # get U from ensemble
    pdb_hierarchy_from_tls = pdb_hierarchy_sel.deep_copy()
    pdb_hierarchy_from_ens = pdb_hierarchy_sel.deep_copy()
    u_from_ens = tools.u_cart_from_ensemble(
      models = ensemble_generator_obj.states.root.models())
    for i in range(xrs.sites_cart().size()):
      print("atom %d:"%i)
      print("  Ucart(from TLS):", ["%8.5f"%u for u in u_from_tls[i]])
      print("  Ucart(from ens):", ["%8.5f"%u for u in u_from_ens[i]])
    #
    u1, u2 = u_from_tls.as_double(), u_from_ens.as_double()
    cc = flex.linear_correlation(x=u1, y=u2).coefficient()
    r = flex.sum(flex.abs(u1-u2))/\
        flex.sum(flex.abs(flex.abs(u1)+flex.abs(u2)))*2
    print("%6.4f %6.4f"%(cc, r))
    #
    pdb_hierarchy_from_tls.atoms().set_uij(u_from_tls)
    pdb_hierarchy_from_ens.atoms().set_uij(u_from_ens)
    pdb_hierarchy_from_tls.write_pdb_file(
      file_name = output_file_name_prefix+"_u_from_tls_%s.pdb"%str(i_group),
      crystal_symmetry = cs)
    pdb_hierarchy_from_ens.write_pdb_file(
      file_name = output_file_name_prefix+"_u_from_ensemble_%s.pdb"%str(i_group),
      crystal_symmetry = cs)
  return ensemble_generator_obj