Commit b665dfcb authored by peastman's avatar peastman
Browse files

Merge pull request #1083 from rmcgibbo/wip-single-23-codebase

Single py2/3 codebase
parents 69a3f678 83d0e5e3
...@@ -30,6 +30,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. ...@@ -30,6 +30,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
""" """
from __future__ import division from __future__ import division
from __future__ import absolute_import
from simtk.openmm import CustomGBForce, Continuous2DFunction from simtk.openmm import CustomGBForce, Continuous2DFunction
...@@ -369,13 +370,13 @@ def GBSAGBn2Force(solventDielectric=78.5, soluteDielectric=1, SA=None, ...@@ -369,13 +370,13 @@ def GBSAGBn2Force(solventDielectric=78.5, soluteDielectric=1, SA=None,
def convertParameters(params, gbmodel): def convertParameters(params, gbmodel):
"""Convert the GB parameters from the file into the values expected by the appropriate CustomGBForce.""" """Convert the GB parameters from the file into the values expected by the appropriate CustomGBForce."""
newparams = [None]*len(params)
if gbmodel == 'GBn2': if gbmodel == 'GBn2':
offset = 0.0195141 offset = 0.0195141
else: else:
offset = 0.009 offset = 0.009
for i in range(len(params)):
newparams[i] = list(params[i]) for p in params:
newparams[i][0] -= offset newParam = list(p)
newparams[i][1] *= newparams[i][0] newParam[0] -= offset
return newparams newParam[1] *= newParam[0]
yield newParam
...@@ -36,6 +36,7 @@ The DataCategory class provides base storage container for instance ...@@ -36,6 +36,7 @@ The DataCategory class provides base storage container for instance
data and definition meta data. data and definition meta data.
""" """
from __future__ import absolute_import
__docformat__ = "restructuredtext en" __docformat__ = "restructuredtext en"
__author__ = "John Westbrook" __author__ = "John Westbrook"
...@@ -99,13 +100,13 @@ class ContainerBase(object): ...@@ -99,13 +100,13 @@ class ContainerBase(object):
self.__name=name self.__name=name
def exists(self,name): def exists(self,name):
if self.__objCatalog.has_key(name): if name in self.__objCatalog:
return True return True
else: else:
return False return False
def getObj(self,name): def getObj(self,name):
if self.__objCatalog.has_key(name): if name in self.__objCatalog:
return self.__objCatalog[name] return self.__objCatalog[name]
else: else:
return None return None
...@@ -118,7 +119,7 @@ class ContainerBase(object): ...@@ -118,7 +119,7 @@ class ContainerBase(object):
of the same name will be overwritten. of the same name will be overwritten.
""" """
if obj.getName() is not None: if obj.getName() is not None:
if not self.__objCatalog.has_key(obj.getName()): if obj.getName() not in self.__objCatalog:
# self.__objNameList is keeping track of object order here -- # self.__objNameList is keeping track of object order here --
self.__objNameList.append(obj.getName()) self.__objNameList.append(obj.getName())
self.__objCatalog[obj.getName()]=obj self.__objCatalog[obj.getName()]=obj
...@@ -126,7 +127,7 @@ class ContainerBase(object): ...@@ -126,7 +127,7 @@ class ContainerBase(object):
def replace(self,obj): def replace(self,obj):
""" Replace an existing object with the input object """ Replace an existing object with the input object
""" """
if ((obj.getName() is not None) and (self.__objCatalog.has_key(obj.getName())) ): if ((obj.getName() is not None) and (obj.getName() in self.__objCatalog) ):
self.__objCatalog[obj.getName()]=obj self.__objCatalog[obj.getName()]=obj
...@@ -158,7 +159,7 @@ class ContainerBase(object): ...@@ -158,7 +159,7 @@ class ContainerBase(object):
""" Revmove object by name. Return True on success or False otherwise. """ Revmove object by name. Return True on success or False otherwise.
""" """
try: try:
if self.__objCatalog.has_key(curName): if curName in self.__objCatalog:
del self.__objCatalog[curName] del self.__objCatalog[curName]
i=self.__objNameList.index(curName) i=self.__objNameList.index(curName)
del self.__objNameList[i] del self.__objNameList[i]
...@@ -217,7 +218,7 @@ class DataContainer(ContainerBase): ...@@ -217,7 +218,7 @@ class DataContainer(ContainerBase):
def invokeDataBlockMethod(self,type,method,db): def invokeDataBlockMethod(self,type,method,db):
self.__currentRow = 1 self.__currentRow = 1
exec method.getInline() exec(method.getInline())
def setGlobal(self): def setGlobal(self):
self.__globalFlag=True self.__globalFlag=True
...@@ -328,7 +329,7 @@ class DataCategory(DataCategoryBase): ...@@ -328,7 +329,7 @@ class DataCategory(DataCategoryBase):
return self._rowList[0][ii] return self._rowList[0][ii]
except (IndexError, KeyError): except (IndexError, KeyError):
raise KeyError raise KeyError
raise TypeError, x raise TypeError(x)
def getCurrentAttribute(self): def getCurrentAttribute(self):
...@@ -464,7 +465,7 @@ class DataCategory(DataCategoryBase): ...@@ -464,7 +465,7 @@ class DataCategory(DataCategoryBase):
return self._rowList[rowI][self._attributeNameList.index(attribute)] return self._rowList[rowI][self._attributeNameList.index(attribute)]
except (IndexError): except (IndexError):
raise IndexError raise IndexError
raise IndexError, attribute raise IndexError(attribute)
def setValue(self,value,attributeName=None,rowIndex=None): def setValue(self,value,attributeName=None,rowIndex=None):
if attributeName is None: if attributeName is None:
...@@ -544,13 +545,13 @@ class DataCategory(DataCategoryBase): ...@@ -544,13 +545,13 @@ class DataCategory(DataCategoryBase):
if (ind >= ll): if (ind >= ll):
row.extend([None for ii in xrange(2*ind-ll)]) row.extend([None for ii in xrange(2*ind-ll)])
row[ind]=None row[ind]=None
exec method.getInline() exec(method.getInline())
self.__currentRowIndex+=1 self.__currentRowIndex+=1
currentRowIndex=self.__currentRowIndex currentRowIndex=self.__currentRowIndex
def invokeCategoryMethod(self,type,method,db): def invokeCategoryMethod(self,type,method,db):
self.__currentRowIndex = 0 self.__currentRowIndex = 0
exec method.getInline() exec(method.getInline())
def getAttributeLengthMaximumList(self): def getAttributeLengthMaximumList(self):
mList=[0 for i in len(self._attributeNameList)] mList=[0 for i in len(self._attributeNameList)]
...@@ -750,7 +751,7 @@ class DataCategory(DataCategoryBase): ...@@ -750,7 +751,7 @@ class DataCategory(DataCategoryBase):
except (IndexError): except (IndexError):
self.__lfh.write("attributeName %s rowI %r rowdata %r\n" % (attributeName,rowI,self._rowList[rowI])) self.__lfh.write("attributeName %s rowI %r rowdata %r\n" % (attributeName,rowI,self._rowList[rowI]))
raise IndexError raise IndexError
raise TypeError, attribute raise TypeError(attribute)
def getValueFormattedByIndex(self,attributeIndex,rowIndex): def getValueFormattedByIndex(self,attributeIndex,rowIndex):
......
...@@ -27,6 +27,7 @@ Acknowledgements: ...@@ -27,6 +27,7 @@ Acknowledgements:
See: http://pymmlib.sourceforge.net/ See: http://pymmlib.sourceforge.net/
""" """
from __future__ import absolute_import
__docformat__ = "restructuredtext en" __docformat__ = "restructuredtext en"
__author__ = "John Westbrook" __author__ = "John Westbrook"
...@@ -137,7 +138,7 @@ class PdbxReader(object): ...@@ -137,7 +138,7 @@ class PdbxReader(object):
# Find the first reserved word and begin capturing data. # Find the first reserved word and begin capturing data.
# #
while True: while True:
curCatName, curAttName, curQuotedString, curWord = tokenizer.next() curCatName, curAttName, curQuotedString, curWord = next(tokenizer)
if curWord is None: if curWord is None:
continue continue
reservedWord, state = self.__getState(curWord) reservedWord, state = self.__getState(curWord)
...@@ -194,7 +195,7 @@ class PdbxReader(object): ...@@ -194,7 +195,7 @@ class PdbxReader(object):
# Get the data for this attribute from the next token # Get the data for this attribute from the next token
tCat, tAtt, curQuotedString, curWord = tokenizer.next() tCat, tAtt, curQuotedString, curWord = next(tokenizer)
if tCat is not None or (curQuotedString is None and curWord is None): if tCat is not None or (curQuotedString is None and curWord is None):
self.__syntaxError("Missing data for item _%s.%s" % (curCatName,curAttName)) self.__syntaxError("Missing data for item _%s.%s" % (curCatName,curAttName))
...@@ -215,7 +216,7 @@ class PdbxReader(object): ...@@ -215,7 +216,7 @@ class PdbxReader(object):
else: else:
self.__syntaxError("Missing value in item-value pair") self.__syntaxError("Missing value in item-value pair")
curCatName, curAttName, curQuotedString, curWord = tokenizer.next() curCatName, curAttName, curQuotedString, curWord = next(tokenizer)
continue continue
# #
...@@ -225,14 +226,14 @@ class PdbxReader(object): ...@@ -225,14 +226,14 @@ class PdbxReader(object):
# The category name in the next curCatName,curAttName pair # The category name in the next curCatName,curAttName pair
# defines the name of the category container. # defines the name of the category container.
curCatName,curAttName,curQuotedString,curWord = tokenizer.next() curCatName,curAttName,curQuotedString,curWord = next(tokenizer)
if curCatName is None or curAttName is None: if curCatName is None or curAttName is None:
self.__syntaxError("Unexpected token in loop_ declaration") self.__syntaxError("Unexpected token in loop_ declaration")
return return
# Check for a previous category declaration. # Check for a previous category declaration.
if categoryIndex.has_key(curCatName): if curCatName in categoryIndex:
self.__syntaxError("Duplicate category declaration in loop_") self.__syntaxError("Duplicate category declaration in loop_")
return return
...@@ -248,7 +249,7 @@ class PdbxReader(object): ...@@ -248,7 +249,7 @@ class PdbxReader(object):
# Read the rest of the loop_ declaration # Read the rest of the loop_ declaration
while True: while True:
curCatName, curAttName, curQuotedString, curWord = tokenizer.next() curCatName, curAttName, curQuotedString, curWord = next(tokenizer)
if curCatName is None: if curCatName is None:
break break
...@@ -280,7 +281,7 @@ class PdbxReader(object): ...@@ -280,7 +281,7 @@ class PdbxReader(object):
elif curQuotedString is not None: elif curQuotedString is not None:
curRow.append(curQuotedString) curRow.append(curQuotedString)
curCatName,curAttName,curQuotedString,curWord = tokenizer.next() curCatName,curAttName,curQuotedString,curWord = next(tokenizer)
# loop_ data processing ends if - # loop_ data processing ends if -
...@@ -306,7 +307,7 @@ class PdbxReader(object): ...@@ -306,7 +307,7 @@ class PdbxReader(object):
categoryIndex = {} categoryIndex = {}
curCategory = None curCategory = None
curCatName,curAttName,curQuotedString,curWord = tokenizer.next() curCatName,curAttName,curQuotedString,curWord = next(tokenizer)
elif state == "ST_DATA_CONTAINER": elif state == "ST_DATA_CONTAINER":
# #
...@@ -317,7 +318,7 @@ class PdbxReader(object): ...@@ -317,7 +318,7 @@ class PdbxReader(object):
containerList.append(curContainer) containerList.append(curContainer)
categoryIndex = {} categoryIndex = {}
curCategory = None curCategory = None
curCatName,curAttName,curQuotedString,curWord = tokenizer.next() curCatName,curAttName,curQuotedString,curWord = next(tokenizer)
elif state == "ST_STOP": elif state == "ST_STOP":
return return
...@@ -327,7 +328,7 @@ class PdbxReader(object): ...@@ -327,7 +328,7 @@ class PdbxReader(object):
containerList.append(curContainer) containerList.append(curContainer)
categoryIndex = {} categoryIndex = {}
curCategory = None curCategory = None
curCatName,curAttName,curQuotedString,curWord = tokenizer.next() curCatName,curAttName,curQuotedString,curWord = next(tokenizer)
elif state == "ST_UNKNOWN": elif state == "ST_UNKNOWN":
self.__syntaxError("Unrecogized syntax element: " + str(curWord)) self.__syntaxError("Unrecogized syntax element: " + str(curWord))
...@@ -366,7 +367,7 @@ class PdbxReader(object): ...@@ -366,7 +367,7 @@ class PdbxReader(object):
## Tokenizer loop begins here --- ## Tokenizer loop begins here ---
while True: while True:
line = fileIter.next() line = next(fileIter)
self.__curLineNumber += 1 self.__curLineNumber += 1
# Dump comments # Dump comments
...@@ -379,7 +380,7 @@ class PdbxReader(object): ...@@ -379,7 +380,7 @@ class PdbxReader(object):
if line.startswith(";"): if line.startswith(";"):
mlString = [line[1:]] mlString = [line[1:]]
while True: while True:
line = fileIter.next() line = next(fileIter)
self.__curLineNumber += 1 self.__curLineNumber += 1
if line.startswith(";"): if line.startswith(";"):
break break
...@@ -451,7 +452,7 @@ class PdbxReader(object): ...@@ -451,7 +452,7 @@ class PdbxReader(object):
## Tokenizer loop begins here --- ## Tokenizer loop begins here ---
while True: while True:
line = fileIter.next() line = next(fileIter)
self.__curLineNumber += 1 self.__curLineNumber += 1
# Dump comments # Dump comments
...@@ -464,7 +465,7 @@ class PdbxReader(object): ...@@ -464,7 +465,7 @@ class PdbxReader(object):
if line.startswith(";"): if line.startswith(";"):
mlString = [line[1:]] mlString = [line[1:]]
while True: while True:
line = fileIter.next() line = next(fileIter)
self.__curLineNumber += 1 self.__curLineNumber += 1
if line.startswith(";"): if line.startswith(";"):
break break
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
## ##
""" Various tests caess for PDBx/mmCIF data file and dictionary reader and writer. """ Various tests caess for PDBx/mmCIF data file and dictionary reader and writer.
""" """
from __future__ import absolute_import
__docformat__ = "restructuredtext en" __docformat__ = "restructuredtext en"
__author__ = "John Westbrook" __author__ = "John Westbrook"
......
...@@ -22,6 +22,7 @@ Acknowledgements: ...@@ -22,6 +22,7 @@ Acknowledgements:
See: http://pymmlib.sourceforge.net/ See: http://pymmlib.sourceforge.net/
""" """
from __future__ import absolute_import
import re,sys import re,sys
from simtk.openmm.app.internal.pdbx.reader.PdbxContainers import * from simtk.openmm.app.internal.pdbx.reader.PdbxContainers import *
...@@ -126,7 +127,7 @@ class PdbxReader(object): ...@@ -126,7 +127,7 @@ class PdbxReader(object):
# Find the first reserved word and begin capturing data. # Find the first reserved word and begin capturing data.
# #
while True: while True:
curCatName, curAttName, curQuotedString, curWord = tokenizer.next() curCatName, curAttName, curQuotedString, curWord = next(tokenizer)
if curWord is None: if curWord is None:
continue continue
reservedWord, state = self.__getState(curWord) reservedWord, state = self.__getState(curWord)
...@@ -183,7 +184,7 @@ class PdbxReader(object): ...@@ -183,7 +184,7 @@ class PdbxReader(object):
# Get the data for this attribute from the next token # Get the data for this attribute from the next token
tCat, tAtt, curQuotedString, curWord = tokenizer.next() tCat, tAtt, curQuotedString, curWord = next(tokenizer)
if tCat is not None or (curQuotedString is None and curWord is None): if tCat is not None or (curQuotedString is None and curWord is None):
self.__syntaxError("Missing data for item _%s.%s" % (curCatName,curAttName)) self.__syntaxError("Missing data for item _%s.%s" % (curCatName,curAttName))
...@@ -204,7 +205,7 @@ class PdbxReader(object): ...@@ -204,7 +205,7 @@ class PdbxReader(object):
else: else:
self.__syntaxError("Missing value in item-value pair") self.__syntaxError("Missing value in item-value pair")
curCatName, curAttName, curQuotedString, curWord = tokenizer.next() curCatName, curAttName, curQuotedString, curWord = next(tokenizer)
continue continue
# #
...@@ -214,14 +215,14 @@ class PdbxReader(object): ...@@ -214,14 +215,14 @@ class PdbxReader(object):
# The category name in the next curCatName,curAttName pair # The category name in the next curCatName,curAttName pair
# defines the name of the category container. # defines the name of the category container.
curCatName,curAttName,curQuotedString,curWord = tokenizer.next() curCatName,curAttName,curQuotedString,curWord = next(tokenizer)
if curCatName is None or curAttName is None: if curCatName is None or curAttName is None:
self.__syntaxError("Unexpected token in loop_ declaration") self.__syntaxError("Unexpected token in loop_ declaration")
return return
# Check for a previous category declaration. # Check for a previous category declaration.
if categoryIndex.has_key(curCatName): if curCatName in categoryIndex:
self.__syntaxError("Duplicate category declaration in loop_") self.__syntaxError("Duplicate category declaration in loop_")
return return
...@@ -237,7 +238,7 @@ class PdbxReader(object): ...@@ -237,7 +238,7 @@ class PdbxReader(object):
# Read the rest of the loop_ declaration # Read the rest of the loop_ declaration
while True: while True:
curCatName, curAttName, curQuotedString, curWord = tokenizer.next() curCatName, curAttName, curQuotedString, curWord = next(tokenizer)
if curCatName is None: if curCatName is None:
break break
...@@ -269,7 +270,7 @@ class PdbxReader(object): ...@@ -269,7 +270,7 @@ class PdbxReader(object):
elif curQuotedString is not None: elif curQuotedString is not None:
curRow.append(curQuotedString) curRow.append(curQuotedString)
curCatName,curAttName,curQuotedString,curWord = tokenizer.next() curCatName,curAttName,curQuotedString,curWord = next(tokenizer)
# loop_ data processing ends if - # loop_ data processing ends if -
...@@ -295,7 +296,7 @@ class PdbxReader(object): ...@@ -295,7 +296,7 @@ class PdbxReader(object):
categoryIndex = {} categoryIndex = {}
curCategory = None curCategory = None
curCatName,curAttName,curQuotedString,curWord = tokenizer.next() curCatName,curAttName,curQuotedString,curWord = next(tokenizer)
elif state == "ST_DATA_CONTAINER": elif state == "ST_DATA_CONTAINER":
# #
...@@ -306,7 +307,7 @@ class PdbxReader(object): ...@@ -306,7 +307,7 @@ class PdbxReader(object):
containerList.append(curContainer) containerList.append(curContainer)
categoryIndex = {} categoryIndex = {}
curCategory = None curCategory = None
curCatName,curAttName,curQuotedString,curWord = tokenizer.next() curCatName,curAttName,curQuotedString,curWord = next(tokenizer)
elif state == "ST_STOP": elif state == "ST_STOP":
return return
...@@ -316,7 +317,7 @@ class PdbxReader(object): ...@@ -316,7 +317,7 @@ class PdbxReader(object):
containerList.append(curContainer) containerList.append(curContainer)
categoryIndex = {} categoryIndex = {}
curCategory = None curCategory = None
curCatName,curAttName,curQuotedString,curWord = tokenizer.next() curCatName,curAttName,curQuotedString,curWord = next(tokenizer)
elif state == "ST_UNKNOWN": elif state == "ST_UNKNOWN":
self.__syntaxError("Unrecogized syntax element: " + str(curWord)) self.__syntaxError("Unrecogized syntax element: " + str(curWord))
...@@ -355,7 +356,7 @@ class PdbxReader(object): ...@@ -355,7 +356,7 @@ class PdbxReader(object):
## Tokenizer loop begins here --- ## Tokenizer loop begins here ---
while True: while True:
line = fileIter.next() line = next(fileIter)
self.__curLineNumber += 1 self.__curLineNumber += 1
# Dump comments # Dump comments
...@@ -368,7 +369,7 @@ class PdbxReader(object): ...@@ -368,7 +369,7 @@ class PdbxReader(object):
if line.startswith(";"): if line.startswith(";"):
mlString = [line[1:]] mlString = [line[1:]]
while True: while True:
line = fileIter.next() line = next(fileIter)
self.__curLineNumber += 1 self.__curLineNumber += 1
if line.startswith(";"): if line.startswith(";"):
break break
...@@ -426,7 +427,7 @@ class PdbxReader(object): ...@@ -426,7 +427,7 @@ class PdbxReader(object):
## Tokenizer loop begins here --- ## Tokenizer loop begins here ---
while True: while True:
line = fileIter.next() line = next(fileIter)
self.__curLineNumber += 1 self.__curLineNumber += 1
# Dump comments # Dump comments
...@@ -439,7 +440,7 @@ class PdbxReader(object): ...@@ -439,7 +440,7 @@ class PdbxReader(object):
if line.startswith(";"): if line.startswith(";"):
mlString = [line[1:]] mlString = [line[1:]]
while True: while True:
line = fileIter.next() line = next(fileIter)
self.__curLineNumber += 1 self.__curLineNumber += 1
if line.startswith(";"): if line.startswith(";"):
break break
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
Test cases for reading PDBx/mmCIF data files PdbxReader class - Test cases for reading PDBx/mmCIF data files PdbxReader class -
""" """
from __future__ import absolute_import
import sys, unittest, traceback import sys, unittest, traceback
import sys, time, os, os.path, shutil import sys, time, os, os.path, shutil
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
Classes for writing data and dictionary containers in PDBx/mmCIF format. Classes for writing data and dictionary containers in PDBx/mmCIF format.
""" """
from __future__ import absolute_import
__docformat__ = "restructuredtext en" __docformat__ = "restructuredtext en"
__author__ = "John Westbrook" __author__ = "John Westbrook"
__email__ = "jwest@rcsb.rutgers.edu" __email__ = "jwest@rcsb.rutgers.edu"
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
Test implementing PDBx/mmCIF write and formatting operations. Test implementing PDBx/mmCIF write and formatting operations.
""" """
from __future__ import absolute_import
__docformat__ = "restructuredtext en" __docformat__ = "restructuredtext en"
__author__ = "John Westbrook" __author__ = "John Westbrook"
__email__ = "jwest@rcsb.rutgers.edu" __email__ = "jwest@rcsb.rutgers.edu"
......
...@@ -28,6 +28,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR ...@@ -28,6 +28,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE. USE OR OTHER DEALINGS IN THE SOFTWARE.
""" """
from __future__ import absolute_import
__author__ = "Peter Eastman" __author__ = "Peter Eastman"
__version__ = "1.0" __version__ = "1.0"
......
...@@ -29,6 +29,7 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE ...@@ -29,6 +29,7 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE. USE OR OTHER DEALINGS IN THE SOFTWARE.
""" """
from __future__ import division from __future__ import division
from __future__ import absolute_import
__author__ = "Peter Eastman" __author__ = "Peter Eastman"
__version__ = "1.0" __version__ = "1.0"
...@@ -40,7 +41,7 @@ from simtk.openmm.vec3 import Vec3 ...@@ -40,7 +41,7 @@ from simtk.openmm.vec3 import Vec3
from simtk.openmm import System, Context, NonbondedForce, CustomNonbondedForce, HarmonicBondForce, HarmonicAngleForce, VerletIntegrator, LocalEnergyMinimizer from simtk.openmm import System, Context, NonbondedForce, CustomNonbondedForce, HarmonicBondForce, HarmonicAngleForce, VerletIntegrator, LocalEnergyMinimizer
from simtk.unit import nanometer, molar, elementary_charge, amu, gram, liter, degree, sqrt, acos, is_quantity, dot, norm from simtk.unit import nanometer, molar, elementary_charge, amu, gram, liter, degree, sqrt, acos, is_quantity, dot, norm
import simtk.unit as unit import simtk.unit as unit
import element as elem from . import element as elem
import os import os
import random import random
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
...@@ -877,7 +878,7 @@ class Modeller(object): ...@@ -877,7 +878,7 @@ class Modeller(object):
# Create copies of all residue templates that have had all extra points removed. # Create copies of all residue templates that have had all extra points removed.
templatesNoEP = {} templatesNoEP = {}
for resName, template in forcefield._templates.iteritems(): for resName, template in forcefield._templates.items():
if any(atom.element is None for atom in template.atoms): if any(atom.element is None for atom in template.atoms):
index = 0 index = 0
newIndex = {} newIndex = {}
......
...@@ -28,6 +28,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR ...@@ -28,6 +28,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE. USE OR OTHER DEALINGS IN THE SOFTWARE.
""" """
from __future__ import absolute_import
__author__ = "Peter Eastman" __author__ = "Peter Eastman"
__version__ = "1.0" __version__ = "1.0"
......
...@@ -28,6 +28,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR ...@@ -28,6 +28,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE. USE OR OTHER DEALINGS IN THE SOFTWARE.
""" """
from __future__ import absolute_import
__author__ = "Peter Eastman" __author__ = "Peter Eastman"
__version__ = "1.0" __version__ = "1.0"
...@@ -133,7 +134,7 @@ class Simulation(object): ...@@ -133,7 +134,7 @@ class Simulation(object):
def _simulate(self, endStep=None, endTime=None): def _simulate(self, endStep=None, endTime=None):
if endStep is None: if endStep is None:
endStep = sys.maxint endStep = sys.maxsize
nextReport = [None]*len(self.reporters) nextReport = [None]*len(self.reporters)
while self.currentStep < endStep and (endTime is None or datetime.now() < endTime): while self.currentStep < endStep and (endTime is None or datetime.now() < endTime):
nextSteps = endStep-self.currentStep nextSteps = endStep-self.currentStep
......
...@@ -28,6 +28,8 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR ...@@ -28,6 +28,8 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE. USE OR OTHER DEALINGS IN THE SOFTWARE.
""" """
from __future__ import absolute_import
from __future__ import print_function
__author__ = "Peter Eastman" __author__ = "Peter Eastman"
__version__ = "1.0" __version__ = "1.0"
...@@ -146,7 +148,7 @@ class StateDataReporter(object): ...@@ -146,7 +148,7 @@ class StateDataReporter(object):
if not self._hasInitialized: if not self._hasInitialized:
self._initializeConstants(simulation) self._initializeConstants(simulation)
headers = self._constructHeaders() headers = self._constructHeaders()
print >>self._out, '#"%s"' % ('"'+self._separator+'"').join(headers) print('#"%s"' % ('"'+self._separator+'"').join(headers), file=self._out)
try: try:
self._out.flush() self._out.flush()
except AttributeError: except AttributeError:
...@@ -163,7 +165,7 @@ class StateDataReporter(object): ...@@ -163,7 +165,7 @@ class StateDataReporter(object):
values = self._constructReportValues(simulation, state) values = self._constructReportValues(simulation, state)
# Write the values. # Write the values.
print >>self._out, self._separator.join(str(v) for v in values) print(self._separator.join(str(v) for v in values), file=self._out)
try: try:
self._out.flush() self._out.flush()
except AttributeError: except AttributeError:
......
...@@ -28,6 +28,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR ...@@ -28,6 +28,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE. USE OR OTHER DEALINGS IN THE SOFTWARE.
""" """
from __future__ import absolute_import
__author__ = "Peter Eastman" __author__ = "Peter Eastman"
__version__ = "1.0" __version__ = "1.0"
......
...@@ -28,6 +28,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR ...@@ -28,6 +28,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE. USE OR OTHER DEALINGS IN THE SOFTWARE.
""" """
from __future__ import absolute_import
__author__ = "Peter Eastman" __author__ = "Peter Eastman"
__version__ = "1.0" __version__ = "1.0"
......
...@@ -28,6 +28,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR ...@@ -28,6 +28,7 @@ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE. USE OR OTHER DEALINGS IN THE SOFTWARE.
""" """
from __future__ import absolute_import
__author__ = "Peter Eastman" __author__ = "Peter Eastman"
__version__ = "1.0" __version__ = "1.0"
......
from __future__ import print_function from __future__ import print_function
from __future__ import absolute_import
from functools import wraps from functools import wraps
import os import os
import sys import sys
......
""" """
Physical quantities with units for dimensional analysis and automatic unit conversion. Physical quantities with units for dimensional analysis and automatic unit conversion.
""" """
__docformat__ = "epytext en" from __future__ import absolute_import
__author__ = "Christopher M. Bruns" __docformat__ = "epytext en"
__copyright__ = "Copyright 2010, Stanford University and Christopher M. Bruns" __author__ = "Christopher M. Bruns"
__credits__ = [] __copyright__ = "Copyright 2010, Stanford University and Christopher M. Bruns"
__license__ = "MIT" __credits__ = []
__maintainer__ = "Christopher M. Bruns" __license__ = "MIT"
__email__ = "cmbruns@stanford.edu" __maintainer__ = "Christopher M. Bruns"
__email__ = "cmbruns@stanford.edu"
from unit import Unit, is_unit
from quantity import Quantity, is_quantity from .unit import Unit, is_unit
from unit_math import * from .quantity import Quantity, is_quantity
from unit_definitions import * from .unit_math import *
from constants import * from .unit_definitions import *
from .constants import *
...@@ -807,8 +807,8 @@ def _is_string(x): ...@@ -807,8 +807,8 @@ def _is_string(x):
if isinstance(x, str): if isinstance(x, str):
return True return True
try: try:
first_item = iter(x).next() first_item = next(iter(x))
inner_item = iter(first_item).next() inner_item = next(iter(first_item))
if first_item is inner_item: if first_item is inner_item:
return True return True
else: else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment