def _setup_model_h(self): if self.model_h is not None: return if not self.model.has_hd(): # runs reduce internally assert (libtbx.env.has_module(name="reduce")) assert (libtbx.env.has_module(name="elbow")) self.model_h = ready_set_model_interface( model=self.model, params=[ "add_h_to_water=False", "optimise_final_geometry_of_hydrogens=False" ], ) else: self.model_h = self.model.deep_copy() params_h = mmtbx.model.manager.get_default_pdb_interpretation_params() params_h.pdb_interpretation = self.model._pdb_interpretation_params.pdb_interpretation # customization for model with H params_h.pdb_interpretation.clash_guard.nonbonded_distance_threshold = None params_h.pdb_interpretation.max_reasonable_bond_distance = None params_h.pdb_interpretation.use_neutron_distances = True params_h.pdb_interpretation.ncs_search = self.params_for_model.pdb_interpretation.ncs_search params_h.pdb_interpretation.ncs_search.exclude_selection = "water" self.model_h.set_pdb_interpretation_params(params_h) self.model_h.get_restraints_manager() self.model_h.idealize_h_riding() self.model_h.setup_ncs_constraints_groups(filter_groups=True) self.model_h._update_master_sel() if self.params.debug: self.shift_and_write_result(model=self.model_h, fname_suffix="model_h")
def get_readyset_model_with_grm(self): ''' Run ready set by default (to get ligand cif and/or add H atoms) TODO: Once it it refactored, make running it optional Complicated case is when cif is input for one ligand, but missing for another ligand ''' self.readyset_model = None #if not self.model.has_hd(): if (self.params.place_hydrogens): params = [ "add_h_to_water=False", "optimise_final_geometry_of_hydrogens=False", "--silent" ] else: params = [ "add_h_to_water=False", "hydrogens=False", "optimise_final_geometry_of_hydrogens=False", "--silent" ] assert (libtbx.env.has_module(name="reduce")) assert (libtbx.env.has_module(name="elbow")) # runs reduce internally self.readyset_model = ready_set_model_interface(model=self.model, params=params) self.readyset_model.set_log(null_out())
def run(self): pdb_fn = self.data_manager.get_default_model_name() print('Using model file:', pdb_fn, file=self.logger) restraint_objects = list() if self.data_manager.has_restraints(): print('Using restraints files', self.data_manager.get_restraint_names(), file=self.logger) for filename in self.data_manager.get_restraint_names(): restraint_objects.append( (filename, self.data_manager.get_restraint(filename))) model = self.data_manager.get_model() pi_params = model.get_default_pdb_interpretation_params() pi_params.pdb_interpretation.clash_guard.nonbonded_distance_threshold = None # TODO: below are some non-defaults for pdb_interpretation, # but they cannot be changed # Do we need the non-defaults? # assume_hydrogens_all_missing --> default is False, but becomes True if H are present # hard_minimum_nonbonded_distance --> default is 0.001 but is 0 in NBO # substitute_non_crystallographic_unit_cell_if_necessary --> not necessary # add H atoms with readyset params = [ "add_h_to_water=False", "optimise_final_geometry_of_hydrogens=False" ] assert (libtbx.env.has_module(name="reduce")) assert (libtbx.env.has_module(name="elbow")) readyset_model = ready_set_model_interface( model=model, params=params, keep_temp=self.params.keep_temp) readyset_model.set_pdb_interpretation_params(pi_params) readyset_model.set_restraint_objects(restraint_objects) readyset_model.get_restraints_manager() # TODO: do we need macro_mol_sel, do we care? # If we use model.select(), we don't need it. proxies = readyset_model.all_chain_proxies cache = proxies.pdb_hierarchy.atom_selection_cache() macro_mol_sel = proxies.selection(cache=cache, string='protein or dna or rna') #t0 = time.time() nb_overlaps = nbo.info(model=readyset_model, macro_molecule_selection=macro_mol_sel) #t1 = time.time() nb_overlaps.show(log=self.logger, nbo_type='all', normalized_nbo=True) #t2 = time.time() processed_nbps = pnp.manager(model=readyset_model) clashes = processed_nbps.get_clashes() #t3 = time.time() clashes.show(log=self.logger) hbonds = processed_nbps.get_hbonds() hbonds.show(log=self.logger)
def _setup_model_h(self): if self.model_h is not None: return if not self.model.has_hd(): self.model_h = ready_set_model_interface( model=self.model, params=[ "add_h_to_water=False", "optimise_final_geometry_of_hydrogens=False" ], ) else: self.model_h = self.model.deep_copy() params_h = mmtbx.model.manager.get_default_pdb_interpretation_params() params_h.pdb_interpretation.use_neutron_distances = True params_h.pdb_interpretation.ncs_search = self.params_for_model.pdb_interpretation.ncs_search params_h.pdb_interpretation.ncs_search.exclude_selection = "water" self.model_h.set_pdb_interpretation_params(params_h) self.model_h.get_restraints_manager() self.model_h.idealize_h_riding() self.model_h.setup_ncs_constraints_groups(filter_groups=True) self.model_h._update_master_sel()