Commit 7cdeded0 authored by peastman's avatar peastman
Browse files

Merge pull request #764 from swails/chambercheck

Add a check and raise an exception if someone tries to use a CHAMBER-style prmtop
parents 54d474a6 42c3cc03
...@@ -173,6 +173,10 @@ class AmberPrmtopFile(object): ...@@ -173,6 +173,10 @@ class AmberPrmtopFile(object):
- ewaldErrorTolerance (float=0.0005) The error tolerance to use if nonbondedMethod is Ewald or PME. - ewaldErrorTolerance (float=0.0005) The error tolerance to use if nonbondedMethod is Ewald or PME.
Returns: the newly created System Returns: the newly created System
""" """
if self._prmtop.chamber:
raise ValueError("CHAMBER-style topology file detected. CHAMBER "
"topologies are not supported -- use the native "
"CHARMM files directly.")
methodMap = {ff.NoCutoff:'NoCutoff', methodMap = {ff.NoCutoff:'NoCutoff',
ff.CutoffNonPeriodic:'CutoffNonPeriodic', ff.CutoffNonPeriodic:'CutoffNonPeriodic',
ff.CutoffPeriodic:'CutoffPeriodic', ff.CutoffPeriodic:'CutoffPeriodic',
......
...@@ -119,7 +119,7 @@ class PrmtopLoader(object): ...@@ -119,7 +119,7 @@ class PrmtopLoader(object):
self._raw_data={} self._raw_data={}
self._has_nbfix_terms = False self._has_nbfix_terms = False
fIn=open(inFilename) with open(inFilename, 'r') as fIn:
for line in fIn: for line in fIn:
if line.startswith('%VERSION'): if line.startswith('%VERSION'):
tag, self._prmtopVersion = line.rstrip().split(None, 1) tag, self._prmtopVersion = line.rstrip().split(None, 1)
...@@ -148,7 +148,9 @@ class PrmtopLoader(object): ...@@ -148,7 +148,9 @@ class PrmtopLoader(object):
item = line[index:index+iLength] item = line[index:index+iLength]
if item: if item:
self._raw_data[flag].append(item.strip()) self._raw_data[flag].append(item.strip())
fIn.close() # See if this is a CHAMBER-style topology file, which is not supported
# for creating Systems
self.chamber = 'CTITLE' in self._flags
def _getFormat(self, flag=None): def _getFormat(self, flag=None):
if not flag: if not flag:
......
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