#include "scripts.h" // ****************************************************** // // This program makes C-shell script files which run // // pot_two_exp_fit_run // // on one of the SU(2) data sets for one channel--one level. // The location of the refined data files is hardwired into // the program. Also, the file containing the fitting // ranges is also hardwired into the program, so these // files better exist. // // Input: (a) one choice of data set // (b) one choice for symmetry channel // (c) one choice for level in that channel // // All appropriate quark-antiquark orientations in the // two_exp_fit_ranges.dat file will be processed. // // Fitting range file specification: // // For each data set, there should be ONE file // named "two_exp_fit_ranges.dat" // // Each line in this file should look like // channel level R t_start t_stop // Sg 1 (3,0,0) 1 11 // // If the line contains the symbol '*', that line is ignored. // If the line contains the symbol '!', reoptimiziation using 4/0 is performed. // // The following assumptions concerning the quark-antiquark // orientations are made: // on-axis (R,0,0) -> index R orientation = 0 // planar-diagonal (R,R,0) -> index R orientation = 1 // cubic-diagonal (R,R,R) -> index R orientation = 2 // // ***************************************************** // global variables int Nirreps; Svector labels; // ********************************************************************* // This routine takes a '\0'-terminated character string in "ff" and returns // all of the tokens. A token is either a sequence on non-blank characters // of a sequence of any characters between parentheses. // If the character '*' appears anywhere in the string, no tokens // are returned. If the character '!' occurs in the line, the // reoptimize_flag is set to unity (otherwise, it is set to zero). // If the character 'X' is found on the line, the omit flag is set to // unity; otherwise, omit_flag is set to zero. void get_tokens(char *ff, Svector& tokens, int& reoptimize_flag, int& omit_flag) { int i,count; char ch,ch2; char *fptr; i=0; while ((ff[i]!='*')&&(ff[i]!='\0')) i++; if (ff[i]=='*'){ tokens(); return; } reoptimize_flag=0; i=0; while (ff[i]!='\0'){ if (ff[i]=='!'){ ff[i]=' '; reoptimize_flag=1; } i++; } omit_flag=0; i=0; while (ff[i]!='\0'){ if (ff[i]=='X'){ ff[i]=' '; omit_flag=1; } i++; } count=i=0; ch=ff[i]; while (ch==' ') ch=ff[++i]; while (ch!='\0'){ count++; if (ch=='(') ch2=')'; else ch2=' '; while ((ch!=ch2)&&(ch!='\0')) ch=ff[++i]; if (ch==')') ch=ff[++i]; while (ch==' ') ch=ff[++i]; } if (count==0){ tokens(); return;} tokens.reset(count); i=count=0; ch=ff[i]; while (ch==' ') ch=ff[++i]; while (ch!='\0'){ count++; fptr=&ff[i]; if (ch=='(') ch2=')'; else ch2=' '; while ((ch!=ch2)&&(ch!='\0')) ch=ff[++i]; if (ch==')') ch=ff[++i]; ch2=ff[i]; ff[i]='\0'; tokens(count)=charString(fptr); ff[i]=ch2; while (ch==' ') ch=ff[++i]; } } // ************************************************************************* // This routine checks that the tokens are in a valid format. // (a) there should be 5 tokens // (b) the second, fourth, and fifth should be integers // (c) the third should be of the form (x, y, z) where x,y,z integers. // If valid, a value zero is returned; otherwise, unity is returned. // If valid, the parsed integer values are returned via the // various subroutine arguments. int valid_tokens(int Nspace_dim, const Svector& tokens, charString& label_string, int& level, int& x, int& y, int& z, int& t_start, int& t_stop) { charString str; label_string=""; x=y=z=level=t_start=t_stop=0; if (tokens.dim()!=5) return 1; if (string_to_int(tokens(2),level)) return 1; if (string_to_int(tokens(4),t_start)) return 1; if (string_to_int(tokens(5),t_stop)) return 1; if ((tokens(3).locate('(')<0)||(tokens(3).locate(')')<0)) return 1; if (Nspace_dim==3){ if (string_to_int(tokens(3).substring('(',','),x)) return 1; if (string_to_int(tokens(3).substring(',',','),y)) return 1; if (string_to_int((tokens(3).right_substring(',')).substring(',',')'),z)) return 1; } else if (Nspace_dim==2){ z=0; if (string_to_int(tokens(3).substring('(',','),x)) return 1; if (string_to_int(tokens(3).substring(',',')'),y)) return 1; } label_string=tokens(1); return 0; } // ************************************************************************* // This routine reads the next line from "istream" and checks // to see if the line involves the channel and level given as // input; it also check to see if the orientation is the one // being requested. If so, it return 0 and values of // Rindex, tstart, tstop in the subroutine arguments. If not, // unity is returned. int parse_next_line(istream& in, int channel, int level, int orientation, int Nspace_dim, int& Rindex, int& tstart, int& tstop, int& reoptimize_flag, int& omit_flag, int block_scale) { const int maxlinelength=132; char ff[maxlinelength]; Svector tokens; charString chan; int llevel,x,y,z; in.getline(ff,maxlinelength); // cout << "line:" << ff <next=NULL; head->value=Rindex; tail=head; } else{ tail->next=new node; tail=tail->next; tail->value=Rindex; tail->next=NULL; } } void delete_nodes() { if (head==NULL) return; node *pnode=head; node *pnext=head->next; while (pnext != NULL){ delete pnode; pnode=pnext; pnext=pnext->next; } head=tail=NULL; } // ****************************************************************