double CMSF (int type,int nh,double lambda, double sin_theta) /* * return Cromer-Mann fit for the atomic scattering factor: * sin_theta is the sine of half the angle between incoming and scattered * vectors. See g_sq.h for a short description of CM fit. */ { int i; double tmp = 0.0, k2; /* * united atoms case * CH2 / CH3 groups */ if (nh > 0) { tmp = (CMSF (return_atom_type ("C"),0,lambda, sin_theta) + nh*CMSF (return_atom_type ("H"),0,lambda, sin_theta)); } /* all atom case */ else { k2 = (sqr (sin_theta) / sqr (10.0 * lambda)); tmp = CM_t[type].c; for (i = 0; (i < 4); i++) tmp += CM_t[type].a[i] * exp (-CM_t[type].b[i] * k2); } return tmp; }
extern double CMSF (gmx_structurefactors_t *gsf, int type, int nh, double lambda, double sin_theta) /* * return Cromer-Mann fit for the atomic scattering factor: * sin_theta is the sine of half the angle between incoming and scattered * vectors. See g_sq.h for a short description of CM fit. */ { int i, success; double tmp = 0.0, k2; real *a, *b; real c; snew(a, 4); snew(b, 4); /* * * f0[k] = c + [SUM a_i*EXP(-b_i*(k^2)) ] * i=1,4 */ /* * united atoms case * CH2 / CH3 groups */ if (nh > 0) { tmp = (CMSF (gsf, return_atom_type ("C", gsf), 0, lambda, sin_theta) + nh*CMSF (gsf, return_atom_type ("H", gsf), 0, lambda, sin_theta)); } /* all atom case */ else { k2 = (sqr (sin_theta) / sqr (10.0 * lambda)); success = gmx_structurefactors_get_sf(gsf, type, a, b, &c); tmp = c; for (i = 0; (i < 4); i++) { tmp += a[i] * exp (-b[i] * k2); } } return tmp; }
void rearrange_atoms (reduced_atom * positions, t_trxframe *fr, atom_id * index, int isize, t_topology * top, bool flag) /* given the group's index, return the (continuous) array of atoms */ { int i; if (flag) for (i = 0; i < isize; i++) positions[i].t = return_atom_type (*(top->atoms.atomname[index[i]])); for (i = 0; i < isize; i++) copy_rvec (fr->x[index[i]], positions[i].x); }
extern void rearrange_atoms (reduced_atom_t * positions, t_trxframe *fr, atom_id * index, int isize, t_topology * top, gmx_bool flag, gmx_structurefactors_t *gsf) /* given the group's index, return the (continuous) array of atoms */ { int i; reduced_atom *pos = (reduced_atom *)positions; if (flag) { for (i = 0; i < isize; i++) { pos[i].t = return_atom_type (*(top->atoms.atomname[index[i]]), gsf); } } for (i = 0; i < isize; i++) { copy_rvec (fr->x[index[i]], pos[i].x); } }