Skip to content

Commit

Permalink
remove cython from setup.py (#504)
Browse files Browse the repository at this point in the history
* remove cython from setup.py

* remove six and xrange -> range

* update changelog
  • Loading branch information
mikemhenry committed Mar 17, 2021
1 parent fa9e701 commit 3f2cfc0
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 32 deletions.
1 change: 0 additions & 1 deletion devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion devtools/conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ requirements:
- python
- numpy
- scipy
- six
- openmm >=7.3.1
- parmed
- mdtraj
Expand Down
1 change: 0 additions & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ dependencies:
- cython
- numpy
- scipy
- six
- parmed
- mdtraj
- numpydoc
Expand Down
4 changes: 4 additions & 0 deletions docs/releasehistory.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release History
***************

0.20.2 - Remove leftover support for python 2.7

- Remove leftover `six` imports and `xrange` (`#504 <https://github.com/choderalab/openmmtools/pull/504>`_)

0.20.1 - Bugfix release
========================================

Expand Down
10 changes: 5 additions & 5 deletions openmmtools/scripts/test_openmm_platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -318,7 +318,7 @@ def get_all_subclasses(cls):
List of all subclasses of `cls`.
"""

all_subclasses = []

for subclass in cls.__subclasses__():
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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']
Expand All @@ -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)

Expand Down
41 changes: 20 additions & 21 deletions openmmtools/sobol.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"""

import math
from six.moves import xrange
from numpy import *

def i4_bit_hi1 ( n ):
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -133,7 +132,7 @@ def i4_bit_lo0 ( n ):

i = i2
return bit

def i4_sobol_generate ( m, n, skip ):

#*****************************************************************************80
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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:
Expand Down Expand Up @@ -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, \
Expand Down Expand Up @@ -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.
#
Expand All @@ -349,18 +348,18 @@ 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
#
# 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]) )
Expand All @@ -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
#
Expand Down Expand Up @@ -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 )
Expand All @@ -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]) )

Expand Down Expand Up @@ -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 ) ):
Expand Down
3 changes: 0 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 3f2cfc0

Please sign in to comment.