partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
Frames.delete_frames
Delete all frames.
gromacs/cbook.py
def delete_frames(self): """Delete all frames.""" for frame in glob.glob(self.frameglob): os.unlink(frame)
def delete_frames(self): """Delete all frames.""" for frame in glob.glob(self.frameglob): os.unlink(frame)
[ "Delete", "all", "frames", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L566-L569
[ "def", "delete_frames", "(", "self", ")", ":", "for", "frame", "in", "glob", ".", "glob", "(", "self", ".", "frameglob", ")", ":", "os", ".", "unlink", "(", "frame", ")" ]
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
IndexBuilder.gmx_resid
Returns resid in the Gromacs index by transforming with offset.
gromacs/cbook.py
def gmx_resid(self, resid): """Returns resid in the Gromacs index by transforming with offset.""" try: gmx_resid = int(self.offset[resid]) except (TypeError, IndexError): gmx_resid = resid + self.offset except KeyError: raise KeyError("offset must be a...
def gmx_resid(self, resid): """Returns resid in the Gromacs index by transforming with offset.""" try: gmx_resid = int(self.offset[resid]) except (TypeError, IndexError): gmx_resid = resid + self.offset except KeyError: raise KeyError("offset must be a...
[ "Returns", "resid", "in", "the", "Gromacs", "index", "by", "transforming", "with", "offset", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1321-L1329
[ "def", "gmx_resid", "(", "self", ",", "resid", ")", ":", "try", ":", "gmx_resid", "=", "int", "(", "self", ".", "offset", "[", "resid", "]", ")", "except", "(", "TypeError", ",", "IndexError", ")", ":", "gmx_resid", "=", "resid", "+", "self", ".", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
IndexBuilder.combine
Combine individual groups into a single one and write output. :Keywords: name_all : string Name of the combined group, ``None`` generates a name. [``None``] out_ndx : filename Name of the output file that will contain the individual groups and th...
gromacs/cbook.py
def combine(self, name_all=None, out_ndx=None, operation='|', defaultgroups=False): """Combine individual groups into a single one and write output. :Keywords: name_all : string Name of the combined group, ``None`` generates a name. [``None``] out_ndx : filename ...
def combine(self, name_all=None, out_ndx=None, operation='|', defaultgroups=False): """Combine individual groups into a single one and write output. :Keywords: name_all : string Name of the combined group, ``None`` generates a name. [``None``] out_ndx : filename ...
[ "Combine", "individual", "groups", "into", "a", "single", "one", "and", "write", "output", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1331-L1417
[ "def", "combine", "(", "self", ",", "name_all", "=", "None", ",", "out_ndx", "=", "None", ",", "operation", "=", "'|'", ",", "defaultgroups", "=", "False", ")", ":", "if", "not", "operation", "in", "(", "'|'", ",", "'&'", ",", "False", ")", ":", "r...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
IndexBuilder.write
Write individual (named) groups to *out_ndx*.
gromacs/cbook.py
def write(self, out_ndx=None, defaultgroups=False): """Write individual (named) groups to *out_ndx*.""" name_all, out_ndx = self.combine(operation=False, out_ndx=out_ndx, defaultgroups=defaultgroups) return out_ndx
def write(self, out_ndx=None, defaultgroups=False): """Write individual (named) groups to *out_ndx*.""" name_all, out_ndx = self.combine(operation=False, out_ndx=out_ndx, defaultgroups=defaultgroups) return out_ndx
[ "Write", "individual", "(", "named", ")", "groups", "to", "*", "out_ndx", "*", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1419-L1422
[ "def", "write", "(", "self", ",", "out_ndx", "=", "None", ",", "defaultgroups", "=", "False", ")", ":", "name_all", ",", "out_ndx", "=", "self", ".", "combine", "(", "operation", "=", "False", ",", "out_ndx", "=", "out_ndx", ",", "defaultgroups", "=", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
IndexBuilder.cat
Concatenate input index files. Generate a new index file that contains the default Gromacs index groups (if a structure file was defined) and all index groups from the input index files. :Arguments: out_ndx : filename Name of the output index file; if ``None`` ...
gromacs/cbook.py
def cat(self, out_ndx=None): """Concatenate input index files. Generate a new index file that contains the default Gromacs index groups (if a structure file was defined) and all index groups from the input index files. :Arguments: out_ndx : filename Nam...
def cat(self, out_ndx=None): """Concatenate input index files. Generate a new index file that contains the default Gromacs index groups (if a structure file was defined) and all index groups from the input index files. :Arguments: out_ndx : filename Nam...
[ "Concatenate", "input", "index", "files", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1424-L1439
[ "def", "cat", "(", "self", ",", "out_ndx", "=", "None", ")", ":", "if", "out_ndx", "is", "None", ":", "out_ndx", "=", "self", ".", "output", "self", ".", "make_ndx", "(", "o", "=", "out_ndx", ",", "input", "=", "[", "'q'", "]", ")", "return", "ou...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
IndexBuilder.parse_selection
Retuns (groupname, filename) with index group.
gromacs/cbook.py
def parse_selection(self, selection, name=None): """Retuns (groupname, filename) with index group.""" if type(selection) is tuple: # range process = self._process_range elif selection.startswith('@'): # verbatim make_ndx command process = self._pr...
def parse_selection(self, selection, name=None): """Retuns (groupname, filename) with index group.""" if type(selection) is tuple: # range process = self._process_range elif selection.startswith('@'): # verbatim make_ndx command process = self._pr...
[ "Retuns", "(", "groupname", "filename", ")", "with", "index", "group", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1441-L1453
[ "def", "parse_selection", "(", "self", ",", "selection", ",", "name", "=", "None", ")", ":", "if", "type", "(", "selection", ")", "is", "tuple", ":", "# range", "process", "=", "self", ".", "_process_range", "elif", "selection", ".", "startswith", "(", "...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
IndexBuilder._process_command
Process ``make_ndx`` command and return name and temp index file.
gromacs/cbook.py
def _process_command(self, command, name=None): """Process ``make_ndx`` command and return name and temp index file.""" self._command_counter += 1 if name is None: name = "CMD{0:03d}".format(self._command_counter) # Need to build it with two make_ndx calls because I cannot...
def _process_command(self, command, name=None): """Process ``make_ndx`` command and return name and temp index file.""" self._command_counter += 1 if name is None: name = "CMD{0:03d}".format(self._command_counter) # Need to build it with two make_ndx calls because I cannot...
[ "Process", "make_ndx", "command", "and", "return", "name", "and", "temp", "index", "file", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1455-L1484
[ "def", "_process_command", "(", "self", ",", "command", ",", "name", "=", "None", ")", ":", "self", ".", "_command_counter", "+=", "1", "if", "name", "is", "None", ":", "name", "=", "\"CMD{0:03d}\"", ".", "format", "(", "self", ".", "_command_counter", "...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
IndexBuilder._process_residue
Process residue/atom selection and return name and temp index file.
gromacs/cbook.py
def _process_residue(self, selection, name=None): """Process residue/atom selection and return name and temp index file.""" if name is None: name = selection.replace(':', '_') # XXX: use _translate_residue() .... m = self.RESIDUE.match(selection) if not m: ...
def _process_residue(self, selection, name=None): """Process residue/atom selection and return name and temp index file.""" if name is None: name = selection.replace(':', '_') # XXX: use _translate_residue() .... m = self.RESIDUE.match(selection) if not m: ...
[ "Process", "residue", "/", "atom", "selection", "and", "return", "name", "and", "temp", "index", "file", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1498-L1533
[ "def", "_process_residue", "(", "self", ",", "selection", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "selection", ".", "replace", "(", "':'", ",", "'_'", ")", "# XXX: use _translate_residue() ....", "m", "=", "self", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
IndexBuilder._process_range
Process a range selection. ("S234", "A300", "CA") --> selected all CA in this range ("S234", "A300") --> selected all atoms in this range .. Note:: Ignores residue type, only cares about the resid (but still required)
gromacs/cbook.py
def _process_range(self, selection, name=None): """Process a range selection. ("S234", "A300", "CA") --> selected all CA in this range ("S234", "A300") --> selected all atoms in this range .. Note:: Ignores residue type, only cares about the resid (but still required) ...
def _process_range(self, selection, name=None): """Process a range selection. ("S234", "A300", "CA") --> selected all CA in this range ("S234", "A300") --> selected all atoms in this range .. Note:: Ignores residue type, only cares about the resid (but still required) ...
[ "Process", "a", "range", "selection", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1535-L1572
[ "def", "_process_range", "(", "self", ",", "selection", ",", "name", "=", "None", ")", ":", "try", ":", "first", ",", "last", ",", "gmx_atomname", "=", "selection", "except", "ValueError", ":", "try", ":", "first", ",", "last", "=", "selection", "gmx_ato...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
IndexBuilder._translate_residue
Translate selection for a single res to make_ndx syntax.
gromacs/cbook.py
def _translate_residue(self, selection, default_atomname='CA'): """Translate selection for a single res to make_ndx syntax.""" m = self.RESIDUE.match(selection) if not m: errmsg = "Selection {selection!r} is not valid.".format(**vars()) logger.error(errmsg) ra...
def _translate_residue(self, selection, default_atomname='CA'): """Translate selection for a single res to make_ndx syntax.""" m = self.RESIDUE.match(selection) if not m: errmsg = "Selection {selection!r} is not valid.".format(**vars()) logger.error(errmsg) ra...
[ "Translate", "selection", "for", "a", "single", "res", "to", "make_ndx", "syntax", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1575-L1594
[ "def", "_translate_residue", "(", "self", ",", "selection", ",", "default_atomname", "=", "'CA'", ")", ":", "m", "=", "self", ".", "RESIDUE", ".", "match", "(", "selection", ")", "if", "not", "m", ":", "errmsg", "=", "\"Selection {selection!r} is not valid.\""...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
IndexBuilder.check_output
Simple tests to flag problems with a ``make_ndx`` run.
gromacs/cbook.py
def check_output(self, make_ndx_output, message=None, err=None): """Simple tests to flag problems with a ``make_ndx`` run.""" if message is None: message = "" else: message = '\n' + message def format(output, w=60): hrule = "====[ GromacsError (diagnos...
def check_output(self, make_ndx_output, message=None, err=None): """Simple tests to flag problems with a ``make_ndx`` run.""" if message is None: message = "" else: message = '\n' + message def format(output, w=60): hrule = "====[ GromacsError (diagnos...
[ "Simple", "tests", "to", "flag", "problems", "with", "a", "make_ndx", "run", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1598-L1622
[ "def", "check_output", "(", "self", ",", "make_ndx_output", ",", "message", "=", "None", ",", "err", "=", "None", ")", ":", "if", "message", "is", "None", ":", "message", "=", "\"\"", "else", ":", "message", "=", "'\\n'", "+", "message", "def", "format...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Transformer.outfile
Path for an output file. If :attr:`outdir` is set then the path is ``outdir/basename(p)`` else just ``p``
gromacs/cbook.py
def outfile(self, p): """Path for an output file. If :attr:`outdir` is set then the path is ``outdir/basename(p)`` else just ``p`` """ if self.outdir is not None: return os.path.join(self.outdir, os.path.basename(p)) else: return p
def outfile(self, p): """Path for an output file. If :attr:`outdir` is set then the path is ``outdir/basename(p)`` else just ``p`` """ if self.outdir is not None: return os.path.join(self.outdir, os.path.basename(p)) else: return p
[ "Path", "for", "an", "output", "file", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1707-L1716
[ "def", "outfile", "(", "self", ",", "p", ")", ":", "if", "self", ".", "outdir", "is", "not", "None", ":", "return", "os", ".", "path", ".", "join", "(", "self", ".", "outdir", ",", "os", ".", "path", ".", "basename", "(", "p", ")", ")", "else",...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Transformer.rp
Return canonical path to file under *dirname* with components *args* If *args* form an absolute path then just return it as the absolute path.
gromacs/cbook.py
def rp(self, *args): """Return canonical path to file under *dirname* with components *args* If *args* form an absolute path then just return it as the absolute path. """ try: p = os.path.join(*args) if os.path.isabs(p): return p except ...
def rp(self, *args): """Return canonical path to file under *dirname* with components *args* If *args* form an absolute path then just return it as the absolute path. """ try: p = os.path.join(*args) if os.path.isabs(p): return p except ...
[ "Return", "canonical", "path", "to", "file", "under", "*", "dirname", "*", "with", "components", "*", "args", "*" ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1718-L1729
[ "def", "rp", "(", "self", ",", "*", "args", ")", ":", "try", ":", "p", "=", "os", ".", "path", ".", "join", "(", "*", "args", ")", "if", "os", ".", "path", ".", "isabs", "(", "p", ")", ":", "return", "p", "except", "TypeError", ":", "pass", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Transformer.center_fit
Write compact xtc that is fitted to the tpr reference structure. See :func:`gromacs.cbook.trj_fitandcenter` for details and description of *kwargs* (including *input*, *input1*, *n* and *n1* for how to supply custom index groups). The most important ones are listed here but in most case...
gromacs/cbook.py
def center_fit(self, **kwargs): """Write compact xtc that is fitted to the tpr reference structure. See :func:`gromacs.cbook.trj_fitandcenter` for details and description of *kwargs* (including *input*, *input1*, *n* and *n1* for how to supply custom index groups). The most important on...
def center_fit(self, **kwargs): """Write compact xtc that is fitted to the tpr reference structure. See :func:`gromacs.cbook.trj_fitandcenter` for details and description of *kwargs* (including *input*, *input1*, *n* and *n1* for how to supply custom index groups). The most important on...
[ "Write", "compact", "xtc", "that", "is", "fitted", "to", "the", "tpr", "reference", "structure", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1731-L1770
[ "def", "center_fit", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'s'", ",", "self", ".", "tpr", ")", "kwargs", ".", "setdefault", "(", "'n'", ",", "self", ".", "ndx", ")", "kwargs", "[", "'f'", "]", "=", "se...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Transformer.fit
Write xtc that is fitted to the tpr reference structure. Runs :class:`gromacs.tools.trjconv` with appropriate arguments for fitting. The most important *kwargs* are listed here but in most cases the defaults should work. Note that the default settings do *not* include centering or ...
gromacs/cbook.py
def fit(self, xy=False, **kwargs): """Write xtc that is fitted to the tpr reference structure. Runs :class:`gromacs.tools.trjconv` with appropriate arguments for fitting. The most important *kwargs* are listed here but in most cases the defaults should work. Note that the defau...
def fit(self, xy=False, **kwargs): """Write xtc that is fitted to the tpr reference structure. Runs :class:`gromacs.tools.trjconv` with appropriate arguments for fitting. The most important *kwargs* are listed here but in most cases the defaults should work. Note that the defau...
[ "Write", "xtc", "that", "is", "fitted", "to", "the", "tpr", "reference", "structure", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1772-L1847
[ "def", "fit", "(", "self", ",", "xy", "=", "False", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'s'", ",", "self", ".", "tpr", ")", "kwargs", ".", "setdefault", "(", "'n'", ",", "self", ".", "ndx", ")", "kwargs", "[", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Transformer.strip_water
Write xtc and tpr with water (by resname) removed. :Keywords: *os* Name of the output tpr file; by default use the original but insert "nowater" before suffix. *o* Name of the output trajectory; by default use the original name but i...
gromacs/cbook.py
def strip_water(self, os=None, o=None, on=None, compact=False, resn="SOL", groupname="notwater", **kwargs): """Write xtc and tpr with water (by resname) removed. :Keywords: *os* Name of the output tpr file; by default use the original but inser...
def strip_water(self, os=None, o=None, on=None, compact=False, resn="SOL", groupname="notwater", **kwargs): """Write xtc and tpr with water (by resname) removed. :Keywords: *os* Name of the output tpr file; by default use the original but inser...
[ "Write", "xtc", "and", "tpr", "with", "water", "(", "by", "resname", ")", "removed", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L1849-L1965
[ "def", "strip_water", "(", "self", ",", "os", "=", "None", ",", "o", "=", "None", ",", "on", "=", "None", ",", "compact", "=", "False", ",", "resn", "=", "\"SOL\"", ",", "groupname", "=", "\"notwater\"", ",", "*", "*", "kwargs", ")", ":", "force", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Transformer.strip_fit
Strip water and fit to the remaining system. First runs :meth:`strip_water` and then :meth:`fit`; see there for arguments. - *strip_input* is used for :meth:`strip_water` (but is only useful in special cases, e.g. when there is no Protein group defined. Then set *strip_inpu...
gromacs/cbook.py
def strip_fit(self, **kwargs): """Strip water and fit to the remaining system. First runs :meth:`strip_water` and then :meth:`fit`; see there for arguments. - *strip_input* is used for :meth:`strip_water` (but is only useful in special cases, e.g. when there is no Protein gro...
def strip_fit(self, **kwargs): """Strip water and fit to the remaining system. First runs :meth:`strip_water` and then :meth:`fit`; see there for arguments. - *strip_input* is used for :meth:`strip_water` (but is only useful in special cases, e.g. when there is no Protein gro...
[ "Strip", "water", "and", "fit", "to", "the", "remaining", "system", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L2070-L2105
[ "def", "strip_fit", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'fit'", ",", "'rot+trans'", ")", "kw_fit", "=", "{", "}", "for", "k", "in", "(", "'xy'", ",", "'fit'", ",", "'fitgroup'", ",", "'input'", ")", ":...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Transformer._join_dirname
return os.path.join(os.path.dirname(args[0]), *args[1:])
gromacs/cbook.py
def _join_dirname(self, *args): """return os.path.join(os.path.dirname(args[0]), *args[1:])""" # extra function because I need to use it in a method that defines # the kwarg 'os', which collides with os.path... return os.path.join(os.path.dirname(args[0]), *args[1:])
def _join_dirname(self, *args): """return os.path.join(os.path.dirname(args[0]), *args[1:])""" # extra function because I need to use it in a method that defines # the kwarg 'os', which collides with os.path... return os.path.join(os.path.dirname(args[0]), *args[1:])
[ "return", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "args", "[", "0", "]", ")", "*", "args", "[", "1", ":", "]", ")" ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/cbook.py#L2107-L2111
[ "def", "_join_dirname", "(", "self", ",", "*", "args", ")", ":", "# extra function because I need to use it in a method that defines", "# the kwarg 'os', which collides with os.path...", "return", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
create
Create a top level logger. - The file logger logs everything (including DEBUG). - The console logger only logs INFO and above. Logging to a file and the console. See http://docs.python.org/library/logging.html?#logging-to-multiple-destinations The top level logger of the library is named...
gromacs/log.py
def create(logger_name, logfile='gromacs.log'): """Create a top level logger. - The file logger logs everything (including DEBUG). - The console logger only logs INFO and above. Logging to a file and the console. See http://docs.python.org/library/logging.html?#logging-to-multiple-destination...
def create(logger_name, logfile='gromacs.log'): """Create a top level logger. - The file logger logs everything (including DEBUG). - The console logger only logs INFO and above. Logging to a file and the console. See http://docs.python.org/library/logging.html?#logging-to-multiple-destination...
[ "Create", "a", "top", "level", "logger", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/log.py#L67-L102
[ "def", "create", "(", "logger_name", ",", "logfile", "=", "'gromacs.log'", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "logger_name", ")", "logger", ".", "setLevel", "(", "logging", ".", "DEBUG", ")", "logfile", "=", "logging", ".", "FileHan...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
_generate_template_dict
Generate a list of included files *and* extract them to a temp space. Templates have to be extracted from the egg because they are used by external code. All template filenames are stored in :data:`config.templates`.
gromacs/config.py
def _generate_template_dict(dirname): """Generate a list of included files *and* extract them to a temp space. Templates have to be extracted from the egg because they are used by external code. All template filenames are stored in :data:`config.templates`. """ return dict((resource_basename(fn...
def _generate_template_dict(dirname): """Generate a list of included files *and* extract them to a temp space. Templates have to be extracted from the egg because they are used by external code. All template filenames are stored in :data:`config.templates`. """ return dict((resource_basename(fn...
[ "Generate", "a", "list", "of", "included", "files", "*", "and", "*", "extract", "them", "to", "a", "temp", "space", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L345-L354
[ "def", "_generate_template_dict", "(", "dirname", ")", ":", "return", "dict", "(", "(", "resource_basename", "(", "fn", ")", ",", "resource_filename", "(", "__name__", ",", "dirname", "+", "'/'", "+", "fn", ")", ")", "for", "fn", "in", "resource_listdir", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
resource_basename
Last component of a resource (which always uses '/' as sep).
gromacs/config.py
def resource_basename(resource): """Last component of a resource (which always uses '/' as sep).""" if resource.endswith('/'): resource = resource[:-1] parts = resource.split('/') return parts[-1]
def resource_basename(resource): """Last component of a resource (which always uses '/' as sep).""" if resource.endswith('/'): resource = resource[:-1] parts = resource.split('/') return parts[-1]
[ "Last", "component", "of", "a", "resource", "(", "which", "always", "uses", "/", "as", "sep", ")", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L356-L361
[ "def", "resource_basename", "(", "resource", ")", ":", "if", "resource", ".", "endswith", "(", "'/'", ")", ":", "resource", "=", "resource", "[", ":", "-", "1", "]", "parts", "=", "resource", ".", "split", "(", "'/'", ")", "return", "parts", "[", "-"...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
get_template
Find template file *t* and return its real path. *t* can be a single string or a list of strings. A string should be one of 1. a relative or absolute path, 2. a file in one of the directories listed in :data:`gromacs.config.path`, 3. a filename in the package template directory (defined in the tem...
gromacs/config.py
def get_template(t): """Find template file *t* and return its real path. *t* can be a single string or a list of strings. A string should be one of 1. a relative or absolute path, 2. a file in one of the directories listed in :data:`gromacs.config.path`, 3. a filename in the package template d...
def get_template(t): """Find template file *t* and return its real path. *t* can be a single string or a list of strings. A string should be one of 1. a relative or absolute path, 2. a file in one of the directories listed in :data:`gromacs.config.path`, 3. a filename in the package template d...
[ "Find", "template", "file", "*", "t", "*", "and", "return", "its", "real", "path", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L401-L425
[ "def", "get_template", "(", "t", ")", ":", "templates", "=", "[", "_get_template", "(", "s", ")", "for", "s", "in", "utilities", ".", "asiterable", "(", "t", ")", "]", "if", "len", "(", "templates", ")", "==", "1", ":", "return", "templates", "[", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
_get_template
Return a single template *t*.
gromacs/config.py
def _get_template(t): """Return a single template *t*.""" if os.path.exists(t): # 1) Is it an accessible file? pass else: _t = t _t_found = False for d in path: # 2) search config.path p = os.path.join(d, _t) if os.path.e...
def _get_template(t): """Return a single template *t*.""" if os.path.exists(t): # 1) Is it an accessible file? pass else: _t = t _t_found = False for d in path: # 2) search config.path p = os.path.join(d, _t) if os.path.e...
[ "Return", "a", "single", "template", "*", "t", "*", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L448-L477
[ "def", "_get_template", "(", "t", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "t", ")", ":", "# 1) Is it an accessible file?", "pass", "else", ":", "_t", "=", "t", "_t_found", "=", "False", "for", "d", "in", "path", ":", "# 2) search config.pa...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
get_configuration
Reads and parses the configuration file. Default values are loaded and then replaced with the values from ``~/.gromacswrapper.cfg`` if that file exists. The global configuration instance :data:`gromacswrapper.config.cfg` is updated as are a number of global variables such as :data:`configdir`, :dat...
gromacs/config.py
def get_configuration(filename=CONFIGNAME): """Reads and parses the configuration file. Default values are loaded and then replaced with the values from ``~/.gromacswrapper.cfg`` if that file exists. The global configuration instance :data:`gromacswrapper.config.cfg` is updated as are a number of g...
def get_configuration(filename=CONFIGNAME): """Reads and parses the configuration file. Default values are loaded and then replaced with the values from ``~/.gromacswrapper.cfg`` if that file exists. The global configuration instance :data:`gromacswrapper.config.cfg` is updated as are a number of g...
[ "Reads", "and", "parses", "the", "configuration", "file", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L561-L583
[ "def", "get_configuration", "(", "filename", "=", "CONFIGNAME", ")", ":", "global", "cfg", ",", "configuration", "# very iffy --- most of the whole config mod should a class", "#: :data:`cfg` is the instance of :class:`GMXConfigParser` that makes all", "#: global configuration data acces...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
setup
Prepare a default GromacsWrapper global environment. 1) Create the global config file. 2) Create the directories in which the user can store template and config files. This function can be run repeatedly without harm.
gromacs/config.py
def setup(filename=CONFIGNAME): """Prepare a default GromacsWrapper global environment. 1) Create the global config file. 2) Create the directories in which the user can store template and config files. This function can be run repeatedly without harm. """ # setup() must be separate and ...
def setup(filename=CONFIGNAME): """Prepare a default GromacsWrapper global environment. 1) Create the global config file. 2) Create the directories in which the user can store template and config files. This function can be run repeatedly without harm. """ # setup() must be separate and ...
[ "Prepare", "a", "default", "GromacsWrapper", "global", "environment", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L594-L616
[ "def", "setup", "(", "filename", "=", "CONFIGNAME", ")", ":", "# setup() must be separate and NOT run automatically when config", "# is loaded so that easy_install installations work", "# (otherwise we get a sandbox violation)", "# populate cfg with defaults (or existing data)", "get_configu...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
check_setup
Check if templates directories are setup and issue a warning and help. Set the environment variable :envvar:`GROMACSWRAPPER_SUPPRESS_SETUP_CHECK` skip the check and make it always return ``True`` :return ``True`` if directories were found and ``False`` otherwise .. versionchanged:: 0.3.1 Us...
gromacs/config.py
def check_setup(): """Check if templates directories are setup and issue a warning and help. Set the environment variable :envvar:`GROMACSWRAPPER_SUPPRESS_SETUP_CHECK` skip the check and make it always return ``True`` :return ``True`` if directories were found and ``False`` otherwise .. versio...
def check_setup(): """Check if templates directories are setup and issue a warning and help. Set the environment variable :envvar:`GROMACSWRAPPER_SUPPRESS_SETUP_CHECK` skip the check and make it always return ``True`` :return ``True`` if directories were found and ``False`` otherwise .. versio...
[ "Check", "if", "templates", "directories", "are", "setup", "and", "issue", "a", "warning", "and", "help", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L619-L643
[ "def", "check_setup", "(", ")", ":", "if", "\"GROMACSWRAPPER_SUPPRESS_SETUP_CHECK\"", "in", "os", ".", "environ", ":", "return", "True", "missing", "=", "[", "d", "for", "d", "in", "config_directories", "if", "not", "os", ".", "path", ".", "exists", "(", "...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
set_gmxrc_environment
Set the environment from ``GMXRC`` provided in *gmxrc*. Runs ``GMXRC`` in a subprocess and puts environment variables loaded by it into this Python environment. If *gmxrc* evaluates to ``False`` then nothing is done. If errors occur then only a warning will be logged. Thus, it should be safe to just c...
gromacs/config.py
def set_gmxrc_environment(gmxrc): """Set the environment from ``GMXRC`` provided in *gmxrc*. Runs ``GMXRC`` in a subprocess and puts environment variables loaded by it into this Python environment. If *gmxrc* evaluates to ``False`` then nothing is done. If errors occur then only a warning will be ...
def set_gmxrc_environment(gmxrc): """Set the environment from ``GMXRC`` provided in *gmxrc*. Runs ``GMXRC`` in a subprocess and puts environment variables loaded by it into this Python environment. If *gmxrc* evaluates to ``False`` then nothing is done. If errors occur then only a warning will be ...
[ "Set", "the", "environment", "from", "GMXRC", "provided", "in", "*", "gmxrc", "*", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L646-L679
[ "def", "set_gmxrc_environment", "(", "gmxrc", ")", ":", "# only v5: 'GMXPREFIX', 'GROMACS_DIR'", "envvars", "=", "[", "'GMXBIN'", ",", "'GMXLDLIB'", ",", "'GMXMAN'", ",", "'GMXDATA'", ",", "'LD_LIBRARY_PATH'", ",", "'MANPATH'", ",", "'PKG_CONFIG_PATH'", ",", "'PATH'",...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
get_tool_names
Get tool names from all configured groups. :return: list of tool names
gromacs/config.py
def get_tool_names(): """ Get tool names from all configured groups. :return: list of tool names """ names = [] for group in cfg.get('Gromacs', 'groups').split(): names.extend(cfg.get('Gromacs', group).split()) return names
def get_tool_names(): """ Get tool names from all configured groups. :return: list of tool names """ names = [] for group in cfg.get('Gromacs', 'groups').split(): names.extend(cfg.get('Gromacs', group).split()) return names
[ "Get", "tool", "names", "from", "all", "configured", "groups", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L682-L690
[ "def", "get_tool_names", "(", ")", ":", "names", "=", "[", "]", "for", "group", "in", "cfg", ".", "get", "(", "'Gromacs'", ",", "'groups'", ")", ".", "split", "(", ")", ":", "names", ".", "extend", "(", "cfg", ".", "get", "(", "'Gromacs'", ",", "...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
GMXConfigParser.configuration
Dict of variables that we make available as globals in the module. Can be used as :: globals().update(GMXConfigParser.configuration) # update configdir, templatesdir ...
gromacs/config.py
def configuration(self): """Dict of variables that we make available as globals in the module. Can be used as :: globals().update(GMXConfigParser.configuration) # update configdir, templatesdir ... """ configuration = { 'configfilename': self....
def configuration(self): """Dict of variables that we make available as globals in the module. Can be used as :: globals().update(GMXConfigParser.configuration) # update configdir, templatesdir ... """ configuration = { 'configfilename': self....
[ "Dict", "of", "variables", "that", "we", "make", "available", "as", "globals", "in", "the", "module", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L526-L545
[ "def", "configuration", "(", "self", ")", ":", "configuration", "=", "{", "'configfilename'", ":", "self", ".", "filename", ",", "'logfilename'", ":", "self", ".", "getpath", "(", "'Logging'", ",", "'logfilename'", ")", ",", "'loglevel_console'", ":", "self", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
GMXConfigParser.getpath
Return option as an expanded path.
gromacs/config.py
def getpath(self, section, option): """Return option as an expanded path.""" return os.path.expanduser(os.path.expandvars(self.get(section, option)))
def getpath(self, section, option): """Return option as an expanded path.""" return os.path.expanduser(os.path.expandvars(self.get(section, option)))
[ "Return", "option", "as", "an", "expanded", "path", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L547-L549
[ "def", "getpath", "(", "self", ",", "section", ",", "option", ")", ":", "return", "os", ".", "path", ".", "expanduser", "(", "os", ".", "path", ".", "expandvars", "(", "self", ".", "get", "(", "section", ",", "option", ")", ")", ")" ]
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
GMXConfigParser.getLogLevel
Return the textual representation of logging level 'option' or the number. Note that option is always interpreted as an UPPERCASE string and hence integer log levels will not be recognized. .. SeeAlso: :mod:`logging` and :func:`logging.getLevelName`
gromacs/config.py
def getLogLevel(self, section, option): """Return the textual representation of logging level 'option' or the number. Note that option is always interpreted as an UPPERCASE string and hence integer log levels will not be recognized. .. SeeAlso: :mod:`logging` and :func:`logging...
def getLogLevel(self, section, option): """Return the textual representation of logging level 'option' or the number. Note that option is always interpreted as an UPPERCASE string and hence integer log levels will not be recognized. .. SeeAlso: :mod:`logging` and :func:`logging...
[ "Return", "the", "textual", "representation", "of", "logging", "level", "option", "or", "the", "number", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/config.py#L551-L559
[ "def", "getLogLevel", "(", "self", ",", "section", ",", "option", ")", ":", "return", "logging", ".", "getLevelName", "(", "self", ".", "get", "(", "section", ",", "option", ")", ".", "upper", "(", ")", ")" ]
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Collection.save
Pickle the whole collection to *filename*. If no extension is provided, ".collection" is appended.
gromacs/collections.py
def save(self, filename): """Pickle the whole collection to *filename*. If no extension is provided, ".collection" is appended. """ cPickle.dump(self, open(self._canonicalize(filename), 'wb'), protocol=cPickle.HIGHEST_PROTOCOL)
def save(self, filename): """Pickle the whole collection to *filename*. If no extension is provided, ".collection" is appended. """ cPickle.dump(self, open(self._canonicalize(filename), 'wb'), protocol=cPickle.HIGHEST_PROTOCOL)
[ "Pickle", "the", "whole", "collection", "to", "*", "filename", "*", ".", "If", "no", "extension", "is", "provided", ".", "collection", "is", "appended", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/collections.py#L46-L52
[ "def", "save", "(", "self", ",", "filename", ")", ":", "cPickle", ".", "dump", "(", "self", ",", "open", "(", "self", ".", "_canonicalize", "(", "filename", ")", ",", "'wb'", ")", ",", "protocol", "=", "cPickle", ".", "HIGHEST_PROTOCOL", ")" ]
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Collection.load
Load collection from pickled file *filename*. *append* determines if the saved collection is added to the current one or if it replaces the current content. If no extension is provided, ".collection" is appended.
gromacs/collections.py
def load(self, filename, append=False): """Load collection from pickled file *filename*. *append* determines if the saved collection is added to the current one or if it replaces the current content. If no extension is provided, ".collection" is appended. """ tmp = cPic...
def load(self, filename, append=False): """Load collection from pickled file *filename*. *append* determines if the saved collection is added to the current one or if it replaces the current content. If no extension is provided, ".collection" is appended. """ tmp = cPic...
[ "Load", "collection", "from", "pickled", "file", "*", "filename", "*", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/collections.py#L54-L67
[ "def", "load", "(", "self", ",", "filename", ",", "append", "=", "False", ")", ":", "tmp", "=", "cPickle", ".", "load", "(", "open", "(", "self", ".", "_canonicalize", "(", "filename", ")", ",", "'rb'", ")", ")", "if", "append", ":", "self", ".", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Collection._canonicalize
Use .collection as extension unless provided
gromacs/collections.py
def _canonicalize(self, filename): """Use .collection as extension unless provided""" path, ext = os.path.splitext(filename) if not ext: ext = ".collection" return path + ext
def _canonicalize(self, filename): """Use .collection as extension unless provided""" path, ext = os.path.splitext(filename) if not ext: ext = ".collection" return path + ext
[ "Use", ".", "collection", "as", "extension", "unless", "provided" ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/collections.py#L73-L78
[ "def", "_canonicalize", "(", "self", ",", "filename", ")", ":", "path", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "if", "not", "ext", ":", "ext", "=", "\".collection\"", "return", "path", "+", "ext" ]
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Flags.register
Register a new :class:`Flag` instance with the Flags registry.
gromacs/environment.py
def register(self,flag): """Register a new :class:`Flag` instance with the Flags registry.""" super(Flags,self).__setitem__(flag.name,flag)
def register(self,flag): """Register a new :class:`Flag` instance with the Flags registry.""" super(Flags,self).__setitem__(flag.name,flag)
[ "Register", "a", "new", ":", "class", ":", "Flag", "instance", "with", "the", "Flags", "registry", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/environment.py#L69-L71
[ "def", "register", "(", "self", ",", "flag", ")", ":", "super", "(", "Flags", ",", "self", ")", ".", "__setitem__", "(", "flag", ".", "name", ",", "flag", ")" ]
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Flags.update
Update Flags registry with a list of :class:`Flag` instances.
gromacs/environment.py
def update(self,*flags): """Update Flags registry with a list of :class:`Flag` instances.""" super(Flags,self).update([(flag.name,flag) for flag in flags])
def update(self,*flags): """Update Flags registry with a list of :class:`Flag` instances.""" super(Flags,self).update([(flag.name,flag) for flag in flags])
[ "Update", "Flags", "registry", "with", "a", "list", "of", ":", "class", ":", "Flag", "instances", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/environment.py#L72-L74
[ "def", "update", "(", "self", ",", "*", "flags", ")", ":", "super", "(", "Flags", ",", "self", ")", ".", "update", "(", "[", "(", "flag", ".", "name", ",", "flag", ")", "for", "flag", "in", "flags", "]", ")" ]
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
scale_dihedrals
Scale dihedral angles
gromacs/scaling.py
def scale_dihedrals(mol, dihedrals, scale, banned_lines=None): """Scale dihedral angles""" if banned_lines is None: banned_lines = [] new_dihedrals = [] for dh in mol.dihedrals: atypes = dh.atom1.get_atomtype(), dh.atom2.get_atomtype(), dh.atom3.get_atomt...
def scale_dihedrals(mol, dihedrals, scale, banned_lines=None): """Scale dihedral angles""" if banned_lines is None: banned_lines = [] new_dihedrals = [] for dh in mol.dihedrals: atypes = dh.atom1.get_atomtype(), dh.atom2.get_atomtype(), dh.atom3.get_atomt...
[ "Scale", "dihedral", "angles" ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/scaling.py#L36-L88
[ "def", "scale_dihedrals", "(", "mol", ",", "dihedrals", ",", "scale", ",", "banned_lines", "=", "None", ")", ":", "if", "banned_lines", "is", "None", ":", "banned_lines", "=", "[", "]", "new_dihedrals", "=", "[", "]", "for", "dh", "in", "mol", ".", "di...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
scale_impropers
Scale improper dihedrals
gromacs/scaling.py
def scale_impropers(mol, impropers, scale, banned_lines=None): """Scale improper dihedrals""" if banned_lines is None: banned_lines = [] new_impropers = [] for im in mol.impropers: atypes = (im.atom1.get_atomtype(), im.atom2.get_atomtype(), ...
def scale_impropers(mol, impropers, scale, banned_lines=None): """Scale improper dihedrals""" if banned_lines is None: banned_lines = [] new_impropers = [] for im in mol.impropers: atypes = (im.atom1.get_atomtype(), im.atom2.get_atomtype(), ...
[ "Scale", "improper", "dihedrals" ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/scaling.py#L90-L134
[ "def", "scale_impropers", "(", "mol", ",", "impropers", ",", "scale", ",", "banned_lines", "=", "None", ")", ":", "if", "banned_lines", "is", "None", ":", "banned_lines", "=", "[", "]", "new_impropers", "=", "[", "]", "for", "im", "in", "mol", ".", "im...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
partial_tempering
Set up topology for partial tempering (REST2) replica exchange. .. versionchanged:: 0.7.0 Use keyword arguments instead of an `args` Namespace object.
gromacs/scaling.py
def partial_tempering(topfile="processed.top", outfile="scaled.top", banned_lines='', scale_lipids=1.0, scale_protein=1.0): """Set up topology for partial tempering (REST2) replica exchange. .. versionchanged:: 0.7.0 Use keyword arguments instead of an `args` Namespace...
def partial_tempering(topfile="processed.top", outfile="scaled.top", banned_lines='', scale_lipids=1.0, scale_protein=1.0): """Set up topology for partial tempering (REST2) replica exchange. .. versionchanged:: 0.7.0 Use keyword arguments instead of an `args` Namespace...
[ "Set", "up", "topology", "for", "partial", "tempering", "(", "REST2", ")", "replica", "exchange", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/scaling.py#L137-L266
[ "def", "partial_tempering", "(", "topfile", "=", "\"processed.top\"", ",", "outfile", "=", "\"scaled.top\"", ",", "banned_lines", "=", "''", ",", "scale_lipids", "=", "1.0", ",", "scale_protein", "=", "1.0", ")", ":", "banned_lines", "=", "map", "(", "int", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
to_unicode
Convert obj to unicode (if it can be be converted). Conversion is only attempted if `obj` is a string type (as determined by :data:`six.string_types`). .. versionchanged:: 0.7.0 removed `encoding keyword argument
gromacs/fileformats/convert.py
def to_unicode(obj): """Convert obj to unicode (if it can be be converted). Conversion is only attempted if `obj` is a string type (as determined by :data:`six.string_types`). .. versionchanged:: 0.7.0 removed `encoding keyword argument """ if not isinstance(obj, six.string_types): ...
def to_unicode(obj): """Convert obj to unicode (if it can be be converted). Conversion is only attempted if `obj` is a string type (as determined by :data:`six.string_types`). .. versionchanged:: 0.7.0 removed `encoding keyword argument """ if not isinstance(obj, six.string_types): ...
[ "Convert", "obj", "to", "unicode", "(", "if", "it", "can", "be", "be", "converted", ")", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/convert.py#L45-L62
[ "def", "to_unicode", "(", "obj", ")", ":", "if", "not", "isinstance", "(", "obj", ",", "six", ".", "string_types", ")", ":", "return", "obj", "try", ":", "obj", "=", "six", ".", "text_type", "(", "obj", ")", "except", "TypeError", ":", "pass", "retur...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
besttype
Convert string x to the most useful type, i.e. int, float or unicode string. If x is a quoted string (single or double quotes) then the quotes are stripped and the enclosed string returned. .. Note:: Strings will be returned as Unicode strings (using :func:`to_unicode`). .. versionchanged:: 0...
gromacs/fileformats/convert.py
def besttype(x): """Convert string x to the most useful type, i.e. int, float or unicode string. If x is a quoted string (single or double quotes) then the quotes are stripped and the enclosed string returned. .. Note:: Strings will be returned as Unicode strings (using :func:`to_unicode`). ...
def besttype(x): """Convert string x to the most useful type, i.e. int, float or unicode string. If x is a quoted string (single or double quotes) then the quotes are stripped and the enclosed string returned. .. Note:: Strings will be returned as Unicode strings (using :func:`to_unicode`). ...
[ "Convert", "string", "x", "to", "the", "most", "useful", "type", "i", ".", "e", ".", "int", "float", "or", "unicode", "string", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/convert.py#L191-L220
[ "def", "besttype", "(", "x", ")", ":", "x", "=", "to_unicode", "(", "x", ")", "# make unicode as soon as possible", "try", ":", "x", "=", "x", ".", "strip", "(", ")", "except", "AttributeError", ":", "pass", "m", "=", "re", ".", "match", "(", "r\"\"\"[...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
to_int64
Return view of the recarray with all int32 cast to int64.
gromacs/fileformats/convert.py
def to_int64(a): """Return view of the recarray with all int32 cast to int64.""" # build new dtype and replace i4 --> i8 def promote_i4(typestr): if typestr[1:] == 'i4': typestr = typestr[0]+'i8' return typestr dtype = [(name, promote_i4(typestr)) for name,typestr in a.dtype...
def to_int64(a): """Return view of the recarray with all int32 cast to int64.""" # build new dtype and replace i4 --> i8 def promote_i4(typestr): if typestr[1:] == 'i4': typestr = typestr[0]+'i8' return typestr dtype = [(name, promote_i4(typestr)) for name,typestr in a.dtype...
[ "Return", "view", "of", "the", "recarray", "with", "all", "int32", "cast", "to", "int64", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/convert.py#L223-L232
[ "def", "to_int64", "(", "a", ")", ":", "# build new dtype and replace i4 --> i8", "def", "promote_i4", "(", "typestr", ")", ":", "if", "typestr", "[", "1", ":", "]", "==", "'i4'", ":", "typestr", "=", "typestr", "[", "0", "]", "+", "'i8'", "return", "typ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
irecarray_to_py
Slow conversion of a recarray into a list of records with python types. Get the field names from :attr:`a.dtype.names`. :Returns: iterator so that one can handle big input arrays
gromacs/fileformats/convert.py
def irecarray_to_py(a): """Slow conversion of a recarray into a list of records with python types. Get the field names from :attr:`a.dtype.names`. :Returns: iterator so that one can handle big input arrays """ pytypes = [pyify(typestr) for name,typestr in a.dtype.descr] def convert_record(r): ...
def irecarray_to_py(a): """Slow conversion of a recarray into a list of records with python types. Get the field names from :attr:`a.dtype.names`. :Returns: iterator so that one can handle big input arrays """ pytypes = [pyify(typestr) for name,typestr in a.dtype.descr] def convert_record(r): ...
[ "Slow", "conversion", "of", "a", "recarray", "into", "a", "list", "of", "records", "with", "python", "types", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/convert.py#L247-L257
[ "def", "irecarray_to_py", "(", "a", ")", ":", "pytypes", "=", "[", "pyify", "(", "typestr", ")", "for", "name", ",", "typestr", "in", "a", ".", "dtype", ".", "descr", "]", "def", "convert_record", "(", "r", ")", ":", "return", "tuple", "(", "[", "c...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Autoconverter._convert_fancy
Convert to a list (sep != None) and convert list elements.
gromacs/fileformats/convert.py
def _convert_fancy(self, field): """Convert to a list (sep != None) and convert list elements.""" if self.sep is False: x = self._convert_singlet(field) else: x = tuple([self._convert_singlet(s) for s in field.split(self.sep)]) if len(x) == 0: ...
def _convert_fancy(self, field): """Convert to a list (sep != None) and convert list elements.""" if self.sep is False: x = self._convert_singlet(field) else: x = tuple([self._convert_singlet(s) for s in field.split(self.sep)]) if len(x) == 0: ...
[ "Convert", "to", "a", "list", "(", "sep", "!", "=", "None", ")", "and", "convert", "list", "elements", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/convert.py#L178-L189
[ "def", "_convert_fancy", "(", "self", ",", "field", ")", ":", "if", "self", ".", "sep", "is", "False", ":", "x", "=", "self", ".", "_convert_singlet", "(", "field", ")", "else", ":", "x", "=", "tuple", "(", "[", "self", ".", "_convert_singlet", "(", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
XPM.parse
Parse the xpm file and populate :attr:`XPM.array`.
gromacs/fileformats/xpm.py
def parse(self): """Parse the xpm file and populate :attr:`XPM.array`.""" with utilities.openany(self.real_filename) as xpm: # Read in lines until we find the start of the array meta = [xpm.readline()] while not meta[-1].startswith("static char *gromacs_xpm[]"): ...
def parse(self): """Parse the xpm file and populate :attr:`XPM.array`.""" with utilities.openany(self.real_filename) as xpm: # Read in lines until we find the start of the array meta = [xpm.readline()] while not meta[-1].startswith("static char *gromacs_xpm[]"): ...
[ "Parse", "the", "xpm", "file", "and", "populate", ":", "attr", ":", "XPM", ".", "array", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/xpm.py#L182-L254
[ "def", "parse", "(", "self", ")", ":", "with", "utilities", ".", "openany", "(", "self", ".", "real_filename", ")", "as", "xpm", ":", "# Read in lines until we find the start of the array", "meta", "=", "[", "xpm", ".", "readline", "(", ")", "]", "while", "n...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
XPM.col
Parse colour specification
gromacs/fileformats/xpm.py
def col(self, c): """Parse colour specification""" m = self.COLOUR.search(c) if not m: self.logger.fatal("Cannot parse colour specification %r.", c) raise ParseError("XPM reader: Cannot parse colour specification {0!r}.".format(c)) value = m.group('value') ...
def col(self, c): """Parse colour specification""" m = self.COLOUR.search(c) if not m: self.logger.fatal("Cannot parse colour specification %r.", c) raise ParseError("XPM reader: Cannot parse colour specification {0!r}.".format(c)) value = m.group('value') ...
[ "Parse", "colour", "specification" ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/xpm.py#L267-L276
[ "def", "col", "(", "self", ",", "c", ")", ":", "m", "=", "self", ".", "COLOUR", ".", "search", "(", "c", ")", "if", "not", "m", ":", "self", ".", "logger", ".", "fatal", "(", "\"Cannot parse colour specification %r.\"", ",", "c", ")", "raise", "Parse...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Command.run
Run the command; args/kwargs are added or replace the ones given to the constructor.
gromacs/core.py
def run(self, *args, **kwargs): """Run the command; args/kwargs are added or replace the ones given to the constructor.""" _args, _kwargs = self._combine_arglist(args, kwargs) results, p = self._run_command(*_args, **_kwargs) return results
def run(self, *args, **kwargs): """Run the command; args/kwargs are added or replace the ones given to the constructor.""" _args, _kwargs = self._combine_arglist(args, kwargs) results, p = self._run_command(*_args, **_kwargs) return results
[ "Run", "the", "command", ";", "args", "/", "kwargs", "are", "added", "or", "replace", "the", "ones", "given", "to", "the", "constructor", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L175-L179
[ "def", "run", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "_args", ",", "_kwargs", "=", "self", ".", "_combine_arglist", "(", "args", ",", "kwargs", ")", "results", ",", "p", "=", "self", ".", "_run_command", "(", "*", "_args"...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Command._combine_arglist
Combine the default values and the supplied values.
gromacs/core.py
def _combine_arglist(self, args, kwargs): """Combine the default values and the supplied values.""" _args = self.args + args _kwargs = self.kwargs.copy() _kwargs.update(kwargs) return _args, _kwargs
def _combine_arglist(self, args, kwargs): """Combine the default values and the supplied values.""" _args = self.args + args _kwargs = self.kwargs.copy() _kwargs.update(kwargs) return _args, _kwargs
[ "Combine", "the", "default", "values", "and", "the", "supplied", "values", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L181-L186
[ "def", "_combine_arglist", "(", "self", ",", "args", ",", "kwargs", ")", ":", "_args", "=", "self", ".", "args", "+", "args", "_kwargs", "=", "self", ".", "kwargs", ".", "copy", "(", ")", "_kwargs", ".", "update", "(", "kwargs", ")", "return", "_args...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Command._run_command
Execute the command; see the docs for __call__. :Returns: a tuple of the *results* tuple ``(rc, stdout, stderr)`` and the :class:`Popen` instance.
gromacs/core.py
def _run_command(self, *args, **kwargs): """Execute the command; see the docs for __call__. :Returns: a tuple of the *results* tuple ``(rc, stdout, stderr)`` and the :class:`Popen` instance. """ # hack to run command WITHOUT input (-h...) even though user defined ...
def _run_command(self, *args, **kwargs): """Execute the command; see the docs for __call__. :Returns: a tuple of the *results* tuple ``(rc, stdout, stderr)`` and the :class:`Popen` instance. """ # hack to run command WITHOUT input (-h...) even though user defined ...
[ "Execute", "the", "command", ";", "see", "the", "docs", "for", "__call__", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L188-L231
[ "def", "_run_command", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# hack to run command WITHOUT input (-h...) even though user defined", "# input (should have named it \"ignore_input\" with opposite values...)", "use_input", "=", "kwargs", ".", "pop", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Command._commandline
Returns the command line (without pipes) as a list.
gromacs/core.py
def _commandline(self, *args, **kwargs): """Returns the command line (without pipes) as a list.""" # transform_args() is a hook (used in GromacsCommand very differently!) return [self.command_name] + self.transform_args(*args, **kwargs)
def _commandline(self, *args, **kwargs): """Returns the command line (without pipes) as a list.""" # transform_args() is a hook (used in GromacsCommand very differently!) return [self.command_name] + self.transform_args(*args, **kwargs)
[ "Returns", "the", "command", "line", "(", "without", "pipes", ")", "as", "a", "list", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L233-L236
[ "def", "_commandline", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# transform_args() is a hook (used in GromacsCommand very differently!)", "return", "[", "self", ".", "command_name", "]", "+", "self", ".", "transform_args", "(", "*", "args...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Command.commandline
Returns the commandline that run() uses (without pipes).
gromacs/core.py
def commandline(self, *args, **kwargs): """Returns the commandline that run() uses (without pipes).""" # this mirrors the setup in run() _args, _kwargs = self._combine_arglist(args, kwargs) return self._commandline(*_args, **_kwargs)
def commandline(self, *args, **kwargs): """Returns the commandline that run() uses (without pipes).""" # this mirrors the setup in run() _args, _kwargs = self._combine_arglist(args, kwargs) return self._commandline(*_args, **_kwargs)
[ "Returns", "the", "commandline", "that", "run", "()", "uses", "(", "without", "pipes", ")", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L238-L242
[ "def", "commandline", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# this mirrors the setup in run()", "_args", ",", "_kwargs", "=", "self", ".", "_combine_arglist", "(", "args", ",", "kwargs", ")", "return", "self", ".", "_commandline"...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Command.Popen
Returns a special Popen instance (:class:`PopenWithInput`). The instance has its input pre-set so that calls to :meth:`~PopenWithInput.communicate` will not need to supply input. This is necessary if one wants to chain the output from one command to an input from another. :TODO...
gromacs/core.py
def Popen(self, *args, **kwargs): """Returns a special Popen instance (:class:`PopenWithInput`). The instance has its input pre-set so that calls to :meth:`~PopenWithInput.communicate` will not need to supply input. This is necessary if one wants to chain the output from one com...
def Popen(self, *args, **kwargs): """Returns a special Popen instance (:class:`PopenWithInput`). The instance has its input pre-set so that calls to :meth:`~PopenWithInput.communicate` will not need to supply input. This is necessary if one wants to chain the output from one com...
[ "Returns", "a", "special", "Popen", "instance", "(", ":", "class", ":", "PopenWithInput", ")", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L244-L299
[ "def", "Popen", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "stderr", "=", "kwargs", ".", "pop", "(", "'stderr'", ",", "None", ")", "# default: print to stderr (if STDOUT then merge)", "if", "stderr", "is", "False", ":", "# False: captu...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Command.transform_args
Transform arguments and return them as a list suitable for Popen.
gromacs/core.py
def transform_args(self, *args, **kwargs): """Transform arguments and return them as a list suitable for Popen.""" options = [] for option,value in kwargs.items(): if not option.startswith('-'): # heuristic for turning key=val pairs into options # (fai...
def transform_args(self, *args, **kwargs): """Transform arguments and return them as a list suitable for Popen.""" options = [] for option,value in kwargs.items(): if not option.startswith('-'): # heuristic for turning key=val pairs into options # (fai...
[ "Transform", "arguments", "and", "return", "them", "as", "a", "list", "suitable", "for", "Popen", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L301-L322
[ "def", "transform_args", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "options", "=", "[", "]", "for", "option", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "if", "not", "option", ".", "startswith", "(", "'-'", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Command.help
Print help; same as using ``?`` in ``ipython``. long=True also gives call signature.
gromacs/core.py
def help(self, long=False): """Print help; same as using ``?`` in ``ipython``. long=True also gives call signature.""" print("\ncommand: {0!s}\n\n".format(self.command_name)) print(self.__doc__) if long: print("\ncall method: command():\n") print(self.__call__.__d...
def help(self, long=False): """Print help; same as using ``?`` in ``ipython``. long=True also gives call signature.""" print("\ncommand: {0!s}\n\n".format(self.command_name)) print(self.__doc__) if long: print("\ncall method: command():\n") print(self.__call__.__d...
[ "Print", "help", ";", "same", "as", "using", "?", "in", "ipython", ".", "long", "=", "True", "also", "gives", "call", "signature", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L324-L330
[ "def", "help", "(", "self", ",", "long", "=", "False", ")", ":", "print", "(", "\"\\ncommand: {0!s}\\n\\n\"", ".", "format", "(", "self", ".", "command_name", ")", ")", "print", "(", "self", ".", "__doc__", ")", "if", "long", ":", "print", "(", "\"\\nc...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
GromacsCommand._combine_arglist
Combine the default values and the supplied values.
gromacs/core.py
def _combine_arglist(self, args, kwargs): """Combine the default values and the supplied values.""" gmxargs = self.gmxargs.copy() gmxargs.update(self._combineargs(*args, **kwargs)) return (), gmxargs
def _combine_arglist(self, args, kwargs): """Combine the default values and the supplied values.""" gmxargs = self.gmxargs.copy() gmxargs.update(self._combineargs(*args, **kwargs)) return (), gmxargs
[ "Combine", "the", "default", "values", "and", "the", "supplied", "values", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L546-L550
[ "def", "_combine_arglist", "(", "self", ",", "args", ",", "kwargs", ")", ":", "gmxargs", "=", "self", ".", "gmxargs", ".", "copy", "(", ")", "gmxargs", ".", "update", "(", "self", ".", "_combineargs", "(", "*", "args", ",", "*", "*", "kwargs", ")", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
GromacsCommand._combineargs
Add switches as 'options' with value True to the options dict.
gromacs/core.py
def _combineargs(self, *args, **kwargs): """Add switches as 'options' with value True to the options dict.""" d = {arg: True for arg in args} # switches are kwargs with value True d.update(kwargs) return d
def _combineargs(self, *args, **kwargs): """Add switches as 'options' with value True to the options dict.""" d = {arg: True for arg in args} # switches are kwargs with value True d.update(kwargs) return d
[ "Add", "switches", "as", "options", "with", "value", "True", "to", "the", "options", "dict", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L575-L579
[ "def", "_combineargs", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "d", "=", "{", "arg", ":", "True", "for", "arg", "in", "args", "}", "# switches are kwargs with value True", "d", ".", "update", "(", "kwargs", ")", "return", "d" ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
GromacsCommand._build_arg_list
Build list of arguments from the dict; keys must be valid gromacs flags.
gromacs/core.py
def _build_arg_list(self, **kwargs): """Build list of arguments from the dict; keys must be valid gromacs flags.""" arglist = [] for flag, value in kwargs.items(): # XXX: check flag against allowed values flag = str(flag) if flag.startswith('_'): ...
def _build_arg_list(self, **kwargs): """Build list of arguments from the dict; keys must be valid gromacs flags.""" arglist = [] for flag, value in kwargs.items(): # XXX: check flag against allowed values flag = str(flag) if flag.startswith('_'): ...
[ "Build", "list", "of", "arguments", "from", "the", "dict", ";", "keys", "must", "be", "valid", "gromacs", "flags", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L581-L606
[ "def", "_build_arg_list", "(", "self", ",", "*", "*", "kwargs", ")", ":", "arglist", "=", "[", "]", "for", "flag", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "# XXX: check flag against allowed values", "flag", "=", "str", "(", "flag", ")"...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
GromacsCommand._run_command
Execute the gromacs command; see the docs for __call__.
gromacs/core.py
def _run_command(self,*args,**kwargs): """Execute the gromacs command; see the docs for __call__.""" result, p = super(GromacsCommand, self)._run_command(*args, **kwargs) self.check_failure(result, command_string=p.command_string) return result, p
def _run_command(self,*args,**kwargs): """Execute the gromacs command; see the docs for __call__.""" result, p = super(GromacsCommand, self)._run_command(*args, **kwargs) self.check_failure(result, command_string=p.command_string) return result, p
[ "Execute", "the", "gromacs", "command", ";", "see", "the", "docs", "for", "__call__", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L608-L612
[ "def", "_run_command", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "result", ",", "p", "=", "super", "(", "GromacsCommand", ",", "self", ")", ".", "_run_command", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
GromacsCommand._commandline
Returns the command line (without pipes) as a list. Inserts driver if present
gromacs/core.py
def _commandline(self, *args, **kwargs): """Returns the command line (without pipes) as a list. Inserts driver if present""" if(self.driver is not None): return [self.driver, self.command_name] + self.transform_args(*args, **kwargs) return [self.command_name] + self.transform_args(*a...
def _commandline(self, *args, **kwargs): """Returns the command line (without pipes) as a list. Inserts driver if present""" if(self.driver is not None): return [self.driver, self.command_name] + self.transform_args(*args, **kwargs) return [self.command_name] + self.transform_args(*a...
[ "Returns", "the", "command", "line", "(", "without", "pipes", ")", "as", "a", "list", ".", "Inserts", "driver", "if", "present" ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L614-L618
[ "def", "_commandline", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "(", "self", ".", "driver", "is", "not", "None", ")", ":", "return", "[", "self", ".", "driver", ",", "self", ".", "command_name", "]", "+", "self", "....
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
GromacsCommand.transform_args
Combine arguments and turn them into gromacs tool arguments.
gromacs/core.py
def transform_args(self,*args,**kwargs): """Combine arguments and turn them into gromacs tool arguments.""" newargs = self._combineargs(*args, **kwargs) return self._build_arg_list(**newargs)
def transform_args(self,*args,**kwargs): """Combine arguments and turn them into gromacs tool arguments.""" newargs = self._combineargs(*args, **kwargs) return self._build_arg_list(**newargs)
[ "Combine", "arguments", "and", "turn", "them", "into", "gromacs", "tool", "arguments", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L621-L624
[ "def", "transform_args", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "newargs", "=", "self", ".", "_combineargs", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "self", ".", "_build_arg_list", "(", "*", "*", "newargs"...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
GromacsCommand._get_gmx_docs
Extract standard gromacs doc Extract by running the program and chopping the header to keep from 'DESCRIPTION' onwards.
gromacs/core.py
def _get_gmx_docs(self): """Extract standard gromacs doc Extract by running the program and chopping the header to keep from 'DESCRIPTION' onwards. """ if self._doc_cache is not None: return self._doc_cache try: logging.disable(logging.CRITICAL) ...
def _get_gmx_docs(self): """Extract standard gromacs doc Extract by running the program and chopping the header to keep from 'DESCRIPTION' onwards. """ if self._doc_cache is not None: return self._doc_cache try: logging.disable(logging.CRITICAL) ...
[ "Extract", "standard", "gromacs", "doc" ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L626-L657
[ "def", "_get_gmx_docs", "(", "self", ")", ":", "if", "self", ".", "_doc_cache", "is", "not", "None", ":", "return", "self", ".", "_doc_cache", "try", ":", "logging", ".", "disable", "(", "logging", ".", "CRITICAL", ")", "rc", ",", "header", ",", "docs"...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
PopenWithInput.communicate
Run the command, using the input that was set up on __init__ (for *use_input* = ``True``)
gromacs/core.py
def communicate(self, use_input=True): """Run the command, using the input that was set up on __init__ (for *use_input* = ``True``)""" if use_input: return super(PopenWithInput, self).communicate(self.input) else: return super(PopenWithInput, self).communicate()
def communicate(self, use_input=True): """Run the command, using the input that was set up on __init__ (for *use_input* = ``True``)""" if use_input: return super(PopenWithInput, self).communicate(self.input) else: return super(PopenWithInput, self).communicate()
[ "Run", "the", "command", "using", "the", "input", "that", "was", "set", "up", "on", "__init__", "(", "for", "*", "use_input", "*", "=", "True", ")" ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/core.py#L702-L707
[ "def", "communicate", "(", "self", ",", "use_input", "=", "True", ")", ":", "if", "use_input", ":", "return", "super", "(", "PopenWithInput", ",", "self", ")", ".", "communicate", "(", "self", ".", "input", ")", "else", ":", "return", "super", "(", "Po...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
autoconvert
Convert input to a numerical type if possible. 1. A non-string object is returned as it is 2. Try conversion to int, float, str.
gromacs/utilities.py
def autoconvert(s): """Convert input to a numerical type if possible. 1. A non-string object is returned as it is 2. Try conversion to int, float, str. """ if type(s) is not str: return s for converter in int, float, str: # try them in increasing order of lenience try: ...
def autoconvert(s): """Convert input to a numerical type if possible. 1. A non-string object is returned as it is 2. Try conversion to int, float, str. """ if type(s) is not str: return s for converter in int, float, str: # try them in increasing order of lenience try: ...
[ "Convert", "input", "to", "a", "numerical", "type", "if", "possible", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L138-L155
[ "def", "autoconvert", "(", "s", ")", ":", "if", "type", "(", "s", ")", "is", "not", "str", ":", "return", "s", "for", "converter", "in", "int", ",", "float", ",", "str", ":", "# try them in increasing order of lenience", "try", ":", "s", "=", "[", "con...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
openany
Context manager for :func:`anyopen`. Open the `datasource` and close it when the context of the :keyword:`with` statement exits. `datasource` can be a filename or a stream (see :func:`isstream`). A stream is reset to its start if possible (via :meth:`~io.IOBase.seek` or :meth:`~cString.StringIO.re...
gromacs/utilities.py
def openany(datasource, mode='rt', reset=True): """Context manager for :func:`anyopen`. Open the `datasource` and close it when the context of the :keyword:`with` statement exits. `datasource` can be a filename or a stream (see :func:`isstream`). A stream is reset to its start if possible (via :me...
def openany(datasource, mode='rt', reset=True): """Context manager for :func:`anyopen`. Open the `datasource` and close it when the context of the :keyword:`with` statement exits. `datasource` can be a filename or a stream (see :func:`isstream`). A stream is reset to its start if possible (via :me...
[ "Context", "manager", "for", ":", "func", ":", "anyopen", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L158-L207
[ "def", "openany", "(", "datasource", ",", "mode", "=", "'rt'", ",", "reset", "=", "True", ")", ":", "stream", "=", "anyopen", "(", "datasource", ",", "mode", "=", "mode", ",", "reset", "=", "reset", ")", "try", ":", "yield", "stream", "finally", ":",...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
anyopen
Open datasource (gzipped, bzipped, uncompressed) and return a stream. `datasource` can be a filename or a stream (see :func:`isstream`). By default, a stream is reset to its start if possible (via :meth:`~io.IOBase.seek` or :meth:`~cString.StringIO.reset`). If possible, the attribute ``stream.name`` i...
gromacs/utilities.py
def anyopen(datasource, mode='rt', reset=True): """Open datasource (gzipped, bzipped, uncompressed) and return a stream. `datasource` can be a filename or a stream (see :func:`isstream`). By default, a stream is reset to its start if possible (via :meth:`~io.IOBase.seek` or :meth:`~cString.StringIO.res...
def anyopen(datasource, mode='rt', reset=True): """Open datasource (gzipped, bzipped, uncompressed) and return a stream. `datasource` can be a filename or a stream (see :func:`isstream`). By default, a stream is reset to its start if possible (via :meth:`~io.IOBase.seek` or :meth:`~cString.StringIO.res...
[ "Open", "datasource", "(", "gzipped", "bzipped", "uncompressed", ")", "and", "return", "a", "stream", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L229-L314
[ "def", "anyopen", "(", "datasource", ",", "mode", "=", "'rt'", ",", "reset", "=", "True", ")", ":", "handlers", "=", "{", "'bz2'", ":", "bz2_open", ",", "'gz'", ":", "gzip", ".", "open", ",", "''", ":", "open", "}", "if", "mode", ".", "startswith",...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
_get_stream
Return open stream if *filename* can be opened with *openfunction* or else ``None``.
gromacs/utilities.py
def _get_stream(filename, openfunction=open, mode='r'): """Return open stream if *filename* can be opened with *openfunction* or else ``None``.""" try: stream = openfunction(filename, mode=mode) except (IOError, OSError) as err: # An exception might be raised due to two reasons, first the op...
def _get_stream(filename, openfunction=open, mode='r'): """Return open stream if *filename* can be opened with *openfunction* or else ``None``.""" try: stream = openfunction(filename, mode=mode) except (IOError, OSError) as err: # An exception might be raised due to two reasons, first the op...
[ "Return", "open", "stream", "if", "*", "filename", "*", "can", "be", "opened", "with", "*", "openfunction", "*", "or", "else", "None", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L317-L341
[ "def", "_get_stream", "(", "filename", ",", "openfunction", "=", "open", ",", "mode", "=", "'r'", ")", ":", "try", ":", "stream", "=", "openfunction", "(", "filename", ",", "mode", "=", "mode", ")", "except", "(", "IOError", ",", "OSError", ")", "as", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
hasmethod
Return ``True`` if object *obj* contains the method *m*. .. versionadded:: 0.7.1
gromacs/utilities.py
def hasmethod(obj, m): """Return ``True`` if object *obj* contains the method *m*. .. versionadded:: 0.7.1 """ return hasattr(obj, m) and callable(getattr(obj, m))
def hasmethod(obj, m): """Return ``True`` if object *obj* contains the method *m*. .. versionadded:: 0.7.1 """ return hasattr(obj, m) and callable(getattr(obj, m))
[ "Return", "True", "if", "object", "*", "obj", "*", "contains", "the", "method", "*", "m", "*", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L343-L348
[ "def", "hasmethod", "(", "obj", ",", "m", ")", ":", "return", "hasattr", "(", "obj", ",", "m", ")", "and", "callable", "(", "getattr", "(", "obj", ",", "m", ")", ")" ]
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
isstream
Detect if `obj` is a stream. We consider anything a stream that has the methods - ``close()`` and either set of the following - ``read()``, ``readline()``, ``readlines()`` - ``write()``, ``writeline()``, ``writelines()`` :Arguments: *obj* stream or str :Returns: *...
gromacs/utilities.py
def isstream(obj): """Detect if `obj` is a stream. We consider anything a stream that has the methods - ``close()`` and either set of the following - ``read()``, ``readline()``, ``readlines()`` - ``write()``, ``writeline()``, ``writelines()`` :Arguments: *obj* stream or ...
def isstream(obj): """Detect if `obj` is a stream. We consider anything a stream that has the methods - ``close()`` and either set of the following - ``read()``, ``readline()``, ``readlines()`` - ``write()``, ``writeline()``, ``writelines()`` :Arguments: *obj* stream or ...
[ "Detect", "if", "obj", "is", "a", "stream", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L350-L388
[ "def", "isstream", "(", "obj", ")", ":", "signature_methods", "=", "(", "\"close\"", ",", ")", "alternative_methods", "=", "(", "(", "\"read\"", ",", "\"readline\"", ",", "\"readlines\"", ")", ",", "(", "\"write\"", ",", "\"writeline\"", ",", "\"writelines\"",...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
convert_aa_code
Converts between 3-letter and 1-letter amino acid codes.
gromacs/utilities.py
def convert_aa_code(x): """Converts between 3-letter and 1-letter amino acid codes.""" if len(x) == 1: return amino_acid_codes[x.upper()] elif len(x) == 3: return inverse_aa_codes[x.upper()] else: raise ValueError("Can only convert 1-letter or 3-letter amino acid codes, " ...
def convert_aa_code(x): """Converts between 3-letter and 1-letter amino acid codes.""" if len(x) == 1: return amino_acid_codes[x.upper()] elif len(x) == 3: return inverse_aa_codes[x.upper()] else: raise ValueError("Can only convert 1-letter or 3-letter amino acid codes, " ...
[ "Converts", "between", "3", "-", "letter", "and", "1", "-", "letter", "amino", "acid", "codes", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L400-L408
[ "def", "convert_aa_code", "(", "x", ")", ":", "if", "len", "(", "x", ")", "==", "1", ":", "return", "amino_acid_codes", "[", "x", ".", "upper", "(", ")", "]", "elif", "len", "(", "x", ")", "==", "3", ":", "return", "inverse_aa_codes", "[", "x", "...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
in_dir
Context manager to execute a code block in a directory. * The directory is created if it does not exist (unless create=False is set) * At the end or after an exception code always returns to the directory that was the current directory before entering the block.
gromacs/utilities.py
def in_dir(directory, create=True): """Context manager to execute a code block in a directory. * The directory is created if it does not exist (unless create=False is set) * At the end or after an exception code always returns to the directory that was the current directory before entering ...
def in_dir(directory, create=True): """Context manager to execute a code block in a directory. * The directory is created if it does not exist (unless create=False is set) * At the end or after an exception code always returns to the directory that was the current directory before entering ...
[ "Context", "manager", "to", "execute", "a", "code", "block", "in", "a", "directory", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L411-L435
[ "def", "in_dir", "(", "directory", ",", "create", "=", "True", ")", ":", "startdir", "=", "os", ".", "getcwd", "(", ")", "try", ":", "try", ":", "os", ".", "chdir", "(", "directory", ")", "logger", ".", "debug", "(", "\"Working in {directory!r}...\"", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
realpath
Join all args and return the real path, rooted at /. Expands ``~`` and environment variables such as :envvar:`$HOME`. Returns ``None`` if any of the args is none.
gromacs/utilities.py
def realpath(*args): """Join all args and return the real path, rooted at /. Expands ``~`` and environment variables such as :envvar:`$HOME`. Returns ``None`` if any of the args is none. """ if None in args: return None return os.path.realpath( os.path.expandvars(os.path.expand...
def realpath(*args): """Join all args and return the real path, rooted at /. Expands ``~`` and environment variables such as :envvar:`$HOME`. Returns ``None`` if any of the args is none. """ if None in args: return None return os.path.realpath( os.path.expandvars(os.path.expand...
[ "Join", "all", "args", "and", "return", "the", "real", "path", "rooted", "at", "/", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L437-L447
[ "def", "realpath", "(", "*", "args", ")", ":", "if", "None", "in", "args", ":", "return", "None", "return", "os", ".", "path", ".", "realpath", "(", "os", ".", "path", ".", "expandvars", "(", "os", ".", "path", ".", "expanduser", "(", "os", ".", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
find_first
Find first *filename* with a suffix from *suffices*. :Arguments: *filename* base filename; this file name is checked first *suffices* list of suffices that are tried in turn on the root of *filename*; can contain the ext separator (:data:`os.path.extsep`) or not :Returns...
gromacs/utilities.py
def find_first(filename, suffices=None): """Find first *filename* with a suffix from *suffices*. :Arguments: *filename* base filename; this file name is checked first *suffices* list of suffices that are tried in turn on the root of *filename*; can contain the ext separat...
def find_first(filename, suffices=None): """Find first *filename* with a suffix from *suffices*. :Arguments: *filename* base filename; this file name is checked first *suffices* list of suffices that are tried in turn on the root of *filename*; can contain the ext separat...
[ "Find", "first", "*", "filename", "*", "with", "a", "suffix", "from", "*", "suffices", "*", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L449-L473
[ "def", "find_first", "(", "filename", ",", "suffices", "=", "None", ")", ":", "# struct is not reliable as it depends on qscript so now we just try everything...", "root", ",", "extension", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "if", "suffices...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
withextsep
Return list in which each element is guaranteed to start with :data:`os.path.extsep`.
gromacs/utilities.py
def withextsep(extensions): """Return list in which each element is guaranteed to start with :data:`os.path.extsep`.""" def dottify(x): if x.startswith(os.path.extsep): return x return os.path.extsep + x return [dottify(x) for x in asiterable(extensions)]
def withextsep(extensions): """Return list in which each element is guaranteed to start with :data:`os.path.extsep`.""" def dottify(x): if x.startswith(os.path.extsep): return x return os.path.extsep + x return [dottify(x) for x in asiterable(extensions)]
[ "Return", "list", "in", "which", "each", "element", "is", "guaranteed", "to", "start", "with", ":", "data", ":", "os", ".", "path", ".", "extsep", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L475-L481
[ "def", "withextsep", "(", "extensions", ")", ":", "def", "dottify", "(", "x", ")", ":", "if", "x", ".", "startswith", "(", "os", ".", "path", ".", "extsep", ")", ":", "return", "x", "return", "os", ".", "path", ".", "extsep", "+", "x", "return", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
iterable
Returns ``True`` if *obj* can be iterated over and is *not* a string.
gromacs/utilities.py
def iterable(obj): """Returns ``True`` if *obj* can be iterated over and is *not* a string.""" if isinstance(obj, string_types): return False # avoid iterating over characters of a string if hasattr(obj, 'next'): return True # any iterator will do try: len(obj) # any...
def iterable(obj): """Returns ``True`` if *obj* can be iterated over and is *not* a string.""" if isinstance(obj, string_types): return False # avoid iterating over characters of a string if hasattr(obj, 'next'): return True # any iterator will do try: len(obj) # any...
[ "Returns", "True", "if", "*", "obj", "*", "can", "be", "iterated", "over", "and", "is", "*", "not", "*", "a", "string", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L662-L672
[ "def", "iterable", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "string_types", ")", ":", "return", "False", "# avoid iterating over characters of a string", "if", "hasattr", "(", "obj", ",", "'next'", ")", ":", "return", "True", "# any iterator wi...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
unlink_f
Unlink path but do not complain if file does not exist.
gromacs/utilities.py
def unlink_f(path): """Unlink path but do not complain if file does not exist.""" try: os.unlink(path) except OSError as err: if err.errno != errno.ENOENT: raise
def unlink_f(path): """Unlink path but do not complain if file does not exist.""" try: os.unlink(path) except OSError as err: if err.errno != errno.ENOENT: raise
[ "Unlink", "path", "but", "do", "not", "complain", "if", "file", "does", "not", "exist", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L689-L695
[ "def", "unlink_f", "(", "path", ")", ":", "try", ":", "os", ".", "unlink", "(", "path", ")", "except", "OSError", "as", "err", ":", "if", "err", ".", "errno", "!=", "errno", ".", "ENOENT", ":", "raise" ]
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
unlink_gmx_backups
Unlink (rm) all backup files corresponding to the listed files.
gromacs/utilities.py
def unlink_gmx_backups(*args): """Unlink (rm) all backup files corresponding to the listed files.""" for path in args: dirname, filename = os.path.split(path) fbaks = glob.glob(os.path.join(dirname, '#'+filename+'.*#')) for bak in fbaks: unlink_f(bak)
def unlink_gmx_backups(*args): """Unlink (rm) all backup files corresponding to the listed files.""" for path in args: dirname, filename = os.path.split(path) fbaks = glob.glob(os.path.join(dirname, '#'+filename+'.*#')) for bak in fbaks: unlink_f(bak)
[ "Unlink", "(", "rm", ")", "all", "backup", "files", "corresponding", "to", "the", "listed", "files", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L703-L709
[ "def", "unlink_gmx_backups", "(", "*", "args", ")", ":", "for", "path", "in", "args", ":", "dirname", ",", "filename", "=", "os", ".", "path", ".", "split", "(", "path", ")", "fbaks", "=", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
mkdir_p
Create a directory *path* with subdirs but do not complain if it exists. This is like GNU ``mkdir -p path``.
gromacs/utilities.py
def mkdir_p(path): """Create a directory *path* with subdirs but do not complain if it exists. This is like GNU ``mkdir -p path``. """ try: os.makedirs(path) except OSError as err: if err.errno != errno.EEXIST: raise
def mkdir_p(path): """Create a directory *path* with subdirs but do not complain if it exists. This is like GNU ``mkdir -p path``. """ try: os.makedirs(path) except OSError as err: if err.errno != errno.EEXIST: raise
[ "Create", "a", "directory", "*", "path", "*", "with", "subdirs", "but", "do", "not", "complain", "if", "it", "exists", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L711-L720
[ "def", "mkdir_p", "(", "path", ")", ":", "try", ":", "os", ".", "makedirs", "(", "path", ")", "except", "OSError", "as", "err", ":", "if", "err", ".", "errno", "!=", "errno", ".", "EEXIST", ":", "raise" ]
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
cat
Concatenate files *f*=[...] and write to *o*
gromacs/utilities.py
def cat(f=None, o=None): """Concatenate files *f*=[...] and write to *o*""" # need f, o to be compatible with trjcat and eneconv if f is None or o is None: return target = o infiles = asiterable(f) logger.debug("cat {0!s} > {1!s} ".format(" ".join(infiles), target)) with open(target,...
def cat(f=None, o=None): """Concatenate files *f*=[...] and write to *o*""" # need f, o to be compatible with trjcat and eneconv if f is None or o is None: return target = o infiles = asiterable(f) logger.debug("cat {0!s} > {1!s} ".format(" ".join(infiles), target)) with open(target,...
[ "Concatenate", "files", "*", "f", "*", "=", "[", "...", "]", "and", "write", "to", "*", "o", "*" ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L722-L735
[ "def", "cat", "(", "f", "=", "None", ",", "o", "=", "None", ")", ":", "# need f, o to be compatible with trjcat and eneconv", "if", "f", "is", "None", "or", "o", "is", "None", ":", "return", "target", "=", "o", "infiles", "=", "asiterable", "(", "f", ")"...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
activate_subplot
Make subplot *numPlot* active on the canvas. Use this if a simple ``subplot(numRows, numCols, numPlot)`` overwrites the subplot instead of activating it.
gromacs/utilities.py
def activate_subplot(numPlot): """Make subplot *numPlot* active on the canvas. Use this if a simple ``subplot(numRows, numCols, numPlot)`` overwrites the subplot instead of activating it. """ # see http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg07156.html from pylab impor...
def activate_subplot(numPlot): """Make subplot *numPlot* active on the canvas. Use this if a simple ``subplot(numRows, numCols, numPlot)`` overwrites the subplot instead of activating it. """ # see http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg07156.html from pylab impor...
[ "Make", "subplot", "*", "numPlot", "*", "active", "on", "the", "canvas", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L739-L748
[ "def", "activate_subplot", "(", "numPlot", ")", ":", "# see http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg07156.html", "from", "pylab", "import", "gcf", ",", "axes", "numPlot", "-=", "1", "# index is 0-based, plots are 1-based", "return", "axes", "(", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
remove_legend
Remove legend for axes or gca. See http://osdir.com/ml/python.matplotlib.general/2005-07/msg00285.html
gromacs/utilities.py
def remove_legend(ax=None): """Remove legend for axes or gca. See http://osdir.com/ml/python.matplotlib.general/2005-07/msg00285.html """ from pylab import gca, draw if ax is None: ax = gca() ax.legend_ = None draw()
def remove_legend(ax=None): """Remove legend for axes or gca. See http://osdir.com/ml/python.matplotlib.general/2005-07/msg00285.html """ from pylab import gca, draw if ax is None: ax = gca() ax.legend_ = None draw()
[ "Remove", "legend", "for", "axes", "or", "gca", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L750-L759
[ "def", "remove_legend", "(", "ax", "=", "None", ")", ":", "from", "pylab", "import", "gca", ",", "draw", "if", "ax", "is", "None", ":", "ax", "=", "gca", "(", ")", "ax", ".", "legend_", "=", "None", "draw", "(", ")" ]
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
number_pdbs
Rename pdbs x1.pdb ... x345.pdb --> x0001.pdb ... x0345.pdb :Arguments: - *args*: filenames or glob patterns (such as "pdb/md*.pdb") - *format*: format string including keyword *num* ["%(num)04d"]
gromacs/utilities.py
def number_pdbs(*args, **kwargs): """Rename pdbs x1.pdb ... x345.pdb --> x0001.pdb ... x0345.pdb :Arguments: - *args*: filenames or glob patterns (such as "pdb/md*.pdb") - *format*: format string including keyword *num* ["%(num)04d"] """ format = kwargs.pop('format', "%(num)04d") nam...
def number_pdbs(*args, **kwargs): """Rename pdbs x1.pdb ... x345.pdb --> x0001.pdb ... x0345.pdb :Arguments: - *args*: filenames or glob patterns (such as "pdb/md*.pdb") - *format*: format string including keyword *num* ["%(num)04d"] """ format = kwargs.pop('format', "%(num)04d") nam...
[ "Rename", "pdbs", "x1", ".", "pdb", "...", "x345", ".", "pdb", "--", ">", "x0001", ".", "pdb", "...", "x0345", ".", "pdb" ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L821-L844
[ "def", "number_pdbs", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "format", "=", "kwargs", ".", "pop", "(", "'format'", ",", "\"%(num)04d\"", ")", "name_format", "=", "\"%(prefix)s\"", "+", "format", "+", "\".%(suffix)s\"", "for", "f", "in", "it...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
FileUtils._init_filename
Initialize the current filename :attr:`FileUtils.real_filename` of the object. Bit of a hack. - The first invocation must have ``filename != None``; this will set a default filename with suffix :attr:`FileUtils.default_extension` unless another one was supplied. - Subseque...
gromacs/utilities.py
def _init_filename(self, filename=None, ext=None): """Initialize the current filename :attr:`FileUtils.real_filename` of the object. Bit of a hack. - The first invocation must have ``filename != None``; this will set a default filename with suffix :attr:`FileUtils.default_extension` ...
def _init_filename(self, filename=None, ext=None): """Initialize the current filename :attr:`FileUtils.real_filename` of the object. Bit of a hack. - The first invocation must have ``filename != None``; this will set a default filename with suffix :attr:`FileUtils.default_extension` ...
[ "Initialize", "the", "current", "filename", ":", "attr", ":", "FileUtils", ".", "real_filename", "of", "the", "object", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L526-L543
[ "def", "_init_filename", "(", "self", ",", "filename", "=", "None", ",", "ext", "=", "None", ")", ":", "extension", "=", "ext", "or", "self", ".", "default_extension", "filename", "=", "self", ".", "filename", "(", "filename", ",", "ext", "=", "extension...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
FileUtils.filename
Supply a file name for the class object. Typical uses:: fn = filename() ---> <default_filename> fn = filename('name.ext') ---> 'name' fn = filename(ext='pickle') ---> <default_filename>'.pickle' fn = filename('name.inp','pdf') --> 'name.pdf' ...
gromacs/utilities.py
def filename(self,filename=None,ext=None,set_default=False,use_my_ext=False): """Supply a file name for the class object. Typical uses:: fn = filename() ---> <default_filename> fn = filename('name.ext') ---> 'name' fn = filename(ext='pickle') ---> <defaul...
def filename(self,filename=None,ext=None,set_default=False,use_my_ext=False): """Supply a file name for the class object. Typical uses:: fn = filename() ---> <default_filename> fn = filename('name.ext') ---> 'name' fn = filename(ext='pickle') ---> <defaul...
[ "Supply", "a", "file", "name", "for", "the", "class", "object", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L545-L589
[ "def", "filename", "(", "self", ",", "filename", "=", "None", ",", "ext", "=", "None", ",", "set_default", "=", "False", ",", "use_my_ext", "=", "False", ")", ":", "if", "filename", "is", "None", ":", "if", "not", "hasattr", "(", "self", ",", "'_file...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
FileUtils.check_file_exists
If a file exists then continue with the action specified in ``resolve``. ``resolve`` must be one of "ignore" always return ``False`` "indicate" return ``True`` if it exists "warn" indicate and issue a :exc:`UserWarning` "exception" ...
gromacs/utilities.py
def check_file_exists(self, filename, resolve='exception', force=None): """If a file exists then continue with the action specified in ``resolve``. ``resolve`` must be one of "ignore" always return ``False`` "indicate" return ``True`` if it exists "w...
def check_file_exists(self, filename, resolve='exception', force=None): """If a file exists then continue with the action specified in ``resolve``. ``resolve`` must be one of "ignore" always return ``False`` "indicate" return ``True`` if it exists "w...
[ "If", "a", "file", "exists", "then", "continue", "with", "the", "action", "specified", "in", "resolve", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L591-L640
[ "def", "check_file_exists", "(", "self", ",", "filename", ",", "resolve", "=", "'exception'", ",", "force", "=", "None", ")", ":", "def", "_warn", "(", "x", ")", ":", "msg", "=", "\"File {0!r} already exists.\"", ".", "format", "(", "x", ")", "logger", "...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
FileUtils.infix_filename
Unless *name* is provided, insert *infix* before the extension *ext* of *default*.
gromacs/utilities.py
def infix_filename(self, name, default, infix, ext=None): """Unless *name* is provided, insert *infix* before the extension *ext* of *default*.""" if name is None: p, oldext = os.path.splitext(default) if ext is None: ext = oldext if ext.startswith(os....
def infix_filename(self, name, default, infix, ext=None): """Unless *name* is provided, insert *infix* before the extension *ext* of *default*.""" if name is None: p, oldext = os.path.splitext(default) if ext is None: ext = oldext if ext.startswith(os....
[ "Unless", "*", "name", "*", "is", "provided", "insert", "*", "infix", "*", "before", "the", "extension", "*", "ext", "*", "of", "*", "default", "*", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L642-L651
[ "def", "infix_filename", "(", "self", ",", "name", ",", "default", ",", "infix", ",", "ext", "=", "None", ")", ":", "if", "name", "is", "None", ":", "p", ",", "oldext", "=", "os", ".", "path", ".", "splitext", "(", "default", ")", "if", "ext", "i...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
Timedelta.strftime
Primitive string formatter. The only directives understood are the following: ============ ========================== Directive meaning ============ ========================== %d day as integer %H hour [00-23] %h ...
gromacs/utilities.py
def strftime(self, fmt="%d:%H:%M:%S"): """Primitive string formatter. The only directives understood are the following: ============ ========================== Directive meaning ============ ========================== %d day as integer ...
def strftime(self, fmt="%d:%H:%M:%S"): """Primitive string formatter. The only directives understood are the following: ============ ========================== Directive meaning ============ ========================== %d day as integer ...
[ "Primitive", "string", "formatter", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/utilities.py#L792-L816
[ "def", "strftime", "(", "self", ",", "fmt", "=", "\"%d:%H:%M:%S\"", ")", ":", "substitutions", "=", "{", "\"%d\"", ":", "str", "(", "self", ".", "days", ")", ",", "\"%H\"", ":", "\"{0:02d}\"", ".", "format", "(", "self", ".", "dhours", ")", ",", "\"%...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
start_logging
Start logging of messages to file and console. The default logfile is named ``gromacs.log`` and messages are logged with the tag *gromacs*.
gromacs/__init__.py
def start_logging(logfile="gromacs.log"): """Start logging of messages to file and console. The default logfile is named ``gromacs.log`` and messages are logged with the tag *gromacs*. """ from . import log log.create("gromacs", logfile=logfile) logging.getLogger("gromacs").info("GromacsWra...
def start_logging(logfile="gromacs.log"): """Start logging of messages to file and console. The default logfile is named ``gromacs.log`` and messages are logged with the tag *gromacs*. """ from . import log log.create("gromacs", logfile=logfile) logging.getLogger("gromacs").info("GromacsWra...
[ "Start", "logging", "of", "messages", "to", "file", "and", "console", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/__init__.py#L219-L228
[ "def", "start_logging", "(", "logfile", "=", "\"gromacs.log\"", ")", ":", "from", ".", "import", "log", "log", ".", "create", "(", "\"gromacs\"", ",", "logfile", "=", "logfile", ")", "logging", ".", "getLogger", "(", "\"gromacs\"", ")", ".", "info", "(", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
stop_logging
Stop logging to logfile and console.
gromacs/__init__.py
def stop_logging(): """Stop logging to logfile and console.""" from . import log logger = logging.getLogger("gromacs") logger.info("GromacsWrapper %s STOPPED logging", get_version()) log.clear_handlers(logger)
def stop_logging(): """Stop logging to logfile and console.""" from . import log logger = logging.getLogger("gromacs") logger.info("GromacsWrapper %s STOPPED logging", get_version()) log.clear_handlers(logger)
[ "Stop", "logging", "to", "logfile", "and", "console", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/__init__.py#L230-L235
[ "def", "stop_logging", "(", ")", ":", "from", ".", "import", "log", "logger", "=", "logging", ".", "getLogger", "(", "\"gromacs\"", ")", "logger", ".", "info", "(", "\"GromacsWrapper %s STOPPED logging\"", ",", "get_version", "(", ")", ")", "log", ".", "clea...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
filter_gromacs_warnings
Set the :meth:`warnings.simplefilter` to *action*. *categories* must be a list of warning classes or strings. ``None`` selects the defaults, :data:`gromacs.less_important_warnings`.
gromacs/__init__.py
def filter_gromacs_warnings(action, categories=None): """Set the :meth:`warnings.simplefilter` to *action*. *categories* must be a list of warning classes or strings. ``None`` selects the defaults, :data:`gromacs.less_important_warnings`. """ if categories is None: categories = less_impor...
def filter_gromacs_warnings(action, categories=None): """Set the :meth:`warnings.simplefilter` to *action*. *categories* must be a list of warning classes or strings. ``None`` selects the defaults, :data:`gromacs.less_important_warnings`. """ if categories is None: categories = less_impor...
[ "Set", "the", ":", "meth", ":", "warnings", ".", "simplefilter", "to", "*", "action", "*", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/__init__.py#L292-L308
[ "def", "filter_gromacs_warnings", "(", "action", ",", "categories", "=", "None", ")", ":", "if", "categories", "is", "None", ":", "categories", "=", "less_important_warnings", "for", "c", "in", "categories", ":", "try", ":", "w", "=", "globals", "(", ")", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
tool_factory
Factory for GromacsCommand derived types.
gromacs/tools.py
def tool_factory(clsname, name, driver, base=GromacsCommand): """ Factory for GromacsCommand derived types. """ clsdict = { 'command_name': name, 'driver': driver, '__doc__': property(base._get_gmx_docs) } return type(clsname, (base,), clsdict)
def tool_factory(clsname, name, driver, base=GromacsCommand): """ Factory for GromacsCommand derived types. """ clsdict = { 'command_name': name, 'driver': driver, '__doc__': property(base._get_gmx_docs) } return type(clsname, (base,), clsdict)
[ "Factory", "for", "GromacsCommand", "derived", "types", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/tools.py#L159-L166
[ "def", "tool_factory", "(", "clsname", ",", "name", ",", "driver", ",", "base", "=", "GromacsCommand", ")", ":", "clsdict", "=", "{", "'command_name'", ":", "name", ",", "'driver'", ":", "driver", ",", "'__doc__'", ":", "property", "(", "base", ".", "_ge...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
find_executables
Find executables in a path. Searches executables in a directory excluding some know commands unusable with GromacsWrapper. :param path: dirname to search for :return: list of executables
gromacs/tools.py
def find_executables(path): """ Find executables in a path. Searches executables in a directory excluding some know commands unusable with GromacsWrapper. :param path: dirname to search for :return: list of executables """ execs = [] for exe in os.listdir(path): fullexe = os.pa...
def find_executables(path): """ Find executables in a path. Searches executables in a directory excluding some know commands unusable with GromacsWrapper. :param path: dirname to search for :return: list of executables """ execs = [] for exe in os.listdir(path): fullexe = os.pa...
[ "Find", "executables", "in", "a", "path", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/tools.py#L178-L194
[ "def", "find_executables", "(", "path", ")", ":", "execs", "=", "[", "]", "for", "exe", "in", "os", ".", "listdir", "(", "path", ")", ":", "fullexe", "=", "os", ".", "path", ".", "join", "(", "path", ",", "exe", ")", "if", "(", "os", ".", "acce...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
load_v5_tools
Load Gromacs 2018/2016/5.x tools automatically using some heuristic. Tries to load tools (1) using the driver from configured groups (2) and falls back to automatic detection from ``GMXBIN`` (3) then to rough guesses. In all cases the command ``gmx help`` is ran to get all tools available. :return: d...
gromacs/tools.py
def load_v5_tools(): """ Load Gromacs 2018/2016/5.x tools automatically using some heuristic. Tries to load tools (1) using the driver from configured groups (2) and falls back to automatic detection from ``GMXBIN`` (3) then to rough guesses. In all cases the command ``gmx help`` is ran to get all too...
def load_v5_tools(): """ Load Gromacs 2018/2016/5.x tools automatically using some heuristic. Tries to load tools (1) using the driver from configured groups (2) and falls back to automatic detection from ``GMXBIN`` (3) then to rough guesses. In all cases the command ``gmx help`` is ran to get all too...
[ "Load", "Gromacs", "2018", "/", "2016", "/", "5", ".", "x", "tools", "automatically", "using", "some", "heuristic", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/tools.py#L197-L241
[ "def", "load_v5_tools", "(", ")", ":", "logger", ".", "debug", "(", "\"Loading 2018/2016/5.x tools...\"", ")", "drivers", "=", "config", ".", "get_tool_names", "(", ")", "if", "len", "(", "drivers", ")", "==", "0", "and", "'GMXBIN'", "in", "os", ".", "envi...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
load_v4_tools
Load Gromacs 4.x tools automatically using some heuristic. Tries to load tools (1) in configured tool groups (2) and fails back to automatic detection from ``GMXBIN`` (3) then to a prefilled list. Also load any extra tool configured in ``~/.gromacswrapper.cfg`` :return: dict mapping tool names to Gr...
gromacs/tools.py
def load_v4_tools(): """ Load Gromacs 4.x tools automatically using some heuristic. Tries to load tools (1) in configured tool groups (2) and fails back to automatic detection from ``GMXBIN`` (3) then to a prefilled list. Also load any extra tool configured in ``~/.gromacswrapper.cfg`` :return: ...
def load_v4_tools(): """ Load Gromacs 4.x tools automatically using some heuristic. Tries to load tools (1) in configured tool groups (2) and fails back to automatic detection from ``GMXBIN`` (3) then to a prefilled list. Also load any extra tool configured in ``~/.gromacswrapper.cfg`` :return: ...
[ "Load", "Gromacs", "4", ".", "x", "tools", "automatically", "using", "some", "heuristic", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/tools.py#L244-L276
[ "def", "load_v4_tools", "(", ")", ":", "logger", ".", "debug", "(", "\"Loading v4 tools...\"", ")", "names", "=", "config", ".", "get_tool_names", "(", ")", "if", "len", "(", "names", ")", "==", "0", "and", "'GMXBIN'", "in", "os", ".", "environ", ":", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
merge_ndx
Takes one or more index files and optionally one structure file and returns a path for a new merged index file. :param args: index files and zero or one structure file :return: path for the new merged index file
gromacs/tools.py
def merge_ndx(*args): """ Takes one or more index files and optionally one structure file and returns a path for a new merged index file. :param args: index files and zero or one structure file :return: path for the new merged index file """ ndxs = [] struct = None for fname in args: ...
def merge_ndx(*args): """ Takes one or more index files and optionally one structure file and returns a path for a new merged index file. :param args: index files and zero or one structure file :return: path for the new merged index file """ ndxs = [] struct = None for fname in args: ...
[ "Takes", "one", "or", "more", "index", "files", "and", "optionally", "one", "structure", "file", "and", "returns", "a", "path", "for", "a", "new", "merged", "index", "file", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/tools.py#L279-L306
[ "def", "merge_ndx", "(", "*", "args", ")", ":", "ndxs", "=", "[", "]", "struct", "=", "None", "for", "fname", "in", "args", ":", "if", "fname", ".", "endswith", "(", "'.ndx'", ")", ":", "ndxs", ".", "append", "(", "fname", ")", "else", ":", "if",...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
NDX.read
Read and parse index file *filename*.
gromacs/fileformats/ndx.py
def read(self, filename=None): """Read and parse index file *filename*.""" self._init_filename(filename) data = odict() with open(self.real_filename) as ndx: current_section = None for line in ndx: line = line.strip() if len(line) ...
def read(self, filename=None): """Read and parse index file *filename*.""" self._init_filename(filename) data = odict() with open(self.real_filename) as ndx: current_section = None for line in ndx: line = line.strip() if len(line) ...
[ "Read", "and", "parse", "index", "file", "*", "filename", "*", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/ndx.py#L101-L121
[ "def", "read", "(", "self", ",", "filename", "=", "None", ")", ":", "self", ".", "_init_filename", "(", "filename", ")", "data", "=", "odict", "(", ")", "with", "open", "(", "self", ".", "real_filename", ")", "as", "ndx", ":", "current_section", "=", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
NDX.write
Write index file to *filename* (or overwrite the file that the index was read from)
gromacs/fileformats/ndx.py
def write(self, filename=None, ncol=ncol, format=format): """Write index file to *filename* (or overwrite the file that the index was read from)""" with open(self.filename(filename, ext='ndx'), 'w') as ndx: for name in self: atomnumbers = self._getarray(name) # allows overri...
def write(self, filename=None, ncol=ncol, format=format): """Write index file to *filename* (or overwrite the file that the index was read from)""" with open(self.filename(filename, ext='ndx'), 'w') as ndx: for name in self: atomnumbers = self._getarray(name) # allows overri...
[ "Write", "index", "file", "to", "*", "filename", "*", "(", "or", "overwrite", "the", "file", "that", "the", "index", "was", "read", "from", ")" ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/ndx.py#L123-L133
[ "def", "write", "(", "self", ",", "filename", "=", "None", ",", "ncol", "=", "ncol", ",", "format", "=", "format", ")", ":", "with", "open", "(", "self", ".", "filename", "(", "filename", ",", "ext", "=", "'ndx'", ")", ",", "'w'", ")", "as", "ndx...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
NDX.ndxlist
Return a list of groups in the same format as :func:`gromacs.cbook.get_ndx_groups`. Format: [ {'name': group_name, 'natoms': number_atoms, 'nr': # group_number}, ....]
gromacs/fileformats/ndx.py
def ndxlist(self): """Return a list of groups in the same format as :func:`gromacs.cbook.get_ndx_groups`. Format: [ {'name': group_name, 'natoms': number_atoms, 'nr': # group_number}, ....] """ return [{'name': name, 'natoms': len(atomnumbers), 'nr': nr+1} for ...
def ndxlist(self): """Return a list of groups in the same format as :func:`gromacs.cbook.get_ndx_groups`. Format: [ {'name': group_name, 'natoms': number_atoms, 'nr': # group_number}, ....] """ return [{'name': name, 'natoms': len(atomnumbers), 'nr': nr+1} for ...
[ "Return", "a", "list", "of", "groups", "in", "the", "same", "format", "as", ":", "func", ":", "gromacs", ".", "cbook", ".", "get_ndx_groups", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/ndx.py#L158-L165
[ "def", "ndxlist", "(", "self", ")", ":", "return", "[", "{", "'name'", ":", "name", ",", "'natoms'", ":", "len", "(", "atomnumbers", ")", ",", "'nr'", ":", "nr", "+", "1", "}", "for", "nr", ",", "(", "name", ",", "atomnumbers", ")", "in", "enumer...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
uniqueNDX.join
Return an index group that contains atoms from all *groupnames*. The method will silently ignore any groups that are not in the index. **Example** Always make a solvent group from water and ions, even if not all ions are present in all simulations:: I['SOLVENT'] =...
gromacs/fileformats/ndx.py
def join(self, *groupnames): """Return an index group that contains atoms from all *groupnames*. The method will silently ignore any groups that are not in the index. **Example** Always make a solvent group from water and ions, even if not all ions are present in all ...
def join(self, *groupnames): """Return an index group that contains atoms from all *groupnames*. The method will silently ignore any groups that are not in the index. **Example** Always make a solvent group from water and ions, even if not all ions are present in all ...
[ "Return", "an", "index", "group", "that", "contains", "atoms", "from", "all", "*", "groupnames", "*", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/ndx.py#L212-L225
[ "def", "join", "(", "self", ",", "*", "groupnames", ")", ":", "return", "self", ".", "_sum", "(", "[", "self", "[", "k", "]", "for", "k", "in", "groupnames", "if", "k", "in", "self", "]", ")" ]
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
break_array
Create a array which masks jumps >= threshold. Extra points are inserted between two subsequent values whose absolute difference differs by more than threshold (default is pi). Other can be a secondary array which is also masked according to *a*. Returns (*a_masked*, *other_masked*) (where *o...
gromacs/fileformats/xvg.py
def break_array(a, threshold=numpy.pi, other=None): """Create a array which masks jumps >= threshold. Extra points are inserted between two subsequent values whose absolute difference differs by more than threshold (default is pi). Other can be a secondary array which is also masked according to ...
def break_array(a, threshold=numpy.pi, other=None): """Create a array which masks jumps >= threshold. Extra points are inserted between two subsequent values whose absolute difference differs by more than threshold (default is pi). Other can be a secondary array which is also masked according to ...
[ "Create", "a", "array", "which", "masks", "jumps", ">", "=", "threshold", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/xvg.py#L1165-L1213
[ "def", "break_array", "(", "a", ",", "threshold", "=", "numpy", ".", "pi", ",", "other", "=", "None", ")", ":", "assert", "len", "(", "a", ".", "shape", ")", "==", "1", ",", "\"Only 1D arrays supported\"", "if", "other", "is", "not", "None", "and", "...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9
valid
XVG.write
Write array to xvg file *filename* in NXY format. .. Note:: Only plain files working at the moment, not compressed.
gromacs/fileformats/xvg.py
def write(self, filename=None): """Write array to xvg file *filename* in NXY format. .. Note:: Only plain files working at the moment, not compressed. """ self._init_filename(filename) with utilities.openany(self.real_filename, 'w') as xvg: xvg.write("# xmgrace compa...
def write(self, filename=None): """Write array to xvg file *filename* in NXY format. .. Note:: Only plain files working at the moment, not compressed. """ self._init_filename(filename) with utilities.openany(self.real_filename, 'w') as xvg: xvg.write("# xmgrace compa...
[ "Write", "array", "to", "xvg", "file", "*", "filename", "*", "in", "NXY", "format", "." ]
Becksteinlab/GromacsWrapper
python
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/fileformats/xvg.py#L334-L346
[ "def", "write", "(", "self", ",", "filename", "=", "None", ")", ":", "self", ".", "_init_filename", "(", "filename", ")", "with", "utilities", ".", "openany", "(", "self", ".", "real_filename", ",", "'w'", ")", "as", "xvg", ":", "xvg", ".", "write", ...
d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9