Dear developpers, <br><br>I am trying to make an extension that allows normal mode calculations with MMTK into chimera. I have several problems beginning with the following. <br><br>I have first used the MMTKinter.py and added a new function called NM_ffm that calculates normal modes with a full atom force field. This works perfectly (although I am not yet able to make an animation in chimera that follows the vectors calculated...that will be a future question for you). Then I added  another function (NM_mcm) that allows me to do NM calculations with the mechanical constraint (see <a href="http://dirac.cnrs-orleans.fr/MMTK/using-mmtk/mmtk-example-scripts/normal-modes/normal-modes-with-mechanical-constraints">http://dirac.cnrs-orleans.fr/MMTK/using-mmtk/mmtk-example-scripts/normal-modes/normal-modes-with-mechanical-constraints</a>). For this I need to define a subspace that requires a universe.protein object (the functions are given at the end of the mail). Unfortunately, I can not pass the molecular object from the chimera space as a universe.protein object. We thought in putting self.universe.protein call into the _makeUniverse function in MMTKinter.py but that did not work. We tried other combinations but we now face the fact that we are blocked. May be we need another function in order to define subspaces but yet we still don't know how to pass chimera infos to MMTK.<br>
<br>Could you give me a hand so that I can define correctly subspaces on chimera molecules?<br><br>All the best and thank in advance for any help,<br><br>Victor<br><br>*************<br>Computational Biotechnological Chemistry @transmet<br>
<br><br><br><br><br>####Function for normal modes calculations in full atom ff<br>    def NM_ffm(self, nsteps, stepsize=0.02,<br>            interval=None, action=None, **kw):<br>        from chimera import replyobj<br>        timestamp("_minimize")<br>
        from MMTK import Units<br>        from MMTK.ForceFields.Amber import AmberData<br>        from MMTK.Minimization import SteepestDescentMinimizer<br>        from MMTK.Trajectory import LogOutput<br>        # from JD to make NM calculations<br>
        from MMTK.NormalModes import NormalModes<br>        from chimera import runCommand as run<br>        from chimera import selection as sele<br>        from chimera import Point, Vector<br>        import os, sys<br>
        # JD'end<br>        import sys<br>        if not interval:<br>            actions = []<br>        else:<br>            actions = [ LogOutput(sys.stdout, ["energy"],<br>                        interval, None, interval) ]<br>
        kw["step_size"] = stepsize * Units.Ang<br>        minimizer = SteepestDescentMinimizer(self.universe,<br>                            actions=actions, **kw)<br>        if action is None or not interval:<br>
            interval = None<br>        msg = "Initial energy: %f" % self.universe.energy()<br>        replyobj.status(msg)<br>        <a href="http://replyobj.info">replyobj.info</a>(msg)<br>        saveNormalizeName = AmberData._normalizeName<br>
        AmberData._normalizeName = simpleNormalizeName<br>        remaining = nsteps<br>        while remaining > 0:<br>            timestamp(" minimize interval")<br>            if interval is None:<br>                realSteps = remaining<br>
            else:<br>                realSteps = min(remaining, interval)<br>            minimizer(steps=realSteps)<br>            remaining -= realSteps<br>            if action is not None:<br>                action(self)<br>
            timestamp(" finished %d steps" % realSteps)<br>            msg = "Finished %d of %d minimization steps" % (<br>                        nsteps - remaining, nsteps)<br>            replyobj.status(msg)<br>
            <a href="http://replyobj.info">replyobj.info</a>(msg)<br>        <a href="http://replyobj.info">replyobj.info</a>("\n")<br>        #Calculate normal modes JD's trucho<br>        def despl(vec):<br>
                run("sel #0")<br>                atoms=sele.currentAtoms()<br>                for a in atoms:<br>                       a.setCoord(a.xformCoord()-10*(vec))<br>        modes = NormalModes(self.universe)<br>
        for mode in modes:<br>            print mode<br>            print mode.array<br>        L1=[]<br>        L2=[]<br>        L3=[]<br>        for mode in modes:<br>               y=6<br>                u=len(mode.array)<br>
                while y<u:<br>                    L1.append(mode.array[y][0])<br>                    L2.append(mode.array[y][1])<br>                    L3.append(mode.array[y][2])<br>                    y+=1<br>        y=0<br>
        run("sel:all")<br>        atoms=sele.currentAtoms()<br>        run("~sel")<br>        u=len(L1)<br>        a=0<br>        o=len(atoms)<br>        while y<u:<br>                   vec=Vector(float(L1[y]),float(L2[y]),float(L3[y]))<br>
                   atoms[a].setCoord(atoms[a].coord()-(vec))<br>                   a+=1<br>            if a==o:<br>                a=0<br>                raw_input()<br>            else:<br>                pass<br>            y+=1<br>
        #JD's end<br>        return modes<br>        AmberData._normalizeName = saveNormalizeName<br>        timestamp("end _minimize")<br>    <br>####Function for mechanical constraint<br>    def NM_mcm(self, nsteps, stepsize=0.02,<br>
            interval=None, action=None, **kw):<br>        from MMTK import *<br>        from MMTK.Proteins import Protein<br>        from MMTK.ForceFields import Amber94ForceField<br>        from MMTK.NormalModes import NormalModes, SubspaceNormalModes<br>
        from MMTK.Subspace import RigidMotionSubspace<br>        from MMTK.Minimization import ConjugateGradientMinimizer<br>        from MMTK.Trajectory import StandardLogOutput<br>        import numpy<br>        # Victor Modifications<br>
        from chimera import replyobj<br>        timestamp("_minimize")<br>        from MMTK import Units<br>        from MMTK.ForceFields.Amber import AmberData<br>        from MMTK.Minimization import SteepestDescentMinimizer<br>
        from MMTK.Trajectory import LogOutput<br>        from MMTK.NormalModes import NormalModes<br>        from chimera import runCommand as run<br>        from chimera import selection as sele<br>        from chimera import Point, Vector<br>
        import os, sys<br>        #/end<br>        if not interval:<br>            actions = []<br>        else:<br>            actions = [ LogOutput(sys.stdout, ["energy"],<br>                        interval, None, interval) ]<br>
        kw["step_size"] = stepsize * Units.Ang<br>        minimizer = SteepestDescentMinimizer(self.universe,<br>                            actions=actions, **kw)<br>        if action is None or not interval:<br>
            interval = None<br>        msg = "Initial energy: %f" % self.universe.energy()<br>        replyobj.status(msg)<br>        <a href="http://replyobj.info">replyobj.info</a>(msg)<br>        saveNormalizeName = AmberData._normalizeName<br>
        AmberData._normalizeName = simpleNormalizeName<br>        remaining = nsteps<br>        while remaining > 0:<br>            timestamp(" minimize interval")<br>            if interval is None:<br>                realSteps = remaining<br>
            else:<br>                realSteps = min(remaining, interval)<br>            minimizer(steps=realSteps)<br>            remaining -= realSteps<br>            if action is not None:<br>                action(self)<br>
            timestamp(" finished %d steps" % realSteps)<br>            msg = "Finished %d of %d minimization steps" % (<br>                        nsteps - remaining, nsteps)<br>            replyobj.status(msg)<br>
            <a href="http://replyobj.info">replyobj.info</a>(msg)<br>        <a href="http://replyobj.info">replyobj.info</a>("\n")<br>        # Construct system<br>        #self.universe = InfiniteUniverse(Amber94ForceField())<br>
        #self.universe.protein = self.universe<br>        # Set up the subspace: rigid-body translation and rotation for each residue<br>        self.subspace = RigidMotionSubspace(self.universe, self.universe.protein.residues())<br>
<br><br><br>