Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update imports for python 3 compatibility #3

Merged
merged 10 commits into from
Apr 17, 2017
Merged

Update imports for python 3 compatibility #3

merged 10 commits into from
Apr 17, 2017

Conversation

jchodera
Copy link
Member

@jchodera jchodera commented Apr 15, 2017

I've updated enough imports to get baoab_vs_vvvr.py to run!

Fixes #2

@jchodera
Copy link
Member Author

Wow, that was a lot more work than I bargained for. I fixed a large number of relative imports for things that had been rearranged, and the remaining errors suggest there is still code that isn't working yet:

======================================================================
ERROR: Failure: ImportError (cannot import name 'get_equilibrium_samples')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/Users/choderaj/miniconda3/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/Users/choderaj/miniconda3/lib/python3.5/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/Users/choderaj/github/choderalab/integrator-benchmark/integrator-benchmark/benchmark/experiments/waterbox_test.py", line 16, in <module>
    from benchmark.experiments.tools import get_equilibrium_samples, \
ImportError: cannot import name 'get_equilibrium_samples'

======================================================================
ERROR: Failure: FileNotFoundError ([Errno 2] No such file or directory: 'serialized_testsystems/alanine_constrained.xml')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/Users/choderaj/miniconda3/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/Users/choderaj/miniconda3/lib/python3.5/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/Users/choderaj/github/choderalab/integrator-benchmark/integrator-benchmark/benchmark/serialization/serialize_testsystems.py", line 11, in <module>
    with open("serialized_testsystems/{}_{}.xml".format(name, c), "w") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'serialized_testsystems/alanine_constrained.xml'

======================================================================
ERROR: Failure: Exception (Unknown global variable: shadow_work)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/Users/choderaj/miniconda3/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/Users/choderaj/miniconda3/lib/python3.5/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/Users/choderaj/github/choderalab/integrator-benchmark/integrator-benchmark/benchmark/tests/substep_test.py", line 13, in <module>
    simulation = simulation_factory(scheme)
  File "/Users/choderaj/github/choderalab/integrator-benchmark/integrator-benchmark/benchmark/tests/tests.py", line 89, in simulation_factory
    simulation = app.Simulation(topology, system, lsi, platform)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/simtk/openmm/app/simulation.py", line 103, in __init__
    self.context = mm.Context(self.system, self.integrator, platform)
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/simtk/openmm/openmm.py", line 6269, in __init__
    this = _openmm.new_Context(*args)
Exception: Unknown global variable: shadow_work

======================================================================
ERROR: benchmark.testsystems.testsystems.get_src_implicit_test_system
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
TypeError: get_src_implicit_test_system() missing 1 required positional argument: 'temperature'

======================================================================
ERROR: benchmark.testsystems.testsystems.get_src_explicit_test_system
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/choderaj/miniconda3/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
TypeError: get_src_explicit_test_system() missing 1 required positional argument: 'temperature'

[success] 95.15% benchmark.testsystems.testsystems.load_mts_test: 0.0179s
[error] 2.54% benchmark.testsystems.testsystems.get_src_explicit_test_system: 0.0005s
[error] 1.36% nose.failure.Failure.runTest: 0.0003s
[error] 0.94% benchmark.testsystems.testsystems.get_src_implicit_test_system: 0.0002s
----------------------------------------------------------------------
Ran 6 tests in 0.032s

FAILED (errors=5)

I'm going to stop here and hand this back to @maxentile to carry forward, since it looks like I've fixed enough to look into the original benchmark/experiments/baoab_vs_vvvr.py issue.

…ng shadow work to avoid initial energy loss for some integrators.
…and velocities at the beginning of each integrator step.
@jchodera
Copy link
Member Author

The last two commits fix the problem noted in #12 where it looked like energy was leaking out of integrator splittings that begin with V or R steps (but not O steps) for constrained systems.

I went a bit overboard and constrained positions and velocities at the beginning of each integrator step just for safety, but this may be unnecessary if we simply ensure to apply position and velocity constraints at the beginning of integration (step = 0). Note that I think we'll need to fix this in the openmmtools version too.

I've also temporarily disabled the solvated alanine dipeptide and modified the parameters for the vacuum alanine dipeptide data collection to ensure the samples were less correlated.

This should be ready to merge after #4 is merged, and then we should get the refactor branch merged into master ASAP.

@maxentile
Copy link
Member

Wow, that was a lot more work than I bargained for.

Ahh, sorry about this! Thank you for all of these fixes and improvements.

I fixed a large number of relative imports for things that had been rearranged

Thanks! Just reviewed all changes,

and the remaining errors suggest there is still code that isn't working yet:

Sorry about this -- I believe I removed this file in the refactor branch

The last two commits fix the problem noted in #12 where it looked like energy was leaking out of integrator splittings that begin with V or R steps (but not O steps) for constrained systems.

Ahh, that would do it! Thanks for tracking down this error. I thought I had checked at the beginning of the study that setVelocitiesToTemperature already applies constraints, but I must have been mistaken...

I went a bit overboard and constrained positions and velocities at the beginning of each integrator step just for safety, but this may be unnecessary if we simply ensure to apply position and velocity constraints at the beginning of integration (step = 0). Note that I think we'll need to fix this in the openmmtools version too.

Thanks! Will think about how to address this efficiently. If this is only an issue on the very first step, then the most direct thing might be to patch the sample_v_from equilibrium function.

I've also temporarily disabled the solvated alanine dipeptide and modified the parameters for the vacuum alanine dipeptide data collection to ensure the samples were less correlated.

Thanks!

This should be ready to merge after #4 is merged, and then we should get the refactor branch merged into master ASAP.

Will do

@maxentile maxentile merged commit b0a6f4c into refactor Apr 17, 2017
@maxentile maxentile deleted the python3 branch April 17, 2017 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants