void free_chunks (struct surface *srf) { int component_index; long n_freed; char message[MAXLINE]; struct chunk *head_chunk; struct chunk *this_chunk, *next_chunk; struct component *cmp_ptr; n_freed = 0; for (component_index = 0; component_index < srf -> n_component; component_index++) { cmp_ptr = get_component_ptr (srf, component_index+1); if (cmp_ptr == NULL) continue; head_chunk = cmp_ptr -> head_chunk; next_chunk = NULL; for (this_chunk = head_chunk; this_chunk != NULL; this_chunk = next_chunk) { next_chunk = this_chunk -> next[1]; free_chunk (this_chunk); n_freed++; } /* end of chunk loop */ } /* end of component loop */ sprintf (message,"%8ld chunks freed", n_freed); informd(message); free_cache (CHUNK); }
int write_volume1 (struct surface *srf, FILE *fp_volume) { int comp; struct component *cmp_ptr; fprintf (fp_volume, "number of atoms = %6ld\n", srf -> n_atom); fprintf (fp_volume, "probe radius = %10.3f\n", srf -> probe_radius); fprintf (fp_volume, "contact area = %10.3f\n", srf -> total_contact_area); fprintf (fp_volume, "reentrant area = %10.3f\n", srf -> total_reentrant_area); fprintf (fp_volume, "molecular area = %10.3f\n", srf -> molecule_area); fprintf (fp_volume, "accessible area = %10.3f\n", srf -> total_accessible_area); fprintf (fp_volume, "solvent-excluded volume = %10.3f\n", srf -> mol_vol); fprintf (fp_volume, "\n"); fprintf (fp_volume, "component center volume molecular accessible\n"); fprintf (fp_volume, " number x y z area area\n"); fprintf (fp_volume, "\n"); for (comp = 0; comp < srf -> n_component; comp++) { cmp_ptr = get_component_ptr (srf, comp+1); fprintf (fp_volume, "%5d %8.3f %8.3f %8.3f %11.3f %11.3f %11.3f\n", comp+1, cmp_ptr -> center[0],cmp_ptr -> center[1],cmp_ptr -> center[2], cmp_ptr -> volume,cmp_ptr -> area,cmp_ptr -> accessible); } return(1); }
int write_component_atom (struct surface *srf, FILE *fp_area) { int atom_number, component_number, label_present; double contact_area, reentrant_area, accessible_area; struct chunk *head_chunk, *this_chunk; struct component *cmp_ptr; for (component_number = 1; component_number <= srf -> n_component; component_number++) { cmp_ptr = get_component_ptr (srf, component_number); head_chunk = cmp_ptr -> head_chunk; if (head_chunk == NULL) continue; for (this_chunk = head_chunk; this_chunk != NULL; this_chunk = this_chunk -> next[1]) { atom_number = this_chunk -> atom_number; contact_area = this_chunk -> contact_area; reentrant_area = this_chunk -> reentrant_area; accessible_area = this_chunk -> accessible_area; label_present = (strcmp (this_chunk -> labels[0], " ") != 0); if (!label_present) fprintf (fp_area, "%3d %5d %8.3f %8.3f %8.3f %8.3f\n", component_number, atom_number, contact_area, reentrant_area, contact_area + reentrant_area, accessible_area); else fprintf (fp_area, "%3d %-5s %-5s %-5s %8.3f %8.3f %8.3f %8.3f\n", component_number, this_chunk -> labels[0], this_chunk -> labels[1], this_chunk -> labels[2], contact_area, reentrant_area, contact_area + reentrant_area, accessible_area); } } return (1); }
void setup_second_links (struct surface *srf) { long component_index, component_number; struct chunk *head_chunk; struct chunk *this_chunk, *previous_chunk; struct component *cmp_ptr; struct atom *atm_ptr; for (component_index = 0; component_index < srf -> n_component; component_index++) { cmp_ptr = get_component_ptr (srf, component_index+1); component_number = component_index + 1; previous_chunk = NULL; for (atm_ptr = (struct atom *) (srf -> head_atom); atm_ptr != NULL; atm_ptr = atm_ptr -> next) { head_chunk = atm_ptr -> head_chunk; for (this_chunk = head_chunk; this_chunk != NULL; this_chunk = this_chunk -> next[0]) { if (this_chunk -> component_number != component_number) continue; /* we like this one */ if (previous_chunk == NULL) cmp_ptr -> head_chunk = this_chunk; else previous_chunk -> next[1] = this_chunk; previous_chunk = this_chunk; break; } /* end of chunk loop */ } /* end of atom loop */ } /* end of component loop */ }
int cvt_components (struct surface *srf) { long comp; char message[MAXLINE]; struct component *cmp_ptr; for (comp = 0; comp < srf -> n_component; comp++) { cmp_ptr = get_component_ptr (srf, comp+1); cmp_ptr -> type = (cmp_ptr -> volume > 0.0) ? OUTER_SUBTYPE : INNER_SUBTYPE; } sprintf (message,"%8ld components converted", srf -> n_component); informd(message); return (1); }
/* write components */ void write_components (struct surface *srf, FILE *fp_surface) { int k, comp; char message[MAXLINE]; struct component *cmp_ptr; struct cmpbin cmpout; cmpout.type = COMPONENT_TYPE; for (comp = 0; comp < srf -> n_component; comp++) { cmp_ptr = get_component_ptr (srf, comp+1); cmpout.subtype = (cmp_ptr -> volume > 0.0) ? OUTER_SUBTYPE : INNER_SUBTYPE; for (k = 0; k < 3; k++) cmpout.center[k] = cmp_ptr -> center[k]; cmpout.volume = cmp_ptr -> volume; cmpout.area = cmp_ptr -> area; cmpout.accessible = cmp_ptr -> accessible; fwrite ((void *) &cmpout, (size_t) sizeof (cmpout), (size_t) 1, fp_surface); } sprintf (message, "%8ld components written", srf -> n_component); informd (message); }
{ const VideoFormatComponentInfo * const cip = &vip->components[component]; const uint8_t *p; uint32_t x, y, w, h, stride, bpc; w = image->width; h = image->height; if (component != 0) { w = (w + (1U << vip->chroma_w_shift) - 1) >> vip->chroma_w_shift; h = (h + (1U << vip->chroma_h_shift) - 1) >> vip->chroma_h_shift; } stride = image->pitches[cip->plane]; bpc = (cip->bit_depth + 7) / 8; // bytes per component p = get_component_ptr(image, cip, 0, 0); if (cip->pixel_stride == bpc) { for (y = 0; y < h; y++) { mvt_hash_update(hash, p, w * bpc); p += stride; } } else { for (y = 0; y < h; y++) { for (x = 0; x < w; x++) mvt_hash_update(hash, p + x * cip->pixel_stride, bpc); p += stride; } } }
int cavity_component (struct surface *srf, int component_number) { struct component *cmp_ptr; cmp_ptr = get_component_ptr (srf, component_number); return (cmp_ptr -> volume < 0.0); }