示例#1
0
    def trajectory(self):
        """
        Particles' coordinates at the current time

        Returns
        -------

        stream : :class:`MDAnalysis.lib.util.NamedStream`
            A stream in the format that can be parsed by :class:`ESPReader`

        """
        # time
        _xyz = str(self.system.time) + '\n'
        # number of particles
        _xyz += str(len(self.system.part)) + '\n'
        # box edges
        _xyz += str(self.system.box_l) + '\n'
        # configuration
        for _p in self.system.part:
            _xyz += str(_p.pos) + '\n'
        for _p in self.system.part:
            _xyz += str(_p.v) + '\n'
        for _p in self.system.part:
            _xyz += str(_p.f) + '\n'
        return NamedStream(StringIO(_xyz), "__.ESP")
示例#2
0
    def _pharmacohore_from_mdanalysis(
            self,
            frame_num: int,
            load_mol_system: bool = False,
            load_ligand: bool = False) -> StructuredBasedPharmacophore:
        """ Derive a pharmacophore for a single frame of an MdAnalysis Universe object.

            Parameters
            ----------
            frame_num : int
                The index number of the frame from which the pharmacophore will be derived.
            
            load_mol_system: bool, default=False
                If true the receptor will be stored in the pharmacophore object.
            
            load_ligand: bool, default=False
                If true the ligand will be stored in the pharmacophore object.
        """
        if not isinstance(frame_num, int):
            raise OpenPharmacophoreTypeError("Frame number must be an integer")
        stream = StringIO()
        pdb_stream = NamedStream(stream, "output.pdb")
        atoms = self._trajectory.select_atoms("all")
        atoms.write(pdb_stream,
                    frames=self._trajectory.trajectory[[frame_num]])
        pharmacophore = StructuredBasedPharmacophore.from_pdb(
            pdb_stream,
            radius=1.0,
            ligand_id=None,
            hydrophobics="plip",
            load_mol_system=load_mol_system,
            load_ligand=load_ligand)

        return pharmacophore
示例#3
0
 def setUp(self):
     self.universe = MDAnalysis.Universe(PSF, DCD)
     stream = StringIO()
     self.namedfile = NamedStream(stream, self.filename)
示例#4
0
 def namedfile(self):
     return NamedStream(StringIO(), self.filename)
示例#5
0
def benzene_universe():
    return mda.Universe(NamedStream(io.StringIO(benz), 'benzene.pdb'))