/* Copyright 2015 Ian Jauslin Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* meankondo A simple tool to compute the renormalization group flow for Fermionic hierarchical models */ #include #include // pre-compiler definitions #include "definitions.cpp" // various arrays #include "array.h" // list of fields #include "fields.h" // numbers #include "number.h" // polynomials #include "polynomial.h" // list of rccs #include "idtable.h" // grouped representation of polynomials #include "grouped_polynomial.h" // command line parser #include "cli_parser.h" // parse input file #include "parse_file.h" // means #include "mean.h" // various string operations #include "istring.h" // read cli arguments int read_args_meankondo(int argc,const char* argv[], Str_Array* str_args, Meankondo_Options* opts); // print usage message int print_usage_meankondo(); // compute flow int compute_flow(Str_Array str_args, Meankondo_Options opts); // compute the flow equation int compute_flow_equation(Polynomial init_poly, Id_Table idtable, Fields_Table fields, Polynomial_Matrix propagator, Groups groups, int threads, Grouped_Polynomial* flow_equation); int main (int argc, const char* argv[]){ // string arguments Str_Array str_args; // options Meankondo_Options opts; // read command-line arguments read_args_meankondo(argc,argv,&str_args,&opts); // warning message if representing rational numbers as floats #ifdef RATIONAL_AS_FLOAT fprintf(stderr,"info: representing rational numbers using floats\n"); #endif compute_flow(str_args, opts); //free memory free_Str_Array(str_args); return(0); } // parse command-line arguments #define CP_FLAG_THREADS 1 int read_args_meankondo(int argc,const char* argv[], Str_Array* str_args, Meankondo_Options* opts){ int i; // pointers char* ptr; // file to read the polynomial from in flow mode const char* file=""; // flag that indicates what argument is being read int flag=0; // whether a file was specified on the command-line int exists_file=0; // defaults // single thread (*opts).threads=1; // do not chain (*opts).chain=0; // loop over arguments for(i=1;i\n\n"); return(0); } // compute the renormalization group flow int compute_flow(Str_Array str_args, Meankondo_Options opts){ int i; // index of the entry in the input file int arg_index; // header of the entry Char_Array arg_header; // list of fields Fields_Table fields; // their propagator Polynomial_Matrix propagator; // initial polynomial Polynomial init_poly; // list of rccs Id_Table idtable; // groups of independent fields Groups groups; // flow equation Grouped_Polynomial flow_equation; // parse fields arg_index=find_str_arg("fields", str_args); if(arg_index<0){ fprintf(stderr,"error: no fields entry in the configuration file\n"); exit(-1); } else{ parse_input_fields(str_args.strs[arg_index],&fields); } // parse id table arg_index=find_str_arg("id_table", str_args); if(arg_index<0){ fprintf(stderr,"error: no id table entry in the configuration file\n"); exit(-1); } else{ parse_input_id_table(str_args.strs[arg_index],&idtable, fields); } // parse symbols arg_index=find_str_arg("symbols", str_args); if(arg_index>=0){ parse_input_symbols(str_args.strs[arg_index],&fields); } else{ init_Symbols(&(fields.symbols),1); } // parse input polynomial arg_index=find_str_arg("input_polynomial", str_args); if(arg_index>=0){ parse_input_polynomial(str_args.strs[arg_index],&init_poly, fields); } else{ fprintf(stderr,"error: no input polynomial entry in the configuration file\n"); exit(-1); } // propagator arg_index=find_str_arg("propagator", str_args); if(arg_index<0){ fprintf(stderr,"error: no propagator entry in the configuration file\n"); exit(-1); } else{ parse_input_propagator(str_args.strs[arg_index],&propagator, fields); } // parse identities arg_index=find_str_arg("identities", str_args); if(arg_index>=0){ parse_input_identities(str_args.strs[arg_index],&fields); } else{ init_Identities(&(fields.ids),1); } // parse groups arg_index=find_str_arg("groups", str_args); if(arg_index>=0){ parse_input_groups(str_args.strs[arg_index],&groups); } else{ init_Groups(&groups, 1); } // flow equation compute_flow_equation(init_poly, idtable, fields, propagator, groups, opts.threads, &flow_equation); free_Polynomial(init_poly); free_Polynomial_Matrix(propagator); free_Fields_Table(fields); free_Groups(groups); // if chain then print config file if(opts.chain==1){ for(i=0;i1){ polynomial_mean_multithread(&exp_poly, fields, propagator, groups, threads); } else{ polynomial_mean(&exp_poly, fields, propagator, groups); } // grouped representation of expanded_poly group_polynomial(exp_poly,flow_equation,idtable, fields); free_Polynomial(exp_poly); return(0); }