Action: PRINT

Module generic
Description Usage
Print quantities to a file. used in 35 tutorialsused in 293 eggs
This action outputs data to a file. You can read more about how PLUMED manages output files here

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 scalar/vector/matrix the labels of the values that you would like to print to the file

Further details and examples

Print quantities to a file.

This command can be used to output quantities to a file. The following demonstrates a very simple example:

Click on the labels of the actions for more information on what each action computes
tested on2.11
d: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=d FILEthe name of the file on which to output these quantities=colvar

This command outputs the distance between atom 1 and 2 to a file called colvar every step of trajectory. If you want to output the distance less frequently you can use the STRIDE keyword as illustrated below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
d: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=d FILEthe name of the file on which to output these quantities=colvar STRIDE the frequency with which the quantities of interest should be output=10

With the input above the distance is only output on every 10th step. Notice this distance will only be calculated on every step as this quantity is not used on every other step.

You can also use the PRINT command to output objects that have a rank that is greater than zero. For example, the following input calculates a vector of three distances. These three distances are then output to the output colvar file every step.

Click on the labels of the actions for more information on what each action computes
tested on2.11
d: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMS1the pair of atom that we are calculating the distance between=1,2 ATOMS2the pair of atom that we are calculating the distance between=3,4 ATOMS3the pair of atom that we are calculating the distance between=5,6
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=d FILEthe name of the file on which to output these quantities=colvar

Alterantively, we can output a matrix by using an input like the one shown below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
d: DISTANCE_MATRIXCalculate a matrix of distances between atoms. This action has hidden defaults. More details GROUPthe atoms for which you would like to calculate the adjacency matrix=1-4
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=d FILEthe name of the file on which to output these quantities=colvar

The output colvar file here will contain the 16 elements of the matrix on each line output. You can also use PRINT to output functions on grids. However, you are probably better using DUMPGRID or DUMPCUBE to output functions on grids.

The PRINT directive can be used multiple times in the input so you can print files with different strides or print different quantities to different files as illustrated in the example input below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
# compute distance:
distance: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=2,5
# compute total energy (potential)
energy: ENERGYCalculate the total potential energy of the simulation box. More details
# print distance on a file
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=distance          STRIDE the frequency with which the quantities of interest should be output=10   FILEthe name of the file on which to output these quantities=COLVAR
# print both variables on another file
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=distance,energy   STRIDE the frequency with which the quantities of interest should be output=1000 FILEthe name of the file on which to output these quantities=COLVAR_ALL

The input above instructs plumed to print the distance between atoms 3 and 5 on a file called COLVAR every 10 steps, and the distance and total energy on a file called COLVAR_ALL every 1000 steps.

You can control the buffering of output using the FLUSH keyword. Furthermore, whether the output file is appended or backed up depends on whetehr or not the RESTART action is present on the file. If you add RESTART=yes on the line containing the PRINT directive the file will be appended also.

Printing happens in the so-called "update" phase. This implies that printing is affected by the presence of UPDATE_IF actions. One can thus decide to start and stop printing at preassigned values of time using the UPDATE_FROM and UPDATE_UNTIL keywords. Keep into account that even on steps when the action is not updated (and thus the file is not printed) the argument will be activated. In other words, if you use UPDATE_FROM to start printing at a given time, the collective variables this PRINT statement depends on will be computed also before that time.

Syntax

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 values that you would like to print to the file
STRIDE compulsory 1 the frequency with which the quantities of interest should be output
FILE optional not used the name of the file on which to output these quantities
FMT optional not used the format that should be used to output real numbers
RESTART optional not used allows per-action setting of restart (YES/NO/AUTO)
UPDATE_FROM optional not used Only update this action from this time
UPDATE_UNTIL optional not used Only update this action until this time