On Mar 23, 2005, at 14:14, Antonio Morreale wrote:
I'm new to pymol, and maybe the question is very basic, but I hope to
have your help. I would like to read grids files generated by in house
program, how can I do this within pymol?
If the data is defined on an equidistant grid, and if you can read
those files into a Python array using Python code, then yes.
Here is an example for a Python script that reads a grid file into
PyMOL. My "map" object has attributes data (a 3D array containing the
data points) and x_axis, y_axis, z_axis (1D arrays containing the
coordinate values). The script is executed using "run" from inside
PyMOL.
Konrad.
filename = 'helix/filt-nmsk.map'
mesh_levels = [0.4, 0.5, 0.6]
from MMTK import *
from chempy.brick import Brick
import Numeric as N
map = load(filename)
x = map.x_axis/Units.Ang
y = map.y_axis/Units.Ang
z = map.z_axis/Units.Ang
resolution_x = x[1]-x[0]
resolution_y = y[1]-y[0]
resolution_z = z[1]-z[0]
brik = Brick()
brik.setup_from_min_max(
[x[ 0], y[ 0], z[ 0]],
[x[-1], y[-1], z[-1]],
[resolution_x, resolution_y, resolution_z],
0.01)
print brik.lvl.shape
print map.data.shape
# bring all values into the interval [0..1]
brik.lvl[:, :, :] = map.data/N.maximum.reduce(N.ravel(map.data))
cmd.load_brick(brik,"density")
for level in mesh_levels:
cmd.do('isomesh s%d,density,%f' % (int(10.*level), level))