Commit 6edd89b1 authored by Ask Hjorth Larsen's avatar Ask Hjorth Larsen
Browse files

enable more tests and fix sections when parsing structure relaxations

parent f3f4cfae
...@@ -255,8 +255,14 @@ infoFileDescription = SM( ...@@ -255,8 +255,14 @@ infoFileDescription = SM(
name='name&version', required=True), name='name&version', required=True),
SM(r'reinit: System Label:\s*\S*', name='syslabel', forwardMatch=True, SM(r'reinit: System Label:\s*\S*', name='syslabel', forwardMatch=True,
adHoc=context.set_label), adHoc=context.set_label),
SM(r'\s*Single-point calculation|\s*Begin \S+ opt\.',
name='singleconfig',
repeats=True,
# XXX some of the matchers should not be in single config calculation
sections=['section_single_configuration_calculation', 'section_system'],
subFlags=SM.SubFlags.Sequenced,
subMatchers=[
SM(r'', weak=True, forwardMatch=True, name='system section', SM(r'', weak=True, forwardMatch=True, name='system section',
sections=['section_system'],
subMatchers=[ subMatchers=[
ArraySM(r'siesta: Atomic coordinates \(Bohr\) and species', ArraySM(r'siesta: Atomic coordinates \(Bohr\) and species',
r'siesta:\s*\S+\s+\S+\s+\S+\s+\S+\s+\S+', r'siesta:\s*\S+\s+\S+\s+\S+\s+\S+\s+\S+',
...@@ -265,19 +271,9 @@ infoFileDescription = SM( ...@@ -265,19 +271,9 @@ infoFileDescription = SM(
r'siesta:\s*\S+\s*\S+\s*\S+', r'siesta:\s*\S+\s*\S+\s*\S+',
get_array('simulation_cell', float, 1, 4, unit='angstrom')) get_array('simulation_cell', float, 1, 4, unit='angstrom'))
]), ]),
SM(r'\s*Single-point calculation|\s*Begin \S+ opt\.',
name='singleconfig',
repeats=True,
# XXX some of the matchers should not be in single config calculation
sections=['section_single_configuration_calculation'],
subFlags=SM.SubFlags.Sequenced,
subMatchers=[
ArraySM(r'outcoor: Atomic coordinates \(Ang\):', ArraySM(r'outcoor: Atomic coordinates \(Ang\):',
r'\s*\S+\s*\S+\s*\S+', r'\s*\S+\s*\S+\s*\S+',
get_array('atom_positions', float, 0, 3, unit='angstrom')), get_array('atom_positions', float, 0, 3, unit='angstrom')),
#ArraySM(r'outcell: Unit cell vectors \(Ang\):',
# r'\s*\S+\s*\S+\s*\S+',
# build_cell),
SM(r'\s*scf:\s*iscf', name='scf', required=True), SM(r'\s*scf:\s*iscf', name='scf', required=True),
SM(r'SCF cycle converged after\s*%s\s*iterations' SM(r'SCF cycle converged after\s*%s\s*iterations'
% integer('number_of_scf_iterations'), name='scf-iterations'), % integer('number_of_scf_iterations'), name='scf-iterations'),
...@@ -291,9 +287,6 @@ infoFileDescription = SM( ...@@ -291,9 +287,6 @@ infoFileDescription = SM(
# that pertains only to the last one, basically eigs and occs. # that pertains only to the last one, basically eigs and occs.
# Therefore we read a bit past the last config and try to trigger # Therefore we read a bit past the last config and try to trigger
# this as appropriate. # this as appropriate.
#SM(r'outcoor: Relaxed atomic coordinates',
# adHoc=read_eigenvalues),
#])
SM(r'', weak=True, name='After singleconfigs', SM(r'', weak=True, name='After singleconfigs',
subFlags=SM.SubFlags.Sequenced, subFlags=SM.SubFlags.Sequenced,
subMatchers=[ subMatchers=[
......
...@@ -4,11 +4,35 @@ import org.specs2.mutable.Specification ...@@ -4,11 +4,35 @@ import org.specs2.mutable.Specification
object SiestaParserSpec extends Specification { object SiestaParserSpec extends Specification {
"SiestaParserTest" >> { "SiestaParserTest" >> {
"test with json-events" >> { "test H2O with json-events" >> {
ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/H2O/out", "json-events") must_== ParseResult.ParseSuccess ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/H2O/out", "json-events") must_== ParseResult.ParseSuccess
} }
"test with json" >> { "test H2O with json" >> {
ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/H2O/out", "json") must_== ParseResult.ParseSuccess ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/H2O/out", "json") must_== ParseResult.ParseSuccess
} }
"test H2O-relax with json-events" >> {
ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/H2O-relax/out", "json-events") must_== ParseResult.ParseSuccess
}
"test H2O-relax with json" >> {
ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/H2O-relax/out", "json") must_== ParseResult.ParseSuccess
}
"test Al-bulk with json-events" >> {
ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/Al-bulk/out", "json-events") must_== ParseResult.ParseSuccess
}
"test Al-bulk with json" >> {
ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/Al-bulk/out", "json") must_== ParseResult.ParseSuccess
}
"test Al-slab with json-events" >> {
ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/Al-slab/out", "json-events") must_== ParseResult.ParseSuccess
}
"test Al-slab with json" >> {
ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/Al-slab/out", "json") must_== ParseResult.ParseSuccess
}
"test Fe with json-events" >> {
ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/Fe/out", "json-events") must_== ParseResult.ParseSuccess
}
"test Fe with json" >> {
ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/Fe/out", "json") must_== ParseResult.ParseSuccess
}
} }
} }
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