# Set minimal log verbosity
setVerbosity(MinimalLog)

from QATK.Analysis import *
from QATK.Calculators.DFT import *
from QATK.Core import *

# %% Device: Copper

# -------------------------------------------------------------
# Left Electrode
# -------------------------------------------------------------

# Set up lattice
vector_a = [3.61496, 0.0, 0.0]*Angstrom
vector_b = [0.0, 20.0, 0.0]*Angstrom
vector_c = [0.0, 0.0, 3.61496]*Angstrom
left_electrode_lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
left_electrode_elements = [Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper]

# Define coordinates
left_electrode_coordinates = [[  2.71122,   5.4813 ,   0.9038 ],
                              [  0.90374,   7.28878,   0.9038 ],
                              [  2.71122,   9.09626,   0.9038 ],
                              [  0.90374,  10.90374,   0.9038 ],
                              [  2.71122,  12.71122,   0.9038 ],
                              [  0.90374,  14.5187 ,   0.9038 ],
                              [  0.90374,   5.4813 ,   2.71128],
                              [  2.71122,   7.28878,   2.71128],
                              [  0.90374,   9.09626,   2.71128],
                              [  2.71122,  10.90374,   2.71128],
                              [  0.90374,  12.71122,   2.71128],
                              [  2.71122,  14.5187 ,   2.71128]]*Angstrom

# Set up configuration
left_electrode = BulkConfiguration(
    bravais_lattice=left_electrode_lattice,
    elements=left_electrode_elements,
    cartesian_coordinates=left_electrode_coordinates
    )

# -------------------------------------------------------------
# Right Electrode
# -------------------------------------------------------------

# Set up lattice
vector_a = [3.61496, 0.0, 0.0]*Angstrom
vector_b = [0.0, 20.0, 0.0]*Angstrom
vector_c = [0.0, 0.0, 3.61496]*Angstrom
right_electrode_lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
right_electrode_elements = [Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                            Copper, Copper, Copper, Copper]

# Define coordinates
right_electrode_coordinates = [[  0.90374,   5.4813 ,   0.90374],
                               [  2.71122,   7.28878,   0.90374],
                               [  0.90374,   9.09626,   0.90374],
                               [  2.71122,  10.90374,   0.90374],
                               [  0.90374,  12.71122,   0.90374],
                               [  2.71122,  14.5187 ,   0.90374],
                               [  2.71122,   5.4813 ,   2.71122],
                               [  0.90374,   7.28878,   2.71122],
                               [  2.71122,   9.09626,   2.71122],
                               [  0.90374,  10.90374,   2.71122],
                               [  2.71122,  12.71122,   2.71122],
                               [  0.90374,  14.5187 ,   2.71122]]*Angstrom

# Set up configuration
right_electrode = BulkConfiguration(
    bravais_lattice=right_electrode_lattice,
    elements=right_electrode_elements,
    cartesian_coordinates=right_electrode_coordinates
    )

# -------------------------------------------------------------
# Central Region
# -------------------------------------------------------------

# Set up lattice
vector_a = [7.22992, 0.0, 0.0]*Angstrom
vector_b = [0.0, 20.0, 0.0]*Angstrom
vector_c = [0.0, 0.0, 41.57209999999999]*Angstrom
central_region_lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
central_region_elements = [Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper, Copper, Copper,
                           Copper, Copper, Copper, Copper, Copper, Copper]

# Define coordinates
central_region_coordinates = [[  2.71122       ,   5.4813        ,   0.9038        ],
                              [  0.90374       ,   7.28878       ,   0.9038        ],
                              [  2.71122       ,   9.09626       ,   0.9038        ],
                              [  0.90374       ,  10.90374       ,   0.9038        ],
                              [  2.71122       ,  12.71122       ,   0.9038        ],
                              [  0.90374       ,  14.5187        ,   0.9038        ],
                              [  0.90374       ,   5.4813        ,   2.71128       ],
                              [  2.71122       ,   7.28878       ,   2.71128       ],
                              [  0.90374       ,   9.09626       ,   2.71128       ],
                              [  2.71122       ,  10.90374       ,   2.71128       ],
                              [  0.90374       ,  12.71122       ,   2.71128       ],
                              [  2.71122       ,  14.5187        ,   2.71128       ],
                              [  2.71122       ,   5.4813        ,   4.51876       ],
                              [  0.90374       ,   7.28878       ,   4.51876       ],
                              [  2.71122       ,   9.09626       ,   4.51876       ],
                              [  0.90374       ,  10.90374       ,   4.51876       ],
                              [  2.71122       ,  12.71122       ,   4.51876       ],
                              [  0.90374       ,  14.5187        ,   4.51876       ],
                              [  0.90374       ,   5.4813        ,   6.32624       ],
                              [  2.71122       ,   7.28878       ,   6.32624       ],
                              [  0.90374       ,   9.09626       ,   6.32624       ],
                              [  2.71122       ,  10.90374       ,   6.32624       ],
                              [  0.90374       ,  12.71122       ,   6.32624       ],
                              [  2.71122       ,  14.5187        ,   6.32624       ],
                              [  2.71122       ,   5.4813        ,   8.13372       ],
                              [  0.90374       ,   7.28878       ,   8.13372       ],
                              [  2.71122       ,   9.09626       ,   8.13372       ],
                              [  0.90374       ,  10.90374       ,   8.13372       ],
                              [  2.71122       ,  12.71122       ,   8.13372       ],
                              [  0.90374       ,  14.5187        ,   8.13372       ],
                              [  0.90374       ,   5.4813        ,   9.9412        ],
                              [  2.71122       ,   7.28878       ,   9.9412        ],
                              [  0.90374       ,   9.09626       ,   9.9412        ],
                              [  2.71122       ,  10.90374       ,   9.9412        ],
                              [  0.90374       ,  12.71122       ,   9.9412        ],
                              [  2.71122       ,  14.5187        ,   9.9412        ],
                              [  6.32618       ,   5.4813        ,   0.9038        ],
                              [  4.5187        ,   7.28878       ,   0.9038        ],
                              [  6.32618       ,   9.09626       ,   0.9038        ],
                              [  4.5187        ,  10.90374       ,   0.9038        ],
                              [  6.32618       ,  12.71122       ,   0.9038        ],
                              [  4.5187        ,  14.5187        ,   0.9038        ],
                              [  4.5187        ,   5.4813        ,   2.71128       ],
                              [  6.32618       ,   7.28878       ,   2.71128       ],
                              [  4.5187        ,   9.09626       ,   2.71128       ],
                              [  6.32618       ,  10.90374       ,   2.71128       ],
                              [  4.5187        ,  12.71122       ,   2.71128       ],
                              [  6.32618       ,  14.5187        ,   2.71128       ],
                              [  6.32618       ,   5.4813        ,   4.51876       ],
                              [  4.5187        ,   7.28878       ,   4.51876       ],
                              [  6.32618       ,   9.09626       ,   4.51876       ],
                              [  4.5187        ,  10.90374       ,   4.51876       ],
                              [  6.32618       ,  12.71122       ,   4.51876       ],
                              [  4.5187        ,  14.5187        ,   4.51876       ],
                              [  4.5187        ,   5.4813        ,   6.32624       ],
                              [  6.32618       ,   7.28878       ,   6.32624       ],
                              [  4.5187        ,   9.09626       ,   6.32624       ],
                              [  6.32618       ,  10.90374       ,   6.32624       ],
                              [  4.5187        ,  12.71122       ,   6.32624       ],
                              [  6.32618       ,  14.5187        ,   6.32624       ],
                              [  6.32618       ,   5.4813        ,   8.13372       ],
                              [  4.5187        ,   7.28878       ,   8.13372       ],
                              [  6.32618       ,   9.09626       ,   8.13372       ],
                              [  4.5187        ,  10.90374       ,   8.13372       ],
                              [  6.32618       ,  12.71122       ,   8.13372       ],
                              [  4.5187        ,  14.5187        ,   8.13372       ],
                              [  4.5187        ,   5.4813        ,   9.9412        ],
                              [  6.32618       ,   7.28878       ,   9.9412        ],
                              [  4.5187        ,   9.09626       ,   9.9412        ],
                              [  6.32618       ,  10.90374       ,   9.9412        ],
                              [  4.5187        ,  12.71122       ,   9.9412        ],
                              [  6.32618       ,  14.5187        ,   9.9412        ],
                              [  2.73051184884 ,   5.572915181078,  11.734992585861],
                              [  6.306902901906,   5.571174890918,  11.734231695114],
                              [  0.902164786926,   7.287875283039,  11.739138459027],
                              [  4.520150966088,   7.317350067136,  11.733372536183],
                              [  2.705125998618,   9.097405314193,  11.736031733753],
                              [  6.331978732328,   9.104380180877,  11.73668954277 ],
                              [  0.909536035093,  10.905823299989,  11.737562402712],
                              [  4.512850653207,  10.898105281678,  11.738348533534],
                              [  2.712626580945,  12.712719587954,  11.740900563429],
                              [  6.324646548285,  12.683079072441,  11.736036640914],
                              [  0.883909928137,  14.426316684024,  11.735187993165],
                              [  4.53847685086 ,  14.427745269399,  11.735138227494],
                              [  4.519217955303,   5.601491907258,  13.554712134973],
                              [  2.691321638043,   7.31864419073 ,  13.54040326489 ],
                              [  6.345950918599,   7.316882075448,  13.539844214127],
                              [  0.901591192811,   9.110310404279,  13.537901823189],
                              [  4.52043557002 ,   9.103038007289,  13.538077479783],
                              [  2.712578625225,  10.892606054625,  13.539952789266],
                              [  6.324652573286,  10.898358802915,  13.541449195404],
                              [  0.923880886385,  12.686689971706,  13.546840884428],
                              [  4.498563056852,  12.686021487975,  13.546742135722],
                              [  6.326270534336,  14.4021003298  ,  13.55818815168 ],
                              [  2.732238086074,   5.615845738837,  15.369863021378],
                              [  6.302696547979,   5.614789223105,  15.383403736134],
                              [  0.900436976665,   7.323929662436,  15.344039811387],
                              [  4.521151431516,   7.350486429535,  15.353321364283],
                              [  2.705533300059,   9.104564852453,  15.347131562072],
                              [  6.331502042648,   9.107458775631,  15.349966064541],
                              [  0.908350516239,  10.892961048605,  15.349496535155],
                              [  4.513949754681,  10.885843791636,  15.348493263227],
                              [  2.712370853045,  12.682774060526,  15.349001827924],
                              [  6.3249168393  ,  12.65554374204 ,  15.356876244876],
                              [  0.879884773873,  14.395598728279,  15.386206747743],
                              [  4.542470399592,  14.396966343596,  15.386285408254],
                              [  0.926662709271,   5.615709553509,  17.149155140008],
                              [  4.498419932927,   5.615463384698,  17.163064151919],
                              [  2.710209015391,   7.350408326515,  17.173397538782],
                              [  6.328151738505,   7.326141139845,  17.183971855507],
                              [  0.899461721337,   9.103461526884,  17.164384505766],
                              [  4.523267521952,   9.107673534556,  17.168074423555],
                              [  2.710374363361,  10.877773897081,  17.158373283478],
                              [  6.327229158425,  10.88069573193 ,  17.160330176113],
                              [  0.906555569656,  12.656196684712,  17.168758544591],
                              [  4.515889905983,  12.654281477898,  17.167727707765],
                              [  2.711620298255,  14.408579734934,  17.170235735932],
                              [  6.325765541612,  14.4071946295  ,  17.18481509348 ],
                              [  2.710615922996,   5.606257149312,  18.983127575446],
                              [  0.886894051055,   7.323556234558,  18.983071649976],
                              [  4.535557968239,   7.326099916725,  18.982870911513],
                              [  2.710921164062,   9.107945974885,  18.978354646618],
                              [  6.32685846104 ,   9.111729136128,  18.97924558238 ],
                              [  0.905600606407,  10.878485151123,  18.972797610116],
                              [  4.517005118559,  10.879641296797,  18.973971768096],
                              [  2.711202549918,  12.650829390236,  18.969242592329],
                              [  6.326247032835,  12.64917258471 ,  18.96911103245 ],
                              [  0.905130992026,  14.40655813822 ,  18.97373511486 ],
                              [  4.51729915755 ,  14.40548288744 ,  18.973034701604],
                              [  0.925364044057,   5.607373472859,  20.808058638915],
                              [  4.497128551777,   5.607658049756,  20.807473482265],
                              [  2.711225260396,   7.351503954298,  20.785166170507],
                              [  6.326437752644,   7.32067872483 ,  20.772502131563],
                              [  0.897858878901,   9.112788771164,  20.788821464972],
                              [  4.524822892257,   9.113224916202,  20.788683282761],
                              [  2.711170443813,  10.881526350094,  20.791386628179],
                              [  6.32634936754 ,  10.887432169782,  20.794154043682],
                              [  0.904992201369,  12.643719625744,  20.77486532059 ],
                              [  4.51746048337 ,  12.644104376454,  20.775310610141],
                              [  2.711167818461,  14.39450734178 ,  20.763345132206],
                              [  6.326227764974,  14.393541806374,  20.761493483573],
                              [  2.71132244127 ,   5.601467209012,  22.593383011079],
                              [  6.326249922295,   5.601258929406,  22.594083137833],
                              [  0.900138804767,   7.348344886915,  22.594825507259],
                              [  4.522472279182,   7.348397765573,  22.594932868172],
                              [  2.711400733096,   9.119964549882,  22.600730031545],
                              [  6.326130992594,   9.111390729738,  22.600305974239],
                              [  0.901755591863,  10.899978406428,  22.608598517296],
                              [  4.520708059932,  10.899811306932,  22.608319209637],
                              [  2.711172271104,  12.672955206313,  22.605809624417],
                              [  6.32622199181 ,  12.677754176655,  22.607147357599],
                              [  0.90495199059 ,  14.373449285203,  22.523787346349],
                              [  4.51748032424 ,  14.373800554092,  22.524142064843],
                              [  0.92610524021 ,   5.607155478048,  24.379828597235],
                              [  4.496414218725,   5.607088503741,  24.379917981007],
                              [  2.711245539868,   7.347722648673,  24.407569433128],
                              [  6.32621513221 ,   7.317728380278,  24.419556979142],
                              [  0.897593182964,   9.107742011807,  24.410932487151],
                              [  4.524857297408,   9.107744506444,  24.411048204016],
                              [  2.711230752699,  10.89747405247 ,  24.405940137081],
                              [  6.326161240229,  10.903177674802,  24.40351076817 ],
                              [  0.90518108748 ,  12.710823500579,  24.401499584608],
                              [  4.517250330975,  12.710739316593,  24.401443911675],
                              [  2.711217177146,   5.602351010412,  26.210519080485],
                              [  0.885574576108,   7.316661442286,  26.21396592268 ],
                              [  4.536878735483,   7.316640317322,  26.213932509411],
                              [  2.711185015239,   9.109932750912,  26.211735202222],
                              [  6.326207509122,   9.115034983517,  26.212559033311],
                              [  0.904907717955,  10.905078957194,  26.202413023462],
                              [  4.517525078255,  10.905108451922,  26.202491610756],
                              [  2.711212693934,  12.677243947774,  26.199866471461],
                              [  6.326179508169,  12.677596176934,  26.19932323978 ],
                              [  0.903540061726,  14.37283511275 ,  26.280693398991],
                              [  4.518892459966,  14.372800970456,  26.280650793327],
                              [  0.928204354338,   5.599412530424,  28.040228424803],
                              [  4.494232556037,   5.599418509661,  28.040221327671],
                              [  2.711227162194,   7.342709113004,  28.023003615925],
                              [  6.326167660671,   7.313968009597,  28.012972117014],
                              [  0.898087180911,   9.10936110607 ,  28.017338785912],
                              [  4.524346305531,   9.109343561732,  28.017302209121],
                              [  2.7112068087  ,  10.883424772229,  28.021446704341],
                              [  6.326185789386,  10.890833089282,  28.022681459954],
                              [  0.905112937141,  12.649660216445,  28.038211469106],
                              [  4.517319823636,  12.649680620902,  28.03823983553 ],
                              [  2.711218752007,  14.399632398157,  28.038610732645],
                              [  6.326173942167,  14.397862380544,  28.038241289531],
                              [  2.711217391097,   5.563976266202,  29.832439555584],
                              [  6.326177787799,   5.565183507852,  29.818886265202],
                              [  0.901824895892,   7.31660833086 ,  29.840635592654],
                              [  4.520609687996,   7.316609554761,  29.840637539824],
                              [  2.711219361011,   9.106055993224,  29.834524889035],
                              [  6.32617484593 ,   9.101788926321,  29.830758306792],
                              [  0.90264015831 ,  10.886149960163,  29.837941934345],
                              [  4.519794176983,  10.886145600444,  29.837935238076],
                              [  2.711215908113,  12.680641594093,  29.849502431238],
                              [  6.326178478292,  12.682649566487,  29.850472457453],
                              [  0.904129082017,  14.437985449515,  29.826158713677],
                              [  4.518305195137,  14.43798814069 ,  29.826162523896],
                              [  0.90374       ,   5.4813        ,  31.63096       ],
                              [  2.71122       ,   7.28878       ,  31.63096       ],
                              [  0.90374       ,   9.09626       ,  31.63096       ],
                              [  2.71122       ,  10.90374       ,  31.63096       ],
                              [  0.90374       ,  12.71122       ,  31.63096       ],
                              [  2.71122       ,  14.5187        ,  31.63096       ],
                              [  2.71122       ,   5.4813        ,  33.43844       ],
                              [  0.90374       ,   7.28878       ,  33.43844       ],
                              [  2.71122       ,   9.09626       ,  33.43844       ],
                              [  0.90374       ,  10.90374       ,  33.43844       ],
                              [  2.71122       ,  12.71122       ,  33.43844       ],
                              [  0.90374       ,  14.5187        ,  33.43844       ],
                              [  0.90374       ,   5.4813        ,  35.24592       ],
                              [  2.71122       ,   7.28878       ,  35.24592       ],
                              [  0.90374       ,   9.09626       ,  35.24592       ],
                              [  2.71122       ,  10.90374       ,  35.24592       ],
                              [  0.90374       ,  12.71122       ,  35.24592       ],
                              [  2.71122       ,  14.5187        ,  35.24592       ],
                              [  2.71122       ,   5.4813        ,  37.0534        ],
                              [  0.90374       ,   7.28878       ,  37.0534        ],
                              [  2.71122       ,   9.09626       ,  37.0534        ],
                              [  0.90374       ,  10.90374       ,  37.0534        ],
                              [  2.71122       ,  12.71122       ,  37.0534        ],
                              [  0.90374       ,  14.5187        ,  37.0534        ],
                              [  0.90374       ,   5.4813        ,  38.86088       ],
                              [  2.71122       ,   7.28878       ,  38.86088       ],
                              [  0.90374       ,   9.09626       ,  38.86088       ],
                              [  2.71122       ,  10.90374       ,  38.86088       ],
                              [  0.90374       ,  12.71122       ,  38.86088       ],
                              [  2.71122       ,  14.5187        ,  38.86088       ],
                              [  2.71122       ,   5.4813        ,  40.66836       ],
                              [  0.90374       ,   7.28878       ,  40.66836       ],
                              [  2.71122       ,   9.09626       ,  40.66836       ],
                              [  0.90374       ,  10.90374       ,  40.66836       ],
                              [  2.71122       ,  12.71122       ,  40.66836       ],
                              [  0.90374       ,  14.5187        ,  40.66836       ],
                              [  4.5187        ,   5.4813        ,  31.63096       ],
                              [  6.32618       ,   7.28878       ,  31.63096       ],
                              [  4.5187        ,   9.09626       ,  31.63096       ],
                              [  6.32618       ,  10.90374       ,  31.63096       ],
                              [  4.5187        ,  12.71122       ,  31.63096       ],
                              [  6.32618       ,  14.5187        ,  31.63096       ],
                              [  6.32618       ,   5.4813        ,  33.43844       ],
                              [  4.5187        ,   7.28878       ,  33.43844       ],
                              [  6.32618       ,   9.09626       ,  33.43844       ],
                              [  4.5187        ,  10.90374       ,  33.43844       ],
                              [  6.32618       ,  12.71122       ,  33.43844       ],
                              [  4.5187        ,  14.5187        ,  33.43844       ],
                              [  4.5187        ,   5.4813        ,  35.24592       ],
                              [  6.32618       ,   7.28878       ,  35.24592       ],
                              [  4.5187        ,   9.09626       ,  35.24592       ],
                              [  6.32618       ,  10.90374       ,  35.24592       ],
                              [  4.5187        ,  12.71122       ,  35.24592       ],
                              [  6.32618       ,  14.5187        ,  35.24592       ],
                              [  6.32618       ,   5.4813        ,  37.0534        ],
                              [  4.5187        ,   7.28878       ,  37.0534        ],
                              [  6.32618       ,   9.09626       ,  37.0534        ],
                              [  4.5187        ,  10.90374       ,  37.0534        ],
                              [  6.32618       ,  12.71122       ,  37.0534        ],
                              [  4.5187        ,  14.5187        ,  37.0534        ],
                              [  4.5187        ,   5.4813        ,  38.86088       ],
                              [  6.32618       ,   7.28878       ,  38.86088       ],
                              [  4.5187        ,   9.09626       ,  38.86088       ],
                              [  6.32618       ,  10.90374       ,  38.86088       ],
                              [  4.5187        ,  12.71122       ,  38.86088       ],
                              [  6.32618       ,  14.5187        ,  38.86088       ],
                              [  6.32618       ,   5.4813        ,  40.66836       ],
                              [  4.5187        ,   7.28878       ,  40.66836       ],
                              [  6.32618       ,   9.09626       ,  40.66836       ],
                              [  4.5187        ,  10.90374       ,  40.66836       ],
                              [  6.32618       ,  12.71122       ,  40.66836       ],
                              [  4.5187        ,  14.5187        ,  40.66836       ]]*Angstrom

# Set up configuration
central_region = BulkConfiguration(
    bravais_lattice=central_region_lattice,
    elements=central_region_elements,
    cartesian_coordinates=central_region_coordinates
    )

device_copper = DeviceConfiguration(
    central_region,
    [left_electrode, right_electrode],
    equivalent_electrode_lengths=[10.84488, 10.84488]*Angstrom,
    transverse_electrode_repetitions=[[2, 1], [2, 1]],
    )

device_copper_name = "Device: Copper"


# %% Set DeviceLCAOCalculator

# %% DeviceLCAOCalculator

k_point_sampling = KpointDensity(
    density_a=4.0 * Angstrom, density_b=4.0 * Angstrom, density_c=150.0 * Angstrom
)

numerical_accuracy_parameters = NumericalAccuracyParameters(
    k_point_sampling=k_point_sampling
)

model = PretrainedGridValuesModels.effective_potential_Cu

grid_values_predictor = EffectivePotentialPredictor(
    model=model,
)
device_algorithm_parameters = DeviceAlgorithmParameters(
    grid_values_predictor=grid_values_predictor
)

calculator = DeviceLCAOCalculator(
    numerical_accuracy_parameters=numerical_accuracy_parameters,
    iteration_control_parameters=NonSelfconsistent,
    device_algorithm_parameters=device_algorithm_parameters,
    checkpoint_handler=NoCheckpointHandler,
)


# %% Set Calculator

device_copper.setCalculator(calculator)

device_copper.update()

nlsave('Device_Copper_ML_non-SCF.hdf5', device_copper)


# %% TransmissionSpectrum

kpoints = MonkhorstPackGrid(na=21, nb=1, nc=1)

transmission_spectrum = TransmissionSpectrum(
    configuration=device_copper,
    energies=numpy.linspace(-0.1, 0.1, 11) * eV,
    kpoints=kpoints,
)
nlsave(
    'Device_Copper_ML_non-SCF.hdf5', transmission_spectrum, object_id='Transmission SCF'
)

