int main(int argc, char **argv) { /* Read command line arguments */ read_command_line(argc,argv); /* Read Parameters from parameter file */ read_parameters(); /* read box from file header */ if (box_from_header) read_box(infilename); /* Initialize cell data structures */ init_cells(); /* Read coordinates and displacement */ read_displacement(infilename); /* Calculate strain tensor */ calc_strain(); /* Output strain tensor */ write_data(); return 0; }
int main(int argc, char **argv) { int tablesize; int n,i,j,k,l; /* Read command line arguments */ read_command_line(argc,argv); /* Read Parameters from parameter file */ read_parameters(); tablesize = slots*ntypes*ntypes*ntypes*ntypes*sizeof(real); histogram = (real *) malloc(tablesize); if (NULL==histogram) error("Cannot allocate memory for histograms."); hist_dim.n = slots; hist_dim.i = ntypes; hist_dim.j = ntypes; hist_dim.k = ntypes; hist_dim.l = ntypes; for (n=0; n<slots; ++n) for (i=0; i<ntypes; ++i) for (j=0; j<ntypes; ++j) for (k=0; k<ntypes; ++k) for (l=0; l<ntypes; ++l) *PTR_5D_V(histogram,n,i,j,k,l,hist_dim) = 0.0; r2_cut = SQR(r_max); /* read box from file header */ if (box_from_header) read_box(infilename); /* Initialize cell data structures */ init_cells(); /* Read atoms */ read_atoms(infilename); /* Calculate the torsion angles */ calc_angles(); /* Output results */ write_data(); return 0; }
int main(int argc, char **argv) { /* Read command line arguments */ read_command_line(argc,argv); /* Read Parameters from parameter file */ read_parameters(); /* read box from file header */ if (box_from_header) read_box(infilename); #ifdef TERSOFF /* Compute Tersoff parameters */ init_tersoff(); #endif /* Initialize cell data structures */ init_cells(); /* Read atoms */ read_atoms(infilename); /* Compute neighbour tables */ do_work(do_neighbour_tables); first = 0; do_work(do_neighbour_tables); /* Search for rings */ search_rings(); /* Output ring statistics */ write_data(); return 0; }
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { mxArray *data; /* element data in a structure */ FILE *fob; double *pd; double dbu_to_uu; int etype; /* check argument number */ if (nrhs != 3) { mexErrMsgTxt("3 input arguments expected."); } if (nlhs != 1) { mexErrMsgTxt("one output argument expected."); } /* get file handle argument */ fob = get_file_ptr((mxArray *)prhs[0]); /* get type argument */ pd = mxGetData(prhs[1]); etype = pd[0]; /* get unit conversion factor: database units --> user units */ pd = mxGetData(prhs[2]); dbu_to_uu = pd[0]; /* decide what to do */ switch (etype) { case BOUNDARY: read_boundary(fob, &data, dbu_to_uu); break; case PATH: read_path(fob, &data, dbu_to_uu); break; case SREF: read_sref(fob, &data, dbu_to_uu); break; case AREF: read_aref(fob, &data, dbu_to_uu); break; case TEXT: read_text(fob, &data, dbu_to_uu); break; case NODE: read_node(fob, &data, dbu_to_uu); break; case BOX: read_box(fob, &data, dbu_to_uu); break; default: mexErrMsgTxt("gds_read_element : unknown element type."); } plhs[0] = data; }