#include "defines.h" #include "stdio.h" #include "time.h" #include "string.h" #include "stdlib.h" #include "math.h" #define F77Name1(x) x##_ /* Need to add one underscore to Fortran program */ #if defined intel #define F77Name2(x) x##_ /* Need to add one underscore to Fortran program for Intel compiler */ #else #define F77Name2(x) x##__ /* Need to add two underscores to Fortran program for GNU f77 compiler */ #endif extern struct{ int npoints; int nvertex; char redinfo[MAX_POINT]; } F77Name2(vertex_zone); extern struct{ double coord[MAX_COORD]; double radius[MAX_POINT]; double coord4[MAX_POINT]; } F77Name2(xyz_vertex); extern struct{ int depth[MAX_TETRA]; char isvoid[MAX_TETRA]; } F77Name2(voids); extern void clear_all_gmp_arrays(int *nvertex); extern void clear_alf_gmp(); extern void F77Name2(adjust_nsphere)(); extern void F77Name1(setup)(); extern void F77Name1(regular3)(int *nredundant, int list_redundant[MAX_ATOM]); extern void F77Name2(remove_inf)(); extern void F77Name1(alfcx)(double *alpha_val, int *nred, int list_redalpha[MAX_ATOM]); extern void F77Name2(readjust_nsphere)(int *nat, int *nred, int list_redalpha[MAX_ATOM]); extern void F77Name2(write_del)(char delaunay_file[FSIZE]); extern void F77Name2(write_alpha)(char alpha_file[FSIZE]); extern void F77Name2(surface_only)(double coef[MAX_ATOM], double *wsurf, double *surf, double surface [MAX_ATOM]); extern void F77Name2(surface_only_void)(double coef[MAX_ATOM], double *wsurf, double *surf, double surface [MAX_ATOM] ); extern void F77Name2(surface_deriv_coord)(double coef[MAX_ATOM], double *wsurf, double *surf, double surface [MAX_ATOM], double deriv_surf [3*MAX_ATOM]); extern void F77Name2(volume_only) ( double coef[MAX_ATOM], double *wsurf, double *wvol, double *surf, double *vol, double ballwsurf[MAX_ATOM], double ballwvol[MAX_ATOM] ); extern void F77Name2(volume_deriv_coord)( double coef[MAX_ATOM], double *wsurf, double *wvol, double *surf, double *vol, double ballwsurf[MAX_ATOM], double ballwvol[MAX_ATOM], double dwsurf[3*MAX_ATOM], double dwvol[3*MAX_ATOM] ); extern void F77Name2(cavballs)( double *x, double *y, double *z, double *r, int *ncav ); void get_surf_vol( int npoints, double *coords, double *radius, double *surf_out, double *vol_out ) { int i; double tmp_coef[MAX_ATOM],tmp_surf,tmp_wsurf,tmp_vol,tmp_wvol, alpha_val=0.0; int tmp_nredundant,tmp_nredalpha,tmp_nat_orig,tmp_list_redundant[MAX_ATOM],tmp_list_redalpha[MAX_ATOM]; for( i = 0; i -0.000001 ) surf_out[i+4] = 0.0; printf("%d %d %.20lf\n",ialpha+1,i+1,surf_out[i+4]); } } free(surf_out); return( tmp_wsurf ); } double get_alpha20_surf_weighted_deriv( int npoints, double *coords, double *radius, double *weights ) { int i; int ialpha; double alpha_val=0; double coordat[3], radiusat, rad0, rad, x,y,z; double tmp_coef[MAX_ATOM]; double tmp_surf,tmp_wsurf; // double tmp_deriv_surf[3*MAX_ATOM]; double void_surf,void_wsurf; // double void_deriv_surf[3*MAX_ATOM]; int tmp_nredundant; int tmp_nredalpha; int tmp_list_redundant[MAX_ATOM]; int tmp_list_redalpha[MAX_ATOM]; int tmp_nat_orig; double * surf_out = malloc((npoints+4) *sizeof(double)); double *deriv_out = malloc((npoints+4)*3*sizeof(double)); F77Name2(vertex_zone).npoints = npoints; for( i=0; i < npoints; i++ ) { F77Name2(xyz_vertex).coord[3*i+0] = coords[3*i+0]; F77Name2(xyz_vertex).coord[3*i+1] = coords[3*i+1]; F77Name2(xyz_vertex).coord[3*i+2] = coords[3*i+2]; F77Name2(xyz_vertex).radius[i] = radius[i]; } double *deriv_x = (double*)malloc(sizeof(double)*npoints); double *deriv_y = (double*)malloc(sizeof(double)*npoints); double *deriv_z = (double*)malloc(sizeof(double)*npoints); double *tot_score = (double*)malloc(sizeof(double)*npoints); for( i=0; i < npoints; i++ ) { tot_score[i] = 0.0; deriv_x[i] = 0.0; deriv_y[i] = 0.0; deriv_z[i] = 0.0; } F77Name2(adjust_nsphere)(); F77Name1(setup)(); tmp_nat_orig = npoints; // for( i = 0; i < 16; i++ ) { // printf("%f %f %f %f\n",coords[i], F77Name2(xyz_vertex).coord[i], radius[i], F77Name2(xyz_vertex).radius[i] ); // } F77Name1(regular3)(&tmp_nredundant,tmp_list_redundant); /* computes triangulation; stores tetrahedra*/ for( ialpha = 0; ialpha < 20; ialpha++ ) { for (i=0;i