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,291 @@
|
|
|
1
|
+
"""
|
|
2
|
+
|
|
3
|
+
.. module:: unused_symmetry_stuff
|
|
4
|
+
:synopsis: tools for automated detection of molecular symmetry; as the name implies, HTPolyNet does not use these routines currently. In pre-release versions, we attempted to use these routines along with very high-T MD simulations of flexible molecules to identify symmetry-equivalent atoms using a distance-matrix approach. Now since we force the user to explicitly declare symmetry-sets, these routines are defunct. They didn't work reliably anyway, but they're kept here to stimulate future efforts to make this feature work. I've also included a couple of methods used for enumeration of angles and dihedrals that have not proven necessary.
|
|
5
|
+
|
|
6
|
+
.. moduleauthor: Cameron F. Abrams, <cfa22@drexel.edu>
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
import numpy as np
|
|
10
|
+
import os
|
|
11
|
+
from pytrr import GroTrrReader
|
|
12
|
+
import logging
|
|
13
|
+
|
|
14
|
+
logger=logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
def encluster(i,j,c):
|
|
17
|
+
"""encluster enforce objects i and j to have the same cluster index c[i] and c[j]
|
|
18
|
+
|
|
19
|
+
:param i: an index
|
|
20
|
+
:type i: int
|
|
21
|
+
:param j: another index
|
|
22
|
+
:type j: int
|
|
23
|
+
:param c: array of cluster indices
|
|
24
|
+
:type c: list
|
|
25
|
+
:return: True if i and j already have same cluster index, False otherwise
|
|
26
|
+
:rtype: bool
|
|
27
|
+
"""
|
|
28
|
+
if c[i]==c[j]:
|
|
29
|
+
return True
|
|
30
|
+
if c[j]>c[i]:
|
|
31
|
+
for k in range(len(c)):
|
|
32
|
+
if c[k]==c[j]:
|
|
33
|
+
c[k]=c[i]
|
|
34
|
+
elif c[j]<c[i]:
|
|
35
|
+
for k in range(len(c)):
|
|
36
|
+
if c[k]==c[i]:
|
|
37
|
+
c[k]=c[j]
|
|
38
|
+
return False
|
|
39
|
+
|
|
40
|
+
def symm(d,thresh=0.1,outfile=None):
|
|
41
|
+
"""symm Builds and returns an atom-idx-ordered list of sea-cluster indexes.
|
|
42
|
+
Any two atoms with the same sea-cluster-index are considered
|
|
43
|
+
symmetry equivalent.
|
|
44
|
+
|
|
45
|
+
:param d: interatomic distance matrix
|
|
46
|
+
:type d: np.ndarray((N,N),float)
|
|
47
|
+
:param thresh: threshold value of euclidean norm of difference between rank-ordered distance matrix columns, defaults to 0.1
|
|
48
|
+
:type thresh: float, optional
|
|
49
|
+
:param outfile: name of outpufile, defaults to None
|
|
50
|
+
:type outfile: str, optional
|
|
51
|
+
:return: symmetry set indices for each atom
|
|
52
|
+
:rtype: list
|
|
53
|
+
"""
|
|
54
|
+
na=d.shape[0]
|
|
55
|
+
# initialize per-atom cluster id's to atom indexes (0-)
|
|
56
|
+
cluster_ids=np.arange(na)
|
|
57
|
+
# sort every column of distance matrix
|
|
58
|
+
d=np.sort(d,axis=0)
|
|
59
|
+
# make a list of columns
|
|
60
|
+
c=np.array([d[:,i] for i in range(d.shape[1])])
|
|
61
|
+
l=[]
|
|
62
|
+
# compute magnitude of distance between columns for
|
|
63
|
+
# all unique pairs of columns, store as a list
|
|
64
|
+
# of 3-tuples (i,j,distance)
|
|
65
|
+
for i,ri in enumerate(c):
|
|
66
|
+
for j,rj in enumerate(c):
|
|
67
|
+
if i<j:
|
|
68
|
+
ij=ri-rj
|
|
69
|
+
l.append((i,j,np.sqrt(ij.dot(ij))))
|
|
70
|
+
|
|
71
|
+
# sort the list by distances (not strictly necessary)
|
|
72
|
+
L=sorted(l,key=lambda x: x[2])
|
|
73
|
+
if outfile:
|
|
74
|
+
with open(outfile,'w') as f:
|
|
75
|
+
for i,j,r in L:
|
|
76
|
+
f.write(f'{i} {j} {r:0.8f}\n')
|
|
77
|
+
|
|
78
|
+
# clusterize the i,j entries of each element of L
|
|
79
|
+
all_done=False
|
|
80
|
+
cpass=0
|
|
81
|
+
while not all_done:
|
|
82
|
+
all_done=True
|
|
83
|
+
for i,j,r in L:
|
|
84
|
+
if r<thresh:
|
|
85
|
+
all_done=encluster(i,j,cluster_ids)
|
|
86
|
+
cpass+=1
|
|
87
|
+
|
|
88
|
+
# reindex cluster id
|
|
89
|
+
cpop={}
|
|
90
|
+
for i,c in enumerate(cluster_ids):
|
|
91
|
+
if not c in cpop:
|
|
92
|
+
cpop[c]=[]
|
|
93
|
+
cpop[c].append(i)
|
|
94
|
+
rc=set(cpop.keys())
|
|
95
|
+
for i,r in enumerate(rc):
|
|
96
|
+
for j in cpop[r]:
|
|
97
|
+
cluster_ids[j]=i
|
|
98
|
+
return cluster_ids
|
|
99
|
+
|
|
100
|
+
def analyze_sea(deffnm,thresh=0.1):
|
|
101
|
+
"""analyze_sea Builds and returns an atom-idx-ordered list of sea-cluster indexes.
|
|
102
|
+
Any two atoms with the same sea-cluster-index are considered
|
|
103
|
+
symmetry equivalent. The main job of this method is to compute the time-averaged interatomic
|
|
104
|
+
distance matrix. This matrix, if computed from a "hot" md simulation,
|
|
105
|
+
should reveal atoms that are topologically symmetric, since the set of
|
|
106
|
+
average interatomic distances from atom A to all other atoms and the set
|
|
107
|
+
of average interatomic distances from atom B to all other atoms are the
|
|
108
|
+
same if A and B are symmetry-equivalent.
|
|
109
|
+
|
|
110
|
+
:param deffnm: gromacs mdrun deffnm
|
|
111
|
+
:type deffnm: str
|
|
112
|
+
:param thresh: threshold value of euclidean norm of difference between rank-ordered distance matrix columns, defaults to 0.1
|
|
113
|
+
:type thresh: float, optional
|
|
114
|
+
"""
|
|
115
|
+
if not os.path.exists(f'{deffnm}.trr'):
|
|
116
|
+
logger.error(f'{deffnm}.trr not found.')
|
|
117
|
+
return []
|
|
118
|
+
logger.debug(f'SEA analysis from {deffnm}.trr')
|
|
119
|
+
with GroTrrReader(f'{deffnm}.trr') as trrfile:
|
|
120
|
+
d=np.array((0,))
|
|
121
|
+
nframes=0
|
|
122
|
+
for mobydick in trrfile:
|
|
123
|
+
frame_natoms=mobydick['natoms']
|
|
124
|
+
if d.shape==(1,):
|
|
125
|
+
d=np.zeros((frame_natoms,frame_natoms))
|
|
126
|
+
data=trrfile.get_data()
|
|
127
|
+
# tally all interatomic distances
|
|
128
|
+
for i,ri in enumerate(data['x']):
|
|
129
|
+
for j,rj in enumerate(data['x']):
|
|
130
|
+
rij=ri-rj
|
|
131
|
+
dist=np.sqrt(rij.dot(rij))
|
|
132
|
+
d[i][j]+=dist
|
|
133
|
+
nframes+=1
|
|
134
|
+
# averages over frames
|
|
135
|
+
d/=nframes
|
|
136
|
+
logger.debug(f'{deffnm}.trr: {nframes} frames')
|
|
137
|
+
# send the distance matrix to be processed, return
|
|
138
|
+
# the atom-ordered list of sea-cluster-idx's
|
|
139
|
+
return symm(d,thresh=thresh,outfile=f'{deffnm}-symmanalysis.dat')
|
|
140
|
+
|
|
141
|
+
# defunct old funtions from topology module that I can't just quit
|
|
142
|
+
from HTPolyNet.topology import typeorder,repeat_check,idxorder,_GromacsTopologyDirectiveHeaders_
|
|
143
|
+
import pandas as pd
|
|
144
|
+
def add_enumerated_angles(self,newbonds,ignores=[],quiet=True):
|
|
145
|
+
at=self.D['atoms']
|
|
146
|
+
ijk=self.D['angletypes'].set_index(['i','j','k']).sort_index()
|
|
147
|
+
newangles=[]
|
|
148
|
+
for b in newbonds:
|
|
149
|
+
''' new angles due to other neighbors of b[0] '''
|
|
150
|
+
for ai in [i for i in self.bondlist.partners_of(b[0]) if (i!=b[1] and not i in ignores)]:
|
|
151
|
+
aj=b[0]
|
|
152
|
+
ak=b[1]
|
|
153
|
+
it=at.iloc[ai-1].type
|
|
154
|
+
jt=at.iloc[aj-1].type
|
|
155
|
+
kt=at.iloc[ak-1].type
|
|
156
|
+
idx=typeorder((it,jt,kt))
|
|
157
|
+
i,j,k=idxorder((ai,aj,ak))
|
|
158
|
+
repeat_check((i,j,k))
|
|
159
|
+
if idx in ijk.index:
|
|
160
|
+
angletype=ijk.loc[idx,'func'] # why no .values[0]
|
|
161
|
+
else:
|
|
162
|
+
if not quiet:
|
|
163
|
+
logger.warning(f'Angle type {idx} ({ai}-{aj}-{ak}) not found.')
|
|
164
|
+
angletype=1
|
|
165
|
+
h=_GromacsTopologyDirectiveHeaders_['angles']
|
|
166
|
+
data=[i,j,k,angletype,pd.NA,pd.NA]
|
|
167
|
+
assert len(h)==len(data), 'Error: not enough data for new angle?'
|
|
168
|
+
angledict={k:[v] for k,v in zip(h,data)}
|
|
169
|
+
self.D['angles']=pd.concat((self.D['angles'],pd.DataFrame(angledict)),ignore_index=True)
|
|
170
|
+
newangles.append([i,j,k])
|
|
171
|
+
''' new angles due to other neighbors of b[1] '''
|
|
172
|
+
for ak in [k for k in self.bondlist.partners_of(b[1]) if (k!=b[0] and not k in ignores)]:
|
|
173
|
+
ai=b[0]
|
|
174
|
+
aj=b[1]
|
|
175
|
+
it=at.iloc[ai-1].type
|
|
176
|
+
jt=at.iloc[aj-1].type
|
|
177
|
+
kt=at.iloc[ak-1].type
|
|
178
|
+
idx=typeorder((it,jt,kt))
|
|
179
|
+
i,j,k=idxorder((ai,aj,ak))
|
|
180
|
+
repeat_check((i,j,k))
|
|
181
|
+
if idx in ijk.index:
|
|
182
|
+
angletype=ijk.loc[idx,'func'] # why no .values[0]
|
|
183
|
+
else:
|
|
184
|
+
if not quiet:
|
|
185
|
+
logger.warning(f'Angle type {idx} ({ai}-{aj}-{ak}) not found.')
|
|
186
|
+
angletype=1
|
|
187
|
+
h=_GromacsTopologyDirectiveHeaders_['angles']
|
|
188
|
+
data=[i,j,k,angletype,pd.NA,pd.NA]
|
|
189
|
+
assert len(h)==len(data), 'Error: not enough data for new angle?'
|
|
190
|
+
angledict={k:[v] for k,v in zip(h,data)}
|
|
191
|
+
self.D['angles']=pd.concat((self.D['angles'],pd.DataFrame(angledict)),ignore_index=True)
|
|
192
|
+
newangles.append([i,j,k])
|
|
193
|
+
return newangles
|
|
194
|
+
|
|
195
|
+
def add_enumerated_dihedrals(self,newbonds,ignores=[],quiet=True):
|
|
196
|
+
newdihedrals=[]
|
|
197
|
+
newpairs=[]
|
|
198
|
+
at=self.D['atoms']
|
|
199
|
+
ijkl=self.D['dihedraltypes'].set_index(['i','j','k','l']).sort_index()
|
|
200
|
+
|
|
201
|
+
''' new proper dihedrals for which the new bond is the central j-k bond '''
|
|
202
|
+
for b in newbonds:
|
|
203
|
+
aj,ak=idxorder(b)
|
|
204
|
+
for ai in [i for i in self.bondlist.partners_of(aj) if (i!=ak and not i in ignores)]:
|
|
205
|
+
for al in [l for l in self.bondlist.partners_of(ak) if (l!=aj and not l in ignores)]:
|
|
206
|
+
it=at.iloc[ai-1].type
|
|
207
|
+
jt=at.iloc[aj-1].type
|
|
208
|
+
kt=at.iloc[ak-1].type
|
|
209
|
+
lt=at.iloc[al-1].type
|
|
210
|
+
idx=typeorder((it,jt,kt,lt))
|
|
211
|
+
i,j,k,l=idxorder((ai,aj,ak,al))
|
|
212
|
+
repeat_check((i,j,k,l),msg=f'central {j}-{k}')
|
|
213
|
+
if idx in ijkl.index:
|
|
214
|
+
dihedtype=ijkl.loc[idx,'func'].values[0] # why values[0]
|
|
215
|
+
else:
|
|
216
|
+
if not quiet:
|
|
217
|
+
logger.warning(f'Dihedral type {idx} {ai}-{aj}-{ak}-{al} not found.')
|
|
218
|
+
dihedtype=9
|
|
219
|
+
h=_GromacsTopologyDirectiveHeaders_['dihedrals']
|
|
220
|
+
data=[i,j,k,l,dihedtype,pd.NA,pd.NA,pd.NA,pd.NA,pd.NA,pd.NA]
|
|
221
|
+
assert len(h)==len(data), 'Error: not enough data for new dihedral?'
|
|
222
|
+
diheddict={k:[v] for k,v in zip(h,data)}
|
|
223
|
+
self.D['dihedrals']=pd.concat((self.D['dihedrals'],pd.DataFrame(diheddict)),ignore_index=True)
|
|
224
|
+
newdihedrals.append([i,j,k,l])
|
|
225
|
+
''' i-l is a new 1-4 pair '''
|
|
226
|
+
h=_GromacsTopologyDirectiveHeaders_['pairs']
|
|
227
|
+
data=[i,l,1]
|
|
228
|
+
pairdict={k:[v] for k,v in zip(h,data)}
|
|
229
|
+
self.D['pairs']=pd.concat((self.D['pairs'],pd.DataFrame(pairdict)),ignore_index=True)
|
|
230
|
+
newpairs.append((i,l))
|
|
231
|
+
''' new proper dihedrals for which the new bond is the i-j or j-i bond '''
|
|
232
|
+
for ai,aj in zip(b,reversed(b)):
|
|
233
|
+
for ak in [k for k in self.bondlist.partners_of(aj) if (k!=ai and not k in ignores)]:
|
|
234
|
+
for al in [l for l in self.bondlist.partners_of(ak) if (l!=aj and not l in ignores)]:
|
|
235
|
+
it=at.iloc[ai-1].type
|
|
236
|
+
jt=at.iloc[aj-1].type
|
|
237
|
+
kt=at.iloc[ak-1].type
|
|
238
|
+
lt=at.iloc[al-1].type
|
|
239
|
+
idx=typeorder((it,jt,kt,lt))
|
|
240
|
+
i,j,k,l=idxorder((ai,aj,ak,al))
|
|
241
|
+
repeat_check((i,j,k,l),msg=f'i-j neighbor of j-k {j}-{k}')
|
|
242
|
+
if idx in ijkl.index:
|
|
243
|
+
dihedtype=ijkl.loc[idx,'func'].values[0]
|
|
244
|
+
# dihedtype=ijkl.loc[idx,'func']
|
|
245
|
+
else:
|
|
246
|
+
if not quiet:
|
|
247
|
+
logger.warning(f'Dihedral type {idx} {ai}-{aj}-{ak}-{al} not found.')
|
|
248
|
+
dihedtype=9
|
|
249
|
+
h=_GromacsTopologyDirectiveHeaders_['dihedrals']
|
|
250
|
+
data=[i,j,k,l,dihedtype,pd.NA,pd.NA,pd.NA,pd.NA,pd.NA,pd.NA]
|
|
251
|
+
assert len(h)==len(data), 'Error: not enough data for new dihedral?'
|
|
252
|
+
diheddict={k:[v] for k,v in zip(h,data)}
|
|
253
|
+
self.D['dihedrals']=pd.concat((self.D['dihedrals'],pd.DataFrame(diheddict)),ignore_index=True)
|
|
254
|
+
newdihedrals.append([i,j,k,l])
|
|
255
|
+
''' i-l is a new 1-4 pair '''
|
|
256
|
+
h=_GromacsTopologyDirectiveHeaders_['pairs']
|
|
257
|
+
data=[i,l,1]
|
|
258
|
+
pairdict={k:[v] for k,v in zip(h,data)}
|
|
259
|
+
self.D['pairs']=pd.concat((self.D['pairs'],pd.DataFrame(pairdict)),ignore_index=True)
|
|
260
|
+
newpairs.append((i,l))
|
|
261
|
+
|
|
262
|
+
''' new proper dihedrals for which the new bond is the k-l or l-k bond '''
|
|
263
|
+
for ak,al in zip(b,reversed(b)):
|
|
264
|
+
for aj in [j for j in self.bondlist.partners_of(ak) if (j!=al and not j in ignores)]:
|
|
265
|
+
for ai in [i for i in self.bondlist.partners_of(aj) if (i!=ak and not i in ignores)]:
|
|
266
|
+
it=at.iloc[ai-1].type
|
|
267
|
+
jt=at.iloc[aj-1].type
|
|
268
|
+
kt=at.iloc[ak-1].type
|
|
269
|
+
lt=at.iloc[al-1].type
|
|
270
|
+
idx=typeorder((it,jt,kt,lt))
|
|
271
|
+
i,j,k,l=idxorder((ai,aj,ak,al))
|
|
272
|
+
repeat_check((i,j,k,l),msg=f'k-l neighbor of j-k {j}-{k}')
|
|
273
|
+
if idx in ijkl.index:
|
|
274
|
+
dihedtype=ijkl.loc[idx,'func'].values[0]
|
|
275
|
+
else:
|
|
276
|
+
if not quiet:
|
|
277
|
+
logger.warning(f'Dihedral type {idx} {ai}-{aj}-{ak}-{al} not found.')
|
|
278
|
+
dihedtype=9
|
|
279
|
+
h=_GromacsTopologyDirectiveHeaders_['dihedrals']
|
|
280
|
+
data=[i,j,k,l,dihedtype,pd.NA,pd.NA,pd.NA,pd.NA,pd.NA,pd.NA]
|
|
281
|
+
assert len(h)==len(data), 'Error: not enough data for new dihedral?'
|
|
282
|
+
diheddict={k:[v] for k,v in zip(h,data)}
|
|
283
|
+
self.D['dihedrals']=pd.concat((self.D['dihedrals'],pd.DataFrame(diheddict)),ignore_index=True)
|
|
284
|
+
newdihedrals.append([i,j,k,l])
|
|
285
|
+
h=_GromacsTopologyDirectiveHeaders_['pairs']
|
|
286
|
+
''' i-l is a new 1-4 pair '''
|
|
287
|
+
data=[i,l,1]
|
|
288
|
+
pairdict={k:[v] for k,v in zip(h,data)}
|
|
289
|
+
self.D['pairs']=pd.concat((self.D['pairs'],pd.DataFrame(pairdict)),ignore_index=True)
|
|
290
|
+
newpairs.append((i,l))
|
|
291
|
+
return newdihedrals,newpairs
|