added ability to add "damask option" to input file

This commit is contained in:
Christoph Kords 2012-03-13 14:08:09 +00:00
parent 433d8a338c
commit 95a2ed3443
1 changed files with 6 additions and 0 deletions

View File

@ -65,11 +65,15 @@ parser.add_option('--use', dest='useFile', type='string', \
help='Optionally parse output descriptors from '+ help='Optionally parse output descriptors from '+
'different <model_job>.outputZZZ file. Saves the effort '+ 'different <model_job>.outputZZZ file. Saves the effort '+
'to start a calculation for each job [%default])') 'to start a calculation for each job [%default])')
parser.add_option('--option', dest='damaskOption', type='string', \
help='Add damask option to input file '+
'for example: "periodic x z" [%default]')
parser.set_defaults(number = 0) parser.set_defaults(number = 0)
parser.set_defaults(homog = '1') parser.set_defaults(homog = '1')
parser.set_defaults(cryst = '1') parser.set_defaults(cryst = '1')
parser.set_defaults(phase = '1') parser.set_defaults(phase = '1')
parser.set_defaults(useFile = '') parser.set_defaults(useFile = '')
parser.set_defaults(damaskOption = '')
(options, files) = parser.parse_args() (options, files) = parser.parse_args()
@ -136,6 +140,8 @@ for file in files:
inFile.close() inFile.close()
output = open(file,'w') output = open(file,'w')
thisSection = '' thisSection = ''
if options.damaskOption:
output.write('$damask {0}\n'.format(options.damaskOption))
for line in input: for line in input:
m = re.match('(\w+)\s',line) m = re.match('(\w+)\s',line)
if m: if m: