Planned maintenance on Wednesday, 2021-01-20, 17:00-18:00. Expect some interruptions during that time

Commit 3e9127e4 authored by Ask Hjorth Larsen's avatar Ask Hjorth Larsen

periodic dimensions. Better quicktest

parent 4392a5e6
python test/H2O/out --annotate > test/H2O/json 2>&1
python test/H2O-relax/out --annotate > test/H2O-relax/json 2>&1
python test/Al-bulk/out --annotate > test/Al-bulk/json 2>&1
python test/Al-slab/out --annotate > test/Al-slab/json 2>&1
python test/MgO/out --annotate > test/MgO/json 2>&1
python test/smeagol-Au-leads/Au.out --annotate > test/smeagol-Au-leads/json 2>&1
python test/smeagol-Au-scregion/Au.out --annotate > test/smeagol-Au-scregion/json 2>&1
python test/H2O/out --annotate 2>&1 | tee test/H2O/json
python test/H2O-relax/out --annotate 2>&1 | tee test/H2O-relax/json
python test/Al-bulk/out --annotate 2>&1 | tee test/Al-bulk/json
python test/Al-slab/out --annotate 2>&1 | tee test/Al-slab/json
python test/MgO/out --annotate 2>&1 | tee test/MgO/json
python test/smeagol-Au-leads/Au.out --annotate 2>&1 | tee test/smeagol-Au-leads/json
python test/smeagol-Au-scregion/Au.out --annotate 2>&1 | tee test/smeagol-Au-scregion/json
......@@ -3,6 +3,7 @@ import os
import sys
import setup_paths
from glob import glob
import re
import numpy as np
from import chemical_symbols
......@@ -30,8 +31,6 @@ def siesta_energy(title, meta, **kwargs):
return SM(r'siesta:\s*%s\s*=\s*(?P<%s__eV>\S+)' % (title, meta),
name=meta, **kwargs)
import re
def line_iter(fd, linepattern = re.compile(r'\s*([^#]+)')):
# Strip off comments and whitespace, return only non-empty strings
for line in fd:
......@@ -89,123 +88,6 @@ def get_input_metadata(inputvars_file, use_new_format):
return inputvars, blocks
def ArraySM(header, row, build, **kwargs):
class LineBuf:
def __init__(self):
self.lines = []
def adhoc_addrow(self, parser):
line = parser.fIn.readline()
def _build_array(self, parser):
build(parser.backend.superBackend, self.lines)
self.lines = []
linebuf = LineBuf()
sm = SM(header,
name=kwargs.pop('name', 'startarray'),
SM(row, name='array', repeats=True,
adHoc=linebuf.adhoc_addrow, required=True),
SM(r'', endReStr='', adHoc=linebuf._build_array, name='endarray',
return sm
def errprint(func):
def wrapper(backend, lines):
func(backend, lines)
except Exception:
print('Error in %s: %d lines' % (func.__name__,
for line in lines:
print(line, file=sys.stderr)
return wrapper
def tokenize(lines):
return np.array([line.split() for line in lines], object)
#def build_cell(backend, lines):
# cell = tokenize(lines).astype(float)
# backend.addArrayValues('simulation_cell', convert_unit(cell, 'angstrom'))
def get_forces(backend, lines):
if len(lines) == 0:
# Siesta sometimes, stupidly, writes a Forces header.
# It then proceeds to not write any forces.
# Thus we ignore that silliness
forces = tokenize(lines)[:, 1:].astype(float)
assert forces.shape[1] == 3, forces.shape
backend.addArrayValues('atom_forces', convert_unit(forces, 'eV/angstrom'))
def get_stress(backend, lines):
stress = tokenize(lines)[:, 1:].astype(float)
assert stress.shape == (3, 3)
backend.addArrayValues('stress_tensor', convert_unit(stress, 'eV/angstrom**3'))
def get_dipole(backend, lines):
assert len(lines) == 1
dipole = tokenize(lines)[:, -3:].astype(float)
# Hmm. There is no common metadata for dipole moment for some reason.
#print('dipole', dipole)
#def get_array(metaname, dtype, istart=0, iend=None, unit=None):
# @errprint
# def buildarray(backend, lines):
# arr = tokenize(lines)
# if iend is None:
# arr = arr[:, istart:]
# else:
# arr = arr[:, istart:iend]
# arr = arr.astype(dtype)
# if unit is not None:
# arr = convert_unit(arr, unit)
# backend.addArrayValues(metaname, arr)
# return buildarray
def get_array(metaname, dtype=float, istart=0, iend=None, unit=None,
def buildarray(backend, lines):
arr = tokenize(lines)
if iend is None:
arr = arr[:, istart:]
arr = arr[:, istart:iend]
arr = arr.astype(dtype)
if unit is not None:
arr = convert_unit(arr, unit)
if storage is not None:
storage[metaname] = arr
backend.addArrayValues(metaname, arr)
return buildarray
def add_positions_and_labels(backend, lines):
matrix = tokenize(lines)
positions = matrix[:, 1:4].astype(float)
labels = np.array([chemical_symbols[i] for i in matrix[:, 5].astype(int)])
backend.addArrayValues('atom_positions', convert_unit(positions, 'bohr'))
backend.addArrayValues('atom_labels', labels)
%block PAO.Basis # Define Basis set
O 2 # Species label, number of l-shells
......@@ -439,6 +321,9 @@ class SiestaContext(object):
for key, value in meta.items():
backend.addArrayValues(key, value)
np.ones(3, bool))
assert len( == 0,
def onClose_section_run(self, backend, gindex, section):
......@@ -665,9 +550,6 @@ mainFileDescription = SM(
#fixedStartValues={'program_name': 'siesta',
# 'program_basis_set_type': 'numeric AOs',
# 'configuration_periodic_dimensions': np.ones(3, bool)},
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