Skip to content

Action: FIND_SPHERICAL_CONTOUR

Module contour
Description Usage
Find an isocontour in a three dimensional grid by searching over a Fibonacci sphere. used in 0 tutorialsused in 0 eggs
output value type
a grid on a Fibonacci sphere that describes the radial distance from the origin for the points on the Willard-Chandler surface grid

Details and examples

Find an isocontour in a three dimensional grid by searching over a Fibonacci sphere.

As discussed in the documentation for the gridtools, PLUMED contains a number of tools that allow you to calculate a function on a grid. The function on this grid might be a HISTOGRAM or it might be one of the phase fields that are discussed here. If this function has one or two input arguments it is relatively straightforward to plot the function. If by contrast the data has a three dimensions it can be difficult to visualize.

This action provides one tool for visualizing these functions. It can be used to search for a set of points on a contour where the function takes a particular value. In other words, for the function this action would find a set of points that have:

where is some constant value that is specified by the user. The points on this contour are find by searching along a set of equally spaced radii of a sphere that centered at on particular, user-specified atom or virtual atom. To ensure that these search radii are equally spaced on the surface of the sphere the search directions are generated by using a Fibonacci spiral projected on a sphere. In other words, the search directions are given by:

where is the second component of the vector defined above, is the number of directions to look in and is

where is a random variable between 0 and that is generated during the read in of the input file and that is fixed during the whole calculation.

It is important to note that this action can only be used to detect contours in three dimensional functions. In addition, this action will fail to find the full set of contour points if the contour does not have the same topology as a sphere. If you are uncertain that the isocontours in your function have a spherical topology you should use FIND_CONTOUR instead.

Examples

The following input demonstrates how this action can be used. The input here is used to study the shape of a droplet that has been formed during the condensation of Lennard Jones from the vapor. The input below achieves this by calculating the coordination numbers, , of all the atoms within the gas. Obviously, those atoms within the droplet will have a large value for the coordination number while the isolated atoms in the gas will have a low value.

We can detect the sizes of the droplets by constructing a matrix whose element tells us whether atom and atom are within 6 nm of each other and both have coordination numbers that are greater that two. The atoms within the various droplets within the system can then be found by performing a DFSCLUSTERING on this matrix to detect the connected components. We can take the largest of these connected components and find the center of the droplet by exploiting the functionality within CENTER. We can then construct a phase field based on the positions of the atoms in the largest cluster and the values of the coordination numbers of these atoms as follows:

where is a switching function. The final line in the input then finds the a set of points on the dividing surface that separates the droplet from the surrounding gas. The value of the phase field on this isocontour is equal to 0.75.

Click on the labels of the actions for more information on what each action computes
tested on2.11
# Calculate coordination numbers
c1: COORDINATIONNUMBERCalculate the coordination numbers of atoms so that you can then calculate functions of the distribution of This action is a shortcut. More details SPECIESthe list of atoms for which the symmetry function is being calculated and the atoms that can be in the environments=1-512 SWITCHthe switching function that it used in the construction of the contact matrix. Options for this keyword are explained in the documentation for LESS_THAN.={EXP D_0=4.0 R_0=0.5 D_MAX=6.0}
# Select coordination numbers that are more than 2.0
cf: MORE_THANUse a switching function to determine how many of the input variables are more than a certain cutoff. More details ARGthe values input to this function=c1 SWITCHThis keyword is used if you want to employ an alternative to the continuous swiching function defined above={RATIONAL D_0=2.0 R_0=0.1}
# Build a contact matrix
c1_mat2: CONTACT_MATRIXAdjacency matrix in which two atoms are adjacent if they are within a certain cutoff. More details GROUPspecifies the list of atoms that should be assumed indistinguishable=1-512 SWITCHthe input for the switching function that acts upon the distance between each pair of atoms. Options for this keyword are explained in the documentation for LESS_THAN.={EXP D_0=4.0 R_0=0.5 D_MAX=6.0}
dp_mat: OUTER_PRODUCTCalculate the outer product matrix of two vectors This action has hidden defaults. More details ARGthe labels of the two vectors from which the outer product is being computed=cf,cf
# Build the final matrix
mat: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=c1_mat2,dp_mat FUNCthe function you wish to evaluate=x*y PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
# Find largest cluster
dfs: DFSCLUSTERINGFind the connected components of the matrix using the depth first search clustering algorithm. More details ARGthe input matrix=mat
clust1: CLUSTER_WEIGHTSSetup a vector that has one for all the atoms that form part of the cluster of interest and that has zero for all other atoms. More details CLUSTERSthe label of the action that does the clustering=dfs CLUSTER which cluster would you like to look at 1 is the largest cluster, 2 is the second largest, 3 is the the third largest and so on=1
# Find center of largest cluster
trans1: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=cf,clust1 FUNCthe function you wish to evaluate=x*x*y PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
cent: CENTERCalculate the center for a group of atoms, with arbitrary weights. This action is a shortcut. More details ATOMSthe group of atoms that appear in the definition of this center=1-512 WEIGHTSwhat weights should be used when calculating the center=trans1 PHASES use trigonometric phases when computing position of center
# Calculate the phase field of the coordination
dens_dist: DISTANCESCalculate the distances between multiple piars of atoms This action is a shortcut. More details ORIGINcalculate the distance of all the atoms specified using the ATOMS keyword from this point=cent ATOMSthe pairs of atoms that you would like to calculate the angles for=c1 COMPONENTS calculate the x, y and z components of the distance separately and store them as label
dens_numer: KDECreate a histogram from the input scalar/vector/matrix using KDE This action has hidden defaults. More details ...
   VOLUMESthis keyword take the label of an action that calculates a vector of values=trans1 ARGthe label for the value that should be used to construct the histogram=dens_dist.x,dens_dist.y,dens_dist.z
   GRID_BINthe number of bins for the grid=30,30,30 BANDWIDTHthe bandwidths for kernel density esimtation=2.0,2.0,2.0
...
dens_denom: KDECreate a histogram from the input scalar/vector/matrix using KDE This action has hidden defaults. More details ...
   VOLUMESthis keyword take the label of an action that calculates a vector of values=clust1 ARGthe label for the value that should be used to construct the histogram=dens_dist.x,dens_dist.y,dens_dist.z
   GRID_BINthe number of bins for the grid=30,30,30 BANDWIDTHthe bandwidths for kernel density esimtation=2.0,2.0,2.0
...
dens: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=dens_numer,dens_denom FUNCthe function you wish to evaluate=x/y PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
# Find the isocontour around the nucleus
sc: FIND_SPHERICAL_CONTOURFind an isocontour in a three dimensional grid by searching over a Fibonacci sphere. This action has hidden defaults. More details ARGthe labels of the grid in which the contour will be found=dens CONTOURthe value we would like to draw the contour at in the space=0.85 INNER_RADIUSthe minimum radius on which to look for the contour=10.0 OUTER_RADIUSthe outer radius on which to look for the contour=40.0 NPOINTSthe number of points for which we are looking for the contour=100
# And print the grid to a file
DUMPGRIDOutput the function on the grid to a file with the PLUMED grid format. More details ARGthe label for the grid that you would like to output=sc PRINT_XYZ output coordinates on fibonacci grid to xyz file FILE the file on which to write the grid=mysurface.xyz STRIDE the frequency with which the grid should be output to the file=1

Input

The arguments that serve as the input for this action are specified using one or more of the keywords in the following table.

Keyword Type Description
ARG grid the labels of the grid in which the contour will be found

Full list of keywords

The following table describes the keywords and options that can be used with this action

Keyword Type Default Description
ARG input none the labels of the grid in which the contour will be found
NPOINTS compulsory none the number of points for which we are looking for the contour
INNER_RADIUS compulsory none the minimum radius on which to look for the contour
OUTER_RADIUS compulsory none the outer radius on which to look for the contour
CONTOUR compulsory none the value we would like to draw the contour at in the space
INTERPOLATION_TYPE compulsory spline the method to use for interpolation
NBINS compulsory 1 the number of discrete sections in which to divide the distance between the inner and outer radius when searching for a contour
SERIAL optional false do the calculation in serial. Further information about this flag can be found here.
USEGPU optional false run this calculation on the GPU. Further information about this flag can be found here.

References

More information about how this action can be used is available in the following articles: