Skip to main content

A package to help accelerate working with cp2k

Project description

PyPi Version

cp2k_helper

This is a package I plan on building up to help accelerate working with cp2k.

CP2K is a quantum chemistry and solid state physics software package. I will explain some of the functionalities I have built so far below.

Installation

Installation through PyPi:

pip install cp2k_helper

Install through GitHub:

Run the following in your terminal where you would like to install the package directory.

git clone https://github.com/loevlie/cp2k_helper.git
pip install -e cp2k_helper

Example Usage

output_parser

Uses

  • Retreive information from the output files generated after running a calculation using cp2k.

Important Note

  • The class will retrieve all information under the given directory (with a max depth as an optional extra argument) and use the directory names to classify each calculation you ran. Therefore, you should not have two seperate cp2k calculations with the same directory name.

Example

The output will be a dictionary of dictionaries (Containing the single point Energy calculations and Geometric optimization final energies found under the specified directory)

from cp2k_helper import output_parser
# Depth automatically set to inf
parser = output_parser(base_file_path='./cp2k') 
# If all=False then only the final energies will be retrieved
Energies = parser.get_energies(all=False) 
print(Energies)

Output:

{'ENERGY': defaultdict(float,
             {'Folder_Name1': -1000.997638482306,
              'Folder_Name2': -1000.997638482306,
              'Folder_Name6': -1000.900349392778}),
 'GEO_OPT': defaultdict(None,
             {'Folder_Name5': -1000.900349392778,
              'Folder_Name7': -1000.997638482306,
              'Folder_Name3': -1000.900349392778,
              'Folder_Name4': -1000.900349392778})}

Note:

The output example has fake foldernames and energy values for proprietary reasons.

Command Line tools

restart

cp2k_helper has a handy command line tool for restarting a calculation if it timed out. Just execute the command below in the directory that the calculation timed out and a new subdirectory will be created for the new job. You can then submit the new job to restart the calculation.

cp2k_helper --restart 

summ

cp2k_helper can give you a quick summary of your output file. Just use the command below with your output filename:

cp2k_helper --summ OPT.out

energy

cp2k_helper can quickly get you the final energy values from all GEO_OPT or ENERGY DFT calculations under a specified directory. The values are converted from Ha to eV. They are saved as a csv (optionally you may name it whatever you want but the default is Energies.csv). An example of using this feature for all of the calculations under the current folder is below:

cp2k_helper --energy . My_Energy_Values

The above command will save a csv file to your current directory with all of the final energy values along with the type of calculation run and the folder name of each. As of now the .csv file will look similar to below (if you had 4 DFT calculations in the given directory).

Energies.csv

Folder_Name Type Energy (eV)
Folder_1 GEO_OPT -10000.34324
Folder_2 ENERGY -10000.34324
Folder_3 ENERGY -10100.34324
Folder_4 GEO_OPT -10000.34324

TODO: Add optional information to the csv file on the following

  • Functional
  • Did the calculation converge? (this one is important/useful)
  • Convergence criteria
  • Atomic composition
  • Etc. (if anyone has other information they think would be useful please add it to this list)

Contribute to cp2k helper

If you have any ideas for features that would be nice to have in cp2k_helper please reach out to me or submit a pull request!

Reporting Issues

Please report issues at https://github.com/loevlie/cp2k_helper/issues.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cp2k_helper-0.0.5.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cp2k_helper-0.0.5-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file cp2k_helper-0.0.5.tar.gz.

File metadata

  • Download URL: cp2k_helper-0.0.5.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for cp2k_helper-0.0.5.tar.gz
Algorithm Hash digest
SHA256 e545ed845367d38421d9547eed20f85142159b42b013793a86aaba866c7259b6
MD5 1078aee1af46abbcd6d95f1164bd95c0
BLAKE2b-256 96271bc85d2ea451c47c77500c3775a5df16ca4d5c6663ff1a024b1254b82948

See more details on using hashes here.

File details

Details for the file cp2k_helper-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: cp2k_helper-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for cp2k_helper-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 fb76d11e0e2754d4eef6c13ded66857874199280d784819a22b8dc0049fcbce8
MD5 a8425d26fbfc7f0420baab1a0a7143bf
BLAKE2b-256 4650babac894d12f817236db8d7bfc3a3173da6406eb4a9207fb06b1910e5288

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page