Skip to content

Commit

Permalink
Update headers, readme etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
msmdev committed Jan 31, 2021
1 parent 80c2837 commit d5e3b52
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 41 deletions.
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ effort to translate the original Sorting routine for real Schur forms `SRSchur`_
into `Python code`_,
M. Weber and `Alexander Sikorski`_ for pointing us to `SLEPc`_ for sorted partial Schur decompositions,
and A. Sikorski for supplying us with an `code example`_ and guidance how to interface SLEPc in Python.
The development of *pyGPCCA* started at the beginning of 2020 in a fork of `MSMTools`_,
since at this time it was planned to integrate GPCCA into it.
Due to this, some similarities in structure and code (indicated were evident) can be found.
Futher the utility functions found in `pygpcca/utils/_utils.py`_ originate from MSMTools.

.. _`Marcus Weber`: https://www.zib.de/members/weber
.. _`CMD`: https://www.zib.de/numeric/cmd
Expand All @@ -102,6 +106,8 @@ and A. Sikorski for supplying us with an `code example`_ and guidance how to int
.. _`Alexander Sikorski`: https://www.zib.de/members/sikorski
.. _`SLEPc`: https://slepc.upv.es/
.. _`code example`: https://github.com/zib-cmd/cmdtools/blob/1c6b6d8e1c35bb487fcf247c5c1c622b4b665b0a/src/cmdtools/analysis/pcca.py#L64
.. _`MSMTools`: https://github.com/markovmodel/msmtools
.. _`pygpcca/utils/_utils.py`: https://github.com/msmdev/pyGPCCA/blob/main/pygpcca/utils/_utils.py

.. |br| raw:: html

Expand Down
6 changes: 6 additions & 0 deletions docs/source/acknowledgments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ effort to translate the original Sorting routine for real Schur forms `SRSchur`_
into `Python code`_,
M. Weber and `Alexander Sikorski`_ for pointing us to `SLEPc`_ for sorted partial Schur decompositions,
and A. Sikorski for supplying us with an `code example`_ and guidance how to interface SLEPc in Python.
The development of *pyGPCCA* started at the beginning of 2020 in a fork of `MSMTools`_,
since at this time it was planned to integrate GPCCA into it.
Due to this, some similarities in structure and code (indicated were evident) can be found.
Futher the utility functions found in `pygpcca/utils/_utils.py`_ originate from MSMTools.

.. _`Marcus Weber`: https://www.zib.de/members/weber
.. _`CMD`: https://www.zib.de/numeric/cmd
Expand All @@ -20,3 +24,5 @@ and A. Sikorski for supplying us with an `code example`_ and guidance how to int
.. _`Alexander Sikorski`: https://www.zib.de/members/sikorski
.. _`SLEPc`: https://slepc.upv.es/
.. _`code example`: https://github.com/zib-cmd/cmdtools/blob/1c6b6d8e1c35bb487fcf247c5c1c622b4b665b0a/src/cmdtools/analysis/pcca.py#L64
.. _`MSMTools`: https://github.com/markovmodel/msmtools
.. _`pygpcca/utils/_utils.py`: https://github.com/msmdev/pyGPCCA/blob/main/pygpcca/utils/_utils.py
51 changes: 37 additions & 14 deletions pygpcca/_gpcca.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,35 @@
# With contributions of Marius Lange and Michal Klein.
# Based on the original MATLAB GPCCA code authored by Bernhard Reuter, Susanna Roeblitz and Marcus Weber,
# Zuse Institute Berlin, Takustrasse 7, 14195 Berlin
# --------------------------------------------------
# ---------------------------------------------------------------------------------------------------------------------
# The development of pyGPCCA started at the beginning of 2020 in a fork of MSMTools
# (Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER);
# provided under LGPL-3.0 License), since at this time it was planned to integrate GPCCA into it.
# Due to this, some similarities in structure/AST and code (indicated were evident) between pcca.py
# https://github.com/markovmodel/msmtools/blob/93126608c6fa9c3197f4fae2f6da93140762b047/msmtools/analysis/dense/pcca.py
# and _gpcca.py can be found.
# ---------------------------------------------------------------------------------------------------------------------
# If you use this code or parts of it, cite the following reference:
# ------------------------------------------------------------------
# ---------------------------------------------------------------------------------------------------------------------
# Reuter, B., Weber, M., Fackeldey, K., Röblitz, S., & Garcia, M. E. (2018).
# Generalized Markov State Modeling Method for Nonequilibrium Biomolecular Dynamics:
# Exemplified on Amyloid β Conformational Dynamics Driven by an Oscillating Electric Field.
# Journal of Chemical Theory and Computation, 14(7), 3579–3594. https://doi.org/10.1021/acs.jctc.8b00079
# ----------------------------------------------------------------
# pyGPCCA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# ---------------------------------------------------------------------------------------------------------------------
# pyGPCCA is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
# General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU Lesser General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.
# ---------------------------------------------------------------------------------------------------------------------

__author__ = __maintainer__ = "Bernhard Reuter"
__email__ = "bernhard.reuter AT uni-tuebingen DOT de"
__email__ = "bernhard-reuter@gmx.de"
__copyright__ = "Copyright 2020, Bernhard Reuter"
__credits__ = [
"Bernhard Reuter",
Expand Down Expand Up @@ -957,6 +964,9 @@ def optimize(
if min(m_list) in [0, 1]:
raise ValueError(f"There is no point in clustering into `{m}` clusters.")

# The following code enclosed by >>>... ...<<< originates (with some adjustments) from MSMTools
# Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER).
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# test connectivity
components = connected_sets(self._P)
n_components = len(components)
Expand All @@ -970,6 +980,7 @@ def optimize(
if np.sum(self._P[component, :][:, rest]) == 0:
closed_components.append(component)
n_closed_components = len(closed_components)
# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

# Calculate Schur matrix R and Schur vector matrix X, if not adequately given.
self._do_schur_helper(max(m_list))
Expand Down Expand Up @@ -1138,6 +1149,12 @@ def macrostate_assignment(self) -> OArray:
-------
Integer vector of shape `(n,)` containing the macrostate
each microstate is located in.
Credits
-------
The code and docstring of this property origins (with some adjustments) from MSMTools
Copyright (c) 2015, 2014 Computational Molecular Biology Group
Freie Universitaet Berlin (GER)
"""
return None if self.memberships is None else np.argmax(self.memberships, axis=1)

Expand All @@ -1155,6 +1172,12 @@ def macrostate_sets(self) -> Optional[List[np.ndarray]]:
A list of length equal to :attr:`n_m`.
Each element is an array with microstate indexes contained in it.
Credits
-------
The code and docstring of this property origins (with some adjustments) from MSMTools
Copyright (c) 2015, 2014 Computational Molecular Biology Group
Freie Universitaet Berlin (GER)
"""
return (
None
Expand Down
25 changes: 12 additions & 13 deletions pygpcca/_sort_real_schur.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
# Python version (translated by Fabian Paul and revised by Bernhard Reuter)
# of the following original work:
# Python version (translated by Fabian Paul; revised by Bernhard Reuter, Michal Klein) of the following original work:
# --------------------------------------------------------------------------------------------------------------------
# Title: Sorting Real Schur Forms
# Author: Jan Brandts
# E-Mail: brandts-AT-science.uva.nl
# http://m2matlabdb.ma.tum.de/download.jsp?MC_ID=3&MP_ID=119
# http://dx.doi.org/10.1002/nla.274
# Institution: University of Amsterdam
# Description: In Matlab 6, there exists a command to generate a real Schur
# form, wheras another transforms a real Schur form into a complex one.
# There do not exist commands to prescribe the order in which the eigenvalues
# appear on the diagonal of the upper (quasi-) triangular factor T.
# For the complex case, a routine is sketched in Golub and Van Loan (1996),
# Description: In Matlab 6, there exists a command to generate a real Schur form,
# wheras another transforms a real Schur form into a complex one.
# There do not exist commands to prescribe the order in which the eigenvalues appear on the diagonal of the upper
# (quasi-) triangular factor T. For the complex case, a routine is sketched in Golub and Van Loan (1996),
# that orders the diagonal of T according to their distance to a target value.
# In the reference below, we give a Matlab routine to sort real Schur forms
# in Matlab. It is based on a block-swapping procedure by Bai and Demmel (1993).
# Sorting real Schur forms, both partially and completely, has important
# applications in the computation of real invariant subspaces.
# In the reference below, we give a Matlab routine to sort real Schur forms in Matlab.
# It is based on a block-swapping procedure by Bai and Demmel (1993).
# Sorting real Schur forms, both partially and completely,
# has important applications in the computation of real invariant subspaces.
# Reference: J.H. Brandts. Matlab code for sorted real Schur forms.
# Numerical Linear Algebra with Applications 9(3):249-261 (2002)
# Keywords: Real Schur Form, sorting, Bai-Demmel algorithm, swapping
# Based on the original Matlab File Version: 1.0
# -------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------------------
# All references to equations or pages made in the comments are referencing
# Jan Brandts. Matlab Code for Sorted Real Schur Forms. Preprint No. 1180,
# January, 2001, Universiteit Utrecht,
# https://www.math.uu.nl/publications/preprints/1180.pdf
# -------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------------------

from typing import List, Tuple, Union

Expand Down
26 changes: 12 additions & 14 deletions pygpcca/_sorted_schur.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,25 @@
# Further parts of sorted_krylov_schur were developed based on the function krylov_schur
# https://github.com/zib-cmd/cmdtools/blob/1c6b6d8e1c35bb487fcf247c5c1c622b4b665b0a/src/cmdtools/analysis/pcca.py#L64,
# written by Alexander Sikorski.
# --------------------------------------------------
# --------------------------------------------------------------------------------------------------------------------
# If you use this code or parts of it, cite the following reference:
# ------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------------------------
# Reuter, B., Weber, M., Fackeldey, K., Röblitz, S., & Garcia, M. E. (2018).
# Generalized Markov State Modeling Method for Nonequilibrium Biomolecular Dynamics:
# Exemplified on Amyloid β Conformational Dynamics Driven by an Oscillating Electric Field.
# Journal of Chemical Theory and Computation, 14(7), 3579–3594. https://doi.org/10.1021/acs.jctc.8b00079
# ----------------------------------------------------------------
# pyGPCCA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# --------------------------------------------------------------------------------------------------------------------
# pyGPCCA is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
# General Public License as published by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# You should have received a copy of the GNU Lesser General Public License along with this program.
# If not, see <http://www.gnu.org/licenses/>.
# --------------------------------------------------------------------------------------------------------------------
from typing import Tuple, Union
import sys

Expand Down

0 comments on commit d5e3b52

Please sign in to comment.