pythonknot 0.2.0__cp310-cp310-win_amd64.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.
pythonknot/__init__.py ADDED
@@ -0,0 +1,18 @@
1
+ import os
2
+ from pathlib import Path
3
+
4
+
5
+ _TABLE_ENV = "PYTHONKNOT_ALEXANDER_TABLE"
6
+ _TABLE_NAME = "table_knot_Alexander_polynomial.txt"
7
+
8
+
9
+ def _configure_default_alexander_table() -> None:
10
+ if os.environ.get(_TABLE_ENV):
11
+ return
12
+
13
+ packaged_table = Path(__file__).resolve().parent / "data" / _TABLE_NAME
14
+ if packaged_table.exists():
15
+ os.environ[_TABLE_ENV] = str(packaged_table)
16
+
17
+
18
+ _configure_default_alexander_table()
@@ -0,0 +1 @@
1
+ # Package data module for bundled runtime resources.
@@ -0,0 +1,251 @@
1
+ 1 1
2
+ 3_1 -1+t-t^2
3
+ 4_1 -1+3*t-t^2
4
+ 5_1 1-t+t^2-t^3+t^4
5
+ 5_2 2-3*t+2*t^2
6
+ 6_1 -2+5*t-2*t^2
7
+ 6_2 1-3*t+3*t^2-3*t^3+t^4
8
+ 6_3 1-3*t+5*t^2-3*t^3+t^4
9
+ 7_1 1-t+t^2-t^3+t^4-t^5+t^6
10
+ 7_2 3-5*t+3*t^2
11
+ 7_3 2-3*t+3*t^2-3*t^3+2*t^4
12
+ 7_4 4-7*t+4*t^2
13
+ 7_5 2-4*t+5*t^2-4*t^3+2*t^4
14
+ 7_6 1-5*t+7*t^2-5*t^3+t^4
15
+ 7_7 1-5*t+9*t^2-5*t^3+t^4
16
+ 8_1 3-7*t+3*t^2
17
+ 8_2 1-3*t+3*t^2-3*t^3+3*t^4-3*t^5+t^6
18
+ 8_3 4-9*t+4*t^2
19
+ 8_4 2-5*t+5*t^2-5*t^3+2*t^4
20
+ 8_5 1-3*t+4*t^2-5*t^3+4*t^4-3*t^5+t^6
21
+ 8_6 2-6*t+7*t^2-6*t^3+2*t^4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2-11*t^3+11*t^4-7*t^5+2*t^6
105
+ 10_20 3-9*t+11*t^2-9*t^3+3*t^4
106
+ 10_21 2-7*t+9*t^2-9*t^3+9*t^4-7*t^5+2*t^6
107
+ 10_22 2-6*t+10*t^2-13*t^3+10*t^4-6*t^5+2*t^6
108
+ 10_23 2-7*t+13*t^2-15*t^3+13*t^4-7*t^5+2*t^6
109
+ 10_24 4-14*t+19*t^2-14*t^3+4*t^4
110
+ 10_25 2-8*t+14*t^2-17*t^3+14*t^4-8*t^5+2*t^6
111
+ 10_26 2-7*t+13*t^2-17*t^3+13*t^4-7*t^5+2*t^6
112
+ 10_27 2-8*t+16*t^2-19*t^3+16*t^4-8*t^5+2*t^6
113
+ 10_28 4-13*t+19*t^2-13*t^3+4*t^4
114
+ 10_29 1-7*t+15*t^2-17*t^3+15*t^4-7*t^5+t^6
115
+ 10_30 4-17*t+25*t^2-17*t^3+4*t^4
116
+ 10_31 4-14*t+21*t^2-14*t^3+4*t^4
117
+ 10_32 2-8*t+15*t^2-19*t^3+15*t^4-8*t^5+2*t^6
118
+ 10_33 4-16*t+25*t^2-16*t^3+4*t^4
119
+ 10_34 3-9*t+13*t^2-9*t^3+3*t^4
120
+ 10_35 2-12*t+21*t^2-12*t^3+2*t^4
121
+ 10_36 3-13*t+19*t^2-13*t^3+3*t^4
122
+ 10_37 4-13*t+19*t^2-13*t^3+4*t^4
123
+ 10_38 4-15*t+21*t^2-15*t^3+4*t^4
124
+ 10_39 2-8*t+13*t^2-15*t^3+13*t^4-8*t^5+2*t^6
125
+ 10_40 2-8*t+17*t^2-21*t^3+17*t^4-8*t^5+2*t^6
126
+ 10_41 1-7*t+17*t^2-21*t^3+17*t^4-7*t^5+t^6
127
+ 10_42 1-7*t+19*t^2-27*t^3+19*t^4-7*t^5+t^6
128
+ 10_43 1-7*t+17*t^2-23*t^3+17*t^4-7*t^5+t^6
129
+ 10_44 1-7*t+19*t^2-25*t^3+19*t^4-7*t^5+t^6
130
+ 10_45 1-7*t+21*t^2-31*t^3+21*t^4-7*t^5+t^6
131
+ 10_46 1-3*t+4*t^2-5*t^3+5*t^4-5*t^5+4*t^6-3*t^7+t^8
132
+ 10_47 1-3*t+6*t^2-7*t^3+7*t^4-7*t^5+6*t^6-3*t^7+t^8
133
+ 10_48 1-3*t+6*t^2-9*t^3+11*t^4-9*t^5+6*t^6-3*t^7+t^8
134
+ 10_49 3-8*t+12*t^2-13*t^3+12*t^4-8*t^5+3*t^6
135
+ 10_50 2-7*t+11*t^2-13*t^3+11*t^4-7*t^5+2*t^6
136
+ 10_51 2-7*t+15*t^2-19*t^3+15*t^4-7*t^5+2*t^6
137
+ 10_52 2-7*t+13*t^2-15*t^3+13*t^4-7*t^5+2*t^6
138
+ 10_53 6-18*t+25*t^2-18*t^3+6*t^4
139
+ 10_54 2-6*t+10*t^2-11*t^3+10*t^4-6*t^5+2*t^6
140
+ 10_55 5-15*t+21*t^2-15*t^3+5*t^4
141
+ 10_56 2-8*t+14*t^2-17*t^3+14*t^4-8*t^5+2*t^6
142
+ 10_57 2-8*t+18*t^2-23*t^3+18*t^4-8*t^5+2*t^6
143
+ 10_58 3-16*t+27*t^2-16*t^3+3*t^4
144
+ 10_59 1-7*t+18*t^2-23*t^3+18*t^4-7*t^5+t^6
145
+ 10_60 1-7*t+20*t^2-29*t^3+20*t^4-7*t^5+t^6
146
+ 10_61 2-5*t+6*t^2-7*t^3+6*t^4-5*t^5+2*t^6
147
+ 10_62 1-3*t+6*t^2-8*t^3+9*t^4-8*t^5+6*t^6-3*t^7+t^8
148
+ 10_63 5-14*t+19*t^2-14*t^3+5*t^4
149
+ 10_64 1-3*t+6*t^2-10*t^3+11*t^4-10*t^5+6*t^6-3*t^7+t^8
150
+ 10_65 2-7*t+14*t^2-17*t^3+14*t^4-7*t^5+2*t^6
151
+ 10_66 3-9*t+16*t^2-19*t^3+16*t^4-9*t^5+3*t^6
152
+ 10_67 4-16*t+23*t^2-16*t^3+4*t^4
153
+ 10_68 4-14*t+21*t^2-14*t^3+4*t^4
154
+ 10_69 1-7*t+21*t^2-29*t^3+21*t^4-7*t^5+t^6
155
+ 10_70 1-7*t+16*t^2-19*t^3+16*t^4-7*t^5+t^6
156
+ 10_71 1-7*t+18*t^2-25*t^3+18*t^4-7*t^5+t^6
157
+ 10_72 2-9*t+16*t^2-19*t^3+16*t^4-9*t^5+2*t^6
158
+ 10_73 1-7*t+20*t^2-27*t^3+20*t^4-7*t^5+t^6
159
+ 10_74 4-16*t+23*t^2-16*t^3+4*t^4
160
+ 10_75 1-7*t+19*t^2-27*t^3+19*t^4-7*t^5+t^6
161
+ 10_76 2-7*t+12*t^2-15*t^3+12*t^4-7*t^5+2*t^6
162
+ 10_77 2-7*t+14*t^2-17*t^3+14*t^4-7*t^5+2*t^6
163
+ 10_78 1-7*t+16*t^2-21*t^3+16*t^4-7*t^5+t^6
164
+ 10_79 1-3*t+7*t^2-12*t^3+15*t^4-12*t^5+7*t^6-3*t^7+t^8
165
+ 10_80 3-9*t+15*t^2-17*t^3+15*t^4-9*t^5+3*t^6
166
+ 10_81 1-8*t+20*t^2-27*t^3+20*t^4-8*t^5+t^6
167
+ 10_82 1-4*t+8*t^2-12*t^3+13*t^4-12*t^5+8*t^6-4*t^7+t^8
168
+ 10_83 2-9*t+19*t^2-23*t^3+19*t^4-9*t^5+2*t^6
169
+ 10_84 2-9*t+20*t^2-25*t^3+20*t^4-9*t^5+2*t^6
170
+ 10_85 1-4*t+8*t^2-10*t^3+11*t^4-10*t^5+8*t^6-4*t^7+t^8
171
+ 10_86 2-9*t+19*t^2-25*t^3+19*t^4-9*t^5+2*t^6
172
+ 10_87 2-9*t+18*t^2-23*t^3+18*t^4-9*t^5+2*t^6
173
+ 10_88 1-8*t+24*t^2-35*t^3+24*t^4-8*t^5+t^6
174
+ 10_89 1-8*t+24*t^2-33*t^3+24*t^4-8*t^5+t^6
175
+ 10_90 2-8*t+17*t^2-23*t^3+17*t^4-8*t^5+2*t^6
176
+ 10_91 1-4*t+9*t^2-14*t^3+17*t^4-14*t^5+9*t^6-4*t^7+t^8
177
+ 10_92 2-10*t+20*t^2-25*t^3+20*t^4-10*t^5+2*t^6
178
+ 10_93 2-8*t+15*t^2-17*t^3+15*t^4-8*t^5+2*t^6
179
+ 10_94 1-4*t+9*t^2-14*t^3+15*t^4-14*t^5+9*t^6-4*t^7+t^8
180
+ 10_95 2-9*t+21*t^2-27*t^3+21*t^4-9*t^5+2*t^6
181
+ 10_96 1-7*t+22*t^2-33*t^3+22*t^4-7*t^5+t^6
182
+ 10_97 5-22*t+33*t^2-22*t^3+5*t^4
183
+ 10_98 2-9*t+18*t^2-23*t^3+18*t^4-9*t^5+2*t^6
184
+ 10_99 1-4*t+10*t^2-16*t^3+19*t^4-16*t^5+10*t^6-4*t^7+t^8
185
+ 10_100 1-4*t+9*t^2-12*t^3+13*t^4-12*t^5+9*t^6-4*t^7+t^8
186
+ 10_101 7-21*t+29*t^2-21*t^3+7*t^4
187
+ 10_102 2-8*t+16*t^2-21*t^3+16*t^4-8*t^5+2*t^6
188
+ 10_103 2-8*t+17*t^2-21*t^3+17*t^4-8*t^5+2*t^6
189
+ 10_104 1-4*t+9*t^2-15*t^3+19*t^4-15*t^5+9*t^6-4*t^7+t^8
190
+ 10_105 1-8*t+22*t^2-29*t^3+22*t^4-8*t^5+t^6
191
+ 10_106 1-4*t+9*t^2-15*t^3+17*t^4-15*t^5+9*t^6-4*t^7+t^8
192
+ 10_107 1-8*t+22*t^2-31*t^3+22*t^4-8*t^5+t^6
193
+ 10_108 2-8*t+14*t^2-15*t^3+14*t^4-8*t^5+2*t^6
194
+ 10_109 1-4*t+10*t^2-17*t^3+21*t^4-17*t^5+10*t^6-4*t^7+t^8
195
+ 10_110 1-8*t+20*t^2-25*t^3+20*t^4-8*t^5+t^6
196
+ 10_111 2-9*t+17*t^2-21*t^3+17*t^4-9*t^5+2*t^6
197
+ 10_112 1-5*t+11*t^2-17*t^3+19*t^4-17*t^5+11*t^6-5*t^7+t^8
198
+ 10_113 2-11*t+26*t^2-33*t^3+26*t^4-11*t^5+2*t^6
199
+ 10_114 2-10*t+21*t^2-27*t^3+21*t^4-10*t^5+2*t^6
200
+ 10_115 1-9*t+26*t^2-37*t^3+26*t^4-9*t^5+t^6
201
+ 10_116 1-5*t+12*t^2-19*t^3+21*t^4-19*t^5+12*t^6-5*t^7+t^8
202
+ 10_117 2-10*t+24*t^2-31*t^3+24*t^4-10*t^5+2*t^6
203
+ 10_118 1-5*t+12*t^2-19*t^3+23*t^4-19*t^5+12*t^6-5*t^7+t^8
204
+ 10_119 2-10*t+23*t^2-31*t^3+23*t^4-10*t^5+2*t^6
205
+ 10_120 8-26*t+37*t^2-26*t^3+8*t^4
206
+ 10_121 2-11*t+27*t^2-35*t^3+27*t^4-11*t^5+2*t^6
207
+ 10_122 2-11*t+24*t^2-31*t^3+24*t^4-11*t^5+2*t^6
208
+ 10_123 1-6*t+15*t^2-24*t^3+29*t^4-24*t^5+15*t^6-6*t^7+t^8
209
+ 10_124 1-t+t^3-t^4+t^5-t^7+t^8
210
+ 10_125 1-2*t+2*t^2-t^3+2*t^4-2*t^5+t^6
211
+ 10_126 1-2*t+4*t^2-5*t^3+4*t^4-2*t^5+t^6
212
+ 10_127 1-4*t+6*t^2-7*t^3+6*t^4-4*t^5+t^6
213
+ 10_128 2-3*t+t^2+t^3+t^4-3*t^5+2*t^6
214
+ 10_129 2-6*t+9*t^2-6*t^3+2*t^4
215
+ 10_130 2-4*t+5*t^2-4*t^3+2*t^4
216
+ 10_131 2-8*t+11*t^2-8*t^3+2*t^4
217
+ 10_132 1-t+t^2-t^3+t^4
218
+ 10_133 1-5*t+7*t^2-5*t^3+t^4
219
+ 10_134 2-4*t+4*t^2-3*t^3+4*t^4-4*t^5+2*t^6
220
+ 10_135 3-9*t+13*t^2-9*t^3+3*t^4
221
+ 10_136 1-4*t+5*t^2-4*t^3+t^4
222
+ 10_137 1-6*t+11*t^2-6*t^3+t^4
223
+ 10_138 1-5*t+8*t^2-7*t^3+8*t^4-5*t^5+t^6
224
+ 10_139 1-t+2*t^3-3*t^4+2*t^5-t^7+t^8
225
+ 10_140 1-2*t+3*t^2-2*t^3+t^4
226
+ 10_141 1-3*t+4*t^2-5*t^3+4*t^4-3*t^5+t^6
227
+ 10_142 2-3*t+2*t^2-t^3+2*t^4-3*t^5+2*t^6
228
+ 10_143 1-3*t+6*t^2-7*t^3+6*t^4-3*t^5+t^6
229
+ 10_144 3-10*t+13*t^2-10*t^3+3*t^4
230
+ 10_145 1+t-3*t^2+t^3+t^4
231
+ 10_146 2-8*t+13*t^2-8*t^3+2*t^4
232
+ 10_147 2-7*t+9*t^2-7*t^3+2*t^4
233
+ 10_148 1-3*t+7*t^2-9*t^3+7*t^4-3*t^5+t^6
234
+ 10_149 1-5*t+9*t^2-11*t^3+9*t^4-5*t^5+t^6
235
+ 10_150 1-4*t+6*t^2-7*t^3+6*t^4-4*t^5+t^6
236
+ 10_151 1-4*t+10*t^2-13*t^3+10*t^4-4*t^5+t^6
237
+ 10_152 1-t-t^2+4*t^3-5*t^4+4*t^5-t^6-t^7+t^8
238
+ 10_153 1-t-t^2+3*t^3-t^4-t^5+t^6
239
+ 10_154 1-4*t^2+7*t^3-4*t^4+t^6
240
+ 10_155 1-3*t+5*t^2-7*t^3+5*t^4-3*t^5+t^6
241
+ 10_156 1-4*t+8*t^2-9*t^3+8*t^4-4*t^5+t^6
242
+ 10_157 1-6*t+11*t^2-13*t^3+11*t^4-6*t^5+t^6
243
+ 10_158 1-4*t+10*t^2-15*t^3+10*t^4-4*t^5+t^6
244
+ 10_159 1-4*t+9*t^2-11*t^3+9*t^4-4*t^5+t^6
245
+ 10_160 1-4*t+4*t^2-3*t^3+4*t^4-4*t^5+t^6
246
+ 10_161 1-2*t^2+3*t^3-2*t^4+t^6
247
+ 10_162 3-9*t+11*t^2-9*t^3+3*t^4
248
+ 10_163 1-5*t+12*t^2-15*t^3+12*t^4-5*t^5+t^6
249
+ 10_164 3-11*t+17*t^2-11*t^3+3*t^4
250
+ 10_165 2-10*t+15*t^2-10*t^3+2*t^4
251
+
@@ -0,0 +1,22 @@
1
+ import numpy as np
2
+
3
+ # design for generating knot configurations for diffrent simulation software
4
+ # lammps read_data, gromacs gmx editconf, openmm pdb
5
+ # get the coordinates of the knot, then write to the corresponding file
6
+ class KnotGenerator:
7
+ def __init__(self, knot):
8
+ """ knot should be a numpy array with shape (N_atoms, 3)"""
9
+ self.knot = knot
10
+
11
+ def write_lammps_data(self, filename):
12
+ pass
13
+
14
+ def write_gromacs_gro(self, filename):
15
+ pass
16
+
17
+ def write_openmm_pdb(self, filename):
18
+ pass
19
+
20
+ def write_xyz(self, filename):
21
+ pass
22
+
pythonknot/polymer.py ADDED
@@ -0,0 +1,46 @@
1
+ import numpy as np
2
+
3
+ def bond_length(xyz:np.ndarray,type = "open"):
4
+ """计算轨迹的键长分布,输入应该为N_frames, N_atoms, 3的numpy array. type="open"表示开链,type="ring"表示闭链."""
5
+ #print("original shape:", xyz.shape)
6
+ temp = xyz.transpose(1,2,0)
7
+ #print("temp shape:", temp.shape)
8
+ if(type == "ring"):
9
+ bond_length = np.linalg.norm(temp[1:] - temp[:-1], axis=1)
10
+ # 闭链需要计算首尾原子的键长
11
+ end_to_start_bond = np.linalg.norm(temp[-1] - temp[0], axis=0)
12
+ #print("end_to_start_bond shape:", end_to_start_bond.shape)
13
+ # 从(N_frames) 变为 (1, N_frames)
14
+ end_to_start_bond = end_to_start_bond.reshape(1,-1)
15
+ bond_length = np.concatenate((bond_length, end_to_start_bond), axis=0)
16
+ elif(type == "open"):
17
+ bond_length = np.linalg.norm(temp[1:] - temp[:-1], axis=1)
18
+ print("bond_length shape:", bond_length.shape)
19
+ bond_length = bond_length.flatten()
20
+ return bond_length
21
+
22
+ def radius_of_gyration(trajectory:np.ndarray):
23
+ """计算轨迹的质心半径分布,输入应该为N_frames, N_atoms, 3的numpy array."""
24
+ # 计算每帧的质心
25
+ centroids = np.mean(trajectory, axis=1)
26
+
27
+ # 广播质心回到trajectory的形状,以便进行逐元素操作
28
+ # centroids[:, np.newaxis, :] 使得 centroids 从 (N_frames, 3) 扩展为 (N_frames, 1, 3)
29
+ # 这样可以与 trajectory (N_frames, N_atoms, 3) 对齐
30
+ displacement = trajectory - centroids[:, np.newaxis, :]
31
+
32
+ # 计算每个原子到质心的距离的平方
33
+ distances_squared = np.sum(displacement**2, axis=2)
34
+
35
+ # 计算每帧的回转半径
36
+ gyration_radius = np.sqrt(np.mean(distances_squared, axis=1))
37
+
38
+ return gyration_radius
39
+
40
+ def end_to_end_distance(trajectory:np.ndarray):
41
+ """计算轨迹的端到端距离分布,输入应该为N_frames, N_atoms, 3的numpy array."""
42
+ # 计算每帧的端到端距离
43
+ end_to_end = trajectory[:,-1] - trajectory[:,0]
44
+ end_to_end_distance = np.linalg.norm(end_to_end, axis=1)
45
+
46
+ return end_to_end_distance
pythonknot/rmsd.py ADDED
@@ -0,0 +1,29 @@
1
+ import rmsd
2
+ import numpy
3
+
4
+ def rmsd_ref(coords,ref):
5
+ """
6
+ Calculate the rmsd of coords to ref, and rotate coords to minimize rmsd.
7
+ """
8
+
9
+ rmsd_all = numpy.zeros(coords.shape[0])
10
+
11
+ frames, atoms, _ = coords.shape
12
+ if(ref.shape != coords[0].shape):
13
+ raise ValueError("The shape of ref and coords should be the same.")
14
+
15
+ ref = ref - numpy.mean(ref, axis=0)
16
+
17
+ # main loop
18
+ for i in range(frames):
19
+ # recenter
20
+ coords[i] -= numpy.mean(coords[i], axis=0)
21
+
22
+ # calculate the rotation matrix
23
+ R = rmsd.kabsch(coords[i], ref)
24
+ # rotate the coords
25
+ coords[i] = numpy.dot(coords[i], R)
26
+ # calculate the rmsd
27
+ rmsd_all[i] = rmsd.rmsd(coords[i], ref)
28
+
29
+ return rmsd_all
pythonknot/xyz.py ADDED
@@ -0,0 +1,31 @@
1
+ import numpy as np
2
+
3
+ def read_xyz(file):
4
+ """Read xyz file and get all the conf in same file, so return N_frames*n_atoms*3 np array"""
5
+ with open(file) as f:
6
+ lines = f.readlines()
7
+ N_frames = int(len(lines)/(int(lines[0])+2))
8
+ N_atoms = int(lines[0])
9
+ print(N_frames, N_atoms)
10
+ coords = np.zeros((N_frames, N_atoms, 3))
11
+ for i in range(N_frames):
12
+ lines = lines[2:]
13
+ for j in range(N_atoms):
14
+ line = lines[j].split()
15
+ coords[i,j,0] = float(line[1])
16
+ coords[i,j,1] = float(line[2])
17
+ coords[i,j,2] = float(line[3])
18
+ lines = lines[N_atoms:]
19
+
20
+ return coords
21
+
22
+ def write_xyz(file, coords):
23
+ """Write xyz file with coords, coords is a N_frames*N_atoms*3 np array, all the frames have same number of atoms"""
24
+ N_atoms = coords.shape[1]
25
+ N_frames = coords.shape[0]
26
+ with open(file, 'w') as f:
27
+ for i in range(N_frames):
28
+ f.write(str(N_atoms)+'\n')
29
+ f.write('frame '+str(i)+'\n')
30
+ for j in range(N_atoms):
31
+ f.write('1 '+str(coords[i,j,0])+' '+str(coords[i,j,1])+' '+str(coords[i,j,2])+'\n')
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.4
2
+ Name: pythonknot
3
+ Version: 0.2.0
4
+ Summary: pythonknot for knot theory calculation
5
+ Home-page:
6
+ Author: yjianzhu
7
+ Author-email: yjianzhu@mail.ustc.edu.cn
8
+ Requires-Dist: numpy
9
+ Requires-Dist: scipy
10
+ Requires-Dist: rmsd
11
+ Dynamic: author
12
+ Dynamic: author-email
13
+ Dynamic: description
14
+ Dynamic: requires-dist
15
+ Dynamic: summary
16
+
17
+ Python Knot is a Python package for creating and manipulating knots and links, calculating knot invariants, and more.
@@ -0,0 +1,12 @@
1
+ pythonknot/__init__.py,sha256=P2DnVoeeIJU1BUBg5bozbyEb1JJTx89obSujymG78Zc,452
2
+ pythonknot/alexander_poly.cp310-win_amd64.pyd,sha256=VGduTxqR0CCYfqHpC_-3d4yo8wR9s54mgTqxuYIoX7s,899584
3
+ pythonknot/knot_generator.py,sha256=LIz1prX2JD7KfxK9a5wneqVl4sI7m5zaXKMAWRb6zPQ,608
4
+ pythonknot/polymer.py,sha256=w5MJDRuBjDKc190N2zvtVv5KeBmlkxILcoqJybZ7hds,2129
5
+ pythonknot/rmsd.py,sha256=1OxstRvKmn1ic_jNaYZyvb90o1UUSe7ATtXYzbkc9E0,783
6
+ pythonknot/xyz.py,sha256=7DF0clQ1BbqxcPRURUJe74hTtMChmJ9HFk3vqSJ_ns4,1221
7
+ pythonknot/data/__init__.py,sha256=E5qObJsuvfKKENzFgrRaZubpxThaQw49jRPRdrCUfhg,54
8
+ pythonknot/data/table_knot_Alexander_polynomial.txt,sha256=nekErtsQWViKTRWT72cDkD8vXrQnnJYpvtkMl3TqzdA,9786
9
+ pythonknot-0.2.0.dist-info/METADATA,sha256=jpd_6KKmpHUFpGdGYtzDB6hdMYNhl2e00BmhPXDwMSg,468
10
+ pythonknot-0.2.0.dist-info/WHEEL,sha256=iPjZCrxu1cE-Y3uyjjPaXg-jNuvTXT9YfQfIwfucHF4,101
11
+ pythonknot-0.2.0.dist-info/top_level.txt,sha256=qFU8P2xZFLCfmfNZ2QjuyHYn-zeiSUD6znlWAPA9KXw,11
12
+ pythonknot-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: false
4
+ Tag: cp310-cp310-win_amd64
5
+
@@ -0,0 +1 @@
1
+ pythonknot