A Python wrapper for the k-point grid generator Java package
Project description
KPoints Generator
A Python package that wraps around the Java-based k-point grid generator for VASP calculations.
Installation
pip install kpoints-generator
Prerequisites
- Python 3.6+
- Java Runtime Environment (JRE)
Usage
Python API
import kpoints_generator as kpg
# Check if all prerequisites are met
success, message = kpg.check_prerequisites()
if not success:
print(f"Warning: {message}")
# Generate a KPOINTS file in the current directory
kpoints_file = kpg.generate_kpoints(
mindistance=0.2, # Required parameter
vasp_directory="./my_vasp_calculation", # Optional, defaults to current dir
precalc_params={ # Optional additional parameters for PRECALC
"WRITE_LATTICE_VECTORS": "True",
"HEADER" : "VERBOSE",
"INCLUDEGAMMA" : "AUTO",
},
output_file="KPOINTS", # Optional, defaults to "KPOINTS"
)
print(f"Created KPOINTS file at: {kpoints_file}")
Command Line Interface
The package also provides a command-line interface:
# Generate a KPOINTS file with mindistance=0.2
kpoints-generator --mindistance 0.2
# Specify a different directory
kpoints-generator --mindistance 0.2 --directory ./my_vasp_calculation
# Check if prerequisites are met without generating k-points
kpoints-generator --check
Advanced Usage
Custom PRECALC Parameters
You can specify additional parameters for the PRECALC file:
kpg.generate_kpoints(
mindistance=0.2,
precalc_params={
"GAMMA": "TRUE",
"EVENK": "TRUE",
"KPPRA": "1000"
}
)
PRECALC Configuration
The package includes a PRECALC_template file in the root directory that lists all available configuration options. You can use this as a reference when setting parameters for k-point grid generation.
The basic required parameter is MINDISTANCE, but many other options are available for fine-tuning the grid.
Command-line PRECALC Parameters
You can specify additional parameters for the PRECALC file through the command line:
kpoints-generator --mindistance 0.2 --precalc-param "GAMMA=TRUE" --precalc-param "EVENK=TRUE"
How It Works
This package bundles the Java-based k-point grid generator and provides a Python interface to it. Under the hood, it:
- Creates a temporary directory
- Copies the necessary VASP input files
- Creates a PRECALC file with the specified parameters
- Runs the Java program using the bundled JAR file
- Copies the generated KPOINTS file to the target directory
License
Acknowledgments
This package is a wrapper around the k-point grid generator developed by the Mueller Group at Johns Hopkins University.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kpoints_generator-0.3.0.tar.gz.
File metadata
- Download URL: kpoints_generator-0.3.0.tar.gz
- Upload date:
- Size: 8.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba97efeb6e2f9416176429dea5fe07af8f42cdc548fc05c99fd190db4ece1896
|
|
| MD5 |
5a6f015b3e416bd5b1d0ca13d0f73dff
|
|
| BLAKE2b-256 |
e76ddc20d60ecc915d8dc8fe2d98acf8ebbe9c0b1730424c6b2ba110d4dc2d5b
|
File details
Details for the file kpoints_generator-0.3.0-py3-none-any.whl.
File metadata
- Download URL: kpoints_generator-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4067c79bebccb10e2437af9c509a8e64826ed3e866e7ef87bc2e1ec77ca6c91d
|
|
| MD5 |
85322179499f99df5700e0d2f0c8c123
|
|
| BLAKE2b-256 |
f0818f642000707ea7e53bda1f309e82a509c754bffff8ecc651d1884568b5bc
|