OverflowError: cannot convert float infinity to integer

24 views
Skip to first unread message

Razvan Marinescu

unread,
Jan 16, 2023, 11:01:08 AM1/16/23
to westpa-users
Hi all,

First, I wanted to thank you all for your help so far on this mailing list, many of you have been very supportive. I have another quick question below. 

What can I do with segments that have too low weights (currently 3.95253e-323)? I got the following error and my WESTPA simulation won't progress further.

-- ERROR    [w_run] -- error message: cannot convert float infinity to integer
-- ERROR    [w_run] -- Traceback (most recent call last):
  File "/global/cfs/cdirs/m4229/westpa_source/src/westpa/cli/core/w_run.py", line 62, in run_simulation
    sim_manager.run()
  File "/global/cfs/cdirs/m4229/westpa_source/src/westpa/core/sim_manager.py", line 771, in run
    self.run_we()
  File "/global/cfs/cdirs/m4229/westpa_source/src/westpa/core/sim_manager.py", line 693, in run_we
    self.we_driver.construct_next()
  File "/global/cfs/cdirs/m4229/westpa_source/src/westpa/core/we_driver.py", line 868, in construct_next
    self._run_we()
  File "/global/cfs/cdirs/m4229/westpa_source/src/westpa/core/we_driver.py", line 696, in _run_we
    self._split_by_weight(i, target_count, ideal_weight, len(subgroups))
  File "/global/cfs/cdirs/m4229/westpa_source/src/westpa/core/we_driver.py", line 528, in _split_by_weight
    m = int(math.ceil(segment.weight / ideal_weight))
OverflowError: cannot convert float infinity to integer


I don't want to restart the simulation as I have been running it for 2 days already.

Many thanks,
Razvan

Anthony Bogetti

unread,
Jan 16, 2023, 11:26:49 AM1/16/23
to westpa...@googlegroups.com
Hi Razvan,

We are happy to help!  For the low weights, you can set a low weight threshold under which the trajectory will not be split further.  Please see this Wiki page for how to use. You should be able to add in the threshold and re-submit and it should take effect.

Anthony

--
You received this message because you are subscribed to the Google Groups "westpa-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to westpa-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/westpa-users/bb97c064-5da2-4c65-8c42-6009cb64be7an%40googlegroups.com.

Razvan Marinescu

unread,
Jan 16, 2023, 1:17:29 PM1/16/23
to westpa-users
Thank you so very much Antony! 

Also, do you have the script trace3.py for WESTPA1 for tracing a trajectory (before HDF5 was introduced)? See my other previous email on the westpa mailing list. The one I have only worked with .h5 files, but now I've turned that off. This is my current script:

(raz-westpa-dev) razvan@perlmutter:login14:~/community/noHDF10mer> cat trace3.py

import h5py
import numpy
import mdtraj
import os
import sys
# python trace3.py <iteration> <segment_nr>


#294 [84]
# 405 seg: [87]
#iteration = 405
iteration = int(sys.argv[1])
#segment = 87
segment = int(sys.argv[2])
pcoord_len = 5


os.system("w_trace -W west2.h5 %s:%s"%(iteration,segment))

iter_list = numpy.loadtxt("traj_%s_%s_trace.txt"%(iteration,segment), usecols=0, skiprows=8)
seg_list = numpy.loadtxt("traj_%s_%s_trace.txt"%(iteration,segment), usecols=1, skiprows=8)

print("tracing trajectory...")

seg_val = int(seg_list[0])
first_iter_h5_filepath = "./traj_segs/iter_"+str(1).zfill(6)+".h5"
pointer = h5py.File(first_iter_h5_filepath)['pointer'][:,1]
where = numpy.where(pointer == seg_val)
print(seg_val, where)
traj_trace = mdtraj.load(first_iter_h5_filepath)[where]

for idx, iter_val in enumerate(iter_list[1:]):
    idx += 1
    iter_h5_filepath = "./traj_segs/iter_"+str(int(iter_val)).zfill(6)+".h5"
    seg_val = int(seg_list[idx])
    pointer = h5py.File(iter_h5_filepath)['pointer'][:,1]
    where = numpy.where(pointer == seg_val)
    print(seg_val, where)
    next_traj = mdtraj.load(iter_h5_filepath)[where]
    traj_trace = mdtraj.join((traj_trace, next_traj))
fi = "trace%d_%d.dcd" % (iteration, segment)
traj_trace.save(fi)
print("trajectory successfully saved to " + fi)

Razvan

Yang, Darian T

unread,
Jan 16, 2023, 1:24:20 PM1/16/23
to westpa...@googlegroups.com

Razvan,

 

We also have an example of how to get a single continuous trajectory on our wiki here:

https://github.com/westpa/westpa/wiki/Accessing-data-from-custom-analysis-scripts

in the “Working with data for a single continuous trajectory” subsection.

 

You can input your iter,seg variables then adjust the parameter file and segment extension (instead of .nc probably .dcd for your case).

 

Best,

Darian

Anthony Bogetti

unread,
Jan 16, 2023, 1:31:00 PM1/16/23
to westpa...@googlegroups.com
Hi Razvan,

In addition to Darian’s reply, you can also use the new westpa.analysis API and the BasicMDTrajectory reader (see here: https://github.com/westpa/westpa/tree/westpa2/src/westpa/analysis).

Anthony

Razvan Marinescu

unread,
Jan 16, 2023, 3:14:33 PM1/16/23
to westpa-users
Thank you both! I'll try that. 

-R

Reply all
Reply to author
Forward
0 new messages