valyte 0.1.8__tar.gz → 0.1.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: valyte
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: A comprehensive CLI tool for VASP pre-processing (Supercells, K-points) and post-processing (DOS, Band Structure plotting)
5
5
  Home-page: https://github.com/nikyadav002/Valyte-Project
6
6
  Author: Nikhil
@@ -113,6 +113,9 @@ valyte supercell 3 3 1 -i POSCAR_primitive -o POSCAR_3x3x1
113
113
 
114
114
  Automatically generate a KPOINTS file with high-symmetry paths for band structure calculations.
115
115
 
116
+ > [!TIP]
117
+ > **Smart K-Path Generation (New in v0.1.7+)**: Valyte now automatically determines the standard path (e.g., `\Gamma - Y - V` for Monoclinic cells) using the **Bradley-Cracknell** convention by default. This ensures clean, publication-ready labels without external dependencies.
118
+
116
119
  ```bash
117
120
  valyte band kpt-gen [options]
118
121
  ```
@@ -121,12 +124,20 @@ valyte band kpt-gen [options]
121
124
  - `-i`, `--input`: Input POSCAR file (default: `POSCAR`).
122
125
  - `-n`, `--npoints`: Points per segment (default: `40`).
123
126
  - `-o`, `--output`: Output filename (default: `KPOINTS`).
127
+ - `--mode`: Path convention. Options: `bradcrack` (Default), `seekpath`, `latimer_munro`, `setyawan_curtarolo`.
124
128
 
125
129
  **Example:**
126
130
  ```bash
127
- valyte band kpt-gen -n 60 -i POSCAR_relaxed -o KPOINTS_band
131
+ # Default (Smart/BradCrack)
132
+ valyte band kpt-gen -n 60
133
+
134
+ # Explicitly use Seekpath convention
135
+ valyte band kpt-gen --mode seekpath
128
136
  ```
129
137
 
138
+ > [!IMPORTANT]
139
+ > The command will generate a **`POSCAR_standard`** file. You **MUST** use this structure for your band structure calculation (i.e., `cp POSCAR_standard POSCAR`) because the K-path corresponds to this specific orientation. Using your original POSCAR may result in incorrect paths.
140
+
130
141
  ### 🕸️ Generate K-Points (Interactive)
131
142
 
132
143
  Generate a `KPOINTS` file for SCF calculations interactively.
@@ -94,6 +94,9 @@ valyte supercell 3 3 1 -i POSCAR_primitive -o POSCAR_3x3x1
94
94
 
95
95
  Automatically generate a KPOINTS file with high-symmetry paths for band structure calculations.
96
96
 
97
+ > [!TIP]
98
+ > **Smart K-Path Generation (New in v0.1.7+)**: Valyte now automatically determines the standard path (e.g., `\Gamma - Y - V` for Monoclinic cells) using the **Bradley-Cracknell** convention by default. This ensures clean, publication-ready labels without external dependencies.
99
+
97
100
  ```bash
98
101
  valyte band kpt-gen [options]
99
102
  ```
@@ -102,12 +105,20 @@ valyte band kpt-gen [options]
102
105
  - `-i`, `--input`: Input POSCAR file (default: `POSCAR`).
103
106
  - `-n`, `--npoints`: Points per segment (default: `40`).
104
107
  - `-o`, `--output`: Output filename (default: `KPOINTS`).
108
+ - `--mode`: Path convention. Options: `bradcrack` (Default), `seekpath`, `latimer_munro`, `setyawan_curtarolo`.
105
109
 
106
110
  **Example:**
107
111
  ```bash
108
- valyte band kpt-gen -n 60 -i POSCAR_relaxed -o KPOINTS_band
112
+ # Default (Smart/BradCrack)
113
+ valyte band kpt-gen -n 60
114
+
115
+ # Explicitly use Seekpath convention
116
+ valyte band kpt-gen --mode seekpath
109
117
  ```
110
118
 
119
+ > [!IMPORTANT]
120
+ > The command will generate a **`POSCAR_standard`** file. You **MUST** use this structure for your band structure calculation (i.e., `cp POSCAR_standard POSCAR`) because the K-path corresponds to this specific orientation. Using your original POSCAR may result in incorrect paths.
121
+
111
122
  ### 🕸️ Generate K-Points (Interactive)
112
123
 
113
124
  Generate a `KPOINTS` file for SCF calculations interactively.
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="valyte",
5
- version="0.1.8",
5
+ version="0.1.9",
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  "numpy",
@@ -15,6 +15,8 @@ try:
15
15
  except ImportError:
16
16
  import importlib_resources as ilr_files
17
17
 
18
+ from valyte.potcar import generate_potcar
19
+
18
20
 
19
21
  def generate_band_kpoints(poscar_path="POSCAR", npoints=40, output="KPOINTS", symprec=0.01, mode="bradcrack"):
20
22
  """
@@ -111,6 +113,15 @@ def generate_band_kpoints(poscar_path="POSCAR", npoints=40, output="KPOINTS", sy
111
113
  except Exception as e:
112
114
  print(f"❌ Error writing KPOINTS file: {e}")
113
115
 
116
+ # --- POTCAR Generation ---
117
+ try:
118
+ print("ℹ️ Generating default POTCAR (PBE)...")
119
+ generate_potcar(poscar_path=poscar_path, functional="PBE", output="POTCAR")
120
+ except Exception as e:
121
+ print(f"⚠️ Could not generate POTCAR: {e}")
122
+ print(" (Proceeding without stopping, as KPOINTS are already generated)")
123
+
124
+
114
125
 
115
126
  class BradCrackKpath:
116
127
  """
@@ -27,6 +27,7 @@ from valyte.band import generate_band_kpoints
27
27
  from valyte.band_plot import plot_band_structure
28
28
  from valyte.dos_plot import load_dos, plot_dos
29
29
  from valyte.kpoints import generate_kpoints_interactive
30
+ from valyte.potcar import generate_potcar
30
31
 
31
32
  def parse_element_selection(inputs):
32
33
  """
@@ -123,6 +124,12 @@ def main():
123
124
  # --- K-Point Generation (Interactive) ---
124
125
  subparsers.add_parser("kpt", help="Interactive K-Point Generation (SCF)")
125
126
 
127
+ # --- POTCAR Generation ---
128
+ potcar_parser = subparsers.add_parser("potcar", help="Generate POTCAR")
129
+ potcar_parser.add_argument("-i", "--input", default="POSCAR", help="Input POSCAR file")
130
+ potcar_parser.add_argument("-o", "--output", default="POTCAR", help="Output filename")
131
+ potcar_parser.add_argument("--functional", default="PBE", help="Functional (default: PBE)")
132
+
126
133
  args = parser.parse_args()
127
134
 
128
135
  if args.command == "dos":
@@ -172,6 +179,17 @@ def main():
172
179
  print(f"❌ Error: {e}")
173
180
  sys.exit(1)
174
181
 
182
+ elif args.command == "potcar":
183
+ try:
184
+ generate_potcar(
185
+ poscar_path=args.input,
186
+ functional=args.functional,
187
+ output=args.output
188
+ )
189
+ except Exception as e:
190
+ print(f"❌ Error: {e}")
191
+ sys.exit(1)
192
+
175
193
  elif args.command == "band":
176
194
  if args.band_command == "kpt-gen":
177
195
  try:
@@ -10,6 +10,7 @@ import sys
10
10
  import numpy as np
11
11
  from pymatgen.core import Structure
12
12
  from pymatgen.io.vasp.inputs import Kpoints
13
+ from valyte.potcar import generate_potcar
13
14
 
14
15
  def generate_kpoints_interactive():
15
16
  """
@@ -94,3 +95,14 @@ def generate_kpoints_interactive():
94
95
  output_file = "KPOINTS"
95
96
  kpts.write_file(output_file)
96
97
  print(f"\n✅ Generated {output_file}!")
98
+
99
+ # --- POTCAR Generation (if missing) ---
100
+ potcar_file = "POTCAR"
101
+ if not os.path.exists(potcar_file):
102
+ try:
103
+ print(f"\nℹ️ POTCAR not found. Generating default POTCAR (PBE)...")
104
+ generate_potcar(poscar_path=poscar_path, functional="PBE", output=potcar_file)
105
+ except Exception as e:
106
+ print(f"⚠️ Could not generate POTCAR: {e}")
107
+ else:
108
+ print(f"ℹ️ POTCAR already exists, skipping generation.")
@@ -0,0 +1,61 @@
1
+ import os
2
+ import sys
3
+ from pymatgen.core import Structure
4
+ from pymatgen.io.vasp.outputs import Potcar
5
+
6
+ def generate_potcar(poscar_path="POSCAR", functional="PBE", output="POTCAR"):
7
+ """
8
+ Generates a POTCAR file based on the species in the POSCAR using Pymatgen configuration.
9
+
10
+ Args:
11
+ poscar_path (str): Path to input POSCAR file.
12
+ functional (str): Functional to use (e.g., "PBE", "PBE_52", "PBE_54", "LDA").
13
+ Defaults to "PBE" which usually maps to the configured default (often PBE_54).
14
+ output (str): Output filename.
15
+ """
16
+ if not os.path.exists(poscar_path):
17
+ print(f"❌ Error: Input file '{poscar_path}' not found.")
18
+ return
19
+
20
+ try:
21
+ structure = Structure.from_file(poscar_path)
22
+ species = structure.symbol_set
23
+
24
+ # Sort species to match POSCAR order if structure.symbol_set isn't ordered
25
+ # Actually Potcar.from_structure usually handles this but let's be safe if we manually construct.
26
+ # Ideally: use Potcar.from_structure if available or construct list.
27
+ # structure.symbol_set returns a tuple/list of unique species.
28
+
29
+ # Pymatgen's Potcar.from_file is for reading.
30
+ # We want to CREATE.
31
+ # Potcar(symbols, functional)
32
+
33
+ # Let's verify which method is best.
34
+ # structure.species gives list of all sites.
35
+ # We need unique species in order of appearance in POSCAR (usually).
36
+ # Wrapper: pymatgen.io.vasp.sets often handles this (e.g. MPRelaxSet),
37
+ # but that generates INCAR/KPOINTS too.
38
+ # Let's stick to just Potcar.
39
+
40
+ print(f"Reading structure from {poscar_path}...")
41
+ print(f"Detected species: {species}")
42
+
43
+ # Use simple Potcar construction.
44
+ # Note: functional argument in pymatgen Potcar init is 'functional'.
45
+ # Assuming Pymatgen is configured correctly, this should work.
46
+
47
+ try:
48
+ # Try explicit functional mapping if user provides "PBE" but config uses "PBE_54" etc
49
+ potcar = Potcar(species, functional=functional)
50
+ except OSError:
51
+ # Fallback or specific error msg about PMG setup
52
+ print(f"⚠️ Could not find POTCARs for functional '{functional}'.")
53
+ print(" Please ensure PMG_VASP_PSP_DIR is set in ~/.pmgrc.yaml")
54
+ raise
55
+
56
+ potcar.write_file(output)
57
+
58
+ print(f"✅ Generated {output} using functional '{functional}'")
59
+
60
+ except Exception as e:
61
+ print(f"❌ Error generating POTCAR: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: valyte
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: A comprehensive CLI tool for VASP pre-processing (Supercells, K-points) and post-processing (DOS, Band Structure plotting)
5
5
  Home-page: https://github.com/nikyadav002/Valyte-Project
6
6
  Author: Nikhil
@@ -113,6 +113,9 @@ valyte supercell 3 3 1 -i POSCAR_primitive -o POSCAR_3x3x1
113
113
 
114
114
  Automatically generate a KPOINTS file with high-symmetry paths for band structure calculations.
115
115
 
116
+ > [!TIP]
117
+ > **Smart K-Path Generation (New in v0.1.7+)**: Valyte now automatically determines the standard path (e.g., `\Gamma - Y - V` for Monoclinic cells) using the **Bradley-Cracknell** convention by default. This ensures clean, publication-ready labels without external dependencies.
118
+
116
119
  ```bash
117
120
  valyte band kpt-gen [options]
118
121
  ```
@@ -121,12 +124,20 @@ valyte band kpt-gen [options]
121
124
  - `-i`, `--input`: Input POSCAR file (default: `POSCAR`).
122
125
  - `-n`, `--npoints`: Points per segment (default: `40`).
123
126
  - `-o`, `--output`: Output filename (default: `KPOINTS`).
127
+ - `--mode`: Path convention. Options: `bradcrack` (Default), `seekpath`, `latimer_munro`, `setyawan_curtarolo`.
124
128
 
125
129
  **Example:**
126
130
  ```bash
127
- valyte band kpt-gen -n 60 -i POSCAR_relaxed -o KPOINTS_band
131
+ # Default (Smart/BradCrack)
132
+ valyte band kpt-gen -n 60
133
+
134
+ # Explicitly use Seekpath convention
135
+ valyte band kpt-gen --mode seekpath
128
136
  ```
129
137
 
138
+ > [!IMPORTANT]
139
+ > The command will generate a **`POSCAR_standard`** file. You **MUST** use this structure for your band structure calculation (i.e., `cp POSCAR_standard POSCAR`) because the K-path corresponds to this specific orientation. Using your original POSCAR may result in incorrect paths.
140
+
130
141
  ### 🕸️ Generate K-Points (Interactive)
131
142
 
132
143
  Generate a `KPOINTS` file for SCF calculations interactively.
@@ -8,6 +8,7 @@ valyte/band_plot.py
8
8
  valyte/cli.py
9
9
  valyte/dos_plot.py
10
10
  valyte/kpoints.py
11
+ valyte/potcar.py
11
12
  valyte/supercell.py
12
13
  valyte/valyte_band.png
13
14
  valyte/valyte_dos.png
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes