diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 0c643dc9fa676e51d60b39d815fefb9a97f54a6f..9189aecece5345a60ec850332af0fca826e14603 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,8 +1,24 @@ +Changes in Release 1.7 +-------------------------------------------------------------------------------- + + * Removed Qt dependency for non-GUI compilation and fixed issues with recent + gcc and boost versions + * Added Quaternary Structure (QS) scoring module + * Fixed mmCIF parser to work with mmCIF dictionary version 5 (now with useful + revision data) and add r_free, r_work and entity.id to MMCifInfo + * Added fast accessibility and secondary structure (mimicking naccess & dssp) + computation (Accessibility & AssignSecStruct in mol.alg) + * Changed behaviour of mol.alg.Superpose with match = 'local-aln' or + 'global-aln' which used to fail for chains without peptide bonds (e.g. + CA-only) + * Large updates for documentation + * Several minor bug fixes, improvements, and speed-ups + Changes in Release 1.6 -------------------------------------------------------------------------------- - * Added code to compare structures attached to a multiple seq. aln. - * Incorporated Antechamber based force-field parameter generation for mm mod. + * Added code to compare structures attached to a multiple seq. aln. + * Incorporated Antechamber based force-field parameter generation for mm mod. Changes in Release 1.5 -------------------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 451dd53b001b234bfad5423be70591187219a6b8..2f582069ba52a1b79e281c8866d6f591c5f1942e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR) project(OpenStructure CXX C) set (CMAKE_EXPORT_COMPILE_COMMANDS 1) set (OST_VERSION_MAJOR 1) -set (OST_VERSION_MINOR 6) +set (OST_VERSION_MINOR 7) set (OST_VERSION_PATCH 0) set (OST_VERSION_STRING ${OST_VERSION_MAJOR}.${OST_VERSION_MINOR}.${OST_VERSION_PATCH} ) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake_support) diff --git a/examples/code_fragments/mm/ethanol_example.py b/examples/code_fragments/mm/ethanol_example.py index 846b2b901ace02eb8af7c44806eee9bffbe268c1..1f8988d384b37763a1a97099959a604b0da2df1c 100644 --- a/examples/code_fragments/mm/ethanol_example.py +++ b/examples/code_fragments/mm/ethanol_example.py @@ -22,9 +22,7 @@ class Anim(QtCore.QTimer): def OnTimer(self): self.sim.Steps(1) - positions = sim.GetPositions() - for a, pos in zip(self.ent.atoms,positions): - self.ed.SetAtomPos(a,pos) + self.sim.UpdatePositions() self.go.UpdatePositions() diff --git a/examples/code_fragments/mm/ethanol_example_using_topology.py b/examples/code_fragments/mm/ethanol_example_using_topology.py index 19a32ed0a53e6547722cf29aac347b07413eaa8f..5587a07f988d3d9c9f7fe957b500b8b1eab22154 100644 --- a/examples/code_fragments/mm/ethanol_example_using_topology.py +++ b/examples/code_fragments/mm/ethanol_example_using_topology.py @@ -36,9 +36,7 @@ class Anim(QtCore.QTimer): self.counter += 1 self.sim.Steps(1) - positions = sim.GetPositions() - for a, pos in zip(self.ent.atoms,positions): - self.ed.SetAtomPos(a,pos) + self.sim.UpdatePositions() self.go.UpdatePositions() self.steps+=1 diff --git a/examples/code_fragments/mm/gb_example.py b/examples/code_fragments/mm/gb_example.py index 7939adb17600f9b2025ffdf341a44e5eae9ffb88..99a55343c6d4b0873ac0b71922eebf41fb9ae491 100644 --- a/examples/code_fragments/mm/gb_example.py +++ b/examples/code_fragments/mm/gb_example.py @@ -22,10 +22,7 @@ class Anim(QtCore.QTimer): def OnTimer(self): self.sim.Steps(5) - positions = sim.GetPositions() - for a, pos in zip(self.ent.atoms,positions): - self.ed.SetAtomPos(a,pos) - self.ed.UpdateICS() + self.sim.UpdatePositions() self.go.UpdatePositions() diff --git a/modules/base/doc/logging.rst b/modules/base/doc/logging.rst index dda9ebc6a22406076d4babd14ab60003d974a9e4..df7e24ef74bc32d275e73feb3063c60c7942ac2a 100644 --- a/modules/base/doc/logging.rst +++ b/modules/base/doc/logging.rst @@ -187,14 +187,12 @@ Each logging event has an associated level that marks its importance. For exampl **Debug**: For developers, but not quite at the trace level. This level is turned off by - default, not available in Python and only enabled when compiling with - debugging symbols. + default and only enabled when compiling with debugging symbols. **Trace**: Used to debug inner loops. Once turned on, you will probably get more debug - output that you will be able to handle. This level is turned off by default, - not available in python and only enabled when compiling with debugging - symbols. + output that you will be able to handle. This level is turned off by default + and only enabled when compiling with debugging symbols. Example diff --git a/modules/bindings/pymod/hhblits.py b/modules/bindings/pymod/hhblits.py index dd51b1207ebb7869512dd522d16647136df3177f..dddaa7404688f414eaa1a3915c6141b049ff52ce 100644 --- a/modules/bindings/pymod/hhblits.py +++ b/modules/bindings/pymod/hhblits.py @@ -574,7 +574,7 @@ class HHblits: job = subprocess.Popen(addss_cmd, shell=True, cwd=self.working_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - sout, _ = job.communicate() + sout, serr = job.communicate() lines = sout.splitlines() for line in lines: if 'error' in line.lower(): diff --git a/modules/doc/install.rst b/modules/doc/install.rst index 1a63e6a293424d49c51868587cbe691e847d8ae7..585dafe3cfd87a45afcd88c6cccec4213a83a125 100644 --- a/modules/doc/install.rst +++ b/modules/doc/install.rst @@ -1,14 +1,6 @@ Installing OpenStructure From Source ================================================================================ -.. note:: - - This document describes how to install OpenStructure from source. If you are - mainly insterested in using OpenStructure and are not planning to modify the - code of OpenStructure itself, please use one of the binaries `available for - download <http://www.openstructure.org/download/>`_. - - Brief Overview -------------------------------------------------------------------------------- @@ -159,7 +151,7 @@ can influence it. * Boost is mainly controlled via the `BOOST_ROOT` option. If boost wasn't found, it should be set to the prefix of the boost installation. If for some reason, it is desirable to use the non-multithreaded boost libraries, you can - switch `Boost_USE_MULTITHREADED` on (it is off by default). + switch `Boost_USE_MULTITHREADED` off (it is on by default). * `PYTHON_ROOT` is the Python equivalent of BOOST_ROOT. It should be set to the prefix path containing the python binary, headers and libraries. diff --git a/modules/geom/src/vec_mat_predicates.hh b/modules/geom/src/vec_mat_predicates.hh index e294efdbfc23a0938d72c35e98653231e9f0a3b7..7f897a5099941015200444cc5148a19098fa39ca 100644 --- a/modules/geom/src/vec_mat_predicates.hh +++ b/modules/geom/src/vec_mat_predicates.hh @@ -39,10 +39,10 @@ boost::test_tools::predicate_result vec_is_close(const V& v1, const V& v2, std::string labels[]={"x","y","z","w"}; bool flag=true; boost::test_tools::predicate_result res( false ); -#if BOOST_VERSION<103400 - boost::test_tools::close_at_tolerance<Real> close_test(tolerance); -#else +#if BOOST_VERSION<105900 boost::test_tools::close_at_tolerance<Real> close_test(boost::test_tools::percent_tolerance(tolerance)); +#else + boost::math::fpc::close_at_tolerance<Real> close_test(boost::math::fpc::percent_tolerance(tolerance)); #endif for(unsigned int i=0;i<dim;++i){ if(v1[i]==0.0){ @@ -97,10 +97,10 @@ boost::test_tools::predicate_result mat_is_close(const M& m1, const M& m2, { bool flag=true; boost::test_tools::predicate_result res( false ); -#if BOOST_VERSION<103400 - boost::test_tools::close_at_tolerance<Real> close_test(tolerance); -#else +#if BOOST_VERSION<105900 boost::test_tools::close_at_tolerance<Real> close_test(boost::test_tools::percent_tolerance(tolerance)); +#else + boost::math::fpc::close_at_tolerance<Real> close_test(boost::math::fpc::percent_tolerance(tolerance)); #endif for(unsigned int i=0;i<dim;++i){ for(unsigned int j=0;j<dim;++j){ diff --git a/modules/img/alg/tests/test_normalizer.cc b/modules/img/alg/tests/test_normalizer.cc index e072626dbc562e70703ae226606c4c9e0d1f6c9d..205a5a5b31125332ea527bd4e0e666f75f0b5354 100644 --- a/modules/img/alg/tests/test_normalizer.cc +++ b/modules/img/alg/tests/test_normalizer.cc @@ -39,7 +39,11 @@ using namespace ost::img::alg; void test() { - boost::test_tools::close_at_tolerance<Real> close_test(::boost::test_tools::percent_tolerance(0.001)); +#if BOOST_VERSION<105900 + boost::test_tools::close_at_tolerance<Real> close_test(boost::test_tools::percent_tolerance(0.001)); +#else + boost::math::fpc::close_at_tolerance<Real> close_test(boost::math::fpc::percent_tolerance(0.001)); +#endif ost::img::ImageHandle testimage=ost::img::CreateImage(ost::img::Extent(ost::img::Point(0,0),ost::img::Point(3,3))); int counter=0; for (ost::img::ExtentIterator i(testimage.GetExtent()); !i.AtEnd(); ++i, ++counter) { diff --git a/modules/io/doc/io.rst b/modules/io/doc/io.rst index 3dbc2ac6ea7986b5c25d2ef813294c536da96012..f8f5302e060d360d13b2851d42dce12d3e9d2c66 100644 --- a/modules/io/doc/io.rst +++ b/modules/io/doc/io.rst @@ -61,12 +61,11 @@ on the file extension. :exc:`~ost.io.IOException` if the import fails due to an erroneous or inexistent file. -Some of the formats have a dedicated function that allows you to tweak many -parameters that affect the import. PDB files can be loaded with -:func:`~ost.io.LoadPDB`. It offers tighter control over the exact loading behaviour. - - -:doc:`profile` +Some of the formats have a dedicated function that allows you to tweak many +parameters that affect the import. PDB files can be loaded with :func:`LoadPDB` +and mmCIF files with :func:`LoadMMCIF` (this also gives you access to the +:class:`MMCifInfo` class). It offers tighter control over the exact loading +behaviour. .. autofunction:: ost.io.LoadPDB diff --git a/modules/io/doc/mmcif.rst b/modules/io/doc/mmcif.rst index 0098cd5033b43efd1ae7574867bffde23c7e8c90..730ca1b8e97ed554287158184c9d9eb20283da37 100644 --- a/modules/io/doc/mmcif.rst +++ b/modules/io/doc/mmcif.rst @@ -1,11 +1,16 @@ mmCIF File Format -------------------------------------------------------------------------------- +.. currentmodule:: ost.io + The mmCIF file format is an alternate container for structural entities, also provided by the PDB. Here we describe how to load those files and how to deal with information provided above the common PDB format (:class:`MMCifInfo`, :class:`MMCifInfoCitation`, :class:`MMCifInfoTransOp`, -:class:`MMCifInfoBioUnit`, :class:`MMCifInfoStructDetails`). +:class:`MMCifInfoBioUnit`, :class:`MMCifInfoStructDetails`, +:class:`MMCifInfoObsolete`, :class:`MMCifInfoStructRef`, +:class:`MMCifInfoStructRefSeq`, :class:`MMCifInfoStructRefSeqDif`, +:class:`MMCifInfoRevisions`). Loading mmCIF Files @@ -20,8 +25,8 @@ Categories Available The following categories of a mmCIF file are considered by the reader: * ``atom_site``: Used to build the :class:`~ost.mol.EntityHandle` -* ``entity``: Involved in setting ChainTypes -* ``entity_poly``: Involved in setting ChainTypes +* ``entity``: Involved in setting :class:`~ost.mol.ChainType` of chains +* ``entity_poly``: Involved in setting :class:`~ost.mol.ChainType` of chains * ``citation``: Goes into :class:`MMCifInfoCitation` * ``citation_author``: Goes into :class:`MMCifInfoCitation` * ``exptl``: Goes into :class:`MMCifInfo` as :attr:`~MMCifInfo.method`. @@ -39,7 +44,7 @@ The following categories of a mmCIF file are considered by the reader: * ``pdbx_database_PDB_obs_spr``: Verbose information on obsoleted/ superseded entries, stored in :class:`MMCifInfoObsolete` * ``struct_ref`` stored in :class:`MMCifInfoStructRef` -* ``struct_ref_seq`` stored in :class:`MMCifInfoStructRefSeq` +* ``struct_ref_seq`` stored in :class:`MMCifInfoStructRefSeqDif` * ``struct_ref_seq_dif`` stored in :class:`MMCifInfoStructRefDif` * ``database_pdb_rev`` (mmCIF dictionary version < 5) stored in :class:`MMCifInfoRevisions` diff --git a/modules/io/doc/structure_formats.rst b/modules/io/doc/structure_formats.rst index ce9c8aedd058d89711a146d8ef537b1c3fb50a79..a8013384224ac6a359db2a5d95a4b2fa32aa7c45 100644 --- a/modules/io/doc/structure_formats.rst +++ b/modules/io/doc/structure_formats.rst @@ -1,8 +1,9 @@ Supported Structure File Formats ================================================================================ -The following file formats are supported by :func:`~ost.io.LoadEntity`: +.. currentmodule:: ost.io +The following file formats are supported by :func:`LoadEntity`: CRD - CARD format file used by CHARMM @@ -14,9 +15,9 @@ This trajectory file format is used by the CHARMM program suite (Molecular Model PDB - Brookhaven PDB File ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Fine grained control over PDB file import is available via the -:func:`~ost.io.LoadPDB` function. The PDB importer supports loading gzipped PDB -files, which are auto-detected by the .gz file extension. +Fine grained control over PDB file import is available via the :func:`LoadPDB` +function. The PDB importer supports loading gzipped PDB files, which are auto- +detected by the .gz file extension. *Recognized File Extensions* .ent, .pdb, .ent.gz, .pdb.gz @@ -26,10 +27,10 @@ files, which are auto-detected by the .gz file extension. mmCIF - macromolecular Crystallographic Information File ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Fine grained control over mmCIFile import is available via the -:func:`~ost.io.LoadMMCIF` function. Most notably, this gives you access to the -:class:`MMCifInfo` class. The mmCIF importer supports loading gzipped files, -which are auto-detected by the .gz file extension. +Fine grained control over mmCIFile import is available via the :func:`LoadMMCIF` +function. Most notably, this gives you access to the :class:`MMCifInfo` class. +The mmCIF importer supports loading gzipped files, which are auto-detected by +the .gz file extension. *Recognized File Extensions* .cif, .cif.gz diff --git a/modules/io/tests/test_io_img.cc b/modules/io/tests/test_io_img.cc index 411201a97e167be7235c1aa9ab041c43e98c95c9..9ac75d094c16fb64cddbc5ec231d41a4a5804832 100644 --- a/modules/io/tests/test_io_img.cc +++ b/modules/io/tests/test_io_img.cc @@ -48,7 +48,11 @@ BOOST_AUTO_TEST_SUITE( io ) BOOST_AUTO_TEST_CASE(test_io_img) { //float tests - boost::test_tools::close_at_tolerance<Real> close_test(::boost::test_tools::percent_tolerance(0.001)); +#if BOOST_VERSION<105900 + boost::test_tools::close_at_tolerance<Real> close_test(boost::test_tools::percent_tolerance(0.001)); +#else + boost::math::fpc::close_at_tolerance<Real> close_test(boost::math::fpc::percent_tolerance(0.001)); +#endif ost::img::ImageHandle testimage=ost::img::CreateImage(ost::img::Extent(ost::img::Point(0,0),ost::img::Point(4,3))); int counter=0; for (img::ExtentIterator i(testimage.GetExtent()); !i.AtEnd(); ++i, ++counter) { @@ -164,7 +168,11 @@ BOOST_AUTO_TEST_CASE(test_io_img_dat) { // test for the dat file format using a square image (non square images not supported by dat) //float test - boost::test_tools::close_at_tolerance<Real> close_test(::boost::test_tools::percent_tolerance(0.001)); +#if BOOST_VERSION<105900 + boost::test_tools::close_at_tolerance<Real> close_test(boost::test_tools::percent_tolerance(0.001)); +#else + boost::math::fpc::close_at_tolerance<Real> close_test(boost::math::fpc::percent_tolerance(0.001)); +#endif ost::img::ImageHandle testimage=ost::img::CreateImage(ost::img::Extent(ost::img::Point(0,0),ost::img::Point(3,3))); int counter=0; for (img::ExtentIterator i(testimage.GetExtent()); !i.AtEnd(); ++i, ++counter) { diff --git a/modules/mol/alg/doc/molalg.rst b/modules/mol/alg/doc/molalg.rst index 4ef9b3d516c592229e01879f051450a2087f5222..1641b6b495143c263417018e8d86224bfadca955 100644 --- a/modules/mol/alg/doc/molalg.rst +++ b/modules/mol/alg/doc/molalg.rst @@ -953,7 +953,7 @@ Algorithms on Structures as described by DSSP. :param ent: Entity on which to assign secondary structures - :type ent: :class:`~ost.mol.EntityView`/ + :type ent: :class:`~ost.mol.EntityView` / :class:`~ost.mol.EntityHandle` diff --git a/modules/mol/alg/pymod/qsscoring.py b/modules/mol/alg/pymod/qsscoring.py index 2d0bac6deffe2d9fe30ab0927e04d90ca55e7ffb..42c073f41eccfb77f44d5d89f49ca52169496a19 100644 --- a/modules/mol/alg/pymod/qsscoring.py +++ b/modules/mol/alg/pymod/qsscoring.py @@ -467,7 +467,8 @@ class QSscorer: Since, the lDDT computation requires a single chain with mapped residue numbering, all chains are appended into a single chain X with unique residue numbers according to the column-index in the alignment. The alignments are - in the same order as they appear in :attr:`alignments`. + in the same order as they appear in :attr:`alignments`. Additional residues + are appended at the end of the chain with unique residue numbers. :getter: Computed on first use (cached) :type: :class:`~ost.mol.EntityHandle` @@ -481,7 +482,7 @@ class QSscorer: """The reference entity used for lDDT scoring (:attr:`lddt_score`). This is a single chain X with residue numbers matching ones in - :attr:`lddt_mdl`. + :attr:`lddt_mdl` where aligned and unique numbers for additional residues. :getter: Computed on first use (cached) :type: :class:`~ost.mol.EntityHandle` diff --git a/modules/mol/alg/src/adjacency_bitmap.hh b/modules/mol/alg/src/adjacency_bitmap.hh index 69eee65f22f26d45244adab63611cbf75ea7d530..204f06cca9328d89366c3efc8d25d2e720937cef 100644 --- a/modules/mol/alg/src/adjacency_bitmap.hh +++ b/modules/mol/alg/src/adjacency_bitmap.hh @@ -7,6 +7,7 @@ #include <ost/tri_matrix.hh> #include <ost/seq/sequence_handle.hh> #include <ost/seq/alignment_handle.hh> +#include <ost/stdint.hh> #include "similarity_matrix.hh" #include "contact_overlap.hh" #include "module_config.hh" diff --git a/modules/mol/alg/tests/test_accessibility.py b/modules/mol/alg/tests/test_accessibility.py index 3ff4c0fde1431336b798f21c2545527baed62fd1..c3d857fd52f43dc5c30c58ebab47b763fa28da45 100644 --- a/modules/mol/alg/tests/test_accessibility.py +++ b/modules/mol/alg/tests/test_accessibility.py @@ -111,19 +111,14 @@ class TestAccessibility(unittest.TestCase): def testAccDSSP(self): - dssp_path = None - + # only relevant if dssp there try: - dssp_path = settings.Locate("dssp") + # same check used in dssp binding + dssp_path = settings.Locate(['dsspcmbi', 'dssp', 'mkdssp'], + env_name='DSSP_EXECUTABLE') except: - try: - dssp_path = settings.locate("mkdssp") - except: - pass - pass - - if dssp_path == None: print "Could not find DSSP, could not compare Accessibility function..." + return # we assume oligo mode to be working as it is tested in # testAccNACCESS. So we only test the single residue @@ -133,7 +128,7 @@ class TestAccessibility(unittest.TestCase): ent_one = ent_one.Select("peptide=true") ent_two = ent_two.Select("peptide=true") - dssp.AssignDSSP(ent_one, extract_burial_status=True, dssp_bin = dssp_path) + dssp.AssignDSSP(ent_one, extract_burial_status=True, dssp_bin=dssp_path) mol.alg.Accessibility(ent_two, algorithm=mol.alg.AccessibilityAlgorithm.DSSP) for a,b in zip(ent_one.residues, ent_two.residues): diff --git a/modules/mol/alg/tests/test_sec_struct.py b/modules/mol/alg/tests/test_sec_struct.py index 3c2d11295a39ac866abb286390c356d60a700591..207f8600c8f14589577fd1fabddd6ee0ebf72598 100644 --- a/modules/mol/alg/tests/test_sec_struct.py +++ b/modules/mol/alg/tests/test_sec_struct.py @@ -9,20 +9,18 @@ class TestSecStruct(unittest.TestCase): def testSecStruct(self): # unit test only makes sense, when a dssp binary is around - dssp_path = None try: - dssp_path = settings.Locate("dssp") + # same check used in dssp binding + dssp_path = settings.Locate(['dsspcmbi', 'dssp', 'mkdssp'], + env_name='DSSP_EXECUTABLE') except: - try: - dssp_path = settings.Locate("mkdssp") - except: - print "Could not find dssp, could not compare sec struct assignment..." - return + print "Could not find DSSP, could not compare sec struct assignment..." + return dssp_ent = io.LoadPDB(os.path.join("testfiles", "1a0s.pdb")) ost_ent = io.LoadPDB(os.path.join("testfiles", "1a0s.pdb")) - dssp.AssignDSSP(dssp_ent, dssp_bin = dssp_path) + dssp.AssignDSSP(dssp_ent, dssp_bin=dssp_path) mol.alg.AssignSecStruct(ost_ent) for a, b in zip(dssp_ent.residues, ost_ent.residues): diff --git a/modules/mol/base/doc/editors.rst b/modules/mol/base/doc/editors.rst index 427a6beae640e6a2b2f876c2503efd9df05a22d8..a5f31e8be85a81d8142861634e8cade02ed29169 100644 --- a/modules/mol/base/doc/editors.rst +++ b/modules/mol/base/doc/editors.rst @@ -421,33 +421,47 @@ Euclidian space. SetAtomTransformedPos(atom_list, pos_list) Set the transformed position of atoms. This method will also update the - original position of the atom by applying the inverse of the entity - transform. + original position of atoms by applying the inverse of the entity transform. + + Setting all positions at once is by far faster than call the function for + each atom, but it is only available if OpenStructure was compiled with an + enabled ``USE_NUMPY`` flag (see :ref:`here <cmake-flags>` for details). The + fastest option to work with all atom positions externally is to extract the + list of :attr:`~ost.mol.EntityHandle.atoms` with + :meth:`ost.mol.EntityHandle.GetPositions` (with *sort_by_index = False*). + Then extract a buffered editor and use the same list of atoms with a + modified numpy array as input to this function. Example: + + .. code-block:: python + + # get atom list and positions + atom_list = ent.atoms + positions = ent.GetPositions(False) + # modify positions but keep ent and atom_list unchanged + # ... + # apply changes to entity all at once + edi = ent.EditXCS(mol.BUFFERED_EDIT) + edi.SetAtomPos(atom_list, positions) + edi.UpdateICS() :param atom: A valid atom handle :type atom: :class:`ost.mol.AtomHandle` - :param atom_list: A valid atom handle - :type atom_list: :class:`ost.mol.AtomHandleList` + :param atom_list: A valid atom handle list or a list of atom :attr:`indices + <ost.mol.AtomHandle.index>`. + :type atom_list: :class:`ost.mol.AtomHandleList` or :class:`list` of + :class:`int` :param pos: The new position :type pos: :class:`~ost.geom.Vec3` - :param pos_list: An array or a list of 3*atom_list.size() floats - :type pos_list: :class:`numpy.array` or :class:`list` of :class:`float` + :param pos_list: An array of positions (shape [*len(atom_list)*, 3], + preferably contiguous array in memory (C order)). + :type pos_list: :class:`numpy.array` .. method:: SetAtomOriginalPos(atom, pos) SetAtomOriginalPos(atom_list, pos_list) Set the original (untransformed) position of atoms. This method will also update the transformed position by applying the entity transform to - the original pos. - - :param atom: A valid atom handle - :type atom: :class:`ost.mol.AtomHandle` - :param atom_list: A valid atom handle - :type atom_list: :class:`ost.mol.AtomHandleList` - :param pos: The new untransformed position - :type pos: :class:`~ost.geom.Vec3` - :param pos_list: An array or a list of 3*atom_list.size() floats - :type pos_list: :class:`numpy.array` or :class:`list` of :class:`float` + the original pos. See :meth:`SetAtomPos` for more details. Editor for the Internal Coordinate System diff --git a/modules/mol/base/doc/entity.rst b/modules/mol/base/doc/entity.rst index 7d5bfd7f749b6b17c4341751bcdb3c9ec7aa759f..653625756a1b38c696a50da10840078fb4d74c58 100644 --- a/modules/mol/base/doc/entity.rst +++ b/modules/mol/base/doc/entity.rst @@ -37,6 +37,14 @@ The Handle Classes :meth:`FindChain`. This property is read-only. + + :type: :class:`ChainHandleList` (list of :class:`ChainHandle`) + + .. attribute:: chain_count + + Number of chains. Read-only. See :meth:`GetChainCount`. + + :type: :class:`int` .. attribute:: residues @@ -55,7 +63,13 @@ The Handle Classes Also available as :meth:`GetResidueList`. To access a single residue, use :meth:`FindResidue`. - :returns: A list of :class:`residue handles<ResidueHandle>` + :type: :class:`ResidueHandleList` (list of :class:`ResidueHandle`) + + .. attribute:: residue_count + + Number of residues. Read-only. See :meth:`GetResidueCount`. + + :type: :class:`int` .. attribute:: atoms @@ -63,8 +77,14 @@ The Handle Classes :meth:`FindAtom`. This property is read-only. Also available as :meth:`GetAtomList` - - :type: A list of :class:`atom handles<AtomHandle>` + + :type: :class:`AtomHandleList` (list of :class:`AtomHandle`) + + .. attribute:: atom_count + + Number of atoms. Read-only. See :meth:`GetAtomCount`. + + :type: :class:`int` .. attribute:: bounds @@ -90,6 +110,14 @@ The Handle Classes :meth:`GetCenterOfAtoms`. :type: :class:`~ost.geom.Vec3` + + .. attribute:: positions + + Equivalent to calling :meth:`GetPositions` with *sort_by_index = True*. This + property is read-only and only available if OpenStructure was compiled with + an enabled ``USE_NUMPY`` flag (see :ref:`here <cmake-flags>` for details). + + :type: :class:`numpy.array` .. method:: GetName() @@ -114,6 +142,10 @@ The Handle Classes .. method:: GetChainList() See :attr:`chains` + + .. method:: GetChainCount() + + See :attr:`chain_count` .. method:: FindResidue(chain_name, res_num) @@ -132,6 +164,10 @@ The Handle Classes .. method:: GetResidueList() See :attr:`residues` + + .. method:: GetResidueCount() + + See :attr:`residue_count` .. method:: FindAtom(chain_name, res_num, atom_name) @@ -153,6 +189,10 @@ The Handle Classes See :attr:`atoms` + .. method:: GetAtomCount() + + See :attr:`atom_count` + .. method:: EditXCS([edit_mode=mol.EditMode.UNBUFFERED_EDIT]) Request :class:`XCSEditor` for editing the external coordinate system. This @@ -187,12 +227,13 @@ The Handle Classes **Example Usage:** - .. code-block::python + .. code-block:: python + # select calpha atoms of peptides - calphas=ent.Select('aname=CA and peptide=true') + calphas = ent.Select('aname=CA and peptide=true') # select atoms in a box of size 10, centred at the origin - in_box=ent.Select('x=-5:5 and y=-5:5 and z=-5:5') + in_box = ent.Select('x=-5:5 and y=-5:5 and z=-5:5') :param query: The query to be executed. :type query: :class:`Query` / :class:`str` @@ -262,7 +303,17 @@ The Handle Classes .. method:: GetMass() See :attr:`mass` - + + .. method:: GetPositions(sort_by_index=True) + + :return: Array of atom positions for this entity. + :rtype: :class:`numpy.array` (shape [:attr:`atom_count`, 3]) + :param sort_by_index: If True, the atoms are sorted by their + :attr:`~AtomHandle.index`. Otherwise, they are sorted + as they appear in the :attr:`atoms` list. + + This method is only available if OpenStructure was compiled with an enabled + ``USE_NUMPY`` flag (see :ref:`here <cmake-flags>` for details). .. method:: FindWithin(pos, radius) @@ -275,7 +326,7 @@ The Handle Classes :param radius: The radius of the sphere :type radius: float - :returns: A list of :class:`atom handles<AtomHandle>` + :returns: :class:`AtomHandleList` (list of :class:`AtomHandle`) .. class:: ChainHandle @@ -324,7 +375,7 @@ The Handle Classes Also available as :meth:`GetResidueList`. To access a single residue, use :meth:`FindResidue`. - :returns: A list of :class:`residue handles<ResidueHandle>` + :type: :class:`ResidueHandleList` (list of :class:`ResidueHandle`) .. attribute:: in_sequence @@ -347,7 +398,7 @@ The Handle Classes This property is read-only. Also available as :meth:`GetAtomList` - :type: A list of :class:`atom handles<AtomHandle>` + :type: :class:`AtomHandleList` (list of :class:`AtomHandle`) .. attribute:: bounds @@ -376,7 +427,7 @@ The Handle Classes .. method:: FindResidue(res_num) - Get residue by residue number. See also :attr:`residues` + Get residue by residue number. See also :attr:`residues`. :param res_num: residue number :type res_num: :class:`ResNum` @@ -387,11 +438,7 @@ The Handle Classes .. method:: GetResidueList() - Get list of all residues of this chain. For peptide chains, the residues - are usually ordered from N- to C-terminus.To access a single residue, use - :meth:`FindResidue`. - - :returns: A list of :class:`residue handles<ResidueHandle>` + See :attr:`residues`. .. method:: FindAtom(res_num, atom_name) @@ -464,6 +511,15 @@ The Handle Classes :type: str + .. attribute:: atoms + + Get list of all atoms of this residue. To access a single atom, use + :meth:`FindAtom`. + + This property is read-only. Also available as :meth:`GetAtomList` + + :type: :class:`AtomHandleList` (list of :class:`AtomHandle`) + .. attribute:: bounds Axis-aligned bounding box of the residue. Read-only. @@ -577,8 +633,7 @@ The Handle Classes .. method:: GetAtomList() - Get list of all atoms of this residue. To access a single atom, use - :meth:`FindAtom`. + See :attr:`atoms` .. method:: IsPeptideLinking() @@ -864,6 +919,14 @@ The View Classes :meth:`FindChain`. This property is read-only. + + :type: :class:`ChainViewList` (list of :class:`ChainView`) + + .. attribute:: chain_count + + Number of chains. Read-only. See :meth:`GetChainCount`. + + :type: :class:`int` .. attribute:: residues @@ -882,7 +945,13 @@ The View Classes Also available as :meth:`GetResidueList`. To access a single residue, use :meth:`FindResidue`. - :type: A list of :class:`ResidueViews <ResidueView>` + :type: :class:`ResidueViewList` (list of :class:`ResidueView`) + + .. attribute:: residue_count + + Number of residues. Read-only. See :meth:`GetResidueCount`. + + :type: :class:`int` .. attribute:: atoms @@ -891,7 +960,13 @@ The View Classes This property is read-only. Also available as :meth:`GetAtomList` - :type: A list of :class:`AtomViews <AtomView>` + :type: :class:`AtomViewList` (list of :class:`AtomView`) + + .. attribute:: atom_count + + Number of atoms. Read-only. See :meth:`GetAtomCount`. + + :type: :class:`int` .. attribute:: bounds @@ -1034,18 +1109,19 @@ The View Classes Find all atoms that are within radius of the given position. See :meth:`EntityHandle.FindWithin`. - :param pos: - :type pos: :class:`~ost.geom.Vec3` - :param radius: - :type radius: float - :rtype: :class:`AtomViewList` + :param pos: Center of sphere + :type pos: :class:`~ost.geom.Vec3` + :param radius: The radius of the sphere + :type radius: float + + :returns: :class:`AtomHandleList` (list of :class:`AtomHandle`) .. method:: FindChain(chain_name) Find chain by name. - :param chain_name: - :type chain_name: str + :param chain_name: Chain identifier, e.g. "A" + :type chain_name: str :returns: The chain if present in the view, an invalid :class:`ChainView` otherwise :rtype: :class:`ChainView` @@ -1112,24 +1188,6 @@ The View Classes .. method:: GetGeometricStart() :rtype: :class:`~ost.geom.Vec3` - - .. attribute:: chain_count - - Number of chains. Read-only. See :meth:`GetChainCount`. - - :type: int - - .. attribute:: residue_count - - Number of residues. Read-only. See :meth:`GetResidueCount`. - - :type: int - - .. attribute:: atom_count - - Number of atoms. Read-only. See :meth:`GetAtomCount`. - - :type: int .. method:: GetCenterOfAtoms() @@ -1138,29 +1196,11 @@ The View Classes :rtype: :class:`~ost.geom.Vec3` - .. method:: GetAtomList() - - See :attr:`atoms` - - :rtype: :class:`AtomViewList` - .. method:: GetBondCount() Get number of bonds :rtype: int - .. method:: GetChainCount() - - Get number chains. See :attr:`chain_count` - - :rtype: int - - .. method:: GetResidueCount() - - See :attr:`residue_count` - - :rtype: int - .. method:: GetBondList() See :attr:`bonds` @@ -1173,10 +1213,6 @@ The View Classes :rtype: :class:`EntityHandle` - .. method:: GetResidueList() - - :rtype: :class:`ResidueViewList` - .. method:: GetGeometricEnd() :rtype: :class:`~ost.geom.Vec3` @@ -1184,13 +1220,26 @@ The View Classes .. method:: GetChainList() See :attr:`chains` + + .. method:: GetChainCount() + + See :attr:`chain_count` + + .. method:: GetResidueList() + + See :attr:`residues` + + .. method:: GetResidueCount() - :rtype: :class:`ChainViewList` + See :attr:`residue_count` + + .. method:: GetAtomList() + + See :attr:`atoms` .. method:: GetAtomCount() - Get number of atoms. See :attr`atom_count`. - :rtype: int + See :attr:`atom_count` .. class:: ChainView @@ -1199,12 +1248,12 @@ The View Classes .. attribute:: name - The chain name. The name uniquely identifies the chain in the entity. In - most cases, the chain name is one character. This is restriction of the PDB - file format. However, you are free to use longer names as long as you don't - want to save them as PDB files + The chain name. The name uniquely identifies the chain in the entity. In + most cases, the chain name is one character. This is a restriction of the + PDB file format. However, you are free to use longer names as long as you + don't want to save them as PDB files. - This property is read-only. To change the name, use an :class:`XCSEditor`. + This property is read-only. To change the name, use an :class:`XCSEditor`. Also available as :meth:`GetName` @@ -1212,8 +1261,8 @@ The View Classes .. attribute:: residues - List of all residues of this chain. The residues are sorted from N- to - C-terminus. Usually the residue numbers are in ascending order + List of all residues of this chain. The residues are sorted from N- to + C-terminus. Usually the residue numbers are in ascending order (see :attr:`in_sequence`). This property is read-only. @@ -1226,10 +1275,10 @@ The View Classes for res in chain.residues: print res.name, res.atom_count - Also available as :meth:`GetResidueList`. To access a single residue, use - :meth:`FindResidue`. + Also available as :meth:`GetResidueList`. To access a single residue, use + :meth:`FindResidue`. - :type: A list of :class:`residue views<residueView>` + :type: :class:`ResidueViewList` (list of :class:`ResidueView`) .. attribute:: in_sequence @@ -1252,7 +1301,7 @@ The View Classes This property is read-only. Also available as :meth:`GetAtomList` - :type: A list of :class:`atom handles<AtomHandle>` + :type: :class:`AtomViewList` (list of :class:`AtomView`) .. attribute:: bounds @@ -1394,8 +1443,6 @@ The View Classes See :attr:`residues` - :rtype: bool - .. method:: InSequence() See :attr:`in_sequence` @@ -1513,9 +1560,12 @@ The View Classes .. attribute:: atoms - List of atoms in this view. + Get list of all atoms of this residue. To access a single atom, use + :meth:`FindAtom`. + + This property is read-only. Also available as :meth:`GetAtomList` - :type: :class:`AtomViewList` + :type: :class:`AtomHandleList` (list of :class:`AtomHandle`) .. attribute:: index @@ -1757,7 +1807,9 @@ here. ``CHAINTYPE_POLY_PEPTIDE_D``, ``CHAINTYPE_POLY_PEPTIDE_L``, ``CHAINTYPE_POLY_DN``, ``CHAINTYPE_POLY_RN``, ``CHAINTYPE_POLY_SAC_D``, ``CHAINTYPE_POLY_SAC_L``, ``CHAINTYPE_POLY_DN_RN``, - ``CHAINTYPE_UNKNOWN``, ``CHAINTYPE_N_CHAINTYPES`` + ``CHAINTYPE_UNKNOWN``, ``CHAINTYPE_MACROLIDE``, + ``CHAINTYPE_CYCLIC_PSEUDO_PEPTIDE``, ``CHAINTYPE_POLY_PEPTIDE_DN_RN``, + ``CHAINTYPE_N_CHAINTYPES`` Where ``CHAINTYPE_N_CHAINTYPES`` holds the number of different types available. diff --git a/modules/mol/base/pymod/export_chain.cc b/modules/mol/base/pymod/export_chain.cc index 36ed2b471f3a3658a9622d3fa907dc019725326f..557e62297ee80a1d09c206784d5eac1361f08784 100644 --- a/modules/mol/base/pymod/export_chain.cc +++ b/modules/mol/base/pymod/export_chain.cc @@ -123,18 +123,21 @@ void export_Chain() { enum_<ChainType>("ChainType") - .value("CHAINTYPE_POLY", CHAINTYPE_POLY) - .value("CHAINTYPE_NON_POLY", CHAINTYPE_NON_POLY) - .value("CHAINTYPE_WATER", CHAINTYPE_WATER) - .value("CHAINTYPE_POLY_PEPTIDE_D", CHAINTYPE_POLY_PEPTIDE_D) - .value("CHAINTYPE_POLY_PEPTIDE_L", CHAINTYPE_POLY_PEPTIDE_L) - .value("CHAINTYPE_POLY_DN", CHAINTYPE_POLY_DN) - .value("CHAINTYPE_POLY_RN", CHAINTYPE_POLY_RN) - .value("CHAINTYPE_POLY_SAC_D", CHAINTYPE_POLY_SAC_D) - .value("CHAINTYPE_POLY_SAC_L", CHAINTYPE_POLY_SAC_L) - .value("CHAINTYPE_POLY_DN_RN", CHAINTYPE_POLY_DN_RN) - .value("CHAINTYPE_UNKNOWN", CHAINTYPE_UNKNOWN) - .value("CHAINTYPE_N_CHAINTYPES", CHAINTYPE_N_CHAINTYPES) + .value("CHAINTYPE_POLY", CHAINTYPE_POLY) + .value("CHAINTYPE_NON_POLY", CHAINTYPE_NON_POLY) + .value("CHAINTYPE_WATER", CHAINTYPE_WATER) + .value("CHAINTYPE_POLY_PEPTIDE_D", CHAINTYPE_POLY_PEPTIDE_D) + .value("CHAINTYPE_POLY_PEPTIDE_L", CHAINTYPE_POLY_PEPTIDE_L) + .value("CHAINTYPE_POLY_DN", CHAINTYPE_POLY_DN) + .value("CHAINTYPE_POLY_RN", CHAINTYPE_POLY_RN) + .value("CHAINTYPE_POLY_SAC_D", CHAINTYPE_POLY_SAC_D) + .value("CHAINTYPE_POLY_SAC_L", CHAINTYPE_POLY_SAC_L) + .value("CHAINTYPE_POLY_DN_RN", CHAINTYPE_POLY_DN_RN) + .value("CHAINTYPE_UNKNOWN", CHAINTYPE_UNKNOWN) + .value("CHAINTYPE_MACROLIDE", CHAINTYPE_MACROLIDE) + .value("CHAINTYPE_CYCLIC_PSEUDO_PEPTIDE", CHAINTYPE_CYCLIC_PSEUDO_PEPTIDE) + .value("CHAINTYPE_POLY_PEPTIDE_DN_RN", CHAINTYPE_POLY_PEPTIDE_DN_RN) + .value("CHAINTYPE_N_CHAINTYPES", CHAINTYPE_N_CHAINTYPES) .export_values() ; } diff --git a/modules/mol/mm/doc/molmm.rst b/modules/mol/mm/doc/molmm.rst index 553c5502ffa5a1112096407f9d30c1ecd8a27739..e372ae76bc1209b0b28eebb92c28b59e28b97d9b 100644 --- a/modules/mol/mm/doc/molmm.rst +++ b/modules/mol/mm/doc/molmm.rst @@ -21,7 +21,7 @@ one interaction after the other or automatically using the and setting up a :class:`Simulation` gets controlled with the :class:`Settings`. Latest Publication of `OpenMM <http://openmm.org>`_: -P. Eastman, M. S. Friedrichs, J. D. Chodera, R. J. Radmer, C. M. Bruns, J. P. Ku, K. A. Beauchamp, T. J. Lane, L.-P. Wang, D. Shukla, T. Tye, M. Houston, T. Stich, C. Klein, M. R. Shirts, and V. S. Pande. "OpenMM 4: A Reusable, Extensible, Hardware Independent Library for High Performance Molecular Simulation." J. Chem. Theor. Comput. 9(1):461-469. (2013) +P. Eastman, J. Swails, J. D. Chodera, R. T. McGibbon, Y. Zhao, K. A. Beauchamp, L.-P. Wang, A. C. Simmonett, M. P. Harrigan, C. D. Stern, R. P. Wiewiora, B. R. Brooks, and V. S. Pande. "OpenMM 7: Rapid development of high performance algorithms for molecular dynamics." PLOS Comp. Biol. 13(7): e1005659. (2017) Installation diff --git a/modules/mol/mm/doc/settings.rst b/modules/mol/mm/doc/settings.rst index d8b3a13b4a713791172284bb79ed797374f7ef70..7269852155f6cacdf75262d316ad35f9fbe668b1 100644 --- a/modules/mol/mm/doc/settings.rst +++ b/modules/mol/mm/doc/settings.rst @@ -12,136 +12,136 @@ of the :class:`Simulation` object. .. attribute:: add_bonds Flag, whether bonds should be parametrized - in :class:`TopologyCreator`. default: True + in :class:`TopologyCreator`. Default: True .. attribute:: add_angles Flag, whether angles should be parametrized - in :class:`TopologyCreator`. default: True + in :class:`TopologyCreator`. Default: True .. attribute:: add_dihedrals Flag, whether dihedrals should be parametrized - in :class:`TopologyCreator`. default: True + in :class:`TopologyCreator`. Default: True .. attribute:: add_impropers Flag, whether impropers should be parametrized - in :class:`TopologyCreator`. default: True + in :class:`TopologyCreator`. Default: True .. attribute:: add_cmaps Flag, whether cmaps should be parametrized - in :class:`TopologyCreator`. default: True + in :class:`TopologyCreator`. Default: True .. attribute:: add_exclusions Flag, whether exclusions should be parametrized - in :class:`TopologyCreator`. default: True + in :class:`TopologyCreator`. Default: True .. attribute:: add_nonbonded Flag, whether nonbonded interactions should be parametrized - in :class:`TopologyCreator`. default: True + in :class:`TopologyCreator`. Default: True .. attribute:: add_gbsa Flag, whether GBSA interactions should be parametrized - in :class:`TopologyCreator`. default: False + in :class:`TopologyCreator`. Default: False .. attribute:: constrain_hbonds Flag, whether bonds involving hydrogens should be constrained - in :class:`TopologyCreator`. default: False + in :class:`TopologyCreator`. Default: False .. attribute:: constrain_bonds Flag, whether all bonds should be constrained in - :class:`TopologyCreator`. default: False + :class:`TopologyCreator`. Default: False .. attribute:: rigid_water Flag, whether water molecules should be made rigid in :class:`TopologyCreator`. This is achieved by adding a distance constraint on the O-H bonds and an additional - one between the two hydrogens. default: False + one between the two hydrogens. Default: False .. attribute:: strict_interactions Makes sure that an error is thrown when a particular interaction cannot be parametrized with the given forcefield in the :class:`TopologyCreator`. - By setting it to False, these cases just get ignored. default: True + By setting it to False, these cases just get ignored. Default: True .. attribute:: ideal_bond_length_constraints Flag, whether the ideal bond length from the :class:`Forcefield` should be - taken for distance constraints in the :class:`TopologyCreator`. - The actual distances from the :class:`EntityHandle` get taken otherwise. - default: True + taken for distance constraints in the :class:`TopologyCreator`. The actual + distances from the :class:`~ost.mol.EntityHandle` get taken otherwise. + Default: True .. attribute:: fix_heavy_atoms Flag, whether all heavy atom positions (non hydrogens) should be fixed in - space in the :class:`TopologyCreator`. default: False + space in the :class:`TopologyCreator`. Default: False .. attribute:: kill_electrostatics Flag, whether all charges should just be set to zero in the - :class:`TopologyCreator`. default: False + :class:`TopologyCreator`. Default: False .. attribute:: generate_disulfid_bonds Flag, whether disulfid bonds based on a simple geometric criterion (SG-SG dist < 2.5A) should be built in :class:`TopologyCreator`. - default: True + Default: True .. attribute:: nonbonded_method Nonbonded method set up at the creation of the :class:`Simulation`. Must be one of mm.NoCutoff, mm.CutoffNonPeriodic, mm.CutoffPeriodic - mm.Ewald or mm.PME. default: mm.NoCutoff + mm.Ewald or mm.PME. Default: mm.NoCutoff .. attribute:: nonbonded_cutoff - Nonbonded cutoff set when simulation is set up. default: 10.0 + Nonbonded cutoff set when simulation is set up. Default: 10.0 .. attribute:: remove_cmm_motion Whether a center of mass remover object should be attached to the - :class:`Simulation`. default: True + :class:`Simulation`. Default: True .. attribute:: cmm_frequency Frequency regarding simulation steps when the cmm remover should be applied. - default: 1 + Default: 1 .. attribute:: periodic_box_extent :class:`ost.geom.Vec3` describing the X,Y and Z extents of the rectangular simulation_box defined when setting up the :class:`Simulation`. - default: (0,0,0) + Default: (0,0,0) .. attribute:: init_temperature Initial simulation velocities get set according to a Boltzman distribution - controlled by init_temperature(Kelvin). default: 0.0 + controlled by init_temperature(Kelvin). Default: 0.0 .. attribute:: forcefield - :class:`Forcefield` that is used in :class:`TopologyCreator`. default: None + :class:`Forcefield` that is used in :class:`TopologyCreator`. Default: None .. attribute:: termini_exceptions Use termini other than the defaults set in the :class:`Forcefield` when using :class:`TopologyCreator`. Has to be a :class:`TerminiExceptions` - object. default: None + object. Default: None .. attribute:: platform Platform used by OpenMM to do the calculations. Must be one of mm.Reference, mm.CPU, mm.CUDA or mm.OpenCL. If anything else than the reference platform is used, the attribute openmm_plugin_directory has to be set accordingly. - default: mm.Reference + Default: mm.Reference .. attribute:: reference_properties @@ -166,77 +166,79 @@ of the :class:`Simulation` object. .. attribute:: add_thermostat Flag, whether an Andersen thermostat should be attached when settings up - the :class:`Simulation`. default: False + the :class:`Simulation`. Default: False .. attribute:: thermostat_temperature - Temperature for the Andersen thermostat in K. default: NaN + Temperature for the Andersen thermostat in K. Default: NaN .. attribute:: thermostat_collision_frequency - Collision frequency of the Andersen thermostat in 1/ps. default: NaN + Collision frequency of the Andersen thermostat in 1/ps. Default: NaN .. attribute:: add_barostat Flag, whether an MonteCarlo barostat should be attached when setting up - the :class:`Simulation`. default: False + the :class:`Simulation`. Default: False .. attribute:: barostat_temperature - Temperature for the MonteCarlo Barostat in K. default: NaN + Temperature for the MonteCarlo Barostat in K. Default: NaN .. attribute:: barostat_pressure - Pressure for the MonteCarlo Barostat in bar. default: NaN + Pressure for the MonteCarlo Barostat in bar. Default: NaN .. attribute:: barostat_frequency - Frequency of the MonteCarlo Barostat. default: 25 + Frequency of the MonteCarlo Barostat. Default: 25 .. attribute:: integrator Integrator to move the simulation forward in time. OpenMM offers following Integrators: :class:`VerletIntegrator`, :class:`BrownianIntegrator`, :class:`LangevinIntegrator`, :class:`VariableVerletIntegrator` and - :class:`VariableLangevinIntegrator`. default: None + :class:`VariableLangevinIntegrator`. Default: None .. attribute:: solvent_dielectric Solvent dielectric constant. This is used for the GBSA force when the - :class:`Simulation` gets set up. default: 78.3 + :class:`Simulation` gets set up. Default: 78.3 .. attribute:: solute_dielectric Solute dielectric constant. This is used for the GBSA force when the - :class:`Simulation` gets set up. default: 1.0 + :class:`Simulation` gets set up. Default: 1.0 .. attribute:: reaction_field_dielecric Sets the reaction field dielectric for the Nonbonded Force when setting - up the :class:`Simulation`. default: 78.3 + up the :class:`Simulation`. Default: 78.3 .. attribute:: use_dispersion_correction Flag, whether the dispersion correction should be used when setting - up the Nonbonded Force in the :class:`Simulation`. default: True + up the Nonbonded Force in the :class:`Simulation`. Default: True .. attribute:: keep_ff_specific_naming When running through the :class:`TopologyCreator`, the given entity gets renamed to the forcefield specific naming. If set to true, the naming stays like that, if not the entity gets renamed to PDB standard. - default: True + Default: True .. attribute:: openmm_plugin_directory Path where OpenMM specific plugins are searched. If you want to use other platforms than Reference, this has to be set. - default: "/usr/local/openmm/lib/plugins" + Defaults to *OPEN_MM_PLUGIN_DIR* which was set when + :ref:`configuring the compilation <cmake-flags>`. .. attribute:: custom_plugin_directory - Path where custom plugins are searched for. - default: "/usr/local/openmm/lib/plugins" + Path where custom plugins are searched for. Defaults to + "share/openstructure/openmm_plugins" within the OST installation or to + :attr:`openmm_plugin_directory` if the OST path could not be determined. diff --git a/modules/mol/mm/doc/simulation.rst b/modules/mol/mm/doc/simulation.rst index bbcf1c8026f823ebcb21633a6505a1b0e8df057d..3fd443aea7a1b473c18e5ddfd6714236c67bb29d 100644 --- a/modules/mol/mm/doc/simulation.rst +++ b/modules/mol/mm/doc/simulation.rst @@ -201,6 +201,10 @@ mapped back to the attached structure at any time. .. method:: AddPositionConstraint(index) Fixes the position of the particle with index given in the argument. + This requires to reinitialize the internal openmm Context + (this is expensive!). Positions, velocities, forces, energies etc. + are properly preserved but e.g. states of random number generators etc. + might be lost. :param index: Particle to be fixed :type index: :class:`int` @@ -211,6 +215,10 @@ mapped back to the attached structure at any time. .. method:: AddPositionConstraints(indices) Fixes the position of the atoms with the indices given in in the argument. + This requires to reinitialize the internal openmm Context + (this is expensive!). Positions, velocities, forces, energies etc. + are properly preserved but e.g. states of random number generators etc. + might be lost. :param indices: Particles to be fixed :type indices: :class:`list` @@ -221,6 +229,10 @@ mapped back to the attached structure at any time. .. method:: ResetPositionConstraints() Removes all position constraints. + This requires to reinitialize the internal openmm Context + (this is expensive!). Positions, velocities, forces, energies etc. + are properly preserved but e.g. states of random number generators etc. + might be lost. .. method:: ResetHarmonicBond(index, bond_length, force_constant) @@ -347,7 +359,11 @@ mapped back to the attached structure at any time. .. method:: ResetDistanceConstraint(index, constraint_length) Update of the distance constraint parameters in the simulation **and** - in the attached :class:`Topology` + in the attached :class:`Topology`. + This requires to reinitialize the internal openmm Context + (this is expensive!). Positions, velocities, forces, energies etc. + are properly preserved but e.g. states of random number generators etc. + might be lost. :param index: Distance constraint to be reset :param constraint_length: New constraint length in nm @@ -445,6 +461,10 @@ mapped back to the attached structure at any time. Update of the mass in the simulation **and** in the attached :class:`Topology` + This requires to reinitialize the internal openmm Context + (this is expensive!). Positions, velocities, forces, energies etc. + are properly preserved but e.g. states of random number generators etc. + might be lost. :param index: Mass to be reset :param mass: New mass diff --git a/modules/mol/mm/src/CMakeLists.txt b/modules/mol/mm/src/CMakeLists.txt index 58cd9883c1518e6dacca772825999151e860b1d3..3ebe98ba087cfc8cd22e891ccb0ee078c769f545 100644 --- a/modules/mol/mm/src/CMakeLists.txt +++ b/modules/mol/mm/src/CMakeLists.txt @@ -101,8 +101,5 @@ TARGET_LINK_LIBRARIES(${SHARED_TARGET_DENSITY_PLUGIN} ${OPEN_MM_LIBRARIES}) TARGET_LINK_LIBRARIES(${SHARED_TARGET_DENSITY_PLUGIN} ost_mol_mm) file(MAKE_DIRECTORY ${STAGE_DIR}/share/openstructure/openmm_plugins/) -INSTALL(TARGETS ${SHARED_TARGET_DENSITY_PLUGIN} LIBRARY DESTINATION "${STAGE_DIR}/share/openstructure/openmm_plugins/") - - - - +INSTALL(TARGETS ${SHARED_TARGET_DENSITY_PLUGIN} LIBRARY + DESTINATION "share/openstructure/openmm_plugins/") diff --git a/modules/mol/mm/src/observer.hh b/modules/mol/mm/src/observer.hh index d36229a9c4ef07177ca78c0d1787db1e0c3db899..e9103cea3a05de0410473e5dd7d10ae75e406106 100644 --- a/modules/mol/mm/src/observer.hh +++ b/modules/mol/mm/src/observer.hh @@ -31,6 +31,7 @@ #include <ost/mol/mm/state_extractor.hh> #include <ost/mol/mm/topology.hh> #include <ost/mol/mm/modeller.hh> +#include <ost/stdint.hh> namespace OpenMM{ class Context; //hacky way of telling the Context is around. @@ -92,12 +93,10 @@ class TrajWriter : public Observer{ public: - TrajWriter(int rhythm, const String& pdb_filename, const String& dcd_filename): rhythm_(rhythm), - pdb_filename_(pdb_filename), - dcd_filename_(dcd_filename), - stream_(), - registered_(false), - frames_(0) { } + TrajWriter(int rhythm, const String& pdb_filename, const String& dcd_filename) + : rhythm_(rhythm), pdb_filename_(pdb_filename), + dcd_filename_(dcd_filename), stream_(), registered_(false), + frames_(0) { } void Init(boost::shared_ptr<OpenMM::Context> c, TopologyPtr top, diff --git a/modules/mol/mm/src/settings.hh.in b/modules/mol/mm/src/settings.hh.in index 50dd9b71abcbd4eb2e9f9229642f40a4843585a1..d94e516424b97402367720221b2c1c3eaf7b3b55 100644 --- a/modules/mol/mm/src/settings.hh.in +++ b/modules/mol/mm/src/settings.hh.in @@ -30,6 +30,9 @@ #include <limits> #include <ost/mol/residue_handle.hh> #include <ost/mol/mm/forcefield.hh> +#include <ost/platform.hh> +#include <boost/filesystem/path.hpp> +#include <ost/log.hh> namespace OpenMM{ class Integrator;//hacky way of telling the Integrator us around @@ -91,7 +94,7 @@ typedef std::map<String,String> PropertyMap; struct Settings{ - Settings(): add_bonds(true), + Settings(): add_bonds(true), add_angles(true), add_dihedrals(true), add_impropers(true), @@ -134,10 +137,22 @@ struct Settings{ reaction_field_dielectric(78.3), use_dispersion_correction(true), keep_ff_specific_naming(true), - openmm_plugin_directory("@OPEN_MM_PLUGIN_DIR@"), - custom_plugin_directory("@STAGE_DIR@/share/openstructure/openmm_plugins") + openmm_plugin_directory("@OPEN_MM_PLUGIN_DIR@") { + + try { + // try to guess custom_plugin_directory + boost::filesystem::path shared_path(GetSharedDataPath()); + custom_plugin_directory = (shared_path / "openmm_plugins").string(); + } catch (std::runtime_error& e) { + // fallback to OpenMM path (used to be default in OST before 1.7) + LOG_WARNING("Failed to find shared data path for openmm_plugins. " + "Please set custom_plugin_directory of Settings object " + "manually or ensure that OST_ROOT is set properly. " + "Caught exception: " << e.what()); + custom_plugin_directory = openmm_plugin_directory; + } - { } + } // bool add_bonds; diff --git a/modules/mol/mm/src/simulation.cc b/modules/mol/mm/src/simulation.cc index 8288f1a5eadb9560c7108972617b3fce1c0de1e0..2a23ddb9a629a112b3301c35dd6756ad2ba08b92 100644 --- a/modules/mol/mm/src/simulation.cc +++ b/modules/mol/mm/src/simulation.cc @@ -694,7 +694,7 @@ void Simulation::ResetDistanceConstraint(uint index, Real constraint_length){ int particle1, particle2; system_->getConstraintParameters(index,particle1,particle2,dummy); system_->setConstraintParameters(index,particle1,particle2,constraint_length); - context_->reinitialize(); + this->ReinitializeContext(); top_->SetDistanceConstraintParameters(index, constraint_length); } @@ -703,7 +703,7 @@ void Simulation::AddPositionConstraint(uint index){ throw ost::Error("Provided index exceeds number of atoms!"); } system_->setParticleMass(index,0.0); - context_->reinitialize(); + this->ReinitializeContext(); top_->AddPositionConstraint(index); } @@ -717,7 +717,7 @@ void Simulation::AddPositionConstraints(const std::vector<uint>& index){ system_->setParticleMass(*i,0.0); top_->AddPositionConstraint(*i); } - context_->reinitialize(); + this->ReinitializeContext(); } void Simulation::ResetPositionConstraints(){ @@ -726,7 +726,7 @@ void Simulation::ResetPositionConstraints(){ system_->setParticleMass(i,original_masses[i]); } top_->ResetPositionConstraints(); - context_->reinitialize(); + this->ReinitializeContext(); } void Simulation::ResetHarmonicPositionRestraint(uint index, const geom::Vec3& ref_position, Real k, @@ -872,7 +872,7 @@ void Simulation::ResetMass(uint index, Real mass){ throw ost::Error("Provided index exceeds number of atoms!"); } system_->setParticleMass(index,mass); - context_->reinitialize(); + this->ReinitializeContext(); top_->SetMass(index,mass); } @@ -896,5 +896,20 @@ void Simulation::SetPeriodicBoxExtents(geom::Vec3& vec){ context_->setPeriodicBoxVectors(ucell_a,ucell_b,ucell_c); } +void Simulation::ReinitializeContext() { + // reinitializing requires to reset all those things! + // Be aware, state of random number generators etc might not be + // preserved! + + // openmm uses bitmasks to selectively extract data from the context. + // The context data might change with different OpenMM versions. + // Passing -1 automagically sets all bits to true => ALL available + // data gets extracted. + int true_bitmask = -1; + OpenMM::State state = context_->getState(true_bitmask); + context_->reinitialize(); + context_->setState(state); +} + }}} diff --git a/modules/mol/mm/src/simulation.hh b/modules/mol/mm/src/simulation.hh index 52aaaa0019761a165bc98e5799d66ab8fb18af0e..89c58b10eb96f8b2b0a5995986d2ea80a47a43b7 100644 --- a/modules/mol/mm/src/simulation.hh +++ b/modules/mol/mm/src/simulation.hh @@ -147,6 +147,8 @@ private: int TimeToNextNotification(); + void ReinitializeContext(); + // loads plugins from directory for OpenMM BUT only once per unique path! static void EnsurePluginsLoaded(const String& plugin_path); diff --git a/modules/seq/alg/src/subst_weight_matrix.cc b/modules/seq/alg/src/subst_weight_matrix.cc index d8102aa230cf7e4acb738f716e823e8ebb4ab884..315b00f10f9069ecaf08c8fde8afd684eb3dfea7 100644 --- a/modules/seq/alg/src/subst_weight_matrix.cc +++ b/modules/seq/alg/src/subst_weight_matrix.cc @@ -18,6 +18,7 @@ //------------------------------------------------------------------------------ #include "subst_weight_matrix.hh" +#include <ost/base.hh> #include <iostream> namespace{ diff --git a/modules/seq/base/tests/test_alignment.cc b/modules/seq/base/tests/test_alignment.cc index a70c19b226cb46140aa1fb70b5a8518b581156bd..52da21684c6dfc2f68e6788b36fce28bad85e65e 100644 --- a/modules/seq/base/tests/test_alignment.cc +++ b/modules/seq/base/tests/test_alignment.cc @@ -167,7 +167,7 @@ BOOST_AUTO_TEST_CASE(alignment_attach_view) BOOST_CHECK_NO_THROW(a.AttachView(0,EntityView())); BOOST_CHECK_EQUAL(a.GetResidue(0,1), EntityView()); BOOST_CHECK_EQUAL(a.GetResidue(0,3), EntityView()); - BOOST_CHECK_THROW(a.GetResidue(-1,0),std::out_of_range) + BOOST_CHECK_THROW(a.GetResidue(-1,0),std::out_of_range); } BOOST_AUTO_TEST_CASE(alignment_cut)