jdrusso / msm_we

History-augmented Markov analysis of weighted ensemble trajectories.
https://msm-we.readthedocs.io
MIT License
7 stars 7 forks source link

Suppress `openmm` import warnings in code using MDAnalysis #25

Closed jdrusso closed 2 years ago

jdrusso commented 2 years ago

MDAnalysis appears to use an old-style method of importing openmm, which raises

(do_stratified_ray_discretization pid=559390) Warning: importing 'simtk.openmm' is deprecated.  Import 'openmm' 
instead.

Suppress this in, for example, my sample processCoordinates scripts (which use mdanalysis)

jdrusso commented 2 years ago
In [1]: from MDAnalysis.analysis import distances

In [2]: import MDAnalysis as mda

In [3]: ref_file = '/home/jd/openeye/synmd_runs/2JOF.pdb'

In [4]: u_ref = mda.Universe(ref_file)
Warning: importing 'simtk.openmm' is deprecated.  Import 'openmm' instead.

The warning can be reproduced by this snippet, and you can see it happens when creating the Universe object

jdrusso commented 2 years ago

The warning comes from my use of MDAnalysis in processCoordinates, and can be suppressed with

import warnings

....

    with warnings.catch_warnings():
        warnings.simplefilter("ignore")

        u_ref = mda.Universe(ref_file)

Not really a bug, or present anywhere else