コード例 #1
0
 def init_amber(self, params, pdb_hierarchy, log):
     if hasattr(params, "amber"):
         self.use_amber = params.amber.use_amber
         print_amber_energies = params.amber.print_amber_energies
         if (self.use_amber):
             sites_cart = pdb_hierarchy.atoms().extract_xyz()
             compute_gradients = False
             make_header("Initializing AMBER", out=log)
             print >> log, "  topology    : %s" % params.amber.topology_file_name
             print >> log, "  atom order  : %s" % params.amber.order_file_name
             if params.amber.coordinate_file_name:
                 print >> log, "  coordinates : %s" % params.amber.coordinate_file_name
             from amber_adaptbx import interface
             self.amber_structs, sander = interface.get_amber_struct_object(
                 params)
             self.sander = sander  # used for cleanup
             import amber_adaptbx
             amber_geometry_manager = amber_adaptbx.geometry_manager(
                 sites_cart=sites_cart,
                 #number_of_restraints=geometry_energy.number_of_restraints,
                 gradients_factory=flex.vec3_double,
                 amber_structs=self.amber_structs)
             geometry = amber_geometry_manager.energies_sites(
                 crystal_symmetry=self.geometry.crystal_symmetry,
                 compute_gradients=compute_gradients)
コード例 #2
0
    def __init__(
        self,
        # pdb_hierarchy,
        # standard_geometry_restraints_manager,
        params,
        energy_components=None,
        # gradients=None,
        # number_of_restraints=0,
        gradients_factory=flex.vec3_double,
        # amber_structs=None,
        log=StringIO()):
        self.gradients_factory = gradients_factory
        # self.number_of_restraints = number_of_restraints
        # self.amber_structs = amber_structs
        adopt_init_args(self, locals(), exclude=["log"])

        self.initialisation(params, log)

        from amber_adaptbx import interface
        self.amber_structs, self.sander = interface.get_amber_struct_object(
            params)
        # self.sander = sander # used for cleanup
        # self.sites_cart = self.pdb_hierarchy.atoms().extract_xyz()
        compute_gradients = False
        # amber_geometry_manager = amber_adaptbx.geometry_manager(
        #   sites_cart=sites_cart,
        #   gradients_factory=flex.vec3_double,
        #   amber_structs=self.amber_structs)
        # order_converter is a Python dict that map amber atom order to phenix order
        # assign later
        if manager.COUNT == 0:
            # compute order_converter from original sites_cart or load from file
            initialize_order_converter(self)
        self.print_amber_energies = params.amber.print_amber_energies
        # self.qmmask = params.amber.qmmask
        # sites_cart = self.pdb_hierarchy.atoms().extract_xyz()
        # print('sites_cart',len(sites_cart))
        # geometry = self.energies_sites(
        #   sites_cart = self.pdb_hierarchy.atoms().extract_xyz(),
        #   compute_gradients = compute_gradients,
        #   log=log,
        #   print_amber_energies=self.print_amber_energies,
        #   #qmmask=self.qmmask,
        #   )

        # increase COUNT to avoid recompute order_converter
        manager.COUNT += 1

        if self.energy_components is None:
            self.energy_components = flex.double(
                [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])