On Fri, Jul 11, 2014 at 2:48 PM, Jouko Virtanen <jouko@umich.edu> wrote:
I would like to calculate the maximum-likelihood score given an input structure and an mtz file.  How can I do that?  Thanks in advance.

Do you just want the ML target function value, i.e. what phenix.refine prints out at regular intervals?  In that case, you can use the script appended below (run with phenix.python score.py), which is derived from $PHENIX/cctbx_project/mmtbx/examples/simple_command_line_cc.py.

from __future__ import division
import mmtbx.command_line
import sys

def master_phil () :
  return mmtbx.command_line.generic_simple_input_phil()

def run (args, out=sys.stdout) :
  cmdline = mmtbx.command_line.load_model_and_data(
    update_f_part1_for="map",
    args=args,
    master_phil=master_phil(),
    out=out,
    process_pdb_file=False,
    create_fmodel=True)
  fmodel = cmdline.fmodel
  tf = fmodel.target_functor(compute_gradients=False)
  score = tf_r.target_work()
  print score

if (__name__ == "__main__") :
  run(sys.argv[1:])