Commit b3ac09e1 authored by Jason Swails's avatar Jason Swails
Browse files

Add more file type detection in the CharmmParameterSet constructor. The current

constructor _should_ be able to take all of files in the CHARMM parameter set
distribution and correctly determine file type from just the name and/or
filename extension.
parent 3e96add8
...@@ -25,10 +25,14 @@ class CharmmParameterSet(object): ...@@ -25,10 +25,14 @@ class CharmmParameterSet(object):
Parameters: Parameters:
- filenames : List of topology, parameter, and stream files to load into - filenames : List of topology, parameter, and stream files to load into
the parameter set. the parameter set. The following file type suffixes are recognized.
Parameter files must have the suffix .par or .prm. Unrecognized file types raise a TypeError
Residue topology files must have the suffix .rtf or .top .rtf, .top -- Residue topology file
Stream files must have the suffix .str .par, .prm -- Parameter file
.str -- Stream file
.inp -- If "par" is in the file name, it is a parameter file. If
"top" is in the file name, it is a topology file. Otherwise,
raise TypeError
Attributes: Attributes:
All type lists are dictionaries whose keys are tuples (with however All type lists are dictionaries whose keys are tuples (with however
...@@ -91,6 +95,13 @@ class CharmmParameterSet(object): ...@@ -91,6 +95,13 @@ class CharmmParameterSet(object):
pars.append(arg) pars.append(arg)
elif arg.endswith('.str'): elif arg.endswith('.str'):
strs.append(arg) strs.append(arg)
elif arg.endswith('.inp'):
if 'par' in arg:
pars.append(arg)
elif 'top' in arg:
tops.append(arg)
else:
raise TypeError('Unrecognized file type: %s' % arg)
else: else:
raise TypeError('Unrecognized file type: %s' % arg) raise TypeError('Unrecognized file type: %s' % arg)
for top in tops: self.readTopologyFile(top) for top in tops: self.readTopologyFile(top)
......
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