├── .ciignore ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── pull_request_template.md └── workflows │ ├── Sandpit_exs.yml │ └── main.yaml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.rst ├── RELEASE_INSTRUCTIONS.rst ├── SECURITY.md ├── actions ├── collect_failed.py ├── parse_requirements.py ├── update_recipe.py └── upload_package.py ├── demo ├── amber │ └── ala │ │ ├── ala.crd │ │ └── ala.top ├── conversion.ipynb ├── conversion.py ├── gromacs │ └── kigaki │ │ ├── kigaki.gro │ │ └── kigaki.top ├── hydration_freenrg.ipynb ├── input_files.ipynb ├── input_files.py ├── interactive_md.ipynb ├── interactive_setup.ipynb ├── knime │ └── knime.py ├── metadynamics.ipynb ├── minimisation.ipynb ├── minimisation.py ├── molecular_setup.ipynb ├── molecular_setup.py ├── molecules │ ├── 2JJC.pdb │ ├── 4V2Y_A.pdb │ ├── benzene.pdb │ ├── cyclohexane.pdb │ ├── ethane.pdb │ ├── ethane.prm7 │ ├── ethane.rst7 │ ├── methane.pdb │ ├── methane.prm7 │ ├── methane.rst7 │ ├── methanol.pdb │ ├── methanol.prm7 │ └── methanol.rst7 └── namd │ ├── alanin │ ├── alanin.params │ ├── alanin.pdb │ └── alanin.psf │ └── ubiquitin │ ├── par_all27_prot_lipid.inp │ ├── ubiquitin.pdb │ ├── ubiquitin.psf │ └── ubiquitin.xsc ├── doc ├── Makefile ├── requirements.txt ├── source │ ├── _static │ │ ├── css │ │ │ ├── custom_fonts.css │ │ │ ├── custom_pygments.css │ │ │ └── custom_style.css │ │ ├── forwards_compatibility.png │ │ ├── js │ │ │ └── custom.js │ │ ├── node.png │ │ ├── plot_01.png │ │ ├── plot_02.png │ │ ├── plot_03.png │ │ ├── plot_04.png │ │ ├── plot_05.png │ │ ├── view_01.png │ │ └── view_02.png │ ├── _templates │ │ └── sidebar │ │ │ └── search.html │ ├── api │ │ ├── index.rst │ │ ├── index_Align.rst │ │ ├── index_Box.rst │ │ ├── index_Config.rst │ │ ├── index_Exceptions.rst │ │ ├── index_FreeEnergy.rst │ │ ├── index_Gateway.rst │ │ ├── index_IO.rst │ │ ├── index_MD.rst │ │ ├── index_Metadynamics.rst │ │ ├── index_Metadynamics_CollectiveVariable.rst │ │ ├── index_Node.rst │ │ ├── index_Notebook.rst │ │ ├── index_Parameters.rst │ │ ├── index_Process.rst │ │ ├── index_Protocol.rst │ │ ├── index_Sandpit.rst │ │ ├── index_SireWrappers.rst │ │ ├── index_Solvent.rst │ │ ├── index_Trajectory.rst │ │ ├── index_Types.rst │ │ ├── index_Units.rst │ │ └── index_Utils.rst │ ├── changelog.rst │ ├── code_of_conduct.rst │ ├── compatibility.rst │ ├── conf.py │ ├── contributing │ │ ├── codestyle.rst │ │ ├── development.rst │ │ ├── index.rst │ │ ├── packaging.rst │ │ └── roadmap.rst │ ├── contributors.rst │ ├── features.rst │ ├── guides │ │ ├── index.rst │ │ ├── nodes.rst │ │ └── protocols.rst │ ├── images │ │ ├── favicon.ico │ │ └── logo.svg │ ├── index.rst │ ├── install.rst │ ├── quickstart │ │ └── index.rst │ ├── support.rst │ └── tutorials │ │ ├── hydration_freenrg.rst │ │ ├── images │ │ ├── cv_time_series.png │ │ ├── ethane_methanol_mapping.png │ │ ├── free_nrg_contour.png │ │ └── free_nrg_phi.png │ │ ├── index.rst │ │ └── metadynamics.rst └── winbuild.bat ├── git_hooks └── commit-msg ├── nodes ├── README.rst └── playground │ ├── BSSEqBoundNode.ipynb │ ├── BSSEqFreeNode.ipynb │ ├── BSSPrepNode.ipynb │ ├── BSSSetup │ ├── BSS_Setup.py │ ├── FESetup_parser.py │ └── input │ ├── amberequilibration.ipynb │ ├── amberequilibration.py │ ├── combine.ipynb │ ├── combine.py │ ├── conformational_analysis │ ├── 2-cyclopentanylindole.mol2 │ ├── Conformation_analysis_I.ipynb │ ├── Conformation_analysis_II.ipynb │ ├── Conformational_analysis.ipynb │ ├── README │ ├── cpptraj.in │ ├── eq1.in │ ├── eq2.in │ ├── eq3.in │ ├── eq4.in │ ├── eq5.in │ └── prod.in │ ├── parameterise.ipynb │ ├── parameterise.py │ ├── prepareFEP.ipynb │ ├── prepareFEP.py │ ├── solvate.ipynb │ ├── solvate.py │ └── solvation │ ├── README.md │ ├── benzene.pdb │ ├── setup_molecule.py │ └── setup_molecule_shell.py ├── paper ├── figures │ ├── fig1.png │ ├── fig2.png │ └── fig3.png ├── paper.bib └── paper.md ├── pyproject.toml ├── python ├── .gitattributes ├── BioSimSpace │ ├── Align │ │ ├── __init__.py │ │ ├── _align.py │ │ └── _merge.py │ ├── Box │ │ ├── __init__.py │ │ └── _box.py │ ├── FreeEnergy │ │ ├── __init__.py │ │ ├── _relative.py │ │ └── _utils.py │ ├── Gateway │ │ ├── __init__.py │ │ ├── _node.py │ │ ├── _requirements.py │ │ └── _resources.py │ ├── IO │ │ ├── __init__.py │ │ └── _io.py │ ├── MD │ │ ├── __init__.py │ │ ├── _md.py │ │ └── _utils.py │ ├── Metadynamics │ │ ├── CollectiveVariable │ │ │ ├── __init__.py │ │ │ ├── _collective_variable.py │ │ │ ├── _distance.py │ │ │ ├── _funnel.py │ │ │ ├── _rmsd.py │ │ │ ├── _torsion.py │ │ │ └── _utils.py │ │ ├── __init__.py │ │ ├── _aux │ │ │ ├── ProjectionOnAxis.cpp │ │ │ └── metadynamics.py │ │ ├── _bound.py │ │ ├── _grid.py │ │ ├── _metadynamics.py │ │ ├── _restraint.py │ │ └── _utils.py │ ├── Node │ │ ├── __init__.py │ │ └── _node.py │ ├── Notebook │ │ ├── __init__.py │ │ ├── _plot.py │ │ └── _view.py │ ├── Parameters │ │ ├── _Protocol │ │ │ ├── __init__.py │ │ │ ├── _amber.py │ │ │ ├── _openforcefield.py │ │ │ └── _protocol.py │ │ ├── __init__.py │ │ ├── _parameters.py │ │ ├── _process.py │ │ └── _utils.py │ ├── Process │ │ ├── __init__.py │ │ ├── _amber.py │ │ ├── _gromacs.py │ │ ├── _namd.py │ │ ├── _openmm.py │ │ ├── _plumed.py │ │ ├── _process.py │ │ ├── _process_runner.py │ │ ├── _somd.py │ │ ├── _task.py │ │ └── _utils.py │ ├── Protocol │ │ ├── __init__.py │ │ ├── _custom.py │ │ ├── _equilibration.py │ │ ├── _free_energy.py │ │ ├── _metadynamics.py │ │ ├── _minimisation.py │ │ ├── _production.py │ │ ├── _protocol.py │ │ ├── _steering.py │ │ └── _utils.py │ ├── Sandpit │ │ ├── Exscientia │ │ │ ├── Align │ │ │ │ ├── __init__.py │ │ │ │ ├── _align.py │ │ │ │ ├── _decouple.py │ │ │ │ ├── _merge.py │ │ │ │ └── _squash.py │ │ │ ├── Box │ │ │ │ ├── __init__.py │ │ │ │ └── _box.py │ │ │ ├── FreeEnergy │ │ │ │ ├── __init__.py │ │ │ │ ├── _relative.py │ │ │ │ ├── _restraint.py │ │ │ │ ├── _restraint_search.py │ │ │ │ └── _utils.py │ │ │ ├── Gateway │ │ │ │ ├── __init__.py │ │ │ │ ├── _node.py │ │ │ │ ├── _requirements.py │ │ │ │ └── _resources.py │ │ │ ├── IO │ │ │ │ ├── __init__.py │ │ │ │ └── _io.py │ │ │ ├── MD │ │ │ │ ├── __init__.py │ │ │ │ ├── _md.py │ │ │ │ └── _utils.py │ │ │ ├── Metadynamics │ │ │ │ ├── CollectiveVariable │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── _collective_variable.py │ │ │ │ │ ├── _distance.py │ │ │ │ │ ├── _funnel.py │ │ │ │ │ ├── _rmsd.py │ │ │ │ │ ├── _torsion.py │ │ │ │ │ └── _utils.py │ │ │ │ ├── __init__.py │ │ │ │ ├── _aux │ │ │ │ │ ├── ProjectionOnAxis.cpp │ │ │ │ │ └── metadynamics.py │ │ │ │ ├── _bound.py │ │ │ │ ├── _grid.py │ │ │ │ ├── _metadynamics.py │ │ │ │ ├── _restraint.py │ │ │ │ └── _utils.py │ │ │ ├── Node │ │ │ │ ├── __init__.py │ │ │ │ └── _node.py │ │ │ ├── Notebook │ │ │ │ ├── __init__.py │ │ │ │ ├── _plot.py │ │ │ │ └── _view.py │ │ │ ├── Parameters │ │ │ │ ├── _Protocol │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── _amber.py │ │ │ │ │ ├── _openforcefield.py │ │ │ │ │ └── _protocol.py │ │ │ │ ├── __init__.py │ │ │ │ ├── _parameters.py │ │ │ │ ├── _process.py │ │ │ │ └── _utils.py │ │ │ ├── Process │ │ │ │ ├── __init__.py │ │ │ │ ├── _amber.py │ │ │ │ ├── _gromacs.py │ │ │ │ ├── _namd.py │ │ │ │ ├── _openmm.py │ │ │ │ ├── _plumed.py │ │ │ │ ├── _process.py │ │ │ │ ├── _process_runner.py │ │ │ │ ├── _somd.py │ │ │ │ ├── _task.py │ │ │ │ └── _utils.py │ │ │ ├── Protocol │ │ │ │ ├── __init__.py │ │ │ │ ├── _config.py │ │ │ │ ├── _custom.py │ │ │ │ ├── _equilibration.py │ │ │ │ ├── _free_energy.py │ │ │ │ ├── _free_energy_equilibration.py │ │ │ │ ├── _free_energy_minimisation.py │ │ │ │ ├── _free_energy_mixin.py │ │ │ │ ├── _metadynamics.py │ │ │ │ ├── _minimisation.py │ │ │ │ ├── _position_restraint.py │ │ │ │ ├── _production.py │ │ │ │ ├── _protocol.py │ │ │ │ ├── _steering.py │ │ │ │ └── _utils.py │ │ │ ├── Solvent │ │ │ │ ├── __init__.py │ │ │ │ └── _solvent.py │ │ │ ├── Trajectory │ │ │ │ ├── __init__.py │ │ │ │ └── _trajectory.py │ │ │ ├── Types │ │ │ │ ├── __init__.py │ │ │ │ ├── _angle.py │ │ │ │ ├── _area.py │ │ │ │ ├── _base_units.py │ │ │ │ ├── _charge.py │ │ │ │ ├── _coordinate.py │ │ │ │ ├── _energy.py │ │ │ │ ├── _general_unit.py │ │ │ │ ├── _length.py │ │ │ │ ├── _pressure.py │ │ │ │ ├── _temperature.py │ │ │ │ ├── _time.py │ │ │ │ ├── _type.py │ │ │ │ ├── _vector.py │ │ │ │ └── _volume.py │ │ │ ├── Units │ │ │ │ ├── Angle │ │ │ │ │ └── __init__.py │ │ │ │ ├── Area │ │ │ │ │ └── __init__.py │ │ │ │ ├── Charge │ │ │ │ │ └── __init__.py │ │ │ │ ├── Energy │ │ │ │ │ └── __init__.py │ │ │ │ ├── Length │ │ │ │ │ └── __init__.py │ │ │ │ ├── Pressure │ │ │ │ │ └── __init__.py │ │ │ │ ├── Temperature │ │ │ │ │ └── __init__.py │ │ │ │ ├── Time │ │ │ │ │ └── __init__.py │ │ │ │ ├── Volume │ │ │ │ │ └── __init__.py │ │ │ │ └── __init__.py │ │ │ ├── _Exceptions │ │ │ │ ├── __init__.py │ │ │ │ └── _exceptions.py │ │ │ ├── _SireWrappers │ │ │ │ ├── __init__.py │ │ │ │ ├── _atom.py │ │ │ │ ├── _bond.py │ │ │ │ ├── _molecule.py │ │ │ │ ├── _molecules.py │ │ │ │ ├── _residue.py │ │ │ │ ├── _search_result.py │ │ │ │ ├── _sire_wrapper.py │ │ │ │ └── _system.py │ │ │ ├── _Utils │ │ │ │ ├── __init__.py │ │ │ │ ├── _command_split.py │ │ │ │ ├── _contextmanagers.py │ │ │ │ └── _module_stub.py │ │ │ ├── __init__.py │ │ │ └── _version.py │ │ └── __init__.py │ ├── Solvent │ │ ├── __init__.py │ │ └── _solvent.py │ ├── Trajectory │ │ ├── __init__.py │ │ └── _trajectory.py │ ├── Types │ │ ├── __init__.py │ │ ├── _angle.py │ │ ├── _area.py │ │ ├── _base_units.py │ │ ├── _charge.py │ │ ├── _coordinate.py │ │ ├── _energy.py │ │ ├── _general_unit.py │ │ ├── _length.py │ │ ├── _pressure.py │ │ ├── _temperature.py │ │ ├── _time.py │ │ ├── _type.py │ │ ├── _vector.py │ │ └── _volume.py │ ├── Units │ │ ├── Angle │ │ │ └── __init__.py │ │ ├── Area │ │ │ └── __init__.py │ │ ├── Charge │ │ │ └── __init__.py │ │ ├── Energy │ │ │ └── __init__.py │ │ ├── Length │ │ │ └── __init__.py │ │ ├── Pressure │ │ │ └── __init__.py │ │ ├── Temperature │ │ │ └── __init__.py │ │ ├── Time │ │ │ └── __init__.py │ │ ├── Volume │ │ │ └── __init__.py │ │ └── __init__.py │ ├── _Config │ │ ├── __init__.py │ │ ├── _amber.py │ │ ├── _config.py │ │ ├── _gromacs.py │ │ └── _somd.py │ ├── _Exceptions │ │ ├── __init__.py │ │ └── _exceptions.py │ ├── _SireWrappers │ │ ├── __init__.py │ │ ├── _atom.py │ │ ├── _bond.py │ │ ├── _molecule.py │ │ ├── _molecules.py │ │ ├── _residue.py │ │ ├── _search_result.py │ │ ├── _sire_wrapper.py │ │ └── _system.py │ ├── _Utils │ │ ├── __init__.py │ │ ├── _command_split.py │ │ ├── _contextmanagers.py │ │ └── _module_stub.py │ ├── __init__.py │ └── _version.py ├── MANIFEST.in ├── setup.cfg ├── setup.py └── versioneer.py ├── recipes └── biosimspace │ ├── LICENSE │ ├── bld.bat │ ├── build.sh │ └── template.yaml ├── requirements.txt ├── requirements_build.txt └── test ├── Align └── test_align.py ├── Gateway ├── node.py ├── test_boolean.py ├── test_file.py ├── test_fileset.py ├── test_float.py ├── test_integer.py ├── test_node.py └── test_string.py ├── IO ├── test_file_cache.py └── test_openff_gromacs.py ├── MD └── test_md.py ├── Parameters └── test_parameters.py ├── Process ├── test_amber.py ├── test_gromacs.py ├── test_namd.py ├── test_openmm.py ├── test_single_point_energy.py └── test_somd.py ├── Sandpit └── Exscientia │ ├── Align │ ├── test_align.py │ ├── test_decouple.py │ └── test_squash.py │ ├── FreeEnergy │ ├── test_relative.py │ ├── test_restraint.py │ └── test_restraint_search.py │ ├── Gateway │ ├── node.py │ ├── test_boolean.py │ ├── test_file.py │ ├── test_fileset.py │ ├── test_float.py │ ├── test_integer.py │ ├── test_node.py │ └── test_string.py │ ├── IO │ ├── test_file_cache.py │ └── test_openff_gromacs.py │ ├── MD │ └── test_md.py │ ├── Parameters │ └── test_parameters.py │ ├── Process │ ├── test_amber.py │ ├── test_gromacs.py │ ├── test_namd.py │ ├── test_openmm.py │ ├── test_position_restraint.py │ ├── test_restart.py │ ├── test_single_point_energy.py │ └── test_somd.py │ ├── Protocol │ ├── test_config.py │ └── test_free_energy_mixin.py │ ├── Trajectory │ └── test_trajectory.py │ ├── Types │ ├── test_general_unit.py │ └── test_types.py │ ├── _SireWrappers │ ├── test_bond.py │ ├── test_molecule.py │ ├── test_properties.py │ ├── test_search_result.py │ └── test_system.py │ ├── input │ └── merged_tripeptide.pickle │ └── output │ └── gromacs.edr ├── Trajectory └── test_trajectory.py ├── Types ├── test_general_unit.py └── test_types.py ├── _SireWrappers ├── test_bond.py ├── test_molecule.py ├── test_properties.py ├── test_search_result.py └── test_system.py └── input ├── ala.crd ├── ala.gro ├── ala.top ├── ala.tpr ├── ala.trr ├── alanin.params ├── alanin.pdb ├── alanin.psf └── morph.pert /.ciignore: -------------------------------------------------------------------------------- 1 | nodes/playground/* 2 | paper/* 3 | README* 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Load the files '...' 16 | 2. Run the code '...' 17 | 3. This is the exception that was raised / this is what went wrong. 18 | 19 | **Expected behavior** 20 | A clear and concise description of what you expected to happen 21 | (or, it should not raise an exception if an exception was raised) 22 | 23 | **Input files** 24 | If possible, please attached some input files or put some input files 25 | on the web that we can use to reproduce this problem. Even better, if 26 | you can, could you supply a short python script that can reproduce 27 | the problem? We will use this as the base for a new unit test to 28 | diagnose and fix your issue. 29 | 30 | **(please complete the following information):** 31 | - OS: [e.g. Linux (distribution), MacOS (version), Windows (version)] 32 | - Version of Python: [e.g. 3.8, 3.9 etc.] 33 | - Version of BioSimSpace: [e.g. 2023.1, or latest `dev` release] 34 | - I confirm that I have checked this bug still exists in the latest released version of BioSimSpace: [yes/no] 35 | 36 | **Additional context** 37 | Add any other context about the problem here. 38 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Is this pull request to fix a bug, or to introduce new functionality? 2 | 3 | ## If this is to fix a bug... 4 | 5 | This pull request fixes issue #? 6 | 7 | * I confirm that I have merged the latest version of `devel` into this branch before issuing this pull request (e.g. by running `git pull origin devel`): [y/n] 8 | * I confirm that I have permission to release this code under the GPL3 license: [y/n] 9 | 10 | ## If this introduces new functionality... 11 | 12 | Changes proposed in this pull request: 13 | 14 | * I confirm that I have merged the latest version of `devel` into this branch before issuing this pull request (e.g. by running `git pull origin devel`): [y/n] 15 | * I confirm that I have added a test for any new functionality in this pull request: [y/n] 16 | * I confirm that I have added documentation (e.g. a new tutorial page or detailed guide) for any new functionality in this pull request: [y/n] 17 | * I confirm that I have permission to release this code under the GPL3 license: [y/n] 18 | 19 | ## Suggested reviewers: 20 | @lohedges, @chryswoods 21 | 22 | ## Any additional context of information? 23 | 24 | (you can also attach files by dragging & dropping) 25 | -------------------------------------------------------------------------------- /.github/workflows/Sandpit_exs.yml: -------------------------------------------------------------------------------- 1 | name: Sandpit_exs_CI 2 | 3 | on: 4 | # run once a day at noon UTC 5 | schedule: 6 | - cron: "0 12 * * *" 7 | push: 8 | pull_request: 9 | workflow_dispatch: 10 | 11 | defaults: 12 | run: 13 | shell: bash -l {0} 14 | 15 | jobs: 16 | test: 17 | runs-on: ${{ matrix.os }} 18 | strategy: 19 | fail-fast: false 20 | matrix: 21 | os: ["ubuntu-latest", "macOS-latest",] 22 | python-version: ["3.8", ] 23 | 24 | steps: 25 | - uses: actions/checkout@v2 26 | 27 | - uses: conda-incubator/setup-miniconda@v2 28 | with: 29 | auto-update-conda: true 30 | python-version: ${{ matrix.python-version }} 31 | activate-environment: bss_build 32 | miniforge-version: latest 33 | miniforge-variant: Mambaforge 34 | use-mamba: true 35 | 36 | - name: Install dependency 37 | run: | 38 | # gromacs=2022.2 as gromacs=2022.3 is not available on OSX ATM 39 | mamba install -c conda-forge -c openbiosim/label/dev biosimspace python=3.8 ambertools gromacs=2022.2 "sire>=2023.1.0" alchemlyb pytest 40 | python -m pip install git+https://github.com/Exscientia/MDRestraintsGenerator.git 41 | # For the testing of BSS.FreeEnergy.Relative.analysis 42 | python -m pip install https://github.com/alchemistry/alchemtest/archive/master.zip 43 | 44 | - name: Install the dev version 45 | run: | 46 | conda remove --force biosimspace 47 | cd python 48 | python setup.py develop 49 | cd .. 50 | 51 | - name: Run tests 52 | run: | 53 | pytest -v --color=yes test/Sandpit/Exscientia/ 54 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files. 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions. 6 | *.so 7 | 8 | # Pytest directories. 9 | .pytest_cache/ 10 | 11 | # macOS folder attributes. 12 | .DS_Store 13 | 14 | # Jupyter notebook checkpoints. 15 | .ipynb_checkpoints/ 16 | 17 | # Build artifacts. 18 | setup.out 19 | setup.err 20 | dist/ 21 | build/ 22 | BioSimSpace.egg-info 23 | 24 | # Test output. 25 | output.yaml 26 | 27 | # Trajectory artifacts. 28 | *_offsets.npz 29 | *.lock 30 | 31 | # Scratch space. 32 | .idea/ 33 | 34 | # VSCode config 35 | .vscode/ 36 | 37 | # Conda recipe (it is auto-generated) 38 | recipes/biosimspace/meta.yaml 39 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We welcome all helpful contributions to improving the quality of BioSimSpace. We have a 4 | [complete guide on how to contribute](https://biosimspace.openbiosim.org/contributing/index.html) 5 | on our website. 6 | 7 | Ways you can help include: 8 | 9 | * Finding and fixing documentation bugs and typos. 10 | * Writing new tutorials, short how-to guides or blog posts. 11 | * Creating more tests and adding them to the pytest library. 12 | * Porting and testing BioSimSpace on different computers. 13 | * Proposing and helping write or test new features. 14 | * Funding development by donating to OpenBioSim. 15 | * We accept pull requests to the devel branch and are happy to discuss ideas via GitHub issues on the repo. 16 | 17 | When contributing, please keep in mind our [Code of Conduct](https://biosimspace.openbiosim.org/code_of_conduct.html). 18 | 19 | Please also ensure that your contribution is compatible with our license. BioSimSpace is licensed under the GPLv3 or later. 20 | Please ensure your contribution is similarly licensed (i.e. GPLv3 or later for the C++ code, MIT, BSD, Apache or GPLv3 or 21 | later for the Python code). Please ensure that your employer (if you are writing code as an employee) gives permission 22 | for you to contribute your code. 23 | 24 | Before contributing we encourage everyone to complete [the tutorial](https://biosimspace.openbiosim.org/tutorial/index.html), 25 | as this gives a good grounding in how BioSimSpace works and how the code is laid out. If you have any problems running 26 | the tutorial then please raise an issue. 27 | 28 | Finally, please do add your name or GitHub handle to our [Contributors page](https://biosimspace.openbiosim.org/contributors.html) 29 | before you submit your pull request. This will ensure that your status as a contributor to BioSimspace can be forever recognised :-) 30 | -------------------------------------------------------------------------------- /RELEASE_INSTRUCTIONS.rst: -------------------------------------------------------------------------------- 1 | BioSimSpace release instructions 2 | ********************************* 3 | 4 | The following instructions describe how to create a new BioSimSpace release: 5 | 6 | Step 1 7 | ====== 8 | 9 | Update the `CHANGELOG `_ 10 | file with a summary of the changes for this relase. Feel free to link to 11 | `GitHub issues `_ where relevant 12 | and give credit for specific contributions. 13 | 14 | Step 2 15 | ====== 16 | 17 | When you're happy, tag the commit that you want to be associated with the 18 | release. The following will tag the latest commit: 19 | 20 | .. code-block:: bash 21 | 22 | git tag -a 2023.1.0 -m "Tagging the 2023.1.0 release of BioSimSpace." 23 | 24 | Step 3 25 | ====== 26 | 27 | Push the commit and tag to the ``devel`` branch on the remote: 28 | 29 | .. code-block:: bash 30 | 31 | git push origin devel --follow-tags 32 | 33 | This will trigger a new Azure Pipelines build which will create binaries 34 | and Conda packages for the release. If you make a mistake and want to move 35 | the tag to a later commit, simply delete the tag from the remote: 36 | 37 | .. code-block:: bash 38 | 39 | git push origin :refs/tags/2023.1.0 40 | 41 | Next, delete the Conda release package from the `Anaconda Cloud `_. 42 | You can then move the tag to the latest commit: 43 | 44 | .. code-block:: bash 45 | 46 | git tag -fa 2023.1.0 47 | 48 | Finally, push the new commit and updated tag: 49 | 50 | .. code-block:: bash 51 | 52 | git push origin devel --follow-tags 53 | 54 | Step 4 55 | ====== 56 | 57 | Create a `GitHub release `_. 58 | When drafting the release, simply choose the tag that you have created. 59 | 60 | Step 5 61 | ====== 62 | 63 | Create a `pull request `_ to 64 | merge ``devel`` into the ``master`` branch. 65 | 66 | That's it! 67 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | As we have limited resource, we only support the latest major release 6 | of BioSimSpace with security updates. For example, if the current version 7 | is 2023.1.0, then only versions 2023.1.0 to 2023.1.X wil have updates, 8 | which will be released as 2023.1.X+1. 9 | 10 | | Version | Supported | 11 | | ------- | ------------------ | 12 | | 2023.1.x | :white_check_mark: | 13 | | < 2023.1.x| :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Please report a vulnerability by emailing the OpenBioSim 18 | team at support@openbiosim.org. We will review your report as quickly 19 | as we can, and will aim to respond to you within seven days with 20 | the outcome. We really appreciate your help and your patience. 21 | -------------------------------------------------------------------------------- /actions/collect_failed.py: -------------------------------------------------------------------------------- 1 | # Script that collects as much as it can from a failed conda build so that it can 2 | # be stored as a GitHub Actions artifact for download and further debugging 3 | 4 | import os 5 | import sys 6 | import glob 7 | import tarfile 8 | 9 | if "BUILD_DIR" not in os.environ: 10 | try: 11 | os.environ["BUILD_DIR"] = sys.argv[1] 12 | except Exception: 13 | print("You need to supply BUILD_DIR") 14 | sys.exit(-1) 15 | 16 | build_dir = os.environ["BUILD_DIR"] 17 | 18 | # We want to bzip up the last 'sire-*' and all 'broken-*' directories in build_dir 19 | work_dirs = glob.glob(os.path.join(build_dir, "biosimspace_*", "work", "build")) 20 | broken_dirs = glob.glob(os.path.join(build_dir, "broke*")) 21 | 22 | if len(work_dirs) > 0: 23 | work_dirs = [work_dirs[-1]] 24 | 25 | zipdirs = work_dirs + broken_dirs 26 | 27 | output_filename = os.path.join(build_dir, "failed.tar.bz2") 28 | 29 | print(f"Zipping up {zipdirs} to {output_filename}") 30 | 31 | 32 | def filter_function(tarinfo): 33 | filename = tarinfo.name 34 | # print(filename) 35 | if filename.find(".git") != -1: 36 | # print("excluded!") 37 | return None 38 | else: 39 | return tarinfo 40 | 41 | 42 | with tarfile.open(output_filename, "w:bz2") as tar: 43 | for dir in zipdirs: 44 | tar.add(dir, arcname=os.path.basename(dir), filter=filter_function) 45 | 46 | print("Complete :-)") 47 | -------------------------------------------------------------------------------- /actions/parse_requirements.py: -------------------------------------------------------------------------------- 1 | def parse_requirements(filename): 2 | """Parse the requirements and return (in conda notation) 3 | the requirements for this system. 4 | """ 5 | try: 6 | from pip_requirements_parser import RequirementsFile 7 | except ImportError as e: 8 | print("\n\n[ERROR] ** You need to install pip-requirements-parser") 9 | print("Run `conda install pip-requirements-parser\n\n") 10 | raise e 11 | 12 | from pkg_resources import evaluate_marker 13 | 14 | reqs = RequirementsFile.from_file(filename).to_dict()["requirements"] 15 | 16 | deps = {} 17 | 18 | for req in reqs: 19 | name = req["name"] 20 | specifier = req["specifier"] 21 | marker = req["marker"] 22 | 23 | if len(specifier) == 0: 24 | specifier = "" 25 | else: 26 | specifier = specifier[0] 27 | 28 | if marker is not None: 29 | # check to see if this line fits this platform 30 | include = evaluate_marker(marker) 31 | else: 32 | include = True 33 | 34 | if include: 35 | deps[name] = specifier 36 | 37 | reqs = list(deps.keys()) 38 | reqs.sort() 39 | 40 | result = [] 41 | 42 | for req in reqs: 43 | result.append(f"{req}{deps[req]}") 44 | 45 | return result 46 | -------------------------------------------------------------------------------- /actions/update_recipe.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import subprocess 4 | 5 | script = os.path.abspath(sys.argv[0]) 6 | 7 | # we want to import the 'get_requirements' package from this directory 8 | sys.path.insert(0, os.path.dirname(script)) 9 | 10 | from parse_requirements import parse_requirements 11 | 12 | # go up one directories to get the source directory 13 | # (this script is in BioSimSpace/actions/) 14 | srcdir = os.path.dirname(os.path.dirname(script)) 15 | 16 | condadir = os.path.join(srcdir, "recipes", "biosimspace") 17 | 18 | print(f"conda recipe in {condadir}") 19 | 20 | # Store the name of the recipe and template YAML files. 21 | recipe = os.path.join(condadir, "meta.yaml") 22 | template = os.path.join(condadir, "template.yaml") 23 | 24 | # Now parse all of the requirements 25 | run_reqs = parse_requirements(os.path.join(srcdir, "requirements.txt")) 26 | print(run_reqs) 27 | build_reqs = parse_requirements(os.path.join(srcdir, "requirements_build.txt")) 28 | print(build_reqs) 29 | 30 | 31 | def run_cmd(cmd): 32 | p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) 33 | return str(p.stdout.read().decode("utf-8")).lstrip().rstrip() 34 | 35 | 36 | gitdir = os.path.join(srcdir, ".git") 37 | 38 | # Get the BSS branch. 39 | branch = run_cmd( 40 | f"git --git-dir={gitdir} --work-tree={srcdir} rev-parse --abbrev-ref HEAD" 41 | ) 42 | print(branch) 43 | 44 | lines = open(template, "r").readlines() 45 | 46 | 47 | def dep_lines(deps): 48 | lines = [] 49 | 50 | for dep in deps: 51 | lines.append(f" - {dep}\n") 52 | 53 | return "".join(lines) 54 | 55 | 56 | run_reqs = dep_lines(run_reqs) 57 | 58 | if len(build_reqs) > 0: 59 | build_reqs = f" build:\n{dep_lines(build_reqs)}" 60 | else: 61 | build_reqs = "" 62 | 63 | with open(recipe, "w") as FILE: 64 | for line in lines: 65 | if line.find("BSS_BUILD_REQUIREMENTS") != -1: 66 | line = build_reqs 67 | elif line.find("BSS_RUN_REQUIREMENTS") != -1: 68 | line = run_reqs 69 | else: 70 | line = line.replace("BSS_BRANCH", branch) 71 | 72 | FILE.write(line) 73 | -------------------------------------------------------------------------------- /actions/upload_package.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import glob 4 | 5 | script = os.path.abspath(sys.argv[0]) 6 | 7 | # go up one directories to get the source directory 8 | # (this script is in Sire/actions/) 9 | srcdir = os.path.dirname(os.path.dirname(script)) 10 | 11 | print(f"BioSimSpace source is in {srcdir}\n") 12 | 13 | # Get the anaconda token to authorise uploads 14 | if "ANACONDA_TOKEN" in os.environ: 15 | conda_token = os.environ["ANACONDA_TOKEN"] 16 | else: 17 | conda_token = "TEST" 18 | 19 | # get the root conda directory 20 | conda = os.environ["CONDA"] 21 | 22 | # Set the path to the conda-bld directory. 23 | conda_bld = os.path.join(conda, "envs", "bss_build", "conda-bld") 24 | 25 | print(f"conda_bld = {conda_bld}") 26 | 27 | # Find the packages to upload 28 | bss_pkg = glob.glob(os.path.join(conda_bld, "*-*", "biosimspace-*.tar.bz2")) 29 | 30 | if len(bss_pkg) == 0: 31 | print("No BioSimSpace packages to upload?") 32 | sys.exit(-1) 33 | 34 | packages = bss_pkg 35 | 36 | print(f"Uploading packages:") 37 | print(" * ", "\n * ".join(packages)) 38 | 39 | packages = " ".join(packages) 40 | 41 | 42 | def run_cmd(cmd): 43 | import subprocess 44 | 45 | p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) 46 | return str(p.stdout.read().decode("utf-8")).lstrip().rstrip() 47 | 48 | 49 | gitdir = os.path.join(srcdir, ".git") 50 | 51 | tag = run_cmd(f"git --git-dir={gitdir} --work-tree={srcdir} tag --contains") 52 | 53 | # If the tag is not empty, then set the label to main (this is a release) 54 | if tag is not None and tag.lstrip().rstrip() != "": 55 | print(f"\nTag {tag} is set. This is a 'main' release.") 56 | label = "--label main --label dev" 57 | else: 58 | # this is a development release 59 | print("\nNo tag is set. This is a 'devel' release.") 60 | label = "--label dev" 61 | 62 | # Upload the packages to the openbiosim channel on Anaconda Cloud. 63 | cmd = f"anaconda --token {conda_token} upload --user openbiosim {label} --force {packages}" 64 | 65 | print(f"\nUpload command:\n\n{cmd}\n") 66 | 67 | # Label release packages with main and dev so that dev is at least as new as 68 | # main. Only need to uncomment the libcpuid and fkcombu package uploads when 69 | # there new versions are released. 70 | if conda_token == "TEST": 71 | print("Not uploading as the ANACONDA_TOKEN is not set!") 72 | sys.exit(-1) 73 | 74 | output = run_cmd(cmd) 75 | 76 | print(output) 77 | 78 | print("Package uploaded!") 79 | -------------------------------------------------------------------------------- /demo/knime/knime.py: -------------------------------------------------------------------------------- 1 | # Example script showing how to interface BioSimSpace with KNIME. 2 | 3 | import pandas 4 | import subprocess 5 | import yaml 6 | 7 | # Set the BioSimSpace Python interpreter. 8 | bss_python = "/home/lester/sire.app/bin/python" 9 | 10 | # Set the script name. 11 | script = "minimisation.py" 12 | 13 | # Set the name of the BioSimSpace output YAML file. (This is the default.) 14 | output = "output.yaml" 15 | 16 | # The KNIME Python extension assumes Pandas DataFrame objects as input/output 17 | # of nodes. While this works well for tabular data, it is a poor format for 18 | # the unstructured data required by BioSimSpace. As a hack, we assume the input 19 | # consists of a DataFrame containing a single Series called "input". This 20 | # is simply a dictionary containing key/value pairs for all of the required 21 | # input to the script. BioSimSpace is able to convert strings to any of its 22 | # built in types, so strings can be used for the value of all input variables. 23 | 24 | # (Note that the input DataFrame, "input_table", should be generated elsewhere 25 | # and passed as input to this node.) 26 | 27 | # For example, create a dictionary to hold the input arguments. 28 | input_dict = {"steps": 1000, "files": ["amber/ala/ala.crd", "amber/ala/ala.top"]} 29 | 30 | # Insert the dictionary into the input DataFrame with label "input". 31 | input_table = pandas.DataFrame(data={"input": input_dict}) 32 | 33 | # Write a YAML configuration file for the BioSimSpace script. 34 | with open("input.yaml", "w") as file: 35 | yaml.dump(input_table["input"].to_dict(), file, default_flow_style=False) 36 | 37 | # Generate the shell command. 38 | command = "%s %s -c input.yaml" % (bss_python, script) 39 | 40 | # Run the BioSimSpace script as a subprocess and raise any error if it fails. 41 | try: 42 | subprocess.run(command, shell=True, check=True) 43 | except: 44 | raise 45 | 46 | # Read the output YAML file into a dictionary. 47 | with open(output, "r") as file: 48 | output_dict = yaml.safe_load(file) 49 | 50 | # Insert the dictionary into the output DataFrame with label "output". 51 | output_table = pandas.DataFrame(data={"output": output_dict}) 52 | -------------------------------------------------------------------------------- /demo/molecules/benzene.pdb: -------------------------------------------------------------------------------- 1 | iCOMPND UNNAMED 2 | AUTHOR GENERATED BY OPEN BABEL 2.3.2 3 | HETATM 1 C LIG 1 -0.760 1.169 -0.001 1.00 0.00 C 4 | HETATM 2 C LIG 1 0.633 1.245 -0.001 1.00 0.00 C 5 | HETATM 3 C LIG 1 1.395 0.077 0.000 1.00 0.00 C 6 | HETATM 4 C LIG 1 0.764 -1.168 0.003 1.00 0.00 C 7 | HETATM 5 C LIG 1 -0.629 -1.243 0.000 1.00 0.00 C 8 | HETATM 6 C LIG 1 -1.391 -0.075 -0.002 1.00 0.00 C 9 | HETATM 7 H LIG 1 -1.354 2.079 0.001 1.00 0.00 H 10 | HETATM 8 H LIG 1 1.124 2.214 -0.003 1.00 0.00 H 11 | HETATM 9 H LIG 1 2.480 0.135 -0.000 1.00 0.00 H 12 | HETATM 10 H LIG 1 1.358 -2.078 0.006 1.00 0.00 H 13 | HETATM 11 H LIG 1 -1.120 -2.213 -0.000 1.00 0.00 H 14 | HETATM 12 H LIG 1 -2.476 -0.134 -0.003 1.00 0.00 H 15 | CONECT 1 2 6 7 16 | CONECT 2 1 3 8 17 | CONECT 3 2 4 9 18 | CONECT 4 3 5 10 19 | CONECT 5 4 6 11 20 | CONECT 6 5 1 12 21 | CONECT 7 1 22 | CONECT 8 2 23 | CONECT 9 3 24 | CONECT 10 4 25 | CONECT 11 5 26 | CONECT 12 6 27 | MASTER 0 0 0 0 0 0 0 0 12 0 12 0 28 | END 29 | -------------------------------------------------------------------------------- /demo/molecules/cyclohexane.pdb: -------------------------------------------------------------------------------- 1 | HETATM 1 C1 UNK 0 -0.001 0.001 0.002 1.00 0.00 C 2 | HETATM 2 C2 UNK 0 -1.478 0.033 -0.420 1.00 0.00 C 3 | HETATM 3 C3 UNK 0 -2.367 0.510 0.738 1.00 0.00 C 4 | HETATM 4 C4 UNK 0 -2.171 -0.372 1.979 1.00 0.00 C 5 | HETATM 5 C5 UNK 0 -0.695 -0.404 2.400 1.00 0.00 C 6 | HETATM 6 C6 UNK 0 0.195 -0.882 1.243 1.00 0.00 C 7 | HETATM 7 H1 UNK 0 0.345 1.038 0.225 1.00 0.00 H 8 | HETATM 8 H2 UNK 0 0.626 -0.381 -0.839 1.00 0.00 H 9 | HETATM 9 H3 UNK 0 -1.607 0.705 -1.302 1.00 0.00 H 10 | HETATM 10 H4 UNK 0 -1.796 -0.989 -0.737 1.00 0.00 H 11 | HETATM 11 H5 UNK 0 -3.439 0.495 0.425 1.00 0.00 H 12 | HETATM 12 H6 UNK 0 -2.114 1.568 0.989 1.00 0.00 H 13 | HETATM 13 H7 UNK 0 -2.799 0.009 2.820 1.00 0.00 H 14 | HETATM 14 H8 UNK 0 -2.517 -1.410 1.756 1.00 0.00 H 15 | HETATM 15 H9 UNK 0 -0.565 -1.077 3.282 1.00 0.00 H 16 | HETATM 16 H10 UNK 0 -0.376 0.617 2.717 1.00 0.00 H 17 | HETATM 17 H11 UNK 0 1.267 -0.867 1.556 1.00 0.00 H 18 | HETATM 18 H12 UNK 0 -0.059 -1.939 0.991 1.00 0.00 H 19 | CONECT 1 2 6 7 8 20 | CONECT 2 1 3 9 10 21 | CONECT 3 2 4 11 12 22 | CONECT 4 3 5 13 14 23 | CONECT 5 4 6 15 16 24 | CONECT 6 1 5 17 18 25 | CONECT 7 1 26 | CONECT 8 1 27 | CONECT 9 2 28 | CONECT 10 2 29 | CONECT 11 3 30 | CONECT 12 3 31 | CONECT 13 4 32 | CONECT 14 4 33 | CONECT 15 5 34 | CONECT 16 5 35 | CONECT 17 6 36 | CONECT 18 6 37 | END 38 | -------------------------------------------------------------------------------- /demo/molecules/ethane.pdb: -------------------------------------------------------------------------------- 1 | MODEL 1 2 | ATOM 1 C LIG 1 13.485 14.305 13.519 1.00 0.00 C 3 | ATOM 2 C LIG 1 15.021 14.278 13.609 1.00 0.00 C 4 | ATOM 3 H LIG 1 13.106 13.693 14.340 1.00 0.00 H 5 | ATOM 4 H LIG 1 13.037 13.862 12.627 1.00 0.00 H 6 | ATOM 5 H LIG 1 13.069 15.304 13.670 1.00 0.00 H 7 | ATOM 6 H LIG 1 15.528 13.348 13.873 1.00 0.00 H 8 | ATOM 7 H LIG 1 15.209 14.947 14.452 1.00 0.00 H 9 | ATOM 8 H LIG 1 15.487 14.693 12.713 1.00 0.00 H 10 | ENDMDL 11 | END 12 | -------------------------------------------------------------------------------- /demo/molecules/ethane.rst7: -------------------------------------------------------------------------------- 1 | BioSimSpace System 2 | 8 3 | 13.4850000 14.3050000 13.5190000 15.0210000 14.2780000 13.6090000 4 | 13.1060000 13.6930000 14.3400000 13.0370000 13.8620000 12.6270000 5 | 13.0690000 15.3040000 13.6700000 15.5280000 13.3480000 13.8730000 6 | 15.2090000 14.9470000 14.4520000 15.4870000 14.6930000 12.7130000 7 | -------------------------------------------------------------------------------- /demo/molecules/methane.pdb: -------------------------------------------------------------------------------- 1 | MODEL 1 2 | ATOM 1 C LIG 1 0.257 -0.363 0.000 1.00 0.00 C 3 | ATOM 2 H LIG 1 0.257 0.727 0.000 1.00 0.00 H 4 | ATOM 3 H LIG 1 0.771 -0.727 0.890 1.00 0.00 H 5 | ATOM 4 H LIG 1 0.771 -0.727 -0.890 1.00 0.00 H 6 | ATOM 5 H LIG 1 -0.771 -0.727 0.000 1.00 0.00 H 7 | ENDMDL 8 | END 9 | -------------------------------------------------------------------------------- /demo/molecules/methane.rst7: -------------------------------------------------------------------------------- 1 | BioSimSpace System 2 | 5 3 | 0.2570000 -0.3630000 0.0000000 0.2570000 0.7270000 0.0000000 4 | 0.7710000 -0.7270000 0.8900000 0.7710000 -0.7270000 -0.8900000 5 | -0.7710000 -0.7270000 0.0000000 6 | -------------------------------------------------------------------------------- /demo/molecules/methanol.pdb: -------------------------------------------------------------------------------- 1 | MODEL 1 2 | ATOM 1 C MEO 1 -0.361 -2.180 -6.288 1.00 0.00 C 3 | ATOM 2 H1 MEO 1 -0.878 -3.029 -6.400 1.00 0.00 H 4 | ATOM 3 H2 MEO 1 -0.996 -1.413 -6.194 1.00 0.00 H 5 | ATOM 4 H3 MEO 1 0.210 -2.243 -5.469 1.00 0.00 H 6 | ATOM 5 OH MEO 1 0.510 -1.963 -7.490 1.00 0.00 O 7 | ATOM 6 HO MEO 1 1.146 -2.730 -7.584 1.00 0.00 H 8 | ENDMDL 9 | END 10 | -------------------------------------------------------------------------------- /demo/molecules/methanol.rst7: -------------------------------------------------------------------------------- 1 | BioSimSpace System 2 | 6 3 | -0.3610000 -2.1800000 -6.2880000 -0.8780000 -3.0290000 -6.4000000 4 | -0.9960000 -1.4130000 -6.1940000 0.2100000 -2.2430000 -5.4690000 5 | 0.5100000 -1.9630000 -7.4900000 1.1460000 -2.7300000 -7.5840000 6 | -------------------------------------------------------------------------------- /demo/namd/ubiquitin/ubiquitin.xsc: -------------------------------------------------------------------------------- 1 | #$LABELS step a_x a_y a_z b_x b_y b_z c_x c_y c_z o_x o_y o_z s_x s_y s_z s_u s_v s_w 2 | 0 42.0 0 0 0 44.0 0 0 0 47.0 31 29 17.5 0 0 0 0 0 0 3 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | SHELL := /bin/bash 5 | 6 | # You can set these variables from the command line. 7 | SPHINXOPTS = -j8 -v 8 | SPHINXBUILD ?= LANG=C sphinx-build 9 | PAPER = 10 | 11 | BUILD_DIR ?= build 12 | FILES = 13 | 14 | # Internal variables. 15 | PAPEROPT_a4 = -D latex_paper_size=a4 16 | PAPEROPT_letter = -D latex_paper_size=letter 17 | ALLSPHINXOPTS = -d $(BUILD_DIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 18 | 19 | .PHONY: help clean html 20 | 21 | #------------------------------------------------------------------------------ 22 | all: html 23 | help: 24 | @echo "Please use \`make ' where is one of" 25 | @echo " html to make standalone HTML files" 26 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 27 | 28 | clean: 29 | -rm -rf $(BUILD_DIR)/* source/generated source/api/generated 30 | 31 | html: 32 | mkdir -p $(BUILD_DIR)/html $(BUILD_DIR)/doctrees 33 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILD_DIR)/html $(FILES) 34 | @echo 35 | @echo "Build finished. The HTML pages are in build/html." 36 | 37 | latex: 38 | mkdir -p build/latex build/doctrees 39 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex $(FILES) 40 | 41 | html_check: 42 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/html $(FILES) 43 | 44 | -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | furo 2 | pygit2 3 | sphinx 4 | sphinxcontrib-programoutput 5 | sphinx-issues 6 | -------------------------------------------------------------------------------- /doc/source/_static/css/custom_style.css: -------------------------------------------------------------------------------- 1 | 2 | /** Remove all underlines from hyperlinks */ 3 | a:link { 4 | text-decoration: none; 5 | } 6 | 7 | a:visited { 8 | text-decoration: none; 9 | } 10 | 11 | a:hover { 12 | text-decoration: none; 13 | } 14 | 15 | a:active { 16 | text-decoration: none; 17 | } 18 | 19 | .highlight { 20 | border-radius: 10px; 21 | } 22 | 23 | .bottom-of-page { 24 | display: none; 25 | } 26 | 27 | .related-pages { 28 | margin-bottom: 1em; 29 | } 30 | 31 | .version_container { 32 | width: 100%; 33 | display: flex; 34 | flex-direction: row; 35 | align-items: stretch; 36 | } 37 | 38 | .version_box { 39 | flex-grow: 4; 40 | } 41 | 42 | .version_box select { 43 | width: 100%; 44 | height: 100%; 45 | height: 2em; 46 | appearance: none; 47 | text-align: left; 48 | border-radius: 5px; 49 | border: none; 50 | background-color: var(--color-background-primary); 51 | font-size: small; 52 | } 53 | 54 | .version_label { 55 | text-align: left; 56 | padding-right: 1em; 57 | height: 100%; 58 | margin: auto; 59 | font-size: small; 60 | color: var(--color-content-foreground); 61 | } 62 | -------------------------------------------------------------------------------- /doc/source/_static/forwards_compatibility.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/_static/forwards_compatibility.png -------------------------------------------------------------------------------- /doc/source/_static/node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/_static/node.png -------------------------------------------------------------------------------- /doc/source/_static/plot_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/_static/plot_01.png -------------------------------------------------------------------------------- /doc/source/_static/plot_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/_static/plot_02.png -------------------------------------------------------------------------------- /doc/source/_static/plot_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/_static/plot_03.png -------------------------------------------------------------------------------- /doc/source/_static/plot_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/_static/plot_04.png -------------------------------------------------------------------------------- /doc/source/_static/plot_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/_static/plot_05.png -------------------------------------------------------------------------------- /doc/source/_static/view_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/_static/view_01.png -------------------------------------------------------------------------------- /doc/source/_static/view_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/_static/view_02.png -------------------------------------------------------------------------------- /doc/source/_templates/sidebar/search.html: -------------------------------------------------------------------------------- 1 | 6 | 7 | 13 | -------------------------------------------------------------------------------- /doc/source/api/index.rst: -------------------------------------------------------------------------------- 1 | .. _ref_api: 2 | 3 | ================= 4 | API Documentation 5 | ================= 6 | 7 | The API (Application Programming Interface) is divided into a collection 8 | of packages. Note that the input files used in some of the examples are 9 | provided in the `demo `__ 10 | directory of the GitHub repository. 11 | 12 | .. toctree:: 13 | :maxdepth: 1 14 | 15 | index_Align 16 | index_Box 17 | index_FreeEnergy 18 | index_Gateway 19 | index_IO 20 | index_Metadynamics 21 | index_MD 22 | index_Node 23 | index_Notebook 24 | index_Parameters 25 | index_Process 26 | index_Protocol 27 | index_Sandpit 28 | index_Solvent 29 | index_Trajectory 30 | index_Types 31 | index_Units 32 | index_Config 33 | index_Exceptions 34 | index_SireWrappers 35 | index_Utils 36 | -------------------------------------------------------------------------------- /doc/source/api/index_Align.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Align: 2 | 3 | BioSimSpace.Align 4 | ================= 5 | 6 | The *Align* package provides functionality for aligning and merging molecules. 7 | Molecules are aligned using a Maximum Common Substructure (MCS) search, which 8 | is used to find mappings between atom indices in the two molecules. 9 | Functionality is provided for sorting the mappings according to a scoring 10 | function, such as the root mean squared displacement of the alignment that is 11 | generated by the mapping. 12 | 13 | Some examples: 14 | 15 | .. code-block:: python 16 | 17 | import BioSimSpace as BSS 18 | 19 | # Here we assume that we have already created two BioSimSpace molecules, 20 | # mol0 and mol1. 21 | 22 | # Find the best MCS mapping from mol0 to mol1. 23 | mapping = BSS.Align.matchAtoms(mol0, mol1) 24 | 25 | # Return a maximum of 10 matches, scored by RMSD and sorted from best to worst. 26 | mappings = BSS.Align.matchAtoms(mol0, mol1, matches=10) 27 | 28 | # Align mol0 to mol1 based on the best mapping. The molecule is aligned based 29 | # on a root mean squared displacement fit to find the optimal translation vector 30 | # (as opposed to merely taking the difference of centroids). 31 | mol0 = BSS.Align.rmsdAlign(mol0, mol1, mapping) 32 | 33 | # Merge the properties of the two molecules based on the atom mapping. 34 | # The resulting "merged-molecule" can be used in free energy perturbation 35 | # simulations. 36 | merged = BSS.Align.merge(mol0, mol1, mappings) 37 | 38 | .. automodule:: BioSimSpace.Align 39 | 40 | .. toctree:: 41 | :maxdepth: 1 42 | -------------------------------------------------------------------------------- /doc/source/api/index_Box.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Box: 2 | 3 | BioSimSpace.Box 4 | =============== 5 | 6 | The *Box* package contains tools for generating parameters for different 7 | simulation boxes. This is particularly useful when needing box magnitudes and 8 | angles for generating :ref:`ref-Solvent` boxes. 9 | 10 | .. automodule:: BioSimSpace.Box 11 | 12 | .. toctree:: 13 | :maxdepth: 1 14 | -------------------------------------------------------------------------------- /doc/source/api/index_Config.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Config: 2 | 3 | BioSimSpace._Config 4 | =================== 5 | 6 | The *_Config* package contains functionality for generating configuration 7 | files for different molecular dynamics engines. The functionality in this 8 | sub-package is only used internally by the :ref:`Process ` 9 | classes and isn't exposed directly to the user. 10 | 11 | .. automodule:: BioSimSpace._Config 12 | 13 | .. toctree:: 14 | :maxdepth: 1 15 | -------------------------------------------------------------------------------- /doc/source/api/index_Exceptions.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Exceptions: 2 | 3 | BioSimSpace._Exceptions 4 | ======================= 5 | 6 | The *_Exceptions* package contains a collection of custom ``Exception`` types. 7 | 8 | .. automodule:: BioSimSpace._Exceptions 9 | 10 | .. toctree:: 11 | :maxdepth: 1 12 | -------------------------------------------------------------------------------- /doc/source/api/index_Gateway.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Gateway: 2 | 3 | BioSimSpace.Gateway 4 | =================== 5 | 6 | The *Gateway* package provides functionality to act as a bridge between 7 | BioSimSpace and the outside world. It allows the user to define robust 8 | and portable workflow components (nodes) that can be run from a variety 9 | of environments, e.g. within `Jupyter `_, or from 10 | the command-line. 11 | 12 | .. automodule:: BioSimSpace.Gateway 13 | 14 | .. toctree:: 15 | :maxdepth: 1 16 | -------------------------------------------------------------------------------- /doc/source/api/index_IO.rst: -------------------------------------------------------------------------------- 1 | .. _ref-IO: 2 | 3 | BioSimSpace.IO 4 | ============== 5 | 6 | The *IO* package contains tools for reading and writing molecular systems. 7 | 8 | .. automodule:: BioSimSpace.IO 9 | 10 | .. toctree:: 11 | :maxdepth: 1 12 | -------------------------------------------------------------------------------- /doc/source/api/index_MD.rst: -------------------------------------------------------------------------------- 1 | .. _ref-MD: 2 | 3 | BioSimSpace.MD 4 | ============== 5 | 6 | The *MD* package provides functionality for automatically configuring and 7 | running molecular dynamics simulations. The function will choose the most 8 | appropriate molecular dynamics driver based on the software available 9 | on the host, the available hardware, the molecular 10 | :class:`System `, and 11 | :class:`Protocol `, returning the user a handle to 12 | a :class:`Process ` object to run the simulation. 13 | 14 | .. automodule:: BioSimSpace.MD 15 | 16 | .. toctree:: 17 | :maxdepth: 1 18 | -------------------------------------------------------------------------------- /doc/source/api/index_Metadynamics.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Metadynamics: 2 | 3 | BioSimSpace.Metadynamics 4 | ======================== 5 | 6 | The *Metadynamics* package contains tools automatically configure, run, and 7 | analyse metadynamics simulations. 8 | 9 | Metadynamics support requires `PLUMED `__. We provide 10 | support for version 2.5 and above. Once installed, make sure that the 11 | ``plumed`` binary is visible in your ``PATH`` so that it can be found by 12 | BioSimSpace. You will also need to ensure that the PLUMED kernel is 13 | visible, and likely need to update your ``LD_LIBRARY_PATH`` too, e.g: 14 | 15 | .. code-block:: bash 16 | 17 | export PLUMED_KERNEL=/usr/local/lib/libplumedKernel.so 18 | export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH 19 | 20 | To use PLUMED you will also have to patch an appropriate molecular dynamics 21 | engine, following the instructions 22 | `here `__. 23 | At present we only support metadynamics simulations using 24 | `GROMACS `__. 25 | 26 | .. automodule:: BioSimSpace.Metadynamics 27 | 28 | Packages 29 | -------- 30 | 31 | .. toctree:: 32 | :maxdepth: 1 33 | 34 | index_Metadynamics_CollectiveVariable 35 | -------------------------------------------------------------------------------- /doc/source/api/index_Metadynamics_CollectiveVariable.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Metadynamics_CollectiveVariable: 2 | 3 | BioSimSpace.Metadynamics.CollectiveVariable 4 | =========================================== 5 | 6 | The *CollectiveVariable* package contains tools configuring collective 7 | variables for use in metadynamics simulations. 8 | 9 | .. automodule:: BioSimSpace.Metadynamics.CollectiveVariable 10 | 11 | .. toctree:: 12 | :maxdepth: 1 13 | -------------------------------------------------------------------------------- /doc/source/api/index_Node.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Node: 2 | 3 | BioSimSpace.Node 4 | ================ 5 | 6 | The *Node* package contains tools for running BioSimSpace nodes. 7 | 8 | .. automodule:: BioSimSpace.Node 9 | 10 | .. toctree:: 11 | :maxdepth: 1 12 | -------------------------------------------------------------------------------- /doc/source/api/index_Notebook.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Notebook: 2 | 3 | BioSimSpace.Notebook 4 | ==================== 5 | 6 | The *Notebook* package contains tools that are used when BioSimSpace is run 7 | interactively, e.g. within a `Jupyter `__ notebook. 8 | 9 | .. automodule:: BioSimSpace.Notebook 10 | 11 | .. toctree:: 12 | :maxdepth: 1 13 | -------------------------------------------------------------------------------- /doc/source/api/index_Parameters.rst: -------------------------------------------------------------------------------- 1 | .. _ref-parameters: 2 | 3 | BioSimSpace.Parameters 4 | ====================== 5 | 6 | The *Parameters* package contains tools for parameterising molecules with 7 | a range of force fields. 8 | 9 | .. automodule:: BioSimSpace.Parameters 10 | 11 | .. toctree:: 12 | :maxdepth: 1 13 | -------------------------------------------------------------------------------- /doc/source/api/index_Process.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Process: 2 | 3 | BioSimSpace.Process 4 | =================== 5 | 6 | The *Process* package contains tools for running different simulation protocols 7 | with a range of external molecular dynamics packages. Process objects are 8 | instantiated with a molecular :class:`System ` 9 | and a :class:`Protocol `, i.e. they are used to apply 10 | a protocol to a system of molecules. 11 | 12 | Process objects can be automatically generated by the 13 | :class:`BioSimSpace.MD.run ` function, which will choose 14 | the most appropriate molecular dynamics driver based on the software available 15 | on the host, the available hardware, the molecular system, and protocol. 16 | 17 | At a minimum, derived Process classes should override the base class 18 | ``start``, ``getSystem``, and ``getTrajectory`` methods to start the process, 19 | and to get the latest molecular system or trajectory from the running process. 20 | 21 | .. automodule:: BioSimSpace.Process 22 | 23 | .. toctree:: 24 | :maxdepth: 1 25 | -------------------------------------------------------------------------------- /doc/source/api/index_Protocol.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Protocol: 2 | 3 | BioSimSpace.Protocol 4 | ==================== 5 | The *Protocol* package contains functionality for defining generic molecular 6 | dynamics protocols. The protocols contain configurable options that are 7 | common across different molecular dynamics packages. In combination with a 8 | molecular :class:`System `, protocols can 9 | be used to create a molecular dynamics :class:`Process `. 10 | 11 | .. automodule:: BioSimSpace.Protocol 12 | 13 | .. toctree:: 14 | :maxdepth: 1 15 | -------------------------------------------------------------------------------- /doc/source/api/index_Sandpit.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Sandpit: 2 | 3 | BioSimSpace.Sandpit 4 | =================== 5 | 6 | The *Sandpit* enables support for experimental functionality alongside the 7 | development build of BioSimSpace. To use a particular sandpit, e.g. ``X`` 8 | 9 | .. code-block:: python 10 | 11 | import BioSimSpace.Sandpit.X as BSS 12 | 13 | Sandpits allow us to quickly roll out experimental features while we work 14 | on ways to merge them into the main code in an interoperable way. 15 | -------------------------------------------------------------------------------- /doc/source/api/index_SireWrappers.rst: -------------------------------------------------------------------------------- 1 | .. _ref-SireWrappers: 2 | 3 | BioSimSpace._SireWrappers 4 | ========================= 5 | 6 | The *_SireWrappers* package contains a set of thin wrappers around 7 | `Sire `_ objects. These are internal 8 | BioSimSpace types and aren't typically instantiated directly by the 9 | user, instead being created indirectly by BioSimSpace, e.g. through . 10 | :class:`BioSimSpace.IO.readMolecules `. 11 | 12 | .. automodule:: BioSimSpace._SireWrappers 13 | 14 | .. toctree:: 15 | :maxdepth: 1 16 | -------------------------------------------------------------------------------- /doc/source/api/index_Solvent.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Solvent: 2 | 3 | BioSimSpace.Solvent 4 | =================== 5 | 6 | The *Solvent* package contains tools for solvating molecular systems. 7 | 8 | .. automodule:: BioSimSpace.Solvent 9 | 10 | .. toctree:: 11 | :maxdepth: 1 12 | -------------------------------------------------------------------------------- /doc/source/api/index_Trajectory.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Trajectory: 2 | 3 | BioSimSpace.Trajectory 4 | ====================== 5 | 6 | The *Trajectory* package contains tools for reading and analysing molecular 7 | dynamics trajectories. 8 | 9 | .. automodule:: BioSimSpace.Trajectory 10 | 11 | .. toctree:: 12 | :maxdepth: 1 13 | -------------------------------------------------------------------------------- /doc/source/api/index_Types.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Types: 2 | 3 | BioSimSpace.Types 4 | ================= 5 | 6 | The *Types* package contains a collection of custom data types. 7 | 8 | .. automodule:: BioSimSpace.Types 9 | 10 | .. toctree:: 11 | :maxdepth: 1 12 | -------------------------------------------------------------------------------- /doc/source/api/index_Units.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Units: 2 | 3 | BioSimSpace.Units 4 | ================= 5 | 6 | The *Units* package provides a set of common physical units required by BioSimSpace. 7 | This provides convenient, short-hand access to :ref:`ref-Types`. 8 | 9 | Some examples: 10 | 11 | .. code-block:: python 12 | 13 | import BioSimSpace as BSS 14 | 15 | # Create a length of 14.3 Angstrom. 16 | length = BSS.Types.Length(14.3, "Angstrom") # Long-winded way. 17 | length = 14.3*BSS.Units.Length.angstrom # Simplified way. 18 | 19 | # Create an area by multiplying two lengths. 20 | area = 3.6*BSS.Units.Length.nanometer * 12*BSS.Units.Length.angstrom 21 | 22 | # Create a time of 100 milliseconds. 23 | time = 100*BSS.Units.Time.millisecond 24 | 25 | .. automodule:: BioSimSpace.Units 26 | 27 | .. toctree:: 28 | :maxdepth: 1 29 | -------------------------------------------------------------------------------- /doc/source/api/index_Utils.rst: -------------------------------------------------------------------------------- 1 | .. _ref-Utils: 2 | 3 | BioSimSpace._Utils 4 | ================== 5 | 6 | The *_Utils* package contains a collection of internal utilities. 7 | 8 | .. automodule:: BioSimSpace._Utils 9 | 10 | .. toctree:: 11 | :maxdepth: 1 12 | -------------------------------------------------------------------------------- /doc/source/compatibility.rst: -------------------------------------------------------------------------------- 1 | .. _ref_compatibility: 2 | 3 | ============= 4 | Compatibility 5 | ============= 6 | 7 | BioSimSpace has been tested against the versions of its 8 | external dependencies listed below. Please let us know if 9 | you encounter problems by raising an issue on our 10 | `GitHub `__ 11 | page. (It may also work with more recent versions and we 12 | will update these lists as they are validated.) 13 | 14 | BioSimSpace is built to be compatible with the 15 | `ambertools `__ 16 | and `gromacs `__ 17 | packages from conda-forge, but this aren't required as 18 | a hard run-time dependency. This is because users will 19 | likely choose to install external versions of the packages 20 | that are optimised for their particular computing environment 21 | and use case. 22 | 23 | 24 | `AMBER `__ 25 | ============================== 26 | 27 | * AmberTools22 28 | * AmberTools21 29 | * AmberTools20 30 | * AmberTools19 31 | * AmberTools18 32 | 33 | Note that AmberTools >= 20 is required for Open Force Field support. 34 | We currently have support for force fields with CMAP terms, e.g. ff19SB. 35 | 36 | `GROMACS `__ 37 | ==================================== 38 | 39 | * 2021 series 40 | * 2020 series 41 | * 2019 series 42 | * 2018 series 43 | 44 | `NAMD `__ 45 | ================================================ 46 | 47 | * 2.14 48 | * 2.13 49 | * 2.12 50 | -------------------------------------------------------------------------------- /doc/source/contributing/index.rst: -------------------------------------------------------------------------------- 1 | ============ 2 | Contributing 3 | ============ 4 | 5 | We welcome all helpful contributions to improving the quality of 6 | BioSimSpace. Ways you can help include: 7 | 8 | * Finding and fixing documentation bugs and typos. 9 | * Writing new tutorials, short how-to guides or blog posts. 10 | * Creating more tests and adding them to the 11 | `pytest library `__. 12 | * Porting and testing :mod:`BioSimSpace` on different computers. 13 | * Proposing and helping write or test new features. 14 | * Funding development by donating to `OpenBioSim `__. 15 | 16 | We accept pull requests to the devel branch and are happy to discuss 17 | ideas via 18 | `GitHub issues on the repo `__. 19 | 20 | When contributing, please keep in mind our 21 | :doc:`../code_of_conduct`. 22 | 23 | Please also ensure that your contribution is compatible with our 24 | license. :mod:`BioSimSpace` is licensed under the GPLv3 or later. Please 25 | ensure your contribution is similarly licensed, i.e. MIT, BSD, Apache or 26 | GPLv3 or later. Please ensure that your employer (if you are writing code 27 | as an employee) gives permission for you to contribute your code. 28 | 29 | Finally, please do add your name or GitHub handle to our 30 | :doc:`../contributors` page before you submit your pull request. 31 | This will ensure that your status as a contributor to :mod:`BioSimSpace` 32 | can be forever recognised. 33 | 34 | .. toctree:: 35 | :maxdepth: 2 36 | 37 | development 38 | codestyle 39 | packaging 40 | roadmap 41 | -------------------------------------------------------------------------------- /doc/source/contributing/roadmap.rst: -------------------------------------------------------------------------------- 1 | ======= 2 | Roadmap 3 | ======= 4 | 5 | Since :mod:`BioSimSpace` aims to be interoperable across the molecular simulation 6 | engines that we support, new features can often take some time to fully implement 7 | and test. We have recently created a ref:`Sandpit ` area, which allows 8 | early access to and testing of expermintal features, often provided by external 9 | collaborators. Over time we work to port these features into the main code base. 10 | 11 | New features that we aim to implement over the coming year are: 12 | 13 | * Consistent cross-package alchemical free-energy analysis using 14 | `alchemlyb `__. 15 | Analysis is currently performed by engine-specific tools, making it hard 16 | to make direct comparisons between results generated by different engines. 17 | * Support for relative binding free-energy simulations with AMBER. (This is 18 | already implemented in ``BioSimSpace.Sandpit.Exscientia`` and will be ported 19 | to the main code base.) 20 | * Support for absolute binding free-energy simulations with GROMACS and SOMD. 21 | (Initial support already exists in ``BioSimSpace.Sandpit.Exscientia``.) 22 | * Implementation of a translation layer to provide (where possible) direct 23 | interconversion between common molecular system representations, e.g. 24 | `OpenMM `__, `Open Force Field `__, 25 | and `RDKit `__. This will avoid the need for translation 26 | via intermediate molecular files, which are unavoidably lossy in nature. 27 | 28 | If you would like to suggest features that should be 29 | added to the roadmap then please 30 | `raise a feature request here `_. 31 | 32 | More details about individual feature branches, which contain the new 33 | features being actively worked on, is available on the 34 | `GitHub issues `_ 35 | page. 36 | -------------------------------------------------------------------------------- /doc/source/contributors.rst: -------------------------------------------------------------------------------- 1 | ============ 2 | Contributors 3 | ============ 4 | 5 | Many people have contributed to the development of :mod:`BioSimSpace`. 6 | 7 | If you submit a pull request, please remember to add your 8 | name and/or GitHub handle below, so that your contribution 9 | can be recognised. 10 | 11 | * `@lohedges `__ 12 | * `@chryswoods `__ 13 | * `@jmichel80 `__ 14 | * `@ppxasjsm `__ 15 | * `@ptosco `__ 16 | * `@JenkeScheen `__ 17 | * `@fjclark `__ 18 | * `@annamherz `__ 19 | * `@AdeleHardie `__ 20 | * `@dlukauskis `__ 21 | * `@msuruzon `__ 22 | * `@xiki-tempula `__ 23 | * `@kexul `__ 24 | -------------------------------------------------------------------------------- /doc/source/features.rst: -------------------------------------------------------------------------------- 1 | ======== 2 | Features 3 | ======== 4 | 5 | :mod:`BioSimSpace` is an interoperable Python framework for biomolecular 6 | simulation. 7 | 8 | * :data:`Read and write ` molecules from a number of molecular 9 | file formats. This includes AMBER, CHARMM, and GROMACS files. 10 | * :data:`Parameterise ` molecules using force fields from 11 | `AmberTools `__ and the 12 | `Open Force Field Initiative `__. 13 | * :data:`Solvate ` molecules using a range of standard water 14 | models. We support both orthorhombic and triclinic simulation boxes. 15 | * Configure :data:`protocols ` for a range of biomolecular 16 | simulations and create :data:`processes ` to run them using 17 | our supported molecular dynamics (MD) engines ( 18 | `AMBER `__, `GROMACS `__, 19 | `OpenMM `__, `NAMD `__, SOMD). 20 | * Setup and run :data:`free energy perturbation ` simulations 21 | with SOMD and GROMACS. (See our :doc:`hydration free energy ` 22 | tutorial for a complete example.) 23 | * Configure and run :data:`metadynamics ` simulations 24 | for a range of supported collective variables. (See our :doc:`tutorial ` 25 | for a complete example.) 26 | * Write interoperable workflow components or :doc:`nodes ` that 27 | work with any supported MD engine and can be run from the command-line, 28 | within a `Jupyter `__ notebook, or exported to a 29 | `Common Workflow Language `__ Tool wrapper. 30 | * Interact with molecular simulation process within interactive Python 31 | environments. This includes: starting and stopping simulations, monitoring 32 | their progress, getting time series data of thermodynamic state information, 33 | plotting data, analysing trajectories, and visualising molecules. 34 | -------------------------------------------------------------------------------- /doc/source/guides/index.rst: -------------------------------------------------------------------------------- 1 | =============== 2 | Detailed Guides 3 | =============== 4 | 5 | Here are some detailed guides that (we hope) will make it easier to 6 | use and understand various parts of BioSimSpace. 7 | 8 | .. toctree:: 9 | :maxdepth: 2 10 | 11 | nodes 12 | protocols 13 | -------------------------------------------------------------------------------- /doc/source/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/images/favicon.ico -------------------------------------------------------------------------------- /doc/source/support.rst: -------------------------------------------------------------------------------- 1 | =================== 2 | How to ask for help 3 | =================== 4 | 5 | We are really happy that you are using :mod:`BioSimSpace`, and want 6 | to do everything we can to help you if you have any problems. 7 | 8 | We have limited resources, so please help us help you by 9 | doing the following: 10 | 11 | 1. Check the `GitHub issues `__ 12 | page to see if anyone else is having a similar problem. Join the 13 | discussion there by either upvoting the issue, or posting 14 | your own experience. This will help us all, as a community, 15 | work together to share and help each other with our problems. 16 | 17 | 2. If your issue hasn't been posted, please double-check that 18 | there isn't anything in the :doc:`tutorials ` 19 | or :doc:`API documentation `, or anywhere 20 | else in this website that could help you. 21 | 22 | 3. If your problem is with the code, then please check that you are 23 | running the latest version of :mod:`BioSimSpace`. We are continually working 24 | to fix bugs, so hopefully we have already fixed your problem in 25 | the newest release. Please install the newest release of :mod:`BioSimSpace` 26 | (e.g. in a new conda environment) and check to see if you still 27 | experience your problem. 28 | 29 | 4. If you can't find help from any of the place mentioned above, 30 | then please create a new issue on our 31 | `GitHub issues page `__ 32 | that fully describes the problem. Please let us know the 33 | operating system you are using (e.g. Linux, MacOS or Windows), 34 | and confirm that you are using the latest release of :mod:`BioSimSpace`. 35 | Please describe the problem in as much detail as you can. 36 | It helps if you can provide example input files or a small 37 | piece of code that can reproduce your issue. This will help us 38 | to create a unit test that reproduces your problem on our 39 | computers, so that we can then work on creating a fix. 40 | 41 | Please remember to be respectful of everyone in the community, 42 | and be patient. Be mindful of our 43 | :doc:`code of conduct `. 44 | -------------------------------------------------------------------------------- /doc/source/tutorials/images/cv_time_series.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/tutorials/images/cv_time_series.png -------------------------------------------------------------------------------- /doc/source/tutorials/images/ethane_methanol_mapping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/tutorials/images/ethane_methanol_mapping.png -------------------------------------------------------------------------------- /doc/source/tutorials/images/free_nrg_contour.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/tutorials/images/free_nrg_contour.png -------------------------------------------------------------------------------- /doc/source/tutorials/images/free_nrg_phi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/doc/source/tutorials/images/free_nrg_phi.png -------------------------------------------------------------------------------- /doc/source/tutorials/index.rst: -------------------------------------------------------------------------------- 1 | ========= 2 | Tutorials 3 | ========= 4 | 5 | These tutorials showcase some of things that are possible with BioSimSpace. 6 | 7 | This tutorial assumes that you have installed BioSimSpace following 8 | :doc:`the instructions here <../install>`, and have activated 9 | the Anaconda / miniconda Python environment into which BioSimSpace was 10 | installed. You can test this by starting python and typing 11 | 12 | >>> import BioSimSpace as BSS 13 | 14 | If :mod:`BioSimSpace` imports without error, then everything is working. 15 | 16 | If you can't import :mod:`BioSimSpace`, or have any other problems, then 17 | please :doc:`ask for support. <../support>` 18 | 19 | 20 | .. toctree:: 21 | :maxdepth: 1 22 | 23 | hydration_freenrg 24 | metadynamics 25 | -------------------------------------------------------------------------------- /doc/winbuild.bat: -------------------------------------------------------------------------------- 1 | if not exist "build\html\NUL" mkdir "build\html" 2 | if not exist "build\doctrees\NUL" mkdir "build\doctrees" 3 | sphinx-build -b html -d build\doctrees -j8 -v source build\html -------------------------------------------------------------------------------- /git_hooks/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Exit if we are only editing the commit message. 4 | if git diff --cached --quiet ; then 5 | exit 6 | fi 7 | 8 | # If .ciignore doesn't exists, just quit this Git hook. 9 | if [[ ! -a .ciignore ]]; then 10 | exit 11 | fi 12 | 13 | # If the commit message already contains ***NO_CI***, the exit. 14 | if grep -q "***NO_CI***" $1; then 15 | exit 16 | fi 17 | 18 | # Load in every file that will be changed via this commit into an array. 19 | changes=$(git diff --name-only --cached) 20 | 21 | git diff --name-only --cached 22 | 23 | # Load the patterns we want to skip into an array. 24 | mapfile -t blacklist < .ciignore 25 | 26 | for i in "${blacklist[@]}" 27 | do 28 | # Remove the current pattern from the list of changes. 29 | changes=( ${changes[@]/$i/} ) 30 | 31 | if [[ ${#changes[@]} -eq 0 ]]; then 32 | # If we've exhausted the list of changes before we've finished going 33 | # through patterns, that's okay, just quit the loop. 34 | break 35 | fi 36 | done 37 | 38 | if [[ ${#changes[@]} -gt 0 ]]; then 39 | # If there's still changes left, then we have stuff to build, leave the commit alone. 40 | exit 41 | fi 42 | 43 | # Delete all comments from commit message. 44 | sed -i.bak -e "/^#/d" "$1" && rm "$1.bak" 45 | 46 | # Append [ci skip] to the commit message. 47 | sed -i.bak -e "\$s/$/ [ci skip]/" "$1" && rm "$1".bak 48 | -------------------------------------------------------------------------------- /nodes/README.rst: -------------------------------------------------------------------------------- 1 | Nodes 2 | ===== 3 | 4 | A collection of example BioSimSpace nodes. 5 | 6 | * *playground*: Experimental nodes: here be dragons! 7 | 8 | For developers 9 | -------------- 10 | 11 | Please install `nb-clean `_ to ensure that 12 | all Jupyter notebooks are cleaned of cell execution counts, metadata, and 13 | outputs. This means that any commits will correspond to actual changes 14 | in the notebook code and that users are presented with a fresh notebook 15 | when it is launched. 16 | 17 | Please also add ``ci skip`` to commit messages to avoid unnecessarily 18 | running the GitHub actions build, e.g. rebuilding the BioSimSpace conda, 19 | package, updating the website, etc. 20 | -------------------------------------------------------------------------------- /nodes/playground/BSSSetup/BSS_Setup.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/nodes/playground/BSSSetup/BSS_Setup.py -------------------------------------------------------------------------------- /nodes/playground/BSSSetup/FESetup_parser.py: -------------------------------------------------------------------------------- 1 | def parse_fesetup_input(filename): 2 | FESetup_dict = {} 3 | 4 | print("Done") 5 | 6 | return FESetup_dict 7 | 8 | 9 | def validate_fesetup_input(fe_dictionary): 10 | return False 11 | 12 | 13 | if __name__ == "__main__": 14 | try: 15 | parse_fesetup_input() 16 | except: 17 | print("Can't parse FESetup file") 18 | -------------------------------------------------------------------------------- /nodes/playground/combine.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # Author: Julien Michel 4 | # email: julien.michel@ed.ac.uk 5 | # 6 | # # Combine 7 | # 8 | # Merge two input molecules into a single system 9 | 10 | # In[1]: 11 | 12 | 13 | import BioSimSpace as BSS 14 | 15 | 16 | # In[2]: 17 | 18 | 19 | node = BSS.Gateway.Node( 20 | "A node to solvate a molecule ready for molecular simulation with AMBER." 21 | ) 22 | 23 | 24 | # In[3]: 25 | 26 | 27 | node.addAuthor( 28 | name="Julien Michel", 29 | email="julien.michel@ed.ac.uk", 30 | affiliation="University of Edinburgh", 31 | ) 32 | node.setLicense("GPLv3") 33 | 34 | 35 | # In[4]: 36 | 37 | 38 | node.addInput( 39 | "system1", 40 | BSS.Gateway.FileSet(help="A topology and coordinates file describing system1"), 41 | ) 42 | 43 | node.addInput( 44 | "system2", 45 | BSS.Gateway.FileSet(help="A topology and coordinates file describing system2"), 46 | ) 47 | 48 | node.addInput( 49 | "output", BSS.Gateway.String(help="The root name of the combined system.") 50 | ) 51 | 52 | 53 | # In[5]: 54 | 55 | 56 | node.addOutput("nodeoutput", BSS.Gateway.FileSet(help="The combined system")) 57 | 58 | 59 | # In[6]: 60 | 61 | 62 | node.showControls() 63 | 64 | 65 | # In[7]: 66 | 67 | 68 | system1 = BSS.IO.readMolecules(node.getInput("system1")) 69 | 70 | 71 | # In[8]: 72 | 73 | 74 | system2 = BSS.IO.readMolecules(node.getInput("system2")) 75 | 76 | 77 | # In[9]: 78 | 79 | 80 | combined = system1 + system2 81 | 82 | 83 | # In[ ]: 84 | 85 | 86 | # print (combined) 87 | 88 | 89 | # In[ ]: 90 | 91 | 92 | # BSS.IO.saveMolecules(node.getInput("output"), combined, ["prm7", "rst7"]) 93 | 94 | 95 | # In[10]: 96 | 97 | 98 | node.setOutput( 99 | "nodeoutput", 100 | BSS.IO.saveMolecules(node.getInput("output"), combined, ["prm7", "rst7"]), 101 | ) 102 | 103 | 104 | # In[11]: 105 | 106 | 107 | node.validate() 108 | -------------------------------------------------------------------------------- /nodes/playground/conformational_analysis/README: -------------------------------------------------------------------------------- 1 | The following will run the conformational analysis: 2 | ~/sire.app/bin/python Conformational_analysis.py --file 2-cyclopentanylindole.mol2 --forcefiled gaff --water tip3p --box_size 5 --minimise eq1.in --step2 eq2.in --step3 eq3.in --step4 eq4.in --step5 eq5.in --production prod.in --cpptraj cpptraj.in --cpptraj_exec /home/ppxasjsm/Software/amber18/bin/cpptraj --exe /home/ppxasjsm/Software/amber18/bin/sander 3 | 4 | Change the paths of the executables where necessary. 5 | -------------------------------------------------------------------------------- /nodes/playground/conformational_analysis/cpptraj.in: -------------------------------------------------------------------------------- 1 | parm prod/prod.prm7 2 | trajin prod/prod.nc 3 | strip :WAT outprefix nosolv 4 | rms first :1 5 | cluster :1 sieve 10 epsilon 0.7 out cluster_out averagelinkage gracecolor summary summary_out info Cluster_info repout centroid repfmt pdb 6 | go 7 | -------------------------------------------------------------------------------- /nodes/playground/conformational_analysis/eq1.in: -------------------------------------------------------------------------------- 1 | #Step 1: restrained minimisation 2 | &cntrl 3 | imin=1,maxcyc=1000,ncyc=100, drms=0.1, ntr=1, 4 | restraintmask="!:WAT" restraint_wt=50 5 | / 6 | -------------------------------------------------------------------------------- /nodes/playground/conformational_analysis/eq2.in: -------------------------------------------------------------------------------- 1 | #Step 2: restrained minimisation 2 | &cntrl 3 | imin=1,maxcyc=1000,ncyc=100, cut=8.0, ntb=1, ntc=2, ntf=2, drms=0.1, ntr=0 4 | / 5 | 6 | -------------------------------------------------------------------------------- /nodes/playground/conformational_analysis/eq3.in: -------------------------------------------------------------------------------- 1 | #Equilibration step 3: warm the system to 300K 2 | &cntrl 3 | ig=-1, imin=0, ntr=1, nstlim=1000, dt=0.002, ntb=2, ntp=1, ntt=3, gamma_ln=0.2, ntf=2, ntc=2, temp0=318, tempi=0, restraint_wt=5, restraintmask="!:WAT", 4 | / 5 | 6 | -------------------------------------------------------------------------------- /nodes/playground/conformational_analysis/eq4.in: -------------------------------------------------------------------------------- 1 | #Equilibration step 4: MD on protein side chains 2 | &cntrl 3 | ig=-1, imin=0, ntr=1, nstlim=1000, dt=0.002, ntwe=500, ntb=2, ntp=1, ntt=3, gamma_ln=0.2, temp0 = 318, ntf=2, ntc=2, irest=1, ntx=5 restraint_wt=5, restraintmask=":LIG",ioutfm=1, 4 | / 5 | 6 | -------------------------------------------------------------------------------- /nodes/playground/conformational_analysis/eq5.in: -------------------------------------------------------------------------------- 1 | #Equilibration step 5: 10ns of unrestrained dynamics 2 | &cntrl 3 | ig=-1, imin=0, ntpr=1000, ntwx=2500, ntwe=500, 4 | irest=1, ntx=5, gamma_ln=0.2, 5 | ntwr=1000, nstlim=5000, ntb=2, 6 | ntf=2, ntc=2, ntp=2, ntt=3, 7 | temp0=318, dt=0.002,ioutfm=1,iwrap=1 8 | / 9 | 10 | -------------------------------------------------------------------------------- /nodes/playground/conformational_analysis/prod.in: -------------------------------------------------------------------------------- 1 | #Production run: 1 micros of NVT dynamics 2 | &cntrl 3 | ig=-1, imin=0, ntpr=1000, ntwx=2500, ntwe=1000, 4 | irest=1, ntx=5, gamma_ln=0.2, 5 | ntwr=100, nstlim=25000, ntb=1, 6 | ntf=2, ntc=2, ntp=0, ntt=3, 7 | temp0=318, dt=0.002,ioutfm=1,iwrap=1 8 | / 9 | 10 | -------------------------------------------------------------------------------- /nodes/playground/parameterise.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # Author: Julien Michel
5 | # Email:   julien.michel@ed.ac.uk 6 | # 7 | # # Parameterise 8 | # 9 | # This notebook parameterises a molecule and writes a topology usable for a molecular simulation. Based on the Molecular Seup node written by Lester Hedges 10 | 11 | # In[ ]: 12 | 13 | 14 | import BioSimSpace as BSS 15 | 16 | 17 | # In[ ]: 18 | 19 | 20 | node = BSS.Gateway.Node( 21 | "A node to parameterise a molecule ready for molecular simulation." 22 | ) 23 | 24 | 25 | # In[ ]: 26 | 27 | 28 | node.addAuthor( 29 | name="Julien Michel", 30 | email="julien.michel@ed.ac.uk", 31 | affiliation="University of Edimnburgh", 32 | ) 33 | node.setLicense("GPLv3") 34 | 35 | 36 | # In[ ]: 37 | 38 | 39 | node.addInput( 40 | "input", BSS.Gateway.File(help="A molecular input file, e.g. a PDB file.") 41 | ) 42 | 43 | node.addInput( 44 | "forcefield", 45 | BSS.Gateway.String( 46 | help="The name of the force field to use for parameterisation.", 47 | allowed=BSS.Parameters.forceFields(), 48 | default="ff14SB", 49 | ), 50 | ) 51 | node.addInput("output", BSS.Gateway.String(help="The root name of the output files.")) 52 | 53 | 54 | # In[ ]: 55 | 56 | 57 | node.addOutput( 58 | "nodeoutput", 59 | BSS.Gateway.FileSet( 60 | help="The parameterised and solvated molecular system in AMBER format." 61 | ), 62 | ) 63 | 64 | 65 | # In[ ]: 66 | 67 | 68 | node.showControls() 69 | 70 | 71 | # In[ ]: 72 | 73 | 74 | system = BSS.IO.readMolecules(node.getInput("input")) 75 | 76 | 77 | # In[ ]: 78 | 79 | 80 | molecule = system[0] 81 | 82 | 83 | # In[ ]: 84 | 85 | 86 | print(molecule) 87 | 88 | 89 | # In[ ]: 90 | 91 | 92 | molecule = BSS.Parameters.parameterise( 93 | molecule, node.getInput("forcefield") 94 | ).getMolecule() 95 | 96 | 97 | # In[ ]: 98 | 99 | 100 | BSS.IO.saveMolecules(node.getInput("output"), molecule, ["prm7", "rst7"]) 101 | 102 | 103 | # In[ ]: 104 | 105 | 106 | node.setOutput( 107 | "nodeoutput", 108 | BSS.IO.saveMolecules(node.getInput("output"), molecule, ["prm7", "rst7"]), 109 | ) 110 | 111 | 112 | # In[ ]: 113 | 114 | 115 | node.validate() 116 | -------------------------------------------------------------------------------- /nodes/playground/solvation/README.md: -------------------------------------------------------------------------------- 1 | Running BioSimSpace: 2 | -------------------- 3 | 4 | All the documentation can be found [here](www.biosimspace.org). 5 | 6 | 1. Get BioSimSpace 7 | Easiest is to download the development binaries from [here](https://objectstorage.eu-frankfurt-1.oraclecloud.com/p/ZH4wscDHe59T28yVJtrMH8uqifI_ih0NL5IyqxXQjSo/n/chryswoods/b/biosimspace_releases/o/biosimspace_devel_latest_linux.run). 8 | Then run: 9 | 10 | ``` 11 | chmod +x biosimspace_devel_latest_linux.run 12 | ./biosimspace_devel_latest_linux.run 13 | ``` 14 | Unless put somewhere else you should now be able to find a directory called biosimspace.app in your home directory. The python version that is available with it, should be used to run any BioSimSpace script. 15 | 16 | There are future plans to fully incorporate BioSimSpace into conda, but they have not yet been finalised. 17 | 18 | 2. Run the examples 19 | BioSimSpace has some dependencies in order to run smoothly. For full functionality you need to have AmberTools18 and Gromacs installed as well as BioSimSpace. This will allow for solvation and dynamics to be run smoothly. 20 | 21 | If you perfer working with docker containers, why not checkout the BioSimSpace docker image [here](https://cloud.docker.com/u/biosimspace/repository/docker/biosimspace/biosimspace-devel). 22 | 23 | The example that solvates and minimises benzene from a pdb file can be found in the `solvation` directory and readily be run as: 24 | 25 | ``` 26 | ~/biosimspace.app/bin/python setup_molecule.py --molecule benzene.pdb --boxsize 40 --parametrisation_base params --minimisation_base mini --verbose --forcefield gaff 27 | ``` 28 | 29 | To get more detailed help on setup_molecule.py you can simply run: 30 | ``` 31 | ~/biosimspace.app/bin/python setup_molecule.py --help 32 | ``` 33 | -------------------------------------------------------------------------------- /nodes/playground/solvation/benzene.pdb: -------------------------------------------------------------------------------- 1 | iCOMPND UNNAMED 2 | AUTHOR GENERATED BY OPEN BABEL 2.3.2 3 | HETATM 1 C LIG 1 -0.760 1.169 -0.001 1.00 0.00 C 4 | HETATM 2 C LIG 1 0.633 1.245 -0.001 1.00 0.00 C 5 | HETATM 3 C LIG 1 1.395 0.077 0.000 1.00 0.00 C 6 | HETATM 4 C LIG 1 0.764 -1.168 0.003 1.00 0.00 C 7 | HETATM 5 C LIG 1 -0.629 -1.243 0.000 1.00 0.00 C 8 | HETATM 6 C LIG 1 -1.391 -0.075 -0.002 1.00 0.00 C 9 | HETATM 7 H LIG 1 -1.354 2.079 0.001 1.00 0.00 H 10 | HETATM 8 H LIG 1 1.124 2.214 -0.003 1.00 0.00 H 11 | HETATM 9 H LIG 1 2.480 0.135 -0.000 1.00 0.00 H 12 | HETATM 10 H LIG 1 1.358 -2.078 0.006 1.00 0.00 H 13 | HETATM 11 H LIG 1 -1.120 -2.213 -0.000 1.00 0.00 H 14 | HETATM 12 H LIG 1 -2.476 -0.134 -0.003 1.00 0.00 H 15 | CONECT 1 2 6 7 16 | CONECT 2 1 3 8 17 | CONECT 3 2 4 9 18 | CONECT 4 3 5 10 19 | CONECT 5 4 6 11 20 | CONECT 6 5 1 12 21 | CONECT 7 1 22 | CONECT 8 2 23 | CONECT 9 3 24 | CONECT 10 4 25 | CONECT 11 5 26 | CONECT 12 6 27 | MASTER 0 0 0 0 0 0 0 0 12 0 12 0 28 | END 29 | -------------------------------------------------------------------------------- /paper/figures/fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/paper/figures/fig1.png -------------------------------------------------------------------------------- /paper/figures/fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/paper/figures/fig2.png -------------------------------------------------------------------------------- /paper/figures/fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/paper/figures/fig3.png -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.pytest.ini_options] 2 | # Ensure that test/Sandpit/Exscientia could have the same name as the tests in test 3 | addopts = "--import-mode=importlib" 4 | -------------------------------------------------------------------------------- /python/.gitattributes: -------------------------------------------------------------------------------- 1 | BioSimSpace/_version.py export-subst 2 | -------------------------------------------------------------------------------- /python/BioSimSpace/Align/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | # generateNetwork uses a modified version of LOMAP: 23 | # https://github.com/MobleyLab/Lomap, which is released under the MIT 24 | # license. 25 | 26 | """ 27 | .. currentmodule:: BioSimSpace.Align 28 | 29 | Functions 30 | ========= 31 | 32 | .. autosummary:: 33 | :toctree: generated/ 34 | 35 | generateNetwork 36 | matchAtoms 37 | rmsdAlign 38 | flexAlign 39 | merge 40 | viewMapping 41 | """ 42 | 43 | from ._align import * 44 | -------------------------------------------------------------------------------- /python/BioSimSpace/Box/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Box 24 | 25 | Functions 26 | ========= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | boxTypes 32 | generateBoxParameters 33 | cubic 34 | rhombicDodecahedronSquare 35 | rhombicDodecahedronHexagon 36 | truncatedOctahedron 37 | 38 | Examples 39 | ======== 40 | 41 | Generate the lattice vectors and angles for a truncated octahedron 42 | of 10 nanometer lattice separation. 43 | 44 | .. code-block:: python 45 | 46 | import BioSimSpace as BSS 47 | 48 | box, angles = BSS.Box.truncatedOctahedron(10 * BSS.Units.Length.nanometer) 49 | """ 50 | 51 | from ._box import * 52 | -------------------------------------------------------------------------------- /python/BioSimSpace/FreeEnergy/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.FreeEnergy 24 | 25 | Classes 26 | ======= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | Relative 32 | 33 | Functions 34 | ========= 35 | 36 | .. autosummary:: 37 | :toctree: generated/ 38 | 39 | engines 40 | getData 41 | """ 42 | 43 | from ._relative import * 44 | from ._utils import * 45 | -------------------------------------------------------------------------------- /python/BioSimSpace/FreeEnergy/_utils.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Utility functions.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["engines"] 28 | 29 | 30 | def engines(): 31 | """ 32 | List the supported molecular dynamics engines for running free-energy 33 | perturbation simulations. 34 | 35 | Returns 36 | ------- 37 | 38 | engines : [str] 39 | The list of supported engines. 40 | """ 41 | return ["Somd", "Gromacs"] 42 | -------------------------------------------------------------------------------- /python/BioSimSpace/Gateway/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Gateway 24 | 25 | Classes 26 | ======= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | Node 32 | 33 | Requirement types 34 | ================= 35 | 36 | .. autosummary:: 37 | :toctree: generated/ 38 | 39 | Boolean 40 | Integer 41 | Float 42 | String 43 | File 44 | FileSet 45 | Length 46 | Area 47 | Volume 48 | Charge 49 | Energy 50 | Pressure 51 | Temperature 52 | Time 53 | """ 54 | 55 | from ._node import * 56 | from ._resources import * 57 | from ._requirements import * 58 | 59 | # Create and initialise the hardware resource manager. 60 | ResourceManager = ResourceManager() 61 | ResourceManager._initialise() 62 | -------------------------------------------------------------------------------- /python/BioSimSpace/IO/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.IO 24 | 25 | Functions 26 | ========= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | fileFormats 32 | formatInfo 33 | readMolecules 34 | readPDB 35 | readPerturbableSystem 36 | saveMolecules 37 | savePerturbableSystem 38 | """ 39 | 40 | from ._io import * 41 | -------------------------------------------------------------------------------- /python/BioSimSpace/MD/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.MD 24 | 25 | Functions 26 | ========= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | engines 32 | run 33 | 34 | Examples 35 | ======== 36 | 37 | .. code-block:: python 38 | 39 | import BioSimSpace as BSS 40 | 41 | # Load a molecular system from file. 42 | system = BSS.IO.readMolecules( 43 | BSS.IO.expand( 44 | BSS.tutorialUrl(), 45 | ["ala.top, "ala.crd"], 46 | ".bz2") 47 | ) 48 | ) 49 | 50 | # Create a default minimisation protocol. 51 | protocol = BSS.Protocol.Minimisation() 52 | 53 | # Find a molecular dynamics package on the host system that supports the 54 | # system and protocol defined above. If a package exists, BioSimSpace 55 | # will auto-generate all of the required input files and return a handle 56 | # to a background process that is running the simulation. 57 | process = BSS.MD.run(system, protocol) 58 | """ 59 | 60 | from ._md import * 61 | from ._utils import * 62 | -------------------------------------------------------------------------------- /python/BioSimSpace/MD/_utils.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Utility functions.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["engines"] 28 | 29 | 30 | def engines(): 31 | """ 32 | List the supported molecular dynamics engines. 33 | 34 | Returns 35 | ------- 36 | 37 | engines : [str] 38 | The list of supported engines. 39 | """ 40 | from ..Process import engines as _engines 41 | 42 | return _engines() + ["auto"] 43 | -------------------------------------------------------------------------------- /python/BioSimSpace/Metadynamics/CollectiveVariable/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Metadynamics.CollectiveVariable 24 | 25 | Functions 26 | ========= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | list 32 | makeFunnel 33 | viewFunnel 34 | 35 | Classes 36 | ======= 37 | 38 | .. autosummary:: 39 | :toctree: generated/ 40 | 41 | Distance 42 | Funnel 43 | RMSD 44 | Torsion 45 | """ 46 | 47 | from ._distance import * 48 | from ._funnel import * 49 | from ._rmsd import * 50 | from ._torsion import * 51 | from ._utils import * 52 | -------------------------------------------------------------------------------- /python/BioSimSpace/Metadynamics/CollectiveVariable/_utils.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Utility functions.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["list"] 28 | 29 | from ._distance import * 30 | from ._funnel import * 31 | from ._torsion import * 32 | 33 | # Create a list of the supported collective variables. 34 | _colvars = [] 35 | import sys as _sys 36 | 37 | _namespace = _sys.modules[__name__] 38 | for _var in dir(): 39 | if _var[0] != "_" and _var[0] != _var[0].lower(): 40 | _colvars.append(_var) 41 | del _namespace 42 | del _sys 43 | del _var 44 | 45 | 46 | def list(): 47 | """ 48 | Return a list of the supported collective variables. 49 | 50 | Returns 51 | ------- 52 | 53 | colvars : [str] 54 | A list of the supported collective variables. 55 | """ 56 | return _colvars 57 | -------------------------------------------------------------------------------- /python/BioSimSpace/Metadynamics/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Metadynamics 24 | 25 | Functions 26 | ========= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | engines 32 | run 33 | 34 | Classes 35 | ======= 36 | 37 | .. autosummary:: 38 | :toctree: generated/ 39 | 40 | Bound 41 | Grid 42 | Restraint 43 | """ 44 | 45 | from ._bound import * 46 | from ._grid import * 47 | from ._metadynamics import * 48 | from ._restraint import * 49 | from ._utils import * 50 | 51 | from . import CollectiveVariable 52 | -------------------------------------------------------------------------------- /python/BioSimSpace/Metadynamics/_utils.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Utility functions.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["engines"] 28 | 29 | 30 | def engines(): 31 | """ 32 | List the supported metadynamics engines. 33 | 34 | Returns 35 | ------- 36 | 37 | engines : [str] 38 | The list of supported engines. 39 | """ 40 | return ["Amber", "Gromacs", "OpenMM", "auto"] 41 | -------------------------------------------------------------------------------- /python/BioSimSpace/Node/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Node 24 | 25 | Functions 26 | ========= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | help 32 | list 33 | run 34 | setNodeDirectory 35 | 36 | Examples 37 | ======== 38 | 39 | Print the list of available nodes. 40 | 41 | .. code-block:: python 42 | 43 | import BioSimSpace as BSS 44 | 45 | print(BSS.Node.list()) 46 | 47 | Get help on the "minimisation" node. 48 | 49 | .. code-block:: python 50 | 51 | import BioSimSpace as BSS 52 | 53 | BSS.Node.help("minimisation") 54 | 55 | Run the minimisation node. 56 | 57 | .. code-block:: python 58 | 59 | import BioSimSpace as BSS 60 | 61 | # Generate a dictionary of input arguments. 62 | input = {"steps" : 1000, "files" : ["amber/ala/ala.top", "amber/ala/ala.crd"]} 63 | 64 | # Run the node and get the output as a dictionary. 65 | output = BSS.Node.run("minimisation", input) 66 | 67 | Set a custom directory for the node library. 68 | 69 | .. code-block:: python 70 | 71 | import BioSimSpace as BSS 72 | 73 | BSS.Node.setNodeDirectory("/path/to/node/library") 74 | """ 75 | 76 | from ._node import * 77 | -------------------------------------------------------------------------------- /python/BioSimSpace/Parameters/_Protocol/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | Protocol for parameterising molecules. 24 | Author: Lester Hedges . 25 | """ 26 | 27 | from ._protocol import Protocol as _Protocol 28 | from ._amber import * 29 | from ._openforcefield import * 30 | -------------------------------------------------------------------------------- /python/BioSimSpace/Parameters/_Protocol/_protocol.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | Functionality for handling parameterisation protocols. 24 | Author: Lester Hedges . 25 | """ 26 | 27 | __author__ = "Lester Hedges" 28 | __email__ = "lester.hedges@gmail.com" 29 | 30 | __all__ = ["Protocol"] 31 | 32 | 33 | class Protocol: 34 | """A base class for parameterisation protocols.""" 35 | 36 | def __init__(self, forcefield, property_map={}): 37 | """ 38 | Constructor. 39 | 40 | Parameters 41 | ---------- 42 | 43 | forcefield : str 44 | The name of the force field. 45 | 46 | property_map : dict 47 | A dictionary that maps system "properties" to their user defined 48 | values. This allows the user to refer to properties with their 49 | own naming scheme, e.g. { "charge" : "my-charge" } 50 | """ 51 | 52 | # Don't allow user to create an instance of this base class. 53 | if type(self) is Protocol: 54 | raise Exception(" must be subclassed.") 55 | 56 | # Validate and set the force field name. 57 | if not isinstance(forcefield, str): 58 | raise TypeError("'forcefield' must be of type 'str'") 59 | else: 60 | self._forcefield = forcefield 61 | 62 | # Validate and set the property map. 63 | if not isinstance(property_map, dict): 64 | raise TypeError("'property_map' must be of type 'dict'") 65 | else: 66 | self._property_map = property_map.copy() 67 | -------------------------------------------------------------------------------- /python/BioSimSpace/Protocol/_protocol.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Functionality for handling simulation protocols.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["Protocol"] 28 | 29 | 30 | class Protocol: 31 | """A base class for holding simulation protocols.""" 32 | 33 | def __init__(self): 34 | """Constructor.""" 35 | 36 | # Don't allow user to create an instance of this base class. 37 | if type(self) is Protocol: 38 | raise Exception(" must be subclassed.") 39 | 40 | # Flag that the protocol hasn't been customised. 41 | self._is_customised = False 42 | 43 | def _setCustomised(self, is_customised): 44 | """ 45 | Internal function to flag whether a protocol has been customised. 46 | 47 | Parameters 48 | ---------- 49 | 50 | is_customised : bool 51 | Whether the protocol has been customised. 52 | """ 53 | if not isinstance(is_customised, bool): 54 | raise TypeError("'is_customised' must be of type 'bool'.") 55 | 56 | self._is_customised = is_customised 57 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Align/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | # generateNetwork uses a modified version of LOMAP: 23 | # https://github.com/MobleyLab/Lomap, which is released under the MIT 24 | # license. 25 | 26 | """ 27 | .. currentmodule:: BioSimSpace.Align 28 | 29 | Functions 30 | ========= 31 | 32 | .. autosummary:: 33 | :toctree: generated/ 34 | 35 | generateNetwork 36 | matchAtoms 37 | rmsdAlign 38 | flexAlign 39 | merge 40 | viewMapping 41 | decouple 42 | """ 43 | 44 | from ._align import * 45 | from ._decouple import * 46 | from ._squash import * 47 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Box/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Box 24 | 25 | Functions 26 | ========= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | boxTypes 32 | generateBoxParameters 33 | cubic 34 | rhombicDodecahedronSquare 35 | rhombicDodecahedronHexagon 36 | truncatedOctahedron 37 | 38 | Examples 39 | ======== 40 | 41 | Generate the lattice vectors and angles for a truncated octahedron 42 | of 10 nanometer lattice separation. 43 | 44 | .. code-block:: python 45 | 46 | import BioSimSpace as BSS 47 | 48 | box, angles = BSS.Box.truncatedOctahedron(10 * BSS.Units.Length.nanometer) 49 | """ 50 | 51 | from ._box import * 52 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/FreeEnergy/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.FreeEnergy 24 | 25 | Classes 26 | ======= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | Relative 32 | Restraint 33 | RestraintSearch 34 | 35 | Functions 36 | ========= 37 | 38 | .. autosummary:: 39 | :toctree: generated/ 40 | 41 | engines 42 | getData 43 | """ 44 | 45 | from ._relative import * 46 | from ._utils import * 47 | from ._restraint import * 48 | from ._restraint_search import * 49 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/FreeEnergy/_utils.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Utility functions.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["engines"] 28 | 29 | 30 | def engines(): 31 | """ 32 | List the supported molecular dynamics engines for running free-energy 33 | perturbation simulations. 34 | 35 | Returns 36 | ------- 37 | 38 | engines : [str] 39 | The list of supported engines. 40 | """ 41 | return ["AMBER", "SOMD", "GROMACS"] 42 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Gateway/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Gateway 24 | 25 | Classes 26 | ======= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | Node 32 | 33 | Requirement types 34 | ================= 35 | 36 | .. autosummary:: 37 | :toctree: generated/ 38 | 39 | Boolean 40 | Integer 41 | Float 42 | String 43 | File 44 | FileSet 45 | Length 46 | Area 47 | Volume 48 | Charge 49 | Energy 50 | Pressure 51 | Temperature 52 | Time 53 | """ 54 | 55 | from ._node import * 56 | from ._resources import * 57 | from ._requirements import * 58 | 59 | # Create and initialise the hardware resource manager. 60 | ResourceManager = ResourceManager() 61 | ResourceManager._initialise() 62 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/IO/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.IO 24 | 25 | Functions 26 | ========= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | fileFormats 32 | formatInfo 33 | readMolecules 34 | readPDB 35 | readPerturbableSystem 36 | saveMolecules 37 | savePerturbableSystem 38 | """ 39 | 40 | from glob import glob 41 | 42 | from ._io import * 43 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/MD/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.MD 24 | 25 | Functions 26 | ========= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | engines 32 | run 33 | 34 | Examples 35 | ======== 36 | 37 | .. code-block:: python 38 | 39 | import BioSimSpace as BSS 40 | 41 | # Load a molecular system from file. 42 | system = BSS.IO.readMolecules( 43 | BSS.IO.expand( 44 | BSS.tutorialUrl(), 45 | ["ala.top, "ala.crd"], 46 | ".bz2") 47 | ) 48 | ) 49 | 50 | # Create a default minimisation protocol. 51 | protocol = BSS.Protocol.Minimisation() 52 | 53 | # Find a molecular dynamics package on the host system that supports the 54 | # system and protocol defined above. If a package exists, BioSimSpace 55 | # will auto-generate all of the required input files and return a handle 56 | # to a background process that is running the simulation. 57 | process = BSS.MD.run(system, protocol) 58 | """ 59 | 60 | from ._md import * 61 | from ._utils import * 62 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/MD/_utils.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Utility functions.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["engines"] 28 | 29 | 30 | def engines(): 31 | """ 32 | List the supported molecular dynamics engines. 33 | 34 | Returns 35 | ------- 36 | 37 | engines : [str] 38 | The list of supported engines. 39 | """ 40 | from ..Process import engines as _engines 41 | 42 | return _engines() + ["AUTO"] 43 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Metadynamics/CollectiveVariable/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Metadynamics.CollectiveVariable 24 | 25 | Functions 26 | ========= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | list 32 | makeFunnel 33 | viewFunnel 34 | 35 | Classes 36 | ======= 37 | 38 | .. autosummary:: 39 | :toctree: generated/ 40 | 41 | Distance 42 | Funnel 43 | RMSD 44 | Torsion 45 | """ 46 | 47 | from ._distance import * 48 | from ._funnel import * 49 | from ._rmsd import * 50 | from ._torsion import * 51 | from ._utils import * 52 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Metadynamics/CollectiveVariable/_utils.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Utility functions.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["list"] 28 | 29 | from ._distance import * 30 | from ._funnel import * 31 | from ._torsion import * 32 | 33 | # Create a list of the supported collective variables. 34 | _colvars = [] 35 | import sys as _sys 36 | 37 | _namespace = _sys.modules[__name__] 38 | for _var in dir(): 39 | if _var[0] != "_" and _var[0] != _var[0].lower(): 40 | _colvars.append(_var) 41 | del _namespace 42 | del _sys 43 | del _var 44 | 45 | 46 | def list(): 47 | """ 48 | Return a list of the supported collective variables. 49 | 50 | Returns 51 | ------- 52 | 53 | colvars : [str] 54 | A list of the supported collective variables. 55 | """ 56 | return _colvars 57 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Metadynamics/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Metadynamics 24 | 25 | Functions 26 | ========= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | engines 32 | run 33 | 34 | Classes 35 | ======= 36 | 37 | .. autosummary:: 38 | :toctree: generated/ 39 | 40 | Bound 41 | Grid 42 | Restraint 43 | """ 44 | 45 | from ._bound import * 46 | from ._grid import * 47 | from ._metadynamics import * 48 | from ._restraint import * 49 | from ._utils import * 50 | 51 | from . import CollectiveVariable 52 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Metadynamics/_utils.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Utility functions.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["engines"] 28 | 29 | 30 | def engines(): 31 | """ 32 | List the supported metadynamics engines. 33 | 34 | Returns 35 | ------- 36 | 37 | engines : [str] 38 | The list of supported engines. 39 | """ 40 | return ["AMBER", "GROMACS", "OPENMM", "AUTO"] 41 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Node/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Node 24 | 25 | Functions 26 | ========= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | help 32 | list 33 | run 34 | setNodeDirectory 35 | 36 | Examples 37 | ======== 38 | 39 | Print the list of available nodes. 40 | 41 | .. code-block:: python 42 | 43 | import BioSimSpace as BSS 44 | 45 | print(BSS.Node.list()) 46 | 47 | Get help on the "minimisation" node. 48 | 49 | .. code-block:: python 50 | 51 | import BioSimSpace as BSS 52 | 53 | BSS.Node.help("minimisation") 54 | 55 | Run the minimisation node. 56 | 57 | .. code-block:: python 58 | 59 | import BioSimSpace as BSS 60 | 61 | # Generate a dictionary of input arguments. 62 | input = {"steps" : 1000, "files" : ["amber/ala/ala.top", "amber/ala/ala.crd"]} 63 | 64 | # Run the node and get the output as a dictionary. 65 | output = BSS.Node.run("minimisation", input) 66 | 67 | Set a custom directory for the node library. 68 | 69 | .. code-block:: python 70 | 71 | import BioSimSpace as BSS 72 | 73 | BSS.Node.setNodeDirectory("/path/to/node/library") 74 | """ 75 | 76 | from ._node import * 77 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Parameters/_Protocol/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | Protocol for parameterising molecules. 24 | Author: Lester Hedges . 25 | """ 26 | 27 | from ._protocol import Protocol as _Protocol 28 | from ._amber import * 29 | from ._openforcefield import * 30 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Trajectory/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Trajectory 24 | 25 | Classes 26 | ======= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | Trajectory 32 | """ 33 | 34 | from ._trajectory import * 35 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Types/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Types 24 | 25 | Classes 26 | ======= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | Angle 32 | Area 33 | Charge 34 | Coordinate 35 | Energy 36 | Length 37 | Pressure 38 | Temperature 39 | Time 40 | Vector 41 | Volume 42 | """ 43 | 44 | from ._angle import * 45 | from ._area import * 46 | from ._charge import * 47 | from ._coordinate import * 48 | from ._energy import * 49 | from ._length import * 50 | from ._pressure import * 51 | from ._temperature import * 52 | from ._time import * 53 | from ._vector import * 54 | from ._volume import * 55 | 56 | # Hide GeneralUnit since it will be automatically created from combinations 57 | # of the unit based types above. 58 | from ._general_unit import GeneralUnit as _GeneralUnit 59 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Types/_base_units.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | # The set of supported base units. General unit based types can be created 23 | # by combining these, e.g. via multiplication or division. 24 | 25 | __all__ = ["_base_units", "_base_dimensions", "_sire_units_locals"] 26 | 27 | from ._angle import * 28 | from ._area import * 29 | from ._charge import * 30 | from ._energy import * 31 | from ._length import * 32 | from ._pressure import * 33 | from ._temperature import * 34 | from ._time import * 35 | from ._volume import * 36 | 37 | import sys as _sys 38 | 39 | _namespace = _sys.modules[__name__] 40 | 41 | # Create the list of base unit types. 42 | _base_units = [getattr(_namespace, var) for var in dir() if var[0] != "_"] 43 | 44 | _base_dimensions = {} 45 | for unit in _base_units: 46 | _base_dimensions[unit._dimensions] = unit 47 | 48 | # Create a local namespace dictionary for the supported Sire units. This 49 | # maps between the unit name and the Sire unit object, allowing us to 50 | # use eval to parse arbitrary expressions based in these units from the 51 | # command-line. 52 | import sire.legacy.Units as _SireUnits 53 | 54 | _sire_units_locals = {} 55 | 56 | for unit in _base_units: 57 | for sire_unit in unit._sire_units: 58 | _sire_units_locals[sire_unit] = getattr(_SireUnits, sire_unit) 59 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Units/Angle/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Angle units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["radian", "degree"] 28 | 29 | from ...Types import Angle as _Angle 30 | 31 | radian = _Angle(1, "radian") 32 | degree = _Angle(1, "degree") 33 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Units/Area/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Area units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["meter2", "angstrom2", "nanometer2", "picometer2"] 28 | 29 | from ...Types import Area as _Area 30 | 31 | meter2 = _Area(1, "meter2") 32 | nanometer2 = _Area(1, "nanometer2") 33 | angstrom2 = _Area(1, "angstrom2") 34 | picometer2 = _Area(1, "picometer2") 35 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Units/Charge/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | Charge units. 24 | Author: Lester Hedges . 25 | """ 26 | 27 | __author__ = "Lester Hedges" 28 | __email__ = "lester.hedges@gmail.com" 29 | 30 | __all__ = ["electron_charge", "coulomb"] 31 | 32 | from ...Types import Charge as _Charge 33 | 34 | electron_charge = _Charge(1, "ELECTRON CHARGE") 35 | coulomb = _Charge(1, "COULOMB") 36 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Units/Energy/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Energy units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["kcal_per_mol", "kj_per_mol", "kt"] 28 | 29 | from ...Types import Energy as _Energy 30 | 31 | kcal_per_mol = _Energy(1, "KILO CALORIES PER MOL") 32 | kj_per_mol = _Energy(1, "KILO JOULES PER MOL") 33 | kt = _Energy(1, "KT") 34 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Units/Length/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Length units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["meter", "centimeter", "millimeter", "nanometer", "angstrom", "picometer"] 28 | 29 | from ...Types import Length as _Length 30 | 31 | meter = _Length(1, "meter") 32 | centimeter = _Length(1, "centimeter") 33 | millimeter = _Length(1, "millimeter") 34 | nanometer = _Length(1, "nanometer") 35 | angstrom = _Length(1, "angstrom") 36 | picometer = _Length(1, "picometer") 37 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Units/Pressure/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Pressure units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["atm", "bar"] 28 | 29 | from ...Types import Pressure as _Pressure 30 | 31 | atm = _Pressure(1, "ATMOSPHERE") 32 | bar = _Pressure(1, "BAR") 33 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Units/Temperature/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Temperature units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["celsius", "fahrenheit", "kelvin"] 28 | 29 | from ...Types import Temperature as _Temperature 30 | 31 | celsius = _Temperature(1, "celsius") 32 | fahrenheit = _Temperature(1, "fahrenheit") 33 | kelvin = _Temperature(1, "kelvin") 34 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Units/Time/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Time units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = [ 28 | "day", 29 | "hour", 30 | "minute", 31 | "second", 32 | "millisecond", 33 | "nanosecond", 34 | "picosecond", 35 | "femtosecond", 36 | ] 37 | 38 | from ...Types import Time as _Time 39 | 40 | day = _Time(1, "day") 41 | hour = _Time(1, "hour") 42 | minute = _Time(1, "minute") 43 | second = _Time(1, "second") 44 | millisecond = _Time(1, "millisecond") 45 | nanosecond = _Time(1, "nanosecond") 46 | picosecond = _Time(1, "picosecond") 47 | femtosecond = _Time(1, "femtosecond") 48 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/Units/Volume/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Volume units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["meter3", "nanometer3", "angstrom3", "picometer3"] 28 | 29 | from ...Types import Volume as _Volume 30 | 31 | meter3 = _Volume(1, "meter3") 32 | nanometer3 = _Volume(1, "nanometer3") 33 | angstrom3 = _Volume(1, "angstrom3") 34 | picometer3 = _Volume(1, "picometer3") 35 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/_Exceptions/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace._Exceptions 24 | 25 | Classes 26 | ======= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | AlignmentError 32 | AnalysisError 33 | IncompatibleError 34 | MissingSoftwareError 35 | ParameterisationError 36 | ThirdPartyError 37 | """ 38 | 39 | from ._exceptions import * 40 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/_Exceptions/_exceptions.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Custom exceptions for error handling.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = [ 28 | "AlignmentError", 29 | "AnalysisError", 30 | "IncompatibleError", 31 | "MissingSoftwareError", 32 | "ParameterisationError", 33 | "ThirdPartyError", 34 | ] 35 | 36 | 37 | class AlignmentError(Exception): 38 | """Exception thrown when molecular alignment fails.""" 39 | 40 | pass 41 | 42 | 43 | class AnalysisError(Exception): 44 | """Exception thrown when analysis on existing simulation data fails.""" 45 | 46 | 47 | class IncompatibleError(Exception): 48 | """Exception thrown when objects are incompatible with each other.""" 49 | 50 | pass 51 | 52 | 53 | class MissingSoftwareError(Exception): 54 | """Exception thrown when external software dependencies are missing.""" 55 | 56 | pass 57 | 58 | 59 | class ParameterisationError(Exception): 60 | """Exception thrown when molecular parameterisation fails.""" 61 | 62 | pass 63 | 64 | 65 | class ThirdPartyError(Exception): 66 | """Exception thrown by a third party package.""" 67 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace._SireWrappers 24 | 25 | Classes 26 | ======= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | Atom 32 | Bond 33 | Molecule 34 | Molecules 35 | Residue 36 | System 37 | SearchResult 38 | """ 39 | 40 | from ._atom import * 41 | from ._bond import * 42 | from ._molecule import * 43 | from ._molecules import * 44 | from ._residue import * 45 | from ._search_result import * 46 | from ._system import * 47 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/_Utils/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace._Utils 24 | 25 | Context managers 26 | ================ 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | cd 32 | command_split 33 | _module_stub 34 | _try_import 35 | _have_imported 36 | _assert_imported 37 | """ 38 | 39 | from ._contextmanagers import * 40 | from ._module_stub import * 41 | from ._command_split import * 42 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/Exscientia/_Utils/_contextmanagers.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Custom context managers.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["cd"] 28 | 29 | from contextlib import contextmanager as _contextmanager 30 | 31 | import os as _os 32 | 33 | 34 | # Adapted from: http://ralsina.me/weblog/posts/BB963.html 35 | @_contextmanager 36 | def cd(work_dir): 37 | """ 38 | Execute the context in the directory "work_dir". 39 | 40 | Parameters 41 | ---------- 42 | 43 | work_dir : str 44 | The working directory for the context. 45 | """ 46 | 47 | # Validate the input. 48 | if not isinstance(work_dir, str): 49 | raise TypeError("'work_dir' must be of type 'str'") 50 | 51 | # Store the current directory. 52 | old_dir = _os.getcwd() 53 | 54 | # Create the working directory if it doesn't exist. 55 | if not _os.path.isdir(work_dir): 56 | _os.makedirs(work_dir) 57 | 58 | # Change to the new directory. 59 | _os.chdir(work_dir) 60 | 61 | # Execute the context. 62 | try: 63 | yield 64 | 65 | # Return to original directory. 66 | finally: 67 | _os.chdir(old_dir) 68 | -------------------------------------------------------------------------------- /python/BioSimSpace/Sandpit/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """A sandpit for experimental BioSimSpace features.""" 23 | -------------------------------------------------------------------------------- /python/BioSimSpace/Trajectory/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Trajectory 24 | 25 | Classes 26 | ======= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | Trajectory 32 | """ 33 | 34 | from ._trajectory import * 35 | -------------------------------------------------------------------------------- /python/BioSimSpace/Types/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace.Types 24 | 25 | Classes 26 | ======= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | Angle 32 | Area 33 | Charge 34 | Coordinate 35 | Energy 36 | Length 37 | Pressure 38 | Temperature 39 | Time 40 | Vector 41 | Volume 42 | """ 43 | 44 | from ._angle import * 45 | from ._area import * 46 | from ._charge import * 47 | from ._coordinate import * 48 | from ._energy import * 49 | from ._length import * 50 | from ._pressure import * 51 | from ._temperature import * 52 | from ._time import * 53 | from ._vector import * 54 | from ._volume import * 55 | 56 | # Hide GeneralUnit since it will be automatically created from combinations 57 | # of the unit based types above. 58 | from ._general_unit import GeneralUnit as _GeneralUnit 59 | -------------------------------------------------------------------------------- /python/BioSimSpace/Types/_base_units.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | # The set of supported base units. General unit based types can be created 23 | # by combining these, e.g. via multiplication or division. 24 | 25 | __all__ = ["_base_units", "_base_dimensions", "_sire_units_locals"] 26 | 27 | from ._angle import * 28 | from ._area import * 29 | from ._charge import * 30 | from ._energy import * 31 | from ._length import * 32 | from ._pressure import * 33 | from ._temperature import * 34 | from ._time import * 35 | from ._volume import * 36 | 37 | import sys as _sys 38 | 39 | _namespace = _sys.modules[__name__] 40 | 41 | # Create the list of base unit types. 42 | _base_units = [getattr(_namespace, var) for var in dir() if var[0] != "_"] 43 | 44 | _base_dimensions = {} 45 | for unit in _base_units: 46 | _base_dimensions[unit._dimensions] = unit 47 | 48 | # Create a local namespace dictionary for the supported Sire units. This 49 | # maps between the unit name and the Sire unit object, allowing us to 50 | # use eval to parse arbitrary expressions based in these units from the 51 | # command-line. 52 | import sire.legacy.Units as _SireUnits 53 | 54 | _sire_units_locals = {} 55 | 56 | for unit in _base_units: 57 | for sire_unit in unit._sire_units: 58 | _sire_units_locals[sire_unit] = getattr(_SireUnits, sire_unit) 59 | -------------------------------------------------------------------------------- /python/BioSimSpace/Units/Angle/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Angle units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["radian", "degree"] 28 | 29 | from ...Types import Angle as _Angle 30 | 31 | radian = _Angle(1, "radian") 32 | degree = _Angle(1, "degree") 33 | -------------------------------------------------------------------------------- /python/BioSimSpace/Units/Area/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Area units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["meter2", "angstrom2", "nanometer2", "picometer2"] 28 | 29 | from ...Types import Area as _Area 30 | 31 | meter2 = _Area(1, "meter2") 32 | nanometer2 = _Area(1, "nanometer2") 33 | angstrom2 = _Area(1, "angstrom2") 34 | picometer2 = _Area(1, "picometer2") 35 | -------------------------------------------------------------------------------- /python/BioSimSpace/Units/Charge/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | Charge units. 24 | Author: Lester Hedges . 25 | """ 26 | 27 | __author__ = "Lester Hedges" 28 | __email__ = "lester.hedges@gmail.com" 29 | 30 | __all__ = ["electron_charge", "coulomb"] 31 | 32 | from ...Types import Charge as _Charge 33 | 34 | electron_charge = _Charge(1, "ELECTRON CHARGE") 35 | coulomb = _Charge(1, "COULOMB") 36 | -------------------------------------------------------------------------------- /python/BioSimSpace/Units/Energy/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Energy units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["kcal_per_mol", "kj_per_mol", "kt"] 28 | 29 | from ...Types import Energy as _Energy 30 | 31 | kcal_per_mol = _Energy(1, "KILO CALORIES PER MOL") 32 | kj_per_mol = _Energy(1, "KILO JOULES PER MOL") 33 | kt = _Energy(1, "KT") 34 | -------------------------------------------------------------------------------- /python/BioSimSpace/Units/Length/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Length units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["meter", "centimeter", "millimeter", "nanometer", "angstrom", "picometer"] 28 | 29 | from ...Types import Length as _Length 30 | 31 | meter = _Length(1, "meter") 32 | centimeter = _Length(1, "centimeter") 33 | millimeter = _Length(1, "millimeter") 34 | nanometer = _Length(1, "nanometer") 35 | angstrom = _Length(1, "angstrom") 36 | picometer = _Length(1, "picometer") 37 | -------------------------------------------------------------------------------- /python/BioSimSpace/Units/Pressure/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Pressure units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["atm", "bar"] 28 | 29 | from ...Types import Pressure as _Pressure 30 | 31 | atm = _Pressure(1, "ATMOSPHERE") 32 | bar = _Pressure(1, "BAR") 33 | -------------------------------------------------------------------------------- /python/BioSimSpace/Units/Temperature/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Temperature units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["celsius", "fahrenheit", "kelvin"] 28 | 29 | from ...Types import Temperature as _Temperature 30 | 31 | celsius = _Temperature(1, "celsius") 32 | fahrenheit = _Temperature(1, "fahrenheit") 33 | kelvin = _Temperature(1, "kelvin") 34 | -------------------------------------------------------------------------------- /python/BioSimSpace/Units/Time/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Time units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = [ 28 | "day", 29 | "hour", 30 | "minute", 31 | "second", 32 | "millisecond", 33 | "nanosecond", 34 | "picosecond", 35 | "femtosecond", 36 | ] 37 | 38 | from ...Types import Time as _Time 39 | 40 | day = _Time(1, "day") 41 | hour = _Time(1, "hour") 42 | minute = _Time(1, "minute") 43 | second = _Time(1, "second") 44 | millisecond = _Time(1, "millisecond") 45 | nanosecond = _Time(1, "nanosecond") 46 | picosecond = _Time(1, "picosecond") 47 | femtosecond = _Time(1, "femtosecond") 48 | -------------------------------------------------------------------------------- /python/BioSimSpace/Units/Volume/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Volume units.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["meter3", "nanometer3", "angstrom3", "picometer3"] 28 | 29 | from ...Types import Volume as _Volume 30 | 31 | meter3 = _Volume(1, "meter3") 32 | nanometer3 = _Volume(1, "nanometer3") 33 | angstrom3 = _Volume(1, "angstrom3") 34 | picometer3 = _Volume(1, "picometer3") 35 | -------------------------------------------------------------------------------- /python/BioSimSpace/_Config/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace._Config 24 | 25 | Classes 26 | ======= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | Amber 32 | Gromacs 33 | Somd 34 | """ 35 | 36 | from ._amber import * 37 | from ._gromacs import * 38 | from ._somd import * 39 | -------------------------------------------------------------------------------- /python/BioSimSpace/_Exceptions/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace._Exceptions 24 | 25 | Classes 26 | ======= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | AlignmentError 32 | AnalysisError 33 | IncompatibleError 34 | MissingSoftwareError 35 | ParameterisationError 36 | ThirdPartyError 37 | """ 38 | 39 | from ._exceptions import * 40 | -------------------------------------------------------------------------------- /python/BioSimSpace/_Exceptions/_exceptions.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Custom exceptions for error handling.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = [ 28 | "AlignmentError", 29 | "AnalysisError", 30 | "IncompatibleError", 31 | "MissingSoftwareError", 32 | "ParameterisationError", 33 | "ThirdPartyError", 34 | ] 35 | 36 | 37 | class AlignmentError(Exception): 38 | """Exception thrown when molecular alignment fails.""" 39 | 40 | pass 41 | 42 | 43 | class AnalysisError(Exception): 44 | """Exception thrown when analysis on existing simulation data fails.""" 45 | 46 | 47 | class IncompatibleError(Exception): 48 | """Exception thrown when objects are incompatible with each other.""" 49 | 50 | pass 51 | 52 | 53 | class MissingSoftwareError(Exception): 54 | """Exception thrown when external software dependencies are missing.""" 55 | 56 | pass 57 | 58 | 59 | class ParameterisationError(Exception): 60 | """Exception thrown when molecular parameterisation fails.""" 61 | 62 | pass 63 | 64 | 65 | class ThirdPartyError(Exception): 66 | """Exception thrown by a third party package.""" 67 | -------------------------------------------------------------------------------- /python/BioSimSpace/_SireWrappers/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace._SireWrappers 24 | 25 | Classes 26 | ======= 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | Atom 32 | Bond 33 | Molecule 34 | Molecules 35 | Residue 36 | System 37 | SearchResult 38 | """ 39 | 40 | from ._atom import * 41 | from ._bond import * 42 | from ._molecule import * 43 | from ._molecules import * 44 | from ._residue import * 45 | from ._search_result import * 46 | from ._system import * 47 | -------------------------------------------------------------------------------- /python/BioSimSpace/_Utils/__init__.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """ 23 | .. currentmodule:: BioSimSpace._Utils 24 | 25 | Context managers 26 | ================ 27 | 28 | .. autosummary:: 29 | :toctree: generated/ 30 | 31 | cd 32 | command_split 33 | _module_stub 34 | _try_import 35 | _have_imported 36 | _assert_imported 37 | """ 38 | 39 | from ._contextmanagers import * 40 | from ._module_stub import * 41 | from ._command_split import * 42 | -------------------------------------------------------------------------------- /python/BioSimSpace/_Utils/_contextmanagers.py: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # BioSimSpace: Making biomolecular simulation a breeze! 3 | # 4 | # Copyright: 2017-2023 5 | # 6 | # Authors: Lester Hedges 7 | # 8 | # BioSimSpace is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation, either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # BioSimSpace is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | # GNU General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with BioSimSpace. If not, see . 20 | ##################################################################### 21 | 22 | """Custom context managers.""" 23 | 24 | __author__ = "Lester Hedges" 25 | __email__ = "lester.hedges@gmail.com" 26 | 27 | __all__ = ["cd"] 28 | 29 | from contextlib import contextmanager as _contextmanager 30 | 31 | import os as _os 32 | 33 | 34 | # Adapted from: http://ralsina.me/weblog/posts/BB963.html 35 | @_contextmanager 36 | def cd(work_dir): 37 | """ 38 | Execute the context in the directory "work_dir". 39 | 40 | Parameters 41 | ---------- 42 | 43 | work_dir : str 44 | The working directory for the context. 45 | """ 46 | 47 | # Validate the input. 48 | if not isinstance(work_dir, str): 49 | raise TypeError("'work_dir' must be of type 'str'") 50 | 51 | # Store the current directory. 52 | old_dir = _os.getcwd() 53 | 54 | # Create the working directory if it doesn't exist. 55 | if not _os.path.isdir(work_dir): 56 | _os.makedirs(work_dir) 57 | 58 | # Change to the new directory. 59 | _os.chdir(work_dir) 60 | 61 | # Execute the context. 62 | try: 63 | yield 64 | 65 | # Return to original directory. 66 | finally: 67 | _os.chdir(old_dir) 68 | -------------------------------------------------------------------------------- /python/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include versioneer.py 2 | include BioSimSpace/_version.py 3 | include BioSimSpace/Metadynamics/_aux/* 4 | include BioSimSpace/Align/_lomap/* 5 | -------------------------------------------------------------------------------- /python/setup.cfg: -------------------------------------------------------------------------------- 1 | [versioneer] 2 | VCS = git 3 | style = pep440 4 | versionfile_source = BioSimSpace/_version.py 5 | versionfile_build = BioSimSpace/_version.py 6 | tag_prefix = 7 | parentdir_prefix = BioSimSpace- 8 | -------------------------------------------------------------------------------- /recipes/biosimspace/bld.bat: -------------------------------------------------------------------------------- 1 | 2 | cd python 3 | python setup.py BSS_CONDA_INSTALL=1 install 4 | -------------------------------------------------------------------------------- /recipes/biosimspace/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Build script for BioSimSpace Conda installation. 4 | 5 | cd python && BSS_CONDA_INSTALL=True python setup.py install --single-version-externally-managed --record=record.txt 6 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # BioSimSpace runtime requirements. 2 | 3 | sire ~=2023.1.0 4 | 5 | configargparse 6 | kcombu_bss 7 | ipywidgets<8 8 | lomap2 9 | networkx 10 | nglview 11 | openff-interchange-base 12 | openff-toolkit-base 13 | parmed 14 | py3dmol 15 | pydot 16 | pygtail 17 | pypdb 18 | pyyaml 19 | rdkit 20 | watchdog 21 | 22 | # The below are packages that aren't available on all 23 | # platforms/OSs and so need to be conditionally included 24 | 25 | alchemlyb<2 ; platform_machine != "aarch64" # Needs pymbar, not on Linux/aarch64 26 | 27 | mdtraj ; platform_machine != "aarch64" # not on Linux/aarch64 28 | 29 | mdanalysis ; platform_machine != "aarch64" # not on Linux/aarch64 30 | -------------------------------------------------------------------------------- /requirements_build.txt: -------------------------------------------------------------------------------- 1 | # BioSimSpace build requirements. 2 | -------------------------------------------------------------------------------- /test/Gateway/test_boolean.py: -------------------------------------------------------------------------------- 1 | from BioSimSpace.Gateway import Boolean 2 | 3 | import pytest 4 | 5 | # Tests for Boolean requirements. 6 | 7 | 8 | def test_no_arguments(): 9 | """Test that calling constructor with no arguments will raise a ValueError.""" 10 | 11 | with pytest.raises(ValueError): 12 | b = Boolean() 13 | 14 | 15 | @pytest.mark.parametrize("value", [True, False]) 16 | def test_value(value): 17 | """Test whether object is initialised correctly and value is set.""" 18 | 19 | # Create boolean with name and help text. 20 | b = Boolean(help="Help!") 21 | 22 | # Set the value of the boolean. 23 | b.setValue(value) 24 | 25 | # Assert that all arguments are parsed correctly and the value is set. 26 | assert b.getValue() == value 27 | assert b.getHelp() == "Help!" 28 | assert b.getDefault() is None 29 | assert b.isOptional() is False 30 | assert b.getMin() == None 31 | assert b.getMax() == None 32 | assert b.getAllowedValues() is None 33 | assert b.isMulti() == False 34 | assert b.getArgType() == bool 35 | 36 | 37 | @pytest.mark.parametrize("default", [True, False]) 38 | def test_default(default): 39 | """Test that default value is set correctly.""" 40 | 41 | b = Boolean(help="Help!", default=default) 42 | 43 | assert b.getHelp() == "Help!" 44 | assert b.getDefault() == default 45 | 46 | # Make sure that the argument is now optional. 47 | assert b.isOptional() is True 48 | 49 | 50 | @pytest.mark.parametrize("value", [5, "True", 5.7, "string", [2, 3, 4]]) 51 | def test_bad_value(value): 52 | """Test that TypeError is raised when "value" is not a boolean.""" 53 | 54 | b = Boolean(help="Help!") 55 | with pytest.raises(TypeError): 56 | b.setValue(value) 57 | 58 | 59 | @pytest.mark.parametrize("default", [5, "False", 5.7, "string", [2, 3, 4]]) 60 | def test_bad_defaul(default): 61 | """Test that TypeError is raised when the default is the wrong type.""" 62 | 63 | with pytest.raises(TypeError): 64 | b = Boolean(help="Help!", default=default) 65 | 66 | 67 | @pytest.mark.parametrize("help", [5, 5.7, True, [5, 7, -4]]) 68 | def test_bad_help(help): 69 | """Test that TypeError is raised when 'help' is not a string.""" 70 | 71 | with pytest.raises(TypeError): 72 | b = Boolean(help=help) 73 | -------------------------------------------------------------------------------- /test/Gateway/test_file.py: -------------------------------------------------------------------------------- 1 | from BioSimSpace.Gateway import File 2 | 3 | import pytest 4 | 5 | # Tests for File requirements. 6 | 7 | 8 | def test_no_arguments(): 9 | """Test that calling constructor with no arguments will raise a ValueError.""" 10 | 11 | with pytest.raises(ValueError): 12 | f = File() 13 | 14 | 15 | @pytest.mark.parametrize("value", ["test/input/ala.crd", "test/input/ala.top"]) 16 | def test_value(value): 17 | """Test whether object is initialised correctly and value is set.""" 18 | 19 | f = File(help="Help!") 20 | f.setValue(value) 21 | 22 | assert f.getValue() == value 23 | assert f.getHelp() == "Help!" 24 | assert f.isOptional() == False 25 | assert f.getDefault() == None 26 | assert f.getMin() == None 27 | assert f.getMax() == None 28 | assert f.getAllowedValues() is None 29 | assert f.isMulti() == False 30 | assert f.getArgType() == str 31 | 32 | 33 | @pytest.mark.parametrize("value", [1.5, 7, True]) 34 | def test_bad_value(value): 35 | """Check that TypeError is raised when "value" is the wrong type.""" 36 | 37 | f = File(help="Help!") 38 | with pytest.raises(TypeError): 39 | f.setValue(value) 40 | 41 | 42 | def test_missing_file(): 43 | """Check that IOError is raised when the file doesn't exist.""" 44 | 45 | with pytest.raises(IOError): 46 | f = File(help="Help!") 47 | f.setValue("missing.txt") 48 | 49 | 50 | @pytest.mark.parametrize("optional", [True, False]) 51 | def test_optional(optional): 52 | """Check that the optional flag is set correctly.""" 53 | 54 | f = File(help="Help!", optional=optional) 55 | 56 | assert f.getHelp() == "Help!" 57 | assert f.isOptional() == optional 58 | assert f.getDefault() == None 59 | assert f.getMin() == None 60 | assert f.getMax() == None 61 | assert f.getAllowedValues() is None 62 | assert f.isMulti() == False 63 | assert f.getArgType() == str 64 | -------------------------------------------------------------------------------- /test/Gateway/test_fileset.py: -------------------------------------------------------------------------------- 1 | from BioSimSpace.Gateway import FileSet 2 | 3 | import pytest 4 | 5 | # Tests for FileSet requirements. 6 | 7 | 8 | def test_no_arguments(): 9 | """Test that calling constructor with no arguments will raise a ValueError.""" 10 | 11 | with pytest.raises(ValueError): 12 | f = FileSet() 13 | 14 | 15 | @pytest.mark.parametrize( 16 | "value", 17 | [ 18 | ["test/input/ala.crd", "test/input/ala.top"], 19 | [ 20 | "test/input/alanin.pdb", 21 | "test/input/alanin.psf", 22 | "test/input/alanin.params", 23 | ], 24 | ], 25 | ) 26 | def test_value(value): 27 | """Test whether object is initialised correctly and value is set.""" 28 | 29 | f = FileSet(help="Help!") 30 | f.setValue(value) 31 | 32 | assert f.getValue() == value 33 | assert f.getHelp() == "Help!" 34 | assert f.isOptional() == False 35 | assert f.getDefault() == None 36 | assert f.getMin() == None 37 | assert f.getMax() == None 38 | assert f.getAllowedValues() is None 39 | assert f.isMulti() == True 40 | assert f.getArgType() == str 41 | 42 | 43 | @pytest.mark.parametrize("value", [[1.5, 7, True], [33.0, False]]) 44 | def test_bad_value(value): 45 | """Check that TypeError is raised when "value" is the wrong type.""" 46 | 47 | f = FileSet(help="Help!") 48 | with pytest.raises(TypeError): 49 | f.setValue(value) 50 | 51 | 52 | def test_missing_files(): 53 | """Check that IOError is raised when a file doesn't exist.""" 54 | 55 | # All files missing. 56 | with pytest.raises(IOError): 57 | f = FileSet(help="Help!") 58 | f.setValue(["missing1.txt", "missing2.txt"]) 59 | 60 | # One file missing. 61 | with pytest.raises(IOError): 62 | f = FileSet(help="Help!") 63 | f.setValue(["test/input/amber/ala/ala.crd", "missing2.txt"]) 64 | 65 | 66 | @pytest.mark.parametrize("optional", [True, False]) 67 | def test_optional(optional): 68 | """Check that the optional flag is set correctly.""" 69 | 70 | f = FileSet(help="Help!", optional=optional) 71 | 72 | assert f.getHelp() == "Help!" 73 | assert f.isOptional() == optional 74 | assert f.getDefault() == None 75 | assert f.getMin() == None 76 | assert f.getMax() == None 77 | assert f.getAllowedValues() is None 78 | assert f.isMulti() == True 79 | assert f.getArgType() == str 80 | -------------------------------------------------------------------------------- /test/IO/test_file_cache.py: -------------------------------------------------------------------------------- 1 | import BioSimSpace as BSS 2 | 3 | import glob 4 | import os 5 | import pytest 6 | import tempfile 7 | 8 | 9 | def test_file_cache(): 10 | """ 11 | Simple test to see if cached files are used when repeatedly writing 12 | the same system to the same file format. 13 | """ 14 | 15 | # Clear the file cache. 16 | BSS.IO._io._file_cache = {} 17 | 18 | # Load the molecular system. 19 | s = BSS.IO.readMolecules(["test/input/ala.crd", "test/input/ala.top"]) 20 | 21 | # Create a temporary working directory. 22 | tmp_dir = tempfile.TemporaryDirectory() 23 | tmp_path = tmp_dir.name 24 | 25 | # Write the system to PDB and PRM7 format. 26 | BSS.IO.saveMolecules(f"{tmp_path}/tmp", s, ["pdb", "prm7"]) 27 | 28 | # Check that the file cache has two entries. 29 | assert len(BSS.IO._io._file_cache) == 2 30 | 31 | # Write to PDB and GroTop format. The PDB from the cache should be reused. 32 | BSS.IO.saveMolecules(f"{tmp_path}/tmp2", s, ["pdb", "grotop"]) 33 | 34 | # Check that the file cache has three entries, i.e. only the GroTop was added. 35 | assert len(BSS.IO._io._file_cache) == 3 36 | 37 | # The directory should now contain 4 files. 38 | assert len(glob.glob(f"{tmp_path}/*")) == 4 39 | 40 | # Now delete one of the files on disk and re-write. This should create a new 41 | # entry in the cache. 42 | os.remove(f"{tmp_path}/tmp.pdb") 43 | BSS.IO.saveMolecules(f"{tmp_path}/tmp3", s, ["pdb", "grotop"]) 44 | 45 | # Check that the file cache still has three entries. 46 | assert len(BSS.IO._io._file_cache) == 3 47 | 48 | # The directory should now contain 5 files. 49 | assert len(glob.glob(f"{tmp_path}/*")) == 5 50 | 51 | # Now "corrupt" a file on disk so that its MD5 checksum is no longer 52 | # valid. 53 | with open(f"{tmp_path}/tmp2.pdb", "w") as f: 54 | pass 55 | 56 | # Write back to PDB and Gro87 format. The PDB file is now invalid, so 57 | # a new one will be written and added to the cache. 58 | BSS.IO.saveMolecules(f"{tmp_path}/tmp4", s, ["pdb", "gro87"]) 59 | 60 | # Check that the file cache still has three entries. 61 | assert len(BSS.IO._io._file_cache) == 4 62 | 63 | # The directory should now contain 7 files. 64 | assert len(glob.glob(f"{tmp_path}/*")) == 7 65 | -------------------------------------------------------------------------------- /test/IO/test_openff_gromacs.py: -------------------------------------------------------------------------------- 1 | import BioSimSpace as BSS 2 | from BioSimSpace._Utils import _try_import, _have_imported 3 | 4 | import os 5 | import pytest 6 | 7 | # Check whether AMBER is installed. 8 | if BSS._amber_home is not None: 9 | exe = "%s/bin/sander" % BSS._amber_home 10 | if os.path.isfile(exe): 11 | has_amber = True 12 | else: 13 | has_amber = False 14 | else: 15 | has_amber = False 16 | 17 | # Check whether GROMACS is installed. 18 | has_gromacs = BSS._gmx_exe is not None 19 | 20 | # Make sure openff is installed. 21 | _openff = _try_import("openff") 22 | has_openff = _have_imported(_openff) 23 | 24 | 25 | @pytest.mark.skipif( 26 | has_amber is False or has_gromacs is False or has_openff is False, 27 | reason="Requires that AMBER, GROMACS, and OpenFF are installed.", 28 | ) 29 | def test_molecule_combine(): 30 | """Single point energy comparison to make sure that GROMACS 31 | can correctly combine Open Force Field molecules where 32 | duplicate atom types have different molecular parameters. 33 | """ 34 | 35 | # Create two test molecules, parameterised using OpenFF. 36 | # These molecules will contain duplicate atom types, e.g. H1, 37 | # which have different parameters. 38 | 39 | # Toluene. 40 | m0 = BSS.Parameters.openff_unconstrained_2_0_0("Cc1ccccc1").getMolecule() 41 | 42 | # Benzene. 43 | m1 = BSS.Parameters.openff_unconstrained_2_0_0("c1ccccc1").getMolecule() 44 | 45 | # Translate m1 such that the molecules don't interact. 46 | m1.translate(3 * [50 * BSS.Units.Length.angstrom]) 47 | 48 | # Create a single-step minimisation protocol. 49 | protocol = BSS.Protocol.Minimisation(steps=1) 50 | 51 | # Create processes to single point calculations with GROMACS. 52 | p0 = BSS.Process.Gromacs(m0.toSystem(), protocol, extra_options={"nsteps": 0}) 53 | p1 = BSS.Process.Gromacs(m1.toSystem(), protocol, extra_options={"nsteps": 0}) 54 | p01 = BSS.Process.Gromacs( 55 | (m0 + m1).toSystem(), protocol, extra_options={"nsteps": 0} 56 | ) 57 | 58 | # Run the processes and wait for them to finish. 59 | p0.start() 60 | p0.wait() 61 | p1.start() 62 | p1.wait() 63 | p01.start() 64 | p01.wait() 65 | 66 | # Get the potential energies. 67 | e0 = p0.getPotentialEnergy() 68 | e1 = p1.getPotentialEnergy() 69 | e01 = p01.getPotentialEnergy() 70 | 71 | # Make sure the energies are consistent. 72 | assert (e0 + e1).value() == pytest.approx(e01.value(), rel=1e-3) 73 | -------------------------------------------------------------------------------- /test/Parameters/test_parameters.py: -------------------------------------------------------------------------------- 1 | import BioSimSpace as BSS 2 | 3 | import os 4 | import pytest 5 | 6 | # Store the tutorial URL. 7 | url = BSS.tutorialUrl() 8 | 9 | # Make sure required AMBER executables are present. 10 | if BSS._amber_home is not None: 11 | tleap = "%s/bin/tleap" % BSS._amber_home 12 | if os.path.isfile(tleap): 13 | has_tleap = True 14 | else: 15 | has_tleap = False 16 | else: 17 | has_tleap = False 18 | 19 | 20 | @pytest.fixture(scope="session") 21 | def molecule(): 22 | return BSS.IO.readMolecules(f"{url}/4LYT_Fixed.pdb.bz2")[0] 23 | 24 | 25 | @pytest.mark.skipif(has_tleap is False, reason="Requires tLEaP to be installed.") 26 | @pytest.mark.parametrize("ff", BSS.Parameters.amberProteinForceFields()) 27 | def test_disulphide(molecule, ff): 28 | """Test parameterisation in the presence of disulphide bridges.""" 29 | 30 | # Try to parameterise with the named force field. If working, this should 31 | # auto-detect disulphide bonds and add the appropriate bond records to the 32 | # tLEaP input script. 33 | molecule = getattr(BSS.Parameters, ff)(molecule).getMolecule() 34 | 35 | # Check that we actually generate records for four disulphide bonds. 36 | bonds = BSS.Parameters._Protocol.AmberProtein._get_disulphide_bonds( 37 | molecule._sire_object 38 | ) 39 | assert len(bonds) == 4 40 | 41 | # Check that the bond parameters are present in the molecule. 42 | bonds = molecule.search("bonds from element S to element S") 43 | assert len(bonds) == 4 44 | -------------------------------------------------------------------------------- /test/Sandpit/Exscientia/Gateway/test_boolean.py: -------------------------------------------------------------------------------- 1 | from BioSimSpace.Sandpit.Exscientia.Gateway import Boolean 2 | 3 | import pytest 4 | 5 | # Tests for Boolean requirements. 6 | 7 | 8 | def test_no_arguments(): 9 | """Test that calling constructor with no arguments will raise a ValueError.""" 10 | 11 | with pytest.raises(ValueError): 12 | b = Boolean() 13 | 14 | 15 | @pytest.mark.parametrize("value", [True, False]) 16 | def test_value(value): 17 | """Test whether object is initialised correctly and value is set.""" 18 | 19 | # Create boolean with name and help text. 20 | b = Boolean(help="Help!") 21 | 22 | # Set the value of the boolean. 23 | b.setValue(value) 24 | 25 | # Assert that all arguments are parsed correctly and the value is set. 26 | assert b.getValue() == value 27 | assert b.getHelp() == "Help!" 28 | assert b.getDefault() is None 29 | assert b.isOptional() is False 30 | assert b.getMin() == None 31 | assert b.getMax() == None 32 | assert b.getAllowedValues() is None 33 | assert b.isMulti() == False 34 | assert b.getArgType() == bool 35 | 36 | 37 | @pytest.mark.parametrize("default", [True, False]) 38 | def test_default(default): 39 | """Test that default value is set correctly.""" 40 | 41 | b = Boolean(help="Help!", default=default) 42 | 43 | assert b.getHelp() == "Help!" 44 | assert b.getDefault() == default 45 | 46 | # Make sure that the argument is now optional. 47 | assert b.isOptional() is True 48 | 49 | 50 | @pytest.mark.parametrize("value", [5, "True", 5.7, "string", [2, 3, 4]]) 51 | def test_bad_value(value): 52 | """Test that TypeError is raised when "value" is not a boolean.""" 53 | 54 | b = Boolean(help="Help!") 55 | with pytest.raises(TypeError): 56 | b.setValue(value) 57 | 58 | 59 | @pytest.mark.parametrize("default", [5, "False", 5.7, "string", [2, 3, 4]]) 60 | def test_bad_defaul(default): 61 | """Test that TypeError is raised when the default is the wrong type.""" 62 | 63 | with pytest.raises(TypeError): 64 | b = Boolean(help="Help!", default=default) 65 | 66 | 67 | @pytest.mark.parametrize("help", [5, 5.7, True, [5, 7, -4]]) 68 | def test_bad_help(help): 69 | """Test that TypeError is raised when 'help' is not a string.""" 70 | 71 | with pytest.raises(TypeError): 72 | b = Boolean(help=help) 73 | -------------------------------------------------------------------------------- /test/Sandpit/Exscientia/Gateway/test_file.py: -------------------------------------------------------------------------------- 1 | from BioSimSpace.Sandpit.Exscientia.Gateway import File 2 | 3 | import pytest 4 | 5 | # Tests for File requirements. 6 | 7 | 8 | def test_no_arguments(): 9 | """Test that calling constructor with no arguments will raise a ValueError.""" 10 | 11 | with pytest.raises(ValueError): 12 | f = File() 13 | 14 | 15 | @pytest.mark.parametrize("value", ["test/input/ala.crd", "test/input/ala.top"]) 16 | def test_value(value): 17 | """Test whether object is initialised correctly and value is set.""" 18 | 19 | f = File(help="Help!") 20 | f.setValue(value) 21 | 22 | assert f.getValue() == value 23 | assert f.getHelp() == "Help!" 24 | assert f.isOptional() == False 25 | assert f.getDefault() == None 26 | assert f.getMin() == None 27 | assert f.getMax() == None 28 | assert f.getAllowedValues() is None 29 | assert f.isMulti() == False 30 | assert f.getArgType() == str 31 | 32 | 33 | @pytest.mark.parametrize("value", [1.5, 7, True]) 34 | def test_bad_value(value): 35 | """Check that TypeError is raised when "value" is the wrong type.""" 36 | 37 | f = File(help="Help!") 38 | with pytest.raises(TypeError): 39 | f.setValue(value) 40 | 41 | 42 | def test_missing_file(): 43 | """Check that IOError is raised when the file doesn't exist.""" 44 | 45 | with pytest.raises(IOError): 46 | f = File(help="Help!") 47 | f.setValue("missing.txt") 48 | 49 | 50 | @pytest.mark.parametrize("optional", [True, False]) 51 | def test_optional(optional): 52 | """Check that the optional flag is set correctly.""" 53 | 54 | f = File(help="Help!", optional=optional) 55 | 56 | assert f.getHelp() == "Help!" 57 | assert f.isOptional() == optional 58 | assert f.getDefault() == None 59 | assert f.getMin() == None 60 | assert f.getMax() == None 61 | assert f.getAllowedValues() is None 62 | assert f.isMulti() == False 63 | assert f.getArgType() == str 64 | -------------------------------------------------------------------------------- /test/Sandpit/Exscientia/Gateway/test_fileset.py: -------------------------------------------------------------------------------- 1 | from BioSimSpace.Sandpit.Exscientia.Gateway import FileSet 2 | 3 | import pytest 4 | 5 | # Tests for FileSet requirements. 6 | 7 | 8 | def test_no_arguments(): 9 | """Test that calling constructor with no arguments will raise a ValueError.""" 10 | 11 | with pytest.raises(ValueError): 12 | f = FileSet() 13 | 14 | 15 | @pytest.mark.parametrize( 16 | "value", 17 | [ 18 | ["test/input/ala.crd", "test/input/ala.top"], 19 | [ 20 | "test/input/alanin.pdb", 21 | "test/input/alanin.psf", 22 | "test/input/alanin.params", 23 | ], 24 | ], 25 | ) 26 | def test_value(value): 27 | """Test whether object is initialised correctly and value is set.""" 28 | 29 | f = FileSet(help="Help!") 30 | f.setValue(value) 31 | 32 | assert f.getValue() == value 33 | assert f.getHelp() == "Help!" 34 | assert f.isOptional() == False 35 | assert f.getDefault() == None 36 | assert f.getMin() == None 37 | assert f.getMax() == None 38 | assert f.getAllowedValues() is None 39 | assert f.isMulti() == True 40 | assert f.getArgType() == str 41 | 42 | 43 | @pytest.mark.parametrize("value", [[1.5, 7, True], [33.0, False]]) 44 | def test_bad_value(value): 45 | """Check that TypeError is raised when "value" is the wrong type.""" 46 | 47 | f = FileSet(help="Help!") 48 | with pytest.raises(TypeError): 49 | f.setValue(value) 50 | 51 | 52 | def test_missing_files(): 53 | """Check that IOError is raised when a file doesn't exist.""" 54 | 55 | # All files missing. 56 | with pytest.raises(IOError): 57 | f = FileSet(help="Help!") 58 | f.setValue(["missing1.txt", "missing2.txt"]) 59 | 60 | # One file missing. 61 | with pytest.raises(IOError): 62 | f = FileSet(help="Help!") 63 | f.setValue(["test/input/amber/ala/ala.crd", "missing2.txt"]) 64 | 65 | 66 | @pytest.mark.parametrize("optional", [True, False]) 67 | def test_optional(optional): 68 | """Check that the optional flag is set correctly.""" 69 | 70 | f = FileSet(help="Help!", optional=optional) 71 | 72 | assert f.getHelp() == "Help!" 73 | assert f.isOptional() == optional 74 | assert f.getDefault() == None 75 | assert f.getMin() == None 76 | assert f.getMax() == None 77 | assert f.getAllowedValues() is None 78 | assert f.isMulti() == True 79 | assert f.getArgType() == str 80 | -------------------------------------------------------------------------------- /test/Sandpit/Exscientia/IO/test_file_cache.py: -------------------------------------------------------------------------------- 1 | import BioSimSpace.Sandpit.Exscientia as BSS 2 | 3 | import glob 4 | import os 5 | import pytest 6 | import tempfile 7 | 8 | 9 | def test_file_cache(): 10 | """ 11 | Simple test to see if cached files are used when repeatedly writing 12 | the same system to the same file format. 13 | """ 14 | 15 | # Clear the file cache. 16 | BSS.IO._io._file_cache = {} 17 | 18 | # Load the molecular system. 19 | s = BSS.IO.readMolecules(["test/input/ala.crd", "test/input/ala.top"]) 20 | 21 | # Create a temporary working directory. 22 | tmp_dir = tempfile.TemporaryDirectory() 23 | tmp_path = tmp_dir.name 24 | 25 | # Write the system to PDB and PRM7 format. 26 | BSS.IO.saveMolecules(f"{tmp_path}/tmp", s, ["pdb", "prm7"]) 27 | 28 | # Check that the file cache has two entries. 29 | assert len(BSS.IO._io._file_cache) == 2 30 | 31 | # Write to PDB and GroTop format. The PDB from the cache should be reused. 32 | BSS.IO.saveMolecules(f"{tmp_path}/tmp2", s, ["pdb", "grotop"]) 33 | 34 | # Check that the file cache has three entries, i.e. only the GroTop was added. 35 | assert len(BSS.IO._io._file_cache) == 3 36 | 37 | # The directory should now contain 4 files. 38 | assert len(glob.glob(f"{tmp_path}/*")) == 4 39 | 40 | # Now delete one of the files on disk and re-write. This should create a new 41 | # entry in the cache. 42 | os.remove(f"{tmp_path}/tmp.pdb") 43 | BSS.IO.saveMolecules(f"{tmp_path}/tmp3", s, ["pdb", "grotop"]) 44 | 45 | # Check that the file cache still has three entries. 46 | assert len(BSS.IO._io._file_cache) == 3 47 | 48 | # The directory should now contain 5 files. 49 | assert len(glob.glob(f"{tmp_path}/*")) == 5 50 | 51 | # Now "corrupt" a file on disk so that its MD5 checksum is no longer 52 | # valid. 53 | with open(f"{tmp_path}/tmp2.pdb", "w") as f: 54 | pass 55 | 56 | # Write back to PDB and Gro87 format. The PDB file is now invalid, so 57 | # a new one will be written and added to the cache. 58 | BSS.IO.saveMolecules(f"{tmp_path}/tmp4", s, ["pdb", "gro87"]) 59 | 60 | # Check that the file cache still has three entries. 61 | assert len(BSS.IO._io._file_cache) == 4 62 | 63 | # The directory should now contain 7 files. 64 | assert len(glob.glob(f"{tmp_path}/*")) == 7 65 | -------------------------------------------------------------------------------- /test/Sandpit/Exscientia/Parameters/test_parameters.py: -------------------------------------------------------------------------------- 1 | import BioSimSpace.Sandpit.Exscientia as BSS 2 | 3 | import os 4 | import pytest 5 | 6 | # Store the tutorial URL. 7 | url = BSS.tutorialUrl() 8 | 9 | # Make sure required AMBER executables are present. 10 | if BSS._amber_home is not None: 11 | tleap = "%s/bin/tleap" % BSS._amber_home 12 | if os.path.isfile(tleap): 13 | has_tleap = True 14 | else: 15 | has_tleap = False 16 | else: 17 | has_tleap = False 18 | 19 | 20 | @pytest.fixture(scope="session") 21 | def molecule(): 22 | return BSS.IO.readMolecules(f"{url}/4LYT_Fixed.pdb.bz2")[0] 23 | 24 | 25 | @pytest.mark.skipif(has_tleap is False, reason="Requires tLEaP to be installed.") 26 | @pytest.mark.parametrize("ff", BSS.Parameters.amberProteinForceFields()) 27 | def test_disulphide(molecule, ff): 28 | """Test parameterisation in the presence of disulphide bridges.""" 29 | 30 | # Try to parameterise with the named force field. If working, this should 31 | # auto-detect disulphide bonds and add the appropriate bond records to the 32 | # tLEaP input script. 33 | molecule = getattr(BSS.Parameters, ff)(molecule).getMolecule() 34 | 35 | # Check that we actually generate records for four disulphide bonds. 36 | bonds = BSS.Parameters._Protocol.AmberProtein._get_disulphide_bonds( 37 | molecule._sire_object 38 | ) 39 | assert len(bonds) == 4 40 | 41 | # Check that the bond parameters are present in the molecule. 42 | bonds = molecule.search("bonds from element S to element S") 43 | assert len(bonds) == 4 44 | -------------------------------------------------------------------------------- /test/Sandpit/Exscientia/_SireWrappers/test_bond.py: -------------------------------------------------------------------------------- 1 | import BioSimSpace.Sandpit.Exscientia as BSS 2 | 3 | import pytest 4 | 5 | # Store the tutorial URL. 6 | url = BSS.tutorialUrl() 7 | 8 | 9 | def test_bonds(): 10 | system = BSS.IO.readMolecules(["test/input/ala.top", "test/input/ala.crd"]) 11 | 12 | bonds = system.search("bonds") 13 | 14 | assert len(bonds) == 1911 15 | 16 | for bond in bonds: 17 | atom0 = bond.atom0() 18 | atom1 = bond.atom1() 19 | 20 | assert atom0 == bond[0] 21 | assert atom1 == bond[1] 22 | 23 | assert bond.moleculeNumber() == atom0.moleculeNumber() 24 | 25 | c0 = atom0.coordinates() 26 | c1 = atom1.coordinates() 27 | 28 | d2 = (c0.x() - c1.x()) ** 2 + (c0.y() - c1.y()) ** 2 + (c0.z() - c1.z()) ** 2 29 | 30 | assert d2.value() == pytest.approx(bond.length().value() ** 2) 31 | 32 | # Some of these bonds have zero energy. 33 | if bond._sire_object.energy().value() == 0: 34 | import sire 35 | 36 | amber_bond = sire.legacy.MM.AmberBond( 37 | bond._sire_object.potential(), sire.legacy.CAS.Symbol("r") 38 | ) 39 | assert amber_bond.r0() == pytest.approx(bond.length().value()) 40 | -------------------------------------------------------------------------------- /test/Sandpit/Exscientia/_SireWrappers/test_properties.py: -------------------------------------------------------------------------------- 1 | import BioSimSpace.Sandpit.Exscientia as BSS 2 | 3 | # Store the tutorial URL. 4 | url = BSS.tutorialUrl() 5 | 6 | 7 | def test_sire_properties(): 8 | s = BSS.IO.readMolecules(["test/input/ala.top", "test/input/ala.crd"]) 9 | 10 | m = s[0]._sire_object 11 | 12 | charges = m.property("charge") 13 | 14 | c = charges.toVector() 15 | 16 | assert len(c) == m.nAtoms() 17 | 18 | masses = m.property("mass") 19 | 20 | v = masses.toVector() 21 | 22 | assert len(v) == m.nAtoms() 23 | 24 | a = m.property("ambertype") 25 | 26 | a = a.toVector() 27 | 28 | assert len(a) == m.nAtoms() 29 | 30 | g = m.property("gb_radii") 31 | 32 | g = g.toVector() 33 | 34 | assert len(g) == m.nAtoms() 35 | 36 | s = m.property("gb_screening") 37 | 38 | s = s.toVector() 39 | 40 | assert len(s) == m.nAtoms() 41 | 42 | t = m.property("treechain") 43 | 44 | t = t.toVector() 45 | 46 | assert len(t) == m.nAtoms() 47 | 48 | 49 | if __name__ == "__main__": 50 | test_sire_properties() 51 | -------------------------------------------------------------------------------- /test/Sandpit/Exscientia/_SireWrappers/test_search_result.py: -------------------------------------------------------------------------------- 1 | import BioSimSpace.Sandpit.Exscientia as BSS 2 | 3 | import pytest 4 | 5 | # Store the tutorial URL. 6 | url = BSS.tutorialUrl() 7 | 8 | 9 | @pytest.fixture(scope="session") 10 | def system(): 11 | """Re-use the same molecuar system for each test.""" 12 | return BSS.IO.readMolecules(["test/input/ala.top", "test/input/ala.crd"]) 13 | 14 | 15 | @pytest.fixture(scope="session") 16 | def molecule(system): 17 | """Re-use the same molecule for each test.""" 18 | return system[0] 19 | 20 | 21 | @pytest.fixture(scope="session") 22 | def residue(molecule): 23 | """Re-use the same residue for each test.""" 24 | return molecule.getResidues()[0] 25 | 26 | 27 | # Parameterise the function with a set of searchable objects. 28 | @pytest.mark.parametrize("fixture", ["system", "molecule", "residue"]) 29 | # Ensure that valid searches return a result. 30 | def test_valid_search(fixture, request): 31 | obj = request.getfixturevalue(fixture) 32 | obj.search("element H") 33 | 34 | 35 | # Parameterise the function with a set of searchable objects. 36 | @pytest.mark.parametrize("fixture", ["system", "molecule", "residue"]) 37 | # Ensure that invalid searches raise a ValueError exception. 38 | def test_invalid_search(fixture, request): 39 | obj = request.getfixturevalue(fixture) 40 | 41 | # Assert that a search for an invalid element raises a ValueError. 42 | with pytest.raises(ValueError): 43 | obj.search("element Z") 44 | 45 | # Assert that a search for a valid element using an invalid property 46 | # map raises a ValueError. 47 | with pytest.raises(ValueError): 48 | obj.search("element H", property_map={"element": "cheese"}) 49 | -------------------------------------------------------------------------------- /test/Sandpit/Exscientia/input/merged_tripeptide.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/test/Sandpit/Exscientia/input/merged_tripeptide.pickle -------------------------------------------------------------------------------- /test/Sandpit/Exscientia/output/gromacs.edr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/test/Sandpit/Exscientia/output/gromacs.edr -------------------------------------------------------------------------------- /test/_SireWrappers/test_bond.py: -------------------------------------------------------------------------------- 1 | import BioSimSpace as BSS 2 | 3 | import pytest 4 | 5 | # Store the tutorial URL. 6 | url = BSS.tutorialUrl() 7 | 8 | 9 | def test_bonds(): 10 | system = BSS.IO.readMolecules(["test/input/ala.top", "test/input/ala.crd"]) 11 | 12 | bonds = system.search("bonds") 13 | 14 | assert len(bonds) == 1911 15 | 16 | for bond in bonds: 17 | atom0 = bond.atom0() 18 | atom1 = bond.atom1() 19 | 20 | assert atom0 == bond[0] 21 | assert atom1 == bond[1] 22 | 23 | assert bond.moleculeNumber() == atom0.moleculeNumber() 24 | 25 | c0 = atom0.coordinates() 26 | c1 = atom1.coordinates() 27 | 28 | d2 = (c0.x() - c1.x()) ** 2 + (c0.y() - c1.y()) ** 2 + (c0.z() - c1.z()) ** 2 29 | 30 | assert d2.value() == pytest.approx(bond.length().value() ** 2) 31 | 32 | # Some of these bonds have zero energy. 33 | if bond._sire_object.energy().value() == 0: 34 | import sire 35 | 36 | amber_bond = sire.legacy.MM.AmberBond( 37 | bond._sire_object.potential(), sire.legacy.CAS.Symbol("r") 38 | ) 39 | assert amber_bond.r0() == pytest.approx(bond.length().value()) 40 | -------------------------------------------------------------------------------- /test/_SireWrappers/test_properties.py: -------------------------------------------------------------------------------- 1 | import BioSimSpace as BSS 2 | 3 | # Store the tutorial URL. 4 | url = BSS.tutorialUrl() 5 | 6 | 7 | def test_sire_properties(): 8 | s = BSS.IO.readMolecules(["test/input/ala.top", "test/input/ala.crd"]) 9 | 10 | m = s[0]._sire_object 11 | 12 | charges = m.property("charge") 13 | 14 | c = charges.toVector() 15 | 16 | assert len(c) == m.nAtoms() 17 | 18 | masses = m.property("mass") 19 | 20 | v = masses.toVector() 21 | 22 | assert len(v) == m.nAtoms() 23 | 24 | a = m.property("ambertype") 25 | 26 | a = a.toVector() 27 | 28 | assert len(a) == m.nAtoms() 29 | 30 | g = m.property("gb_radii") 31 | 32 | g = g.toVector() 33 | 34 | assert len(g) == m.nAtoms() 35 | 36 | s = m.property("gb_screening") 37 | 38 | s = s.toVector() 39 | 40 | assert len(s) == m.nAtoms() 41 | 42 | t = m.property("treechain") 43 | 44 | t = t.toVector() 45 | 46 | assert len(t) == m.nAtoms() 47 | 48 | 49 | if __name__ == "__main__": 50 | test_sire_properties() 51 | -------------------------------------------------------------------------------- /test/_SireWrappers/test_search_result.py: -------------------------------------------------------------------------------- 1 | import BioSimSpace as BSS 2 | 3 | import pytest 4 | 5 | # Store the tutorial URL. 6 | url = BSS.tutorialUrl() 7 | 8 | 9 | @pytest.fixture(scope="session") 10 | def system(): 11 | """Re-use the same molecuar system for each test.""" 12 | return BSS.IO.readMolecules(["test/input/ala.top", "test/input/ala.crd"]) 13 | 14 | 15 | @pytest.fixture(scope="session") 16 | def molecule(system): 17 | """Re-use the same molecule for each test.""" 18 | return system[0] 19 | 20 | 21 | @pytest.fixture(scope="session") 22 | def residue(molecule): 23 | """Re-use the same residue for each test.""" 24 | return molecule.getResidues()[0] 25 | 26 | 27 | # Parameterise the function with a set of searchable objects. 28 | @pytest.mark.parametrize("fixture", ["system", "molecule", "residue"]) 29 | # Ensure that valid searches return a result. 30 | def test_valid_search(fixture, request): 31 | obj = request.getfixturevalue(fixture) 32 | obj.search("element H") 33 | 34 | 35 | # Parameterise the function with a set of searchable objects. 36 | @pytest.mark.parametrize("fixture", ["system", "molecule", "residue"]) 37 | # Ensure that invalid searches raise a ValueError exception. 38 | def test_invalid_search(fixture, request): 39 | obj = request.getfixturevalue(fixture) 40 | 41 | # Assert that a search for an invalid element raises a ValueError. 42 | with pytest.raises(ValueError): 43 | obj.search("element Z") 44 | 45 | # Assert that a search for a valid element using an invalid property 46 | # map raises a ValueError. 47 | with pytest.raises(ValueError): 48 | obj.search("element H", property_map={"element": "cheese"}) 49 | -------------------------------------------------------------------------------- /test/input/ala.tpr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/test/input/ala.tpr -------------------------------------------------------------------------------- /test/input/ala.trr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michellab/BioSimSpace/6a36648e1f2e95ee6de35b2e6c9ac32f201c2bc8/test/input/ala.trr --------------------------------------------------------------------------------