示例#1
0
    def _unaligned_image(self, state):
        """

        Parameters
        ----------
        state :
            

        Returns
        -------

        """

        # get the box lengths from the vectors
        box_lengths, box_angles = box_vectors_to_lengths_angles(
            state['box_vectors'])

        # recenter the protein-ligand complex into the center of the
        # periodic boundary conditions

        # regroup the ligand and protein in together
        grouped_positions = group_pair(state['positions'], box_lengths,
                                       self._bs_idxs, self._lig_idxs)

        # then center them around the binding site
        centered_positions = center_around(grouped_positions, self._bs_idxs)

        # slice these positions to get the image
        state_image = centered_positions[self._image_idxs]

        return state_image
示例#2
0
    def _progress(self, walker):
        """Calculate if the walker has bound and provide progress record.

        Parameters
        ----------
        walker : object implementing the Walker interface

        Returns
        -------
        is_bound : bool
           Whether the walker is unbound (warped) or not

        progress_data : dict of str : value
           Dictionary of the progress record group fields
           for this walker alone.

        """

        # first recenter the ligand and the receptor in the walker
        box_lengths, box_angles = box_vectors_to_lengths_angles(
            walker.state['box_vectors'])
        grouped_walker_pos = group_pair(walker.state['positions'], box_lengths,
                                        self.binding_site_idxs,
                                        self.ligand_idxs)

        # center the positions around the center of the binding site
        centered_walker_pos = center_around(grouped_walker_pos,
                                            self.binding_site_idxs)

        # superimpose the walker state positions over the native state
        # matching the binding site indices only
        sup_walker_pos, _, _ = superimpose(self.native_state['positions'],
                                           centered_walker_pos,
                                           idxs=self.binding_site_idxs)

        # calculate the rmsd of the walker ligand (superimposed
        # according to the binding sites) to the native state ligand
        native_rmsd = calc_rmsd(self.native_state['positions'],
                                sup_walker_pos,
                                idxs=self.ligand_idxs)

        # test to see if the ligand is re-bound
        rebound = False
        if native_rmsd <= self.cutoff_rmsd:
            rebound = True

        progress_data = {'native_rmsd': native_rmsd}

        return rebound, progress_data
示例#3
0
    def _unaligned_image(self, state):
        """The preprocessing method of states.

        First it groups the binding site and ligand into the same
        periodic box image and then centers the box around their
        mutual center of mass and returns only the positions of the
        binding site and ligand.

        Parameters
        ----------
        state : object implementing WalkerState
            State with 'positions' (Nx3 dims) and 'box_vectors' (3x3
            array) attributes.

        Returns
        -------

        """

        # get the box lengths from the vectors
        box_lengths, box_angles = box_vectors_to_lengths_angles(
            state['box_vectors'])

        # recenter the protein-ligand complex into the center of the
        # periodic boundary conditions

        # regroup the ligand and protein in together
        grouped_positions = group_pair(state['positions'], box_lengths,
                                       self._bs_idxs, self._lig_idxs)

        # then center them around the binding site
        centered_positions = center_around(grouped_positions, self._bs_idxs)

        # slice these positions to get the image
        state_image = centered_positions[self._image_idxs]

        return state_image