https://github.com/freude/NanoNet
Tip revision: a21033b38869376ca2bcb44237eed09178a0d10c authored by Mykhailo Klymenko on 28 June 2018, 06:17:06 UTC
added sparse solver and initializer
added sparse solver and initializer
Tip revision: a21033b
hamiltonian_initializer.py
import sys
import numpy as np
from atoms import Atom
import diatomic_matrix_element as dme
from hamiltonian import Hamiltonian
from hamiltonian_sparse import HamiltonianSp
def set_tb_params(**kwargs):
for item in kwargs:
if item.startswith('PARAMS_'):
setattr(dme, item, kwargs[item])
def initializer(**kwargs):
set_tb_params(**kwargs)
Atom.orbital_sets = kwargs.get('orbital_sets', {'Si': 'SiliconSP3D5S', 'H': 'HydrogenS'})
sys.modules[__name__].VERBOSITY = kwargs.get('VERBOSITY', 1)
xyz = kwargs.get('xyz', {})
nn_distance = kwargs.get('nn_distance', 2.7)
sparse = kwargs.get('sparse', 0)
if sparse:
h = HamiltonianSp(xyz=xyz, nn_distance=nn_distance)
else:
h = Hamiltonian(xyz=xyz, nn_distance=nn_distance)
h.initialize()
primitive_cell = kwargs.get('primitive_cell', [0, 0, 0])
if np.sum(np.abs(np.array(primitive_cell))) > 0:
h.set_periodic_bc(primitive_cell=primitive_cell)
return h