Beispiel #1
0
 def adp_refinement(self, log):
   if log is None:
     log = sys.stdout
   save_xray_structure = self.fmodels.fmodel_xray().\
     xray_structure.deep_copy_scatterers().scatterers()
     ###> Make ADP of H/D sites equal
   self.model.reset_adp_of_hd_sites_to_be_equal()
   self.fmodels.update_xray_structure(
     xray_structure = self.model.get_xray_structure(),
     update_f_calc  = True)
   self.adp_refinement_manager = adp_refinement.manager(
     fmodels                = self.fmodels,
     model                  = self.model,
     group_adp_selections   = self.model.refinement_flags.adp_group,
     group_adp_selections_h = self.model.refinement_flags.group_h,
     group_adp_params       = self.params.group_b_iso,
     tls_selections         = self.model.refinement_flags.adp_tls,
     all_params             = self.params,
     tls_params             = self.params.tls,
     individual_adp_params  = self.params.adp,
     adp_restraints_params  = self.params.adp_restraints,
     refine_adp_individual  = self.model.refinement_flags.individual_adp,
     refine_adp_group       = self.model.refinement_flags.group_adp,
     refine_tls             = self.model.refinement_flags.tls,
     tan_b_iso_max          = self.tan_b_iso_max,
     restraints_manager     = self.model.restraints_manager,
     macro_cycle            = self.macro_cycle,
     target_weights         = self.target_weights,
     log                    = log,
     h_params               = self.params.hydrogens,
     nproc                  = 1)
Beispiel #2
0
 def adp_refinement(self, log):
   if log is None:
     log = sys.stdout
   save_xray_structure = self.fmodels.fmodel_xray().\
     xray_structure.deep_copy_scatterers().scatterers()
     ###> Make ADP of H/D sites equal
   self.model.reset_adp_of_hd_sites_to_be_equal()
   self.fmodels.update_xray_structure(
     xray_structure = self.model.xray_structure,
     update_f_calc  = True)
   self.adp_refinement_manager = adp_refinement.manager(
     fmodels                = self.fmodels,
     model                  = self.model,
     group_adp_selections   = self.model.refinement_flags.adp_group,
     group_adp_selections_h = self.model.refinement_flags.group_h,
     group_adp_params       = self.params.group_b_iso,
     tls_selections         = self.model.refinement_flags.adp_tls,
     all_params             = self.params,
     tls_params             = self.params.tls,
     individual_adp_params  = self.params.adp,
     adp_restraints_params  = self.params.adp_restraints,
     refine_adp_individual  = self.model.refinement_flags.individual_adp,
     refine_adp_group       = self.model.refinement_flags.group_adp,
     refine_tls             = self.model.refinement_flags.tls,
     tan_b_iso_max          = self.tan_b_iso_max,
     restraints_manager     = self.model.restraints_manager,
     macro_cycle            = self.macro_cycle,
     target_weights         = self.target_weights,
     log                    = log,
     h_params               = self.params.hydrogens,
     nproc                  = 1)
Beispiel #3
0
def run(
      model,
      params,
      fmodels,
      save_optimize_adp_weight,
      log,
      macro_cycle,
      prefix,
      target_weights):
  target_weights_params = params.target_weights
  h_params = params.hydrogens
  print_statistics.make_header(prefix, out = log)
  if(save_optimize_adp_weight):
    r_work = fmodels.fmodel_xray().r_work()
    r_free = fmodels.fmodel_xray().r_free()
    if ((r_free < r_work or (r_free-r_work)<0.01) and
        (not target_weights_params.force_optimize_weights)) :
      target_weights_params.optimize_adp_weight = False
    else:
      target_weights_params.optimize_adp_weight=save_optimize_adp_weight
  fmodels.fmodel_xray().xray_structure.scatterers().flags_set_grads(
    state = False)
  # Exclude H from ADP refinement
  if ((params.hydrogens.refine == "riding") or
      (params.hydrogens.force_riding_adp)) :
    excl_h = model.xray_structure.hd_selection().count(True) > 0
    if(excl_h and model.refinement_flags.adp_individual_iso is not None):
      model.refinement_flags.adp_individual_iso.set_selected(
        model.xray_structure.hd_selection(), False)
    if(excl_h and model.refinement_flags.adp_individual_aniso is not None):
      model.refinement_flags.adp_individual_aniso.set_selected(
        model.xray_structure.hd_selection(), False)
  #
  save_xray_structure = \
    fmodels.fmodel_xray().xray_structure.deep_copy_scatterers() # XXX ?
  ###> Make ADP of H/D sites equal
  model.reset_adp_of_hd_sites_to_be_equal()
  fmodels.update_xray_structure(xray_structure = model.xray_structure,
                                update_f_calc  = True)
  tidy_us(params=params, fmodels=fmodels, model=model, log=log)
  adp_refinement_manager = adp_refinement.manager(
    fmodels                = fmodels,
    model                  = model,
    group_adp_selections   = model.refinement_flags.adp_group,
    group_adp_selections_h = model.refinement_flags.group_h,
    group_adp_params       = params.group_b_iso,
    tls_selections         = model.refinement_flags.adp_tls,
    nm_selections          = model.refinement_flags.adp_nm,
    all_params             = params,
    tls_params             = params.tls,
    nm_params              = params.nm,
    individual_adp_params  = params.adp,
    adp_restraints_params  = params.adp_restraints,
    refine_adp_individual  = model.refinement_flags.individual_adp,
    refine_adp_group       = model.refinement_flags.group_adp,
    refine_tls             = model.refinement_flags.tls,
    refine_nm              = model.refinement_flags.nm,
    tan_b_iso_max          = 0,
    restraints_manager     = model.restraints_manager,
    macro_cycle            = macro_cycle,
    target_weights         = target_weights,
    log                    = log,
    h_params               = h_params)
  assert fmodels.fmodel_xray().xray_structure.min_u_cart_eigenvalue()>=0
  print >> log
  model.show_adp_statistics(padded = True)
  print >> log
  fmodels.update_xray_structure(update_f_calc = True)
  ###> Make ADP of H/D sites equal
  model.reset_adp_of_hd_sites_to_be_equal()
  fmodels.update_xray_structure(xray_structure = model.xray_structure,
                                update_f_calc  = True)
  assert fmodels.fmodel_xray().xray_structure.min_u_cart_eigenvalue()>=0