8. Python Classes and Functions¶
See also
Tutorial: Getting Started: Python
For ParAMS users, the five most important Python classes to know are
ResultsImporter: It lets you convert a reference (DFT) calculation into the ParAMS format (job collections, engine collections, and data sets)
Extractors: Functions that extract data from jobs, e.g.
energy
,forces
,angle
, etc.Parameter interfaces like ReaxFFParameters and GFN1xTBParameters: They let you set which parameters to optimize, their initial values, and can convert between the ParAMS format and the AMS format.
ParAMSJob: It lets you set up the settings for a ParAMS job and run it through Python (using PLAMS).
ParAMSResults: It lets you extract results from a finished ParAMS job (also works if the job was run with the GUI).
The ResultsImporter class is usually enough to add training data. For full control of your training set, you can also use the classes that ResultsImporter uses internally:
Job Collection: Contains most settings for the jobs (the structure and task like SinglePoint or GeometryOptimization).
Engine Collection: Contains additional engine settings. It is usually not needed, but may be used to set e.g. k-space sampling for GFN1-xTB parametrizations.
Data Set: Contains reference values with units, what to extract from jobs, and the weights. It used for both the training set and (optionally) validation set.
To set the data set weights, you may be interested in
Weights schemes: They let you set different weights to different force components (for example) depending on how large the forces are.
To get more from your results, you may be interested in
Data Set Evaluator: It lets you access the contents of files like
stats.txt
andscatter_plots/forces.txt
.
Finally, there are some classes that are used internally by ParAMS. You typically shouldn’t use these yourself, but instead set the corresponding input options in the input file (that you can set up with a ParAMSJob).
- 8.1. Results Importer
- 8.1.1. ResultsImporter overview
- 8.1.1.1. ResultsImporter summary
- 8.1.1.2. ResultsImporter settings
- 8.1.1.3. Training set, validation set, etc.
- 8.1.1.4. Save and load from disk
- 8.1.1.5. add_singlejob
- 8.1.1.6. add_trajectory_singlepoints
- 8.1.1.7. add_reaction_energy
- 8.1.1.8. add_pesscan_singlepoints
- 8.1.1.9. add_neb_singlepoints
- 8.1.1.10. add_pesexploration_singlepoints
- 8.1.2. AMS, VASP, Quantum ESPRESSO, and Gaussian reference data
- 8.1.3. ResultsImporters API
- 8.1.1. ResultsImporter overview
- 8.2. Extractors and Comparators
- 8.2.1. Available Extractors
- 8.2.1.1. Angle
- 8.2.1.2. Average distance
- 8.2.1.3. BandGap
- 8.2.1.4. BandStructure
- 8.2.1.5. Bulk modulus
- 8.2.1.6. Cell angles
- 8.2.1.7. Cell lengths
- 8.2.1.8. Cell volume
- 8.2.1.9. Charges
- 8.2.1.10. Dihedral
- 8.2.1.11. dipole_moment
- 8.2.1.12. Distance
- 8.2.1.13. Distance vector
- 8.2.1.14. Energy
- 8.2.1.15. Forces
- 8.2.1.16. Hessian
- 8.2.1.17. PES
- 8.2.1.18. PES compared
- 8.2.1.19. PESScan angle
- 8.2.1.20. PESScan dihedral
- 8.2.1.21. PESScan distance
- 8.2.1.22. RMSD
- 8.2.1.23. Shear modulus
- 8.2.1.24. Stress tensor
- 8.2.1.25. Stress tensor 1D
- 8.2.1.26. Stress tensor 2D
- 8.2.1.27. Stress tensor 3D
- 8.2.1.28. Stress tensor diagonal 2D
- 8.2.1.29. Stress tensor diagonal 3D
- 8.2.1.30. Stress tensor off-diagonal 2D
- 8.2.1.31. Stress tensor off-diagonal 3D
- 8.2.1.32. Vibrational frequencies
- 8.2.1.33. Young modulus
- 8.2.2. Custom Extractors
- 8.2.3. Supported Data Structures
- 8.2.4. Custom Comparators
- 8.2.1. Available Extractors
- 8.3. Parameter Interfaces
- 8.3.1. Available Parameter Interfaces
- 8.3.1.1. GFN1-xTB
- 8.3.1.2. ReaxFF
- 8.3.1.2.1. Reading Legacy params Files
- 8.3.1.2.2. Addition of Parameters
- 8.3.1.2.3. Trim (remove elements) from a ReaxFF force field
- 8.3.1.2.4. Apply recommended parameter ranges (constraints)
- 8.3.1.2.5. Parameter Databases and Value Suggestions
- 8.3.1.2.6. ReaxFF Conversion Functions
- 8.3.1.2.7. ReaxFF Interface API
- 8.3.1.2.8. Full List of Parameter Names
- 8.3.1.2.9. Parameter Categories
- 8.3.1.3. SCC-DFTB repulsive potential
- 8.3.1.4. Lennard Jones
- 8.3.1.5. No parameters (empty interface)
- 8.3.1.6. ASE Parameters
- 8.3.2. Working with Parameter Interfaces
- 8.3.1. Available Parameter Interfaces
- 8.4. ParAMSJob
- 8.5. ParAMSResults
- 8.6. Job and Engine Collections
- 8.7. Data Set
- 8.7.1. An example DataSet
- 8.7.2. Load or store DataSet
- 8.7.3. Adding entries
- 8.7.4. Demonstration: Working with a DataSet
- 8.7.5. Calculating and Adding Reference Data with AMS
- 8.7.6. Calculating the Loss Function Value
- 8.7.7. Checking for Consistency with a given Job Collection
- 8.7.8. Sigma vs. weight: What is the difference?
- 8.7.9. Data Set Entry API
- 8.7.10. Data Set API
- 8.8. Data Set Evaluator
- 8.9. Utilities
- 8.10. Internal ParAMS classes