Build gamma from PariserParr module
Closed this issue · 1 comments
Description
The idea is not to overload connectivity
parameter in the __init__
method of HamPPP
, but instead invoke PPP
module to build HamPPP
. This is very easy for user, and I feel like this is the way we will use it.
We already have a functionality to do this, since we initially separated Rauk in a stand-alone module for this reason. However, there are few changes in API that can make this much more user friendly and structured code-wise.
ToDo:
-
We need to rename function
generate_connectivity_matrix
from theapi.py
file intoparse_connectivity
. It’s also a good idea to move it into the utils file, since it doesn’t relate to hamiltonians anymore.def parse_connectivity(system): r""" Parse the connectivity of the system given as list of tuples. Parameters ---------- system: list list of tuples that specifies sites and bonds between them For example, for a linear chain of 4 sites, the connectivity can be specified as [(C1, C2, 1), (C2, C3, 1), (C3, C4, 1)] Returns ------- tuple: (list np.ndarray) First element is a list of atoms in the order they apperar in the attice, second element is matrix that corresponds to the either distance matrix, or adjacency matrix. """
-
The function above should be reused in both
hamiltonins.py
file andPariserParr.py
module. Specifically, functioncalculate_gamma
inPariserParr.py
file should either get system as list of tuples, and then callparse_connectivity
inside of it or directly gets distance matrix. -
Move these lines into the
PariserParr.py
file -
Don't use the connectivity name here, instead use the
adjacency
parameter, that is either provided by user, or build during the initialization fromconnectivity
. Note:connectivity
is a list of tuples.
Once this is done, we can easily build PariserParr
module such as:
system = [(C1, C2, 2.3), (C2, C3, 1.1), (C3, C4, 1.5)]
gamma_1 = moha.rauk.PariserParr.calculate_gamma(system)
gamma_2 = moha.rauk.PariserParr.calculate_gamma(atom_lst = [C, C, C, C], R_xy = np.array([[0, 2.3, 0, 0],
[2.3, 0, 1.1, 0],
[0, 0, 1.5, 0]])
gamma_3 = moha.rauk.PariserParr.calculate_gamma(U_xy, R_xy)
This has been done