File: phimap_class.py

package info (click to toggle)
pdb2pqr 1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,576 kB
  • sloc: python: 24,897; sh: 12,005; cpp: 9,831; xml: 9,098; makefile: 355; ansic: 36
file content (63 lines) | stat: -rw-r--r-- 1,910 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import sys
sys.path.append('/Users/nielsen/bin/APBS/tools/python/vgrid')
from vgrid import *
NMAX=5

class phimap_class:

    def __init__(self,xmap,ymap,zmap):
        #print
        #print 'Reading initial Epsmaps'
        #print
        self.maps={}
        for name,emap in [['x',xmap],['y',ymap],['z',zmap]]:
            print 'Reading',emap
            data=[]
            value=0.0
            
            startVio()
            import sys
            from sys import stdout, stderr
            grid = Vgrid_ctor(0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, data)
            Vgrid_readDX(grid, "FILE", "ASC", "", emap)

            nx = grid.nx
            ny = grid.ny
            nz = grid.nz
            hx = grid.hx
            hy = grid.hy
            hzed = grid.hzed
            xmin = grid.xmin
            ymin = grid.ymin
            zmin = grid.zmin
            # Get the grid data
            grid_data=[]
            for k in range(nz):
                for j in range(ny):
                    for i in range(nx):                    
                        inval=0.0
                        pt = [xmin + i*hx, ymin + j*hy, zmin + k*hzed]
                        ret, value = Vgrid_value(grid, pt, inval)
                        grid_data.append(value)
                        if not ret:
                            raise Exception('Grid point not found')

#avg
        return grid_data


    def writemap(self,map,filename='tester.dx'):
        """Write this map in dx format"""
        mydata=[]
        #count=0
        
        #
        # Create the grid
        #
        #print mydata
        mygrid = Vgrid_ctor(map.nx, map.ny, map.nz,
                            map.hx, map.hy, map.hz,
                            map.xmin, map.ymin, map.zmin, mydata)
        Vgrid_writeDX(mygrid, "FILE", "ASC", "", filename,'What is this', null_array())
        delete_vgrid(mygrid)
        return