Exemple #1
0
        # translational eigenvectors
        x1 = np.zeros(coords.shape)
        x2 = x1.copy()
        x3 = x1.copy()
        x1.reshape(coords.size/3,3)[0:2,0] = 1.
        x2.reshape(coords.size/3,3)[0:2,1] = 1.
        x3.reshape(coords.size/3,3)[0:2,2] = 1.

        return [x1/np.linalg.norm(x1), x2/np.linalg.norm(x2), x3/np.linalg.norm(x3)]
        
    def findTS(self, coords):
        from pygmin.optimize import fire
        pot = gminpot.GMINPotential(GMIN)
        tau = np.random.random(coords.shape) - 0.5
        tau[-6:]=0.
        from pygmin import defaults
        import pygmin.optimize.transition_state.transition_state_refinement as tsr
        defaults.quenchParams["maxstep"]=0.01
        defaults.quenchParams["tol"]=1.e-4
        defaults.quenchRoutine = fire
        ret = dimer.findTransitionState(coords+1e-2*tau, pot, direction=tau, zeroEigenVecs=self.zeroEigenVecs, tol=1e-4, maxstep=0.01)
        #ret = tsr.findTransitionState(coords+1e-2*tau, pot, tol=1e-4)
        print "TS:",ret.energy
        m1,m2 = tstools.minima_from_ts(pot.getEnergyGradient, ret.coords, ret.eigenvec, displace=1e-1)
        print "Energies: ", m1[1],ret.energy,m2[1]
        return [ret.coords,ret.energy],m1,m2
               
if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(CrystalSystem)
Exemple #2
0
def run_gui(system, db=None):
    import pygmin.gui.run as gr
    gr.run_gui(system, db=db)
Exemple #3
0
def run_gui(system):
    import pygmin.gui.run as gr
    gr.run_gui(system)
Exemple #4
0
        super(LJSystem, self).__init__(self.natoms)
        self.params.gui.basinhopping_nsteps = 1000

    def get_optim_spawner(self, coords1, coords2):
        from pygmin.systems.spawn_OPTIM import SpawnOPTIM_LJ
        import os
        #        # TODO: this should be passable somehow
        #        optim = os.path.expanduser("~")+"/git/OPTIM/source/build/OPTIM"
        ##        optim = "OPTIM"
        optim = config.get("exec", "OPTIM")
        optim = os.path.expandvars(os.path.expanduser(optim))
        print "optim executable", optim
        return SpawnOPTIM_LJ(coords1, coords2, self, OPTIM=optim, tempdir=True)


class NewLJDialog(QtGui.QDialog, NewLJ.Ui_DialogLJSetup):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.setupUi(self)

    def natoms(self):
        return int(self.lineNatoms.text())

    def nsave(self):
        return int(self.lineNsave.text())


if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(LJSystem)
Exemple #5
0
from PyQt4 import QtGui
from ljsystem import NewLJDialog

from pygmin.systems import BLJCluster
 
class BLJSystem(BLJCluster):
    def __init__(self):
        dlg = NewLJDialog()
        dlg.exec_()
        self.natoms = dlg.natoms()
        super(BLJSystem, self).__init__(self.natoms)
        if dlg.result() == QtGui.QDialog.Rejected:
            raise BaseException("Aborted parameter dialog")

    
    def findTS(self, coords):
        raise NotImplementedError
        
if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(BLJSystem)
Exemple #6
0
def run_gui(system):
    import pygmin.gui.run as gr
    gr.run_gui(system)
Exemple #7
0
from PyQt4 import QtGui
from ljsystem import NewLJDialog

from pygmin.systems import BLJCluster


class BLJSystem(BLJCluster):
    def __init__(self):
        dlg = NewLJDialog()
        dlg.exec_()
        self.natoms = dlg.natoms()
        super(BLJSystem, self).__init__(self.natoms)
        if dlg.result() == QtGui.QDialog.Rejected:
            raise BaseException("Aborted parameter dialog")

    def findTS(self, coords):
        raise NotImplementedError


if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(BLJSystem)
Exemple #8
0
def rungui(system, db=None):
    import pygmin.gui.run as gr
    from pygmin.storage import Database
    gr.run_gui(system, db=db)
Exemple #9
0
import gmin_ as GMIN
from pygmin.potentials import GMINPotential
from pygmin.systems import LJCluster
import numpy as np

class GUPTASystem(LJCluster):
    def __init__(self):
        GMIN.initialize()
        self.natoms = GMIN.getNAtoms()
        super(GUPTASystem, self).__init__(self.natoms)

        qp = self.params.structural_quench_params
        qp["tol"]=1e-5
        qp["maxErise"]=1e-5
        qp["maxstep"]=0.1
        qp["iprint"]=-1
        qp["debug"]=False
        
        neb = self.params.double_ended_connect.local_connect_params.NEBparams
        neb["image_density"]=5
        neb["adjustk_freq"]=5

    
    def get_potential(self):
        return GMINPotential(GMIN)
    
if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(GUPTASystem)
Exemple #10
0
    def draw(self, coordsl, index):
        from OpenGL import GL,GLUT
        coords=coordsl.reshape(coordsl.size/3,3)
        #coords = coords.reshape(GMIN.getNAtoms, 3)
        com=np.mean(coords, axis=0)                  
        for xx in coords:
            x = xx-com
            GL.glPushMatrix()            
            GL.glTranslate(x[0],x[1],x[2])
            GLUT.glutSolidSphere(0.3,30,30)
            GL.glPopMatrix()

        # get bond list from amber params 
        mol = readAmb.readAmberParam()
        mol.populateBondConn() 
        
        # draw bonds  
        for atomPairs in mol.bondConn:
            xyz1 = coords[atomPairs[0]-1] - com  
            xyz2 = coords[atomPairs[1]-1] - com 
            self.drawCylinder(xyz1, xyz2)            
                     
    def createNEB(self, coords1, coords2):
        pot = gminpot.GMINPotental(GMIN)
        return NEB.NEB(coords1, coords2, pot, k = 100. ,nimages=20)

               
if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(molSystem)
Exemple #11
0
        ca1 = CoordsAdapter(nrigid=coords1.size/6, coords = coords1)
        ca2 = CoordsAdapter(nrigid=coords2.size/6, coords = coords2)
        rot = rmsfit.findrotation_kabsch(ca2.posRigid, ca1.posRigid)
        ca2.posRigid[:] = np.dot(rot,ca2.posRigid.transpose()).transpose()
        for p in ca2.rotRigid:
            p[:] = rotations.mx2aa((np.dot(rot, rotations.aa2mx(p))))
            
        print "before"
        print potential.getEnergy(coords1), potential.getEnergy(coords2)
        print ca2.rotRigid - ca1.rotRigid
        for p1,p2 in zip(ca1.rotRigid, ca2.rotRigid):
            p1[:],p2[:] = aamindist.aadistance(p1, p2)
        print "after"
        print potential.getEnergy(coords1), potential.getEnergy(coords2)
        print ca2.rotRigid - ca1.rotRigid
        path = InterpolatedPath(coords1, coords2, 40)
        print potential.getEnergy(path[0])
        print "Interpolated energies"
        for x in InterpolatedPath(coords1, coords2, 40):
            print potential.getEnergy(x)
        print "done"
        return coords1, coords2
    
    def createNEB(self, coords1, coords2):
        return NEB(InterpolatedPath(coords1, coords2, 40), GMINPotential(GMIN), k = 100.)
    
        
if __name__ == "__main__":
    GMIN.initialize()
    gr.run_gui(OXDNASystem)
Exemple #12
0
        self.render_scale = 0.1
        self.atom_types = system.get_atomtypes()

        self.draw_bonds = []
        for i in xrange(nrigid):
            self.draw_bonds.append((3 * i, 3 * i + 1))
            self.draw_bonds.append((3 * i, 3 * i + 2))

        return system

    def get_compare_exact(self, **kwargs):
        return ExactMatchAACluster(self.aasystem,
                                   accuracy=0.1,
                                   tol=0.07,
                                   **kwargs)

    def get_mindist(self, **kwargs):
        return MinPermDistAACluster(self.aasystem,
                                    accuracy=0.1,
                                    tol=0.07,
                                    **kwargs)

    def get_potential(self):
        return self.potential


if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(PAPSystem, db="pap.sqlite")
Exemple #13
0
        water = create_pap()
        
        system = RBTopology()
        system.add_sites([deepcopy(water) for i in xrange(nrigid)])
        self.potential = pot
        self.nrigid = nrigid
        
        self.render_scale = 0.1
        self.atom_types = system.get_atomtypes()
        
        self.draw_bonds = []
        for i in xrange(nrigid):
            self.draw_bonds.append((3*i, 3*i+1))
            self.draw_bonds.append((3*i, 3*i+2))
    
        return system
    
    def get_compare_exact(self, **kwargs):
        return ExactMatchAACluster(self.aasystem, accuracy=0.1, tol=0.07, **kwargs)
    
    def get_mindist(self, **kwargs):
        return MinPermDistAACluster(self.aasystem,accuracy=0.1, tol=0.07, **kwargs)
    
    def get_potential(self):
        return self.potential
    
if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(PAPSystem, db="pap.sqlite")
Exemple #14
0
def rungui(system, db=None):
    import pygmin.gui.run as gr
    from pygmin.storage import Database
    gr.run_gui(system, db=db)
Exemple #15
0
    def draw(self, coordsl, index):
        from OpenGL import GL, GLUT
        coords = coordsl.reshape(coordsl.size / 3, 3)
        #coords = coords.reshape(GMIN.getNAtoms, 3)
        com = np.mean(coords, axis=0)
        for xx in coords:
            x = xx - com
            GL.glPushMatrix()
            GL.glTranslate(x[0], x[1], x[2])
            GLUT.glutSolidSphere(0.3, 30, 30)
            GL.glPopMatrix()

        # get bond list from amber params
        mol = readAmb.readAmberParam()
        mol.populateBondConn()

        # draw bonds
        for atomPairs in mol.bondConn:
            xyz1 = coords[atomPairs[0] - 1] - com
            xyz2 = coords[atomPairs[1] - 1] - com
            self.drawCylinder(xyz1, xyz2)

    def createNEB(self, coords1, coords2):
        pot = gminpot.GMINPotental(GMIN)
        return NEB.NEB(coords1, coords2, pot, k=100., nimages=20)

if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(molSystem)
Exemple #16
0
from pygmin.amber import amberSystem 

# create new amber system
sys   = amberSystem.AMBERSystem('coords.prmtop', 'coords.inpcrd')        

#start the gui 
from pygmin.gui import run as gr    
gr.run_gui(sys)
Exemple #17
0
                GL.glTranslate( X1[0], X1[1], X1[2] )
                GL.glRotate( a, t[0], t[1], t[2] )
                GLUT.glutSolidCone(.2,r,30,30)  #I can't seem to draw a cylinder
                GL.glPopMatrix()
         



    def Align(self, coords1, coords2):
        from pygmin.mindist.minpermdist_rbmol import minPermDistRBMol as minpermdist
        dist, X1, X2 = minpermdist( coords1, coords2, self.mysys, niter = 100 )
        return X1, X2
    
    def createNEB(self, coords1, coords2):
        return NEB.NEB(coords1, coords2, self.mysys, k = 100., nimages=20)

       

class NewLJDialog(QtGui.QDialog,NewLJ.Ui_DialogLJSetup):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.setupUi(self)
    def natoms(self):
        return int(self.lineNatoms.text())
    def nsave(self):
        return int(self.lineNsave.text())
        
if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(RBSystem)
Exemple #18
0
#print 'GMIN POTENTIAL' 
#sys   = AMBERSystem_GMIN('coords.prmtop', 'coords.inpcrd')        
#sys.test_potential('coords.pdb')

# openmm potential is ~6x slower than gmin potential 
print 'OPENmm POTENTIAL' 
sys  = AMBERSystem_OpenMM('coords.prmtop', 'coords.inpcrd')
sys.test_potential('coords.pdb')

# create new database  
from pygmin.storage import Database
dbcurr = sys.create_database()
                    
# ------- TEST gui 
from pygmin.gui import run as gr    
gr.run_gui(sys, db=dbcurr)

# ------ Test potential 
sys.test_potential('coords.pdb')
    
# ------ BH 
start = time.clock()
sys.test_BH(dbcurr)
elapsed = (time.clock() - start)
print "time taken by BH = ", elapsed 

exit() 
# ------- Connect runs 
sys.test_connect(dbcurr)  
    
# ------- Disconn graph  
Exemple #19
0
 
 # create new amber system    
 sysAmb  = AMBERSystem('/home/ss2029/WORK/PyGMIN/examples/amber/coords.prmtop', '/home/ss2029/WORK/PyGMIN/examples/amber/coords.inpcrd')
 
 # load existing database 
 from pygmin.storage import Database
 dbcurr = Database(db="/home/ss2029/WORK/PyGMIN/examples/amber/aladipep.db")
                     
 
 coords = sysAmb.get_random_configuration()
 aa = sysAmb.get_metric_tensor(coords)
 
 exit()  
 # ------- TEST gui 
 from pygmin.gui import run as gr    
 gr.run_gui(sysAmb)
 
 # ------ Test potential 
 sysAmb.test_potential('coords.pdb')
 
 # ------ BH 
 sysAmb.test_BH(dbcurr)
 
 # ------- Connect runs 
 sysAmb.test_connect(dbcurr)  
 
 # ------- Disconn graph  
 sysAmb.test_disconn_graph(dbcurr)  
 
 # ------- Test mindist  
 sysAmb.test_mindist( dbcurr)
Exemple #20
0
        dlg.exec_()
        self.natoms = dlg.natoms()
        if dlg.result() == QtGui.QDialog.Rejected:
            raise BaseException("Aborted parameter dialog")
        super(LJSystem, self).__init__(self.natoms)
    
    def get_optim_spawner(self, coords1, coords2):
        from pygmin.systems.spawn_OPTIM import SpawnOPTIM_LJ
        import os
#        # TODO: this should be passable somehow
#        optim = os.path.expanduser("~")+"/git/OPTIM/source/build/OPTIM"
##        optim = "OPTIM"
        optim = config.get("exec", "OPTIM")
        optim = os.path.expandvars(os.path.expanduser(optim))
        print "optim executable", optim
        return SpawnOPTIM_LJ(coords1, coords2, self, OPTIM=optim, tempdir=True)


class NewLJDialog(QtGui.QDialog,NewLJ.Ui_DialogLJSetup):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        self.setupUi(self)
    def natoms(self):
        return int(self.lineNatoms.text())
    def nsave(self):
        return int(self.lineNsave.text())
        
if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(LJSystem)
Exemple #21
0
        pot = GMINPotential(GMIN)
        coords = pot.getCoords()        
        nrigid = coords.size / 6

        print "I have %d water molecules in the system"%nrigid
        print "The initial energy is", pot.getEnergy(coords)

        water = tip4p.water()
        
        system = RBTopology()
        system.add_sites([deepcopy(water) for i in xrange(nrigid)])
        self.potential = pot
        self.nrigid = nrigid
        
        self.render_scale = 0.3
        self.atom_types = system.get_atomtypes()
        
        self.draw_bonds = []
        for i in xrange(nrigid):
            self.draw_bonds.append((3*i, 3*i+1))
            self.draw_bonds.append((3*i, 3*i+2))
    
        return system
    
    def get_potential(self):
        return self.potential
    
if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(TIP4PSystem, db="tip4p_8.sqlite")
Exemple #22
0
        for xx in coords:
            if(i%3 == 0):
                color = [1.0, 0.0, 0.0]
                radius = 0.35
            else:
                color = [1.0, 1.0, 1.0]
                radius = 0.3
            if index == 2:
                color = [0.5, 1.0, .5]                
            
            i+=1
            GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, color)
            
            x=xx-com
            GL.glPushMatrix()            
            GL.glTranslate(x[0],x[1],x[2])
            GLUT.glutSolidSphere(radius,30,30)
            GL.glPopMatrix()
        
        for i in xrange(self.nrigid):
            color = [1.0, 0.0, 0.0]
            if index == 2:
                color = [0.5, 1.0, .5]                
            GL.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, color)
            self.drawCylinder(coords[3*i]-com, coords[3*i+1]-com)
            self.drawCylinder(coords[3*i]-com, coords[3*i+2]-com)
            
if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(TIP4PSystem)
Exemple #23
0
def run_gui(system, db=None):
    import pygmin.gui.run as gr
    gr.run_gui(system, db=db)
Exemple #24
0
        coords = pot.getCoords()
        nrigid = coords.size / 6

        print "I have %d water molecules in the system" % nrigid
        print "The initial energy is", pot.getEnergy(coords)

        water = tip4p.water()

        system = RBTopology()
        system.add_sites([deepcopy(water) for i in xrange(nrigid)])
        self.potential = pot
        self.nrigid = nrigid

        self.render_scale = 0.3
        self.atom_types = system.get_atomtypes()

        self.draw_bonds = []
        for i in xrange(nrigid):
            self.draw_bonds.append((3 * i, 3 * i + 1))
            self.draw_bonds.append((3 * i, 3 * i + 2))

        return system

    def get_potential(self):
        return self.potential


if __name__ == "__main__":
    import pygmin.gui.run as gr
    gr.run_gui(TIP4PSystem, db="tip4p_8.sqlite")
Exemple #25
0
 
 # create new amber system    
 sysAmb  = AMBERSystem('/home/ss2029/WORK/PyGMIN/examples/amber/coords.prmtop', '/home/ss2029/WORK/PyGMIN/examples/amber/coords.inpcrd')
 
 # load existing database 
 from pygmin.storage import Database
 dbcurr = Database(db="/home/ss2029/WORK/PyGMIN/examples/amber/aladipep.db")
                     
 
 coords = sysAmb.get_random_configuration()
 aa = sysAmb.get_metric_tensor(coords)
 
 exit()  
 # ------- TEST gui 
 from pygmin.gui import run as gr    
 gr.run_gui(sysAmb)
 
 # ------ Test potential 
 sysAmb.test_potential('coords.pdb')
 
 # ------ BH 
 sysAmb.test_BH(dbcurr)
 
 # ------- Connect runs 
 sysAmb.test_connect(dbcurr)  
 
 # ------- Disconn graph  
 sysAmb.test_disconn_graph(dbcurr)  
 
 # ------- Test mindist  
 sysAmb.test_mindist( dbcurr)