示例#1
0
def init():
    display.set(size=[1024,768])
    display.set(projection='Perspective')
    color.set_colormap('Display',{'Background': 'white'})
    axes.set_location('OFF')
    display.set(depthcue=False)
    display.set(nearclip=0.01)
    for m in molecule.listall():
        molecule.delete(m)
    def ssrecalcu(molid, frame):
        molecule.ssrecalc(molid)
示例#2
0
            #load the O atom from O.pdb
            O=load('pdb','O.pdb')

            #Move the O atom into the right place
            all=atomsel()
            all.moveby([x,y,z0])
            
            #Set resid to 0 (for now, doesn't matter, just needs to be something
            # so that the simulation program isn't unhappy
            all=atomsel()
            all.set('resid',0)
   

#So far we have 26 molecfules (1 graphene, 25 O).  We need to combine them into one thing
#so that we can treat them together. We use topotools to do this
combined=evaltcl('::TopoTools::mergemols %s'%list2tcl(molecule.listall()))


import animate

#Set the segname of everything to CNT (doesn't matter now, just to make sim happy)
all=atomsel()
all.set('segname','CNT')
all.set('resname','CNT')

#Set the occupacy of everything to 0
all.set('occupancy',0)

#Set the occupancy of just the CA atoms to 1, which we'll use as a flag to keep them fixed
all=atomsel('type CA')
all.set('occupancy',1)
示例#3
0
def moleculeList():
  """ Returns a Molecule instance for all current molecules. """
  return [Molecule(id=id) for id in molecule.listall()]
示例#4
0
    def __init__(self, changes, molid, vmd_frames, window, label_before_after, 
            observable):
        if molid not in molecule.listall():
            raise RuntimeError, "Invalid molid %d" % molid
        self.molid = molid
        self.tk = timekeeper(molid)
        self.tk.register(self)

        self.disp_h = False
        self.changes = {}
        for time, change in changes.items():
            # Map change time (frame in original trajectory file) to VMD frame
            if vmd_frames is None:
                vmd_time = time + 1
            else:
                if len(vmd_frames) != 4 or vmd_frames[0] >= vmd_frames[1] or \
                        vmd_frames[0] < 0 or vmd_frames[2] < 1:
                    raise RuntimeError, "Invalid vmd_frames input"
                vmd_time = (float(time) - vmd_frames[0]) / vmd_frames[2]
                if vmd_time < 0 or vmd_time > vmd_frames[1]:
                    continue
                if vmd_frames[3]:
                    vmd_time += 1
            self.changes[vmd_time]=change
            for pair in change:
                a0_all = self._info_to_ids(pair[0])
                a1_all = self._info_to_ids(pair[1])
                for a0 in a0_all:
                    for a1 in a1_all:
                        if atomsel('index %d' % a0).get('element') == 'H' and \
                                'C' not in atomsel('withinbonds 1 of index %d'
                                        % a0).get('element'):
                            self.disp_h = True
                        if atomsel('index %d' % a1).get('element') == 'H' and \
                                'C' not in atomsel('withinbonds 1 of index %d'
                                        % a1).get('element'):
                            self.disp_h = True
        self.change_times = sorted(self.changes.keys())
        self.loaded_frames = False

        # To display residues and lines in VMD
        self.window = window
        self.label_before_after = label_before_after
        self.pairs = []
        self.gray_res_sels = []
        self.color_res_sels = []
        molrep.addrep(self.molid, style='Licorice', color='ColorID 2',
                selection='none', material='Opaque')
        self.gray_rep = molrep.get_repname(self.molid, molrep.num(self.molid)-1)
        molrep.addrep(self.molid, style='Licorice', color='Element',
                selection='none', material='Opaque')
        self.color_rep = molrep.get_repname(self.molid, molrep.num(self.molid)-1)

        # To plot an indicator variable with a moving line
        self.fig = None
        self.ax = None
        self.line = None
        self.observable = observable
        if observable is not None:
            ymin = min(observable)
            ymax = max(observable)
            self.ylim = (1.1 * ymin - 0.1 * ymax, 1.1 * ymax - 0.1 * ymin)
        else:
            self.ylim = (0,2)
示例#5
0
def moleculeList():
    """ Returns a Molecule instance for all current molecules. """
    return [Molecule(id=id) for id in molecule.listall()]