diff --git a/CHANGES b/CHANGES index 0684102d..c1ce99ba 100644 --- a/CHANGES +++ b/CHANGES @@ -5,7 +5,7 @@ CHANGES for MDPOW Add summary of changes for each release. Use ISO dates. Reference GitHub issues numbers and PR numbers. -2021-07-xx 0.7.0 +2021-08-02 0.7.0 orbeckst, VOD555, ALescoulie Changes diff --git a/doc/logo/LICENSE b/doc/logo/LICENSE new file mode 100644 index 00000000..22fcb145 --- /dev/null +++ b/doc/logo/LICENSE @@ -0,0 +1,7 @@ +POW! image Image by Andrew Martin from Pixabay +Andrew Martin from Pixabay. + +Used under Pixabay license https://pixabay.com/service/license/ +(Free for commercial use +No attribution required ) + diff --git a/doc/logo/mdpow-ico-32x32.pdf b/doc/logo/mdpow-ico-32x32.pdf new file mode 100644 index 00000000..d568ce8d Binary files /dev/null and b/doc/logo/mdpow-ico-32x32.pdf differ diff --git a/doc/logo/mdpow-ico-32x32.tif b/doc/logo/mdpow-ico-32x32.tif new file mode 100644 index 00000000..afbdb0ab Binary files /dev/null and b/doc/logo/mdpow-ico-32x32.tif differ diff --git a/doc/logo/mdpow-logo.pdf b/doc/logo/mdpow-logo.pdf new file mode 100644 index 00000000..631fb1b5 Binary files /dev/null and b/doc/logo/mdpow-logo.pdf differ diff --git a/doc/logo/mdpow.ico b/doc/logo/mdpow.ico new file mode 100644 index 00000000..df3132ed Binary files /dev/null and b/doc/logo/mdpow.ico differ diff --git a/doc/logo/pow-1601674_640.png b/doc/logo/pow-1601674_640.png new file mode 100644 index 00000000..c717a434 Binary files /dev/null and b/doc/logo/pow-1601674_640.png differ diff --git a/doc/sphinx/source/_static/mdpow-logo.png b/doc/sphinx/source/_static/mdpow-logo.png new file mode 100644 index 00000000..0dca43b1 Binary files /dev/null and b/doc/sphinx/source/_static/mdpow-logo.png differ diff --git a/doc/sphinx/source/_static/mdpow.ico b/doc/sphinx/source/_static/mdpow.ico new file mode 100644 index 00000000..df3132ed Binary files /dev/null and b/doc/sphinx/source/_static/mdpow.ico differ diff --git a/doc/sphinx/source/conf.py b/doc/sphinx/source/conf.py index 7f74b0a2..0620a585 100644 --- a/doc/sphinx/source/conf.py +++ b/doc/sphinx/source/conf.py @@ -107,8 +107,7 @@ html_theme = 'sphinx_rtd_theme' html_theme_options = { - 'canonical_url': '', - #'logo_only': True, + 'logo_only': False, 'display_version': True, 'prev_next_buttons_location': 'bottom', 'style_external_links': False, @@ -137,12 +136,12 @@ # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +html_logo = "_static/mdpow-logo.png" # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +html_favicon = "_static/mdpow.ico" # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -229,7 +228,7 @@ intersphinx_mapping = {'https://docs.python.org/': None, 'https://numpy.org/doc/stable/': None, 'https://docs.scipy.org/doc/scipy/reference/': None, - 'https://gromacswrapper.readthedocs.org/en/latest/': None, + 'https://gromacswrapper.readthedocs.io/en/latest': None, } diff --git a/doc/sphinx/source/forcefields.txt b/doc/sphinx/source/forcefields.txt new file mode 100644 index 00000000..d3e0f8b3 --- /dev/null +++ b/doc/sphinx/source/forcefields.txt @@ -0,0 +1 @@ +.. automodule:: mdpow.forcefields diff --git a/doc/sphinx/source/index.txt b/doc/sphinx/source/index.txt index e9c79f9a..746361fb 100644 --- a/doc/sphinx/source/index.txt +++ b/doc/sphinx/source/index.txt @@ -50,7 +50,7 @@ It should be possible to use any of these Gromacs versions without further adjustments, thanks to the underlying GromacsWrapper library [#GromacsWrapperFramework]_. -Nevertheless, you should _always_ check the topology and runinput +Nevertheless, you should *always* check the topology and runinput (mdp) files for the version of Gromacs_ that you are using. @@ -141,7 +141,6 @@ For current issues and open feature requests please look through the fep utilities forcefields - tables .. rubric:: Indices and tables diff --git a/doc/sphinx/source/scripts.txt b/doc/sphinx/source/scripts.txt index 64c0ef51..fb40c05b 100644 --- a/doc/sphinx/source/scripts.txt +++ b/doc/sphinx/source/scripts.txt @@ -62,8 +62,8 @@ be found). The required **input** is 2. a structure file (PDB or GRO) for the compound 3. a Gromacs ITP file for the compound (OPLS/AA force field) -A template *RUNFILE* can be generated with :option:`mdpow-get-runinput -runinput.yml`, which will copy the default run input file bundled with +A template *RUNFILE* can be generated with :program:`mdpow-get-runinput` +``runinput.yml``, which will copy the default run input file bundled with MDPOW and put it in the current directory under the name ``runinput.yml``. @@ -79,14 +79,16 @@ by :mod:`yaml`). numbers. For example, a name "005" would be interpreted as the number 5 unless explicitly quoted. -The script keeps track of the stages of the simulation protocol and allows the -user to **restart from the last completed stage**. For instance, one can use the -script to set up a simulation, then run the simulation on a cluster, transfer -back the generated files, and start :program:`mdpow-equilibrium` again with the -exact same input to finish the protocol. Since Gromacs 4.5 it is also possible -to interrupt a running :program:`mdrun` process (e.g. with :kbd:`Control-c`) -and then resume the simulation at the last saved trajectory checkpoint by -running :program:`mdpow-equilibrium` again. +The script keeps track of the stages of the simulation protocol (in +the state files :file:`water.simulation`, :file:`octanol.simulation` +etc) and allows the user to **restart from the last completed +stage**. For instance, one can use the script to set up a simulation, +then run the simulation on a cluster, transfer back the generated +files, and start :program:`mdpow-equilibrium` again with the exact +same input to finish the protocol. Since Gromacs 4.5 it is also +possible to interrupt a running :program:`mdrun` process (e.g. with +:kbd:`Control-c`) and then resume the simulation at the last saved +trajectory checkpoint by running :program:`mdpow-equilibrium` again. If in doubt, just try running :program:`mdpow-equilibrium` running again and let it figure out the best course of action. Look at the log file to see what @@ -103,17 +105,24 @@ Usage of the command: compound and one solvent. All parameters except the solvent are specified in the *RUNFILE*. + Arguments: + + .. option:: RUNFILE + + The runfile :file:`runinput.yml` with all configuration parameters. + + Options: - .. cmdoption:: -h, --help + .. option:: -h, --help show this help message and exit - .. cmdoption:: -S , --solvent= + .. option:: -S , --solvent= solvent ```` for compound, can be 'water', 'octanol', 'cyclohexane' [water] - .. cmdoption:: -d , --dirname= + .. option:: -d , --dirname= generate files and directories in ````, which is created if it does not already exist. The default is to use the molecule *name* from the run input @@ -143,21 +152,23 @@ Usage of the command: :program:`mdpow-fep` [options] *RUNFILE* - Options: + Arguments: - .. cmdoption:: -h, --help + .. option:: RUNFILE - show this help message and exit + The runfile :file:`runinput.yml` with all configuration parameters. - .. cmdoption:: --get-template + Options: + + .. option:: -h, --help - generate a template *RUNFILE* and exit + show this help message and exit - .. cmdoption:: -S , --solvent= + .. option:: -S , --solvent= solvent ```` for compound, can be 'water' or 'octanol' [water] - .. cmdoption:: -d , --dirname= + .. option:: -d , --dirname= generate files and directories in ````, which is created if it does not already exist. The default is to use the molecule *name* from the run @@ -189,93 +200,149 @@ Usage of the command: .. program:: mdpow-solvationenergy - :program:`mdpow-solvationenergy` [options] DIRECTORY [DIRECTORY ...] - - Run the free energy analysis for a solvent in ``/FEP`` and - return ``DeltaG``. - - ``DIRECTORY`` should contain all the files resulting from running - ``mdpow.fep.Ghyd.setup()`` (or the corresponding ``Goct.setup()`` or - ``Gcyclohexane.setup()`` and the results of the MD FEP simulations. It - relies on the canonical naming scheme (basically: just use the defaults - as in the tutorial). - - The dV/dlambda plots can be produced automatically (``--plot=auto``). If - multiple ``DIRECTORY`` arguments are provided then one has to choose the - "auto" option (or ``None``). + :program:`mdpow-solvationenergy` [options] DIRECTORY [DIRECTORY ...] - The total solvation free energy is calculated as + Run the free energy analysis for a solvent in ``/FEP`` and + return ``DeltaG``. - DeltaG* = -(DeltaG_coul + DeltaG_vdw) + ``DIRECTORY`` should contain all the files resulting from running + ``mdpow.fep.Ghyd.setup()`` (or the corresponding ``Goct.setup()`` or + ``Gcyclohexane.setup()`` and the results of the MD FEP simulations. It + relies on the canonical naming scheme (basically: just use the defaults + as in the tutorial). - Note that the standard state refers to the "Ben-Naim" standard state of - transferring 1 M of compound in the gas phase to 1 M in the aqueous - phase. - - Results are *appended* to a data file with **Output file format**:: - - . ---------- kJ/mol --- - molecule solvent DeltaG* coulomb vdw - - All observables are quoted with an error estimate, which is derived - from the correlation time and error propagation through Simpson's rule - (see :meth:`mdpow.fep.Gsolv`). It ultimately comes from the error on - , which is estimated as the error to determine the - average. - - :molecule: - molecule name as used in the itp - :DeltaG*: - solvation free energy vacuum --> solvent, in kJ/mol - :coulomb: - discharging contribution to the DeltaG* - :vdw: - decoupling contribution to the DeltaG* - :directory: - folder in which the simulations were stored - - - Options: - - .. cmdoption:: -h, --help - - show this help message and exit + The dV/dlambda plots can be produced automatically (``--plotfile auto``). If + multiple ``DIRECTORY`` arguments are provided then one has to choose the + "auto" option (or "none"). - .. cmdoption:: -S , --solvent= + The total solvation free energy is calculated as - solvent NAME for compound, 'water', 'octanol', or 'cyclohexane' [water] + .. math:: - .. cmdoption:: -p , --plotfile= + \Delta G^{*} = -(\Delta G_{\text{coul}} + \Delta G_{\text{vdw}}) - plot dV/dlambda to :file:`{FILE}`; use png or pdf suffix to determine the - file type. 'auto' generates a pdf file :file:`{DIRECTORY}/dVdl.pdf` and - 'None' disables it [auto] + Note that the standard state refers to the "Ben-Naim" standard state of + transferring 1 M of compound in the gas phase to 1 M in the aqueous + phase. - .. cmdoption:: -e , --energies= + Results are *appended* to a data file with **Output file format**:: - append solvation free energies to ```` [:file:`energies.txt`] + . ---------- kJ/mol --- + molecule solvent DeltaG* coulomb vdw - .. cmdoption:: -s , --stride= + All observables are quoted with an error estimate, which is derived + from the correlation time and error propagation through Simpson's rule + (see :meth:`mdpow.fep.Gsolv`). It ultimately comes from the error on + , which is estimated as the error to determine the + average. - Use every N-th datapoint from the original dV/dlambda data. Using a - number larger than 1 can significantly reduce memory usage with little - impact on the precision of the final output. [10] + :molecule: + molecule name as used in the itp + :DeltaG*: + solvation free energy vacuum --> solvent, in kJ/mol + :coulomb: + discharging contribution to the DeltaG* + :vdw: + decoupling contribution to the DeltaG* + :directory: + folder in which the simulations were stored - .. cmdoption:: --force - force rereading all data [False] - - .. cmdoption:: --ignore-corrupted + positional arguments: + + .. option:: DIRECTORY [DIRECTORY ...] - skip lines in the md.xvg files that cannot be parsed, perhaps because to an - intermittent file system problem. In order to salvage the existing data, - this option is provided for diagnostic purposes. [False] + directory or directories which contain all the files + resulting from running :meth:`mdpow.fep.Ghyd.setup` - .. Warning:: Only use this option with care; skipped lines can indicate that - other parts of the file have been corrupted but still pass the line - corruption test. USE AT YOUR OWN RISK. + optional arguments: + + .. option:: -h, --help + + show this help message and exit + .. option:: --plotfile FILE + + plot dV/dlambda to FILE; use png or pdf suffix to + determine the file type. *'auto'* generates a pdf file + :file:`{DIRECTORY}/dVdl_{molname}_{solvent}.pdf` and + *none* disables it The plot function is only + available for mdpow estimator,and is disabled when + using alchemlyb estimators. (default: none) + + .. option:: --solvent NAME, -S NAME + + solvent `NAME` for compound, 'water', 'octanol', or + 'cyclohexane' (default: water) + + .. option:: -o FILE, --outfile FILE + + append one-line results summary to `FILE` (default: + :file:`gsolv.txt`) + + .. option:: -e FILE, --energies FILE + + append solvation free energies to FILE (default: + :file:`energies.txt`) + + .. option:: --estimator {mdpow,alchemlyb} + + choose the estimator to be used, *alchemlyb* or *mdpow* + estimators (default: *alchemlyb*) + + .. option:: --method {TI,MBAR,BAR} + + choose the method to calculate free energy (default: + *MBAR*) + + .. option:: --force + + force rereading all data (default: False) + + .. option:: --SI + + enable statistical inefficiency (SI) analysis. + Statistical inefficiency analysis is performed by + default when usingalchemlyb estimators and is always + disabled when using mdpow estimator. (default: True) + + .. option:: --no-SI + + disable statistical inefficiency + analysis. Statistical inefficiency analysis is + performed by default when usingalchemlyb estimators + and is disabled when using mdpow estimator. (default: + False) + + .. option:: -s N, --stride N + + use every `N`-th datapoint from the original dV/dlambda + data. (default: 1) + + .. option:: --start START + + start point for the data used from the original + dV/dlambda data. (default: 0) + + .. option:: --stop STOP + + stop point for the data used from the original + dV/dlambda data. (default: None) + + .. option:: --ignore-corrupted + + skip lines in the md.xvg files that cannot be parsed. + (default: False) + + .. warning:: + + Other lines in the file might have been corrupted + in such a way that they appear correct but are in + fact wrong. WRONG RESULTS CAN OCCUR! USE AT YOUR + OWN RISK + + It is recommended to simply rerun the affected simulation(s). + - It is recommended to simply rerun the affected simulation(s). Partition coefficients @@ -292,6 +359,9 @@ The :program:`mdpow-pow` script * appends results to ``pow.txt`` and ``energies.txt`` (when the default names are chosen), see :ref:`mdpow-pow-outputformat-label`. +An equivalent script :program:`mdpow-pcw` for the water-cyclohexane +partition coefficient is also included. + Usage of the command: .. program:: mdpow-pow @@ -306,45 +376,108 @@ Usage of the command: of the MD FEP simulations. It relies on the canonical naming scheme (basically: just use the defaults as in the tutorial). - The dV/dlambda plots can be produced automatically (:option:`mdpow-pow - -p` auto). If multiple *DIRECTORY* arguments are provided then one has to - choose the auto option (or ``None``). - - Options: - - .. cmdoption:: -h, --help - - show this help message and exit - - .. cmdoption:: -p , --plotfile= - - plot dV/dlambda to :file:`{FILE}`; use png or pdf suffix to determine the - file type. 'auto' generates a pdf file :file:`{DIRECTORY}/dVdl.pdf` and - 'None' disables it [auto] + The dV/dlambda plots can be produced automatically + (``--plotfile auto``). If multiple *DIRECTORY* + arguments are provided then one has to choose the "auto" option (or + "none"). - .. cmdoption:: -o , --outfile= - append one-line results summary to ```` [:file:`pow.txt`] - - .. cmdoption:: -e , --energies= - - append solvation free energies to ```` [:file:`energies.txt`] - - .. cmdoption:: --force - - force rereading all data [False] - - .. cmdoption:: --ignore-corrupted - - skip lines in the md.xvg files that cannot be parsed, perhaps because to an - intermittent file system problem. In order to salvage the existing data, - this option is provided for diagnostic purposes. [False] - - .. Warning:: Only use this option with care; skipped lines can indicate that - other parts of the file have been corrupted but still pass the line - corruption test. USE AT YOUR OWN RISK. - - It is recommended to simply rerun the affected simulation(s). + positional arguments: + + .. option:: DIRECTORY [DIRECTORY ...] + + One or more directories that contain the state pickle + files (:file:`water.simulation`, + :file:`octanol.simulation`) for the solvation free + energy calculations in water and octanol. These + directory or directories should contain all the files + resulting from running :meth:`mdpow.fep.Ghyd.setup` and + :meth:`mdpow.fep.Goct.setup` and the results of the MD FEP + simulations. + + optional arguments: + + .. option:: -h, --help + + show this help message and exit + + .. option:: --plotfile FILE + + plot dV/dlambda to FILE; use png or pdf suffix to + determine the file type. *'auto'* generates a pdf file + :file:`{DIRECTORY}/dVdl_{molname}_pow.pdf` and + *none* disables it The plot function is only + available for mdpow estimator,and is disabled when + using alchemlyb estimators. (default: none) + + .. option:: -o FILE, --outfile FILE + + append one-line results summary to `FILE` (default: + :file:`pow.txt`) + + .. option:: -e FILE, --energies FILE + + append solvation free energies to FILE (default: + :file:`energies.txt`) + + .. option:: --estimator {mdpow,alchemlyb} + + choose the estimator to be used, *alchemlyb* or *mdpow* + estimators (default: *alchemlyb*) + + .. option:: --method {TI,MBAR,BAR} + + choose the method to calculate free energy (default: + *MBAR*) + + .. option:: --force + + force rereading all data (default: False) + + .. option:: --SI + + enable statistical inefficiency (SI) analysis. + Statistical inefficiency analysis is performed by + default when usingalchemlyb estimators and is always + disabled when using mdpow estimator. (default: True) + + .. option:: --no-SI + + disable statistical inefficiency + analysis. Statistical inefficiency analysis is + performed by default when usingalchemlyb estimators + and is disabled when using mdpow estimator. (default: + False) + + .. option:: -s N, --stride N + + use every `N`-th datapoint from the original dV/dlambda + data. (default: 1) + + .. option:: --start START + + start point for the data used from the original + dV/dlambda data. (default: 0) + + .. option:: --stop STOP + + stop point for the data used from the original + dV/dlambda data. (default: None) + + .. option:: --ignore-corrupted + + skip lines in the md.xvg files that cannot be parsed. + (default: False) + + .. warning:: + + Other lines in the file might have been corrupted + in such a way that they appear correct but are in + fact wrong. WRONG RESULTS CAN OCCUR! USE AT YOUR + OWN RISK + + It is recommended to simply rerun the affected simulation(s). + .. _mdpow-pow-outputformat-label: @@ -541,11 +674,11 @@ Usage of the command: Options: - .. cmdoption:: -h, --help + .. option:: -h, --help show this help message and exit - .. cmdoption:: -o , --outfile= + .. option:: -o , --outfile= write status results to :file:`{FILE}` [:file:`status.txt`] @@ -571,11 +704,11 @@ Usage of the command: Options: - .. cmdoption:: -h, --help + .. option:: -h, --help show this help message and exit - .. cmdoption:: --solvent= + .. option:: --solvent= rebuild file for 'water', 'octanol', or 'all' [all] @@ -605,15 +738,15 @@ Usage of the command: Options: - .. cmdoption:: -h, --help + .. option:: -h, --help show this help message and exit - .. cmdoption:: --solvent= + .. option:: --solvent= rebuild fep for 'water', 'octanol', or 'all' [all] - .. cmdoption:: --setup= + .. option:: --setup= Re-generate queuing system scripts with appropriate paths: runs :meth:`fep.Gsolv.setup` with argument `qscript=[LIST]` after diff --git a/doc/sphinx/source/tables.txt b/doc/sphinx/source/tables.txt deleted file mode 100644 index ec490e9a..00000000 --- a/doc/sphinx/source/tables.txt +++ /dev/null @@ -1,2 +0,0 @@ -.. automodule:: mdpow.tables - :members: diff --git a/mdpow/_version.py b/mdpow/_version.py index 4c148a21..c0829035 100644 --- a/mdpow/_version.py +++ b/mdpow/_version.py @@ -9,6 +9,7 @@ # versioneer-0.18 (https://github.com/warner/python-versioneer) """Git implementation of _version.py.""" +from __future__ import absolute_import, print_function import errno import os diff --git a/mdpow/fep.py b/mdpow/fep.py index efd149c3..00e37627 100644 --- a/mdpow/fep.py +++ b/mdpow/fep.py @@ -73,9 +73,20 @@ .. autoclass:: Gsolv :members: + :inherited-members: + .. autoclass:: Ghyd + :members: + :inherited-members: + .. autoclass:: Goct + :members: + :inherited-members: + .. autoclass:: Gcyclo + :members: + :inherited-members: + .. autofunction:: pOW .. autofunction:: pCW @@ -876,7 +887,7 @@ def _lencorrupted(xvg): return numpy.any([x for x in corrupted.values()]) def analyze(self, force=False, stride=None, autosave=True, ncorrel=25000): - """Extract dV/dl from output and calculate dG by TI. + r"""Extract dV/dl from output and calculate dG by TI. Thermodynamic integration (TI) is performed on the individual component window calculation (typically the Coulomb and the @@ -889,7 +900,8 @@ def analyze(self, force=False, stride=None, autosave=True, ncorrel=25000): interaction switched on and ``lambda=1`` as switched off. .. math:: - \Delta A* &= -(\Delta A_{\mathrm{coul}} + \Delta A_{\mathrm{vdw}})\\ + + \Delta A^{*} = -(\Delta A_{\mathrm{coul}} + \Delta A_{\mathrm{vdw}}) Data are stored in :attr:`Gsolv.results`. @@ -936,23 +948,27 @@ def analyze(self, force=False, stride=None, autosave=True, ncorrel=25000): *ncorrel* aim for <= 25,000 samples for t_correl - ..rubric:: Notes + .. rubric:: Notes - Error on the mean of the data, taking the correlation time into account. + The error on the mean of the data :math:`\epsilon_y`, taking + the correlation time into account, is calculated according to + [FrenkelSmit2002]_ `p526`_: - See [FrenkelSmit2002]_ `p526`_: + .. math:: - error = sqrt(2*tc*acf[0]/T) + \epsilon_y = \sqrt{2 \tau_c \mathrm{acf}(0)/T} - where acf() is the autocorrelation function of the fluctuations around - the mean, y-, tc is the correlation time, and T the total length of - the simulation. + where :math:`\mathrm{acf}()` is the autocorrelation function + of the fluctuations around the mean, :math:`y - \langle y + \rangle`, :math:`\tau_c` is the correlation time, and :math:`T` + the total length of the simulation. .. [FrenkelSmit2002] D. Frenkel and B. Smit, Understanding Molecular Simulation. Academic Press, San Diego 2002 .. _p526: http://books.google.co.uk/books?id=XmyO2oRUg0cC&pg=PA526 + """ stride = stride or self.stride logger.info("Analysis stride is %s.",stride) diff --git a/mdpow/filelock.py b/mdpow/filelock.py index 9bf69f7a..07228a07 100644 --- a/mdpow/filelock.py +++ b/mdpow/filelock.py @@ -26,7 +26,7 @@ """ -from __future__ import absolute_import +from __future__ import absolute_import, print_function import os import time diff --git a/mdpow/forcefields.py b/mdpow/forcefields.py index e7683e8b..61118919 100644 --- a/mdpow/forcefields.py +++ b/mdpow/forcefields.py @@ -5,13 +5,16 @@ # See the file COPYING for details. """ -Configuration settings related to force fields -============================================== +Force field selection +===================== -At the moment, only the OPLS-AA force field is directly supported -(although in the principle it is possible to switch to a different -force field by supplying alternative template files). However, in the -future we want to support a simple configuration based switch. +The :mod:`mdpow.forcefields` module contains settings for selecting +different force fields and the corresponding solvent topologies. + +The OPLS-AA, CHARMM/CGENFF and the AMBER/GAFF force field are directly +supported. In the principle it is possible to switch to a +different force field by supplying alternative template +files. .. autodata:: DEFAULT_FORCEFIELD .. autodata:: DEFAULT_WATER_MODEL @@ -47,6 +50,7 @@ .. autofunction:: get_solvent_identifier .. autofunction:: get_solvent_model + """ from __future__ import absolute_import @@ -182,6 +186,8 @@ def get_water_model(watermodel=DEFAULT_WATER_MODEL): identifier="cyclohexane", itp="1cyclo.itp", coordinates="1cyclo_amber.gro"), } +#: Solvents available in GROMACS; the keys of the dictionary +#: are the forcefields. GROMACS_SOLVENT_MODELS = { 'OPLS-AA': OPLS_SOLVENT_MODELS, 'CHARMM': CHARMM_SOLVENT_MODELS, @@ -213,7 +219,7 @@ def get_solvent_identifier(solvent_type, model=None, forcefield='OPLS-AA'): :Returns: Either an identifier or ``None`` """ - if solvent_type is "water": + if solvent_type == "water": identifier = model if not model in (None, 'water') else DEFAULT_WATER_MODEL return identifier if identifier in GROMACS_WATER_MODELS else None if not model in GROMACS_SOLVENT_MODELS[forcefield]: @@ -230,7 +236,7 @@ def get_solvent_model(identifier, forcefield='OPLS-AA'): If identifier is "water" then the :data:`DEFAULT_WATER_MODEL` is assumed. """ - if identifier is "water": + if identifier == "water": identifier = DEFAULT_WATER_MODEL try: return GROMACS_WATER_MODELS[identifier] @@ -264,6 +270,7 @@ def get_ff_paths(forcefield='OPLS-AA'): def get_top_template(identifier): + """Return the topology file template suitable for the solvent model.""" templates = {'water': 'system.top', 'octanol': 'system.top', 'cyclohexane': 'system.top', 'wetoctanol': 'system_octwet.top'} try: diff --git a/mdpow/restart.py b/mdpow/restart.py index 1fb77c71..65229fcf 100644 --- a/mdpow/restart.py +++ b/mdpow/restart.py @@ -21,7 +21,7 @@ .. autofunction:: checkpoint """ -from __future__ import absolute_import +from __future__ import absolute_import, print_function from six.moves import cPickle as pickle @@ -66,7 +66,7 @@ class Journal(object): J.start('main') ... # main does not finish properly - print J.incomplete + print(J.incomplete) # --> 'main' J.start('post') # raises JournalSequenceError diff --git a/scripts/mdpow-cfg2yaml.py b/scripts/mdpow-cfg2yaml.py index ef5efac0..7bcba217 100755 --- a/scripts/mdpow-cfg2yaml.py +++ b/scripts/mdpow-cfg2yaml.py @@ -1,5 +1,5 @@ #! /bin/python -from __future__ import absolute_import, print_statement, division +from __future__ import absolute_import, print_function, division import sys import yaml diff --git a/scripts/mdpow-check b/scripts/mdpow-check index ccd50eab..be786378 100755 --- a/scripts/mdpow-check +++ b/scripts/mdpow-check @@ -9,7 +9,7 @@ error. A quick way to find problems is to do a :: cat status.txt | gawk -F '|' '$2 !~ /OK/ {print $0}' """ -from __future__ import absolute_import, print_statement, division +from __future__ import absolute_import, print_function, division import logging logger = logging.getLogger('mdpow') diff --git a/scripts/mdpow-equilibrium b/scripts/mdpow-equilibrium index 1d93b4cf..529f6692 100755 --- a/scripts/mdpow-equilibrium +++ b/scripts/mdpow-equilibrium @@ -21,7 +21,7 @@ You will require: # TODO: # # 2) Default config file in user's home dir. -from __future__ import absolute_import, print_statement, division +from __future__ import absolute_import, print_function, division from mdpow.run import equilibrium_simulation from mdpow.config import get_configuration diff --git a/scripts/mdpow-fep b/scripts/mdpow-fep index dc9bc9b4..4f06a8e3 100755 --- a/scripts/mdpow-fep +++ b/scripts/mdpow-fep @@ -20,7 +20,7 @@ You will require: # TODO: # # 2) Default config file in user's home dir. -from __future__ import absolute_import, print_statement, division +from __future__ import absolute_import, print_function, division from mdpow.run import fep_simulation from mdpow.config import get_configuration diff --git a/scripts/mdpow-get-runinput b/scripts/mdpow-get-runinput index eba22629..5b7e0902 100755 --- a/scripts/mdpow-get-runinput +++ b/scripts/mdpow-get-runinput @@ -3,7 +3,7 @@ Generate a template RUNINPUTFILE. """ -from __future__ import absolute_import, print_statement, division +from __future__ import absolute_import, print_function, division from mdpow.config import get_configuration diff --git a/scripts/mdpow-ghyd b/scripts/mdpow-ghyd index bf2cbe3f..8df75197 100755 --- a/scripts/mdpow-ghyd +++ b/scripts/mdpow-ghyd @@ -49,7 +49,7 @@ directory folder in which the simulations were stored """ -from __future__ import absolute_import, print_statement, division +from __future__ import absolute_import, print_function, division import os import warnings diff --git a/scripts/mdpow-pcw b/scripts/mdpow-pcw index 48d03755..4a1d47a8 100755 --- a/scripts/mdpow-pcw +++ b/scripts/mdpow-pcw @@ -32,7 +32,7 @@ wat_ok, cyc_ok directory folder in which the simulations were stored """ -from __future__ import absolute_import, print_statement, division +from __future__ import absolute_import, print_function, division import os import mdpow.fep diff --git a/scripts/mdpow-pow b/scripts/mdpow-pow index 8edb8d17..4081f3f8 100755 --- a/scripts/mdpow-pow +++ b/scripts/mdpow-pow @@ -32,7 +32,7 @@ wat_ok, octa_ok directory folder in which the simulations were stored """ -from __future__ import absolute_import, print_statement, division +from __future__ import absolute_import, print_function, division import os import mdpow.fep diff --git a/scripts/mdpow-rebuild-fep b/scripts/mdpow-rebuild-fep index 615d3dab..cd454492 100755 --- a/scripts/mdpow-rebuild-fep +++ b/scripts/mdpow-rebuild-fep @@ -7,7 +7,7 @@ equilibrium simulation file under /FEP. (This should only be necessary when the fep file was destroyed due to a software error.) """ -from __future__ import absolute_import, print_statement, division +from __future__ import absolute_import, print_function, division import os import mdpow.equil diff --git a/scripts/mdpow-rebuild-simulation b/scripts/mdpow-rebuild-simulation index 3d4f8e28..1649aa3c 100755 --- a/scripts/mdpow-rebuild-simulation +++ b/scripts/mdpow-rebuild-simulation @@ -7,7 +7,7 @@ adjusted paths. (This should only be necessary when the directories are moved or copied to a different machine.) """ -from __future__ import absolute_import, print_statement, division +from __future__ import absolute_import, print_function, division import os import mdpow.equil diff --git a/scripts/mdpow-solvationenergy b/scripts/mdpow-solvationenergy index 846b9e23..529eee69 100755 --- a/scripts/mdpow-solvationenergy +++ b/scripts/mdpow-solvationenergy @@ -45,7 +45,7 @@ directory folder in which the simulations were stored """ -from __future__ import absolute_import, print_statement, division +from __future__ import absolute_import, print_function, division import os import mdpow.fep diff --git a/setup.py b/setup.py index d549c138..a7a05ee1 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,7 @@ cmdclass=versioneer.get_cmdclass(), description="A library for computing solvation/water partitioning coefficients using molecular dynamics simulations", long_description=open("README.rst").read(), + long_description_content_type="text/x-rst", author="Oliver Beckstein", author_email="orbeckst@gmail.com", license="GPLv3",