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
@@ -0,0 +1,74 @@
1
+ # This script makes still images of systems that include only residues that
2
+ # have reacted
3
+ #
4
+ #
5
+ # inside of a "systems" subdirectory, issue "vmd -dispdev text -e render.tcl"
6
+ # Cameron F Abrams
7
+
8
+ package require pbctools
9
+
10
+ # read a column-oriented data file with a header row
11
+ # into a dictionary keyed by column name with value list
12
+ # from that column
13
+ # Assumes rows are whitespace-delimited
14
+ proc read_cod { filename } {
15
+ set pfi [open $filename "r"]
16
+ # read header
17
+ set cnt [gets $pfi header]
18
+ if {$cnt < 0} {return}
19
+ set columns [regexp -all -inline {\S+} $header]
20
+ set D [dict create]
21
+ foreach h $columns {
22
+ dict append D $h [list]
23
+ }
24
+ while {1 == 1} {
25
+ set cnt [gets $pfi line]
26
+ if {$cnt < 0} {break}
27
+ set columns [regexp -all -inline {\S+} $line]
28
+ for {set i 0} {$i < [llength $columns]} { incr i } {
29
+ set key [lindex $header $i]
30
+ dict lappend D $key [lindex $columns $i]
31
+ }
32
+ }
33
+ close $pfi
34
+ return $D
35
+ }
36
+
37
+ proc render_by_reactants { iter_no image_file current_resids } {
38
+ set pre "iter-"
39
+ append pre $iter_no
40
+ set dfn $pre
41
+ append dfn "/2-cure_update-bonds.csv"
42
+ set cfg $pre
43
+ append cfg "/4-cure_equilibrate-npt.gro"
44
+ set D [read_cod $dfn]
45
+ set R [lsort -integer -unique [concat $current_resids [dict get $D ri] [dict get $D rj]]]
46
+
47
+ set viewplist {}
48
+ mol new $cfg type gro first 0 last -1 step 1 filebonds 1 autobonds 1 waitfor all
49
+ mol delrep 0 top
50
+ mol representation Licorice 0.300000 12.000000 12.000000
51
+ mol color ResName
52
+ mol selection "resid $R"
53
+ mol material Opaque
54
+ mol addrep top
55
+
56
+ # set viewpoints {{{1 0 0 -25.9876} {0 1 0 -26.254} {0 0 1 -26.024} {0 0 0 1}} {{0.779795 -0.0110901 0.625937 0} {0.0650928 0.99586 -0.0634485 0} {-0.622642 0.0902208 0.777288 0} {0 0 0 1}} {{0.0264722 0 0 0} {0 0.0264722 0 0} {0 0 0.0264722 0} {0 0 0 1}} {{1 0 0 -0.06} {0 1 0 0.07} {0 0 1 0} {0 0 0 1}}}
57
+ # molinfo top set {center_matrix rotate_matrix scale_matrix global_matrix} $viewpoints
58
+
59
+ axes location off
60
+ color Display {Background} white
61
+ pbc box
62
+ render TachyonInternal $image_file
63
+ mol delete top
64
+ return $R
65
+ }
66
+
67
+ set current_resids [list]
68
+ for {set i 1} { $i < 36 } { incr i } {
69
+ set imname $i
70
+ append imname ".tga"
71
+ set current_resids [render_by_reactants $i $imname $current_resids]
72
+ }
73
+ quit
74
+
HTPolyNet/ring.py ADDED
@@ -0,0 +1,155 @@
1
+ """
2
+
3
+ .. module:: ring
4
+ :synopsis: handles ring-piercing determinations
5
+
6
+ .. moduleauthor: Cameron F. Abrams, <cfa22@drexel.edu>
7
+
8
+ """
9
+ # Pierced rings
10
+ # Cameron F. Abrams cfa22@drexel.edu
11
+ #
12
+ # How to use (suggested):
13
+ #
14
+ # 1. Create a list of rings from a coordinate snapshot:
15
+ # Suppose X is an Nx3 numpy array ordered such
16
+ # that each consecutive group of six elements are
17
+ # the positions of carbon atoms of a phenyl ring.
18
+ # Then
19
+ #
20
+ # Rings=[]
21
+ # for i in range(0,len(X),6):
22
+ # Rings.append(Ring(np.array([X[i+j] for j in range(6)]))
23
+ #
24
+ # This can be done once per CURE iteration as long as R is
25
+ # in scope.
26
+ #
27
+ # 2. Now, suppose B is a 2x3 numpy array containing coordinates
28
+ # of two atoms that are a potential bond. Cast this as a
29
+ # Segment, and then loop over Rings until a piercing is found
30
+ #
31
+ # S=Segment(B)
32
+ # for R in Rings:
33
+ # pierced,P=R.segint(S)
34
+ # if pierced:
35
+ # # print some message
36
+ # # set some "not allowed to bond" flag
37
+ # break
38
+ #
39
+ # IMPORTANT NOTE: no MIC is used here, so all
40
+ # coordinates must be unwrapped into the *same*
41
+ # periodic image!
42
+ #
43
+ import numpy as np
44
+
45
+ def lawofcos(a,b):
46
+ """lawofcos return the cosine of the angle defined by vectors a and b if they share a vertex (the LAW OF COSINES)
47
+
48
+ :param a: a vector
49
+ :type a: numpy.ndarray(3,float)
50
+ :param b: another vector
51
+ :type b: numpy.ndarray(3,float)
52
+ :return: cosine of the angle formed by a and b
53
+ :rtype: float
54
+ """
55
+ return np.dot(a,b)/np.sqrt(np.dot(a,a)*np.dot(b,b))
56
+
57
+ class Segment:
58
+ """ a segment object owns a list of Points P with two elements representing segment endpoints, and a vector that points from the first point to the second, V
59
+ """
60
+ def __init__(self,P):
61
+ """__init__ generates a new Segment object from the points in container P
62
+
63
+ :param P: listlike container of two points, each of which is a 3-dimensional numpy array
64
+ :type P: list
65
+ """
66
+ self.P=P.copy()
67
+ # will need to recompute this when molecules are shifted
68
+ self.V=self.P[1]-self.P[0] # p1=p0+t*(p1-p0)
69
+
70
+ class Ring:
71
+ def __init__(self,P):
72
+ """__init__ generates a Ring object from the list of N points P
73
+
74
+ :param P: listlike container of N points defining an N-membered ring
75
+ :type P: list
76
+ """
77
+ self.V=P.copy() # Nx3 np array P[i] is point-i (x,y,z)
78
+ def analyze(self):
79
+ """analyze computes some geometric features of a Ring object
80
+ """
81
+ # geometric center
82
+ self.O=np.zeros(shape=(3))
83
+ for i in self.V:
84
+ self.O=self.O+i
85
+ self.O=self.O/len(self.V)
86
+ self.B=[] # list of bond vectors
87
+ self.C=[] # list of bond-i-bond-i+1 cross produts
88
+ for i,j in zip(self.V[:-1],self.V[1:]):
89
+ self.B.append(i-j)
90
+ self.B.append(self.V[-1]-self.V[0])
91
+ for bi,bj in zip(self.B[:-1],self.B[1:]):
92
+ self.C.append(np.cross(bi,bj))
93
+ self.C.append(np.cross(self.B[-1],self.B[0]))
94
+ # compute unit normal vector as average
95
+ # of all bond-i-bond-i+1 crosses
96
+ n=np.zeros(shape=(3))
97
+ for c in self.C:
98
+ n=n+c
99
+ self.n=n/np.sqrt(np.dot(n,n))
100
+ # compute planarity as average of all
101
+ # cross-i-cross-i+1 dot products
102
+ self.planarity=0
103
+ for ci,cj in zip(self.C[:-1],self.C[1:]):
104
+ self.planarity+=lawofcos(ci,cj)
105
+ self.planarity+=lawofcos(self.C[-1],self.C[0])
106
+ self.planarity/=6
107
+ # get the d for n-dot-r + d = 0 equation of the plane
108
+ # n[0]*(x-O[0])+n[1]*(y-O[1])+n[2]*(z-O[2])=0
109
+ # n[0]*x + n[1]*y + n[2]*z - (n[0]*O[0]+n[1]*O[1]+n[2]*O[2]) = 0
110
+ self.d=-np.dot(self.n,self.O)
111
+ def __str__(self):
112
+ return str(self.V)
113
+ def self_planarize(self):
114
+ """self_planarize projects points in P into plane -> vP
115
+ """
116
+ self.vP=[]
117
+ for v in self.V:
118
+ r=v-self.O
119
+ p=r-np.dot(r,self.n)*self.n
120
+ newv=p+self.O
121
+ self.vP.append(newv)
122
+ def segint(self,S):
123
+ """segint determines if segment S pierces ring; uses ray projection method
124
+ and fact that scaled length must be between 0 and 1 for a plane intersection
125
+
126
+ :param S: a Segment object
127
+ :type S: Segment
128
+ :return: True if S pierces self's ring, along with the intersection point
129
+ :rtype: tuple (boolean, Point)
130
+ """
131
+ #
132
+ t=-(np.dot(S.P[0],self.n)+self.d)/(np.dot(S.V,self.n))
133
+ if 0<t<1:
134
+ # compute point in ring plane that marks intersection with this vector
135
+ P=S.P[0]+t*S.V
136
+ # determine if P is inside ring:
137
+ # 1. project every ring vertex into the common plane (if necessary)
138
+ self.self_planarize()
139
+ OP=self.O-P
140
+ inside=True
141
+ # 2. for every vertex vi: angle O-vi-P must be
142
+ # more acute than angle O-vi-v(i+1) in order
143
+ # for point P to be inside the ring
144
+ for i in range(len(self.vP)):
145
+ vi=self.vP[i]
146
+ vii=self.vP[np.mod((i+1),len(self.vP))]
147
+ r=self.O-vi
148
+ e=vii-vi
149
+ vp=P-vi
150
+ cp=lawofcos(vp,r)
151
+ ce=lawofcos(e,r)
152
+ inside = inside and cp > ce
153
+ return inside, P
154
+ return False, np.zeros(3)*np.nan
155
+