[chimera-dev] writing atom information using the mol2 atom order.

Jean Didier Pie Marechal JeanDidier.Marechal at uab.cat
Tue Nov 3 06:20:50 PST 2009


Dear all,

I have a mol2 file and I would like to generate an input for an external program using chimera. For a great ease in practicability, I would like the mol2 order to be kept. 

I used the following artefact to get to what I want:
def input(molecule):
    ##for compatibility with mol2 atom ordering I use the doble loop as follow
    ##makes the writing substantially slower, but yet the compatibility with mol2 format seems absolute. 
    for i in range(len(molecule.atoms)):
        for atoms in molecule.atoms:
            if atoms.serialNumber == i:
                text=str(atoms.element)+"-"+str(atoms.gaffType)+"-"+str(atoms.charge)+"    "+str(atoms.flex)+"    "+str(atoms.coord()) +"\n"
                filename.write(text)
        i=i+1

I think I could order directly the writing in function of the serialNumber (which is preserved regarding the mol2) file. But how could I do this?

Best,
JD

Dr. Jean-Didier Maréchal
Lecturer
Computational Biotechnological Chemistry @ Transmet
Unitat de Química Física
Departament de Química
Universitat Autònoma de Barcelona
Edifici C.n.
08193 Cerdanyola (Barcelona)
Tel: +34.935814936
e-mail: JeanDidier.Marechal at uab.es




More information about the Chimera-dev mailing list