5.1. Simple benchmark calculations (ParAMS Task SinglePoint)¶
This tutorial shows you how you can
Use any AMS engine to evaluate a dataset and compare to reference values using Task: SinglePoint
Here, ParAMS is not used for parametrization but simply as a convenient tool to run multiple calculations and compare the results to reference values.
Note
This tutorial shows a simplified way of running a benchmark with just a single engine.
This method is only available from the command-line and Python.
See also the tutorial for the more general way supporting multiple engines (e.g., different values for spin-polarization or k-space sampling), which is available from GUI, command-line, and Python.
We will use ParAMS together with an AMS engine to evaluate a subset of the ISOL isomerization benchmark set. The reference energies were evaluated at the CCSD(T)-F12a/aDZ level of theory.
The example files are stored in $AMSHOME/scripting/scm/params/examples/benchmark-simple-engine
.
5.1.1. Run from the command-line¶
Copy all the files from $AMSHOME/scripting/scm/params/examples/benchmark-simple-engine
to a new empty directory.
The params.in
file contains:
Task SinglePoint
StoreJobs Yes
Engine ForceField
Type UFF
EndEngine
Simply write the engine input the way it would be done for any normal AMS calculation.
Note that the Task SinglePoint
here means that there is no parametrization.
The jobs in the job collection can contain jobs with any AMS Task
(GeometryOptimization, PESScan, etc.).
Then launch ParAMS:
$AMSBIN/params
You can open the results in the ParAMS GUI to visualize the results:
$AMSBIN/params -gui results
5.1.2. Run benchmark from Python¶
The run.py
file contains:
#!/usr/bin/env amspython
import os
from scm.params import ParAMSJob
from scm.plams import log
def main():
examples_dir = os.path.expandvars("$AMSHOME/scripting/scm/params/examples/benchmark-simple-engine")
job = ParAMSJob.from_yaml(examples_dir, name="all_jobs_with_single_engine")
job.settings.input.Task = "SinglePoint"
job.settings.input.StoreJobs = "Yes" # set to "Yes" to store all jobs on disk
# engine settings are given directly under job.settings.input
# set up the UFF force field
job.settings.input.ForceField.Type = "UFF"
# run the job
job.run()
if not job.ok():
log(job.get_errormsg())
return
# get the results
res = job.results.get_data_set_evaluator().results["energy"]
print(res.detailed_string())
print("---------")
print("Mean absolute error: {:.2f} {}".format(res.mae, res.unit))
# technically check that results can be loaded from disk and printed again
print("---------")
print("--Loading job from disk and printing results again--")
job2 = ParAMSJob.load_external(job.results.path)
res2 = job.results.get_data_set_evaluator().results["energy"]
print(res2.detailed_string())
print("---------")
print("Mean absolute error: {:.2f} {}".format(res2.mae, res2.unit))
if __name__ == "__main__":
main()
Copy this file to new empty directory. The engine settings are specified in the normal PLAMS Settings format.
Then launch amspython:
$AMSBIN/amspython run.py
You can open the results in the ParAMS GUI to visualize the results:
$AMSBIN/params -gui plams_workdir/all_jobs_with_single_engine/results