# Database Tools
This Python package provides the tools to initialize the active learning loop for element embracing machine
learning potentials through the SCINE interface. It also provides easy access to some example input files
and trajectories.

Installation
------------
To install the package run
 `pip install .`.

Installing the package provides the executables `single_points`, `qm_region_selection`, `active_learning_postprocessing`,
and `monitor_database` to run single point calculations, select a QM region, post process active learning files, and
monitor the state of the database, respectively.


Download Example Files
----------------------
This framework uses molecular dynamics trajectories as input. Example files can be downloaded by running the
`download.sh` scripts in the directories `input_files/structures/mcl1-19G` and `input_files/structures/grp78-nkp1339`.

You can run the script `initialize_input_file_paths.sh` in `input_files` to generate input files for the MCL1-19G and
GRP78-NKP1339 systems. The example input files will be located in `input_files/single_points` and
`input_files/qm_region_selection`.

Example Commands
----------------
Run QM region selection:

`qm_region_selection -i NEW input_files/qm_region_selection/mcl1-19G_complex.yml`

Add reference calculation runs to the database:

`single_points input_files/single_points/mcl1-19G_complex.yml`

Select active learning structures from a set of trajectory files:

`active_learning_postprocessing -c input_files/single_points/mcl1-19G_complex.yml -in directory-with-files`

Monitor the state of the database:

`monitor_database -c input_files/single_points/mcl1-19G_complex.yml -s`

Check error messages:

`error_report input_files/single_points/mcl1-19G_complex.yml`

Remove broken structures and calculations in the case of an input error:

`clean_up_database -c input_files/single_points/mcl1-19G_complex.yml -f True`

`clean_up_database -c input_files/single_points/mcl1-19G_complex.yml -d "31.05.2024"`

Get runtimes:

`timings -c input_files/single_points/mcl1-19G_complex.yml`

Reset pending calculations to status "new":

`reset_pending_calculations -c input_files/single_points/mcl1-19G_complex.yml`

Copy a database (excludes calculations by default) or transfer structures and properties between databases:

`transfer_database --source_configuration input_files/single_points/mcl1-19G_complex.yml --target_configuration input_files/qmqmmm_single_points/mcl1-19G_complex.yml`

Add QM/QM/MM calculations to a database:

`add_qmqmmm_single_points -c input_files/single_points/grp78-nkp1339_complex.yml -n 100 -sn 2001 -j dft_embedded_hamiltonian`