507
507
return(R2D*via(a,b,3));
510
/**********************************/
511
/* dihedral calculation primitive */
512
/**********************************/
513
gdouble measure_dihedral(gdouble *x1, gdouble *x2, gdouble *x3, gdouble *x4)
516
gdouble a[3], b[3], c[3], n[3];
518
/* compute end atom vectors (from 1-2 axis) */
524
/* compute normal to the plane in which the dihedral is to be calc'd */
529
/* CURRENT - compute the direction sense (sign) */
531
if (via(c,n,3) < 0.5*PI)
536
/* n[0..2] is the normal of the plane */
537
/* project 1-0 onto the normal (ie dist to plane) */
538
len = a[0]*n[0] + a[1]*n[1] + a[2]*n[2];
539
/* subtract vector to plane from 1-0 to get projection on plane */
543
/* project 2-3 onto the normal */
544
len = b[0]*n[0] + b[1]*n[1] + b[2]*n[2];
545
/* subtract vector to plane from 2-3 to get projection on plane */
549
/* compute angle between projected vectors */
550
return(sign * R2D*via(a,b,3));
510
553
/*********************************************/
511
554
/* recompute a measurement value for a model */
512
555
/*********************************************/
728
771
/* test if distance satisfies the cutoffs */
730
fractional_minsq(x1, model->periodic);
773
fractional_min(x1, model->periodic);
731
774
vecmat(model->latmat, x1);
732
775
rsq = VEC3MAGSQ(x1);
1327
/************************/
1328
/* match pairs of atoms */
1329
/************************/
1330
#define DEBUG_PAIR_MATCH 0
1331
gint pair_match(const gchar *label1, const gchar *label2,
1332
struct core_pak *core1, struct core_pak *core2)
1334
gint a, b, i, j, mask;
1336
#if DEBUG_PAIR_MATCH
1337
printf("[%s,%s] : [%s,%s]\n", label1, label2, core1->label, core2->label);
1340
/* if a or b = 0 => any i or j is accepted */
1341
/* otherwise it must match either i or j */
1342
/* if a and b are non zero, both i & j must match both a & b */
1343
a = elem_symbol_test(label1);
1344
b = elem_symbol_test(label2);
1345
i = core1->atom_code;
1346
j = core2->atom_code;
1348
/* fill out the mask */
1352
/* if input label doesn't match the element symbol length - it means the */
1353
/* user has put in something like H1 - compare this with the atom label */
1354
if (g_ascii_strcasecmp(label1, elements[i].symbol) != 0)
1356
if (g_ascii_strcasecmp(core1->atom_label, label1) == 0)
1365
if (g_ascii_strcasecmp(label1, elements[j].symbol) != 0)
1367
if (g_ascii_strcasecmp(core2->atom_label, label1) == 0)
1376
if (g_ascii_strcasecmp(label2, elements[i].symbol) != 0)
1378
if (g_ascii_strcasecmp(core1->atom_label, label2) == 0)
1387
if (g_ascii_strcasecmp(label2, elements[j].symbol) != 0)
1389
if (g_ascii_strcasecmp(core2->atom_label, label2) == 0)
1396
#if DEBUG_PAIR_MATCH
1397
printf("mask = %d\n", mask);
1400
/* if both types must match - only two possibilities (a,b) or (b,a) */
1401
/* but we can get further matches (than the required 2) when labels are compared */
1406
/* single valid pair match */
1409
/* valid pair match plus one extra */
1414
/* pair match in all possible combinations */
1417
/* bad match - exit */
1423
/* if only one type to match - any match at all will do */
1428
#if DEBUG_PAIR_MATCH
1429
printf("accepted [%d][%d] as a match.\n",i,j);