Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcello-Sega committed Jul 20, 2017
1 parent 8ec4f73 commit 7645889
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 41 deletions.
26 changes: 13 additions & 13 deletions docs/source/micelle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Some statistics
It's easy to calculate some simple statistical properties. For example, the percentage of atoms of DPC at the surface is

>>> print "percentage of atoms at the surface: {:.1f}".format(len(inter.layers[0])*100./len(g))
percentage of atoms at the surface: 37.4
percentage of atoms at the surface: 37.8

This is a rather high percentage, but is due to the small size of the micelle (large surface/volume ratio)

Expand All @@ -80,26 +80,26 @@ We can also easily find out which atom is more likely to be found at the surface
... surface = np.sum(inter.layers[0].names == name )
... print('{:>4s} ---> {:>2.0f}%'.format(name, surface*100./total))
C1 ---> 86%
C2 ---> 57%
C3 ---> 75%
C2 ---> 60%
C3 ---> 78%
N4 ---> 0%
C5 ---> 69%
C5 ---> 71%
C6 ---> 88%
O7 ---> 60%
P8 ---> 0%
O9 ---> 72%
O7 ---> 57%
P8 ---> 2%
O9 ---> 71%
O10 ---> 82%
O11 ---> 49%
C12 ---> 34%
C13 ---> 38%
C14 ---> 12%
C12 ---> 32%
C13 ---> 40%
C14 ---> 15%
C15 ---> 23%
C16 ---> 9%
C17 ---> 17%
C16 ---> 11%
C17 ---> 18%
C18 ---> 11%
C19 ---> 18%
C20 ---> 11%
C21 ---> 14%
C21 ---> 12%
C22 ---> 17%
C23 ---> 17%

Expand Down
41 changes: 14 additions & 27 deletions pytim/gitim.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"""

import numpy as np
from scipy.spatial import Delaunay
from scipy.spatial import distance
from pytim import utilities
import pytim
from pytetgen import Delaunay


class GITIM(pytim.PYTIM):
Expand All @@ -25,8 +25,6 @@ class GITIM(pytim.PYTIM):
(from GROMOS 43a1) will be used.
:param int max_layers: the number of layers to be identified
:param bool info: print additional info
:param bool multiproc: parallel version (default: True. \
Switch off for debugging)
Example:
Expand All @@ -43,7 +41,7 @@ class GITIM(pytim.PYTIM):
>>> layer = interface.layers[0]
>>> interface.writepdb('gitim.pdb',centered=False)
>>> print repr(layer)
<AtomGroup with 559 atoms>
<AtomGroup with 565 atoms>
"""
_surface = None
Expand All @@ -62,7 +60,6 @@ def __init__(
molecular=True,
extra_cluster_groups=None,
info=False,
multiproc=True,
centered=False,
**kargs):

Expand All @@ -87,13 +84,10 @@ def __init__(
if(self.symmetry == 'planar'):
sanity.assign_normal(normal)

self.grid = None
self.use_threads = False
self.use_kdtree = True
self.use_multiproc = multiproc

pytim.PatchTrajectory(universe.trajectory, self)

self._assign_layers()

self._atoms = self.LayerAtomGroupFactory(
self._layers[:].sum().indices, self.universe)

Expand Down Expand Up @@ -152,7 +146,8 @@ def circumradius(self, simplex):
# out of points alinged in the plane
return 0
else:
raise
raise RuntimeError(err.message)

v = r_i[1] - r_i[0]

A = - (rad_i[0] - np.dot(u, v))
Expand All @@ -179,21 +174,14 @@ def alpha_shape(self, alpha):
points, box, delta,method='3d'
)
# add points at the vertices of the expanded (by 2 alpha) box
for dim in range(8):
# [0,0,0],[0,0,1],[0,1,0],...,[1,1,1]
tmp = np.array(
np.array(
list(
np.binary_repr(
dim,
width=3)),
dtype=np.int8),
dtype=np.float)
tmp *= (box + delta)
tmp += gitter[dim] # added to prevent coplanar points
tmp[tmp < box / 2.] -= delta
tmp = np.reshape(tmp, (1, 3))
extrapoints = np.append(extrapoints, tmp, axis=0)
cube_vertices = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 1.0], [0.0, 1.0, 0.0],
[0.0, 1.0, 1.0], [1.0, 0.0, 0.0], [1.0, 0.0, 1.0],
[1.0, 1.0, 0.0], [1.0, 1.0, 1.0]])
for dim,vertex in enumerate(cube_vertices):
vertex = vertex * box + delta + gitter[dim] # added to prevent coplanar points
vertex [vertex < box / 2.] -= 2*delta
vertex = np.reshape(vertex, (1, 3))
extrapoints = np.append(extrapoints, vertex, axis=0)
extraids = np.append(extraids, -1)

# print utilities.lap()
Expand Down Expand Up @@ -236,7 +224,6 @@ def _assign_layers(self):
self.label_group(self.cluster_group.atoms, 0.0)

size = len(self.cluster_group.positions)
self._seen = np.zeros(size, dtype=np.int8)

alpha_ids = self.alpha_shape(self.alpha)

Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=['MDAnalysis>=0.15','PyWavelets>=0.5.2','numpy>=1.12.0','scipy>=0.18','scikit-image>=0.13.0','cython>=0.24.1','sphinx>=1.4.3','matplotlib'],
install_requires=['MDAnalysis>=0.15','PyWavelets>=0.5.2','numpy>=1.12.0',
'scipy>=0.18','scikit-image>=0.13.0','cython>=0.24.1',
'sphinx>=1.4.3','matplotlib','pytetgen'],

# List additional groups of dependencies here (e.g. development
# dependencies). You can install these using the following syntax,
Expand Down

0 comments on commit 7645889

Please sign in to comment.