Commits

Adrien Saladin committed 5b88859

added PairList interface. An Attract systematic docking now works

  • Participants
  • Parent commits 5aa1ebd

Comments (0)

Files changed (5)

File PyAttract/attract.py

     return i
 
 def rmsdca(l1,l2):
-    return Rmsd(l1.CA(), l2.CA())
+    return Rmsd(l1.CA().CreateRigid(), l2.CA().CreateRigid())
 
 
 def compress_file(filename):
         mat.append(line)
 
     out=AttractRigidbody(rigid)
-    for i in range(rigid.Size()):
+    for i in range(len(rigid)):
         coords=rigid.getCoords(i)
         coords2=Coord3D()
         coords2.x = mat[0][0]*coords.x + mat[0][1]*coords.y + mat[0][2]*coords.z + mat[0][3]
 if (options.reffile):
     checkFile(options.reffile, "")
     ref=Rigidbody(options.reffile)
-    print "Reading reference file: %s with %d particules" %( options.reffile, ref.Size() )
+    print "Reading reference file: %s with %d particules" %( options.reffile, len(ref) )
     refca = ref.CA()
-    if refca.Size() == 0:  #No C alpha atom, ligand is probably a dna
+    if len(refca) == 0:  #No C alpha atom, ligand is probably a dna
         Rmsd_alias = Rmsd
         print "No Calpha atom found for ligand (DNA?). RMSD will be calculated on all grains"
     else:
 include "rigidbody.pyx"
 include "pdbio.pyx"
 include "surface.pyx"
+include "pairlist.pyx"
 include "attractrigidbody.pyx"
 include "atomselection.pyx"
 include "attractforcefield.pyx"

File attractforcefield.pyx

         void AddLigand(CppAttractRigidbody &)
         double getVdw()
         double getCoulomb()
-        
+        double nonbon8(CppAttractRigidbody& , CppAttractRigidbody& , CppAttractPairList & , int) 
         
         
     
        double Function(vector[double]&)
        double getVdw()
        double getCoulomb()
+       
 
 
 cdef class AttractForceField1(BaseAttractForceField):
     def getCoulomb(self):
         return self.thisptr.getCoulomb()
 
+    def nonbon8(self, AttractRigidbody rec, AttractRigidbody lig, AttractPairList pl, verbose=False):
+        return self.thisptr.nonbon8(deref(rec.thisptr), deref(lig.thisptr), deref(pl.thisptr), verbose)
+

File attractrigidbody.pyx

         #returns the radius of a Rigidbody (max distance from center)
         double Radius()
 
+        void PrintMatrix()
+
+        CppAtomSelection CA()
+
 
 
 cdef CppAttractRigidbody* _getAttractRigidbody_from_py_name(pyname):
         rig.AttractEulerRotate(phi, ssi, rot)
 
 
+    #these function should be defined only in Rigdibody object and attractrigdbody should inherit from it:œ
+
     def Radius(self):
        return self.thisptr.Radius()
 
     def RadiusGyration(self):
-       return self.thisptr.RadiusGyration()      
+       return self.thisptr.RadiusGyration()      
+
+
+    def PrintMatrix(self):
+       self.thisptr.PrintMatrix()
+
+    def CA(self):
+       ret = AtomSelection()
+       del ret.thisptr
+       cdef CppAtomSelection new_sel =  self.thisptr.CA()
+       ret.thisptr  = new CppAtomSelection(new_sel)
+       return ret

File pairlist.pyx

+from cython.operator cimport dereference as deref
+from libcpp.string cimport string
+
+
+cdef extern from "pairlist.h" namespace "PTools":
+    cdef cppclass CppAttractPairList "PTools::AttractPairList":
+       CppAttractPairList()
+       CppAttractPairList(CppAttractRigidbody &, CppAttractRigidbody &, double )
+       CppAttractPairList(CppAttractRigidbody &, CppAttractRigidbody & )
+
+
+
+cdef class AttractPairList:
+    cdef CppAttractPairList * thisptr
+
+    def __cinit__(self, *args):
+        self.thisptr = <CppAttractPairList*> 0
+        if len(args) == 0: 
+            self.thisptr = new CppAttractPairList()
+        if isinstance(args[0], AttractRigidbody) and isinstance(args[1], AttractRigidbody):
+            r1 = <AttractRigidbody> args[0]
+            r2 = <AttractRigidbody> args[1]
+
+            if len(args) == 2:
+               self.thisptr = new CppAttractPairList(deref(r1.thisptr), deref(r2.thisptr))
+               return
+            if len(args) == 3 :
+               self.thisptr = new CppAttractPairList(deref(r1.thisptr), deref(r2.thisptr), <double?> args[2] )
+               return
+        raise TypeError("arguments error in AttractPairList.__cinit__()")
+          
+
+    def __dealloc__(self):
+        if self.thisptr:
+            del self.thisptr
+
+
+
+