Skip to content

Commit

Permalink
Merge pull request #9 from amritagos/develop
Browse files Browse the repository at this point in the history
Develop: upgrade ASE etc
  • Loading branch information
amritagos authored Feb 4, 2025
2 parents 6e9577f + f310813 commit d70d7f9
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 140 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ jobs:
post-cleanup: 'all'

- if: runner.os == 'Linux'
name: Setup xvfb (Linux)
run: |
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0 libxcb-shape0 libglib2.0-0 libgl1-mesa-dev
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
name: Setup xvfb (Linux)
run: |
sudo apt-get update --fix-missing
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 \
libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0 libxcb-shape0 \
libglib2.0-0 libgl1-mesa-dev || sudo apt-get install -y libgl1-mesa-glx
sudo apt-get install -y '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev \
libxkbcommon-x11-dev
export DISPLAY=:99
Xvfb :99 -screen 0 1280x1024x24 &
- name: Install the package
shell: micromamba-shell {0}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## About

Various ways to analyze and visualize solvation shell structures, which wraps [`PyVista`](https://docs.pyvista.org/version/stable/). Meant primarily for analyzing the outputs produced by LAMMPS here.
Various ways to analyze and visualize solvation shell structures, which wraps [`PyVista`](https://docs.pyvista.org/version/stable/). Meant primarily for analyzing the outputs produced by LAMMPS, but anything that [ASE](https://gitlab.com/ase/ase) can handle should work.

## Installation

Expand Down Expand Up @@ -48,7 +48,7 @@ In order to debug tests using `pdb`, you can write the command `breakpoint()` in

To see more verbose output from `pytest`, including tests that pass, you can run `pytest -rA`.

Note that `test_hydrogen_bond.py` and `test_plot_octahedral_shell.py` actually compare the results of images created for a single hydrogen bond and for an octahedral shell showing hydrogen bonds formed by the acceptor seventh molecule, respectively. The images compared against are present in the top-level `image_cache_dir` directory.
Note that `test_hydrogen_bond.py` and `test_plot_octahedral_shell.py` actually compare the results of images created for a single hydrogen bond and for an octahedral shell showing hydrogen bonds formed by the acceptor seventh molecule, respectively. The images compared against are present in the top-level `image_cache_dir` directory. The package [`pytest-pyvista`](https://github.com/pyvista/pytest-pyvista) is used for image verification.

To view a coverage report, run the following from the top-level directory:

Expand Down
34 changes: 17 additions & 17 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,32 @@ channels:
# - {{ compiler('c++') }}
dependencies:
- python>=3.10
- build<0.10.0
- python-build
- ase>=3.22.1
- numpy>=1.26.4 # 1.22.4
- scipy>=1.7.3
- ipython>=8.26.0
- pandas>=2.2.2
- pyvista==0.43.0
- pyvista>=0.43.0
- pytest-pyvista
# Dependencies for pyvista
- vtk==9.2.6
- pillow==10.0.1
- imageio==2.31.5
- pooch==1.8.0
- scooby==0.9.2
- vtk>=9.2.6
- pillow>=10.0.1
- imageio>=2.31.5
- pooch>=1.8.0
- scooby>=0.9.2
# Packaging
- twine
- flit==3.9.0
- pytest==6.2.5
- coverage==6.1.1
- pytest-cov==3.0.0
- flake8==3.9.2
- mypy==0.910
- black==22.3.0
- isort==5.9.3
- autoflake==1.4
- flake8-docstrings==1.6.0
- flit>=3.9.0
- pytest>=6.2.5
- coverage>=6.1.1
- pytest-cov>=3.0.0
- flake8>=3.9.2
- mypy>=0.910
- black>=22.3.0
- isort>=5.9.3
- autoflake>=1.4
- flake8-docstrings>=1.6.0
- meson-python>=0.16.0
- pytest-cov>=3.0.0
# - pip:
Expand Down
Binary file modified image_cache_dir/octahedral_shell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 16 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,39 @@ build-backend = "mesonpy"

[project]
name = "solvis-tools"
version = "0.1.4"
version = "0.1.5"
description = "A module for analyzing and visualizing solvation shells in LAMMPS output files, but would work with most files that can be handled by ASE."
authors = [
{name = "Amrita Goswami", email = "[email protected]"},
]
classifiers=[
'Programming Language :: Python :: 3.10']
dependencies = [
"ase == 3.22.1",
"ase >= 3.22.1",
"numpy",
"scipy >= 1.7.3",
"pyvista == 0.43.0",
"pillow == 10.0.1",
"imageio == 2.31.5",
"pooch==1.8.0",
"scooby==0.9.2"]
"pyvista >= 0.43.0",
"pillow >= 10.0.1",
"imageio >= 2.31.5",
"pooch>=1.8.0",
"scooby>=0.9.2"]
requires-python = ">=3.10"
readme = "README.md"
license = {text = "MIT"}

[project.optional-dependencies]
test = [
"pytest==6.2.5",
"coverage==6.1.1",
"pytest-cov==3.0.0",
"pytest>=6.2.5",
"coverage>=6.1.1",
"pytest-cov>=3.0.0",
]
dev = [
"flake8==3.9.2",
"mypy==0.910",
"black==22.3.0",
"isort==5.9.3",
"autoflake==1.4",
"flake8-docstrings==1.6.0",
"flake8>=3.9.2",
"mypy>=0.910",
"black>=22.3.0",
"isort>=5.9.3",
"autoflake>=1.4",
"flake8-docstrings>=1.6.0",
]
examples = [
"pandas"
Expand Down
95 changes: 0 additions & 95 deletions resources/system_oct_hbonds.data

This file was deleted.

31 changes: 31 additions & 0 deletions resources/system_oct_hbonds.lammpstrj
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
ITEM: TIMESTEP
0
ITEM: NUMBER OF ATOMS
22
ITEM: BOX BOUNDS pp pp pp
0.0 49.3343262653
0.0 49.3343262653
0.0 49.3343262653
ITEM: ATOMS id type mol x y z
8342 1 2952 36.7343285501 15.8050824282 11.0866297913
8343 2 2952 36.4231130904 15.6435884192 11.9790976036
8344 2 2952 36.0541073213 15.430605905 10.523983995
51 3 51 38.4269627491 16.7640096871 10.5166861564
6917 1 2477 37.3705723999 18.4064471724 9.9960275912
10241 1 3585 38.190079692 16.032697681 8.6381675257
10242 2 3585 37.7089454164 16.4231842844 7.9063654411
10243 2 3585 38.5194086342 15.2011958161 8.2921883998
11081 1 3865 39.5037304337 15.1105580206 10.9930383184
11082 2 3865 40.4563419719 15.002068572 10.9764231595
11083 2 3865 39.172385178 14.271094096 11.3171288078
11231 1 3915 40.1398526826 17.685469079 9.9427187829
11232 2 3915 40.6050552836 18.3827417874 10.4084777851
11233 2 3915 40.6345096646 17.568816026 9.1295717459
6919 2 2477 36.7264230983 18.7590344697 10.6137857894
6918 2 2477 37.4060896033 19.0546184324 9.2904820606
4745 1 1753 38.6612581135 17.4564295043 12.4015089326
4746 2 1753 37.9776645136 18.0020671862 12.7962175922
4747 2 1753 39.308292735 17.3402502873 13.0994298131
3417 2 1310 35.3461723311 18.5020561601 12.7963785306
3416 1 1310 36.205330391 18.8010521733 12.4957046084
3418 2 1310 36.2695761464 19.7031328123 12.8124575692
2 changes: 1 addition & 1 deletion tests/test_hydrogen_bonds.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_single_hbond(verify_image_cache):
infilename, format="lammps-dump-text"
) # Read in the last frame of the trajectory
# Box size lengths
box_len = currentframe.get_cell_lengths_and_angles()[:3]
box_len = currentframe.cell.cellpar()[:3]

# Create a SolvationShell object from the solvent
solvation_shell = solvis.solvation_shell.create_solvation_shell_from_solvent(
Expand Down
8 changes: 4 additions & 4 deletions tests/test_plot_octahedral_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_octahedral_shell(verify_image_cache):
"""
# Input filename
test_dir = Path(__file__).resolve().parent
infilename = test_dir / "../resources/system_oct_hbonds.data"
infilename = test_dir / "../resources/system_oct_hbonds.lammpstrj"
# In the LAMMPS trajectory file, the types of atoms are 1, 2 and 3 for O, H and Fe respectively.
fe_type = 3
h_type = 2
Expand All @@ -30,10 +30,10 @@ def test_octahedral_shell(verify_image_cache):

# Read in the current frame
currentframe = read(
infilename, format="lammps-data"
infilename, format="lammps-dump-text"
) # Read in the last frame of the trajectory
# Box size lengths
box_len = currentframe.get_cell_lengths_and_angles()[:3]
box_len = currentframe.cell.cellpar()[:3]

# Make a System object
full_system = solvis.system.System(currentframe, expand_box=True)
Expand Down Expand Up @@ -127,7 +127,7 @@ def test_octahedral_shell(verify_image_cache):
["center", iatom_tag],
bond_type=1,
colorby="bondtype",
**bond1_render_opt
**bond1_render_opt,
)

# Change the color of the bond from the seventh atom
Expand Down

0 comments on commit d70d7f9

Please sign in to comment.