예제 #1
0
                a._coords[0][1] = -1. * a._coords[0][1]
        elif rotation == 'y':
            #for rotation around y-axis:
            for a in mol.allAtoms:
                a._coords[0][0] = -1. * a._coords[0][0]
                a._coords[0][2] = -1. * a._coords[0][2]
        elif rotation == 'x':
            #for rotation around x-axis:
            for a in mol.allAtoms:
                a._coords[0][1] = -1. * a._coords[0][1]
                a._coords[0][2] = -1. * a._coords[0][2]
    ncrds = numpy.array(mol.allAtoms.coords)
    ncrds = ncrds + center
    ncrds = ncrds.tolist()
    mol.allAtoms.updateCoords(ncrds)

    if writer:
        outptr = open(outputfilename, 'w')
        liglines = mol.parser.allLines
        ctr = 0
        for l in liglines:
            if l.find("ATOM") != 0 and l.find("HETATM") != 0:
                outptr.write(l)
            else:
                writer.write_atom(outptr, mol.allAtoms[ctr])
                ctr += 1
        outptr.close()

# To execute this command type:
# rotate_molecule.py -f filename [-o outputfilename -u axis -a angle to rotate] -v
예제 #2
0
        GasteigerChargeCalculator().addCharges(mol.allAtoms)

    if charges_to_add is not None:
        #restore any previous charges
        for atom, chargeList in preserved.items():
            atom._charges[chargeList[0]] = chargeList[1]
            atom.chargeSet = chargeList[0]

    #pdbqt_filename = mol.name + '.pdbqt'
    writer = PdbqtWriter()
    fptr = open(pdbqt_filename, 'w')
    ctr = 0
    for line in mol.parser.allLines:
        if find(line, 'ATOM')<0 and find(line, "HETA")<0:
            fptr.write(line)
        else:
            this_atom = mol.allAtoms[ctr]
            writer.write_atom(fptr, this_atom)
            ctr = ctr + 1
    fptr.close()
    if verbose:
        print "wrote ", ctr, " atoms to", pdbqt_filename
    

# To execute this command type:
# pdbqs_to_pdbqt.py -s pdbqs_filename_stem  -v




            for a in ats:
                if a.chargeSet is not None:
                    preserved[a] = [a.chargeSet, a.charge]

    if charges_to_add == 'gasteiger':
        GasteigerChargeCalculator().addCharges(mol.allAtoms)

    if charges_to_add is not None:
        #restore any previous charges
        for atom, chargeList in list(preserved.items()):
            atom._charges[chargeList[0]] = chargeList[1]
            atom.chargeSet = chargeList[0]

    #pdbqt_filename = mol.name + '.pdbqt'
    writer = PdbqtWriter()
    fptr = open(pdbqt_filename, 'w')
    ctr = 0
    for line in mol.parser.allLines:
        if find(line, 'ATOM') < 0 and find(line, "HETA") < 0:
            fptr.write(line)
        else:
            this_atom = mol.allAtoms[ctr]
            writer.write_atom(fptr, this_atom)
            ctr = ctr + 1
    fptr.close()
    if verbose:
        print("wrote ", ctr, " atoms to", pdbqt_filename)

# To execute this command type:
# pdbqs_to_pdbqt.py -s pdbqs_filename_stem  -v
예제 #4
0
            #for rotation around y-axis:
            for a in mol.allAtoms:
                a._coords[0][0] = -1.*a._coords[0][0]
                a._coords[0][2] = -1.*a._coords[0][2]
        elif rotation=='x':
            #for rotation around x-axis:
            for a in mol.allAtoms:
                a._coords[0][1] = -1.*a._coords[0][1]
                a._coords[0][2] = -1.*a._coords[0][2]
    ncrds = Numeric.array(mol.allAtoms.coords)
    ncrds = ncrds + center
    ncrds = ncrds.tolist()
    mol.allAtoms.updateCoords(ncrds)

    if writer:
        outptr = open(outputfilename, 'w')
        liglines = mol.parser.allLines
        ctr = 0
        for l in liglines:
            if l.find("ATOM")!=0 and l.find("HETATM")!=0:
                outptr.write(l)
            else:
                writer.write_atom(outptr, mol.allAtoms[ctr])
                ctr += 1
        outptr.close()


# To execute this command type:
# rotate_molecule.py -f filename [-o outputfilename -u axis -a angle to rotate] -v