def _make_solutepdb(atoms, masses, ligand): """ Make a solute PDB file """ mass2elem = { 1.0080000: "H", 12.0100000: "C", 14.0100000: "N", 16.0000000: "O", 32.0600000: "S", 35.4500000: "Cl", 19.0000000: "F", 79.9000000: "Br" } pdbout = pdb.PDBFile() res = pdb.Residue() res.resname = ligand res.serial = 1 for i, (a, m) in enumerate(zip(atoms, masses), 1): atom = pdb.Atom() atom.serial = i atom.hetatm = False atom.name = "%s%d" % (mass2elem[m], i ) # Atom names from masses and serial number atom.resname = ligand atom.residue = 1 atom.set_xyz(a.xyz) res.atoms.append(atom) pdbout.atoms.append(atom) pdbout.residues.append(res) pdbout.write(ligand + ".pdb")
def write_singlepdb(filename, resname, atomname): struct = pdb.PDBFile() res = pdb.Residue() atm = pdb.Atom() atm.serial = 1 atm.name = atomname atm.resname = resname atm.residue = 1 res.append(atm) struct.residues.append(res) struct.write(filename)
def make(self, bd=3.0): struct = pdb.PDBFile() res = pdb.Residue() for i, bead in enumerate(self.beads): atom = pdb.Atom() atom.idx = i atom.serial = i + 1 atom.name = bead.name atom.resname = self.name atom.residue = 1 atom.set_xyz(bead.xyz * bd) res.atoms.append(atom) struct.atoms.append(atom) struct.residues.append(res) allcoord = np.asarray([a.xyz for a in struct.atoms]) offset = allcoord.mean(axis=0) + 50.0 for a in struct.atoms: a.set_xyz(a.xyz + offset) struct.box = np.asarray([100, 100, 100]) return struct
natomtypes - 1].mass atom.set_mu([0.0, 0.0, 0.0]) conlist = [ aa_datafiles[res].bonds, aa_datafiles[res].angles, aa_datafiles[res].dihedrals ] for cons, ntypes in zip(conlist, contypes): for con in cons: con.param = con.param + ntypes natomtypes = _ntypes(include.masses) # Add a range of all-atom residues to the data file moli = 0 if aa_range is not None: first, last = map(lambda x: int(x) - 1, aa_range[1:].split("-")) resall = pdb.Residue() allres = [] for i in range(first, last + 1): for atom in pdbfile.residues[i].atoms: resall.append(atom) allres.append(pdbfile.residues[i]) takeres[i] = False _generate_aa_residue(resall, 1, aa_datafiles[aa_range], data) moli = 1 if args.watrad is not None: ninside = 0 com = [ np.asarray([res.collect("centerofmass") for res in allres]).mean(axis=0) ]
rotate_struct(pdbfile, host, centroids[1]-centroids[0], 'z') # Then rotate around the short axis of the host host_xyz = host.collect("xyz") rotate_struct(pdbfile, host, host_xyz[axis_indices[0][0],:]- host_xyz[axis_indices[0][1],:], 'y') # Next move G1 to the new origin pdbfile.update_xyz(pdbfile.xyz-pdbfile.xyz[g1,:]) # And finally add three new residues with dummy atoms new_xyz = [[0.000,3.500,-14.500], [0.000,0.000,-11.000], [0.000,0.000,-6.000]] for i in range(3) : res = pdb.Residue() atom = pdb.Atom() atom.idx = 1 atom.hetatm = False atom.serial = 1 atom.name = " Pb " atom.residue = 1 atom.resname = "DUM" atom.set_xyz(new_xyz[i]) res.append(atom) pdbfile.atoms.insert(0, atom) pdbfile.residues.insert(0, res) pdbfile.renumber() if args.out is None : args.out = os.path.splitext(args.file)[0]+"_apr.pdb"