Skip to main content

Simple thin client to interface python scripts with SambVca catalytic pocket Fortran calculator.

Project description

py2sambvca

Simple thin client to interface python scripts with SambVca catalytic pocket Fortran calculator.

py2sambvca logo

GitHub Repo Stars PyPI - Downloads Total Downloads PyPI commits since PyPI - Python Version PyPI - License Test Status

Installation

py2sambvca is available on PyPI and can be installed like so:

pip install py2sambvca

py2sambvca has zero external dependencies.

Downloading and Compiling SambVca

py2sambvca can read and write input and output files for SambVca without the actual program in place, but in order to run input files you must have an executable sambvca21.exe (or similar) somewhere on your machine.

You can download the source code on the SambVca webserver and compile it using gfortran.

By default, py2sambvca expects the executable to be present in the cwd and named sambvca21.exe on Windows or sambvca21.x on Unix-based systems. optionally, the filepath to your executable can be specified as shown below.

Usage

After installation, py2sambvca can be added to a Python script via import and instantiated:

from py2sambvca import p2s

nhc_p2s = p2s(
    "test/data/nhc.xyz",
    [22],
    [5],
    [1],
    path_to_sambvcax="sambvca21.exe",
)

The required input parameters are shown below:

  • xyz_filepath (str): Location of .xyz molecular coordinates file for writing input data
  • sphere_center_atom_ids (list): ID of atoms defining the sphere center
  • z_ax_atom_ids (list): ID of atoms for z-axis
  • xz_plane_atoms_ids (list): ID of atoms for xz-plane

The following parameters are optional and will be filled with default values if not specified:

  • atoms_to_delete_ids (list): ID of atoms to be deleted (default None)
  • sphere_radius (float): Sphere radius in Angstrom (default 3.5)
  • displacement (float): Displacement of oriented molecule from sphere center in Angstrom (default 0.0)
  • mesh_size (float): Mesh size for numerical integration (default 0.10)
  • remove_H (int): 0/1 Do not remove/remove H atoms from Vbur calculation (default 1)
  • orient_z (int): 0/1 Molecule oriented along negative/positive Z-axis (default 1)
  • write_surf_files (int): 0/1 Do not write/write files for top and bottom surfaces (default 1)
  • path_to_sambvcax (str): Path to the SambVca executable. Only needed to use py2sambvca.calc()(default "sambvca.exe")
  • working_dir (path): Path to the working directory where the output and input files are generated (default py2sambvca_temp_UUID). UUID is used to ensure that py2sambvca is threadsafe (i.e., can be run in parallel with multiprocessing or free threading).
  • verbose (int): 0 for no output, 1 for some output, 2 for the most output (default 1)
  • radii_table (dict or str): a dictionary of atomic symbols and their radii (angstroms), "vdw" for the Van der Waals radii, or "default" for the radii used in the original implementation

From here, running can be done stepwise or with a single function:

nhc_p2s.run()
# equivalent to
nhc_p2s.write_input()
nhc_p2s.calc()
nhc_p2s.parse_output()
nhc_p2s.clean_files()

All values for the total complex, quadrants, and octants are available through getters:

Total Values Quadrant Values Octant Values
get_free_volume() get_quadrant_free_volume() get_octant_free_volume()
get_buried_volume() get_quadrant_buried_volume() get_octant_buried_volume()
get_exact_volume() not available not available
get_total_volume() get_quadrant_total_volume() get_octant_total_volume()
get_percent_buried_volume() get_quadrant_percent_buried_volume() get_octant_percent_buried_volume()
get_percent_free_volume() get_quadrant_percent_free_volume() get_octant_percent_free_volume()
get_percent_total_volume() not available not available

Results can also be accessed through a general getter method: get(), get_quadrant_result(), and get_octant_result().

All results can also be directly accessed through dictionaries, returned from a call to run() or parse_output() and available through p2s.total_results, p2s.quadrant_results, and p2s.octant_results.

In case there is something else you are looking for, you can use a general purpose get_regex() function to return the line containing a pattern.

Examples

Here are a couple repositories using py2sambvca as a Python package or extending its source code, check them out:

See Also

  • Kjell Jorner's morfeus package re-implements the original buried volume algorithm directly in Python

License

py2sambvca is available under the GNU GPLv3 in accordance with the base Fortran code which is available under the same license and can be retreieved here: https://www.molnac.unisa.it/OMtools/sambvca2.1/download/download.html

The original fortran program (sambvca21.f) is also included in the test directory for testing purposes. It is still under the same terms of the GNU license:

  • This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.
  • This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  • The results obtained from using the source code shall be used for scientific purposes only, excluding industrial or commercial purposes. To use the SambVca suite for industrial or commercial purposes, contact lcavallo|@|unisa.it.
  • Proper acknowledgement shall be made to the author of the source code in publications resulting from the use of it in its original form or modified.
  • The results from using the source code are provided "AS IS" without warranty of any kind.

Citation

Please cite the SambVca underlying Fortran tool according to the guidelines on the buried volume webserver: https://www.molnac.unisa.it/OMtools/sambvca2.1/help/help.html

py2sambvca has been uploaded to Figshare and may be cited as: Burns, J. figshare. 2020, DOI:10.6084/m9.figshare.12846707

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py2sambvca-2.0.0.post1.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py2sambvca-2.0.0.post1-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file py2sambvca-2.0.0.post1.tar.gz.

File metadata

  • Download URL: py2sambvca-2.0.0.post1.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for py2sambvca-2.0.0.post1.tar.gz
Algorithm Hash digest
SHA256 1771c766d75ea0ee11620eee4bdf031eb3c7ec71c1d1f8add61af9b24e0b1e36
MD5 0b69ed139403da33bb7ae8261d68c7ca
BLAKE2b-256 373563683575ebfb289aa2cdb2c38396b222b19f60dbea0117cd0f23605e80f9

See more details on using hashes here.

File details

Details for the file py2sambvca-2.0.0.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for py2sambvca-2.0.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 0323b08ef43dd3a50d827574bce4b677bdcfa9fdf1286acdd5402ff3dc79fa80
MD5 0c37b85f64d16411986c7f43f0292432
BLAKE2b-256 4bf51cc4d76b6c1d7de46966c485df3f2be10ae6f22e40fae5b0b25be4806d5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page