Skip to main content

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:

  1. Creates a temporary directory
  2. Copies the necessary VASP input files
  3. Creates a PRECALC file with the specified parameters
  4. Runs the Java program using the bundled JAR file
  5. Copies the generated KPOINTS file to the target directory

License

APACHE License

Acknowledgments

This package is a wrapper around the k-point grid generator developed by the Mueller Group at Johns Hopkins University.

Metadata

Release files for kpoints-generator 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kpoints-generator 0.3.0
File Size Uploaded
kpoints_generator-0.3.0.tar.gz 8.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for kpoints-generator 0.3.0
File Interpreter ABI Platform
kpoints_generator-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.9 MB

Release files / kpoints_generator-0.3.0.tar.gz

Download URL kpoints_generator-0.3.0.tar.gz
Size 8.0 MB
Tags Source
SHA-256 checksum
How to use checksums
ba97efeb6e2f9416176429dea5fe07af8f42cdc548fc05c99fd190db4ece1896
BLAKE2b-256 checksum
How to use checksums
e76ddc20d60ecc915d8dc8fe2d98acf8ebbe9c0b1730424c6b2ba110d4dc2d5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.9

Release files / kpoints_generator-0.3.0-py3-none-any.whl

Download URL kpoints_generator-0.3.0-py3-none-any.whl
Size 8.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4067c79bebccb10e2437af9c509a8e64826ed3e866e7ef87bc2e1ec77ca6c91d
BLAKE2b-256 checksum
How to use checksums
f0818f642000707ea7e53bda1f309e82a509c754bffff8ecc651d1884568b5bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page