void simulation::drawtraj(repere* R){ IntervalVector curf(4); IntervalVector nextf(4); for(int i=0;i<dataf.size()-1;i++){ curf=dataf[i]; nextf=dataf[i+1]; R->DrawLine(curf[0].mid(),curf[1].mid(),nextf[0].mid(),nextf[1].mid(),QPen(Qt::blue)); } }
void read_sf(float *x, int nx, int ny, int nz, float scale, float temp, CREFL *refl, int nrefl, int usepsi) { int count, p, q, r, used; float dsq, fh, fk, fl, s, t; fcomplex f, /*ww,*/ fsym; int nsymop = 0; char buf[100]; int i, k; /* k = 3, quadratic splines */ double psi; int /*n_i[3],*/ N[4]; k = usepsi + 2; N[1] = 2*nx; N[2] = ny; N[3] = nz; /* nextf is a logical function used to read structure factors. * If nextf is true, the arguments have returned the indices and * value of the next structure factor in the input list. * If nextf is false, there are no more structure factors. * * xpnd is a logical function used to apply symmetry relations * to structure factors. If xpnd is true, a symmetry operator * has been applied and the indices and value of the related * structure factor have been returned. If xpnd is false, there * are no more symmetry operators to apply for this hkl. */ s = (float)scale; t = (float)(temp/4.0); used = count = 0; while (nextf(hin, &f, count, refl, nrefl)) { count++; fh = (float)hin[0]; fk = (float)hin[1]; fl = (float)hin[2]; dsq = fh*(fh*g11+fk*g12+fl*g13) + fk*(fk*g22+fl*g23) + g33*fl*fl; if ((dsq <= dsqmax) && (dsq >= dsqmin)) { used++; f.re = (float)(s*exp(-t*dsq)*f.re); f.im = (float)(s*exp(-t*dsq)*f.im); if (usepsi) { psi = 1.; for (i = 0; i < 3; ++i) { psi *= psi_(hin[i], N[i + 1], k); } f.re /= (float)psi; f.im /= (float)psi; } /* * the following is a complex exponent * it is different from the above which is correct * summer-1990 * cexp (&ww, -t*dsq); * c_mul(f,ww,f); * f.re *= s; * f.im *= s; */ nsymop = 0; while (xpnd(hin, hout, &f, &fsym, nsymop)) { p = hout[0]; if (p < 0) { sprintf(buf, "Error in symmetry expansion\n"); Logger::log(buf); sprintf(buf, "position %d hin= %d %d %d hout= %d %d %d\n", nsymop+1, hin[0], hin[1], hin[2], hout[0], hout[1], hout[2]); Logger::log(buf); return; } q = hout[1]; r = hout[2]; if (p >= nx) { if (nx != 1) { expansion_error(nsymop); } return; } else if (abs(q) >= ny) { if (ny != 1) { expansion_error(nsymop); } return; } else if (abs(r) >= nz) { if (nz != 1) { expansion_error(nsymop); } return; } else { if (q < 0) { q += ny; } if (r < 0) { r += nz; } x[2*(r*nx*ny + q*nx + p)] = fsym.re; x[2*(r*nx*ny + q*nx + p)+1] = fsym.im; if (p <= 0) { /* Fill in the 0,-k,-l reflections by conjugate symmetry */ q = -hout[1]; r = -hout[2]; if (q < 0) { q += ny; } if (r < 0) { r += nz; } x[2*(r*nx*ny + q*nx)] = fsym.re; x[2*(r*nx*ny + q*nx)+1] = -fsym.im; } } nsymop++; } } } sprintf(buf, " %d structure factors used out of %d in input.\n\n", used, count); Logger::log(buf); }