1. 29 Mar, 2020 1 commit
    • Rasmus Wriedt Larsen's avatar
      Minor Python tweaks (#2616) · c87b96fb
      Rasmus Wriedt Larsen authored
      * Use list-comprehension in Python code
      
      A minor change, but slighly easier to understand the initialization of
      `parent_exclude_list` in my opinion.
      
      * Implement __ne__ in Python classes that has __eq__
      
      In Python 3, `__ne__` is automatically implemented as `not __eq__`.
      
      However, in Python 2 it seems to be implemented as `not is` (so based on object
      identity).
      
      Based on setup.py [0] which says that "OpenMM requires Python 2.7 or better", it
      should be useful to have better support for Python 2 :)
      
      This was already done in 4 of the 12 classes that implements `__eq__`
      
      ```
      >>> class WildCard(object):
      ...     def __eq__(self, other): return True
      
      >>> w = WildCard()
      
      >>> w == 42
      True
      
      >>> w != 42
      True
      
      >>> w != w
      False
      ```
      
      [0]: https://github.com/openmm/openmm/blob/5cef29ce8d4e17b6d0f9fd8a3c6cc1669ca0ba2b/wrappers/python/setup.py#L237
      
      * Use umambiguous floor division for index calculations in Python
      
      This makes the code work as intended if run as Python 3
      
      ```
      $ python2 -c 'print(3/2, 3//2)'
      (1, 1)
      $ python3 -c 'print(3/2, 3//2)'
      1.5 1
      ```
      
      * Use `with` for file handling in Python
      
      * Use `is None` instead of `== None` in Python
      
      This is recommended in PEP8:
      
      > Comparisons to singletons like None should always be done with is or is not, never the equality operators.
      > - https://www.python.org/dev/peps/pep-0008/#programming-recommendations
      c87b96fb
  2. 11 Jul, 2018 1 commit
  3. 10 Jul, 2018 1 commit
  4. 07 Mar, 2018 1 commit
  5. 03 Nov, 2015 1 commit
    • Robert McGibbon's avatar
      Improve docstrings · 98d053d4
      Robert McGibbon authored
      Swigged python docstrings now include documented return values and type
      information or their arguments. They are generated in numpydoc format.
      Furthermore, all of the Python app layer docstrings have been changed
      to numpydoc format. The filterPythonFiles.py script which helps to
      generate the Doxygen Python API docs has been updated to reflect these
      changes.
      98d053d4
  6. 27 Aug, 2015 1 commit
  7. 20 Apr, 2015 1 commit
  8. 10 Apr, 2015 1 commit
    • Jason Swails's avatar
      Improve CHARMM parsing when resnums have inscodes · 7b30da6e
      Jason Swails authored
      Apparently CHARMM PSF files (particularly those printed by VMD's psfgen) can
      have an insertion code tacked on to the end of the residue number, meaning that
      casting to an integer will invariably fail.  We can't just ignore the insertion
      code, though, since it will differentiate from the residues that came before and
      after (which will likely have the same number -- same general idea as insertion
      codes from PDB files). So instead we pull the insertion code off of the residue
      number and extend the Residue object to accommodate that.
      
      This is the port of the fix from ParmEd: ParmEd/ParmEd#98
      
      I added a test for this case.
      7b30da6e
  9. 22 Aug, 2014 1 commit
  10. 16 Aug, 2014 1 commit
  11. 18 Jul, 2014 1 commit
  12. 03 Jul, 2014 1 commit
    • Jason Swails's avatar
      Small fixes: · f5cbd31e
      Jason Swails authored
          - Adjust CharmmPsfFile parser to accept multiple blank lines before the
            NATOM record (I saw 1 PSF file like this... not sure how common it really
            is)
          - Removed the shebang line from element.py and removed execute permissions--
            it should never be executed directly (evidenced by the fact that the
            original shebang line was wrong and would never work, anyway).
          - Fix a test to determine if a Bond is part of an Angle in the PSF data
            structures.
      f5cbd31e
  13. 12 Jun, 2014 1 commit
  14. 12 May, 2014 1 commit
  15. 18 Apr, 2014 1 commit
  16. 10 Apr, 2014 2 commits
    • Jason Swails's avatar
      Move charmm package to internal. · 64803f2e
      Jason Swails authored
      64803f2e
    • Jason Swails's avatar
      Add a couple unittests for CHARMM files. Good thing, too, because they helped · 31f09353
      Jason Swails authored
      pick up some bugs that were not caught in my initial test following the port
      from ParmEd.
      
      All 4 tests pass right now, although no periodic systems are being tested.
      Currently CHARMM, XPLOR, and VMD tests are all being run (for the same ala-3
      system).
      
      Disable implicit solvent tests, since there is no robust radii assignment
      routine yet (the radii are stored in the Amber topology file).  I will port my
      assignment routine from ParmEd here shortly and then re-enable the GB tests.
      31f09353
  17. 09 Apr, 2014 1 commit