
Dear Chimera Dev. Team, I'm trying to add energy calculations in my script. To do so, I started with the class Minimize, defining nsteps as 0 but I think that it is not so tidy. In chimera/share/MMMD/MMTKinter.py I found the function minimize and a line that says: msg = "Initial energy: %f" % self.universe.energy() . My question is... How can I invoke this self.universe.energy() in order to get the energy? I tried to write a new class in MMMD/base.py and a new function in MMMD/MMTKinter.py in order to obtain a function like "MMMD.base.energy()" to write in my script but I think that I am doing it more complex that it is... Anyone has any idea for doing it successfully? Thanks, Elisabeth Ortega-Carrasco Ph.D. Student @ Universitat Autònoma de Barcelona.

Dear Elisabeth, You can try to define a new class that derives from the MMTKinter like this: First create a simple function in the MMTKinter class that will give you the energy: * def energy(self): return self.universe.energy()* Now let's create the new class: *from MMMD.MMTKinter import MMTKinter class NewClass(MMTKinter): def __init__(self, molecule): self.molecule = molecule self.nogui = True self._MMTK = MMTKinter(self.molecule, self.nogui) self._MMTK._finishIniti() self._MMTK.loadMMTKCoordinates() def energy(self): self.energy = self._MMTK.energy() print self.energy* This way you can initialize the MMTKinter class and create the universe, being the molecule your own molecule. With the self.nogui = True you just do all that stuff without the graphic interface. The energy function here will return you the energy of the system. Hope that will help. If it's not what you wanted just send another mail and I'll look it for you again. Kind regards, --
participants (2)
-
Elisabeth Ortega
-
Victor Muñoz