00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #include <stdio.h>
00048 #include "dpd.h"
00049
00050 extern "C" {
00051
00052 void dpd_3d_sort(double ***Win, double ***Wout, int nirreps, int h, int *rowtot, int **rowidx,
00053 int ***roworb, int *asym, int *bsym, int *aoff, int *boff,
00054 int *cpi, int *coff, int **rowidx_out, enum pattern index, int sum)
00055 {
00056 int Ga, Gb, Gc;
00057 int Gab, Gac, Gca, Gcb, Gbc, Gba;
00058 int A, B, C, a, b, c;
00059 int ab, ac, ca, cb, bc, ba;
00060
00061 switch(index) {
00062
00063 case abc:
00064 fprintf(stderr, "\ndpd_3d_sort: abc pattern is invalid.\n");
00065 dpd_error("3d_sort", stderr);
00066 break;
00067
00068 case acb:
00069 for(Gab=0; Gab < nirreps; Gab++) {
00070 Gc = h ^ Gab;
00071
00072 for(ab=0; ab < rowtot[Gab]; ab++) {
00073
00074 A = roworb[Gab][ab][0];
00075 B = roworb[Gab][ab][1];
00076
00077 Ga = asym[A]; Gb = bsym[B];
00078 Gac = Ga ^ Gc;
00079
00080 b = B - boff[Gb];
00081
00082 for(c=0; c < cpi[Gc]; c++) {
00083 C = coff[Gc] + c;
00084
00085 ac = rowidx_out[A][C];
00086
00087 if(sum) Wout[Gac][ac][b] += Win[Gab][ab][c];
00088 else Wout[Gac][ac][b] = Win[Gab][ab][c];
00089 }
00090 }
00091 }
00092
00093 break;
00094
00095 case cab:
00096 for(Gab=0; Gab < nirreps; Gab++) {
00097 Gc = h ^ Gab;
00098
00099 for(ab=0; ab < rowtot[Gab]; ab++) {
00100
00101 A = roworb[Gab][ab][0];
00102 B = roworb[Gab][ab][1];
00103
00104 Ga = asym[A]; Gb = bsym[B];
00105 Gca = Ga ^ Gc;
00106
00107 b = B - boff[Gb];
00108
00109 for(c=0; c < cpi[Gc]; c++) {
00110 C = coff[Gc] + c;
00111
00112 ca = rowidx_out[C][A];
00113
00114 if(sum) Wout[Gca][ca][b] += Win[Gab][ab][c];
00115 else Wout[Gca][ca][b] = Win[Gab][ab][c];
00116 }
00117 }
00118 }
00119
00120 break;
00121
00122 case cba:
00123 for(Gab=0; Gab < nirreps; Gab++) {
00124 Gc = h ^ Gab;
00125
00126 for(ab=0; ab < rowtot[Gab]; ab++) {
00127
00128 A = roworb[Gab][ab][0];
00129 B = roworb[Gab][ab][1];
00130
00131 Ga = asym[A]; Gb = bsym[B];
00132 a = A - aoff[Ga];
00133
00134 Gcb = Gc ^ Gb;
00135
00136 for(c=0; c < cpi[Gc]; c++) {
00137 C = coff[Gc] + c;
00138
00139 cb = rowidx_out[C][B];
00140
00141 if(sum) Wout[Gcb][cb][a] += Win[Gab][ab][c];
00142 else Wout[Gcb][cb][a] = Win[Gab][ab][c];
00143 }
00144 }
00145 }
00146
00147 break;
00148
00149 case bca:
00150 for(Gab=0; Gab < nirreps; Gab++) {
00151 Gc = h ^ Gab;
00152
00153 for(ab=0; ab < rowtot[Gab]; ab++) {
00154
00155 A = roworb[Gab][ab][0];
00156 B = roworb[Gab][ab][1];
00157
00158 Ga = asym[A]; Gb = bsym[B];
00159 a = A - aoff[Ga];
00160
00161 Gbc = Gb ^ Gc;
00162
00163 for(c=0; c < cpi[Gc]; c++) {
00164 C = coff[Gc] + c;
00165
00166 bc = rowidx_out[B][C];
00167
00168 if(sum) Wout[Gbc][bc][a] += Win[Gab][ab][c];
00169 else Wout[Gbc][bc][a] = Win[Gab][ab][c];
00170 }
00171 }
00172 }
00173
00174 break;
00175
00176 case bac:
00177 for(Gab=0; Gab < nirreps; Gab++) {
00178 Gc = h ^ Gab;
00179 Gba = Gab;
00180
00181 for(ab=0; ab < rowtot[Gab]; ab++) {
00182
00183 A = roworb[Gab][ab][0];
00184 B = roworb[Gab][ab][1];
00185
00186 ba = rowidx_out[B][A];
00187
00188 for(c=0; c < cpi[Gc]; c++) {
00189 C = coff[Gc] + c;
00190
00191 if(sum) Wout[Gba][ba][c] += Win[Gab][ab][c];
00192 else Wout[Gba][ba][c] = Win[Gab][ab][c];
00193 }
00194 }
00195 }
00196
00197 break;
00198
00199 }
00200 }
00201
00202 }