Action: FIND_CONTOUR
| Module |
contour |
| Description |
Usage |
| Find an isocontour in a smooth function. |
  |
Details and examples
Find an isocontour in a smooth function.
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 values. 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 detected using a variant
on the marching squares or marching cubes algorithm.
As such, and unlike FIND_CONTOUR_SURFACE or FIND_SPHERICAL_CONTOUR, the function input to this action is not required to have three arguments.
You can find a contour in any function with 2 or more arguments. Furthermore, the topology of the contour will be determined by the algorithm and does not need to be specified by the user.
Examples
The input shown below was used to analyze the results from a simulation of an interface between solid and molten Lennard Jones. The interface between
the solid and the liquid was set up in the plane perpendicular to the direction of the simulation cell. The input below calculates something
akin to a Willard-Chandler dividing surface (see contour) between the solid phase and the liquid phase. There are two of these interfaces within the
simulation box because of the periodic boundary conditions but we were able to determine that one of these two surfaces lies in a particular part of the
simulation box. The input below detects the height profile of one of these two interfaces. It does so by computing a phase field average from the transformed values, , of the
FCCUBIC symmetry functions for each of the atoms using the following expression.
where is the position of atom relative to the position of atom 1, is a switching function, is a Gaussian kernel function and .
The virtual atom that is computed using CENTER is located in the center of the region where the atoms are solid like and the positions of the atoms
are given relative to this position when computing the phase field in the expression above. This phase field provides a continuous function that
gives a measure of the average degree of solidness at each point in the simulation cell. The Willard-Chandler dividing surface is calculated by finding a a set of points
at which the value of this phase field is equal to 0.5. This set of points is output to file called mycontour.dat. A new contour
is found on every single step for each frame that is read in.
UNITSThis command sets the internal units for the code. More details NATURAL use natural units
The UNITS action with label calculates somethingfccThe FCCUBIC action with label fcc calculates the following quantities:| Quantity | Type | Description |
| fcc | vector | the symmetry function for each of the specified atoms |
: FCCUBICMeasure how similar the environment around atoms is to that found in a FCC structure. 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-96000 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.={CUBIC D_0=1.2 D_MAX=1.5}
ALPHA The alpha parameter of the angular function that is used for FCCUBIC=27 PHI The Euler rotational angle phi=0.0 THETA The Euler rotational angle theta=-1.5708 PSI The Euler rotational angle psi=-2.35619
...
# fcc: FCCUBIC ...
fcc_grpThe GROUP action with label fcc_grp calculates the following quantities:| Quantity | Type | Description |
| fcc_grp | atoms | indices of atoms specified in GROUP |
: GROUPDefine a group of atoms so that a particular list of atoms can be referenced with a single label in definitions of CVs or virtual atoms. More details ATOMSthe numerical indexes for the set of atoms in the group=1-96000
fcc_matThe CONTACT_MATRIX action with label fcc_mat calculates the following quantities:| Quantity | Type | Description |
| fcc_mat.w | matrix | a matrix containing the weights for the bonds between each pair of atoms |
| fcc_mat.x | matrix | the projection of the bond on the x axis |
| fcc_mat.y | matrix | the projection of the bond on the y axis |
| fcc_mat.z | matrix | the projection of the bond on the z axis |
: 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-96000 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.={CUBIC D_0=1.2 D_MAX=1.5} COMPONENTS also calculate the components of the vector connecting the atoms in the contact matrix
fcc_xrotThe CUSTOM action with label fcc_xrot calculates the following quantities:| Quantity | Type | Description |
| fcc_xrot | matrix | the matrix obtained by doing an element-wise application of an arbitrary function to the input matrix |
: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=fcc_mat.x,fcc_mat.y,fcc_mat.z FUNCthe function you wish to evaluate=-0.707104*x+2.59736e-06*y+0.70711*z PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
fcc_yrotThe CUSTOM action with label fcc_yrot calculates the following quantities:| Quantity | Type | Description |
| fcc_yrot | matrix | the matrix obtained by doing an element-wise application of an arbitrary function to the input matrix |
: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=fcc_mat.x,fcc_mat.y,fcc_mat.z FUNCthe function you wish to evaluate=0.70711*x+2.59734e-06*y+0.707104*z PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
fcc_zrotThe CUSTOM action with label fcc_zrot calculates the following quantities:| Quantity | Type | Description |
| fcc_zrot | matrix | the matrix obtained by doing an element-wise application of an arbitrary function to the input matrix |
: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=fcc_mat.x,fcc_mat.y,fcc_mat.z FUNCthe function you wish to evaluate=-0*x+1*y+-3.67321e-06*z PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
fcc_vfuncThe FCCUBIC_FUNC action with label fcc_vfunc calculates the following quantities:| Quantity | Type | Description |
| fcc_vfunc | matrix | the matrix obtained by doing an element-wise application of a function that measures the similarity with an fcc environment to the input matrix |
: FCCUBIC_FUNCMeasure how similar the environment around atoms is to that found in a FCC structure. More details ARGthe values input to this function=fcc_mat.x,fcc_mat.y,fcc_mat.z ALPHA The alpha parameter of the angular function=27
fcc_wvfuncThe CUSTOM action with label fcc_wvfunc calculates the following quantities:| Quantity | Type | Description |
| fcc_wvfunc | matrix | the matrix obtained by doing an element-wise application of an arbitrary function to the input matrix |
: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=fcc_vfunc,fcc_mat.w 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
fcc_onesThe CONSTANT action with label fcc_ones calculates the following quantities:| Quantity | Type | Description |
| fcc_ones | vector | the constant value that was read from the plumed input |
: ONESCreate a constant vector with all elements equal to one More details SIZEthe number of ones that you would like to create=96000
fccThe MATRIX_VECTOR_PRODUCT action with label fcc calculates the following quantities:| Quantity | Type | Description |
| fcc | vector | the vector that is obtained by taking the product between the matrix and the vector that were input |
: MATRIX_VECTOR_PRODUCTCalculate the product of the matrix and the vector More details ARGthe label for the matrix and the vector/scalar that are being multiplied=fcc_wvfunc,fcc_ones
fcc_denomThe MATRIX_VECTOR_PRODUCT action with label fcc_denom calculates the following quantities:| Quantity | Type | Description |
| fcc_denom | vector | the vector that is obtained by taking the product between the matrix and the vector that were input |
: MATRIX_VECTOR_PRODUCTCalculate the product of the matrix and the vector More details ARGthe label for the matrix and the vector/scalar that are being multiplied=fcc_mat.w,fcc_ones
fcc_nThe CUSTOM action with label fcc_n calculates the following quantities:| Quantity | Type | Description |
| fcc_n | vector | the vector obtained by doing an element-wise application of an arbitrary function to the input vectors |
: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=fcc,fcc_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
# --- End of included input ---
tfccThe LESS_THAN action with label tfcc calculates the following quantities:| Quantity | Type | Description |
| tfcc | vector | the vector obtained by doing an element-wise application of a function that is one if the input is less than a threshold to the input vectors |
: LESS_THANUse a switching function to determine how many of the input variables are less than a certain cutoff. More details ARGthe values input to this function=fcc SWITCHThis keyword is used if you want to employ an alternative to the continuous swiching function defined above={SMAP R_0=0.5 A=8 B=8}
centerThe ARGS2VATOM action with label center calculates the following quantities:| Quantity | Type | Description |
| center.x | scalar | the x coordinate of the virtual atom |
| center.y | scalar | the y coordinate of the virtual atom |
| center.z | scalar | the z coordinate of the virtual atom |
| center.mass | scalar | the mass of the virtual atom |
| center.charge | scalar | the charge of the virtual atom |
: 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-96000 WEIGHTSwhat weights should be used when calculating the center=tfcc
# center: CENTER ATOMS=1-96000 WEIGHTS=tfcc
center_mThe MASS action with label center_m calculates the following quantities:| Quantity | Type | Description |
| center_m | vector | the MASS of the atom/s |
: MASSGet the mass of one or multiple atoms More details ATOMSthe atom numbers that you would like to store the masses and charges of=1-96000
center_massThe SUM action with label center_mass calculates the following quantities:| Quantity | Type | Description |
| center_mass | scalar | the SUM of the elements in the input value |
: SUMCalculate the sum of the arguments More details PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO ARGthe vector/matrix/grid whose elements shuld be added together=center_m
center_qThe CHARGE action with label center_q calculates the following quantities:| Quantity | Type | Description |
| center_q | vector | the CHARGE of the atom/s |
: CHARGEGet the charges of one or multiple atoms More details ATOMSthe atom numbers that you would like to store the masses and charges of=1-96000
center_chargeThe SUM action with label center_charge calculates the following quantities:| Quantity | Type | Description |
| center_charge | scalar | the SUM of the elements in the input value |
: SUMCalculate the sum of the arguments More details PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO ARGthe vector/matrix/grid whose elements shuld be added together=center_q
center_wnormThe SUM action with label center_wnorm calculates the following quantities:| Quantity | Type | Description |
| center_wnorm | scalar | the SUM of the elements in the input value |
: SUMCalculate the sum of the arguments More details PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO ARGthe vector/matrix/grid whose elements shuld be added together=tfcc
center_weightsThe CUSTOM action with label center_weights calculates the following quantities:| Quantity | Type | Description |
| center_weights | vector | the vector obtained by doing an element-wise application of an arbitrary function to the input vectors |
: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=tfcc,center_wnorm 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
center_posThe POSITION action with label center_pos calculates the following quantities:| Quantity | Type | Description |
| center_pos.x | vector | the x-component of the atom position |
| center_pos.y | vector | the y-component of the atom position |
| center_pos.z | vector | the z-component of the atom position |
: POSITIONCalculate the components of the position of an atom or atoms. More details WHOLEMOLECULES if this is a vector of positions do you want to make the positions into a whole before ATOMSthe atom numbers that you would like to use the positions of=1-96000
center_xwvecThe CUSTOM action with label center_xwvec calculates the following quantities:| Quantity | Type | Description |
| center_xwvec | vector | the vector obtained by doing an element-wise application of an arbitrary function to the input vectors |
: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=center_weights,center_pos.x 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
center_ywvecThe CUSTOM action with label center_ywvec calculates the following quantities:| Quantity | Type | Description |
| center_ywvec | vector | the vector obtained by doing an element-wise application of an arbitrary function to the input vectors |
: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=center_weights,center_pos.y 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
center_zwvecThe CUSTOM action with label center_zwvec calculates the following quantities:| Quantity | Type | Description |
| center_zwvec | vector | the vector obtained by doing an element-wise application of an arbitrary function to the input vectors |
: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=center_weights,center_pos.z 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
center_xThe SUM action with label center_x calculates the following quantities:| Quantity | Type | Description |
| center_x | scalar | the SUM of the elements in the input value |
: SUMCalculate the sum of the arguments More details ARGthe vector/matrix/grid whose elements shuld be added together=center_xwvec PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
center_yThe SUM action with label center_y calculates the following quantities:| Quantity | Type | Description |
| center_y | scalar | the SUM of the elements in the input value |
: SUMCalculate the sum of the arguments More details ARGthe vector/matrix/grid whose elements shuld be added together=center_ywvec PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
center_zThe SUM action with label center_z calculates the following quantities:| Quantity | Type | Description |
| center_z | scalar | the SUM of the elements in the input value |
: SUMCalculate the sum of the arguments More details ARGthe vector/matrix/grid whose elements shuld be added together=center_zwvec PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
center: ARGS2VATOMCreate a virtual atom from the input scalars More details XPOSthe value to use for the x position of the atom=center_x YPOSthe value to use for the y position of the atom=center_y ZPOSthe value to use for the z position of the atom=center_z MASSthe value to use for the mass of the atom=center_mass CHARGEthe value to use for the charge of the atom=center_charge
# --- End of included input ---
dens_distThe DISTANCE action with label dens_dist calculates the following quantities:| Quantity | Type | Description |
| dens_dist.x | vector | the x-component of the vector connecting the two atoms |
| dens_dist.y | vector | the y-component of the vector connecting the two atoms |
| dens_dist.z | vector | the z-component of the vector connecting the two atoms |
: 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=center ATOMSthe pairs of atoms that you would like to calculate the angles for=1-96000 COMPONENTS calculate the x, y and z components of the distance separately and store them as label
# dens_dist: DISTANCES ORIGIN=center ATOMS=1-96000 COMPONENTS
dens_dist: DISTANCECalculate the distance/s between pairs of atoms. More details COMPONENTS calculate the x, y and z components of the distance separately and store them as label ATOMS1the pair of atom that we are calculating the distance between=center,1 ATOMS2the pair of atom that we are calculating the distance between=center,2 ATOMS3the pair of atom that we are calculating the distance between=center,3 ATOMS4the pair of atom that we are calculating the distance between=center,4 ATOMS5the pair of atom that we are calculating the distance between=center,5
# --- End of included input ---
dens_numerThe KDE action with label dens_numer calculates the following quantities:| Quantity | Type | Description |
| dens_numer | grid | a function on a grid that was obtained by doing a Kernel Density Estimation using the input arguments |
: 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=tfcc 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=80,80,80 BANDWIDTHthe bandwidths for kernel density esimtation=1.0,1.0,1.0
...
dens_numer: KDECreate a histogram from the input scalar/vector/matrix using KDE This action uses the defaults shown here. More details ...
VOLUMESthis keyword take the label of an action that calculates a vector of values=tfcc 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=80,80,80 BANDWIDTHthe bandwidths for kernel density esimtation=1.0,1.0,1.0
KERNEL the kernel function you are using=GAUSSIAN
...
dens_denomThe KDE action with label dens_denom calculates the following quantities:| Quantity | Type | Description |
| dens_denom | grid | a function on a grid that was obtained by doing a Kernel Density Estimation using the input arguments |
: KDECreate a histogram from the input scalar/vector/matrix using KDE This action has hidden defaults. More details ...
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=80,80,80 BANDWIDTHthe bandwidths for kernel density esimtation=1.0,1.0,1.0
...
dens_denom: KDECreate a histogram from the input scalar/vector/matrix using KDE This action uses the defaults shown here. More details ...
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=80,80,80 BANDWIDTHthe bandwidths for kernel density esimtation=1.0,1.0,1.0
KERNEL the kernel function you are using=GAUSSIAN
...
densThe CUSTOM action with label dens calculates the following quantities:| Quantity | Type | Description |
| dens | grid | the grid obtained by doing an element-wise application of an arbitrary function to the input grid |
: 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
contThe FIND_CONTOUR action with label cont calculates the following quantities:| Quantity | Type | Description |
| cont.dens_dist.x | vector | a vector of coordinates for the contour along the dens_dist.x direction |
| cont.dens_dist.y | vector | a vector of coordinates for the contour along the dens_dist.y direction |
| cont.dens_dist.z | vector | a vector of coordinates for the contour along the dens_dist.z direction |
: FIND_CONTOURFind an isocontour in a smooth function. 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.5
cont: FIND_CONTOURFind an isocontour in a smooth function. This action uses the defaults shown here. 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.5 BUFFER number of buffer grid points around location where grid was found on last step=0 INTERPOLATION_TYPE the method to use for interpolation=spline
DUMPCONTOURPrint the contour More details ARGthe labels of the FIND_CONTOUR action that you would like to output=cont FILE the file on which to write the grid=surface.xyz
Notice that with this method you have to use the DUMPCONTOUR action to output any contour you find to a file.
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 |
| 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 |
| BUFFER |
compulsory |
0 |
number of buffer grid points around location where grid was found on last step |
| 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:
- A. P. Willard, D. Chandler, Coarse-grained modeling of the interface between water and heterogeneous surfaces. Faraday Discuss. 141, 209–220 (2009)
- A. P. Willard, D. Chandler, Instantaneous Liquid Interfaces. The Journal of Physical Chemistry B. 114, 1954–1958 (2010)
- E. Baldi, M. Ceriotti, G. A. Tribello, Extracting the interfacial free energy and anisotropy from a smooth fluctuating dividing surface. Journal of Physics: Condensed Matter. 29, 445001 (2017)
- B. Cheng, M. Ceriotti, G. A. Tribello, Classical nucleation theory predicts the shape of the nucleus in homogeneous solidification. The Journal of Chemical Physics. 152 (2020)