Skip to content

Commit

Permalink
generate input file man page from config.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
ntBre committed Nov 29, 2023
1 parent 8e80539 commit c9735a0
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 146 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ docs: man/rpbqff.1
%.pdf: %.1
groff -Tpdf $? -mman > $@

man/rpbqff.1: man/rpbqff.head testfiles/test.toml man/rpbqff.tail
man/config.man: src/config.rs scripts/config.awk
scripts/config.awk $< > $@

man/rpbqff.1: man/rpbqff.head man/config.man man/example.man testfiles/test.toml man/rpbqff.tail
cat $^ > $@

scripts: qffbuddy/qffbuddy*
Expand Down
48 changes: 48 additions & 0 deletions man/config.man
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.TP
.B geometry \fIString\fR
The initial geometry to use for the computation. Both XYZ and Z-matrix geometries are accepted.
.TP
.B optimize \fIbool\fR
Whether or not to perform a geometry optimization on the input
.TP
.B charge \fIisize\fR
The molecular charge. This value can be spliced into the template using the {{.charge}} directive.
.TP
.B step_size \fIf64\fR
The size of the displacement to take in the QFF coordinates.
.TP
.B sleep_int \fIusize\fR
The interval in seconds to wait between loops checking if any jobs have finished.
.TP
.B job_limit \fIusize\fR
The maximum number of jobs to submit at once, as determined by the number of individual input files. This distinction is important when chunk_size is greater than 1 because the maximum number of jobs submitted to the queue will be job_limit / chunk_size .
.TP
.B chunk_size \fIusize\fR
The number of individual calculations to bundle into a single queue submission.
.TP
.B coord_type \fICoordType\fR
The type of coordinate to use in the QFF. Currently-supported values are "sic", "cart", and "normal". Note that SIC QFFs require an additional input file called intder.in to define the internal coordinates.
.TP
.B template \fITemplateSrc\fR
The template input file for the quantum chemistry program. Supported formatting directives depend on the program in question. Molpro supports {{.geom}} for the geometry and {{.charge}} for the molecular charge, while Mopac expects a static template.
.TP
.B hybrid_template \fIOption<TemplateSrc>\fR
An optional template file for the cubic and quartic portion of the QFF. If this is provided, the regular template is used only for the harmonic portion of the QFF, and this is used for the rest of the points.
.TP
.B queue_template \fIOption<TemplateSrc>\fR
The template input file for the queuing system. Supported formatting directives include {{.basename}} for the base name of the submit script, which is useful for naming the job in the queue, and {{.filename}} for the name of the quantum chemistry program input file. Not all program and queue combinations expand these, however.
.TP
.B program \fIProgram\fR
The quantum chemistry program to use in running the QFF. Currently-supported values are "cfour", "dftb+", "molpro", "mopac".
.TP
.B queue \fIQueue\fR
The queuing system to use in running the QFF. Currently-supported values are "local", which uses bash to run computations directly, "pbs", and "slurm".
.TP
.B findiff \fIOption<bool>\fR
Whether to use finite differences or least-squares fitting for the potential energy surface. Currently normal coordinates are the only coord_type to use this option, so it has a default value of false, meaning use the fitted version of normal coordinates. Setting this option to true forces the use of finite differences for the normal coordinate QFF.
.TP
.B check_int \fIusize\fR
The interval at which to write checkpoint files. Every coordinate type will write an initial checkpoint (res.chk), but this interval determines whether or not checkpoints are written while the single-point energies are being run. A value of 0 will disable checkpoints entirely. This interval refers to the number of polling iterations that have occurred, not the number of jobs that have completed. The iteration count is shown in the log file when the number of jobs remaining is printed.
.TP
.B weights \fIOption<Vec<f64>>\fR
An optional vector of atomic masses to use for normal coordinate generation and Spectro.
7 changes: 7 additions & 0 deletions man/example.man
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

.SH EXAMPLE
The following is an example input file for c-C3H2 in SICs in Mopac on the Slurm
queuing system:
.nf
.rs

112 changes: 45 additions & 67 deletions man/rpbqff.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH rpbqff 1 2023-01-06
.TH rpbqff 1 2023-11-29

.SH NAME
rpbqff - push-button quartic force fields
Expand Down Expand Up @@ -57,77 +57,55 @@ TOML, Tom's Obvious Minimal Language. For help constructing your input file, see
.BR qffbuddy (1)
which should have been included with
.BR rpbqff .

.TP
.B geometry \fIstring\fR
The initial geometry to use for the computation. Both XYZ and Z-matrix
geometries are accepted.
.B geometry \fIString\fR
The initial geometry to use for the computation. Both XYZ and Z-matrix geometries are accepted.
.TP
.B optimize \fIboolean\fR
.B optimize \fIbool\fR
Whether or not to perform a geometry optimization on the input
.BR geometry .
.TP
.B charge \fIinteger\fR
The molecular charge. This value can be spliced into the
.B template
using the {{.charge}} directive.
.TP
.B step_size \fIfloat\fR
The size of the step to take in the QFF coordinates.
.TP
.B coord_type \fIstring\fR
The type of coordinate to use in the QFF. Currently-supported values are "sic",
"cart", and "normal". Note that SIC QFFs require an additional input file called
.I intder.in
to define the internal coordinates.
.TP
.B program \fIstring\fR
The quantum chemistry program to use in running the QFF. Currently-supported
values are "molpro" and "mopac".
.TP
.B queue \fIstring\fR
The queuing system to use in running the QFF. Currently-supported values are
"pbs" and "slurm".
.TP
.B sleep_int \fIint\fR
The interval in seconds to wait between loops checking if any jobs have
finished.
.TP
.B job_limit \fIint\fR
The maximum number of jobs to submit at once, as determined by the number of
individual input files. This distinction is important when
.B chunk_size
is greater than 1 because the maximum number of jobs submitted to the queue will
be
.BR job_limit / chunk_size .
.TP
.B chunk_size \fIint\fR
.TP
.B charge \fIisize\fR
The molecular charge. This value can be spliced into the template using the {{.charge}} directive.
.TP
.B step_size \fIf64\fR
The size of the displacement to take in the QFF coordinates.
.TP
.B sleep_int \fIusize\fR
The interval in seconds to wait between loops checking if any jobs have finished.
.TP
.B job_limit \fIusize\fR
The maximum number of jobs to submit at once, as determined by the number of individual input files. This distinction is important when chunk_size is greater than 1 because the maximum number of jobs submitted to the queue will be job_limit / chunk_size .
.TP
.B chunk_size \fIusize\fR
The number of individual calculations to bundle into a single queue submission.
.TP
.B template \fIstring\fR
The template input file for the quantum chemistry
.BR program .
Supported formatting directives depend on the
.B program
in question. Molpro supports {{.geom}} for the geometry and {{.charge}} for the
molecular charge, while Mopac expects a static template.
.TP
.B check_int \fIint\fR
The interval at which to write checkpoint files. Every coordinate type will
write an initial checkpoint
.RI ( res.chk ),
but this interval determines whether or not checkpoints are written while the
single-point energies are being run. A value of 0 will disable checkpoints
entirely. This interval refers to the number of polling iterations that have
occurred, not the number of jobs that have completed. The iteration count is
shown in the log file when the number of jobs remaining is printed.
.TP
.B findiff [\fIbool\fR]
Whether to use finite differences or least-squares fitting for the potential
energy surface. Currently normal coordinates are the only
.B coord_type
to use this option, so it has a default value of false, meaning use the fitted
version of normal coordinates. Setting this option to true forces the use of
finite differences for the normal coordinate QFF.
.B coord_type \fICoordType\fR
The type of coordinate to use in the QFF. Currently-supported values are "sic", "cart", and "normal". Note that SIC QFFs require an additional input file called intder.in to define the internal coordinates.
.TP
.B template \fITemplateSrc\fR
The template input file for the quantum chemistry program. Supported formatting directives depend on the program in question. Molpro supports {{.geom}} for the geometry and {{.charge}} for the molecular charge, while Mopac expects a static template.
.TP
.B hybrid_template \fIOption<TemplateSrc>\fR
An optional template file for the cubic and quartic portion of the QFF. If this is provided, the regular template is used only for the harmonic portion of the QFF, and this is used for the rest of the points.
.TP
.B queue_template \fIOption<TemplateSrc>\fR
The template input file for the queuing system. Supported formatting directives include {{.basename}} for the base name of the submit script, which is useful for naming the job in the queue, and {{.filename}} for the name of the quantum chemistry program input file. Not all program and queue combinations expand these, however.
.TP
.B program \fIProgram\fR
The quantum chemistry program to use in running the QFF. Currently-supported values are "cfour", "dftb+", "molpro", "mopac".
.TP
.B queue \fIQueue\fR
The queuing system to use in running the QFF. Currently-supported values are "local", which uses bash to run computations directly, "pbs", and "slurm".
.TP
.B findiff \fIOption<bool>\fR
Whether to use finite differences or least-squares fitting for the potential energy surface. Currently normal coordinates are the only coord_type to use this option, so it has a default value of false, meaning use the fitted version of normal coordinates. Setting this option to true forces the use of finite differences for the normal coordinate QFF.
.TP
.B check_int \fIusize\fR
The interval at which to write checkpoint files. Every coordinate type will write an initial checkpoint (res.chk), but this interval determines whether or not checkpoints are written while the single-point energies are being run. A value of 0 will disable checkpoints entirely. This interval refers to the number of polling iterations that have occurred, not the number of jobs that have completed. The iteration count is shown in the log file when the number of jobs remaining is printed.
.TP
.B weights \fIOption<Vec<f64>>\fR
An optional vector of atomic masses to use for normal coordinate generation and Spectro.

.SH EXAMPLE
The following is an example input file for c-C3H2 in SICs in Mopac on the Slurm
Expand Down
79 changes: 1 addition & 78 deletions man/rpbqff.head
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH rpbqff 1 2023-01-06
.TH rpbqff 1 2023-11-29

.SH NAME
rpbqff - push-button quartic force fields
Expand Down Expand Up @@ -57,81 +57,4 @@ TOML, Tom's Obvious Minimal Language. For help constructing your input file, see
.BR qffbuddy (1)
which should have been included with
.BR rpbqff .
.TP
.B geometry \fIstring\fR
The initial geometry to use for the computation. Both XYZ and Z-matrix
geometries are accepted.
.TP
.B optimize \fIboolean\fR
Whether or not to perform a geometry optimization on the input
.BR geometry .
.TP
.B charge \fIinteger\fR
The molecular charge. This value can be spliced into the
.B template
using the {{.charge}} directive.
.TP
.B step_size \fIfloat\fR
The size of the step to take in the QFF coordinates.
.TP
.B coord_type \fIstring\fR
The type of coordinate to use in the QFF. Currently-supported values are "sic",
"cart", and "normal". Note that SIC QFFs require an additional input file called
.I intder.in
to define the internal coordinates.
.TP
.B program \fIstring\fR
The quantum chemistry program to use in running the QFF. Currently-supported
values are "molpro" and "mopac".
.TP
.B queue \fIstring\fR
The queuing system to use in running the QFF. Currently-supported values are
"pbs" and "slurm".
.TP
.B sleep_int \fIint\fR
The interval in seconds to wait between loops checking if any jobs have
finished.
.TP
.B job_limit \fIint\fR
The maximum number of jobs to submit at once, as determined by the number of
individual input files. This distinction is important when
.B chunk_size
is greater than 1 because the maximum number of jobs submitted to the queue will
be
.BR job_limit / chunk_size .
.TP
.B chunk_size \fIint\fR
The number of individual calculations to bundle into a single queue submission.
.TP
.B template \fIstring\fR
The template input file for the quantum chemistry
.BR program .
Supported formatting directives depend on the
.B program
in question. Molpro supports {{.geom}} for the geometry and {{.charge}} for the
molecular charge, while Mopac expects a static template.
.TP
.B check_int \fIint\fR
The interval at which to write checkpoint files. Every coordinate type will
write an initial checkpoint
.RI ( res.chk ),
but this interval determines whether or not checkpoints are written while the
single-point energies are being run. A value of 0 will disable checkpoints
entirely. This interval refers to the number of polling iterations that have
occurred, not the number of jobs that have completed. The iteration count is
shown in the log file when the number of jobs remaining is printed.
.TP
.B findiff [\fIbool\fR]
Whether to use finite differences or least-squares fitting for the potential
energy surface. Currently normal coordinates are the only
.B coord_type
to use this option, so it has a default value of false, meaning use the fitted
version of normal coordinates. Setting this option to true forces the use of
finite differences for the normal coordinate QFF.

.SH EXAMPLE
The following is an example input file for c-C3H2 in SICs in Mopac on the Slurm
queuing system:
.nf
.rs

Binary file modified man/rpbqff.pdf
Binary file not shown.
16 changes: 16 additions & 0 deletions scripts/config.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/awk -f

/struct RawConfig/,/^}$/ {
if ($1 ~ /\/\/\//) {
for (i = 2; i <= NF; i++) {
buf = buf " " $i
}
} else if (/^$/ || /struct/ || /^}$/) {
# pass
} else { # field name
field = substr($1, 1, length($1) - 1) # trim colon
type = substr($2, 1, length($2) - 1) # trim comma
printf ".TP\n.B %s \\fI%s\\fR\n%s\n", field, type, substr(buf, 2)
buf = ""
}
}
64 changes: 64 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,85 @@ impl From<TemplateSrc> for String {
#[derive(Deserialize, Debug, PartialEq)]
#[serde(deny_unknown_fields)]
struct RawConfig {
/// The initial geometry to use for the computation. Both XYZ and Z-matrix
/// geometries are accepted.
geometry: String,

/// Whether or not to perform a geometry optimization on the input
optimize: bool,

/// The molecular charge. This value can be spliced into the template using
/// the {{.charge}} directive.
charge: isize,

/// The size of the displacement to take in the QFF coordinates.
step_size: f64,

/// The interval in seconds to wait between loops checking if any jobs have
/// finished.
sleep_int: usize,

/// The maximum number of jobs to submit at once, as determined by the
/// number of individual input files. This distinction is important when
/// chunk_size is greater than 1 because the maximum number of jobs
/// submitted to the queue will be job_limit / chunk_size .
job_limit: usize,

/// The number of individual calculations to bundle into a single queue
/// submission.
chunk_size: usize,

/// The type of coordinate to use in the QFF. Currently-supported values are
/// "sic", "cart", and "normal". Note that SIC QFFs require an additional
/// input file called intder.in to define the internal coordinates.
coord_type: CoordType,

/// The template input file for the quantum chemistry program. Supported
/// formatting directives depend on the program in question. Molpro supports
/// {{.geom}} for the geometry and {{.charge}} for the molecular charge,
/// while Mopac expects a static template.
template: TemplateSrc,

/// An optional template file for the cubic and quartic portion of the QFF.
/// If this is provided, the regular template is used only for the harmonic
/// portion of the QFF, and this is used for the rest of the points.
hybrid_template: Option<TemplateSrc>,

/// The template input file for the queuing system. Supported formatting
/// directives include {{.basename}} for the base name of the submit script,
/// which is useful for naming the job in the queue, and {{.filename}} for
/// the name of the quantum chemistry program input file. Not all program
/// and queue combinations expand these, however.
queue_template: Option<TemplateSrc>,

/// The quantum chemistry program to use in running the QFF.
/// Currently-supported values are "cfour", "dftb+", "molpro", "mopac".
program: Program,

/// The queuing system to use in running the QFF. Currently-supported values
/// are "local", which uses bash to run computations directly, "pbs", and
/// "slurm".
queue: Queue,

/// Whether to use finite differences or least-squares fitting for the
/// potential energy surface. Currently normal coordinates are the only
/// coord_type to use this option, so it has a default value of false,
/// meaning use the fitted version of normal coordinates. Setting this
/// option to true forces the use of finite differences for the normal
/// coordinate QFF.
findiff: Option<bool>,

/// The interval at which to write checkpoint files. Every coordinate type
/// will write an initial checkpoint (res.chk), but this interval determines
/// whether or not checkpoints are written while the single-point energies
/// are being run. A value of 0 will disable checkpoints entirely. This
/// interval refers to the number of polling iterations that have occurred,
/// not the number of jobs that have completed. The iteration count is shown
/// in the log file when the number of jobs remaining is printed.
check_int: usize,

/// An optional vector of atomic masses to use for normal coordinate
/// generation and Spectro.
weights: Option<Vec<f64>>,
}

Expand Down

0 comments on commit c9735a0

Please sign in to comment.