コード例 #1
0
    def parse(self, **kwargs):
        pbmol = next(pybel.readfile('cif', self.filename))
        unpack_symmetry(pbmol)

        natoms = len(pbmol.atoms)

        names = np.zeros(natoms, dtype=object)
        charges = np.zeros(natoms, dtype=np.float32)
        masses = np.zeros(natoms, dtype=np.float64)

        for i, atom in enumerate(pbmol.atoms):
            names[i] = atom.type
            masses[i] = atom.exactmass
            charges[i] = atom.partialcharge

        attrs = [
            Atomnames(names),
            Charges(charges),
            Masses(masses),
            Resids(np.array([1])),
            Resnums(np.array([1])),
            Segids(np.array(['SYSTEM'], dtype=object)),
        ]

        return Topology(natoms, 1, 1, attrs=attrs)
コード例 #2
0
ファイル: __init__.py プロジェクト: opichals/espresso
    def parse(self):
        """
        Access ESPResSo data and return the topology object

        Returns
        -------

        top : :class:`MDAnalysis.core.topology.Topology`
            a topology object

        """
        espresso = self.kwargs['espresso']

        names = []
        atomtypes = []
        masses = []
        charges = []

        for p in espresso.part:
            names.append("A" + repr(p.type))
            atomtypes.append("T" + repr(p.type))
            masses.append(p.mass)
            charges.append(p.q)
        natoms = len(espresso.part)
        attrs = [
            Atomnames(np.array(names, dtype=object)),
            Atomids(np.arange(natoms) + 1),
            Atomtypes(np.array(atomtypes, dtype=object)),
            Masses(masses),
            Resids(np.array([1])),
            Resnums(np.array([1])),
            Segids(np.array(['System'], dtype=object)),
            AltLocs(np.array([' '] * natoms, dtype=object)),
            Resnames(np.array(['R'], dtype=object)),
            Occupancies(np.zeros(natoms)),
            Tempfactors(np.zeros(natoms)),
            ICodes(np.array([' '], dtype=object)),
            Charges(np.array(charges)),
        ]

        top = Topology(natoms, 1, 1, attrs=attrs)

        return top
コード例 #3
0
        atoms = mol.getAtoms()
        for atom in atoms:
            charge = atom._sire_object.property("charge").value()
            if mol.getResidues()[0].name() == 'LIG':
                charge = (1 - L) * charge
            charges.append(charge)
    #sys.exit(-1)

    #creating the universe

    u = MDAnalysis.Universe(PRM7, DCD)

    # select solute atoms

    #selection = u.select_atoms('resname LIG')

    #to include ions we should use
    selection = u.select_atoms('not resname WAT')

    # construct restricted ligand or complex Universe

    system_u = MDAnalysis.core.universe.Merge(selection)
    system_u.add_TopologyAttr(Radii(rads))
    system_u.add_TopologyAttr(Charges(charges))

    # write pqr file

    system_u.atoms.write('../../pqr_snapshots/rad_bss/LIG_opt_free_L_' +
                         str(L) + '.pqr')

    os.chdir("../")
コード例 #4
0
    radO, radC, radO, radC, radC, radC, radC, radC, radC, radO3, radC, radO4,
    radC, radH, radH, radH, radH, radH, radH, radH
]

ligand_u.add_TopologyAttr(Radii(rad))

# how to customize the charges

topo = MDAnalysis.topology.TOPParser.TOPParser("input/SYSTEM.top")

topology_parsed = topo.parse()

tab_charges = topology_parsed.charges.values

first_charges = []

for i in range(len(selection)):
    first_charges.append(tab_charges[i])

lambda_charges = []

for charge in first_charges:
    lambda_charges.append(charge * (1 - L))

ligand_u.add_TopologyAttr(Charges(lambda_charges))

# write pqr file

ligand_u.atoms.write('pqr_snapshots/LIG_free_1st_L_' + str(L) + '.pqr',
                     frames=[0])
コード例 #5
0
ファイル: __init__.py プロジェクト: reinaual/espresso
    def parse(self):
        """
        Access ESPResSo data and return the topology object.

        Returns
        -------

        top : :class:`MDAnalysis.core.topology.Topology`
            a topology object

        """
        espresso = self.kwargs['espresso']

        names = []
        atomtypes = []
        masses = []
        charges = []
        bonds = []
        angles = []
        dihedrals = []

        for p in espresso.part:
            names.append("A" + repr(p.type))
            atomtypes.append("T" + repr(p.type))
            masses.append(p.mass)
            charges.append(p.q)
            for bond in p.bonds:
                partner_ids = bond[1:]
                n_partner = len(partner_ids)
                if n_partner == 1:
                    bonds.append((p.id, partner_ids[0]))
                elif n_partner == 2:
                    angles.append((partner_ids[0], p.id, partner_ids[1]))
                elif n_partner == 3:
                    dihedrals.append(
                        (partner_ids[0], p.id, partner_ids[1], partner_ids[2]))
                else:
                    continue
        natoms = len(espresso.part)
        attrs = [
            Atomnames(np.array(names, dtype=object)),
            Atomids(np.arange(natoms) + 1),
            Atomtypes(np.array(atomtypes, dtype=object)),
            Masses(masses),
            Resids(np.array([1])),
            Resnums(np.array([1])),
            Segids(np.array(['System'], dtype=object)),
            AltLocs(np.array([' '] * natoms, dtype=object)),
            Resnames(np.array(['R'], dtype=object)),
            Occupancies(np.zeros(natoms)),
            Tempfactors(np.zeros(natoms)),
            ICodes(np.array([' '], dtype=object)),
            Charges(np.array(charges)),
            Bonds(bonds),
            Angles(angles),
            Dihedrals(dihedrals)
        ]

        top = Topology(natoms, 1, 1, attrs=attrs)

        return top