Skip to content

Commit

Permalink
fix examples; adapt readme a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
eimrek committed Feb 5, 2025
1 parent 4d68a5f commit 527ce85
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 17 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ Features include:

### Installation

The package requires an MPI implementation to be available on your system for `mpi4py`. You can install it:
The package requires an MPI implementation to be available on your system for `mpi4py`. One option is `mpich`, which you can install with:

- On Linux: through your package manager (e.g., `apt install mpich` or `yum install mpich`)
- On macOS: through Homebrew (`brew install mpich`)
- On Windows: through conda (`conda install -c conda-forge mpich`)
- Or via conda, but then it's recommended to install it together with `mpi4py`: `conda install -c conda-forge mpi4py mpich`

Then install the package with pip:

```bash
pip install cp2k-spm-tools
```

Or, for development:

```bash
git clone https://github.com/nanotech-empa/cp2k-spm-tools.git
cd cp2k-spm-tools
Expand Down Expand Up @@ -64,11 +66,15 @@ cgo.load_restart_wfn_file("./PROJ-RESTART.wfn", n_occ=2, n_virt=2)

### Evaluate the orbitals in the specific region ###
cgo.calc_morbs_in_region(
dr_guess = 0.15, # grid spacing
dr_guess = 0.15, # grid spacing, can change very slightly
x_eval_region = None, # take whole cell in x
y_eval_region = [0.0, cgo.cell_ang[1]/2], # half cell in y
z_eval_region = [19.0, 24.0], # around the molecule in z
)

cgo.write_cube("./homo.cube", orbital_nr=0)
```

Here's the resulting cube file, illustrating the constrained region of evaluation:

<img src="examples/example.png" width="500">
2 changes: 1 addition & 1 deletion examples/benzene_cube_from_wfn/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BASIS_PATH="../data/BASIS_MOLOPT"

mkdir cubes

../../cube_from_wfn.py \
cp2k-cube-from-wfn \
--cp2k_input_file $DATA_PATH/cp2k.inp \
--basis_set_file $BASIS_PATH \
--xyz_file $DATA_PATH/geom.xyz \
Expand Down
2 changes: 1 addition & 1 deletion examples/benzene_overlap/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ BASIS_PATH="../data/BASIS_MOLOPT"

mkdir out

mpirun -n 2 python3 ../../overlap_from_wfns.py \
mpirun -n 2 cp2k-overlap-from-wfns \
--cp2k_input_file1 "$SLAB_FOLDER"/cp2k.inp \
--basis_set_file1 $BASIS_PATH \
--xyz_file1 "$SLAB_FOLDER"/geom.xyz \
Expand Down
4 changes: 2 additions & 2 deletions examples/benzene_stm/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BASIS_PATH="../data/BASIS_MOLOPT"

mkdir out

mpirun -n 2 python3 ../../stm_sts_from_wfn.py \
mpirun -n 2 cp2k-stm-sts-wfn \
--cp2k_input_file "$FOLDER"/cp2k.inp \
--basis_set_file $BASIS_PATH \
--xyz_file "$FOLDER"/geom.xyz \
Expand All @@ -32,5 +32,5 @@ mpirun -n 2 python3 ../../stm_sts_from_wfn.py \
--fwhms 0.5 \

cd out
../../../stm_sts_plotter.py --orb_npz orb.npz --stm_npz stm.npz
cp2k-stm-sts-plot --orb_npz orb.npz --stm_npz stm.npz

4 changes: 2 additions & 2 deletions examples/c2h2_bader_bond_order/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mkdir out

echo "### 1: calculate charge density cube ###"

mpirun -n 2 python3 ../../cube_from_wfn.py \
mpirun -n 2 cp2k-cube-from-wfn \
--cp2k_input_file "$FOLDER"/cp2k.inp \
--basis_set_file $BASIS_PATH \
--xyz_file "$FOLDER"/geom.xyz \
Expand Down Expand Up @@ -43,7 +43,7 @@ cd ..

echo "### 3: calculate bond order based on the Bader basins ###"

mpirun -n 2 python3 ../../bader_bond_order.py \
mpirun -n 2 cp2k-bader-bond-order \
--cp2k_input_file "$FOLDER"/cp2k.inp \
--basis_set_file $BASIS_PATH \
--xyz_file "$FOLDER"/geom.xyz \
Expand Down
2 changes: 1 addition & 1 deletion examples/c2h2_bader_charge_wfn/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BASIS_PATH="../data/BASIS_MOLOPT"

mkdir out

mpirun -n 2 python3 ../../cube_from_wfn.py \
mpirun -n 2 cp2k-cube-from-wfn \
--cp2k_input_file "$FOLDER"/cp2k.inp \
--basis_set_file $BASIS_PATH \
--xyz_file "$FOLDER"/geom.xyz \
Expand Down
2 changes: 1 addition & 1 deletion examples/o2_cube_from_wfn/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BASIS_PATH="../data/BASIS_MOLOPT"

mkdir cubes

../../cube_from_wfn.py \
cp2k-cube-from-wfn \
--cp2k_input_file $DIR/inp \
--basis_set_file $BASIS_PATH \
--xyz_file $DIR/aiida.coords.xyz \
Expand Down
2 changes: 1 addition & 1 deletion examples/o2_overlap/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BASIS_PATH="../data/BASIS_MOLOPT"

mkdir out

mpirun -n 2 python3 ../../overlap_from_wfns.py \
mpirun -n 2 cp2k-overlap-from-wfns \
--cp2k_input_file1 "$SLAB_FOLDER"/inp \
--basis_set_file1 $BASIS_PATH \
--xyz_file1 "$SLAB_FOLDER"/aiida.coords.xyz \
Expand Down
7 changes: 4 additions & 3 deletions examples/run_all_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
# Loop through all subdirectories
for dir in */ ; do
if [ -f "$dir/run.sh" ]; then
echo "####"
echo "#### Running example in $dir"
echo "####"
echo ""
echo "# ----"
echo "# Running example in $dir"
echo "# ----"
(cd "$dir" && ./run.sh)
fi
done
2 changes: 1 addition & 1 deletion examples/tbau2_cube_from_wfn/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BASIS_PATH="../data/BASIS_MOLOPT"

mkdir cubes

../../cube_from_wfn.py \
cp2k-cube-from-wfn \
--cp2k_input_file $DIR/inp \
--basis_set_file $BASIS_PATH \
--xyz_file $DIR/aiida.coords.xyz \
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ cp2k-cube-operations = "cp2k_spm_tools.cli.cube_operations:main"
cp2k-cube-single-column = "cp2k_spm_tools.cli.cube_single_column:main"
cp2k-cube-split = "cp2k_spm_tools.cli.cube_split:main"
cp2k-hrstm-from-wfn = "cp2k_spm_tools.cli.hrstm_from_wfn:main"
cp2k-overlap-from-wfn = "cp2k_spm_tools.cli.overlap_from_wfns:main"
cp2k-overlap-from-wfns = "cp2k_spm_tools.cli.overlap_from_wfns:main"
cp2k-stm-sts-wfn = "cp2k_spm_tools.cli.stm_sts_from_wfn:main"
cp2k-stm-sts-plot = "cp2k_spm_tools.cli.stm_sts_plotter:main"

Expand Down

0 comments on commit 527ce85

Please sign in to comment.