@@ -2202,20 +2202,18 @@ def findminima2(self, temp=300.0, energy_unit="kJ/mol", max_iteration=10000):
2202
2202
2203
2203
print ("Searching for the nearest local minima... " )
2204
2204
iteration = 0
2205
- old_m_fes = m_fes
2206
2205
while 0.0 in m_fes [:]:
2207
2206
iteration += 1
2208
- if iteration > 10000 :
2207
+ if iteration > max_iteration :
2209
2208
print ("Warning: Maximum number of iterations reached when searching. " )
2210
2209
break
2211
2210
for i in range (self .fes .shape [0 ]):
2212
2211
m_fes [i ] = m_fes [int (dirs [i ])]
2213
- if np .all (np .equal (old_m_fes , m_fes )):
2214
- print ("Warning: some of the FES bins were not associated to any local minimum. " )
2215
- break
2216
- old_m_fes = m_fes
2217
- if iteration <= 10000 :
2212
+ if iteration <= max_iteration :
2218
2213
print ("Done." )
2214
+ if 0.0 in m_fes [:]:
2215
+ print ("Warning: some of the FES bins were not associated to any local minimum. " )
2216
+
2219
2217
self .minima = np .array (minima_list )
2220
2218
self .m_fes = m_fes
2221
2219
@@ -2255,19 +2253,22 @@ def findminima2(self, temp=300.0, energy_unit="kJ/mol", max_iteration=10000):
2255
2253
okoli [ii ,jj ] = self .fes [int (a_indexes [ii ,jj ,0 ]),int (a_indexes [ii ,jj ,1 ])]
2256
2254
2257
2255
m_i , m_j = np .unravel_index (np .argmin (okoli ), okoli .shape , order = 'C' )
2258
-
2259
- dirs [i ,j , 0 ] = a_indexes [m_i ,m_j ,0 ]
2260
- dirs [i ,j , 1 ] = a_indexes [m_i ,m_j ,1 ]
2261
- if self .fes [i ,j ] == self .fes [int (a_indexes [m_i ,m_j ,0 ]), int (a_indexes [m_i , m_j , 1 ])] and not np .all (okoli == np .min (okoli )):
2262
- minima_count += 1
2263
- m_fes [i ,j ] = minima_count
2264
- min_cv1 = (((i )/ self .res )* (cv1max - cv1min ))+ cv1min
2265
- min_cv2 = (((j )/ self .res )* (cv2max - cv2min ))+ cv2min
2266
- minima_list .append ([self .fes [i ,j ],i ,j , min_cv1 , min_cv2 ])
2256
+
2257
+ if not np .all (okoli == np .min (okoli )):
2258
+ dirs [i ,j , 0 ] = a_indexes [m_i ,m_j ,0 ]
2259
+ dirs [i ,j , 1 ] = a_indexes [m_i ,m_j ,1 ]
2260
+ if self .fes [i ,j ] == self .fes [int (a_indexes [m_i ,m_j ,0 ]), int (a_indexes [m_i , m_j , 1 ])]:
2261
+ minima_count += 1
2262
+ m_fes [i ,j ] = minima_count
2263
+ min_cv1 = (((i )/ self .res )* (cv1max - cv1min ))+ cv1min
2264
+ min_cv2 = (((j )/ self .res )* (cv2max - cv2min ))+ cv2min
2265
+ minima_list .append ([self .fes [i ,j ],i ,j , min_cv1 , min_cv2 ])
2266
+ else :
2267
+ dirs [i ,j , 0 ] = i
2268
+ dirs [i ,j , 1 ] = j
2267
2269
2268
2270
print ("Searching for the nearest local minima... " )
2269
2271
iteration = 0
2270
- old_m_fes = m_fes
2271
2272
while 0.0 in m_fes [:,:]:
2272
2273
iteration += 1
2273
2274
if iteration > max_iteration :
@@ -2276,12 +2277,11 @@ def findminima2(self, temp=300.0, energy_unit="kJ/mol", max_iteration=10000):
2276
2277
for i in range (self .fes .shape [0 ]):
2277
2278
for j in range (self .fes .shape [1 ]):
2278
2279
m_fes [i ,j ] = m_fes [int (dirs [i ,j ,0 ]), int (dirs [i ,j ,1 ])]
2279
- if np .all (np .equal (old_m_fes , m_fes )):
2280
- print ("Warning: some of the FES bins were not associated to any local minimum. " )
2281
- break
2282
- old_m_fes = m_fes
2283
- if iteration <= 10000 :
2284
- print ("Done." )
2280
+ if iteration <= max_iteration :
2281
+ print ("Done." )
2282
+ if 0.0 in m_fes [:,:]:
2283
+ print ("Warning: some of the FES bins were not associated to any local minimum. " )
2284
+
2285
2285
self .minima = np .array (minima_list )
2286
2286
self .m_fes = m_fes
2287
2287
@@ -2338,22 +2338,20 @@ def findminima2(self, temp=300.0, energy_unit="kJ/mol", max_iteration=10000):
2338
2338
2339
2339
print ("Searching for the nearest local minima... " )
2340
2340
iteration = 0
2341
- old_m_fes = m_fes
2342
2341
while 0.0 in m_fes [:,:,:]:
2343
2342
iteration += 1
2344
- if iteration > 10000 :
2343
+ if iteration > max_iteration :
2345
2344
print ("Warning: Maximum number of iterations reached when searching. " )
2346
2345
break
2347
2346
for i in range (self .fes .shape [0 ]):
2348
2347
for j in range (self .fes .shape [1 ]):
2349
2348
for k in range (self .fes .shape [2 ]):
2350
2349
m_fes [i ,j ,k ] = m_fes [int (dirs [i ,j ,k ,0 ]), int (dirs [i ,j ,k ,1 ]),int (dirs [i ,j ,k ,2 ])]
2351
- if np .all (np .equal (old_m_fes , m_fes )):
2352
- print ("Warning: some of the FES bins were not associated to any local minimum. " )
2353
- break
2354
- old_m_fes = m_fes
2355
- if iteration <= 10000 :
2350
+ if iteration <= max_iteration :
2356
2351
print ("Done." )
2352
+ if 0.0 in m_fes [:,:,:]:
2353
+ print ("Warning: some of the FES bins were not associated to any local minimum. " )
2354
+
2357
2355
self .minima = np .array (minima_list )
2358
2356
self .m_fes = m_fes
2359
2357
0 commit comments