HTPolyNet 1.0.8__py3-none-any.whl → 2.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. htpolynet/__init__.py +2 -0
  2. {HTPolyNet → htpolynet/analysis}/analyze.py +48 -50
  3. {HTPolyNet → htpolynet/analysis}/plot.py +79 -98
  4. {HTPolyNet → htpolynet/analysis}/postsim.py +85 -85
  5. {HTPolyNet → htpolynet/analysis}/utils.py +83 -89
  6. htpolynet/cli.py +488 -0
  7. htpolynet/core/__init__.py +0 -0
  8. htpolynet/core/bondtemplate.py +112 -0
  9. htpolynet/core/configuration.py +83 -0
  10. htpolynet/core/coordinates.py +644 -0
  11. htpolynet/core/molecule.py +998 -0
  12. htpolynet/core/projectfilesystem.py +616 -0
  13. {HTPolyNet → htpolynet/core}/runtime.py +280 -217
  14. {HTPolyNet → htpolynet/core}/topocoord.py +896 -877
  15. htpolynet/core/topology.py +1138 -0
  16. htpolynet/cure/__init__.py +0 -0
  17. htpolynet/cure/chain.py +135 -0
  18. {HTPolyNet → htpolynet/cure}/curecontroller.py +152 -174
  19. htpolynet/cure/expandreactions.py +294 -0
  20. {HTPolyNet → htpolynet/cure}/reaction.py +72 -74
  21. htpolynet/external/__init__.py +0 -0
  22. htpolynet/external/ambertools.py +97 -0
  23. htpolynet/external/command.py +73 -0
  24. {HTPolyNet → htpolynet/external}/gromacs.py +78 -103
  25. htpolynet/external/slurm.py +111 -0
  26. htpolynet/external/software.py +183 -0
  27. htpolynet/geometry/__init__.py +0 -0
  28. {HTPolyNet → htpolynet/geometry}/bondlist.py +56 -55
  29. htpolynet/geometry/lattice.py +32 -0
  30. htpolynet/geometry/linkcell.py +210 -0
  31. htpolynet/geometry/matrix4.py +110 -0
  32. {HTPolyNet → htpolynet/geometry}/ring.py +273 -292
  33. htpolynet/io/__init__.py +6 -0
  34. htpolynet/io/gro.py +195 -0
  35. htpolynet/io/mol2.py +210 -0
  36. htpolynet/io/pdb.py +157 -0
  37. htpolynet/resources/__init__.py +0 -0
  38. htpolynet/resources/example_depot/0-liquid-styrene.sh +134 -0
  39. htpolynet/resources/example_depot/0-liquid-styrene.tgz +0 -0
  40. htpolynet/resources/example_depot/1-polystyrene.sh +202 -0
  41. htpolynet/resources/example_depot/1-polystyrene.tgz +0 -0
  42. htpolynet/resources/example_depot/2-bisgma-styrene-thermoset.sh +353 -0
  43. htpolynet/resources/example_depot/2-bisgma-styrene-thermoset.tgz +0 -0
  44. htpolynet/resources/example_depot/3-pacm-dgeba-epoxy-thermoset.sh +242 -0
  45. htpolynet/resources/example_depot/3-pacm-dgeba-epoxy-thermoset.tgz +0 -0
  46. htpolynet/resources/example_depot/4-dfda-fde-epoxy-thermoset.sh +216 -0
  47. htpolynet/resources/example_depot/4-dfda-fde-epoxy-thermoset.tgz +0 -0
  48. htpolynet/utils/__init__.py +0 -0
  49. {HTPolyNet → htpolynet/utils}/banner.py +6 -5
  50. {HTPolyNet → htpolynet/utils}/checkpoint.py +15 -18
  51. htpolynet/utils/dataframetools.py +92 -0
  52. htpolynet/utils/inputcheck.py +49 -0
  53. htpolynet/utils/logsetup.py +44 -0
  54. {htpolynet-1.0.8.dist-info → htpolynet-2.0.0.dist-info}/METADATA +22 -31
  55. htpolynet-2.0.0.dist-info/RECORD +110 -0
  56. {htpolynet-1.0.8.dist-info → htpolynet-2.0.0.dist-info}/WHEEL +1 -1
  57. htpolynet-2.0.0.dist-info/entry_points.txt +2 -0
  58. HTPolyNet/__init__.py +0 -1
  59. HTPolyNet/ambertools.py +0 -94
  60. HTPolyNet/bondtemplate.py +0 -111
  61. HTPolyNet/command.py +0 -42
  62. HTPolyNet/configuration.py +0 -240
  63. HTPolyNet/coordinates.py +0 -1100
  64. HTPolyNet/countTime.py +0 -26
  65. HTPolyNet/dataframetools.py +0 -134
  66. HTPolyNet/driver.py +0 -257
  67. HTPolyNet/expandreactions.py +0 -154
  68. HTPolyNet/inputcheck.py +0 -51
  69. HTPolyNet/linkcell.py +0 -322
  70. HTPolyNet/matrix4.py +0 -110
  71. HTPolyNet/molecule.py +0 -1247
  72. HTPolyNet/projectfilesystem.py +0 -483
  73. HTPolyNet/resources/example_depot/0-liquid-styrene.tgz +0 -0
  74. HTPolyNet/resources/example_depot/1-polystyrene.tgz +0 -0
  75. HTPolyNet/resources/example_depot/2-polymethylstyrene.tgz +0 -0
  76. HTPolyNet/resources/example_depot/3-bisgma-styrene-thermoset.tgz +0 -0
  77. HTPolyNet/resources/example_depot/4-pacm-dgeba-epoxy-thermoset.tgz +0 -0
  78. HTPolyNet/resources/example_depot/5-dfda-fde-epoxy-thermoset.tgz +0 -0
  79. HTPolyNet/software.py +0 -106
  80. HTPolyNet/topology.py +0 -1228
  81. HTPolyNet/unused_symmetry_stuff.py +0 -291
  82. htpolynet-1.0.8.dist-info/RECORD +0 -94
  83. htpolynet-1.0.8.dist-info/entry_points.txt +0 -2
  84. {HTPolyNet/resources → htpolynet/analysis}/__init__.py +0 -0
  85. {HTPolyNet → htpolynet}/resources/README.md +0 -0
  86. {HTPolyNet → htpolynet}/resources/cfg/DGE-PAC-hi.yaml +0 -0
  87. {HTPolyNet → htpolynet}/resources/cfg/DGE-PAC-lo.yaml +0 -0
  88. {HTPolyNet → htpolynet}/resources/cfg/FDE-DFDA-hi.yaml +0 -0
  89. {HTPolyNet → htpolynet}/resources/cfg/FDE-DFDA-lo.yaml +0 -0
  90. {HTPolyNet → htpolynet}/resources/cfg/GMASTY-hi.yaml +0 -0
  91. {HTPolyNet → htpolynet}/resources/cfg/GMASTY-lo.yaml +0 -0
  92. {HTPolyNet → htpolynet}/resources/cfg/README.md +0 -0
  93. {HTPolyNet → htpolynet}/resources/cfg/STY.yaml +0 -0
  94. {HTPolyNet → htpolynet}/resources/cfg/pMSTY-hi.yaml +0 -0
  95. {HTPolyNet → htpolynet}/resources/cfg/pMSTY-lo.yaml +0 -0
  96. {HTPolyNet → htpolynet}/resources/cfg/pSTY-hi.yaml +0 -0
  97. {HTPolyNet → htpolynet}/resources/cfg/pSTY-lo.yaml +0 -0
  98. {HTPolyNet → htpolynet}/resources/mdp/README.md +0 -0
  99. {HTPolyNet → htpolynet}/resources/mdp/drag-min.mdp +0 -0
  100. {HTPolyNet → htpolynet}/resources/mdp/drag-npt.mdp +0 -0
  101. {HTPolyNet → htpolynet}/resources/mdp/drag-nvt.mdp +0 -0
  102. {HTPolyNet → htpolynet}/resources/mdp/min.mdp +0 -0
  103. {HTPolyNet → htpolynet}/resources/mdp/npt.mdp +0 -0
  104. {HTPolyNet → htpolynet}/resources/mdp/nvt.mdp +0 -0
  105. {HTPolyNet → htpolynet}/resources/mdp/relax-min.mdp +0 -0
  106. {HTPolyNet → htpolynet}/resources/mdp/relax-npt.mdp +0 -0
  107. {HTPolyNet → htpolynet}/resources/mdp/relax-nvt.mdp +0 -0
  108. {HTPolyNet → htpolynet}/resources/mdp/single-molecule-min.mdp +0 -0
  109. {HTPolyNet → htpolynet}/resources/mdp/single-molecule-nvt.mdp +0 -0
  110. {HTPolyNet → htpolynet}/resources/molecules/inputs/DFA.pdb +0 -0
  111. {HTPolyNet → htpolynet}/resources/molecules/inputs/DGE.mol2 +0 -0
  112. {HTPolyNet → htpolynet}/resources/molecules/inputs/EMB.mol2 +0 -0
  113. {HTPolyNet → htpolynet}/resources/molecules/inputs/FDE.pdb +0 -0
  114. {HTPolyNet → htpolynet}/resources/molecules/inputs/GMA.mol2 +0 -0
  115. {HTPolyNet → htpolynet}/resources/molecules/inputs/PAC.mol2 +0 -0
  116. {HTPolyNet → htpolynet}/resources/molecules/inputs/STY.mol2 +0 -0
  117. {HTPolyNet → htpolynet}/resources/molecules/make-monomers.sh +0 -0
  118. {HTPolyNet → htpolynet}/resources/molecules/pics/DFA.png +0 -0
  119. {HTPolyNet → htpolynet}/resources/molecules/pics/DGE.png +0 -0
  120. {HTPolyNet → htpolynet}/resources/molecules/pics/EMB.png +0 -0
  121. {HTPolyNet → htpolynet}/resources/molecules/pics/FDE.png +0 -0
  122. {HTPolyNet → htpolynet}/resources/molecules/pics/GMA.png +0 -0
  123. {HTPolyNet → htpolynet}/resources/molecules/pics/PAC.png +0 -0
  124. {HTPolyNet → htpolynet}/resources/molecules/pics/STY.png +0 -0
  125. {HTPolyNet → htpolynet}/resources/molecules/sample-inputs/DFA.pdb +0 -0
  126. {HTPolyNet → htpolynet}/resources/molecules/sample-inputs/DGE.mol2 +0 -0
  127. {HTPolyNet → htpolynet}/resources/molecules/sample-inputs/EMB.mol2 +0 -0
  128. {HTPolyNet → htpolynet}/resources/molecules/sample-inputs/FDE.pdb +0 -0
  129. {HTPolyNet → htpolynet}/resources/molecules/sample-inputs/GMA.mol2 +0 -0
  130. {HTPolyNet → htpolynet}/resources/molecules/sample-inputs/PAC.mol2 +0 -0
  131. {HTPolyNet → htpolynet}/resources/molecules/sample-inputs/STY.mol2 +0 -0
  132. {HTPolyNet → htpolynet}/resources/tcl/readbonds.tcl +0 -0
  133. {HTPolyNet → htpolynet}/resources/tcl/readgrx.tcl +0 -0
  134. {HTPolyNet → htpolynet}/resources/tcl/render.tcl +0 -0
  135. {HTPolyNet → htpolynet/utils}/stringthings.py +0 -0
  136. {htpolynet-1.0.8.dist-info → htpolynet-2.0.0.dist-info}/licenses/LICENSE +0 -0
htpolynet/__init__.py ADDED
@@ -0,0 +1,2 @@
1
+ from importlib.metadata import version
2
+ HTPOLYNET_VERSION = version('htpolynet')
@@ -1,21 +1,21 @@
1
- """
2
-
3
- .. module:: analyze
4
- :synopsis: handles the analyze subcommand
5
-
6
- .. moduleauthor: Cameron F. Abrams, <cfa22@drexel.edu>
1
+ """Handles the analyze subcommand.
7
2
 
3
+ Author: Cameron F. Abrams <cfa22@drexel.edu>
8
4
  """
5
+ import json
9
6
  import logging
10
7
  import os
11
- import json
12
- import yaml
13
- import HTPolyNet.projectfilesystem as pfs
14
- from HTPolyNet.gromacs import gmx_command
15
- import HTPolyNet.software as software
16
- from HTPolyNet.configuration import Configuration
8
+
17
9
  from pathlib import Path
18
10
 
11
+ import yaml
12
+
13
+ from ..core import projectfilesystem as pfs
14
+ from ..core.configuration import Configuration
15
+ from ..external import software as software
16
+ from ..external.gromacs import gmx_command
17
+ from ..utils.logsetup import setup_logging
18
+
19
19
  logger=logging.getLogger(__name__)
20
20
 
21
21
  class Analyze:
@@ -40,9 +40,7 @@ class Analyze:
40
40
  self.console_output=None
41
41
 
42
42
  def do(self,**gromacs_dict):
43
- """do handles executing the analysis
44
-
45
- """
43
+ """Handles executing the analysis."""
46
44
  p=self.params
47
45
  print(p)
48
46
  for rk in self.required_keys:
@@ -105,7 +103,7 @@ class AnalyzeDensity(Analyze):
105
103
  """
106
104
  default_params={
107
105
  'subdir': 'analyze/density',
108
- 'links': ['postsim/equilibrate/equilibrate.tpr','postsim/equilibrate/equilibrate.trr'],
106
+ 'links': [f'{pfs.Dirs.postsim}/equilibrate/equilibrate.tpr',f'{pfs.Dirs.postsim}/equilibrate/equilibrate.trr'],
109
107
  'gromacs' : {
110
108
  'gmx': 'gmx'
111
109
  },
@@ -125,7 +123,7 @@ class AnalyzeDensity(Analyze):
125
123
  class AnalyzeFFV(Analyze):
126
124
  default_params={
127
125
  'subdir': 'analyze/freevolume',
128
- 'links': ['postsim/equilibrate/equilibrate.tpr','postsim/equilibrate/equilibrate.trr'],
126
+ 'links': [f'{pfs.Dirs.postsim}/equilibrate/equilibrate.tpr',f'{pfs.Dirs.postsim}/equilibrate/equilibrate.trr'],
129
127
  'gromacs' : {
130
128
  'gmx': 'gmx'
131
129
  },
@@ -165,15 +163,17 @@ class AnalyzeConfiguration:
165
163
 
166
164
  @classmethod
167
165
  def read(cls,filename,parse=True,**kwargs):
168
- """read generates a new PostsimConfiguration object by reading in the JSON or YAML file indicated by filename
166
+ """Generates a new PostsimConfiguration object by reading in the JSON or YAML file indicated by filename.
167
+
168
+ Args:
169
+ filename (str): name of file from which to read new PostsimConfiguration object
170
+ parse (bool): if True, parse the input configuration file, defaults to True
169
171
 
170
- :param filename: name of file from which to read new PostsimConfiguration object
171
- :type filename: str
172
- :param parse: if True, parse the input configuration file, defaults to True
173
- :type parse: bool, optional
174
- :raises Exception: if extension of filename is not '.json' or '.yaml' or '.yml'
175
- :return: a new PostsimConfiguration object
176
- :rtype: PostsimConfiguration
172
+ Raises:
173
+ Exception: if extension of filename is not '.json' or '.yaml' or '.yml'
174
+
175
+ Returns:
176
+ PostsimConfiguration: a new PostsimConfiguration object
177
177
  """
178
178
  basename,extension=os.path.splitext(filename)
179
179
  if extension=='.json':
@@ -185,14 +185,14 @@ class AnalyzeConfiguration:
185
185
 
186
186
  @classmethod
187
187
  def _read_json(cls,filename,parse=True,**kwargs):
188
- """_read_json create a new PostsimConfiguration object by reading from JSON input
188
+ """Creates a new PostsimConfiguration object by reading from JSON input.
189
+
190
+ Args:
191
+ filename (str): name of JSON file
192
+ parse (bool): if True, parse the JSON data, defaults to True
189
193
 
190
- :param filename: name of JSON file
191
- :type filename: str
192
- :param parse: if True, parse the JSON data, defaults to True
193
- :type parse: bool, optional
194
- :return: a new PostsimConfiguration object
195
- :rtype: PostsimConfiguration
194
+ Returns:
195
+ PostsimConfiguration: a new PostsimConfiguration object
196
196
  """
197
197
  inst=cls()
198
198
  inst.cfgFile=filename
@@ -204,14 +204,14 @@ class AnalyzeConfiguration:
204
204
 
205
205
  @classmethod
206
206
  def _read_yaml(cls,filename,parse=True,**kwargs):
207
- """_read_yaml create a new PostsimConfiguration object by reading from YAML input
207
+ """Creates a new PostsimConfiguration object by reading from YAML input.
208
208
 
209
- :param filename: name of YAML file
210
- :type filename: str
211
- :param parse: if True, parse the YAML data, defaults to True
212
- :type parse: bool, optional
213
- :return: a new PostsimConfiguration object
214
- :rtype: PostsimConfiguration
209
+ Args:
210
+ filename (str): name of YAML file
211
+ parse (bool): if True, parse the YAML data, defaults to True
212
+
213
+ Returns:
214
+ PostsimConfiguration: a new PostsimConfiguration object
215
215
  """
216
216
  inst=cls()
217
217
  inst.cfgFile=filename
@@ -222,8 +222,7 @@ class AnalyzeConfiguration:
222
222
  return inst
223
223
 
224
224
  def parse(self,**kwargs):
225
- """parse parses a PostsimConfiguration file to build the list of stages to run
226
- """
225
+ """Parses a PostsimConfiguration file to build the list of stages to run."""
227
226
  for content in self.baselist:
228
227
  analysistype=content['command']
229
228
  if analysistype in self.predefined_classes:
@@ -232,26 +231,25 @@ class AnalyzeConfiguration:
232
231
  self.stagelist.append(self.default_class(content))
233
232
 
234
233
  def analyze(args):
235
- """postsim handles the analyze subcommand for managing gromacs-based trajectory analyses
234
+ """Handles the analyze subcommand for managing gromacs-based trajectory analyses.
236
235
 
237
- :param args: command-line arguments
238
- :type args: argparse.Namespace
236
+ Args:
237
+ args (argparse.Namespace): command-line arguments
239
238
  """
240
- loglevel_numeric=getattr(logging, args.loglevel.upper())
241
- logging.basicConfig(format='%(levelname)s> %(message)s',level=loglevel_numeric)
239
+ setup_logging(args.loglevel, no_banner=args.no_banner)
242
240
  ess='y' if len(args.proj)==0 else 'ies'
243
241
  ogromacs={}
244
242
  if args.ocfg:
245
- ocfg=Configuration.read(args.ocfg,parse=False)
246
- ogromacs=ocfg.basedict.get('gromacs',{})
243
+ ocfg=Configuration.read(args.ocfg)
244
+ ogromacs=ocfg.gromacs
247
245
  cfg=AnalyzeConfiguration.read(args.cfg)
248
246
  logger.debug(f'{cfg.baselist}')
249
247
  logger.info(f'Project director{ess}: {args.proj}')
250
248
  software.sw_setup()
251
249
  logger.debug(f'ogromacs {ogromacs}')
252
250
  for d in args.proj:
253
- pfs.pfs_setup(root=os.getcwd(),topdirs=['molecules','systems','plots','postsim','analyze'],verbose=True,projdir=d,reProject=False,userlibrary=args.lib)
254
- pfs.go_to('analyze')
251
+ pfs.pfs_setup(root=os.getcwd(),topdirs=pfs.Dirs.analyze_topdirs,verbose=True,projdir=d,reProject=False,userlibrary=args.lib)
252
+ pfs.go_to(pfs.Dirs.analyze)
255
253
  for stage in cfg.stagelist:
256
254
  stage.do(**ogromacs)
257
255
  stage.parse_console_output()
@@ -1,38 +1,35 @@
1
- """
2
-
3
- .. module:: plot
4
- :synopsis: provides plotting functionality
5
-
6
- .. moduleauthor: Cameron F. Abrams, <cfa22@drexel.edu>
1
+ """Provides plotting functionality.
7
2
 
3
+ Author: Cameron F. Abrams <cfa22@drexel.edu>
8
4
  """
9
- from HTPolyNet.gromacs import *
10
- from HTPolyNet.utils import *
11
- from HTPolyNet.banner import banner
12
- import matplotlib.pyplot as plt
13
- import matplotlib.cm as cm
14
- import pandas as pd
15
5
  import logging
16
- import networkx as nx
6
+
17
7
  from datetime import datetime
8
+
18
9
  import yaml
19
10
 
11
+ import matplotlib.cm as cm
12
+ import matplotlib.pyplot as plt
13
+ import networkx as nx
14
+ import pandas as pd
15
+
16
+ from ..analysis.utils import *
17
+ from ..external.gromacs import *
18
+ from ..utils.logsetup import setup_logging
19
+
20
20
  logger=logging.getLogger(__name__)
21
21
 
22
22
  # prevents "RuntimeError: main thread is not in main loop" tk bug
23
23
  plt.switch_backend('agg')
24
24
 
25
25
  def scatter(df,xcolumn,columns=[],outfile='plot.png',**kwargs):
26
- """scatter generic scatter plot generator
27
-
28
- :param df: dataframe containing data
29
- :type df: pd.DataFrame
30
- :param xcolumn: name of column holding x-data
31
- :type xcolumn: str
32
- :param columns: list of y-value columns to be plotted vs. x, defaults to []
33
- :type columns: list, optional
34
- :param outfile: name of output image file, defaults to 'plot.png'
35
- :type outfile: str, optional
26
+ """Generic scatter plot generator.
27
+
28
+ Args:
29
+ df (pd.DataFrame): dataframe containing data
30
+ xcolumn (str): name of column holding x-data
31
+ columns (list): list of y-value columns to be plotted vs. x, defaults to []
32
+ outfile (str): name of output image file, defaults to 'plot.png'
36
33
  """
37
34
  logging.disable(logging.DEBUG)
38
35
  cmapname=kwargs.get('colormap','plasma')
@@ -50,16 +47,15 @@ def scatter(df,xcolumn,columns=[],outfile='plot.png',**kwargs):
50
47
 
51
48
 
52
49
  def trace(qty,edrs,outfile='plot.png',**kwargs):
53
- """trace generates a plot of the energy-like quantity named by 'qty' vs time by reading data from the list of edr files named in 'edrs'
54
-
55
- :param qty: name of energy-like quantity; must conform to menu generated by 'gmx energy'
56
- :type qty: str
57
- :param edrs: list of names of edr files to scan, in order
58
- :type edrs: list
59
- :param outfile: name of output image file, defaults to 'plot.png'
60
- :type outfile: str, optional
61
- :return: the list of average values
62
- :rtype: list
50
+ """Generates a plot of the energy-like quantity named by 'qty' vs time by reading data from the list of edr files named in 'edrs'.
51
+
52
+ Args:
53
+ qty (str): name of energy-like quantity; must conform to menu generated by 'gmx energy'
54
+ edrs (list): list of names of edr files to scan, in order
55
+ outfile (str): name of output image file, defaults to 'plot.png'
56
+
57
+ Returns:
58
+ list: the list of average values
63
59
  """
64
60
  # disable debug-level logging and above since matplotlib has a lot of debug statements
65
61
  logging.disable(logging.DEBUG)
@@ -111,16 +107,13 @@ def trace(qty,edrs,outfile='plot.png',**kwargs):
111
107
  return avg
112
108
 
113
109
  def multi_trace(dfL,xnames,ynames,labels=[],xlabel='time [ps]',ylabel='',outfile='plot.png',**kwargs):
114
- """multi_trace generates a plot of each y vs x in df
115
-
116
- :param df: a pandas dataframe
117
- :type df: pandas.DataFrame
118
- :param xnames: list of x-column names
119
- :type xnames: list
120
- :param ynames: list of y-column names, parallel to xnames
121
- :type ynames: list
122
- :param outfile: name of output image file, defaults to 'plot.png'
123
- :type outfile: str, optional
110
+ """Generates a plot of each y vs x in df.
111
+
112
+ Args:
113
+ dfL (list of pandas.DataFrame): list of dataframes, one per trace
114
+ xnames (list): list of x-column names
115
+ ynames (list): list of y-column names, parallel to xnames
116
+ outfile (str): name of output image file, defaults to 'plot.png'
124
117
  """
125
118
  # disable debug-level logging and above since matplotlib has a lot of debug statements
126
119
  default_units={'Temperature':'K','Pressure':'bar','Density':'kg/m^3','Potential':'kJ/mol'}
@@ -149,22 +142,16 @@ def multi_trace(dfL,xnames,ynames,labels=[],xlabel='time [ps]',ylabel='',outfile
149
142
 
150
143
 
151
144
  def global_trace(df,names,outfile='plot.png',transition_times=[],markers=[],interval_labels=[],y2names=[],**kwargs):
152
- """global_trace generates custom-formatted multiplots of energy-like quantities named in 'names' in the input dataframe df
153
-
154
- :param df: pandas dataframe containing all data
155
- :type df: pd.DataFrame
156
- :param names: list of quantity names (Density, Temperature, etc)
157
- :type names: list
158
- :param outfile: name of output image file, defaults to 'plot.png'
159
- :type outfile: str, optional
160
- :param transition_times: time values at which vertical lines are drawn, defaults to []
161
- :type transition_times: list, optional
162
- :param markers: time values at which transitions are marked somehow, I forget, defaults to []
163
- :type markers: list, optional
164
- :param interval_labels: list of labels of intervals defined by markers, defaults to []
165
- :type interval_labels: list, optional
166
- :param y2names: names of quantities to be plotted on a secondary y axis, defaults to []
167
- :type y2names: list, optional
145
+ """Generates custom-formatted multiplots of energy-like quantities named in 'names' in the input dataframe df.
146
+
147
+ Args:
148
+ df (pd.DataFrame): pandas dataframe containing all data
149
+ names (list): list of quantity names (Density, Temperature, etc)
150
+ outfile (str): name of output image file, defaults to 'plot.png'
151
+ transition_times (list): time values at which vertical lines are drawn, defaults to []
152
+ markers (list): time values at which transitions are marked, defaults to []
153
+ interval_labels (list): list of labels of intervals defined by markers, defaults to []
154
+ y2names (list): names of quantities to be plotted on a secondary y axis, defaults to []
168
155
  """
169
156
  # disable debug-level logging and above since matplotlib has a lot of debug statements
170
157
  default_units={'Temperature':'K','Pressure':'bar','Density':'kg/m^3','Potential':'kJ/mol'}
@@ -262,12 +249,11 @@ def global_trace(df,names,outfile='plot.png',transition_times=[],markers=[],inte
262
249
  logging.disable(logging.NOTSET)
263
250
 
264
251
  def network_graph(G,filename,**kwargs):
265
- """network_graph draws a custom formatted network plot from graph G
252
+ """Draws a custom formatted network plot from graph G.
266
253
 
267
- :param G: a graph from networkx
268
- :type G: nx.Graph or nx.DiGraph
269
- :param filename: name of output image filename
270
- :type filename: str
254
+ Args:
255
+ G (nx.Graph or nx.DiGraph): a graph from networkx
256
+ filename (str): name of output image filename
271
257
  """
272
258
  logging.disable(logging.DEBUG)
273
259
  arrows=kwargs.get('arrows',False)
@@ -296,29 +282,26 @@ _template_2_token_idx=[2,3,6,7]
296
282
  _template_2_data_idx={'iter':(int,5),'conv':(float,8),'nbonds':(int,10)}
297
283
 
298
284
  def _token_match(l,template,pat_idx):
299
- """_token_match returns True if tokens indexed by pat_idx in the space-split l and template match
300
-
301
- :param l: probe string
302
- :type l: str
303
- :param template: template string
304
- :type template: str
305
- :param pat_idx: list of token indices
306
- :type pat_idx: list
307
- :return: True if tokens in l match those in template
308
- :rtype: bool
285
+ """Returns True if tokens indexed by pat_idx in the space-split l and template match.
286
+
287
+ Args:
288
+ l (str): probe string
289
+ template (str): template string
290
+ pat_idx (list): list of token indices
291
+
292
+ Returns:
293
+ bool: True if tokens in l match those in template
309
294
  """
310
295
  if len(l.split())!=len(template.split()): return
311
296
  return all([l.split()[t]==template.split()[t] for t in pat_idx])
312
297
 
313
298
  def _parse_data(dat,l,idx_dict):
314
- """_parse_data parses data in a matching line
315
-
316
- :param dat: pandas dataframe
317
- :type dat: pd.DataFame
318
- :param l: line
319
- :type l: str
320
- :param idx_dict: dictionary of column-name:(type-converter,token-index)
321
- :type idx_dict: dict
299
+ """Parses data in a matching line.
300
+
301
+ Args:
302
+ dat (pd.DataFrame): pandas dataframe
303
+ l (str): line
304
+ idx_dict (dict): dictionary of column-name:(type-converter,token-index)
322
305
  """
323
306
  tok=l.split()
324
307
  for k,v in idx_dict.items():
@@ -326,12 +309,11 @@ def _parse_data(dat,l,idx_dict):
326
309
  dat[k].append(conv(tok[s]))
327
310
 
328
311
  def diagnostics_graphs(logfiles,filename,**kwargs):
329
- """diagnostics_graphs extracts selected data from the diagnostic output and generates plots
312
+ """Extracts selected data from the diagnostic output and generates plots.
330
313
 
331
- :param logfiles: list of names of diagnostic log files to treat in parallel
332
- :type logfiles: list
333
- :param filename: name of output image file
334
- :type filename: str
314
+ Args:
315
+ logfiles (list): list of names of diagnostic log files to treat in parallel
316
+ filename (str): name of output image file
335
317
  """
336
318
  xmax=kwargs.get('xmax',-1)
337
319
  figsize=kwargs.get('figsize',(12,6))
@@ -383,12 +365,13 @@ def diagnostics_graphs(logfiles,filename,**kwargs):
383
365
  logging.disable(logging.NOTSET)
384
366
 
385
367
  def init_molecule_graph(proj_dir):
386
- """init_molecule_graph creates and initializes a inter-molecular graph to show network connectivity
368
+ """Creates and initializes an inter-molecular graph to show network connectivity.
369
+
370
+ Args:
371
+ proj_dir (str): name of project directory
387
372
 
388
- :param proj_dir: name of project directory
389
- :type proj_dir: str
390
- :return: a nodes-only Graph enumerating all molecules; this will be further processed elsewhere to add connectivity information
391
- :rtype: networkx.Graph
373
+ Returns:
374
+ networkx.Graph: a nodes-only Graph enumerating all molecules; this will be further processed elsewhere to add connectivity information
392
375
  """
393
376
  gro=os.path.join(proj_dir,'systems/init/init.gro')
394
377
  top=os.path.join(proj_dir,'systems/init/init.top')
@@ -402,14 +385,12 @@ def init_molecule_graph(proj_dir):
402
385
  return G
403
386
 
404
387
  def plots(args):
405
- """plots handles the plots subcommand
388
+ """Handles the plots subcommand.
406
389
 
407
- :param args: command-line arguments
408
- :type args: argparse.Namespace
390
+ Args:
391
+ args (argparse.Namespace): command-line arguments
409
392
  """
410
- loglevel_numeric=getattr(logging, args.loglevel.upper())
411
- logging.basicConfig(format='%(levelname)s> %(message)s',level=loglevel_numeric)
412
- if not args.no_banner: banner(logger.info)
393
+ setup_logging(args.loglevel, no_banner=args.no_banner)
413
394
 
414
395
  if args.source=='build':
415
396
  build_plots(args)