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.
- HTPolyNet/__init__.py +1 -0
- HTPolyNet/ambertools.py +94 -0
- HTPolyNet/analyze.py +258 -0
- HTPolyNet/banner.py +26 -0
- HTPolyNet/bondlist.py +206 -0
- HTPolyNet/bondtemplate.py +111 -0
- HTPolyNet/checkpoint.py +88 -0
- HTPolyNet/command.py +42 -0
- HTPolyNet/configuration.py +240 -0
- HTPolyNet/coordinates.py +1071 -0
- HTPolyNet/countTime.py +26 -0
- HTPolyNet/curecontroller.py +767 -0
- HTPolyNet/dataframetools.py +130 -0
- HTPolyNet/driver.py +250 -0
- HTPolyNet/expandreactions.py +154 -0
- HTPolyNet/gromacs.py +333 -0
- HTPolyNet/inputcheck.py +51 -0
- HTPolyNet/linkcell.py +322 -0
- HTPolyNet/molecule.py +1279 -0
- HTPolyNet/plot.py +607 -0
- HTPolyNet/postsim.py +444 -0
- HTPolyNet/projectfilesystem.py +483 -0
- HTPolyNet/reaction.py +282 -0
- HTPolyNet/resources/README.md +20 -0
- HTPolyNet/resources/__init__.py +0 -0
- HTPolyNet/resources/cfg/DGE-PAC-hi.yaml +115 -0
- HTPolyNet/resources/cfg/DGE-PAC-lo.yaml +115 -0
- HTPolyNet/resources/cfg/FDE-DFDA-hi.yaml +116 -0
- HTPolyNet/resources/cfg/FDE-DFDA-lo.yaml +116 -0
- HTPolyNet/resources/cfg/GMASTY-hi.yaml +158 -0
- HTPolyNet/resources/cfg/GMASTY-lo.yaml +158 -0
- HTPolyNet/resources/cfg/README.md +1 -0
- HTPolyNet/resources/cfg/STY.yaml +23 -0
- HTPolyNet/resources/cfg/pMSTY-hi.yaml +101 -0
- HTPolyNet/resources/cfg/pMSTY-lo.yaml +101 -0
- HTPolyNet/resources/cfg/pSTY-hi.yaml +101 -0
- HTPolyNet/resources/cfg/pSTY-lo.yaml +101 -0
- HTPolyNet/resources/example_depot/0-liquid-styrene.tgz +0 -0
- HTPolyNet/resources/example_depot/1-polystyrene.tgz +0 -0
- HTPolyNet/resources/example_depot/2-polymethylstyrene.tgz +0 -0
- HTPolyNet/resources/example_depot/3-bisgma-styrene-thermoset.tgz +0 -0
- HTPolyNet/resources/example_depot/4-pacm-dgeba-epoxy-thermoset.tgz +0 -0
- HTPolyNet/resources/example_depot/5-dfda-fde-epoxy-thermoset.tgz +0 -0
- HTPolyNet/resources/mdp/README.md +1 -0
- HTPolyNet/resources/mdp/drag-min.mdp +13 -0
- HTPolyNet/resources/mdp/drag-npt.mdp +36 -0
- HTPolyNet/resources/mdp/drag-nvt.mdp +31 -0
- HTPolyNet/resources/mdp/min.mdp +14 -0
- HTPolyNet/resources/mdp/npt.mdp +37 -0
- HTPolyNet/resources/mdp/nvt.mdp +29 -0
- HTPolyNet/resources/mdp/relax-min.mdp +13 -0
- HTPolyNet/resources/mdp/relax-npt.mdp +37 -0
- HTPolyNet/resources/mdp/relax-nvt.mdp +31 -0
- HTPolyNet/resources/mdp/single-molecule-min.mdp +12 -0
- HTPolyNet/resources/mdp/single-molecule-nvt.mdp +25 -0
- HTPolyNet/resources/molecules/inputs/DFA.pdb +62 -0
- HTPolyNet/resources/molecules/inputs/DGE.mol2 +115 -0
- HTPolyNet/resources/molecules/inputs/EMB.mol2 +50 -0
- HTPolyNet/resources/molecules/inputs/FDE.pdb +72 -0
- HTPolyNet/resources/molecules/inputs/GMA.mol2 +163 -0
- HTPolyNet/resources/molecules/inputs/PAC.mol2 +91 -0
- HTPolyNet/resources/molecules/inputs/STY.mol2 +44 -0
- HTPolyNet/resources/molecules/make-monomers.sh +64 -0
- HTPolyNet/resources/molecules/pics/DFA.png +0 -0
- HTPolyNet/resources/molecules/pics/DGE.png +0 -0
- HTPolyNet/resources/molecules/pics/EMB.png +0 -0
- HTPolyNet/resources/molecules/pics/FDE.png +0 -0
- HTPolyNet/resources/molecules/pics/GMA.png +0 -0
- HTPolyNet/resources/molecules/pics/PAC.png +0 -0
- HTPolyNet/resources/molecules/pics/STY.png +0 -0
- HTPolyNet/resources/molecules/sample-inputs/DFA.pdb +62 -0
- HTPolyNet/resources/molecules/sample-inputs/DGE.mol2 +115 -0
- HTPolyNet/resources/molecules/sample-inputs/EMB.mol2 +50 -0
- HTPolyNet/resources/molecules/sample-inputs/FDE.pdb +72 -0
- HTPolyNet/resources/molecules/sample-inputs/GMA.mol2 +163 -0
- HTPolyNet/resources/molecules/sample-inputs/PAC.mol2 +91 -0
- HTPolyNet/resources/molecules/sample-inputs/STY.mol2 +44 -0
- HTPolyNet/resources/tcl/readbonds.tcl +32 -0
- HTPolyNet/resources/tcl/readgrx.tcl +46 -0
- HTPolyNet/resources/tcl/render.tcl +74 -0
- HTPolyNet/ring.py +155 -0
- HTPolyNet/runtime.py +709 -0
- HTPolyNet/software.py +106 -0
- HTPolyNet/stringthings.py +39 -0
- HTPolyNet/topocoord.py +1877 -0
- HTPolyNet/topology.py +1288 -0
- HTPolyNet/unused_symmetry_stuff.py +291 -0
- HTPolyNet/utils.py +405 -0
- htpolynet-1.0.7.2.dist-info/METADATA +84 -0
- htpolynet-1.0.7.2.dist-info/RECORD +93 -0
- htpolynet-1.0.7.2.dist-info/WHEEL +4 -0
- htpolynet-1.0.7.2.dist-info/entry_points.txt +2 -0
- 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
|
+
|