Skip to content

Commit 6eb3f5d

Browse files
committed
Merge branch 'devel'
2 parents 01c7f4d + 20bf3bf commit 6eb3f5d

26 files changed

+947
-718
lines changed

CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,12 @@ SET(EIGEN3_INCLUDE_DIRS "${EIGEN3_INCLUDE_DIR}")
9696

9797
# Libint2 2.7.0 CONFIG REQUIRED COMPONENTS shared gss e5 g5
9898
#FIND_PACKAGE(Libint2 MODULE 2.7.0)
99-
FIND_PACKAGE(Libint2 CONFIG 2.7.0 REQUIRED COMPONENTS shared gss e5 g5)
99+
#find_package(Libint2)
100+
FIND_PACKAGE(Libint2 CONFIG 2.7.1 REQUIRED COMPONENTS shared gss impure_sh onebody_d0_l6 g12_d0_l4 g12_d1_l4 eri_c4_d0_l5 eri_c4_d1_l4) #gss e5 g5)
100101
IF(Libint2_FOUND)
101-
INCLUDE_DIRECTORIES("${Libint2_INCLUDE_DIRS}")
102+
#INCLUDE_DIRECTORIES("${Libint2_INCLUDE_DIRS}")
103+
INCLUDE_DIRECTORIES(Libint2::int2 Libint2::cxx Libint2::int2-cxx Libint2::impure_sh Libint2::gss Libint2::onebody_d0_l6 Libint::g12_d0_l4 Libint2::g12_d1_l4 Libint2::shared Libint2::cxx_ho Libint2::c Libint2::eri_c4_d0_l5 Libint2::eri_c4_d1_l4)
104+
MESSAGE("${LIBINT2_INCLUDE_DIR}")
102105
MESSAGE("Found Libint2 include directory: ")
103106
MESSAGE("${Libint2_INCLUDE_DIRS}")
104107
MESSAGE("Found Libint2_LIBRARIES: ")
@@ -136,7 +139,7 @@ ENDIF()
136139
#
137140
# Set the libraries
138141
#
139-
SET( ext_libs ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} )
142+
SET( ext_libs ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
140143

141144

142145

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ for all users with the intent:
2626
knowledge and skills with others;
2727

2828

29+
## Installation Videotutorials (as of 5/16/2022)
30+
31+
* [Installing WSL2](https://ub.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=02184b70-7745-4eb4-a776-ae92014c652a&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all)
32+
33+
* [Installing WSL2: After reboot](https://ub.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=972aef79-e235-4a90-9ce1-ae92014d34db&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all)
34+
35+
* [Installing Ubuntu on Windows 11](https://ub.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=31a63536-f333-4242-9b56-ae92015ece64&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all)
36+
37+
* [Creating Conda environment for Libra](https://ub.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=d6ada23e-7e16-4b7a-b290-ae920188627c&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all)
38+
39+
* [Installing Libra](https://ub.hosted.panopto.com/Panopto/Pages/Embed.aspx?id=7f8dd8c4-9f58-4ca0-a8cb-ae930166b7ec&autoplay=false&offerviewer=true&showtitle=true&showbrand=true&captions=false&interactivity=all)
40+
41+
42+
2943
## Installation (as of after 5/14/2021)
3044

3145
### 1. Install miniconda (for Python 3.8) and activate Conda
@@ -131,7 +145,7 @@ We need to downgrade Python version here to 3.6 to enable Psi4 installation
131145
You can install Jupyter notebook using the following command. This will be useful and you can set up and access the Jupyter notebook
132146
remotely from a cluster and load the tutorials
133147

134-
conda install -c conda-forge jupyterlab
148+
conda install -c anaconda jupyter
135149

136150

137151
Used in some of the tutorials

src/dyn/Dynamics.cpp

Lines changed: 62 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ CMATRIX transform_amplitudes(int rep_in, int rep_out, CMATRIX& C, nHamiltonian&
248248

249249

250250
//vector<CMATRIX> compute_St(nHamiltonian& ham, CMATRIX** Uprev){
251-
vector<CMATRIX> compute_St(nHamiltonian& ham, vector<CMATRIX>& Uprev){
251+
vector<CMATRIX> compute_St(nHamiltonian& ham, vector<CMATRIX>& Uprev, int isNBRA){
252252
/**
253253
This function computes the time-overlap matrices for all trajectories
254254
@@ -258,16 +258,26 @@ vector<CMATRIX> compute_St(nHamiltonian& ham, vector<CMATRIX>& Uprev){
258258
int ntraj = ham.children.size();
259259

260260
vector<CMATRIX> St(ntraj, CMATRIX(nst, nst));
261-
261+
if(isNBRA==1){
262+
St[0] = Uprev[0].H() * ham.children[0]->get_basis_transform();
263+
}
264+
else{
262265
for(int traj=0; traj<ntraj; traj++){
263266
St[traj] = Uprev[traj].H() * ham.children[traj]->get_basis_transform();
264267
}
265-
268+
}
266269
return St;
267270

268271
}
269272

270-
vector<CMATRIX> compute_St(nHamiltonian& ham){
273+
vector<CMATRIX> compute_St(nHamiltonian& ham, vector<CMATRIX>& Uprev){
274+
275+
int is_nbra = 0;
276+
return compute_St(ham, Uprev, is_nbra);
277+
278+
}
279+
280+
vector<CMATRIX> compute_St(nHamiltonian& ham, int isNBRA){
271281
/**
272282
This function computes the time-overlap matrices for all trajectories
273283
@@ -277,16 +287,23 @@ vector<CMATRIX> compute_St(nHamiltonian& ham){
277287
int ntraj = ham.children.size();
278288

279289
vector<CMATRIX> St(ntraj, CMATRIX(nst, nst));
280-
290+
if(isNBRA==1){
291+
St[0] = ham.children[0]->get_time_overlap_adi();
292+
}
293+
else{
281294
for(int traj=0; traj<ntraj; traj++){
282295
St[traj] = ham.children[traj]->get_time_overlap_adi();
283296
}
284-
297+
}
285298
return St;
286299

287300
}
288301

302+
vector<CMATRIX> compute_St(nHamiltonian& ham){
303+
int is_nbra = 1;
289304

305+
return compute_St(ham, is_nbra);
306+
}
290307

291308

292309
void apply_afssh(dyn_variables& dyn_var, CMATRIX& C, vector<int>& act_states, MATRIX& invM,
@@ -487,20 +504,20 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
487504

488505

489506

490-
491507
dyn_control_params prms;
492508
prms.set_parameters(dyn_params);
493509

494510
int i,j;
495511
int cdof;
496512
int ndof = q.n_rows;
497513
int ntraj = q.n_cols;
514+
int ntraj1;
498515
int nst = C.n_rows;
499516
int traj, dof, idof;
500517
int n_therm_dofs;
501518
int num_el = prms.num_electronic_substeps;
502519
double dt_el = prms.dt / num_el;
503-
520+
//cout << "Flag 1 isNBRA " << prms.isNBRA << endl;
504521

505522
//dyn_variables dyn_var(nst, nst, ndof, ntraj);
506523

@@ -510,11 +527,22 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
510527
vector<int> project_out_states(ntraj); // for DISH
511528

512529
vector<CMATRIX> Uprev;
513-
vector<CMATRIX> St(ntraj, CMATRIX(nst, nst));
514-
vector<CMATRIX> Eadi(ntraj, CMATRIX(nst, nst));
515-
vector<MATRIX> decoherence_rates(ntraj, MATRIX(nst, nst));
516-
vector<double> Ekin(ntraj, 0.0);
517-
vector<MATRIX> prev_ham_dia(ntraj, MATRIX(nst, nst));
530+
// Defining ntraj1 as a reference for making these matrices
531+
// ntraj is defined as q.n_cols as since it would be large in NBRA
532+
// we can define another variable like ntraj1 and build the matrices based on that.
533+
// We can make some changes where q is generated but this seems to be a bit easier
534+
if(prms.isNBRA==1){
535+
ntraj1 = 1;
536+
}
537+
else{
538+
ntraj1 = ntraj;
539+
}
540+
// Defining matrices based on ntraj1
541+
vector<CMATRIX> St(ntraj1, CMATRIX(nst, nst));
542+
vector<CMATRIX> Eadi(ntraj1, CMATRIX(nst, nst));
543+
vector<MATRIX> decoherence_rates(ntraj1, MATRIX(nst, nst));
544+
vector<double> Ekin(ntraj1, 0.0);
545+
vector<MATRIX> prev_ham_dia(ntraj1, MATRIX(nst, nst));
518546
MATRIX gamma(ndof, ntraj);
519547
MATRIX p_traj(ndof, 1);
520548
vector<int> t1(ndof, 0); for(dof=0;dof<ndof;dof++){ t1[dof] = dof; }
@@ -535,13 +563,14 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
535563
}
536564

537565

538-
539-
if(prms.tsh_method == 3){ // DISH
540-
for(traj=0; traj<ntraj; traj++){
566+
if(prms.tsh_method == 3){ // DISH
567+
// prev_ham_dia[0] = ham.children[0]->get_ham_dia().real();
568+
//}
569+
//else{
570+
for(traj=0; traj<ntraj1; traj++){
541571
prev_ham_dia[traj] = ham.children[traj]->get_ham_dia().real();
542572
}
543573
}
544-
545574
//============ Update the Hamiltonian object =============
546575
// In case, we may need phase correction & state reordering
547576
// prepare the temporary files
@@ -562,13 +591,12 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
562591

563592
//============== Electronic propagation ===================
564593
// Evolve electronic DOFs for all trajectories
594+
// Adding the prms.isNBRA to the propagate electronic
565595
for(i=0; i<num_el; i++){
566-
propagate_electronic(0.5*dt_el, C, projectors, ham.children, prms.rep_tdse);
596+
propagate_electronic(0.5*dt_el, C, projectors, ham.children, prms.rep_tdse, prms.isNBRA);
567597
}
568598

569-
570599
//============== Nuclear propagation ===================
571-
572600
// NVT dynamics
573601
if(prms.ensemble==1){
574602
for(idof=0; idof<n_therm_dofs; idof++){
@@ -578,9 +606,7 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
578606
}// traj
579607
}// idof
580608
}
581-
582609
p = p + aux_get_forces(prms, C, projectors, act_states, ham) * 0.5 * prms.dt;
583-
584610
// Kinetic constraint
585611
for(cdof = 0; cdof < prms.constrained_dofs.size(); cdof++){
586612
p.scale(prms.constrained_dofs[cdof], -1, 0.0);
@@ -591,7 +617,6 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
591617
if(prms.entanglement_opt==22){
592618
gamma = ETHD3_friction(q, p, invM, prms.ETHD3_alpha, prms.ETHD3_beta);
593619
}
594-
595620
// Update coordinates of nuclei for all trajectories
596621
for(traj=0; traj<ntraj; traj++){
597622
for(dof=0; dof<ndof; dof++){
@@ -615,9 +640,10 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
615640

616641
if(prms.state_tracking_algo > 0 || prms.do_phase_correction){
617642

618-
if(prms.time_overlap_method==0){ St = compute_St(ham, Uprev); }
619-
else if(prms.time_overlap_method==1){ St = compute_St(ham); }
620-
643+
if(prms.time_overlap_method==0){
644+
St = compute_St(ham, Uprev, prms.isNBRA);
645+
}
646+
else if(prms.time_overlap_method==1){ St = compute_St(ham, prms.isNBRA); }
621647
Eadi = get_Eadi(ham); // these are raw properties
622648
update_projectors(prms, projectors, Eadi, St, rnd);
623649

@@ -645,7 +671,6 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
645671
p.scale(prms.constrained_dofs[cdof], -1, 0.0);
646672
}
647673

648-
649674
// NVT dynamics
650675
if(prms.ensemble==1){
651676
for(idof=0; idof<n_therm_dofs; idof++){
@@ -656,13 +681,13 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
656681
}// idof
657682
}
658683

659-
660684
//============== Electronic propagation ===================
661685
// Evolve electronic DOFs for all trajectories
662686
update_Hamiltonian_p(prms, ham, p, invM);
663687
for(i=0; i<num_el; i++){
664-
propagate_electronic(0.5*dt_el, C, projectors, ham.children, prms.rep_tdse);
688+
propagate_electronic(0.5*dt_el, C, projectors, ham.children, prms.rep_tdse, prms.isNBRA);
665689
}
690+
CMATRIX Hvib(ham.children[0]->nadi, ham.children[0]->nadi); Hvib = ham.children[0]->get_hvib_adi();
666691

667692

668693
//============== Begin the TSH part ===================
@@ -684,27 +709,25 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
684709
}
685710

686711

687-
688712
//================= Update decoherence rates & times ================
689713
//MATRIX decoh_rates(*prms.decoh_rates);
690714
// exit(0);
691-
692715
if(prms.decoherence_times_type==-1){
693-
for(traj=0; traj<ntraj; traj++){ decoherence_rates[traj] = 0.0; }
716+
for(traj=0; traj<ntraj1; traj++){ decoherence_rates[traj] = 0.0; }
694717
}
695718

696719
/// mSDM
697720
/// Just use the plain times given from the input, usually the
698721
/// mSDM formalism
699722
else if(prms.decoherence_times_type==0){
700-
for(traj=0; traj<ntraj; traj++){ decoherence_rates[traj] = *prms.decoherence_rates; }
723+
for(traj=0; traj<ntraj1; traj++){ decoherence_rates[traj] = *prms.decoherence_rates; }
701724
}
702725

703726
/// Compute the dephasing rates according the original energy-based formalism
704727
else if(prms.decoherence_times_type==1){
705728
Eadi = get_Eadi(ham);
706729
Ekin = compute_kinetic_energies(p, invM);
707-
decoherence_rates = edc_rates(Eadi, Ekin, prms.decoherence_C_param, prms.decoherence_eps_param);
730+
decoherence_rates = edc_rates(Eadi, Ekin, prms.decoherence_C_param, prms.decoherence_eps_param, prms.isNBRA);
708731
}
709732

710733
else if(prms.decoherence_times_type==2){
@@ -720,14 +743,13 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
720743
if(prms.dephasing_informed==1){
721744
Eadi = get_Eadi(ham);
722745
MATRIX ave_gaps(*prms.ave_gaps);
723-
dephasing_informed_correction(decoherence_rates, Eadi, ave_gaps);
746+
dephasing_informed_correction(decoherence_rates, Eadi, ave_gaps, prms.isNBRA);
724747
}
725748

726-
727749
//============ Apply decoherence corrections ==================
728750
// SDM and alike methods
729751
if(prms.decoherence_algo==0){
730-
Coeff = sdm(Coeff, prms.dt, act_states, decoherence_rates, prms.sdm_norm_tolerance);
752+
Coeff = sdm(Coeff, prms.dt, act_states, decoherence_rates, prms.sdm_norm_tolerance, prms.isNBRA);
731753
}
732754
// BCSH
733755
else if(prms.decoherence_algo==3){
@@ -737,7 +759,7 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
737759

738760
else if(prms.decoherence_algo==4){
739761
// MATRIX decoh_rates(ndof, ntraj);
740-
Coeff = mfsd(p, Coeff, invM, prms.dt, decoherence_rates, ham, rnd);
762+
Coeff = mfsd(p, Coeff, invM, prms.dt, decoherence_rates, ham, rnd, prms.isNBRA);
741763
}
742764

743765
// exit(0);
@@ -801,6 +823,7 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
801823

802824
/// New version, as of 8/3/2020
803825
vector<int> old_states(act_states);
826+
//cout << "Flag before dish" << endl;
804827
act_states = dish(prms, q, p, invM, Coeff, projectors, ham, act_states, coherence_time, decoherence_rates, rnd);
805828

806829
/// Velocity rescaling
@@ -841,7 +864,6 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
841864
}
842865

843866
// exit(0);
844-
845867
St.clear();
846868
Eadi.clear();
847869
decoherence_rates.clear();
@@ -852,13 +874,13 @@ void compute_dynamics(MATRIX& q, MATRIX& p, MATRIX& invM, CMATRIX& C, vector<CMA
852874

853875

854876
// exit(0);
855-
856877
}
857878

858879

859880

860881

861882

883+
862884
}// namespace libdyn
863885
}// liblibra
864886

src/dyn/Dynamics.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@ void update_Hamiltonian_p(bp::dict prms, nHamiltonian& ham, MATRIX& p, MATRIX& i
7474

7575
CMATRIX transform_amplitudes(int rep_in, int rep_out, CMATRIX& C, nHamiltonian& ham);
7676

77-
77+
// Adding the NBRA flag to the functions in the header
78+
vector<CMATRIX> compute_St(nHamiltonian& ham, int isNBRA);
7879
vector<CMATRIX> compute_St(nHamiltonian& ham);
80+
81+
vector<CMATRIX> compute_St(nHamiltonian& ham, vector<CMATRIX>& Uprev, int isNBRA);
7982
vector<CMATRIX> compute_St(nHamiltonian& ham, vector<CMATRIX>& Uprev);
8083

8184

src/dyn/dyn_control_params.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ dyn_control_params::dyn_control_params(){
5353
convergence = 0;
5454
max_number_attempts = 100;
5555
min_probability_reordering = 0.0;
56-
56+
isNBRA = 0;
5757

5858
///================= Surface hopping: proposal, acceptance =======================
5959
tsh_method = 0;
@@ -187,6 +187,7 @@ void dyn_control_params::set_parameters(bp::dict params){
187187
else if(key=="convergence") { convergence = bp::extract<int>(params.values()[i]); }
188188
else if(key=="max_number_attempts") { max_number_attempts = bp::extract<int>(params.values()[i]); }
189189
else if(key=="min_probability_reordering") { min_probability_reordering = bp::extract<double>(params.values()[i]); }
190+
else if(key=="isNBRA") { isNBRA = bp::extract<int>(params.values()[i]); }
190191

191192
///================= Surface hopping: proposal, acceptance =======================
192193
else if(key=="tsh_method") { tsh_method = bp::extract<int>(params.values()[i]); }

0 commit comments

Comments
 (0)