Skip to content
Snippets Groups Projects
Commit d4d32ad4 authored by James Graham's avatar James Graham
Browse files

Added documentation RST files to repo

Added some more doc strings
parent cf26469e
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ Contents: ...@@ -13,7 +13,7 @@ Contents:
members members
Indices and tables Indexes
================== ==================
* :ref:`genindex` * :ref:`genindex`
......
pycgtool
========
.. toctree::
:maxdepth: 4
pycgtool
pycgtool.bondset module
=======================
.. automodule:: pycgtool.bondset
:members:
:undoc-members:
:show-inheritance:
pycgtool.forcefield module
==========================
.. automodule:: pycgtool.forcefield
:members:
:undoc-members:
:show-inheritance:
pycgtool.frame module
=====================
.. automodule:: pycgtool.frame
:members:
:undoc-members:
:show-inheritance:
pycgtool.interface module
=========================
.. automodule:: pycgtool.interface
:members:
:undoc-members:
:show-inheritance:
pycgtool.mapping module
=======================
.. automodule:: pycgtool.mapping
:members:
:undoc-members:
:show-inheritance:
pycgtool.parsers.cfg module
===========================
.. automodule:: pycgtool.parsers.cfg
:members:
:undoc-members:
:show-inheritance:
pycgtool.parsers package
========================
Submodules
----------
.. toctree::
pycgtool.parsers.cfg
Module contents
---------------
.. automodule:: pycgtool.parsers
:members:
:undoc-members:
:show-inheritance:
pycgtool package
================
Subpackages
-----------
.. toctree::
pycgtool.parsers
Submodules
----------
.. toctree::
pycgtool.bondset
pycgtool.forcefield
pycgtool.frame
pycgtool.interface
pycgtool.mapping
pycgtool.util
pycgtool.warnings
Module contents
---------------
.. automodule:: pycgtool
:members:
:undoc-members:
:show-inheritance:
pycgtool.util module
====================
.. automodule:: pycgtool.util
:members:
:undoc-members:
:show-inheritance:
pycgtool.warnings module
========================
.. automodule:: pycgtool.warnings
:members:
:undoc-members:
:show-inheritance:
...@@ -13,7 +13,7 @@ def main(args, config): ...@@ -13,7 +13,7 @@ def main(args, config):
""" """
Main function of the program PyCGTOOL. Main function of the program PyCGTOOL.
Performs the complete AA->CG mapping and outputs a GROMACS forcefield directory. Performs the complete AA->CG mapping and outputs a files dependent on given input.
:param args: Arguments from argparse :param args: Arguments from argparse
:param config: Configuration dictionary :param config: Configuration dictionary
......
...@@ -128,15 +128,35 @@ class BondSet: ...@@ -128,15 +128,35 @@ class BondSet:
self._create_angles(mol.name, options.generate_dihedrals) self._create_angles(mol.name, options.generate_dihedrals)
def get_bond_lengths(self, mol, with_constr=False): def get_bond_lengths(self, mol, with_constr=False):
"""
Return list of all bond lengths in molecule. May include constraints.
:param mol: Molecule name to return bonds for
:param with_constr: Include constraints?
:return: List of bonds
"""
if with_constr: if with_constr:
return [bond for bond in self._molecules[mol] if len(bond.atoms) == 2] return [bond for bond in self._molecules[mol] if len(bond.atoms) == 2]
else: else:
return [bond for bond in self._molecules[mol] if len(bond.atoms) == 2 and bond.fconst < self._fconst_constr_threshold] return [bond for bond in self._molecules[mol] if len(bond.atoms) == 2 and bond.fconst < self._fconst_constr_threshold]
def get_bond_length_constraints(self, mol): def get_bond_length_constraints(self, mol):
"""
Return list of all bond length constraints in molecule.
:param mol: Molecule name to return bonds for
:return: List of bonds
"""
return [bond for bond in self._molecules[mol] if len(bond.atoms) == 2 and bond.fconst >= self._fconst_constr_threshold] return [bond for bond in self._molecules[mol] if len(bond.atoms) == 2 and bond.fconst >= self._fconst_constr_threshold]
def get_bond_angles(self, mol, exclude_triangle=True): def get_bond_angles(self, mol, exclude_triangle=True):
"""
Return list of all bond angles in molecule.
:param mol: Molecule name to return bonds for
:param exclude_triangle: Exclude angles that are part of a triangle?
:return: List of bonds
"""
angles = [bond for bond in self._molecules[mol] if len(bond.atoms) == 3] angles = [bond for bond in self._molecules[mol] if len(bond.atoms) == 3]
if exclude_triangle: if exclude_triangle:
...@@ -154,6 +174,12 @@ class BondSet: ...@@ -154,6 +174,12 @@ class BondSet:
return angles return angles
def get_bond_dihedrals(self, mol): def get_bond_dihedrals(self, mol):
"""
Return list of all bond dihedrals in molecule.
:param mol: Molecule name to return bonds for
:return: List of bonds
"""
return [bond for bond in self._molecules[mol] if len(bond.atoms) == 4] return [bond for bond in self._molecules[mol] if len(bond.atoms) == 4]
def _create_angles(self, mol, gen_dihedrals=False): def _create_angles(self, mol, gen_dihedrals=False):
...@@ -326,6 +352,11 @@ class BondSet: ...@@ -326,6 +352,11 @@ class BondSet:
angle_default_fc=self._angle_default_fc) angle_default_fc=self._angle_default_fc)
def dump_values(self, target_number=100000): def dump_values(self, target_number=100000):
"""
Output measured bond values to files for length, angles and dihedrals.
:param target_number: Approx number of sample measurements to output. If None, all samples will be output
"""
def transpose(bond_list): def transpose(bond_list):
""" """
Transpose a list of bonds containing values and slice to provide target number of rows. Transpose a list of bonds containing values and slice to provide target number of rows.
......
"""
This module contains classes for interaction at the terminal.
"""
import collections import collections
import curses import curses
import curses.textpad import curses.textpad
...@@ -7,8 +10,16 @@ import time ...@@ -7,8 +10,16 @@ import time
class Options: class Options:
""" """
Class to hold program options not specified at the initial command line. Class to hold program options not specified at the initial command line.
Values can be queried by indexing as a dictionary or by attribute. Iterable.
""" """
def __init__(self, default, args=None): def __init__(self, default, args=None):
"""
Create Options instance from iterable of keys and default values.
:param default: Iterable of key, default value pairs (e.g. list of tuples)
:param args: Optional program arguments from Argparse, will be displayed in interactive mode
"""
self._dict = collections.OrderedDict() self._dict = collections.OrderedDict()
for key, val in default: for key, val in default:
try: try:
...@@ -221,6 +232,11 @@ class Progress: ...@@ -221,6 +232,11 @@ class Progress:
return self return self
def __next__(self): def __next__(self):
"""
Allow iteration over Progress while testing prewhile and postwhile conditions.
:return: Iteration number
"""
if self._postwhile is not None and self._its > 0 and not self._postwhile(): if self._postwhile is not None and self._its > 0 and not self._postwhile():
self._stop() self._stop()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment