<jupyter_start><jupyter_text>Prerequisite After compiling the DFT driver and installing PyCDFT, run the ground state calculation.- - - - - - -For Qbox```bash export qb="/path/to/executable" $qb  gs.out```Then in the same directory, run [Qbox in server mode](qboxcode.org/daoc/html/usage/client-server.html) (using interactive queue)    ```bash mpirun -np  $qb -server qb_cdft.in qb_cdft.out```where qb_cdft.\* are files reserved in client-server mode.  Tutorial: coupling constant for thiophene<jupyter_code>from pycdft import *
from ase.io import read
cell = read("./REPL1")
print(r"Initial atomic positions (Ang):")
print(cell.get_positions())
print(r"Initial lattice parameters (Ang):")
print(cell.get_cell())
V = (-0.2,0.2)
    
print("==================== Initializing Run =========================")
# load sample geometry
sample = Sample(ase_cell=cell, n1=REPLX, n2=REPLY, n3=REPLZ, vspin=1)
print(sample.atoms[1])
    
# load DFT driver
qboxdriver = QboxDriver(
    sample=sample,
    init_cmd="load gs.xml\n"
             "set xc PBE\n"
             "set wf_dyn JD\n"
             "set scf_tol 1.0E-8\n",
    scf_cmd="run 0 50 5"
)
    
# set up CDFT constraints and solver
solver1 = CDFTSolver(job="scf", optimizer="REPLOPT_A",sample=sample, dft_driver=qboxdriver)
solver2 = solver1.copy() 
    
# add constraint to two solvers
ChargeTransferConstraint(
    sample=solver1.sample,
    donor=Fragment(solver1.sample, solver1.sample.atoms[0:9]),
    acceptor=Fragment(solver1.sample, solver1.sample.atoms[9:18]),
    REPLV_START_A ,
    N0=1,
    N_tol=REPL_TOL
)
ChargeTransferConstraint(
    sample=solver2.sample, 
    donor=Fragment(solver2.sample, solver2.sample.atoms[0:9]),
    acceptor=Fragment(solver2.sample, solver2.sample.atoms[9:18]),
    REPLV_START_B ,
    N0=-1, 
    N_tol=REPL_TOL
)
    
print("~~~~~~~~~~~~~~~~~~~~ Applying CDFT ~~~~~~~~~~~~~~~~~~~~")
print("---- solver A ------")
solver1.solve()
print("---- solver B ------")
solver2.solve()
    
print("~~~~~~~~~~~~~~~~~~~~ Calculating coupling ~~~~~~~~~~~~~~~~~~~~")
compute_elcoupling(solver1, solver2)
    
print("==================== JOB DONE =========================")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2078754578754579, 'fraction_numerical': 0.02197802197802198, 'mean_word_length': 4.329268292682927, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '53125', 'license': 'MIT', 'n_tokens_mistral': 804, 'n_tokens_neox': 758, 'n_words': 160, 'path': 'examples/03-thiophene-rotated/thiophene-coupling-tmp.ipynb', 'repo_name': 'wwwennie/pycdft', 'size': '2184'}