Closed joaander closed 8 years ago
Original comment by Åsmund Ervik (Bitbucket: asmunder, GitHub: asmunder).
I tested this now, and the following appears to solve the problem:
#!python
if not isinstance(polymers,list) or len(polymers) == 0:
raise RuntimeError();
if not isinstance(separation,dict) or len(separation) == 0:
raise RuntimeError();
And it looks more pythonic to boot.
Removes type checks for polymers list and separation dict in create_random_polymers() in init.py
This resolves #107 and makes HOOMD-blue compatible with jobscripts using the "future" module. I initially thought to use "isinstance" as outlined in #107, but Joshua suggested to remove the type checks altogether, and I agree this makes more sense (then it fails later with more specific error messages).
Merged in asmunder/hoomd-blue-my-prs/remove-polymers-separation-typecheck-2 (pull request #112)
fixes #107 Removes type checks for polymers list and separation dict in create_random_polymers() in init.py
Original report by Åsmund Ervik (Bitbucket: asmunder, GitHub: asmunder).
Trying to write a Python 2/3 agnostic jobscript for HOOMD-blue, using the futures module, there are two sanity checks in
hoomd_script/init.py
that break (abbreviated below):Both of these tests raise false errors when given correct data structures for
polymers
andseparation
.The problem is that when running on Python2 with futures, the types of list and dict are, respectively,
which doesn't match the types of
[]
anddict()
ininit.py
, since that does not import future.In raaSAFT I use future to make the framework Python 2/3 universal, so the problem occurs for all raaSAFT-based jobscripts running under Python 2, even when the jobscript does not import future.