def DigestPdb(self):
     """   add atoms too self and 8 neighboring cubes. points except for water ###
     """
     self.pdb_water_head = pdb.Pdb()  ## used for visualizations
     self.pdb_water_head.AddMolecule()
     if self.pdb.cryst:
         self.cryst = self.pdb.cryst
         print "unit cell size: ", self.cryst
     else:
         print "Please provide the unit-cell size in self.cryst"
     num_atoms = self.pdb.NumOfAtoms()
     c = 0
     self.points_periodic = vtk.vtkPoints()
     self.points = vtk.vtkPoints()
     print "Digesting the input pdb ..."
     for atom in self.pdb:
         if atom.name.replace(" ","") not in ["W","WF","ROH","H1","H2","H3"] and\
            ( atom.GetMolNameGMX()[0]!="G" or atom.name.replace(" ","") not in ["C1","C2","C3"] ) :
             self.points.InsertNextPoint(atom.pos)
             for q in [-self.cryst[0], 0, self.cryst[0]]:
                 for p in [-self.cryst[1], 0, self.cryst[1]]:
                     for r in [-self.cryst[2], 0, self.cryst[2]]:
                         pos_aux = atom.pos + np.array([q, p, r])
                         self.points_periodic.InsertNextPoint(pos_aux)
             self.pdb_water_head.molecules[-1].AddAtom(atom.line)
         c += 1
         pdb.update_progress(float(c) / num_atoms)
     print "\n"
     self.polydata = vtk.vtkPolyData()
     self.polydata.SetPoints(self.points_periodic)
     ### initialize pointlocator ###
     self.pointlocator = vtk.vtkPointLocator()
     self.pointlocator.SetDataSet(self.polydata)
     self.pointlocator.SetNumberOfPointsPerBucket(10)
     self.pointlocator.BuildLocator()
    def __init__(self, file_in, traj_file=False, steps_input=5):
        self.color_series = vtk.vtkColorSeries()
        self.color_series.SetColorScheme(
            self.color_series.BREWER_SEQUENTIAL_YELLOW_ORANGE_BROWN_9
        )  #set the color theme

        if not traj_file:
            self.traj_mode = False
            if file_in[-3:] == "pdb":
                self.pdb = pdb.Pdb()
                self.pdb.ReadFileGMX(file_in)
                #self.pdb.BringToPositiveCorner()
                self.marching_cubes = False
                self.univ = False
            elif file_in[-3:] == "gro":
                self.univ = MDAnalysis.Universe(file_in)
        else:
            self.traj_mode = True
            self.univ = MDAnalysis.Universe(file_in, traj_file)
            self.univ_gro = MDAnalysis.Universe(
                file_in
            )  #only load gro file to read coordinates and velocities from. not trajectory
            self.steps = steps_input  # number of steps to consider in the analysis in the whole trajectory file.

        self.gauss_mean = True  # in gaussian curvature case = True / in mean curvature  case = False
        self.test = []
        self.test_lines = vtk.vtkCellArray()
        self.test_points = vtk.vtkPoints()
示例#3
0
import molar.pdb as p
import numpy as np
import random
m = p.Pdb("cernp24.pdb")

c1 = m.GetAtomByName("C2F")
c2 = m.GetAtomByName("C6F")

c3 = m.GetAtomByName("C4S")
c4 = m.GetAtomByName("C8S")

a1 = m.GetAtomByName("C2S")
a2 = m.GetAtomByName("C3S")

a3 = m.GetAtomByName("NF")
a4 = m.GetAtomByName("C1F")

a5 = m.GetAtomByName("C1F")
a6 = m.GetAtomByName("C2F")

###############


def Change(amp=10):
    alpha = amp * 2 * (random.random() - 0.5)
    beta = amp * 2 * (random.random() - 0.5)
    gamma = amp * 2 * (random.random() - 0.5)

    m.SelectBond(a2, a1)
    m.RotateBond(alpha)
示例#4
0
import molar.pdb as p
import numpy as np
import random
m = p.Pdb("cereos.pdb")

m.WriteOnFile(file_name_str="test.pdb", make_TER=False, include_CONECT=True)
示例#5
0
import molar.pdb as pdb
import vtk

cer = pdb.Pdb()
glu = pdb.Pdb()

cer.ReadFile(
    "/Users/alinar/Dropbox/The Project/MicroBio/molecule_pool/lip1.pdb")
glu.ReadFile(
    "/Users/alinar/Dropbox/The Project/MicroBio/molecule_pool/glucose.pdb")

c5 = glu.GetAtomsByName("C5")[0]
o6 = glu.GetAtomsByName("O6")[0]
c6 = cer.GetAtomsByName("C6")[0]
c7 = cer.GetAtomsByName("C7")[0]
o1 = cer.GetAtomsByName("O1")[0]
h49 = cer.GetAtomsByName("H49")[0]

v1 = o6.pos - c5.pos
v2 = o1.pos - h49.pos
v_pos = c7.pos - c6.pos

trans = pdb.RotateToParallel(v2, v1)
glu.ApplyTransform(trans)
trans.Identity()
trans.Translate(o1.pos - o6.pos)
#trans.Translate(1.0 * v_pos) #fine_tune
glu.RemoveAtom(o6)
glu.ApplyTransform(trans)
cer.RemoveAtom(h49)
result = pdb.MergePdb([cer, glu])