From 3f2cfc0d9ea5ee69b270b1f7705867548f8ca037 Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Wed, 17 Mar 2021 08:31:41 -0700 Subject: [PATCH] remove cython from setup.py (#504) * remove cython from setup.py * remove six and xrange -> range * update changelog --- devtools/conda-envs/test_env.yaml | 1 - devtools/conda-recipe/meta.yaml | 1 - docs/environment.yml | 1 - docs/releasehistory.rst | 4 ++ openmmtools/scripts/test_openmm_platforms.py | 10 ++--- openmmtools/sobol.py | 41 ++++++++++---------- setup.py | 3 -- 7 files changed, 29 insertions(+), 32 deletions(-) diff --git a/devtools/conda-envs/test_env.yaml b/devtools/conda-envs/test_env.yaml index 5b5cd8603..2751a4442 100644 --- a/devtools/conda-envs/test_env.yaml +++ b/devtools/conda-envs/test_env.yaml @@ -14,7 +14,6 @@ dependencies: - python - numpy - scipy - - six - parmed - mdtraj - netcdf4 >=1.4.2 # after bugfix: "always return masked array by default, even if there are no masked values" diff --git a/devtools/conda-recipe/meta.yaml b/devtools/conda-recipe/meta.yaml index 14c692268..f4e54325b 100644 --- a/devtools/conda-recipe/meta.yaml +++ b/devtools/conda-recipe/meta.yaml @@ -20,7 +20,6 @@ requirements: - python - numpy - scipy - - six - openmm >=7.3.1 - parmed - mdtraj diff --git a/docs/environment.yml b/docs/environment.yml index 1c71fcf80..5d269f663 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -9,7 +9,6 @@ dependencies: - cython - numpy - scipy - - six - parmed - mdtraj - numpydoc diff --git a/docs/releasehistory.rst b/docs/releasehistory.rst index fde0d6228..6266bd981 100644 --- a/docs/releasehistory.rst +++ b/docs/releasehistory.rst @@ -1,6 +1,10 @@ Release History *************** +0.20.2 - Remove leftover support for python 2.7 + +- Remove leftover `six` imports and `xrange` (`#504 `_) + 0.20.1 - Bugfix release ======================================== diff --git a/openmmtools/scripts/test_openmm_platforms.py b/openmmtools/scripts/test_openmm_platforms.py index a19dcb33a..0094ed4ed 100644 --- a/openmmtools/scripts/test_openmm_platforms.py +++ b/openmmtools/scripts/test_openmm_platforms.py @@ -91,7 +91,7 @@ def format(self, record): n_handlers = len(logging.root.handlers) if n_handlers > 0: root_logger = logging.root - for i in xrange(n_handlers): + for i in range(n_handlers): root_logger.removeHandler(root_logger.handlers[0]) # If this is a worker node, don't save any log file @@ -318,7 +318,7 @@ def get_all_subclasses(cls): List of all subclasses of `cls`. """ - + all_subclasses = [] for subclass in cls.__subclasses__(): @@ -457,7 +457,7 @@ def main(): xml_file.write(state_xml) xml_file.close() - + # Place forces into different force groups. forces = [ system.getForce(force_index) for force_index in range(system.getNumForces()) ] force_group_names = dict() @@ -490,7 +490,7 @@ def main(): try: platform = openmm.Platform.getPlatform(platform_index) platform_name = platform.getName() - + # Define precision models to test. if platform_name == 'Reference': precision_models = ['double'] @@ -505,7 +505,7 @@ def main(): platform.setPropertyDefaultValue('CudaPrecision', precision_model) if platform_name == 'OpenCL': platform.setPropertyDefaultValue('OpenCLPrecision', precision_model) - + # Compute potential and force. [platform_potential, platform_force] = compute_potential_and_force_by_force_group(system, positions, platform, force_group) diff --git a/openmmtools/sobol.py b/openmmtools/sobol.py index cc91780f5..a8862ac81 100644 --- a/openmmtools/sobol.py +++ b/openmmtools/sobol.py @@ -7,7 +7,6 @@ """ import math -from six.moves import xrange from numpy import * def i4_bit_hi1 ( n ): @@ -23,7 +22,7 @@ def i4_bit_hi1 ( n ): # 0 0 0 # 1 1 1 # 2 10 2 -# 3 11 2 +# 3 11 2 # 4 100 3 # 5 101 3 # 6 110 3 @@ -84,7 +83,7 @@ def i4_bit_lo0 ( n ): # 0 0 1 # 1 1 2 # 2 10 1 -# 3 11 3 +# 3 11 3 # 4 100 1 # 5 101 2 # 6 110 1 @@ -133,7 +132,7 @@ def i4_bit_lo0 ( n ): i = i2 return bit - + def i4_sobol_generate ( m, n, skip ): #*****************************************************************************80 @@ -164,7 +163,7 @@ def i4_sobol_generate ( m, n, skip ): # Output, real R(M,N), the points. # r=zeros((m,n)) - for j in xrange (1, n+1): + for j in range (1, n+1): seed = skip + j - 2 [ r[0:m,j-1], seed ] = i4_sobol ( m, seed ) return r @@ -207,7 +206,7 @@ def i4_sobol ( dim_num, seed ): # # Bennett Fox, # Algorithm 647: -# Implementation and Relative Efficiency of Quasirandom +# Implementation and Relative Efficiency of Quasirandom # Sequence Generators, # ACM Transactions on Mathematical Software, # Volume 12, Number 4, pages 362-376, 1986. @@ -216,10 +215,10 @@ def i4_sobol ( dim_num, seed ): # USSR Computational Mathematics and Mathematical Physics, # Volume 16, pages 236-242, 1977. # -# Ilya Sobol, Levitan, -# The Production of Points Uniformly Distributed in a Multidimensional +# Ilya Sobol, Levitan, +# The Production of Points Uniformly Distributed in a Multidimensional # Cube (in Russian), -# Preprint IPM Akad. Nauk SSSR, +# Preprint IPM Akad. Nauk SSSR, # Number 40, Moscow 1976. # # Parameters: @@ -274,7 +273,7 @@ def i4_sobol ( dim_num, seed ): 1, 3, 7, 9, 5,13,13,11, 3,15, \ 5, 3,15, 7, 9,13, 9, 1,11, 7, \ 5,15, 1,15,11, 5, 3, 1, 7, 9 ]) - + v[7:40,4] = transpose([ \ 9, 3,27, \ 15,29,21,23,19,11,25, 7,13,17, \ @@ -331,7 +330,7 @@ def i4_sobol ( dim_num, seed ): # # Initialize the remaining rows of V. # - for i in xrange(2 , dim_num+1): + for i in range(2 , dim_num+1): # # The bits of the integer POLY(I) gives the form of polynomial I. # @@ -349,7 +348,7 @@ def i4_sobol ( dim_num, seed ): # j = self.poly[i-1] includ=zeros(m) - for k in xrange(m, 0, -1): + for k in range(m, 0, -1): j2 = math.floor ( j / 2. ) includ[k-1] = (j != 2 * j2 ) j = j2 @@ -357,10 +356,10 @@ def i4_sobol ( dim_num, seed ): # Calculate the remaining elements of row I as explained # in Bratley and Fox, section 2. # - for j in xrange( m+1, self.maxcol+1 ): + for j in range( m+1, self.maxcol+1 ): newv = self.v[i-1,j-m-1] l = 1 - for k in xrange(1, m+1): + for k in range(1, m+1): l = 2 * l if ( includ[k-1] ): newv = bitwise_xor ( int(newv), int(l * self.v[i-1,j-k-1]) ) @@ -369,7 +368,7 @@ def i4_sobol ( dim_num, seed ): # Multiply columns of V by appropriate power of 2. # l = 1 - for j in xrange( self.maxcol-1, 0, -1): + for j in range( self.maxcol-1, 0, -1): l = 2 * l self.v[0:dim_num,j-1] = self.v[0:dim_num,j-1] * l # @@ -399,18 +398,18 @@ def i4_sobol ( dim_num, seed ): l = 1 self.lastq=zeros(dim_num) - for seed_temp in xrange( int(self.seed_save), int(seed)): + for seed_temp in range( int(self.seed_save), int(seed)): l = i4_bit_lo0 ( seed_temp ) - for i in xrange(1 , dim_num+1): + for i in range(1 , dim_num+1): self.lastq[i-1] = bitwise_xor ( int(self.lastq[i-1]), int(self.v[i-1,l-1]) ) l = i4_bit_lo0 ( seed ) elif ( self.seed_save + 1 < seed ): - for seed_temp in xrange( int(self.seed_save + 1), int(seed) ): + for seed_temp in range( int(self.seed_save + 1), int(seed) ): l = i4_bit_lo0 ( seed_temp ) - for i in xrange(1, dim_num+1): + for i in range(1, dim_num+1): self.lastq[i-1] = bitwise_xor ( int(self.lastq[i-1]), int(self.v[i-1,l-1]) ) l = i4_bit_lo0 ( seed ) @@ -427,7 +426,7 @@ def i4_sobol ( dim_num, seed ): # Calculate the new components of QUASI. # quasi=zeros(dim_num) - for i in xrange( 1, dim_num+1): + for i in range( 1, dim_num+1): quasi[i-1] = self.lastq[i-1] * self.recipd self.lastq[i-1] = bitwise_xor ( int(self.lastq[i-1]), int(self.v[i-1,l-1]) ) @@ -571,7 +570,7 @@ def prime_ge ( n ): # Input, integer N, the number to be bounded. # # Output, integer P, the smallest prime number that is greater -# than or equal to N. +# than or equal to N. # p = max ( math.ceil ( n ), 2 ) while ( not isprime ( p ) ): diff --git a/setup.py b/setup.py index 10500ff8a..4b1464bd6 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,6 @@ """ Various Python tools for OpenMM. """ -import distutils.extension -from Cython.Build import cythonize - import sys from setuptools import setup, find_packages import versioneer