Skip to content

Commit 051c7b8

Browse files
committed
Revised many of the DFTB+ auxiliary functions to make them thread-safe, reworked the overall workflow to better integrate the compute_adi_dftb function with the general TSH approach - now the model parameters is a single dictionary rather than a list of dictionaries; all the needed trajectory-specific variables are stored within that overall dictionary. The workflow should now work with the NBRA or non-NBRA settings, but it still needed further validations. The older tutorials will be updated and the new one - on the non-NBRA calculations - will be added soon
1 parent 38cf81a commit 051c7b8

2 files changed

Lines changed: 566 additions & 391 deletions

File tree

src/libra_py/dynamics/tsh/compute.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,8 @@ def run_dynamics(dyn_var, _dyn_params, ham, compute_model, _model_params, rnd):
815815
# functions with the same input variables without worries that they will be altered
816816
# inside of each other
817817

818-
model_params = dict(_model_params)
818+
#model_params = dict(_model_params)
819+
model_params = copy.deepcopy(_model_params)
819820
dyn_params = dict(_dyn_params)
820821

821822
nstates = model_params["nstates"]
@@ -1005,6 +1006,7 @@ def run_dynamics(dyn_var, _dyn_params, ham, compute_model, _model_params, rnd):
10051006
_savers["txt2_saver"].save_data_txt(F"{prefix2}", properties_to_save, "w", 0)
10061007

10071008
model_params.update({"timestep": icond})
1009+
10081010
update_Hamiltonian_variables(dyn_params, dyn_var, ham, ham, compute_model, model_params, 0)
10091011
update_Hamiltonian_variables(dyn_params, dyn_var, ham, ham, compute_model, model_params, 1)
10101012

@@ -1051,10 +1053,12 @@ def run_dynamics(dyn_var, _dyn_params, ham, compute_model, _model_params, rnd):
10511053
save.save_tsh_data_1234_new(_savers, dyn_params, i, dyn_var, ham)
10521054

10531055
# ============ Propagate ===========
1054-
index = i + icond
1056+
index = i + icond + 1 ### AVA: added +1 on 3/18/2026 for the debug
10551057
if nfiles > 0:
10561058
index = index % nfiles
10571059
model_params.update({"timestep": index})
1060+
model_params["act_state"] = { itraj : dyn_var.act_states[itraj] for itraj in range(ntraj) }
1061+
10581062

10591063
compute_dynamics(dyn_var, dyn_params, ham, ham_aux, compute_model, model_params, rnd, therm)
10601064

@@ -1118,7 +1122,7 @@ def generic_recipe(_dyn_params, compute_model, _model_params, _init_elec, _init_
11181122
11191123
"""
11201124

1121-
model_params = dict(_model_params)
1125+
model_params = copy.deepcopy(_model_params)
11221126
dyn_params = dict(_dyn_params)
11231127
init_elec = dict(_init_elec)
11241128
init_nucl = dict(_init_nucl)
@@ -1179,7 +1183,7 @@ def generic_recipe(_dyn_params, compute_model, _model_params, _init_elec, _init_
11791183
ham.init_all(2, 1)
11801184

11811185
# Compute internals of the Hamiltonian objects
1182-
model_params1 = dict(model_params)
1186+
model_params1 = copy.deepcopy(model_params)
11831187
model_params1.update({"model": model_params["model0"], "timestep": 0})
11841188

11851189
# We set up this temporary dict such that we we request diabatic Ham calculations

0 commit comments

Comments
 (0)