Skip to content

Commit

Permalink
Make grid keywords singular
Browse files Browse the repository at this point in the history
  • Loading branch information
jhenin committed Sep 23, 2024
1 parent 1b71d4d commit 3a40dbb
Show file tree
Hide file tree
Showing 17 changed files with 67 additions and 58 deletions.
29 changes: 19 additions & 10 deletions doc/colvars-refman-main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4203,6 +4203,7 @@
Many algorithms require the definition of two boundaries and a bin width for each colvar, which are necessary to compute discrete ``states'' for a collective variable's otherwise continuous values.
The following keywords define these parameters for a specific variable, and will be used by all bias that refer to that variable unless otherwise specified.
Some of these parameters can be set directly within a bias configuration by inserting a \refkey{grid}{sec:colvarbias_grid} block (\ref{sec:colvarbias_grid}).
\begin{itemize}
Expand Down Expand Up @@ -5232,22 +5233,30 @@
\cvsubsec{Defining grids for biasing and analysis methods}{sec:colvarbias_grid}
Several methods (\hyperlink{sec:colvarbias_histogram}{histograms}, \hyperlink{sec:colvarbias_abf}{ABF} and \hyperlink{sec:colvarbias_abf_extended}{eABF}, optionally \hyperlink{sec:colvarbias_metadynamics}{metadynamics}) rely on discretizing colvars on regular grids to represent functions such as probability distributions or free energy surfaces.
Grid parameters for these may be provided at the level of the individual variables, or via a dedicated configuration block \texttt{grid \{ \ldots \}} inside the configuration of the bias.
Grid parameters for these may be provided at the level of the individual variables (\ref{sec:colvar_grid_params}), or via a dedicated configuration block \texttt{grid \{ \ldots \}} inside the configuration of the bias.
The options supported \emph{inside this block} are:
\begin{itemize}
\item %
\key{%
lowerBoundaries}{%
lowerBoundary}{%
\texttt{grid}}{%
Lower boundaries of the grid}{%
list of space-separated decimals}{%
This option defines the lower boundaries of the grid, overriding any values defined by the \texttt{lowerBoundary} keyword of each colvar.
This option is specified once, and takes as many parameters as there are colvars associated with this bias.
It defines the lower boundaries of the grid, overriding any values defined by the \refkey{lowerBoundary}{colvar|lowerBoundary} keyword of each colvar.
}
\item %
\simkey{upperBoundaries}{\texttt{grid}}{lowerBoundaries}
\simkey{upperBoundary}{\texttt{grid}}{lowerBoundary}
\item %
\simkey{widths}{\texttt{grid}}{lowerBoundaries}
\key{%
lowerBoundary}{%
\texttt{grid}}{%
Bin widths of the grid}{%
list of space-separated decimals}{%
This option is specified once, and takes as many parameters as there are colvars associated with this bias.
It defines the bin widths of the grid along each dimension, overriding any values defined by the \refkey{width}{colvar|width} keyword of each colvar.
}
\end{itemize}
Expand Down Expand Up @@ -5454,7 +5463,7 @@
\cvsubsubsec{Parameters for ABF}{sec:colvarbias_abf_params}
ABF depends on parameters from each collective variable to define the grid on which free energy gradients are computed: see \ref{sec:colvar_grid_params} for details.
Alternately, grid parameters can be set directly inside the ABF block by inserting a \texttt{grid} sub-block, as explained in \ref{sec:colvarbias_histogram_grid}.
Alternately, grid parameters can be set directly inside the ABF block by inserting a \texttt{grid} sub-block, as explained in \ref{sec:colvarbias_grid}.
Other parameters to control the ABF runtime can be set in the ABF configuration block:
\begin{itemize}
Expand Down Expand Up @@ -7144,15 +7153,15 @@
\-\-~~name~hist2d\\
\-\-~~colvars~r~theta\\
\-\-~~grid~\{\\
\-\-~~~~widths~~0.1~1.0\\
\-\-~~~~lowerBoundaries~~~2.0~30.0\\
\-\-~~~~upperBoundaries~~10.0~90.0\\
\-\-~~~~width~~0.1~1.0\\
\-\-~~~~lowerBoundary~~~2.0~30.0\\
\-\-~~~~upperBoundary~~10.0~90.0\\
\-\-~~\}\\
\-\}\\
\end{cvexampleinput}
The standard keywords below are used to control the histogram's computation and to select the variables that are sampled. See also \ref{sec:colvarbias_histogram_grid} for keywords used to define the grid, \ref{sec:colvarbias_histogram_output} for output parameters and \ref{sec:colvarbias_histogram_vectors} for more advanced keywords.
The standard keywords below are used to control the histogram's computation and to select the variables that are sampled. See also \ref{sec:colvarbias_grid} for keywords used to define the grid, \ref{sec:colvarbias_histogram_output} for output parameters and \ref{sec:colvarbias_histogram_vectors} for more advanced keywords.
\begin{itemize}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ colvar {
histogram {
colvars r phi
grid {
widths 0.2 6.0
lowerBoundaries 0.0 0.0
upperBoundaries 10.0 360.0
width 0.2 6.0
lowerBoundary 0.0 0.0
upperBoundary 10.0 360.0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ colvar {
histogram {
colvars r phi
grid {
widths 0.2 6.0
lowerBoundaries 0.0 0.0
upperBoundaries 10.0 360.0
width 0.2 6.0
lowerBoundary 0.0 0.0
upperBoundary 10.0 360.0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ colvar {
histogram {
colvars one
grid {
widths 0.2
lowerBoundaries 0.6
upperBoundaries 5.4
width 0.2
lowerBoundary 0.6
upperBoundary 5.4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ colvar {
histogram {
colvars one
grid {
widths 5
lowerBoundaries -60
upperBoundaries 300
width 5
lowerBoundary -60
upperBoundary 300
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ colvar {
histogram {
colvars r phi
grid {
widths 0.2 6.0
lowerBoundaries 0.0 0.0
upperBoundaries 10.0 360.0
width 0.2 6.0
lowerBoundary 0.0 0.0
upperBoundary 10.0 360.0
}
}
6 changes: 3 additions & 3 deletions namd/tests/library/000_distance-grid_abf-customgrid/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ abf {
fullSamples 10

grid {
widths 0.2
lowerBoundaries 1.0
upperBoundaries 5.0
width 0.2
lowerBoundary 1.0
upperBoundary 5.0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ colvar {
histogram {
colvars one
grid {
widths 0.2
lowerBoundaries 0.6
upperBoundaries 5.4
width 0.2
lowerBoundary 0.6
upperBoundary 5.4
}
}
6 changes: 3 additions & 3 deletions namd/tests/library/000_distance_histogram-customgrid/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ colvar {
histogram {
colvars one
grid {
widths 0.2
lowerBoundaries 0.6
upperBoundaries 5.4
width 0.2
lowerBoundary 0.6
upperBoundary 5.4
}
}
6 changes: 3 additions & 3 deletions src/colvargrid_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ template <class T> int colvar_grid<T>::parse_params(std::string const &conf,
upper_boundaries, upper_boundaries, colvarparse::parse_silent);

// camel case keywords are used in config file
colvarparse::get_keyval(conf, "lowerBoundaries",
colvarparse::get_keyval(conf, "lowerBoundary",
lower_boundaries, lower_boundaries, parse_mode);
colvarparse::get_keyval(conf, "upperBoundaries",
colvarparse::get_keyval(conf, "upperBoundary",
upper_boundaries, upper_boundaries, parse_mode);

colvarparse::get_keyval(conf, "widths", widths, widths, parse_mode);
colvarparse::get_keyval(conf, "width", widths, widths, parse_mode);

// only used in state file
colvarparse::get_keyval(conf, "sizes", nx, nx, colvarparse::parse_silent);
Expand Down
6 changes: 3 additions & 3 deletions tests/distance-dihedral_histogram2d-periodic-customgrid.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ colvar {
histogram {
colvars r phi
grid {
widths 0.2 6.0
lowerBoundaries 0.0 0.0
upperBoundaries 10.0 360.0
width 0.2 6.0
lowerBoundary 0.0 0.0
upperBoundary 10.0 360.0
}
}
6 changes: 3 additions & 3 deletions tests/histogram-customgrid-periodic.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
histogram {
colvars one
grid {
widths 5
lowerBoundaries -60
upperBoundaries 300
width 5
lowerBoundary -60
upperBoundary 300
}
}
6 changes: 3 additions & 3 deletions tests/histogram-customgrid.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
histogram {
colvars one
grid {
widths 0.2
lowerBoundaries 0.6
upperBoundaries 5.4
width 0.2
lowerBoundary 0.6
upperBoundary 5.4
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ colvar {
histogram {
colvars one
grid {
widths 5
lowerBoundaries -60
upperBoundaries 300
width 5
lowerBoundary -60
upperBoundary 300
}
}
6 changes: 3 additions & 3 deletions tests/input_files/distance-grid_abf-customgrid/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ abf {
fullSamples 10

grid {
widths 0.2
lowerBoundaries 1.0
upperBoundaries 5.0
width 0.2
lowerBoundary 1.0
upperBoundary 5.0
}
}
6 changes: 3 additions & 3 deletions tests/input_files/distance-grid_histogram-customgrid/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ colvar {
histogram {
colvars one
grid {
widths 0.2
lowerBoundaries 0.6
upperBoundaries 5.4
width 0.2
lowerBoundary 0.6
upperBoundary 5.4
}
}
6 changes: 3 additions & 3 deletions tests/input_files/distance_histogram-customgrid/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ colvar {
histogram {
colvars one
grid {
widths 0.2
lowerBoundaries 0.6
upperBoundaries 5.4
width 0.2
lowerBoundary 0.6
upperBoundary 5.4
}
}

0 comments on commit 3a40dbb

Please sign in to comment.