HTPolyNet 1.0.7.2__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 (93) hide show
  1. HTPolyNet/__init__.py +1 -0
  2. HTPolyNet/ambertools.py +94 -0
  3. HTPolyNet/analyze.py +258 -0
  4. HTPolyNet/banner.py +26 -0
  5. HTPolyNet/bondlist.py +206 -0
  6. HTPolyNet/bondtemplate.py +111 -0
  7. HTPolyNet/checkpoint.py +88 -0
  8. HTPolyNet/command.py +42 -0
  9. HTPolyNet/configuration.py +240 -0
  10. HTPolyNet/coordinates.py +1071 -0
  11. HTPolyNet/countTime.py +26 -0
  12. HTPolyNet/curecontroller.py +767 -0
  13. HTPolyNet/dataframetools.py +130 -0
  14. HTPolyNet/driver.py +250 -0
  15. HTPolyNet/expandreactions.py +154 -0
  16. HTPolyNet/gromacs.py +333 -0
  17. HTPolyNet/inputcheck.py +51 -0
  18. HTPolyNet/linkcell.py +322 -0
  19. HTPolyNet/molecule.py +1279 -0
  20. HTPolyNet/plot.py +607 -0
  21. HTPolyNet/postsim.py +444 -0
  22. HTPolyNet/projectfilesystem.py +483 -0
  23. HTPolyNet/reaction.py +282 -0
  24. HTPolyNet/resources/README.md +20 -0
  25. HTPolyNet/resources/__init__.py +0 -0
  26. HTPolyNet/resources/cfg/DGE-PAC-hi.yaml +115 -0
  27. HTPolyNet/resources/cfg/DGE-PAC-lo.yaml +115 -0
  28. HTPolyNet/resources/cfg/FDE-DFDA-hi.yaml +116 -0
  29. HTPolyNet/resources/cfg/FDE-DFDA-lo.yaml +116 -0
  30. HTPolyNet/resources/cfg/GMASTY-hi.yaml +158 -0
  31. HTPolyNet/resources/cfg/GMASTY-lo.yaml +158 -0
  32. HTPolyNet/resources/cfg/README.md +1 -0
  33. HTPolyNet/resources/cfg/STY.yaml +23 -0
  34. HTPolyNet/resources/cfg/pMSTY-hi.yaml +101 -0
  35. HTPolyNet/resources/cfg/pMSTY-lo.yaml +101 -0
  36. HTPolyNet/resources/cfg/pSTY-hi.yaml +101 -0
  37. HTPolyNet/resources/cfg/pSTY-lo.yaml +101 -0
  38. HTPolyNet/resources/example_depot/0-liquid-styrene.tgz +0 -0
  39. HTPolyNet/resources/example_depot/1-polystyrene.tgz +0 -0
  40. HTPolyNet/resources/example_depot/2-polymethylstyrene.tgz +0 -0
  41. HTPolyNet/resources/example_depot/3-bisgma-styrene-thermoset.tgz +0 -0
  42. HTPolyNet/resources/example_depot/4-pacm-dgeba-epoxy-thermoset.tgz +0 -0
  43. HTPolyNet/resources/example_depot/5-dfda-fde-epoxy-thermoset.tgz +0 -0
  44. HTPolyNet/resources/mdp/README.md +1 -0
  45. HTPolyNet/resources/mdp/drag-min.mdp +13 -0
  46. HTPolyNet/resources/mdp/drag-npt.mdp +36 -0
  47. HTPolyNet/resources/mdp/drag-nvt.mdp +31 -0
  48. HTPolyNet/resources/mdp/min.mdp +14 -0
  49. HTPolyNet/resources/mdp/npt.mdp +37 -0
  50. HTPolyNet/resources/mdp/nvt.mdp +29 -0
  51. HTPolyNet/resources/mdp/relax-min.mdp +13 -0
  52. HTPolyNet/resources/mdp/relax-npt.mdp +37 -0
  53. HTPolyNet/resources/mdp/relax-nvt.mdp +31 -0
  54. HTPolyNet/resources/mdp/single-molecule-min.mdp +12 -0
  55. HTPolyNet/resources/mdp/single-molecule-nvt.mdp +25 -0
  56. HTPolyNet/resources/molecules/inputs/DFA.pdb +62 -0
  57. HTPolyNet/resources/molecules/inputs/DGE.mol2 +115 -0
  58. HTPolyNet/resources/molecules/inputs/EMB.mol2 +50 -0
  59. HTPolyNet/resources/molecules/inputs/FDE.pdb +72 -0
  60. HTPolyNet/resources/molecules/inputs/GMA.mol2 +163 -0
  61. HTPolyNet/resources/molecules/inputs/PAC.mol2 +91 -0
  62. HTPolyNet/resources/molecules/inputs/STY.mol2 +44 -0
  63. HTPolyNet/resources/molecules/make-monomers.sh +64 -0
  64. HTPolyNet/resources/molecules/pics/DFA.png +0 -0
  65. HTPolyNet/resources/molecules/pics/DGE.png +0 -0
  66. HTPolyNet/resources/molecules/pics/EMB.png +0 -0
  67. HTPolyNet/resources/molecules/pics/FDE.png +0 -0
  68. HTPolyNet/resources/molecules/pics/GMA.png +0 -0
  69. HTPolyNet/resources/molecules/pics/PAC.png +0 -0
  70. HTPolyNet/resources/molecules/pics/STY.png +0 -0
  71. HTPolyNet/resources/molecules/sample-inputs/DFA.pdb +62 -0
  72. HTPolyNet/resources/molecules/sample-inputs/DGE.mol2 +115 -0
  73. HTPolyNet/resources/molecules/sample-inputs/EMB.mol2 +50 -0
  74. HTPolyNet/resources/molecules/sample-inputs/FDE.pdb +72 -0
  75. HTPolyNet/resources/molecules/sample-inputs/GMA.mol2 +163 -0
  76. HTPolyNet/resources/molecules/sample-inputs/PAC.mol2 +91 -0
  77. HTPolyNet/resources/molecules/sample-inputs/STY.mol2 +44 -0
  78. HTPolyNet/resources/tcl/readbonds.tcl +32 -0
  79. HTPolyNet/resources/tcl/readgrx.tcl +46 -0
  80. HTPolyNet/resources/tcl/render.tcl +74 -0
  81. HTPolyNet/ring.py +155 -0
  82. HTPolyNet/runtime.py +709 -0
  83. HTPolyNet/software.py +106 -0
  84. HTPolyNet/stringthings.py +39 -0
  85. HTPolyNet/topocoord.py +1877 -0
  86. HTPolyNet/topology.py +1288 -0
  87. HTPolyNet/unused_symmetry_stuff.py +291 -0
  88. HTPolyNet/utils.py +405 -0
  89. htpolynet-1.0.7.2.dist-info/METADATA +84 -0
  90. htpolynet-1.0.7.2.dist-info/RECORD +93 -0
  91. htpolynet-1.0.7.2.dist-info/WHEEL +4 -0
  92. htpolynet-1.0.7.2.dist-info/entry_points.txt +2 -0
  93. htpolynet-1.0.7.2.dist-info/licenses/LICENSE +21 -0
HTPolyNet/software.py ADDED
@@ -0,0 +1,106 @@
1
+ """
2
+
3
+ .. module:: software
4
+ :synopsis: handles identification of available software needed by HTPolyNet
5
+
6
+ .. moduleauthor: Cameron F. Abrams, <cfa22@drexel.edu>
7
+
8
+ """
9
+ import subprocess
10
+ import logging
11
+ import os
12
+ from HTPolyNet.stringthings import my_logger
13
+ # from GPUtil import getGPUs
14
+ logger=logging.getLogger(__name__)
15
+
16
+ class Software:
17
+ ambertools=['antechamber','tleap','parmchk2']
18
+ def __init__(self):
19
+ """__init__ generates a new Software object
20
+ """
21
+ cnf=[]
22
+ self.passes=True
23
+ for c in Software.ambertools:
24
+ CP=subprocess.run(['which',c],capture_output=True,text=True)
25
+ if CP.returncode!=0:
26
+ self.passes=False
27
+ cnf.append(c)
28
+ try:
29
+ assert self.passes,f'Could not find {cnf}'
30
+ except AssertionError:
31
+ print('It seems like you do not have an accessible installation of ambertools.')
32
+
33
+ def set_gmx_preferences(self,parameters):
34
+ """set_gmx_preferences set the necessary resolution of gromacs executables based on directives in the parameters parameter
35
+
36
+ :param parameters: dictionary read in from cfg file
37
+ :type parameters: dict
38
+ """
39
+ gromacs_dict=parameters.get('gromacs',{})
40
+ logger.debug(f'gromacs_dict {gromacs_dict}')
41
+ if gromacs_dict:
42
+ self.gmx=gromacs_dict.get('gmx','gmx')
43
+ self.gmx_options=gromacs_dict.get('gmx_options','-quiet')
44
+ self.mdrun_options=gromacs_dict.get('mdrun_options',{})
45
+ self.mdrun=gromacs_dict.get('mdrun',f'{self.gmx} {self.gmx_options} mdrun')
46
+ self.mdrun_single_molecule=gromacs_dict.get('mdrun_single_molecule',f'{self.gmx} {self.gmx_options} mdrun')
47
+ logger.debug(f'{self.gmx}, {self.gmx_options}, {self.mdrun}')
48
+ else:
49
+ self.gmx_options=parameters.get('gmx_options','')
50
+ self.gmx=parameters.get('gmx','gmx')
51
+ self.mdrun=parameters.get('mdrun',f'{self.gmx} {self.gmx_options} mdrun')
52
+ self.mdrun_single_molecule=parameters.get('mdrun_single_molecule',f'{self.gmx} {self.gmx_options} mdrun')
53
+ CP=subprocess.run(['which',self.gmx],capture_output=True,text=True)
54
+ assert CP.returncode==0,f'{self.gmx} not found'
55
+
56
+ def __str__(self):
57
+ self.getVersions()
58
+ r=['Ambertools:']
59
+ for c in self.ambertools:
60
+ r.append(f'{os.path.split(c)[1]:>12s} ({self.versions["ambertools"]:>s})')
61
+ return '\n'.join(r)
62
+
63
+ def getVersions(self):
64
+ """getVersions attempts to determine versions of AmberTools
65
+ """
66
+ self.versions={}
67
+ if self.passes:
68
+ CP=subprocess.run(['antechamber','-h'],capture_output=True,text=True)
69
+ l=CP.stdout.split('\n')[1].split()[3].strip().strip(':')
70
+ self.versions['ambertools']=f'ver. {l}'
71
+ else:
72
+ self.versions['ambertools']='Not installed.'
73
+
74
+ def info(self):
75
+ my_logger(str(self),logger.info)
76
+
77
+ _SW_:Software=None
78
+ def sw_setup():
79
+ """sw_setup sets up the global Software object
80
+ """
81
+ global _SW_
82
+ _SW_=Software()
83
+
84
+ def info():
85
+ _SW_.info()
86
+
87
+ def to_string():
88
+ return str(_SW_)
89
+
90
+ gmx='gmx'
91
+ gmx_options='-quiet'
92
+ mdrun=f'{gmx} mdrun'
93
+ mdrun_single_molecule=f'{gmx} mdrun'
94
+ def set_gmx_preferences(parmdict):
95
+ """set_gmx_preferences sets the global Gromacs preferences
96
+
97
+ :param parmdict: dictionary from cfg file
98
+ :type parmdict: dict
99
+ """
100
+ global _SW_, gmx, gmx_options, mdrun, mdrun_single_molecule
101
+ _SW_.set_gmx_preferences(parmdict)
102
+ gmx=_SW_.gmx
103
+ gmx_options=_SW_.gmx_options
104
+ mdrun=_SW_.mdrun
105
+ mdrun_single_molecule=_SW_.mdrun_single_molecule
106
+
@@ -0,0 +1,39 @@
1
+ """
2
+
3
+ .. module:: stringthings
4
+ :synopsis: defines a specially-formatted logging method (silly)
5
+
6
+ .. moduleauthor: Cameron F. Abrams, <cfa22@drexel.edu>
7
+
8
+ """
9
+ import pandas as pd
10
+ _ANGSTROM_='Ångström'
11
+
12
+ def my_logger(msg,logf,width=67,fill='*',sep=', ',just='^'):
13
+ fmt=r'{'+r':'+fill+just+f'{width}'+r'}'
14
+ ll=' ' if just in ['^','>'] else ''
15
+ rr=' ' if just in ['^','<'] else ''
16
+ if type(msg)==list:
17
+ rr=' ' if ' ' not in sep else ''
18
+ lnlst=[]
19
+ for tok in msg:
20
+ ll_sofar=sum([len(x) for x in lnlst])
21
+ test_ll=ll_sofar+len(tok)+len(sep)*(len(lnlst)+1)
22
+ if test_ll>width-2*(1+len(sep)):
23
+ outstr=ll+sep.join(lnlst)+sep+rr
24
+ logf(fmt.format(outstr))
25
+ lnlst=[tok]
26
+ else:
27
+ lnlst.append(tok)
28
+ outstr=ll+sep.join(lnlst)+' '
29
+ logf(fmt.format(outstr))
30
+ elif type(msg)==pd.DataFrame:
31
+ for ln in msg.to_string().split('\n'):
32
+ outstr=ll+ln+rr
33
+ logf(fmt.format(outstr))
34
+ else:
35
+ lns=msg.split('\n')
36
+ for ln in lns:
37
+ outstr=ll+ln+rr
38
+ logf(fmt.format(outstr))
39
+