3
\brief Enter brief description of file here
7
#include <libciomr/libciomr.h>
8
#include <libdpd/dpd.h>
16
namespace psi { namespace stable {
18
extern void follow_evec_UHF(double *vf, int dim_A, int dim_B);
19
extern void follow_evec_UHF2(double *vf, int dim_A, int dim_B);
23
int h, i, dim, dim_A, dim_B;
25
int ai, bj, ck, c, k, C, K, Ksym;
26
double **A, *eps, **v, *evec_to_follow;
28
dpdbuf4 A_AA, A_BB, A_AB;
31
dpd_buf4_init(&A_AA, PSIF_MO_HESS, 0, 21, 21, 21, 21, 0, "A(AI,BJ)");
32
dpd_buf4_init(&A_BB, PSIF_MO_HESS, 0, 31, 31, 31, 31, 0, "A(ai,bj)");
33
dpd_buf4_init(&A_AB, PSIF_MO_HESS, 0, 21, 31, 21, 31, 0, "A(AI,bj)");
34
for(h=0; h < moinfo.nirreps; h++) {
35
dim_A = A_AA.params->rowtot[h];
36
dim_B = A_BB.params->rowtot[h];
41
A = block_matrix(dim, dim);
42
eps = init_array(dim);
43
v = block_matrix(dim, dim);
45
dpd_buf4_mat_irrep_init(&A_AA, h);
46
dpd_buf4_mat_irrep_rd(&A_AA, h);
47
for(ai=0; ai < dim_A; ai++)
48
for(bj=0; bj < dim_A; bj++)
49
A[ai][bj] = A_AA.matrix[h][ai][bj];
50
dpd_buf4_mat_irrep_close(&A_AA, h);
52
dpd_buf4_mat_irrep_init(&A_BB, h);
53
dpd_buf4_mat_irrep_rd(&A_BB, h);
54
for(ai=0; ai < dim_B; ai++)
55
for(bj=0; bj < dim_B; bj++)
56
A[ai+dim_A][bj+dim_A] = A_BB.matrix[h][ai][bj];
57
dpd_buf4_mat_irrep_close(&A_BB, h);
59
dpd_buf4_mat_irrep_init(&A_AB, h);
60
dpd_buf4_mat_irrep_rd(&A_AB, h);
61
for(ai=0; ai < dim_A; ai++)
62
for(bj=0; bj < dim_B; bj++)
63
A[ai][bj+dim_A] = A[bj+dim_A][ai] = A_AB.matrix[h][ai][bj];
64
dpd_buf4_mat_irrep_close(&A_AB, h);
66
sq_rsp(dim, dim, A, eps, 1, v, 1e-12);
68
for(i=0; i < MIN0(moinfo.rank[h],5); i++)
69
moinfo.A_evals[h][i] = eps[i];
71
if (params.num_evecs_print > 0) {
72
fprintf(outfile, "First %d eigenvectors for %s block:\n",
73
MIN0(moinfo.rank[h], params.num_evecs_print), moinfo.labels[h]);
74
eivout(v,eps,dim,MIN0(moinfo.rank[h],params.num_evecs_print),outfile);
77
/* try to follow eigenvector downhill */
78
if (h==0 && params.follow_instab) {
80
fprintf(outfile, "\nNo negative eigenvalues to follow.\n");
82
evec_to_follow = init_array(dim);
83
for (i=0; i<dim; i++) evec_to_follow[i] = v[i][0];
85
fprintf(outfile, "\nAttempting to follow eigenvector using ");
86
if (params.rotation_method == 0) {
87
fprintf(outfile, "orbital rotation method.\n");
88
follow_evec_UHF(evec_to_follow, dim_A, dim_B);
91
fprintf(outfile, "antisymmetric matrix method.\n");
92
follow_evec_UHF2(evec_to_follow, dim_A, dim_B);
103
dpd_buf4_close(&A_AA);
104
dpd_buf4_close(&A_BB);
105
dpd_buf4_close(&A_AB);
110
}} // namespace psi::stable