diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..cf7a39f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "pip" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" diff --git a/AtomPacker/__init__.py b/AtomPacker/__init__.py index bf442c7..8430b9a 100644 --- a/AtomPacker/__init__.py +++ b/AtomPacker/__init__.py @@ -4,7 +4,7 @@ __author__ = """João V S Guerra""" __email__ = 'jvsguerra@gmail.com' -__version__ = '0.1.0' +__version__ = '0.1.1' from . import AtomPacker from .AtomPacker import PackmolStructure, CavityDetector, AtomPacker diff --git a/README.md b/README.md index 24ffe22..36f663f 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,7 @@ pip install -e AtomPacker ## Usage -There are two pipelines available to pack nanoparticle atoms inside a supramolecular cage: - -### 1. Packing nanoparticle atoms freely with packmol and filter atoms inside the cavity; +Packing nanoparticle atoms freely with packmol and filter atoms inside the cavity ```python from AtomPacker import * @@ -69,42 +67,6 @@ ap.packing(replicates=10) print(ap.summary) ``` -### 2. Packing nanoparticle atoms with packmol inside a boundary and filter atoms inside the cavity; - -```python -from AtomPacker import * - -# Load supramolecular cage into PackmolStructure object -smc = PackmolStructure( - os.path.join("data", "C1.pdb"), - number=1, - instructions=["center", "fixed 0. 0. 0. 0. 0. 0."], -) - -# Load nanoparticle atoms into PackmolStructure object -# NOTE: You must set an appropriate number of atoms to fill the cavity and define a sphere that contains the whole supramolecular cage -np_atom = PackmolStructure( - os.path.join("data", "Au.pdb"), number=40, instructions=["inside sphere 0. 0. 0. 6."] -) - -# Create a CavityDetector with detection parameters appropriate for the supramolecular cage -cd = CavityDetector(step=0.25, probe_in=1.4, probe_out=10.0, removal_distance=1.0, volume_cutoff=5.0, vdw=None) - -# Create the AtomPacked object -# NOTE: For gold, atom radius is 1.36 Å -ap = AtomPacker(smc, np_atom, np_atom_radius=1.36, cavity_detector=cd, -basedir="pipeline-2") - -# Add a boundary to pack nanoparticle atoms -ap.add_boundary() - -# Run Packing algorithm with 10 replicates -ap.packing(replicates=10) - -# Show number of packed atoms -print(ap.summary) -``` - ## Citing If you find `AtomPacker` useful for you, please cite the following sources: diff --git a/pyproject.toml b/pyproject.toml index 37a646c..5d07e72 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,8 @@ build-backend = "setuptools.build_meta" name = "AtomPacker" description = "A python package for packing atoms into a supramolecular cage" authors = [ - { name = "João Victor da Silva Guerra", email = "jvsguerra@gmail.com" }, + { name = "João Victor da Silva Guerra" }, + { name = "Gabriel Ernesto Jara" }, ] maintainers = [ { name = "João Victor da Silva Guerra", email = "jvsguerra@gmail.com" }, @@ -29,11 +30,11 @@ classifiers = [ "Programming Language :: Python :: 3 :: Only", ] dependencies = [ - "MDAnalysis==2.6.1", - "numpy==1.26.1", - "pyKVFinder==0.6.8", - "pandas==2.1.1", - "scipy==1.11.2", + "MDAnalysis==2.7.0", + "numpy==1.26.3", + "pyKVFinder==0.6.11", + "pandas==2.1.4", + "scipy==1.11.4", ] dynamic = ["version"] diff --git a/tests/conftest.py b/tests/conftest.py index f6fb7f0..f23c517 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,8 +8,7 @@ def clean_directories(): # Define the directories to remove directories_to_remove = [ - "tests/pipeline-1", - "tests/pipeline-2", + "tests/pipeline", # Add more directories to remove as needed ] diff --git a/tests/test_pipeline_1.py b/tests/test_pipeline.py similarity index 81% rename from tests/test_pipeline_1.py rename to tests/test_pipeline.py index 9b7f04b..4df0f0c 100644 --- a/tests/test_pipeline_1.py +++ b/tests/test_pipeline.py @@ -57,20 +57,20 @@ def test_pipeline_1(np_atom_params): np_atom, np_atom_radius=np_atom_radius, cavity_detector=cd, - basedir=os.path.join(HERE, "pipeline-1", basename), + basedir=os.path.join(HERE, "pipeline", basename), ) # Run Packing algorithm ap.packing(replicates=REPLICATES) # Perform assertions to check if files were created for the specified np_atom and np_atom_radius - assert os.path.exists(os.path.join(HERE, "pipeline-1", basename, "PackedAtoms.csv")) - assert os.path.exists(os.path.join(HERE, "pipeline-1", basename, "cavity.pdb")) - assert os.path.exists(os.path.join(HERE, "pipeline-1", basename, "packmol.inp")) - assert os.path.exists(os.path.join(HERE, "pipeline-1", basename, "packmol.stdout")) + assert os.path.exists(os.path.join(HERE, "pipeline", basename, "PackedAtoms.csv")) + assert os.path.exists(os.path.join(HERE, "pipeline", basename, "cavity.pdb")) + assert os.path.exists(os.path.join(HERE, "pipeline", basename, "packmol.inp")) + assert os.path.exists(os.path.join(HERE, "pipeline", basename, "packmol.stdout")) for replicate in range(REPLICATES): assert os.path.exists( - os.path.join(HERE, "pipeline-1", basename, f"packed{replicate}.pdb") + os.path.join(HERE, "pipeline", basename, f"packed{replicate}.pdb") ) diff --git a/tests/test_pipeline_2.py b/tests/test_pipeline_2.py deleted file mode 100644 index 55c2579..0000000 --- a/tests/test_pipeline_2.py +++ /dev/null @@ -1,92 +0,0 @@ -import os -import pytest -from AtomPacker import * - -HERE = os.path.abspath(os.path.dirname(__file__)) -REPLICATES = 10 - - -# Define a fixture for different np_atom and np_atom_radius combinations -@pytest.fixture( - params=[ - {"np_atom_file": os.path.join(HERE, "data", "Au.pdb"), "np_atom_radius": 1.36}, - {"np_atom_file": os.path.join(HERE, "data", "Pd.pdb"), "np_atom_radius": 1.39}, - ] -) -def np_atom_params(request): - return request.param - - -# Define a test function to test AtomPacker with different np_atom and np_atom_radius -@pytest.mark.filterwarnings("ignore::UserWarning") -def test_pipeline_1(np_atom_params): - # Define a basename for the temporary directory - basename = np_atom_params["np_atom_file"].split("/")[-1].replace(".pdb", "") - - # Extract parameters from the fixture - np_atom_file = np_atom_params["np_atom_file"] - np_atom_radius = np_atom_params["np_atom_radius"] - - # Load supramolecular cage into PackmolStructure object - smc = PackmolStructure( - os.path.join(HERE, "data", "C1.pdb"), - number=1, - instructions=["center", "fixed 0. 0. 0. 0. 0. 0."], - ) - - # Load nanoparticle atoms into PackmolStructure object (specified by np_atom_file) - np_atom = PackmolStructure( - np_atom_file, - number=40, - instructions=["inside sphere 0. 0. 0. 7."], - ) - - # Create a CavityDetector with detection parameters appropriate for the supramolecular cage - cd = CavityDetector( - step=0.25, - probe_in=1.4, - probe_out=10.0, - removal_distance=1.0, - volume_cutoff=5.0, - vdw=None, - ) - - # Create the AtomPacker object with specified np_atom_radius - ap = AtomPacker( - smc, - np_atom, - np_atom_radius=np_atom_radius, - cavity_detector=cd, - basedir=os.path.join(HERE, "pipeline-2", basename), - ) - - # Add a boundary to pack nanoparticle atoms (pipeline 2 specific step) - ap.add_boundary() - - # Run Packing algorithm - ap.packing(replicates=REPLICATES) - - # Perform assertions to check if files were created for the specified np_atom and np_atom_radius - assert os.path.exists( - os.path.join(HERE, "pipeline-2", basename, "PackedAtoms.csv") - ) - assert os.path.exists( - os.path.join(HERE, "pipeline-2", basename, "cavity.pdb") - ) - assert os.path.exists( - os.path.join(HERE, "pipeline-2", basename, "packmol.inp") - ) - assert os.path.exists( - os.path.join(HERE, "pipeline-2", basename, "packmol.stdout") - ) - for replicate in range(REPLICATES): - assert os.path.exists( - os.path.join( - HERE, "pipeline-2", basename, f"packed{replicate}.pdb" - ) - ) - - -# Run the pytest framework -if __name__ == "__main__": - pytest.main([__file__])