-
-

New properties of Atoms

-
-

Summary

-

Pytim adds some new properties to the Atoms class of MDAnalysis.

+
+

New properties of Atoms

+
+

Summary

+

Pytim adds some new properties to the Atoms class of MDAnalysis.

This tutorial shows what they are and how to used them.

-
-
-

Background

+ +
+

Background

After computing for the first time the interfacial atoms/molecules in a system (this is true for classes like ITIM and GITIM, but not for WillardChandler) some new properties are added to all atoms in the universe: layers, clusters and, in case of ITIM, also sides.

-

Note that, differently from what happens in MDAnalysys, also some of the standard properties (e.g. radii, tempfactors, bfactors, elements) will always be associated to the atoms, even if the information is not present in the configuration file/trajectory (some heuristics is used by pytim to guess their values)

-
-
-

Layers

-

The value of atoms.layers can be either -1 (atom not in any of the layers) or 1, 2, 3,…, max_layers

-
>>> import numpy as np
+

Note that, differently from what happens in MDAnalysis, also some of the standard properties (e.g. radii, tempfactors, bfactors, elements) will always be associated to the atoms, even if the information is not present in the configuration file/trajectory (some heuristics is used by Pytim to guess their values)

+ +
+

Layers

+

The value of atoms.layers can be either -1 (atom not in any of the layers) or 1, 2, 3,…, max_layers

+
>>> import numpy as np
 >>> import MDAnalysis as mda
 >>> import pytim
->>> from   pytim.datafiles import WATER_GRO
+>>> from   pytim.datafiles import WATER_GRO
 
-
>>> u = mda.Universe(WATER_GRO)
+
>>> u = mda.Universe(WATER_GRO)
 >>> g = u.select_atoms('name OW')
 >>> inter = pytim.ITIM(u,group=g,max_layers=3)
->>> print np.unique(u.atoms.layers)
+>>> print (np.unique(u.atoms.layers))
+[-1  1  2  3]
 

This property can be used to select a particular subset of atoms, e.g.

-
>>> # select all hydrogens in the first layer
+
>>> # select all hydrogens in the first layer
 >>> condition = np.logical_and(u.atoms.layers == 1 , u.atoms.types=='H')
 >>> u.atoms[condition]
 <AtomGroup with 1048 atoms>
 
-
-
-

Clusters

-

The value of atoms.clusters can be -1 if the atom is not in a +

+
+

Clusters

+

The value of atoms.clusters can be -1 if the atom is not in a cluster (or not in the group for which the cluster search is performed) or 0,1,… if it belongs to the largest cluster, second-to-largest cluster, and so on, respectively.

For example, the benzene molecules in ILBENZENE_GRO are labelled automatically according to the cluster they belong when calling:

-
>>> import pytim
+
>>> import pytim
 >>> import MDAnalysis as mda
->>> from pytim.datafiles import ILBENZENE_GRO
+>>> from pytim.datafiles import ILBENZENE_GRO
 >>> import numpy as np
 >>> u = mda.Universe(ILBENZENE_GRO)
 >>> g = u.select_atoms('resname LIG')
->>> inter = pytim.ITIM(u,group=g,cluster_cut=7.5,cluster_threshold_density='auto')
+>>> inter = pytim.ITIM(u,group=g,cluster_cut=7.5,cluster_threshold_density='auto',normal=2)
 >>> np.sum(g.clusters==0)
 19200
 >>> np.sum(g.clusters==1)
@@ -112,26 +118,23 @@ 

Clusters10164

-

The option tempfactors of writepdb() +

The option tempfactors of writepdb() can be used to save to a pdb file, instead of the information about the layers (default), the cluster labels:

-
>>> inter.writepdb('/tmp/clusters.pdb',tempfactors=u.atoms.clusters)
+
>>> inter.writepdb('/tmp/clusters.pdb',tempfactors=u.atoms.clusters)
 

This results in the following (isolated molecules not shown)

- --- - -
_images/ILclusters.png + + +
_images/ILclusters.png
- -
-

Sides

+ +
+

Sides

The value of atoms.sides can be -1, 1, or 0 depending whether the atom is in one of the upper half layers, in the one of the lower half layers, or not in any layer. This properties is working only in ITIM.

@@ -147,10 +150,11 @@

Sides -

-
+ + +
@@ -159,8 +163,8 @@

Sides -

Table Of Contents

-

Tutorials

+

Table of Contents

+

Tutorials

-

Modules

+

Modules

-

Previous topic

-

Choosing the atomic radii

-

Next topic

-

ITIM

+
+

Previous topic

+

Choosing the atomic radii

+
+
+

Next topic

+

ITIM

+

This Page

    @@ -203,17 +212,15 @@

    This Page

- +
@@ -233,12 +240,13 @@

Navigation

  • previous |
  • - + + \ No newline at end of file diff --git a/docs/build/plot_directive/observables-1.hires.png b/docs/build/plot_directive/observables-1.hires.png index eef79cbd..2254708c 100644 Binary files a/docs/build/plot_directive/observables-1.hires.png and b/docs/build/plot_directive/observables-1.hires.png differ diff --git a/docs/build/plot_directive/observables-1.pdf b/docs/build/plot_directive/observables-1.pdf index 19240546..12f014d0 100644 Binary files a/docs/build/plot_directive/observables-1.pdf and b/docs/build/plot_directive/observables-1.pdf differ diff --git a/docs/build/plot_directive/observables-1.png b/docs/build/plot_directive/observables-1.png index 31dc5be6..35893d6a 100644 Binary files a/docs/build/plot_directive/observables-1.png and b/docs/build/plot_directive/observables-1.png differ diff --git a/docs/build/plot_directive/observables-2.hires.png b/docs/build/plot_directive/observables-2.hires.png index 5a925944..1344a969 100644 Binary files a/docs/build/plot_directive/observables-2.hires.png and b/docs/build/plot_directive/observables-2.hires.png differ diff --git a/docs/build/plot_directive/observables-2.pdf b/docs/build/plot_directive/observables-2.pdf index de4f6bb2..b44b91de 100644 Binary files a/docs/build/plot_directive/observables-2.pdf and b/docs/build/plot_directive/observables-2.pdf differ diff --git a/docs/build/plot_directive/observables-2.png b/docs/build/plot_directive/observables-2.png index 869dbb7f..e38a6fe1 100644 Binary files a/docs/build/plot_directive/observables-2.png and b/docs/build/plot_directive/observables-2.png differ diff --git a/docs/build/plot_directive/utilities-1.hires.png b/docs/build/plot_directive/utilities-1.hires.png index 6f2a3842..ea1dfc31 100644 Binary files a/docs/build/plot_directive/utilities-1.hires.png and b/docs/build/plot_directive/utilities-1.hires.png differ diff --git a/docs/build/plot_directive/utilities-1.pdf b/docs/build/plot_directive/utilities-1.pdf index 5f2c3215..88404e6f 100644 Binary files a/docs/build/plot_directive/utilities-1.pdf and b/docs/build/plot_directive/utilities-1.pdf differ diff --git a/docs/build/plot_directive/utilities-1.png b/docs/build/plot_directive/utilities-1.png index 25db9267..fa6d6aa1 100644 Binary files a/docs/build/plot_directive/utilities-1.png and b/docs/build/plot_directive/utilities-1.png differ