
9 def generate_l a r g e_fcc_spe c t r um () :
10 print ( " --- ␣ Starting ␣ Large - Scale ␣ FCC ␣ Spectral ␣ Densit y ␣ Simulat i on ␣ --- "
)
11 start _time = time . time ()
12
13 # 1. Ge nerate Ma croscopic Lattice Nodes
14 size = 25 # Yields ~6.6 x10 ^4 nodes for bulk approximati o n
15 nodes = []
16 node_t o _idx = {}
17 idx = 0
18
19 print ( f" Generating ␣ cubic ␣ grid ␣ boundary ␣ of ␣ size ␣ { size }... " )
20
21 for x in range ( - size , size +1) :
22 for y in range ( - size , size +1) :
23 for z in range ( - size , size +1) :
24 if (x + y + z ) % 2 == 0: # FCC Parity constra int
25 nodes . append ((x , y , z))
26
27 node_to_i d x [( x , y , z)] = idx
28 idx += 1
29
30 N = len ( nodes )
31 print ( f" Total ␣ Vacuum ␣ Nodes ␣ gener ated : ␣{N } " )
32
33 # 2. Con struct Sparse Adjac ency Matrix ( K =12)
34 print ( " Constructing ␣ K =12 ␣ Ad jacency ␣ co n nections ... ")
35 v ector s = [
36 (1 ,1 ,0) , (1 , -1 ,0) , ( -1 ,1 ,0) , ( -1 , -1 ,0) ,
37 (1 ,0 ,1) , (1 ,0 , -1) , ( -1 ,0 ,1) , ( -1 ,0 , -1) ,
38 (0 ,1 ,1) , (0 ,1 , -1) , (0 , -1 ,1) , (0 , -1 , -1)
39 ]
40
41 rows , cols , data = [] , [] , []
42 for i , (x , y , z) in e numerate ( nodes ) :
43 for dx , dy , dz in vecto rs :
44 neighbor = (x+dx , y+ dy , z + dz )
45 if neighbor in no d e_to_idx :
46 rows . append (i)
47 cols . append ( node_to_ i dx [ neigh bor ])
48 data . append (1.0)
49
50 A = sp . coo_matrix (( data , ( rows , cols )) , shape =(N , N) ) . tocsr ()
51 print ( " Sparse ␣ matrix ␣ constru c t ed .")
52
53 # 3. Con struct No r malized La placian
54 print ( " Calculating ␣ Graph ␣ Laplacian ... ")
55
56 d egree s = np . array ( A. sum ( axis =1) ) . flatten ()
57 D_inv _sqrt = sp . diags (1.0 / np . sqrt ( np . maximum ( degrees , 1) ))
58 L_norm = sp . eye (N) - D_in v _sqrt @ A @ D_inv_s qrt
59
60 # 4. Extract Dominant Spectral Edge using Krylov Subspace Me thods
61 k_eig = min (2000 , N - 2)
62 print ( f" Sampli ng ␣{ k_eig }␣ upper - edge ␣ eige n values ␣ via ␣ Lanczos ␣
iter ation ... ")
63 eigenvalues , _ = sla . eigsh ( L_norm , k= k_eig , which = ’LM ’)
64
8