Commit ac605067 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Performance fix.

parent ebadcfa2
......@@ -369,9 +369,8 @@ class VASPXml(Parser):
@property
def n_bands(self):
if self._n_bands is None:
for n in range(self.n_calculations):
val = self.parser.get(
'calculation[%d]/eigenvalues/array/set[1]/set[1]/set[1]/r' % (n + 1))
for n in range(0, len(self._calculation_parsers)):
val = self._calculation_parsers[n].get('eigenvalues/array/set[1]/set[1]/set[1]/r')
if val is not None:
self._n_bands = len(val)
break
......@@ -382,9 +381,8 @@ class VASPXml(Parser):
@property
def n_dos(self):
if self._n_dos is None:
for n in range(self.n_calculations):
val = self.parser.get(
'calculation[%d]/dos/total/array/set[1]/set[1]/r' % (n + 1))
for n in range(0, len(self._calculation_parsers)):
val = self._calculation_parsers[n].get('dos/total/array/set[1]/set[1]/r')
if val is not None:
self._n_dos = len(val)
break
......
  • @ladinesa FYI: I had to make these tiny changes. This had huge performance implication; 2-5 times the execution time.

  • I somehow forgot to change it here. Do you have preliminary results on the timings?

  • Too soon to tell, but it looks similar to the old parser now. Before it was 2-5 times slower. This is why a started looking for things like this.

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