/* Rotate viewport as V' = R*V but letting the anchor stay at the same place */ void rotate (int iw, double R[3][3]) { double V0[3][3], s[3], tmp[3]; if (n[iw].anchor >= 0) { V3SUB (B->BALL[n[iw].anchor].x, AX_3D[iw].x, tmp); M3mV3 (AX_3D[iw].V, tmp, s); } else { V3SUB (n[iw].hook, AX_3D[iw].x, tmp); M3mV3 (AX_3D[iw].V, tmp, s); } M3EQV (AX_3D[iw].V, V0); V3mM3 (R[0], V0, AX_3D[iw].V[0]); V3mM3 (R[1], V0, AX_3D[iw].V[1]); V3NORMALIZE (AX_3D[iw].V[1], tmp[0]); /* ensure the orthogonality numerically */ V3CROSS (AX_3D[iw].V[0], AX_3D[iw].V[1], AX_3D[iw].V[2]); V3NORMALIZE (AX_3D[iw].V[2], tmp[0]); V3CROSS (AX_3D[iw].V[1], AX_3D[iw].V[2], AX_3D[iw].V[0]); if (n[iw].anchor >= 0) { V3mM3 (s, AX_3D[iw].V, tmp); V3SUB (B->BALL[n[iw].anchor].x, tmp, AX_3D[iw].x); } else { V3mM3 (s, AX_3D[iw].V, tmp); V3SUB (n[iw].hook, tmp, AX_3D[iw].x); } return; } /* end rotate() */
/* Return z>0 if there is intersection, -1 otherwise. */ double Eyesight_Intersect_H_Surface (double H[3][3], int surface_id, double x0[3], double V[3][3], double k0, double k1, double s[3], double x[3]) { int i; double b[3], M[3][3], MI[3][3], tmp; i = surface_id / 2; if (surface_id % 2) V3SUB(x0,H[i],b); else V3EQV(x0,b); M3EQV(H,M); V3NEG(V[2],M[i]); V3SUBmuL(M[i],k0,V[0]); V3SUBmuL(M[i],k1,V[1]); tmp = M3DETERMINANT(M); if (ISTINY(tmp)) return(-1); M3INV(M,MI,tmp); V3mM3(b,MI,s); tmp = s[i]; s[i] = surface_id % 2; V3mM3 (s,H,x); return (tmp); } /* end Eyesight_Intersect_H_Surface() */
static int tag_atoms_in_monoclinic_filter (V3 origin, M3 HH, double height, double xytolerance, int *selected, char *taglist) { register int i; M3 HHH, HHHI; double dx[4], ds[3]; M3EQV (HH, HHH); V3MuL (height, HHH[2]); M3inv (HHH, HHHI); selected[0] = 0; selected[1] = 0; for (i=np; i--;) { V3SUB (B->BALL[i].x, origin, dx); V3mM3 (dx, HHHI, ds); if ( XIN(ds[0],-xytolerance,1+xytolerance) && XIN(ds[1],-xytolerance,1+xytolerance) && XIN(ds[2],-0.5,0.5) ) { if (ds[2] < 0) { selected[0]++; taglist[i] = 1; } else { selected[1]++; taglist[i] = 2; } } else taglist[i] = 0; } return(selected[0]+selected[1]); } /* end tag_atoms_in_monoclinic_filter() */
bool print_status (int iw) { int i; double x[3], V[3][3]; SimpleStatistics ss; /* xterm_get_focus(iw); */ for (i=0; i<CONFIG_num_auxiliary; i++) { CalculateSimpleStatistics (np, CHARP(CONFIG_auxiliary[i]), sizeof(double), IOVAL_DOUBLE, &ss); printf("\nauxiliary[%d]=%s [%s], threshold=[%g, %g]\n", i, CONFIG_auxiliary_name[i], CONFIG_auxiliary_unit[i], n[iw].auxiliary_threshold[i][0], n[iw].auxiliary_threshold[i][1]); printf("[%g(%d), %g(%d)], avg=%g, std.dev.=%g\n", ss.min, ss.idx_min, ss.max, ss.idx_max, ss.average, ss.standard_deviation); } printf("\n======================= Status of Viewport #%d " "=======================\n",iw); V3EQV (AX_3D[iw].x, x); V3pr ("Viewpoint is at %M A,\n", x); M3inv (H, V); V3mM3 (AX_3D[iw].x, V, x); V3pr("in reduced coordinates it is %M;\n", x); M3EQV(AX_3D[iw].V, V); S3PR("viewport axes = %M;\n", V); printf ("window width = %d, height = %d pixels,\n", AX_size[iw].width, AX_size[iw].height); printf ("and conversion factor is %g pixel/radian,\n", AX_3D[iw].k); printf ("which converts to %g x %g degrees of field of view.\n", RADIAN_TO_DEGREE(2*atan(AX_size[iw].width/2/AX_3D[iw].k)), RADIAN_TO_DEGREE(2*atan(AX_size[iw].height/2/AX_3D[iw].k))); printf ("The viewport is now anchored to %s", (n[iw].anchor>=0)? "atom" : "hook" ); if (n[iw].anchor >= 0) print_atom(iw,n[iw].anchor); else { M3inv (H, V); V3mM3 (n[iw].hook, V, x); printf("\nx = [%g %g %g] A, or s = [%g %g %g].\n", n[iw].hook[0], n[iw].hook[1], n[iw].hook[2], x[0], x[1], x[2]); } printf("parallel projection mode is turned %s.\n", n[iw].parallel_projection?"ON":"OFF"); printf("term printout suppression is turned %s.\n", n[iw].suppress_printout?"ON":"OFF"); V3pr ("background color = %M.\n", n[iw].bgcolor); printf ("atom r_ratio = %f, bond radius = %f A.\n", n[iw].atom_r_ratio, n[iw].bond_radius); printf("bond mode is turned %s.\n", n[iw].bond_mode?"ON":"OFF"); printf("system average IS%s subtracted off from atomistic strains.\n", shear_strain_subtract_mean ? "" : "N'T"); printf("wireframe mode is %s.\n", (n[iw].wireframe_mode==WIREFRAME_MODE_CONTRAST)?"CONTRAST": (n[iw].wireframe_mode==WIREFRAME_MODE_NONE)?"NONE": (n[iw].wireframe_mode==WIREFRAME_MODE_RGBO)?"RGBO": (n[iw].wireframe_mode==WIREFRAME_MODE_RGBK)?"RGBK": (n[iw].wireframe_mode==WIREFRAME_MODE_RGB)?"RGB": "UNKNOWN"); if (n[iw].xtal_mode) { printf ("Xtal mode is turned ON:\n"); V3mM3 (n[iw].xtal_origin, HI, x); V3TRIM (x, x); V3pr ("xtal_origin = %M.\n", x); } else printf ("Xtal mode is turned OFF.\n"); printf ("color mode = %s.\n", (n[iw].color_mode==COLOR_MODE_NORMAL)? "NORMAL" : (n[iw].color_mode==COLOR_MODE_COORD)? "COORDINATION" : (n[iw].color_mode==COLOR_MODE_AUXILIARY)? "Auxiliary Properties" : (n[iw].color_mode==COLOR_MODE_SCRATCH)? "SCRATCH" : "UNKNOWN"); if (n[iw].shell_viewer_mode) printf("Shell viewer auto-invoke is turned ON.\n"); else printf("Shell viewer auto-invoke is turned OFF.\n"); printf("s[%d]=%d surface is now seen or selected.\n", n[iw].last_surface_id/2, n[iw].last_surface_id%2); if (rcut_patching) printf ("Neighbor distance cutoff between %s = %g.\n", rcut_patch_pairname, rcut_patch[rcut_patch_item].rcut); printf ("rate of change = %g.\n", n[iw].delta); if (n[iw].color_mode==COLOR_MODE_AUXILIARY) { i = n[iw].auxiliary_idx; if (i < CONFIG_num_auxiliary) printf("auxiliary[%d] = %s [%s], threshold = [%g, %g],\n", i, CONFIG_auxiliary_name[i], CONFIG_auxiliary_unit[i], n[iw].auxiliary_threshold[i][0], n[iw].auxiliary_threshold[i][1]); else printf("auxiliary = %s, threshold = [%g, %g],\n", geolist[i-CONFIG_MAX_AUXILIARY].token, n[iw].auxiliary_threshold[i][0], n[iw].auxiliary_threshold[i][1]); CalculateSimpleStatistics (np, CHARP(INW(n[iw].auxiliary_idx,CONFIG_num_auxiliary) ? CONFIG_auxiliary[i] : geo[i-CONFIG_MAX_AUXILIARY]), sizeof(double), IOVAL_DOUBLE, &ss); printf("[%g(%d),%g(%d)], avg=%g, std.dev.=%g,\n", ss.min, ss.idx_min, ss.max, ss.idx_max, ss.average, ss.standard_deviation); printf("auxiliaries' colormap = %s \"%s\".\n", AX_cmap_funs[n[iw].auxiliary_cmap].name, AX_cmap_funs[n[iw].auxiliary_cmap].description); printf("invisible outside auxiliary thresholds flag = %s.\n", n[iw].auxiliary_thresholds_saturation?"OFF":"ON"); printf("floating auxiliary thresholds flag = %s.\n", n[iw].auxiliary_thresholds_rigid?"OFF":"ON"); } printf ("clicked atoms = [ "); for (i=0; i<ATOM_STACK_SIZE; i++) printf ("%d ", n[iw].atom_stack[i]); printf ("];\n"); for (i=0; i<AX_3D_MAX_FILTER_PLANE; i++) if (AX_V3NEZERO(AX_3D[iw].fp[i].dx)) printf("%s fp %d: dx = [%g %g %g], s = [%g %g %g]\n", (n[iw].just_activated_fp==i) ? "*" : " ", i, V3E(AX_3D[iw].fp[i].dx), V3E(n[iw].fp[i].s0)); printf("==============================================" "=======================\n"); return(FALSE); } /* end print_status() */