Skip to content

Added own scripts: getPOTCAR.sh, plotHOMA_withPBC.py and xyz2POSCAR.py#15

Merged
patrickmelix merged 15 commits intoTonner-Zech-Group:mainfrom
JakobSchramm:feat/add_my_scripts
Apr 17, 2026
Merged

Added own scripts: getPOTCAR.sh, plotHOMA_withPBC.py and xyz2POSCAR.py#15
patrickmelix merged 15 commits intoTonner-Zech-Group:mainfrom
JakobSchramm:feat/add_my_scripts

Conversation

@JakobSchramm
Copy link
Copy Markdown

getPOTCAR.sh - Generate POTCAR with same order of elements as specified in POSCAR.
plotHOMA_withPBC.py - Calculate and plot HOMA from coordinates, including pbc.
xyz2POSCAR.py - Insert molecule from .xyz file into a cell from a POSCAR.

Copy link
Copy Markdown
Member

@patrickmelix patrickmelix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice additions Jakob — the POTCAR script in particular fills a common workflow gap. A couple of inline suggestions.

Comment thread src/tools4vasp/bash_scripts/getPOTCAR.sh Outdated
Comment thread src/tools4vasp/xyz2POSCAR.py Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds three new utilities to the tools4vasp toolkit for common VASP workflows: generating a POTCAR matching POSCAR element order, inserting an XYZ molecule into a POSCAR cell, and computing/plotting HOMA (with a PBC plotting workaround). It also updates the README tool list to mention the new commands.

Changes:

  • Added xyz2POSCAR.py for inserting/centering/sorting/constraining and optionally rotating an XYZ molecule into a POSCAR-defined cell.
  • Added plotHOMA_withPBC.py to compute HOMA values and generate a 2D plot, with optional PBC tiling for visualization.
  • Added bash_scripts/getPOTCAR.sh to assemble a POTCAR from a POSCAR’s element ordering; updated README to document new tools.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 19 comments.

File Description
src/tools4vasp/xyz2POSCAR.py New CLI-like script to create a POSCAR from an XYZ molecule and a reference cell.
src/tools4vasp/plotHOMA_withPBC.py New script to compute/plot HOMA and optionally replicate atoms for PBC plotting.
src/tools4vasp/bash_scripts/getPOTCAR.sh New bash utility to concatenate POTCARs in POSCAR element order.
README.md Documents the new tools in the command list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tools4vasp/plotHOMA_withPBC.py Outdated
Comment thread src/tools4vasp/plotHOMA_withPBC.py
Comment thread src/tools4vasp/plotHOMA_withPBC.py Outdated
Comment thread README.md
Comment thread src/tools4vasp/xyz2POSCAR.py Outdated
Comment thread src/tools4vasp/plotHOMA_withPBC.py Outdated
Comment thread src/tools4vasp/xyz2POSCAR.py Outdated
Comment thread src/tools4vasp/plotHOMA_withPBC.py Outdated
Comment thread src/tools4vasp/bash_scripts/getPOTCAR.sh
Comment thread src/tools4vasp/xyz2POSCAR.py Outdated
Copy link
Copy Markdown
Member

@patrickmelix patrickmelix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more items that Copilot correctly caught.

Comment thread src/tools4vasp/xyz2POSCAR.py Outdated
Comment thread src/tools4vasp/bash_scripts/getPOTCAR.sh
Comment thread src/tools4vasp/plotHOMA_withPBC.py Outdated
Comment thread src/tools4vasp/plotHOMA_withPBC.py Outdated
Comment thread src/tools4vasp/xyz2POSCAR.py
patrickmelix added a commit that referenced this pull request Apr 17, 2026
mixed_interpolate.py and xyz2POSCAR.py (PRs #15, #16) import
scipy.optimize.leastsq for plane fitting, but scipy was not declared
as a dependency. This causes ImportError on fresh installs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@patrickmelix patrickmelix self-requested a review April 17, 2026 10:26
JakobSchramm and others added 15 commits April 17, 2026 10:28
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
xyz2POSCAR.py:
- Remove leftover max(solution) lines before norm_val fix
- Fix typo "Molacular" → "Molecular"
- Add format='vasp' to mol.write() for reliable POSCAR output

getPOTCAR.sh:
- Fix typo "creats" → "creates"
- Remove Fr from "None" group in help text (it belongs in "sv")

plotHOMA_withPBC.py:
- Guard against empty cycles list (IndexError on acyclic systems)
- Fix uninitialized factor/digit when distance == d_opt exactly
- Remove trailing comma after argparse line

Co-Authored-By: Patrick Melix <chemistry@melix.me>
getPOTCAR, xyz2POSCAR, and plotHOMA_withPBC are not wired as
console scripts in pyproject.toml yet. Add footnote so users
know to run them directly from the repo checkout.

Co-Authored-By: Patrick Melix <chemistry@melix.me>
… tests

xyz2POSCAR.py:
- Rename main() → run(), add new main() with argparse
- Now installable as `xyz2POSCAR` console command

plotHOMA_withPBC.py:
- Rename main() → run(), add new main() with argparse
- Now installable as `plotHOMA_withPBC` console command

pyproject.toml:
- Register xyz2POSCAR and plotHOMA_withPBC as entry points

README.md:
- Remove non-installable footnotes for xyz2POSCAR and plotHOMA_withPBC
- Keep footnote only for getPOTCAR (bash script)

test_coverage.py:
- 4 tests for xyz2POSCAR: basic run, rotation, constraints, main() CLI
- 3 tests for plotHOMA_withPBC: benzene ring, empty cycles error, main() CLI

Co-Authored-By: Patrick Melix <chemistry@melix.me>
Add getPOTCAR.py that forwards CLI args to getPOTCAR.sh via
subprocess, following the same pattern as calc_deformation_density.py.
Register as console script in pyproject.toml so `getPOTCAR` is
available after `pip install`.

Remove the non-installable footnote from README — all tools are now
installable console commands.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@patrickmelix patrickmelix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude says good

@patrickmelix patrickmelix merged commit 1684b44 into Tonner-Zech-Group:main Apr 17, 2026
2 checks passed
patrickmelix added a commit that referenced this pull request Apr 17, 2026
Resolve conflicts by taking main's version for plotHOMA_withPBC.py,
xyz2POSCAR.py, and README.md (no branch-specific changes). Keep
branch version of getPOTCAR.sh (env-var logic).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants