@@ -417,26 +417,15 @@ def compute(self, state: OptimizationState):
417417 geom_1 = geom_2 = state .geometry
418418
419419 # State 1
420- # Use config's global charge/mult as default, or parse specific params if implemented differently
421- # Here assuming config has default, but for different states usually params are needed.
422- # Assuming config.electric_charge_and_multiplicity is for state 1,
423- # and params has info for state 2 if needed.
424-
425- # NOTE: For standard cases, State 1 uses global config.
426420 e1 , g1 , ex1 = self ._run_calc (self .calc1 , geom_1 , self .single_element_list , self .config .electric_charge_and_multiplicity , "State1" , iter_idx )
427421
428422 # State 2
429- # Determine Charge/Multiplicity for State 2
430423 if self .is_bitss :
431- # BITSS usually keeps same spin/charge for both images (NEB-like) unless specified
432424 chg_mult_2 = self .config .electric_charge_and_multiplicity
433425 else :
434- # For MECI/Seam, params usually hold [charge2, mult2]
435- # Ensure params are integers
436426 if len (self .params ) >= 2 :
437427 chg_mult_2 = [int (self .params [0 ]), int (self .params [1 ])]
438428 else :
439- # Fallback if not provided (though params usually required for these modes)
440429 chg_mult_2 = self .config .electric_charge_and_multiplicity
441430
442431 e2 , g2 , ex2 = self ._run_calc (self .calc2 , geom_2 , self .single_element_list , chg_mult_2 , "State2" , iter_idx )
@@ -566,21 +555,24 @@ def _run_calc(self, calc_inst, geom, elems, chg_mult, label, iter_idx):
566555 old_dir = calc_inst .BPA_FOLDER_DIRECTORY
567556 calc_inst .BPA_FOLDER_DIRECTORY = run_dir
568557
569-
558+ # Charge/Multiplicity update for PySCF compatibility
570559 calc_inst .electronic_charge = chg_mult [0 ]
571560 calc_inst .spin_multiplicity = chg_mult [1 ]
572561
573562 geom_str = self .file_io .print_geometry_list (geom * self .config .bohr2angstroms , elems , chg_mult , display_flag = True )
574563 inp_path = self .file_io .make_psi4_input_file (geom_str , iter_idx , path = run_dir )
575564
576-
565+ # Method string for xTB
577566 method_str = getattr (calc_inst , "xtb_method" , "" )
578567 if method_str is None :
579568 method_str = ""
580569
570+ # [FIX] Convert list to numpy array (int) to avoid 'list has no attribute tolist' error in tblite tools
571+ atom_nums = np .array ([element_number (el ) for el in elems ], dtype = int )
572+
581573 e , g , _ , ex = calc_inst .single_point (
582574 inp_path ,
583- [ element_number ( el ) for el in elems ],
575+ atom_nums , # Passing numpy array instead of list
584576 iter_idx ,
585577 chg_mult ,
586578 method = method_str
@@ -597,8 +589,8 @@ def finalize_bitss_trajectory(self):
597589 for s , g in enumerate (full_seq ):
598590 f .write (f"{ len (g )} \n BITSS_Step { s } \n " )
599591 for i , atom in enumerate (g ):
600- f .write (f"{ self .single_element_list [i ]:2s} { atom [0 ]:12.8f} { atom [1 ]:12.8f} { atom [2 ]:12.8f} \n " )
601-
592+ f .write (f"{ self .single_element_list [i ]:2s} { atom [0 ]:12.8f} { atom [1 ]:12.8f} { atom [2 ]:12.8f} \n " )
593+
602594class ONIOMHandler (BasePotentialHandler ):
603595 """
604596 Handles ONIOM calculations with microiterations.
0 commit comments