3 cylindrical-density.py : compute the density of atoms ("targets") around
4 a centering selection, output a 2D histogram in
6 The expected use-case for this is looking at lipid packing around a membrane
7 protein, when for whatever region you want to average out the "polar"
10 For example, a command line could look like:
12 cylindrical-density.py sim.psf sim.dcd 'segid == "PROT"' 'segid =~ "PE" && \!hydrogen' -25 25 50 10 30 20
14 This would read the system info from sim.psf, and use the trajectory sim.dcd.
15 The system would be translated such that "PROT" is at the origin, and then
16 the density of all heavy atoms with segment names containing "PE" would be
17 computed. The z-range of the histogram would go from -25:25 with 50 bins,
18 and r-range would be 10:30 with 20 bins.
20 I highly suggest including the "&& \!hydrogen" part of the target selection,
21 since that will make the program run significantly faster without
22 substantially changing the information content (the slash in front of the "!"
23 may or may not be necessary, depending on which shell you use).
29 This file is part of LOOS.
31 LOOS (Lightweight Object-Oriented Structure library)
32 Copyright (c) 2013 Tod Romo, Grossfield Lab
33 Department of Biochemistry and Biophysics
34 School of Medicine & Dentistry, University of Rochester
36 This package (LOOS) is free software: you can redistribute it and/or modify
37 it under the terms of the GNU General Public License as published by
38 the Free Software Foundation under version 3 of the License.
40 This package is distributed in the hope that it will be useful,
41 but WITHOUT ANY WARRANTY; without even the implied warranty of
42 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43 GNU General Public License for more details.
45 You should have received a copy of the GNU General Public License
46 along with this program. If not, see <http://www.gnu.org/licenses/>.
header = " "
system_file = sys.argv
traj_file = sys.argv
centering_selection_string = sys.argv
target_selection_string = sys.argv
zmin = float(sys.argv)
zmax = float(sys.argv)
znum_bins = int(sys.argv)
rmin = float(sys.argv)
rmax = float(sys.argv)
rnum_bins = int(sys.argv)
zbin_width = (zmax - zmin) / znum_bins
rbin_width = (rmax - rmin) / rnum_bins
hist = numpy.zeros( [rnum_bins, znum_bins])
centroid = centering.centroid()
(zmin < z < zmax) and
(rmin2 < r2 < rmax2):
rbin = int((r - rmin)/ rbin_width)
zbin = int((z - zmin)/ zbin_width)
hist[rbin, zbin] += 1.0
rinner = rmin + i*rbin_width
router = rinner + rbin_width
rval = rmin + (i+0.5)*rbin_width
norm = math.pi * (router*router - rinner*rinner)
zval = zmin + (j+0.5)*zbin_width
rval, zval, hist[i,j] / norm
Python-based wrapper for LOOS Trajectories This class turns a loos Trajectory into something more pyt...
AtomicGroup selectAtoms(const AtomicGroup &source, const std::string selection)
Applies a string-based selection to an atomic group...
AtomicGroup createSystem(const std::string &filename, const std::string &filetype)