From: Thomas G. K. <tg...@da...> - 2008-10-11 14:27:26
|
Hi all, I'm trying to rotate parts of a molecule around a rotable bond, but I can't seem to figure out how to do this from python. My experiments try to rotate the bonds of a ligand to see how the energy landscape changes. My goal is to experiment with energy minimization algorithms. I appreciate all the help I can get... Thomas G. Kristensen (phd student, Aarhus University, Denmark) p.s: This is how far I've gotten so far: #!/usr/bin/env python """ A (hopefully) small test that will reviel how easy it is to calculate the energy of a molecule using the open babel python swig bindings. """ import pybel import openbabel forcefield = openbabel.OBForceField.FindForceField("MMFF94") if __name__ == "__main__": for mol in pybel.readfile("mol2", "ligands.mol2"): obmol = mol.OBMol forcefield.Setup(obmol) print forcefield.Energy() for bond in openbabel.OBMolBondIter(obmol): print bond.IsRotor() # I cant ask this object to rotate :( for torsion in openbabel.OBMolTorsionIter(obmol): print torsion # Is not an object, can not be manipulated :( |
From: Noel O'B. <bao...@gm...> - 2008-10-11 15:15:45
|
OBMolTorsionIter may not be working correctly. Apart from that, see OBMol::SetTorsion and OBMol::GetTorsion in the C++ documentation (openbabel.org/api) 2008/10/11 Thomas Greve Kristensen <tg...@da...>: > Hi all, > > I'm trying to rotate parts of a molecule around a rotable bond, but I > can't seem to figure out how to do this from python. > My experiments try to rotate the bonds of a ligand to see how the energy > landscape changes. My goal is to experiment with energy minimization > algorithms. > > I appreciate all the help I can get... > > Thomas G. Kristensen > (phd student, Aarhus University, Denmark) > > p.s: This is how far I've gotten so far: > > #!/usr/bin/env python > """ > A (hopefully) small test that will reviel how easy > it is to calculate the energy of a molecule using > the open babel python swig bindings. > """ > import pybel > import openbabel > > forcefield = openbabel.OBForceField.FindForceField("MMFF94") > > if __name__ == "__main__": > for mol in pybel.readfile("mol2", "ligands.mol2"): > obmol = mol.OBMol > forcefield.Setup(obmol) > print forcefield.Energy() > > for bond in openbabel.OBMolBondIter(obmol): > print bond.IsRotor() # I cant ask this object to rotate :( > > for torsion in openbabel.OBMolTorsionIter(obmol): > print torsion # Is not an object, can not be manipulated :( > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > OpenBabel-scripting mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-scripting > |
From: Thomas G. K. <tg...@da...> - 2008-10-13 07:33:50
Attachments:
calc_energy.py
|
Hi, thanks for the help, but I still not sure how to do this. My problem is that I can extract the atom ids from TorsionIter, and wtih those I can extract the atoms, which I need for getting and setting torsions, but the enclosed script results in a segmentation fault. Is this due to a broken TorsionIter or is it me who are misunderstanding something? Thanks for all your help, Thomas |
From: Noel O'B. <bao...@gm...> - 2008-10-13 08:59:59
|
Apparently, the atom IDs returned by TorsionIter are off by one (you need to add to each of them to get the correct atom ID - I'll file a bug report I think about this). Hence the segfault when you tried to access a non-existent atom (or non existent torsion...). Noel 2008/10/13 Thomas Greve Kristensen <tg...@da...>: > Hi, > > thanks for the help, but I still not sure how to do this. My problem is that > I can extract the atom ids from TorsionIter, and wtih those I can extract > the atoms, which I need for getting and setting torsions, but the enclosed > script results in a segmentation fault. > > Is this due to a broken TorsionIter or is it me who are misunderstanding > something? > > Thanks for all your help, > > Thomas > > > > > On Oct 11, 2008, at 5:15 PM, Noel O'Boyle wrote: > >> OBMolTorsionIter may not be working correctly. Apart from that, see >> OBMol::SetTorsion and OBMol::GetTorsion in the C++ documentation >> (openbabel.org/api) >> >> 2008/10/11 Thomas Greve Kristensen <tg...@da...>: >>> >>> Hi all, >>> >>> I'm trying to rotate parts of a molecule around a rotable bond, but I >>> can't seem to figure out how to do this from python. >>> My experiments try to rotate the bonds of a ligand to see how the energy >>> landscape changes. My goal is to experiment with energy minimization >>> algorithms. >>> >>> I appreciate all the help I can get... >>> >>> Thomas G. Kristensen >>> (phd student, Aarhus University, Denmark) >>> >>> p.s: This is how far I've gotten so far: >>> >>> #!/usr/bin/env python >>> """ >>> A (hopefully) small test that will reviel how easy >>> it is to calculate the energy of a molecule using >>> the open babel python swig bindings. >>> """ >>> import pybel >>> import openbabel >>> >>> forcefield = openbabel.OBForceField.FindForceField("MMFF94") >>> >>> if __name__ == "__main__": >>> for mol in pybel.readfile("mol2", "ligands.mol2"): >>> obmol = mol.OBMol >>> forcefield.Setup(obmol) >>> print forcefield.Energy() >>> >>> for bond in openbabel.OBMolBondIter(obmol): >>> print bond.IsRotor() # I cant ask this object to rotate :( >>> >>> for torsion in openbabel.OBMolTorsionIter(obmol): >>> print torsion # Is not an object, can not be manipulated :( >>> >>> ------------------------------------------------------------------------- >>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>> challenge >>> Build the coolest Linux based applications with Moblin SDK & win great >>> prizes >>> Grand prize is a trip for two to an Open Source event anywhere in the >>> world >>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>> _______________________________________________ >>> OpenBabel-scripting mailing list >>> Ope...@li... >>> https://lists.sourceforge.net/lists/listinfo/openbabel-scripting >>> > > > |