void visualize_images(char *fn,int ePBC,matrix box) { t_atoms atoms; rvec *img; char *c,*ala; int nat,i; nat = NTRICIMG+1; init_t_atoms(&atoms,nat,FALSE); atoms.nr = nat; snew(img,nat); c = "C"; ala = "ALA"; for(i=0; i<nat; i++) { atoms.atomname[i] = &c; atoms.atom[i].resnr = i; atoms.resname[i] = &ala; atoms.atom[i].chain = 'A'+i/NCUCVERT; } calc_triclinic_images(box,img+1); write_sto_conf(fn,"Images",&atoms,img,NULL,ePBC,box); free_t_atoms(&atoms,FALSE); sfree(img); }
void visualize_images(const char *fn, int ePBC, matrix box) { t_atoms atoms; rvec *img; char *c, *ala; int nat, i; nat = NTRICIMG + 1; init_t_atoms(&atoms, nat, FALSE); atoms.nr = nat; snew(img,nat); /* FIXME: Constness should not be cast away */ c = (char *) "C"; ala = (char *) "ALA"; for (i = 0; i < nat; i++) { atoms.atomname[i] = &c; atoms.atom[i].resind = i; atoms.resinfo[i].name = &ala; atoms.resinfo[i].nr = i + 1; atoms.resinfo[i].chainid = 'A' + i / NCUCVERT; } calc_triclinic_images(box, img + 1); write_sto_conf(fn, "Images", &atoms, img, NULL, ePBC, box); free_t_atoms(&atoms, FALSE); sfree(img); }
void calc_compact_unitcell_vertices(int ecenter,matrix box,rvec vert[]) { rvec img[NTRICIMG],box_center; int n,i,j,tmp[4],d; calc_triclinic_images(box,img); n=0; for(i=2; i<=5; i+=3) { tmp[0] = i-1; if (i==2) tmp[1] = 8; else tmp[1] = 6; tmp[2] = (i+1) % 6; tmp[3] = tmp[1]+4; for(j=0; j<4; j++) { for(d=0; d<DIM; d++) vert[n][d] = img[i][d]+img[tmp[j]][d]+img[tmp[(j+1)%4]][d]; n++; } } for(i=7; i<=13; i+=6) { tmp[0] = (i-7)/2; tmp[1] = tmp[0]+1; if (i==7) tmp[2] = 8; else tmp[2] = 10; tmp[3] = i-1; for(j=0; j<4; j++) { for(d=0; d<DIM; d++) vert[n][d] = img[i][d]+img[tmp[j]][d]+img[tmp[(j+1)%4]][d]; n++; } } for(i=9; i<=11; i+=2) { if (i==9) tmp[0] = 3; else tmp[0] = 0; tmp[1] = tmp[0]+1; if (i==9) tmp[2] = 6; else tmp[2] = 12; tmp[3] = i-1; for(j=0; j<4; j++) { for(d=0; d<DIM; d++) vert[n][d] = img[i][d]+img[tmp[j]][d]+img[tmp[(j+1)%4]][d]; n++; } } calc_box_center(ecenter,box,box_center); for(i=0; i<NCUCVERT; i++) for(d=0; d<DIM; d++) vert[i][d] = vert[i][d]*0.25+box_center[d]; }