diff --git a/src/file.h b/src/file.h index 6b921e0..3def66f 100644 --- a/src/file.h +++ b/src/file.h @@ -175,6 +175,9 @@ gint read_xyz_frame(FILE *, struct model_pak *); gint read_dlpoly_frame(FILE *, struct model_pak *); gint read_dmol_frame(FILE *, struct model_pak *); +/*NEW: track/update frames (TODO)*/ +gint update_frame_uspex(gint idx,struct model_pak *model); + gint load_planes(gchar *, struct model_pak *); gint mark_trj_frames(struct model_pak *); diff --git a/src/file_arc.c b/src/file_arc.c index 6fde7e2..60dee3a 100644 --- a/src/file_arc.c +++ b/src/file_arc.c @@ -205,9 +205,10 @@ return(FALSE); /* NB: assumes fp is at a line before !DATE line */ void read_arc_block(FILE *fp, struct model_pak *data) { -gint region, core_flag, end_count; +gint region=0; +gint core_flag, end_count; GSList *clist, *slist; -struct core_pak *core; +struct core_pak *core=NULL; struct shel_pak *shel; gchar *line; gdouble energy; @@ -390,7 +391,8 @@ gint read_arc(gchar *filename, struct model_pak *data) gint frame=0; gchar *line; FILE *fp; -long int fp_pos,old_fp_pos; +long int fp_pos; +long int old_fp_pos=0; /* checks */ g_return_val_if_fail(data != NULL, 1); diff --git a/src/file_uspex.c b/src/file_uspex.c index 09770af..7eb1829 100644 --- a/src/file_uspex.c +++ b/src/file_uspex.c @@ -21,17 +21,17 @@ The GNU GPL can also be found at http://www.gnu.org */ /* USPEX Parser: - * The reading of USPEX result file is a little different: - * 1/ make a graph representing all structures energy levels vs. generation numbers - * -> make each point on that graph clickable so that selecting a point will - * open a new model containing the corresponding structure. - * 2/ load the optimal structures as base model. - * -> each optimal structure, for each generation, is represented as a frame - * in this model. - * TODO: - * 1/ include other data plots: - * - hardness / force vs. generation - * 2/ calculate some other properties... + * supported versions VER 10.1, VER 9.4.4 + * All structure geometries are displayed "as an animation", additionally + * also some graphs are produced depending on the USPEX calculation type: + * Graph ALL shows all structures energies vs generation number + * Graph BEST shows the best _fitness_ structures per generation + * Graph PATH shows the image energies of VCNEB/TPS optimization + * Graph COMP_X shows the structure energy for each X atomic ratio + * + * All graphs are selectable, ie. selecting a value represented by + * a square on a graph will load the structure on the main display + * * */ #include @@ -58,223 +58,2369 @@ extern struct sysenv_pak sysenv; extern struct elem_pak elements[]; #define DEBUG_USPEX_READ 0 -#define _UC (*uspex_calc) -gint read_parameter_uspex(gchar *filename, struct model_pak *model){ +/***********************************/ +/* Initialize uspex_calc structure */ +/***********************************/ +void init_uspex_parameters(uspex_calc_struct *uspex_calc){ + /*Initialize uspex_calc with model independant parameters.*/ + _UC.name=NULL; + _UC.filename=NULL; + _UC.path=NULL; + _UC.special=0; + _UC.calculationMethod=US_CM_USPEX; + _UC.calculationType=300; + _UC._calctype_dim=3; + _UC._calctype_mol=FALSE; + _UC._calctype_var=FALSE; + _UC._calctype_mag=FALSE; //VER 10.1 + _UC.optType=US_OT_ENTHALPY; + _UC.new_optType=NULL; //VER 10.1 + _UC.anti_opt=FALSE; + _UC._nspecies=0; + _UC.atomType=NULL; + _UC._var_nspecies=0; + _UC.numSpecies=NULL; + _UC.magRatio[0]=0.1; //VER 10.1 + _UC.magRatio[1]=0.225; //VER 10.1 + _UC.magRatio[2]=0.225; //VER 10.1 + _UC.magRatio[3]=0.225; //VER 10.1 + _UC.magRatio[4]=0.225; //VER 10.1 + _UC.magRatio[5]=0.0; //VER 10.1 + _UC.magRatio[6]=0.0; //VER 10.1 + _UC.ldaU=NULL; //VER 10.1 + _UC.ExternalPressure=0.; + _UC.valences=NULL; + _UC.goodBonds=NULL; + _UC.checkMolecules=TRUE; + _UC.checkConnectivity=FALSE; + _UC.fitLimit=0.; //VER 10.1 + _UC.populationSize=0; + _UC.initialPopSize=-1;/*zero actually have a meaning*/ + _UC.numGenerations=100; + _UC.stopCrit=0; + _UC.bestFrac=0.7; + _UC.keepBestHM=0; + _UC.reoptOld=FALSE; + _UC.symmetries=NULL; + _UC.fracGene=0.5; + _UC.fracRand=0.2; + _UC.fracTopRand=0.2; //VER 10.1 + _UC.fracPerm=0.; + _UC.fracAtomsMut=0.1; + _UC.fracRotMut=0.; + _UC.fracLatMut=0.; + _UC.fracSpinMut=0.1; //VER 10.1 + _UC.howManySwaps=0; + _UC.specificSwaps=NULL; + _UC.mutationDegree=0; + _UC.mutationRate=0.5; + _UC.DisplaceInLatmutation=1.0; + _UC.AutoFrac=FALSE; + _UC.minVectorLength=0.; + _UC.IonDistances=NULL; + _UC.constraint_enhancement=TRUE; + _UC._nmolecules=0; + _UC.MolCenters=NULL; + _UC._nlattice_line=0; + _UC._nlattice_vals=0; + _UC.Latticevalues=NULL; + _UC._nsplits=0; + _UC.splitInto=NULL; + _UC.pickUpYN=FALSE; + _UC.pickUpGen=0; + _UC.pickUpFolder=0; + _UC._num_opt_steps=0; + _UC.abinitioCode=NULL; + _UC._isfixed=NULL; + _UC.KresolStart=NULL; + _UC.vacuumSize=NULL; + _UC.numParallelCalcs=1; + _UC.numProcessors=1;/*undocumented*/ + _UC._isCmdList=FALSE;/*default is only 1 commandExecutable*/ + _UC.commandExecutable=NULL; + _UC.whichCluster=0; + _UC.remoteFolder=NULL; + _UC.PhaseDiagram=FALSE; + _UC.RmaxFing=10.0; + _UC.deltaFing=0.08; + _UC.sigmaFing=0.03; + _UC.antiSeedsActivation=5000; + _UC.antiSeedsMax=0.; + _UC.antiSeedsSigma=0.001; + _UC.doSpaceGroup=TRUE; + _UC.SymTolerance=0.1; + _UC.repeatForStatistics=1; + _UC.stopFitness=0.; + _UC.fixRndSeed=0; //VER 10.1 + _UC.collectForces=FALSE; + _UC.ordering_active=TRUE; + _UC.symmetrize=FALSE; + _UC.valenceElectr=NULL; + _UC.percSliceShift=1.0; + _UC.dynamicalBestHM=2; + _UC.softMutOnly=NULL; + _UC.maxDistHeredity=0.5; + _UC.manyParents=0; + _UC.minSlice=0.; + _UC.maxSlice=0.; + _UC.numberparents=2; + _UC.BoltzTraP_T_max=800.0; //VER 10.1 + _UC.BoltzTraP_T_delta=50.0; //VER 10.1 + _UC.BoltzTraP_T_efcut=0.15; //VER 10.1 + _UC.TE_T_interest=300.0; //VER 10.1 + _UC.TE_threshold=0.5; //VER 10.1 + _UC.TE_goal=US_BT_ZT; //VER 10.1 + _UC.thicknessS=2.0; + _UC.thicknessB=3.0; + _UC.reconstruct=1; + _UC.StoichiometryStart=NULL;/*almost undocumented*/ + _UC.firstGeneMax=11; + _UC.minAt=0; + _UC.maxAt=0; + _UC.fracTrans=0.1; + _UC.howManyTrans=0.2; + _UC.specificTrans=NULL; + _UC.GaussianWidth=0.; + _UC.GaussianHeight=0.; + _UC.FullRelax=2; + _UC.maxVectorLength=0.; + _UC.PSO_softMut=1; + _UC.PSO_BestStruc=1; + _UC.PSO_BestEver=1; + _UC.vcnebType=110; + _UC._vcnebtype_method=1; + _UC._vcnebtype_img_num=TRUE; + _UC._vcnebtype_spring=FALSE; + _UC.numImages=9; + _UC.numSteps=200; + _UC.optReadImages=2; + _UC.optimizerType=1; + _UC.optRelaxType=3; + _UC.dt=0.05; + _UC.ConvThreshold=0.003; + _UC.VarPathLength=0.; + _UC.K_min=5; + _UC.K_max=5; + _UC.Kconstant=5; + _UC.optFreezing=FALSE; + _UC.optMethodCIDI=0; + _UC.startCIDIStep=100; + _UC.pickupImages=NULL; + _UC.FormatType=2;/*MUST BE VASP FORMAT!*/ + _UC.PrintStep=1; + _UC.numIterations=1000; //VER 10.1 + _UC.speciesSymbol=NULL; //VER 10.1 + _UC.mass=NULL; //VER 10.1 + _UC.amplitudeShoot[0]=0.1; //VER 10.1 + _UC.amplitudeShoot[1]=0.1; //VER 10.1 + _UC.magnitudeShoot[0]=1.05; //VER 10.1 + _UC.magnitudeShoot[1]=1.05; //VER 10.1 + _UC.shiftRatio=0.1; //VER 10.1 + _UC.orderParaType=TRUE; //VER 10.1 NOTE: here we select fingerprint method as default! + _UC.opCriteria[0]=0.; //VER 10.1 + _UC.opCriteria[1]=0.; //VER 10.1 + _UC.cmdOrderParameter=NULL; //VER 10.1 + _UC.cmdEnthalpyTemperature=NULL; //VER 10.1 + _UC.orderParameterFile=g_strdup("fp.dat"); //VER 10.1 + _UC.enthalpyTemperatureFile=g_strdup("HT.dat"); //VER 10.1 + _UC.trajectoryFile=g_strdup("traj.dat"); //VER 10.1 + _UC.MDrestartFile=g_strdup("traj.restart"); //VER 10.1 +} +void free_uspex_parameters(uspex_calc_struct *uspex_calc){ + /*free the sub-structures, and set it back to init*/ + g_free(_UC.name); + g_free(_UC.path); + g_free(_UC.filename); + g_free(_UC.new_optType); //VER 10.1 + g_free(_UC.atomType); + g_free(_UC.numSpecies); + g_free(_UC.ldaU); //VER 10.1 + g_free(_UC.valences); + g_free(_UC.goodBonds); + g_free(_UC.symmetries); + g_free(_UC.specificSwaps); + g_free(_UC.IonDistances); + g_free(_UC.MolCenters); + g_free(_UC.Latticevalues); + g_free(_UC.splitInto); + g_free(_UC.abinitioCode); + g_free(_UC._isfixed); + g_free(_UC.KresolStart); + g_free(_UC.vacuumSize); + g_free(_UC.commandExecutable); + g_free(_UC.remoteFolder); + g_free(_UC.valenceElectr); + g_free(_UC.softMutOnly); + g_free(_UC.specificTrans); + g_free(_UC.pickupImages); + g_free(_UC.speciesSymbol); //VER 10.1 + g_free(_UC.mass); //VER 10.1 + g_free(_UC.cmdOrderParameter); //VER 10.1 + g_free(_UC.cmdEnthalpyTemperature); //VER 10.1 + g_free(_UC.orderParameterFile); //VER 10.1 + g_free(_UC.enthalpyTemperatureFile); //VER 10.1 + g_free(_UC.trajectoryFile); //VER 10.1 + g_free(_UC.MDrestartFile); //VER 10.1 + init_uspex_parameters(uspex_calc); +} +/************************************************************************/ +/* Read Parameters.txt and fill keywords of uspex_calc_struct structure */ +/************************************************************************/ +uspex_calc_struct *read_uspex_parameters(gchar *filename,gint safe_nspecies){ FILE *vf; - gchar *line=NULL; - gchar *ptr; - gint idx; - uspex_calc_struct *uspex_calc=model->uspex; - /* specific */ - gchar method; - /*start*/ - _UC.nspecies=0; - vf = fopen(filename, "rt"); - if (!vf) return 1; - line = file_read_line(vf); - while (line){ - if (find_in_string("calculationMethod",line) != NULL) { - sscanf(line,"%c%*s : calculationMethod %*s",&(method)); - switch (method){ - case 'U': - case 'u': - /*uspex*/ - _UC.method=US_CM_USPEX; - property_add_ranked(2, "Calculation", "USPEX", model); + long int vfpos; + gchar *line=NULL; + gchar *ptr,*ptr2; + gchar c; + gint i,j,k; + guint n_size; + uspex_calc_struct *uspex_calc; + /*tests*/ + if(filename==NULL) return NULL; + vf = fopen(filename, "rt"); + if (!vf) return NULL; + /**/ + uspex_calc = g_malloc(sizeof(uspex_calc_struct)); + init_uspex_parameters(uspex_calc); +/*this should be promoted*/ +#define __Q(a) #a +/*some lazy defines*/ +#define __STRIP_EOL(line) for(i=0;i3))) { + g_free(line); + line = file_read_line(vf); + continue; + } + _UC._calctype_dim=i; + ptr++; + i=g_ascii_digit_value(*ptr);/*molecular*/ + if((i<0)||(i>1)){ + g_free(line); + line = file_read_line(vf); + continue; + } + _UC._calctype_mol=(i==1); + ptr++; + i=g_ascii_digit_value(*ptr);/*variable*/ + if((i<0)||(i>1)){ + g_free(line); + line = file_read_line(vf); + continue; + } + _UC._calctype_var=(i==1); + _UC.calculationType+=(j*_UC._calctype_dim*100)+(_UC._calctype_mol*10)+_UC._calctype_var; + _UC.calculationType*=j; + g_free(line); + line = file_read_line(vf); + continue; + } if (find_in_string("optType",line) != NULL) { - sscanf(line,"%i : optType %*s",&(_UC.opt_type)); -#if DEBUG_USPEX_READ -fprintf(stdout,"#DBG: USPEX optType=%i\n",_UC.type); -#endif - + /*VER 10.1 has a new format: + old format: "XXX : optType" + new fromat: "% optType" + "XXX XXX XXX" + "%endOptType"*/ + ptr=&(line[0]); + __SKIP_BLANK(ptr); + if(*ptr=='%'){/*switch to new optType*/ + g_free(line);line = file_read_line(vf);/*go next line*/ + __STRIP_EOL(line); + ptr=&(line[0]); + __SKIP_BLANK(ptr); + if(_UC.new_optType!=NULL) g_free(_UC.new_optType); + _UC.new_optType=g_strdup(ptr); + }else{/*old fashion optType*/ + __STRIP_EOL(line); + if(_UC.new_optType!=NULL) g_free(_UC.new_optType); + _UC.new_optType=NULL; + } + ptr=&(line[0]); + __SKIP_BLANK(ptr); + /*in ANY case we still load the first value as old optType*/ + if(g_ascii_isalpha(*ptr)){ + j=0; + if((*ptr=='m')||(*ptr=='M')){ + /*could be Min max*/ + if((*(ptr+1)=='a')&&(*(ptr+2)=='x')) { + /*can be mag_moment -> checked x*/ + j=1; + ptr+=4; + } + if(*(ptr+1)=='i') { + /*can be only Min*/ + j=-1; + ptr+=4; + } + } + c=*ptr; + switch(c){ + case 'E': + case 'e': + _UC.optType=US_OT_ENTHALPY; + if(j==1) _UC.anti_opt=TRUE; + break; + case 'v': + case 'V': + _UC.optType=US_OT_VOLUME; + if(j==1) _UC.anti_opt=TRUE; + break; + case 'h': + case 'H': + _UC.optType=US_OT_HARDNESS; + if(j==-1) _UC.anti_opt=TRUE; + break; + case 's': + case 'S': + _UC.optType=US_OT_ORDER; + if(j==-1) _UC.anti_opt=TRUE; + break; + case 'a': + case 'A': + _UC.optType=US_OT_DISTANCE; + if(j==-1) _UC.anti_opt=TRUE; + break; + case 'd': + case 'D': + if((*(ptr+1)=='e')||(*(ptr+1)=='E')){ + /*VER 10.1 "density" replaces "aver_dist"*/ + _UC.optType=US_OT_DISTANCE; + if(j==-1) _UC.anti_opt=TRUE; + break; + }else if((*(ptr+1)=='i')||(*(ptr+1)=='I')){ + if((*(ptr+5)=='s')||(*(ptr+5)=='S')) _UC.optType=US_OT_DIELEC_S; + else if((*(ptr+5)=='g')||(*(ptr+5)=='G')) _UC.optType=US_OT_DIELEC_GAP; + else _UC.optType=US_OT_UNKNOWN; + if(j==-1) _UC.anti_opt=TRUE; + } else _UC.optType=US_OT_UNKNOWN; + break; + case 'g': + case 'G': + _UC.optType=US_OT_GAP; + break; + case 'b': + case 'B': + if((*(ptr+1)=='a')||(*(ptr+1)=='A')){ + /*VER 10.1 "bandgap" replaces "gap"*/ + _UC.optType=US_OT_GAP; + break; + } else if((*(ptr+1)=='i')||(*(ptr+1)=='I')){ + _UC.optType=US_OT_2R;/*VER 10.1*/ + break; + } + case 'm': + case 'M': + _UC.optType=US_OT_MAG; + break; + case 'q': + case 'Q': + _UC.optType=US_OT_QE; + break; + case 'z': + case 'Z': + _UC.optType=US_OT_ZT; + break; + case 'f': + case 'F': + _UC.optType=US_OT_Fphon; + break; + default: + _UC.optType=US_OT_UNKNOWN; + } + } else if(g_ascii_isdigit(*ptr)||(*ptr=='-')){ + /*load optType*/ + k=0;sscanf(ptr,"%i%*s",&(k)); + if(k<0) { + _UC.anti_opt=TRUE; + k*=-1; + } + switch (k){ + case 1: + _UC.optType=US_OT_ENTHALPY; + break; + case 2: + _UC.optType=US_OT_VOLUME; + break; + case 3: + _UC.optType=US_OT_HARDNESS; + break; + case 4: + _UC.optType=US_OT_ORDER; + break; + case 5: + _UC.optType=US_OT_DISTANCE; + break; + case 6: + _UC.optType=US_OT_DIELEC_S; + break; + case 7: + _UC.optType=US_OT_GAP; + break; + case 8: + _UC.optType=US_OT_DIELEC_GAP; + break; + case 9: + _UC.optType=US_OT_MAG; + break; + case 10: + _UC.optType=US_OT_QE; + break; + case 11:/*VER 10.1*/ + _UC.optType=US_OT_2R; + break; + case 14:/*VER 10.1*/ + _UC.optType=US_OT_ZT; + break; + case 17:/*VER 10.1*/ + _UC.optType=US_OT_Fphon; + break; + case 1101: + _UC.optType=US_OT_BULK_M; + break; + case 1102: + _UC.optType=US_OT_SHEAR_M; + break; + case 1103: + _UC.optType=US_OT_YOUNG_M; + break; + case 1104: + _UC.optType=US_OT_POISSON; + break; + case 1105: + _UC.optType=US_OT_PUGH_R; + break; + case 1106: + _UC.optType=US_OT_VICKERS_H; + break; + case 1107: + _UC.optType=US_OT_FRACTURE; + break; + case 1108: + _UC.optType=US_OT_DEBYE_T; + break; + case 1109: + _UC.optType=US_OT_SOUND_V; + break; + case 1110: + _UC.optType=US_OT_SWAVE_V; + break; + case 1111: + _UC.optType=US_OT_PWAVE_V; + break; + default: + _UC.optType=US_OT_UNKNOWN; + } + } else _UC.optType=US_OT_UNKNOWN; + if(_UC.new_optType!=NULL){ + g_free(line); + line = file_read_line(vf);/*This is the EndOptType line*/ + } + g_free(line); + line = file_read_line(vf); + continue; + /*TODO: assign a count of optType values in case of Multiobjective optimization*/ } if (find_in_string("atomType",line) !=NULL){ - /*let's count number of species here*/ - g_free(line); - line = file_read_line(vf); - ptr=&(line[0]); - while(*ptr==' ') ptr++;/*skip initial space (if any)*/ - _UC.nspecies=1;/*there is at lease one species*/ - while(*ptr!='\0'){ - if(*ptr==' ') { - _UC.nspecies++;ptr++; + g_free(line);line = file_read_line(vf);/*go next line*/ + /*look for atomType*/ + _UC.atomType = g_malloc(_UC._nspecies*sizeof(gint)); + for(i=0;i<_UC._nspecies;i++) _UC.atomType[i]=0; + ptr=&(line[0]);i=0; + while((*ptr!='\n')&&(*ptr!='\0')){ + __SKIP_BLANK(ptr); + if(g_ascii_isdigit(*ptr)) _UC.atomType[i]=(gint)g_ascii_strtoull (ptr,NULL,10);/*user provided Z number*/ + else _UC.atomType[i]=elem_symbol_test(ptr);/*try user provided symbol*/ + if((_UC.atomType[i]<=0)||(_UC.atomType[i]>MAX_ELEMENTS-1)){/*invalid Z*/ + _UC.atomType[i]=0;/*allow it for now*/ + } + ptr++;i++; while(g_ascii_isgraph(*ptr)) ptr++;/*go to next space/end*/ - }else ptr++; - } -#if DEBUG_USPEX_READ -fprintf(stdout,"#DBG: USPEX number_of_species=%i\n",_UC.nspecies); -#endif - /*now let's find each species symbol*/ - _UC.spe_Z=g_malloc(_UC.nspecies*sizeof(gint)); - ptr=&(line[0]);idx=0; - while(*ptr==' ') ptr++;/*skip initial space (if any)*/ - while((*ptr!='\n')&&(*ptr!='\0')){ - if(*ptr==' ') while(*ptr==' ') ptr++;/*skip space(s)*/ - if(g_ascii_isdigit(*ptr)) _UC.spe_Z[idx]=g_ascii_strtod(ptr,NULL);/*user provided Z number*/ - else _UC.spe_Z[idx]=elem_symbol_test(ptr);/*user provided symbol*/ - if((_UC.spe_Z[idx]<=0)||(_UC.spe_Z[idx]>MAX_ELEMENTS-1)){/*X not allowed*/ + } + g_free(line); + line = file_read_line(vf);/*this is the EndAtomType line*/ + g_free(line); + line = file_read_line(vf); + continue; + } + if (find_in_string("numSpeci",line) != NULL) { +/*_BUG_ VER 10.1 EX26 has a typo (numSpecices instead of numSpecies)*/ + vfpos=ftell(vf);/* flag */ + g_free(line);line = file_read_line(vf);/*go next line*/ + /*1st get the total number of lines*/ + _UC._var_nspecies=0; + do{ + g_free(line);line = file_read_line(vf);/*go next line*/ + _UC._var_nspecies++; + }while(find_in_string("EndNumSpeci",line) == NULL); +/*_BUG_ VER 10.1 EX26 has a consistent typo (EndNumSpecices instead of EndNumSpecies)*/ +/*_BUG_ when _cactype_mol=TRUE numSpecies actually refer to a number of molecules, and thus depends on _nmolecules*/ +if((_UC._calctype_mol)&&(_UC._nmolecules==0)){ + /*numSpecies refer to molecules, but _nmolecules has not been calculated.*/ + ptr=&(line[0]); + __COUNT_ALNUM(ptr,_UC._nmolecules); +} + fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ + g_free(line);/*FIX: _VALGRIND_BUG_*/ + line = file_read_line(vf);/*first line of numSpecies*/ +if(_UC._calctype_mol) n_size=_UC._nmolecules; +else n_size=_UC._nspecies; + _UC.numSpecies = g_malloc(n_size*_UC._var_nspecies*sizeof(gint)); + for(i=0;i0){ + ptr=&(line[0]);ptr2=ptr;j=0; + if(_UC.ldaU!=NULL) g_free(_UC.ldaU); + _UC.ldaU=g_malloc(i*sizeof(gdouble)); + while((j1)||(_UC._nlattice_vals!=_UC._var_nspecies)) + gui_text_show(WARNING, line); + }else{ + switch(_UC._nlattice_line){ + case 1: + switch(_UC._nlattice_vals){ + case 1: + break;/*always ok*/ + case 6: + if(_UC._calctype_dim==3) break; + case 3: + if(_UC._calctype_dim==2) break; + case 0:/*cannot happen*/ + default: + gui_text_show(WARNING, line); + } + break; + case 2: + if(_UC._nlattice_vals!=2) gui_text_show(WARNING, line); + break; + case 3: + if(_UC._nlattice_vals!=3) gui_text_show(WARNING, line); + break; + default: + gui_text_show(WARNING, line); + } + } + g_free(line);line = file_read_line(vf);/*go next line*/ + _UC.Latticevalues = g_malloc(_UC._nlattice_vals*_UC._nlattice_line*sizeof(gdouble)); + for(j=0;j<_UC._nlattice_vals*_UC._nlattice_line;j++) _UC.Latticevalues[j]=0.; + j=0; + while(find_in_string("Endvalues",line) == NULL){ + ptr=&(line[0]); + i=0; + while((*ptr!='\n')&&(*ptr!='\0')){ + __SKIP_BLANK(ptr); + _UC.Latticevalues[i+j*_UC._nlattice_line]=g_ascii_strtod(ptr,&ptr2); + ptr=ptr2+1; + i++; + } + j++; + g_free(line);line = file_read_line(vf); + } + g_free(line); + line = file_read_line(vf); + continue; + } + if (find_in_string("splitInto",line) != NULL) { + g_free(line);line = file_read_line(vf);/*go next line*/ + /*count number of splits*/ + ptr=&(line[0]); + while(*ptr==' ') ptr++; + _UC._nsplits=1; + while(*ptr!='\0'){ + if(*ptr==' ') { + _UC._nsplits++;ptr++; + while(g_ascii_isgraph(*ptr)) ptr++; + }else ptr++; + } + /*look for splits*/ + _UC.splitInto = g_malloc(_UC._nsplits*sizeof(gint)); + for(i=0;i<_UC._nsplits;i++) _UC.splitInto[i]=0; + ptr=&(line[0]);i=0; + while((*ptr!='\n')&&(*ptr!='\0')){ + __SKIP_BLANK(ptr); + _UC.splitInto[i]=(gint)g_ascii_strtoull(ptr,&ptr2,10); + ptr=ptr2+1; + i++; + } + g_free(line); + line = file_read_line(vf);/*this is the EndSplitInto line*/ + g_free(line); + line = file_read_line(vf); + continue; + } + if (find_in_string("pickUpYN",line) != NULL) {/*pickUpYN is deprecated BTW*/ + sscanf(line,"%i%*s",&(i)); + _UC.pickUpYN=(i!=0); + g_free(line);line = file_read_line(vf); + continue; + } + __GET_INT(pickUpGen); + __GET_INT(pickUpFolder); + if (find_in_string("abinitioCode",line) != NULL) { + g_free(line);line = file_read_line(vf);/*go next line*/ + /*look for abinitioCode*/ + _UC.abinitioCode = g_malloc(_UC._num_opt_steps*sizeof(gint)); + for(i=0;i<_UC._num_opt_steps;i++) _UC.abinitioCode[i]=0; + ptr=&(line[0]);i=0; +/*TODO: deal with META parenthesis here!*/ +_UC._isfixed = g_malloc(_UC._num_opt_steps*sizeof(gboolean)); +for(i=0;i<_UC._num_opt_steps;i++) _UC._isfixed[i]=TRUE; +j=0;i=0;n_size=0; +while((*ptr!='\n')&&(*ptr!='\0')){ + __SKIP_BLANK(ptr); + if(*ptr=='(') { + n_size=1; + ptr++; + j++; + } + if(n_size==0) _UC._isfixed[i]=TRUE; + else _UC._isfixed[i]=FALSE; + _UC.abinitioCode[i]=(gint)g_ascii_strtoull(ptr,&ptr2,10); + if(*ptr2==')') n_size=0; + ptr=ptr2+1; + i++; +} +/*funny thing: if they are all true means they are all false*/ +if(j==0) for(i=0;i<_UC._num_opt_steps;i++) _UC._isfixed[i]=FALSE; + g_free(line); + line = file_read_line(vf);/*this is the ENDabinit line*/ + g_free(line); + line = file_read_line(vf); + continue; + } + if (find_in_string("KresolStart",line) != NULL) { + g_free(line);line = file_read_line(vf);/*go next line*/ + /*in my understanding, there is either 1 or _num_opt_steps values of KresolStart*/ + _UC.KresolStart = g_malloc(_UC._num_opt_steps*sizeof(gdouble)); + for(i=0;i<_UC._num_opt_steps;i++) _UC.KresolStart[i]=0.; + ptr=&(line[0]);i=0; + while((*ptr!='\n')&&(*ptr!='\0')){ + __SKIP_BLANK(ptr); + _UC.KresolStart[i]=g_ascii_strtod(ptr,&ptr2); + ptr=ptr2+1; + i++; + } + g_free(line); + line = file_read_line(vf);/*this is the Kresolend line*/ + g_free(line); + line = file_read_line(vf); + continue; + } + if (find_in_string("vacuumSize",line) != NULL) { + g_free(line);line = file_read_line(vf);/*go next line*/ + /*in my understanding, there is BETWEEN 1 to _num_opt_steps values of vacuumSize*/ + _UC.vacuumSize = g_malloc(_UC._num_opt_steps*sizeof(gdouble)); + for(i=0;i<_UC._num_opt_steps;i++) _UC.vacuumSize[i]=10.;/*implicit is 10.*/ + ptr=&(line[0]);i=0; + while((*ptr!='\n')&&(*ptr!='\0')){ + __SKIP_BLANK(ptr); + _UC.vacuumSize[i]=g_ascii_strtod(ptr,&ptr2); + ptr=ptr2+1; + i++; + } + g_free(line); + line = file_read_line(vf);/*this is the endVacuumSize line*/ + g_free(line); + line = file_read_line(vf); + continue; + } + __GET_INT(numParallelCalcs); + __GET_INT(numProcessors);/*undocumented*/ + if (find_in_string("commandExecutable",line) != NULL) { + g_free(line);line = file_read_line(vf);/*go next line*/ + /*there is also 12); + /*remove last '\n'*/ + j = strlen(_UC.commandExecutable); + ptr = &(_UC.commandExecutable[j]); + while((*ptr!='\n')&&(j>0)) j--; + ptr[j-1]='\0'; + g_free(line); + line = file_read_line(vf); + continue; + } + __GET_INT(whichCluster); + __GET_CHARS(remoteFolder); + __GET_BOOL(PhaseDiagram); + __GET_DOUBLE(RmaxFing); + __GET_DOUBLE(deltaFing); + __GET_DOUBLE(sigmaFing); + __GET_INT(antiSeedsActivation); + __GET_DOUBLE(antiSeedsMax); + __GET_DOUBLE(antiSeedsSigma); + __GET_BOOL(doSpaceGroup); + if (find_in_string("SymTolerance",line) != NULL) { + /*can be either a number or quantifier*/ + ptr=&(line[0]); + __SKIP_BLANK(ptr); + c=*ptr; + if(g_ascii_isalpha(c)){ + /*Either high, medium, or low*/ + switch(c){ + case 'H': + case 'h': + _UC.SymTolerance=0.05; + break; + case 'M': + case 'm': + _UC.SymTolerance=0.10; + break; + case 'L': + case 'l': + _UC.SymTolerance=0.20; + break; + default:/*everything else is a bad setting*/ + g_free(line); + line = g_strdup_printf("ERROR: USPEX bad SymTolerance setting in Parameters.txt!\n"); + gui_text_show(ERROR, line); + } + }else{ + /*get the number directly*/ + _UC.SymTolerance=g_ascii_strtod(ptr,NULL); + } + g_free(line); + line = file_read_line(vf); + continue; + } + __GET_INT(repeatForStatistics); + __GET_DOUBLE(stopFitness); + __GET_INT(fixRndSeed);/*VER 10.1*/ + __GET_BOOL(collectForces); + __GET_BOOL(ordering_active); + __GET_BOOL(symmetrize); + if (find_in_string("valenceElectr",line) != NULL) { + g_free(line);line = file_read_line(vf);/*go next line*/ + /*look for valenceElectr*/ + _UC.valenceElectr = g_malloc(_UC._nspecies*sizeof(gint)); + for(i=0;i<_UC._nspecies;i++) _UC.valenceElectr[i]=0; + ptr=&(line[0]);i=0; + while((*ptr!='\n')&&(*ptr!='\0')){ + __SKIP_BLANK(ptr); + _UC.valenceElectr[i]=(gint)g_ascii_strtoull(ptr,&ptr2,10); + ptr=ptr2+1; + i++; + } + g_free(line); + line = file_read_line(vf);/*this is the endValenceElectr line*/ + g_free(line); + line = file_read_line(vf); + continue; + } + __GET_DOUBLE(percSliceShift); + __GET_INT(dynamicalBestHM); + __GET_STRING(softMutOnly);/*TODO: rewrite as "smart" int array*/ + __GET_DOUBLE(maxDistHeredity); + __GET_INT(manyParents); + __GET_DOUBLE(minSlice); + __GET_DOUBLE(maxSlice); + __GET_INT(numberparents); + __GET_DOUBLE(BoltzTraP_T_max);/*VER 10.1*/ + __GET_DOUBLE(BoltzTraP_T_delta);/*VER 10.1*/ + __GET_DOUBLE(BoltzTraP_T_efcut);/*VER 10.1*/ + __GET_DOUBLE(TE_T_interest);/*VER 10.1*/ + __GET_DOUBLE(TE_threshold);/*VER 10.1*/ + if (find_in_string("TE_goal",line) != NULL) { + /*VER 10.1: figure of merit component*/ + ptr=&(line[0]); + __SKIP_BLANK(ptr); + if(*ptr=='Z'){ + ptr++; + if(*ptr=='T'){ + ptr++; + if(*ptr=='_'){ + ptr++; + c=*ptr; + switch(c){ + case 'x': + _UC.TE_goal=US_BT_ZTxx; + break; + case 'y': + _UC.TE_goal=US_BT_ZTyy; + break; + case 'z': + _UC.TE_goal=US_BT_ZTzz; + break; + default: + _UC.TE_goal=US_BT_UNKNOWN; + } + }else{ + _UC.TE_goal=US_BT_ZT; + } + }else{ + _UC.TE_goal=US_BT_UNKNOWN; + } + }else{ + _UC.TE_goal=US_BT_UNKNOWN; + } + } + __GET_DOUBLE(thicknessS); + __GET_DOUBLE(thicknessB); + __GET_INT(reconstruct); + if (find_in_string("StoichiometryStart",line) != NULL) { + g_free(line);line = file_read_line(vf);/*go next line*/ + _UC.StoichiometryStart=g_malloc(_UC._nspecies*sizeof(gint)); + for(i=0;i<_UC._nspecies;i++) _UC.StoichiometryStart[i]=0; + ptr=&(line[0]);i=0; + while((*ptr!='\n')&&(*ptr!='\0')){ + __SKIP_BLANK(ptr); + _UC.StoichiometryStart[i]=(gint)g_ascii_strtoull(ptr,&ptr2,10); + ptr=ptr2+1; + i++; + } + g_free(line); + line = file_read_line(vf);/*this is the endStoichiometryStart line*/ + g_free(line); + line = file_read_line(vf); + continue; + } + __GET_INT(firstGeneMax); + __GET_INT(minAt); + __GET_INT(maxAt); + __GET_DOUBLE(fracTrans); + __GET_DOUBLE(howManyTrans); + if (find_in_string("specificTrans",line) != NULL) { + g_free(line);line = file_read_line(vf);/*go next line*/ + /*count number of specificTrans*/ + ptr=&(line[0]); + _UC._nspetrans=1; + while(*ptr!='\0'){ + if(*ptr==' ') { + _UC._nspetrans++;ptr++; + while(g_ascii_isgraph(*ptr)) ptr++; + }else ptr++; + } + /*look for specificTrans*/ + _UC.specificTrans = g_malloc(_UC._nspetrans*sizeof(gint)); + for(i=0;i<_UC._nspetrans;i++) _UC.specificTrans[i]=0; + ptr=&(line[0]);i=0; + while((*ptr!='\n')&&(*ptr!='\0')){ + __SKIP_BLANK(ptr); + _UC.specificTrans[i]=(gint)g_ascii_strtoull(ptr,&ptr2,10); + ptr=ptr2+1; + i++; + } + g_free(line); + line = file_read_line(vf);/*this is the EndTransSpecific line*/ + g_free(line); + line = file_read_line(vf); + continue; + } + __GET_DOUBLE(GaussianWidth); + __GET_DOUBLE(GaussianHeight); + __GET_INT(FullRelax); + __GET_DOUBLE(maxVectorLength); + __GET_DOUBLE(PSO_softMut); + __GET_DOUBLE(PSO_BestStruc); + __GET_DOUBLE(PSO_BestEver); + if (find_in_string("vcnebType",line) != NULL) { + k=0;sscanf(line,"%i%*s",&(k)); + j=k; + i=((int)(j/100))%10; + if((i<1)||(i>2)) { + g_free(line); + line = file_read_line(vf); + continue; + } + _UC._vcnebtype_method=i; + j-=i*100; + i=((int)(j/10))%10; + if((i<0)||(i>1)){ + g_free(line); + line = file_read_line(vf); + continue; + } + _UC._vcnebtype_img_num=(i==1); + j-=i*10; + i=j%10; + if((i<0)||(i>1)){ + g_free(line); + line = file_read_line(vf); + continue; + } + _UC._vcnebtype_spring=(i==1); + _UC.vcnebType=k; + g_free(line); + line = file_read_line(vf); + continue; + } + __GET_INT(numImages); + __GET_INT(numSteps); + __GET_INT(optReadImages); + __GET_INT(optimizerType); + __GET_INT(optRelaxType); + __GET_DOUBLE(dt); + __GET_DOUBLE(ConvThreshold); + __GET_DOUBLE(VarPathLength); + __GET_DOUBLE(K_min); + __GET_DOUBLE(K_max); + __GET_DOUBLE(Kconstant); + __GET_BOOL(optFreezing); + __GET_INT(optMethodCIDI); + __GET_INT(startCIDIStep); + if (find_in_string("pickupImages",line) != NULL) { + g_free(line);line = file_read_line(vf);/*go next line*/ + /*count number of picked-up images*/ + ptr=&(line[0]); + _UC._npickimg=1; + while(*ptr!='\0'){ + if(*ptr==' ') { + _UC._npickimg++;ptr++; + while(g_ascii_isgraph(*ptr)) ptr++; + }else ptr++; + } + /*look for pickupImages*/ + _UC.pickupImages = g_malloc(_UC._npickimg*sizeof(gint)); + for(i=0;i<_UC._npickimg;i++) _UC.pickupImages[i]=0; + ptr=&(line[0]);i=0; + while((*ptr!='\n')&&(*ptr!='\0')){ + __SKIP_BLANK(ptr); + _UC.pickupImages[i]=(gint)g_ascii_strtoull(ptr,&ptr2,10); + ptr=ptr2+1; + i++; + } + g_free(line); + line = file_read_line(vf);/*this is the EndPickupImages line*/ + g_free(line); + line = file_read_line(vf); + continue; + } + __GET_INT(FormatType); + __GET_INT(PrintStep); + __GET_INT(numIterations);/*VER 10.1*/ + __GET_STRING(speciesSymbol);/*VER 10.1 TODO: smart array*/ + if (find_in_string("mass",line) != NULL) { + /*VER 10.1: n_species mass*/ + g_free(line);line = file_read_line(vf);/*go next line*/ + _UC.mass=g_malloc(_UC._nspecies*sizeof(gdouble)); + for(i=0;i<_UC._nspecies;i++) _UC.mass[i]=0.; + ptr=&(line[0]);i=0; + while((*ptr!='\n')&&(*ptr!='\0')){ + __SKIP_BLANK(ptr); + _UC.mass[i]=g_ascii_strtod(ptr,&ptr2); + ptr=ptr2+1; + i++; } + g_free(line); + line = file_read_line(vf);/*this is the EndMass line*/ + g_free(line); + line = file_read_line(vf); + continue; + } + if (find_in_string("amplitudeShoot",line) != NULL) { + /*VER 10.1: 2 amplitudeShoot*/ + g_free(line);line = file_read_line(vf);/*go next line*/ + _UC.amplitudeShoot[0]=0.; + _UC.amplitudeShoot[1]=0.; + ptr=&(line[0]); + __SKIP_BLANK(ptr); + _UC.amplitudeShoot[0]=g_ascii_strtod(ptr,&ptr2); + ptr=ptr2+1; + __SKIP_BLANK(ptr); + _UC.amplitudeShoot[1]=g_ascii_strtod(ptr,&ptr2); + g_free(line); + line = file_read_line(vf);/*this is the EndAmplitudeShoot*/ + g_free(line); + line = file_read_line(vf); + continue; + } + if (find_in_string("magnitudeShoot",line) != NULL) { + /*VER 10.1: 2 magnitudeShoot*/ + g_free(line);line = file_read_line(vf);/*go next line*/ + _UC.magnitudeShoot[0]=0.; + _UC.magnitudeShoot[1]=0.; + ptr=&(line[0]); + __SKIP_BLANK(ptr); + _UC.magnitudeShoot[0]=g_ascii_strtod(ptr,&ptr2); + ptr=ptr2+1; + __SKIP_BLANK(ptr); + _UC.magnitudeShoot[1]=g_ascii_strtod(ptr,&ptr2); + g_free(line); + line = file_read_line(vf);/*this is the EndMagnitudeShoot*/ + g_free(line); + line = file_read_line(vf); + continue; + } + __GET_DOUBLE(shiftRatio);/*VER 10.1*/ + __GET_BOOL(orderParaType);/*VER 10.1*/ + if (find_in_string("opCriteria",line) != NULL) { + /*VER 10.1: 2 opCriteria*/ + g_free(line);line = file_read_line(vf);/*go next line*/ + _UC.opCriteria[0]=0.; + _UC.opCriteria[1]=0.; + ptr=&(line[0]); + __SKIP_BLANK(ptr); + _UC.opCriteria[0]=g_ascii_strtod(ptr,&ptr2); + ptr=ptr2+1; + __SKIP_BLANK(ptr); + _UC.opCriteria[1]=g_ascii_strtod(ptr,&ptr2); + g_free(line); + line = file_read_line(vf);/*this is the EndOpCriteria*/ + g_free(line); + line = file_read_line(vf); + continue; + } + __GET_STRING(cmdOrderParameter);/*VER 10.1*/ + __GET_STRING(cmdEnthalpyTemperature);/*VER 10.1*/ + __GET_CHARS(orderParameterFile);/*VER 10.1*/ + __GET_CHARS(enthalpyTemperatureFile);/*VER 10.1*/ + __GET_CHARS(trajectoryFile);/*VER 10.1*/ + __GET_CHARS(MDrestartFile);/*VER 10.1*/ + /*in case no match was done:*/ #if DEBUG_USPEX_READ -fprintf(stdout,"#DBG: USPEX species[%i] Z=%i\n",idx,_UC.spe_Z[idx]); +fprintf(stdout,"#DBG: PROBE FAIL LINE: %s",line); #endif - ptr++;idx++; - while(g_ascii_isgraph(*ptr)) ptr++;/*go to next space/end*/ - } + g_free(line); + line = file_read_line(vf); + } + fclose(vf); + return uspex_calc; +#undef __GET_BOOL +#undef __GET_INT +#undef __GET_DOUBLE +#undef __GET_STRING +#undef __GET_CHARS +//#undef __COUNT_ALNUM +//#undef __COUNT_NUM +} +void copy_uspex_parameters(uspex_calc_struct *src,uspex_calc_struct *dest){ + gint i; +#define _SRC (*src) +#define _DEST (*dest) +#define _CP(value) _DEST.value=_SRC.value +#define _COPY(value,size,type) do{\ + if((_SRC.value)!=NULL){\ + if(_DEST.value!=NULL) g_free(_DEST.value);\ + _DEST.value = g_malloc(size*sizeof(type));\ + memcpy(_DEST.value,_SRC.value,size*sizeof(type));\ + }else{\ + _DEST.value=NULL;\ + }\ +}while(0) +#define _DBLCP(value,size) do{\ + if((_SRC.value)!=NULL){\ + if(_DEST.value!=NULL) g_free(_DEST.value);\ + _DEST.value = g_malloc(size*sizeof(gdouble));\ + for(i=0;i1)&&(_UC.MolCenters==NULL)) { + line = g_strdup_printf("ERROR: USPEX - molecular calculation but missing MolCenters!\n"); + gui_text_show(ERROR, line);g_free(line); + return -5; + } + if((_UC.repeatForStatistics>1)&&(_UC.stopFitness==0.)){ + line = g_strdup_printf("ERROR: USPEX - repeatForStatistics is >1 but stopFitness is 0.!\n"); + gui_text_show(ERROR, line);g_free(line); + return -5; + } +/*this is not an error as per EX14, EX19, EX22*/ + if((_UC._calctype_var)&&(_UC.minAt==0)){ + line = g_strdup_printf("WARNING: USPEX - varcomp calculation but missing minAt!\n"); + gui_text_show(WARNING, line);g_free(line); + } +/*this is not an error as per EX19*/ + if((_UC._calctype_var)&&(_UC.maxAt==0)){ + line = g_strdup_printf("WARNING: USPEX - varcomp calculation but missing maxAt!\n"); + gui_text_show(WARNING, line);g_free(line); + } + if((_UC.calculationMethod==US_CM_META)&&(_UC.maxVectorLength==0.)){ + line = g_strdup_printf("ERROR: USPEX - META calculation but missing maxVectorLength!\n"); + gui_text_show(ERROR, line);g_free(line); + return -5; + } + /*open output*/ + dest = fopen(filename, "w"); + if (!dest) return -2; + vf = tmpfile(); + if(!vf) { + fclose(dest); + return -3; + } + /*output resulting "Parameter.txt" input*/ + fprintf(vf,"* +++++++++++++++++++++++++++++++++ *\n"); + fprintf(vf,"* PARAMETERS EVOLUTIONARY ALGORITHM *\n"); + fprintf(vf,"* GENERATED BY GDIS %4.2f.%d (C) %d *\n",VERSION,PATCH,YEAR); + fprintf(vf,"* +++++++++++++++++++++++++++++++++ *\n"); + if(_UC.name==NULL) _UC.name=g_strdup("(unnamed)"); + line=g_strdup_printf("* CALCULATION: %s *",_UC.name); + __TITLE(line); + g_free(line); + line=g_strdup_printf("* TYPE OF RUN AND SYSTEM *"); + __TITLE(line); + g_free(line); + /*always print:*/ + switch(_UC.calculationMethod){ + _CS(US_CM,calculationMethod,USPEX); + _CS(US_CM,calculationMethod,META); + _CS(US_CM,calculationMethod,VCNEB); + _CS(US_CM,calculationMethod,PSO); + _CS(US_CM,calculationMethod,TPS);/*VER 10.1*/ + _CS(US_CM,calculationMethod,MINHOP);/*VER 10.1*/ + _CS(US_CM,calculationMethod,COPEX);/*VER 10.1*/ + case US_CM_UNKNOWN: + default: + fprintf(vf,"???\t: calculationMethod (unsupported method)\n"); + } +if((_UC.calculationMethod != US_CM_VCNEB)&&(_UC.calculationMethod != US_CM_TPS)){ + /*VER 10.1: new magnetic 's' prefix added*/ + switch(_UC.calculationType){ + _CS(US_CT,calculationType,300); + _CS(US_CT,calculationType,s300); + _CS(US_CT,calculationType,301); + _CS(US_CT,calculationType,s301); + _CS(US_CT,calculationType,310); + _CS(US_CT,calculationType,311); + _CS(US_CT,calculationType,000); + _CS(US_CT,calculationType,s000); + _CS(US_CT,calculationType,001); + _CS(US_CT,calculationType,110); + _CS(US_CT,calculationType,200); + _CS(US_CT,calculationType,s200); + _CS(US_CT,calculationType,201); + _CS(US_CT,calculationType,s201); + case US_CT_m200: fprintf(vf,"-200\t: calculationType\n");break; + case US_CT_sm200: fprintf(vf,"-s200\t: calculationType\n");break; + default: + fprintf(vf,"???\t: calculationType (unsupported type)\n"); + } +if(_UC.calculationMethod != US_CM_MINHOP){ + if(_UC.new_optType==NULL){ + /*old fashion optType*/ + if(!_UC.anti_opt) __OUT_INT(optType); + else { + fprintf(vf,"%i\t: optType\n",-1*_UC.optType); + } + }else{ + /*VER 10.1: new optType*/ + __OUT_BK_STRING(new_optType,"EndOptType"); + } +}/*MINHOP don't require optType*/ +}/*VCNEB,TPS don't require calculationType,optType*/ + /*NEW: use symbols*/ + fprintf(vf,"%% atomType\n"); + fprintf(vf,"%s",elements[_UC.atomType[0]].symbol);/*there is at least 1 atomType*/ + for(i=1;i<(_UC._nspecies);i++) fprintf(vf," %s",elements[_UC.atomType[i]].symbol); + fprintf(vf,"\n");fprintf(vf,"%% EndAtomType\n"); + if(_UC._var_nspecies==1){ + if(_UC._calctype_mol) __OUT_BK_INT(numSpecies,"EndNumSpecies",_UC._nmolecules); + else __OUT_BK_INT(numSpecies,"EndNumSpecies",_UC._nspecies); + is_w++; + }else{ + /*numSpecies can be set as a variable composition molecules block? - I think yes*/ + fprintf(vf,"%% numSpecies\n"); +if(_UC._calctype_mol){ + for(i=0;i<_UC._var_nspecies;i++){ + for(j=0;j<_UC._nmolecules;j++){ + fprintf(vf,"%i ",_UC.numSpecies[j+i*_UC._nmolecules]); + } + fprintf(vf,"\n"); + } +}else{ + for(i=0;i<_UC._var_nspecies;i++){ + for(j=0;j<_UC._nspecies;j++){ + fprintf(vf,"%i ",_UC.numSpecies[j+i*_UC._nspecies]); + } + fprintf(vf,"\n"); } +} + fprintf(vf,"%% EndNumSpecies\n"); + is_w++; + } + if(_UC._calctype_mag){ + /*VER 10.1: magnetic calculation -> MagRatio mandatory*/ + __OUT_BK_DOUBLE(magRatio,"EndMagRatio",7); + } + if(_UC.ldaU!=NULL){ + /*VER 10.1: LDA+U values per species*/ + __OUT_BK_DOUBLE(ldaU,"EndLdaU",_UC._nspecies); + } + if(_UC.calculationMethod==US_CM_META) __OUT_DOUBLE(ExternalPressure); + else if(_UC.ExternalPressure!=0.) __OUT_DOUBLE(ExternalPressure); + /*print when NOT default or unset*/ +if(_UC.valences!=NULL){ + /*do not print valences if all of them are zero*/ + zero_check=FALSE;for(i=0;i<_UC._nspecies;i++) zero_check|=(_UC.valences[i]!=0); + if(zero_check && (_UC.valences!=NULL)) __OUT_BK_INT(valences,"endValences",_UC._nspecies); +} + if(_UC.goodBonds!=NULL) __OUT_TMAT_DOUBLE(goodBonds,"EndGoodBonds",_UC._nspecies);/*TODO: use of a single value is unsupported*/ + if(!_UC.checkMolecules) __OUT_BOOL(checkMolecules); + if(_UC.checkConnectivity) __OUT_BOOL(checkConnectivity); + if(_UC.fitLimit!=0.) __OUT_DOUBLE(fitLimit);/*VER 10.1*/ +vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* POPULATION *"); + __TITLE(line); + g_free(line); +if((_UC.calculationMethod != US_CM_VCNEB)&&(_UC.calculationMethod != US_CM_TPS)){ + if(_UC.populationSize!=0) __OUT_INT(populationSize); + if((_UC.initialPopSize>=0)&&(_UC.initialPopSize!=_UC.populationSize)) __OUT_INT(initialPopSize); + if(_UC.numGenerations!=100) __OUT_INT(numGenerations); + /*default stopCrit*/ + if(_UC._calctype_var) i=_UC.maxAt; + else {/*given the number numSpecies meaning, this should be revised*/ + i=0;for(j=0;j<_UC._nspecies;j++) i+=_UC.numSpecies[j]; + } + if((_UC.stopCrit!=i)&&(_UC.stopCrit!=0)) __OUT_INT(stopCrit); +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* SURVIVAL & SELECTION *"); + __TITLE(line); + g_free(line); + if(_UC.bestFrac!=0.7) __OUT_DOUBLE(bestFrac); + /*default keepBestHM*/ + i=(gint)(0.15*(_UC.populationSize)); + if((_UC.keepBestHM!=i)&&(_UC.keepBestHM!=0)) __OUT_INT(keepBestHM); + if(_UC.reoptOld) __OUT_BOOL(reoptOld); +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* VARIATION OPERATORS *"); + __TITLE(line); + g_free(line); + if(_UC.symmetries!=NULL) __OUT_BK_STRING(symmetries,"endSymmetries"); + if(_UC.fracGene!=0.5) __OUT_DOUBLE(fracGene); + if(_UC.fracRand!=0.2) __OUT_DOUBLE(fracRand); + if(_UC.fracTopRand!=0.2) __OUT_DOUBLE(fracTopRand);/*VER 10.1*/ + if((_UC._nspecies>1)&&(_UC.fracPerm!=0.1)) __OUT_DOUBLE(fracPerm); + if((_UC._nspecies==1)&&(_UC.fracPerm!=0.)) __OUT_DOUBLE(fracPerm); + if(_UC.fracAtomsMut!=0.1) __OUT_DOUBLE(fracAtomsMut); + if((_UC._calctype_dim==3)&&(_UC._calctype_mol)){ + if(_UC.fracRotMut!=0.1) __OUT_DOUBLE(fracRotMut); + }else{ + if(_UC.fracRotMut!=0.) __OUT_DOUBLE(fracRotMut); + } + if((_UC.FullRelax==0)||(_UC.optRelaxType==1)){ + if(_UC.fracLatMut!=0.) __OUT_DOUBLE(fracLatMut); + }else{ + if(_UC.fracLatMut!=0.1) __OUT_DOUBLE(fracLatMut); + } + if(_UC.fracSpinMut!=0.1) __OUT_DOUBLE(fracSpinMut);/*VER 10.1*/ + /*default howManySwaps*/ + k=0; + for(i=0;i<(_UC._nspecies-1);i++) + for(j=i+1;j<_UC._nspecies;j++) k+=MIN(_UC.numSpecies[i],_UC.numSpecies[j]); + k*=0.5; + if((_UC.howManySwaps!=k) && (_UC.howManySwaps!=0)) __OUT_INT(howManySwaps); + if(_UC.specificSwaps!=NULL) __OUT_BK_STRING(specificSwaps,"EndSpecific"); + if(_UC.mutationDegree!=0.) __OUT_DOUBLE(mutationDegree); + if(_UC.mutationRate!=0.5) __OUT_DOUBLE(mutationRate); + if(_UC.DisplaceInLatmutation!=1.0) __OUT_DOUBLE(DisplaceInLatmutation); + if(_UC.AutoFrac) __OUT_BOOL(AutoFrac); +}/*VCNEB,TPS don't require POPULATION, SURVIVAL & SELECTION, or VARIATION OPERATORS information*/ +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* CONSTRAINTS *"); + __TITLE(line); g_free(line); + if(_UC.minVectorLength!=0.) __OUT_DOUBLE(minVectorLength); +if(_UC.IonDistances!=NULL){ + /*do not print IonDistances if all of them are zero*/ + zero_check=FALSE;for(i=0;i<(_UC._nspecies*_UC._nspecies);i++) zero_check|=(_UC.IonDistances[i]!=0.0); + if(zero_check && (_UC.IonDistances!=NULL)) __OUT_TMAT_DOUBLE(IonDistances,"EndDistances",_UC._nspecies); +} + if(!_UC.constraint_enhancement) __OUT_BOOL(constraint_enhancement); + if(_UC.MolCenters!=NULL) __OUT_TMAT_DOUBLE(MolCenters,"EndMol",_UC._nmolecules); +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* CELL *"); + __TITLE(line); + g_free(line); +if((_UC.calculationMethod != US_CM_VCNEB)&&(_UC.calculationMethod != US_CM_TPS)){ + if((_UC._nlattice_line>0)&&(_UC.Latticevalues!=NULL)){ + if(_UC._calctype_var) { + /*should be 1 line*/ + __OUT_BK_DOUBLE(Latticevalues,"Endvalues",_UC._nlattice_vals); + }else{/*if more than one line -> rectangular matrix*/ + if(_UC._nlattice_line>1) __OUT_TMAT_DOUBLE(Latticevalues,"Endvalues",_UC._nlattice_vals); + else __OUT_BK_DOUBLE(Latticevalues,"Endvalues",_UC._nlattice_vals); + } + } + if((_UC._nsplits>1)&&(_UC.splitInto!=NULL)) __OUT_BK_INT(splitInto,"EndSplitInto",_UC._nsplits); +}/*VCNEB,TPS don't require CELL information*/ +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* RESTART *"); + __TITLE(line); + g_free(line); + if(_UC.pickUpYN) __OUT_BOOL(pickUpYN); + if(_UC.pickUpGen!=0) __OUT_INT(pickUpGen); + if(_UC.pickUpFolder!=0) __OUT_INT(pickUpFolder); +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* DETAILS OF AB INITIO CALCULATIONS *"); + __TITLE(line); + g_free(line); + if(_UC.abinitioCode!=NULL) { +/*NEW: deals with parenthesis*/ +/*if they are all false means the are all true*/ +zero_check=FALSE;for(i=0;i<_UC._num_opt_steps;i++) zero_check|=_UC._isfixed[i]; +if(!zero_check) + for(i=0;i<_UC._num_opt_steps;i++) + _UC._isfixed[i]=TRUE; + fprintf(vf,"%% abinitioCode\n"); + if(!_UC._isfixed[0]) fprintf(vf,"(%i",_UC.abinitioCode[0]);/*possible?*/ + else fprintf(vf,"%i",_UC.abinitioCode[0]); + for(i=1;i<(_UC._num_opt_steps);i++) { + if(_UC._isfixed[i]!=_UC._isfixed[i-1]) { + if(!_UC._isfixed[i]) fprintf(vf," (%i",_UC.abinitioCode[i]);/*has become not fixed*/ + else fprintf(vf,") %i",_UC.abinitioCode[i]);/*has become fixed (possible?)*/ + }else{ + fprintf(vf," %i",_UC.abinitioCode[i]);/*same as previous*/ + } + } + if(_UC._isfixed[_UC._num_opt_steps-1]) fprintf(vf,"\n");/*terminate on fixed ie. normal*/ + else fprintf(vf,")\n");/*terminate on non fixed*/ + fprintf(vf,"%% ENDabinit\n"); +/*restore previous values*/ +if(!zero_check) + for(i=0;i<_UC._num_opt_steps;i++) + _UC._isfixed[i]=FALSE; + is_w++; +//__OUT_BK_INT(abinitioCode,"ENDabinit",_UC._num_opt_steps); +} +/*do not print KresolStart if linearly = {0.2~0.08}*/ +zero_check=(_UC.KresolStart[0]!=0.2); +for(i=1;i<_UC._num_opt_steps;i++) zero_check|=(_UC.KresolStart[i]!=(0.2-(gdouble)(i)*(0.2-0.08)/(_UC._num_opt_steps-1))); + if(zero_check && (_UC.KresolStart!=NULL)) __OUT_BK_DOUBLE(KresolStart,"Kresolend",_UC._num_opt_steps); +/*do not print vacuumSize if all of them are 10. (default)*/ +zero_check=FALSE;for(i=0;i<_UC._num_opt_steps;i++) zero_check|=(_UC.vacuumSize[i]!=10.0); + if(zero_check && (_UC.vacuumSize!=NULL)) __OUT_BK_DOUBLE(vacuumSize,"endVacuumSize",_UC._num_opt_steps); + if(_UC.numParallelCalcs>1) __OUT_INT(numParallelCalcs); + if(_UC.numProcessors>1) __OUT_INT(numProcessors); +/*often commandExecutable (which should be mandatory) is omitted when abinitioCode==1 (VASP)*/ + if((_UC.abinitioCode[0]!=0)&&(_UC.commandExecutable!=NULL)) __OUT_BK_STRING(commandExecutable,"EndExecutable");/*let's be permissive*/ + if(_UC.whichCluster!=0) __OUT_INT(whichCluster); + if((_UC.whichCluster==2)&&(_UC.remoteFolder!=NULL)) __OUT_STRING(remoteFolder); + if(_UC.PhaseDiagram) __OUT_BOOL(PhaseDiagram); +/*note that mandatory block will always make is_w>0*/ +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* FINGERPRINT SETTINGS *"); + __TITLE(line); + g_free(line); + if(_UC.RmaxFing!=10.) __OUT_DOUBLE(RmaxFing); + if(_UC.deltaFing!=0.08) __OUT_DOUBLE(deltaFing); + if(_UC.sigmaFing!=0.03) __OUT_DOUBLE(sigmaFing); +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* ANTISEEDS SETTINGS *"); + __TITLE(line); + g_free(line); + if(_UC.antiSeedsActivation!=5000) __OUT_INT(antiSeedsActivation); + if(_UC.antiSeedsMax!=0.) __OUT_DOUBLE(antiSeedsMax); + if(_UC.antiSeedsSigma!=0.001) __OUT_DOUBLE(antiSeedsSigma); +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* SPACE GROUP DETERMINATION *"); + __TITLE(line); + g_free(line); + if((_UC._calctype_dim==3)&&(!_UC.doSpaceGroup)) __OUT_BOOL(doSpaceGroup); + if((_UC._calctype_dim!=3)&&(_UC.doSpaceGroup)) __OUT_BOOL(doSpaceGroup); + if(_UC.SymTolerance!=0.1) __OUT_DOUBLE(SymTolerance); +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* DEVELOPERS *"); + __TITLE(line); + g_free(line); + if(_UC.repeatForStatistics!=1) __OUT_INT(repeatForStatistics); + if(_UC.stopFitness!=0.) __OUT_DOUBLE(stopFitness);/*not necessarily used with repeatForStatistics?*/ + if(_UC.fixRndSeed!=0) __OUT_INT(fixRndSeed);/*VER 10.1*/ + if(_UC.collectForces) __OUT_BOOL(collectForces); +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* SELDOM *"); + __TITLE(line); + g_free(line); + if(!_UC.ordering_active) __OUT_BOOL(ordering_active); + if(_UC.symmetrize) __OUT_BOOL(symmetrize); + if(_UC.valenceElectr!=NULL) __OUT_BK_INT(valenceElectr,"endValenceElectr",_UC._nspecies); + if(_UC.percSliceShift!=1.0) __OUT_DOUBLE(percSliceShift); + if(_UC.dynamicalBestHM!=2) __OUT_INT(dynamicalBestHM); + if(_UC.softMutOnly!=NULL) __OUT_BK_STRING(softMutOnly,"EndSoftOnly"); + if(_UC.maxDistHeredity!=0.5) __OUT_DOUBLE(maxDistHeredity); + if(_UC.manyParents!=0) __OUT_INT(manyParents); + if(_UC.minSlice!=0.) __OUT_DOUBLE(minSlice); + if(_UC.maxSlice!=0.) __OUT_DOUBLE(maxSlice); + if(_UC.numberparents!=2) __OUT_INT(numberparents); +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* BOLTZTRAP *");/*VER 10.1*/ + __TITLE(line); + g_free(line); +if((_UC.calculationMethod != US_CM_VCNEB)&&(_UC.calculationMethod != US_CM_TPS)){ + if(_UC.BoltzTraP_T_max!=800.0) __OUT_DOUBLE(BoltzTraP_T_max); + if(_UC.BoltzTraP_T_delta!=50.0) __OUT_DOUBLE(BoltzTraP_T_delta); + if(_UC.BoltzTraP_T_efcut!=0.15) __OUT_DOUBLE(BoltzTraP_T_efcut); + if(_UC.TE_T_interest!=300.0) __OUT_DOUBLE(TE_T_interest); + if(_UC.TE_threshold!=0.5) __OUT_DOUBLE(TE_threshold); + if(_UC.TE_goal!=US_BT_ZT) { + switch (_UC.TE_goal){ + case US_BT_ZT:/*we should never get there...*/ + fprintf(vf,"ZT\t: TE_goal\n");is_w++; + break; + case US_BT_ZTxx: + fprintf(vf,"ZT_xx\t: TE_goal\n");is_w++; + break; + case US_BT_ZTyy: + fprintf(vf,"ZT_yy\t: TE_goal\n");is_w++; + break; + case US_BT_ZTzz: + fprintf(vf,"ZT_zz\t: TE_goal\n");is_w++; + break; + case US_BT_UNKNOWN: + default: + fprintf(vf,"???\t: TE_goal (unsupported keyword)\n");is_w++; + } + } +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* SURFACES *"); + __TITLE(line); + g_free(line); + if(_UC.thicknessS!=2.0) __OUT_DOUBLE(thicknessS); + if(_UC.thicknessB!=3.0) __OUT_DOUBLE(thicknessB); + if(_UC.reconstruct!=1) __OUT_INT(reconstruct); + if(_UC.StoichiometryStart!=NULL) __OUT_BK_INT(StoichiometryStart,"endStoichiometryStart",_UC._nspecies); +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* VARIABLE COMPOSITION *"); + __TITLE(line); + g_free(line); + if(_UC.firstGeneMax!=11) __OUT_INT(firstGeneMax); + /*minAt and maxAt are authorized outside of variable composition*/ + if(_UC.minAt!=0) __OUT_INT(minAt); + if(_UC.maxAt!=0) __OUT_INT(maxAt); + if(_UC.fracTrans!=0.1) __OUT_DOUBLE(fracTrans); + if(_UC.howManyTrans!=0.2) __OUT_DOUBLE(howManyTrans); + if(_UC.specificTrans!=NULL) __OUT_BK_INT(specificTrans,"EndTransSpecific",_UC._nspetrans); +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* METADYNAMICS *"); + __TITLE(line); + g_free(line); + if(_UC.GaussianWidth!=0.) __OUT_DOUBLE(GaussianWidth); + if(_UC.GaussianHeight!=0.) __OUT_DOUBLE(GaussianHeight); + if(_UC.FullRelax!=2) __OUT_INT(FullRelax); + if(_UC.maxVectorLength!=0.) __OUT_DOUBLE(maxVectorLength); +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* PARTICLE SWARM OPTIMIZATION (PSO) *"); + __TITLE(line); + g_free(line); + if(_UC.PSO_softMut!=1.) __OUT_DOUBLE(PSO_softMut); + if(_UC.PSO_BestStruc!=1.) __OUT_DOUBLE(PSO_BestStruc); + if(_UC.PSO_BestEver!=1.) __OUT_DOUBLE(PSO_BestEver); +}/*VCNEB,TPS don't require BOLTZTRAP, SURFACES, VARCOMP, METADYNAMICS, or PSO information*/ +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* VARIABLE-CELL NEB (VCNEB) *"); + __TITLE(line); + g_free(line); +if(_UC.calculationMethod==US_CM_VCNEB){ + if(_UC.vcnebType!=110) __OUT_INT(vcnebType); + if(_UC.numImages!=9) __OUT_INT(numImages); + if(_UC.numSteps!=200) __OUT_INT(numSteps); + if(_UC.optReadImages!=2) __OUT_INT(optReadImages); + if((_UC._vcnebtype_method==1)&&(_UC.optimizerType!=1)) __OUT_INT(optimizerType); + if((_UC._vcnebtype_method==2)&&(_UC.optimizerType!=2)) __OUT_INT(optimizerType); + if(_UC.optRelaxType!=3) __OUT_INT(optRelaxType); + if(_UC.dt!=0.05) __OUT_DOUBLE(dt); + if(_UC.ConvThreshold!=0.003) __OUT_DOUBLE(ConvThreshold); + if(_UC.VarPathLength!=0.) __OUT_DOUBLE(VarPathLength); + if(_UC.K_min!=5.) __OUT_DOUBLE(K_min); + if(_UC.K_max!=5.) __OUT_DOUBLE(K_max); + if(_UC.Kconstant!=5.) __OUT_DOUBLE(Kconstant); + if(_UC.optFreezing) __OUT_BOOL(optFreezing); + if(_UC.optMethodCIDI!=0) __OUT_INT(optMethodCIDI); + if(_UC.startCIDIStep!=100) __OUT_INT(startCIDIStep); + if(_UC.pickupImages!=NULL) __OUT_BK_INT(pickupImages,"EndPickupImages",_UC._npickimg); + if(_UC.FormatType!=2) __OUT_INT(FormatType); + if(_UC.PrintStep!=1) __OUT_INT(PrintStep); +} +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ +is_w=0; + line=g_strdup_printf("* TRANSITION PATH SAMPLING (TPS) *");/*VER 10.1*/ + __TITLE(line); + g_free(line); +if(_UC.calculationMethod==US_CM_TPS){/*because some values don't have default*/ + if(_UC.numIterations!=1000) __OUT_INT(numIterations); + if(_UC.speciesSymbol!=NULL) __OUT_BK_STRING(speciesSymbol,"EndSpeciesSymbol"); + if(_UC.mass!=NULL) __OUT_BK_DOUBLE(mass,"endMass",_UC._nspecies); + if((_UC.amplitudeShoot[0]!=0.10)&&(_UC.amplitudeShoot[1]!=0.10)) __OUT_BK_DOUBLE(amplitudeShoot,"EndAmplitudeShoot",2); + if((_UC.magnitudeShoot[0]!=1.05)&&(_UC.magnitudeShoot[1]!=1.05)) __OUT_BK_DOUBLE(magnitudeShoot,"EndMagnitudeShoot",2); + if(_UC.shiftRatio!=0.1) __OUT_DOUBLE(shiftRatio); + if(!_UC.orderParaType) __OUT_BOOL(orderParaType); + if((_UC.opCriteria[0]!=0.)&&(_UC.opCriteria[1]!=0.)) __OUT_BK_DOUBLE(opCriteria,"EndOpCriteria",2); + if(_UC.cmdOrderParameter!=NULL) __OUT_BK_STRING(cmdOrderParameter,"EndCmdOrderParameter"); + if(_UC.cmdEnthalpyTemperature!=NULL) __OUT_BK_STRING(cmdEnthalpyTemperature,"EndCmdEnthalpyTemperature"); + if(_UC.orderParameterFile!=NULL) __OUT_STRING(orderParameterFile); + if(_UC.enthalpyTemperatureFile!=NULL) __OUT_STRING(enthalpyTemperatureFile); + if(_UC.trajectoryFile!=NULL) __OUT_STRING(trajectoryFile); + if(_UC.MDrestartFile!=NULL) __OUT_STRING(MDrestartFile); +} +if(is_w==0) fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ +else vfpos=ftell(vf);/* flag */ + line=g_strdup_printf("* END OF FILE *"); + __TITLE(line); + g_free(line); + fprintf(vf,"EOFEOFEOF\n"); + /*remove the garbage after EOFEOFEOF*/ + rewind(vf); line = file_read_line(vf); - } -/*other parameters will be filled later for gui_uspex */ - - - -/*end of Parameters.txt read*/ + while(line){ + if(find_in_string("EOFEOFEOF",line) != NULL) break; + fprintf(dest,"%s",line); + g_free(line); + line = file_read_line(vf); + } + if(line) g_free(line); + /*there might be some garbage on the file after this point*/ + fclose(vf); + fclose(dest); return 0; +#undef __TITLE +#undef __OUT_BOOL +#undef __OUT_INT +#undef __OUT_DOUBLE +#undef __OUT_STRING +#undef __OUT_BK_INT +#undef __OUT_BK_DOUBLE +#undef __OUT_BK_STRING +#undef __OUT_TMAT_DOUBLE } - +/************************/ +/* NEW Read Individuals */ +/************************/ gint read_individuals_uspex(gchar *filename, struct model_pak *model){ - FILE *vf; - long int vfpos; - gchar *line=NULL; - gchar tmp[64]; - uspex_calc_struct *uspex_calc=model->uspex; - /* specific */ - gint idx=0; + FILE *vf; + gchar *line=NULL; + uspex_output_struct *uspex_output=model->uspex; + /* specific */ gchar *ptr; - gint max_struct; - gint red_index; - /*since energy is sometimes eV, and sometimes eV/atom ?*/ - gboolean e_red=FALSE; + gchar *ptr2; + gint gen; + gint idx,jdx; + gboolean e_red=FALSE;/*FALSE -> eV ; TRUE -> eV/atom*/ /*start*/ - vf = fopen(filename, "rt"); - if (!vf) return 1; - /*Have fitness? Better watch for each case...*/ - /*^^^^ I thought that calculationMethod = USPEX => fitness, but got defeated by EX19*/ + vf = fopen(filename, "rt"); + if (!vf) return -1;/*fail*/ line = file_read_line(vf); - if (find_in_string("Fitness",line) != NULL) _UC.have_fitness=TRUE; - else _UC.have_fitness=FALSE; - rewind(vf); - /* deal with the problematic units */ - if(fetch_in_file(vf,"eV/atom")!=0) e_red=TRUE; - rewind(vf); - /* Skip header: FIX a _BUG_ when Individuals file sometimes has 2 line and sometimes only 1 */ - vfpos=ftell(vf);/* flag */ - line = file_read_line(vf); - while(line){ - ptr=&(line[0]); - while(*ptr==' ') ptr++; - if(g_ascii_isdigit(*ptr)) { - fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ - break; - } - vfpos=ftell(vf);/* flag */ - g_free(line); - line = file_read_line(vf); - } - if(line==NULL) return -1; - /* META calculation have a gen=0 Individual - unfortunately, it is *not* in the gather- - -POSCARS file, so we ignore gen=0 for now. */ - if(_UC.method==US_CM_META){ - g_free(line); - line = file_read_line(vf); - vfpos=ftell(vf);/* flag */ +// _UO.have_fitness=FALSE; + _UO.have_supercell=FALSE; +// if(find_in_string("Fitness",line) != NULL) _UO.have_fitness=TRUE; + if(find_in_string("SuperCell",line) !=NULL){ + /*it's not about natoms, it's about supercell*/ + _UO.have_supercell=TRUE; } - /*do a 1st pass to count stuctures*/ - _UC.num_struct=0; - while (line){ - _UC.num_struct++; - sscanf(line," %*i %i %*s",&idx); - if(idx>max_struct) max_struct=idx; +/* Fitness is currently not activated due to a lack of consitency with some results */ + if (find_in_string("eV/atom",line) != NULL) e_red=TRUE; + g_free(line); + line = file_read_line(vf); + if (find_in_string("eV/atom",line) != NULL) e_red=TRUE;/*just in case it's on the second line*/ + ptr=&(line[0]); + __SKIP_BLANK(ptr); + while(!g_ascii_isdigit(*ptr)){ + /*skip additionnal header lines*/ g_free(line); line = file_read_line(vf); + ptr=&(line[0]); + __SKIP_BLANK(ptr); } - _UC.num_struct--; - fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ - line = file_read_line(vf); - /* now prepare arrays <- JOB=USPEX/300 example */ - if(_UC.num_struct==0) return 1; - _UC.red_index=g_malloc(max_struct*sizeof(gint)); - for(idx=0;idx_UC.num_gen) _UC.num_gen=_UC.ind[idx].gen; - _UC.red_index[red_index]=idx; - if(!e_red) _UC.ind[idx].E=_UC.ind[idx].energy/_UC.ind[idx].natoms; - else _UC.ind[idx].E=_UC.ind[idx].energy; +/* This is the definition of all columns of Individuals, according to USPEX examples +USPEX Gen ID Origin Composition Enthalpy Volume Density Fitness KPOINTS SYMM Q_entr A_order S_order +mag_US Gen ID Origin Composition Enthalpy Volume Density Fitness KPOINTS SYMM Q_entr A_order S_order Magmom-Type +gMETA Gen ID SuperCell Enthalpy(eV/at) Volume(A^3/at) KPOINTS SYMMETRY +META Gen ID Composition Enthalpy(eV/at) Volume(A^3/at) KPOINTS SYMMETRY +MINHOP Gen ID Composition Enthalpy(eV/at) Volume(A^3/at) KPOINTS SYMMETRY +EX19? Gen ID Origin Composition Enthalpy(eV) V(A^3) KPOINTS SYMM Q_entro A_ord S_ord +*/ + _UO.num_gen=0; + _UO.min_E=+1./0.;_UO.max_E=-1./0.; + _UO.min_F=+1./0.;_UO.max_F=-1./0.; + while(line){ + ptr=&(line[0]); + __SKIP_BLANK(ptr); + /*get gen*/ + gen=(gint)g_ascii_strtoull(ptr,&ptr2,10); + if(ptr2==NULL) goto end_loop_ind; +#if DEBUG_USPEX_READ +fprintf(stdout,"#DBG: read_ind: gen=%i ",gen); +#endif + if(gen>_UO.num_gen) _UO.num_gen=gen; + ptr=ptr2+1; + __SKIP_BLANK(ptr); + /*get index*/ + idx=(gint)g_ascii_strtoull(ptr,&ptr2,10); + if(ptr2==NULL) goto end_loop_ind; +#if DEBUG_USPEX_READ +fprintf(stdout,"idx=%i ",idx); +#endif + _UO.ind[idx].gen=gen; + ptr=ptr2+1; + /*jump to [ ... ] part*/ + while((*ptr!='[')&&(*ptr!='\0')) ptr++; + if(*ptr=='\0') goto end_loop_ind; + _UO.ind[idx].natoms=0;ptr2=ptr;jdx=0; +#if DEBUG_USPEX_READ +fprintf(stdout,"[ "); +#endif +if(!_UO.have_supercell){ + while((ptr2!=NULL)&&(*ptr2!='\0')&&(jdx<_UO.calc->_nspecies)){ + ptr=ptr2+1; + __SKIP_BLANK(ptr); + _UO.ind[idx].atoms[jdx]=(gint)g_ascii_strtoull(ptr,&ptr2,10); +#if DEBUG_USPEX_READ +fprintf(stdout,"%i ",_UO.ind[idx].atoms[jdx]); +#endif + _UO.ind[idx].natoms+=_UO.ind[idx].atoms[jdx]; + jdx++; + } + if(*ptr2=='\0') goto end_loop_ind; +#if DEBUG_USPEX_READ +fprintf(stdout,"] natm=%i ",_UO.ind[idx].natoms); +#endif + ptr=ptr2+1; + __SKIP_BLANK(ptr); +}else{ + /*supercell automagic*/ + ptr=ptr2+1;jdx=1; + while((*ptr!=']')&&(*ptr!='\0')){ + __SKIP_BLANK(ptr); + jdx*=(gint)g_ascii_strtoull(ptr,&ptr2,10); + ptr=ptr2+1; + __SKIP_BLANK(ptr); + } + _UO.ind[idx].natoms=(gdouble)jdx;/*temporary*/ #if DEBUG_USPEX_READ -fprintf(stdout,"#DBG: USPEX[Individual]: GEN=%i STRUCT=%i e=%lf n_atom=%i E=%lf\n",_UC.ind[idx].gen,idx+1,_UC.ind[idx].energy,_UC.ind[idx].natoms,_UC.ind[idx].E); +fprintf(stdout," x%i ] ",_UO.ind[idx].natoms); +#endif +} + /*we should be at *ptr==']' (hopefully)*/ + if(*ptr==']') ptr++; + __SKIP_BLANK(ptr); + /*get enthalpy*/ + _UO.ind[idx].energy=g_ascii_strtod(ptr,&ptr2); + if(ptr2==NULL) goto end_loop_ind; +#if DEBUG_USPEX_READ +fprintf(stdout,"e=%lf ",_UO.ind[idx].energy); +#endif + if(!e_red) _UO.ind[idx].E=_UO.ind[idx].energy/_UO.ind[idx].natoms; + else _UO.ind[idx].E=_UO.ind[idx].energy; +#if DEBUG_USPEX_READ +fprintf(stdout,"e/atm=%lf ",_UO.ind[idx].E); +#endif + if(_UO.ind[idx].E<_UO.min_E) _UO.min_E=_UO.ind[idx].E; + if(_UO.ind[idx].E>_UO.max_E) _UO.max_E=_UO.ind[idx].E; + ptr=ptr2+1; + __SKIP_BLANK(ptr); + /*get volume*/ + _UO.ind[idx].volume=g_ascii_strtod(ptr,&ptr2); + if(ptr2==NULL) goto end_loop_ind; +#if DEBUG_USPEX_READ +fprintf(stdout,"v=%lf ",_UO.ind[idx].volume); +#endif + /*from this point we can say that we have data*/ + _UO.ind[idx].have_data=TRUE; + if(_UO.calc->calculationMethod==US_CM_META) goto get_symmetry; + if(_UO.calc->calculationMethod==US_CM_MINHOP) goto get_symmetry; + ptr=ptr2+1; + __SKIP_BLANK(ptr); + /*get density -- example 19 will fail here! (USPEX 10.0.0)*/ + _UO.ind[idx].density=g_ascii_strtod(ptr,&ptr2); + if(ptr2==NULL) goto end_loop_ind; +#if DEBUG_USPEX_READ +fprintf(stdout,"d=%lf ",_UO.ind[idx].density); +#endif + ptr=ptr2+1; + __SKIP_BLANK(ptr); + /*get fitness*/ + _UO.ind[idx].fitness=10000; + _UO.ind[idx].fitness=g_ascii_strtod(ptr,&ptr2); + if(ptr2==NULL) goto end_loop_ind; +#if DEBUG_USPEX_READ +fprintf(stdout,"f=%lf ",_UO.ind[idx].fitness); +#endif + if(_UO.ind[idx].fitness<_UO.min_F) _UO.min_F=_UO.ind[idx].fitness; + if(_UO.ind[idx].fitness>_UO.max_F) _UO.max_F=_UO.ind[idx].fitness; + ptr=ptr2+1; + __SKIP_BLANK(ptr); + /*get SYMM (skip KPOINTS)*/ +get_symmetry: + while((*ptr!=']')&&(*ptr!='\0')) ptr++; + if(*ptr=='\0') goto end_loop_ind; + ptr++; + __SKIP_BLANK(ptr); + _UO.ind[idx].symmetry=(gint)g_ascii_strtoull(ptr,NULL,10); +#if DEBUG_USPEX_READ +fprintf(stdout,"sym=%i ",_UO.ind[idx].symmetry); +#endif + /*-> ignore the "N/A" possibility on symmetry*/ +end_loop_ind: +#if DEBUG_USPEX_READ +fprintf(stdout,"\n"); #endif - if(_UC.ind[idx].E<_UC.min_E) _UC.min_E=_UC.ind[idx].E; - if(_UC.ind[idx].E>_UC.max_E) _UC.max_E=_UC.ind[idx].E; g_free(line); line = file_read_line(vf); - idx++; } - /*all done*/ return 0; } - +/**********************************************************************************/ +/* Read uspex output */ +/* Require several files: OUTPUT.txt, Parameters.txt + calculation specific files.*/ +/**********************************************************************************/ gint read_output_uspex(gchar *filename, struct model_pak *model){ gchar *line; FILE *vf; @@ -287,25 +2433,34 @@ gint read_output_uspex(gchar *filename, struct model_pak *model){ gint idx; gint jdx; gint min,max,med; - gint job; - /* results */ - FILE *f_src; - FILE *f_dest; - gdouble *e; - gdouble *c; - gdouble *tag; - gdouble *tmp; - gdouble compo; - gint n_compo; - gint skip=0; - gint gen=1; + uspex_method method; + gint nspecies; gint num; - gint natoms; - gint species_index; + gint *atom_n; + gint max_num_p; + gint max_num_i; + gint n_data; + /*graph*/ + gint gen; gdouble min_E; - gdouble min_F; gdouble max_E; + g_data_x gx; + g_data_y gy; + /*VARCOMP*/ + gint n_compo; + gdouble compo; + gint c_sum; + gdouble *c; + gdouble *c_min; + gint32 *c_idx; + graph_symbol *c_sym; + gint species_index; + /* results */ + FILE *f_src; + FILE *f_dest; + gint natoms=0; gchar *atoms; + uspex_output_struct *uspex_output; uspex_calc_struct *uspex_calc; /* checks */ g_return_val_if_fail(model != NULL, 1); @@ -318,11 +2473,15 @@ gint read_output_uspex(gchar *filename, struct model_pak *model){ } /*allocs*/ if(model->uspex!=NULL) g_free(model->uspex); - model->uspex=g_malloc(sizeof(uspex_calc_struct)); - uspex_calc=model->uspex; - /* TODO: check that selected file is OUTPUT.txt */ + model->uspex=g_malloc(sizeof(uspex_output_struct)); + uspex_output=model->uspex; vf = fopen(filename, "rt"); - if (!vf) return 1; + if (!vf) { + line = g_strdup_printf("ERROR: Can't open USPEX OUTPUT.txt file!\n"); + gui_text_show(ERROR, line); + g_free(line); + return -1; + } error_table_clear(); /* --- get result folder*/ res_folder=g_strdup (filename); @@ -334,466 +2493,817 @@ gint read_output_uspex(gchar *filename, struct model_pak *model){ /* --- setup environment */ sysenv.render.show_energy = TRUE; -/* --- read the system OUTPUT.txt (will be confirmed by Parameters.txt)*/ - if(fetch_in_file(vf,"Version")==0){ - /*can't get version number (10.0.0 example will fail here)*/ - /* -> just produce a warning... file might actually be processed correctly*/ - line = g_strdup_printf("WARNING: USPEX version unsupported!\n"); - gui_text_show(WARNING, line); +/* --- read the system OUTPUT.txt - actually only read Version, {VCNEB,TPS}, and nspecies*/ + _UO.version=0;method=US_CM_UNKNOWN;nspecies=0; + line = file_read_line(vf); + while(line) { + ptr=NULL; + ptr=find_in_string("Version",line); + if(ptr!=NULL){ + /*we find version tag*/ + while((*ptr!='\0')&&(!g_ascii_isdigit(*ptr))) ptr++; + if(!g_ascii_isdigit(*ptr)){/*malformed Version tag*/ + g_free(line); + line = g_strdup_printf("WARNING: wrong USPEX Version tag!\n"); + gui_text_show(WARNING, line); + }else{ + min=0;med=0;max=0; + ptr2=NULL; + max=g_ascii_strtoull(ptr,&ptr2,10); + ptr=NULL; + if(ptr2!=NULL) med=(gint)g_ascii_strtoull(ptr2+1,&ptr,10); + if(ptr!=NULL) min=(gint)g_ascii_strtoull(ptr+1,NULL,10); + _UO.version=min+10*med+100*max; + } + g_free(line); + line = file_read_line(vf); + continue; + } + ptr=find_in_string("- USPEX",line); + if(ptr!=NULL){ + /* Version 10.0.0 have a strange format: + * USPEX 10.0.0 (mm/dd/yyyy) + * so we need to check for this one too.*/ + ptr=ptr+2; + while((*ptr!='\0')&&(!g_ascii_isdigit(*ptr))) ptr++; + if(!g_ascii_isdigit(*ptr)){/*malformed Version tag*/ + /*but we IGNORE it since it can be a valid tag which is not a Version*/ + }else{ + min=0;med=0;max=0; + ptr2=NULL; + max=g_ascii_strtoull(ptr,&ptr2,10); + ptr=NULL; + if(ptr2!=NULL) med=(gint)g_ascii_strtoull(ptr2+1,&ptr,10); + if(ptr!=NULL) min=(gint)g_ascii_strtoull(ptr+1,NULL,10); + _UO.version=min+10*med+100*max; + } + g_free(line); + line = file_read_line(vf); + continue; + } + if(find_in_string("VCNEB",line) != NULL) { + method=US_CM_VCNEB; + g_free(line); + line = file_read_line(vf); + continue; + } + if(find_in_string("Transition Path Sampling",line) != NULL) {/*VER 10.1*/ + method=US_CM_TPS; + g_free(line); + line = file_read_line(vf); + continue; + } + if(find_in_string("types of atoms in the system",line) != NULL){ + /*detect nspecies*/ + ptr=&(line[0]); + while((*ptr!='\0')&&(!g_ascii_isdigit(*ptr))) ptr++; + if(!g_ascii_isdigit(*ptr)){/*malformed atom type tag*/ + /*let's ignore*/ + }else{ + nspecies=(gint)g_ascii_strtoull(ptr,NULL,10); + } + g_free(line); + line = file_read_line(vf); + continue; + } g_free(line); + line = file_read_line(vf); + } + if(line!=NULL) g_free(line); +#if DEBUG_USPEX_READ +fprintf(stdout,"#DBG: FILE: %s VERS: %i NSPE: %i\n",filename,_UO.version,nspecies); +#endif + if(_UO.version==0){ + line=g_strdup_printf("USPEX version undetected!\n"); + gui_text_show(ERROR, line); + }else if(_UO.version==944){ + line=g_strdup_printf("USPEX version %i detected!\n",_UO.version); + gui_text_show(STANDARD, line); + }else if(_UO.version==1010){ + line=g_strdup_printf("USPEX new version %i detected!\n",_UO.version); + gui_text_show(STANDARD, line); }else{ - rewind(vf); + line=g_strdup_printf("USPEX unsupported version %i detected!\n",_UO.version); + gui_text_show(WARNING, line); + } + g_free(line); + if((method==US_CM_UNKNOWN)&&(nspecies==0)){ + line=g_strdup_printf("USPEX OUTPUT.txt is missing nspecies information!\n"); + gui_text_show(WARNING, line); + } +/* --- and close */ + fclose(vf);vf=NULL; +/* --- READ Parameters.txt */ + aux_file = g_strdup_printf("%s%s",res_folder,"Parameters.txt"); + _UO.calc=read_uspex_parameters(aux_file,nspecies); + if(_UO.calc==NULL){ + line = g_strdup_printf("ERROR: reading USPEX REAL Parameter.txt file!\n"); + gui_text_show(ERROR, line); + g_free(line); + g_free(aux_file); + goto uspex_fail; + } + g_free(aux_file); + uspex_calc=_UO.calc; + _UC.path=g_strdup(res_folder); +/* --- ANYTHING but VCNEB, and TPS (and unsupported)*/ +if((_UC.calculationMethod==US_CM_USPEX) + ||(_UC.calculationMethod==US_CM_META) + ||(_UC.calculationMethod==US_CM_PSO) + ||(_UC.calculationMethod==US_CM_MINHOP)){ +/* +++ check gatheredPOSCARS*/ + if((_UC.calculationMethod==US_CM_META)||(_UC.calculationMethod==US_CM_MINHOP)) aux_file = g_strdup_printf("%s%s",res_folder,"gatheredPOSCARS_relaxed"); + else aux_file = g_strdup_printf("%s%s",res_folder,"gatheredPOSCARS"); + vf = fopen(aux_file, "rt"); + if (!vf) { + if((_UC.calculationMethod==US_CM_META)||(_UC.calculationMethod==US_CM_MINHOP)) + line = g_strdup_printf("ERROR: can't open USPEX gatheredPOSCARS_relaxed file!\n"); + else line = g_strdup_printf("ERROR: can't open USPEX gatheredPOSCARS file!\n"); + gui_text_show(ERROR, line); + g_free(line); + g_free(aux_file); + goto uspex_fail; + } + strcpy(model->filename,aux_file);// which means that we "forget" about OUTPUT.txt + g_free(aux_file); + /*seems good so far*/ + g_free(model->basename); + model->basename=g_strdup_printf("uspex"); + model->num_frames=0; +/* +++ register frames, calculate max_struct (according to gatherPOSCARS - it can change)*/ + num=0;max_num_p=0; + vfpos=ftell(vf);/* flag */ +/* +++ frame_0 exists (but is not part of gathered_POSCARS) in case of META calculation*/ + /*for now, just duplicate the first one (until we find out if this information is available somewhere in results)*/ + add_frame_offset(vf, model); + model->num_frames++; + line = file_read_line(vf); +/* +++ in case of supercell calculation, we need to get a real natoms, and rescale accordingly*/ + idx=0; + while((idx<6)&&(!feof(vf))){ + idx++; + g_free(line); line = file_read_line(vf); - while(line) { - if (find_in_string("Version",line) != NULL){ - sscanf(line,"| Version %i.%i.%i %*s",&(max),&(med),&(min)); - _UC.version=min+10*med+100*max; - if(_UC.version!=944){ - g_free(line); - line = g_strdup_printf("WARNING: USPEX version %i unsupported!\n",_UC.version); - gui_text_show(WARNING, line); - - } - g_free(line); - break; - } + } + ptr=&(line[0]); + atom_n=g_malloc(_UO.calc->_nspecies*sizeof(gint)); + natoms=0; + jdx=0; + while((*ptr!='\0')&&(*ptr!='\n')){ + __SKIP_BLANK(ptr); + /*we also need a ratio for supercell calculations*/ + atom_n[jdx]=(gint)g_ascii_strtoull(ptr,&ptr2,10); + natoms+=atom_n[jdx]; + ptr=ptr2+1; + jdx++; + } + /*all done*/ + num=0; + rewind(vf); + line = file_read_line(vf); + while(!feof(vf)){ + ptr=&(line[0]); + if((*ptr=='E')&&(*(ptr+1)=='A')) { + ptr=ptr+2; + num=(gint)g_ascii_strtoull(ptr,NULL,10); + if(num>max_num_p) max_num_p=num; + fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ + add_frame_offset(vf, model); + model->num_frames++; g_free(line); line = file_read_line(vf); } + g_free(line); + vfpos=ftell(vf);/* flag */ + line = file_read_line(vf); } - rewind(vf); - job=0; - if(fetch_in_file(vf,"Block for system description")==0) { -/*since VCNEB will fail here due to a non-unified OUTPUT.txt format - *we need to be a little more permissive... */ - rewind(vf); - if(fetch_in_file(vf,"VCNEB")==0) goto uspex_fail;/*definitely wrong*/ - job=-1; - } -if(job>-1){ - /*next line contains Dimensionality*/ - ix=0; +/* +++ challenge the max_num_p with Individuals max_num_i*/ + fclose(vf); + aux_file = g_strdup_printf("%s%s",res_folder,"Individuals"); + vf = fopen(aux_file, "rt"); + if (!vf) { + line = g_strdup_printf("ERROR: can't open USPEX Individuals file!\n"); + gui_text_show(ERROR, line); + g_free(line); + g_free(aux_file); + goto uspex_fail; + } + g_free(aux_file); + num=0;max_num_i=0; line = file_read_line(vf); - /*unless from a previous version and it contains a lot of '-' character*/ - if (find_in_string("Dimensionality",line) == NULL) { + while(!feof(vf)){ + ptr=&(line[0]); + __SKIP_BLANK(ptr); + num=(gint)g_ascii_strtoull(ptr,&(ptr2),10); + if(ptr2!=NULL) { + num=0; + ptr=ptr2+1; + __SKIP_BLANK(ptr); + num=(gint)g_ascii_strtoull(ptr,NULL,10); + if(num>max_num_i) max_num_i=num; + } g_free(line); line = file_read_line(vf); } - sscanf(line," Dimensionality : %i ",&(ix)); - switch (ix){/*to be use later*/ - case -2: - /*we do not deal with 2D crystal yet*/ - case 0: - case 1: - case 2: - case 3: - _UC.dim=ix; - break; - default: - line = g_strdup_printf("ERROR: reading USPEX OUTPUT.txt file!\n"); + if(max_num_p idx ind*/ + fclose(vf); +/* +++ alloc/prepare the Ind array!*/ + _UO.ind=g_malloc(_UO.num_struct*sizeof(uspex_individual)); + for(idx=0;idx<_UO.num_struct;idx++) { + _UO.ind[idx].have_data=FALSE; + _UO.ind[idx].struct_number=-1; + _UO.ind[idx].gen=0; + _UO.ind[idx].natoms=0; + _UO.ind[idx].atoms=g_malloc(_UO.calc->_nspecies*sizeof(gint)); + _UO.ind[idx].energy=0.; + _UO.ind[idx].E=0.; + _UO.ind[idx].fitness=0.; + _UO.ind[idx].volume=0.; + _UO.ind[idx].density=0.; + _UO.ind[idx].symmetry=0; + } + /*exept for META, _UO.ind[0] will contain no data!*/ +/* +++ load Individuals*/ +/* ^^^ NEW: everyone reads Individuals first, then Individuals_relaxed (if exists)*/ + aux_file = g_strdup_printf("%s%s",res_folder,"Individuals"); + if(read_individuals_uspex(aux_file,model)!=0) { + line = g_strdup_printf("ERROR: reading USPEX Individuals_relaxed file!\n"); gui_text_show(ERROR, line); g_free(line); + g_free(aux_file); goto uspex_fail; } - job=ix*100; - g_free(line); - /*next line contains Molecular*/ - line = file_read_line(vf); - sscanf(line," Molecular : %i %*s",&(ix)); - job+=(ix*10); - if(ix==0) _UC.mol=FALSE; - else if(ix==1) _UC.mol=TRUE; - else{ - line = g_strdup_printf("ERROR: reading USPEX OUTPUT.txt file!\n"); + g_free(aux_file); + if(_UO.have_supercell){ + /*rescale atoms,natoms in case of a supercell calculation NOTE: first supercell has to be [1,1,1]*/ + for(idx=0;idx<_UO.num_struct;idx++) { + for(jdx=0;jdx<_UO.calc->_nspecies;jdx++) _UO.ind[idx].atoms[jdx]=atom_n[jdx]*_UO.ind[idx].natoms; + _UO.ind[idx].natoms*=natoms; + } + } + g_free(atom_n); + aux_file = g_strdup_printf("%s%s",res_folder,"Individuals_relaxed"); + if(read_individuals_uspex(aux_file,model)!=0) { + /*failure to load Individuals_relaxed is not an error, thus not fatal*/ + if((_UC.calculationMethod==US_CM_META)||(_UC.calculationMethod==US_CM_MINHOP)){ + line = g_strdup_printf("WARNING: error reading USPEX Individuals_relaxed file!\n"); + gui_text_show(WARNING, line); + g_free(line); + } + } + g_free(aux_file); + n_data=0;for(idx=0;idx<_UO.num_struct;idx++) if(_UO.ind[idx].have_data) n_data++; +/* +++ get gatherPOSCARS information for have_data=FALSE (is any)*/ + if((_UC.calculationMethod==US_CM_META)||(_UC.calculationMethod==US_CM_MINHOP)) + aux_file = g_strdup_printf("%s%s",res_folder,"gatheredPOSCARS_relaxed"); + else aux_file = g_strdup_printf("%s%s",res_folder,"gatheredPOSCARS"); + vf = fopen(aux_file, "rt"); + if (!vf) { + if((_UC.calculationMethod==US_CM_META)||(_UC.calculationMethod==US_CM_MINHOP)) + line = g_strdup_printf("ERROR: can't re-open USPEX gatheredPOSCARS_relaxed file?!\n"); + else line = g_strdup_printf("ERROR: can't re-open USPEX gatheredPOSCARS file?!\n"); gui_text_show(ERROR, line); g_free(line); + g_free(aux_file); goto uspex_fail; } - g_free(line); - /*next line contains Variable Composition*/ + g_free(aux_file); + idx=0; +/* +++ get atomTypes if missing from Paramters.txt <- and this is bad*/ +if(_UC.atomType==NULL){ line = file_read_line(vf); - sscanf(line," Variable Composition : %i %*s",&(ix)); - job+=ix; - if(ix==0) _UC.var=FALSE; - else if(ix==1) _UC.var=TRUE; - else{ - line = g_strdup_printf("ERROR: reading USPEX OUTPUT.txt file!\n"); + while((idx<5)&&(!feof(vf))){ + idx++; + g_free(line); + line = file_read_line(vf); + } + if(line){ + ptr=&(line[0]); + num=0;__COUNT_ALNUM(ptr,num); + _UC.atomType=g_malloc(num*sizeof(gint)); + ptr=&(line[0]); + for(idx=0;idxbasename=g_strdup_printf("uspex"); -/* we have to open structure file first because of inconsistency in atom reporting in Individuals file*/ -/* --- READ gatheredPOSCARS <- this is going to be the main model file */ -/* ^^^ META: If gatheredPOSCARS_relaxed exists, read it instead */ - if(_UC.method==US_CM_META) { - aux_file = g_strdup_printf("%s%s",res_folder,"gatheredPOSCARS_relaxed"); - vf = fopen(aux_file, "rt"); - if (!vf) aux_file = g_strdup_printf("%s%s",res_folder,"gatheredPOSCARS"); - else fclose(vf); - }else{ - aux_file = g_strdup_printf("%s%s",res_folder,"gatheredPOSCARS"); - } - vf = fopen(aux_file, "rt"); - if (!vf) { - if(_UC.ind!=NULL) g_free(_UC.ind); - line = g_strdup_printf("ERROR: can't open USPEX gatheredPOSCARS file!\n"); - gui_text_show(ERROR, line); - g_free(line); - goto uspex_fail; - } - /*count number of structures*/ - _UC.num_struct=0; + /*count the number of BEST structures*/ + line = file_read_line(vf);/*TITLE LINE, DISCARD*/ + g_free(line); + vfpos=ftell(vf);/* flag */ line = file_read_line(vf); - while(!feof(vf)){ - if((line[0]=='E')&&(line[1]=='A')) _UC.num_struct++; + ptr=&(line[0]); + __SKIP_BLANK(ptr); + while(!g_ascii_isdigit(*ptr)){ + /*skip additionnal header lines*/ g_free(line); + vfpos=ftell(vf);/* flag */ line = file_read_line(vf); + ptr=&(line[0]); + __SKIP_BLANK(ptr); } - rewind(vf); - model->num_frames=0; - vfpos=ftell(vf);/* flag */ - line = file_read_line(vf); - _UC.ind=g_malloc((_UC.num_struct)*sizeof(uspex_individual)); - idx=0;ix=-1; - while(!feof(vf)){ - if((line[0]=='E')&&(line[1]=='A')) { - idx=0;ix++; - fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ - add_frame_offset(vf, model); - model->num_frames++; - g_free(line); - line = file_read_line(vf); - } - if(idx==5){/*calculate number of species and atoms*/ - _UC.ind[ix].atoms=g_malloc(_UC.nspecies*sizeof(gint)); - for(jdx=0;jdx<_UC.nspecies;jdx++) _UC.ind[ix].atoms[jdx]=0;/*init atoms*/ - _UC.ind[ix].natoms=0; - /*get this structure nspecies*/ - ptr=&(line[0]); - while(*ptr==' ') ptr++;/*skip initial space (if any)*/ - jdx=1;/*there is at least one species*/ - while(*ptr!='\0'){ - if(*ptr==' ') { - jdx++;ptr++; - while(*ptr==' ') ptr++;/*skip space*/ - }else ptr++; - } - if(jdx<_UC.nspecies){ - gchar *line2;/*double buffer*/ - /*we need to know which species is here*/ - line2 = file_read_line(vf); - ptr=&(line[0]); - ptr2=&(line2[0]); - idx++; - jdx=0; - while(*ptr==' ') ptr++;/*skip initial space (if any)*/ - while(*ptr2==' ') ptr2++;/*skip initial space (if any)*/ - while((*ptr!='\0')&&(*ptr2!='\0')){ - /*get the correct jdx number*/ - jdx=0;/*we reset jdx to cope with 'OUT OF ORDER' poscar species, if any*/ - while((jdx<_UC.nspecies)&&(_UC.spe_Z[jdx]!=elem_symbol_test(ptr))) jdx++; - _UC.ind[ix].atoms[jdx]=g_ascii_strtod(ptr2,NULL); - _UC.ind[ix].natoms+=_UC.ind[ix].atoms[jdx]; - ptr++;ptr2++; - while(g_ascii_isgraph(*ptr)) ptr++;/*go to next space/end*/ - while(g_ascii_isgraph(*ptr2)) ptr2++;/*go to next space/end*/ - ptr++;ptr2++; - while(*ptr==' ') ptr++;/*skip space*/ - while(*ptr2==' ') ptr2++;/*skip space*/ + /*count number of lines -> num_best*/ + _UO.num_best=0; + while(line){ + _UO.num_best++; + g_free(line); + line = file_read_line(vf); + } +#if DEBUG_USPEX_READ +fprintf(stdout,"#DBG: N_BEST=%i ",_UO.num_best); +#endif + fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ + /*prepare (NEW) best_ind array*/ + _UO.best_ind=g_malloc((2*_UO.num_best)*sizeof(gint)); + line = file_read_line(vf); + idx=0; + while(line){ + ptr=&(line[0]); + __SKIP_BLANK(ptr); + _UO.best_ind[idx]=(gint)g_ascii_strtoull(ptr,&(ptr2),10); + if(ptr2!=NULL) { + ptr=ptr2+1; + _UO.best_ind[idx+1]=(gint)g_ascii_strtoull(ptr,NULL,10); + } +#if DEBUG_USPEX_READ +fprintf(stdout,"{gen=%i idx=%i} ",_UO.best_ind[idx],_UO.best_ind[idx+1]); +#endif + idx=idx+2; + g_free(line); + line = file_read_line(vf); + } +#if DEBUG_USPEX_READ +fprintf(stdout,"\n"); +#endif +/* +++ prepare ALL graph*/ + _UO.graph=graph_new("ALL", model); + /*process ALL graph ; ALL graph is _always_ enthalpy*/ + min_E=_UO.min_E-(_UO.max_E-_UO.min_E)*0.05; + max_E=_UO.max_E+(_UO.max_E-_UO.min_E)*0.05; + /*NEW - x dat*/ + gx.x_size=_UO.num_gen+1; + gx.x=g_malloc(gx.x_size*sizeof(gdouble)); + for(idx=0;idx0) { + gy.idx[ix]=_UO.ind[jdx].struct_number; + } else { + gy.idx[ix]=-1*jdx; + gy.symbol[ix]=GRAPH_SYMB_CROSS; } - g_free(line); - line=line2; - }else{ - /*get a new line (the number of each atoms)*/ - g_free(line); - line = file_read_line(vf); - idx++; - ptr=&(line[0]); - ptr2=ptr;jdx=0; - do{/*get the number of each species (in the Parameters.txt order)*/ - _UC.ind[ix].atoms[jdx]=g_ascii_strtod(ptr,&ptr2); - _UC.ind[ix].natoms+=_UC.ind[ix].atoms[jdx]; - if(ptr2==ptr) break; - jdx++; - ptr=ptr2; - }while(1); +#if DEBUG_USPEX_READ +fprintf(stdout,"E[%i]=e[%i]=%lf c[%i]=%i ",jdx,ix,gy.y[ix],ix,gy.symbol[ix]); +#endif + ix++; } } - vfpos=ftell(vf);/* flag */ - idx++; - g_free(line); - line = file_read_line(vf); - } - strcpy(model->filename,aux_file);// which means that we "forget" about OUTPUT.txt - g_free(aux_file); - -/* --- READ Individuals <- information about all structures */ -/* ^^^ META: If Individuals_relaxed exists, read it instead */ - if(_UC.method==US_CM_META) { - aux_file = g_strdup_printf("%s%s",res_folder,"Individuals_relaxed"); - vf = fopen(aux_file, "rt"); - if (!vf) aux_file = g_strdup_printf("%s%s",res_folder,"Individuals"); - else fclose(vf); - }else{ - aux_file = g_strdup_printf("%s%s",res_folder,"Individuals"); + /*add ALL data*/ +#if DEBUG_USPEX_READ +fprintf(stdout,"-SENT\n"); +#endif +/* NEW - y dat*/ + gy.type=GRAPH_IX_TYPE; + gy.line=GRAPH_LINE_NONE; + dat_graph_add_y(gy,_UO.graph); + g_free(gy.y); + g_free(gy.idx); + g_free(gy.symbol); +/* END - NEW*/ +// idx=jdx; + gen++; } - if(read_individuals_uspex(aux_file,model)!=0) { - line = g_strdup_printf("ERROR: reading USPEX Individuals file!\n"); - gui_text_show(ERROR, line); - g_free(line); - goto uspex_fail; +/* +++ prepare BEST graph*/ + _UO.graph_best=graph_new("e_BEST", model); + /*determine limits*/ + min_E=_UO.ind[_UO.best_ind[1]].E; + max_E=_UO.ind[_UO.best_ind[1]].E; + for(idx=0;idx<_UO.num_best;idx++){ + if(_UO.ind[_UO.best_ind[2*idx+1]].E < min_E) min_E=_UO.ind[_UO.best_ind[2*idx+1]].E; + if(_UO.ind[_UO.best_ind[2*idx+1]].E > max_E) max_E=_UO.ind[_UO.best_ind[2*idx+1]].E; } - g_free(aux_file); -/* --- open the last frame */ - if(_UC.method==US_CM_META) { - aux_file = g_strdup_printf("%s%s",res_folder,"gatheredPOSCARS_relaxed"); - vf = fopen(aux_file, "rt"); - if (!vf) aux_file = g_strdup_printf("%s%s",res_folder,"gatheredPOSCARS"); - else fclose(vf); - }else{ - aux_file = g_strdup_printf("%s%s",res_folder,"gatheredPOSCARS"); + /*for case where energy is not properly calculated*/ + if(max_E==min_E) { + min_E-=0.1; + max_E+=0.1; } - vf = fopen(aux_file, "rt"); - if (!vf) {/*very unlikely, we just opened it*/ - if(_UC.ind!=NULL) g_free(_UC.ind); - line = g_strdup_printf("ERROR: can't open USPEX gatheredPOSCARS file!\n"); - gui_text_show(ERROR, line); - g_free(line); - goto uspex_fail; - } - read_frame_uspex(vf,model);/*open first frame*/ - fclose(vf); - -/* --- Prepare the summary graph */ - /*no need to load BESTIndividuals since we already know everything from Individuals*/ - _UC.graph=graph_new("ALL", model); - _UC.graph_best=graph_new("BEST", model); - if(_UC.num_struct>_UC.num_gen){ - skip=0; + /*process BEST graph*/ + min_E=min_E-(max_E-min_E)*0.05; + max_E=max_E+(max_E-min_E)*0.05; + /*NEW - x dat*/ + gx.x_size=_UO.num_gen+1; + gx.x=g_malloc(gx.x_size*sizeof(gdouble)); + for(idx=0;idx0) { + gy.idx[ix]=_UO.ind[_UO.best_ind[jdx+1]].struct_number; + gy.symbol[ix]=GRAPH_SYMB_SQUARE; + }else{ + gy.idx[ix]=-1*_UO.best_ind[jdx+1]; + gy.symbol[ix]=GRAPH_SYMB_CROSS; } - } - num++; - ix++; - } - e=g_malloc((1+num)*sizeof(gdouble)); - ix=skip; - e[0]=(gdouble)num; - while(_UC.ind[ix].gen==gen){ - e[ix-skip+1]=_UC.ind[ix].E; - ix++; - } - graph_add_borned_data( - _UC.num_gen,e,0,_UC.num_gen, - _UC.min_E-(_UC.max_E-_UC.min_E)*0.05,_UC.max_E+(_UC.max_E-_UC.min_E)*0.05,GRAPH_USPEX,_UC.graph); - gen++; - g_free(e); - } - /*prepare array*/ - e=g_malloc((1+_UC.num_gen)*sizeof(gdouble)); - e[0]=(gdouble)_UC.num_gen; - max_E=_UC.ind[_UC.best_ind[1]].E; - min_E=max_E; - for(gen=0;gen<_UC.num_gen;gen++) { - if(_UC.ind[_UC.best_ind[gen+1]].E>max_E) max_E=_UC.ind[_UC.best_ind[gen+1]].E; - if(_UC.ind[_UC.best_ind[gen+1]].E15) ix=5; - else ix=_UC.num_gen+1; - graph_set_xticks(TRUE,ix,_UC.graph); - graph_set_yticks(TRUE,5,_UC.graph); - graph_set_xticks(TRUE,ix,_UC.graph_best); - graph_set_yticks(TRUE,5,_UC.graph_best); + dat_graph_add_y(gy,_UO.graph_best); + g_free(gy.y); + g_free(gy.symbol); +/* +++ ticks */ + if(_UO.num_gen>15) ix=5; + else ix=_UO.num_gen+1; + graph_set_xticks(TRUE,ix,_UO.graph); + graph_set_yticks(TRUE,5,_UO.graph); + graph_set_xticks(TRUE,ix,_UO.graph_best); + graph_set_yticks(TRUE,5,_UO.graph_best); /* --- variable composition */ -if(_UC.var){ -/* --- NEW: add a simple composition % graph for each species */ -if(_UC.nspecies>1){ -n_compo=2; -ix=0; -for(species_index=0;species_index<_UC.nspecies;species_index++){ - c=g_malloc(2*sizeof(gdouble));/*suppose at least 2 different compositions*/ - c[0]=(gdouble)_UC.ind[0].atoms[species_index] / (gdouble)_UC.ind[0].natoms; - c[1]=c[0]; - compo=c[0]; - ix=0; - while((compo==c[0])&&(ix<_UC.num_struct)){ - compo=(gdouble)_UC.ind[ix].atoms[species_index] / (gdouble)_UC.ind[ix].natoms; - if(compo!=c[0]){ - if(compo>c[0]) c[1]=compo; - else { - c[1]=c[0];c[0]=compo; - } - } - ix++; - } - if(c[1]==c[0]) continue;/*in VARCOMP calculation, one species can be kept fixed*/ - for(ix=0;ix<_UC.num_struct;ix++){ - compo=(gdouble)_UC.ind[ix].atoms[species_index] / (gdouble)_UC.ind[ix].natoms; - if(compo_calctype_var)&&(_UC._nspecies>1)){ + _UO.graph_comp=g_malloc(_UC._nspecies*sizeof(gpointer)); + for(species_index=0;species_index<_UC._nspecies;species_index++){ + min_E=_UO.min_E-(_UO.max_E-_UO.min_E)*0.05; + max_E=_UO.max_E+(_UO.max_E-_UO.min_E)*0.05; + n_compo=2; + gx.x_size=n_compo; + gx.x=g_malloc(n_compo*sizeof(gdouble)); + /*determine the different compositions*/ + gx.x[0]=0.; + gx.x[1]=1.; + for(idx=0;idx<_UO.num_struct;idx++){ + if(!_UO.ind[idx].have_data) continue; + c_sum=0;for(ix=0;ix<_UO.calc->_nspecies;ix++) c_sum+=_UO.ind[idx].atoms[ix]; + if(c_sum==0) continue;/*something stupid here!*/ + compo=(gdouble)(_UO.ind[idx].atoms[species_index])/c_sum; + if((compo>=1.0)||(compo<=0.0)) { + continue;/*rejected*/ } - if(compo>c[n_compo-1]){/*we have a new last element*/ - tmp=g_malloc((n_compo+1)*sizeof(gdouble)); - tmp[n_compo]=compo; - memcpy(&(tmp[0]),c,n_compo*sizeof(gdouble)); - g_free(c); - c=tmp; - n_compo++; - continue; - } - for(jdx=1;jdxc[jdx-1])&&(compogx.x[jdx])) jdx++; + if((compo-gx.x[jdx])==0.) continue;/*we already have that one*/ + c=g_malloc((n_compo+1)*sizeof(gdouble)); + jdx=0; + for(jdx=0;(compo>gx.x[jdx])&&(jdx_nspecies;ix++) c_sum+=_UO.ind[idx].atoms[ix]; + compo=(gdouble)(_UO.ind[idx].atoms[species_index])/c_sum; + if((compo-gx.x[jdx])!=0.0) continue; + num++; + if(gy.y==NULL){ + c=g_malloc(1*sizeof(gdouble)); + c_idx=g_malloc(1*sizeof(gint32)); + c_sym=g_malloc(1*sizeof(graph_symbol)); + }else{ + c=g_malloc(num*sizeof(gdouble)); + memcpy(c,gy.y,(num-1)*sizeof(gdouble)); + c_idx=g_malloc(num*sizeof(gint32)); + memcpy(c_idx,gy.idx,(num-1)*sizeof(gint32)); + c_sym=g_malloc(num*sizeof(graph_symbol)); + memcpy(c_sym,gy.symbol,(num-1)*sizeof(graph_symbol)); + g_free(gy.y); + g_free(gy.idx); + g_free(gy.symbol); } - - } - } - /*build the energy array*/ - e=g_malloc(n_compo*sizeof(gdouble)); - tag=g_malloc(n_compo*sizeof(gdouble)); - max_E=_UC.min_E; - for(ix=0;ixmax_E) max_E=e[jdx]; - } + c[num-1]=_UO.ind[idx].E; + if(c[num-1]0) { + c_idx[num-1]=_UO.ind[idx].struct_number; + c_sym[num-1]=GRAPH_SYMB_SQUARE; + }else{ + c_idx[num-1]=-1*idx; + c_sym[num-1]=GRAPH_SYMB_CROSS; } + gy.y=c; + gy.idx=c_idx; + gy.symbol=c_sym; + gy.type=GRAPH_XX_TYPE; + } + gy.y_size=num; + dat_graph_add_y(gy,_UO.graph_comp[species_index]); + if(num>0){ + g_free(gy.y); + g_free(gy.idx); + g_free(gy.symbol); } } - /* prepare composition diagram*/ - line=g_strdup_printf("COMP_%s",elements[_UC.spe_Z[species_index]].symbol); - _UC.graph_comp=graph_new(line, model); - graph_add_borned_data( - n_compo,tag,0,1,_UC.min_E-(max_E-_UC.min_E)*0.05,max_E+(max_E-_UC.min_E)*0.05,GRAPH_USPEX_2D,_UC.graph_comp); - graph_add_borned_data( - n_compo,c,0,1,_UC.min_E-(max_E-_UC.min_E)*0.05,max_E+(max_E-_UC.min_E)*0.05,GRAPH_USPEX_2D,_UC.graph_comp); - graph_add_borned_data( - n_compo,e,0,1,_UC.min_E-(max_E-_UC.min_E)*0.05,max_E+(max_E-_UC.min_E)*0.05,GRAPH_USPEX_2D,_UC.graph_comp); - g_free(line); - g_free(tag); - g_free(c); - g_free(e); - /*set ticks*/ - graph_set_xticks(TRUE,3,_UC.graph_comp); - graph_set_yticks(TRUE,5,_UC.graph_comp); - + /*set ticks*/ + graph_set_xticks(TRUE,3,_UO.graph_comp[species_index]); + graph_set_yticks(TRUE,5,_UO.graph_comp[species_index]); +/* +++ add a set for convex hull*/ + gy.y_size=n_compo; + gy.y=g_malloc(n_compo*sizeof(gdouble)); + gy.idx=g_malloc(n_compo*sizeof(gint32)); + gy.symbol=g_malloc(n_compo*sizeof(graph_symbol)); + gy.type=GRAPH_IY_TYPE;/*CHANGED TYPE*/ + gy.line=GRAPH_LINE_DASH; + /*1- look for the minimum of minimum*/ + min=0; + for(idx=0;idx0;idx--){ + compo=(c_min[min]-c_min[idx])/(gx.x[min]-gx.x[idx]); + if(compo>min_E){ + min_E=compo; + med=idx; + } } - -}/*variable composition with only 1 species...*/ -}/*not a VARCOMP calculation*/ - + gy.y[med]=c_min[med]; + gy.idx[med]=-1; + gy.symbol[med]=GRAPH_SYMB_DIAM; + if(gx.x[med]==0.) max_E=gy.y[med]; + else max_E=(gy.y[min]-(gy.y[med]*gx.x[min]/gx.x[med]))/(1.0-(gx.x[min]/gx.x[med])); + for(idx=min-1;idx>med;idx--){ + gy.y[idx]=min_E*gx.x[idx]+max_E;/*ie y=ax+b*/ + gy.idx[idx]=-1; + gy.symbol[idx]=GRAPH_SYMB_NONE; + } + min=med; +} +/* +++ right */ +while(max!=n_compo-1){ + max_E=(c_min[n_compo-1]-c_min[max])/(gx.x[n_compo-1]-gx.x[max]); + med=n_compo-1; + for(idx=max+1;idx<(n_compo-1);idx++){ + compo=(c_min[idx]-c_min[max])/(gx.x[idx]-gx.x[max]); + if(comporedraw = TRUE; - /* always show this information */ - gui_text_show(ITALIC,g_strdup_printf("USPEX: %i structures detected.\n",model->num_frames)); - model_prep(model); - - -}else if(_UC.method==US_CM_VCNEB){ -/* --- tentative at adding VCNEB, which format is different**/ -/* ^^^ *BUT unfortunately, we NEED a vasp5 output (VCNEB stayed at VASP4) */ -/* thus we create a new file called transitionPath_POSCARs5 which is a - * translation of transitionPath_POSCARs for VASP5...*/ - atoms = g_strdup_printf("%s",elements[_UC.spe_Z[0]].symbol); - for(idx=1;idx<_UC.nspecies;idx++){ - line = g_strdup_printf("%s %s",atoms,elements[_UC.spe_Z[idx]].symbol); + model->redraw = TRUE; + /* always show this information */ + line=g_strdup_printf("USPEX: %i structures detected.\n",model->num_frames); + gui_text_show(ITALIC,line); + g_free(line); + model_prep(model); +}/* ^^^ end ANYTHING but VCNEB, and TPS*/ +/* --- VCNEB method*/ +else if(_UC.calculationMethod==US_CM_VCNEB){ +/* +++ transitionPath_POSCARs conversion to VASP5 format*/ +if(_UO.version<1010){ + atoms = g_strdup_printf("%s",elements[_UC.atomType[0]].symbol); + for(idx=1;idx<_UC._nspecies;idx++){ + line = g_strdup_printf("%s %s",atoms,elements[_UC.atomType[idx]].symbol); g_free(atoms); atoms=line; } @@ -804,18 +3314,20 @@ for(species_index=0;species_index<_UC.nspecies;species_index++){ line = g_strdup_printf("ERROR: can't open USPEX transitionPath_POSCARs file!\n"); gui_text_show(ERROR, line); g_free(line); + g_free(aux_file); goto uspex_fail; } g_free(aux_file); aux_file = g_strdup_printf("%s%s",res_folder,"transitionPath_POSCARs5"); f_dest = fopen(aux_file, "w"); if(!f_dest) { - vf=f_src; line = g_strdup_printf("ERROR: can't WRITE into USPEX transitionPath_POSCARs5 file!\n"); gui_text_show(ERROR, line); g_free(line); + g_free(aux_file); goto uspex_fail; } + g_free(aux_file); /*get the total number of atoms*/ for(idx=0;idx<5;idx++){ line = file_read_line(f_src); @@ -824,7 +3336,7 @@ for(species_index=0;species_index<_UC.nspecies;species_index++){ natoms=1;/*there is at least one atom*/ ptr=&(line[0]); do{ - natoms+=g_ascii_strtod(ptr,&ptr2); + natoms+=(gint)g_ascii_strtod(ptr,&ptr2); if(ptr2==ptr) break; ptr=ptr2; }while(1); @@ -834,13 +3346,13 @@ fprintf(stdout,"#DBG: USPEX[VCNEB]: NATOMS=%i ATOMS=%s\n",natoms,atoms); /*translate input VASP4 into proper VASP5*/ rewind(f_src); idx=0; - _UC.num_struct=0; + _UO.num_struct=0; line = file_read_line(f_src); while(line){ fprintf(f_dest,"%s",line); if (find_in_string("Image",line) != NULL) { idx=0; - _UC.num_struct++; + _UO.num_struct++; } if(idx==4) fprintf(f_dest,"%s\n",atoms); idx++; @@ -849,15 +3361,63 @@ fprintf(stdout,"#DBG: USPEX[VCNEB]: NATOMS=%i ATOMS=%s\n",natoms,atoms); } fclose(f_src); fclose(f_dest); - fclose(vf); g_free(atoms); - _UC.ind=g_malloc((_UC.num_struct)*sizeof(uspex_individual)); -/* --- read energies from the Energy file */ +}/* ^^^ end transitionPath_POSCARs conversion*/ +/* +++ VER 10.1 of USPEX uses a VASP5 format for transitionPath_POSCARs!*/ +else{ + /*read the number of structures*/ + aux_file = g_strdup_printf("%s%s",res_folder,"transitionPath_POSCARs"); + vf = fopen(aux_file, "rt"); + if(!vf){ + line = g_strdup_printf("ERROR: can't open USPEX transitionPath_POSCARs file!\n"); + gui_text_show(ERROR, line); + g_free(line); + g_free(aux_file); + goto uspex_fail; + } g_free(aux_file); + _UO.num_struct=0; + line = file_read_line(vf); + while(line){ + if (find_in_string("Image",line) != NULL) _UO.num_struct++; + g_free(line); + line = file_read_line(vf); + } + /*get the total number of atoms*/ + rewind(vf); + for(idx=0;idx<6;idx++){ + line = file_read_line(vf); + g_free(line); + } + natoms=1;/*there is at least one atom*/ + ptr=&(line[0]); + do{ + natoms+=(gint)g_ascii_strtod(ptr,&ptr2); + if(ptr2==ptr) break; + ptr=ptr2; + }while(1); + /*all done*/ + fclose(vf); +} +/* --- read energies from the Energy file */ + _UO.ind=g_malloc((1+_UO.num_struct)*sizeof(uspex_individual)); + for(idx=0;idx<=_UO.num_struct;idx++) { + _UO.ind[idx].have_data=FALSE; + _UO.ind[idx].struct_number=-1; + _UO.ind[idx].gen=0; + _UO.ind[idx].natoms=0; + _UO.ind[idx].atoms=NULL; + _UO.ind[idx].energy=0.; + _UO.ind[idx].E=0.; + _UO.ind[idx].fitness=0.; + _UO.ind[idx].volume=0.; + _UO.ind[idx].density=0.; + _UO.ind[idx].symmetry=0; + } aux_file = g_strdup_printf("%s%s",res_folder,"Energy"); vf=fopen(aux_file,"rt"); if (!vf) { - g_free(_UC.ind); + g_free(_UO.ind); line = g_strdup_printf("ERROR: can't open USPEX Energy file!\n"); gui_text_show(ERROR, line); g_free(line); @@ -866,60 +3426,92 @@ fprintf(stdout,"#DBG: USPEX[VCNEB]: NATOMS=%i ATOMS=%s\n",natoms,atoms); /*first get to the first data line*/ line = file_read_line(vf); ptr=&(line[0]); - while((ptr)&&(*ptr==' ')) ptr++;/*skip blanks*/ + __SKIP_BLANK(ptr); while(!g_ascii_isdigit(*ptr)){ g_free(line); line = file_read_line(vf); ptr=&(line[0]); - while((ptr)&&(*ptr==' ')) ptr++;/*skip blanks*/ + __SKIP_BLANK(ptr); }/*line should now point to the first data line*/ - /*get first energy*/ - _UC.best_ind=g_malloc((1+_UC.num_struct)*sizeof(gint)); - e = g_malloc((_UC.num_struct+1)*sizeof(gdouble)); - e[0]=(gdouble) _UC.num_struct;/*first element is the size*/ - sscanf(line," %*i %lf %*s",&(e[1])); - e[1] /= (gdouble)natoms; - _UC.min_E=e[1]; - _UC.max_E=e[1]; - for(idx=0;idx<_UC.num_struct;idx++){ +/* +++ NEW: prepare image graph at the same time*/ + _UO.best_ind=g_malloc((1+_UO.num_struct)*sizeof(gint)); + _UO.graph_best=graph_new("PATH", model); + _UO.num_gen=_UO.num_struct+1;/*because VCNEB start at image_1*/ + /*X -> image coordinate*/ + gx.x_size=_UO.num_gen; + gx.x=g_malloc(gx.x_size*sizeof(gdouble)); + for(idx=0;idx image data*/ + gy.y_size=_UO.num_gen; + gy.y=g_malloc(gy.y_size*sizeof(gdouble)); + gy.idx=g_malloc(gy.y_size*sizeof(gint32)); + gy.symbol=g_malloc(gy.y_size*sizeof(graph_symbol)); + sscanf(line," %*i %lf %*s",&(gy.y[1])); + gy.y[1] /= (gdouble)natoms; + _UO.min_E=gy.y[1]; + _UO.max_E=gy.y[1]; + /*create a fake image_0*/ + _UO.ind[0].gen=0; + _UO.ind[0].have_data=FALSE; + _UO.ind[0].struct_number=0; + for(idx=1;idx<_UO.num_gen;idx++){ if(!line) break;/*<- useful? */ - sscanf(line," %*i %lf %*s",&(_UC.ind[idx].energy)); - _UC.ind[idx].atoms=g_malloc(_UC.nspecies*sizeof(gint)); - _UC.ind[idx].natoms=natoms;/*<-constant*/ - _UC.ind[idx].E = _UC.ind[idx].energy / (gdouble)_UC.ind[idx].natoms; - _UC.ind[idx].gen=idx;/*<- this is actually *not* true*/ - _UC.best_ind[idx+1]=idx; - e[idx+1]=_UC.ind[idx].E; - if(e[idx+1]<_UC.min_E) _UC.min_E=e[idx+1]; - if(e[idx+1]>_UC.max_E) _UC.max_E=e[idx+1]; + sscanf(line," %*i %lf %*s",&(_UO.ind[idx].energy)); + _UO.ind[idx].atoms=g_malloc(_UC._nspecies*sizeof(gint)); + _UO.ind[idx].natoms=natoms;/*<-constant*/ + _UO.ind[idx].E = _UO.ind[idx].energy / (gdouble)_UO.ind[idx].natoms; + _UO.ind[idx].gen=idx; + _UO.best_ind[idx]=idx; + _UO.ind[idx].struct_number=idx; + gy.y[idx]=_UO.ind[idx].E; + gy.idx[idx]=idx; + gy.symbol[idx]=GRAPH_SYMB_DIAM; + gy.type=GRAPH_IY_TYPE; + if(gy.y[idx]<_UO.min_E) _UO.min_E=gy.y[idx]; + if(gy.y[idx]>_UO.max_E) _UO.max_E=gy.y[idx]; #if DEBUG_USPEX_READ -fprintf(stdout,"#DBG: USPEX[VCNEB] Image %i: natoms=%i energy=%lf e=%lf\n",_UC.ind[idx].gen,_UC.ind[idx].natoms,_UC.ind[idx].energy,e[idx]); +fprintf(stdout,"#DBG: VCNEB Image %i: natoms=%i energy=%lf e=%lf\n",_UO.ind[idx].gen,_UO.ind[idx].natoms,_UO.ind[idx].energy,_UO.ind[idx].E); #endif g_free(line); line = file_read_line(vf); } - fclose(vf); + fclose(vf);vf=NULL; g_free(aux_file); - /*create the reduced index table*/ - _UC.red_index=g_malloc(_UC.num_struct*sizeof(gint)); - for(idx=0;idx<_UC.num_struct;idx++) _UC.red_index[idx]=idx; - aux_file = g_strdup_printf("%s%s",res_folder,"transitionPath_POSCARs5"); -/* --- reopen the newly created transitionPath_POSCARs5 file for reading <- this will be our new model file*/ + min_E=_UO.min_E-(_UO.max_E-_UO.min_E)*0.05; + max_E=_UO.max_E+(_UO.max_E-_UO.min_E)*0.05; + dat_graph_set_limits(0,_UO.num_gen,min_E,max_E,_UO.graph_best); + gy.line=GRAPH_LINE_DASH; + dat_graph_add_y(gy,_UO.graph_best); + g_free(gy.y); + g_free(gy.idx); + g_free(gy.symbol); + /*set ticks*/ + if(_UO.num_gen>15) ix=5; + else ix=_UO.num_gen+1; + graph_set_xticks(TRUE,ix,_UO.graph_best); + graph_set_yticks(TRUE,5,_UO.graph_best); +/* --- reopen transitionPath_POSCARs or the newly created transitionPath_POSCARs5 file for reading + * ^^^ this will be our new model file*/ + if(_UO.version<1010) aux_file = g_strdup_printf("%s%s",res_folder,"transitionPath_POSCARs5"); + else aux_file = g_strdup_printf("%s%s",res_folder,"transitionPath_POSCARs"); vf=fopen(aux_file,"rt"); - if (!vf) {/*very unlikely: we just create it*/ - g_free(_UC.ind); - line = g_strdup_printf("ERROR: can't open USPEX transitionPath_POSCARs5 file!\n"); + if (!vf) {/*very unlikely: we just create/read it*/ + g_free(_UO.ind); + if(_UO.version<1010) line = g_strdup_printf("ERROR: can't open USPEX transitionPath_POSCARs5 file!\n"); + else line = g_strdup_printf("ERROR: can't open USPEX transitionPath_POSCARs file!\n"); gui_text_show(ERROR, line); g_free(line); + g_free(aux_file); goto uspex_fail; } model->num_frames=0; vfpos=ftell(vf);/* flag */ line = file_read_line(vf); - idx=0; while(!feof(vf)){ if (find_in_string("Image",line) != NULL) { - idx=0; fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ add_frame_offset(vf, model); model->num_frames++; @@ -929,57 +3521,47 @@ fprintf(stdout,"#DBG: USPEX[VCNEB] Image %i: natoms=%i energy=%lf e=%lf\n",_UC.i vfpos=ftell(vf);/* flag */ g_free(line); line = file_read_line(vf); - idx++; } - strcpy(model->filename,aux_file);// which means that we "forget" about OUTPUT.txt - g_free(aux_file); - rewind(vf); - read_frame_uspex(vf,model);/*open first frame*/ - fclose(vf); - - /*do a "best" graph with each image*/ - _UC.graph_best=graph_new("PATH", model); - _UC.num_gen=_UC.num_struct; - graph_add_borned_data( - _UC.num_gen,e,0,_UC.num_gen, - _UC.min_E-(_UC.max_E-_UC.min_E)*0.05,_UC.max_E+(_UC.max_E-_UC.min_E)*0.05,GRAPH_USPEX_BEST,_UC.graph_best); - g_free(e); - /*set ticks*/ - if(_UC.num_gen>15) ix=5; - else ix=_UC.num_gen+1; - graph_set_xticks(TRUE,ix,_UC.graph_best); - graph_set_yticks(TRUE,5,_UC.graph_best); - - + strcpy(model->filename,aux_file);// which means that we "forget" about OUTPUT.txt + g_free(aux_file); + g_free(model->basename); + model->basename=g_strdup_printf("uspex"); + rewind(vf); + read_frame_uspex(vf,model);/*open first frame*/ + fclose(vf);vf=NULL; /*refresh model*/ tree_model_refresh(model); model->redraw = TRUE; /* always show this information */ gui_text_show(ITALIC,g_strdup_printf("USPEX: %i structures detected.\n",model->num_frames)); model_prep(model); - - - -}else{/*calculation method is not supported*/ - line = g_strdup_printf("ERROR: USPEX support is limited to calculationMethod={USPEX,META,VCNEB} for now!\n"); +}/* ^^^ end VCNEB method*/ +else{/*calculation method is not supported*/ + line = g_strdup_printf("ERROR: USPEX unsupport method!\n"); gui_text_show(ERROR, line); g_free(line); goto uspex_fail; } + /*g_free some data*/ + g_free(res_folder); + /*update some properties*/ + model->num_species=_UO.calc->_nspecies; - + /*end*/ error_table_print_all(); return 0; uspex_fail: line = g_strdup_printf("ERROR: loading USPEX failed!\n"); gui_text_show(ERROR, line); g_free(line); - fclose(vf); return 3; } +/********************/ +/* read_frame_uspex */ +/********************/ gint read_frame_uspex(FILE *vf, struct model_pak *model){ gchar *line; - uspex_calc_struct *uspex_calc=model->uspex; + uspex_output_struct *uspex_output=model->uspex; long int vfpos;/*to counter _BUG_ where loading a raw frame does not update model->cur_frame*/ gchar *ptr; gint idx=0; @@ -993,19 +3575,67 @@ if(line==NULL) return -1; ptr=&(line[0]); while(g_ascii_isalpha(*ptr)) ptr++; sscanf(ptr,"%i%*s",&idx); +g_free(line);/*FIX: _VALGRIND_BUG_*/ fseek(vf,vfpos,SEEK_SET);/* rewind to flag */ if(vasp_load_poscar5(vf,model)<0) return 3; -/* in case of meta idx is *not* the real number of the structure */ -/* now the index should always be _UC.red_index[idx-1] <- I THINK*/ - line=g_strdup_printf("%lf eV",_UC.ind[_UC.red_index[idx]].energy); +if(_UO.ind[idx].have_data){ + line=g_strdup_printf("%lf eV",_UO.ind[idx].energy); + property_add_ranked(3, "Energy", line, model); + model->volume=_UO.ind[idx].volume; + g_free(line);line=g_strdup_printf("%lf uV",model->volume); + property_add_ranked(4, "Volume", line, model); + g_free(line); + /*note: Formula property rank is 7*/ +if(_UO.ind[idx].struct_number>=0){/*useless for now: no frame means no read_frame*/ + line=g_strdup_printf("%i",_UO.ind[idx].struct_number); +}else{ + /*note: there is no way to reach here from read_frame_uspex*/ + line=g_strdup_printf("N/A"); +} + property_add_ranked(8, "Structure", line, model); + g_free(line); +} + return 0; +} +/****************************/ +/* update frame information */ +/****************************/ +gint update_frame_uspex(gint idx,struct model_pak *model){ +/*this is used when there is data, but no structure*/ + gchar *line; + uspex_output_struct *uspex_output=model->uspex; + /*formula*/ + gint i; + gchar *spec; + /**/ + if(idx<0) idx*=-1; +if(_UO.ind[idx].have_data){ + line=g_strdup_printf("%lf eV",_UO.ind[idx].energy); property_add_ranked(3, "Energy", line, model); - model->volume=_UC.ind[_UC.red_index[idx]].volume; + model->volume=_UO.ind[idx].volume; + g_free(line);line=g_strdup_printf("%lf uV",model->volume); + property_add_ranked(4, "Volume", line, model); + g_free(line); + line=g_strdup_printf("%c",'\0'); + for(i=0;i<_UO.calc->_nspecies;i++) { + spec=g_strdup_printf("%s(%i)",elements[_UO.calc->atomType[i]].symbol,_UO.ind[idx].atoms[i]); + line=g_strdup_printf("%s%s",line,spec); + g_free(spec); + } + property_add_ranked(7, "Formula", line, model); g_free(line); - line=g_strdup_printf("%i",idx); + if(_UO.ind[idx].struct_number>=0){ + line=g_strdup_printf("%i",_UO.ind[idx].struct_number); + }else{ + line=g_strdup_printf("N/A"); + } property_add_ranked(8, "Structure", line, model); g_free(line); + model_prep(model);/*maybe a little too much!*/ +} return 0; } -#undef _UC + +#undef _UO diff --git a/src/file_uspex.h b/src/file_uspex.h index 81e08c6..9fb74ee 100644 --- a/src/file_uspex.h +++ b/src/file_uspex.h @@ -22,58 +22,312 @@ The GNU GPL can also be found at http://www.gnu.org /* header for USPEX file */ +/*defines*/ +#define _UO (*uspex_output) +#define _UC (*uspex_calc) + +/*structures*/ typedef enum {/*released USPEX calculation methods as of 2018 (5)*/ - US_CM_USPEX, /*USPEX*/ - US_CM_META, /*metadynamics*/ - US_CM_VCNEB, /*VC-NEB*/ - US_CM_PSO, /*PSO*/ + US_CM_USPEX, /*USPEX*/ + US_CM_META, /*metadynamics*/ + US_CM_VCNEB, /*VC-NEB*/ + US_CM_PSO, /*PSO*/ + US_CM_TPS, /*TPS VER 10.1*/ + US_CM_MINHOP, /*MINHOP, unsupported VER 10.1*/ + US_CM_COPEX, /*COPEX, unsupported VER 10.1*/ + US_CM_UNKNOWN, /*unknown*/ } uspex_method; - +typedef enum{ + US_CT_300=300, /*bulk crystals; no-mol; no-var*/ + US_CT_s300=1300, /*+magnetic VER 10.1*/ + US_CT_301=301, /*bulk crystals; no-mol; var*/ + US_CT_s301=1301, /*+magnetic VER 10.1*/ + US_CT_310=310, /*bulk crystals; mol; no-var*/ + US_CT_311=311, /*bulk crystals; mol; var*/ + US_CT_000=0, /*nanoparticles; no-mol; no-var*/ + US_CT_s000=1000, /*+magnetic VER 10.1*/ + US_CT_001=1, /*+cluster VER 10.1*/ + US_CT_110=110, /*polymers; no-mol; no-var*/ + US_CT_200=200, /*surfaces; no-mol; no-var*/ + US_CT_s200=1200, /*+magnetic VER 10.1*/ + US_CT_201=201, /*surfaces; no-mol; var*/ + US_CT_s201=1201, /*+magnetic VER 10.1*/ + US_CT_m200=-200, /*2D crystals; no-mol; no-var*/ + US_CT_sm200=-1200, /*+magnetic VER 10.1*/ +} uspex_type; +typedef enum { + US_OT_ENTHALPY=1, /*most stable structure*/ + US_OT_VOLUME=2, /*min volume*/ + US_OT_HARDNESS=3, /*max hardness*/ + US_OT_ORDER=4, /*most ordered structure*/ + US_OT_DISTANCE=5, /*max structure */ + US_OT_DIELEC_S=6, /*max dielectric suseptibility*/ + US_OT_GAP=7, /*max band gap*/ + US_OT_DIELEC_GAP=8, /*max energy storage capacity*/ + US_OT_MAG=9, /*max magnetization*/ + US_OT_QE=10, /*max stucture quasientropy*/ + US_OT_2R=11, /*birefringence VER 10.1*/ + US_OT_ZT=14, /*thermoelectric VER 10.1*/ + US_OT_Fphon=17, /*free energy & finite temperature VER 10.1*/ +/*elasticity related*/ + US_OT_BULK_M=1101, /*max bulk modulus*/ + US_OT_SHEAR_M=1102, /*max shear modulus*/ + US_OT_YOUNG_M=1103, /*max Young modulus*/ + US_OT_POISSON=1104, /*max Poisson modulus*/ + US_OT_PUGH_R=1105, /*max Pugh modulus ratio*/ + US_OT_VICKERS_H=1106, /*max Vickers hardness*/ + US_OT_FRACTURE=1107, /*max fracture toughness*/ + US_OT_DEBYE_T=1108, /*max Debye temperature*/ + US_OT_SOUND_V=1109, /*max sound velocity*/ + US_OT_SWAVE_V=1110, /*max S-wave velocity*/ + US_OT_PWAVE_V=1111, /*max P-wave velocity*/ + US_OT_UNKNOWN=0, /*reserved for future use*/ +} uspex_opt; +typedef enum { + US_BT_ZT=0, /*trace of BT figure of merit (ZT)*/ + US_BT_ZTxx=1, /*x diagonal component of ZT*/ + US_BT_ZTyy=2, /*y diagonal component of ZT*/ + US_BT_ZTzz=3, /*z diagonal component of ZT*/ + US_BT_UNKNOWN=-1, /*invalid entry*/ +} uspex_bt_goal; typedef struct { - gint gen; /*generation of this individual*/ - gint natoms; /*number of atoms*/ - gint *atoms; /*number of atoms per species*/ - gdouble energy; /*total energy*/ - gdouble E; /*reduce energy / atoms*/ - gdouble fitness; /*NEW: fitness*/ - gdouble volume; /*total volume*/ + gboolean have_data; /*NEW: allow incomplete Individuals*/ + gint struct_number; /*NEW: allow incomplete gatheredPOSCARS*/ + gint gen; /*generation of this individual*/ + gint natoms; /*number of atoms*/ + gint *atoms; /*number of atoms per species*/ + gdouble energy; /*total energy*/ + gdouble E; /*reduce energy / atoms*/ + gdouble fitness; /*fitness*/ + gdouble volume; /*total volume*/ + gdouble density; /*NEW: density*/ + gint symmetry; /*NEW: Symmetry*/ } uspex_individual; - -/* global calculation structure */ +/* USPEX calculation structure */ +typedef struct { +/*additional controls*/ + gchar *name; /*the job name*/ + gchar *path; /*original job path*/ + gchar *filename; /*corresponding filename*/ + gint special; /*special tag*/ +/*4.1 Type of run & System*/ + uspex_method calculationMethod; /*supported calculation methods*/ + uspex_type calculationType; /*supported calculation types*/ + gint _calctype_dim; /*HIDDEN: X.. digit in calculation type: dimension*/ + gboolean _calctype_mol; /*HIDDEN: .X. digit in calculation type: molecular*/ + gboolean _calctype_var; /*HIDDEN: ..X digit in calculation type: variable composition*/ + gboolean _calctype_mag; /*HIDDEN: s... trigger magnetic calculation VER 10.1*/ + uspex_opt optType; /*optimization property*/ + gchar *new_optType; /*extended property of optimization VER 10.1*/ + gboolean anti_opt; /*if set, reverse the optimization direction*/ + gint _nspecies; /*HIDDEN: number of different species*/ + gint *atomType; /*atomic number of each species*/ + gint _var_nspecies; /*HIDDEN: numer of numSpecies blocks*/ + gint *numSpecies; /*number of species for each type*/ + gdouble magRatio[7]; /*fraction of initial structures with: + NM, FM-LS, FM-HS, AFM-L, AFM-H, FM-LH, AF-LH VER 10.1*/ + gdouble *ldaU; /*U value for VASP LDA+U {in Dudarev et al. formalism} VER 10.1*/ + gdouble ExternalPressure; /*external pressure*/ + gint *valences; /*valence for each species*/ + gdouble *goodBonds; /*minimum bond valences*/ + gboolean checkMolecules; /*check molecules*/ + gboolean checkConnectivity; /*check connectivity*/ + gdouble fitLimit; /*best fitness stop criterion VER 10.1*/ +/*4.2 Population*/ + gint populationSize; /*number of structure in each generation*/ + gint initialPopSize; /*number of structure in initial generation*/ + gint numGenerations; /*maximum number of generation*/ + gint stopCrit; /*stop criterion (max generation with same lowest structure)*/ +/*4.3 Survival of the fittest & Selection*/ + gdouble bestFrac; /*fraction of structures in current generation used for producing the next*/ + gint keepBestHM; /*number of surviving best structures*/ + gboolean reoptOld; /*reoptimization of survivors*/ +/*4.4 Structure generation and variation operators*/ + gchar *symmetries; /*possible symmetries*/ + gdouble fracGene; /*fraction of structures generated by heredity*/ + gdouble fracRand; /*fraction of structures generated randomly*/ + gdouble fracTopRand; /*fraction of structures generated by topological randomness VER 10.1*/ + gdouble fracPerm; /*fraction of structures generated by permutation*/ + gdouble fracAtomsMut; /*fraction of structures generated by softmutation*/ + gdouble fracRotMut; /*fraction of structures generated by orientation mutation*/ + gdouble fracLatMut; /*fraction of structures generated by lattice mutation*/ + gdouble fracSpinMut; /*fraction of structures generated by spin mutation VER 10.1*/ + gint howManySwaps; /*number of pairwise swaps*/ + gchar *specificSwaps; /*which atoms are swapped*/ + gdouble mutationDegree; /*max displacement (Ang) in softmutation*/ + gdouble mutationRate; /*standard deviation in the strain matrix for lattice mutation*/ + gdouble DisplaceInLatmutation; /*max displacement in sofmutation of lattice mutation*/ + gboolean AutoFrac; /*automatic evolution of variation operators*/ +/*4.5 Constrains*/ + gdouble minVectorLength; /*minimum length of a cell parameter*/ + gdouble *IonDistances; /*triangular-matrix of the minimum allowed interatomic distances*/ + gint constraint_enhancement; /*allow c_e times stricter constraints of IonDistances*/ + gint _nmolecules; /*HIDDEN: number of molecules*/ + gdouble *MolCenters; /*triangular-matrix of minimal distances between centers of molecules*/ +/*4.6 Cell*/ + gint _nlattice_line; /*HIDDEN: number of lines in Latticevalues*/ + gint _nlattice_vals; /*HIDDEN: number of elements per lines*/ + gdouble *Latticevalues; /*initial volume/parameter of the unit cell*/ + gint _nsplits; /*HIDDEN: number of splits*/ + gint *splitInto; /*number of subcells into which unit cell is split*/ +/*4.7 Restart*/ + gboolean pickUpYN; /*select whether to perform a restart (deprecated)*/ + gint pickUpGen; /*generation from which to restart from*/ + gint pickUpFolder; /*result forder index from which to restart from*/ +/*4.8 Ab initio calculations*/ + gint _num_opt_steps; /*HIDDEN: number of optimization steps*/ + gint *abinitioCode; /*calculation code used for each optimization steps*/ + gboolean *_isfixed; /*HIDDEN: deal with parenthesis*/ + gdouble *KresolStart; /*reciprocal-space resolution (2*pi*ang-1) for k-points generation*/ + gdouble *vacuumSize; /*amount of vacuum added at each optimization step*/ + gint numParallelCalcs; /*number of structure relaxations at a time (in parallel)*/ + gint numProcessors; /*how many processors per calculation - undocumented*/ + gboolean _isCmdList; /*HIDDEN: switch between only 1 commandExecutable and 1 per optimization steps*/ + gchar *commandExecutable; /*executable file/command for each optimization step*/ + gint whichCluster; /*type of job-submission*/ + gchar *remoteFolder; /*remote folder where calculation is performed (whichCluster=2)*/ + gboolean PhaseDiagram; /*calculate a crude phase diagram w/ (rough) transition pressure*/ +/*4.9 fingerprint*/ + gdouble RmaxFing; /*the distance cutoff (Ang)*/ + gdouble deltaFing; /*discretization (Ang) of fingerprint function*/ + gdouble sigmaFing; /*gaussian broadening of interatomic distances*/ +/*4.10 Antiseed*/ + gint antiSeedsActivation; /*generation at which antiseeds will be active*/ + gdouble antiSeedsMax; /*gaussian height in msd of enthalpy in the generation among potential parents*/ + gdouble antiSeedsSigma; /*gaussian width in average distance in the generation among potential parents*/ +/*4.11 Space group*/ + gboolean doSpaceGroup; /*determine space group*/ + gdouble SymTolerance; /*precision (ang) in the symmetry determination*/ +/*4.12 Developers*/ + gint repeatForStatistics; /*repeat USPEX calculation rFS times*/ + gdouble stopFitness; /*set halting fitness condition*/ + gint fixRndSeed; /*fixed random seed number VER 10.1*/ + gboolean collectForces; /*collect all relaxation information (from VASP)*/ +/*4.13 Seldom*/ + gboolean ordering_active; /*biasing of variation parameters*/ + gboolean symmetrize; /*all structures into std symmetrized crystallographic settings*/ + gint *valenceElectr; /*number of valence electrons for each atom type*/ + gdouble percSliceShift; /*probability of shifting slabs*/ + gint dynamicalBestHM; /*number of survivors will vary: 0:no 1:yes 2:yes, with max diversity*/ + gchar *softMutOnly; /*generations that are produced by softmutation*/ + gdouble maxDistHeredity; /*max cos distances between structure involved in heredity*/ + gint manyParents; /*more than 2 slices (or parents) are used for heredity*/ + gdouble minSlice; /*minimal thickness (Ang) of a slice*/ + gdouble maxSlice; /*maximal thickness (Ang) of a slice*/ + gint numberparents; /*number of parents for cluster*/ +/*5 Additional*/ +/*5.1 molecular crystal*/ + /*no keyword in this section*/ +/*VER 10.1 - 5.2 Optimization of thermoelectric efficiency (new)*/ + gdouble BoltzTraP_T_max; /*Max temperature in K VER 10.1*/ + gdouble BoltzTraP_T_delta; /*Temperature increment in K VER 10.1*/ + gdouble BoltzTraP_T_efcut; /*Chemical potential interval in eV VER 10.1*/ + gdouble TE_T_interest; /*Target temperature in K VER 10.1*/ + gdouble TE_threshold; /*discard structures with a lower ZT - figure of merit VER 10.1*/ + uspex_bt_goal TE_goal; /*component of ZT to be optimized VER 10.1*/ +/*5.3 Surfaces (previously 5.2)*/ + gdouble thicknessS; /*thickness (Ang) of the surface (ie adatoms) surface region*/ + gdouble thicknessB; /*thickness (Ang) of the buffer (no adatoms) surface region*/ + gint reconstruct; /*max number of multiplication of the surface cell (for reconstruction)*/ + gint *StoichiometryStart; /*starting stoichiometry (undocumented)*/ +/*VER 10.1 - 5.4 Clusters*/ + /*no keyword in this section (selection by calculationType)*/ +/*5.5 Variable composition (previously 5.3)*/ + gint firstGeneMax; /*how many different composition are sampled in the 1st generation*/ + gint minAt; /*minimum number of atoms/unit cell in the 1st generation*/ + gint maxAt; /*maximum number of atoms/unit cell in the 1st generation*/ + gdouble fracTrans; /*fraction of structures generated by transmutation*/ + gdouble howManyTrans; /*maximum fraction of atoms in the structure that are being transmuted*/ + gint _nspetrans; /*HIDDEN: number of specific transmutations*/ + gint *specificTrans; /*specific transmutations*/ +/*5.6 metadynamics (previously 5.4)*/ + gdouble GaussianWidth; /*width of each gaussian added to surface energy*/ + gdouble GaussianHeight; /*height of each gaussian added to surface energy*/ + gint FullRelax; /*whether relax within a fixed cell, fully relax best, or all structures*/ + gdouble maxVectorLength; /*maximum (Ang) unit cell length (if larger then steep force correction is added)*/ +/*5.7 Particle swarm optimization (previously 5.5)*/ + gdouble PSO_softMut; /*weight of softmutation*/ + gdouble PSO_BestStruc; /*weight of heredity with best position, within same PSO particle*/ + gdouble PSO_BestEver; /*weight of heredity with globally best PSO particle*/ +/*6 Phase Transition Pathways*/ +/*6.1 Variable cell nudged elastic band (VCNEB)*/ + /*no keyword in this section*/ +/*6.1.1 VCNEB options (previously 6.2)*/ + gint vcnebType; /*type of VCNEB*/ + gint _vcnebtype_method; /*HIDDEN: X.. digit in vcnebType: use VCNEB or just relax*/ + gboolean _vcnebtype_img_num; /*HIDDEN: .X. digit in vcnebType: fixed or variable image number*/ + gboolean _vcnebtype_spring; /*HIDDEN: ..X digit in vcnebType: fixed or variable spring constant*/ + gint numImages; /*initial number of images*/ + gint numSteps; /*maximum VCNEB steps*/ + gint optReadImages; /*reading the Image file (all image, initial and final, or +intermediate)*/ + gint optimizerType; /*optimization algorithm*/ + gint optRelaxType; /*relaxation mode (fixed cell, only cell, full relaxation)*/ + gdouble dt; /*time step*/ + gdouble ConvThreshold; /*halting RMS (eV/Ang) condition*/ + gdouble VarPathLength; /*min distance (* 1.5) between 2 image to generate a new image*/ + gdouble K_min; /*min spring constant, for variable spring cte calculation*/ + gdouble K_max; /*max spring constant, for variable spring cte calculation*/ + gdouble Kconstant; /*spring constant, for variable spring cte calculation*/ + gboolean optFreezing; /*freeze image structure (when ConvThreshold is achieve)*/ + gint optMethodCIDI; /*use climbing image / downing image method*/ + gint startCIDIStep; /*CI/DI method starting step*/ + gint _npickimg; /*HIDDEN: number of picked-up images*/ + gint *pickupImages; /*# of images chosen for CI/DI*/ + gint FormatType; /*structure format in the output pathway (ONLY VASP5 is supported!)*/ + gint PrintStep; /*save VCNEB restart files in STEP directory every PS steps*/ +/*6.1.2 Set initial pathway in VCNEB (perviously 6.3)*/ + /*no keyword in this section*/ +/*VER 10.1 - 6.2 Transistion path sampling (TPS)*/ + /*no keyword in this section*/ +/*vER 10.1 - 6.2.1 TPS options*/ + gint numIterations; /*max number of TPS steps VER 10.1*/ + gchar *speciesSymbol; /*Symbols for all atoms or molecules VER 10.1*/ + gdouble *mass; /*mass of each species VER 10.1*/ + gdouble amplitudeShoot[2]; /*momentum amplitude for A->B and B->A VER 10.1*/ + gdouble magnitudeShoot[2]; /*succeed and fail factors for: + increasing/decreasing amplitude of magnitude distribution VER 10.1*/ + gdouble shiftRatio; /*ratio for a shifter op after a successful shooter one VER 10.1*/ + gboolean orderParaType; /*method of order parameter: FALSE -> custom ; TRUE -> fingerprint VER 10.1*/ + gdouble opCriteria[2]; /*tolerable similarity of starting and ending state VER 10.1*/ + gchar *cmdOrderParameter; /*custom command for orderParaType=FALSE*/ + gchar *cmdEnthalpyTemperature; /*custom command to extract enthalpy and temperature from MD VER 10.1*/ + gchar *orderParameterFile; /*filename to store order VER 10.1*/ + gchar *enthalpyTemperatureFile; /*filename to store enthalpy and temperature VER 10.1*/ + gchar *trajectoryFile; /*filename to store the MD trajectory VER 10.1*/ + gchar *MDrestartFile; /*filename to store the MD restart file VER 10.1*/ +/*run parameters*/ + gchar *job_uspex_exe; + gchar *job_path; +} uspex_calc_struct; +/* global output structure */ typedef struct { /*name*/ - gchar *name; - gint version; -/*system parameters*/ - uspex_method method; - gint type; - /* in detail */ - gint dim; - gboolean mol; - gboolean var; - /* optimization */ - gint opt_type; - gboolean have_fitness; - + gchar *name; + gint version; + gint index; /*index is the # of result folder*/ + uspex_calc_struct *calc; + /* optimization */ + gboolean have_supercell; /*NEW: deal with supecell automagic*/ + gboolean have_fitness; /*structures*/ - gint num_gen; - gint num_struct; - gint nspecies; /*number of species*/ - gint *spe_Z; /*atomic number of each species*/ - gint *red_index; /*in case not all structure are displayed (ie. META)*/ - gdouble min_E; - gdouble max_E; - uspex_individual *ind; - gint num_best; - gint *best_ind; + gint num_gen; + gint num_struct; + gdouble min_E; + gdouble max_E; + gdouble min_F; /*NEW: fitness data*/ + gdouble max_F; /*NEW: fitness data*/ + uspex_individual *ind; + gint num_best; + gint *best_ind; /*NEW: {ID - GEN} there can be several best in a generation*/ /*interpretation*/ - gpointer graph; - gpointer graph_best; - gpointer graph_comp; -} uspex_calc_struct; + gpointer graph; + gpointer graph_best; + gpointer *graph_comp; +} uspex_output_struct; /* execution structure */ typedef struct { int job_id; + gint index; /*index is the result# folder*/ gboolean have_result; /*job related*/ gchar *job_uspex_exe; @@ -81,5 +335,11 @@ typedef struct { } uspex_exec_struct; /*methods of interest*/ +void init_uspex_parameters(uspex_calc_struct *uspex_calc); +void free_uspex_parameters(uspex_calc_struct *uspex_calc); +uspex_calc_struct *read_uspex_parameters(gchar *filename,gint safe_nspecies); +void copy_uspex_parameters(uspex_calc_struct *src,uspex_calc_struct *dest); +gint dump_uspex_parameters(gchar *filename,uspex_calc_struct *uspex_calc); + diff --git a/src/file_vasp.c b/src/file_vasp.c index 19a9f48..7311ff0 100644 --- a/src/file_vasp.c +++ b/src/file_vasp.c @@ -1816,7 +1816,7 @@ core_delete_all(model); name=g_strdup_printf("%c",'\0'); do{ ptr=ptr2; - ix=g_ascii_strtod(ptr,&ptr2); + ix=(gint)g_ascii_strtod(ptr,&ptr2); if(ptr2==ptr) break; while(*ptr3==' ') ptr3++; sym[0]=*ptr3; @@ -1835,7 +1835,10 @@ core_delete_all(model); name=g_strdup(spec); model->num_atoms+=ix; }while(1); + g_free(spec);/*FIX _VALGRIND_BUG_*/ + g_free(label);/*FIX _VALGRIND_BUG_*/ property_add_ranked(7, "Formula", name, model); + g_free(name);/*FIX _VALGRIND_BUG_*/ g_free(line); /*Always true in VASP*/ model->fractional=TRUE; diff --git a/src/gl_graph.c b/src/gl_graph.c index bae3a90..31150d7 100644 --- a/src/gl_graph.c +++ b/src/gl_graph.c @@ -174,7 +174,7 @@ void graph_set_xticks(gint label, gint ticks, gpointer ptr_graph) struct graph_pak *graph = ptr_graph; g_assert(graph != NULL); -g_assert(ticks > 1);/* FIXME: ticks shouldn't matter if label=FALSE */ +if(label) g_assert(ticks > 1); graph->xlabel = label; graph->xticks = ticks; @@ -188,7 +188,7 @@ void graph_set_yticks(gint label, gint ticks, gpointer ptr_graph) struct graph_pak *graph = ptr_graph; g_assert(graph != NULL); -g_assert(ticks > 1);/* FIXME: ticks shouldn't matter if label=FALSE */ +if(label) g_assert(ticks > 1); graph->ylabel = label; graph->yticks = ticks; @@ -205,7 +205,9 @@ g_assert(graph != NULL); graph->wavelength = wavelength; } - +/********************************/ +/* regular selection of 1D data */ +/********************************/ void graph_set_select(gdouble x, gchar *label, gpointer data) { gdouble n; @@ -232,7 +234,6 @@ else printf("select -> %d : [0, %d]\n", graph->select, graph->size); */ } - /*****************************/ /* add dependent data set(s) */ /*****************************/ @@ -260,7 +261,6 @@ graph_init_y(x, graph); graph->set_list = g_slist_append(graph->set_list, ptr); } - /*********************************/ /* add borned (x,y) data (ovhpa) */ /*********************************/ @@ -271,8 +271,6 @@ struct graph_pak *graph = data; g_assert(graph != NULL); -/* try to prevent the user supplying different sized data */ -/* TODO - sample in some fashion if different? */ if(type==GRAPH_BANDOS){ /*the first *two* sets of a GRAPH_BANDOS are _not_ the same size*/ /*also it doesn't make much sense to allow anything on that one.*/ @@ -292,13 +290,8 @@ else graph->size = size; } -if((type==GRAPH_USPEX)||(type==GRAPH_USPEX_BEST)){ -ptr = g_malloc(1+((gint)x[0])*sizeof(gdouble)); -memcpy(ptr,x,(1+(gint)x[0])*sizeof(gdouble)); -}else{ ptr = g_malloc(size*sizeof(gdouble)); memcpy(ptr, x, size*sizeof(gdouble)); -} graph->xmin = x_min; graph->xmax = x_max; @@ -309,6 +302,96 @@ graph->type=type; graph->set_list = g_slist_append(graph->set_list, ptr); } +/*************************/ +/* NEW - dat_graph: set x*/ +/*************************/ +void dat_graph_set_x(g_data_x dx,gpointer pgraph){ +struct graph_pak *graph = pgraph; +int i; +g_data_x *px; + +g_assert(graph != NULL); + +/*duplicate and register*/ +px=g_malloc(sizeof(g_data_x)); +g_assert(px != NULL); +px->x_size = dx.x_size; +px->x = g_malloc(dx.x_size*sizeof(gdouble)); +//memcpy(px->x,dx.x,dx.x_size*sizeof(gdouble)); +for(i=0;ix[i]=dx.x[i]; + +graph->size=0;/*graph size hold the number of y arrays!*/ +graph->set_list = g_slist_append(graph->set_list, px); +} +/**************************/ +/* NEW - dat_graph: add y */ +/**************************/ +void dat_graph_add_y(g_data_y dy,gpointer pgraph){ +struct graph_pak *graph = pgraph; +g_data_y *py; + +g_assert(graph != NULL); + +if(dy.y_size==0) { + /*empty size data set are OK*/ + py=g_malloc(sizeof(g_data_y)); + py->y_size=0; + py->y=NULL; + py->idx=NULL; + py->type=GRAPH_REGULAR; + py->symbol=NULL; + py->line=GRAPH_LINE_NONE; + py->color=0; + graph->size++;/*graph size hold the number of y arrays!*/ + graph->set_list = g_slist_append(graph->set_list, py); + return; +} +/*duplicate and register*/ +py=g_malloc(sizeof(g_data_y)); +g_assert(py != NULL); +py->y_size=dy.y_size; +py->y=g_malloc(dy.y_size*sizeof(gdouble)); +memcpy(py->y,dy.y,dy.y_size*sizeof(gdouble)); +if(dy.idx==NULL) py->idx=NULL; +else{ + py->idx=g_malloc(dy.y_size*sizeof(gint32)); + memcpy(py->idx,dy.idx,dy.y_size*sizeof(gint32)); +} +if(dy.symbol==NULL) py->symbol=NULL; +else{ + py->symbol=g_malloc(dy.y_size*sizeof(graph_symbol)); + memcpy(py->symbol,dy.symbol,dy.y_size*sizeof(graph_symbol)); +} +py->line=dy.line; +py->color=dy.color; +py->type=dy.type; + +graph->size++;/*graph size hold the number of y arrays!*/ +graph->set_list = g_slist_append(graph->set_list, py); +} +/*******************************/ +/* NEW - dat_graph: set limits */ +/*******************************/ +void dat_graph_set_limits(gdouble x_min,gdouble x_max,gdouble y_min,gdouble y_max,gpointer pgraph){ +struct graph_pak *graph = pgraph; + +g_assert(graph != NULL); + +graph->xmin = x_min; +graph->xmax = x_max; +graph->ymin = y_min; +graph->ymax = y_max; +} +/*******************************/ +/* NEW - set global graph type */ +/*******************************/ +void dat_graph_set_type(graph_type type,gpointer pgraph){ +struct graph_pak *graph = pgraph; + +g_assert(graph != NULL); + +graph->type=type; +} /*********************************************/ /* select a value in a GRAPH_FREQUENCY graph */ /*********************************************/ @@ -346,30 +429,29 @@ for (list=graph->set_list ; list ; list=g_slist_next(list)) } } } -/***************************************/ -/* Select a value in GRAPH_USPEX graph */ -/***************************************/ -void graph_uspex_select(gint x, gint y, struct model_pak *model){ -/*when selected, print value and open the corresponding structure file*/ +/***********************************/ +/* NEW - dat_graph: select a value */ +/***********************************/ +void dat_graph_select(gint x, gint y, struct model_pak *model){ struct graph_pak *graph; struct canvas_pak *canvas; - gint struct_sel; - gdouble ox,dx; - gdouble oy,dy,yf; - gint yy; + gdouble ox,dx, xf; + gdouble oy,dy, yf; + gint xx,yy; int i,j; - gdouble *ptr; GSList *list; -/*just a try*/ - FILE *vf; - gint n_struct; - /*get the selected structure*/ + FILE *vf; + gint x_index; + gint y_index; + g_data_x *p_x; + g_data_y *p_y; + g_assert(model!=NULL); - graph=(struct graph_pak *)model->graph_active; + graph=(struct graph_pak *)model->graph_active; g_assert(graph!=NULL); - canvas = g_slist_nth_data(sysenv.canvas_list, 0); + canvas = g_slist_nth_data(sysenv.canvas_list, 0); g_assert(canvas!=NULL); -/*calculate real data*/ +/*calculate x data*/ ox=canvas->x + 4*gl_fontsize; if (graph->ylabel) ox+=4*gl_fontsize; oy=canvas->y + canvas->height - 2*gl_fontsize; @@ -377,158 +459,99 @@ g_assert(canvas!=NULL); dy=(canvas->height-8.0*gl_fontsize); dx=(canvas->width-2.0*ox); - struct_sel=(gint)(0.25+((x-ox)/dx)*(graph->size));/*generation*/ - struct_sel--; - -/*check if the data point exists*/ -if((struct_sel<0)||(struct_sel>graph->size-1)) return;/*not in there*/ - -/*USPEX_BEST: simple search*/ -if(graph->type==GRAPH_USPEX_BEST){ -list=graph->set_list;/*there should be only one list*/ -ptr = (gdouble *) list->data; -i = struct_sel + 1; -yf = ptr[i]; -yf -= graph->ymin; -yf /= (graph->ymax - graph->ymin); -yf *= dy; -yy = (gint) yf; -yy *= -1; -yy += oy; -if((y>yy-3)&&(yuspex; - /*we have a hit*/ - graph->select=struct_sel; - graph->select_2=ptr[i]; - g_free(graph->select_label); - graph->select_label=g_strdup_printf("[%i,%f]",struct_sel+1,ptr[i]); - vf=fopen(model->filename, "r"); - if(!vf) return; - model->cur_frame=(*uspex_calc).best_ind[struct_sel+1];/*this is the structure number*/ - read_raw_frame(vf,model->cur_frame,model); - fclose(vf); - tree_model_refresh(model); - model_prep(model); - return;/*no need to continue for all data!*/ -} -}else{ -/*USPEX: more complex search*/ -j=0;n_struct=0; -for (list=graph->set_list ; list ; list=g_slist_next(list)) - { - if(j>struct_sel) return; - if(jdata; - n_struct+=(gint)ptr[0]; - j++; - continue; - }else{ - /*we are on the good set*/ - ptr = (gdouble *) list->data; - for(i=1;i<=(gint)ptr[0];i++){ - yf = ptr[i]; - yf -= graph->ymin; - yf /= (graph->ymax - graph->ymin); - yf *= dy; - yy = (gint) yf; - yy *= -1; - yy += oy; - if((y>yy-3)&&(yuspex; - /*we have a hit*/ - graph->select=struct_sel; - graph->select_2=ptr[i]; - g_free(graph->select_label); - graph->select_label=g_strdup_printf("[%i,%f]",struct_sel+1,ptr[i]); + list=graph->set_list; + p_x = (g_data_x *) list->data; + /*get the corresponding x index*/ + x_index=-1; + for(i=0;ix_size;i++){ + xf = p_x->x[i]; + xf -= graph->xmin; + xf /= (graph->xmax - graph->xmin); + xx = ox + xf*dx; + if((x>xx-3)&&(xtype==GRAPH_IY_TYPE)||(graph->type==GRAPH_XY_TYPE)){ + for ( ; list ; list=g_slist_next(list)){ + p_y = (g_data_y *) list->data; + yf = p_y->y[x_index];/*only need to look here*/ + yf -= graph->ymin; + yf /= (graph->ymax - graph->ymin); + yf *= dy; + yy = (gint) yf; + yy *= -1; + yy += oy; + if((y>yy-3)&&(yselect=x_index; + graph->select_2=p_y->y[x_index]; + if(graph->select_label) g_free(graph->select_label); + if(graph->type==GRAPH_IY_TYPE) graph->select_label=g_strdup_printf("[%i,%f]",(gint)p_x->x[x_index],p_y->y[x_index]); + else graph->select_label=g_strdup_printf("[%G,%G]",p_x->x[x_index],p_y->y[x_index]); + if(p_y->idx!=NULL) { + if(p_y->idx[x_index]<0) { + update_frame_uspex(p_y->idx[x_index]-1,model); + return;/*unavailable*/ + } + /*load structure*/ vf=fopen(model->filename, "r"); if(!vf) return; - if((*uspex_calc).method==US_CM_META) n_struct++; - model->cur_frame=n_struct+i-1; - read_raw_frame(vf,n_struct+i-1,model); + model->cur_frame=p_y->idx[x_index]-1; + read_raw_frame(vf,p_y->idx[x_index]-1,model); fclose(vf); tree_model_refresh(model); model_prep(model); - return;/*no need to continue for all data!*/ } + break; } j++; } - } -} -} -/******************************************/ -/* Select a value in GRAPH_USPEX_2D graph */ -/******************************************/ -void graph_uspex_2d_select(gint x, gint y, struct model_pak *model){ -/*when selected, print value and open the corresponding structure file*/ - struct graph_pak *graph; - struct canvas_pak *canvas; - gdouble ox,dx, xf; - gdouble oy,dy, yf; - gint xx,yy; - int i; - gdouble *xval; - gdouble *yval; - gdouble *tag; - GSList *list; - FILE *vf; - /*get the selected structure*/ -g_assert(model!=NULL); - graph=(struct graph_pak *)model->graph_active; -g_assert(graph!=NULL); - canvas = g_slist_nth_data(sysenv.canvas_list, 0); -g_assert(canvas!=NULL); -/*calculate real data*/ - ox=canvas->x + 4*gl_fontsize; - if (graph->ylabel) ox+=4*gl_fontsize; - oy=canvas->y + canvas->height - 2*gl_fontsize; - if (graph->xlabel) oy-=2*gl_fontsize; - dy=(canvas->height-8.0*gl_fontsize); - dx=(canvas->width-2.0*ox); - -/*first set is tags*/ -list=graph->set_list; -tag = (gdouble *) list->data; -list=g_slist_next(list); -/*second set is x*/ -xval = (gdouble *) list->data; -list=g_slist_next(list); - -for ( ; list ; list=g_slist_next(list)){ - i=0; - yval = (gdouble *) list->data; - while(isize){ - xf = xval[i]; - xf -= graph->xmin; - xf /= (graph->xmax - graph->xmin); - xx = ox + xf*dx; - if((x>xx-3)&&(xtype==GRAPH_IX_TYPE)||(graph->type==GRAPH_XX_TYPE)){ + /*in this case, we know the data is on the x_index set*/ + list=g_slist_nth(graph->set_list,x_index+1); + if(!list) return;/*missing data?*/ + p_y = (g_data_y *) list->data; + for(j=0;jy_size;j++){ + yf = p_y->y[j]; yf -= graph->ymin; yf /= (graph->ymax - graph->ymin); yf *= dy; yy = (gint) yf; yy *= -1; yy += oy; - if((y>yy-3)&&(yselect=i; - graph->select_2=yval[i]; - g_free(graph->select_label); - graph->select_label=g_strdup_printf("[%f,%f]",xval[i],yval[i]); - vf=fopen(model->filename, "r"); - if(!vf) return; - model->cur_frame=tag[i]; - read_raw_frame(vf,tag[i],model); - fclose(vf); - tree_model_refresh(model); - model_prep(model); - return;/*no need to continue for all data!*/ + if((y>yy-3)&&(yselect=x_index; + graph->select_2=p_y->y[y_index]; + if(graph->select_label) g_free(graph->select_label); + if(graph->type==GRAPH_IX_TYPE) graph->select_label=g_strdup_printf("[%i,%f]",(gint)p_x->x[x_index],p_y->y[y_index]); + else graph->select_label=g_strdup_printf("[%G,%G]",p_x->x[x_index],p_y->y[y_index]); + if(p_y->idx!=NULL) { + if(p_y->idx[y_index]<0) { + update_frame_uspex(p_y->idx[y_index],model); + return;/*unavailable*/ + } + /*load structure*/ + vf=fopen(model->filename, "r"); + if(!vf) return; + model->cur_frame=p_y->idx[y_index]; + read_raw_frame(vf,p_y->idx[y_index],model); + fclose(vf); + tree_model_refresh(model); + model_prep(model); + } + break; } } - i++; - } - -} + }else return;/*unknown graph type*/ } /************************************/ /* graph data extraction primitives */ @@ -578,8 +601,14 @@ gint size; gint shift; gint nkpoints; gdouble sz; -gdouble *xval; -gdouble xmin,xmax; +gdouble *xval=NULL; +gdouble xmin=0.; +gdouble xmax=0.; +/*NEW - dat_graph*/ +g_data_x *gx=NULL; +g_data_y *gy=NULL; +graph_type type=graph->type; +graph_line line=GRAPH_LINE_NONE; /* compute origin */ ox = canvas->x + 4*gl_fontsize; if (graph->ylabel) ox += 4*gl_fontsize; @@ -592,7 +621,7 @@ dx = (canvas->width-2.0*ox); glColor3f(sysenv.render.fg_colour[0],sysenv.render.fg_colour[1],sysenv.render.fg_colour[2]); glLineWidth(2.0); /* x labels */ -if((graph->type==GRAPH_DOS)&&(graph->xticks>2)){ +if((type==GRAPH_DOS)&&(graph->xticks>2)){ /* we WANT 0 to be a tick, if nticks>2 */ sz=(graph->xmax-graph->xmin)/(graph->xticks);/*size of a tick*/ shift=(gint)(graph->xmin/sz); @@ -629,14 +658,14 @@ if((graph->type==GRAPH_DOS)&&(graph->xticks>2)){ for (i=0 ; ixticks ; i++){ /* get real index */ xf = (gdouble) i / (gdouble) (graph->xticks-1); - if(graph->type==GRAPH_BANDOS){ + if(type==GRAPH_BANDOS){ x = ox + xf*dx*0.3; }else{ x = ox + xf*dx; } if (graph->xlabel){ /*only calculate real value when needed*/ - if(graph->type!=GRAPH_BANDOS){ + if(type!=GRAPH_BANDOS){ xf *= (graph->xmax-graph->xmin); xf += graph->xmin; } @@ -654,7 +683,7 @@ if((graph->type==GRAPH_DOS)&&(graph->xticks>2)){ } } /* another x axis */ -if(graph->type==GRAPH_BANDOS){ +if(type==GRAPH_BANDOS){ /*second x axis*/ oldx = ox+dx*0.4; for (i=0 ; ixticks ; i++){ @@ -677,7 +706,7 @@ if(graph->type==GRAPH_BANDOS){ } } /* y labels */ -if(((graph->type==GRAPH_BANDOS)||(graph->type==GRAPH_BAND))&&(graph->yticks>2)){ +if(((type==GRAPH_BANDOS)||(type==GRAPH_BAND))&&(graph->yticks>2)){ /* we WANT 0 to be a tick, if nticks>2 */ sz=(graph->ymax-graph->ymin)/(graph->yticks);/*size of a tick*/ shift=(gint)(graph->ymin/sz); @@ -741,7 +770,7 @@ if(((graph->type==GRAPH_BANDOS)||(graph->type==GRAPH_BAND))&&(graph->yticks>2)){ } } /* another y axis */ -if(graph->type==GRAPH_BANDOS){ +if(type==GRAPH_BANDOS){ x=ox+0.4*dx; y=oy-dy; oldy=oy; @@ -801,7 +830,7 @@ flag = FALSE; sx = sy = 0; list=graph->set_list; size=graph->size; -if(graph->type==GRAPH_BANDOS){ +if(type==GRAPH_BANDOS){ /*first set is the DOS, to put on [0,0.3] of x, rotated by 90 degrees*/ ptr = (gdouble *) list->data; glBegin(GL_LINE_STRIP); @@ -833,47 +862,65 @@ if(graph->type==GRAPH_BANDOS){ size=nkpoints; list=g_slist_next(list); } -if(graph->type==GRAPH_BAND){ +if(type==GRAPH_BAND){ /*the first set of GRAPH_BAND data contain X values*/ /*we do not read the full header (yet)*/ ptr = (gdouble *) list->data; xval=&(ptr[4]); list=g_slist_next(list); } -if(graph->type==GRAPH_USPEX_2D){ -/*first set is the tags, ignore*/ -list=g_slist_next(list); -/*second set is x*/ - ptr = (gdouble *) list->data; - xval=&(ptr[0]); +if((type==GRAPH_IY_TYPE) + ||(type==GRAPH_XY_TYPE) + ||(type==GRAPH_IX_TYPE) + ||(type==GRAPH_XX_TYPE)){ +/*we have dedicated x,y*/ + gx=(g_data_x *)list->data; + xval=&(gx->x[0]); list=g_slist_next(list); } j=0; for ( ; list ; list=g_slist_next(list)) { - ptr = (gdouble *) list->data; + /*FIXME here with ALL graph*/ + if((type==GRAPH_IY_TYPE) + ||(type==GRAPH_XY_TYPE) + ||(type==GRAPH_IX_TYPE) + ||(type==GRAPH_XX_TYPE)){ + gy=(g_data_y *)list->data; + ptr=&(gy->y[0]); + size=gy->y_size; + line=gy->line; + if((ptr==NULL)||(size==0)){ + /*empty data set is OK*/ + j++; + continue; + } + if(gy->type!=GRAPH_REGULAR) type=gy->type; + } else { + ptr = (gdouble *) list->data; + } oldx=-1; oldy=-1; i=0; - if(graph->type==GRAPH_USPEX) size=(gint)ptr[0]; while(itype){ - case GRAPH_USPEX_BEST: - xf = (gdouble) (i); - yf = ptr[i+1]; +switch (type){ + case GRAPH_IY_TYPE: + case GRAPH_XY_TYPE: + xf = xval[i]; + yf = ptr[i]; break; - case GRAPH_USPEX: - xf = (gdouble) (j); - yf = ptr[i+1]; + case GRAPH_IX_TYPE: + case GRAPH_XX_TYPE: + xf = xval[j]; + yf = ptr[i]; break; case GRAPH_FREQUENCY: case GRAPH_DOS: xf = ptr[i]; yf = ptr[i+1]; break; - case GRAPH_USPEX_2D: case GRAPH_BANDOS: case GRAPH_BAND: xf = xval[i]; @@ -888,13 +935,14 @@ switch (graph->type){ /*new: skip drawing for points outside of graph extrema (also interrupt line when line drawing)*/ if((xfxmin)||(xf>graph->xmax)||(yfymin)||(yf>graph->ymax)) { /*update index*/ - switch(graph->type){ + switch(type){ case GRAPH_FREQUENCY: case GRAPH_DOS: i++;/* ie twice ++ */ - case GRAPH_USPEX_2D: - case GRAPH_USPEX_BEST: - case GRAPH_USPEX: + case GRAPH_IY_TYPE: + case GRAPH_XY_TYPE: + case GRAPH_IX_TYPE: + case GRAPH_XX_TYPE: case GRAPH_BAND: case GRAPH_BANDOS: case GRAPH_REGULAR: @@ -905,7 +953,7 @@ if((xfxmin)||(xf>graph->xmax)||(yfymin)||(yf>graph->ymax)) { continue; } /*calculate screen values*/ -switch (graph->type){ +switch (type){ case GRAPH_FREQUENCY: /*we can draw impulse directly*/ glBegin(GL_LINE_STRIP); @@ -954,27 +1002,11 @@ switch (graph->type){ y *= -1; y += oy; break; - case GRAPH_USPEX_BEST: - case GRAPH_USPEX: - xf += 1.; - xf /= (gdouble) (graph->size);/*NOT size*/ - x = ox + xf*dx; - yf -= graph->ymin; - yf /= (graph->ymax - graph->ymin); - yf *= dy; - y = (gint) yf; - y *= -1; - y += oy; - /*draw a rectangle*/ - glBegin(GL_LINE_STRIP); - gl_vertex_window(x-2, y-2, canvas); - gl_vertex_window(x+2, y-2, canvas); - gl_vertex_window(x+2, y+2, canvas); - gl_vertex_window(x-2, y+2, canvas); - gl_vertex_window(x-2, y-2, canvas); - glEnd(); - break; - case GRAPH_USPEX_2D: + case GRAPH_IY_TYPE: + case GRAPH_XY_TYPE: + case GRAPH_IX_TYPE: + case GRAPH_XX_TYPE: +// xf += 1.; xf -= graph->xmin; xf /= (graph->xmax - graph->xmin); x = ox + xf*dx; @@ -984,7 +1016,59 @@ switch (graph->type){ y = (gint) yf; y *= -1; y += oy; - /*draw a rectangle*/ +if(gy->symbol){ + switch(gy->symbol[i]){ + case GRAPH_SYMB_SQUARE: + glBegin(GL_LINE_STRIP); + gl_vertex_window(x-2, y-2, canvas); + gl_vertex_window(x+2, y-2, canvas); + gl_vertex_window(x+2, y+2, canvas); + gl_vertex_window(x-2, y+2, canvas); + gl_vertex_window(x-2, y-2, canvas); + glEnd(); + break; + case GRAPH_SYMB_CROSS: + glBegin(GL_LINE_STRIP); + gl_vertex_window(x-2, y-2, canvas); + gl_vertex_window(x+2, y+2, canvas); + glEnd(); + glBegin(GL_LINE_STRIP); + gl_vertex_window(x+2, y-2, canvas); + gl_vertex_window(x-2, y+2, canvas); + glEnd(); + break; + case GRAPH_SYMB_TRI_DN: + glBegin(GL_LINE_STRIP); + gl_vertex_window(x, y+3, canvas); + gl_vertex_window(x-3, y-3, canvas); + gl_vertex_window(x+3, y-3, canvas); + gl_vertex_window(x, y+3, canvas); + glEnd(); + break; + case GRAPH_SYMB_TRI_UP: + glBegin(GL_LINE_STRIP); + gl_vertex_window(x, y-3, canvas); + gl_vertex_window(x-3, y+3, canvas); + gl_vertex_window(x+3, y+3, canvas); + gl_vertex_window(x, y-3, canvas); + glEnd(); + break; + case GRAPH_SYMB_DIAM: + glBegin(GL_LINE_STRIP); + gl_vertex_window(x, y+5, canvas); + gl_vertex_window(x-5, y, canvas); + gl_vertex_window(x, y-5, canvas); + gl_vertex_window(x+5, y, canvas); + gl_vertex_window(x, y+5, canvas); + glEnd(); + break; + case GRAPH_SYMB_NONE: + default: + /*no symbol*/ + break; + } +}else{ + /*draw a default rectangle*/ glBegin(GL_LINE_STRIP); gl_vertex_window(x-2, y-2, canvas); gl_vertex_window(x+2, y-2, canvas); @@ -992,6 +1076,7 @@ switch (graph->type){ gl_vertex_window(x-2, y+2, canvas); gl_vertex_window(x-2, y-2, canvas); glEnd(); +} if((i == graph->select)&&(ptr[i] == graph->select_2)){ sx=x; sy=y-1; @@ -1017,19 +1102,49 @@ switch (graph->type){ } if(oldx!=-1){ /*plot LINE data*/ - switch(graph->type){ - case GRAPH_USPEX: - case GRAPH_USPEX_2D: + switch(type){ + case GRAPH_IY_TYPE: + case GRAPH_XY_TYPE: + /* NEW: use line*/ + switch(line){ + case GRAPH_LINE_THICK: + glLineWidth(2.0); + case GRAPH_LINE_SINGLE: + glBegin(GL_LINE_STRIP); + gl_vertex_window(oldx, oldy-1, canvas); + gl_vertex_window(x, y-1, canvas); + glEnd(); + glLineWidth(1.0); + break; + case GRAPH_LINE_DASH: + glEnable(GL_LINE_STIPPLE); + glLineStipple(1,0xCCCC); + glBegin(GL_LINE_STRIP); + gl_vertex_window(oldx, oldy-1, canvas); + gl_vertex_window(x, y-1, canvas); + glEnd(); + glDisable(GL_LINE_STIPPLE); + case GRAPH_LINE_DOT: + glEnable(GL_LINE_STIPPLE); + glLineStipple(1,0xAAAA); + glBegin(GL_LINE_STRIP); + gl_vertex_window(oldx, oldy-1, canvas); + gl_vertex_window(x, y-1, canvas); + glEnd(); + glDisable(GL_LINE_STIPPLE); + break; + case GRAPH_LINE_NONE: + default: + break; + } + break; + case GRAPH_IX_TYPE: + case GRAPH_XX_TYPE: + /*not ready yet*/ break; case GRAPH_FREQUENCY: /*we should never reach here*/ break; - case GRAPH_USPEX_BEST: - glBegin(GL_LINE_STRIP); - gl_vertex_window(oldx,oldy-1,canvas); - gl_vertex_window(x,y-1,canvas); - glEnd(); - break; case GRAPH_DOS: case GRAPH_BAND: case GRAPH_REGULAR: @@ -1045,13 +1160,14 @@ if(oldx!=-1){ oldx=x; oldy=y; /*update index*/ - switch(graph->type){ + switch(type){ case GRAPH_FREQUENCY: case GRAPH_DOS: i++;/* ie twice ++ */ - case GRAPH_USPEX: - case GRAPH_USPEX_BEST: - case GRAPH_USPEX_2D: + case GRAPH_IY_TYPE: + case GRAPH_XY_TYPE: + case GRAPH_IX_TYPE: + case GRAPH_XX_TYPE: case GRAPH_BAND: case GRAPH_BANDOS: case GRAPH_REGULAR: @@ -1062,7 +1178,7 @@ if(oldx!=-1){ j++; } /*outside of loop*/ -switch (graph->type){ +switch (type){ /*plot add-axis*/ case GRAPH_DOS: /* need 0 y axis at Fermi level */ @@ -1115,71 +1231,88 @@ switch (graph->type){ gl_vertex_window(x, y-1, canvas); glEnd(); break; - case GRAPH_USPEX_BEST: - case GRAPH_USPEX_2D:/*TODO: add a 0.5 composition axis?*/ - case GRAPH_USPEX: + case GRAPH_IY_TYPE: + case GRAPH_XY_TYPE: + case GRAPH_IX_TYPE: + case GRAPH_XX_TYPE: case GRAPH_FREQUENCY: case GRAPH_REGULAR: default: break; } - -/* draw peak selector */ -/*regular, frequency*/ - if (flag) { - glEnable(GL_LINE_STIPPLE); - glLineStipple(1, 0x0303); - glColor3f(0.9, 0.7, 0.4); - glLineWidth(2.0); - glBegin(GL_LINES); - gl_vertex_window(sx, sy-10, canvas); - gl_vertex_window(sx, 3*gl_fontsize, canvas); - glEnd(); - - if (graph->select_label) - { - gint xoff; - - xoff = (gint) strlen(graph->select_label); - xoff *= gl_fontsize; - xoff /= 4; - gl_print_window(graph->select_label, sx-xoff, 2*gl_fontsize, canvas); - } - glDisable(GL_LINE_STIPPLE); - } -/* uspex, uspex_best */ - if(((graph->type==GRAPH_USPEX)||(graph->type==GRAPH_USPEX_BEST))&&(graph->select_label!=NULL)){ - xf = (gdouble) (graph->select+1) / (gdouble) (graph->size); - sx = ox + xf*dx; - yf = graph->select_2; - yf -= graph->ymin; - yf /= (graph->ymax - graph->ymin); - yf *= dy; - sy = (gint) yf; - sy *= -1; - sy += oy; - glEnable(GL_LINE_STIPPLE); - glLineStipple(1, 0x0303); - glColor3f(0.9, 0.7, 0.4); - glLineWidth(2.0); - /*horizontal*/ - glBegin(GL_LINES); - gl_vertex_window(ox, sy, canvas); - gl_vertex_window(sx, sy, canvas); - glEnd(); - /*vertical*/ - glBegin(GL_LINES); - gl_vertex_window(sx, sy, canvas); - gl_vertex_window(sx, -1*(gint)(dy)+oy, canvas); - glEnd(); - /*label*/ - gint xoff; - xoff = (gint) strlen(graph->select_label); - xoff *= gl_fontsize; - xoff /= 4; - gl_print_window(graph->select_label, sx-xoff, 2*gl_fontsize, canvas); - glDisable(GL_LINE_STIPPLE); - } +/* NEW - selector*/ + if((flag)||(graph->select_label!=NULL)){ + gint xoff; + list=graph->set_list; + glEnable(GL_LINE_STIPPLE); + glLineStipple(1, 0x0303); + glColor3f(0.9, 0.7, 0.4); + glLineWidth(2.0); + /*depend on graph->type ; TODO: manage changing types*/ + switch(graph->type){ + case GRAPH_IX_TYPE: + case GRAPH_XX_TYPE: + gx=(g_data_x *)list->data; + xf=gx->x[graph->select]; + yf=graph->select_2; + xf -= graph->xmin; + xf /= (graph->xmax - graph->xmin); + sx = ox + xf*dx; + yf -= graph->ymin; + yf /= (graph->ymax - graph->ymin); + yf *= dy; + sy = (gint) yf; + sy *= -1; + sy += oy; + /*horizontal*/ + glBegin(GL_LINES); + gl_vertex_window(ox, sy, canvas); + gl_vertex_window(sx, sy, canvas); + glEnd(); + /*vertical*/ + glBegin(GL_LINES); + gl_vertex_window(sx, sy, canvas); + gl_vertex_window(sx, -1*(gint)(dy)+oy, canvas); + glEnd(); + break; + case GRAPH_IY_TYPE: + case GRAPH_XY_TYPE: + gx=(g_data_x *)list->data; + xf=gx->x[graph->select]; + yf=graph->select_2; + xf -= graph->xmin; + xf /= (graph->xmax - graph->xmin); + sx = ox + xf*dx; + yf -= graph->ymin; + yf /= (graph->ymax - graph->ymin); + yf *= dy; + sy = (gint) yf; + sy *= -1; + sy += oy; + /*horizontal*/ + glBegin(GL_LINES); + gl_vertex_window(ox, sy, canvas); + gl_vertex_window(sx, sy, canvas); + glEnd(); + /*vertical*/ + glBegin(GL_LINES); + gl_vertex_window(sx, sy, canvas); + gl_vertex_window(sx, -1*(gint)(dy)+oy, canvas); + glEnd(); + break; + default: + glBegin(GL_LINES); + gl_vertex_window(sx, sy-10, canvas); + gl_vertex_window(sx, 3*gl_fontsize, canvas); + glEnd(); + } + /*label is always same (I think)*/ + xoff = (gint) strlen(graph->select_label); + xoff *= gl_fontsize; + xoff /= 4; + gl_print_window(graph->select_label, sx-xoff, 2*gl_fontsize, canvas); + glDisable(GL_LINE_STIPPLE); + } } /****************/ @@ -1193,9 +1326,10 @@ void graph_draw_1d(struct canvas_pak *canvas, struct graph_pak *graph) case GRAPH_BAND: case GRAPH_DOS: case GRAPH_BANDOS: - case GRAPH_USPEX: - case GRAPH_USPEX_BEST: - case GRAPH_USPEX_2D: + case GRAPH_IY_TYPE: + case GRAPH_XY_TYPE: + case GRAPH_IX_TYPE: + case GRAPH_XX_TYPE: graph_draw_new(canvas,graph); break; default: @@ -1278,7 +1412,8 @@ void graph_read(gchar *filename) { gint i, j, n, num_tokens; gchar *fullpath, *line, **buff; -gdouble xstart, xstop, x[GRAPH_SIZE_MAX], *y; +gdouble xstart=0.; +gdouble xstop, x[GRAPH_SIZE_MAX], *y; GArray *garray; gpointer graph; struct model_pak *model; diff --git a/src/gl_main.c b/src/gl_main.c index 3050357..12dfb55 100644 --- a/src/gl_main.c +++ b/src/gl_main.c @@ -1326,7 +1326,8 @@ g_assert(data != NULL); /* turn lighting off for wire frame drawing - looks esp ugly */ /* when hidden (stippled) lines and normal lines are overlayed */ -if (0.5*sysenv.render.wire_surface) +//if (0.5*sysenv.render.wire_surface) +if (((gint)0.5*sysenv.render.wire_surface)!=0) glDisable(GL_LIGHTING); glLineWidth(sysenv.render.frame_thickness); diff --git a/src/graph.h b/src/graph.h index 985d177..5c7b734 100644 --- a/src/graph.h +++ b/src/graph.h @@ -21,16 +21,47 @@ The GNU GPL can also be found at http://www.gnu.org */ typedef enum { - GRAPH_REGULAR=0,/*previous plain graph*/ - GRAPH_FREQUENCY,/*impulse graph for frequency*/ - GRAPH_BAND,/*kpoints/state energy graph */ - GRAPH_DOS,/*interleave e,dos plot*/ - GRAPH_BANDOS,/*dual BAND & DOS graph*/ - GRAPH_USPEX,/*point graph with selectable*/ - GRAPH_USPEX_BEST,/*linepoint graph with selectable*/ - GRAPH_USPEX_COMP,/*composition vs energy, point with selectable*/ - GRAPH_USPEX_2D,/*2D point graph with selectable*/ + GRAPH_REGULAR=0, /*previous plain graph*/ + GRAPH_FREQUENCY, /*impulse graph for frequency*/ + GRAPH_BAND, /*kpoints/state energy graph */ + GRAPH_DOS, /*interleave e,dos plot*/ + GRAPH_BANDOS, /*dual BAND & DOS graph*/ + /* NEW - graph: generic data types*/ + GRAPH_IY_TYPE, /*nx integer {x} + ny sets of {nx real y for all x}*/ + GRAPH_XY_TYPE, /*nx real {x} + ny sets of {nx real y for all x}*/ + GRAPH_IX_TYPE, /*nx integer {x} + nx sets of {ny real y for one x}*/ + GRAPH_XX_TYPE, /*nx real {x} + nx sets of {ny real y for one x}*/ } graph_type; +typedef enum { + /* NEW - graph: symbol shapes */ + GRAPH_SYMB_NONE=0, + GRAPH_SYMB_CROSS, + GRAPH_SYMB_SQUARE, + GRAPH_SYMB_TRI_DN, + GRAPH_SYMB_TRI_UP, + GRAPH_SYMB_DIAM, +} graph_symbol; +typedef enum { + /* NEW - graph: line shapes */ + GRAPH_LINE_NONE=0, /*no lines*/ + GRAPH_LINE_SINGLE, /*single line*/ + GRAPH_LINE_DASH, /*dashed line*/ + GRAPH_LINE_DOT, /*dotted line*/ + GRAPH_LINE_THICK, /*thick line*/ +} graph_line; +typedef struct { + gint x_size; /*size of the x array*/ + gdouble *x; /* -> x array*/ +} g_data_x; +typedef struct { + gint y_size; /*size of a y array*/ + gdouble *y; /* -> y array*/ + gint32 *idx; /*index up to 2,147,483,647 (<0 = missing structure)*/ + graph_type type; /* NEW - type can change for each set! */ + graph_symbol *symbol; /*symbol for each data*/ + graph_line line; /*one line type per set*/ + gdouble color; /*TODO graph set color*/ +} g_data_y; /*******************/ /* data structures */ /*******************/ @@ -44,7 +75,7 @@ struct graph_pak /* flags */ gint xlabel; gint ylabel; - graph_type type; + graph_type type; /*TODO eliminate this*/ /* graph layout */ gint xticks; gint yticks; @@ -54,15 +85,16 @@ struct graph_pak gdouble ymax; /* NB: all sets are required to be <= size */ gint size; - GSList *set_list;/*in case of 1D graph, set_list={x[,tag]} for 2D set_list={x,y[,tag]}*/ + GSList *set_list;/*in case of 1D graph, set_list={x[]} for other set_list={g_data_x,g_data_y[]}*/ /* peak selection */ gint select; - gdouble select_2;/*uspex peak selections require two index*/ + gdouble select_2;/*peak selections for 2D graph*/ gchar *select_label; }; gpointer graph_new(const gchar *, struct model_pak *); void graph_free_list(struct model_pak *); void graph_free(gpointer, struct model_pak *); +void graph_set_color(gint size,gchar *color,gpointer data); void graph_add_data(gint, gdouble *, gdouble, gdouble, gpointer); void graph_add_borned_data(gint size,gdouble *x,gdouble x_min,gdouble x_max,gdouble y_min,gdouble y_max,gint type,gpointer data); void graph_frequency_select(gint x, gint y, struct model_pak *model); @@ -85,6 +117,13 @@ gdouble graph_xmax(gpointer); gdouble graph_ymin(gpointer); gdouble graph_ymax(gpointer); gdouble graph_wavelength(gpointer); +/* dat_graph interface */ +void dat_graph_set_x(g_data_x dx,gpointer pgraph); +void dat_graph_add_y(g_data_y dy,gpointer pgraph); +void dat_graph_set_limits(gdouble x_min,gdouble x_max,gdouble y_min,gdouble y_max,gpointer pgraph); +void dat_graph_set_type(graph_type type,gpointer pgraph); +void dat_graph_select(gint x, gint y, struct model_pak *model); + /* TODO - relocate */ gint anim_next_frame(struct model_pak *); diff --git a/src/gui_defs.h b/src/gui_defs.h new file mode 100644 index 0000000..5695f07 --- /dev/null +++ b/src/gui_defs.h @@ -0,0 +1,460 @@ +/* +Copyright (C) 2018 by Okadome Valencia + +hubert.valencia _at_ imass.nagoya-u.ac.jp + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +The GNU GPL can also be found at http://www.gnu.org +*/ + +/* graphic define interface */ +/**************************************************** + * By using compiler defines, this is aimed to be an + * easy to upgrade interface design: by just changing + * the content here will upgrade all files gui_* that + * use a specific GTK interface... --OVHPA + ****************************************************/ + +/* DEFINES: interface */ +#define GUI_SPACE 0 +#define GUI_OBJ GtkWidget +#define GUI_NOTE GtkNotebook +#define GUI_TEXTVIEW GtkTextView +#define GUI_TEXTVIEW_BUFFER GtkTextBuffer + +/*****************/ +/* BOX INTERFACE */ +/*****************/ +/*Create a new frame (frame) in box (box)*/ +/*Q: add? gtk_container_set_border_width(GTK_CONTAINER(frame), GUI_SPACE);*/ +#define GUI_FRAME_BOX(box,frame) do{\ + frame = gtk_frame_new(NULL);\ + gtk_box_pack_start(GTK_BOX(box),frame,FALSE,FALSE,0);\ +}while(0) +/*Set a new horizontal box (hbox) in a box (box).*/ +#define GUI_LINE_BOX(box,hbox) do{\ + hbox = gtk_hbox_new(FALSE, 0);\ + gtk_container_set_border_width(GTK_CONTAINER(hbox), GUI_SPACE);\ + gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);\ +}while(0) +/*Set a new label (label) with text ("text") in a box (box).*/ +#define GUI_LABEL_BOX(box,label,text) do{\ + label = gtk_label_new(text);\ + gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);\ +}while(0) +/*Set a new text entry (entry) with initial value ("value") expanding (wilde=TRUE) or not (wilde=FALSE) in an horizontal box (hbox).*/ +#define GUI_TEXT_ENTRY(hbox,entry,value,wilde) do{\ + gchar *_text;\ + entry=gtk_entry_new();\ + _text=g_strdup_printf("%s",value);\ + if(value!=NULL) gtk_entry_set_text(GTK_ENTRY(entry),_text);\ + gtk_box_pack_start(GTK_BOX(hbox), entry, wilde, wilde, 0);\ + g_free(_text);\ +}while(0) +/*Set a new entry (entry) with initial value (value) of format ("format") with a width of (size) characters, in an horizontal box (hbox).*/ +#define GUI_ENTRY(hbox,entry,value,format,size) do{\ + gchar *_text;\ + entry=gtk_entry_new();\ + _text=g_strdup_printf(format,value);\ + gtk_entry_set_text(GTK_ENTRY(entry),_text);\ + gtk_entry_set_width_chars (GTK_ENTRY(entry),size);\ + gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0);\ + g_free(_text);\ +}while(0) +/*Set a new separator (separator) in an horizontal box (hbox).*/ +#define GUI_NEW_SEPARATOR(hbox,separator) do{\ + separator=gtk_hseparator_new();\ + gtk_box_pack_start(GTK_BOX(hbox), separator, TRUE, FALSE, 0);\ +}while(0) +/*Set a new combo (combo), with an uneditable link to GLIST (list) which is FREED after link, with an initial value ("default_text"), and connected to function (function), in an horizontal box (hbox).*/ +/* THIS GTK COMBO USE IS DEPRECATED! */ +#define GUI_REG_COMBO(hbox,combo,list,default_text,function) do{\ + combo = gtk_combo_new();\ +_Pragma ("GCC warning \"use of GTK COMBO interface is deprecated!\"");\ + gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(combo)->entry), FALSE);\ + gtk_combo_set_popdown_strings(GTK_COMBO(combo), list);\ + g_list_free(list);\ + gtk_box_pack_start(GTK_BOX(hbox), combo, FALSE, FALSE, 0);\ + gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry),default_text);\ + g_signal_connect(GTK_OBJECT(GTK_COMBO(combo)->entry), "changed",GTK_SIGNAL_FUNC(function),data);\ +}while(0) +/*Create can open button (button) connected on click to function (function) in box (box).*/ +#define GUI_OPEN_BUTTON_BOX(box,button,function) do{\ + button=gtk_button_new_from_stock(GTK_STOCK_OPEN);\ + gtk_box_pack_end(GTK_BOX(box), button, FALSE, FALSE, 0);\ + g_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(function),NULL);\ +}while(0) +/*Create an gtk-absurdly complex uneditable, scrollable textview (tv) with textbuffer (tv_buffer), in a box (box).*/ +#define GUI_TEXTVIEW_BOX(box,tv,tv_buffer) do{\ + GtkWidget *_absurd = gtk_scrolled_window_new(NULL, NULL);\ + tv = gtk_text_view_new();\ + tv_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tv));\ + gtk_text_view_set_editable(GTK_TEXT_VIEW(tv),FALSE);\ + gtk_widget_set_sensitive(tv,FALSE);\ + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(_absurd),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);\ + gtk_container_add(GTK_CONTAINER(_absurd),tv);\ + gtk_container_set_border_width(GTK_CONTAINER(_absurd),1);\ + gtk_box_pack_start(GTK_BOX(box),_absurd,TRUE,TRUE,0);\ +}while(0) +/*Set text ("text") in textbuffer (tv_buffer)*/ +#define GUI_TEXTVIEW_SET(tv_buffer,text) do{\ + gtk_text_buffer_set_text(tv_buffer,text,-1);\ +}while(0) +/*Insert text ("text") in textbuffer (tv_buffer) - at cursor.*/ +#define GUI_TEXTVIEW_INSERT(tv_buffer,text) do{\ + gtk_text_buffer_insert_at_cursor(tv_buffer,text,-1);\ +}while(0) +/**********************/ +/* NOTEBOOK INTERFACE */ +/**********************/ +/*create a new page (page) with label ("caption") in notebook (notebook).*/ +#define GUI_PAGE_NOTE(notebook,page,caption) do{\ + GtkWidget *_label = gtk_label_new(caption);\ + page = gtk_vbox_new(FALSE, GUI_SPACE);\ + gtk_notebook_append_page(GTK_NOTEBOOK(notebook),page,_label);\ +}while(0) +/*Create a new frame (frame) with label ("caption") in a notebook page (page).*/ +#define GUI_FRAME_NOTE(page,frame,caption) do{\ + frame = gtk_frame_new(caption);\ + gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0);\ +}while(0) +/*create a new table (table) in a notebook page (page).*/ +#define GUI_TABLE_NOTE(page,table,row,col) do{\ + table=gtk_table_new(row, col, FALSE);\ + gtk_box_pack_start(GTK_BOX(page),table,TRUE,TRUE,0);\ +}while(0) +/*Connect a switch-page even of a notebook (notebook) to a function (function) passing data (data).*/ +#define GUI_PAGE_CHANGE(notebook,function,data) do{\ + g_signal_connect(GTK_NOTEBOOK(notebook),"switch-page",GTK_SIGNAL_FUNC(function),data);\ +}while(0) +/*return page number*/ +#define GUI_NOTE_PAGE_NUMBER(notebook,number) do{\ + number = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));\ +}while(0) +/*hide a page*/ +#define GUI_NOTE_PAGE_HIDE(page) do{\ + gtk_widget_hide(page);\ +}while(0) +/*show a page*/ +#define GUI_NOTE_PAGE_SHOW(page) do{\ + gtk_widget_show(page);\ +}while(0) +/*******************/ +/* FRAME INTERFACE */ +/*******************/ +/*Create a new vertical box (vbox) in a frame (frame).*/ +#define GUI_VBOX_FRAME(frame,vbox) do{\ + vbox = gtk_vbox_new(FALSE, GUI_SPACE);\ + gtk_container_add(GTK_CONTAINER(frame), vbox);\ +}while(0) +/*Create a new unexpanded (row) x (col) table (table) in a frame (frame).*/ +#define GUI_TABLE_FRAME(frame,table,row,col) do{\ + table = gtk_table_new(row, col, FALSE);\ + gtk_container_add(GTK_CONTAINER(frame), table);\ +}while(0) +/*Create a new toptab notebook (notebook) with border in a frame (frame).*/ +#define GUI_NOTE_FRAME(frame,notebook) do{\ + notebook = gtk_notebook_new();\ + gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP);\ + gtk_container_add(GTK_CONTAINER(frame), notebook);\ + gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook), TRUE);\ +}while(0) +/************************************************************************************/ +/* TABLE INTERFACE: */ +/* all of the *_TABLE() defines set a new table cell @l,r,t,b in table (table).*/ +/************************************************************************************/ +#define _ATTACH_TABLE(table,widget,l,r,t,b) gtk_table_attach_defaults(GTK_TABLE(table),widget,l,r,t,b) +//gtk_table_attach(GTK_TABLE(table),widget,l,r,t,b,GTK_FILL,GTK_FILL,0,0) +/*Create a new cell with: + * a label with text ("text")*/ +#define GUI_LABEL_TABLE(table,text,l,r,t,b) do{\ + GtkWidget *_label = gtk_label_new(text);\ + _ATTACH_TABLE(table,_label,l,r,t,b);\ +}while(0) +/*Create a new frame with the text ("text")*/ +#define GUI_FRAME_TABLE(table,text,l,r,t,b) do{\ + GtkWidget *_frame = gtk_frame_new(text);\ + _ATTACH_TABLE(table,_frame,l,r,t,b);\ +}while(0) +/*Create a new cell with: + * a boxed label (created with GUI_LABEL_BOX) with text ("caption"), + * an expanded text entry (entry, created with GUI_TEXT_ENTRY) with a default value ("value").*/ +#define GUI_TEXT_TABLE(table,entry,value,caption,l,r,t,b) do{\ + GtkWidget *_label;\ + GtkWidget *_hbox = gtk_hbox_new(FALSE, 0);\ + GUI_LABEL_BOX(_hbox,_label,caption);\ + GUI_TEXT_ENTRY(_hbox,entry,value,TRUE);\ + _ATTACH_TABLE(table,_hbox,l,r,t,b);\ +}while(0) +/*Create a new cell with: + * a boxed label (created with GUI_LABEL_BOX) with text ("caption"), + * a boxed separator, + * a sized-8 boxed entry (entry, created with GUI_ENTRY) with an initial value (value) of format ("format").*/ +#define GUI_ENTRY_TABLE(table,entry,value,format,caption,l,r,t,b) do{\ + GtkWidget *_separator;\ + GtkWidget *_label;\ + GtkWidget *_hbox = gtk_hbox_new(FALSE, 0);\ + GUI_LABEL_BOX(_hbox,_label,caption);\ + GUI_NEW_SEPARATOR(_hbox,_separator);\ + GUI_ENTRY(_hbox,entry,value,format,8);\ + _ATTACH_TABLE(table,_hbox,l,r,t,b);\ +}while(0) +/*Create a new cell with: + * a new check button (check) with an initial value (value) connected to function (function) with text ("caption").*/ +#define GUI_CHECK_TABLE(table,check,value,function,caption,l,r,t,b) do{\ + GtkWidget *_hbox = gtk_hbox_new(FALSE, 0);\ + check = gui_direct_check(caption,&(value),function,NULL,_hbox);\ + _ATTACH_TABLE(table,_hbox,l,r,t,b);\ +}while(0) +/*Create a new cell with: + * a boxed label (created with GUI_LABEL_BOX) with text ("caption"), + * a boxed separator, + * a boxed combo (combo,created with GUI_REG_COMBO) linked to GLIST (list) which is FREED after GUI_REG_COMBO. + * */ +/* THIS GTK COMBO USE IS DEPRECATED! */ +#define GUI_COMBO_TABLE(table,combo,default_text,function,caption,l,r,t,b) do{\ + GtkWidget *_separator;\ + GtkWidget *_label;\ + GtkWidget *_hbox = gtk_hbox_new(FALSE, 0);\ +_Pragma ("GCC warning \"use of GTK COMBO interface is deprecated!\"");\ + GUI_LABEL_BOX(_hbox,_label,caption);\ + GUI_NEW_SEPARATOR(_hbox,_separator);\ + GUI_REG_COMBO(hbox,combo,list,default_text,function);\ + _ATTACH_TABLE(table,_hbox,l,r,t,b);\ +}while(0) +/*Create a new cell with: + * a separator (not boxed!). + * a.k.a. an empty cell.*/ +#define GUI_SEPARATOR_TABLE(l,r,t,b) do{\ + GtkWidget *_separator = gtk_hseparator_new();\ + gtk_table_attach_defaults(GTK_TABLE(table),_separator,l,r,t,b);\ +}while(0) +/*Create a new cell with: + * a boxed label with text ("caption"), + * an extended boxed combobox which is set as uneditable.*/ +/* THIS IS THE PROPER (but not simplier) REPLACEMENT FOR GTK COMBO DEPRECATED INTERFACE! */ +#define GUI_COMBOBOX_TABLE(table,combobox,caption,l,r,t,b) do{\ + GtkWidget *_hbox = gtk_hbox_new(FALSE, 0);\ + GtkWidget *_label = gtk_label_new(caption);\ + gtk_box_pack_start(GTK_BOX(_hbox),_label,FALSE,FALSE,0);\ + combobox=gtk_combo_box_text_new_with_entry();\ + gtk_entry_set_editable(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combobox))),FALSE);\ + gtk_box_pack_start(GTK_BOX(_hbox),combobox,TRUE,TRUE,0);\ + _ATTACH_TABLE(table,_hbox,l,r,t,b);\ +}while(0) +/*Add a new element with text ("text") in the combobox (combobox). + * This have to be called AFTER GUI_COMBOBOX.*/ +#define GUI_COMBOBOX_ADD(combobox,text) do{\ + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox),text);\ +}while(0) +/*Set a default value (default_value) of the combobox (combobox), and register the function (function) for a changed value in combobox. + * This have to be called AFTER GUI_COMBOBOX and preferentially after GUI_COMBOBOX_ADD added some elements to combobox. + * If GUI_COMBOBOX_ADD is called after, it may trigger the function (function) each time.*/ +#define GUI_COMBOBOX_SETUP(combobox,default_value,function) do{\ + gtk_combo_box_set_active(GTK_COMBO_BOX(combobox),default_value);\ + if((function)!=NULL) g_signal_connect(GTK_COMBO_BOX_TEXT(combobox),"changed",GTK_SIGNAL_FUNC(function),data);\ +}while(0) +/*Only set a default value (default_value) for the combobox (combobox). + * Can be call anytime, and is equivalent to GUI_COMBOBOX_SETUP(combobox,default_value,NULL).*/ +#define GUI_COMBOBOX_SET(combobox,default_value) do{\ + gtk_combo_box_set_active(GTK_COMBO_BOX(combobox),default_value);\ +}while(0) +/*Get combobox (combobox) active index (index).*/ +#define GUI_COMBOBOX_GET(combobox,index) do{\ + index=gtk_combo_box_get_active(GTK_COMBO_BOX(combobox));\ +}while(0) +/*Get combobox (combobox) active text ("text")*/ +#define GUI_COMBOBOX_GET_TEXT(combobox,text) do{\ + text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(combobox));\ +}while(0) +/*Insert combobox (combobox) text ("text") at position index (index).*/ +/* NEW: use non-deprecated gtk_combo_box_text_insert_text */ +#define GUI_COMBOBOX_ADD_TEXT(combobox,index,text) do{\ + gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(combobox),index,text);\ +}while(0) +/*Prepend text ("text") in combobox (combobox).*/ +#define GUI_COMBOBOX_PREPEND_TEXT(combobox,text) do{\ + gtk_combo_box_text_prepend_text(GTK_COMBO_BOX_TEXT(combobox),text);\ +}while(0) +/*Delete combobox (combobox) text at position index (index)*/ +#define GUI_COMBOBOX_DEL(combobox,index) do{\ + gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(combobox),index);\ +}while(0) +/*Wipe the combobox (combobox)*/ +#define GUI_COMBOBOX_WIPE(combobox) do{\ + gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combobox))));\ +}while(0) +/*Create a new cell with: + * a boxed spin button, which default value is 1 and interval is [1,100], and labeled with text ("caption"). + * Due to limitation of GTK, value has to be of double type and not integer (event though it make little sense).*/ +#define GUI_SPIN_TABLE(table,spin,value,function,caption,l,r,t,b) do{\ + GtkWidget *_hbox = gtk_hbox_new(FALSE, 0);\ + spin = gui_direct_spin(caption,&(value),1.0,100.0,1.0,function,NULL,_hbox);\ + _ATTACH_TABLE(table,_hbox,l,r,t,b);\ +}while(0) +/*Set spin (spin) within range [min,max] (min,max).*/ +#define GUI_SPIN_RANGE(spin,min,max) do{\ + gtk_spin_button_set_range(GTK_SPIN_BUTTON(spin),min,max);\ +}while(0) +/*Set spin (spin) at value (value).*/ +#define GUI_SPIN_SET(spin,value) do{\ + gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin),value);\ +}while(0) +/*Create a new cell with: + * a button (button) with label "text" connected on click to function (function)*/ +#define GUI_BUTTON_TABLE(table,button,text,function,l,r,t,b) do{\ + button=gtk_button_new_with_label (text);\ + _ATTACH_TABLE(table,button,l,r,t,b);\ + g_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(function),NULL);\ +}while(0) +/*Create a new cell with: + * an open button (button) connected on click to function (function).*/ +#define GUI_OPEN_BUTTON_TABLE(table,button,function,l,r,t,b) do{\ + button=gtk_button_new_from_stock(GTK_STOCK_OPEN);\ + _ATTACH_TABLE(table,button,l,r,t,b);\ + g_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(function),NULL);\ +}while(0) +/*Create a new cell with: + * an apply button (button) connected on click to function (function).*/ +#define GUI_APPLY_BUTTON_TABLE(table,button,function,l,r,t,b) do{\ + button=gtk_button_new_from_stock(GTK_STOCK_APPLY);\ + _ATTACH_TABLE(table,button,l,r,t,b);\ + g_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(function),NULL);\ +}while(0) +/*Create a new cell with: + * a delete button (button) connected on click to function (function).*/ +#define GUI_DELETE_BUTTON_TABLE(table,button,function,l,r,t,b) do{\ + button=gtk_button_new_from_stock(GTK_STOCK_DELETE);\ + _ATTACH_TABLE(table,button,l,r,t,b);\ + g_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(function),NULL);\ +}while(0) +/*Create a new cell with: + * a boxed button of type APPLY connected on click to a function (function_1), + * a boxed button of type DELETE connected on click to a function (function_2).*/ +#define GUI_2BUTTONS_TABLE(table,function_1,function_2,l,r,t,b) do{\ + GtkWidget *_hbox = gtk_hbox_new(FALSE, 0);\ + GtkWidget *_sep;\ + GUI_NEW_SEPARATOR(_hbox,_sep);\ + gui_stock_button(GTK_STOCK_APPLY,function_1,NULL,_hbox);\ + gui_stock_button(GTK_STOCK_DELETE,function_2,NULL,_hbox);\ + _ATTACH_TABLE(table,_hbox,l,r,t,b);\ +}while(0) +/*left aligned labels*/ +/*Create a new cell with: + * a boxed label with text ("caption"), + * a separator. + * a.k.a. a left aligned label.*/ +#define GUI_LEFT_LABEL_TABLE(table,caption,l,r,t,b) do{\ + GtkWidget *_separator;\ + GtkWidget *_hbox = gtk_hbox_new(FALSE, 0);\ + GtkWidget *_label = gtk_label_new(caption);\ + gtk_box_pack_start(GTK_BOX(_hbox),_label,FALSE,FALSE,0);\ + GUI_NEW_SEPARATOR(_hbox,_separator);\ + _ATTACH_TABLE(table,_hbox,l,r,t,b);\ +}while(0) +/*Create a new cell with: + * a radio button (radio_1) with caption ("caption_1") connected to function (pointer_1) + * a radio button (radio_2) with caption ("caption_2") connected to function (pointer_2)*/ +#define GUI_2RADIO_TABLE(table,radio_1,caption_1,pointer_1,radio_2,caption_2,pointer_2,l,r,t,b) do{\ + GtkWidget *_vbox = gtk_vbox_new(FALSE,0);\ + new_radio_group(0,_vbox,FF);\ + radio_1 = add_radio_button(caption_1,(gpointer)pointer_1,NULL);\ + radio_2 = add_radio_button(caption_2,(gpointer)pointer_2,NULL);\ + _ATTACH_TABLE(table,_vbox,l,r,t,b);\ +}while(0) +/********************/ +/* GENERAL COMMANDS */ +/********************/ +/*create a tooltip with text ("text") for the widget (widget).*/ +#define GUI_TOOLTIP(widget,text) gtk_widget_set_tooltip_text(widget,text) +/*registering value of entry (entry) into variable (value), according to format (format).*/ +#define GUI_REG_VAL(entry,value,format) do{\ + sscanf(gtk_entry_get_text(GTK_ENTRY(entry)),format,&(value));\ +}while(0) +/*set the entry (entry) text ("text")*/ +#define GUI_ENTRY_TEXT(entry,text) gtk_entry_set_text(GTK_ENTRY(entry),text); +/*connect entry (entry) on change with the function (function) passing data (data).*/ +#define GUI_ENTRY_CHANGE(entry,function,data) g_signal_connect(GTK_OBJECT(GTK_ENTRY(entry)),"changed",GTK_SIGNAL_FUNC(function),data) +/*connect entry (entry) on activation (enter key) with the function (function) passing data (data).*/ +#define GUI_ENTRY_ACTIVATE(entry,function,data) g_signal_connect(GTK_OBJECT(GTK_ENTRY(entry)),"activate",GTK_SIGNAL_FUNC(function),data) +/*get the text ("text") of an entry (entry).*/ +/* NEW: GTK2 says that return text is const and shall not be freed, hence the g_strdup + * so text HAVE TO be freed after use.*/ +#define GUI_ENTRY_GET_TEXT(entry,text) do{\ + text=g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));\ +}while(0) +/*get the lenght of text in entry (entry)*/ +#define GUI_ENTRY_LENGHT(entry) (gtk_entry_get_text_length(GTK_ENTRY(entry))) +/*set sensitivity of a widget*/ +#define GUI_LOCK(widget) gtk_widget_set_sensitive(widget,FALSE) +#define GUI_UNLOCK(widget) gtk_widget_set_sensitive(widget,TRUE) +/*set a toggle button (button) ON and OFF*/ +#define GUI_TOGGLE_ON(button) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),TRUE) +#define GUI_TOGGLE_OFF(button) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),FALSE) +/*insert a frame (frame) in a dialog (window) using an implicit vertical box.*/ +#define GUI_FRAME_WINDOW(window,frame) do{\ + GUI_FRAME_BOX(GTK_DIALOG(window)->vbox,frame);\ +}while(0) +/*add a save action button (button) connected to function (function) passing data (data) on the dialog (window).*/ +#define GUI_SAVE_ACTION(window,button,function,data) do{\ + button=gui_stock_button(GTK_STOCK_SAVE,function,data,GTK_DIALOG(window)->action_area);\ +}while(0) +/*add an execute action button (button) connected to function (function) passing data (data) on the dialog (window).*/ +#define GUI_EXEC_ACTION(window,button,function,data) do{\ + button=gui_stock_button(GTK_STOCK_EXECUTE,function,data,GTK_DIALOG(window)->action_area);\ +}while(0) +/*add a close action button (button) connected to function (function) passing data (data) on the dialog (window).*/ +#define GUI_CLOSE_ACTION(window,button,function,data) do{\ + button=gui_stock_button(GTK_STOCK_CLOSE,function,data,GTK_DIALOG(window)->action_area);\ +}while(0) +/*prepare an open-dialog (open_dialog) in the window (window) with the title (title) and an implicit filter with pattern (filter_pattern) and filter title (filter_caption).*/ +#define GUI_PREPARE_OPEN_DIALOG(window,open_dialog,title,filter_pattern,filter_caption) do{\ + GtkFileFilter *_filter = gtk_file_filter_new();\ + gtk_file_filter_add_pattern(_filter,filter_pattern);\ + if(filter_caption!=NULL) gtk_file_filter_set_name (_filter,filter_caption);\ + open_dialog = gtk_file_chooser_dialog_new(title,GTK_WINDOW(window),GTK_FILE_CHOOSER_ACTION_OPEN,GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_OPEN,GTK_RESPONSE_ACCEPT,NULL);\ + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(open_dialog),_filter);\ +}while(0) +/*prepare an open-folder dialog (open_dialog) in the window (window) with the title (title).*/ +#define GUI_PREPARE_OPEN_FOLDER(window,open_dialog,title) do{\ + open_dialog = gtk_file_chooser_dialog_new(title,GTK_WINDOW(window),GTK_FILE_CHOOSER_ACTION_OPEN,GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_OPEN,GTK_RESPONSE_ACCEPT,NULL);\ + gtk_file_chooser_set_action(GTK_FILE_CHOOSER(open_dialog),GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);\ +}while(0) +/*run the previously open-dialog (open_dialog) and either: + * i) get selected filename (filename) and signal having an answer (have_answer); + * OR + * ii) set filename to NULL and signal absence of answer (have_answer). */ +#define GUI_OPEN_DIALOG_RUN(open_dialog,have_answer,filename) do{\ + if(gtk_dialog_run(GTK_DIALOG(open_dialog)) == GTK_RESPONSE_ACCEPT) {\ + have_answer=TRUE;\ + filename=gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser));\ + }else{\ + have_answer=FALSE;\ + filename=NULL;\ + }\ +}while(0) +/*destroy the open-dialog (open_dialog)*/ +#define GUI_KILL_OPEN_DIALOG(open_dialog) do{\ + gtk_widget_destroy (GTK_WIDGET(open_dialog));\ +}while(0) +/*display the dialog (window).*/ +#define GUI_SHOW(window) do{\ + gtk_widget_show_all(window);\ +}while(0) +/*close window (window)*/ +#define GUI_CLOSE(window) do{\ + gtk_widget_destroy(window);\ +}while(0) diff --git a/src/gui_main.c b/src/gui_main.c index 5ea9fbc..6419b14 100644 --- a/src/gui_main.c +++ b/src/gui_main.c @@ -129,8 +129,7 @@ if (data->graph_active) struct graph_pak *graph=(struct graph_pak *)data->graph_active; if(graph->type==GRAPH_REGULAR) diffract_select_peak(x, y, data); if(graph->type==GRAPH_FREQUENCY) graph_frequency_select(x, y, data); - if((graph->type==GRAPH_USPEX)||(graph->type==GRAPH_USPEX_BEST)) graph_uspex_select(x,y,data); - if(graph->type==GRAPH_USPEX_2D) graph_uspex_2d_select(x,y,data); + if((graph->type==GRAPH_IY_TYPE)||(GRAPH_XY_TYPE)||(GRAPH_IX_TYPE)||(GRAPH_XX_TYPE)) dat_graph_select(x,y,data); return(FALSE); } @@ -1376,6 +1375,7 @@ static GtkItemFactoryEntry menu_items[] = { "/Tools/Computation/Monty...", NULL, monty_dialog, 0, NULL }, { "/Tools/Computation/SIESTA...", NULL, gui_siesta_dialog, 0, NULL }, { "/Tools/Computation/VASP...", NULL, gui_vasp_dialog, 0, NULL }, + { "/Tools/Computation/USPEX...", NULL, gui_uspex_dialog, 0, NULL }, { "/Tools/Analysis", NULL, NULL, 0, "" }, { "/Tools/Analysis/Dynamics...", NULL, gui_analysis_dialog, 0, NULL }, diff --git a/src/gui_setup.c b/src/gui_setup.c index 61d273f..c3f8b39 100644 --- a/src/gui_setup.c +++ b/src/gui_setup.c @@ -52,7 +52,7 @@ frame = gtk_frame_new(NULL); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox), frame, FALSE, FALSE, PANEL_SPACING); gtk_container_set_border_width(GTK_CONTAINER(frame), PANEL_SPACING); -table = gtk_table_new(2, 8, FALSE); +table = gtk_table_new(2, 9, FALSE); gtk_container_add(GTK_CONTAINER(frame), table); gtk_container_set_border_width(GTK_CONTAINER(table), PANEL_SPACING); @@ -77,39 +77,46 @@ vbox = gtk_vbox_new(TRUE, 0); gtk_table_attach_defaults(GTK_TABLE(table),vbox,1,2,2,3); gui_text_entry(NULL, &sysenv.vasp_path, TRUE, TRUE, vbox); -label = gtk_label_new("MPIRUN"); +label = gtk_label_new("USPEX"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,3,4); vbox = gtk_vbox_new(TRUE, 0); gtk_table_attach_defaults(GTK_TABLE(table),vbox,1,2,3,4); -gui_text_entry(NULL, &sysenv.mpirun_path, TRUE, TRUE, vbox); +gui_text_entry(NULL, &sysenv.uspex_path, TRUE, TRUE, vbox); -label = gtk_label_new("GULP"); +label = gtk_label_new("MPIRUN"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,4,5); vbox = gtk_vbox_new(TRUE, 0); gtk_table_attach_defaults(GTK_TABLE(table),vbox,1,2,4,5); -gui_text_entry(NULL, &sysenv.gulp_path, TRUE, TRUE, vbox); +gui_text_entry(NULL, &sysenv.mpirun_path, TRUE, TRUE, vbox); -label = gtk_label_new("Monty"); +label = gtk_label_new("GULP"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,5,6); vbox = gtk_vbox_new(TRUE, 0); gtk_table_attach_defaults(GTK_TABLE(table),vbox,1,2,5,6); -gui_text_entry(NULL, &sysenv.monty_path, TRUE, TRUE, vbox); +gui_text_entry(NULL, &sysenv.gulp_path, TRUE, TRUE, vbox); -label = gtk_label_new("POVRay"); +label = gtk_label_new("Monty"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,6,7); vbox = gtk_vbox_new(TRUE, 0); gtk_table_attach_defaults(GTK_TABLE(table),vbox,1,2,6,7); -gui_text_entry(NULL, &sysenv.povray_path, TRUE, TRUE, vbox); +gui_text_entry(NULL, &sysenv.monty_path, TRUE, TRUE, vbox); -label = gtk_label_new("Image viewer "); +label = gtk_label_new("POVRay"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,7,8); vbox = gtk_vbox_new(TRUE, 0); gtk_table_attach_defaults(GTK_TABLE(table),vbox,1,2,7,8); +gui_text_entry(NULL, &sysenv.povray_path, TRUE, TRUE, vbox); + +label = gtk_label_new("Image viewer "); +gtk_misc_set_alignment(GTK_MISC(label), 0, 0); +gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,8,9); +vbox = gtk_vbox_new(TRUE, 0); +gtk_table_attach_defaults(GTK_TABLE(table),vbox,1,2,8,9); gui_text_entry(NULL, &sysenv.viewer_path, TRUE, TRUE, vbox); /* termination */ diff --git a/src/gui_uspex.c b/src/gui_uspex.c new file mode 100644 index 0000000..034b696 --- /dev/null +++ b/src/gui_uspex.c @@ -0,0 +1,4695 @@ +/* +Copyright (C) 2018 by Okadome Valencia + +hubert.valencia _at_ imass.nagoya-u.ac.jp + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +The GNU GPL can also be found at http://www.gnu.org +*/ + +/* simple USPEX launcher */ + +#include +#include +#include +#include +#include +#include +#include + + +#include "gdis.h" +#include "coords.h" +#include "model.h" +#include "file.h" +#include "matrix.h" +#include "module.h" +#include "numeric.h" +#include "parse.h" +#include "project.h" +#include "render.h" +#include "spatial.h" +#include "quaternion.h" +#include "task.h" +#include "interface.h" +#include "dialog.h" +#include "gui_shorts.h" +#include "file_uspex.h" +#include "gui_defs.h" +#include "gui_uspex.h" + +extern struct sysenv_pak sysenv; +extern struct elem_pak elements[]; + +/*globals variables*/ +struct uspex_calc_gui uspex_gui; + +/*************************/ +/* initialize gui values */ +/*************************/ +void gui_uspex_init(struct model_pak *model){ + gint idx; + gchar *line; + gchar *ptr; + uspex_gui.cur_page=USPEX_PAGE_SYSTEM; + /*prepare local values*/ + uspex_gui._tmp_atom_typ=0;uspex_gui._tmp_atom_num=0;uspex_gui._tmp_atom_val=0; + strcpy(uspex_gui._tmp_atom_sym,elements[uspex_gui._tmp_atom_typ].symbol); + if(uspex_gui.calc._nspecies<1) uspex_gui.calc._nspecies=1; + if(uspex_gui.calc._num_opt_steps<1) uspex_gui.calc._num_opt_steps=1; + uspex_gui._tmp_num_opt_steps=(gdouble)uspex_gui.calc._num_opt_steps; + uspex_gui._tmp_curr_step=1.; + if(uspex_gui.calc._isfixed==NULL) { + uspex_gui.calc._isfixed=g_malloc(uspex_gui.calc._num_opt_steps*sizeof(gboolean)); + for(idx=0;idxdata); + idx++; + } + g_slist_free(list); + /*fill the numType with information from current model*/ + if(uspex_gui.calc.numSpecies!=NULL) g_free(uspex_gui.calc.numSpecies); + uspex_gui.calc._var_nspecies=1;/*we don't automatically vary formula at that point*/ + uspex_gui.calc.numSpecies = g_malloc(uspex_gui.calc._nspecies*sizeof(gint)); + for(idx=0;idxcores ; list ; list=g_slist_next(list)){ + idx=0; + core=list->data; + /*find corresponding species*/ + while(idxatom_code==uspex_gui.calc.atomType[idx]) uspex_gui.calc.numSpecies[idx]++; + idx++; + } + } +/*EX14 has valences, but no atomType \/(^^)\/ */ +// if(uspex_gui.calc.valences!=NULL) g_free(uspex_gui.calc.valences); + if(uspex_gui.calc.valences==NULL){ + uspex_gui.calc.valences = g_malloc(uspex_gui.calc._nspecies*sizeof(gint)); + for(idx=0;idxnum_atoms%10)*10; + uspex_gui.calc.initialPopSize=uspex_gui.calc.populationSize; + } + if(uspex_gui.calc.stopCrit==0) { + if(uspex_gui.calc._calctype_var) uspex_gui.calc.stopCrit=uspex_gui.calc.maxAt; + else uspex_gui.calc.stopCrit=model->num_atoms; + } + if(uspex_gui.calc.keepBestHM==0) uspex_gui.calc.keepBestHM=(gint)(0.15*(uspex_gui.calc.populationSize)); + if(uspex_gui.calc.symmetries==NULL){ + switch(uspex_gui.calc._calctype_dim){ + case 0: + uspex_gui.calc.symmetries=g_strdup("E C2 D2 C4 C3 C6 T S2 Ch1 Cv2 S4 S6 Ch3 Th Ch2 Ch4 D3 Ch6 O D4 Cv3 D6 Td Cv4 Dd3 Cv6 Oh C5 S5 S10 Cv5 Ch5 D5 Dd5 Dh5 I Ih"); + break; + case 1: + uspex_gui.calc.symmetries=g_strdup(""); + break; + case 2: + uspex_gui.calc.symmetries=g_strdup("2-17"); + break; + case 3: + default: + uspex_gui.calc.symmetries=g_strdup("2-230"); + } + } + if((uspex_gui.calc.fracPerm==0)&&(uspex_gui.calc._nspecies>1)) uspex_gui.calc.fracPerm=0.1; + if((uspex_gui.calc.fracRotMut==0)&&(uspex_gui.calc._calctype_mol)) uspex_gui.calc.fracRotMut=0.1; + if((uspex_gui.calc.fracLatMut==0)&&(uspex_gui.calc.optRelaxType!=1)) uspex_gui.calc.fracLatMut=0.1; + if((uspex_gui.calc.howManySwaps==0)&&(uspex_gui.calc._nspecies>1)&&(uspex_gui.calc.numSpecies!=NULL)){ + if(uspex_gui.calc.specificSwaps==NULL){ + gint i,j; + for(i=0;i<(uspex_gui.calc._nspecies-1);i++) + for(j=i+1;j default 300 + uspex_gui.calc.calculationType=US_CT_300; + uspex_gui.calc._calctype_dim=3; + uspex_gui.calc._calctype_mol=FALSE; + uspex_gui.calc._calctype_var=FALSE; + uspex_gui.calc._calctype_mag=FALSE; + } + /*now update uspex_gui._calctype_dim, uspex_gui._calctype_mol, and uspex_gui._calctype_var*/ + GUI_SPIN_SET(uspex_gui._calctype_dim,(gdouble)uspex_gui.calc._calctype_dim); + if(uspex_gui.calc._calctype_mol) GUI_TOGGLE_ON(uspex_gui._calctype_mol); + else GUI_TOGGLE_OFF(uspex_gui._calctype_mol); + if(uspex_gui.calc._calctype_var) GUI_TOGGLE_ON(uspex_gui._calctype_var); + else GUI_TOGGLE_OFF(uspex_gui._calctype_var); + if(uspex_gui.calc._calctype_mag) GUI_TOGGLE_ON(uspex_gui._calctype_mag); + else GUI_TOGGLE_OFF(uspex_gui._calctype_mag); + update_specific(); +} +/**************************/ +/* update calculationType */ +/**************************/ +void _update_calculationType(){ + gint i=0; + switch(uspex_gui.calc._calctype_dim){ + case 3://300,301,310,311 - VER 10.1 s300 s301 + i=300; + break; + case 2://200,201 - VER 10.1 s200 s201 + i=200; + uspex_gui.calc._calctype_mol=FALSE; + break; + case 1://110 + i=100; + uspex_gui.calc._calctype_mag=FALSE; + uspex_gui.calc._calctype_mol=TRUE; + uspex_gui.calc._calctype_var=FALSE; + break; + case 0://000 - VER 10.1 s000 001 + i=0; + uspex_gui.calc._calctype_mol=FALSE; + break; + case -2://-200 - VER 10.1 -s200 + i=200; + uspex_gui.calc._calctype_mol=FALSE; + uspex_gui.calc._calctype_var=FALSE; + break; + default://should not happen + i=300;/*reset to default value*/ + uspex_gui.calc._calctype_mag=FALSE; + uspex_gui.calc._calctype_mol=FALSE; + uspex_gui.calc._calctype_var=FALSE; + } + if(uspex_gui.calc._calctype_mag) i+=1000; + if(uspex_gui.calc._calctype_mol) i+=10; + if(uspex_gui.calc._calctype_var) i+=1; + if(uspex_gui.calc._calctype_dim==-2) i*=-1; + uspex_gui.calc.calculationType=i; + /*reset toogles*/ + if(uspex_gui.calc._calctype_mol) GUI_TOGGLE_ON(uspex_gui._calctype_mol); + else GUI_TOGGLE_OFF(uspex_gui._calctype_mol); + if(uspex_gui.calc._calctype_var) GUI_TOGGLE_ON(uspex_gui._calctype_var); + else GUI_TOGGLE_OFF(uspex_gui._calctype_var); + if(uspex_gui.calc._calctype_mag) GUI_TOGGLE_ON(uspex_gui._calctype_mag); + else GUI_TOGGLE_OFF(uspex_gui._calctype_mag); + /*reset select*/ + switch(uspex_gui.calc.calculationType){ + case US_CT_s300: + GUI_COMBOBOX_SET(uspex_gui.calculationType,1);break; + case US_CT_301: + GUI_COMBOBOX_SET(uspex_gui.calculationType,2);break; + case US_CT_s301: + GUI_COMBOBOX_SET(uspex_gui.calculationType,3);break; + case US_CT_310: + GUI_COMBOBOX_SET(uspex_gui.calculationType,4);break; + case US_CT_311: + GUI_COMBOBOX_SET(uspex_gui.calculationType,5);break; + case US_CT_000: + GUI_COMBOBOX_SET(uspex_gui.calculationType,6);break; + case US_CT_s000: + GUI_COMBOBOX_SET(uspex_gui.calculationType,7);break; + case US_CT_001: + GUI_COMBOBOX_SET(uspex_gui.calculationType,8);break; + case US_CT_110: + GUI_COMBOBOX_SET(uspex_gui.calculationType,9);break; + case US_CT_200: + GUI_COMBOBOX_SET(uspex_gui.calculationType,10);break; + case US_CT_s200: + GUI_COMBOBOX_SET(uspex_gui.calculationType,11);break; + case US_CT_201: + GUI_COMBOBOX_SET(uspex_gui.calculationType,12);break; + case US_CT_s201: + GUI_COMBOBOX_SET(uspex_gui.calculationType,13);break; + case US_CT_m200: + GUI_COMBOBOX_SET(uspex_gui.calculationType,14);break; + case US_CT_sm200: + GUI_COMBOBOX_SET(uspex_gui.calculationType,15);break; + case US_CT_300: + default: + GUI_COMBOBOX_SET(uspex_gui.calculationType,0); + } + update_specific(); +} +/************************/ +/* update _calctype_dim */ +/************************/ +void spin_update_dim(void){ + gint i=(gint)uspex_gui._dim; + /*ban the -1 value*/ + if(i==-1){ + if(uspex_gui.calc._calctype_dim==0) i=-2; + else i=0; + } + /*update calc value*/ + uspex_gui.calc._calctype_dim=i; + /*update spin value*/ + uspex_gui._dim=(gdouble)i; + GUI_SPIN_SET(uspex_gui._calctype_dim,uspex_gui._dim); + /*done, now update calculationType*/ + _update_calculationType(); +} +/*****************************************/ +/* toggle mol -> update calculation type */ +/*****************************************/ +void mol_toggle(void){ + gint dim=uspex_gui.calc._calctype_dim*100; + gint sgn; + if(dim<0) { + dim*=-1; + sgn=-1; + }else sgn=1; + if(uspex_gui.calc._calctype_mol){ + if(uspex_gui.calc._calctype_var) uspex_gui.calc.calculationType = dim+10+1; + else uspex_gui.calc.calculationType = dim+10; + }else{ + if(uspex_gui.calc._calctype_mag){ + if(uspex_gui.calc._calctype_var) uspex_gui.calc.calculationType = 1000+dim+1; + else uspex_gui.calc.calculationType = 1000+dim; + }else{ + if(uspex_gui.calc._calctype_var) uspex_gui.calc.calculationType = dim+1; + else uspex_gui.calc.calculationType = dim; + } + } + uspex_gui.calc.calculationType*=sgn; + /*done, now update calculationType*/ + _update_calculationType(); +} +/*****************************************/ +/* toggle var -> update calculation type */ +/*****************************************/ +void var_toggle(void){ + gint dim=uspex_gui.calc._calctype_dim*100; + gint sgn; + if(dim<0) { + dim*=-1; + sgn=-1; + }else sgn=1; + if(uspex_gui.calc._calctype_var){ + if(uspex_gui.calc._calctype_mol) uspex_gui.calc.calculationType = dim+10+1; + else if(uspex_gui.calc._calctype_mag) uspex_gui.calc.calculationType = 1000+dim+1; + else uspex_gui.calc.calculationType = dim+1; + }else{ + if(uspex_gui.calc._calctype_mol) uspex_gui.calc.calculationType = dim+10; + else if(uspex_gui.calc._calctype_mag) uspex_gui.calc.calculationType = 1000+dim; + else uspex_gui.calc.calculationType = dim; + } + uspex_gui.calc.calculationType*=sgn; + /*done, now update calculationType*/ + _update_calculationType(); +} +/*****************************************/ +/* mag_toggle -> update calculation type */ +/*****************************************/ +void mag_toggle(void){ + gint dim=uspex_gui.calc._calctype_dim*100; + gint sgn; + if(dim<0) { + dim*=-1; + sgn=-1; + }else sgn=1; + if(uspex_gui.calc._calctype_mag){ + if(uspex_gui.calc._calctype_var) uspex_gui.calc.calculationType = 1000+dim+1; + else uspex_gui.calc.calculationType = 1000+dim; + }else{ + if(uspex_gui.calc._calctype_mol){ + if(uspex_gui.calc._calctype_var) uspex_gui.calc.calculationType = dim+10+1; + else uspex_gui.calc.calculationType = dim+10; + }else{ + if(uspex_gui.calc._calctype_var) uspex_gui.calc.calculationType = dim+1; + else uspex_gui.calc.calculationType = dim; + } + } + uspex_gui.calc.calculationType*=sgn; + /*done, now update calculationType*/ + _update_calculationType(); + /*now enable/disable mag-related items*/ + if(uspex_gui.calc._calctype_mag){ + GUI_UNLOCK(uspex_gui.mag_nm); + GUI_UNLOCK(uspex_gui.mag_fmls); + GUI_UNLOCK(uspex_gui.mag_fmhs); + GUI_UNLOCK(uspex_gui.mag_afml); + GUI_UNLOCK(uspex_gui.mag_afmh); + GUI_UNLOCK(uspex_gui.mag_fmlh); + GUI_UNLOCK(uspex_gui.mag_aflh); + GUI_UNLOCK(uspex_gui.fracSpinMut); + + }else{ + GUI_LOCK(uspex_gui.mag_nm); + GUI_LOCK(uspex_gui.mag_fmls); + GUI_LOCK(uspex_gui.mag_fmhs); + GUI_LOCK(uspex_gui.mag_afml); + GUI_LOCK(uspex_gui.mag_afmh); + GUI_LOCK(uspex_gui.mag_fmlh); + GUI_LOCK(uspex_gui.mag_aflh); + GUI_LOCK(uspex_gui.fracSpinMut); + } +} +/***********************************/ +/* selecting optimization property */ +/***********************************/ +void uspex_optimization_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + uspex_gui.have_ZT=FALSE; + switch (index){ + case 0://1 + uspex_gui.calc.optType=US_OT_ENTHALPY;break; + case 1://2 + uspex_gui.calc.optType=US_OT_VOLUME;break; + case 2://3 + uspex_gui.calc.optType=US_OT_HARDNESS;break; + case 3://4 + uspex_gui.calc.optType=US_OT_ORDER;break; + case 4://5 + uspex_gui.calc.optType=US_OT_DISTANCE;break; + case 5://6 + uspex_gui.calc.optType=US_OT_DIELEC_S;break; + case 6://7 + uspex_gui.calc.optType=US_OT_GAP;break; + case 7://8 + uspex_gui.calc.optType=US_OT_DIELEC_GAP;break; + case 8://9 + uspex_gui.calc.optType=US_OT_MAG;break; + case 9://10 + uspex_gui.calc.optType=US_OT_QE;break; + case 10://11 + uspex_gui.calc.optType=US_OT_2R;break; + case 11://14 + uspex_gui.calc.optType=US_OT_ZT; + uspex_gui.have_ZT=TRUE; + break; + case 12://17 + uspex_gui.calc.optType=US_OT_Fphon;break; + case 13://1101 + uspex_gui.calc.optType=US_OT_BULK_M;break; + case 14://1102 + uspex_gui.calc.optType=US_OT_SHEAR_M;break; + case 15://1103 + uspex_gui.calc.optType=US_OT_YOUNG_M;break; + case 16://1104 + uspex_gui.calc.optType=US_OT_POISSON;break; + case 17://1105 + uspex_gui.calc.optType=US_OT_PUGH_R;break; + case 18://1106 + uspex_gui.calc.optType=US_OT_VICKERS_H;break; + case 19://1107 + uspex_gui.calc.optType=US_OT_FRACTURE;break; + case 20://1108 + uspex_gui.calc.optType=US_OT_DEBYE_T;break; + case 21://1109 + uspex_gui.calc.optType=US_OT_SOUND_V;break; + case 22://1110 + uspex_gui.calc.optType=US_OT_SWAVE_V;break; + case 23://1111 + uspex_gui.calc.optType=US_OT_PWAVE_V;break; + default: + uspex_gui.calc.optType=US_OT_UNKNOWN; + } + update_specific(); +} +/**********************/ +/* Selecting atomType */ +/**********************/ +void atomType_selected(GUI_OBJ *w){ + gchar *text; + gchar sym[3]; + GUI_COMBOBOX_GET_TEXT(w,text); + if (g_ascii_strcasecmp(text,"ADD ATOMTYPE") == 0) return;/*last selection*/ + sscanf(text,"%[^(](%i) (V=%i)",sym,&(uspex_gui._tmp_atom_num),&(uspex_gui._tmp_atom_val)); + sym[2]='\0';uspex_gui._tmp_atom_typ=elem_symbol_test(sym); + strcpy(uspex_gui._tmp_atom_sym,sym); + g_free(text); + /*update entries*/ + GUI_ENTRY_TEXT(uspex_gui._atom_sym,uspex_gui._tmp_atom_sym); + text=g_strdup_printf("%i",uspex_gui._tmp_atom_typ); + GUI_ENTRY_TEXT(uspex_gui._atom_typ,text); + g_free(text);text=g_strdup_printf("%i",uspex_gui._tmp_atom_num); + GUI_ENTRY_TEXT(uspex_gui._atom_num,text); + g_free(text);text=g_strdup_printf("%i",uspex_gui._tmp_atom_val); + GUI_ENTRY_TEXT(uspex_gui._atom_val,text); + g_free(text); +} +/************************************************************/ +/* update numSpecies in case it is changed through atomType */ +/************************************************************/ +void update_numSpecies(void){ + gchar *text; + gchar *tmp; + gint idx; + /**/ + if(uspex_gui.calc._calctype_var) return;/*we only update 1-line numSpecies here*/ +GUI_UNLOCK(uspex_gui.numSpecies); + GUI_COMBOBOX_WIPE(uspex_gui.numSpecies); + text=g_strdup_printf("%i",uspex_gui.calc.numSpecies[0]); + for(idx=1;idx should never happen*/ + GUI_COMBOBOX_SET(uspex_gui.atomType,0); + return; + } + GUI_COMBOBOX_GET_TEXT(uspex_gui.atomType,text); + /*mini-sync*/ + GUI_REG_VAL(uspex_gui._atom_sym,sym[0],"%s"); + GUI_REG_VAL(uspex_gui._atom_num,num,"%i"); + GUI_REG_VAL(uspex_gui._atom_val,val,"%i"); + typ = elem_symbol_test(sym); + /*trick to have a valid sym*/ + strcpy(sym,elements[typ].symbol); + if (g_ascii_strcasecmp(text,"ADD ATOMTYPE") == 0) { + g_free(text); + /*add a new atomType*/ + /*check if atomType does not exists*/ + idx=0; + GUI_COMBOBOX_SET(uspex_gui.atomType,0); + GUI_COMBOBOX_GET_TEXT(uspex_gui.atomType,text); + while(g_ascii_strcasecmp(text,"ADD ATOMTYPE") != 0){ + sscanf(text,"%[^(](%*i) (V=%*i)",tmp); + uspex_gui._tmp_atom_typ=elem_symbol_test(tmp); + if(uspex_gui._tmp_atom_typ==typ) exists=TRUE; + g_free(text); + idx++; + GUI_COMBOBOX_SET(uspex_gui.atomType,idx); + GUI_COMBOBOX_GET_TEXT(uspex_gui.atomType,text); + } + if(exists){ + text = g_strdup_printf("Atom type %s already exists! Can't add to atomType!\n",sym); + gui_text_show(ERROR,text); + g_free(text); + return; + }else{ + text = g_strdup_printf("%s(%i) (V=%i)",sym,num,val); + GUI_COMBOBOX_ADD_TEXT(uspex_gui.atomType,index,text); + g_free(text); + /*synchronize: calc.atomType, numSpecies*/ + atomType=g_malloc((uspex_gui.calc._nspecies+1)*sizeof(gint)); + numSpecies=g_malloc((uspex_gui.calc._nspecies+1)*sizeof(gint)); + for(idx=0;idx should never happen*/ + GUI_COMBOBOX_SET(uspex_gui.atomType,0); + return; + } + GUI_COMBOBOX_GET_TEXT(uspex_gui.atomType,text); + if (g_ascii_strcasecmp(text,"ADD ATOMTYPE") == 0) { + /*can't delete this one*/ + g_free(text); + return; + } + GUI_COMBOBOX_DEL(uspex_gui.atomType,index); + g_free(text); + /*synchronize: calc.atomType, numSpecies*/ + if(uspex_gui.calc._nspecies==1) return;/*this should never happen*/ + atomType=g_malloc((uspex_gui.calc._nspecies-1)*sizeof(gint)); + numSpecies=g_malloc((uspex_gui.calc._nspecies-1)*sizeof(gint)); + for(idx=0;idx1){ + GUI_COMBOBOX_WIPE(uspex_gui.numSpecies); + for(jdx=0;jdx should never happen*/ + GUI_COMBOBOX_SET(uspex_gui.numSpecies,0); + return; + } + if(!uspex_gui.calc._calctype_var) return;/*only varcomp allowed*/ + GUI_COMBOBOX_GET_TEXT(uspex_gui.numSpecies,text); + if (g_ascii_strcasecmp(text,"ADD SPECIES BLOCK") == 0){ + /*can't delete this one*/ + g_free(text); + return; + } + GUI_COMBOBOX_DEL(uspex_gui.numSpecies,index); + if(index-1<0) index=1; + GUI_COMBOBOX_SET(uspex_gui.numSpecies,index-1); + g_free(text); +} +/*********************/ +/* toggle auto_bonds */ +/*********************/ +void auto_bond_toggle(void){ + if(uspex_gui.auto_bonds){ + GUI_LOCK(uspex_gui.goodBonds); + GUI_LOCK(uspex_gui._bond_d); + }else{ + GUI_UNLOCK(uspex_gui.goodBonds); + GUI_UNLOCK(uspex_gui._bond_d); + } +} +/**********************/ +/* Selecting goodBond */ +/**********************/ +void goodBonds_selected(GUI_OBJ *w){ + gchar *text; + /**/ + GUI_COMBOBOX_GET_TEXT(w,text); + if (g_ascii_strcasecmp(text,"ADD GOODBOND") == 0) return;/*last selection*/ + /*the line is going directly into _bond_d*/ + if(uspex_gui._tmp_bond_d!=NULL) g_free(uspex_gui._tmp_bond_d); + uspex_gui._tmp_bond_d=g_strdup(text); + GUI_ENTRY_TEXT(uspex_gui._bond_d,uspex_gui._tmp_bond_d); + g_free(text); +} +/************************************/ +/* Change/ADD goodBonds information */ +/************************************/ +void apply_bonds(){ + gint index; + gchar *text; + /**/ + GUI_COMBOBOX_GET(uspex_gui.goodBonds,index); + GUI_COMBOBOX_GET_TEXT(uspex_gui.goodBonds,text); + if(uspex_gui._tmp_bond_d!=NULL) g_free(uspex_gui._tmp_bond_d); + GUI_ENTRY_GET_TEXT(uspex_gui._bond_d,uspex_gui._tmp_bond_d); + GUI_COMBOBOX_ADD_TEXT(uspex_gui.goodBonds,index,uspex_gui._tmp_bond_d); + if (g_ascii_strcasecmp(text,"ADD GOODBOND") == 0){ + /*new line*/ + GUI_COMBOBOX_SET(uspex_gui.goodBonds,index+1); + }else{ + /*modify*/ + GUI_COMBOBOX_DEL(uspex_gui.goodBonds,index+1); + GUI_COMBOBOX_SET(uspex_gui.goodBonds,index); + } +} +/********************************/ +/* Remove goodBonds information */ +/********************************/ +void remove_bonds(){ + gint index; + gchar *text; + GUI_COMBOBOX_GET(uspex_gui.goodBonds,index); + if(index==-1) {/*nothing selected -> should never happen*/ + GUI_COMBOBOX_SET(uspex_gui.goodBonds,0); + return; + } + GUI_COMBOBOX_GET_TEXT(uspex_gui.goodBonds,text); + if (g_ascii_strcasecmp(text,"ADD GOODBOND") == 0){ + /*can't delete this one*/ + g_free(text); + return; + } + GUI_COMBOBOX_DEL(uspex_gui.goodBonds,index); + if(index-1<0) index=1; + GUI_COMBOBOX_SET(uspex_gui.goodBonds,index-1); + g_free(text); +} +/**********************/ +/* toggle new_optType */ +/**********************/ +void opt_toggle(){ + if(uspex_gui.have_new_opt){ + GUI_UNLOCK(uspex_gui.new_optType); + GUI_LOCK(uspex_gui.optType); + }else{ + GUI_LOCK(uspex_gui.new_optType); + GUI_UNLOCK(uspex_gui.optType); + } +} +/**************************************/ +/* Apply changes to IonDistances line */ +/**************************************/ +void apply_distances(void){ + gint index; + gchar *text; + gchar *ptr; + gchar *ptr2; + gint idx; + /**/ + GUI_COMBOBOX_GET(uspex_gui.IonDistances,index); + GUI_ENTRY_GET_TEXT(uspex_gui._distances,text); + /*there is _nspecies values per line (and _nspecies lines)*/ + ptr=&(text[0]); + while((*ptr!='\0')&&(!g_ascii_isgraph(*ptr))) ptr++; + ptr2=ptr;idx=0; + while(*ptr!='\0'){ + uspex_gui.calc.IonDistances[index*(uspex_gui.calc._nspecies)+idx]=g_ascii_strtod(ptr,&ptr2); + if(ptr2==ptr) break; + ptr=ptr2+1; + idx++; + if(idx>=uspex_gui.calc._nspecies) break; + } + /*now refresch IonDistances line*/ + text=g_strdup_printf("%.4lf",uspex_gui.calc.IonDistances[index*(uspex_gui.calc._nspecies)]); + for(idx=1;idx=uspex_gui.calc._nmolecules) break; + } + /*now refresh MolCenters line*/ + text=g_strdup_printf("%.4lf",uspex_gui.calc.MolCenters[index*(uspex_gui.calc._nmolecules)]); + for(idx=1;idx0)&&(uspex_gui.calc.MolCenters!=NULL)){ + /*refresh MolCenters*/ + GUI_UNLOCK(uspex_gui.MolCenters); + GUI_UNLOCK(uspex_gui._centers); + /*wipe MolCenters, rewrite*/ + GUI_COMBOBOX_WIPE(uspex_gui.MolCenters); + for(i=0;i1){ + /*matrix has to be rectangular*/ + ptr=uspex_gui._tmp_latticevalue; + nvals=0; + while((*ptr!='\0')&&(!g_ascii_isgraph(*ptr))) ptr++; + while((*ptr!='\0')&&(nvals0){ + text=g_strdup_printf("%.4lf",uspex_gui.calc.Latticevalues[0]); + for(idx=0;idx lattice*/ + switch (index){ + case 1://lattice parameters + if((uspex_gui.calc._calctype_dim==3)&&(uspex_gui.calc._nlattice_line==3)&&(uspex_gui.calc._nlattice_vals==3)){ + /*do not wipe*/ + }else if((uspex_gui.calc._calctype_dim==2)&&(uspex_gui.calc._nlattice_line==2)&&(uspex_gui.calc._nlattice_vals==2)){ + /*do not wipe*/ + }else{ + /*wipe*/ + if(uspex_gui.calc._calctype_dim==3){ + uspex_gui.calc._nlattice_line=3; + uspex_gui.calc._nlattice_vals=3; + }else{ + uspex_gui.calc._nlattice_line=2; + uspex_gui.calc._nlattice_vals=2; + } + if(uspex_gui.calc.Latticevalues!=NULL) g_free(uspex_gui.calc.Latticevalues); +uspex_gui.calc.Latticevalues=g_malloc((uspex_gui.calc._nlattice_line*uspex_gui.calc._nlattice_vals)*sizeof(gdouble)); + for(idx=0;idx1) { + GUI_COMBOBOX_SET(uspex_gui._latticeformat,1);/*lattice*/ + return; + } + switch(uspex_gui.calc._nlattice_vals){ + case 3: + if(uspex_gui.calc._calctype_dim==-2) + GUI_COMBOBOX_SET(uspex_gui._latticeformat,2);/*crystal*/ + else GUI_COMBOBOX_SET(uspex_gui._latticeformat,0);/*volume*/ + return; + case 6: + if((uspex_gui.calc._calctype_dim==-2)||(uspex_gui.calc._calctype_dim==3)) + GUI_COMBOBOX_SET(uspex_gui._latticeformat,2);/*crystal*/ + else GUI_COMBOBOX_SET(uspex_gui._latticeformat,0);/*volume*/ + return; + default: + GUI_COMBOBOX_SET(uspex_gui._latticeformat,0);/*Volume by default*/ + } +} +/***********************************/ +/* Toggle spacegroup determination */ +/***********************************/ +void SG_toggle(void){ + if(uspex_gui.calc.doSpaceGroup){ + GUI_UNLOCK(uspex_gui.SymTolerance); + }else{ + GUI_LOCK(uspex_gui.SymTolerance); + } +} +/*****************************************************************/ +/* convert from _tmp_commandExecutable to calc.commandExecutable */ +/*****************************************************************/ +void register_commandExecutable(void){ + gchar *text; + gint idx; + gint jdx; + gboolean repopulate=FALSE; + /*1- wipe calc.commandExecutable*/ + if(uspex_gui.calc.commandExecutable!=NULL) g_free(uspex_gui.calc.commandExecutable); + uspex_gui.calc.commandExecutable=NULL; + /*2- register mandatory element*/ + if(uspex_gui._tmp_commandExecutable[0]==NULL) return;/*nothing to update at all*/ + uspex_gui.calc.commandExecutable=g_strdup(uspex_gui._tmp_commandExecutable[0]); + for(idx=1;idxuspex_gui.calc._num_opt_steps){ + /*increase*/ + for(idx=0;idxi) uspex_gui._tmp_curr_step=(gdouble)i; + GUI_SPIN_SET(uspex_gui._curr_step,uspex_gui._tmp_curr_step); +} +/***************************/ +/* change the current step */ +/***************************/ +void spin_update_curr_step(void){ + gint i=(gint)uspex_gui._tmp_curr_step; + gchar *text; + /*update step information*/ + uspex_gui._tmp_isfixed=uspex_gui.calc._isfixed[i-1]; + if(uspex_gui._tmp_isfixed) GUI_TOGGLE_ON(uspex_gui._isfixed); + else GUI_TOGGLE_OFF(uspex_gui._isfixed); + GUI_COMBOBOX_SET(uspex_gui.abinitioCode,uspex_gui.calc.abinitioCode[i-1]); + text=g_strdup_printf("%.4lf",uspex_gui.calc.KresolStart[i-1]); + GUI_ENTRY_TEXT(uspex_gui.KresolStart,text); + g_free(text); + text=g_strdup_printf("%.4lf",uspex_gui.calc.vacuumSize[i-1]); + GUI_ENTRY_TEXT(uspex_gui.vacuumSize,text); + g_free(text); + /*commandExecutable*/ + if(!uspex_gui.calc._isCmdList){ + /*only first command matter*/ + if(uspex_gui._tmp_commandExecutable[0]==NULL) text=g_strdup("N/A"); + else text=g_strdup(uspex_gui._tmp_commandExecutable[0]); + }else{ + /*display ith command*/ + if(uspex_gui._tmp_commandExecutable[i-1]==NULL) text=g_strdup("N/A"); + else text=g_strdup(uspex_gui._tmp_commandExecutable[i-1]); + } + GUI_ENTRY_TEXT(uspex_gui.commandExecutable,text); + g_free(text); + /*uspex_gui._tmp_ai_input*/ + if(uspex_gui._tmp_ai_input[i-1]==NULL) text=g_strdup("N/A"); + else text=g_strdup(uspex_gui._tmp_ai_input[i-1]); + GUI_ENTRY_TEXT(uspex_gui.ai_input,text); + g_free(text); + /*uspex_gui._tmp_ai_opt*/ + if(uspex_gui._tmp_ai_opt[i-1]==NULL) text=g_strdup("N/A"); + else text=g_strdup(uspex_gui._tmp_ai_opt[i-1]); + GUI_ENTRY_TEXT(uspex_gui.ai_opt,text); + g_free(text); + +} +/********************/ +/* toggle auto_step */ +/********************/ +void toggle_auto_step(void){ + if(uspex_gui.auto_step){ + GUI_LOCK(uspex_gui.ai_input); + GUI_LOCK(uspex_gui.ai_input_button); + GUI_LOCK(uspex_gui.ai_opt); + GUI_LOCK(uspex_gui.ai_opt_button); + GUI_LOCK(uspex_gui.ai_spe); + GUI_LOCK(uspex_gui.ai_pot); + GUI_LOCK(uspex_gui.ai_pot_button); + }else{ + GUI_UNLOCK(uspex_gui.ai_input); + GUI_UNLOCK(uspex_gui.ai_input_button); + GUI_UNLOCK(uspex_gui.ai_opt); + GUI_UNLOCK(uspex_gui.ai_opt_button); + GUI_UNLOCK(uspex_gui.ai_spe); + GUI_UNLOCK(uspex_gui.ai_pot); + GUI_UNLOCK(uspex_gui.ai_pot_button); + } +} +/********************************/ +/* select AI code for this step */ +/********************************/ +void uspex_ai_selected(GUI_OBJ *w){ + gint idx; + gint step=(gint)uspex_gui._tmp_curr_step; + GUI_COMBOBOX_GET(w,uspex_gui.calc.abinitioCode[step-1]); + /*propose some defaults command is missing*/ + if((uspex_gui._tmp_commandExecutable[step-1]==NULL)&&(uspex_gui.calc._isCmdList)){ + /*we don't have commandExecutable*/ + for(idx=0;idxdata; + /*to be registered a model must have at least 1 atom*/ + if(g_slist_length(data->cores)>0) { + text=g_strdup_printf("%i: %s",index,data->basename); + GUI_COMBOBOX_ADD(uspex_gui.meta_model,text); + g_free(text); + } + index++; + } + GUI_COMBOBOX_SET(uspex_gui.meta_model,0); +} +/****************************************/ +/* load metadynamics starting structure */ +/****************************************/ +void load_meta_start_file(void){ + GUI_OBJ *file_chooser; + gint have_answer; + gchar *filename; + gchar *text; + /**/ + GUI_PREPARE_OPEN_DIALOG(uspex_gui.window,file_chooser,"Select META starting point","POSCAR*","POSCAR_1"); + GUI_OPEN_DIALOG_RUN(file_chooser,have_answer,filename); + if(have_answer){ + /*there should be no case where have_answer==TRUE AND filename==NULL, but just in case.*/ + if(filename) { + text=g_strdup_printf("%s",filename); + GUI_COMBOBOX_ADD_TEXT(uspex_gui.meta_model,0,text); + GUI_COMBOBOX_DEL(uspex_gui.meta_model,1); + GUI_COMBOBOX_SET(uspex_gui.meta_model,0); + g_free(text); + g_free (filename); + } + } + GUI_KILL_OPEN_DIALOG(file_chooser); +} +/*****************************/ +/* select metadynamics model */ +/*****************************/ +void uspex_meta_model_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + switch (index){ + case 0: + GUI_UNLOCK(uspex_gui.meta_model_button); + break; + default: + GUI_LOCK(uspex_gui.meta_model_button); + } +} +/*********************/ +/* update VCNEB Type */ +/*********************/ +void update_vcnebType(void){ + gchar *text; + gint type=uspex_gui.calc._vcnebtype_method*100; + if(uspex_gui.calc.calculationMethod!=US_CM_VCNEB) return; + if(uspex_gui.calc._vcnebtype_img_num) type+=10; + if(uspex_gui.calc._vcnebtype_spring) type+=1; + uspex_gui.calc.vcnebType=type; + /*update uspex_gui.vcnebType */ + text=g_strdup_printf("%3i",type); + GUI_ENTRY_TEXT(uspex_gui.vcnebType,text); + g_free(text); + /*consequences*/ + if(uspex_gui.calc._vcnebtype_img_num) GUI_UNLOCK(uspex_gui.VarPathLength); + else GUI_LOCK(uspex_gui.VarPathLength); + if(uspex_gui.calc._vcnebtype_spring){ + GUI_UNLOCK(uspex_gui.K_min); + GUI_UNLOCK(uspex_gui.K_max); + GUI_LOCK(uspex_gui.Kconstant); + }else{ + GUI_LOCK(uspex_gui.K_min); + GUI_LOCK(uspex_gui.K_max); + GUI_UNLOCK(uspex_gui.Kconstant); + } +} +/***********************/ +/* select VCNEB method */ +/***********************/ +void uspex_vcneb_method_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + switch (index){ + case 1: + uspex_gui.calc._vcnebtype_method=2; + break; + case 0: + /* fall through */ + default: + uspex_gui.calc._vcnebtype_method=1; + } + update_vcnebType(); +} +/******************************/ +/* select VCNEB optReadImages */ +/******************************/ +void uspex_ReadImg_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + switch (index){ + case 0: + uspex_gui.calc.optReadImages=0; + break; + case 1: + uspex_gui.calc.optReadImages=1; + break; + case 2: + /* fall through */ + default: + uspex_gui.calc.optReadImages=2; + } +} +/*******************************/ +/* select VCNEB optimizer type */ +/*******************************/ +void uspex_optimizerType_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + switch (index){ + case 1: + uspex_gui.calc.optimizerType=2; + case 0: + /* fall through */ + default: + uspex_gui.calc.optimizerType=1; + } +} +/********************************/ +/* select VCNEB relaxation type */ +/********************************/ +void uspex_RelaxType_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + switch (index){ + case 0: + uspex_gui.calc.optRelaxType=1; + break; + case 1: + uspex_gui.calc.optRelaxType=2; + break; + case 2: + /* fall through */ + default: + uspex_gui.calc.optRelaxType=3; + } +} +/*****************************/ +/* select VCNEB CI/DI method */ +/*****************************/ +void uspex_CIDI_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + switch (index){ + case 1: + uspex_gui.calc.optMethodCIDI=1; + break; + case 2: + uspex_gui.calc.optMethodCIDI=-1; + break; + case 3: + uspex_gui.calc.optMethodCIDI=2; + break; + case 0: + /* fall through */ + default: + uspex_gui.calc.optMethodCIDI=0; + } + /*consequences*/ + if(uspex_gui.calc.optMethodCIDI==0){ + GUI_LOCK(uspex_gui.startCIDIStep); + GUI_LOCK(uspex_gui.pickupImages); + }else{ + GUI_UNLOCK(uspex_gui.startCIDIStep); + GUI_UNLOCK(uspex_gui.pickupImages); + } +} +/***********************************/ +/* select VCNEB PATH output format */ +/***********************************/ +void uspex_FormatType_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + switch (index){ + case 0: + uspex_gui.calc.FormatType=1; + break; + case 2: + uspex_gui.calc.FormatType=3; + break; + case 1: + /* fall through */ + default: + uspex_gui.calc.FormatType=2; + } +} +/*************************************/ +/* initialize image models from GDIS */ +/*************************************/ +void init_img_gdis_model(void){ + gint index; + gchar *text; + GSList *list; + struct model_pak *data; + /*WIPE MODEL*/ + GUI_COMBOBOX_WIPE(uspex_gui.img_model); + GUI_COMBOBOX_ADD(uspex_gui.img_model,"From VASP5 POSCAR file"); + index=1; + for(list=sysenv.mal;list;list=g_slist_next(list)){ + data = list->data; + /*to be registered, a model must 3D periodic... I think*/ + if(data->periodic==3){ + text=g_strdup_printf("%i: %s",index,data->basename); + GUI_COMBOBOX_ADD(uspex_gui.img_model,text); + g_free(text); + } + index++; + } + GUI_COMBOBOX_SET(uspex_gui.img_model,0); +} +/*****************************/ +/* select VCNEB Images model */ +/*****************************/ +void uspex_img_model_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + switch (index){ + case 0: + GUI_UNLOCK(uspex_gui.img_model_button); + break; + default: + GUI_LOCK(uspex_gui.img_model_button); + } +} +/*************************/ +/* load VCNEB Image file */ +/*************************/ +void load_img_model_file(void){ + GUI_OBJ *file_chooser; + gint have_answer; + gchar *filename; + gchar *text; + /**/ + GUI_PREPARE_OPEN_DIALOG(uspex_gui.window,file_chooser,"Select VCNEB image model","*","VASP5 format"); + GUI_OPEN_DIALOG_RUN(file_chooser,have_answer,filename); + if(have_answer){ + /*there should be no case where have_answer==TRUE AND filename==NULL, but just in case.*/ + if(filename) { + text=g_strdup_printf("%s",filename); + GUI_COMBOBOX_ADD_TEXT(uspex_gui.img_model,0,text); + GUI_COMBOBOX_DEL(uspex_gui.img_model,1); + GUI_COMBOBOX_SET(uspex_gui.img_model,0); + g_free(text); + g_free (filename); + } + } + GUI_KILL_OPEN_DIALOG(file_chooser); +} +/*****************************************/ +/* initialize molecular models from GDIS */ +/*****************************************/ +void init_uspex_gdis_mol(void){ + gint index; + gchar *text; + GSList *list; + struct model_pak *data; + /*WIPE MODEL*/ + GUI_COMBOBOX_WIPE(uspex_gui.mol_gdis); + index=0; + for(list=sysenv.mal;list;list=g_slist_next(list)){ + data = list->data; + /*to be registered, a model must have a molecule*/ + if(g_slist_length(data->moles)>0) { + text=g_strdup_printf("%i: %s",index,data->basename); + GUI_COMBOBOX_ADD(uspex_gui.mol_gdis,text); + g_free(text); + } + index++; + } + GUI_COMBOBOX_SET(uspex_gui.mol_gdis,uspex_gui._tmp_mols_gdis[0]); +} +/**************************/ +/* select Molecular model */ +/**************************/ +void uspex_mol_model_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + switch (index){ + case 1:/*from folder*/ + GUI_UNLOCK(uspex_gui.num_mol); + GUI_UNLOCK(uspex_gui.mol_model_button); + GUI_LOCK(uspex_gui.mol_gdis); + GUI_LOCK(uspex_gui.curr_mol); + GUI_LOCK(uspex_gui.mol_gulp); + GUI_LOCK(uspex_gui.mol_apply_button); + break; + case 2:/*from gdis*/ + GUI_UNLOCK(uspex_gui.num_mol); + GUI_LOCK(uspex_gui.mol_model_button); + GUI_UNLOCK(uspex_gui.mol_gdis); + GUI_UNLOCK(uspex_gui.curr_mol); + GUI_UNLOCK(uspex_gui.mol_gulp); + GUI_UNLOCK(uspex_gui.mol_apply_button); + break; + case 0:/*already provided*/ + /* fall through */ + default: + GUI_LOCK(uspex_gui.num_mol); + GUI_LOCK(uspex_gui.mol_model_button); + GUI_LOCK(uspex_gui.mol_gdis); + GUI_LOCK(uspex_gui.curr_mol); + GUI_LOCK(uspex_gui.mol_gulp); + GUI_LOCK(uspex_gui.mol_apply_button); + } +} +/*******************************/ +/* load molecular model/folder */ +/*******************************/ +void load_mol_model_folder(void){ + GUI_OBJ *file_chooser; + gint have_answer; + gchar *filename; + gchar *text; + /**/ + GUI_PREPARE_OPEN_FOLDER(uspex_gui.window,file_chooser,"Select MOL_x folder"); + GUI_OPEN_DIALOG_RUN(file_chooser,have_answer,filename); + if(have_answer){ + /*there should be no case where have_answer==TRUE AND filename==NULL, but just in case.*/ + if(filename) { + text=g_strdup_printf("%s",filename); + /*save that path as mol_model #1*/ + GUI_COMBOBOX_ADD_TEXT(uspex_gui.mol_model,1,text); + GUI_COMBOBOX_DEL(uspex_gui.mol_model,2); + GUI_COMBOBOX_SET(uspex_gui.mol_model,1); + g_free(text); + g_free(filename); + } + } + GUI_KILL_OPEN_DIALOG(file_chooser); +} +/******************************/ +/* update number of molecules */ +/******************************/ +void spin_update_num_mol(void){ + gint idx; + gint i=uspex_gui._tmp_num_mol; + gint *tmp_i; + gboolean *tmp_b; + /**/ + tmp_i=g_malloc(i*sizeof(gint)); + tmp_b=g_malloc(i*sizeof(gboolean)); + if(idata; + /*to be registered, a model must be 3D periodic*/ + if(data->periodic==3){ + text=g_strdup_printf("%i: %s",index,data->basename); + GUI_COMBOBOX_ADD(uspex_gui.substrate_model,text); + g_free(text); + } + index++; + } + GUI_COMBOBOX_SET(uspex_gui.substrate_model,0); +} +/**********************************/ +/* select surface substrate model */ +/**********************************/ +void uspex_substrate_model_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + switch (index){ + case 0: + GUI_UNLOCK(uspex_gui.substrate_model_button); + break; + default: + GUI_LOCK(uspex_gui.substrate_model_button); + } +} +/********************************/ +/* load surface substrate model */ +/********************************/ +void load_substrate_model_file(void){ + GUI_OBJ *file_chooser; + gint have_answer; + gchar *filename; + gchar *text; + /**/ + GUI_PREPARE_OPEN_DIALOG(uspex_gui.window,file_chooser,"Select Substrate structure","POSCAR_SUBSTRATE","VASP5 format"); + GUI_OPEN_DIALOG_RUN(file_chooser,have_answer,filename); + if(have_answer){ + /*there should be no case where have_answer==TRUE AND filename==NULL, but just in case.*/ + if(filename) { + text=g_strdup_printf("%s",filename); + GUI_COMBOBOX_ADD_TEXT(uspex_gui.substrate_model,0,text); + GUI_COMBOBOX_DEL(uspex_gui.substrate_model,1); + GUI_COMBOBOX_SET(uspex_gui.substrate_model,0); + g_free(text); + g_free (filename); + } + } + GUI_KILL_OPEN_DIALOG(file_chooser); +} +/************************/ +/* Switch notebook page */ +/************************/ +void uspex_gui_page_switch(GUI_NOTE *notebook,GUI_OBJ *page,guint page_num){ + gint from_page; + gint idx; + /* some (few) values need to be updated from a page to another*/ + GUI_NOTE_PAGE_NUMBER(notebook,from_page); + if(from_page==(gint)page_num) return;/*not moved*/ + uspex_gui.cur_page=page_num; + GUI_LOCK(page); + if(page_num==USPEX_PAGE_SYSTEM){ + /*sync uspex_gui._calctype_mag*/ + if(uspex_gui.calc._calctype_mag) { + GUI_TOGGLE_ON(uspex_gui._calctype_mag); + }else{ + GUI_TOGGLE_OFF(uspex_gui._calctype_mag); + } + } else if(page_num==USPEX_PAGE_STRUCTURES){ + /*sync uspex_gui._calctype_mag_2*/ + if(uspex_gui.calc._calctype_mag) { + GUI_TOGGLE_ON(uspex_gui._calctype_mag_2); + }else{ + GUI_TOGGLE_OFF(uspex_gui._calctype_mag_2); + } + } else if (page_num==USPEX_PAGE_CALCULATION){ + /**/ + populate_spe(); + } else if (page_num==USPEX_PAGE_ADVANCED){ + /**/ + } else if (page_num==USPEX_PAGE_SPECIFIC){ + /*update meta_model_button*/ + GUI_COMBOBOX_GET(uspex_gui.meta_model,idx); + if((uspex_gui.calc.calculationMethod==US_CM_META)&&(idx==0)) GUI_UNLOCK(uspex_gui.meta_model_button); + else GUI_LOCK(uspex_gui.meta_model_button); + /*update vcneb*/ + update_vcnebType(); + } + GUI_UNLOCK(page); +} +/****************************************************/ +/* convert current uspex_gui into uspex_calc_struct */ +/****************************************************/ +void uspex_gui_sync(){ + gint index; + gint idx; + gint jdx; + gchar *text; + gchar *ptr; + gchar *ptr2; + gint num; + gint val; + /* sync start here */ + USPEX_REG_TEXT(name); + //calculationMethod is already sync + //calculationType is already sync + uspex_gui.calc._calctype_dim=(gint)uspex_gui._dim; + //_calctype_mol is already sync + //_calctype_var is already sync + //_calctype_mag is already sync + //optType is already sync + if(uspex_gui.have_new_opt) USPEX_REG_TEXT(new_optType); + //anti_opt is already sync + //n_species is already sync + //atomType is already sync + if(uspex_gui.calc._calctype_var){/*VARCOMP -> take numSpecies from numSpecies lines*/ + GUI_COMBOBOX_GET(uspex_gui.numSpecies,index);/*PUSH index*/ + /*count _var_nspecies*/ + idx=0; + GUI_COMBOBOX_SET(uspex_gui.numSpecies,0); + GUI_COMBOBOX_GET_TEXT(uspex_gui.numSpecies,text); + while(g_ascii_strcasecmp(text,"ADD SPECIES BLOCK") != 0){ + g_free(text); + idx++; + GUI_COMBOBOX_SET(uspex_gui.numSpecies,idx); + GUI_COMBOBOX_GET_TEXT(uspex_gui.numSpecies,text); + } + uspex_gui.calc._var_nspecies=idx; + if(uspex_gui.calc.numSpecies!=NULL) g_free(uspex_gui.calc.numSpecies); + uspex_gui.calc.numSpecies=g_malloc((uspex_gui.calc._nspecies*uspex_gui.calc._var_nspecies)*sizeof(gint)); + jdx=0; + GUI_COMBOBOX_SET(uspex_gui.numSpecies,0); + GUI_COMBOBOX_GET_TEXT(uspex_gui.numSpecies,text); + while(g_ascii_strcasecmp(text,"ADD SPECIES BLOCK") != 0){ + ptr=text; + while((*ptr!='\0')&&(!g_ascii_isgraph(*ptr))) ptr++; + idx=0; + while((idx numSpecies is a 1-line block, take it directly from atomType*/ + uspex_gui.calc._var_nspecies=1; + GUI_COMBOBOX_GET(uspex_gui.atomType,index);/*PUSH index*/ + GUI_LOCK(uspex_gui.atomType); + /*re-dim*/ + if(uspex_gui.calc.numSpecies!=NULL) g_free(uspex_gui.calc.numSpecies); + if(uspex_gui.calc.valences!=NULL) g_free(uspex_gui.calc.valences); + uspex_gui.calc.numSpecies=g_malloc((uspex_gui.calc._nspecies)*sizeof(gint)); + uspex_gui.calc.valences=g_malloc((uspex_gui.calc._nspecies)*sizeof(gint)); + for(idx=0;idx0){/*we have some value to sync*/ + if(uspex_gui.calc.ldaU!=NULL) g_free(uspex_gui.calc.ldaU); + uspex_gui.calc.ldaU=g_malloc((uspex_gui.calc._nspecies)*sizeof(gdouble)); + for(idx=0;idx uspex.log",(*uspex_exec).job_uspex_exe); + else cmd = g_strdup_printf("%s -m > uspex.log",(*uspex_exec).job_uspex_exe); +}else{ + if(uspex_gui.have_octave) cmd = g_strdup_printf("%s -9 > uspex.log",(*uspex_exec).job_uspex_exe); + else cmd = g_strdup_printf("%s -m9 > uspex.log",(*uspex_exec).job_uspex_exe); +} +#endif + cwd=sysenv.cwd;/*push*/ + sysenv.cwd=g_strdup_printf("%s",(*uspex_exec).job_path); + task_sync(cmd); + g_free(sysenv.cwd); + sysenv.cwd=cwd;/*pull*/ + g_free(cmd); + (*uspex_exec).have_result=TRUE; +} +/*****************************/ +/* cleanup task: load result */ +/*****************************/ +void cleanup_uspex_exec(uspex_exec_struct *uspex_exec){ + /*USPEX process has exit, DO NOT try to load the result -- yet*/ + /*sync_ wait for result?*/ + while(!(*uspex_exec).have_result) usleep(500*1000);/*sleep 500ms until job is done*/ + /*TODO: connect an empty model that will be updated with uspex results AS THEY ARRIVE TODO*/ +/*just wipe the structure*/ + sysenv.uspex_calc_list=g_slist_remove(sysenv.uspex_calc_list,uspex_exec);/*does not free, does it?*/ + g_free(uspex_exec); +} +/******************************/ +/* Enqueue a uspex calculation */ +/******************************/ +void uspex_exec_calc(){ + uspex_exec_struct *uspex_exec; + /*this will sync then enqueue a USPEX calculation*/ + if(save_uspex_calc()) return;/*sync and save all file*/ +/*copy structure to the list*/ + uspex_exec=g_malloc(sizeof(uspex_exec_struct)); + uspex_exec->job_id=g_slist_length(sysenv.uspex_calc_list); + uspex_exec->have_result=FALSE; + uspex_exec->job_uspex_exe=g_strdup_printf("%s",uspex_gui.calc.job_uspex_exe); + uspex_exec->job_path=g_strdup_printf("%s",uspex_gui.calc.job_path); + /*prepend to calc list*/ + sysenv.uspex_calc_list = g_slist_prepend (sysenv.uspex_calc_list,uspex_exec); + /*launch uspex in a task*/ + GUI_LOCK(uspex_gui.button_save); + GUI_LOCK(uspex_gui.button_exec); + task_new("USPEX", &run_uspex_exec,uspex_exec,&cleanup_uspex_exec,uspex_exec,sysenv.active_model); + /*when task is launched, close dialog*/ + uspex_cleanup(); + GUI_CLOSE(uspex_gui.window); +} +/********************************/ +/* Quit uspex calculation dialog */ +/********************************/ +void quit_uspex_gui(GUI_OBJ *w, gpointer data){ + struct model_pak *model=data; + uspex_cleanup(); + dialog_destroy(w,model); +} +/********************************/ +/* USPEX calculation main dialog */ +/********************************/ +void gui_uspex_dialog(void){ +/*launch the main interface*/ +/*TODO: use distant connections*/ + gchar *title; + gpointer dialog; + GUI_OBJ *frame, *vbox, *hbox, *table; + GUI_OBJ *notebook, *page, *button, *label; + /* special */ + struct model_pak *data; + gint idx; + gchar *tmp; +/* checks */ + data = sysenv.active_model; + if (!data) return; +/* do we have a uspexrun.xml model? */ + if (data->id == USPEX) { + uspex_output_struct *uspex_output=data->uspex; + uspex_calc_struct *uspex_calc; + /*take GUI default from the opened USPEX output*/ + free_uspex_parameters(&(uspex_gui.calc)); + /*be careful to read Parameters.txt, specifically*/ + title = g_strdup_printf("%s%s",_UO.calc->path,"Parameters.txt"); + uspex_calc = read_uspex_parameters(title,data->num_species); + g_free(title); + if(uspex_calc){ + uspex_gui.have_output=TRUE; + copy_uspex_parameters(uspex_calc,&(uspex_gui.calc)); + gui_uspex_init(data); + }else{ + uspex_gui.have_output=FALSE; + init_uspex_parameters(&(uspex_gui.calc)); + gui_uspex_init(data); + } + g_free(uspex_calc); + } else { + uspex_gui.have_output=FALSE; + init_uspex_parameters(&(uspex_gui.calc)); + gui_uspex_init(data); + } +/*bailout process*/ + +if(uspex_gui.calc.numSpecies==NULL){ + title=g_strdup("USPEX model is missing numSpecies information!\n"); + gui_text_show(ERROR,title); + g_free(title); +} + +/* dialog setup */ + title = g_strdup_printf("USPEX: %s", data->basename); + dialog = dialog_request(CUSPEX, title, NULL, uspex_cleanup,data); + g_free(title); + uspex_gui.window = dialog_window(dialog); +/* --- Outside of notebook */ + GUI_FRAME_WINDOW(uspex_gui.window,frame); + GUI_VBOX_FRAME(frame,vbox); +/* --- MODEL NAME */ + GUI_LINE_BOX(vbox,hbox); + GUI_LABEL_BOX(hbox,label,"MODEL NAME"); + GUI_TEXT_ENTRY(hbox,uspex_gui.name,data->basename,TRUE); +GUI_TOOLTIP(uspex_gui.name,"The model name will be used in USPEX files\nas well as GDIS display."); +/* --- CONNECTED OUTPUT */ + GUI_LINE_BOX(vbox,hbox); + GUI_LABEL_BOX(hbox,label,"CONNECTED OUTPUT"); +if(uspex_gui.have_output){ + uspex_output_struct *uspex_output=data->uspex; + tmp=g_strdup_printf("%s%s",_UO.calc->path,"Parameters.txt"); + GUI_TEXT_ENTRY(hbox,uspex_gui.file_entry,tmp,TRUE); + g_free(tmp); +}else{ + GUI_TEXT_ENTRY(hbox,uspex_gui.file_entry,"",TRUE); +} +GUI_TOOLTIP(uspex_gui.file_entry,"Use the previous result of a USPEX calculation\nto fill the parameters of the current one.\nNOTE: all settings should be checked again. Carefully."); + GUI_OPEN_BUTTON_BOX(hbox,button,load_parameters_dialog); +/*update job_path <- default to current directory!*/ + if(uspex_gui.calc.job_path!=NULL) g_free(uspex_gui.calc.job_path); + uspex_gui.calc.job_path=g_strdup_printf("%s",sysenv.cwd); +/* create frame in box */ + GUI_FRAME_WINDOW(uspex_gui.window,frame); +/* create notebook in frame */ + GUI_NOTE_FRAME(frame,notebook); + +/*------------------*/ +/* page 1 -> SYSTEM */ +/*------------------*/ + GUI_PAGE_NOTE(notebook,page,"SYSTEM"); +/* create a table in the page*/ + GUI_TABLE_NOTE(page,table,18,4); +/* --- Type & System */ + GUI_LABEL_TABLE(table,"Type & System",0,4,0,1); +/* line 1 */ + GUI_COMBOBOX_TABLE(table,uspex_gui.calculationMethod,"Method: ",0,1,1,2);/*multiline*/ + GUI_COMBOBOX_ADD(uspex_gui.calculationMethod,"USPEX"); + GUI_COMBOBOX_ADD(uspex_gui.calculationMethod,"META"); + GUI_COMBOBOX_ADD(uspex_gui.calculationMethod,"VCNEB"); + GUI_COMBOBOX_ADD(uspex_gui.calculationMethod,"PSO"); + GUI_COMBOBOX_ADD(uspex_gui.calculationMethod,"TPS"); + GUI_COMBOBOX_ADD(uspex_gui.calculationMethod,"MINHOP"); +GUI_TOOLTIP(uspex_gui.calculationMethod,"calculationMethod: Ch. 4.1 DEFAULT: USPEX\nSet the method of calculation."); + GUI_COMBOBOX_TABLE(table,uspex_gui.calculationType,"Type: ",1,3,1,2); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"300"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"s300"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"301"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"s301"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"310"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"311"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"000"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"s000"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"001"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"110"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"200"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"s200"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"201"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"s201"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"-200"); + GUI_COMBOBOX_ADD(uspex_gui.calculationType,"-s200"); +GUI_TOOLTIP(uspex_gui.calculationType,"calculationType: Ch. 4.1 DEFAULT: 300\nSets the dimensionality, molecularity, and variability\nof the calculation, can also be set individually.\n(311) and (110) calculations may not be supported."); + GUI_CHECK_TABLE(table,uspex_gui._calctype_mag,uspex_gui.calc._calctype_mag,mag_toggle,"MAG",3,4,1,2); +GUI_TOOLTIP(uspex_gui._calctype_mag,"Set a magnetic calculation."); +/* line 2 */ + /*col 1: empty*/ + GUI_SPIN_TABLE(table,uspex_gui._calctype_dim,uspex_gui._dim,spin_update_dim,"DIM",1,2,2,3); + GUI_SPIN_RANGE(uspex_gui._calctype_dim,-2.,3.); +GUI_TOOLTIP(uspex_gui._calctype_dim,"Set the dimension of the system.\n3, 2, 1, and 0 are equilvalent to 3D, 2D, 1D, and 0D.\n-2 correspond to 2D crystals."); + GUI_CHECK_TABLE(table,uspex_gui._calctype_mol,uspex_gui.calc._calctype_mol,mol_toggle,"MOL",2,3,2,3); +GUI_TOOLTIP(uspex_gui._calctype_mol,"Set the molecularity of the system."); + GUI_CHECK_TABLE(table,uspex_gui._calctype_var,uspex_gui.calc._calctype_var,var_toggle,"VAR",3,4,2,3); +GUI_TOOLTIP(uspex_gui._calctype_var,"Set the variability of chemical composition."); +/* line 3 */ + GUI_COMBOBOX_TABLE(table,uspex_gui.atomType,"atomType:",0,1,3,4);/*multiline*/ + GUI_COMBOBOX_ADD(uspex_gui.atomType,"ADD ATOMTYPE"); +GUI_TOOLTIP(uspex_gui.atomType,"atomType: Ch. 4.1 DEFAULT: none\nThis list regroups several tags:\natomType, numSpecies, and valences."); + GUI_ENTRY_TABLE(table,uspex_gui._atom_sym,uspex_gui._tmp_atom_sym,"%s","@Sym:",1,2,3,4); +GUI_TOOLTIP(uspex_gui._atom_sym,"atomSym: - DEFAULT: none\nAtomic symbol of current species."); + GUI_ENTRY_TABLE(table,uspex_gui._atom_typ,uspex_gui._tmp_atom_typ,"%3i","@Z:",2,3,3,4); +GUI_TOOLTIP(uspex_gui._atom_typ,"atomTyp: - DEFAULT: none\nAtomic number of current species."); + GUI_APPLY_BUTTON_TABLE(table,button,apply_atom,3,4,3,4); +/* line 4 */ + /*col 1: empty*/ + GUI_ENTRY_TABLE(table,uspex_gui._atom_num,uspex_gui._tmp_atom_num,"%3i","@Num:",1,2,4,5); +GUI_TOOLTIP(uspex_gui._atom_num,"atomNum: - DEFAULT: none\nNumber of atoms in current species."); + GUI_ENTRY_TABLE(table,uspex_gui._atom_val,uspex_gui._tmp_atom_val,"%3i","@Val:",2,3,4,5); +GUI_TOOLTIP(uspex_gui._atom_val,"atomVal: - DEFAULT: auto\nValence of the current species.\nAutomatically determined if zero."); + GUI_DELETE_BUTTON_TABLE(table,button,remove_atom,3,4,4,5); +/* line 5 */ + GUI_COMBOBOX_TABLE(table,uspex_gui.numSpecies,"numSpecies:",0,1,5,6); + GUI_COMBOBOX_ADD(uspex_gui.numSpecies,"ADD SPECIES BLOCK"); +GUI_TOOLTIP(uspex_gui.numSpecies,"numSpecies: Ch. 4.1 DEFAULT: none\nSpecifies the number of atoms of each types.\nCan be use to set blockSpecies for variable composition."); + GUI_TEXT_TABLE(table,uspex_gui.blockSpecies,uspex_gui._tmp_blockSpecies,"Species: ",1,2,5,6); +GUI_TOOLTIP(uspex_gui.blockSpecies,"The number of atoms of each types for this block."); +// GUI_2BUTTONS_TABLE(table,apply_block_species,delete_block_species,3,4,5,6); + GUI_APPLY_BUTTON_TABLE(table,uspex_gui.Species_apply_button,apply_block_species,2,3,5,6); + GUI_DELETE_BUTTON_TABLE(table,uspex_gui.Species_delete_button,delete_block_species,3,4,5,6); +/* line 6 */ + GUI_COMBOBOX_TABLE(table,uspex_gui.goodBonds,"goodBonds:",0,1,6,7);/*multiline*/ + GUI_COMBOBOX_ADD(uspex_gui.goodBonds,"ADD GOODBOND"); +GUI_TOOLTIP(uspex_gui.goodBonds,"goodBonds: Ch. 4.1 DEFAULT: auto\nSet the minimum distance at which a bond is considered."); + GUI_TEXT_TABLE(table,uspex_gui._bond_d,uspex_gui._tmp_bond_d,"Bonds: ",1,2,6,7); +GUI_TOOLTIP(uspex_gui._bond_d,"Minimum bond distance between selected and others species."); + GUI_APPLY_BUTTON_TABLE(table,button,apply_bonds,2,3,6,7); + GUI_DELETE_BUTTON_TABLE(table,button,remove_bonds,3,4,6,7); +/* line 7 */ + GUI_ENTRY_TABLE(table,uspex_gui.ExternalPressure,uspex_gui.calc.ExternalPressure,"%.4f","ExtP:",0,1,7,8); +GUI_TOOLTIP(uspex_gui.ExternalPressure,"ExternalPressure: Ch. 4.1, 5.6 DEFAULT: none\nExternal pressure (GPa) for calculation."); + GUI_TEXT_TABLE(table,uspex_gui.ldaU,uspex_gui._tmp_ldaU,"lda+U:",1,3,7,8); +GUI_TOOLTIP(uspex_gui.ldaU,"ldaU: Ch. 4.1 DEFAULT: all 0\nHubbard U value (per atom) in L(S)DA+U method."); + GUI_CHECK_TABLE(table,button,uspex_gui.auto_bonds,auto_bond_toggle,"AUTO_BONDS",3,4,7,8); +GUI_TOOLTIP(button,"Automatically determine bonds (recommended)."); +/* line 8 */ + GUI_COMBOBOX_TABLE(table,uspex_gui.optType,"optType:",0,1,8,9);/*multiline*/ + GUI_COMBOBOX_ADD(uspex_gui.optType,"1: MIN Enthalpy (stable phases)"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"2: MIN Volume (densest structure)"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"3: MAX Hardness (hardest phase)"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"4: MAX order (most order structure)"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"5: MAX Structure average difference"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"6: MAX Dielectric susceptibility"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"7: MAX Band gap"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"8: MAX electric energy storage capacity"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"9: MAX Magnetization"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"10: MAX Structure quasientropy"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"11: MAX? L/H eigenvalue difference of refractive index"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"14: MAX? ZT thermoelectric figure of merit"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"17: MAX? free energy at finite temperature"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"1101: MAX Bulk modulus"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"1102: MAX Shear modulus"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"1103: MAX Young modulus"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"1104: MAX Poisson Modulus"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"1105: MAX Pugh ratio"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"1106: MAX Vickers hardness"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"1107: MAX Fracture toughness"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"1108: MAX Debye temperature"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"1109: MAX Sound velocity"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"1110: MAX S-wave velocity"); + GUI_COMBOBOX_ADD(uspex_gui.optType,"1111: MAX P-wave velocity"); +GUI_TOOLTIP(uspex_gui.optType,"optType: Ch. 4.1 DEFAULT: 1(Enthalpy)\nSelect the properties to optimize."); + GUI_TEXT_TABLE(table,uspex_gui.new_optType,uspex_gui._tmp_new_optType,"NEW optType: ",1,3,8,9); +GUI_TOOLTIP(uspex_gui.optType,"optType: Ch. 4.1 DEFAULT: MIN_enthalpy\nSelect the properties to optimize in the new\nVER 10.1 USPEX format."); + GUI_CHECK_TABLE(table,button,uspex_gui.have_new_opt,opt_toggle,"NEW",3,4,8,9); +GUI_TOOLTIP(button,"Use the VER 10.1 optType format.\nMandatory for multiobjective optimization."); + /*TODO: check on "change" to detect ZT*/ +/* line 9 */ + /*col 1: empty*/ + GUI_CHECK_TABLE(table,button,uspex_gui.calc.anti_opt,NULL,"ANTI-OPT",1,2,9,10);/*not calling anything*/ +GUI_TOOLTIP(button,"anti-opt: - DEFAULT: FALSE\nIf set REVERSE the direction of optimization.\ni.e. MIN -> MAX & MAX -> MIN"); + GUI_CHECK_TABLE(table,button,uspex_gui.calc.checkMolecules,NULL,"ckMol",2,3,9,10);/*not calling anything*/ +GUI_TOOLTIP(button,"checkMolecules: Ch. 4.1 DEFAULT: TRUE\nCheck and discard broken/merged molecules."); + GUI_CHECK_TABLE(table,button,uspex_gui.calc.checkConnectivity,NULL,"ckCon",3,4,9,10);/*not calling anything*/ +GUI_TOOLTIP(button,"checkConnectivity: Ch. 4.1 DEFAULT: FALSE\nCalculate hardness and add connectivity in softmutation."); +/* <- Ext Pressure, LDA+U, and magRation moved to p. III, II, and III, respectively.*/ +/* --- cell */ + GUI_LABEL_TABLE(table,"Cell",0,4,10,11); +/* line 11 */ + GUI_COMBOBOX_TABLE(table,uspex_gui.Latticevalues,"Lattice:",0,1,11,12);/*multiline*/ +GUI_TOOLTIP(uspex_gui.Latticevalues,"Latticevalues: Ch. 4.6 DEFAULT: auto\nInitial volume of the unit cell, or known lattice parameters."); + GUI_TEXT_TABLE(table,uspex_gui._latticevalue,uspex_gui._tmp_latticevalue,"VALUES:",1,3,11,12); +GUI_TOOLTIP(uspex_gui._latticevalue,"VALUES: values of the current line of Latticevalues."); + GUI_APPLY_BUTTON_TABLE(table,button,apply_latticevalue,3,4,11,12); +/* line 12 */ + GUI_COMBOBOX_TABLE(table,uspex_gui._latticeformat,"FORMAT:",0,1,12,13); + /*col 2: empty*/ + GUI_COMBOBOX_ADD(uspex_gui._latticeformat,"Volumes"); + GUI_COMBOBOX_ADD(uspex_gui._latticeformat,"Lattice"); + GUI_COMBOBOX_ADD(uspex_gui._latticeformat,"Crystal"); +GUI_TOOLTIP(uspex_gui._latticeformat,"FORMAT: whether Lattice values correspond to a series of\nVolumes, lattive vectors, or crystallographic definition."); + title=g_strdup_printf("%i",uspex_gui.calc.splitInto[0]); + for(idx=1;idx STRUCTURE */ +/*---------------------*/ + GUI_PAGE_NOTE(notebook,page,"STRUCTURE"); +/* create a table in the page*/ + GUI_TABLE_NOTE(page,table,18,4); +/* --- Population & selection */ + GUI_LABEL_TABLE(table,"Population & selection",0,4,0,1); +/* line 1 */ + GUI_ENTRY_TABLE(table,uspex_gui.populationSize,uspex_gui.calc.populationSize,"%4i","SIZE:",0,1,1,2); +GUI_TOOLTIP(uspex_gui.populationSize,"populationSize: Ch. 4.2 DEFAULT: auto\nNumber of structures in each generation."); + GUI_ENTRY_TABLE(table,uspex_gui.initialPopSize,uspex_gui.calc.initialPopSize,"%4i","INIT:",1,2,1,2); +GUI_TOOLTIP(uspex_gui.initialPopSize,"initialPopSize: Ch. 4.2 DEFAULT: populationSize\nNumber of structures in initial generation."); + GUI_ENTRY_TABLE(table,uspex_gui.numGenerations,uspex_gui.calc.numGenerations,"%4i","NGEN:",2,3,1,2); +GUI_TOOLTIP(uspex_gui.numGenerations,"numGenerations: Ch. 4.2 DEFAULT: 100\nMaximum number of generations."); + GUI_ENTRY_TABLE(table,uspex_gui.stopCrit,uspex_gui.calc.stopCrit,"%4i","STOP:",3,4,1,2); +GUI_TOOLTIP(uspex_gui.stopCrit,"stopCrit: Ch. 4.2 DEFAULT: auto\nMaximum number of generations."); +/* line 2 */ + GUI_ENTRY_TABLE(table,uspex_gui.mag_nm,uspex_gui.calc.magRatio[0],"%.4f","N.M.:",0,1,2,3); +GUI_TOOLTIP(uspex_gui.mag_nm,"magRatio: Ch. 4.1 DEFAULT: 0.1\n(magnetic calculation) Initial ratio of structures\nwith a non-magnetic order."); + GUI_ENTRY_TABLE(table,uspex_gui.mag_fmls,uspex_gui.calc.magRatio[1],"%.4f","FM-LS:",1,2,2,3); +GUI_TOOLTIP(uspex_gui.mag_fmls,"magRatio: Ch. 4.1 DEFAULT: 0.1\n(magnetic calculation) Initial ratio of structures\nwith a low-spin ferromagnetic order."); + GUI_ENTRY_TABLE(table,uspex_gui.mag_afml,uspex_gui.calc.magRatio[3],"%.4f","AFM-L:",2,3,2,3); +GUI_TOOLTIP(uspex_gui.mag_afml,"magRatio: Ch. 4.1 DEFAULT: 0.1\n(magnetic calculation) Initial ratio of structures\nwith a low-spin antiferromagnetic order."); + GUI_ENTRY_TABLE(table,uspex_gui.mag_fmlh,uspex_gui.calc.magRatio[5],"%.4f","FM-LH:",3,4,2,3); +GUI_TOOLTIP(uspex_gui.mag_fmlh,"magRatio: Ch. 4.1 DEFAULT: 0.1\n(magnetic calculation) Initial ratio of structures\nwith a low/high spin mixed ferromagnetic order."); +/* line 3 */ + GUI_CHECK_TABLE(table,uspex_gui._calctype_mag_2,uspex_gui.calc._calctype_mag,mag_toggle,"MAG",0,1,3,4); +GUI_TOOLTIP(uspex_gui._calctype_mag_2,"Set a magnetic calculation."); + GUI_ENTRY_TABLE(table,uspex_gui.mag_fmhs,uspex_gui.calc.magRatio[2],"%.4f","FM-HS:",1,2,3,4); +GUI_TOOLTIP(uspex_gui.mag_fmhs,"magRatio: Ch. 4.1 DEFAULT: 0.1\n(magnetic calculation) Initial ratio of structures\nwith a high-spin ferromagnetic."); + GUI_ENTRY_TABLE(table,uspex_gui.mag_afmh,uspex_gui.calc.magRatio[4],"%.4f","AFM-H:",2,3,3,4); +GUI_TOOLTIP(uspex_gui.mag_afmh,"magRatio: Ch. 4.1 DEFAULT: 0.1\n(magnetic calculation) Initial ratio of structures\nwith a high-spin antiferromagnetic."); + GUI_ENTRY_TABLE(table,uspex_gui.mag_aflh,uspex_gui.calc.magRatio[6],"%.4f","AF-LH:",3,4,3,4); +GUI_TOOLTIP(uspex_gui.mag_aflh,"magRatio: Ch. 4.1 DEFAULT: 0.1\n(magnetic calculation) Initial ratio of structures\nwith a low/high spin mixed antiferromagnetic."); +/* line 4 */ + GUI_ENTRY_TABLE(table,uspex_gui.bestFrac,uspex_gui.calc.bestFrac,"%.4f","Best:",0,1,4,5); +GUI_TOOLTIP(uspex_gui.bestFrac,"bestFrac: Ch. 4.3 DEFAULT: 0.7\nFraction of current generation used to generate the next."); + GUI_ENTRY_TABLE(table,uspex_gui.keepBestHM,uspex_gui.calc.keepBestHM,"%3i","BestHM:",1,2,4,5); +GUI_TOOLTIP(uspex_gui.keepBestHM,"keepBestHM: Ch. 4.3 DEFAULT: auto\nNumber of best structures that will survive in next generation."); + GUI_CHECK_TABLE(table,uspex_gui.reoptOld,uspex_gui.calc.reoptOld,NULL,"reopt",2,3,4,5);/*not calling anything*/ +GUI_TOOLTIP(uspex_gui.reoptOld,"reoptOld: Ch. 4.3 DEFAULT: FALSE\nIf set surviving structure will be re-optimized."); + GUI_ENTRY_TABLE(table,uspex_gui.fitLimit,uspex_gui.calc.fitLimit,"%.4f","fitLimit:",3,4,4,5); +GUI_TOOLTIP(uspex_gui.fitLimit,"fitLimit: Ch. 4.3 DEFAULT: none\nStop calculation when fitLimit fitness is reached."); +/* --- Structure & Variation */ + GUI_LABEL_TABLE(table,"Structure & Variation",0,4,5,6); +/* line 6 */ + GUI_TEXT_TABLE(table,uspex_gui.symmetries,uspex_gui.calc.symmetries,"symmetries: ",0,4,6,7); +GUI_TOOLTIP(uspex_gui.symmetries,"symmetries: Ch. 4.4 DEFAULT: auto\nPossible space group for crystals,\nplane group for 2D crystals/surface\nor point group for clusters."); +/* line 7 */ + GUI_ENTRY_TABLE(table,uspex_gui.fracGene,uspex_gui.calc.fracGene,"%.4f","Heredity:",0,1,7,8); +GUI_TOOLTIP(uspex_gui.fracGene,"fracGene: Ch. 4.4 DEFAULT: 0.5\nRatio of structures obtained by heredity."); + GUI_ENTRY_TABLE(table,uspex_gui.fracRand,uspex_gui.calc.fracRand,"%.4f","Random:",1,2,7,8); +GUI_TOOLTIP(uspex_gui.fracRand,"fracRand: Ch. 4.4 DEFAULT: 0.2\nRatio of structures obtained randomly."); + GUI_ENTRY_TABLE(table,uspex_gui.fracTopRand,uspex_gui.calc.fracTopRand,"%.4f","TOPRand:",2,3,7,8); +GUI_TOOLTIP(uspex_gui.fracTopRand,"fracTopRand: Ch. 4.4 DEFAULT: 0.2\nRatio of structures obtained by topological random generator."); + GUI_ENTRY_TABLE(table,uspex_gui.fracPerm,uspex_gui.calc.fracPerm,"%.4f","Permutation:",3,4,7,8); +GUI_TOOLTIP(uspex_gui.fracPerm,"fracPerm: Ch. 4.4 DEFAULT: auto\nRatio of structures obtained by permutation."); +/* line 8 */ + GUI_ENTRY_TABLE(table,uspex_gui.fracAtomsMut,uspex_gui.calc.fracAtomsMut,"%.4f","AtmMut:",0,1,8,9); +GUI_TOOLTIP(uspex_gui.fracAtomsMut,"fracAtomsMut: Ch. 4.4 DEFAULT: 0.1\nRatio of structures obtained by softmutation."); + GUI_ENTRY_TABLE(table,uspex_gui.fracRotMut,uspex_gui.calc.fracRotMut,"%.4f","RotMut:",1,2,8,9); +GUI_TOOLTIP(uspex_gui.fracRotMut,"fracRotMut: Ch. 4.4 DEFAULT: auto\nRatio of structures obtained by mutation of molecular orientation."); + GUI_ENTRY_TABLE(table,uspex_gui.fracLatMut,uspex_gui.calc.fracLatMut,"%.4f","LatMut:",2,3,8,9); +GUI_TOOLTIP(uspex_gui.fracLatMut,"fracLatMut: Ch. 4.4 DEFAULT: auto\nRatio of structures obtained by lattice mutation."); + GUI_ENTRY_TABLE(table,uspex_gui.fracSpinMut,uspex_gui.calc.fracSpinMut,"%.4f","SpinMut:",3,4,8,9); +GUI_TOOLTIP(uspex_gui.fracSpinMut,"fracSpinMut: Ch. 4.4 DEFAULT: 0.1\nRatio of structures obtained by spin mutation."); +/* line 9 */ + GUI_ENTRY_TABLE(table,uspex_gui.howManySwaps,uspex_gui.calc.howManySwaps,"%3i","NSwaps:",0,1,9,10); +GUI_TOOLTIP(uspex_gui.howManySwaps,"howManySwaps: Ch. 4.4 DEFAULT: auto\nNumber of pairwise swaps for permutation\ndistributed uniformly between [1,howManySwaps]."); + GUI_TEXT_TABLE(table,uspex_gui.specificSwaps,uspex_gui.calc.specificSwaps,"Swaps: ",1,4,9,10); +GUI_TOOLTIP(uspex_gui.specificSwaps,"specificSwaps: Ch. 4.4 DEFAULT: blank\nWich atoms are allow to swap during permutation."); +/* line 10 */ + GUI_ENTRY_TABLE(table,uspex_gui.mutationDegree,uspex_gui.calc.mutationDegree,"%.4f","mutationDegree:",0,1,10,11); +GUI_TOOLTIP(uspex_gui.mutationDegree,"mutationDegree: Ch. 4.13 DEFAULT: auto\nMaximum displacement in softmutation (Ang)."); + GUI_ENTRY_TABLE(table,uspex_gui.mutationRate,uspex_gui.calc.mutationRate,"%.4f","mutationRate:",1,2,10,11); +GUI_TOOLTIP(uspex_gui.mutationRate,"mutationRate: Ch. 4.13 DEFAULT: 0.5\nStd. dev. of epsilon in strain matrix for lattice mutation."); + GUI_ENTRY_TABLE(table,uspex_gui.DisplaceInLatmutation,uspex_gui.calc.DisplaceInLatmutation,"%.4f","D_LATMUT:",2,3,10,11); +GUI_TOOLTIP(uspex_gui.DisplaceInLatmutation,"DisplaceInLatmutation: Ch. ?.? DEFAULT: 1.0\nSets softmutation as part of lattice mutation\nand gives maximum displacement (Ang).\nThis keyword has disapear in the 10.1 version of USPEX."); + GUI_CHECK_TABLE(table,uspex_gui.AutoFrac,uspex_gui.calc.AutoFrac,NULL,"AutoFrac",3,4,10,11);/*not calling anything*/ +GUI_TOOLTIP(uspex_gui.AutoFrac,"AutoFrac: Ch. 4.4 DEFAULT: FALSE\nIf set variation parameters will be optimized during run."); +/* --- Fingerprint & Antiseeds */ + GUI_LABEL_TABLE(table,"Fingerprint, antiseed, & spacegroup",0,4,11,12); +/* line 12 */ + GUI_LABEL_TABLE(table,"Fingerprint",0,1,12,13); + GUI_ENTRY_TABLE(table,uspex_gui.RmaxFing,uspex_gui.calc.RmaxFing,"%.4f","RMax:",1,2,12,13); +GUI_TOOLTIP(uspex_gui.RmaxFing,"RmaxFing: Ch. 4.9 DEFAULT: 10.0\ncutoff distance (Ang.)."); + GUI_ENTRY_TABLE(table,uspex_gui.deltaFing,uspex_gui.calc.deltaFing,"%.4f","delta:",2,3,12,13); +GUI_TOOLTIP(uspex_gui.deltaFing,"deltaFing: Ch. 4.9 DEFAULT: 0.08\nDiscretization of the fingerprint function."); + GUI_ENTRY_TABLE(table,uspex_gui.sigmaFing,uspex_gui.calc.sigmaFing,"%.4f","sigma:",3,4,12,13); +GUI_TOOLTIP(uspex_gui.sigmaFing,"sigmaFing: Ch. 4.9 DEFAULT: 0.03\nGaussian broadening of interatomic distance."); +/* line 13 */ + GUI_LABEL_TABLE(table,"Antiseed",0,1,13,14); + GUI_ENTRY_TABLE(table,uspex_gui.antiSeedsActivation,uspex_gui.calc.antiSeedsActivation,"%4i","Activation:",1,2,13,14); +GUI_TOOLTIP(uspex_gui.antiSeedsActivation,"antiSeedsActivation: Ch. 4.10 DEFAULT: 5000\nGeneration at which antiseed is active."); + GUI_ENTRY_TABLE(table,uspex_gui.antiSeedsMax,uspex_gui.calc.antiSeedsMax,"%.4f","Max:",2,3,13,14); +GUI_TOOLTIP(uspex_gui.antiSeedsMax,"antiSeedsMax: Ch. 4.10 DEFAULT: 0.000\nGaussian height in mean square deviation of the generation enthalpy\nAmong bestFrac structures, recommended value is 0.01."); + GUI_ENTRY_TABLE(table,uspex_gui.antiSeedsSigma,uspex_gui.calc.antiSeedsSigma,"%.4f","sigma:",3,4,13,14); +GUI_TOOLTIP(uspex_gui.antiSeedsSigma,"antiSeedsSigma: Ch. 4.10 DEFAULT: 0.001\nGaussian width in average distances between generated structure\nAmong bestFrac structures, recommended calue is 0.005."); +/* line 14 */ + GUI_LABEL_TABLE(table,"Space group",0,1,14,15); + /*col 2: empty*/ + GUI_CHECK_TABLE(table,uspex_gui.doSpaceGroup,uspex_gui.calc.doSpaceGroup,SG_toggle,"Active",2,3,14,15); +GUI_TOOLTIP(uspex_gui.doSpaceGroup,"doSpaceGroup: Ch. 4.11 DEFAULT: TRUE\nActivate space group determination."); + GUI_ENTRY_TABLE(table,uspex_gui.SymTolerance,uspex_gui.calc.SymTolerance,"%.4f","TOL:",3,4,14,15); +GUI_TOOLTIP(uspex_gui.SymTolerance,"SymTolerance: Ch. 4.11 DEFAULT: 0.10\nPrecision for symmetry determination."); +/* --- Variable-composition */ + GUI_LABEL_TABLE(table,"Variable-composition",0,4,15,16); +/* line 16 */ + GUI_ENTRY_TABLE(table,uspex_gui.firstGeneMax,uspex_gui.calc.firstGeneMax,"%4i","1st_Gen:",0,1,16,17); +GUI_TOOLTIP(uspex_gui.firstGeneMax,"firstGeneMax: Ch. 5.5 DEFAULT: 11\nNumber of composition sampled in 1st generation."); + GUI_ENTRY_TABLE(table,uspex_gui.minAt,uspex_gui.calc.minAt,"%4i","min@:",1,2,16,17); +GUI_TOOLTIP(uspex_gui.minAt,"minAt: Ch. 5.5 DEFAULT: none\nMinimum number of atoms (molecules) in unitcell\nfor the first generation."); + GUI_ENTRY_TABLE(table,uspex_gui.maxAt,uspex_gui.calc.maxAt,"%4i","max@:",2,3,16,17); +GUI_TOOLTIP(uspex_gui.maxAt,"maxAt: Ch. 5.5 DEFAULT: none\nMaximum number of atoms (molecules) in unitcell\nfor the first generation."); +/*col 4: empty*/ +/* line 17 */ + GUI_ENTRY_TABLE(table,uspex_gui.fracTrans,uspex_gui.calc.fracTrans,"%.4f","fTrans:",0,1,17,18); +GUI_TOOLTIP(uspex_gui.fracTrans,"fracTrans: Ch. 5.5 DEFAULT: 0.1\nFraction of structures obtained by transmutation."); + GUI_ENTRY_TABLE(table,uspex_gui.howManyTrans,uspex_gui.calc.howManyTrans,"%.4f","rTrans:",1,2,17,18); +GUI_TOOLTIP(uspex_gui.howManyTrans,"howManyTrans: Ch. 5.5 DEFAULT: 0.2\nMaximum ratio of transmutated atoms in a structure."); + if(uspex_gui.calc._nspetrans<1){ + title=g_strdup(""); + }else{ + title=g_strdup_printf("%i",uspex_gui.calc.specificTrans[0]); + } + for(idx=1;idx CALCULATION */ +/*-----------------------*/ + GUI_PAGE_NOTE(notebook,page,"CALCULATION"); +/* create a table in the page*/ + GUI_TABLE_NOTE(page,table,18,4); +/* --- Ab initio */ + GUI_LABEL_TABLE(table,"Ab initio",0,4,0,1); +/* line 1 */ + GUI_SPIN_TABLE(table,uspex_gui._num_opt_steps,uspex_gui._tmp_num_opt_steps,spin_update_num_opt_steps,"N_STEPS",0,1,1,2); + GUI_SPIN_RANGE(uspex_gui._num_opt_steps,1.,(gdouble)USPEX_MAX_NUM_OPT_STEPS); +GUI_TOOLTIP(uspex_gui._num_opt_steps,"Set the number of optimisation steps.\nIncluding fixed-cells and full relaxation steps."); + GUI_SPIN_TABLE(table,uspex_gui._curr_step,uspex_gui._tmp_curr_step,spin_update_curr_step,"STEPS #",1,2,1,2); + GUI_SPIN_RANGE(uspex_gui._curr_step,1.,uspex_gui._tmp_num_opt_steps); +GUI_TOOLTIP(uspex_gui._curr_step,"Select current optimisation step number."); + GUI_CHECK_TABLE(table,button,uspex_gui.auto_step,toggle_auto_step,"AUTO STEP",2,3,1,2); +GUI_TOOLTIP(button,"This indicates that user have a \"Specific\" directory containing\nall necessary calculation files:\nginput_N, goptions_N for GULP (for each N step)\nINCAR_N, POTCAR_X for VASP (for each step N and species X)"); + GUI_CHECK_TABLE(table,uspex_gui._isfixed,uspex_gui._tmp_isfixed,NULL,"Relax_fixed",3,4,1,2); +GUI_TOOLTIP(uspex_gui._isfixed,"Set the current step as a fixed relaxation.\nUseful only with a mix between fixed and full relaxations."); +/* line 2 */ + GUI_COMBOBOX_TABLE(table,uspex_gui.abinitioCode,"CODE:",0,2,2,3); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"0 - NONE"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"1 - VASP"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"2 - SIESTA"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"3 - GULP"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"4 - LAMMPS"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"5 - ORCA"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"6 - DMACRYS"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"7 - CP2K"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"8 - QE"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"9 - FHI-aims"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"10 - ATK"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"11 - CASTEP"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"12 - Tinker"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"13 - MOPAC"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"14 - BoltzTraP"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"15 - DFTB"); + GUI_COMBOBOX_ADD(uspex_gui.abinitioCode,"16 - Gaussian"); +GUI_TOOLTIP(uspex_gui.abinitioCode,"abinitioCode: Ch. 4.8 DEFAULT: 1\nCode used for the calculations in this step."); + GUI_ENTRY_TABLE(table,uspex_gui.KresolStart,uspex_gui.calc.KresolStart[0],"%.4f","Kresol:",2,3,2,3); +GUI_TOOLTIP(uspex_gui.KresolStart,"KresolStart: Ch. 4.8 DEFAULT: 0.2-0.08\nReciprocal-space resolution for this optimization step (2*pi/Ang)."); + GUI_ENTRY_TABLE(table,uspex_gui.vacuumSize,uspex_gui.calc.vacuumSize[0],"%.4f","vacuum:",3,4,2,3); +GUI_TOOLTIP(uspex_gui.vacuumSize,"vacuumSize: Ch. 4.8 DEFAULT: 10.0\nVacuum size (Ang.) between neighbor atoms from adjacent unit cells.\nFor cluster, 2D-crystal, and surfaces only."); +/* line 3 */ + GUI_TEXT_TABLE(table,uspex_gui.ai_input,uspex_gui._tmp_ai_input[0],"INP:",0,1,3,4); +GUI_TOOLTIP(uspex_gui.ai_input,"Input for the current calculation step.\nFile name as to end with *_N where N is the step number."); + GUI_OPEN_BUTTON_TABLE(table,uspex_gui.ai_input_button,load_ai_input_dialog,1,2,3,4); + GUI_TEXT_TABLE(table,uspex_gui.ai_opt,uspex_gui._tmp_ai_opt[0],"OPT:",2,3,3,4); +GUI_TOOLTIP(uspex_gui.ai_opt,"Complementary (optional) file for the current calculation step.\nWhen present, file name as to end with *_N where N is the step number."); + GUI_OPEN_BUTTON_TABLE(table,uspex_gui.ai_opt_button,load_ai_opt_dialog,3,4,3,4); +/* line 4 */ + GUI_TEXT_TABLE(table,uspex_gui.commandExecutable,uspex_gui._tmp_commandExecutable[0],"EXE:",0,1,4,5); +GUI_TOOLTIP(uspex_gui.commandExecutable,"commandExecutable: Ch. 4.8 DEFAULT: none\nCurrent optimisation step executable of submission script."); + GUI_OPEN_BUTTON_TABLE(table,button,load_abinitio_exe_dialog,1,2,4,5); + GUI_BUTTON_TABLE(table,uspex_gui.ai_generate,"Generate",generate_step,2,3,4,5); +GUI_TOOLTIP(uspex_gui.ai_generate,"Use GDIS integrated interface to create this step input file.\nUnavailable (for now) m(_ _)m"); + GUI_APPLY_BUTTON_TABLE(table,button,apply_step,3,4,4,5); +GUI_TOOLTIP(button,"Apply changes to this step (only)."); +/* line 5 */ + GUI_COMBOBOX_TABLE(table,uspex_gui.ai_spe,"Species:",0,1,5,6); +GUI_TOOLTIP(uspex_gui.ai_spe,"Select species for (pseudo-)potential information."); + GUI_TEXT_TABLE(table,uspex_gui.ai_pot,uspex_gui._potentials[0],"POT:",1,3,5,6); +GUI_TOOLTIP(uspex_gui.ai_pot,"Per-species (pseudo-)potential files.\nFor pair- and molecules-potential, do not mind the \"per-species\"."); + GUI_OPEN_BUTTON_TABLE(table,uspex_gui.ai_pot_button,load_ai_pot_dialog,3,4,5,6); +/* --- USPEX launch */ + GUI_LABEL_TABLE(table,"USPEX launch",0,4,6,7); +/* line 7 */ + GUI_TEXT_TABLE(table,uspex_gui.job_uspex_exe,uspex_gui.calc.job_uspex_exe,"USPEX:",0,1,7,8); +GUI_TOOLTIP(uspex_gui.job_uspex_exe,"The USPEX script executable."); + GUI_OPEN_BUTTON_TABLE(table,button,load_uspex_exe,1,2,7,8); + GUI_ENTRY_TABLE(table,uspex_gui.whichCluster,uspex_gui.calc.whichCluster,"%i","Cluster:",2,3,7,8); +GUI_TOOLTIP(uspex_gui.whichCluster,"whichCluster: Ch. 4.8 DEFAULT: 0\nType of job submission, including:\n0 - no job-script;\n1 - local submission;\n2 - remote submission.\n>2 - specific supercomputer."); + GUI_CHECK_TABLE(table,button,uspex_gui.calc.PhaseDiagram,NULL,"PhaseDiag",3,4,7,8);/*not calling anything*/ +GUI_TOOLTIP(button,"PhaseDiagram: Ch. 4.8 DEFAULT: FALSE\nSet calculation of an estimated phase diagram\nfor calculationMethod 30X (300, 301, s300, and s301)."); +/* line 8 */ + GUI_CHECK_TABLE(table,button,uspex_gui.have_v1010,NULL,"Ver 10.1",0,1,8,9);/*not calling anything*/ +GUI_TOOLTIP(button,"Use USPEX v. 10.1 instead of 9.4.4."); + GUI_ENTRY_TABLE(table,uspex_gui.numProcessors,uspex_gui.calc.numProcessors,"%i","CPU:",1,2,8,9); +GUI_TOOLTIP(uspex_gui.numProcessors,"numProcessors: Ch. ? DEFAULT: 1\nNumber of processors used in a step (undocumented)."); + GUI_ENTRY_TABLE(table,uspex_gui.numParallelCalcs,uspex_gui.calc.numParallelCalcs,"%i","PAR:",2,3,8,9); +GUI_TOOLTIP(uspex_gui.numParallelCalcs,"numParallelCalcs: Ch. 4.8 DEFAULT: 1\nNumber of structure relaxations in parallel."); + GUI_CHECK_TABLE(table,button,uspex_gui.have_octave,NULL,"OCTAVE",3,4,8,9);/*not calling anything*/ +GUI_TOOLTIP(button,"Use octave instead of matlab."); +/* line 9 */ + GUI_TEXT_TABLE(table,uspex_gui.job_path,uspex_gui.calc.job_path,"Folder:",0,1,9,10); +GUI_TOOLTIP(uspex_gui.job_path,"Select USPEX calculation folder.\nThis folder is where run_uspex will be launched\nand result will be read by GDIS."); + GUI_OPEN_BUTTON_TABLE(table,button,uspex_path_dialog,1,2,9,10); + GUI_TEXT_TABLE(table,uspex_gui.remoteFolder,uspex_gui.calc.remoteFolder,"Remote:",2,3,9,10); +GUI_TOOLTIP(uspex_gui.remoteFolder,"remoteFolder: Ch. 4.8 DEFAULT: none\nWhen using remote submission, this hold the\nexecution folder on the distant computer."); + GUI_OPEN_BUTTON_TABLE(table,button,load_remote_folder,3,4,9,10); + /*TODO: disable remote when whichCluster<2*/ +/* --- Restart */ + GUI_LABEL_TABLE(table,"Restart",0,4,10,11); +/* line 11 */ + GUI_CHECK_TABLE(table,uspex_gui.pickUpYN,uspex_gui.calc.pickUpYN,NULL,"RESTART",0,1,11,12);/*not calling anything*/ +GUI_TOOLTIP(uspex_gui.pickUpYN,"pickUpYN: deprecated DEFAULT: 0\nSet to restart a calculation, deprecated on version <= 10."); + GUI_ENTRY_TABLE(table,uspex_gui.pickUpGen,uspex_gui.calc.pickUpGen,"%i","GEN:",1,2,11,12); +GUI_TOOLTIP(uspex_gui.pickUpGen,"pickUpGen: Ch. 4.7 DEFAULT: 0\nSelect the generation at which USPEX should restart.\nA new calculation is started for 0 (default)."); + GUI_ENTRY_TABLE(table,uspex_gui.pickUpFolder,uspex_gui.calc.pickUpFolder,"%i","Folder:",2,3,11,12); +GUI_TOOLTIP(uspex_gui.pickUpFolder,"pickUpFolder: Ch. 4.7 DEFAULT: 0\nSelect the folder number from which to restart from.\nSetting N means restarting from a folder named \"resultN\"."); + GUI_CHECK_TABLE(table,button,uspex_gui.restart_cleanup,NULL,"CLEANUP",3,4,11,12);/*not calling anything*/ +GUI_TOOLTIP(button,"Cleanup the calculation directory before restart,\nie. remove still_running, NOT_YET, 0PhaseDiagram: Ch. 4.8 DEFAULT: FALSE\nSet calculation of an estimated phase diagram\nfor calculationMethod 30X (300, 301, s300, and s301)."); +/* reserved for future use */ + for(idx=12;idx<18;idx++) GUI_LABEL_TABLE(table," ",0,4,idx,idx+1); +/* --- end page */ + +/*--------------------*/ +/* page 4 -> ADVANCED */ +/*--------------------*/ + GUI_PAGE_NOTE(notebook,page,"ADVANCED"); +/* create a table in the page*/ + GUI_TABLE_NOTE(page,table,18,4); +/* --- Developers */ + GUI_LABEL_TABLE(table,"Developers",0,4,0,1); +/* line 1 */ + GUI_ENTRY_TABLE(table,uspex_gui.repeatForStatistics,uspex_gui.calc.repeatForStatistics,"%i","REPEAT:",0,1,1,2); +GUI_TOOLTIP(uspex_gui.repeatForStatistics,"repeatForStatistics: Ch. 4.12 DEFAULT: 1\nNumber of USPEX repeated job execution.\nFor default 1 value, no statistic is collected."); + GUI_ENTRY_TABLE(table,uspex_gui.stopFitness,uspex_gui.calc.stopFitness,"%.4f","STOP_FIT:",1,2,1,2); +GUI_TOOLTIP(uspex_gui.stopFitness,"stopFitness: Ch. 4.12 DEFAULT: none\nThe fitness value at which USPEX calculation will stop.\nSee also fitLimit in STRUCTURE page."); + GUI_ENTRY_TABLE(table,uspex_gui.fixRndSeed,uspex_gui.calc.fixRndSeed,"%i","RND_SEED:",2,3,1,2); +GUI_TOOLTIP(uspex_gui.fixRndSeed,"fixRndSeed: Ch. 4.12 DEFAULT: 0\nFor non-zero values, fix the random seed\nto check that for two USPEX calculations\nwith the same seed produce the same results."); + GUI_CHECK_TABLE(table,button,uspex_gui.calc.collectForces,NULL,"CollectForces",3,4,1,2);/*not calling anything*/ +GUI_TOOLTIP(button,"collectForces: Ch. 4.12 DEFAULT: FALSE\nCollect relaxation information from VASP calculation\n(energies, forces, positions, geometry, and stress)."); +/* --- Seldom */ + GUI_LABEL_TABLE(table,"Seldom",0,4,2,3); +/* line 3 */ + GUI_CHECK_TABLE(table,button,uspex_gui.calc.ordering_active,NULL,"ordering",0,1,3,4);/*not calling anything*/ +GUI_TOOLTIP(button,"ordering_active: Ch. 4.12 DEFAULT: TRUE\nSwitch the \"biasing of variation operators by local order parameters\"."); + GUI_CHECK_TABLE(table,button,uspex_gui.calc.symmetrize,NULL,"symmetrize",1,2,3,4);/*not calling anything*/ +GUI_TOOLTIP(button,"symmetrize: Ch. 4.13 DEFAULT: FALSE\nTransform all structure to \"standard symmetry-adapted crystallografic setting\"."); + if(uspex_gui.calc.valenceElectr==NULL){ + title=g_strdup(""); + }else{ + title=g_strdup_printf("%i",uspex_gui.calc.valenceElectr[0]); + for(idx=1;idxB):",0,1,13,14); +GUI_TOOLTIP(uspex_gui.amplitudeShoot_AB,"amplitudeShoot: Ch. 6.2 DEFAULT: 0.1\nMomentum amplitude for A->B shooting."); + GUI_ENTRY_TABLE(table,uspex_gui.amplitudeShoot_BA,uspex_gui.calc.amplitudeShoot[1],"%.4f","A(B->A):",1,2,13,14); +GUI_TOOLTIP(uspex_gui.amplitudeShoot_BA,"amplitudeShoot: Ch. 6.2 DEFAULT: 0.1\nMomentum amplitude for B->A shooting."); + GUI_ENTRY_TABLE(table,uspex_gui.magnitudeShoot_success,uspex_gui.calc.magnitudeShoot[0],"%.4f","M(success):",2,3,13,14); +GUI_TOOLTIP(uspex_gui.magnitudeShoot_success,"magnitudeShoot: Ch. 6.2 DEFAULT: 1.05\nAmplitude increasing factor on MD trajectory success."); + GUI_ENTRY_TABLE(table,uspex_gui.magnitudeShoot_failure,uspex_gui.calc.magnitudeShoot[1],"%.4f","M(failure):",3,4,13,14); +GUI_TOOLTIP(uspex_gui.magnitudeShoot_failure,"magnitudeShoot: Ch. 6.2 DEFAULT: 1.05\nAmplitude decreasing factor on MD trajectory failure."); +/* line 14 */ + GUI_TEXT_TABLE(table,uspex_gui.cmdOrderParameter,uspex_gui.calc.cmdOrderParameter,"cmdOP:",0,2,14,15); +GUI_TOOLTIP(uspex_gui.cmdOrderParameter,"cmdOrderParameter: Ch. 6.2 DEFAULT: none\nUser-defined command for order parameter calculation."); + GUI_OPEN_BUTTON_TABLE(table,uspex_gui.cmdOrderParameter_button,load_cmd_OP,2,3,14,15); + GUI_ENTRY_TABLE(table,uspex_gui.opCriteria_start,uspex_gui.calc.opCriteria[0],"%.4f","SIM(start):",3,4,14,15); +GUI_TOOLTIP(uspex_gui.opCriteria_start,"opCriteria: Ch. 6.2 DEFAULT: none\nAllowable degree of similarity between starting states."); +/* line 15 */ + GUI_TEXT_TABLE(table,uspex_gui.cmdEnthalpyTemperature,uspex_gui.calc.cmdEnthalpyTemperature,"cmdET:",0,2,15,16); +GUI_TOOLTIP(uspex_gui.cmdEnthalpyTemperature,"cmdEnthalpyTemperature: Ch. 6.2 DEFAULT: none\nUser-defined command for enthalpy/temperature\nextraction from the MD results."); + GUI_OPEN_BUTTON_TABLE(table,uspex_gui.cmdEnthalpyTemperature_button,load_cmd_ET,2,3,15,16); + GUI_ENTRY_TABLE(table,uspex_gui.opCriteria_end,uspex_gui.calc.opCriteria[1],"%.4f","SIM(end):",3,4,15,16); +GUI_TOOLTIP(uspex_gui.opCriteria_end,"opCriteria: Ch. 6.2 DEFAULT: none\nAllowable degree of similarity between ending states."); +/* line 16 */ + GUI_TEXT_TABLE(table,uspex_gui.orderParameterFile,uspex_gui.calc.orderParameterFile,"OP_file:",0,1,16,17); +GUI_TOOLTIP(uspex_gui.orderParameterFile,"orderParameterFile: Ch. 6.2 DEFAULT: fp.dat\nOrder parameter history file."); + GUI_OPEN_BUTTON_TABLE(table,uspex_gui.orderParameterFile_button,load_OP_file,1,2,16,17); + GUI_TEXT_TABLE(table,uspex_gui.enthalpyTemperatureFile,uspex_gui.calc.enthalpyTemperatureFile,"ET_file:",2,3,16,17); +GUI_TOOLTIP(uspex_gui.enthalpyTemperatureFile,"enthalpyTemperatureFile: Ch. 6.2 DEFAULT: HT.dat\nEnthalpy and temperature history file."); + GUI_OPEN_BUTTON_TABLE(table,uspex_gui.enthalpyTemperatureFile_button,load_ET_file,3,4,16,17); +/* line 17 */ + GUI_TEXT_TABLE(table,uspex_gui.trajectoryFile,uspex_gui.calc.trajectoryFile,"traj_file:",0,1,17,18); +GUI_TOOLTIP(uspex_gui.trajectoryFile,"trajectoryFile: Ch. 6.2 DEFAULT: traj.dat\nMD trajectory file."); + GUI_OPEN_BUTTON_TABLE(table,uspex_gui.trajectoryFile_button,load_traj_file,1,2,17,18); + GUI_TEXT_TABLE(table,uspex_gui.MDrestartFile,uspex_gui.calc.MDrestartFile,"MD_file:",2,3,17,18); +GUI_TOOLTIP(uspex_gui.MDrestartFile,"MDrestartFile: Ch. 6.2 DEFAULT: traj.restart\nMD restart file."); + GUI_OPEN_BUTTON_TABLE(table,uspex_gui.MDrestartFile_button,load_MDrestart_file,3,4,17,18); +/* --- end page */ + +/*--------------------*/ +/* page 5 -> SPECIFIC */ +/*--------------------*/ + GUI_PAGE_NOTE(notebook,uspex_gui.specific_page,"SPECIFIC"); +/* create a table in the page*/ + GUI_TABLE_NOTE(uspex_gui.specific_page,table,18,4); +/* --- Metadynamics */ + GUI_LABEL_TABLE(table,"Metadynamics",0,4,0,1); +/* line 1 */ + GUI_COMBOBOX_TABLE(table,uspex_gui.FullRelax,"Relax:",0,1,1,2); + GUI_COMBOBOX_ADD(uspex_gui.FullRelax,"0 - No full relaxation (fix cells)"); + GUI_COMBOBOX_ADD(uspex_gui.FullRelax,"1 - Relax only the best structures"); + GUI_COMBOBOX_ADD(uspex_gui.FullRelax,"2 - Relax all different structures"); +GUI_TOOLTIP(uspex_gui.FullRelax,"FullRelax: Ch. 5.6 DEFAULT: 2\nPerform full relaxation of which structures for analysis.\nRecommended value is 2."); + GUI_ENTRY_TABLE(table,uspex_gui.maxVectorLength,uspex_gui.calc.maxVectorLength,"%.4f","MaxV:",1,2,1,2); +GUI_TOOLTIP(uspex_gui.maxVectorLength,"maxVectorLength: Ch. 5.6 DEFAULT: none\nAdd a correction force to keep cell length below this setting."); + GUI_ENTRY_TABLE(table,uspex_gui.GaussianWidth,uspex_gui.calc.GaussianWidth,"%.4f","GaussW:",2,3,1,2); +GUI_TOOLTIP(uspex_gui.GaussianWidth,"GaussianWidth: Ch. 5.6 DEFAULT: AUTO\nWidth of Gaussian added to PES to accelerate phase transition.\nRecommended values is 0.10~0.15L (L = minimum cell length)."); + GUI_ENTRY_TABLE(table,uspex_gui.GaussianHeight,uspex_gui.calc.GaussianHeight,"%.4f","GaussH:",3,4,1,2); +GUI_TOOLTIP(uspex_gui.GaussianHeight,"GaussianHeight: Ch. 5.6 DEFAULT: AUTO\nHeight of Gaussian added to PES to accelerate phase transition.\nRecommended values is L.dh^2.G with L = average cell length,\ndh = GaussW, and G = shear modulus."); +/* line 2 */ + /*col 1: empty*/ +// GUI_ENTRY_TABLE(table,uspex_gui.ExternalPressure,uspex_gui.calc.ExternalPressure,"%.4f","ExtP:",0,1,2,3); +//GUI_TOOLTIP(uspex_gui.ExternalPressure,"ExternalPressure: Ch. 4.1, 5.6 DEFAULT: none\nExternal pressure (GPa) for calculation."); + GUI_COMBOBOX_TABLE(table,uspex_gui.meta_model,"MODEL:",1,3,2,3); + GUI_COMBOBOX_ADD(uspex_gui.meta_model,"From POSCAR FILE"); + GUI_COMBOBOX_ADD(uspex_gui.meta_model,"UNDER CONSTRUCTION"); +GUI_TOOLTIP(uspex_gui.meta_model,"Select the model from which metadynamics is started.\nA good structure, relaxed at ExtP is necessary."); + GUI_OPEN_BUTTON_TABLE(table,uspex_gui.meta_model_button,load_meta_start_file,3,4,2,3); +/* --- Particles Swarm optimization */ + GUI_LABEL_TABLE(table,"Particles Swarm optimization",0,4,3,4); +/* line 4 */ + /*col 1: empty*/ + GUI_ENTRY_TABLE(table,uspex_gui.PSO_softMut,uspex_gui.calc.PSO_softMut,"%.4f","SoftMut:",1,2,4,5); +GUI_TOOLTIP(uspex_gui.PSO_softMut,"PSO_softMut: Ch. 5.7 DEFAULT: 1\nSoft mutation weight."); + GUI_ENTRY_TABLE(table,uspex_gui.PSO_BestStruc,uspex_gui.calc.PSO_BestStruc,"%.4f","BestStruct:",2,3,4,5); +GUI_TOOLTIP(uspex_gui.PSO_BestStruc,"PSO_BestStruc: Ch. 5.7 DEFAULT: 1\nWeight of heredity with best position of a given PSO particle."); + GUI_ENTRY_TABLE(table,uspex_gui.PSO_BestEver,uspex_gui.calc.PSO_BestEver,"%.4f","BestEver:",3,4,4,5); +GUI_TOOLTIP(uspex_gui.PSO_BestEver,"PSO_BestEver: Ch. 5.7 DEFAULT: 1\nWeight of heredity with globally best PSO particle."); +/* --- Variable-cell nudged elastic band */ + GUI_LABEL_TABLE(table,"Variable-cell nudged elastic band",0,4,5,6); +/* line 6 */ + GUI_COMBOBOX_TABLE(table,uspex_gui._vcnebtype_method,"Method:",0,1,6,7); + GUI_COMBOBOX_ADD(uspex_gui._vcnebtype_method,"1 - VC-NEB method"); + GUI_COMBOBOX_ADD(uspex_gui._vcnebtype_method,"2 - simple relaxation"); +GUI_TOOLTIP(uspex_gui._vcnebtype_method,"Choose between VC-NEB method and simple structure relaxation."); + GUI_ENTRY_TABLE(table,uspex_gui.vcnebType,uspex_gui.calc.vcnebType,"%3i","VC-NEB:",1,2,6,7); +GUI_TOOLTIP(uspex_gui.vcnebType,"vcnebType: Ch. 6.1 DEFAULT: 110\nType of VC-NEB calculation."); +GUI_LOCK(uspex_gui.vcnebType);/*not directly modifiable*/ + GUI_CHECK_TABLE(table,uspex_gui._vcnebtype_img_num,uspex_gui.calc._vcnebtype_img_num,update_vcnebType,"Var_Image",2,3,6,7); +GUI_TOOLTIP(uspex_gui._vcnebtype_img_num,"Set whether number of images should be kept fixed."); + GUI_CHECK_TABLE(table,uspex_gui._vcnebtype_spring,uspex_gui.calc._vcnebtype_spring,update_vcnebType,"Var_Spring",3,4,6,7); +GUI_TOOLTIP(uspex_gui._vcnebtype_spring,"Set whether spring constants should be kept fixed."); +/* line 7 */ + GUI_COMBOBOX_TABLE(table,uspex_gui.optReadImages,"Img:",0,1,7,8); + GUI_COMBOBOX_ADD(uspex_gui.optReadImages,"0 - All structures are needed"); + GUI_COMBOBOX_ADD(uspex_gui.optReadImages,"1 - Only initial and final"); + GUI_COMBOBOX_ADD(uspex_gui.optReadImages,"2 - Initial and final + intermediates"); +GUI_TOOLTIP(uspex_gui.optReadImages,"optReadImages: Ch. 6.1 DEFAULT: 2\nSet the method for reading Images file."); + GUI_ENTRY_TABLE(table,uspex_gui.numImages,uspex_gui.calc.numImages,"%i","N_Img:",1,2,7,8); +GUI_TOOLTIP(uspex_gui.numImages,"numImages: Ch. 6.1 DEFAULT: 9\nInitial number of images."); + GUI_ENTRY_TABLE(table,uspex_gui.numSteps,uspex_gui.calc.numSteps,"%4i","N_Step:",2,3,7,8); +GUI_TOOLTIP(uspex_gui.numSteps,"numSteps: Ch. 6.1 DEFAULT: 600\nMaximum VC-NEB step iterations.\nA value of at least 500 is recommended."); + GUI_CHECK_TABLE(table,uspex_gui.optFreezing,uspex_gui.calc.optFreezing,NULL,"Freeze_Img",3,4,7,8);/*not calling anything*/ +GUI_TOOLTIP(uspex_gui.optFreezing,"optFreezing: Ch. 6.1 DEFAULT: FALSE\nActivate freezing of Image structure when ConvThreshold is reached."); +/* line 8 */ + GUI_COMBOBOX_TABLE(table,uspex_gui.optimizerType,"Opt:",0,1,8,9); + GUI_COMBOBOX_ADD(uspex_gui.optimizerType,"1 - Steepest Descent"); + GUI_COMBOBOX_ADD(uspex_gui.optimizerType,"2 - Fast Inertial Relaxation Engine"); +GUI_TOOLTIP(uspex_gui.optimizerType,"optimizerType: Ch. 6.1 DEFAULT: 1\nSelect the optimization algorithm (SD or FIRE)."); + GUI_ENTRY_TABLE(table,uspex_gui.dt,uspex_gui.calc.dt,"%.4f","dt:",1,2,8,9); +GUI_TOOLTIP(uspex_gui.dt,"dt: Ch. 6.1 DEFAULT: 0.05\nTime step for structure relaxation."); + GUI_ENTRY_TABLE(table,uspex_gui.ConvThreshold,uspex_gui.calc.ConvThreshold,"%.4f","Conv:",2,3,8,9); +GUI_TOOLTIP(uspex_gui.ConvThreshold,"ConvThreshold: Ch. 6.1 DEFAULT: 0.003\nHalting condition (ev/Ang.) for RMS forces on images."); + GUI_ENTRY_TABLE(table,uspex_gui.VarPathLength,uspex_gui.calc.VarPathLength,"%.4f","PathLength:",3,4,8,9); +GUI_TOOLTIP(uspex_gui.VarPathLength,"VarPathLength: Ch. 6.1 DEFAULT: AUTO\nCriterion to determine image creation/deletion for variable image method.\nif L>1.5*criterion image is added\nif L<0.5*criterion image is deleted\nL=length between two neighbor images."); +/* line 9 */ + GUI_COMBOBOX_TABLE(table,uspex_gui.optRelaxType,"Relax:",0,1,9,10); + GUI_COMBOBOX_ADD(uspex_gui.optRelaxType,"1 - fixed cell, positions relaxed (=NEB)"); + GUI_COMBOBOX_ADD(uspex_gui.optRelaxType,"2 - cell lattice only (only for testing)"); + GUI_COMBOBOX_ADD(uspex_gui.optRelaxType,"3 - full, cell and positions relaxation."); +GUI_TOOLTIP(uspex_gui.optRelaxType,"optRelaxType: Ch. 6.1 DEFAULT: 3>\nStructure relaxation mode."); + GUI_ENTRY_TABLE(table,uspex_gui.K_min,uspex_gui.calc.K_min,"%.4f","Kmin:",1,2,9,10); +GUI_TOOLTIP(uspex_gui.K_min,"K_min: Ch. 6.1 DEFAULT: 5\nMinimum spring constant (eV/Ang.^2)."); + GUI_ENTRY_TABLE(table,uspex_gui.K_max,uspex_gui.calc.K_max,"%.4f","Kmax:",2,3,9,10); +GUI_TOOLTIP(uspex_gui.K_max,"K_max: Ch. 6.1 DEFAULT: 5\nMaximum spring constant (eV/Ang.^2)."); + GUI_ENTRY_TABLE(table,uspex_gui.Kconstant,uspex_gui.calc.Kconstant,"%.4f","Kcte:",3,4,9,10); +GUI_TOOLTIP(uspex_gui.Kconstant,"Kconstant: Ch. 6.1 DEFAULT: 5\nFixed spring constant (eV/Ang.^2)."); +/* line 10 */ + GUI_COMBOBOX_TABLE(table,uspex_gui.optMethodCIDI,"CI/DI:",0,1,10,11); + GUI_COMBOBOX_ADD(uspex_gui.optMethodCIDI," 0 - No CI/DI method will be used"); + GUI_COMBOBOX_ADD(uspex_gui.optMethodCIDI," 1 - single CI on highest energy TS"); + GUI_COMBOBOX_ADD(uspex_gui.optMethodCIDI,"-1 - Single DI on lowest energy LM"); + GUI_COMBOBOX_ADD(uspex_gui.optMethodCIDI," 2 - Multi-CI/DI on provided TS/LM"); +GUI_TOOLTIP(uspex_gui.optMethodCIDI,"optMethodCIDI: Ch. 6.1 DEFAULT: 0\nOption for Climbing-Image (CI) and Descending-Image (DI)."); + GUI_ENTRY_TABLE(table,uspex_gui.startCIDIStep,uspex_gui.calc.startCIDIStep,"%i","Start CI/DI:",1,2,10,11); +GUI_TOOLTIP(uspex_gui.startCIDIStep,"startCIDIStep: Ch. 6.1 DEFAULT: 100\nStarting step for CI/DI method."); + if(uspex_gui.calc._npickimg<1){ + title=g_strdup(""); + }else{ + title=g_strdup_printf("%i",uspex_gui.calc.pickupImages[0]); + } + for(idx=1;idx0) GUI_ENTRY_GET_TEXT(uspex_gui.value,uspex_gui.calc.value);\ + else uspex_gui.calc.value=NULL;\ +}while(0) +/*page numbers*/ +#define USPEX_PAGE_SYSTEM 0 +#define USPEX_PAGE_STRUCTURES 1 +#define USPEX_PAGE_CALCULATION 2 +#define USPEX_PAGE_ADVANCED 3 +#define USPEX_PAGE_SPECIFIC 4 +/*fixed parameters*/ +#define USPEX_MAX_NUM_OPT_STEPS 16 +/* gui structure */ +struct uspex_calc_gui{ + /*window information*/ + GUI_OBJ *window; + /*connection to calculation parameters*/ + uspex_calc_struct calc; +/*actual GUI*/ + gint cur_page; + gboolean is_dirty; + GUI_OBJ *name; + GUI_OBJ *file_entry; + gboolean have_output; + GUI_OBJ *specific_page;/*because this page can be locked if nothing relevant*/ +/*4.1 Type of run & System*/ + GUI_OBJ *calculationMethod; + GUI_OBJ *calculationType; + GUI_OBJ *_calctype_dim; + gdouble _dim;/*absurd spin on double*/ + GUI_OBJ *_calctype_mol; + GUI_OBJ *_calctype_var; + GUI_OBJ *_calctype_mag; /*VER 10.1*/ + GUI_OBJ *_calctype_mag_2; /*VER 10.1*/ + GUI_OBJ *optType; + gboolean have_new_opt; /*VER 10.1*/ + GUI_OBJ *new_optType; /*VER 10.1*/ + gchar *_tmp_new_optType; /*VER 10.1*/ + /*atoms definition: apply/remove*/ + GUI_OBJ *atomType; + GUI_OBJ *_atom_sym; + GUI_OBJ *_atom_typ; + GUI_OBJ *_atom_num; + GUI_OBJ *_atom_val; + /*temporary values*/ + gchar _tmp_atom_sym[3]; + gint _tmp_atom_typ; + gint _tmp_atom_num; + gint _tmp_atom_val; + /*numSpecies block*/ + GUI_OBJ *numSpecies; + gchar *_tmp_blockSpecies; + GUI_OBJ *blockSpecies; + GUI_OBJ *Species_apply_button; + GUI_OBJ *Species_delete_button; + /*bond definition: apply/auto*/ + GUI_OBJ *goodBonds; + GUI_OBJ *_bond_d; + gchar *_tmp_bond_d; + gboolean auto_bonds; + //checkMolecules is auto-sync + //checkConnectivity is auto-sync + GUI_OBJ *fitLimit; /*VER 10.1*/ + gchar *_tmp_ldaU; /*VER 10.1*/ + GUI_OBJ *ldaU; /*VER 10.1*/ +/*4.2 Population*/ + GUI_OBJ *populationSize; + GUI_OBJ *initialPopSize; + GUI_OBJ *numGenerations; + GUI_OBJ *stopCrit; + GUI_OBJ *mag_nm; /*VER 10.1*/ + GUI_OBJ *mag_fmls; /*VER 10.1*/ + GUI_OBJ *mag_fmhs; /*VER 10.1*/ + GUI_OBJ *mag_afml; /*VER 10.1*/ + GUI_OBJ *mag_afmh; /*VER 10.1*/ + GUI_OBJ *mag_fmlh; /*VER 10.1*/ + GUI_OBJ *mag_aflh; /*VER 10.1*/ +/*4.3 Survival of the fittest & Selection*/ + GUI_OBJ *bestFrac; + GUI_OBJ *keepBestHM; + GUI_OBJ *reoptOld; +/*4.4 Structure generation and variation operators*/ + GUI_OBJ *symmetries; + GUI_OBJ *fracGene; + GUI_OBJ *fracRand; + GUI_OBJ *fracTopRand; /*VER 10.1*/ + GUI_OBJ *fracPerm; + GUI_OBJ *fracAtomsMut; + GUI_OBJ *fracRotMut; + GUI_OBJ *fracLatMut; + GUI_OBJ *fracSpinMut; /*VER 10.1*/ + GUI_OBJ *howManySwaps; + GUI_OBJ *specificSwaps; + GUI_OBJ *mutationDegree; + GUI_OBJ *mutationRate; + GUI_OBJ *DisplaceInLatmutation; + GUI_OBJ *AutoFrac; +/*4.5 Constrains*/ + GUI_OBJ *IonDistances; + GUI_OBJ *_distances; + GUI_OBJ *minVectorLength; + GUI_OBJ *MolCenters; + GUI_OBJ *_centers; + GUI_OBJ *_centers_button; + GUI_OBJ *constraint_enhancement; + gboolean auto_C_ion; +/*4.6 Cell*/ + GUI_OBJ *Latticevalues; + GUI_OBJ *_latticeformat; + GUI_OBJ *_latticevalue; + gchar *_tmp_latticevalue; + GUI_OBJ *splitInto; + gboolean auto_C_lat; +/*4.7 restart*/ + GUI_OBJ *pickUpYN; + GUI_OBJ *pickUpGen; + GUI_OBJ *pickUpFolder; + gboolean restart_cleanup; +/*4.8 Ab initio*/ + gdouble _tmp_num_opt_steps;/*because gtk_spin type is double*/ + GUI_OBJ *_num_opt_steps;/*usually determined indirectly*/ + gdouble _tmp_curr_step;/*because gtk_spin type is double*/ + GUI_OBJ *_curr_step; + gboolean _tmp_isfixed; + GUI_OBJ *_isfixed; + GUI_OBJ *abinitioCode; + GUI_OBJ *KresolStart; + GUI_OBJ *vacuumSize; + gboolean auto_step; + gchar **_tmp_ai_input; + GUI_OBJ *ai_input; + GUI_OBJ *ai_input_button; + gchar **_tmp_ai_opt; + GUI_OBJ *ai_opt; + GUI_OBJ *ai_opt_button; + GUI_OBJ *ai_generate; + gchar *_tmp_ai_spe; + GUI_OBJ *ai_spe; + gchar **_potentials; + gchar *_tmp_ai_pot; + GUI_OBJ *ai_pot; + GUI_OBJ *ai_pot_button; + GUI_OBJ *numProcessors; + GUI_OBJ *numParallelCalcs; + gchar **_tmp_commandExecutable; + GUI_OBJ *commandExecutable; + GUI_OBJ *whichCluster; + GUI_OBJ *remoteFolder; + //PhaseDiagram is auto-sync +/*4.9 fingerprint*/ + GUI_OBJ *RmaxFing; + GUI_OBJ *deltaFing; + GUI_OBJ *sigmaFing; +/*4.10 Antiseed*/ + GUI_OBJ *antiSeedsActivation; + GUI_OBJ *antiSeedsMax; + GUI_OBJ *antiSeedsSigma; +/*4.11 spacegroup*/ + GUI_OBJ *doSpaceGroup; + GUI_OBJ *SymTolerance; +/*4.12 developers*/ + GUI_OBJ *repeatForStatistics; + GUI_OBJ *stopFitness; + GUI_OBJ *fixRndSeed; + //collectForces is auto-sync +/*4.13 seldom used*/ + //ordering_active is auto-sync + //symmetrize is auto-sync + GUI_OBJ *valenceElectr; + GUI_OBJ *percSliceShift; + GUI_OBJ *dynamicalBestHM; + GUI_OBJ *softMutOnly; + GUI_OBJ *maxDistHeredity; + GUI_OBJ *manyParents; + GUI_OBJ *minSlice; + GUI_OBJ *maxSlice; + GUI_OBJ *numberparents; +/*5.1 molecular: ADDITIONAL*/ + GUI_OBJ *mol_model; + GUI_OBJ *mol_model_button; + gdouble _tmp_num_mol; + GUI_OBJ *num_mol; + GUI_OBJ *mol_gdis; + gdouble _tmp_curr_mol; + GUI_OBJ *curr_mol; + gboolean mol_as_gulp; + GUI_OBJ *mol_gulp; + gint *_tmp_mols_gdis; + gboolean *_tmp_mols_gulp; + GUI_OBJ *mol_apply_button; +/*5.2 BoltzTraP*/ + gboolean have_ZT; + GUI_OBJ *BoltzTraP_T_max; + GUI_OBJ *BoltzTraP_T_delta; + GUI_OBJ *BoltzTraP_T_efcut; + GUI_OBJ *TE_T_interest; + GUI_OBJ *TE_threshold; + GUI_OBJ *TE_goal; + gchar *_tmp_cmd_BoltzTraP;/*optional, and unused (for now)*/ + GUI_OBJ *cmd_BoltzTraP;/*optional, and unused (for now)*/ + GUI_OBJ *cmd_BoltzTraP_button; +/*5.3 Surfaces*/ + GUI_OBJ *thicknessS; + GUI_OBJ *thicknessB; + GUI_OBJ *reconstruct; + GUI_OBJ *StoichiometryStart;/*almost undocumented*/ + GUI_OBJ *substrate_model;/*additional*/ + GUI_OBJ *substrate_model_button;/*additional*/ +/*5.4 Clusters*/ +/*5.5 variable composition*/ + GUI_OBJ *firstGeneMax; + GUI_OBJ *minAt; + GUI_OBJ *maxAt; + GUI_OBJ *fracTrans; + GUI_OBJ *howManyTrans; + GUI_OBJ *specificTrans; +/*5.6 metadynamics*/ + GUI_OBJ *ExternalPressure; + GUI_OBJ *GaussianWidth; + GUI_OBJ *GaussianHeight; + GUI_OBJ *FullRelax; + GUI_OBJ *maxVectorLength; + GUI_OBJ *meta_model;/*additional*/ + GUI_OBJ *meta_model_button;/*additional*/ +/*5.7 Particle swarn optimization*/ + GUI_OBJ *PSO_softMut; + GUI_OBJ *PSO_BestStruc; + GUI_OBJ *PSO_BestEver; +/*6.1 Variable-Cell Nudged Elastic Band */ + GUI_OBJ *vcnebType; + GUI_OBJ *_vcnebtype_method; + GUI_OBJ *_vcnebtype_img_num; + GUI_OBJ *_vcnebtype_spring; + GUI_OBJ *numImages; + GUI_OBJ *numSteps; + GUI_OBJ *optReadImages; + GUI_OBJ *optimizerType; + GUI_OBJ *optRelaxType; + GUI_OBJ *dt; + GUI_OBJ *ConvThreshold; + GUI_OBJ *VarPathLength; + GUI_OBJ *K_min; + GUI_OBJ *K_max; + GUI_OBJ *Kconstant; + GUI_OBJ *optFreezing; + GUI_OBJ *optMethodCIDI; + GUI_OBJ *startCIDIStep; + GUI_OBJ *pickupImages; + GUI_OBJ *FormatType; + GUI_OBJ *PrintStep; + GUI_OBJ *img_model;/*additional*/ + GUI_OBJ *img_model_button;/*additional*/ +/*6.2 Transition Path Sampling*/ + GUI_OBJ *numIterations; + GUI_OBJ *speciesSymbol; + GUI_OBJ *mass; + GUI_OBJ *amplitudeShoot_AB; + GUI_OBJ *amplitudeShoot_BA; + GUI_OBJ *magnitudeShoot_success; + GUI_OBJ *magnitudeShoot_failure; + GUI_OBJ *shiftRatio; + GUI_OBJ *orderParaType; + GUI_OBJ *opCriteria_start; + GUI_OBJ *opCriteria_end; + GUI_OBJ *cmdOrderParameter; + GUI_OBJ *cmdOrderParameter_button; + GUI_OBJ *cmdEnthalpyTemperature; + GUI_OBJ *cmdEnthalpyTemperature_button; + GUI_OBJ *orderParameterFile; + GUI_OBJ *orderParameterFile_button; + GUI_OBJ *enthalpyTemperatureFile; + GUI_OBJ *enthalpyTemperatureFile_button; + GUI_OBJ *trajectoryFile; + GUI_OBJ *trajectoryFile_button; + GUI_OBJ *MDrestartFile; + GUI_OBJ *MDrestartFile_button; +/* CALCUL */ + GUI_OBJ *job_uspex_exe; + GUI_OBJ *job_path; + gboolean have_result; + gboolean have_v1010; + gboolean have_octave; + gint index; +/*buttons*/ + GUI_OBJ *button_save; + GUI_OBJ *button_exec; +}; + +/*methods of interest*/ + +void uspex_gui_refresh(); diff --git a/src/gui_vasp.c b/src/gui_vasp.c index bb07a82..86f108e 100644 --- a/src/gui_vasp.c +++ b/src/gui_vasp.c @@ -48,9 +48,11 @@ The GNU GPL can also be found at http://www.gnu.org #include "dialog.h" #include "gui_shorts.h" #include "file_vasp.h" +#include "gui_defs.h" #include "gui_vasp.h" extern struct sysenv_pak sysenv; +extern struct elem_pak elements[]; /*globals variables*/ struct vasp_calc_gui vasp_gui; @@ -75,408 +77,539 @@ void gui_vasp_init(){ /*********************************************************/ /* Load calculation setting from an included vasprun.xml */ /*********************************************************/ -void load_vasprun_dialog(GtkButton *button, gpointer data){ - GtkWidget *file_chooser; - GtkFileFilter *filter; -/*set filter*/ - filter = gtk_file_filter_new(); - gtk_file_filter_add_pattern(filter, "*vasprun.xml"); - gtk_file_filter_set_name (filter,"vasprun.xml files"); - file_chooser = gtk_file_chooser_dialog_new("Select a vasprun.xml File",GTK_WINDOW(vasp_gui.window),GTK_FILE_CHOOSER_ACTION_OPEN,GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_OPEN,GTK_RESPONSE_ACCEPT,NULL); -gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(file_chooser),filter);/*apply filter*/ - if (gtk_dialog_run (GTK_DIALOG (file_chooser)) == GTK_RESPONSE_ACCEPT) - { - char *filename; - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser)); - if(filename) { - gtk_entry_set_text(GTK_ENTRY(vasp_gui.file_entry),g_strdup_printf("%s",filename)); - vasprun_update(filename,&vasp_gui.calc);/*<- update everything according to the new vasprun.xml*/ - g_free (filename); - vasp_gui_refresh();/*refresh GUI with new vasp_gui.calc*/ - } - } - gtk_widget_destroy (GTK_WIDGET(file_chooser)); +void load_vasprun_dialog(void){ + GUI_OBJ *file_chooser; + gint have_answer; + gchar *filename; + gchar *text; + /**/ + GUI_PREPARE_OPEN_DIALOG(vasp_gui.window,file_chooser,"Select a vasprun.xml File","*vasprun.xml","vasprun.xml files"); + GUI_OPEN_DIALOG_RUN(file_chooser,have_answer,filename); + if(have_answer){ + /*there should be no case where have_answer==TRUE AND filename==NULL, but just in case.*/ + if(filename) { + text=g_strdup_printf("%s",filename); + GUI_ENTRY_TEXT(vasp_gui.file_entry,text); + g_free(text); + vasprun_update(filename,&vasp_gui.calc);/*<- update everything according to the new vasprun.xml*/ + g_free (filename); + vasp_gui_refresh();/*refresh GUI with new vasp_gui.calc*/ + } + } + GUI_KILL_OPEN_DIALOG(file_chooser); } /**************************/ /* load mpirun executable */ /**************************/ -void load_mpirun_dialog(GtkButton *button, gpointer data){ - GtkWidget *file_chooser; - GtkFileFilter *filter; -/*set filter*/ - filter = gtk_file_filter_new(); - gtk_file_filter_add_pattern(filter, "mpirun"); - gtk_file_filter_set_name (filter,"mpirun exec"); - file_chooser = gtk_file_chooser_dialog_new("Select mpirun Executable",GTK_WINDOW(vasp_gui.window),GTK_FILE_CHOOSER_ACTION_OPEN,GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_OPEN,GTK_RESPONSE_ACCEPT,NULL); -gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(file_chooser),filter);/*apply filter*/ - if (gtk_dialog_run (GTK_DIALOG (file_chooser)) == GTK_RESPONSE_ACCEPT) - { - char *filename; - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser)); - if(filename) { - gtk_entry_set_text(GTK_ENTRY(vasp_gui.job_mpirun),g_strdup_printf("%s",filename)); - /* sync job_mpirun */ - VASP_REG_TEXT(job_mpirun); - g_free (filename); - } - } - gtk_widget_destroy (GTK_WIDGET(file_chooser)); +void load_mpirun_dialog(void){ + GUI_OBJ *file_chooser; + gint have_answer; + gchar *filename; + gchar *text; + /**/ + GUI_PREPARE_OPEN_DIALOG(vasp_gui.window,file_chooser,"Select mpirun Executable","mpirun","mpirun exec"); + GUI_OPEN_DIALOG_RUN(file_chooser,have_answer,filename); + if(have_answer){ + /*there should be no case where have_answer==TRUE AND filename==NULL, but just in case.*/ + if(filename) { + text=g_strdup_printf("%s",filename); + GUI_ENTRY_TEXT(vasp_gui.job_mpirun,text); + g_free(text); + VASP_REG_TEXT(job_mpirun); + g_free (filename); + } + } + GUI_KILL_OPEN_DIALOG(file_chooser); } /****************************/ /* load the vasp executable */ /****************************/ -void load_vasp_exe_dialog(GtkButton *button, gpointer data){ - GtkWidget *file_chooser; - file_chooser = gtk_file_chooser_dialog_new("Select VASP Executable",GTK_WINDOW(vasp_gui.window),GTK_FILE_CHOOSER_ACTION_OPEN,GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_OPEN,GTK_RESPONSE_ACCEPT,NULL); - if (gtk_dialog_run (GTK_DIALOG (file_chooser)) == GTK_RESPONSE_ACCEPT) - { - char *filename; - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser)); - if(filename) { - gtk_entry_set_text(GTK_ENTRY(vasp_gui.job_vasp_exe),g_strdup_printf("%s",filename)); - /*sync job_vasp_exe*/ - VASP_REG_TEXT(job_vasp_exe); - g_free (filename); - } - } - gtk_widget_destroy (GTK_WIDGET(file_chooser)); +void load_vasp_exe_dialog(void){ + GUI_OBJ *file_chooser; + gint have_answer; + gchar *filename; + gchar *text; + /**/ + GUI_PREPARE_OPEN_DIALOG(vasp_gui.window,file_chooser,"Select VASP Executable","vasp","vasp_exec"); + GUI_OPEN_DIALOG_RUN(file_chooser,have_answer,filename); + if(have_answer){ + /*there should be no case where have_answer==TRUE AND filename==NULL, but just in case.*/ + if(filename) { + text=g_strdup_printf("%s",filename); + GUI_ENTRY_TEXT(vasp_gui.job_vasp_exe,text); + g_free(text); + VASP_REG_TEXT(job_vasp_exe); + g_free (filename); + } + } + GUI_KILL_OPEN_DIALOG(file_chooser); } /*****************************************/ /* point to the path to run the VASP job */ /*****************************************/ -void load_path_dialog(GtkButton *button, gpointer data){ - GtkWidget *file_chooser; -file_chooser=gtk_file_chooser_dialog_new("Select working folder",GTK_WINDOW(vasp_gui.window),GTK_FILE_CHOOSER_ACTION_OPEN,GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_OPEN,GTK_RESPONSE_ACCEPT,NULL); - gtk_file_chooser_set_action (GTK_FILE_CHOOSER(file_chooser),GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); - if (gtk_dialog_run (GTK_DIALOG (file_chooser)) == GTK_RESPONSE_ACCEPT) - { - char *foldername = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser)); - if(foldername) { - gtk_entry_set_text(GTK_ENTRY(vasp_gui.job_path),g_strdup_printf("%s",foldername)); - /*sync job_path*/ - VASP_REG_TEXT(job_path); - g_free (foldername); - } - } - gtk_widget_destroy (GTK_WIDGET(file_chooser)); +void load_path_dialog(void){ + GUI_OBJ *file_chooser; + gint have_answer; + gchar *filename; + gchar *text; + /**/ + GUI_PREPARE_OPEN_FOLDER(vasp_gui.window,file_chooser,"Select working folder"); + GUI_OPEN_DIALOG_RUN(file_chooser,have_answer,filename); + if(have_answer){ + /*there should be no case where have_answer==TRUE AND filename==NULL, but just in case.*/ + if(filename) { + text=g_strdup_printf("%s",filename); + GUI_ENTRY_TEXT(vasp_gui.job_path,text); + g_free(text); + VASP_REG_TEXT(job_path); + g_free (filename); + } + } + GUI_KILL_OPEN_DIALOG(file_chooser); } /*********************************************/ /* refresh the GUI with value from vasp_gui.calc */ /*********************************************/ void vasp_gui_refresh(){ + gchar *text; /*do not refresh the simple interface, though*/ - switch(vasp_gui.calc.prec){ - case VP_SINGLE: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.prec),1);break; - case VP_ACCURATE: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.prec),2);break; - case VP_HIGH: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.prec),3);break; - case VP_MED: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.prec),4);break; - case VP_LOW: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.prec),5);break; - case VP_NORM: - default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.prec),0); - } + switch(vasp_gui.calc.prec){ + case VP_SINGLE: + GUI_COMBOBOX_SET(vasp_gui.prec,1);break; + case VP_ACCURATE: + GUI_COMBOBOX_SET(vasp_gui.prec,2);break; + case VP_HIGH: + GUI_COMBOBOX_SET(vasp_gui.prec,3);break; + case VP_MED: + GUI_COMBOBOX_SET(vasp_gui.prec,4);break; + case VP_LOW: + GUI_COMBOBOX_SET(vasp_gui.prec,5);break; + case VP_NORM: + default: + GUI_COMBOBOX_SET(vasp_gui.prec,0); + } //use_prec already sync - gtk_entry_set_text(GTK_ENTRY(vasp_gui.encut),g_strdup_printf("%.2lf",vasp_gui.calc.encut)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.enaug),g_strdup_printf("%.2lf",vasp_gui.calc.enaug)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ediff),g_strdup_printf("%.2lE",vasp_gui.calc.ediff)); + text=g_strdup_printf("%.2lf",vasp_gui.calc.encut); + GUI_ENTRY_TEXT(vasp_gui.encut,text); + g_free(text);text=g_strdup_printf("%.2lf",vasp_gui.calc.enaug); + GUI_ENTRY_TEXT(vasp_gui.enaug,text); + g_free(text);text=g_strdup_printf("%.2lE",vasp_gui.calc.ediff); + GUI_ENTRY_TEXT(vasp_gui.ediff,text); + g_free(text); switch(vasp_gui.calc.algo){ case VA_IALGO: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.algo),1); + GUI_COMBOBOX_SET(vasp_gui.algo,1); switch(vasp_gui.calc.ialgo){ case VIA_OE_FIXED: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),0);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,0);break; case VIA_O_FIXED: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),1);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,1);break; case VIA_SUBROT: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),2);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,2);break; case VIA_STEEP: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),3);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,3);break; case VIA_CG: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),4);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,4);break; case VIA_PSTEEP: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),5);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,5);break; case VIA_PCG: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),6);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,6);break; case VIA_ESTEEP: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),8);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,8);break; case VIA_RMMP: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),9);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,9);break; case VIA_PRMM: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),10);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,10);break; case VIA_VAR_DAMP: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),11);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,11);break; case VIA_VAR_QUENCH: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),12);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,12);break; case VIA_VAR_PCG: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),13);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,13);break; case VIA_EXACT: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),14);break; + GUI_COMBOBOX_SET(vasp_gui.ialgo,14);break; case VIA_KOSUGI: default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ialgo),7); + GUI_COMBOBOX_SET(vasp_gui.ialgo,7); } break; case VA_VERYFAST: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.algo),2);break; + GUI_COMBOBOX_SET(vasp_gui.algo,2);break; case VA_FAST: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.algo),3);break; + GUI_COMBOBOX_SET(vasp_gui.algo,3);break; case VA_CONJ: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.algo),4);break; + GUI_COMBOBOX_SET(vasp_gui.algo,4);break; case VA_ALL: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.algo),5);break; + GUI_COMBOBOX_SET(vasp_gui.algo,5);break; case VA_DAMPED: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.algo),6);break; + GUI_COMBOBOX_SET(vasp_gui.algo,6);break; case VA_SUBROT: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.algo),7);break; + GUI_COMBOBOX_SET(vasp_gui.algo,7);break; case VA_EIGEN: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.algo),8);break; + GUI_COMBOBOX_SET(vasp_gui.algo,8);break; case VA_NONE: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.algo),9);break; + GUI_COMBOBOX_SET(vasp_gui.algo,9);break; case VA_NOTHING: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.algo),10);break; + GUI_COMBOBOX_SET(vasp_gui.algo,10);break; case VA_EXACT: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.algo),11);break; + GUI_COMBOBOX_SET(vasp_gui.algo,11);break; case VA_DIAG: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.algo),12);break; + GUI_COMBOBOX_SET(vasp_gui.algo,12);break; case VA_NORM: default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.algo),0);break; + GUI_COMBOBOX_SET(vasp_gui.algo,0); } //ldiag already sync - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nsim),g_strdup_printf("%i",vasp_gui.calc.nsim)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.vtime),g_strdup_printf("%.4lf",vasp_gui.calc.vtime)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.iwavpr),g_strdup_printf("%i",vasp_gui.calc.iwavpr)); + text=g_strdup_printf("%i",vasp_gui.calc.nsim); + GUI_ENTRY_TEXT(vasp_gui.nsim,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.vtime); + GUI_ENTRY_TEXT(vasp_gui.vtime,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.iwavpr); + GUI_ENTRY_TEXT(vasp_gui.iwavpr,text); + g_free(text); //auto already sync - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nbands),g_strdup_printf("%i",vasp_gui.calc.nbands)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nelect),g_strdup_printf("%.4lf",vasp_gui.calc.nelect)); + text=g_strdup_printf("%i",vasp_gui.calc.nbands); + GUI_ENTRY_TEXT(vasp_gui.nbands,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.nelect); + GUI_ENTRY_TEXT(vasp_gui.nelect,text); + g_free(text); //iniwav already sync - gtk_entry_set_text(GTK_ENTRY(vasp_gui.istart),g_strdup_printf("%i",vasp_gui.calc.istart)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.icharg),g_strdup_printf("%i",vasp_gui.calc.icharg)); - /*mixer*/ - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nelm),g_strdup_printf("%i",vasp_gui.calc.nelm)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nelmdl),g_strdup_printf("%i",vasp_gui.calc.nelmdl)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nelmin),g_strdup_printf("%i",vasp_gui.calc.nelmin)); + text=g_strdup_printf("%i",vasp_gui.calc.istart); + GUI_ENTRY_TEXT(vasp_gui.istart,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.icharg); + GUI_ENTRY_TEXT(vasp_gui.icharg,text); + g_free(text); + //mixer + text=g_strdup_printf("%i",vasp_gui.calc.nelm); + GUI_ENTRY_TEXT(vasp_gui.nelm,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.nelmdl); + GUI_ENTRY_TEXT(vasp_gui.nelmdl,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.nelmin); + GUI_ENTRY_TEXT(vasp_gui.nelmin,text); + g_free(text); if(!vasp_gui.calc.auto_mixer){ switch(vasp_gui.calc.imix){ case VM_0: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.mixer),0);break; + GUI_COMBOBOX_SET(vasp_gui.mixer,0);break; case VM_1: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.mixer),1);break; + GUI_COMBOBOX_SET(vasp_gui.mixer,1);break; case VM_2: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.mixer),2);break; + GUI_COMBOBOX_SET(vasp_gui.mixer,2);break; case VM_4: default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.mixer),3); + GUI_COMBOBOX_SET(vasp_gui.mixer,3); } switch(vasp_gui.calc.inimix){ case VIM_0: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.inimix),0);break; + GUI_COMBOBOX_SET(vasp_gui.inimix,0);break; case VIM_1: default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.inimix),1); + GUI_COMBOBOX_SET(vasp_gui.inimix,1); } switch(vasp_gui.calc.mixpre){ case VMP_0: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.mixpre),0);break; + GUI_COMBOBOX_SET(vasp_gui.mixpre,0);break; case VMP_2: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.mixpre),2);break; + GUI_COMBOBOX_SET(vasp_gui.mixpre,2);break; case VMP_1: default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.mixpre),1); + GUI_COMBOBOX_SET(vasp_gui.mixpre,1); } - } + } switch(vasp_gui.calc.lreal){ case VLR_AUTO: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.lreal),0);break; + GUI_COMBOBOX_SET(vasp_gui.lreal,0);break; case VLR_ON: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.lreal),1);break; + GUI_COMBOBOX_SET(vasp_gui.lreal,1);break; case VLR_TRUE: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.lreal),2);break; + GUI_COMBOBOX_SET(vasp_gui.lreal,2);break; case VLR_FALSE: default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.lreal),3);break; + GUI_COMBOBOX_SET(vasp_gui.lreal,3); + } + if(vasp_gui.calc.ropt!=NULL){ + text=g_strdup_printf("%s",vasp_gui.calc.ropt); + GUI_ENTRY_TEXT(vasp_gui.ropt,text); + g_free(text); } - if(vasp_gui.calc.ropt!=NULL) gtk_entry_set_text(GTK_ENTRY(vasp_gui.ropt),g_strdup_printf("%s",vasp_gui.calc.ropt)); //addgrid already sync - gtk_entry_set_text(GTK_ENTRY(vasp_gui.lmaxmix),g_strdup_printf("%i",vasp_gui.calc.lmaxmix)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.lmaxpaw),g_strdup_printf("%i",vasp_gui.calc.lmaxpaw)); + text=g_strdup_printf("%i",vasp_gui.calc.lmaxmix); + GUI_ENTRY_TEXT(vasp_gui.lmaxmix,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.lmaxpaw); + GUI_ENTRY_TEXT(vasp_gui.lmaxpaw,text); + g_free(text); if(!vasp_gui.calc.auto_grid){ - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ngx),g_strdup_printf("%i",vasp_gui.calc.ngx)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ngy),g_strdup_printf("%i",vasp_gui.calc.ngy)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ngz),g_strdup_printf("%i",vasp_gui.calc.ngz)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ngxf),g_strdup_printf("%i",vasp_gui.calc.ngxf)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ngyf),g_strdup_printf("%i",vasp_gui.calc.ngyf)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ngzf),g_strdup_printf("%i",vasp_gui.calc.ngzf)); - } - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ismear),g_strdup_printf("%i",vasp_gui.calc.ismear)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.sigma),g_strdup_printf("%.4lf",vasp_gui.calc.sigma)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.kgamma),vasp_gui.calc.kgamma); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kspacing),g_strdup_printf("%.4lf",vasp_gui.calc.kspacing)); - if(vasp_gui.calc.fermwe!=NULL) gtk_entry_set_text(GTK_ENTRY(vasp_gui.fermwe),g_strdup_printf("%s",vasp_gui.calc.fermwe)); - if(vasp_gui.calc.fermdo!=NULL) gtk_entry_set_text(GTK_ENTRY(vasp_gui.fermdo),g_strdup_printf("%s",vasp_gui.calc.fermdo)); + text=g_strdup_printf("%i",vasp_gui.calc.ngx); + GUI_ENTRY_TEXT(vasp_gui.ngx,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.ngy); + GUI_ENTRY_TEXT(vasp_gui.ngy,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.ngz); + GUI_ENTRY_TEXT(vasp_gui.ngz,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.ngxf); + GUI_ENTRY_TEXT(vasp_gui.ngxf,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.ngyf); + GUI_ENTRY_TEXT(vasp_gui.ngyf,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.ngzf); + GUI_ENTRY_TEXT(vasp_gui.ngzf,text); + g_free(text); + } + text=g_strdup_printf("%i",vasp_gui.calc.ismear); + GUI_ENTRY_TEXT(vasp_gui.ismear,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.sigma); + GUI_ENTRY_TEXT(vasp_gui.sigma,text); + g_free(text); + if(vasp_gui.calc.kgamma) GUI_TOGGLE_ON(vasp_gui.kgamma); + else GUI_TOGGLE_OFF(vasp_gui.kgamma); + text=g_strdup_printf("%.4lf",vasp_gui.calc.kspacing); + GUI_ENTRY_TEXT(vasp_gui.kspacing,text); + g_free(text); + if(vasp_gui.calc.fermwe!=NULL) { + text=g_strdup_printf("%s",vasp_gui.calc.fermwe); + GUI_ENTRY_TEXT(vasp_gui.fermwe,text); + g_free(text); + } + if(vasp_gui.calc.fermdo!=NULL) { + text=g_strdup_printf("%s",vasp_gui.calc.fermdo); + GUI_ENTRY_TEXT(vasp_gui.fermdo,text); + g_free(text); + } //ispin already sync //non_collinear already sync //lsorbit already sync //gga_compat already sync - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nupdown),g_strdup_printf("%.1lf",vasp_gui.calc.nupdown)); - if(vasp_gui.calc.magmom!=NULL) gtk_entry_set_text(GTK_ENTRY(vasp_gui.magmom),g_strdup_printf("%s",vasp_gui.calc.magmom)); - if(vasp_gui.calc.saxis!=NULL) gtk_entry_set_text(GTK_ENTRY(vasp_gui.saxis),g_strdup_printf("%s",vasp_gui.calc.saxis)); + text=g_strdup_printf("%.1lf",vasp_gui.calc.nupdown); + GUI_ENTRY_TEXT(vasp_gui.nupdown,text); + g_free(text); + if(vasp_gui.calc.magmom!=NULL) { + text=g_strdup_printf("%s",vasp_gui.calc.magmom); + GUI_ENTRY_TEXT(vasp_gui.magmom,text); + g_free(text); + } + if(vasp_gui.calc.saxis!=NULL) { + text=g_strdup_printf("%s",vasp_gui.calc.saxis); + GUI_ENTRY_TEXT(vasp_gui.saxis,text); + g_free(text); + } switch(vasp_gui.calc.gga){ case VG_91: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.gga),0);break; + GUI_COMBOBOX_SET(vasp_gui.gga,0);break; case VG_RP: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.gga),2);break; + GUI_COMBOBOX_SET(vasp_gui.gga,2);break; case VG_AM: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.gga),3);break; + GUI_COMBOBOX_SET(vasp_gui.gga,3);break; case VG_PS: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.gga),4);break; + GUI_COMBOBOX_SET(vasp_gui.gga,4);break; case VG_PE: default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.gga),1); + GUI_COMBOBOX_SET(vasp_gui.gga,1); } //voskown already sync switch (vasp_gui.calc.mgga){ case VMG_TPSS: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.metagga),0);break; + GUI_COMBOBOX_SET(vasp_gui.metagga,0);break; case VMG_RTPSS: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.metagga),1);break; + GUI_COMBOBOX_SET(vasp_gui.metagga,1);break; case VMG_M06L: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.metagga),2);break; + GUI_COMBOBOX_SET(vasp_gui.metagga,2);break; case VMG_MBJ: default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.metagga),3); + GUI_COMBOBOX_SET(vasp_gui.metagga,3); } //lmetagga already sync //lasph already sync //lmixtau already sync - gtk_entry_set_text(GTK_ENTRY(vasp_gui.lmaxtau),g_strdup_printf("%i",vasp_gui.calc.lmaxtau)); - if(vasp_gui.calc.cmbj!=NULL) gtk_entry_set_text(GTK_ENTRY(vasp_gui.cmbj),g_strdup_printf("%s",vasp_gui.calc.cmbj)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.cmbja),g_strdup_printf("%.4lf",vasp_gui.calc.cmbja)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.cmbjb),g_strdup_printf("%.4lf",vasp_gui.calc.cmbjb)); + text=g_strdup_printf("%i",vasp_gui.calc.lmaxtau); + GUI_ENTRY_TEXT(vasp_gui.lmaxtau,text); + g_free(text); + if(vasp_gui.calc.cmbj!=NULL) { + text=g_strdup_printf("%s",vasp_gui.calc.cmbj); + GUI_ENTRY_TEXT(vasp_gui.cmbj,text); + g_free(text); + } + text=g_strdup_printf("%.4lf",vasp_gui.calc.cmbja); + GUI_ENTRY_TEXT(vasp_gui.cmbja,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.cmbjb); + GUI_ENTRY_TEXT(vasp_gui.cmbjb,text); + g_free(text); if(vasp_gui.calc.ldau){ switch(vasp_gui.calc.ldau_type){ case VU_1: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ldau),0);break; + GUI_COMBOBOX_SET(vasp_gui.ldau,0);break; case VU_4: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ldau),2);break; + GUI_COMBOBOX_SET(vasp_gui.ldau,2);break; case VU_2: default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ldau),1); + GUI_COMBOBOX_SET(vasp_gui.ldau,1); } switch(vasp_gui.calc.ldau_output){ case VUO_1: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ldau_print),1);break; + GUI_COMBOBOX_SET(vasp_gui.ldau_print,1);break; case VUO_2: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ldau_print),2);break; + GUI_COMBOBOX_SET(vasp_gui.ldau_print,2);break; case VUO_0: default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ldau_print),0); + GUI_COMBOBOX_SET(vasp_gui.ldau_print,0); + } + if(vasp_gui.calc.ldaul!=NULL) { + text=g_strdup_printf("%s",vasp_gui.calc.ldaul); + GUI_ENTRY_TEXT(vasp_gui.ldaul,text); + g_free(text); + } + if(vasp_gui.calc.ldauu!=NULL) { + text=g_strdup_printf("%s",vasp_gui.calc.ldauu); + GUI_ENTRY_TEXT(vasp_gui.ldauu,text); + g_free(text); + } + if(vasp_gui.calc.ldauj!=NULL) { + text=g_strdup_printf("%s",vasp_gui.calc.ldauj); + GUI_ENTRY_TEXT(vasp_gui.ldauj,text); + g_free(text); } - if(vasp_gui.calc.ldaul!=NULL) gtk_entry_set_text(GTK_ENTRY(vasp_gui.ldaul),g_strdup_printf("%s",vasp_gui.calc.ldaul)); - if(vasp_gui.calc.ldauu!=NULL) gtk_entry_set_text(GTK_ENTRY(vasp_gui.ldauu),g_strdup_printf("%s",vasp_gui.calc.ldauu)); - if(vasp_gui.calc.ldauj!=NULL) gtk_entry_set_text(GTK_ENTRY(vasp_gui.ldauj),g_strdup_printf("%s",vasp_gui.calc.ldauj)); } switch(vasp_gui.calc.idipol){ case VID_1: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.idipol),1);break; + GUI_COMBOBOX_SET(vasp_gui.idipol,1);break; case VID_2: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.idipol),2);break; + GUI_COMBOBOX_SET(vasp_gui.idipol,2);break; case VID_3: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.idipol),3);break; + GUI_COMBOBOX_SET(vasp_gui.idipol,3);break; case VID_4: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.idipol),4);break; + GUI_COMBOBOX_SET(vasp_gui.idipol,4);break; case VID_0: default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.idipol),0); + GUI_COMBOBOX_SET(vasp_gui.idipol,0); } - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.ldipol),vasp_gui.calc.ldipol); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.lmono),vasp_gui.calc.lmono); - if(vasp_gui.calc.dipol!=NULL) gtk_entry_set_text(GTK_ENTRY(vasp_gui.dipol),g_strdup_printf("%s",vasp_gui.calc.dipol)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.epsilon),g_strdup_printf("%.4lf",vasp_gui.calc.epsilon)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.efield),g_strdup_printf("%.4lf",vasp_gui.calc.efield)); + if(vasp_gui.calc.ldipol) GUI_TOGGLE_ON(vasp_gui.ldipol); + else GUI_TOGGLE_OFF(vasp_gui.ldipol); + if(vasp_gui.calc.lmono) GUI_TOGGLE_ON(vasp_gui.lmono); + else GUI_TOGGLE_OFF(vasp_gui.lmono); + if(vasp_gui.calc.dipol!=NULL) { + text=g_strdup_printf("%s",vasp_gui.calc.dipol); + GUI_ENTRY_TEXT(vasp_gui.dipol,text); + g_free(text); + } + text=g_strdup_printf("%.4lf",vasp_gui.calc.epsilon); + GUI_ENTRY_TEXT(vasp_gui.epsilon,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.efield); + GUI_ENTRY_TEXT(vasp_gui.efield,text); + g_free(text); switch(vasp_gui.calc.lorbit){ case 1: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.lorbit),1);break; + GUI_COMBOBOX_SET(vasp_gui.lorbit,1);break; case 2: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.lorbit),2);break; + GUI_COMBOBOX_SET(vasp_gui.lorbit,2);break; case 5: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.lorbit),3);break; + GUI_COMBOBOX_SET(vasp_gui.lorbit,3);break; case 10: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.lorbit),4);break; + GUI_COMBOBOX_SET(vasp_gui.lorbit,4);break; case 11: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.lorbit),5);break; + GUI_COMBOBOX_SET(vasp_gui.lorbit,5);break; case 12: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.lorbit),6);break; + GUI_COMBOBOX_SET(vasp_gui.lorbit,6);break; case 0: default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.lorbit),0); - } - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nedos),g_strdup_printf("%i",vasp_gui.calc.nedos)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.emin),g_strdup_printf("%.2lf",vasp_gui.calc.emin)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.emax),g_strdup_printf("%.2lf",vasp_gui.calc.emax)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.efermi),g_strdup_printf("%.2lf",vasp_gui.calc.efermi)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.have_paw),vasp_gui.calc.have_paw); - if(vasp_gui.calc.rwigs!=NULL) gtk_entry_set_text(GTK_ENTRY(vasp_gui.rwigs),g_strdup_printf("%s",vasp_gui.calc.rwigs)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.loptics),vasp_gui.calc.loptics); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.lepsilon),vasp_gui.calc.lepsilon); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.lrpa),vasp_gui.calc.lrpa); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.lnabla),vasp_gui.calc.lnabla); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.cshift),g_strdup_printf("%.2lf",vasp_gui.calc.cshift)); + GUI_COMBOBOX_SET(vasp_gui.lorbit,0); + } + text=g_strdup_printf("%i",vasp_gui.calc.nedos); + GUI_ENTRY_TEXT(vasp_gui.nedos,text); + g_free(text);text=g_strdup_printf("%.2lf",vasp_gui.calc.emin); + GUI_ENTRY_TEXT(vasp_gui.emin,text); + g_free(text);text=g_strdup_printf("%.2lf",vasp_gui.calc.emax); + GUI_ENTRY_TEXT(vasp_gui.emax,text); + g_free(text);text=g_strdup_printf("%.2lf",vasp_gui.calc.efermi); + GUI_ENTRY_TEXT(vasp_gui.efermi,text); + g_free(text); + if(vasp_gui.calc.have_paw) GUI_TOGGLE_ON(vasp_gui.have_paw); + else GUI_TOGGLE_OFF(vasp_gui.have_paw); + if(vasp_gui.calc.rwigs!=NULL) { + text=g_strdup_printf("%s",vasp_gui.calc.rwigs); + GUI_ENTRY_TEXT(vasp_gui.rwigs,text); + g_free(text); + } + if(vasp_gui.calc.loptics) GUI_TOGGLE_ON(vasp_gui.loptics); + else GUI_TOGGLE_OFF(vasp_gui.loptics); + if(vasp_gui.calc.lepsilon) GUI_TOGGLE_ON(vasp_gui.lepsilon); + else GUI_TOGGLE_OFF(vasp_gui.lepsilon); + if(vasp_gui.calc.lrpa) GUI_TOGGLE_ON(vasp_gui.lrpa); + else GUI_TOGGLE_OFF(vasp_gui.lrpa); + if(vasp_gui.calc.lnabla) GUI_TOGGLE_ON(vasp_gui.lnabla); + else GUI_TOGGLE_OFF(vasp_gui.lnabla); + text=g_strdup_printf("%.2lf",vasp_gui.calc.cshift); + GUI_ENTRY_TEXT(vasp_gui.cshift,text); + g_free(text); switch(vasp_gui.calc.ibrion){ case 0: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ibrion),1);break; + GUI_COMBOBOX_SET(vasp_gui.ibrion,1);break; case 1: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ibrion),2);break; + GUI_COMBOBOX_SET(vasp_gui.ibrion,2);break; case 2: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ibrion),3);break; + GUI_COMBOBOX_SET(vasp_gui.ibrion,3);break; case 3: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ibrion),4);break; + GUI_COMBOBOX_SET(vasp_gui.ibrion,4);break; case 5: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ibrion),5);break; + GUI_COMBOBOX_SET(vasp_gui.ibrion,5);break; case 6: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ibrion),6);break; + GUI_COMBOBOX_SET(vasp_gui.ibrion,6);break; case 7: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ibrion),7);break; + GUI_COMBOBOX_SET(vasp_gui.ibrion,7);break; case 8: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ibrion),8);break; + GUI_COMBOBOX_SET(vasp_gui.ibrion,8);break; case 44: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ibrion),9);break; + GUI_COMBOBOX_SET(vasp_gui.ibrion,9);break; case -1: default: - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ibrion),0);break; + GUI_COMBOBOX_SET(vasp_gui.ibrion,0); } - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.isif),vasp_gui.calc.isif); + GUI_COMBOBOX_SET(vasp_gui.isif,vasp_gui.calc.isif); //relax_ions already sync //relax_shape already sync //relax_volume already sync - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nsw),g_strdup_printf("%i",vasp_gui.calc.nsw)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ediffg),g_strdup_printf("%.2lE",vasp_gui.calc.ediffg)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.potim),g_strdup_printf("%.4lf",vasp_gui.calc.potim)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.pstress),g_strdup_printf("%.4lf",vasp_gui.calc.pstress)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nfree),g_strdup_printf("%i",vasp_gui.calc.nfree)); + text=g_strdup_printf("%i",vasp_gui.calc.nsw); + GUI_ENTRY_TEXT(vasp_gui.nsw,text); + g_free(text);text=g_strdup_printf("%.2lE",vasp_gui.calc.ediffg); + GUI_ENTRY_TEXT(vasp_gui.ediffg,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.potim); + GUI_ENTRY_TEXT(vasp_gui.potim,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.pstress); + GUI_ENTRY_TEXT(vasp_gui.pstress,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.nfree); + GUI_ENTRY_TEXT(vasp_gui.nfree,text); + g_free(text); if(vasp_gui.calc.ibrion==0){ - gtk_entry_set_text(GTK_ENTRY(vasp_gui.tebeg),g_strdup_printf("%.1lf",vasp_gui.calc.tebeg)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.teend),g_strdup_printf("%.1lf",vasp_gui.calc.teend)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.smass),g_strdup_printf("%.1lf",vasp_gui.calc.smass)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nblock),g_strdup_printf("%i",vasp_gui.calc.nblock)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kblock),g_strdup_printf("%i",vasp_gui.calc.kblock)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.npaco),g_strdup_printf("%i",vasp_gui.calc.npaco)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.apaco),g_strdup_printf("%.4lf",vasp_gui.calc.apaco)); + text=g_strdup_printf("%.1lf",vasp_gui.calc.tebeg); + GUI_ENTRY_TEXT(vasp_gui.tebeg,text); + g_free(text);text=g_strdup_printf("%.1lf",vasp_gui.calc.teend); + GUI_ENTRY_TEXT(vasp_gui.teend,text); + g_free(text);text=g_strdup_printf("%.1lf",vasp_gui.calc.smass); + GUI_ENTRY_TEXT(vasp_gui.smass,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.nblock); + GUI_ENTRY_TEXT(vasp_gui.nblock,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.kblock); + GUI_ENTRY_TEXT(vasp_gui.kblock,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.npaco); + GUI_ENTRY_TEXT(vasp_gui.npaco,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.apaco); + GUI_ENTRY_TEXT(vasp_gui.apaco,text); + g_free(text); } /*POSCAR*/ - gtk_entry_set_text(GTK_ENTRY(vasp_gui.poscar_species),g_strdup_printf("%s",vasp_gui.calc.species_symbols)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.simple_poscar),g_strdup_printf("%s",vasp_gui.calc.species_symbols)); + text=g_strdup_printf("%s",vasp_gui.calc.species_symbols); + GUI_ENTRY_TEXT(vasp_gui.poscar_species,text); + g_free(text);text=g_strdup_printf("%s",vasp_gui.calc.species_symbols); + GUI_ENTRY_TEXT(vasp_gui.simple_poscar,text); + g_free(text); /*KPOINTS*/ - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ismear_3),g_strdup_printf("%i",vasp_gui.calc.ismear)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.kgamma_3),vasp_gui.calc.kgamma); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kspacing_3),g_strdup_printf("%.4lf",vasp_gui.calc.kspacing)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_nkpts),g_strdup_printf("%i",vasp_gui.calc.kpoints_nkpts)); - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.kpoints_mode),vasp_gui.calc.kpoints_mode); + text=g_strdup_printf("%i",vasp_gui.calc.ismear); + GUI_ENTRY_TEXT(vasp_gui.ismear_3,text); + g_free(text); + if(vasp_gui.calc.kgamma) GUI_TOGGLE_ON(vasp_gui.kgamma_3); + else GUI_TOGGLE_OFF(vasp_gui.kgamma_3); + text=g_strdup_printf("%.4lf",vasp_gui.calc.kspacing); + GUI_ENTRY_TEXT(vasp_gui.kspacing_3,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.kpoints_nkpts); + GUI_ENTRY_TEXT(vasp_gui.kpoints_nkpts,text); + g_free(text); + GUI_COMBOBOX_SET(vasp_gui.kpoints_mode,vasp_gui.calc.kpoints_mode); switch(vasp_gui.calc.kpoints_mode){ case VKP_MAN: /*we do not update the kpoint list (here)*/ @@ -485,57 +618,61 @@ void vasp_gui_refresh(){ /*we do not update the kpoint list (here)*/ break; case VKP_GAMMA: - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.kpoints_kx),vasp_gui.calc.kpoints_kx); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.kpoints_ky),vasp_gui.calc.kpoints_ky); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.kpoints_kz),vasp_gui.calc.kpoints_kz); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_sx),g_strdup_printf("%.4lf",vasp_gui.calc.kpoints_sx)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_sy),g_strdup_printf("%.4lf",vasp_gui.calc.kpoints_sy)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_sz),g_strdup_printf("%.4lf",vasp_gui.calc.kpoints_sz)); + GUI_SPIN_SET(vasp_gui.kpoints_kx,vasp_gui.calc.kpoints_kx); + GUI_SPIN_SET(vasp_gui.kpoints_ky,vasp_gui.calc.kpoints_ky); + GUI_SPIN_SET(vasp_gui.kpoints_kz,vasp_gui.calc.kpoints_kz); + text=g_strdup_printf("%.4lf",vasp_gui.calc.kpoints_sx); + GUI_ENTRY_TEXT(vasp_gui.kpoints_sx,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.kpoints_sy); + GUI_ENTRY_TEXT(vasp_gui.kpoints_sy,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.kpoints_sz); + GUI_ENTRY_TEXT(vasp_gui.kpoints_sz,text); + g_free(text); break; case VKP_MP: - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.kpoints_kx),vasp_gui.calc.kpoints_kx); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.kpoints_ky),vasp_gui.calc.kpoints_ky); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.kpoints_kz),vasp_gui.calc.kpoints_kz); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_sx),g_strdup_printf("%.4lf",vasp_gui.calc.kpoints_sx)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_sy),g_strdup_printf("%.4lf",vasp_gui.calc.kpoints_sy)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_sz),g_strdup_printf("%.4lf",vasp_gui.calc.kpoints_sz)); + GUI_SPIN_SET(vasp_gui.kpoints_kx,vasp_gui.calc.kpoints_kx); + GUI_SPIN_SET(vasp_gui.kpoints_ky,vasp_gui.calc.kpoints_ky); + GUI_SPIN_SET(vasp_gui.kpoints_kz,vasp_gui.calc.kpoints_kz); + text=g_strdup_printf("%.4lf",vasp_gui.calc.kpoints_sx); + GUI_ENTRY_TEXT(vasp_gui.kpoints_sx,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.kpoints_sy); + GUI_ENTRY_TEXT(vasp_gui.kpoints_sy,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.kpoints_sz); + GUI_ENTRY_TEXT(vasp_gui.kpoints_sz,text); + g_free(text); break; case VKP_BASIS: /*we do not update the basis definition list (here)*/ break; case VKP_AUTO: default: - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.kpoints_kx),vasp_gui.calc.kpoints_kx); + GUI_SPIN_SET(vasp_gui.kpoints_kx,vasp_gui.calc.kpoints_kx); } /*skip POTCAR*/ /*skip EXEC*/ - -/* - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ismear),g_strdup_printf("%i",vasp_gui.calc.ismear)); - gtk_combo_box_set_active(GTK_COMBO_BOX(combobox),default_value); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.have_tetra),TRUE); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.ncore),1.0); -*/ - } /************************************************************/ /* Preload with default parameter from the simple interface */ /************************************************************/ -void vasp_apply_simple(GtkButton *button, gpointer data){ +void vasp_apply_simple(void){ /*simple interface*/ -#define _OUT(a) gtk_text_buffer_insert_at_cursor(vasp_gui.simple_message_buff,a,-1) - gint calcul=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.simple_calcul)); - gint system=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.simple_system)); - gint kgrid=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.simple_kgrid)); + gint calcul; + gint system; + gint kgrid; gint dim=(gint)vasp_gui.dimension; - gtk_text_buffer_set_text(vasp_gui.simple_message_buff,"Simple interface started.\n",-1); + gchar *text; + /**/ + GUI_COMBOBOX_GET(vasp_gui.simple_calcul,calcul); + GUI_COMBOBOX_GET(vasp_gui.simple_system,system); + GUI_COMBOBOX_GET(vasp_gui.simple_kgrid,kgrid); + GUI_TEXTVIEW_SET(vasp_gui.simple_message_buff,"Simple interface started.\n"); /*1st take care of the obvious*/ if((vasp_gui.simple_rgeom)&&(calcul<3)){ - _OUT("FAIL: ROUGHT GEOMETRY: OPTIMIZE GEOMETRY FIRST!\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"FAIL: ROUGHT GEOMETRY: OPTIMIZE GEOMETRY FIRST!\n"); return; } if(dim==0){ - _OUT("ATOM/MOLECULE in a box, setting only gamma point\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"ATOM/MOLECULE in a box, setting only gamma point\n"); vasp_gui.calc.kpoints_mode=VKP_GAMMA; vasp_gui.calc.kpoints_kx=1.; vasp_gui.calc.kpoints_ky=1.; @@ -543,71 +680,72 @@ void vasp_apply_simple(GtkButton *button, gpointer data){ }else{ vasp_gui.calc.kpoints_mode=VKP_AUTO; vasp_gui.calc.kpoints_kx = (gdouble)(dim+dim*(1+2*(2*kgrid+1)));/*not a serious formula*/ - gtk_text_buffer_insert_at_cursor(vasp_gui.simple_message_buff, - g_strdup_printf("SET AUTO gamma-centered grid w/ AUTO = %i\n",(gint)vasp_gui.calc.kpoints_kx),-1); + text=g_strdup_printf("SET AUTO gamma-centered grid w/ AUTO = %i\n",(gint)vasp_gui.calc.kpoints_kx); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,text); + g_free(text); } if(calcul<3){ vasp_gui.calc.prec=VP_ACCURATE; - _OUT("SET PREC=ACCURATE\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET PREC=ACCURATE\n"); vasp_gui.calc.algo=VA_NORM; - _OUT("SET ALGO=NORMAL\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET ALGO=NORMAL\n"); vasp_gui.calc.ldiag=TRUE; - _OUT("SET LDIAG=.TRUE.\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET LDIAG=.TRUE.\n"); } vasp_gui.calc.use_prec=TRUE; /*set LREAL*/ if(vasp_gui.calc.atoms_total>16) { vasp_gui.calc.lreal=VLR_AUTO; - _OUT("SET LREAL=Auto\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET LREAL=Auto\n"); } else { vasp_gui.calc.lreal=VLR_FALSE; - _OUT("SET LREAL=.FALSE.\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET LREAL=.FALSE.\n"); } /*set smearing*/ if(system>0) { vasp_gui.calc.ismear=0; - _OUT("SET ISMEAR=0\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET ISMEAR=0\n"); vasp_gui.calc.sigma=0.05; - _OUT("SET SIGMA=0.05\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET SIGMA=0.05\n"); } else { vasp_gui.calc.ismear=1; - _OUT("SET ISMEAR=1\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET ISMEAR=1\n"); vasp_gui.calc.sigma=0.2; - _OUT("SET SIGMA=0.2\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET SIGMA=0.2\n"); } /*set dipol correction*/ - _OUT("Please manually SET all dipole related settings in ELECT-I!\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"Please manually SET all dipole related settings in ELECT-I!\n"); switch(dim){ case 0://atom in a box vasp_gui.calc.idipol=VID_4; - _OUT("SET IDIPOL=4\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET IDIPOL=4\n"); break; case 1: //linear system is characterized by a major axis vasp_gui.calc.idipol=VID_3; - _OUT("SET IDIPOL=3\n"); - _OUT("By convention, the major direction for a 1D material is the Z axis.\n"); - _OUT("If this is not the case, RESET IDIPOL accordingly!\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET IDIPOL=3\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"By convention, the major direction for a 1D material is the Z axis.\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"If this is not the case, RESET IDIPOL accordingly!\n"); break; case 2: //surface are characterized by a normal axis vasp_gui.calc.idipol=VID_3; - _OUT("SET IDIPOL=3\n"); - _OUT("By convention, the Z AXIS is normal to the surface of 2D material.\n"); - _OUT("If this is not the case, RESET IDIPOL accordingly!\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET IDIPOL=3\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"By convention, the Z AXIS is normal to the surface of 2D material.\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"If this is not the case, RESET IDIPOL accordingly!\n"); break; case 3: default: vasp_gui.calc.ldipol=FALSE; - _OUT("SET LDIPOL=.FALSE.\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET LDIPOL=.FALSE.\n"); } /* spin? */ if((gint)(vasp_gui.calc.electron_total/2)-(gdouble)(vasp_gui.calc.electron_total/2.0)!=0.0){ vasp_gui.calc.ispin=TRUE; - _OUT("SET ISPIN=2\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET ISPIN=2\n"); }else{ vasp_gui.calc.ispin=FALSE; - _OUT("SET ISPIN=1\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET ISPIN=1\n"); } /*set calculation specific*/ switch(calcul){ @@ -615,149 +753,150 @@ void vasp_apply_simple(GtkButton *button, gpointer data){ /*use ismear=-5 if we have enough kpoints (ie more than 3)*/ if((kgrid>1)&&(dim>0)) { vasp_gui.calc.ismear=-5; - _OUT("SET ISMEAR=-5\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET ISMEAR=-5\n"); } break; case 1://DOS/BANDS (single point) - if(dim==0) _OUT("PB: COARSE KGRID BUT BAND/DOS REQUIRED!\n"); + if(dim==0) GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"PB: COARSE KGRID BUT BAND/DOS REQUIRED!\n"); if(vasp_gui.calc.have_paw) { vasp_gui.calc.lorbit=12; - _OUT("SET LORBIT=12\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET LORBIT=12\n"); } else { vasp_gui.calc.lorbit=2; - _OUT("SET LORBIT=2\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET LORBIT=2\n"); } vasp_gui.calc.nedos=2001; - _OUT("SET NEDOS=2001\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET NEDOS=2001\n"); vasp_gui.calc.emin=-10.; - _OUT("SET EMIN=-10.0\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET EMIN=-10.0\n"); vasp_gui.calc.emax=10.; - _OUT("SET EMAX=10.0\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET EMAX=10.0\n"); break; case 2://Lattice Dynamics (opt.) vasp_gui.calc.addgrid=TRUE; - _OUT("SET ADDGRID=.TRUE.\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET ADDGRID=.TRUE.\n"); /*according to vasp manual, Sec. 9.9*/ //PREC=Accurate already set vasp_gui.calc.lreal=VLR_FALSE;/*force LREAL=FALSE*/ - _OUT("SET LREAL=.FALSE.\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET LREAL=.FALSE.\n"); //smearing default vasp_gui.calc.ibrion=6; - _OUT("Default to finite Difference (IBRION=6)... SET IBRION=8 for Linear Perturbation!\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff, + "Default to finite Difference (IBRION=6)... SET IBRION=8 for Linear Perturbation!\n"); /*according to vasp manual, Sec. 6.22.6*/ vasp_gui.calc.potim=0.015; - _OUT("SET POTIM=0.015\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET POTIM=0.015\n"); if(vasp_gui.calc.ncore>1){ - _OUT("Lattice Dynamics does not support NCORE>1... RESETING NCORE\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"Lattice Dynamics does not support NCORE>1... RESETING NCORE\n"); vasp_gui.calc.ncore=1; - _OUT("(note that kpar can be set > 1\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"(note that kpar can be set > 1\n"); } break; case 3://Geometry (opt.) if(vasp_gui.simple_rgeom){ vasp_gui.calc.prec=VP_NORM; - _OUT("SET PREC=NORMAL\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET PREC=NORMAL\n"); vasp_gui.calc.use_prec=TRUE; vasp_gui.calc.algo=VA_FAST; - _OUT("SET ALGO=FAST\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET ALGO=FAST\n"); /*according to vasp manual, Sec. 6.2.4*/ vasp_gui.calc.nelmin=5; - _OUT("SET NELMIN=5\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET NELMIN=5\n"); vasp_gui.calc.ediff=1E-2; - _OUT("SET EDIFF=1E-2\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET EDIFF=1E-2\n"); vasp_gui.calc.ediffg=-0.3; - _OUT("SET EDIFFG=-0.3\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET EDIFFG=-0.3\n"); vasp_gui.calc.nsw=10; - _OUT("SET NSW=10\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET NSW=10\n"); vasp_gui.calc.ibrion=2; - _OUT("SET IBRION=2\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET IBRION=2\n"); }else{ vasp_gui.calc.prec=VP_ACCURATE; - _OUT("SET PREC=ACCURATE\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET PREC=ACCURATE\n"); vasp_gui.calc.use_prec=TRUE; vasp_gui.calc.algo=VA_NORM; - _OUT("SET ALGO=NORMAL\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET ALGO=NORMAL\n"); vasp_gui.calc.ldiag=TRUE; - _OUT("SET LDIAG=.TRUE.\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET LDIAG=.TRUE.\n"); vasp_gui.calc.addgrid=TRUE; - _OUT("SET ADDGRID=.TRUE.\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET ADDGRID=.TRUE.\n"); /*according to manual, Sec. 6.2.5*/ vasp_gui.calc.nelmin=8; - _OUT("SET NELMIN=8\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET NELMIN=8\n"); vasp_gui.calc.ediff=1E-5; - _OUT("SET EDIFF=1E-5\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET EDIFF=1E-5\n"); vasp_gui.calc.ediffg=-0.01; - _OUT("SET EDIFFG=-0.01\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET EDIFFG=-0.01\n"); vasp_gui.calc.nsw=20; - _OUT("SET NSW=20\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET NSW=20\n"); vasp_gui.calc.maxmix=80; - _OUT("SET MAXMIX=80\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET MAXMIX=80\n"); vasp_gui.calc.ibrion=1; - _OUT("SET IBRION=1\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET IBRION=1\n"); vasp_gui.calc.nfree=10; - _OUT("SET NFREE=10\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET NFREE=10\n"); } break; case 4://Molecular Dynamics (opt.) if(vasp_gui.simple_rgeom) { vasp_gui.calc.prec=VP_LOW; - _OUT("SET PREC=LOW\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET PREC=LOW\n"); } else { vasp_gui.calc.prec=VP_NORM; - _OUT("SET PREC=NROMAL\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET PREC=NROMAL\n"); } vasp_gui.calc.use_prec=TRUE;/*<- this is maybe too high for PREC=NORMAL*/ /*according to vasp manual, Sec. 9.7*/ vasp_gui.calc.ediff=1E-5; - _OUT("SET EDIFF=1E-5\n"); - _OUT("Please set smearing manually!\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET EDIFF=1E-5\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"Please set smearing manually!\n"); vasp_gui.calc.ismear=-1; - _OUT("SET ISMEAR=-1\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET ISMEAR=-1\n"); vasp_gui.calc.sigma=0.086; - _OUT("SET SIGMA=0.086\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET SIGMA=0.086\n"); /*choose smearing wisely*/ vasp_gui.calc.algo=VA_VERYFAST; - _OUT("SET ALGO=VERYFAST"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET ALGO=VERYFAST"); vasp_gui.calc.maxmix=40; - _OUT("SET MAXMIX=40\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET MAXMIX=40\n"); vasp_gui.calc.isym=0; - _OUT("SET ISYM=0\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET ISYM=0\n"); vasp_gui.calc.nelmin=4; - _OUT("SET NELMIN=4\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET NELMIN=4\n"); vasp_gui.calc.ibrion=0; - _OUT("SET IBRION=0\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET IBRION=0\n"); vasp_gui.calc.nsw=100; - _OUT("SET NSW=100\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET NSW=100\n"); vasp_gui.calc.nwrite=0;/*TODO: for (adv.)*/ - _OUT("SET NWRITE=0\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET NWRITE=0\n"); vasp_gui.calc.lcharg=FALSE; - _OUT("SET LCHARG=.FALSE.\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET LCHARG=.FALSE.\n"); vasp_gui.calc.lwave=FALSE; - _OUT("SET LWAVE=.FALSE.\n"); - _OUT("Please set TEBEG and TEEND manually!\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET LWAVE=.FALSE.\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"Please set TEBEG and TEEND manually!\n"); vasp_gui.calc.tebeg=1000; - _OUT("SET TEBEG=1000\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET TEBEG=1000\n"); vasp_gui.calc.teend=1000; - _OUT("SET TEEND=1000\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET TEEND=1000\n"); vasp_gui.calc.smass=3; - _OUT("SET SMASS=3\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET SMASS=3\n"); vasp_gui.calc.nblock=50; - _OUT("SET NBLOCK=50\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET NBLOCK=50\n"); vasp_gui.calc.potim=1.5; - _OUT("SET POTIM=1.5\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"SET POTIM=1.5\n"); break; default: - _OUT("FAIL: UNKNOWN CALCUL SETTING!\n"); + GUI_TEXTVIEW_INSERT(vasp_gui.simple_message_buff,"FAIL: UNKNOWN CALCUL SETTING!\n"); return; } - vasp_gui_refresh(); -#undef _OUT + vasp_gui_refresh();/*TODO: refresh the simple interface part that was changed*/ } /******************/ /* selecting PREC */ /******************/ -void vasp_prec_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); +void vasp_prec_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); switch (index){ case 1://Single vasp_gui.calc.prec=VP_SINGLE;break; @@ -777,17 +916,21 @@ void vasp_prec_selected(GtkWidget *w, struct model_pak *model){ /*****************************************/ /* Toggle use of automatic prec settings */ /*****************************************/ -void prec_toggle(GtkWidget *w, GtkWidget *box){ +void prec_toggle(void){ + gchar *text; if(!(vasp_gui.calc.use_prec)){ /*switch to manual values*/ - gtk_widget_set_sensitive(vasp_gui.encut,TRUE); - gtk_widget_set_sensitive(vasp_gui.enaug,TRUE); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.encut),g_strdup_printf("%.2lf",vasp_gui.calc.encut)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.enaug),g_strdup_printf("%.2lf",vasp_gui.calc.enaug)); + GUI_UNLOCK(vasp_gui.encut); + GUI_UNLOCK(vasp_gui.enaug); + text=g_strdup_printf("%.2lf",vasp_gui.calc.encut); + GUI_ENTRY_TEXT(vasp_gui.encut,text); + g_free(text);text=g_strdup_printf("%.2lf",vasp_gui.calc.enaug); + GUI_ENTRY_TEXT(vasp_gui.enaug,text); + g_free(text); }else{ /*switch to automatic values*/ - gtk_widget_set_sensitive(vasp_gui.encut,FALSE); - gtk_widget_set_sensitive(vasp_gui.enaug,FALSE); + GUI_LOCK(vasp_gui.encut); + GUI_LOCK(vasp_gui.enaug); } @@ -795,13 +938,14 @@ void prec_toggle(GtkWidget *w, GtkWidget *box){ /******************/ /* selecting ALGO */ /******************/ -void vasp_algo_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); - gtk_widget_set_sensitive(vasp_gui.ialgo,FALSE); +void vasp_algo_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + GUI_LOCK(vasp_gui.ialgo); switch(index){ case 1://USE_IALGO vasp_gui.calc.algo=VA_IALGO; - gtk_widget_set_sensitive(vasp_gui.ialgo,TRUE); + GUI_UNLOCK(vasp_gui.ialgo); break; case 2://VERYFAST vasp_gui.calc.algo=VA_VERYFAST;break; @@ -833,8 +977,9 @@ void vasp_algo_selected(GtkWidget *w, struct model_pak *model){ /*******************/ /* selecting IALGO */ /*******************/ -void vasp_ialgo_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); +void vasp_ialgo_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); switch(index){ case 0://2:FIXED ORB/1E vasp_gui.calc.ialgo=VIA_OE_FIXED;break; @@ -872,33 +1017,41 @@ void vasp_ialgo_selected(GtkWidget *w, struct model_pak *model){ /***************/ /* elec toggle */ /***************/ -void elec_toggle(GtkWidget *w, GtkWidget *box){ +void elec_toggle(void){ + gchar *text; if(!(vasp_gui.calc.auto_elec)){ /*switch to manual values*/ - gtk_widget_set_sensitive(vasp_gui.nsim,TRUE); - gtk_widget_set_sensitive(vasp_gui.vtime,TRUE); - gtk_widget_set_sensitive(vasp_gui.nbands,TRUE); - gtk_widget_set_sensitive(vasp_gui.nelect,TRUE); - gtk_widget_set_sensitive(vasp_gui.iwavpr,TRUE); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nsim),g_strdup_printf("%i",vasp_gui.calc.nsim)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.vtime),g_strdup_printf("%.4lf",vasp_gui.calc.vtime)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nbands),g_strdup_printf("%i",vasp_gui.calc.nbands)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.nelect),g_strdup_printf("%.4lf",vasp_gui.calc.nelect)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.iwavpr),g_strdup_printf("%i",vasp_gui.calc.iwavpr)); + GUI_UNLOCK(vasp_gui.nsim); + GUI_UNLOCK(vasp_gui.vtime); + GUI_UNLOCK(vasp_gui.nbands); + GUI_UNLOCK(vasp_gui.nelect); + GUI_UNLOCK(vasp_gui.iwavpr); + text=g_strdup_printf("%i",vasp_gui.calc.nsim); + GUI_ENTRY_TEXT(vasp_gui.nsim,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.vtime); + GUI_ENTRY_TEXT(vasp_gui.vtime,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.nbands); + GUI_ENTRY_TEXT(vasp_gui.nbands,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.nelect); + GUI_ENTRY_TEXT(vasp_gui.nelect,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.iwavpr); + GUI_ENTRY_TEXT(vasp_gui.iwavpr,text); + g_free(text); }else{ /*switch to automatic values*/ - gtk_widget_set_sensitive(vasp_gui.nsim,FALSE); - gtk_widget_set_sensitive(vasp_gui.vtime,FALSE); - gtk_widget_set_sensitive(vasp_gui.nbands,FALSE); - gtk_widget_set_sensitive(vasp_gui.nelect,FALSE); - gtk_widget_set_sensitive(vasp_gui.iwavpr,FALSE); + GUI_LOCK(vasp_gui.nsim); + GUI_LOCK(vasp_gui.vtime); + GUI_LOCK(vasp_gui.nbands); + GUI_LOCK(vasp_gui.nelect); + GUI_LOCK(vasp_gui.iwavpr); } } /*******************/ /* selecting LREAL */ /*******************/ -void vasp_lreal_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); +void vasp_lreal_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); switch(index){ case 0://Auto vasp_gui.calc.lreal=VLR_AUTO;break; @@ -914,72 +1067,85 @@ void vasp_lreal_selected(GtkWidget *w, struct model_pak *model){ /***************/ /* grid toggle */ /***************/ -void grid_toggle(GtkWidget *w, GtkWidget *box){ - if(!(vasp_gui.calc.auto_grid)){ - /*switch to manual values*/ - gtk_widget_set_sensitive(vasp_gui.ngx,TRUE); - gtk_widget_set_sensitive(vasp_gui.ngy,TRUE); - gtk_widget_set_sensitive(vasp_gui.ngz,TRUE); - gtk_widget_set_sensitive(vasp_gui.ngxf,TRUE); - gtk_widget_set_sensitive(vasp_gui.ngyf,TRUE); - gtk_widget_set_sensitive(vasp_gui.ngzf,TRUE); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ngx),g_strdup_printf("%i",vasp_gui.calc.ngx)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ngy),g_strdup_printf("%i",vasp_gui.calc.ngy)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ngz),g_strdup_printf("%i",vasp_gui.calc.ngz)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ngxf),g_strdup_printf("%i",vasp_gui.calc.ngxf)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ngyf),g_strdup_printf("%i",vasp_gui.calc.ngyf)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ngzf),g_strdup_printf("%i",vasp_gui.calc.ngzf)); - }else{ - /*switch to automatic values*/ - gtk_widget_set_sensitive(vasp_gui.ngx,FALSE); - gtk_widget_set_sensitive(vasp_gui.ngy,FALSE); - gtk_widget_set_sensitive(vasp_gui.ngz,FALSE); - gtk_widget_set_sensitive(vasp_gui.ngxf,FALSE); - gtk_widget_set_sensitive(vasp_gui.ngyf,FALSE); - gtk_widget_set_sensitive(vasp_gui.ngzf,FALSE); - } +void grid_toggle(void){ + gchar *text; + if(!(vasp_gui.calc.auto_grid)){ + /*switch to manual values*/ + GUI_UNLOCK(vasp_gui.ngx); + GUI_UNLOCK(vasp_gui.ngy); + GUI_UNLOCK(vasp_gui.ngz); + GUI_UNLOCK(vasp_gui.ngxf); + GUI_UNLOCK(vasp_gui.ngyf); + GUI_UNLOCK(vasp_gui.ngzf); + text=g_strdup_printf("%i",vasp_gui.calc.ngx); + GUI_ENTRY_TEXT(vasp_gui.ngx,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.ngy); + GUI_ENTRY_TEXT(vasp_gui.ngy,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.ngz); + GUI_ENTRY_TEXT(vasp_gui.ngz,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.ngxf); + GUI_ENTRY_TEXT(vasp_gui.ngxf,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.ngyf); + GUI_ENTRY_TEXT(vasp_gui.ngyf,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.ngzf); + GUI_ENTRY_TEXT(vasp_gui.ngzf,text); + g_free(text); + }else{ + /*switch to automatic values*/ + GUI_LOCK(vasp_gui.ngx); + GUI_LOCK(vasp_gui.ngy); + GUI_LOCK(vasp_gui.ngz); + GUI_LOCK(vasp_gui.ngxf); + GUI_LOCK(vasp_gui.ngyf); + GUI_LOCK(vasp_gui.ngzf); + } } /***************************/ /* ismear value is changed */ /***************************/ -void ismear_changed(GtkWidget *w, struct model_pak *model){ - const gchar *label = gtk_entry_get_text(GTK_ENTRY(w)); - sscanf(label,"%i",&(vasp_gui.calc.ismear)); +void ismear_changed(GUI_OBJ *w){ + gchar *label; + GUI_ENTRY_GET_TEXT(w,label); + sscanf(label,"%i",&(vasp_gui.calc.ismear)); if(vasp_gui.calc.ismear==-5) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.have_tetra),TRUE); - gtk_widget_set_sensitive(vasp_gui.have_tetra,TRUE); + GUI_TOGGLE_ON(vasp_gui.have_tetra); + GUI_UNLOCK(vasp_gui.have_tetra); } else { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.have_tetra),FALSE); - gtk_widget_set_sensitive(vasp_gui.have_tetra,FALSE); + GUI_TOGGLE_OFF(vasp_gui.have_tetra); + GUI_LOCK(vasp_gui.have_tetra); } + g_free(label); } /*****************************/ /* kspacing value is changed */ /*****************************/ -void kspacing_changed(GtkWidget *w, struct model_pak *model){ - const gchar *label = gtk_entry_get_text(GTK_ENTRY(w)); - sscanf(label,"%lf",&(vasp_gui.calc.kspacing)); +void kspacing_changed(GUI_OBJ *w){ + gchar *label; + GUI_ENTRY_GET_TEXT(w,label); + sscanf(label,"%lf",&(vasp_gui.calc.kspacing)); + g_free(label); } /************************/ /* toggle LNONCOLLINEAR */ /************************/ -void lnoncoll_toggle(GtkWidget *w, GtkWidget *box){ - /* unselecting LNONCOLLINEAR automatically unselect LSORBIT */ - if(!vasp_gui.calc.non_collinear) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.lsorbit),FALSE); +void lnoncoll_toggle(void){ + /* unselecting LNONCOLLINEAR automatically unselect LSORBIT */ + if(!vasp_gui.calc.non_collinear) GUI_TOGGLE_OFF(vasp_gui.lsorbit); } /******************/ /* toggle LSORBIT */ /******************/ -void lsorbit_toggle(GtkWidget *w, GtkWidget *box){ +void lsorbit_toggle(void){ /* LSORBIT automatically select LNONCOLLINEAR */ - if(vasp_gui.calc.lsorbit) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.lnoncoll),TRUE); + if(vasp_gui.calc.lsorbit) GUI_TOGGLE_ON(vasp_gui.lnoncoll); } /*****************/ /* selecting GGA */ /*****************/ -void vasp_gga_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); +void vasp_gga_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); switch(index){ case 0://91:PW91 vasp_gui.calc.gga=VG_91;break; @@ -997,11 +1163,12 @@ void vasp_gga_selected(GtkWidget *w, struct model_pak *model){ /*********************/ /* selecting METAGGA */ /*********************/ -void vasp_metagga_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); - gtk_widget_set_sensitive(vasp_gui.cmbj,FALSE); - gtk_widget_set_sensitive(vasp_gui.cmbja,FALSE); - gtk_widget_set_sensitive(vasp_gui.cmbjb,FALSE); +void vasp_metagga_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + GUI_LOCK(vasp_gui.cmbj); + GUI_LOCK(vasp_gui.cmbja); + GUI_LOCK(vasp_gui.cmbjb); switch(index){ case 0://TPSS vasp_gui.calc.mgga=VMG_TPSS;break; @@ -1012,58 +1179,75 @@ void vasp_metagga_selected(GtkWidget *w, struct model_pak *model){ case 3://MBJ default: vasp_gui.calc.mgga=VMG_MBJ; - gtk_widget_set_sensitive(vasp_gui.cmbj,TRUE); - gtk_widget_set_sensitive(vasp_gui.cmbja,TRUE); - gtk_widget_set_sensitive(vasp_gui.cmbjb,TRUE); + GUI_UNLOCK(vasp_gui.cmbj); + GUI_UNLOCK(vasp_gui.cmbja); + GUI_UNLOCK(vasp_gui.cmbjb); } } /*******************/ /* toggle LMETAGGA */ /*******************/ -void metagga_toggle(GtkWidget *w, GtkWidget *box){ - if(!vasp_gui.calc.lmetagga){ - /*switch to manual values*/ - gtk_widget_set_sensitive(vasp_gui.metagga,FALSE); - gtk_widget_set_sensitive(vasp_gui.cmbj,FALSE); - gtk_widget_set_sensitive(vasp_gui.cmbja,FALSE); - gtk_widget_set_sensitive(vasp_gui.cmbjb,FALSE); - }else{ - /*switch to automatic values*/ - gtk_widget_set_sensitive(vasp_gui.metagga,TRUE); - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.metagga),3);//MBJ (actually there is no default) - gtk_widget_set_sensitive(vasp_gui.cmbj,TRUE); - gtk_widget_set_sensitive(vasp_gui.cmbja,TRUE); - gtk_widget_set_sensitive(vasp_gui.cmbjb,TRUE); - } +void metagga_toggle(void){ + if(!vasp_gui.calc.lmetagga){ + /*switch to manual values*/ + GUI_LOCK(vasp_gui.metagga); + GUI_LOCK(vasp_gui.cmbj); + GUI_LOCK(vasp_gui.cmbja); + GUI_LOCK(vasp_gui.cmbjb); + }else{ + /*switch to automatic values*/ + GUI_UNLOCK(vasp_gui.metagga); + GUI_COMBOBOX_SET(vasp_gui.metagga,3);//MBJ (actually there is no default) + GUI_UNLOCK(vasp_gui.cmbj); + GUI_UNLOCK(vasp_gui.cmbja); + GUI_UNLOCK(vasp_gui.cmbjb); + } } /*******************/ /* toggle L(S)DA+U */ /*******************/ -void ldau_toggle(GtkWidget *w, GtkWidget *box){ - if(!vasp_gui.calc.ldau){ - /*switch to manual values*/ - gtk_widget_set_sensitive(vasp_gui.ldau,FALSE); - gtk_widget_set_sensitive(vasp_gui.ldau_print,FALSE); - gtk_widget_set_sensitive(vasp_gui.ldaul,FALSE); - gtk_widget_set_sensitive(vasp_gui.ldauu,FALSE); - gtk_widget_set_sensitive(vasp_gui.ldauj,FALSE); - }else{ - /*switch to automatic values*/ - gtk_widget_set_sensitive(vasp_gui.ldau,TRUE); - gtk_widget_set_sensitive(vasp_gui.ldau_print,TRUE); - gtk_widget_set_sensitive(vasp_gui.ldaul,TRUE); - gtk_widget_set_sensitive(vasp_gui.ldauu,TRUE); - gtk_widget_set_sensitive(vasp_gui.ldauj,TRUE); - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ldau),1);//2:LSDA+U Dudarev - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.ldau_print),0);//0:Silent - /*TODO: update ldaul, ldauu, ldauj*/ - } +void ldau_toggle(void){ + gchar *text; + if(!vasp_gui.calc.ldau){ + /*switch to manual values*/ + GUI_LOCK(vasp_gui.ldau); + GUI_LOCK(vasp_gui.ldau_print); + GUI_LOCK(vasp_gui.ldaul); + GUI_LOCK(vasp_gui.ldauu); + GUI_LOCK(vasp_gui.ldauj); + }else{ + /*switch to automatic values*/ + GUI_UNLOCK(vasp_gui.ldau); + GUI_UNLOCK(vasp_gui.ldau_print); + GUI_UNLOCK(vasp_gui.ldaul); + GUI_UNLOCK(vasp_gui.ldauu); + GUI_UNLOCK(vasp_gui.ldauj); + GUI_COMBOBOX_SET(vasp_gui.ldau,1);//2:LSDA+U Dudarev + GUI_COMBOBOX_SET(vasp_gui.ldau_print,0);//0:Silent + /*mini-sync*/ + if(vasp_gui.calc.ldaul!=NULL) { + text=g_strdup_printf("%s",vasp_gui.calc.ldaul); + GUI_ENTRY_TEXT(vasp_gui.ldaul,text); + g_free(text); + } + if(vasp_gui.calc.ldauu!=NULL) { + text=g_strdup_printf("%s",vasp_gui.calc.ldauu); + GUI_ENTRY_TEXT(vasp_gui.ldauu,text); + g_free(text); + } + if(vasp_gui.calc.ldauj!=NULL) { + text=g_strdup_printf("%s",vasp_gui.calc.ldauj); + GUI_ENTRY_TEXT(vasp_gui.ldauj,text); + g_free(text); + } + } } /***************************/ /* selecting L(S)DA+U type */ /***************************/ -void vasp_ldau_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); +void vasp_ldau_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); switch(index){ case 0://1:LSDA+U Liechtenstein vasp_gui.calc.ldau_type=VU_1;break; @@ -1077,8 +1261,9 @@ void vasp_ldau_selected(GtkWidget *w, struct model_pak *model){ /***************************************/ /* selecting L(S)DA+U output verbosity */ /***************************************/ -void vasp_ldau_print_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); +void vasp_ldau_print_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); switch(index){ case 1://1:Occupancy matrix vasp_gui.calc.ldau_output=VUO_1;break; @@ -1092,51 +1277,59 @@ void vasp_ldau_print_selected(GtkWidget *w, struct model_pak *model){ /************************************/ /* toggle manual selection of mixer */ /************************************/ -void mixer_toggle(GtkWidget *w, GtkWidget *box){ - if((vasp_gui.calc.auto_mixer)){ - /*switch to manual values*/ - gtk_widget_set_sensitive(vasp_gui.mixer,FALSE); - gtk_widget_set_sensitive(vasp_gui.amix,FALSE); - gtk_widget_set_sensitive(vasp_gui.bmix,FALSE); - gtk_widget_set_sensitive(vasp_gui.amin,FALSE); - gtk_widget_set_sensitive(vasp_gui.amix_mag,FALSE); - gtk_widget_set_sensitive(vasp_gui.bmix_mag,FALSE); - gtk_widget_set_sensitive(vasp_gui.maxmix,FALSE); - gtk_widget_set_sensitive(vasp_gui.wc,FALSE); - gtk_widget_set_sensitive(vasp_gui.inimix,FALSE); - gtk_widget_set_sensitive(vasp_gui.mixpre,FALSE); - }else{ - /*switch to automatic values*/ - gtk_widget_set_sensitive(vasp_gui.mixer,TRUE); - gtk_widget_set_sensitive(vasp_gui.amix,TRUE); - gtk_widget_set_sensitive(vasp_gui.bmix,TRUE); - gtk_widget_set_sensitive(vasp_gui.amin,TRUE); - gtk_widget_set_sensitive(vasp_gui.amix_mag,TRUE); - gtk_widget_set_sensitive(vasp_gui.bmix_mag,TRUE); - gtk_widget_set_sensitive(vasp_gui.maxmix,TRUE); - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.mixer),3);//4:BROYDEN - gtk_entry_set_text(GTK_ENTRY(vasp_gui.amix),g_strdup_printf("%.4lf",vasp_gui.calc.amix)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.bmix),g_strdup_printf("%.4lf",vasp_gui.calc.bmix)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.amin),g_strdup_printf("%.4lf",vasp_gui.calc.amin)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.amix_mag),g_strdup_printf("%.4lf",vasp_gui.calc.amix_mag)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.bmix_mag),g_strdup_printf("%.4lf",vasp_gui.calc.bmix_mag)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.maxmix),g_strdup_printf("%i",vasp_gui.calc.maxmix)); +void mixer_toggle(void){ + gchar *text; + if((vasp_gui.calc.auto_mixer)){ + /*switch to manual values*/ + GUI_LOCK(vasp_gui.mixer); + GUI_LOCK(vasp_gui.amix); + GUI_LOCK(vasp_gui.bmix); + GUI_LOCK(vasp_gui.amin); + GUI_LOCK(vasp_gui.amix_mag); + GUI_LOCK(vasp_gui.bmix_mag); + GUI_LOCK(vasp_gui.maxmix); + GUI_LOCK(vasp_gui.wc); + GUI_LOCK(vasp_gui.inimix); + GUI_LOCK(vasp_gui.mixpre); + }else{ + /*switch to automatic values*/ + GUI_UNLOCK(vasp_gui.mixer); + GUI_UNLOCK(vasp_gui.amix); + GUI_UNLOCK(vasp_gui.bmix); + GUI_UNLOCK(vasp_gui.amin); + GUI_UNLOCK(vasp_gui.amix_mag); + GUI_UNLOCK(vasp_gui.bmix_mag); + GUI_UNLOCK(vasp_gui.maxmix); + GUI_COMBOBOX_SET(vasp_gui.mixer,3);//4:BROYDEN + text=g_strdup_printf("%.4lf",vasp_gui.calc.amix); + GUI_ENTRY_TEXT(vasp_gui.amix,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.bmix); + GUI_ENTRY_TEXT(vasp_gui.bmix,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.amin); + GUI_ENTRY_TEXT(vasp_gui.amin,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.amix_mag); + GUI_ENTRY_TEXT(vasp_gui.amix_mag,text); + g_free(text);text=g_strdup_printf("%.4lf",vasp_gui.calc.bmix_mag); + GUI_ENTRY_TEXT(vasp_gui.bmix_mag,text); + g_free(text);text=g_strdup_printf("%i",vasp_gui.calc.maxmix); + GUI_ENTRY_TEXT(vasp_gui.maxmix,text); + g_free(text); if(vasp_gui.calc.imix==VM_4){ - gtk_widget_set_sensitive(vasp_gui.wc,TRUE); - gtk_widget_set_sensitive(vasp_gui.inimix,TRUE); - gtk_widget_set_sensitive(vasp_gui.mixpre,TRUE); + GUI_UNLOCK(vasp_gui.wc); + GUI_UNLOCK(vasp_gui.inimix); + GUI_UNLOCK(vasp_gui.mixpre); } - - } + } } /*******************/ /* selecting mixer */ /*******************/ -void vasp_mixer_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); - gtk_widget_set_sensitive(vasp_gui.wc,FALSE); - gtk_widget_set_sensitive(vasp_gui.inimix,FALSE); - gtk_widget_set_sensitive(vasp_gui.mixpre,FALSE); +void vasp_mixer_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + GUI_LOCK(vasp_gui.wc); + GUI_LOCK(vasp_gui.inimix); + GUI_LOCK(vasp_gui.mixpre); switch(index){ case 0://0:NO MIXING vasp_gui.calc.imix=VM_0;break; @@ -1147,16 +1340,17 @@ void vasp_mixer_selected(GtkWidget *w, struct model_pak *model){ case 3://4:BROYDEN default: vasp_gui.calc.imix=VM_4; - gtk_widget_set_sensitive(vasp_gui.wc,TRUE); - gtk_widget_set_sensitive(vasp_gui.inimix,TRUE); - gtk_widget_set_sensitive(vasp_gui.mixpre,TRUE); + GUI_UNLOCK(vasp_gui.wc); + GUI_UNLOCK(vasp_gui.inimix); + GUI_UNLOCK(vasp_gui.mixpre); } } /***************************/ /* selecting initial mixer */ /***************************/ -void vasp_inimix_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); +void vasp_inimix_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); switch(index){ case 0://0:LINEAR vasp_gui.calc.inimix=VIM_0;break; @@ -1168,8 +1362,9 @@ void vasp_inimix_selected(GtkWidget *w, struct model_pak *model){ /************************/ /* selecting pre-mixing */ /************************/ -void vasp_mixpre_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); +void vasp_mixpre_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); switch(index){ case 0://0:NONE vasp_gui.calc.mixpre=VMP_0;break; @@ -1183,13 +1378,14 @@ void vasp_mixpre_selected(GtkWidget *w, struct model_pak *model){ /********************/ /* selecting idipol */ /********************/ -void vasp_idipol_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); - gtk_widget_set_sensitive(vasp_gui.ldipol,TRUE); - gtk_widget_set_sensitive(vasp_gui.lmono,TRUE); - gtk_widget_set_sensitive(vasp_gui.dipol,TRUE); - gtk_widget_set_sensitive(vasp_gui.epsilon,TRUE); - gtk_widget_set_sensitive(vasp_gui.efield,TRUE); +void vasp_idipol_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + GUI_UNLOCK(vasp_gui.ldipol); + GUI_UNLOCK(vasp_gui.lmono); + GUI_UNLOCK(vasp_gui.dipol); + GUI_UNLOCK(vasp_gui.epsilon); + GUI_UNLOCK(vasp_gui.efield); switch(index){ case 1://1:u axis vasp_gui.calc.idipol=VID_1;break; @@ -1199,23 +1395,24 @@ void vasp_idipol_selected(GtkWidget *w, struct model_pak *model){ vasp_gui.calc.idipol=VID_3;break; case 4://4:all axis vasp_gui.calc.idipol=VID_4; - gtk_widget_set_sensitive(vasp_gui.efield,FALSE);/*not implemented*/ + GUI_LOCK(vasp_gui.efield); break; case 0://0:no calcul default: vasp_gui.calc.idipol=VID_0; - gtk_widget_set_sensitive(vasp_gui.ldipol,FALSE); - gtk_widget_set_sensitive(vasp_gui.lmono,FALSE); - gtk_widget_set_sensitive(vasp_gui.dipol,FALSE); - gtk_widget_set_sensitive(vasp_gui.epsilon,FALSE); - gtk_widget_set_sensitive(vasp_gui.efield,FALSE); + GUI_LOCK(vasp_gui.ldipol); + GUI_LOCK(vasp_gui.lmono); + GUI_LOCK(vasp_gui.dipol); + GUI_LOCK(vasp_gui.epsilon); + GUI_LOCK(vasp_gui.efield); } } /********************/ /* selecting lorbit */ /********************/ -void vasp_lorbit_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); +void vasp_lorbit_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); switch(index){ case 1://1:lm-PROCAR vasp_gui.calc.lorbit=1;break; @@ -1237,26 +1434,27 @@ void vasp_lorbit_selected(GtkWidget *w, struct model_pak *model){ /********************/ /* selecting ibrion */ /********************/ -void vasp_ibrion_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); - gtk_widget_set_sensitive(vasp_gui.tebeg,FALSE); - gtk_widget_set_sensitive(vasp_gui.teend,FALSE); - gtk_widget_set_sensitive(vasp_gui.smass,FALSE); - gtk_widget_set_sensitive(vasp_gui.nblock,FALSE); - gtk_widget_set_sensitive(vasp_gui.kblock,FALSE); - gtk_widget_set_sensitive(vasp_gui.npaco,FALSE); - gtk_widget_set_sensitive(vasp_gui.apaco,FALSE); +void vasp_ibrion_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); + GUI_LOCK(vasp_gui.tebeg); + GUI_LOCK(vasp_gui.teend); + GUI_LOCK(vasp_gui.smass); + GUI_LOCK(vasp_gui.nblock); + GUI_LOCK(vasp_gui.kblock); + GUI_LOCK(vasp_gui.npaco); + GUI_LOCK(vasp_gui.apaco); switch(index){ case 1://0:Molecular Dynamics vasp_gui.calc.ibrion=0; /*molecular dynamics part*/ - gtk_widget_set_sensitive(vasp_gui.tebeg,TRUE); - gtk_widget_set_sensitive(vasp_gui.teend,TRUE); - gtk_widget_set_sensitive(vasp_gui.smass,TRUE); - gtk_widget_set_sensitive(vasp_gui.nblock,TRUE); - gtk_widget_set_sensitive(vasp_gui.kblock,TRUE); - gtk_widget_set_sensitive(vasp_gui.npaco,TRUE); - gtk_widget_set_sensitive(vasp_gui.apaco,TRUE); + GUI_UNLOCK(vasp_gui.tebeg); + GUI_UNLOCK(vasp_gui.teend); + GUI_UNLOCK(vasp_gui.smass); + GUI_UNLOCK(vasp_gui.nblock); + GUI_UNLOCK(vasp_gui.kblock); + GUI_UNLOCK(vasp_gui.npaco); + GUI_UNLOCK(vasp_gui.apaco); break; case 2://1:Quasi-Newton vasp_gui.calc.ibrion=1;break; @@ -1282,48 +1480,49 @@ void vasp_ibrion_selected(GtkWidget *w, struct model_pak *model){ /******************/ /* selecting ISIF */ /******************/ -void vasp_isif_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); +void vasp_isif_selected(GUI_OBJ *w){ + gint index; + GUI_COMBOBOX_GET(w,index); vasp_gui.calc.isif=index; switch(index){ case 3://3:F_S_I_S_V - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_ions),TRUE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_shape),TRUE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_volume),TRUE); + GUI_TOGGLE_ON(vasp_gui.relax_ions); + GUI_TOGGLE_ON(vasp_gui.relax_shape); + GUI_TOGGLE_ON(vasp_gui.relax_volume); break; case 4://4:F_S_I_S_0 - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_ions),TRUE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_shape),TRUE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_volume),FALSE); + GUI_TOGGLE_ON(vasp_gui.relax_ions); + GUI_TOGGLE_ON(vasp_gui.relax_shape); + GUI_TOGGLE_OFF(vasp_gui.relax_volume); break; case 5://5:F_S_0_S_0 - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_ions),FALSE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_shape),TRUE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_volume),FALSE); + GUI_TOGGLE_OFF(vasp_gui.relax_ions); + GUI_TOGGLE_ON(vasp_gui.relax_shape); + GUI_TOGGLE_OFF(vasp_gui.relax_volume); break; case 6://6:F_S_0_S_V - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_ions),FALSE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_shape),TRUE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_volume),TRUE); + GUI_TOGGLE_OFF(vasp_gui.relax_ions); + GUI_TOGGLE_ON(vasp_gui.relax_shape); + GUI_TOGGLE_ON(vasp_gui.relax_volume); break; case 7://7:F_S_0_0_V - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_ions),FALSE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_shape),FALSE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_volume),TRUE); + GUI_TOGGLE_OFF(vasp_gui.relax_ions); + GUI_TOGGLE_OFF(vasp_gui.relax_shape); + GUI_TOGGLE_ON(vasp_gui.relax_volume); break; case 0://0:F_0_I_0_0 case 1://1:F_P_I_0_0 case 2://2:F_S_I_0_0 default: - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_ions),TRUE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_shape),FALSE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_volume),FALSE); + GUI_TOGGLE_ON(vasp_gui.relax_ions); + GUI_TOGGLE_OFF(vasp_gui.relax_shape); + GUI_TOGGLE_OFF(vasp_gui.relax_volume); } } /****************/ /* isif toggles */ /****************/ -void isif_toggle(GtkWidget *w, GtkWidget *box){ +void isif_toggle(void){ /*recalculate isif function of the user switches*/ if((vasp_gui.rions)&&(!vasp_gui.rshape)&&(!vasp_gui.rvolume)) {if(vasp_gui.calc.isif>2) vasp_gui.calc.isif=2;} else if((vasp_gui.rions)&&(vasp_gui.rshape)&&(vasp_gui.rvolume)) vasp_gui.calc.isif=3; @@ -1333,14 +1532,14 @@ else if ((!vasp_gui.rions)&&(vasp_gui.rshape)&&(vasp_gui.rvolume)) vasp_gui.calc else if ((!vasp_gui.rions)&&(!vasp_gui.rshape)&&(vasp_gui.rvolume)) vasp_gui.calc.isif=7; /*deal with forbiden combination*/ if((vasp_gui.rions)&&(!vasp_gui.rshape)&&(vasp_gui.rvolume)) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_ions),FALSE); + GUI_TOGGLE_OFF(vasp_gui.relax_ions); vasp_gui.calc.isif=7; } if((!vasp_gui.rions)&&(!vasp_gui.rshape)&&(!vasp_gui.rvolume)) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.relax_ions),TRUE); + GUI_TOGGLE_ON(vasp_gui.relax_ions); vasp_gui.calc.isif=2; } -gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.isif),vasp_gui.calc.isif);/*more simple than before*/ +GUI_COMBOBOX_SET(vasp_gui.isif,vasp_gui.calc.isif); } /*****************************/ /* selective dynamics toggle */ @@ -1348,31 +1547,40 @@ gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.isif),vasp_gui.calc.isif);/*more void toggle_poscar_sd(){ if((vasp_gui.calc.poscar_free==VPF_MAN)&&(vasp_gui.calc.poscar_sd)){ /*we need some tags*/ - gtk_widget_set_sensitive(vasp_gui.poscar_tx,TRUE); - gtk_widget_set_sensitive(vasp_gui.poscar_ty,TRUE); - gtk_widget_set_sensitive(vasp_gui.poscar_tz,TRUE); + GUI_UNLOCK(vasp_gui.poscar_tx); + GUI_UNLOCK(vasp_gui.poscar_ty); + GUI_UNLOCK(vasp_gui.poscar_tz); }else{ /*tags are no longer important*/ - gtk_widget_set_sensitive(vasp_gui.poscar_tx,FALSE); - gtk_widget_set_sensitive(vasp_gui.poscar_ty,FALSE); - gtk_widget_set_sensitive(vasp_gui.poscar_tz,FALSE); + GUI_LOCK(vasp_gui.poscar_tx); + GUI_LOCK(vasp_gui.poscar_ty); + GUI_LOCK(vasp_gui.poscar_tz); } - gtk_widget_set_sensitive(vasp_gui.poscar_free,vasp_gui.calc.poscar_sd); + if(vasp_gui.calc.poscar_sd) GUI_UNLOCK(vasp_gui.poscar_free); + else GUI_LOCK(vasp_gui.poscar_free); } /*************************/ /* selecting poscar_free */ /*************************/ -void vasp_poscar_free_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); - gint ix=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms));/*PUSH*/ +void vasp_poscar_free_selected(GUI_OBJ *w){ + gint index; + gint ix; gchar *text; gdouble x,y,z; gchar symbol[3]; gint idx=0; gchar tag; - gtk_widget_set_sensitive(vasp_gui.poscar_tx,(index==2)); - gtk_widget_set_sensitive(vasp_gui.poscar_ty,(index==2)); - gtk_widget_set_sensitive(vasp_gui.poscar_tz,(index==2)); + GUI_COMBOBOX_GET(w,index); + GUI_COMBOBOX_GET(vasp_gui.poscar_atoms,ix);/*PUSH*/ + if(index==2){ + GUI_UNLOCK(vasp_gui.poscar_tx); + GUI_UNLOCK(vasp_gui.poscar_ty); + GUI_UNLOCK(vasp_gui.poscar_tz); + }else{ + GUI_LOCK(vasp_gui.poscar_tx); + GUI_LOCK(vasp_gui.poscar_ty); + GUI_LOCK(vasp_gui.poscar_tz); + } switch(index){ case 0://All atom FIXED vasp_gui.calc.poscar_free=VPF_FIXED; @@ -1387,27 +1595,29 @@ void vasp_poscar_free_selected(GtkWidget *w, struct model_pak *model){ vasp_gui.calc.poscar_free=VPF_FREE; tag='T'; } - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,idx); + GUI_COMBOBOX_GET_TEXT(vasp_gui.poscar_atoms,text); while(g_ascii_strcasecmp(text,"ADD atom")!=0){ /*modify each line tags*/ sscanf(text,"%lf %lf %lf %*c %*c %*c ! atom: %*i (%[^)])",&x,&y,&z,&(symbol[0])); - gtk_combo_box_insert_text(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx, - g_strdup_printf("%.8lf %.8lf %.8lf %c %c %c ! atom: %i (%s)", - x,y,z,tag,tag,tag,idx,symbol)); - gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms),idx+1); + g_free(text);/*combobox returned text should be freed*/ + text=g_strdup_printf("%.8lf %.8lf %.8lf %c %c %c ! atom: %i (%s)",x,y,z,tag,tag,tag,idx,symbol); + GUI_COMBOBOX_ADD_TEXT(vasp_gui.poscar_atoms,idx,text); + GUI_COMBOBOX_DEL(vasp_gui.poscar_atoms,idx+1); idx++; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,idx); + g_free(text);/*so is g_strdup text*/ + GUI_COMBOBOX_GET_TEXT(vasp_gui.poscar_atoms,text); } /*return to selected atom*/ - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),ix);/*PULL*/ + g_free(text);/*free "ADD atom" string*/ + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,ix);/*PULL*/ } /************************/ /* poscar_direct toggle */ /************************/ void toggle_poscar_direct(){ - gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms));/*PUSH*/ + gint index; gint idx=0; gchar *text; gchar *tamp; @@ -1415,18 +1625,19 @@ void toggle_poscar_direct(){ gdouble ux,uy,uz; gdouble vx,vy,vz; gdouble wx,wy,wz; - /* TODO: recalculate all positions on a single click */ + /**/ + GUI_COMBOBOX_GET(vasp_gui.poscar_atoms,index);/*PUSH*/ /*mini sync*/ - VASP_REG_VAL(poscar_a0,"%lf"); - VASP_REG_VAL(poscar_ux,"%lf"); - VASP_REG_VAL(poscar_uy,"%lf"); - VASP_REG_VAL(poscar_uz,"%lf"); - VASP_REG_VAL(poscar_vx,"%lf"); - VASP_REG_VAL(poscar_vy,"%lf"); - VASP_REG_VAL(poscar_vz,"%lf"); - VASP_REG_VAL(poscar_wx,"%lf"); - VASP_REG_VAL(poscar_wy,"%lf"); - VASP_REG_VAL(poscar_wz,"%lf"); + VASP_REG_VAL(poscar_a0,"%lf"); + VASP_REG_VAL(poscar_ux,"%lf"); + VASP_REG_VAL(poscar_uy,"%lf"); + VASP_REG_VAL(poscar_uz,"%lf"); + VASP_REG_VAL(poscar_vx,"%lf"); + VASP_REG_VAL(poscar_vy,"%lf"); + VASP_REG_VAL(poscar_vz,"%lf"); + VASP_REG_VAL(poscar_wx,"%lf"); + VASP_REG_VAL(poscar_wy,"%lf"); + VASP_REG_VAL(poscar_wz,"%lf"); ux=vasp_gui.calc.poscar_ux*vasp_gui.calc.poscar_a0; uy=vasp_gui.calc.poscar_uy*vasp_gui.calc.poscar_a0; uz=vasp_gui.calc.poscar_uz*vasp_gui.calc.poscar_a0; @@ -1437,12 +1648,13 @@ void toggle_poscar_direct(){ wy=vasp_gui.calc.poscar_wy*vasp_gui.calc.poscar_a0; wz=vasp_gui.calc.poscar_wz*vasp_gui.calc.poscar_a0; /**/ - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); - while(g_ascii_strcasecmp(text,"ADD atom")!=0){ - /*get each line*/ + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,idx); + GUI_COMBOBOX_GET_TEXT(vasp_gui.poscar_atoms,text); + while(g_ascii_strcasecmp(text,"ADD atom")!=0){ + /*get each line*/ tamp=g_strdup(text);/*to get enough space*/ sscanf(text,"%lf %lf %lf %[^\n]",&x,&y,&z,tamp); + g_free(text); /*convert*/ if(vasp_gui.calc.poscar_direct){ /*was cartesian, now changed to direct*/ @@ -1456,37 +1668,47 @@ void toggle_poscar_direct(){ z=z*(uz+vz+wz); } /*rewrite data*/ - gtk_combo_box_insert_text(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx,g_strdup_printf("%.8lf %.8lf %.8lf %s",x,y,z,tamp)); - gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms),idx+1); + text=g_strdup_printf("%.8lf %.8lf %.8lf %s",x,y,z,tamp); + GUI_COMBOBOX_ADD_TEXT(vasp_gui.poscar_atoms,idx,text); + GUI_COMBOBOX_DEL(vasp_gui.poscar_atoms,idx+1); g_free(tamp); + g_free(text); idx++; /*get new line*/ - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,idx); + GUI_COMBOBOX_GET_TEXT(vasp_gui.poscar_atoms,text); } - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),index);/*PULL*/ + g_free(text);/*free "ADD atom" string*/ + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,index);/*PULL*/ } /*************************/ /* selecting poscar atom */ /*************************/ -void vasp_poscar_atoms_selected(GtkWidget *w, struct model_pak *model){ - /* using combobox*/ - gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); - gchar *text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(w)); +void vasp_poscar_atoms_selected(GUI_OBJ *w){ + gint index; + gchar *text; gdouble x,y,z; gchar tx,ty,tz; gchar symbol[3]; - gtk_entry_set_text(GTK_ENTRY(vasp_gui.poscar_index),g_strdup_printf("%i",index)); + GUI_COMBOBOX_GET(w,index); + text=g_strdup_printf("%i",index); + GUI_ENTRY_TEXT(vasp_gui.poscar_index,text); + g_free(text); + GUI_COMBOBOX_GET_TEXT(w,text); if (g_ascii_strcasecmp(text,"ADD atom") == 0) { /*allow symbol*/ - gtk_widget_set_sensitive(vasp_gui.poscar_symbol,TRUE); + GUI_UNLOCK(vasp_gui.poscar_symbol); }else{ /*populate atom properties*/ sscanf(text,"%lf %lf %lf %c %c %c ! atom: %*i (%[^)])",&x,&y,&z,&tx,&ty,&tz,&(symbol[0])); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.poscar_symbol),g_strdup_printf("%s",symbol)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.poscar_x),g_strdup_printf("%.6lf",x)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.poscar_y),g_strdup_printf("%.6lf",y)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.poscar_z),g_strdup_printf("%.6lf",z)); + g_free(text);text=g_strdup_printf("%s",symbol); + GUI_ENTRY_TEXT(vasp_gui.poscar_symbol,text); + g_free(text);text=g_strdup_printf("%.6lf",x); + GUI_ENTRY_TEXT(vasp_gui.poscar_x,text); + g_free(text);text=g_strdup_printf("%.6lf",y); + GUI_ENTRY_TEXT(vasp_gui.poscar_y,text); + g_free(text);text=g_strdup_printf("%.6lf",z); + GUI_ENTRY_TEXT(vasp_gui.poscar_z,text); /* register all that */ vasp_gui.calc.poscar_index=index; vasp_gui.calc.poscar_x=x; @@ -1496,35 +1718,43 @@ void vasp_poscar_atoms_selected(GtkWidget *w, struct model_pak *model){ vasp_gui.calc.poscar_ty=(ty=='T'); vasp_gui.calc.poscar_tz=(tz=='T'); /* disallow symbol */ - gtk_widget_set_sensitive(vasp_gui.poscar_symbol,FALSE); + GUI_LOCK(vasp_gui.poscar_symbol); } + g_free(text); /* set tags sensitivity */ - gtk_widget_set_sensitive(vasp_gui.poscar_tx,(vasp_gui.calc.poscar_free==VPF_MAN)); - gtk_widget_set_sensitive(vasp_gui.poscar_ty,(vasp_gui.calc.poscar_free==VPF_MAN)); - gtk_widget_set_sensitive(vasp_gui.poscar_tz,(vasp_gui.calc.poscar_free==VPF_MAN)); + if(vasp_gui.calc.poscar_free==VPF_MAN){ + GUI_UNLOCK(vasp_gui.poscar_tx); + GUI_UNLOCK(vasp_gui.poscar_ty); + GUI_UNLOCK(vasp_gui.poscar_tz); + }else{ + GUI_LOCK(vasp_gui.poscar_tx); + GUI_LOCK(vasp_gui.poscar_ty); + GUI_LOCK(vasp_gui.poscar_tz); + } /* (re)set tags value! */ - if(vasp_gui.calc.poscar_tx) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.poscar_tx),TRUE); - else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.poscar_tx),FALSE); - if(vasp_gui.calc.poscar_ty) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.poscar_ty),TRUE); - else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.poscar_ty),FALSE); - if(vasp_gui.calc.poscar_tz) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.poscar_tz),TRUE); - else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.poscar_tz),FALSE); + if(vasp_gui.calc.poscar_tx) GUI_TOGGLE_ON(vasp_gui.poscar_tx); + else GUI_TOGGLE_OFF(vasp_gui.poscar_tx); + if(vasp_gui.calc.poscar_ty) GUI_TOGGLE_ON(vasp_gui.poscar_ty); + else GUI_TOGGLE_OFF(vasp_gui.poscar_ty); + if(vasp_gui.calc.poscar_tz) GUI_TOGGLE_ON(vasp_gui.poscar_tz); + else GUI_TOGGLE_OFF(vasp_gui.poscar_tz); } /**************************/ /* modify/add poscar atom */ /**************************/ void vasp_atom_modified(){ - gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms)); - gchar *text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); - gchar *tamp; + gint index; + gchar *text; gchar tx,ty,tz; - /*mini-sync*/ + GUI_COMBOBOX_GET(vasp_gui.poscar_atoms,index);/*PUSH*/ VASP_REG_VAL(poscar_index,"%i"); VASP_REG_VAL(poscar_x,"%lf"); VASP_REG_VAL(poscar_y,"%lf"); VASP_REG_VAL(poscar_z,"%lf"); - sprintf(vasp_gui.calc.poscar_symbol,"%s",gtk_entry_get_text(GTK_ENTRY(vasp_gui.poscar_symbol))); + GUI_ENTRY_GET_TEXT(vasp_gui.poscar_symbol,text); + sprintf(vasp_gui.calc.poscar_symbol,"%s",text); + g_free(text); tx='F'; ty='F'; tz='F'; @@ -1542,177 +1772,229 @@ void vasp_atom_modified(){ break; } /* add/modify */ + GUI_COMBOBOX_GET_TEXT(vasp_gui.poscar_atoms,text); if(g_ascii_strcasecmp(text,"ADD atom") == 0){ /*we are going to insert some data*/ - gtk_combo_box_insert_text(GTK_COMBO_BOX(vasp_gui.poscar_atoms),index, - g_strdup_printf("%.8lf %.8lf %.8lf %c %c %c ! atom: %i (%s)", - vasp_gui.calc.poscar_x,vasp_gui.calc.poscar_y,vasp_gui.calc.poscar_z,tx,ty,tz,index,vasp_gui.calc.poscar_symbol)); + g_free(text); + text=g_strdup_printf("%.8lf %.8lf %.8lf %c %c %c ! atom: %i (%s)", + vasp_gui.calc.poscar_x,vasp_gui.calc.poscar_y,vasp_gui.calc.poscar_z,tx,ty,tz,index,vasp_gui.calc.poscar_symbol); + GUI_COMBOBOX_ADD_TEXT(vasp_gui.poscar_atoms,index,text); }else{ /*we are goign to modify some data*/ - gtk_combo_box_insert_text(GTK_COMBO_BOX(vasp_gui.poscar_atoms),index, - g_strdup_printf("%.8lf %.8lf %.8lf %c %c %c ! atom: %i (%s)", - vasp_gui.calc.poscar_x,vasp_gui.calc.poscar_y,vasp_gui.calc.poscar_z,tx,ty,tz,index,vasp_gui.calc.poscar_symbol)); - /* Note: GTK 3.0 has gtk_combo_box_text_insert */ - gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms),index+1); + g_free(text); + text=g_strdup_printf("%.8lf %.8lf %.8lf %c %c %c ! atom: %i (%s)", + vasp_gui.calc.poscar_x,vasp_gui.calc.poscar_y,vasp_gui.calc.poscar_z,tx,ty,tz,index,vasp_gui.calc.poscar_symbol); + GUI_COMBOBOX_ADD_TEXT(vasp_gui.poscar_atoms,index,text); + GUI_COMBOBOX_DEL(vasp_gui.poscar_atoms,index+1); } + g_free(text); /*re-select current entry (to refresh content)*/ - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),index); + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,index);/*PULL*/ vasp_gui.poscar_dirty=TRUE; } /**********************/ /* delete poscar atom */ /**********************/ void vasp_atom_delete(){ - gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms)); - gchar *text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); - if(g_ascii_strcasecmp(text,"ADD atom") == 0) return;/*can't delete this one*/ - if(index==-1) return;/*nothing selected anyway*/ - gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms),index); - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),index-1); + gint index; + gchar *text; + GUI_COMBOBOX_GET(vasp_gui.poscar_atoms,index); + if(index==-1) { + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,0); + return;/*nothing selected anyway*/ + } + GUI_COMBOBOX_GET_TEXT(vasp_gui.poscar_atoms,text); + if(g_ascii_strcasecmp(text,"ADD atom") == 0) { + g_free(text); + return;/*can't delete this one*/ + } + GUI_COMBOBOX_DEL(vasp_gui.poscar_atoms,index); + if(index-1<0) index=1; + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,index-1); + g_free(text); vasp_gui.poscar_dirty=TRUE; } /**************************/ /* selecting kpoints_mode */ /**************************/ -void vasp_kpoints_mode_selected(GtkWidget *w, struct model_pak *model){ - const gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); - gtk_widget_set_sensitive(vasp_gui.kpoints_w,FALSE); - gtk_widget_set_sensitive(vasp_gui.kpoints_cart,FALSE); - gtk_widget_set_sensitive(vasp_gui.kpoints_tetra,FALSE); - gtk_widget_set_sensitive(vasp_gui.have_tetra,FALSE); - gtk_widget_set_sensitive(vasp_gui.kpoints_coord,FALSE); - gtk_widget_set_sensitive(vasp_gui.kpoints_kx,FALSE); - gtk_widget_set_sensitive(vasp_gui.kpoints_ky,FALSE); - gtk_widget_set_sensitive(vasp_gui.kpoints_kz,FALSE); - gtk_widget_set_sensitive(vasp_gui.kpoints_sx,FALSE); - gtk_widget_set_sensitive(vasp_gui.kpoints_sy,FALSE); - gtk_widget_set_sensitive(vasp_gui.kpoints_sz,FALSE); +void vasp_kpoints_mode_selected(GUI_OBJ *w){ + gint index; + gchar *text; + GUI_COMBOBOX_GET(w,index); + GUI_LOCK(vasp_gui.kpoints_w); + GUI_LOCK(vasp_gui.kpoints_cart); + GUI_LOCK(vasp_gui.kpoints_tetra); + GUI_LOCK(vasp_gui.have_tetra); + GUI_LOCK(vasp_gui.kpoints_coord); + GUI_LOCK(vasp_gui.kpoints_kx); + GUI_LOCK(vasp_gui.kpoints_ky); + GUI_LOCK(vasp_gui.kpoints_kz); + GUI_LOCK(vasp_gui.kpoints_sx); + GUI_LOCK(vasp_gui.kpoints_sy); + GUI_LOCK(vasp_gui.kpoints_sz); switch(index){ case 0://Manual Entry vasp_gui.calc.kpoints_mode=VKP_MAN; - gtk_widget_set_sensitive(vasp_gui.kpoints_w,TRUE); - gtk_widget_set_sensitive(vasp_gui.kpoints_coord,TRUE);//need coord - gtk_widget_set_sensitive(vasp_gui.kpoints_nkpts,TRUE);//need nkpts - gtk_widget_set_sensitive(vasp_gui.kpoints_cart,TRUE);//can be cart - if(vasp_gui.calc.ismear==-5) gtk_widget_set_sensitive(vasp_gui.kpoints_tetra,TRUE);//only VKP_MAN require tetra - if(vasp_gui.calc.ismear==-5) gtk_widget_set_sensitive(vasp_gui.have_tetra,TRUE);//and only if ISMEAR=-5 + GUI_UNLOCK(vasp_gui.kpoints_w); + GUI_UNLOCK(vasp_gui.kpoints_coord); + GUI_UNLOCK(vasp_gui.kpoints_nkpts); + GUI_UNLOCK(vasp_gui.kpoints_cart); + if(vasp_gui.calc.ismear==-5) { + GUI_UNLOCK(vasp_gui.kpoints_tetra); + GUI_UNLOCK(vasp_gui.have_tetra); + } break; case 1://Line Mode vasp_gui.calc.kpoints_mode=VKP_LINE; - gtk_widget_set_sensitive(vasp_gui.kpoints_coord,TRUE);//need coord - gtk_widget_set_sensitive(vasp_gui.kpoints_nkpts,TRUE);//need nkpts - gtk_widget_set_sensitive(vasp_gui.kpoints_cart,TRUE);//can be cart + GUI_UNLOCK(vasp_gui.kpoints_coord); + GUI_UNLOCK(vasp_gui.kpoints_nkpts); + GUI_UNLOCK(vasp_gui.kpoints_cart); break; case 3://Gamma (M&P) vasp_gui.calc.kpoints_mode=VKP_GAMMA; - gtk_widget_set_sensitive(vasp_gui.kpoints_kx,TRUE);//require kx - gtk_widget_set_sensitive(vasp_gui.kpoints_ky,TRUE);//require ky - gtk_widget_set_sensitive(vasp_gui.kpoints_kz,TRUE);//require kz - gtk_widget_set_sensitive(vasp_gui.kpoints_sx,TRUE);//require sx - gtk_widget_set_sensitive(vasp_gui.kpoints_sy,TRUE);//require sy - gtk_widget_set_sensitive(vasp_gui.kpoints_sz,TRUE);//require sz + GUI_UNLOCK(vasp_gui.kpoints_kx); + GUI_UNLOCK(vasp_gui.kpoints_ky); + GUI_UNLOCK(vasp_gui.kpoints_kz); + GUI_UNLOCK(vasp_gui.kpoints_sx); + GUI_UNLOCK(vasp_gui.kpoints_sy); + GUI_UNLOCK(vasp_gui.kpoints_sz); vasp_gui.calc.kpoints_nkpts=0; - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_nkpts),g_strdup_printf("%i",vasp_gui.calc.kpoints_nkpts)); - gtk_widget_set_sensitive(vasp_gui.kpoints_nkpts,FALSE);//NKPTS is 0 and disable + text=g_strdup_printf("%i",vasp_gui.calc.kpoints_nkpts); + GUI_ENTRY_TEXT(vasp_gui.kpoints_nkpts,text); + g_free(text); + GUI_LOCK(vasp_gui.kpoints_nkpts); break; case 4://Monkhorst-Pack classic vasp_gui.calc.kpoints_mode=VKP_MP; - gtk_widget_set_sensitive(vasp_gui.kpoints_kx,TRUE);//require kx - gtk_widget_set_sensitive(vasp_gui.kpoints_ky,TRUE);//require ky - gtk_widget_set_sensitive(vasp_gui.kpoints_kz,TRUE);//require kz - gtk_widget_set_sensitive(vasp_gui.kpoints_sx,TRUE);//require sx - gtk_widget_set_sensitive(vasp_gui.kpoints_sy,TRUE);//require sy - gtk_widget_set_sensitive(vasp_gui.kpoints_sz,TRUE);//require sz + GUI_UNLOCK(vasp_gui.kpoints_kx); + GUI_UNLOCK(vasp_gui.kpoints_ky); + GUI_UNLOCK(vasp_gui.kpoints_kz); + GUI_UNLOCK(vasp_gui.kpoints_sx); + GUI_UNLOCK(vasp_gui.kpoints_sy); + GUI_UNLOCK(vasp_gui.kpoints_sz); vasp_gui.calc.kpoints_nkpts=0; - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_nkpts),g_strdup_printf("%i",vasp_gui.calc.kpoints_nkpts)); - gtk_widget_set_sensitive(vasp_gui.kpoints_nkpts,FALSE);//NKPTS is 0 and disable + text=g_strdup_printf("%i",vasp_gui.calc.kpoints_nkpts); + GUI_ENTRY_TEXT(vasp_gui.kpoints_nkpts,text); + g_free(text); + GUI_LOCK(vasp_gui.kpoints_nkpts); break; case 5://Basis set definition vasp_gui.calc.kpoints_mode=VKP_BASIS; - gtk_widget_set_sensitive(vasp_gui.kpoints_coord,TRUE);//need coord - gtk_widget_set_sensitive(vasp_gui.kpoints_nkpts,TRUE);//need nkpts - gtk_widget_set_sensitive(vasp_gui.kpoints_cart,TRUE);//can be cart + GUI_UNLOCK(vasp_gui.kpoints_coord); + GUI_UNLOCK(vasp_gui.kpoints_nkpts); + GUI_UNLOCK(vasp_gui.kpoints_cart); break; case 2://Automatic (M&P) default: vasp_gui.calc.kpoints_mode=VKP_AUTO; - gtk_widget_set_sensitive(vasp_gui.kpoints_kx,TRUE);//AUTO only require kx + GUI_UNLOCK(vasp_gui.kpoints_kx); vasp_gui.calc.kpoints_nkpts=0; - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_nkpts),g_strdup_printf("%i",vasp_gui.calc.kpoints_nkpts)); - gtk_widget_set_sensitive(vasp_gui.kpoints_nkpts,FALSE);//NKPTS is 0 and disable + text=g_strdup_printf("%i",vasp_gui.calc.kpoints_nkpts); + GUI_ENTRY_TEXT(vasp_gui.kpoints_nkpts,text); + g_free(text); + GUI_LOCK(vasp_gui.kpoints_nkpts); } } /**********************/ /* selecting a kpoint */ /**********************/ -void vasp_kpoints_kpts_selected(GtkWidget *w, struct model_pak *model){ - /* using combobox*/ - gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); - gchar *text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(w)); - gdouble x,y,z,wt; - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_i),g_strdup_printf("%i",index+1)); +void vasp_kpoints_kpts_selected(GUI_OBJ *w){ + gint index; + gchar *text; + gdouble x,y,z,wt; + /**/ + GUI_COMBOBOX_GET(w,index); + text=g_strdup_printf("%i",index+1); + GUI_ENTRY_TEXT(vasp_gui.kpoints_i,text); + g_free(text); + GUI_COMBOBOX_GET_TEXT(w,text); if (g_ascii_strcasecmp(text,"ADD kpoint") == 0) { - /*no need to update anything but index*/ + /*no need to update anything but index*/ } else { /*update index,x,y,z,w*/ wt=0.0; if(vasp_gui.calc.kpoints_mode==VKP_LINE) sscanf(text,"%lf %lf %lf ! kpoint: %*i",&x,&y,&z); else sscanf(text,"%lf %lf %lf %lf ! kpoint: %*i",&x,&y,&z,&wt); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_x),g_strdup_printf("%.8lf",x)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_y),g_strdup_printf("%.8lf",y)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_z),g_strdup_printf("%.8lf",z)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kpoints_w),g_strdup_printf("%.8lf",wt)); + g_free(text);text=g_strdup_printf("%.8lf",x); + GUI_ENTRY_TEXT(vasp_gui.kpoints_x,text); + g_free(text);text=g_strdup_printf("%.8lf",y); + GUI_ENTRY_TEXT(vasp_gui.kpoints_y,text); + g_free(text);text=g_strdup_printf("%.8lf",z); + GUI_ENTRY_TEXT(vasp_gui.kpoints_z,text); + g_free(text);text=g_strdup_printf("%.8lf",wt); + GUI_ENTRY_TEXT(vasp_gui.kpoints_w,text); } + g_free(text); } /*********************/ /* Add/modify kpoint */ /*********************/ void vasp_kpoint_modified(){ - gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.kpoints_kpts)); - gchar *text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.kpoints_kpts)); - gchar *tamp; - /*mini-sync*/ - VASP_REG_VAL(kpoints_i,"%i"); - VASP_REG_VAL(kpoints_x,"%lf"); - VASP_REG_VAL(kpoints_y,"%lf"); - VASP_REG_VAL(kpoints_z,"%lf"); + gint index; + gchar *text; + /*mini-sync*/ + GUI_COMBOBOX_GET(vasp_gui.kpoints_kpts,index);/*PUSH*/ + GUI_COMBOBOX_GET_TEXT(vasp_gui.kpoints_kpts,text); + VASP_REG_VAL(kpoints_i,"%i"); + VASP_REG_VAL(kpoints_x,"%lf"); + VASP_REG_VAL(kpoints_y,"%lf"); + VASP_REG_VAL(kpoints_z,"%lf"); VASP_REG_VAL(kpoints_w,"%lf"); - /* add/modify */ - if(g_ascii_strcasecmp(text,"ADD kpoint") == 0){ - /*we are going to insert some data*/ - if(vasp_gui.calc.kpoints_mode==VKP_LINE) - gtk_combo_box_insert_text(GTK_COMBO_BOX(vasp_gui.kpoints_kpts),index, - g_strdup_printf("%.8lf %.8lf %.8lf ! kpoint: %i", - vasp_gui.calc.kpoints_x,vasp_gui.calc.kpoints_y,vasp_gui.calc.kpoints_z,index+1)); - else - gtk_combo_box_insert_text(GTK_COMBO_BOX(vasp_gui.kpoints_kpts),index, - g_strdup_printf("%.8lf %.8lf %.8lf %.8lf ! kpoint: %i", - vasp_gui.calc.kpoints_x,vasp_gui.calc.kpoints_y,vasp_gui.calc.kpoints_z,vasp_gui.calc.kpoints_w,index+1)); - }else{ - /*we are goign to modify some data*/ - if(vasp_gui.calc.kpoints_mode==VKP_LINE) - gtk_combo_box_insert_text(GTK_COMBO_BOX(vasp_gui.kpoints_kpts),index, - g_strdup_printf("%.8lf %.8lf %.8lf ! kpoint: %i", - vasp_gui.calc.kpoints_x,vasp_gui.calc.kpoints_y,vasp_gui.calc.kpoints_z,index+1)); - else - gtk_combo_box_insert_text(GTK_COMBO_BOX(vasp_gui.kpoints_kpts),index, - g_strdup_printf("%.8lf %.8lf %.8lf %.8lf ! kpoint: %i", - vasp_gui.calc.kpoints_x,vasp_gui.calc.kpoints_y,vasp_gui.calc.kpoints_z,vasp_gui.calc.kpoints_w,index+1)); - gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(vasp_gui.kpoints_kpts),index+1); - } - /*re-select current entry (to refresh content)*/ - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.kpoints_kpts),index); + /* add/modify */ + if(g_ascii_strcasecmp(text,"ADD kpoint") == 0){ + g_free(text); + /*we are going to insert some data*/ + if(vasp_gui.calc.kpoints_mode==VKP_LINE){ + text=g_strdup_printf("%.8lf %.8lf %.8lf ! kpoint: %i", + vasp_gui.calc.kpoints_x,vasp_gui.calc.kpoints_y,vasp_gui.calc.kpoints_z,index+1); + GUI_COMBOBOX_ADD_TEXT(vasp_gui.kpoints_kpts,index,text); + g_free(text); + }else{ + text=g_strdup_printf("%.8lf %.8lf %.8lf %.8lf ! kpoint: %i", + vasp_gui.calc.kpoints_x,vasp_gui.calc.kpoints_y,vasp_gui.calc.kpoints_z,vasp_gui.calc.kpoints_w,index+1); + GUI_COMBOBOX_ADD_TEXT(vasp_gui.kpoints_kpts,index,text); + g_free(text); + } + }else{ + g_free(text); + /*we are goign to modify some data*/ + if(vasp_gui.calc.kpoints_mode==VKP_LINE){ + text=g_strdup_printf("%.8lf %.8lf %.8lf ! kpoint: %i", + vasp_gui.calc.kpoints_x,vasp_gui.calc.kpoints_y,vasp_gui.calc.kpoints_z,index+1); + GUI_COMBOBOX_ADD_TEXT(vasp_gui.kpoints_kpts,index,text); + g_free(text); + }else{ + text=g_strdup_printf("%.8lf %.8lf %.8lf %.8lf ! kpoint: %i", + vasp_gui.calc.kpoints_x,vasp_gui.calc.kpoints_y,vasp_gui.calc.kpoints_z,vasp_gui.calc.kpoints_w,index+1); + GUI_COMBOBOX_ADD_TEXT(vasp_gui.kpoints_kpts,index,text); + g_free(text); + } + GUI_COMBOBOX_DEL(vasp_gui.kpoints_kpts,index+1); + + } + /*re-select current entry (to refresh content)*/ + GUI_COMBOBOX_SET(vasp_gui.kpoints_kpts,index);/*PULL*/ } /******************/ /* deleted kpoint */ /******************/ void vasp_kpoint_delete(){ - gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.kpoints_kpts)); - gchar *text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.kpoints_kpts)); - if(g_ascii_strcasecmp(text,"ADD kpoint") == 0) return;/*can't delete this one*/ - if(index==-1) return;/*nothing selected anyway*/ - gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(vasp_gui.kpoints_kpts),index); - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.kpoints_kpts),index-1); + gint index; + gchar *text; + GUI_COMBOBOX_GET(vasp_gui.kpoints_kpts,index); + if(index==-1) { + GUI_COMBOBOX_SET(vasp_gui.kpoints_kpts,0); + return;/*nothing selected anyway*/ + } + GUI_COMBOBOX_GET_TEXT(vasp_gui.kpoints_kpts,text); + if(g_ascii_strcasecmp(text,"ADD kpoint") == 0) { + g_free(text); + return;/*can't delete this one*/ + } + g_free(text); + GUI_COMBOBOX_DEL(vasp_gui.kpoints_kpts,index); + if(index-1<0) index=1; + GUI_COMBOBOX_SET(vasp_gui.kpoints_kpts,index-1); } /****************/ /* tetra toggle */ @@ -1721,71 +2003,93 @@ void toogle_tetra(){ /*enable/disable tetrahedron*/ if(vasp_gui.calc.ismear!=-5) vasp_gui.calc.kpoints_tetra=FALSE;/*ISMEAR=-5 required*/ if(vasp_gui.calc.kpoints_mode!=VKP_MAN) vasp_gui.calc.kpoints_tetra=FALSE;/*manual generation must be selected*/ - if(vasp_gui.calc.kpoints_tetra==FALSE) gtk_widget_set_sensitive(vasp_gui.kpoints_tetra,FALSE); - else gtk_widget_set_sensitive(vasp_gui.kpoints_tetra,TRUE); + if(vasp_gui.calc.kpoints_tetra==FALSE) GUI_LOCK(vasp_gui.kpoints_tetra); + else GUI_UNLOCK(vasp_gui.kpoints_tetra); } /*************************/ /* selecting tetrahedron */ /*************************/ -void vasp_tetra_selected(GtkWidget *w, struct model_pak *model){ - /* using combobox*/ - gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(w)); - gchar *text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(w)); +void vasp_tetra_selected(GUI_OBJ *w){ + gint index; + gchar *text; gdouble wt; gint a,b,c,d; + /**/ + GUI_COMBOBOX_GET(w,index); + GUI_COMBOBOX_GET_TEXT(w,text); if (g_ascii_strcasecmp(text,"ADD tetrahedron") == 0) { /*no need to update anything*/ } else { sscanf(text,"%lf %i %i %i %i ! tetrahedron: %*i",&wt,&a,&b,&c,&d); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.tetra_i),g_strdup_printf("%i",index)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.tetra_w),g_strdup_printf("%.4lf",wt)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.tetra_a),g_strdup_printf("%i",a)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.tetra_b),g_strdup_printf("%i",b)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.tetra_c),g_strdup_printf("%i",c)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.tetra_d),g_strdup_printf("%i",d)); + g_free(text);text=g_strdup_printf("%i",index); + GUI_ENTRY_TEXT(vasp_gui.tetra_i,text); + g_free(text);text=g_strdup_printf("%.4lf",wt); + GUI_ENTRY_TEXT(vasp_gui.tetra_w,text); + g_free(text);text=g_strdup_printf("%i",a); + GUI_ENTRY_TEXT(vasp_gui.tetra_a,text); + g_free(text);text=g_strdup_printf("%i",b); + GUI_ENTRY_TEXT(vasp_gui.tetra_b,text); + g_free(text);text=g_strdup_printf("%i",c); + GUI_ENTRY_TEXT(vasp_gui.tetra_c,text); + g_free(text);text=g_strdup_printf("%i",d); + GUI_ENTRY_TEXT(vasp_gui.tetra_d,text); } + g_free(text); } /**************************/ /* Add/modify tetrahedron */ /**************************/ void vasp_tetra_modified(){ - gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.tetra)); - gchar *text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.tetra)); - gchar *tamp; - - /*mini-sync*/ - VASP_REG_VAL(tetra_i,"%i"); - VASP_REG_VAL(tetra_w,"%lf"); + gint index; + gchar *text; + /*mini-sync*/ + GUI_COMBOBOX_GET(vasp_gui.tetra,index); + GUI_COMBOBOX_GET_TEXT(vasp_gui.tetra,text); + VASP_REG_VAL(tetra_i,"%i"); + VASP_REG_VAL(tetra_w,"%lf"); VASP_REG_VAL(tetra_a,"%i"); - VASP_REG_VAL(tetra_b,"%i"); - VASP_REG_VAL(tetra_c,"%i"); - VASP_REG_VAL(tetra_d,"%i"); - /* add/modify */ - if(g_ascii_strcasecmp(text,"ADD tetrahedron") == 0){ - /*we are going to insert some data*/ - gtk_combo_box_insert_text(GTK_COMBO_BOX(vasp_gui.tetra),index, - g_strdup_printf("%lf %i %i %i %i ! tetrahedron: %i", - vasp_gui.calc.tetra_w,vasp_gui.calc.tetra_a,vasp_gui.calc.tetra_b,vasp_gui.calc.tetra_c,vasp_gui.calc.tetra_d,index)); - }else{ - /*we are goign to modify some data*/ - gtk_combo_box_insert_text(GTK_COMBO_BOX(vasp_gui.tetra),index, - g_strdup_printf("%lf %i %i %i %i ! tetrahedron: %i", - vasp_gui.calc.tetra_w,vasp_gui.calc.tetra_a,vasp_gui.calc.tetra_b,vasp_gui.calc.tetra_c,vasp_gui.calc.tetra_d,index)); - gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(vasp_gui.tetra),index+1); - } - /*re-select current entry (to refresh content)*/ - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.tetra),index); + VASP_REG_VAL(tetra_b,"%i"); + VASP_REG_VAL(tetra_c,"%i"); + VASP_REG_VAL(tetra_d,"%i"); + /* add/modify */ + if(g_ascii_strcasecmp(text,"ADD tetrahedron") == 0){ + /*we are going to insert some data*/ + g_free(text); + text=g_strdup_printf("%lf %i %i %i %i ! tetrahedron: %i", + vasp_gui.calc.tetra_w,vasp_gui.calc.tetra_a,vasp_gui.calc.tetra_b,vasp_gui.calc.tetra_c,vasp_gui.calc.tetra_d,index); + GUI_COMBOBOX_ADD_TEXT(vasp_gui.tetra,index,text); + }else{ + /*we are goign to modify some data*/ + g_free(text); + text=g_strdup_printf("%lf %i %i %i %i ! tetrahedron: %i", + vasp_gui.calc.tetra_w,vasp_gui.calc.tetra_a,vasp_gui.calc.tetra_b,vasp_gui.calc.tetra_c,vasp_gui.calc.tetra_d,index); + GUI_COMBOBOX_ADD_TEXT(vasp_gui.tetra,index,text); + GUI_COMBOBOX_DEL(vasp_gui.tetra,index+1); + } + g_free(text); + /*re-select current entry (to refresh content)*/ + GUI_COMBOBOX_SET(vasp_gui.tetra,index); } /**********************/ /* delete tetrahedron */ /**********************/ void vasp_tetra_delete(){ - gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.tetra)); - gchar *text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.tetra)); - if(g_ascii_strcasecmp(text,"ADD tetrahedron") == 0) return;/*can't delete this one*/ - if(index==-1) return;/*nothing selected anyway*/ - gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(vasp_gui.tetra),index); - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.tetra),index-1); + gint index; + gchar *text; + GUI_COMBOBOX_GET(vasp_gui.tetra,index); + if(index==-1) { + GUI_COMBOBOX_SET(vasp_gui.tetra,0); + return;/*nothing selected anyway*/ + } + GUI_COMBOBOX_GET_TEXT(vasp_gui.tetra,text); + if(g_ascii_strcasecmp(text,"ADD tetrahedron") == 0) { + g_free(text); + return;/*can't delete this one*/ + } + g_free(text); + GUI_COMBOBOX_DEL(vasp_gui.tetra,index); + if(index-1<0) index=1; + GUI_COMBOBOX_SET(vasp_gui.tetra,index-1); } /****************************************************/ /* get species information (ie. symbol) from POTCAR */ @@ -1797,11 +2101,11 @@ void potcar_get_species(){ gchar sym[3]; /*the resulting species information should match that of POSCAR*/ fp=fopen(vasp_gui.calc.potcar_file,"r"); - if (!fp) { + if (!fp) { if(vasp_gui.calc.potcar_species!=NULL) g_free(vasp_gui.calc.potcar_species); vasp_gui.calc.potcar_species=NULL; - return; - } + return; + } /*file is opened*/ sym[2]='\0'; if(vasp_gui.calc.potcar_species!=NULL) g_free(vasp_gui.calc.potcar_species); @@ -1810,7 +2114,7 @@ void potcar_get_species(){ sscanf(line," %c%c%c%*s %*s",&(sym[0]),&(sym[1]),&(sym[2])); if((sym[0]=='P')&&(sym[1]=='A')&&(sym[2]=='W')) { vasp_gui.calc.have_paw=TRUE; - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.have_paw),TRUE); + GUI_TOGGLE_ON(vasp_gui.have_paw); } sym[2]='\0'; while(line){ @@ -1825,59 +2129,71 @@ void potcar_get_species(){ } fclose(fp); /*update vasp_gui.simple_species and vasp_gui.potcar_species*/ - gtk_entry_set_text(GTK_ENTRY(vasp_gui.simple_species),g_strdup_printf("%s",vasp_gui.calc.potcar_species)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.potcar_species),g_strdup_printf("%s",vasp_gui.calc.potcar_species)); + tamp=g_strdup_printf("%s",vasp_gui.calc.potcar_species); + GUI_ENTRY_TEXT(vasp_gui.simple_species,tamp); + g_free(tamp);tamp=g_strdup_printf("%s",vasp_gui.calc.potcar_species); + GUI_ENTRY_TEXT(vasp_gui.potcar_species,tamp); + g_free(tamp); } /************************************************************************/ /* point to a file where POTCAR information is stored for each elements */ /************************************************************************/ -void load_potcar_file_dialog(GtkButton *button, gpointer data){ - GtkWidget *file_chooser; - GtkFileFilter *filter; -/*set filter*/ - filter = gtk_file_filter_new(); - gtk_file_filter_add_pattern(filter, "*POTCAR"); - gtk_file_filter_set_name (filter,"POTCAR files"); - file_chooser = gtk_file_chooser_dialog_new("Select a POTCAR File",GTK_WINDOW(vasp_gui.window),GTK_FILE_CHOOSER_ACTION_OPEN,GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_OPEN,GTK_RESPONSE_ACCEPT,NULL); -gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(file_chooser),filter);/*apply filter*/ - if (gtk_dialog_run (GTK_DIALOG (file_chooser)) == GTK_RESPONSE_ACCEPT) - { - char *filename; - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser)); - if(filename) { - gtk_entry_set_text(GTK_ENTRY(vasp_gui.simple_potcar),g_strdup_printf("%s",filename)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.potcar_file),g_strdup_printf("%s",filename)); -/*dont forget to sync!!*/ - VASP_REG_TEXT(potcar_file); - g_free (filename); - potcar_get_species(); - } - } - gtk_widget_destroy (GTK_WIDGET(file_chooser)); +void load_potcar_file_dialog(void){ + GUI_OBJ *file_chooser; + gint have_answer; + char *filename; + gchar *text; + /**/ + GUI_PREPARE_OPEN_DIALOG(vasp_gui.window,file_chooser,"Select a POTCAR File","*POTCAR","POTCAR files"); + GUI_OPEN_DIALOG_RUN(file_chooser,have_answer,filename); + if(have_answer){ + /*there should be no case where have_answer==TRUE AND filename==NULL, but just in case.*/ + if(filename) { + text=g_strdup_printf("%s",filename); + GUI_ENTRY_TEXT(vasp_gui.simple_potcar,text); + g_free(text);text=g_strdup_printf("%s",filename); + GUI_ENTRY_TEXT(vasp_gui.potcar_file,text); + g_free(text); + VASP_REG_TEXT(potcar_file); + g_free (filename); + potcar_get_species(); + } + } + GUI_KILL_OPEN_DIALOG(file_chooser); } /*****************************************************/ /* register a specific pseudopotential for a species */ /*****************************************************/ -void apply_species_flavor(GtkButton *button, gpointer data){ - gchar *text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.species_flavor)); - gchar *symbol=g_strdup(text); - gchar *flavor=g_strdup(text); +void apply_species_flavor(void){ + gchar *text; + gchar *symbol; + gchar *flavor; gchar sym[3]; gint idx; gchar *result=NULL; + /**/ + GUI_COMBOBOX_GET_TEXT(vasp_gui.species_flavor,text); if(text==NULL) return;/*nothing selected*/ - if(text[0]=='\0') return;/*nothing selected*/ + symbol=g_strdup(text);/*prepare enough size*/ + flavor=g_strdup(text);/*prepare enough size*/ + if(text[0]=='\0') { + /*nothing selected*/ + goto flavor_end; + } sscanf(text,"%[^:]: %s",symbol,flavor); + g_free(text); text=g_strdup_printf("%s",vasp_gui.calc.potcar_species_flavor); g_free(vasp_gui.calc.potcar_species_flavor); sym[2]='\0'; + /*chemical symbol is at MAX 2 characters*/ if(g_ascii_islower(symbol[1])){/*2 letters*/ sscanf(symbol,"%c%c",&(sym[0]),&(sym[1])); idx=0; while((g_ascii_strncasecmp(&(text[idx]),sym,2)!=0)&&(text[idx]!='\0')) idx++; if(text[idx]=='\0'){ fprintf(stderr,"ERROR in setting POTCAR flavor.\n"); - return;/*this should never happen*/ + /*this should never happen*/ + goto flavor_end; } if(idx!=0) { text[idx]='\0'; @@ -1903,7 +2219,9 @@ void apply_species_flavor(GtkButton *button, gpointer data){ } if(text[idx]=='\0'){ fprintf(stderr,"ERROR in setting POTCAR flavor.\n"); - return;/*this should never happen*/ + /*this should never happen*/ + goto flavor_end; + } if(idx!=0) { text[idx]='\0'; @@ -1919,14 +2237,21 @@ void apply_species_flavor(GtkButton *button, gpointer data){ vasp_gui.calc.potcar_species_flavor=g_strdup_printf("%s%s",result,&(text[idx])); } } + g_free(text);text=g_strdup_printf("%s",vasp_gui.calc.potcar_species_flavor); + GUI_ENTRY_TEXT(vasp_gui.potcar_species_flavor,text); g_free(result); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.potcar_species_flavor),g_strdup_printf("%s",vasp_gui.calc.potcar_species_flavor)); +flavor_end: + g_free(text); + g_free(symbol); + g_free(flavor); + return; } /******************************************************/ /* register a species and a flavor from POTCAR FOLDER */ /******************************************************/ #define DEBUG_POTCAR_FOLDER 0 void potcar_folder_register(gchar *item){ + gchar *text; gchar elem[3]; elem[0]=item[0]; if(g_ascii_islower (item[1])) elem[1]=item[1]; @@ -1935,23 +2260,31 @@ void potcar_folder_register(gchar *item){ #if DEBUG_POTCAR_FOLDER fprintf(stdout,"#DBG: REG_ %s as %s \n",item,elem); #endif - VASP_COMBOBOX_ADD(vasp_gui.species_flavor,g_strdup_printf("%s: %s",elem,item)); + text=g_strdup_printf("%s: %s",elem,item); + GUI_COMBOBOX_ADD(vasp_gui.species_flavor,text); + g_free(text); } /**************************************/ /* get information from POTCAR folder */ /**************************************/ void potcar_folder_get_info(){ /*using POTCAR files, given they are not stored in a ZCOMPRESS format*/ - const gchar *path=gtk_entry_get_text(GTK_ENTRY(vasp_gui.potcar_folder)); - GSList *folders=file_dir_list(path,FALSE); + gchar *path; + GSList *folders; gchar *item; gchar sym[3]; + gchar *text; + /**/ + GUI_ENTRY_GET_TEXT(vasp_gui.potcar_folder,path); + folders=file_dir_list(path,FALSE); + g_free(path); + vasp_gui.poscar_dirty=TRUE;/*FIX _BUG_ when loading POTCAR folder *after* changing vasprun.xml*/ vasp_poscar_sync(); #if DEBUG_POTCAR_FOLDER fprintf(stdout,"#DBG: looking for %s\n",vasp_gui.calc.species_symbols); #endif /*wipe all entry in vasp_gui.species_flavor*/ - gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(vasp_gui.species_flavor)))); + GUI_COMBOBOX_WIPE(vasp_gui.species_flavor); sym[2]='\0'; for ( ; folders ; folders=g_slist_next(folders)){ item=g_strdup_printf("%s",(char *)folders->data); @@ -1978,61 +2311,72 @@ void potcar_folder_get_info(){ } g_free(item); } + /*FIXME: wipe before copy?*/ vasp_gui.calc.potcar_species=g_strdup(vasp_gui.calc.species_symbols);/*just copy is enough for now*/ vasp_gui.calc.potcar_species_flavor=g_strdup(vasp_gui.calc.species_symbols);/*same here*/ - gtk_entry_set_text(GTK_ENTRY(vasp_gui.simple_species),g_strdup_printf("%s",vasp_gui.calc.potcar_species)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.potcar_species),g_strdup_printf("%s",vasp_gui.calc.potcar_species)); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.potcar_species_flavor),g_strdup_printf("%s",vasp_gui.calc.potcar_species_flavor)); - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.species_flavor),0); + + text=g_strdup_printf("%s",vasp_gui.calc.potcar_species); + GUI_ENTRY_TEXT(vasp_gui.simple_species,text); + GUI_ENTRY_TEXT(vasp_gui.potcar_species,text); + g_free(text);text=g_strdup_printf("%s",vasp_gui.calc.potcar_species_flavor); + GUI_ENTRY_TEXT(vasp_gui.potcar_species_flavor,text); + g_free(text); + GUI_COMBOBOX_SET(vasp_gui.species_flavor,0); } /***************************************************************/ /* point to a folder where POTCAR are stored for each elements */ /***************************************************************/ -void load_potcar_folder_dialog(GtkButton *button, gpointer data){ - GtkWidget *file_chooser; -file_chooser=gtk_file_chooser_dialog_new("Select the POTCAR folder",GTK_WINDOW(vasp_gui.window),GTK_FILE_CHOOSER_ACTION_OPEN,GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_OPEN,GTK_RESPONSE_ACCEPT,NULL); - gtk_file_chooser_set_action (GTK_FILE_CHOOSER(file_chooser),GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); - if (gtk_dialog_run (GTK_DIALOG (file_chooser)) == GTK_RESPONSE_ACCEPT) - { - char *foldername = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (file_chooser)); - if(foldername) { - gtk_entry_set_text(GTK_ENTRY(vasp_gui.potcar_folder),g_strdup_printf("%s",foldername)); - if(vasp_gui.calc.potcar_folder!=NULL) g_free(vasp_gui.calc.potcar_folder); - vasp_gui.calc.potcar_folder=g_strdup_printf("%s",foldername); - g_free (foldername); - potcar_folder_get_info(); - } - } - gtk_widget_destroy (GTK_WIDGET(file_chooser)); +void load_potcar_folder_dialog(void){ + GUI_OBJ *file_chooser; + gint have_answer; + gchar *filename; + gchar *text; + /**/ + GUI_PREPARE_OPEN_FOLDER(vasp_gui.window,file_chooser,"Select the POTCAR folder"); + GUI_OPEN_DIALOG_RUN(file_chooser,have_answer,filename); + if(have_answer){ + /*there should be no case where have_answer==TRUE AND filename==NULL, but just in case.*/ + if(filename) { + text=g_strdup_printf("%s",filename); + GUI_ENTRY_TEXT(vasp_gui.potcar_folder,text); + g_free(text); + if(vasp_gui.calc.potcar_folder!=NULL) g_free(vasp_gui.calc.potcar_folder); + vasp_gui.calc.potcar_folder=g_strdup_printf("%s",filename); + g_free (filename); + /*sync before*/ + potcar_folder_get_info(); + } + } + GUI_KILL_OPEN_DIALOG(file_chooser); } /*************************************/ /* Select POTCAR information by file */ /*************************************/ -void toggle_potcar_file(GtkWidget *w, GtkWidget *box){ +void toggle_potcar_file(void){ vasp_gui.have_potcar_folder=FALSE; - gtk_widget_set_sensitive(vasp_gui.potcar_folder,FALSE); - gtk_widget_set_sensitive(vasp_gui.potcar_folder_button,FALSE); - gtk_widget_set_sensitive(vasp_gui.species_flavor,FALSE); - gtk_widget_set_sensitive(vasp_gui.species_button,FALSE); - gtk_widget_set_sensitive(vasp_gui.potcar_file,TRUE); - gtk_widget_set_sensitive(vasp_gui.potcar_file_button,TRUE); + GUI_LOCK(vasp_gui.potcar_folder); + GUI_LOCK(vasp_gui.potcar_folder_button); + GUI_LOCK(vasp_gui.species_flavor); + GUI_LOCK(vasp_gui.species_button); + GUI_UNLOCK(vasp_gui.potcar_file); + GUI_UNLOCK(vasp_gui.potcar_file_button); } /*************************************/ /* Select POTCAR information by path */ /*************************************/ -void toggle_potcar_folder(GtkWidget *w, GtkWidget *box){ +void toggle_potcar_folder(void){ vasp_gui.have_potcar_folder=TRUE; - gtk_widget_set_sensitive(vasp_gui.potcar_file,FALSE); - gtk_widget_set_sensitive(vasp_gui.potcar_file_button,FALSE); - gtk_widget_set_sensitive(vasp_gui.potcar_folder,TRUE); - gtk_widget_set_sensitive(vasp_gui.potcar_folder_button,TRUE); - gtk_widget_set_sensitive(vasp_gui.species_flavor,TRUE); - gtk_widget_set_sensitive(vasp_gui.species_button,TRUE); + GUI_LOCK(vasp_gui.potcar_file); + GUI_LOCK(vasp_gui.potcar_file_button); + GUI_UNLOCK(vasp_gui.potcar_folder); + GUI_UNLOCK(vasp_gui.potcar_folder_button); + GUI_UNLOCK(vasp_gui.species_flavor); + GUI_UNLOCK(vasp_gui.species_button); } /************************************************************************/ -/* tentative to equilibrate the NPAR,NCORE,KPAR with the number of CPUs */ +/* equilibrate NPAR,NCORE,KPAR with the number of CPUs */ /************************************************************************/ -void parallel_eq(GtkWidget *w, GtkWidget *box){ +void parallel_eq(void){ /*parallel equilibration*/ gint np,ncore,kpar; /* no need to sync */ @@ -2042,162 +2386,206 @@ void parallel_eq(GtkWidget *w, GtkWidget *box){ /*we have np CPU*/ if(np==1){ //NCORE=1 ; KPAR=1 - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.ncore),1.0); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.kpar),1.0); - gtk_spin_button_set_range(GTK_SPIN_BUTTON(vasp_gui.ncore),1.0,1.0); - gtk_spin_button_set_range(GTK_SPIN_BUTTON(vasp_gui.kpar),1.0,1.0); + GUI_SPIN_SET(vasp_gui.ncore,1.0); + GUI_SPIN_SET(vasp_gui.kpar,1.0); + GUI_SPIN_RANGE(vasp_gui.ncore,1.0,1.0); + GUI_SPIN_RANGE(vasp_gui.kpar,1.0,1.0); /*same for simplified interface*/ - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.simple_ncore),1.0); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.simple_kpar),1.0); - gtk_spin_button_set_range(GTK_SPIN_BUTTON(vasp_gui.simple_ncore),1.0,1.0); - gtk_spin_button_set_range(GTK_SPIN_BUTTON(vasp_gui.simple_kpar),1.0,1.0); + GUI_SPIN_SET(vasp_gui.simple_ncore,1.0); + GUI_SPIN_SET(vasp_gui.simple_kpar,1.0); + GUI_SPIN_RANGE(vasp_gui.simple_ncore,1.0,1.0); + GUI_SPIN_RANGE(vasp_gui.simple_kpar,1.0,1.0); return; } /* ncore should be [1,ncpu/kpar] */ - if(ncore>((gint)np/kpar)) gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.ncore),(gdouble)((gint)np/kpar)); - gtk_spin_button_set_range(GTK_SPIN_BUTTON(vasp_gui.ncore),1.0,(gdouble)((gint)np/kpar)); + if(ncore>((gint)np/kpar)) { + GUI_SPIN_SET(vasp_gui.ncore,(gdouble)((gint)np/kpar)); + GUI_SPIN_SET(vasp_gui.simple_ncore,(gdouble)((gint)np/kpar)); + } + GUI_SPIN_RANGE(vasp_gui.ncore,1.0,(gdouble)((gint)np/kpar)); + GUI_SPIN_RANGE(vasp_gui.simple_ncore,1.0,(gdouble)((gint)np/kpar)); /* kpar can be [1,ncpu] */ - gtk_spin_button_set_range(GTK_SPIN_BUTTON(vasp_gui.kpar),1.0,(gdouble)np); - /*same for the simplified interface*/ - if(ncore>((gint)np/kpar)) gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.simple_ncore),(gdouble)((gint)np/kpar)); - gtk_spin_button_set_range(GTK_SPIN_BUTTON(vasp_gui.simple_ncore),1.0,(gdouble)((gint)np/kpar)); - gtk_spin_button_set_range(GTK_SPIN_BUTTON(vasp_gui.simple_kpar),1.0,(gdouble)np); + GUI_SPIN_RANGE(vasp_gui.kpar,1.0,(gdouble)np); + GUI_SPIN_RANGE(vasp_gui.simple_kpar,1.0,(gdouble)np); } /***************************/ /* sync poscar information */ /***************************/ void vasp_poscar_sync(){ - gchar *tamp; - gchar *text; - gchar *text2; - gchar *tamp2; - gchar symbol[3]; - gint idx,jdx; - if(vasp_gui.poscar_dirty==FALSE) return;/*ne need to update*/ -/* pass_1: GROUP atom list by atom types */ - idx=0; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); - while(g_ascii_strcasecmp(text,"ADD atom")!=0){ - sscanf(text,"%*f %*f %*f %*c %*c %*c ! atom: %*i (%[^)])",&(vasp_gui.calc.poscar_symbol[0])); - jdx=0; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),jdx); - text2=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); - while(g_ascii_strcasecmp(text2,"ADD atom")!=0){ - /**/ - sscanf(text2,"%*f %*f %*f %*c %*c %*c ! atom: %*i (%[^)])",&(symbol[0])); - if(g_ascii_strcasecmp(vasp_gui.calc.poscar_symbol,symbol) == 0){ - gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms),jdx); - gtk_combo_box_text_prepend_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms),text2); - idx++; - } - jdx++; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),jdx); - text2=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); - } - idx++; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); - } -/* pass_2: REORDER atom list <- useful for 'consistent' ordering*/ - idx=0; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); - while(g_ascii_strcasecmp(text,"ADD atom")!=0){ - gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms),idx); - gtk_combo_box_text_prepend_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms),text); - idx++; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); - } -/* pass_3: SETUP unexposed properties (fix atom index)*/ - idx=0;jdx=0;vasp_gui.calc.electron_total=0; - vasp_gui.calc.species_total=1; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); - sscanf(text,"%*f %*f %*f %*c %*c %*c ! atom: %*i (%[^)])",&(vasp_gui.calc.poscar_symbol[0])); - tamp=g_strdup_printf(" %s",vasp_gui.calc.poscar_symbol); - tamp2=g_strdup_printf(" "); - while(g_ascii_strcasecmp(text,"ADD atom")!=0){ - /*get each line*/ - sscanf(text,"%*f %*f %*f %*c %*c %*c ! atom: %*i (%[^)])",&(symbol[0])); - text2=g_strdup(text);/*to get enough space*/ - sscanf(text,"%[^!]%*s",text2); - gtk_combo_box_insert_text(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx,g_strdup_printf("%s! atom: %i (%s)",text2,idx,symbol)); - gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms),idx+1); - g_free(text2); - vasp_gui.calc.electron_total+=elem_symbol_test(symbol); - if(g_ascii_strcasecmp(vasp_gui.calc.poscar_symbol,symbol) != 0) { - /*new species*/ - text=g_strdup_printf("%s %s",tamp,symbol); - g_free(tamp); - tamp=text; - text=g_strdup_printf("%s %i",tamp2,jdx); - g_free(tamp2); - tamp2=text; - vasp_gui.calc.species_total++; - sprintf(vasp_gui.calc.poscar_symbol,"%s",symbol); - jdx=0; - } - idx++; - jdx++; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); - } - vasp_gui.calc.atoms_total=idx;/*so we have the total number of atoms*/ - /*we need to get the last jdx*/ - text=g_strdup_printf("%s %i",tamp2,jdx); - g_free(tamp2); - tamp2=text; - if(vasp_gui.calc.species_symbols!=NULL) g_free(vasp_gui.calc.species_symbols); - if(vasp_gui.calc.species_numbers!=NULL) g_free(vasp_gui.calc.species_numbers); - vasp_gui.calc.species_symbols=g_strdup(tamp);g_free(tamp); - vasp_gui.calc.species_numbers=g_strdup(tamp2);g_free(tamp2); - vasp_gui.poscar_dirty=FALSE; -} + GSList *list=NULL; + GSList *lp; + gint *zval,*ztmp; + gchar *text; + gchar *tamp; + gchar symbol[3]; + gint idx,jdx,kdx; + gint natoms; + gint nspecies; + gint spec; + gboolean have_changed; + if(vasp_gui.poscar_dirty==FALSE) return;/*no need to update*/ + /* get the new number of atoms */ + idx=0; + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,idx); + GUI_COMBOBOX_GET_TEXT(vasp_gui.poscar_atoms,text); + sscanf(text,"%*[^!]! atom: %*i (%[^)])",&(vasp_gui.calc.poscar_symbol[0])); + nspecies=1; + tamp=g_strdup(&(vasp_gui.calc.poscar_symbol[0])); + zval = g_malloc(sizeof(gint)); + zval[0]=elem_symbol_test(vasp_gui.calc.poscar_symbol); + while(g_ascii_strcasecmp(text,"ADD atom")!=0){ + idx++; + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,idx); + GUI_COMBOBOX_GET_TEXT(vasp_gui.poscar_atoms,text); + sscanf(text,"%*[^!]! atom: %*i (%[^)])",&(symbol[0])); + if(g_ascii_strcasecmp(vasp_gui.calc.poscar_symbol,symbol) == 0){ + /*same species*/ + }else{ + /*different species*/ + have_changed=FALSE; + spec=elem_symbol_test(symbol); + for(kdx=0;kdxdata; + sscanf(text,"%*[^!]! atom: %*i (%[^)])",&(vasp_gui.calc.poscar_symbol[0])); + for (lp=list ; lp ; lp=g_slist_next(lp)){ + text=lp->data; + tamp=g_strdup(text);/*to get some space*/ + sscanf(text,"%[^!]! atom: %*i (%[^)])",tamp,&(symbol[0])); + text=g_strdup_printf("%s! atom: %i (%s)",tamp,idx,symbol); + g_free(tamp); + GUI_COMBOBOX_ADD(vasp_gui.poscar_atoms,text); + idx++; + } + GUI_COMBOBOX_ADD(vasp_gui.poscar_atoms,"ADD atom");/*add "ADD atom"*/ + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,natoms); + /*update some properties*/ + vasp_gui.calc.atoms_total=natoms; + vasp_gui.calc.species_total=nspecies; + /*cleanup*/ + for (lp=list ; lp ; lp=g_slist_next(lp)){ + g_free(lp->data); + lp->data=NULL; + } + g_slist_free(list); + g_free(zval); +} /************************/ /* Switch notebook page */ /************************/ -void vasp_gui_page_switch(GtkNotebook *notebook,GtkWidget *page,guint page_num,gpointer user_data){ - /* some (few) values need to be updated from a page to another*/ - vasp_gui.cur_page=page_num;/*TODO: for (adv.)*/ +void vasp_gui_page_switch(GUI_NOTE *notebook,GUI_OBJ *page,guint page_num){ + gint from_page; + gchar *text; + /* some (few) values need to be updated from a page to another*/ + GUI_NOTE_PAGE_NUMBER(notebook,from_page); + if(from_page==(gint)page_num) return;/*not moved*/ + vasp_gui.cur_page=page_num; + GUI_LOCK(page); if(page_num==VASP_PAGE_SIMPLIFIED){ vasp_poscar_sync();/*we need to know species_symbols*/ - gtk_entry_set_text(GTK_ENTRY(vasp_gui.simple_poscar),g_strdup_printf("%s",vasp_gui.calc.species_symbols)); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.simple_np),vasp_gui.calc.job_nproc); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.simple_ncore),vasp_gui.calc.ncore); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.simple_kpar),vasp_gui.calc.kpar); + text=g_strdup_printf("%s",vasp_gui.calc.species_symbols); + GUI_ENTRY_TEXT(vasp_gui.simple_poscar,text); + g_free(text); + GUI_SPIN_SET(vasp_gui.simple_np,vasp_gui.calc.job_nproc); + GUI_SPIN_SET(vasp_gui.simple_ncore,vasp_gui.calc.ncore); + GUI_SPIN_SET(vasp_gui.simple_kpar,vasp_gui.calc.kpar); } else if(page_num==VASP_PAGE_ELECTRONIC){ - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ismear),g_strdup_printf("%i",vasp_gui.calc.ismear)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.kgamma),vasp_gui.calc.kgamma); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kspacing),g_strdup_printf("%.4lf",vasp_gui.calc.kspacing)); + /*can be changed from anywhere*/ + text=g_strdup_printf("%i",vasp_gui.calc.ismear); + GUI_ENTRY_TEXT(vasp_gui.ismear,text); + g_free(text); + if(vasp_gui.calc.kgamma) GUI_TOGGLE_ON(vasp_gui.kgamma); + else GUI_TOGGLE_OFF(vasp_gui.kgamma); + text=g_strdup_printf("%.4lf",vasp_gui.calc.kspacing); + GUI_ENTRY_TEXT(vasp_gui.kspacing,text); + g_free(text); } else if (page_num==VASP_PAGE_IONIC){ vasp_poscar_sync();/*arrange poscar atom values*/ } else if (page_num==VASP_PAGE_KPOINTS){ - gtk_entry_set_text(GTK_ENTRY(vasp_gui.ismear_3),g_strdup_printf("%i",vasp_gui.calc.ismear)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vasp_gui.kgamma_3),vasp_gui.calc.kgamma); - gtk_entry_set_text(GTK_ENTRY(vasp_gui.kspacing_3),g_strdup_printf("%.4lf",vasp_gui.calc.kspacing)); - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.kpoints_mode),vasp_gui.calc.kpoints_mode); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.kpoints_kx),vasp_gui.calc.kpoints_kx); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.kpoints_ky),vasp_gui.calc.kpoints_ky); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.kpoints_kz),vasp_gui.calc.kpoints_kz); + text=g_strdup_printf("%i",vasp_gui.calc.ismear); + GUI_ENTRY_TEXT(vasp_gui.ismear_3,text); + g_free(text); + if(vasp_gui.calc.kgamma) GUI_TOGGLE_ON(vasp_gui.kgamma_3); + else GUI_TOGGLE_OFF(vasp_gui.kgamma_3); + text=g_strdup_printf("%.4lf",vasp_gui.calc.kspacing); + GUI_ENTRY_TEXT(vasp_gui.kspacing_3,text); + g_free(text); + GUI_COMBOBOX_SET(vasp_gui.kpoints_mode,vasp_gui.calc.kpoints_mode); + GUI_SPIN_SET(vasp_gui.kpoints_kx,vasp_gui.calc.kpoints_kx); + GUI_SPIN_SET(vasp_gui.kpoints_ky,vasp_gui.calc.kpoints_ky); + GUI_SPIN_SET(vasp_gui.kpoints_kz,vasp_gui.calc.kpoints_kz); toogle_tetra();/*in case we need*/ } else if (page_num==VASP_PAGE_POTCAR){ vasp_poscar_sync();/*we need to know species_symbols*/ - gtk_entry_set_text(GTK_ENTRY(vasp_gui.poscar_species),g_strdup_printf("%s",vasp_gui.calc.species_symbols)); + text=g_strdup_printf("%s",vasp_gui.calc.species_symbols); + GUI_ENTRY_TEXT(vasp_gui.poscar_species,text); + g_free(text); } else if (page_num==VASP_PAGE_EXEC){ - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.job_nproc),vasp_gui.calc.job_nproc); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.ncore),vasp_gui.calc.ncore); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(vasp_gui.kpar),vasp_gui.calc.kpar); + GUI_SPIN_SET(vasp_gui.job_nproc,vasp_gui.calc.job_nproc); + GUI_SPIN_SET(vasp_gui.ncore,vasp_gui.calc.ncore); + GUI_SPIN_SET(vasp_gui.kpar,vasp_gui.calc.kpar); } + GUI_UNLOCK(page); /*to be continued...*/ } /**********************************************************/ /* convert current vasp_gui into current vasp_calc_struct */ /**********************************************************/ void vasp_gui_sync(){ - gchar *tamp; /* sync start here */ VASP_REG_TEXT(name); //prec already sync @@ -2227,7 +2615,7 @@ void vasp_gui_sync(){ VASP_REG_VAL(lmaxpaw,"%i"); VASP_REG_VAL(istart,"%i"); VASP_REG_VAL(icharg,"%i"); - //iniwav already sync + //iniwav already sync //ispin already sync //non_collinear already sync VASP_REG_TEXT(magmom); @@ -2322,18 +2710,18 @@ void vasp_gui_sync(){ vasp_poscar_sync(); /*no need to sync individual poscar entry*/ /*PROCESS KPOINTS*/ - VASP_REG_VAL(kpoints_nkpts,"%i"); + VASP_REG_VAL(kpoints_nkpts,"%i"); VASP_REG_VAL(kpoints_kx,"%lf"); VASP_REG_VAL(kpoints_ky,"%lf"); VASP_REG_VAL(kpoints_kz,"%lf"); VASP_REG_VAL(kpoints_sx,"%lf"); VASP_REG_VAL(kpoints_sy,"%lf"); VASP_REG_VAL(kpoints_sz,"%lf"); - VASP_REG_VAL(kpoints_i,"%i"); - VASP_REG_VAL(kpoints_x,"%lf"); - VASP_REG_VAL(kpoints_y,"%lf"); - VASP_REG_VAL(kpoints_z,"%lf"); - VASP_REG_VAL(kpoints_w,"%lf"); + VASP_REG_VAL(kpoints_i,"%i"); + VASP_REG_VAL(kpoints_x,"%lf"); + VASP_REG_VAL(kpoints_y,"%lf"); + VASP_REG_VAL(kpoints_z,"%lf"); + VASP_REG_VAL(kpoints_w,"%lf"); VASP_REG_VAL(tetra_total,"%i"); VASP_REG_VAL(tetra_volume,"%lf"); /*no need to sync individual tetrahedron entry*/ @@ -2346,13 +2734,14 @@ void vasp_gui_sync(){ /* convert vasp structure to POSCAR (not gui_free) */ /***************************************************/ void calc_to_poscar(FILE *output,vasp_calc_struct calc){ - gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms)); + gint index; gchar *text; gdouble x,y,z; gchar tx,ty,tz; gint idx; /* generate a VASP5 POSCAR file */ - if(calc.name!=NULL) fprintf(output,"%s ",calc.name); + GUI_COMBOBOX_GET(vasp_gui.poscar_atoms,index);/*PUSH*/ + if(calc.name!=NULL) fprintf(output,"%s ",calc.name); else fprintf(output,"UNNAMED MODEL "); fprintf(output,"! GENERATED BY GDIS %4.2f.%d (C) %d\n",VERSION,PATCH,YEAR); fprintf(output,"%lf\n",calc.poscar_a0); @@ -2367,29 +2756,32 @@ void calc_to_poscar(FILE *output,vasp_calc_struct calc){ if(calc.poscar_direct) fprintf(output,"Direct\n"); else fprintf(output,"Cartesian\n"); idx=0; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,idx); + GUI_COMBOBOX_GET_TEXT(vasp_gui.poscar_atoms,text); sscanf(text,"%*f %*f %*f %*c %*c %*c ! atom: %*i (%[^)])",&(vasp_gui.calc.poscar_symbol[0])); - while(g_ascii_strcasecmp(text,"ADD atom")!=0){ + while(g_ascii_strcasecmp(text,"ADD atom")!=0){ /*get each line*/ sscanf(text,"%lf %lf %lf %c %c %c %*s",&x,&y,&z,&tx,&ty,&tz); + g_free(text); fprintf(output," % .8lf % .8lf % .8lf %c %c %c\n",x,y,z,tx,ty,tz); idx++; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms)); - } - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),index); + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,idx); + GUI_COMBOBOX_GET_TEXT(vasp_gui.poscar_atoms,text); + } + g_free(text);/*free "ADD atom"*/ + GUI_COMBOBOX_SET(vasp_gui.poscar_atoms,index);/*PULL*/ } /****************************************************/ /* convert vasp structure to KPOINTS (not gui_free) */ /****************************************************/ void calc_to_kpoints(FILE *output,vasp_calc_struct calc){ - gint index=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.kpoints_kpts)); + gint index; gchar *text; gdouble x,y,z,wt; gint a,b,c,d; gint idx; /* generate a VASP KPOINTS file */ + GUI_COMBOBOX_GET(vasp_gui.kpoints_kpts,index);/*PUSH*/ if(calc.name!=NULL) fprintf(output,"%s ",calc.name); else fprintf(output,"UNNAMED MODEL "); fprintf(output,"! GENERATED BY GDIS %4.2f.%d (C) %d\n",VERSION,PATCH,YEAR); @@ -2400,33 +2792,36 @@ void calc_to_kpoints(FILE *output,vasp_calc_struct calc){ switch (vasp_gui.calc.kpoints_mode){ case VKP_LINE: fprintf(output,"Line-mode\n"); + if(vasp_gui.calc.kpoints_cart) fprintf(output,"Cartesian\n"); + else fprintf(output,"Reciprocal\n"); + break; case VKP_BASIS: - case VKP_MAN: + case VKP_MAN: if(vasp_gui.calc.kpoints_cart) fprintf(output,"Cartesian\n"); else fprintf(output,"Reciprocal\n"); break; - case VKP_GAMMA: + case VKP_GAMMA: fprintf(output,"Gamma\n"); fprintf(output,"%i %i %i\n",(gint)vasp_gui.calc.kpoints_kx,(gint)vasp_gui.calc.kpoints_ky,(gint)vasp_gui.calc.kpoints_kz); if((vasp_gui.calc.kpoints_sx!=0.0)&&(vasp_gui.calc.kpoints_sy!=0.0)&&(vasp_gui.calc.kpoints_sz!=0.0)) fprintf(output,"%lf %lf %lf\n",vasp_gui.calc.kpoints_sx,vasp_gui.calc.kpoints_sy,vasp_gui.calc.kpoints_sz); return; - case VKP_MP: + case VKP_MP: fprintf(output,"Monkhorst-Pack\n"); fprintf(output,"%i %i %i\n",(gint)vasp_gui.calc.kpoints_kx,(gint)vasp_gui.calc.kpoints_ky,(gint)vasp_gui.calc.kpoints_kz); if((vasp_gui.calc.kpoints_sx!=0.0)&&(vasp_gui.calc.kpoints_sy!=0.0)&&(vasp_gui.calc.kpoints_sz!=0.0)) fprintf(output,"%lf %lf %lf\n",vasp_gui.calc.kpoints_sx,vasp_gui.calc.kpoints_sy,vasp_gui.calc.kpoints_sz); return; - case VKP_AUTO: + case VKP_AUTO: fprintf(output,"Auto\n"); fprintf(output,"%i\n",(gint)vasp_gui.calc.kpoints_kx); return; - } + } /*print all coordinates*/ idx=0; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.kpoints_kpts),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.kpoints_kpts)); - while(g_ascii_strcasecmp(text,"ADD kpoint")!=0){ + GUI_COMBOBOX_SET(vasp_gui.kpoints_kpts,idx); + GUI_COMBOBOX_GET_TEXT(vasp_gui.kpoints_kpts,text); + while(g_ascii_strcasecmp(text,"ADD kpoint")!=0){ if(vasp_gui.calc.kpoints_mode==VKP_MAN) { sscanf(text,"%lf %lf %lf %lf ! kpoint: %*i",&x,&y,&z,&wt); fprintf(output,"%lf %lf %lf %lf ! kpoint: %i\n",x,y,z,wt,idx+1); @@ -2434,29 +2829,33 @@ void calc_to_kpoints(FILE *output,vasp_calc_struct calc){ sscanf(text,"%lf %lf %lf ! kpoint: %*i",&x,&y,&z); fprintf(output,"%lf %lf %lf ! kpoint: %i\n",x,y,z,idx+1); } + g_free(text); idx++; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.kpoints_kpts),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.kpoints_kpts)); + GUI_COMBOBOX_SET(vasp_gui.kpoints_kpts,idx); + GUI_COMBOBOX_GET_TEXT(vasp_gui.kpoints_kpts,text); } + g_free(text);/*free "ADD kpoint"*/ /*return to previous postition*/ - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.kpoints_kpts),index); + GUI_COMBOBOX_SET(vasp_gui.kpoints_kpts,index);/*PULL*/ /*print all tetrahedron (if any)*/ if(!vasp_gui.calc.kpoints_tetra) return; fprintf(output,"Tetrahedron\n"); fprintf(output,"%i %lf\n",vasp_gui.calc.tetra_total,vasp_gui.calc.tetra_volume); - index=gtk_combo_box_get_active(GTK_COMBO_BOX(vasp_gui.tetra)); + GUI_COMBOBOX_GET(vasp_gui.tetra,index);/*PUSH*/ idx=0; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.tetra),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.tetra)); + GUI_COMBOBOX_SET(vasp_gui.tetra,idx); + GUI_COMBOBOX_GET_TEXT(vasp_gui.tetra,text); while(g_ascii_strcasecmp(text,"ADD tetrahedron")!=0){ sscanf(text,"%lf %i %i %i %i ! tetrahedron: %*i",&wt,&a,&b,&c,&d); fprintf(output,"%lf %i %i %i %i ! tetrahedron: %i\n",wt,a,b,c,d,idx+1); + g_free(text); idx++; - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.tetra),idx); - text=gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(vasp_gui.tetra)); + GUI_COMBOBOX_SET(vasp_gui.tetra,idx); + GUI_COMBOBOX_GET_TEXT(vasp_gui.tetra,text); } + g_free(text);/*free "ADD tetrahedron"*/ /*return to previous postition*/ - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.tetra),index); + GUI_COMBOBOX_SET(vasp_gui.tetra,index);/*PULL*/ } /*************************************/ /* append one POTCAR file to another */ @@ -2500,7 +2899,7 @@ if(!vasp_gui.have_potcar_folder){ if(vasp_gui.calc.potcar_species_flavor==NULL) return; hasend=FALSE; idx=0; - while((text[idx]==' ')) {/*skip trailing space*/ + while((text[idx]==' ')||(text[idx]=='\t')) {/*skip trailing space*/ if(text[idx]=='\0') { fprintf(stderr,"ERROR while reading POTCAR flavors!\n"); g_free(text); @@ -2530,6 +2929,7 @@ if(!vasp_gui.have_potcar_folder){ ptr=&(text[idx]); } g_free(text); + if(vasp_gui.calc.potcar_file!=NULL) g_free(vasp_gui.calc.potcar_file); vasp_gui.calc.potcar_file=g_strdup_printf("%s/POTCAR",vasp_gui.calc.job_path); } /*that's all folks*/ @@ -2590,7 +2990,6 @@ gint save_vasp_calc(){ vasp_gui.calc_to_incar(stdout,vasp_gui.calc); calc_to_poscar(stdout,vasp_gui.calc); calc_to_kpoints(stdout,vasp_gui.calc); - #endif return 0; } @@ -2603,15 +3002,15 @@ void vasp_cleanup(){ /*****************************************/ /* Execute or enqueue a vasp calculation */ /*****************************************/ -void run_vasp_exec(vasp_exec_struct *vasp_exec,struct task_pak *task){ +void run_vasp_exec(vasp_exec_struct *vasp_exec){ /* Execute a vasp task TODO distant job */ gchar *cmd; gchar *cwd;/*for push/pull*/ #if __WIN32 /* At present running vasp in __WIN32 environment is impossible. - * However, it should be possible to launch a (remote) job on a - * distant server. See TODO */ + * However, it should be possible to launch a (remote) job on a + * distant server. See TODO */ fprintf(stderr,"VASP calculation can't be done in this environment.\n");return; #else /*direct launch*/ @@ -2637,7 +3036,7 @@ void cleanup_vasp_exec(vasp_exec_struct *vasp_exec){ while(!(*vasp_exec).have_result) usleep(500*1000);/*sleep 500ms until job is done*/ /*init a model*/ result_model=model_new(); - model_init(result_model); + model_init(result_model); /*put result into it*/ filename=g_strdup_printf("%s/vasprun.xml",(*vasp_exec).job_path); /*TODO: detect if a calculation have failed*/ @@ -2670,17 +3069,17 @@ void exec_calc(){ /*prepend to calc list*/ sysenv.vasp_calc_list = g_slist_prepend (sysenv.vasp_calc_list,vasp_exec); /*launch vasp in a task*/ - gtk_widget_set_sensitive(vasp_gui.button_save,FALSE); - gtk_widget_set_sensitive(vasp_gui.button_exec,FALSE); + GUI_LOCK(vasp_gui.button_save); + GUI_LOCK(vasp_gui.button_exec); task_new("VASP", &run_vasp_exec,vasp_exec,&cleanup_vasp_exec,vasp_exec,sysenv.active_model); /*when task is launched, close dialog*/ vasp_cleanup(); - gtk_widget_destroy(vasp_gui.window); + GUI_CLOSE(vasp_gui.window); } /********************************/ /* Quit vasp calculation dialog */ /********************************/ -void quit_vasp_gui(GtkWidget *w, gpointer data){ +void quit_vasp_gui(GUI_OBJ *w, gpointer data){ struct model_pak *model=data; vasp_cleanup(); dialog_destroy(w,model); @@ -2693,9 +3092,9 @@ void gui_vasp_dialog(void){ /*TODO: use distant connections*/ gchar *title; gpointer dialog; - GtkWidget *frame, *vbox, *hbox, *table; - GtkWidget *notebook, *page, *button, *label; - GtkWidget *separator; + GUI_OBJ *frame, *vbox, *hbox, *table; + GUI_OBJ *notebook, *page, *button, *label; + GUI_OBJ *separator; /* special */ GSList *list2; struct model_pak *data; @@ -2704,6 +3103,20 @@ void gui_vasp_dialog(void){ /* checks */ data = sysenv.active_model; if (!data) return; +/* some format can't be used */ + if (data->id == MORPH){ + title = g_strdup_printf("Can't setup a VASP calculation from a MORPH file!\n"); + gui_text_show(ERROR,title); + g_free(title); + return; + } +/* need natoms >1 */ + if (data->num_atoms==0) { + title = g_strdup_printf("Can't setup a VASP calculation with no atom information!\n"); + gui_text_show(ERROR,title); + g_free(title); + return; + } /* do we have a vasprun.xml model? */ if (data->id == VASP) { vasp_gui.have_xml=TRUE; @@ -2720,777 +3133,701 @@ void gui_vasp_dialog(void){ g_free(title); vasp_gui.window = dialog_window(dialog); /* --- Outside of notebook */ - frame = gtk_frame_new(NULL); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(vasp_gui.window)->vbox), frame, FALSE, FALSE, 0); - vbox = gtk_vbox_new(FALSE, _SPACE); - gtk_container_add(GTK_CONTAINER(frame), vbox); + GUI_FRAME_WINDOW(vasp_gui.window,frame); + GUI_VBOX_FRAME(frame,vbox); /* --- MODEL NAME */ - hbox = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, _SPACE); - label = gtk_label_new(g_strdup_printf("MODEL NAME")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - VASP_TEXT_ENTRY(vasp_gui.name,g_strdup_printf("%s",data->basename),TRUE); -VASP_TOOLTIP(vasp_gui.name,"The model name will be used in VASP files\nas well as GDIS display."); + GUI_LINE_BOX(vbox,hbox); + GUI_LABEL_BOX(hbox,label,"MODEL NAME"); + GUI_TEXT_ENTRY(hbox,vasp_gui.name,data->basename,TRUE); +GUI_TOOLTIP(vasp_gui.name,"The model name will be used in VASP files\nas well as GDIS display."); /* --- CONNECTED XML */ - hbox = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, _SPACE); - label = gtk_label_new(g_strdup_printf("CONNECTED XML")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - VASP_TEXT_ENTRY(vasp_gui.file_entry,data->filename,TRUE); - if(data->id!=VASP) gtk_entry_set_text(GTK_ENTRY(vasp_gui.file_entry),""); -VASP_TOOLTIP(vasp_gui.file_entry,"Use the result of a calculation (vasprun.xml)\nas a model to fill up settings of the current one.\nNOTE: important settings (such as NELM) will be wrong\nand all settings should be checked again. Carefully."); - button=gtk_button_new_from_stock(GTK_STOCK_OPEN); - gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); - g_signal_connect(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(load_vasprun_dialog),NULL); -/* notebook frame */ - frame = gtk_frame_new(NULL); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(vasp_gui.window)->vbox), frame, FALSE, FALSE, 0); - gtk_container_set_border_width(GTK_CONTAINER(frame), _SPACE); -/* create notebook */ - notebook = gtk_notebook_new(); - gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP); - gtk_container_add(GTK_CONTAINER(frame), notebook); - gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook), TRUE); + GUI_LINE_BOX(vbox,hbox); + GUI_LABEL_BOX(hbox,label,"CONNECTED XML"); + GUI_TEXT_ENTRY(hbox,vasp_gui.file_entry,data->filename,TRUE); + if(data->id!=VASP) GUI_ENTRY_TEXT(vasp_gui.file_entry,""); +GUI_TOOLTIP(vasp_gui.file_entry,"Use the result of a calculation (vasprun.xml)\nas a model to fill up settings of the current one.\nNOTE: important settings (such as NELM) will be wrong\nand all settings should be checked again. Carefully."); + GUI_OPEN_BUTTON_BOX(hbox,button,load_vasprun_dialog); +/* create frame in box */ + GUI_FRAME_WINDOW(vasp_gui.window,frame); +/* create notebook in frame */ + GUI_NOTE_FRAME(frame,notebook); /*------------------*/ /* page 0 -> PRESET */ /*------------------*/ - page = gtk_vbox_new(FALSE, _SPACE); - label = gtk_label_new("PRESET"); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook),page,label); + GUI_PAGE_NOTE(notebook,page,"PRESET"); /* --- general */ - frame = gtk_frame_new("General"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"General"); /* create a table in the frame*/ - table = gtk_table_new(5, 4, FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,5,4); /* 1st line */ - VASP_COMBOBOX_TABLE(vasp_gui.simple_calcul,"CALCUL:",0,1,0,1); - VASP_COMBOBOX_ADD(vasp_gui.simple_calcul,"Energy (single point)"); - VASP_COMBOBOX_ADD(vasp_gui.simple_calcul,"DOS/BANDS (single point)"); - VASP_COMBOBOX_ADD(vasp_gui.simple_calcul,"Lattice Dynamics (opt.)"); - VASP_COMBOBOX_ADD(vasp_gui.simple_calcul,"Geometry (opt.)"); - VASP_COMBOBOX_ADD(vasp_gui.simple_calcul,"Molecular Dynamics (opt.)"); -VASP_TOOLTIP(vasp_gui.simple_calcul,"What is the intended calculation type?"); - VASP_CHECK_TABLE(button,vasp_gui.simple_rgeom,NULL,"ROUGH GEOM.",2,3,0,1);/*not calling anything*/ -VASP_TOOLTIP(button,"Is the current geometry:\nFAR from groundstate geometry\nor NOT-SO-FAR from it?"); - VASP_SPIN_TABLE(vasp_gui.simple_dim,vasp_gui.dimension,NULL,"DIM:",3,4,0,1);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.simple_dim,"What is the dimension of system?\nThe DIM (0D, 1D, 2D, or 3D) will be used\nto determine some parameters in INCAR and KPOINTS\nNO CHANGE will be made to the current geometry!"); - gtk_spin_button_set_range(GTK_SPIN_BUTTON(vasp_gui.simple_dim),0.0,3.0);/*0D~3D*/ + GUI_COMBOBOX_TABLE(table,vasp_gui.simple_calcul,"CALCUL:",0,1,0,1); + GUI_COMBOBOX_ADD(vasp_gui.simple_calcul,"Energy (single point)"); + GUI_COMBOBOX_ADD(vasp_gui.simple_calcul,"DOS/BANDS (single point)"); + GUI_COMBOBOX_ADD(vasp_gui.simple_calcul,"Lattice Dynamics (opt.)"); + GUI_COMBOBOX_ADD(vasp_gui.simple_calcul,"Geometry (opt.)"); + GUI_COMBOBOX_ADD(vasp_gui.simple_calcul,"Molecular Dynamics (opt.)"); +GUI_TOOLTIP(vasp_gui.simple_calcul,"What is the intended calculation type?"); + GUI_CHECK_TABLE(table,button,vasp_gui.simple_rgeom,NULL,"ROUGH GEOM.",2,3,0,1);/*not calling anything*/ +GUI_TOOLTIP(button,"Is the current geometry:\nFAR from groundstate geometry\nor NOT-SO-FAR from it?"); + GUI_SPIN_TABLE(table,vasp_gui.simple_dim,vasp_gui.dimension,NULL,"DIM:",3,4,0,1);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.simple_dim,"What is the dimension of system?\nThe DIM (0D, 1D, 2D, or 3D) will be used\nto determine some parameters in INCAR and KPOINTS\nNO CHANGE will be made to the current geometry!"); + GUI_SPIN_RANGE(vasp_gui.simple_dim,0.0,3.0);/*0D~3D*/ /* 2nd line */ - VASP_COMBOBOX_TABLE(vasp_gui.simple_system,"SYSTEM:",0,1,1,2); - VASP_COMBOBOX_ADD(vasp_gui.simple_system,"Metal"); - VASP_COMBOBOX_ADD(vasp_gui.simple_system,"Semi-conducting"); - VASP_COMBOBOX_ADD(vasp_gui.simple_system,"Insulator"); - VASP_COMBOBOX_ADD(vasp_gui.simple_system,"Unknown"); -VASP_TOOLTIP(vasp_gui.simple_system,"What is the electronic properties of the intended material?"); - VASP_TEXT_TABLE(vasp_gui.simple_poscar,vasp_gui.calc.species_symbols,"POSCAR:",1,4,1,2); -VASP_TOOLTIP(vasp_gui.simple_poscar,"Atomic symbols of the species\ndetected from the model geometry."); - gtk_widget_set_sensitive(vasp_gui.simple_poscar,FALSE); + GUI_COMBOBOX_TABLE(table,vasp_gui.simple_system,"SYSTEM:",0,1,1,2); + GUI_COMBOBOX_ADD(vasp_gui.simple_system,"Metal"); + GUI_COMBOBOX_ADD(vasp_gui.simple_system,"Semi-conducting"); + GUI_COMBOBOX_ADD(vasp_gui.simple_system,"Insulator"); + GUI_COMBOBOX_ADD(vasp_gui.simple_system,"Unknown"); +GUI_TOOLTIP(vasp_gui.simple_system,"What is the electronic properties of the intended material?"); + GUI_TEXT_TABLE(table,vasp_gui.simple_poscar,vasp_gui.calc.species_symbols,"POSCAR:",1,4,1,2); +GUI_TOOLTIP(vasp_gui.simple_poscar,"Atomic symbols of the species\ndetected from the model geometry."); + GUI_LOCK(vasp_gui.simple_poscar); /* 3rd line */ - VASP_COMBOBOX_TABLE(vasp_gui.simple_kgrid,"KPT GRID:",0,1,2,3); - VASP_COMBOBOX_ADD(vasp_gui.simple_kgrid,"COARSE"); - VASP_COMBOBOX_ADD(vasp_gui.simple_kgrid,"MEDIUM"); - VASP_COMBOBOX_ADD(vasp_gui.simple_kgrid,"FINE"); - VASP_COMBOBOX_ADD(vasp_gui.simple_kgrid,"ULTRA-FINE"); -VASP_TOOLTIP(vasp_gui.simple_kgrid,"What is the intended k-point grid density?"); - VASP_TEXT_TABLE(vasp_gui.simple_species,vasp_gui.calc.potcar_species,"POTCAR:",1,4,2,3); -VASP_TOOLTIP(vasp_gui.simple_species,"From POTCAR file, the following species are detected.\nThis should match the POSCAR definition above."); - gtk_widget_set_sensitive(vasp_gui.simple_species,FALSE); + GUI_COMBOBOX_TABLE(table,vasp_gui.simple_kgrid,"KPT GRID:",0,1,2,3); + GUI_COMBOBOX_ADD(vasp_gui.simple_kgrid,"COARSE"); + GUI_COMBOBOX_ADD(vasp_gui.simple_kgrid,"MEDIUM"); + GUI_COMBOBOX_ADD(vasp_gui.simple_kgrid,"FINE"); + GUI_COMBOBOX_ADD(vasp_gui.simple_kgrid,"ULTRA-FINE"); +GUI_TOOLTIP(vasp_gui.simple_kgrid,"What is the intended k-point grid density?"); + GUI_TEXT_TABLE(table,vasp_gui.simple_species,vasp_gui.calc.potcar_species,"POTCAR:",1,4,2,3); +GUI_TOOLTIP(vasp_gui.simple_species,"From POTCAR file, the following species are detected.\nThis should match the POSCAR definition above."); + GUI_LOCK(vasp_gui.simple_species); /* 4th line */ - VASP_TEXT_TABLE(vasp_gui.simple_potcar,vasp_gui.calc.potcar_file,"POTCAR FILE:",0,3,3,4); -VASP_TOOLTIP(vasp_gui.simple_potcar,"Where is the POTCAR file for this calculation?"); - VASP_BUTTON_TABLE(vasp_gui.simple_potcar_button,GTK_STOCK_OPEN,load_potcar_file_dialog,3,4,3,4); + GUI_TEXT_TABLE(table,vasp_gui.simple_potcar,vasp_gui.calc.potcar_file,"POTCAR FILE:",0,3,3,4); +GUI_TOOLTIP(vasp_gui.simple_potcar,"Where is the POTCAR file for this calculation?"); + GUI_OPEN_BUTTON_TABLE(table,vasp_gui.simple_potcar_button,load_potcar_file_dialog,3,4,3,4); /* 5th line */ - VASP_LABEL_TABLE("EXEC:",0,1,4,5); - VASP_SPIN_TABLE(vasp_gui.simple_np,vasp_gui.calc.job_nproc,parallel_eq,"NP=",1,2,4,5); -VASP_TOOLTIP(vasp_gui.simple_np,"How many CPU(s) should be used for calculation?"); - VASP_SPIN_TABLE(vasp_gui.simple_ncore,vasp_gui.calc.ncore,parallel_eq,"NCORE=",2,3,4,5); -VASP_TOOLTIP(vasp_gui.simple_ncore,"How many CPU(s) should work on one band?"); - VASP_SPIN_TABLE(vasp_gui.simple_kpar,vasp_gui.calc.kpar,parallel_eq,"KPAR=",3,4,4,5); -VASP_TOOLTIP(vasp_gui.simple_kpar,"How many k-points should be worked on at a time?\nNote: each k-point is worked on by NCORE CPU(s)."); + GUI_LEFT_LABEL_TABLE(table,"EXEC:",0,1,4,5); + GUI_SPIN_TABLE(table,vasp_gui.simple_np,vasp_gui.calc.job_nproc,parallel_eq,"NP=",1,2,4,5); +GUI_TOOLTIP(vasp_gui.simple_np,"How many CPU(s) should be used for calculation?"); + GUI_SPIN_TABLE(table,vasp_gui.simple_ncore,vasp_gui.calc.ncore,parallel_eq,"NCORE=",2,3,4,5); +GUI_TOOLTIP(vasp_gui.simple_ncore,"How many CPU(s) should work on one band?"); + GUI_SPIN_TABLE(table,vasp_gui.simple_kpar,vasp_gui.calc.kpar,parallel_eq,"KPAR=",3,4,4,5); +GUI_TOOLTIP(vasp_gui.simple_kpar,"How many k-points should be worked on at a time?\nNote: each k-point is worked on by NCORE CPU(s)."); /* initialize */ - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.simple_calcul),0);/*not calling anything*/ - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.simple_system),0);/*not calling anything*/ - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.simple_kgrid),0);/*not calling anything*/ + GUI_COMBOBOX_SETUP(vasp_gui.simple_calcul,0,NULL);/*not calling anything*/ + GUI_COMBOBOX_SETUP(vasp_gui.simple_system,0,NULL);/*not calling anything*/ + GUI_COMBOBOX_SETUP(vasp_gui.simple_kgrid,0,NULL);/*not calling anything*/ /* --- end frame */ /* --- DISCLAMER */ - frame = gtk_frame_new("DISCLAMER"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"DISCLAMER"); /* create a table in the frame*/ - table = gtk_table_new(4, 3,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,4,3); /* 1st line */ - label = gtk_label_new("This simplified interface is aimed at pre-loading parameters with default values"); - gtk_table_attach_defaults(GTK_TABLE(table),label,1,2,0,1); + GUI_LABEL_TABLE(table,"This simplified interface is aimed at pre-loading parameters with default values",1,2,0,1); /* 2nd line */ - label = gtk_label_new("for a given calculation type. User should then check said defaults extremely carefuly..."); - gtk_table_attach_defaults(GTK_TABLE(table),label,1,2,1,2); + GUI_LABEL_TABLE(table,"for a given calculation type. User should then check said defaults extremely carefuly...",1,2,1,2); /* 3th line */ - label = gtk_label_new("GENERATE ==>"); - gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,3,4); - VASP_BUTTON_TABLE(vasp_gui.simple_apply,GTK_STOCK_APPLY,vasp_apply_simple,1,2,3,4); -VASP_TOOLTIP(vasp_gui.simple_apply,"Use this to obtain a preset of setting.\nIf calculation is already set using this will\noverwrite settings resulting in an unpredictable state."); - label = gtk_label_new("<== (and check...)"); - gtk_table_attach_defaults(GTK_TABLE(table),label,2,3,3,4); + GUI_LABEL_TABLE(table,"GENERATE ==>",0,1,3,4); + GUI_APPLY_BUTTON_TABLE(table,vasp_gui.simple_apply,vasp_apply_simple,1,2,3,4); +GUI_TOOLTIP(vasp_gui.simple_apply,"Use this to obtain a preset of setting.\nIf calculation is already set using this will\noverwrite settings resulting in an unpredictable state."); + GUI_LABEL_TABLE(table,"<== (and check...)",2,3,3,4); /* --- end frame */ /* --- MESSAGE */ - frame = gtk_frame_new("MESSAGE"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); -/*create a vbox in frame*/ - vbox=gtk_vbox_new(TRUE, 0); - gtk_container_add(GTK_CONTAINER(frame),vbox); -/* num frames */ - vasp_gui.simple_message=gtk_text_view_new(); - vasp_gui.simple_message_buff=gtk_text_view_get_buffer(GTK_TEXT_VIEW(vasp_gui.simple_message)); - gtk_text_view_set_editable(GTK_TEXT_VIEW(vasp_gui.simple_message),FALSE); - gtk_widget_set_sensitive(vasp_gui.simple_message,FALSE); - button=gtk_scrolled_window_new(NULL, NULL);/*GTK-ABSURD*/ - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(button),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); - gtk_container_add(GTK_CONTAINER(button),vasp_gui.simple_message); - gtk_container_set_border_width(GTK_CONTAINER(button),1); - gtk_box_pack_start(GTK_BOX(vbox),button,TRUE,TRUE,0); + GUI_FRAME_NOTE(page,frame,"MESSAGE"); +/* create a vbox in frame*/ + GUI_VBOX_FRAME(frame,vbox); +/* create a textview in a frame */ + GUI_TEXTVIEW_BOX(vbox,vasp_gui.simple_message,vasp_gui.simple_message_buff); /* --- end frame */ - /*-----------------------*/ /* page 1 -> CONVERGENCE */ /*-----------------------*/ - page = gtk_vbox_new(FALSE, _SPACE); - label = gtk_label_new("CONVERGENCE"); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook),page,label); + GUI_PAGE_NOTE(notebook,page,"CONVERGENCE"); /* --- general */ - frame = gtk_frame_new("General"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"General"); /* create a table in the frame*/ - table = gtk_table_new(5, 4, FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,5,4); /* 1st line */ - VASP_COMBOBOX_TABLE(vasp_gui.prec,"PREC=",0,1,0,1); - VASP_COMBOBOX_ADD(vasp_gui.prec,"Normal"); - VASP_COMBOBOX_ADD(vasp_gui.prec,"Single"); - VASP_COMBOBOX_ADD(vasp_gui.prec,"Accurate"); - VASP_COMBOBOX_ADD(vasp_gui.prec,"High"); - VASP_COMBOBOX_ADD(vasp_gui.prec,"Medium"); - VASP_COMBOBOX_ADD(vasp_gui.prec,"Low"); -VASP_TOOLTIP(vasp_gui.prec,"PREC: Ch. 6.11 DEFAULT: Normal\nSets numerical accuracy by changing\nENCUT, NG{X,Y,Z}, NG{X,Y,Z}F, and ROPT.\n(can be override manually)"); - VASP_CHECK_TABLE(button,vasp_gui.calc.use_prec,prec_toggle,"USE PREC",1,2,0,1); -VASP_TOOLTIP(button,"Let PREC decides on ENCUT, NG{X,Y,Z}, NG{X,Y,Z}F, and ROPT."); - VASP_ENTRY_TABLE(vasp_gui.encut,vasp_gui.calc.encut,"%.2lf","ENCUT=",2,3,0,1); -VASP_TOOLTIP(vasp_gui.encut,"ENCUT: Ch. 6.9 DEFAULT: MAX(ENMAX)\nPlane-wave basis cutoff energy (eV).\nDefault MAX(ENMAX) is taken from POTCAR file."); - VASP_ENTRY_TABLE(vasp_gui.enaug,vasp_gui.calc.enaug,"%.2lf","ENAUG=",3,4,0,1); -VASP_TOOLTIP(vasp_gui.enaug,"ENAUG: Ch. 6.10 DEFAULT: EAUG\nKinetic cutoff for augmentation charges.\nDefault EAUG is taken from POTCAR file."); - VASP_ENTRY_TABLE(vasp_gui.ediff,vasp_gui.calc.ediff,"%.2lE","EDIFF=",4,5,0,1); -VASP_TOOLTIP(vasp_gui.ediff,"EDIFF: Ch. 6.18 DEFAULT: 10^{-4}\nSet the criterion (eV) for electronic convergence."); + GUI_COMBOBOX_TABLE(table,vasp_gui.prec,"PREC=",0,1,0,1); + GUI_COMBOBOX_ADD(vasp_gui.prec,"Normal"); + GUI_COMBOBOX_ADD(vasp_gui.prec,"Single"); + GUI_COMBOBOX_ADD(vasp_gui.prec,"Accurate"); + GUI_COMBOBOX_ADD(vasp_gui.prec,"High"); + GUI_COMBOBOX_ADD(vasp_gui.prec,"Medium"); + GUI_COMBOBOX_ADD(vasp_gui.prec,"Low"); +GUI_TOOLTIP(vasp_gui.prec,"PREC: Ch. 6.11 DEFAULT: Normal\nSets numerical accuracy by changing\nENCUT, NG{X,Y,Z}, NG{X,Y,Z}F, and ROPT.\n(can be override manually)"); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.use_prec,prec_toggle,"USE PREC",1,2,0,1); +GUI_TOOLTIP(button,"Let PREC decides on ENCUT, NG{X,Y,Z}, NG{X,Y,Z}F, and ROPT."); + GUI_ENTRY_TABLE(table,vasp_gui.encut,vasp_gui.calc.encut,"%.2lf","ENCUT=",2,3,0,1); +GUI_TOOLTIP(vasp_gui.encut,"ENCUT: Ch. 6.9 DEFAULT: MAX(ENMAX)\nPlane-wave basis cutoff energy (eV).\nDefault MAX(ENMAX) is taken from POTCAR file."); + GUI_ENTRY_TABLE(table,vasp_gui.enaug,vasp_gui.calc.enaug,"%.2lf","ENAUG=",3,4,0,1); +GUI_TOOLTIP(vasp_gui.enaug,"ENAUG: Ch. 6.10 DEFAULT: EAUG\nKinetic cutoff for augmentation charges.\nDefault EAUG is taken from POTCAR file."); + GUI_ENTRY_TABLE(table,vasp_gui.ediff,vasp_gui.calc.ediff,"%.2lE","EDIFF=",4,5,0,1); +GUI_TOOLTIP(vasp_gui.ediff,"EDIFF: Ch. 6.18 DEFAULT: 10^{-4}\nSet the criterion (eV) for electronic convergence."); /* 2nd line */ - VASP_COMBOBOX_TABLE(vasp_gui.algo,"ALGO=",0,1,1,2); - VASP_COMBOBOX_ADD(vasp_gui.algo,"NORMAL"); - VASP_COMBOBOX_ADD(vasp_gui.algo,"USE_IALGO"); - VASP_COMBOBOX_ADD(vasp_gui.algo,"VERYFAST"); - VASP_COMBOBOX_ADD(vasp_gui.algo,"FAST"); - VASP_COMBOBOX_ADD(vasp_gui.algo,"CONJUGATE"); - VASP_COMBOBOX_ADD(vasp_gui.algo,"ALL"); - VASP_COMBOBOX_ADD(vasp_gui.algo,"DAMPED"); - VASP_COMBOBOX_ADD(vasp_gui.algo,"SUBROT"); - VASP_COMBOBOX_ADD(vasp_gui.algo,"EIGENVAL"); - VASP_COMBOBOX_ADD(vasp_gui.algo,"NONE"); - VASP_COMBOBOX_ADD(vasp_gui.algo,"NOTHING"); - VASP_COMBOBOX_ADD(vasp_gui.algo,"EXACT"); - VASP_COMBOBOX_ADD(vasp_gui.algo,"DIAG"); -VASP_TOOLTIP(vasp_gui.algo,"ALGO: Ch. 6.46 DEFAULT: Normal\nSelect the electronic minimization algorithm.\nIt is overrided by IALGO when specified."); - VASP_CHECK_TABLE(button,vasp_gui.calc.ldiag,NULL,"LDIAG",1,2,1,2);/*not calling anything*/ -VASP_TOOLTIP(button,"LDIAG: Ch. 6.47 DEFAULT: TRUE\nSwitch on the sub-space rotation."); - VASP_ENTRY_TABLE(vasp_gui.nsim,vasp_gui.calc.nsim,"%i","NSIM=",2,3,1,2); -VASP_TOOLTIP(vasp_gui.nsim,"NSIM: Ch. 6.48 DEFAULT: 4\nNumber of bands optimized at a time\nin blocked minimization algorithm."); - VASP_ENTRY_TABLE(vasp_gui.vtime,vasp_gui.calc.vtime,"%.4lf","TIME=",3,4,1,2); -VASP_TOOLTIP(vasp_gui.vtime,"TIME: Ch. 6.51 DEFAULT: 0.4\nSelect the trial time or value step\nfor minimization algorithm IALGO=5X."); - VASP_ENTRY_TABLE(vasp_gui.iwavpr,vasp_gui.calc.iwavpr,"%i","IWAVPR=",4,5,1,2); -VASP_TOOLTIP(vasp_gui.iwavpr,"IWAVPR: Ch. 6.26 DEFAULT: 2(IBRION=0-2)\nDetermine how charge density/orbitals are predicted\nfrom one ionic configuration to the next.\nDefault is 0 if IBRION is different from 0-2."); + GUI_COMBOBOX_TABLE(table,vasp_gui.algo,"ALGO=",0,1,1,2); + GUI_COMBOBOX_ADD(vasp_gui.algo,"NORMAL"); + GUI_COMBOBOX_ADD(vasp_gui.algo,"USE_IALGO"); + GUI_COMBOBOX_ADD(vasp_gui.algo,"VERYFAST"); + GUI_COMBOBOX_ADD(vasp_gui.algo,"FAST"); + GUI_COMBOBOX_ADD(vasp_gui.algo,"CONJUGATE"); + GUI_COMBOBOX_ADD(vasp_gui.algo,"ALL"); + GUI_COMBOBOX_ADD(vasp_gui.algo,"DAMPED"); + GUI_COMBOBOX_ADD(vasp_gui.algo,"SUBROT"); + GUI_COMBOBOX_ADD(vasp_gui.algo,"EIGENVAL"); + GUI_COMBOBOX_ADD(vasp_gui.algo,"NONE"); + GUI_COMBOBOX_ADD(vasp_gui.algo,"NOTHING"); + GUI_COMBOBOX_ADD(vasp_gui.algo,"EXACT"); + GUI_COMBOBOX_ADD(vasp_gui.algo,"DIAG"); +GUI_TOOLTIP(vasp_gui.algo,"ALGO: Ch. 6.46 DEFAULT: Normal\nSelect the electronic minimization algorithm.\nIt is overrided by IALGO when specified."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.ldiag,NULL,"LDIAG",1,2,1,2);/*not calling anything*/ +GUI_TOOLTIP(button,"LDIAG: Ch. 6.47 DEFAULT: TRUE\nSwitch on the sub-space rotation."); + GUI_ENTRY_TABLE(table,vasp_gui.nsim,vasp_gui.calc.nsim,"%i","NSIM=",2,3,1,2); +GUI_TOOLTIP(vasp_gui.nsim,"NSIM: Ch. 6.48 DEFAULT: 4\nNumber of bands optimized at a time\nin blocked minimization algorithm."); + GUI_ENTRY_TABLE(table,vasp_gui.vtime,vasp_gui.calc.vtime,"%.4lf","TIME=",3,4,1,2); +GUI_TOOLTIP(vasp_gui.vtime,"TIME: Ch. 6.51 DEFAULT: 0.4\nSelect the trial time or value step\nfor minimization algorithm IALGO=5X."); + GUI_ENTRY_TABLE(table,vasp_gui.iwavpr,vasp_gui.calc.iwavpr,"%i","IWAVPR=",4,5,1,2); +GUI_TOOLTIP(vasp_gui.iwavpr,"IWAVPR: Ch. 6.26 DEFAULT: 2(IBRION=0-2)\nDetermine how charge density/orbitals are predicted\nfrom one ionic configuration to the next.\nDefault is 0 if IBRION is different from 0-2."); /* 3rd line */ - VASP_COMBOBOX_TABLE(vasp_gui.ialgo,"IALGO=",0,1,2,3); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"2:FIXED ORB/1E"); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"3:FIXED ORB"); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"4:SUBROT ONLY"); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"5:STEEPEST"); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"6:CONJUGUATE GRADIENTS"); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"7:PRECOND. STEEPEST"); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"8:PRECOND. CG"); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"38:KOSUGI"); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"44:RMM STEEPEST"); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"46:RMM PRECOND."); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"48:PRECOND. RMM"); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"53:VAR DAMPED MD"); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"54:VAR DAMPED QUENCH MD"); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"58:VAR PRECOND. CG"); - VASP_COMBOBOX_ADD(vasp_gui.ialgo,"90:EXACT"); -VASP_TOOLTIP(vasp_gui.ialgo,"IALGO: Ch. 6.47 DEFAULT: 38\nSets the minimization algorithm number.\nIt is advised to use ALGO instead of IALGO\ndue to instabilities in extra IALGO algorithms."); - VASP_CHECK_TABLE(button,vasp_gui.calc.auto_elec,elec_toggle,"AUTO",1,2,2,3); -VASP_TOOLTIP(button,"Automatically sets NSIM, TIME, IWAVPR, NBANDS, and NELECT"); - VASP_ENTRY_TABLE(vasp_gui.nbands,vasp_gui.calc.nbands,"%i","NBANDS=",2,3,2,3); -VASP_TOOLTIP(vasp_gui.nbands,"NBANDS: Ch. 6.5 DEFAULT: NELEC/2+NIONS/2\nNumber of bands in the calculation.\nDefault for spin-polarized calcualtions is 0.6*NELECT+NMAG"); - VASP_ENTRY_TABLE(vasp_gui.nelect,vasp_gui.calc.nelect,"%.2lf","NELECT=",3,4,2,3); -VASP_TOOLTIP(vasp_gui.nelect,"NELECT: Ch. 6.35 DEFAULT: Ne valence\nSets the number of electrons\nCan be use add an extra charge background\nas an homogeneous background-charge."); + GUI_COMBOBOX_TABLE(table,vasp_gui.ialgo,"IALGO=",0,1,2,3); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"2:FIXED ORB/1E"); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"3:FIXED ORB"); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"4:SUBROT ONLY"); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"5:STEEPEST"); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"6:CONJUGUATE GRADIENTS"); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"7:PRECOND. STEEPEST"); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"8:PRECOND. CG"); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"38:KOSUGI"); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"44:RMM STEEPEST"); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"46:RMM PRECOND."); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"48:PRECOND. RMM"); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"53:VAR DAMPED MD"); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"54:VAR DAMPED QUENCH MD"); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"58:VAR PRECOND. CG"); + GUI_COMBOBOX_ADD(vasp_gui.ialgo,"90:EXACT"); +GUI_TOOLTIP(vasp_gui.ialgo,"IALGO: Ch. 6.47 DEFAULT: 38\nSets the minimization algorithm number.\nIt is advised to use ALGO instead of IALGO\ndue to instabilities in extra IALGO algorithms."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.auto_elec,elec_toggle,"AUTO",1,2,2,3); +GUI_TOOLTIP(button,"Automatically sets NSIM, TIME, IWAVPR, NBANDS, and NELECT"); + GUI_ENTRY_TABLE(table,vasp_gui.nbands,vasp_gui.calc.nbands,"%i","NBANDS=",2,3,2,3); +GUI_TOOLTIP(vasp_gui.nbands,"NBANDS: Ch. 6.5 DEFAULT: NELEC/2+NIONS/2\nNumber of bands in the calculation.\nDefault for spin-polarized calcualtions is 0.6*NELECT+NMAG"); + GUI_ENTRY_TABLE(table,vasp_gui.nelect,vasp_gui.calc.nelect,"%.2lf","NELECT=",3,4,2,3); +GUI_TOOLTIP(vasp_gui.nelect,"NELECT: Ch. 6.35 DEFAULT: Ne valence\nSets the number of electrons\nCan be use add an extra charge background\nas an homogeneous background-charge."); /*empty: col4*/ /* 4th line */ /*empty: col0*/ - VASP_CHECK_TABLE(button,vasp_gui.calc.iniwav,NULL,"INIWAV",1,2,3,4);/*not calling anything*/ -VASP_TOOLTIP(button,"INIWAV: Ch. 6.16 DEFAULT: 1\nDetermine how initial wavefunctions are filled\nThe only option is the default random filling.\nOther option (INIWAV=0) is usually not available."); - VASP_ENTRY_TABLE(vasp_gui.istart,vasp_gui.calc.istart,"%i","ISTART=",2,3,3,4); -VASP_TOOLTIP(vasp_gui.istart,"ISTART: Ch. 6.14 DEFAULT 1\nDetermine whether WAVECAR should be read.\nDefault is 0 when no WAVECAR file is found."); - VASP_ENTRY_TABLE(vasp_gui.icharg,vasp_gui.calc.icharg,"%i","ICHARG=",3,4,3,4); -VASP_TOOLTIP(vasp_gui.icharg,"ICHARG: Ch. 6.15 DEFAULT 2\nDetermine how the initial charge density is calculated\nDefault is 0 if ISTART is not 0."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.iniwav,NULL,"INIWAV",1,2,3,4);/*not calling anything*/ +GUI_TOOLTIP(button,"INIWAV: Ch. 6.16 DEFAULT: 1\nDetermine how initial wavefunctions are filled\nThe only option is the default random filling.\nOther option (INIWAV=0) is usually not available."); + GUI_ENTRY_TABLE(table,vasp_gui.istart,vasp_gui.calc.istart,"%i","ISTART=",2,3,3,4); +GUI_TOOLTIP(vasp_gui.istart,"ISTART: Ch. 6.14 DEFAULT 1\nDetermine whether WAVECAR should be read.\nDefault is 0 when no WAVECAR file is found."); + GUI_ENTRY_TABLE(table,vasp_gui.icharg,vasp_gui.calc.icharg,"%i","ICHARG=",3,4,3,4); +GUI_TOOLTIP(vasp_gui.icharg,"ICHARG: Ch. 6.15 DEFAULT 2\nDetermine how the initial charge density is calculated\nDefault is 0 if ISTART is not 0."); /*empty: col4*/ /* initialize */ - VASP_COMBOBOX_SETUP(vasp_gui.prec,0,vasp_prec_selected); - VASP_COMBOBOX_SETUP(vasp_gui.algo,0,vasp_algo_selected); - VASP_COMBOBOX_SETUP(vasp_gui.ialgo,7,vasp_ialgo_selected); - gtk_widget_set_sensitive(vasp_gui.ialgo,FALSE); - prec_toggle(NULL,NULL); - elec_toggle(NULL,NULL); + GUI_COMBOBOX_SETUP(vasp_gui.prec,0,vasp_prec_selected); + GUI_COMBOBOX_SETUP(vasp_gui.algo,0,vasp_algo_selected); + GUI_COMBOBOX_SETUP(vasp_gui.ialgo,7,vasp_ialgo_selected); + GUI_LOCK(vasp_gui.ialgo); + prec_toggle(); + elec_toggle(); /* --- end frame */ /* --- mixing */ - frame = gtk_frame_new("Mixing"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"Mixing"); /* create a table in the frame*/ - table = gtk_table_new(5, 3, FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,5,3); /* 1st line */ - VASP_COMBOBOX_TABLE(vasp_gui.mixer,"IMIX=",0,1,0,1); - VASP_COMBOBOX_ADD(vasp_gui.mixer,"0:NONE"); - VASP_COMBOBOX_ADD(vasp_gui.mixer,"1:KERKER"); - VASP_COMBOBOX_ADD(vasp_gui.mixer,"2:TCHEBYCHEV"); - VASP_COMBOBOX_ADD(vasp_gui.mixer,"4:BROYDEN"); -VASP_TOOLTIP(vasp_gui.mixer,"IMIX: Ch. 6.49 DEFAULT: 4\nDetermine the type of mixing."); - VASP_CHECK_TABLE(button,vasp_gui.calc.auto_mixer,mixer_toggle,"AUTO MIXER",1,2,0,1); -VASP_TOOLTIP(button,"Use automatic mixing settings."); - VASP_ENTRY_TABLE(vasp_gui.nelm,vasp_gui.calc.nelm,"%i","NELM=",2,3,0,1); -VASP_TOOLTIP(vasp_gui.nelm,"NELM: Ch. 6.17 DEFAULT: 60\nMaximum number of electronic steps."); - VASP_ENTRY_TABLE(vasp_gui.nelmdl,vasp_gui.calc.nelmdl,"%i","NELMDL=",3,4,0,1); -VASP_TOOLTIP(vasp_gui.nelmdl,"NELMDL: Ch. 6.17 DEFAULT -5(if IALGO=x8)\nSets the number of initial non-selfconsistent steps\ndefault is 0 if ISTART is not 0."); - VASP_ENTRY_TABLE(vasp_gui.nelmin,vasp_gui.calc.nelmin,"%i","NELMIN=",4,5,0,1); -VASP_TOOLTIP(vasp_gui.nelmin,"NELMIN: Ch. 6.17 DEFAULT: 2\nMinimum number of electronic steps."); + GUI_COMBOBOX_TABLE(table,vasp_gui.mixer,"IMIX=",0,1,0,1); + GUI_COMBOBOX_ADD(vasp_gui.mixer,"0:NONE"); + GUI_COMBOBOX_ADD(vasp_gui.mixer,"1:KERKER"); + GUI_COMBOBOX_ADD(vasp_gui.mixer,"2:TCHEBYCHEV"); + GUI_COMBOBOX_ADD(vasp_gui.mixer,"4:BROYDEN"); +GUI_TOOLTIP(vasp_gui.mixer,"IMIX: Ch. 6.49 DEFAULT: 4\nDetermine the type of mixing."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.auto_mixer,mixer_toggle,"AUTO MIXER",1,2,0,1); +GUI_TOOLTIP(button,"Use automatic mixing settings."); + GUI_ENTRY_TABLE(table,vasp_gui.nelm,vasp_gui.calc.nelm,"%i","NELM=",2,3,0,1); +GUI_TOOLTIP(vasp_gui.nelm,"NELM: Ch. 6.17 DEFAULT: 60\nMaximum number of electronic steps."); + GUI_ENTRY_TABLE(table,vasp_gui.nelmdl,vasp_gui.calc.nelmdl,"%i","NELMDL=",3,4,0,1); +GUI_TOOLTIP(vasp_gui.nelmdl,"NELMDL: Ch. 6.17 DEFAULT -5(if IALGO=x8)\nSets the number of initial non-selfconsistent steps\ndefault is 0 if ISTART is not 0."); + GUI_ENTRY_TABLE(table,vasp_gui.nelmin,vasp_gui.calc.nelmin,"%i","NELMIN=",4,5,0,1); +GUI_TOOLTIP(vasp_gui.nelmin,"NELMIN: Ch. 6.17 DEFAULT: 2\nMinimum number of electronic steps."); /* 2nd line */ - VASP_COMBOBOX_TABLE(vasp_gui.mixpre,"MIXPRE=",0,1,1,2); - VASP_COMBOBOX_ADD(vasp_gui.mixpre,"0:NONE"); - VASP_COMBOBOX_ADD(vasp_gui.mixpre,"1:F=20 INVERSE KERKER"); - VASP_COMBOBOX_ADD(vasp_gui.mixpre,"2:F=200 INVERSE KERKER"); -VASP_TOOLTIP(vasp_gui.mixpre,"MIXPRE: Ch. 6.49 DEFAULT: 1\nSelect the preconditioning for Broyden mixing."); + GUI_COMBOBOX_TABLE(table,vasp_gui.mixpre,"MIXPRE=",0,1,1,2); + GUI_COMBOBOX_ADD(vasp_gui.mixpre,"0:NONE"); + GUI_COMBOBOX_ADD(vasp_gui.mixpre,"1:F=20 INVERSE KERKER"); + GUI_COMBOBOX_ADD(vasp_gui.mixpre,"2:F=200 INVERSE KERKER"); +GUI_TOOLTIP(vasp_gui.mixpre,"MIXPRE: Ch. 6.49 DEFAULT: 1\nSelect the preconditioning for Broyden mixing."); /*empty: col1*/ - VASP_ENTRY_TABLE(vasp_gui.amix,vasp_gui.calc.amix,"%.4lf","AMIX=",2,3,1,2); -VASP_TOOLTIP(vasp_gui.amix,"AMIX: Ch. 6.49 DEFAULT: 0.4\nlinear mixing parameter\nDefault is 0.8 for ultrasoft pseudopotentials."); - VASP_ENTRY_TABLE(vasp_gui.bmix,vasp_gui.calc.bmix,"%.4lf","BMIX=",3,4,1,2); -VASP_TOOLTIP(vasp_gui.bmix,"BMIX: Ch. 6.49 DEFAULT: 1.0\ncutoff wavevector for Kerker mixing."); - VASP_ENTRY_TABLE(vasp_gui.amin,vasp_gui.calc.amin,"%.4lf","AMIN=",4,5,1,2); -VASP_TOOLTIP(vasp_gui.amin,"AMIN: Ch. 6.49 DEFAULT: 0.1\nminimal mixing parameter."); + GUI_ENTRY_TABLE(table,vasp_gui.amix,vasp_gui.calc.amix,"%.4lf","AMIX=",2,3,1,2); +GUI_TOOLTIP(vasp_gui.amix,"AMIX: Ch. 6.49 DEFAULT: 0.4\nlinear mixing parameter\nDefault is 0.8 for ultrasoft pseudopotentials."); + GUI_ENTRY_TABLE(table,vasp_gui.bmix,vasp_gui.calc.bmix,"%.4lf","BMIX=",3,4,1,2); +GUI_TOOLTIP(vasp_gui.bmix,"BMIX: Ch. 6.49 DEFAULT: 1.0\ncutoff wavevector for Kerker mixing."); + GUI_ENTRY_TABLE(table,vasp_gui.amin,vasp_gui.calc.amin,"%.4lf","AMIN=",4,5,1,2); +GUI_TOOLTIP(vasp_gui.amin,"AMIN: Ch. 6.49 DEFAULT: 0.1\nminimal mixing parameter."); /* 3rd line */ - VASP_COMBOBOX_TABLE(vasp_gui.inimix,"INIMIX=",0,1,2,3); - VASP_COMBOBOX_ADD(vasp_gui.inimix,"0:LINEAR"); - VASP_COMBOBOX_ADD(vasp_gui.inimix,"1:KERKER"); -VASP_TOOLTIP(vasp_gui.inimix,"INIMIX: Ch. 6.49 DEFAULT: 1\ntype of initial mixing in Broyden mixing."); - VASP_ENTRY_TABLE(vasp_gui.maxmix,vasp_gui.calc.maxmix,"%i","MAXMIX=",1,2,2,3); -VASP_TOOLTIP(vasp_gui.maxmix,"MAXMIX: Ch. 6.49 DEFAULT: -45\nMaximum number of steps stored in Broyden mixer."); - VASP_ENTRY_TABLE(vasp_gui.amix_mag,vasp_gui.calc.amix_mag,"%.4lf","AMIX_MAG=",2,3,2,3); -VASP_TOOLTIP(vasp_gui.amix_mag,"AMIX_MAG: Ch. 6.49 DEFAULT: 1.6\nlinear mixing parameter for magnetization."); - VASP_ENTRY_TABLE(vasp_gui.bmix_mag,vasp_gui.calc.bmix_mag,"%.4lf","BMIX_MAG=",3,4,2,3); -VASP_TOOLTIP(vasp_gui.bmix_mag,"BMIX_MAG: Ch. 6.49 DEFAULT: 1.0\ncutoff wavevector for Kerker mixing with magnetization."); - VASP_ENTRY_TABLE(vasp_gui.wc,vasp_gui.calc.wc,"%.1lf","WC=",4,5,2,3); -VASP_TOOLTIP(vasp_gui.wc,"WC: Ch. 6.49 DEFAULT: 1000\nstep weight factor for Broyden mixing."); + GUI_COMBOBOX_TABLE(table,vasp_gui.inimix,"INIMIX=",0,1,2,3); + GUI_COMBOBOX_ADD(vasp_gui.inimix,"0:LINEAR"); + GUI_COMBOBOX_ADD(vasp_gui.inimix,"1:KERKER"); +GUI_TOOLTIP(vasp_gui.inimix,"INIMIX: Ch. 6.49 DEFAULT: 1\ntype of initial mixing in Broyden mixing."); + GUI_ENTRY_TABLE(table,vasp_gui.maxmix,vasp_gui.calc.maxmix,"%i","MAXMIX=",1,2,2,3); +GUI_TOOLTIP(vasp_gui.maxmix,"MAXMIX: Ch. 6.49 DEFAULT: -45\nMaximum number of steps stored in Broyden mixer."); + GUI_ENTRY_TABLE(table,vasp_gui.amix_mag,vasp_gui.calc.amix_mag,"%.4lf","AMIX_MAG=",2,3,2,3); +GUI_TOOLTIP(vasp_gui.amix_mag,"AMIX_MAG: Ch. 6.49 DEFAULT: 1.6\nlinear mixing parameter for magnetization."); + GUI_ENTRY_TABLE(table,vasp_gui.bmix_mag,vasp_gui.calc.bmix_mag,"%.4lf","BMIX_MAG=",3,4,2,3); +GUI_TOOLTIP(vasp_gui.bmix_mag,"BMIX_MAG: Ch. 6.49 DEFAULT: 1.0\ncutoff wavevector for Kerker mixing with magnetization."); + GUI_ENTRY_TABLE(table,vasp_gui.wc,vasp_gui.calc.wc,"%.1lf","WC=",4,5,2,3); +GUI_TOOLTIP(vasp_gui.wc,"WC: Ch. 6.49 DEFAULT: 1000\nstep weight factor for Broyden mixing."); /* initialize */ - VASP_COMBOBOX_SETUP(vasp_gui.mixer,3,vasp_mixer_selected); - VASP_COMBOBOX_SETUP(vasp_gui.mixpre,1,vasp_mixpre_selected); - VASP_COMBOBOX_SETUP(vasp_gui.inimix,1,vasp_inimix_selected); - mixer_toggle(NULL,NULL); + GUI_COMBOBOX_SETUP(vasp_gui.mixer,3,vasp_mixer_selected); + GUI_COMBOBOX_SETUP(vasp_gui.mixpre,1,vasp_mixpre_selected); + GUI_COMBOBOX_SETUP(vasp_gui.inimix,1,vasp_inimix_selected); + mixer_toggle(); /* --- end frame */ /* --- projector */ - frame = gtk_frame_new("Projector"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"Projector"); /* create a table in the frame*/ - table = gtk_table_new(5, 4, FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,5,4); /* 1st line */ - VASP_COMBOBOX_TABLE(vasp_gui.lreal,"LREAL=",0,1,0,1); - VASP_COMBOBOX_ADD(vasp_gui.lreal,"Auto"); - VASP_COMBOBOX_ADD(vasp_gui.lreal,"On"); - VASP_COMBOBOX_ADD(vasp_gui.lreal,"TRUE"); - VASP_COMBOBOX_ADD(vasp_gui.lreal,"FALSE"); -VASP_TOOLTIP(vasp_gui.lreal,"LREAL: Ch. 6.39 DEFAULT: FALSE\nDetermine whether projection operators are evaluated in\nreal-space or reciprocal-space."); + GUI_COMBOBOX_TABLE(table,vasp_gui.lreal,"LREAL=",0,1,0,1); + GUI_COMBOBOX_ADD(vasp_gui.lreal,"Auto"); + GUI_COMBOBOX_ADD(vasp_gui.lreal,"On"); + GUI_COMBOBOX_ADD(vasp_gui.lreal,"TRUE"); + GUI_COMBOBOX_ADD(vasp_gui.lreal,"FALSE"); +GUI_TOOLTIP(vasp_gui.lreal,"LREAL: Ch. 6.39 DEFAULT: FALSE\nDetermine whether projection operators are evaluated in\nreal-space or reciprocal-space."); /*empty: col2*/ - VASP_TEXT_TABLE(vasp_gui.ropt,vasp_gui.calc.ropt,"ROPT=",2,5,0,1); -VASP_TOOLTIP(vasp_gui.ropt,"ROPT: Ch. 6.39 DEFAULT: -\nROPT determine the precision of the real-space operator\nfor LREAL=AUTO and LREAL=On."); + GUI_TEXT_TABLE(table,vasp_gui.ropt,vasp_gui.calc.ropt,"ROPT=",2,5,0,1); +GUI_TOOLTIP(vasp_gui.ropt,"ROPT: Ch. 6.39 DEFAULT: -\nROPT determine the precision of the real-space operator\nfor LREAL=AUTO and LREAL=On."); /* 2nd line */ /*empty: col1*/ - VASP_CHECK_TABLE(button,vasp_gui.calc.addgrid,NULL,"ADDGRID",1,2,1,2);/*not calling anything*/ -VASP_TOOLTIP(button,"ADDGRID: Ch. 6.63 DEFAULT: FALSE\nSelect the third fine grid for augmentation charge."); - VASP_ENTRY_TABLE(vasp_gui.lmaxmix,vasp_gui.calc.lmaxmix,"%i","LMAXMIX=",2,3,1,2); -VASP_TOOLTIP(vasp_gui.lmaxmix,"LMAXMIX: Ch. 6.63 DEFAULT: 2\nMaximum l-quantum number passed to charge density mixer."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.addgrid,NULL,"ADDGRID",1,2,1,2);/*not calling anything*/ +GUI_TOOLTIP(button,"ADDGRID: Ch. 6.63 DEFAULT: FALSE\nSelect the third fine grid for augmentation charge."); + GUI_ENTRY_TABLE(table,vasp_gui.lmaxmix,vasp_gui.calc.lmaxmix,"%i","LMAXMIX=",2,3,1,2); +GUI_TOOLTIP(vasp_gui.lmaxmix,"LMAXMIX: Ch. 6.63 DEFAULT: 2\nMaximum l-quantum number passed to charge density mixer."); /*empty: col4*/ - VASP_ENTRY_TABLE(vasp_gui.lmaxpaw,vasp_gui.calc.lmaxpaw,"%i","LMAXPAW=",4,5,1,2); -VASP_TOOLTIP(vasp_gui.lmaxpaw,"LMAXPAW: Ch. 6.63 DEFAULT: 2*lmax\nMaximum l-quantum number for the evaluation of the PAW\non-site terms on the radial grid."); + GUI_ENTRY_TABLE(table,vasp_gui.lmaxpaw,vasp_gui.calc.lmaxpaw,"%i","LMAXPAW=",4,5,1,2); +GUI_TOOLTIP(vasp_gui.lmaxpaw,"LMAXPAW: Ch. 6.63 DEFAULT: 2*lmax\nMaximum l-quantum number for the evaluation of the PAW\non-site terms on the radial grid."); /* 3rd line */ /*empty: col1*/ - VASP_CHECK_TABLE(button,vasp_gui.calc.auto_grid,grid_toggle,"AUTO GRID",1,2,2,3); -VASP_TOOLTIP(button,"Automatically sets NG{X,Y,Z}, and NG{X,Y,Z}F."); - VASP_ENTRY_TABLE(vasp_gui.ngx,vasp_gui.calc.ngx,"%i","NGX=",2,3,2,3); -VASP_TOOLTIP(vasp_gui.ngx,"NGX: Ch. 6.3 DEFAULT: -\nnumber of FFT-mesh grid-points along the x direction."); - VASP_ENTRY_TABLE(vasp_gui.ngy,vasp_gui.calc.ngy,"%i","NGY=",3,4,2,3); -VASP_TOOLTIP(vasp_gui.ngy,"NGY: Ch. 6.3 DEFAULT: -\nnumber of FFT-mesh grid-points along the y direction."); - VASP_ENTRY_TABLE(vasp_gui.ngz,vasp_gui.calc.ngz,"%i","NGZ=",4,5,2,3); -VASP_TOOLTIP(vasp_gui.ngz,"NGZ: Ch. 6.3 DEFAULT: -\nnumber of FFT-mesh grid-points along the z direction."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.auto_grid,grid_toggle,"AUTO GRID",1,2,2,3); +GUI_TOOLTIP(button,"Automatically sets NG{X,Y,Z}, and NG{X,Y,Z}F."); + GUI_ENTRY_TABLE(table,vasp_gui.ngx,vasp_gui.calc.ngx,"%i","NGX=",2,3,2,3); +GUI_TOOLTIP(vasp_gui.ngx,"NGX: Ch. 6.3 DEFAULT: -\nnumber of FFT-mesh grid-points along the x direction."); + GUI_ENTRY_TABLE(table,vasp_gui.ngy,vasp_gui.calc.ngy,"%i","NGY=",3,4,2,3); +GUI_TOOLTIP(vasp_gui.ngy,"NGY: Ch. 6.3 DEFAULT: -\nnumber of FFT-mesh grid-points along the y direction."); + GUI_ENTRY_TABLE(table,vasp_gui.ngz,vasp_gui.calc.ngz,"%i","NGZ=",4,5,2,3); +GUI_TOOLTIP(vasp_gui.ngz,"NGZ: Ch. 6.3 DEFAULT: -\nnumber of FFT-mesh grid-points along the z direction."); /* 4th line */ /*empty: col1*/ /*empty: col2*/ - VASP_ENTRY_TABLE(vasp_gui.ngxf,vasp_gui.calc.ngxf,"%i","NGXF=",2,3,3,4); -VASP_TOOLTIP(vasp_gui.ngxf,"NGXF: Ch. 6.3 DEFAULT: -\nnumber of fine FFT-mesh grid-points along the x direction."); - VASP_ENTRY_TABLE(vasp_gui.ngyf,vasp_gui.calc.ngyf,"%i","NGYF=",3,4,3,4); -VASP_TOOLTIP(vasp_gui.ngyf,"NGYF: Ch. 6.3 DEFAULT: -\nnumber of fine FFT-mesh grid-points along the y direction."); - VASP_ENTRY_TABLE(vasp_gui.ngzf,vasp_gui.calc.ngzf,"%i","NGZF=",4,5,3,4); -VASP_TOOLTIP(vasp_gui.ngzf,"NGZF: Ch. 6.3 DEFAULT: -\nnumber of fine FFT-mesh grid-points along the z direction."); + GUI_ENTRY_TABLE(table,vasp_gui.ngxf,vasp_gui.calc.ngxf,"%i","NGXF=",2,3,3,4); +GUI_TOOLTIP(vasp_gui.ngxf,"NGXF: Ch. 6.3 DEFAULT: -\nnumber of fine FFT-mesh grid-points along the x direction."); + GUI_ENTRY_TABLE(table,vasp_gui.ngyf,vasp_gui.calc.ngyf,"%i","NGYF=",3,4,3,4); +GUI_TOOLTIP(vasp_gui.ngyf,"NGYF: Ch. 6.3 DEFAULT: -\nnumber of fine FFT-mesh grid-points along the y direction."); + GUI_ENTRY_TABLE(table,vasp_gui.ngzf,vasp_gui.calc.ngzf,"%i","NGZF=",4,5,3,4); +GUI_TOOLTIP(vasp_gui.ngzf,"NGZF: Ch. 6.3 DEFAULT: -\nnumber of fine FFT-mesh grid-points along the z direction."); /* initialize */ - VASP_COMBOBOX_SETUP(vasp_gui.lreal,3,vasp_lreal_selected); - grid_toggle(NULL,NULL); + GUI_COMBOBOX_SETUP(vasp_gui.lreal,3,vasp_lreal_selected); + grid_toggle(); /* --- end frame */ /*-------------------*/ /* page 2 -> ELECT-I */ /*-------------------*/ - page = gtk_vbox_new(FALSE, _SPACE); - label = gtk_label_new("ELECT-I"); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook),page,label); + GUI_PAGE_NOTE(notebook,page,"ELECT-I"); /* --- smearing */ - frame = gtk_frame_new("Smearing"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"Smearing"); /* create a table in the frame*/ - table = gtk_table_new(4, 2, FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,4,2); /* 1st line */ - VASP_ENTRY_TABLE(vasp_gui.ismear,vasp_gui.calc.ismear,"%i","ISMEAR=",0,1,0,1); -VASP_TOOLTIP(vasp_gui.ismear,"ISMEAR: Ch. 6.38 DEFAULT: 1\nDetermine how the partial occupations are set.\nIt is advised to change it to ISMEAR=0\nfor semiconducting or insulating materials."); - VASP_ENTRY_TABLE(vasp_gui.sigma,vasp_gui.calc.sigma,"%.4lf","SIGMA=",1,2,0,1); -VASP_TOOLTIP(vasp_gui.sigma,"SIGMA: Ch. 6.38 DEFAULT: 0.2\nDetermine the width of the smearing (eV)\nFor ISMEAR=0 (semiconductors or insulators)\na small SIGMA=0.05 can be chosen."); - VASP_CHECK_TABLE(vasp_gui.kgamma,vasp_gui.calc.kgamma,NULL,"KGAMMA",2,3,0,1);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.kgamma,"KGAMMA: Ch. 6.4 DEFAULT: TRUE\nWhen KPOINTS file is not present KGAMMA\nindicate if the k-grid is centered around gamma point."); - VASP_ENTRY_TABLE(vasp_gui.kspacing,vasp_gui.calc.kspacing,"%.4lf","KSPACING=",3,4,0,1); -VASP_TOOLTIP(vasp_gui.kspacing,"KSPACING: Ch. 6.4 DEFAULT: 0.5\nWhen KPOINTS file is not present KSPACING\nDetermine the smallest spacing between k-points (Ang^-1)."); + GUI_ENTRY_TABLE(table,vasp_gui.ismear,vasp_gui.calc.ismear,"%i","ISMEAR=",0,1,0,1); +GUI_TOOLTIP(vasp_gui.ismear,"ISMEAR: Ch. 6.38 DEFAULT: 1\nDetermine how the partial occupations are set.\nIt is advised to change it to ISMEAR=0\nfor semiconducting or insulating materials."); + GUI_ENTRY_TABLE(table,vasp_gui.sigma,vasp_gui.calc.sigma,"%.4lf","SIGMA=",1,2,0,1); +GUI_TOOLTIP(vasp_gui.sigma,"SIGMA: Ch. 6.38 DEFAULT: 0.2\nDetermine the width of the smearing (eV)\nFor ISMEAR=0 (semiconductors or insulators)\na small SIGMA=0.05 can be chosen."); + GUI_CHECK_TABLE(table,vasp_gui.kgamma,vasp_gui.calc.kgamma,NULL,"KGAMMA",2,3,0,1);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.kgamma,"KGAMMA: Ch. 6.4 DEFAULT: TRUE\nWhen KPOINTS file is not present KGAMMA\nindicate if the k-grid is centered around gamma point."); + GUI_ENTRY_TABLE(table,vasp_gui.kspacing,vasp_gui.calc.kspacing,"%.4lf","KSPACING=",3,4,0,1); +GUI_TOOLTIP(vasp_gui.kspacing,"KSPACING: Ch. 6.4 DEFAULT: 0.5\nWhen KPOINTS file is not present KSPACING\nDetermine the smallest spacing between k-points (Ang^-1)."); /* 2nd line */ - VASP_TEXT_TABLE(vasp_gui.fermwe,vasp_gui.calc.fermwe,"FERMWE=",0,2,1,2); -VASP_TOOLTIP(vasp_gui.fermwe,"FERMWE: Ch. 6.38 DEFAULT -\nFor ISMEAR=-2 explicitly sets\noccupancy for each band."); - VASP_TEXT_TABLE(vasp_gui.fermdo,vasp_gui.calc.fermdo,"FERMDO=",2,4,1,2); -VASP_TOOLTIP(vasp_gui.fermdo,"FERDO: Ch. 6.38 DEFAULT -\nFor ISMEAR=-2 and ISPIN=2 sets\noccupancy for down spin of each band."); + GUI_TEXT_TABLE(table,vasp_gui.fermwe,vasp_gui.calc.fermwe,"FERMWE=",0,2,1,2); +GUI_TOOLTIP(vasp_gui.fermwe,"FERMWE: Ch. 6.38 DEFAULT -\nFor ISMEAR=-2 explicitly sets\noccupancy for each band."); + GUI_TEXT_TABLE(table,vasp_gui.fermdo,vasp_gui.calc.fermdo,"FERMDO=",2,4,1,2); +GUI_TOOLTIP(vasp_gui.fermdo,"FERDO: Ch. 6.38 DEFAULT -\nFor ISMEAR=-2 and ISPIN=2 sets\noccupancy for down spin of each band."); +/* initialize */ + GUI_ENTRY_CHANGE(vasp_gui.ismear,ismear_changed,NULL);/*NEW: ELECT-I ismear -> KPOINTS ismear*/ + GUI_ENTRY_CHANGE(vasp_gui.kspacing,kspacing_changed,NULL);/*NEW: ELECT-I kspacing -> KPOINTS kspacing*/ /* --- end frame */ /* --- spin */ - frame = gtk_frame_new("Spin"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"Spin"); /* create a table in the frame*/ - table = gtk_table_new(5, 2,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,5,2); /* 1st line */ - VASP_CHECK_TABLE(button,vasp_gui.calc.ispin,NULL,"SPIN POLARIZED",0,1,0,1);/*not calling anything*/ -VASP_TOOLTIP(button,"ISPIN: Ch. 6.12 DEFAULT 1\nSpin polarized calculation sets ISPIN=2."); - VASP_CHECK_TABLE(vasp_gui.lnoncoll,vasp_gui.calc.non_collinear,lnoncoll_toggle,"NON COLLINEAR",1,2,0,1); -VASP_TOOLTIP(vasp_gui.lnoncoll,"LNONCOLLINEAR: Ch. 6.68.1 DEFAULT FALSE\nAllow to perform fully, non-collinear\nmagnetic structure calculations."); - VASP_CHECK_TABLE(vasp_gui.lsorbit,vasp_gui.calc.lsorbit,lsorbit_toggle,"LSORBIT",2,3,0,1); - VASP_TOOLTIP(vasp_gui.lsorbit,"LSORBIT: Ch. 6.68.2 DEFAULT: FALSE\nSwitch on spin-orbit coupling (for PAW)\nautomatically sets LNONCOLLINEAR when TRUE."); - VASP_CHECK_TABLE(button,vasp_gui.calc.gga_compat,NULL,"GGA_COMPAT",3,4,0,1);/*not calling anything*/ -VASP_TOOLTIP(button,"GGA_COMPAT: Ch. 6.42 DEFAULT: TRUE\nRestores the lattice symmetry\nfor gradient corrected functionals."); - VASP_ENTRY_TABLE(vasp_gui.nupdown,vasp_gui.calc.nupdown,"%.1f","NUPDOWN=",4,5,0,1); -VASP_TOOLTIP(vasp_gui.nupdown,"NUPDOWN: Ch. 6.36 DEFAULT -1\nSets the difference between number\nof electrons in up and down spin component."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.ispin,NULL,"SPIN POLARIZED",0,1,0,1);/*not calling anything*/ +GUI_TOOLTIP(button,"ISPIN: Ch. 6.12 DEFAULT 1\nSpin polarized calculation sets ISPIN=2."); + GUI_CHECK_TABLE(table,vasp_gui.lnoncoll,vasp_gui.calc.non_collinear,lnoncoll_toggle,"NON COLLINEAR",1,2,0,1); +GUI_TOOLTIP(vasp_gui.lnoncoll,"LNONCOLLINEAR: Ch. 6.68.1 DEFAULT FALSE\nAllow to perform fully, non-collinear\nmagnetic structure calculations."); + GUI_CHECK_TABLE(table,vasp_gui.lsorbit,vasp_gui.calc.lsorbit,lsorbit_toggle,"LSORBIT",2,3,0,1); + GUI_TOOLTIP(vasp_gui.lsorbit,"LSORBIT: Ch. 6.68.2 DEFAULT: FALSE\nSwitch on spin-orbit coupling (for PAW)\nautomatically sets LNONCOLLINEAR when TRUE."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.gga_compat,NULL,"GGA_COMPAT",3,4,0,1);/*not calling anything*/ +GUI_TOOLTIP(button,"GGA_COMPAT: Ch. 6.42 DEFAULT: TRUE\nRestores the lattice symmetry\nfor gradient corrected functionals."); + GUI_ENTRY_TABLE(table,vasp_gui.nupdown,vasp_gui.calc.nupdown,"%.1f","NUPDOWN=",4,5,0,1); +GUI_TOOLTIP(vasp_gui.nupdown,"NUPDOWN: Ch. 6.36 DEFAULT -1\nSets the difference between number\nof electrons in up and down spin component."); /* 2nd line */ - VASP_TEXT_TABLE(vasp_gui.magmom,vasp_gui.calc.magmom,"MAGMOM=",0,3,1,2); -VASP_TOOLTIP(vasp_gui.magmom,"MAGMOM: Ch. 6.13 DEFAULT: NIONS\nSets the initial magnetic moment for each atom\nuseful only for calculation with no WAVECAR or CHGCAR\nor magnetic calculations from a non-magnetic start.\nFor non-collinear calculations default value is 3*NIONS."); - VASP_TEXT_TABLE(vasp_gui.saxis,vasp_gui.calc.saxis,"SAXIS=",3,5,1,2); -VASP_TOOLTIP(vasp_gui.saxis,"SAXIS: Ch. 6.68.2 DEFAULT -\nSets the quantisation axis for spin.\nThe default is SAXIS = eps 0 1\nwhere eps is a small quantity."); + GUI_TEXT_TABLE(table,vasp_gui.magmom,vasp_gui.calc.magmom,"MAGMOM=",0,3,1,2); +GUI_TOOLTIP(vasp_gui.magmom,"MAGMOM: Ch. 6.13 DEFAULT: NIONS\nSets the initial magnetic moment for each atom\nuseful only for calculation with no WAVECAR or CHGCAR\nor magnetic calculations from a non-magnetic start.\nFor non-collinear calculations default value is 3*NIONS."); + GUI_TEXT_TABLE(table,vasp_gui.saxis,vasp_gui.calc.saxis,"SAXIS=",3,5,1,2); +GUI_TOOLTIP(vasp_gui.saxis,"SAXIS: Ch. 6.68.2 DEFAULT -\nSets the quantisation axis for spin.\nThe default is SAXIS = eps 0 1\nwhere eps is a small quantity."); /* --- end frame */ /* --- exchange correlation */ - frame = gtk_frame_new("Exchange Correlation"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"Exchange Correlation"); /* create a table in the frame*/ - table = gtk_table_new(5, 5,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); -// gtk_container_set_border_width(GTK_CONTAINER(table), PANEL_SPACING);/*useful?*/ + GUI_TABLE_FRAME(frame,table,5,5); /* 1st line */ - VASP_COMBOBOX_TABLE(vasp_gui.gga,"GGA=",0,1,0,1); - VASP_COMBOBOX_ADD(vasp_gui.gga,"91:PW91"); - VASP_COMBOBOX_ADD(vasp_gui.gga,"PE:PBE"); - VASP_COMBOBOX_ADD(vasp_gui.gga,"RP:rPBE"); - VASP_COMBOBOX_ADD(vasp_gui.gga,"AM:AM05"); - VASP_COMBOBOX_ADD(vasp_gui.gga,"PS:PBEsol"); -VASP_TOOLTIP(vasp_gui.gga,"GGA: Ch. 6.40 DEFAULT -\nSets the gradient corrected functional.\nThe default is selected according to the POTCAR file."); - VASP_CHECK_TABLE(button,vasp_gui.calc.voskown,NULL,"VOSKOWN",1,2,0,1);/*not calling anything*/ -VASP_TOOLTIP(button,"VOSKOWN: Ch. 6.41 DEFAULT 0\nSets the Vosko, Wilk and Nusair method\nfor interpolation of correlation functional).\nUseful only if GGA=91 (PW91)."); + GUI_COMBOBOX_TABLE(table,vasp_gui.gga,"GGA=",0,1,0,1); + GUI_COMBOBOX_ADD(vasp_gui.gga,"91:PW91"); + GUI_COMBOBOX_ADD(vasp_gui.gga,"PE:PBE"); + GUI_COMBOBOX_ADD(vasp_gui.gga,"RP:rPBE"); + GUI_COMBOBOX_ADD(vasp_gui.gga,"AM:AM05"); + GUI_COMBOBOX_ADD(vasp_gui.gga,"PS:PBEsol"); +GUI_TOOLTIP(vasp_gui.gga,"GGA: Ch. 6.40 DEFAULT -\nSets the gradient corrected functional.\nThe default is selected according to the POTCAR file."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.voskown,NULL,"VOSKOWN",1,2,0,1);/*not calling anything*/ +GUI_TOOLTIP(button,"VOSKOWN: Ch. 6.41 DEFAULT 0\nSets the Vosko, Wilk and Nusair method\nfor interpolation of correlation functional).\nUseful only if GGA=91 (PW91)."); /*empty: col2*/ /*empty: col3*/ /*empty: col4*/ /* 2nd line */ - VASP_COMBOBOX_TABLE(vasp_gui.metagga,"METAGGA=",0,1,1,2); - VASP_COMBOBOX_ADD(vasp_gui.metagga,"TPSS"); - VASP_COMBOBOX_ADD(vasp_gui.metagga,"rTPSS"); - VASP_COMBOBOX_ADD(vasp_gui.metagga,"M06L"); - VASP_COMBOBOX_ADD(vasp_gui.metagga,"MBJ"); -VASP_TOOLTIP(vasp_gui.metagga,"METAGGA: Ch. 6.43 DEFAULT none\nSets the meta-GGA functional."); - VASP_CHECK_TABLE(button,vasp_gui.calc.lmetagga,metagga_toggle,"LMETAGGA",1,2,1,2); -VASP_TOOLTIP(button,"LMETAGGA (secret) DEFAULT FALSE\nIgnored (but recognized and read) by VASP.\nUsed (here) to enable a METAGGA calculation."); - VASP_CHECK_TABLE(button,vasp_gui.calc.lasph,NULL,"LASPH",2,3,1,2);/*not calling anything*/ -VASP_TOOLTIP(button,"LASPH: Ch. 6.44 DEFAULT FALSE\nSets calculation of non-spherical contributions\nfrom the gradient corrections in PAW spheres."); - VASP_CHECK_TABLE(button,vasp_gui.calc.lmixtau,NULL,"LMIXTAU",3,4,1,2);/*not calling anything*/ -VASP_TOOLTIP(button,"LMIXTAU: Ch. 6.43.2 DEFAULT FALSE\nSets inclusion of kinetic energy density\nto the mixer (useful to converge METAGGA)."); - VASP_ENTRY_TABLE(vasp_gui.lmaxtau,vasp_gui.calc.lmaxtau,"%i","LMAXTAU=",4,5,1,2); -VASP_TOOLTIP(vasp_gui.lmaxtau,"LMAXTAU: Ch. 6.43.1 DEFAULT 0\nSets maximum l-quantum number\nto calculate PAW one-center expansion\nof the kinetic energy density.\nDefault is 6 if LASPH is set to TRUE."); + GUI_COMBOBOX_TABLE(table,vasp_gui.metagga,"METAGGA=",0,1,1,2); + GUI_COMBOBOX_ADD(vasp_gui.metagga,"TPSS"); + GUI_COMBOBOX_ADD(vasp_gui.metagga,"rTPSS"); + GUI_COMBOBOX_ADD(vasp_gui.metagga,"M06L"); + GUI_COMBOBOX_ADD(vasp_gui.metagga,"MBJ"); +GUI_TOOLTIP(vasp_gui.metagga,"METAGGA: Ch. 6.43 DEFAULT none\nSets the meta-GGA functional."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.lmetagga,metagga_toggle,"LMETAGGA",1,2,1,2); +GUI_TOOLTIP(button,"LMETAGGA (secret) DEFAULT FALSE\nIgnored (but recognized and read) by VASP.\nUsed (here) to enable a METAGGA calculation."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.lasph,NULL,"LASPH",2,3,1,2);/*not calling anything*/ +GUI_TOOLTIP(button,"LASPH: Ch. 6.44 DEFAULT FALSE\nSets calculation of non-spherical contributions\nfrom the gradient corrections in PAW spheres."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.lmixtau,NULL,"LMIXTAU",3,4,1,2);/*not calling anything*/ +GUI_TOOLTIP(button,"LMIXTAU: Ch. 6.43.2 DEFAULT FALSE\nSets inclusion of kinetic energy density\nto the mixer (useful to converge METAGGA)."); + GUI_ENTRY_TABLE(table,vasp_gui.lmaxtau,vasp_gui.calc.lmaxtau,"%i","LMAXTAU=",4,5,1,2); +GUI_TOOLTIP(vasp_gui.lmaxtau,"LMAXTAU: Ch. 6.43.1 DEFAULT 0\nSets maximum l-quantum number\nto calculate PAW one-center expansion\nof the kinetic energy density.\nDefault is 6 if LASPH is set to TRUE."); /* 3rd line */ - VASP_TEXT_TABLE(vasp_gui.cmbj,vasp_gui.calc.cmbj,"CMBJ=",0,3,2,3); -VASP_TOOLTIP(vasp_gui.cmbj,"CMBJ: Ch 6.43 DEFAULT: -\nFor MBJ meta-GGA calculations CMBJ\nsets the mixing coefficient for Becke-Roussel potential\nfor each species or constant if CMBJ has only one value."); - VASP_ENTRY_TABLE(vasp_gui.cmbja,vasp_gui.calc.cmbja,"%.4lf","CMBJA=",3,4,2,3); -VASP_TOOLTIP(vasp_gui.cmbja,"CMBJA: Ch. 6.43 DEFAULT -0.012\nAlpha parameter to calculate CMBJ\nSelfconsistently at each electronic step.\nUnused if CMBJ is specified."); - VASP_ENTRY_TABLE(vasp_gui.cmbjb,vasp_gui.calc.cmbjb,"%.4lf","CMBJB=",4,5,2,3); -VASP_TOOLTIP(vasp_gui.cmbjb,"CMBJB: Ch. 6.43 DEFAULT 1.023\nBeta parameter to calculate CMBJ\nSelfconsistently at each electronic step.\nUnused if CMBJ is specified."); + GUI_TEXT_TABLE(table,vasp_gui.cmbj,vasp_gui.calc.cmbj,"CMBJ=",0,3,2,3); +GUI_TOOLTIP(vasp_gui.cmbj,"CMBJ: Ch 6.43 DEFAULT: -\nFor MBJ meta-GGA calculations CMBJ\nsets the mixing coefficient for Becke-Roussel potential\nfor each species or constant if CMBJ has only one value."); + GUI_ENTRY_TABLE(table,vasp_gui.cmbja,vasp_gui.calc.cmbja,"%.4lf","CMBJA=",3,4,2,3); +GUI_TOOLTIP(vasp_gui.cmbja,"CMBJA: Ch. 6.43 DEFAULT -0.012\nAlpha parameter to calculate CMBJ\nSelfconsistently at each electronic step.\nUnused if CMBJ is specified."); + GUI_ENTRY_TABLE(table,vasp_gui.cmbjb,vasp_gui.calc.cmbjb,"%.4lf","CMBJB=",4,5,2,3); +GUI_TOOLTIP(vasp_gui.cmbjb,"CMBJB: Ch. 6.43 DEFAULT 1.023\nBeta parameter to calculate CMBJ\nSelfconsistently at each electronic step.\nUnused if CMBJ is specified."); /* 4th line */ - VASP_COMBOBOX_TABLE(vasp_gui.ldau,"LDAUTYPE=",0,1,3,4); - VASP_COMBOBOX_ADD(vasp_gui.ldau,"1:LSDA+U Liechtenstein"); - VASP_COMBOBOX_ADD(vasp_gui.ldau,"2:LSDA+U Dudarev"); - VASP_COMBOBOX_ADD(vasp_gui.ldau,"4:LDA+U Liechtenstein"); -VASP_TOOLTIP(vasp_gui.ldau,"LDAUTYPE: Ch. 6.70 DEFAULT: 2\nSets the type of L(S)DA+U calculation."); - VASP_CHECK_TABLE(button,vasp_gui.calc.ldau,ldau_toggle,"LDAU",1,2,3,4); -VASP_TOOLTIP(button,"LDAU: Ch. 6.70 DEFAULT: FALSE\nSwitches on L(S)DA+U calculation."); - VASP_TEXT_TABLE(vasp_gui.ldaul,vasp_gui.calc.ldaul,"LDAUL=",2,5,3,4); -VASP_TOOLTIP(vasp_gui.ldaul,"LDAUL: Ch. 6.70 DEFAULT: 2\nSets the l-quantum number (for each species)\nfor which the on-site interaction is added."); + GUI_COMBOBOX_TABLE(table,vasp_gui.ldau,"LDAUTYPE=",0,1,3,4); + GUI_COMBOBOX_ADD(vasp_gui.ldau,"1:LSDA+U Liechtenstein"); + GUI_COMBOBOX_ADD(vasp_gui.ldau,"2:LSDA+U Dudarev"); + GUI_COMBOBOX_ADD(vasp_gui.ldau,"4:LDA+U Liechtenstein"); +GUI_TOOLTIP(vasp_gui.ldau,"LDAUTYPE: Ch. 6.70 DEFAULT: 2\nSets the type of L(S)DA+U calculation."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.ldau,ldau_toggle,"LDAU",1,2,3,4); +GUI_TOOLTIP(button,"LDAU: Ch. 6.70 DEFAULT: FALSE\nSwitches on L(S)DA+U calculation."); + GUI_TEXT_TABLE(table,vasp_gui.ldaul,vasp_gui.calc.ldaul,"LDAUL=",2,5,3,4); +GUI_TOOLTIP(vasp_gui.ldaul,"LDAUL: Ch. 6.70 DEFAULT: 2\nSets the l-quantum number (for each species)\nfor which the on-site interaction is added."); /* 5th line */ - VASP_COMBOBOX_TABLE(vasp_gui.ldau_print,"LDAUPRINT=",0,1,4,5); - VASP_COMBOBOX_ADD(vasp_gui.ldau_print,"0:Silent"); - VASP_COMBOBOX_ADD(vasp_gui.ldau_print,"1:Occupancy matrix"); - VASP_COMBOBOX_ADD(vasp_gui.ldau_print,"2:Full output"); -VASP_TOOLTIP(vasp_gui.ldau_print,"LDAUPRINT: Ch. 6.70 DEFAULT 0\nSets the level of verbosity of L(S)DA+U."); - VASP_TEXT_TABLE(vasp_gui.ldauu,vasp_gui.calc.ldauu,"LDAUU=",1,3,4,5); -VASP_TOOLTIP(vasp_gui.ldauu,"LDAUU: Ch. 6.70 DEFAULT: -\nSets effective on-site Coulomb interaction (for each species)."); - VASP_TEXT_TABLE(vasp_gui.ldauj,vasp_gui.calc.ldauj,"LDAUJ=",3,5,4,5); -VASP_TOOLTIP(vasp_gui.ldauj,"LDAUJ: Ch. 6.70 DEFAULT: -\nSets effective on-site Exchange interaction (for each species)."); + GUI_COMBOBOX_TABLE(table,vasp_gui.ldau_print,"LDAUPRINT=",0,1,4,5); + GUI_COMBOBOX_ADD(vasp_gui.ldau_print,"0:Silent"); + GUI_COMBOBOX_ADD(vasp_gui.ldau_print,"1:Occupancy matrix"); + GUI_COMBOBOX_ADD(vasp_gui.ldau_print,"2:Full output"); +GUI_TOOLTIP(vasp_gui.ldau_print,"LDAUPRINT: Ch. 6.70 DEFAULT 0\nSets the level of verbosity of L(S)DA+U."); + GUI_TEXT_TABLE(table,vasp_gui.ldauu,vasp_gui.calc.ldauu,"LDAUU=",1,3,4,5); +GUI_TOOLTIP(vasp_gui.ldauu,"LDAUU: Ch. 6.70 DEFAULT: -\nSets effective on-site Coulomb interaction (for each species)."); + GUI_TEXT_TABLE(table,vasp_gui.ldauj,vasp_gui.calc.ldauj,"LDAUJ=",3,5,4,5); +GUI_TOOLTIP(vasp_gui.ldauj,"LDAUJ: Ch. 6.70 DEFAULT: -\nSets effective on-site Exchange interaction (for each species)."); /* initialize */ - VASP_COMBOBOX_SETUP(vasp_gui.gga,1,vasp_gga_selected); - VASP_COMBOBOX_SETUP(vasp_gui.metagga,3,vasp_metagga_selected); - VASP_COMBOBOX_SETUP(vasp_gui.ldau,1,vasp_ldau_selected); - VASP_COMBOBOX_SETUP(vasp_gui.ldau_print,0,vasp_ldau_print_selected); - metagga_toggle(NULL,NULL);/*initialize TODO: move to end*/ - ldau_toggle(NULL,NULL);/*initialize TODO: move to end*/ + GUI_COMBOBOX_SETUP(vasp_gui.gga,1,vasp_gga_selected); + GUI_COMBOBOX_SETUP(vasp_gui.metagga,3,vasp_metagga_selected); + GUI_COMBOBOX_SETUP(vasp_gui.ldau,1,vasp_ldau_selected); + GUI_COMBOBOX_SETUP(vasp_gui.ldau_print,0,vasp_ldau_print_selected); + metagga_toggle(); + ldau_toggle(); /* --- end frame */ /* --- dipole */ - frame = gtk_frame_new("Dipole"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"Dipole"); /* create a table in the frame*/ - table = gtk_table_new(2, 5,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); -// gtk_container_set_border_width(GTK_CONTAINER(table), PANEL_SPACING);/*useful?*/ + GUI_TABLE_FRAME(frame,table,2,5); /* 1st line */ - VASP_COMBOBOX_TABLE(vasp_gui.idipol,"IDIPOL=",0,1,0,1); - VASP_COMBOBOX_ADD(vasp_gui.idipol,"0:no calcul"); - VASP_COMBOBOX_ADD(vasp_gui.idipol,"1:u axis"); - VASP_COMBOBOX_ADD(vasp_gui.idipol,"2:v axis"); - VASP_COMBOBOX_ADD(vasp_gui.idipol,"3:w axis"); - VASP_COMBOBOX_ADD(vasp_gui.idipol,"4:all axis"); -VASP_TOOLTIP(vasp_gui.idipol,"IDIPOL: Ch. 6.64 DEFAULT: -\nSets the direction of the calculated dipole moment\nparallel to the 1st (1), 2nd (2) or 3rd (3) lattice vector.\nIDIPOL=4 trigger full dipole calculation\n0 switches off dipole calculation (remove IDIPOL)."); - VASP_CHECK_TABLE(vasp_gui.ldipol,vasp_gui.calc.ldipol,NULL,"LDIPOL",1,2,0,1);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.ldipol,"LDIPOL: Ch. 6.64 DEFAULT: FALSE\nSets potential dipole correction of the\nslab/molecule periodic-boundary induced errors."); - VASP_CHECK_TABLE(vasp_gui.lmono,vasp_gui.calc.lmono,NULL,"LMONO",2,3,0,1);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.lmono,"LMONO: Ch. 6.64 DEFAULT: FALSE\nSets potential monopole correction of the\nslab/molecule periodic-boundary induced errors."); - VASP_TEXT_TABLE(vasp_gui.dipol,vasp_gui.calc.dipol,"DIPOL=",3,5,0,1); -VASP_TOOLTIP(vasp_gui.dipol,"DIPOL: Ch. 6.64 DEFAULT: -\nSets the center of the net charge distribution.\nIf left blank a guess value is sets at runtime."); + GUI_COMBOBOX_TABLE(table,vasp_gui.idipol,"IDIPOL=",0,1,0,1); + GUI_COMBOBOX_ADD(vasp_gui.idipol,"0:no calcul"); + GUI_COMBOBOX_ADD(vasp_gui.idipol,"1:u axis"); + GUI_COMBOBOX_ADD(vasp_gui.idipol,"2:v axis"); + GUI_COMBOBOX_ADD(vasp_gui.idipol,"3:w axis"); + GUI_COMBOBOX_ADD(vasp_gui.idipol,"4:all axis"); +GUI_TOOLTIP(vasp_gui.idipol,"IDIPOL: Ch. 6.64 DEFAULT: -\nSets the direction of the calculated dipole moment\nparallel to the 1st (1), 2nd (2) or 3rd (3) lattice vector.\nIDIPOL=4 trigger full dipole calculation\n0 switches off dipole calculation (remove IDIPOL)."); + GUI_CHECK_TABLE(table,vasp_gui.ldipol,vasp_gui.calc.ldipol,NULL,"LDIPOL",1,2,0,1);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.ldipol,"LDIPOL: Ch. 6.64 DEFAULT: FALSE\nSets potential dipole correction of the\nslab/molecule periodic-boundary induced errors."); + GUI_CHECK_TABLE(table,vasp_gui.lmono,vasp_gui.calc.lmono,NULL,"LMONO",2,3,0,1);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.lmono,"LMONO: Ch. 6.64 DEFAULT: FALSE\nSets potential monopole correction of the\nslab/molecule periodic-boundary induced errors."); + GUI_TEXT_TABLE(table,vasp_gui.dipol,vasp_gui.calc.dipol,"DIPOL=",3,5,0,1); +GUI_TOOLTIP(vasp_gui.dipol,"DIPOL: Ch. 6.64 DEFAULT: -\nSets the center of the net charge distribution.\nIf left blank a guess value is sets at runtime."); /* 2nd line */ /*empty: col0*/ /*empty: col1*/ /*empty: col2*/ - VASP_ENTRY_TABLE(vasp_gui.epsilon,vasp_gui.calc.epsilon,"%.4lf","EPSILON=",3,4,2,3); -VASP_TOOLTIP(vasp_gui.epsilon,"EPSILON: Ch. 6.64 DEFAULT: 1\nSets the dielectric constant of the medium."); - VASP_ENTRY_TABLE(vasp_gui.efield,vasp_gui.calc.efield,"%.4lf","EFIELD=",4,5,2,3); -VASP_TOOLTIP(vasp_gui.efield,"EFIELD: Ch. 6.64 DEFAULT: 0\nApply an external electrostatic field\nin a slab, or molecule calculation.\nOnly a single component can be given\nparallel to IDIPOL direction (1-3)."); + GUI_ENTRY_TABLE(table,vasp_gui.epsilon,vasp_gui.calc.epsilon,"%.4lf","EPSILON=",3,4,2,3); +GUI_TOOLTIP(vasp_gui.epsilon,"EPSILON: Ch. 6.64 DEFAULT: 1\nSets the dielectric constant of the medium."); + GUI_ENTRY_TABLE(table,vasp_gui.efield,vasp_gui.calc.efield,"%.4lf","EFIELD=",4,5,2,3); +GUI_TOOLTIP(vasp_gui.efield,"EFIELD: Ch. 6.64 DEFAULT: 0\nApply an external electrostatic field\nin a slab, or molecule calculation.\nOnly a single component can be given\nparallel to IDIPOL direction (1-3)."); /*initialize sensitive widget*/ - VASP_COMBOBOX_SETUP(vasp_gui.idipol,0,vasp_idipol_selected); + GUI_COMBOBOX_SETUP(vasp_gui.idipol,0,vasp_idipol_selected); if(vasp_gui.calc.idipol!=VID_0) { - gtk_widget_set_sensitive(vasp_gui.ldipol,TRUE); - gtk_widget_set_sensitive(vasp_gui.lmono,TRUE); - gtk_widget_set_sensitive(vasp_gui.dipol,TRUE); - gtk_widget_set_sensitive(vasp_gui.epsilon,TRUE); - if(vasp_gui.calc.idipol!=VID_4) gtk_widget_set_sensitive(vasp_gui.efield,TRUE); + GUI_UNLOCK(vasp_gui.ldipol); + GUI_UNLOCK(vasp_gui.lmono); + GUI_UNLOCK(vasp_gui.dipol); + GUI_UNLOCK(vasp_gui.epsilon); + if(vasp_gui.calc.idipol!=VID_4) GUI_UNLOCK(vasp_gui.efield); }else{ - gtk_widget_set_sensitive(vasp_gui.ldipol,FALSE); - gtk_widget_set_sensitive(vasp_gui.lmono,FALSE); - gtk_widget_set_sensitive(vasp_gui.dipol,FALSE); - gtk_widget_set_sensitive(vasp_gui.epsilon,FALSE); - gtk_widget_set_sensitive(vasp_gui.efield,FALSE); + GUI_LOCK(vasp_gui.ldipol); + GUI_LOCK(vasp_gui.lmono); + GUI_LOCK(vasp_gui.dipol); + GUI_LOCK(vasp_gui.epsilon); + GUI_LOCK(vasp_gui.efield); } /* --- end frame */ /*---------------------*/ /* page 2b -> ELECT-II */ /*---------------------*/ - page = gtk_vbox_new(FALSE, _SPACE); - label = gtk_label_new("ELECT-II"); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook),page,label); + GUI_PAGE_NOTE(notebook,page,"ELECT-II"); /* --- DOS */ - frame = gtk_frame_new("Density of States"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"Density of States"); /* create a table in the frame*/ - table = gtk_table_new(2, 5, FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,2,5); /* 1st line */ - VASP_COMBOBOX_TABLE(vasp_gui.lorbit,"LORBIT=",0,1,0,1); - VASP_COMBOBOX_ADD(vasp_gui.lorbit,"0:PROCAR"); - VASP_COMBOBOX_ADD(vasp_gui.lorbit,"1:lm-PROCAR"); - VASP_COMBOBOX_ADD(vasp_gui.lorbit,"2:phase+lm-PROCAR"); - VASP_COMBOBOX_ADD(vasp_gui.lorbit,"5:PROOUT"); - VASP_COMBOBOX_ADD(vasp_gui.lorbit,"10:PROCAR"); - VASP_COMBOBOX_ADD(vasp_gui.lorbit,"11:lm-PROCAR"); - VASP_COMBOBOX_ADD(vasp_gui.lorbit,"12:phase+lm-PROCAR"); -VASP_TOOLTIP(vasp_gui.lorbit,"LORBIT: Ch. 6.34 DEFAULT: 0\nSets the spd- and site projected\nwavefunction character of each band\nand the local partial DOS."); - VASP_ENTRY_TABLE(vasp_gui.nedos,vasp_gui.calc.nedos,"%i","NEDOS=",1,2,0,1); -VASP_TOOLTIP(vasp_gui.nedos,"NEDOS: Ch. 6.37 DEFAULT: 301\nNumber of points for which DOS is calculated."); - VASP_ENTRY_TABLE(vasp_gui.emin,vasp_gui.calc.emin,"%.2lf","EMIN=",2,3,0,1); -VASP_TOOLTIP(vasp_gui.emin,"EMIN: Ch. 6.37 DEFAULT: low eig-eps\nSets the smallest energy for which DOS is calculated.\nDefault is lowest Kohn-Sham eigenvalue minus a small quantity."); - VASP_ENTRY_TABLE(vasp_gui.emax,vasp_gui.calc.emax,"%.2lf","EMAX=",3,4,0,1); -VASP_TOOLTIP(vasp_gui.emax,"EMAX: Ch. 6.37 DEFAULT: high eig+eps\nSets the highest energy for which DOS is calculated.\nDefault is highest Kohn-Sham eigenvalue plus a small quantity."); - VASP_ENTRY_TABLE(vasp_gui.efermi,vasp_gui.calc.efermi,"%.2lf","EFERMI=",4,5,0,1); -VASP_TOOLTIP(vasp_gui.efermi,"EFERMI: (secret) DEFAULT: EREF\nSets initial Fermi energy before it is calculated.\nUsually there is no use to change this setting.\nEREF is actually another \"secret\" parameter."); + GUI_COMBOBOX_TABLE(table,vasp_gui.lorbit,"LORBIT=",0,1,0,1); + GUI_COMBOBOX_ADD(vasp_gui.lorbit,"0:PROCAR"); + GUI_COMBOBOX_ADD(vasp_gui.lorbit,"1:lm-PROCAR"); + GUI_COMBOBOX_ADD(vasp_gui.lorbit,"2:phase+lm-PROCAR"); + GUI_COMBOBOX_ADD(vasp_gui.lorbit,"5:PROOUT"); + GUI_COMBOBOX_ADD(vasp_gui.lorbit,"10:PROCAR"); + GUI_COMBOBOX_ADD(vasp_gui.lorbit,"11:lm-PROCAR"); + GUI_COMBOBOX_ADD(vasp_gui.lorbit,"12:phase+lm-PROCAR"); +GUI_TOOLTIP(vasp_gui.lorbit,"LORBIT: Ch. 6.34 DEFAULT: 0\nSets the spd- and site projected\nwavefunction character of each band\nand the local partial DOS."); + GUI_ENTRY_TABLE(table,vasp_gui.nedos,vasp_gui.calc.nedos,"%i","NEDOS=",1,2,0,1); +GUI_TOOLTIP(vasp_gui.nedos,"NEDOS: Ch. 6.37 DEFAULT: 301\nNumber of points for which DOS is calculated."); + GUI_ENTRY_TABLE(table,vasp_gui.emin,vasp_gui.calc.emin,"%.2lf","EMIN=",2,3,0,1); +GUI_TOOLTIP(vasp_gui.emin,"EMIN: Ch. 6.37 DEFAULT: low eig-eps\nSets the smallest energy for which DOS is calculated.\nDefault is lowest Kohn-Sham eigenvalue minus a small quantity."); + GUI_ENTRY_TABLE(table,vasp_gui.emax,vasp_gui.calc.emax,"%.2lf","EMAX=",3,4,0,1); +GUI_TOOLTIP(vasp_gui.emax,"EMAX: Ch. 6.37 DEFAULT: high eig+eps\nSets the highest energy for which DOS is calculated.\nDefault is highest Kohn-Sham eigenvalue plus a small quantity."); + GUI_ENTRY_TABLE(table,vasp_gui.efermi,vasp_gui.calc.efermi,"%.2lf","EFERMI=",4,5,0,1); +GUI_TOOLTIP(vasp_gui.efermi,"EFERMI: (secret) DEFAULT: EREF\nSets initial Fermi energy before it is calculated.\nUsually there is no use to change this setting.\nEREF is actually another \"secret\" parameter."); /* 2nd line */ - VASP_LABEL_TABLE("(LORBIT>5) => Req. PAW",0,1,1,2); - VASP_CHECK_TABLE(vasp_gui.have_paw,vasp_gui.calc.have_paw,NULL,"HAVE PAW",1,2,1,2);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.have_paw,"Is set if a PAW POTCAR file is detected."); - gtk_widget_set_sensitive(vasp_gui.have_paw,FALSE);/*just an indication*/ - VASP_TEXT_TABLE(vasp_gui.rwigs,vasp_gui.calc.rwigs,"RWIGS=",2,5,1,2); -VASP_TOOLTIP(vasp_gui.rwigs,"RWIGS: Ch. 6.33 DEFAULT: -\nSets the Wigner Seitz radius for each species.\nDefault value is read from POTCAR."); + GUI_LEFT_LABEL_TABLE(table,"(LORBIT>5) => Req. PAW",0,1,1,2); + GUI_CHECK_TABLE(table,vasp_gui.have_paw,vasp_gui.calc.have_paw,NULL,"HAVE PAW",1,2,1,2);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.have_paw,"Is set if a PAW POTCAR file is detected."); + GUI_LOCK(vasp_gui.have_paw);/*just an indication*/ + GUI_TEXT_TABLE(table,vasp_gui.rwigs,vasp_gui.calc.rwigs,"RWIGS=",2,5,1,2); +GUI_TOOLTIP(vasp_gui.rwigs,"RWIGS: Ch. 6.33 DEFAULT: -\nSets the Wigner Seitz radius for each species.\nDefault value is read from POTCAR."); /* initialize */ -if(vasp_gui.calc.have_paw) VASP_COMBOBOX_SETUP(vasp_gui.lorbit,4,vasp_lorbit_selected); -else VASP_COMBOBOX_SETUP(vasp_gui.lorbit,0,vasp_lorbit_selected); +if(vasp_gui.calc.have_paw) GUI_COMBOBOX_SETUP(vasp_gui.lorbit,4,vasp_lorbit_selected); +else GUI_COMBOBOX_SETUP(vasp_gui.lorbit,0,vasp_lorbit_selected); /* --- end frame */ /* --- Linear Response */ - frame = gtk_frame_new("Linear Response"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"Linear Response"); /* create a table in the frame*/ - table = gtk_table_new(1, 5,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,1,5); /* 1st line */ - VASP_CHECK_TABLE(vasp_gui.loptics,vasp_gui.calc.loptics,NULL,"LOPTICS",0,1,0,1);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.loptics,"LOPTICS: Ch. 6.72.1 DEFAULT: FALSE\nSwitch frequency dependent dielectric matrix calculation\nover a grid determined by NEDOS.\nIt is advised to increase NEDOS & NBANDS."); - VASP_CHECK_TABLE(vasp_gui.lepsilon,vasp_gui.calc.lepsilon,NULL,"LEPSILON",1,2,0,1);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.lepsilon,"LEPSILON: Ch. 6.72.4 DEFAULT: FALSE\nSwitch dielectric matrix calculation using\ndensity functional perturbation theory.\nConcurrent to LOPTICS, it is not recommended\nto run both at the same time."); - VASP_CHECK_TABLE(vasp_gui.lrpa,vasp_gui.calc.lrpa,NULL,"LRPA",2,3,0,1);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.lrpa,"LRPA: Ch. 6.72.5 DEFAULT: FALSE\nSwitch local field effects calculation\non the Hartree level only (no XC)."); - VASP_CHECK_TABLE(vasp_gui.lnabla,vasp_gui.calc.lnabla,NULL,"LNABLA",3,4,0,1);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.lnabla,"LNABLA: Ch. 6.72.3 DEFAULT: FALSE\nSwitch to the simple transversal expressions\nof the frequency dependent dielectric matrix.\nUsually there is no use to change this setting."); - VASP_ENTRY_TABLE(vasp_gui.cshift,vasp_gui.calc.cshift,"%.2lf","CSHIFT=",4,5,0,1); -VASP_TOOLTIP(vasp_gui.cshift,"CSHIFT: Ch. 6.72.2 DEFAULT: 0.1\nSets the complex shift \%nu of the Kramers-Kronig\ntransformation of the dielectric function.\nIf CSHIFT is decreased, NEDOS should be increased."); + GUI_CHECK_TABLE(table,vasp_gui.loptics,vasp_gui.calc.loptics,NULL,"LOPTICS",0,1,0,1);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.loptics,"LOPTICS: Ch. 6.72.1 DEFAULT: FALSE\nSwitch frequency dependent dielectric matrix calculation\nover a grid determined by NEDOS.\nIt is advised to increase NEDOS & NBANDS."); + GUI_CHECK_TABLE(table,vasp_gui.lepsilon,vasp_gui.calc.lepsilon,NULL,"LEPSILON",1,2,0,1);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.lepsilon,"LEPSILON: Ch. 6.72.4 DEFAULT: FALSE\nSwitch dielectric matrix calculation using\ndensity functional perturbation theory.\nConcurrent to LOPTICS, it is not recommended\nto run both at the same time."); + GUI_CHECK_TABLE(table,vasp_gui.lrpa,vasp_gui.calc.lrpa,NULL,"LRPA",2,3,0,1);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.lrpa,"LRPA: Ch. 6.72.5 DEFAULT: FALSE\nSwitch local field effects calculation\non the Hartree level only (no XC)."); + GUI_CHECK_TABLE(table,vasp_gui.lnabla,vasp_gui.calc.lnabla,NULL,"LNABLA",3,4,0,1);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.lnabla,"LNABLA: Ch. 6.72.3 DEFAULT: FALSE\nSwitch to the simple transversal expressions\nof the frequency dependent dielectric matrix.\nUsually there is no use to change this setting."); + GUI_ENTRY_TABLE(table,vasp_gui.cshift,vasp_gui.calc.cshift,"%.2lf","CSHIFT=",4,5,0,1); +GUI_TOOLTIP(vasp_gui.cshift,"CSHIFT: Ch. 6.72.2 DEFAULT: 0.1\nSets the complex shift \%nu of the Kramers-Kronig\ntransformation of the dielectric function.\nIf CSHIFT is decreased, NEDOS should be increased."); /* --- end frame */ - /*-----------------*/ /* page 3 -> IONIC */ /*-----------------*/ - page = gtk_vbox_new(FALSE, _SPACE); - label = gtk_label_new("IONIC"); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook),page,label); + GUI_PAGE_NOTE(notebook,page,"IONIC"); /* --- general */ - frame = gtk_frame_new("General"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"General"); /* create a table in the frame*/ - table = gtk_table_new(2, 5,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,2,5); /* 1st line */ - VASP_COMBOBOX_TABLE(vasp_gui.ibrion,"IBRION=",0,1,0,1); - VASP_COMBOBOX_ADD(vasp_gui.ibrion,"-1:Nothing"); - VASP_COMBOBOX_ADD(vasp_gui.ibrion,"0:Molecular Dynamics"); - VASP_COMBOBOX_ADD(vasp_gui.ibrion,"1:Quasi-Newton"); - VASP_COMBOBOX_ADD(vasp_gui.ibrion,"2:Conjugate Gradients"); - VASP_COMBOBOX_ADD(vasp_gui.ibrion,"3:Damped"); - VASP_COMBOBOX_ADD(vasp_gui.ibrion,"5:Finite Differences"); - VASP_COMBOBOX_ADD(vasp_gui.ibrion,"6:Finite Diff. with SYM"); - VASP_COMBOBOX_ADD(vasp_gui.ibrion,"7:Perturbation Theory"); - VASP_COMBOBOX_ADD(vasp_gui.ibrion,"8:Pert. Theory with SYM"); - VASP_COMBOBOX_ADD(vasp_gui.ibrion,"44:Transition State"); -VASP_TOOLTIP(vasp_gui.ibrion,"IBRION: Ch. 6.22 DEFAULT -1\nSets the algorithm for the ions motion.\nDefault is IBRION=0 if NSW>1."); - VASP_ENTRY_TABLE(vasp_gui.nsw,vasp_gui.calc.nsw,"%i","NSW=",1,2,0,1); -VASP_TOOLTIP(vasp_gui.nsw,"NSW: Ch. 6.20 DEFAULT 0\nSet the maximum number of ionic steps."); - VASP_ENTRY_TABLE(vasp_gui.ediffg,vasp_gui.calc.ediffg,"%.2E","EDIFFG=",2,3,0,1); -VASP_TOOLTIP(vasp_gui.ediffg,"EDIFFG: Ch. 6.19 DEFAULT EDIFF*10\nSets the energy criterion for ending ionic relaxation\n>0 value are for energy difference (eV)\n<0 values are for absolute forces value (eV/Ang)."); - VASP_ENTRY_TABLE(vasp_gui.potim,vasp_gui.calc.potim,"%.4lf","POTIM=",3,4,0,1); -VASP_TOOLTIP(vasp_gui.potim,"POTIM: Ch. 6.23 DEFAULT 0.5\nFor IBRION=0 (MD) sets time step (fs)\nfor IBRION=1-3 sets force scaling constant."); - VASP_ENTRY_TABLE(vasp_gui.pstress,vasp_gui.calc.pstress,"%.4lf","PSTRESS=",4,5,0,1); -VASP_TOOLTIP(vasp_gui.pstress,"PSTRESS: Ch. 6.25 DEFAULT 0\nSets the Pulay stress correction (kBar)\nalso used to set an external pressure."); + GUI_COMBOBOX_TABLE(table,vasp_gui.ibrion,"IBRION=",0,1,0,1); + GUI_COMBOBOX_ADD(vasp_gui.ibrion,"-1:Nothing"); + GUI_COMBOBOX_ADD(vasp_gui.ibrion,"0:Molecular Dynamics"); + GUI_COMBOBOX_ADD(vasp_gui.ibrion,"1:Quasi-Newton"); + GUI_COMBOBOX_ADD(vasp_gui.ibrion,"2:Conjugate Gradients"); + GUI_COMBOBOX_ADD(vasp_gui.ibrion,"3:Damped"); + GUI_COMBOBOX_ADD(vasp_gui.ibrion,"5:Finite Differences"); + GUI_COMBOBOX_ADD(vasp_gui.ibrion,"6:Finite Diff. with SYM"); + GUI_COMBOBOX_ADD(vasp_gui.ibrion,"7:Perturbation Theory"); + GUI_COMBOBOX_ADD(vasp_gui.ibrion,"8:Pert. Theory with SYM"); + GUI_COMBOBOX_ADD(vasp_gui.ibrion,"44:Transition State"); +GUI_TOOLTIP(vasp_gui.ibrion,"IBRION: Ch. 6.22 DEFAULT -1\nSets the algorithm for the ions motion.\nDefault is IBRION=0 if NSW>1."); + GUI_ENTRY_TABLE(table,vasp_gui.nsw,vasp_gui.calc.nsw,"%i","NSW=",1,2,0,1); +GUI_TOOLTIP(vasp_gui.nsw,"NSW: Ch. 6.20 DEFAULT 0\nSet the maximum number of ionic steps."); + GUI_ENTRY_TABLE(table,vasp_gui.ediffg,vasp_gui.calc.ediffg,"%.2E","EDIFFG=",2,3,0,1); +GUI_TOOLTIP(vasp_gui.ediffg,"EDIFFG: Ch. 6.19 DEFAULT EDIFF*10\nSets the energy criterion for ending ionic relaxation\n>0 value are for energy difference (eV)\n<0 values are for absolute forces value (eV/Ang)."); + GUI_ENTRY_TABLE(table,vasp_gui.potim,vasp_gui.calc.potim,"%.4lf","POTIM=",3,4,0,1); +GUI_TOOLTIP(vasp_gui.potim,"POTIM: Ch. 6.23 DEFAULT 0.5\nFor IBRION=0 (MD) sets time step (fs)\nfor IBRION=1-3 sets force scaling constant."); + GUI_ENTRY_TABLE(table,vasp_gui.pstress,vasp_gui.calc.pstress,"%.4lf","PSTRESS=",4,5,0,1); +GUI_TOOLTIP(vasp_gui.pstress,"PSTRESS: Ch. 6.25 DEFAULT 0\nSets the Pulay stress correction (kBar)\nalso used to set an external pressure."); /* 2nd line */ - VASP_COMBOBOX_TABLE(vasp_gui.isif,"ISIF=",0,1,1,2); - VASP_COMBOBOX_ADD(vasp_gui.isif,"0:F_0_I_0_0"); - VASP_COMBOBOX_ADD(vasp_gui.isif,"1:F_P_I_0_0"); - VASP_COMBOBOX_ADD(vasp_gui.isif,"2:F_S_I_0_0"); - VASP_COMBOBOX_ADD(vasp_gui.isif,"3:F_S_I_S_V"); - VASP_COMBOBOX_ADD(vasp_gui.isif,"4:F_S_I_S_0"); - VASP_COMBOBOX_ADD(vasp_gui.isif,"5:F_S_0_S_0"); - VASP_COMBOBOX_ADD(vasp_gui.isif,"6:F_S_0_S_V"); - VASP_COMBOBOX_ADD(vasp_gui.isif,"7:F_S_0_0_V"); -VASP_TOOLTIP(vasp_gui.isif,"ISIF: Ch. 6.24 DEFAULT 2\nSwitch to calculate F(force) and S(stress)\nand to relax I(ion) S(cell shape) and V(cell voume)\n0 = no calcul/no relaxation P = only total Pressure\nDefault is 0(F_0_I_0_0) if IBRION=0."); - VASP_CHECK_TABLE(vasp_gui.relax_ions,vasp_gui.rions,isif_toggle,"atom positions",1,2,1,2); -VASP_TOOLTIP(vasp_gui.relax_ions,"Switches atomic relaxation.\nUpdates ISIF accordingly (but not IBRION)."); - VASP_CHECK_TABLE(vasp_gui.relax_shape,vasp_gui.rshape,isif_toggle,"cell shape",2,3,1,2); -VASP_TOOLTIP(vasp_gui.relax_ions,"Switches cell shape relaxation.\nUpdates ISIF accordingly (but not IBRION)."); - VASP_CHECK_TABLE(vasp_gui.relax_volume,vasp_gui.rvolume,isif_toggle,"cell volume",3,4,1,2); -VASP_TOOLTIP(vasp_gui.relax_ions,"Switches cell volume relaxation.\nUpdates ISIF accordingly (but not IBRION)."); - VASP_ENTRY_TABLE(vasp_gui.nfree,vasp_gui.calc.nfree,"%i","NFREE=",4,5,1,2); -VASP_TOOLTIP(vasp_gui.nfree,"NFREE: Ch. 6.22 DEFAULT: -\nSets the number of ionic steps kept in history\nfor IBRION=1 Quasi-Newton algorithm.\nFor finite difference IBRION=5-6 NFREE\nsets the number of displacement/direction/atom."); + GUI_COMBOBOX_TABLE(table,vasp_gui.isif,"ISIF=",0,1,1,2); + GUI_COMBOBOX_ADD(vasp_gui.isif,"0:F_0_I_0_0"); + GUI_COMBOBOX_ADD(vasp_gui.isif,"1:F_P_I_0_0"); + GUI_COMBOBOX_ADD(vasp_gui.isif,"2:F_S_I_0_0"); + GUI_COMBOBOX_ADD(vasp_gui.isif,"3:F_S_I_S_V"); + GUI_COMBOBOX_ADD(vasp_gui.isif,"4:F_S_I_S_0"); + GUI_COMBOBOX_ADD(vasp_gui.isif,"5:F_S_0_S_0"); + GUI_COMBOBOX_ADD(vasp_gui.isif,"6:F_S_0_S_V"); + GUI_COMBOBOX_ADD(vasp_gui.isif,"7:F_S_0_0_V"); +GUI_TOOLTIP(vasp_gui.isif,"ISIF: Ch. 6.24 DEFAULT 2\nSwitch to calculate F(force) and S(stress)\nand to relax I(ion) S(cell shape) and V(cell voume)\n0 = no calcul/no relaxation P = only total Pressure\nDefault is 0(F_0_I_0_0) if IBRION=0."); + GUI_CHECK_TABLE(table,vasp_gui.relax_ions,vasp_gui.rions,isif_toggle,"atom positions",1,2,1,2); +GUI_TOOLTIP(vasp_gui.relax_ions,"Switches atomic relaxation.\nUpdates ISIF accordingly (but not IBRION)."); + GUI_CHECK_TABLE(table,vasp_gui.relax_shape,vasp_gui.rshape,isif_toggle,"cell shape",2,3,1,2); +GUI_TOOLTIP(vasp_gui.relax_ions,"Switches cell shape relaxation.\nUpdates ISIF accordingly (but not IBRION)."); + GUI_CHECK_TABLE(table,vasp_gui.relax_volume,vasp_gui.rvolume,isif_toggle,"cell volume",3,4,1,2); +GUI_TOOLTIP(vasp_gui.relax_ions,"Switches cell volume relaxation.\nUpdates ISIF accordingly (but not IBRION)."); + GUI_ENTRY_TABLE(table,vasp_gui.nfree,vasp_gui.calc.nfree,"%i","NFREE=",4,5,1,2); +GUI_TOOLTIP(vasp_gui.nfree,"NFREE: Ch. 6.22 DEFAULT: -\nSets the number of ionic steps kept in history\nfor IBRION=1 Quasi-Newton algorithm.\nFor finite difference IBRION=5-6 NFREE\nsets the number of displacement/direction/atom."); /* initialize */ - VASP_COMBOBOX_SETUP(vasp_gui.ibrion,0,vasp_ibrion_selected); - VASP_COMBOBOX_SETUP(vasp_gui.isif,0,vasp_isif_selected); + GUI_COMBOBOX_SETUP(vasp_gui.ibrion,0,vasp_ibrion_selected); + GUI_COMBOBOX_SETUP(vasp_gui.isif,0,vasp_isif_selected); /* --- end frame */ /* --- MD */ - frame = gtk_frame_new("Molecular Dynamics"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"Molecular Dynamics"); /* create a table in the frame*/ - table = gtk_table_new(2, 5,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,2,5); /* 1st line */ //multicolumn label - label = gtk_label_new("SET IBRION=0 FOR MD"); - gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,0,2); - VASP_ENTRY_TABLE(vasp_gui.tebeg,vasp_gui.calc.tebeg,"%.1lf","TEBEG=",1,2,0,1); -VASP_TOOLTIP(vasp_gui.tebeg,"TEBEG: Ch. 6.29 DEFAULT: 0\nSets the start temperature of MD run.\nTo be corrected by (Nion-1)/Nion."); - VASP_ENTRY_TABLE(vasp_gui.teend,vasp_gui.calc.teend,"%.1lf","TEEND=",2,3,0,1); -VASP_TOOLTIP(vasp_gui.teend,"TEEND: Ch. 6.29 DEFAULT: TEBEG\nSets the end temperature of MD run.\nTo be corrected by (Nion-1)/Nion."); - VASP_ENTRY_TABLE(vasp_gui.smass,vasp_gui.calc.smass,"%.1lf","SMASS=",3,4,0,1); -VASP_TOOLTIP(vasp_gui.smass,"SMASS: Ch. 6.30 DEFAULT 0\nControls the velocities during MD.\nFor IBRION=3 SMASS is used as a damping factor."); + GUI_LABEL_TABLE(table,"SET IBRION=0 FOR MD",0,1,0,2); + GUI_ENTRY_TABLE(table,vasp_gui.tebeg,vasp_gui.calc.tebeg,"%.1lf","TEBEG=",1,2,0,1); +GUI_TOOLTIP(vasp_gui.tebeg,"TEBEG: Ch. 6.29 DEFAULT: 0\nSets the start temperature of MD run.\nTo be corrected by (Nion-1)/Nion."); + GUI_ENTRY_TABLE(table,vasp_gui.teend,vasp_gui.calc.teend,"%.1lf","TEEND=",2,3,0,1); +GUI_TOOLTIP(vasp_gui.teend,"TEEND: Ch. 6.29 DEFAULT: TEBEG\nSets the end temperature of MD run.\nTo be corrected by (Nion-1)/Nion."); + GUI_ENTRY_TABLE(table,vasp_gui.smass,vasp_gui.calc.smass,"%.1lf","SMASS=",3,4,0,1); +GUI_TOOLTIP(vasp_gui.smass,"SMASS: Ch. 6.30 DEFAULT 0\nControls the velocities during MD.\nFor IBRION=3 SMASS is used as a damping factor."); /*empty: col4*/ /* 2nd line */ /*occ: col0*/ - VASP_ENTRY_TABLE(vasp_gui.nblock,vasp_gui.calc.nblock,"%i","NBLOCK=",1,2,1,2); -VASP_TOOLTIP(vasp_gui.nblock,"NBLOCK: Ch. 6.21 DEFAULT: 1\nSets number of steps after which DOS/pair correlation\nfunction are calculated, and XDATCAR updated.\nFor SMASS=-1 kinetic energy is scaled every NBLOCK."); - VASP_ENTRY_TABLE(vasp_gui.kblock,vasp_gui.calc.kblock,"%i","KBLOCK=",2,3,1,2); -VASP_TOOLTIP(vasp_gui.kblock,"KBLOCK: Ch. 6.21 DEFAULT: NSW\nAfter KBLOCK*NBLOCK iterations DOS and\naverage pair correlation function is written\nto DOSCAR and PCDAT, respectively."); - VASP_ENTRY_TABLE(vasp_gui.npaco,vasp_gui.calc.npaco,"%i","NPACO=",3,4,1,2); -VASP_TOOLTIP(vasp_gui.npaco,"NPACO Ch. 6.31 DEFAULT: 256\nNumber of slots of pair correlation function."); - VASP_ENTRY_TABLE(vasp_gui.apaco,vasp_gui.calc.apaco,"%.4lf","APACO=",4,5,1,2); -VASP_TOOLTIP(vasp_gui.apaco,"APACO: Ch. 6.31 DEFAULT: 16\nMax distance (Ang) for calculation\nof pair correlation function."); + GUI_ENTRY_TABLE(table,vasp_gui.nblock,vasp_gui.calc.nblock,"%i","NBLOCK=",1,2,1,2); +GUI_TOOLTIP(vasp_gui.nblock,"NBLOCK: Ch. 6.21 DEFAULT: 1\nSets number of steps after which DOS/pair correlation\nfunction are calculated, and XDATCAR updated.\nFor SMASS=-1 kinetic energy is scaled every NBLOCK."); + GUI_ENTRY_TABLE(table,vasp_gui.kblock,vasp_gui.calc.kblock,"%i","KBLOCK=",2,3,1,2); +GUI_TOOLTIP(vasp_gui.kblock,"KBLOCK: Ch. 6.21 DEFAULT: NSW\nAfter KBLOCK*NBLOCK iterations DOS and\naverage pair correlation function is written\nto DOSCAR and PCDAT, respectively."); + GUI_ENTRY_TABLE(table,vasp_gui.npaco,vasp_gui.calc.npaco,"%i","NPACO=",3,4,1,2); +GUI_TOOLTIP(vasp_gui.npaco,"NPACO Ch. 6.31 DEFAULT: 256\nNumber of slots of pair correlation function."); + GUI_ENTRY_TABLE(table,vasp_gui.apaco,vasp_gui.calc.apaco,"%.4lf","APACO=",4,5,1,2); +GUI_TOOLTIP(vasp_gui.apaco,"APACO: Ch. 6.31 DEFAULT: 16\nMax distance (Ang) for calculation\nof pair correlation function."); /* initialize sensitive widget*/ if (vasp_gui.calc.ibrion==0) {/*selecting MD enable molecular dynamics settings*/ - gtk_widget_set_sensitive(vasp_gui.tebeg,TRUE); - gtk_widget_set_sensitive(vasp_gui.teend,TRUE); - gtk_widget_set_sensitive(vasp_gui.smass,TRUE); - gtk_widget_set_sensitive(vasp_gui.nblock,TRUE); - gtk_widget_set_sensitive(vasp_gui.kblock,TRUE); - gtk_widget_set_sensitive(vasp_gui.npaco,TRUE); - gtk_widget_set_sensitive(vasp_gui.apaco,TRUE); + GUI_UNLOCK(vasp_gui.tebeg); + GUI_UNLOCK(vasp_gui.teend); + GUI_UNLOCK(vasp_gui.smass); + GUI_UNLOCK(vasp_gui.nblock); + GUI_UNLOCK(vasp_gui.kblock); + GUI_UNLOCK(vasp_gui.npaco); + GUI_UNLOCK(vasp_gui.apaco); }else{ - gtk_widget_set_sensitive(vasp_gui.tebeg,FALSE); - gtk_widget_set_sensitive(vasp_gui.teend,FALSE); - gtk_widget_set_sensitive(vasp_gui.smass,FALSE); - gtk_widget_set_sensitive(vasp_gui.nblock,FALSE); - gtk_widget_set_sensitive(vasp_gui.kblock,FALSE); - gtk_widget_set_sensitive(vasp_gui.npaco,FALSE); - gtk_widget_set_sensitive(vasp_gui.apaco,FALSE); + GUI_LOCK(vasp_gui.tebeg); + GUI_LOCK(vasp_gui.teend); + GUI_LOCK(vasp_gui.smass); + GUI_LOCK(vasp_gui.nblock); + GUI_LOCK(vasp_gui.kblock); + GUI_LOCK(vasp_gui.npaco); + GUI_LOCK(vasp_gui.apaco); } /* --- end frame */ /* --- POSCAR */ - frame = gtk_frame_new("POSCAR & SYMMTERY"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"POSCAR & SYMMTERY"); /* create a table in the frame*/ - table = gtk_table_new(7, 5,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,7,5); /* 1st line */ - VASP_COMBOBOX_TABLE(vasp_gui.poscar_free,"DYN:",0,1,0,1); - VASP_COMBOBOX_ADD(vasp_gui.poscar_free,"All atom FIXED"); - VASP_COMBOBOX_ADD(vasp_gui.poscar_free,"All atom FREE"); - VASP_COMBOBOX_ADD(vasp_gui.poscar_free,"Manual selection"); -VASP_TOOLTIP(vasp_gui.poscar_free,"Set position tags to \"F F F\" (FIXED)\n\"T T T\" (FREE) or user modifications."); - VASP_CHECK_TABLE(button,vasp_gui.calc.poscar_sd,toggle_poscar_sd,"Sel. Dynamics",1,2,0,1); -VASP_TOOLTIP(button,"Allow use of tags for ion motion (Ch. 5.7)."); - VASP_ENTRY_TABLE(vasp_gui.isym,vasp_gui.calc.isym,"%i","ISYM=",2,3,0,1); -VASP_TOOLTIP(vasp_gui.isym,"ISYM: Ch. 6.27 DEFAULT 2\nSwitch symmetry method (0=OFF)\nDefault is 1 for ultrasoft, 2 for PAW PP."); - VASP_ENTRY_TABLE(vasp_gui.sym_prec,vasp_gui.calc.sym_prec,"%.2lE","_PREC=",3,4,0,1); -VASP_TOOLTIP(vasp_gui.sym_prec,"SYMPREC: Ch. 6.27 DEFAULT 10^-5\nSets the accuracy of ion positions\nin determining the system symmetry."); - VASP_ENTRY_TABLE(vasp_gui.poscar_a0,vasp_gui.calc.poscar_a0,"%.4lf","A0=",4,5,0,1); -VASP_TOOLTIP(vasp_gui.poscar_a0,"Lattice parameter (Ch. 5.7)\nSets the lattice constant (Ang.) parameter\nevery lattice vector will be scaled with."); + GUI_COMBOBOX_TABLE(table,vasp_gui.poscar_free,"DYN:",0,1,0,1); + GUI_COMBOBOX_ADD(vasp_gui.poscar_free,"All atom FIXED"); + GUI_COMBOBOX_ADD(vasp_gui.poscar_free,"All atom FREE"); + GUI_COMBOBOX_ADD(vasp_gui.poscar_free,"Manual selection"); +GUI_TOOLTIP(vasp_gui.poscar_free,"Set position tags to \"F F F\" (FIXED)\n\"T T T\" (FREE) or user modifications."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.poscar_sd,toggle_poscar_sd,"Sel. Dynamics",1,2,0,1); +GUI_TOOLTIP(button,"Allow use of tags for ion motion (Ch. 5.7)."); + GUI_ENTRY_TABLE(table,vasp_gui.isym,vasp_gui.calc.isym,"%i","ISYM=",2,3,0,1); +GUI_TOOLTIP(vasp_gui.isym,"ISYM: Ch. 6.27 DEFAULT 2\nSwitch symmetry method (0=OFF)\nDefault is 1 for ultrasoft, 2 for PAW PP."); + GUI_ENTRY_TABLE(table,vasp_gui.sym_prec,vasp_gui.calc.sym_prec,"%.2lE","_PREC=",3,4,0,1); +GUI_TOOLTIP(vasp_gui.sym_prec,"SYMPREC: Ch. 6.27 DEFAULT 10^-5\nSets the accuracy of ion positions\nin determining the system symmetry."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_a0,vasp_gui.calc.poscar_a0,"%.4lf","A0=",4,5,0,1); +GUI_TOOLTIP(vasp_gui.poscar_a0,"Lattice parameter (Ch. 5.7)\nSets the lattice constant (Ang.) parameter\nevery lattice vector will be scaled with."); /* 2nd line */ /*empty: col0 (TODO: SUPERCELL)*/ - VASP_CHECK_TABLE(vasp_gui.poscar_direct,vasp_gui.calc.poscar_direct,toggle_poscar_direct,"Direct Coord.",1,2,1,2); -VASP_TOOLTIP(vasp_gui.poscar_direct,"Sets whether ions positions are given\nin direct lattice or cartesian coordinate."); - VASP_ENTRY_TABLE(vasp_gui.poscar_ux,vasp_gui.calc.poscar_ux,"%.4lf","UX=",2,3,1,2); -VASP_TOOLTIP(vasp_gui.poscar_ux,"First lattice vector x component."); - VASP_ENTRY_TABLE(vasp_gui.poscar_uy,vasp_gui.calc.poscar_uy,"%.4lf","UY=",3,4,1,2); -VASP_TOOLTIP(vasp_gui.poscar_uy,"First lattice vector y component."); - VASP_ENTRY_TABLE(vasp_gui.poscar_uz,vasp_gui.calc.poscar_uz,"%.4lf","UZ=",4,5,1,2); -VASP_TOOLTIP(vasp_gui.poscar_uz,"First lattice vector z component."); + GUI_CHECK_TABLE(table,vasp_gui.poscar_direct,vasp_gui.calc.poscar_direct,toggle_poscar_direct,"Direct Coord.",1,2,1,2); +GUI_TOOLTIP(vasp_gui.poscar_direct,"Sets whether ions positions are given\nin direct lattice or cartesian coordinate."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_ux,vasp_gui.calc.poscar_ux,"%.4lf","UX=",2,3,1,2); +GUI_TOOLTIP(vasp_gui.poscar_ux,"First lattice vector x component."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_uy,vasp_gui.calc.poscar_uy,"%.4lf","UY=",3,4,1,2); +GUI_TOOLTIP(vasp_gui.poscar_uy,"First lattice vector y component."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_uz,vasp_gui.calc.poscar_uz,"%.4lf","UZ=",4,5,1,2); +GUI_TOOLTIP(vasp_gui.poscar_uz,"First lattice vector z component."); /* 3rd line */ /*empty: col0 (TODO: -X)*/ /*empty: col1 (TODO: +X)*/ - VASP_ENTRY_TABLE(vasp_gui.poscar_vx,vasp_gui.calc.poscar_vx,"%.4lf","VX=",2,3,2,3); -VASP_TOOLTIP(vasp_gui.poscar_vx,"Second lattice vector x component."); - VASP_ENTRY_TABLE(vasp_gui.poscar_vy,vasp_gui.calc.poscar_vy,"%.4lf","VY=",3,4,2,3); -VASP_TOOLTIP(vasp_gui.poscar_vy,"Second lattice vector y component."); - VASP_ENTRY_TABLE(vasp_gui.poscar_vz,vasp_gui.calc.poscar_vz,"%.4lf","VZ=",4,5,2,3); -VASP_TOOLTIP(vasp_gui.poscar_vz,"Second lattice vector z component."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_vx,vasp_gui.calc.poscar_vx,"%.4lf","VX=",2,3,2,3); +GUI_TOOLTIP(vasp_gui.poscar_vx,"Second lattice vector x component."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_vy,vasp_gui.calc.poscar_vy,"%.4lf","VY=",3,4,2,3); +GUI_TOOLTIP(vasp_gui.poscar_vy,"Second lattice vector y component."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_vz,vasp_gui.calc.poscar_vz,"%.4lf","VZ=",4,5,2,3); +GUI_TOOLTIP(vasp_gui.poscar_vz,"Second lattice vector z component."); /* 4th line */ /*empty: col0 (TODO: -Y)*/ /*empty: col1 (TODO: +Y)*/ - VASP_ENTRY_TABLE(vasp_gui.poscar_wx,vasp_gui.calc.poscar_wx,"%.4lf","WX=",2,3,3,4); -VASP_TOOLTIP(vasp_gui.poscar_wx,"Third lattice vector x component."); - VASP_ENTRY_TABLE(vasp_gui.poscar_wy,vasp_gui.calc.poscar_wy,"%.4lf","WY=",3,4,3,4); -VASP_TOOLTIP(vasp_gui.poscar_wy,"Third lattice vector y component."); - VASP_ENTRY_TABLE(vasp_gui.poscar_wz,vasp_gui.calc.poscar_wz,"%.4lf","WZ=",4,5,3,4); -VASP_TOOLTIP(vasp_gui.poscar_wz,"Third lattice vector z component."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_wx,vasp_gui.calc.poscar_wx,"%.4lf","WX=",2,3,3,4); +GUI_TOOLTIP(vasp_gui.poscar_wx,"Third lattice vector x component."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_wy,vasp_gui.calc.poscar_wy,"%.4lf","WY=",3,4,3,4); +GUI_TOOLTIP(vasp_gui.poscar_wy,"Third lattice vector y component."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_wz,vasp_gui.calc.poscar_wz,"%.4lf","WZ=",4,5,3,4); +GUI_TOOLTIP(vasp_gui.poscar_wz,"Third lattice vector z component."); /* 5th line */ /*empty: col0 (TODO: -Z)*/ /*empty: col1 (TODO: +Z)*/ - VASP_CHECK_TABLE(vasp_gui.poscar_tx,vasp_gui.calc.poscar_tx,NULL,"TX",2,3,4,5);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.poscar_tx,"Tag for the motion of current ion\nin first lattice coordinate."); - VASP_CHECK_TABLE(vasp_gui.poscar_ty,vasp_gui.calc.poscar_ty,NULL,"TY",3,4,4,5);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.poscar_tx,"Tag for the motion of current ion\nin second lattice coordinate."); - VASP_CHECK_TABLE(vasp_gui.poscar_tz,vasp_gui.calc.poscar_tz,NULL,"TZ",4,5,4,5);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.poscar_tx,"Tag for the motion of current ion\nin third lattice coordinate."); + GUI_CHECK_TABLE(table,vasp_gui.poscar_tx,vasp_gui.calc.poscar_tx,NULL,"TX",2,3,4,5);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.poscar_tx,"Tag for the motion of current ion\nin first lattice coordinate."); + GUI_CHECK_TABLE(table,vasp_gui.poscar_ty,vasp_gui.calc.poscar_ty,NULL,"TY",3,4,4,5);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.poscar_tx,"Tag for the motion of current ion\nin second lattice coordinate."); + GUI_CHECK_TABLE(table,vasp_gui.poscar_tz,vasp_gui.calc.poscar_tz,NULL,"TZ",4,5,4,5);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.poscar_tx,"Tag for the motion of current ion\nin third lattice coordinate."); /* 6th line */ - /*this combo is special and should be explicitely defined*/ - hbox = gtk_hbox_new(FALSE, 0); - label = gtk_label_new("ATOMS:"); - gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0); - vasp_gui.poscar_atoms = gtk_combo_box_text_new_with_entry();/*gtkcombo replacement*/ - gtk_entry_set_editable(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(vasp_gui.poscar_atoms))), FALSE);/*supposed to be simple?*/ - idx=0; - for (list2=data->cores ; list2 ; list2=g_slist_next(list2)){ + /*NEW: rewrite of ATOM list combobox*/ + GUI_COMBOBOX_TABLE(table,vasp_gui.poscar_atoms,"ATOMS:",0,4,5,6); + idx=0; + for (list2=data->cores ; list2 ; list2=g_slist_next(list2)){ gchar sym[3]; - core=list2->data; - sym[0]=core->atom_label[0]; - if(g_ascii_islower(core->atom_label[1])) sym[1]=core->atom_label[1]; - else sym[1]='\0'; - sym[2]='\0'; - if(vasp_gui.calc.poscar_free==VPF_FIXED) -gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (vasp_gui.poscar_atoms),g_strdup_printf("%.8lf %.8lf %.8lf F F F ! atom: %i (%s)", - core->x[0],core->x[1],core->x[2],idx,sym)); - else -gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (vasp_gui.poscar_atoms),g_strdup_printf("%.8lf %.8lf %.8lf T T T ! atom: %i (%s)", - core->x[0],core->x[1],core->x[2],idx,sym)); - idx++; - } -vasp_gui.calc.atoms_total=idx; - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT (vasp_gui.poscar_atoms),"ADD atom"); - gtk_box_pack_start(GTK_BOX(hbox),vasp_gui.poscar_atoms,TRUE,TRUE,0); - gtk_table_attach_defaults(GTK_TABLE(table),hbox,0,4,5,6); - g_signal_connect(GTK_COMBO_BOX_TEXT(vasp_gui.poscar_atoms),"changed",GTK_SIGNAL_FUNC(vasp_poscar_atoms_selected),data); -VASP_TOOLTIP(vasp_gui.poscar_atoms,"Atoms positions in POSCAR format."); + core=list2->data; +//////////////// NEW: necessary for some unconventional atom definition: for ex. MG (instead of Mg). + strcpy(sym,elements[core->atom_code].symbol); +//////////////// + if(vasp_gui.calc.poscar_free==VPF_FIXED){ + GUI_COMBOBOX_ADD(vasp_gui.poscar_atoms, + g_strdup_printf("%.8lf %.8lf %.8lf F F F ! atom: %i (%s)",core->x[0],core->x[1],core->x[2],idx,sym)); + }else{ + GUI_COMBOBOX_ADD(vasp_gui.poscar_atoms, + g_strdup_printf("%.8lf %.8lf %.8lf T T T ! atom: %i (%s)",core->x[0],core->x[1],core->x[2],idx,sym)); + } + idx++; + } + vasp_gui.calc.atoms_total=idx; + GUI_COMBOBOX_ADD(vasp_gui.poscar_atoms,"ADD atom"); + GUI_COMBOBOX_SETUP(vasp_gui.poscar_atoms,idx,vasp_poscar_atoms_selected); + /*this combo is special and should be explicitely defined*/ +GUI_TOOLTIP(vasp_gui.poscar_atoms,"Atoms positions in POSCAR format."); /*2 buttons*/ - hbox = gtk_hbox_new(FALSE, 0); - VASP_NEW_SEPARATOR(); - gui_stock_button(GTK_STOCK_APPLY,vasp_atom_modified,NULL,hbox); - gui_stock_button(GTK_STOCK_DELETE,vasp_atom_delete,NULL,hbox); - gtk_table_attach_defaults(GTK_TABLE(table),hbox,4,5,5,6); + GUI_2BUTTONS_TABLE(table,vasp_atom_modified,vasp_atom_delete,4,5,5,6); /* 7th line */ - VASP_ENTRY_TABLE(vasp_gui.poscar_index,vasp_gui.calc.poscar_index,"%i","INDEX:",0,1,6,7); - gtk_widget_set_sensitive(vasp_gui.poscar_index,FALSE);/*<- is changed only by selecting poscar_atoms*/ -VASP_TOOLTIP(vasp_gui.poscar_index,"Atom number (in POSCAR ORDER)."); - VASP_ENTRY_TABLE(vasp_gui.poscar_symbol,vasp_gui.calc.poscar_symbol,"%s","SYMBOL:",1,2,6,7); -VASP_TOOLTIP(vasp_gui.poscar_index,"Atom symbol (will correspond to POSCAR).\nChanging symbol will change index accordingly."); - VASP_ENTRY_TABLE(vasp_gui.poscar_x,vasp_gui.calc.poscar_x,"%.6lf","X=",2,3,6,7); -VASP_TOOLTIP(vasp_gui.poscar_x,"atom component X: x in cartesian mode\nand first lattice coordinate in direct mode."); - VASP_ENTRY_TABLE(vasp_gui.poscar_y,vasp_gui.calc.poscar_y,"%.6lf","Y=",3,4,6,7); -VASP_TOOLTIP(vasp_gui.poscar_y,"atom component Y: y in cartesian mode\nand second lattice coordinate in direct mode."); - VASP_ENTRY_TABLE(vasp_gui.poscar_z,vasp_gui.calc.poscar_z,"%.6lf","Z=",4,5,6,7); -VASP_TOOLTIP(vasp_gui.poscar_z,"atom component Z: z in cartesian mode\nand third lattice coordinate in direct mode."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_index,vasp_gui.calc.poscar_index,"%i","INDEX:",0,1,6,7); + GUI_LOCK(vasp_gui.poscar_index);/*<- is changed only by selecting poscar_atoms*/ +GUI_TOOLTIP(vasp_gui.poscar_index,"Atom number (in POSCAR ORDER)."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_symbol,vasp_gui.calc.poscar_symbol,"%s","SYMBOL:",1,2,6,7); +GUI_TOOLTIP(vasp_gui.poscar_index,"Atom symbol (will correspond to POSCAR).\nChanging symbol will change index accordingly."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_x,vasp_gui.calc.poscar_x,"%.6lf","X=",2,3,6,7); +GUI_TOOLTIP(vasp_gui.poscar_x,"atom component X: x in cartesian mode\nand first lattice coordinate in direct mode."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_y,vasp_gui.calc.poscar_y,"%.6lf","Y=",3,4,6,7); +GUI_TOOLTIP(vasp_gui.poscar_y,"atom component Y: y in cartesian mode\nand second lattice coordinate in direct mode."); + GUI_ENTRY_TABLE(table,vasp_gui.poscar_z,vasp_gui.calc.poscar_z,"%.6lf","Z=",4,5,6,7); +GUI_TOOLTIP(vasp_gui.poscar_z,"atom component Z: z in cartesian mode\nand third lattice coordinate in direct mode."); /* initialize sensitive widget*/ - VASP_COMBOBOX_SETUP(vasp_gui.poscar_free,1,vasp_poscar_free_selected); + GUI_COMBOBOX_SETUP(vasp_gui.poscar_free,1,vasp_poscar_free_selected); if((vasp_gui.calc.poscar_free==VPF_FIXED)||(vasp_gui.calc.poscar_free==VPF_FREE)){ - gtk_widget_set_sensitive(vasp_gui.poscar_tx,FALSE); - gtk_widget_set_sensitive(vasp_gui.poscar_ty,FALSE); - gtk_widget_set_sensitive(vasp_gui.poscar_tz,FALSE); + GUI_LOCK(vasp_gui.poscar_tx); + GUI_LOCK(vasp_gui.poscar_ty); + GUI_LOCK(vasp_gui.poscar_tz); if(vasp_gui.calc.poscar_free==VPF_FIXED){ vasp_gui.calc.poscar_tx=FALSE; vasp_gui.calc.poscar_ty=FALSE; @@ -3503,314 +3840,273 @@ if((vasp_gui.calc.poscar_free==VPF_FIXED)||(vasp_gui.calc.poscar_free==VPF_FREE) } /* (re)initialize */ toggle_poscar_sd(NULL,NULL); - gtk_combo_box_set_active(GTK_COMBO_BOX(vasp_gui.poscar_atoms),idx);/*sets "ADD atom" as active*/ - vasp_poscar_free_selected(vasp_gui.poscar_free,NULL); + vasp_poscar_free_selected(vasp_gui.poscar_free); /* --- end frame */ /*-------------------*/ /* page 4 -> KPOINTS */ /*-------------------*/ - page = gtk_vbox_new(FALSE, _SPACE); - label = gtk_label_new("KPOINTS"); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook),page,label); + GUI_PAGE_NOTE(notebook,page,"KPOINTS"); /* --- from INCAR */ - frame = gtk_frame_new("from INCAR"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"from INCAR"); /* create a table in the frame*/ - table = gtk_table_new(1, 5,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,1,5); /* 1st line */ - VASP_ENTRY_TABLE(vasp_gui.ismear_3,vasp_gui.calc.ismear,"%i","ISMEAR=",0,1,0,1); -VASP_TOOLTIP(vasp_gui.ismear_3,"ISMEAR: Ch. 6.38 DEFAULT: 1\nDetermine how the partial occupations are set.\nIt is advised to change it to ISMEAR=0\nfor semiconducting or insulating materials."); - VASP_CHECK_TABLE(vasp_gui.kgamma_3,vasp_gui.calc.kgamma,NULL,"KGAMMA",1,2,0,1);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.kgamma_3,"KGAMMA: Ch. 6.4 DEFAULT: TRUE\nWhen KPOINTS file is not present KGAMMA\nindicate if the k-grid is centered around gamma point."); - VASP_ENTRY_TABLE(vasp_gui.kspacing_3,vasp_gui.calc.kspacing,"%.4f","KSPACING=",2,3,0,1); -VASP_TOOLTIP(vasp_gui.kspacing_3,"KSPACING: Ch. 6.4 DEFAULT: 0.5\nWhen KPOINTS file is not present KSPACING\nDetermine the smallest spacing between k-points (Ang^-1)."); + GUI_ENTRY_TABLE(table,vasp_gui.ismear_3,vasp_gui.calc.ismear,"%i","ISMEAR=",0,1,0,1); +GUI_TOOLTIP(vasp_gui.ismear_3,"ISMEAR: Ch. 6.38 DEFAULT: 1\nDetermine how the partial occupations are set.\nIt is advised to change it to ISMEAR=0\nfor semiconducting or insulating materials."); + GUI_CHECK_TABLE(table,vasp_gui.kgamma_3,vasp_gui.calc.kgamma,NULL,"KGAMMA",1,2,0,1);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.kgamma_3,"KGAMMA: Ch. 6.4 DEFAULT: TRUE\nWhen KPOINTS file is not present KGAMMA\nindicate if the k-grid is centered around gamma point."); + GUI_ENTRY_TABLE(table,vasp_gui.kspacing_3,vasp_gui.calc.kspacing,"%.4f","KSPACING=",2,3,0,1); +GUI_TOOLTIP(vasp_gui.kspacing_3,"KSPACING: Ch. 6.4 DEFAULT: 0.5\nWhen KPOINTS file is not present KSPACING\nDetermine the smallest spacing between k-points (Ang^-1)."); /*empty: col3*/ /*empty: col4*/ /* --- end frame */ /* --- General */ - frame = gtk_frame_new("General"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"General"); /* create a table in the frame*/ - table = gtk_table_new(2, 5,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,2,5); /* 1st line */ - VASP_COMBOBOX_TABLE(vasp_gui.kpoints_mode,"GEN:",0,1,0,1); - VASP_COMBOBOX_ADD(vasp_gui.kpoints_mode,"Manual Entry"); - VASP_COMBOBOX_ADD(vasp_gui.kpoints_mode,"Line Mode"); - VASP_COMBOBOX_ADD(vasp_gui.kpoints_mode,"Automatic (M&P)"); - VASP_COMBOBOX_ADD(vasp_gui.kpoints_mode,"Gamma (M&P)"); - VASP_COMBOBOX_ADD(vasp_gui.kpoints_mode,"Monkhorst-Pack classic"); - VASP_COMBOBOX_ADD(vasp_gui.kpoints_mode,"Basis set definition"); -VASP_TOOLTIP(vasp_gui.kpoints_mode,"Sets how the k-points are generated/entered as defined in Ch. 5.5."); - VASP_CHECK_TABLE(vasp_gui.kpoints_cart,vasp_gui.calc.kpoints_cart,NULL,"Cartesian",1,2,0,1);/*not calling anything*/ -VASP_TOOLTIP(vasp_gui.kpoints_cart,"Switch cartesian/reciprocal lattice coordinate mode."); - VASP_SPIN_TABLE(vasp_gui.kpoints_kx,vasp_gui.calc.kpoints_kx,NULL,"KX",2,3,0,1); -VASP_TOOLTIP(vasp_gui.kpoints_kx,"Grid size for automated generation\n1st component only for M&P."); - VASP_SPIN_TABLE(vasp_gui.kpoints_ky,vasp_gui.calc.kpoints_ky,NULL,"KY",3,4,0,1); -VASP_TOOLTIP(vasp_gui.kpoints_ky,"2nd Component of the M&P grid size."); - VASP_SPIN_TABLE(vasp_gui.kpoints_kz,vasp_gui.calc.kpoints_kz,NULL,"KZ",4,5,0,1); -VASP_TOOLTIP(vasp_gui.kpoints_kz,"3rd Component of the M&P grid size."); + GUI_COMBOBOX_TABLE(table,vasp_gui.kpoints_mode,"GEN:",0,1,0,1); + GUI_COMBOBOX_ADD(vasp_gui.kpoints_mode,"Manual Entry"); + GUI_COMBOBOX_ADD(vasp_gui.kpoints_mode,"Line Mode"); + GUI_COMBOBOX_ADD(vasp_gui.kpoints_mode,"Automatic (M&P)"); + GUI_COMBOBOX_ADD(vasp_gui.kpoints_mode,"Gamma (M&P)"); + GUI_COMBOBOX_ADD(vasp_gui.kpoints_mode,"Monkhorst-Pack classic"); + GUI_COMBOBOX_ADD(vasp_gui.kpoints_mode,"Basis set definition"); +GUI_TOOLTIP(vasp_gui.kpoints_mode,"Sets how the k-points are generated/entered as defined in Ch. 5.5."); + GUI_CHECK_TABLE(table,vasp_gui.kpoints_cart,vasp_gui.calc.kpoints_cart,NULL,"Cartesian",1,2,0,1);/*not calling anything*/ +GUI_TOOLTIP(vasp_gui.kpoints_cart,"Switch cartesian/reciprocal lattice coordinate mode."); + GUI_SPIN_TABLE(table,vasp_gui.kpoints_kx,vasp_gui.calc.kpoints_kx,NULL,"KX",2,3,0,1); +GUI_TOOLTIP(vasp_gui.kpoints_kx,"Grid size for automated generation\n1st component only for M&P."); + GUI_SPIN_TABLE(table,vasp_gui.kpoints_ky,vasp_gui.calc.kpoints_ky,NULL,"KY",3,4,0,1); +GUI_TOOLTIP(vasp_gui.kpoints_ky,"2nd Component of the M&P grid size."); + GUI_SPIN_TABLE(table,vasp_gui.kpoints_kz,vasp_gui.calc.kpoints_kz,NULL,"KZ",4,5,0,1); +GUI_TOOLTIP(vasp_gui.kpoints_kz,"3rd Component of the M&P grid size."); /* 2nd line */ - VASP_ENTRY_TABLE(vasp_gui.kpoints_nkpts,vasp_gui.calc.kpoints_nkpts,"%i","NKPTS=",0,1,1,2); -VASP_TOOLTIP(vasp_gui.kpoints_nkpts,"Total number of k-points (0 for automated methods)."); - VASP_CHECK_TABLE(vasp_gui.have_tetra,vasp_gui.calc.kpoints_tetra,toogle_tetra,"Tetrahedron",1,2,1,2); -VASP_TOOLTIP(vasp_gui.have_tetra,"Switch on the tetrahedron method for entering k-points.\nISMEAR must be set to -5 for this method!"); - VASP_ENTRY_TABLE(vasp_gui.kpoints_sx,vasp_gui.calc.kpoints_sx,"%.4lf","SX=",2,3,1,2); -VASP_TOOLTIP(vasp_gui.kpoints_sx,"In case a grid is used to generate k-points\nThis will set a shift from grid origin\nin 1st reciprocal lattice component."); - VASP_ENTRY_TABLE(vasp_gui.kpoints_sy,vasp_gui.calc.kpoints_sy,"%.4lf","SY=",3,4,1,2); -VASP_TOOLTIP(vasp_gui.kpoints_sy,"In case a grid is used to generate k-points\nThis will set a shift from grid origin\nin 2nd reciprocal lattice component."); - VASP_ENTRY_TABLE(vasp_gui.kpoints_sz,vasp_gui.calc.kpoints_sz,"%.4lf","SZ=",4,5,1,2); -VASP_TOOLTIP(vasp_gui.kpoints_sz,"In case a grid is used to generate k-points\nThis will set a shift from grid origin\nin 3rd reciprocal lattice component."); + GUI_ENTRY_TABLE(table,vasp_gui.kpoints_nkpts,vasp_gui.calc.kpoints_nkpts,"%i","NKPTS=",0,1,1,2); +GUI_TOOLTIP(vasp_gui.kpoints_nkpts,"Total number of k-points (0 for automated methods)."); + GUI_CHECK_TABLE(table,vasp_gui.have_tetra,vasp_gui.calc.kpoints_tetra,toogle_tetra,"Tetrahedron",1,2,1,2); +GUI_TOOLTIP(vasp_gui.have_tetra,"Switch on the tetrahedron method for entering k-points.\nISMEAR must be set to -5 for this method!"); + GUI_ENTRY_TABLE(table,vasp_gui.kpoints_sx,vasp_gui.calc.kpoints_sx,"%.4lf","SX=",2,3,1,2); +GUI_TOOLTIP(vasp_gui.kpoints_sx,"In case a grid is used to generate k-points\nThis will set a shift from grid origin\nin 1st reciprocal lattice component."); + GUI_ENTRY_TABLE(table,vasp_gui.kpoints_sy,vasp_gui.calc.kpoints_sy,"%.4lf","SY=",3,4,1,2); +GUI_TOOLTIP(vasp_gui.kpoints_sy,"In case a grid is used to generate k-points\nThis will set a shift from grid origin\nin 2nd reciprocal lattice component."); + GUI_ENTRY_TABLE(table,vasp_gui.kpoints_sz,vasp_gui.calc.kpoints_sz,"%.4lf","SZ=",4,5,1,2); +GUI_TOOLTIP(vasp_gui.kpoints_sz,"In case a grid is used to generate k-points\nThis will set a shift from grid origin\nin 3rd reciprocal lattice component."); /* --- end frame */ /* --- Coordinate */ - vasp_gui.kpoints_coord = gtk_frame_new("Coordinate"); - gtk_box_pack_start(GTK_BOX(page),vasp_gui.kpoints_coord,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,vasp_gui.kpoints_coord,"Coordinate"); /* create a table in the frame*/ - table = gtk_table_new(2, 5,FALSE); - gtk_container_add(GTK_CONTAINER(vasp_gui.kpoints_coord), table); + GUI_TABLE_FRAME(vasp_gui.kpoints_coord,table,2,5); /* 1st line */ - VASP_COMBOBOX_TABLE(vasp_gui.kpoints_kpts,"KPOINT:",0,4,0,1); - VASP_COMBOBOX_ADD(vasp_gui.kpoints_kpts,"ADD kpoint"); -VASP_TOOLTIP(vasp_gui.kpoints_kpts,"List of the k-points coordinates.\nThe index after comment sign \"! kpoint:\" can be used\nfor entering tetrahedron edge definition."); - /*2 buttons*/ - hbox = gtk_hbox_new(FALSE, 0); - VASP_NEW_SEPARATOR(); - gui_stock_button(GTK_STOCK_APPLY,vasp_kpoint_modified,NULL,hbox); - gui_stock_button(GTK_STOCK_DELETE,vasp_kpoint_delete,NULL,hbox); - gtk_table_attach_defaults(GTK_TABLE(table),hbox,4,5,0,1); + GUI_COMBOBOX_TABLE(table,vasp_gui.kpoints_kpts,"KPOINT:",0,4,0,1); + GUI_COMBOBOX_ADD(vasp_gui.kpoints_kpts,"ADD kpoint"); +GUI_TOOLTIP(vasp_gui.kpoints_kpts,"List of the k-points coordinates.\nThe index after comment sign \"! kpoint:\" can be used\nfor entering tetrahedron edge definition."); + /*2 buttons*/ + GUI_2BUTTONS_TABLE(table,vasp_kpoint_modified,vasp_kpoint_delete,4,5,0,1); /* 2nd line */ - VASP_ENTRY_TABLE(vasp_gui.kpoints_i,vasp_gui.calc.kpoints_i,"%i","INDEX:",0,1,1,2); - gtk_widget_set_sensitive(vasp_gui.kpoints_i,FALSE);/*<- is changed only by selecting kpoints_kpts*/ -VASP_TOOLTIP(vasp_gui.kpoints_i,"The index of current k-point.\n(can be changed by deletion/addition only)"); - VASP_ENTRY_TABLE(vasp_gui.kpoints_x,vasp_gui.calc.kpoints_x,"%.4lf","X=",1,2,1,2); -VASP_TOOLTIP(vasp_gui.kpoints_x,"Coordinate of k-point in 1st component of selected mode.\n(cartesian or reciprocal)"); - VASP_ENTRY_TABLE(vasp_gui.kpoints_y,vasp_gui.calc.kpoints_y,"%.4lf","Y=",2,3,1,2); -VASP_TOOLTIP(vasp_gui.kpoints_y,"Coordinate of k-point in 2nd component of selected mode.\n(cartesian or reciprocal)"); - VASP_ENTRY_TABLE(vasp_gui.kpoints_z,vasp_gui.calc.kpoints_z,"%.4lf","Z=",3,4,1,2); -VASP_TOOLTIP(vasp_gui.kpoints_z,"Coordinate of k-point in 3rd component of selected mode.\n(cartesian or reciprocal)"); - VASP_ENTRY_TABLE(vasp_gui.kpoints_w,vasp_gui.calc.kpoints_w,"%.4lf","W=",4,5,1,2); -VASP_TOOLTIP(vasp_gui.kpoints_w,"Symmetry degeneration weight of k-point.\nSum of all weight does not have to be 1\nbut relative ratio should be respected."); + GUI_ENTRY_TABLE(table,vasp_gui.kpoints_i,vasp_gui.calc.kpoints_i,"%i","INDEX:",0,1,1,2); + GUI_LOCK(vasp_gui.kpoints_i);/*<- is changed only by selecting kpoints_kpts*/ +GUI_TOOLTIP(vasp_gui.kpoints_i,"The index of current k-point.\n(can be changed by deletion/addition only)"); + GUI_ENTRY_TABLE(table,vasp_gui.kpoints_x,vasp_gui.calc.kpoints_x,"%.4lf","X=",1,2,1,2); +GUI_TOOLTIP(vasp_gui.kpoints_x,"Coordinate of k-point in 1st component of selected mode.\n(cartesian or reciprocal)"); + GUI_ENTRY_TABLE(table,vasp_gui.kpoints_y,vasp_gui.calc.kpoints_y,"%.4lf","Y=",2,3,1,2); +GUI_TOOLTIP(vasp_gui.kpoints_y,"Coordinate of k-point in 2nd component of selected mode.\n(cartesian or reciprocal)"); + GUI_ENTRY_TABLE(table,vasp_gui.kpoints_z,vasp_gui.calc.kpoints_z,"%.4lf","Z=",3,4,1,2); +GUI_TOOLTIP(vasp_gui.kpoints_z,"Coordinate of k-point in 3rd component of selected mode.\n(cartesian or reciprocal)"); + GUI_ENTRY_TABLE(table,vasp_gui.kpoints_w,vasp_gui.calc.kpoints_w,"%.4lf","W=",4,5,1,2); +GUI_TOOLTIP(vasp_gui.kpoints_w,"Symmetry degeneration weight of k-point.\nSum of all weight does not have to be 1\nbut relative ratio should be respected."); /* --- end frame */ /* --- Tetrahedron */ - vasp_gui.kpoints_tetra = gtk_frame_new("Tetrahedron"); - gtk_box_pack_start(GTK_BOX(page),vasp_gui.kpoints_tetra,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,vasp_gui.kpoints_tetra,"Tetrahedron"); /* create a table in the frame*/ - table = gtk_table_new(3, 6,FALSE); - gtk_container_add(GTK_CONTAINER(vasp_gui.kpoints_tetra), table); + GUI_TABLE_FRAME(vasp_gui.kpoints_tetra,table,3,6); /* 1st line */ - VASP_ENTRY_TABLE(vasp_gui.tetra_total,vasp_gui.calc.tetra_total,"%i","TOTAL=",0,1,0,1); -VASP_TOOLTIP(vasp_gui.tetra_total,"Total number of tetrahedrons."); - label = gtk_label_new("EXACT VOLUME:"); - gtk_table_attach_defaults(GTK_TABLE(table),label,1,2,0,1); - VASP_ENTRY_TABLE(vasp_gui.tetra_volume,vasp_gui.calc.tetra_volume,"%.6lf","V=",2,3,0,1); -VASP_TOOLTIP(vasp_gui.tetra_volume,"Volume weight for a single tetrahedron.\nAll have a volume defined by the ratio of\ntetrahedron volume / Brillouin zone Volume."); - label = gtk_label_new("for (A,B,C,D) tetrahedron"); - gtk_table_attach_defaults(GTK_TABLE(table),label,3,6,0,1); + GUI_ENTRY_TABLE(table,vasp_gui.tetra_total,vasp_gui.calc.tetra_total,"%i","TOTAL=",0,1,0,1); +GUI_TOOLTIP(vasp_gui.tetra_total,"Total number of tetrahedrons."); + GUI_LABEL_TABLE(table,"EXACT VOLUME:",1,2,0,1); + GUI_ENTRY_TABLE(table,vasp_gui.tetra_volume,vasp_gui.calc.tetra_volume,"%.6lf","V=",2,3,0,1); +GUI_TOOLTIP(vasp_gui.tetra_volume,"Volume weight for a single tetrahedron.\nAll have a volume defined by the ratio of\ntetrahedron volume / Brillouin zone Volume."); + GUI_LABEL_TABLE(table,"for (A,B,C,D) tetrahedron",3,6,0,1); /* 2nd line */ - VASP_COMBOBOX_TABLE(vasp_gui.tetra,"TETRAHEDRON:",0,5,1,2); - VASP_COMBOBOX_ADD(vasp_gui.tetra,"ADD tetrahedron"); -VASP_TOOLTIP(vasp_gui.tetra,"Tetrahedron list, consisting of\nsymmetry degeneration weight followed by\nfour corner points of each tetrahedron\nin k-point indices given above."); + GUI_COMBOBOX_TABLE(table,vasp_gui.tetra,"TETRAHEDRON:",0,5,1,2); + GUI_COMBOBOX_ADD(vasp_gui.tetra,"ADD tetrahedron"); +GUI_TOOLTIP(vasp_gui.tetra,"Tetrahedron list, consisting of\nsymmetry degeneration weight followed by\nfour corner points of each tetrahedron\nin k-point indices given above."); /*2 buttons*/ - hbox = gtk_hbox_new(FALSE, 0); - VASP_NEW_SEPARATOR(); - gui_stock_button(GTK_STOCK_APPLY,vasp_tetra_modified,NULL,hbox); - gui_stock_button(GTK_STOCK_DELETE,vasp_tetra_delete,NULL,hbox); - gtk_table_attach_defaults(GTK_TABLE(table),hbox,5,6,1,2); + GUI_2BUTTONS_TABLE(table,vasp_tetra_modified,vasp_tetra_delete,5,6,1,2); /* 3rd line */ - VASP_ENTRY_TABLE(vasp_gui.tetra_i,vasp_gui.calc.tetra_i,"%i","INDEX:",0,1,2,3); - gtk_widget_set_sensitive(vasp_gui.tetra_i,FALSE);/*<- is changed only by selecting tetra*/ -VASP_TOOLTIP(vasp_gui.tetra_i,"The index of current tetrahedron.\n(can be changed by deletion/addition only)"); - VASP_ENTRY_TABLE(vasp_gui.tetra_w,vasp_gui.calc.tetra_w,"%.4lf","Degen. W=",1,2,2,3); -VASP_TOOLTIP(vasp_gui.tetra_w,"Symmetry degeneration weight.\nUnlike k-points, weight must be normalized\nie. total Brillouin zone Volume should be recovered\nby summing all degeneration * V"); - VASP_ENTRY_TABLE(vasp_gui.tetra_a,vasp_gui.calc.tetra_a,"%i","PtA:",2,3,2,3); -VASP_TOOLTIP(vasp_gui.tetra_a,"1st corner of the tetrahedron (A) in k-point index."); - VASP_ENTRY_TABLE(vasp_gui.tetra_b,vasp_gui.calc.tetra_b,"%i","PtB:",3,4,2,3); -VASP_TOOLTIP(vasp_gui.tetra_b,"2nd corner of the tetrahedron (B) in k-point index."); - VASP_ENTRY_TABLE(vasp_gui.tetra_c,vasp_gui.calc.tetra_c,"%i","PtC:",4,5,2,3); -VASP_TOOLTIP(vasp_gui.tetra_c,"3rd corner of the tetrahedron (C) in k-point index."); - VASP_ENTRY_TABLE(vasp_gui.tetra_d,vasp_gui.calc.tetra_d,"%i","PtD:",5,6,2,3); -VASP_TOOLTIP(vasp_gui.tetra_d,"4th corner of the tetrahedron (D) in k-point index."); + GUI_ENTRY_TABLE(table,vasp_gui.tetra_i,vasp_gui.calc.tetra_i,"%i","INDEX:",0,1,2,3); + GUI_LOCK(vasp_gui.tetra_i);/*<- is changed only by selecting tetra*/ +GUI_TOOLTIP(vasp_gui.tetra_i,"The index of current tetrahedron.\n(can be changed by deletion/addition only)"); + GUI_ENTRY_TABLE(table,vasp_gui.tetra_w,vasp_gui.calc.tetra_w,"%.4lf","Degen. W=",1,2,2,3); +GUI_TOOLTIP(vasp_gui.tetra_w,"Symmetry degeneration weight.\nUnlike k-points, weight must be normalized\nie. total Brillouin zone Volume should be recovered\nby summing all degeneration * V"); + GUI_ENTRY_TABLE(table,vasp_gui.tetra_a,vasp_gui.calc.tetra_a,"%i","PtA:",2,3,2,3); +GUI_TOOLTIP(vasp_gui.tetra_a,"1st corner of the tetrahedron (A) in k-point index."); + GUI_ENTRY_TABLE(table,vasp_gui.tetra_b,vasp_gui.calc.tetra_b,"%i","PtB:",3,4,2,3); +GUI_TOOLTIP(vasp_gui.tetra_b,"2nd corner of the tetrahedron (B) in k-point index."); + GUI_ENTRY_TABLE(table,vasp_gui.tetra_c,vasp_gui.calc.tetra_c,"%i","PtC:",4,5,2,3); +GUI_TOOLTIP(vasp_gui.tetra_c,"3rd corner of the tetrahedron (C) in k-point index."); + GUI_ENTRY_TABLE(table,vasp_gui.tetra_d,vasp_gui.calc.tetra_d,"%i","PtD:",5,6,2,3); +GUI_TOOLTIP(vasp_gui.tetra_d,"4th corner of the tetrahedron (D) in k-point index."); /* initialize */ - g_signal_connect(GTK_OBJECT(GTK_ENTRY(vasp_gui.ismear_3)),"changed",GTK_SIGNAL_FUNC(ismear_changed),data); - g_signal_connect(GTK_OBJECT(GTK_ENTRY(vasp_gui.kspacing_3)),"changed",GTK_SIGNAL_FUNC(kspacing_changed),data); - VASP_COMBOBOX_SETUP(vasp_gui.kpoints_mode,vasp_gui.calc.kpoints_mode,vasp_kpoints_mode_selected); - VASP_COMBOBOX_SETUP(vasp_gui.kpoints_kpts,0,vasp_kpoints_kpts_selected); - VASP_COMBOBOX_SETUP(vasp_gui.tetra,0,vasp_tetra_selected); + GUI_ENTRY_CHANGE(vasp_gui.ismear_3,ismear_changed,NULL); + GUI_ENTRY_CHANGE(vasp_gui.kspacing_3,kspacing_changed,NULL); + GUI_COMBOBOX_SETUP(vasp_gui.kpoints_mode,vasp_gui.calc.kpoints_mode,vasp_kpoints_mode_selected); + GUI_COMBOBOX_SETUP(vasp_gui.kpoints_kpts,0,vasp_kpoints_kpts_selected); + GUI_COMBOBOX_SETUP(vasp_gui.tetra,0,vasp_tetra_selected); toogle_tetra(); + ismear_changed(vasp_gui.ismear_3);/*necessary*/ /* --- end frame */ /* TODO: import KPOINTS/IBZKPT file*/ /*------------------*/ /* page 5 -> POTCAR */ /*------------------*/ - page = gtk_vbox_new(FALSE, _SPACE); - label = gtk_label_new("POTCAR"); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook),page,label); + GUI_PAGE_NOTE(notebook,page,"POTCAR"); /* --- general */ - frame = gtk_frame_new("General"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"General"); /* create a table in the frame*/ - table = gtk_table_new(2, 1,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,2,1); /* 1st line */ - VASP_TEXT_TABLE(vasp_gui.poscar_species,vasp_gui.calc.species_symbols,"SPECIES:",0,1,0,1); - gtk_widget_set_sensitive(vasp_gui.poscar_species,FALSE); -VASP_TOOLTIP(vasp_gui.poscar_species,"List of atomic symbol of the species\ndetected in the POSCAR ionic information."); + GUI_TEXT_TABLE(table,vasp_gui.poscar_species,vasp_gui.calc.species_symbols,"SPECIES:",0,1,0,1); + GUI_LOCK(vasp_gui.poscar_species); +GUI_TOOLTIP(vasp_gui.poscar_species,"List of atomic symbol of the species\ndetected in the POSCAR ionic information."); /* 2nd line */ - label = gtk_label_new("(each species will require a separate POTCAR information)"); - gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,1,2); + GUI_LABEL_TABLE(table,"(each species will require a separate POTCAR information)",0,1,1,2); /* --- end frame */ /* --- get POTCAR information */ - frame = gtk_frame_new("get POTCAR information"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"get POTCAR information"); /* create a table in the frame*/ - table = gtk_table_new(3, 4,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,3,4); /* 1st line */ /* 2 lines radiobutton */ - vbox = gtk_vbox_new(FALSE,0); - new_radio_group(0,vbox,FF); - vasp_gui.potcar_select_file = add_radio_button("Use POTCAR file",(gpointer)toggle_potcar_file,NULL); - vasp_gui.potcar_select_folder = add_radio_button("Use POTCAR path",(gpointer)toggle_potcar_folder,NULL); - gtk_table_attach_defaults(GTK_TABLE(table),vbox,0,1,0,2); -VASP_TOOLTIP(vasp_gui.potcar_select_file,"Load a previously prepared POTCAR file.\nThe species (and species order) should match\nEXACTLY those of the POSCAR ion information."); -VASP_TOOLTIP(vasp_gui.potcar_select_folder,"Use the directory where all POTCAR information are available.\nUsually a directory containing atomic symbols sub-directories."); - VASP_TEXT_TABLE(vasp_gui.potcar_file,vasp_gui.calc.potcar_file,"FILE:",1,3,0,1); - VASP_BUTTON_TABLE(vasp_gui.potcar_file_button,GTK_STOCK_OPEN,load_potcar_file_dialog,3,4,0,1); -VASP_TOOLTIP(vasp_gui.potcar_file,"POTCAR file, including its full path."); + GUI_2RADIO_TABLE(table, + vasp_gui.potcar_select_file,"Use POTCAR file",toggle_potcar_file, + vasp_gui.potcar_select_folder,"Use POTCAR path",toggle_potcar_folder,0,1,0,2); +GUI_TOOLTIP(vasp_gui.potcar_select_file,"Load a previously prepared POTCAR file.\nThe species (and species order) should match\nEXACTLY those of the POSCAR ion information."); +GUI_TOOLTIP(vasp_gui.potcar_select_folder,"Use the directory where all POTCAR information are available.\nUsually a directory containing atomic symbols sub-directories."); + GUI_TEXT_TABLE(table,vasp_gui.potcar_file,vasp_gui.calc.potcar_file,"FILE:",1,3,0,1); + GUI_OPEN_BUTTON_TABLE(table,vasp_gui.potcar_file_button,load_potcar_file_dialog,3,4,0,1); +GUI_TOOLTIP(vasp_gui.potcar_file,"POTCAR file, including its full path."); /* 2nd line */ - VASP_TEXT_TABLE(vasp_gui.potcar_folder,vasp_gui.calc.potcar_folder,"PATH:",1,3,1,2); - VASP_BUTTON_TABLE(vasp_gui.potcar_folder_button,GTK_STOCK_OPEN,load_potcar_folder_dialog,3,4,1,2); -VASP_TOOLTIP(vasp_gui.potcar_folder,"Full PATH to the POTCAR sub-directories."); + GUI_TEXT_TABLE(table,vasp_gui.potcar_folder,vasp_gui.calc.potcar_folder,"PATH:",1,3,1,2); + GUI_OPEN_BUTTON_TABLE(table,vasp_gui.potcar_folder_button,load_potcar_folder_dialog,3,4,1,2); +GUI_TOOLTIP(vasp_gui.potcar_folder,"Full PATH to the POTCAR sub-directories."); /* 3rd line */ - VASP_COMBOBOX_TABLE(vasp_gui.species_flavor,"FLAVOR:",2,3,2,3); - VASP_BUTTON_TABLE(vasp_gui.species_button,GTK_STOCK_APPLY,apply_species_flavor,3,4,2,3); -VASP_TOOLTIP(vasp_gui.species_flavor,"When Using PATH method, for each species a choice\nbetween different pseudopotential setting (flavors) exists\nEx: _h hard, _s soft _pv include pseudo-core valence, etc."); + GUI_COMBOBOX_TABLE(table,vasp_gui.species_flavor,"FLAVOR:",2,3,2,3); + GUI_APPLY_BUTTON_TABLE(table,vasp_gui.species_button,apply_species_flavor,3,4,2,3); +GUI_TOOLTIP(vasp_gui.species_flavor,"When Using PATH method, for each species a choice\nbetween different pseudopotential setting (flavors) exists\nEx: _h hard, _s soft _pv include pseudo-core valence, etc."); /* initialize */ - toggle_potcar_file(NULL,NULL); + toggle_potcar_file(); /* --- end frame */ /* --- POTCAR results */ - frame = gtk_frame_new("POTCAR results"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"POTCAR results"); /* create a table in the frame*/ - table = gtk_table_new(2, 2,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,2,2); /* 1st line */ //multicolumn label - label = gtk_label_new("DETECTED"); - gtk_table_attach_defaults(GTK_TABLE(table),label,0,1,0,2); - VASP_TEXT_TABLE(vasp_gui.potcar_species,vasp_gui.calc.potcar_species,"SPECIES:",1,2,0,1); -VASP_TOOLTIP(vasp_gui.potcar_species,"List of atomic symbol of the species\ndetected from the POTCAR setting."); - gtk_widget_set_sensitive(vasp_gui.potcar_species,FALSE); + GUI_LABEL_TABLE(table,"DETECTED",0,1,0,2); + GUI_TEXT_TABLE(table,vasp_gui.potcar_species,vasp_gui.calc.potcar_species,"SPECIES:",1,2,0,1); +GUI_TOOLTIP(vasp_gui.potcar_species,"List of atomic symbol of the species\ndetected from the POTCAR setting."); + GUI_LOCK(vasp_gui.potcar_species); /* 2nd line */ /*occ: col0*/ - VASP_TEXT_TABLE(vasp_gui.potcar_species_flavor,vasp_gui.calc.potcar_species_flavor,"FLAVOR:",1,2,1,2); -VASP_TOOLTIP(vasp_gui.potcar_species_flavor,"List of the pseudopotential flavors (PATH method)\ndetected from the POTCAR setting."); - gtk_widget_set_sensitive(vasp_gui.potcar_species_flavor,FALSE); + GUI_TEXT_TABLE(table,vasp_gui.potcar_species_flavor,vasp_gui.calc.potcar_species_flavor,"FLAVOR:",1,2,1,2); +GUI_TOOLTIP(vasp_gui.potcar_species_flavor,"List of the pseudopotential flavors (PATH method)\ndetected from the POTCAR setting."); + GUI_LOCK(vasp_gui.potcar_species_flavor); +/* --- end frame */ /*----------------*/ /* page 6 -> EXEC */ /*----------------*/ - page = gtk_vbox_new(FALSE, _SPACE); - label = gtk_label_new("EXEC"); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook),page,label); + GUI_PAGE_NOTE(notebook,page,"EXEC"); /* --- general */ - frame = gtk_frame_new("General"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"General"); /* create a table in the frame*/ - table = gtk_table_new(3, 6,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,3,6); /* 1st line */ - VASP_LABEL_TABLE("VASP EXEC:",0,1,0,1); - VASP_TEXT_TABLE(vasp_gui.job_vasp_exe,vasp_gui.calc.job_vasp_exe,"FILE=",1,5,0,1); -VASP_TOOLTIP(vasp_gui.job_vasp_exe,"Location (full path) of the vasp executable."); - VASP_BUTTON_TABLE(button,GTK_STOCK_OPEN,load_vasp_exe_dialog,5,6,0,1); + GUI_LABEL_TABLE(table,"VASP EXEC:",0,1,0,1); + GUI_TEXT_TABLE(table,vasp_gui.job_vasp_exe,vasp_gui.calc.job_vasp_exe,"FILE=",1,5,0,1); +GUI_TOOLTIP(vasp_gui.job_vasp_exe,"Location (full path) of the vasp executable."); + GUI_OPEN_BUTTON_TABLE(table,button,load_vasp_exe_dialog,5,6,0,1); /* 2nd line */ - VASP_LABEL_TABLE("CALCUL PATH:",0,1,1,2); - VASP_TEXT_TABLE(vasp_gui.job_path,vasp_gui.calc.job_path,"PATH=",1,5,1,2); -VASP_TOOLTIP(vasp_gui.job_path,"Location (full path) of the calculation directory.\nit is IMPORTANT to check this parameter so that\n* no other calculation is overwritten\n* calculation will not start in an unexpected directory."); - VASP_BUTTON_TABLE(button,GTK_STOCK_OPEN,load_path_dialog,5,6,1,2); + GUI_LABEL_TABLE(table,"CALCUL PATH:",0,1,1,2); + GUI_TEXT_TABLE(table,vasp_gui.job_path,vasp_gui.calc.job_path,"PATH=",1,5,1,2); +GUI_TOOLTIP(vasp_gui.job_path,"Location (full path) of the calculation directory.\nit is IMPORTANT to check this parameter so that\n* no other calculation is overwritten\n* calculation will not start in an unexpected directory."); + GUI_OPEN_BUTTON_TABLE(table,button,load_path_dialog,5,6,1,2); /* 3rd line */ - VASP_LABEL_TABLE("OUTPUT:",0,1,2,3); - VASP_CHECK_TABLE(button,vasp_gui.calc.lwave,NULL,"LWAVE",1,2,2,3);/*not calling anything*/ -VASP_TOOLTIP(button,"LWAVE: Ch. 6.52 DEFAULT: TRUE\nIf set the WAVECAR (wavefunctions) file is written."); - VASP_CHECK_TABLE(button,vasp_gui.calc.lcharg,NULL,"LCHARG",2,3,2,3);/*not calling anything*/ -VASP_TOOLTIP(button,"LCHARG: Ch. 6.52 DEFAULT: TRUE\nIf set the CHGCAR (charge density) file is written."); - VASP_CHECK_TABLE(button,vasp_gui.calc.lvtot,NULL,"LVTOT",3,4,2,3);/*not calling anything*/ -VASP_TOOLTIP(button,"LVTOT: Ch. 6.53 DEFAULT: FALSE\nIf set the LOCPOT (local potential) file is written."); - VASP_CHECK_TABLE(button,vasp_gui.calc.lvhar,NULL,"LVHAR",4,5,2,3);/*not calling anything*/ -VASP_TOOLTIP(button,"LVHAR: Ch. 6.54 DEFAULT: FALSE\nIf set the full local potential is written to LOCPOT\n(ie. ionic+Hartree+XC) otherwise only electrostatic\n(ie. ionic+Hartree) is written."); - VASP_CHECK_TABLE(button,vasp_gui.calc.lelf,NULL,"LELF",5,6,2,3);/*not calling anything*/ -VASP_TOOLTIP(button,"LELF: Ch 6.55 DEFAULT: FALSE\nIf set the ELFCAR (electron localization function)\nfile is written."); + GUI_LABEL_TABLE(table,"OUTPUT:",0,1,2,3); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.lwave,NULL,"LWAVE",1,2,2,3);/*not calling anything*/ +GUI_TOOLTIP(button,"LWAVE: Ch. 6.52 DEFAULT: TRUE\nIf set the WAVECAR (wavefunctions) file is written."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.lcharg,NULL,"LCHARG",2,3,2,3);/*not calling anything*/ +GUI_TOOLTIP(button,"LCHARG: Ch. 6.52 DEFAULT: TRUE\nIf set the CHGCAR (charge density) file is written."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.lvtot,NULL,"LVTOT",3,4,2,3);/*not calling anything*/ +GUI_TOOLTIP(button,"LVTOT: Ch. 6.53 DEFAULT: FALSE\nIf set the LOCPOT (local potential) file is written."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.lvhar,NULL,"LVHAR",4,5,2,3);/*not calling anything*/ +GUI_TOOLTIP(button,"LVHAR: Ch. 6.54 DEFAULT: FALSE\nIf set the full local potential is written to LOCPOT\n(ie. ionic+Hartree+XC) otherwise only electrostatic\n(ie. ionic+Hartree) is written."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.lelf,NULL,"LELF",5,6,2,3);/*not calling anything*/ +GUI_TOOLTIP(button,"LELF: Ch 6.55 DEFAULT: FALSE\nIf set the ELFCAR (electron localization function)\nfile is written."); /* --- end frame */ /* --- PARALLEL */ - frame = gtk_frame_new("Parallel Optimization"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"Parallel Optimization"); /* create a table in the frame*/ - table = gtk_table_new(2, 6,FALSE); - gtk_container_add(GTK_CONTAINER(frame), table); + GUI_TABLE_FRAME(frame,table,2,6); /* 1st line */ - VASP_LABEL_TABLE("MPIRUN:",0,1,0,1); - VASP_TEXT_TABLE(vasp_gui.job_mpirun,vasp_gui.calc.job_mpirun,"FILE=",1,5,0,1); -VASP_TOOLTIP(vasp_gui.job_mpirun,"Location (full path) of mpirun executable.\nRequired for parallel calculation only."); - VASP_BUTTON_TABLE(button,GTK_STOCK_OPEN,load_mpirun_dialog,5,6,0,1); + GUI_LABEL_TABLE(table,"MPIRUN:",0,1,0,1); + GUI_TEXT_TABLE(table,vasp_gui.job_mpirun,vasp_gui.calc.job_mpirun,"FILE=",1,5,0,1); +GUI_TOOLTIP(vasp_gui.job_mpirun,"Location (full path) of mpirun executable.\nRequired for parallel calculation only."); + GUI_OPEN_BUTTON_TABLE(table,button,load_mpirun_dialog,5,6,0,1); /* 2nd line */ - VASP_SPIN_TABLE(vasp_gui.job_nproc,vasp_gui.calc.job_nproc,parallel_eq,"NP=",0,1,1,2); -VASP_TOOLTIP(vasp_gui.job_nproc,"Total number of CPU used for calculation.\nwill be used as N in \"mpirun -np N vasp\"\nto start vasp calculation."); - VASP_SPIN_TABLE(vasp_gui.ncore,vasp_gui.calc.ncore,parallel_eq,"NCORE=",1,2,1,2); -VASP_TOOLTIP(vasp_gui.ncore,"NCORE: Ch. 6.57 DEFAULT: 1\nSets how many cores works on one orbital.\nNote that NCORE is limited by KPAR."); - VASP_SPIN_TABLE(vasp_gui.kpar,vasp_gui.calc.kpar,parallel_eq,"KPAR=",2,3,1,2); -VASP_TOOLTIP(vasp_gui.kpar,"KPAR: Ch. 6.57 DEFAULT: 1\nSets the number of k-points treated in parallel.\nEach k-point is worked on by NCORE CPUs."); - VASP_CHECK_TABLE(button,vasp_gui.calc.lplane,NULL,"LPLANE",3,4,1,2);/*not calling anything*/ -VASP_TOOLTIP(button,"LPLANE: Ch. 6.57 DEFAULT: TRUE\nIf set the real-space data distribution is done plane wise."); - VASP_CHECK_TABLE(button,vasp_gui.calc.lscalu,NULL,"LSCALU",4,5,1,2);/*not calling anything*/ -VASP_TOOLTIP(button,"LSCALU: Ch. 6.59 DEFAULT: FALSE\nIf set parallel LU decomposition will be used."); - VASP_CHECK_TABLE(button,vasp_gui.calc.lscalapack,NULL,"LSCALAPACK",5,6,1,2);/*not calling anything*/ -VASP_TOOLTIP(button,"LSCALAPACK: Ch. 6.59 DEFAULT: FALSE\nIf set scaLAPACK routines will be used."); + GUI_SPIN_TABLE(table,vasp_gui.job_nproc,vasp_gui.calc.job_nproc,parallel_eq,"NP=",0,1,1,2); +GUI_TOOLTIP(vasp_gui.job_nproc,"Total number of CPU used for calculation.\nwill be used as N in \"mpirun -np N vasp\"\nto start vasp calculation."); + GUI_SPIN_TABLE(table,vasp_gui.ncore,vasp_gui.calc.ncore,parallel_eq,"NCORE=",1,2,1,2); +GUI_TOOLTIP(vasp_gui.ncore,"NCORE: Ch. 6.57 DEFAULT: 1\nSets how many cores works on one orbital.\nNote that NCORE is limited by KPAR."); + GUI_SPIN_TABLE(table,vasp_gui.kpar,vasp_gui.calc.kpar,parallel_eq,"KPAR=",2,3,1,2); +GUI_TOOLTIP(vasp_gui.kpar,"KPAR: Ch. 6.57 DEFAULT: 1\nSets the number of k-points treated in parallel.\nEach k-point is worked on by NCORE CPUs."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.lplane,NULL,"LPLANE",3,4,1,2);/*not calling anything*/ +GUI_TOOLTIP(button,"LPLANE: Ch. 6.57 DEFAULT: TRUE\nIf set the real-space data distribution is done plane wise."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.lscalu,NULL,"LSCALU",4,5,1,2);/*not calling anything*/ +GUI_TOOLTIP(button,"LSCALU: Ch. 6.59 DEFAULT: FALSE\nIf set parallel LU decomposition will be used."); + GUI_CHECK_TABLE(table,button,vasp_gui.calc.lscalapack,NULL,"LSCALAPACK",5,6,1,2);/*not calling anything*/ +GUI_TOOLTIP(button,"LSCALAPACK: Ch. 6.59 DEFAULT: FALSE\nIf set scaLAPACK routines will be used."); /* --- end frame */ /* --- DISTANT */ - frame = gtk_frame_new("Distant calculation"); - gtk_box_pack_start(GTK_BOX(page),frame,FALSE,FALSE,0); + GUI_FRAME_NOTE(page,frame,"Distant calculation"); /*create a vbox in frame*/ - vbox=gtk_vbox_new(TRUE, 0); - gtk_container_add(GTK_CONTAINER(frame),vbox); + GUI_VBOX_FRAME(frame,vbox); /* 1st line */ - VASP_NEW_LINE(); + GUI_LINE_BOX(vbox,hbox); /* 2nd line */ - VASP_NEW_LINE(); - VASP_NEW_LABEL("Remote execution of VASP is currently UNDER CONSTRUCTION."); + GUI_LINE_BOX(vbox,hbox); + GUI_LABEL_BOX(hbox,label,"Remote execution of VASP is currently UNDER CONSTRUCTION."); /* 3rd line */ - VASP_NEW_LINE(); -// VASP_NEW_SEPARATOR(); - VASP_NEW_LABEL("For now, please save files and manually transfer them to the distant server, then submit and retreive files as usual."); + GUI_LINE_BOX(vbox,hbox); + GUI_LABEL_BOX(hbox,label,"For now, please save files and manually transfer them to the distant server, then submit and retreive files as usual."); /* 4th line */ - VASP_NEW_LINE(); - VASP_NEW_LABEL("The future GDIS job interface will hopefully automate the whole process..."); + GUI_LINE_BOX(vbox,hbox); + GUI_LABEL_BOX(hbox,label,"The future GDIS job interface will hopefully automate the whole process..."); /* 5th line */ - VASP_NEW_LINE(); - VASP_NEW_LABEL("...and will be made available in the VASP calculation interface at that time."); - VASP_NEW_SEPARATOR(); - VASP_NEW_LABEL("--OVHPA"); + GUI_LINE_BOX(vbox,hbox); + GUI_LABEL_BOX(hbox,label,"...and will be made available in the VASP calculation interface at that time."); + GUI_NEW_SEPARATOR(hbox,separator); + GUI_LABEL_BOX(hbox,label,"--OVHPA"); /* 6th line */ - VASP_NEW_LINE(); + GUI_LINE_BOX(vbox,hbox); +/* --- end frame */ /* --- Outside of notebook */ - frame = gtk_frame_new(NULL); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(vasp_gui.window)->vbox), frame, FALSE, FALSE, 0); - vbox = gtk_vbox_new(FALSE, _SPACE); - gtk_container_add(GTK_CONTAINER(frame), vbox); + GUI_FRAME_WINDOW(vasp_gui.window,frame); + GUI_VBOX_FRAME(frame,vbox); /* Action buttons */ - vasp_gui.button_save=gui_stock_button(GTK_STOCK_SAVE, save_vasp_calc, NULL, GTK_DIALOG(vasp_gui.window)->action_area); - vasp_gui.button_exec=gui_stock_button(GTK_STOCK_EXECUTE, exec_calc, NULL, GTK_DIALOG(vasp_gui.window)->action_area); - gui_stock_button(GTK_STOCK_CLOSE, quit_vasp_gui, dialog, GTK_DIALOG(vasp_gui.window)->action_area); + GUI_SAVE_ACTION(vasp_gui.window,vasp_gui.button_save,save_vasp_calc,NULL); + GUI_EXEC_ACTION(vasp_gui.window,vasp_gui.button_exec,exec_calc,NULL); + GUI_CLOSE_ACTION(vasp_gui.window,button,quit_vasp_gui,dialog); /* connect to signals */ - g_signal_connect(GTK_NOTEBOOK(notebook),"switch-page",GTK_SIGNAL_FUNC(vasp_gui_page_switch),NULL); - + GUI_PAGE_CHANGE(notebook,vasp_gui_page_switch,NULL); /* all done */ + vasp_poscar_sync(); vasp_gui_refresh();/*refresh once more*/ - gtk_widget_show_all(vasp_gui.window); - sysenv.refresh_dialog=TRUE; + GUI_SHOW(vasp_gui.window);/*display*/ + sysenv.refresh_dialog=TRUE; } diff --git a/src/gui_vasp.h b/src/gui_vasp.h index 321cc76..f1f5949 100644 --- a/src/gui_vasp.h +++ b/src/gui_vasp.h @@ -23,127 +23,13 @@ The GNU GPL can also be found at http://www.gnu.org /* simple VASP calcul interface */ /* DEFINES: sync vasp_gui and vasp_gui.calc */ #define VASP_REG_VAL(value,format) do{\ - tamp=g_strdup_printf("%s",gtk_entry_get_text(GTK_ENTRY(vasp_gui.value)));\ - sscanf(tamp,format,&(vasp_gui.calc.value));\ - g_free(tamp);\ + GUI_REG_VAL(vasp_gui.value,vasp_gui.calc.value,format);\ }while(0) #define VASP_REG_TEXT(value) do{\ -if(gtk_entry_get_text_length(GTK_ENTRY(vasp_gui.value))>0){\ - if(vasp_gui.calc.value!=NULL) g_free(vasp_gui.calc.value);\ - vasp_gui.calc.value=g_strdup_printf("%s",gtk_entry_get_text(GTK_ENTRY(vasp_gui.value)));\ -}else{\ - if(vasp_gui.calc.value!=NULL) g_free(vasp_gui.calc.value);\ - vasp_gui.calc.value=NULL;\ -}\ + if(vasp_gui.calc.value!=NULL) g_free(vasp_gui.calc.value);\ + if(GUI_ENTRY_LENGHT(vasp_gui.value)>0) GUI_ENTRY_GET_TEXT(vasp_gui.value,vasp_gui.calc.value);\ + else vasp_gui.calc.value=NULL;\ }while(0) -/* DEFINES: interface */ -#define _SPACE 0 -#define VASP_NEW_LINE() do{\ - hbox = gtk_hbox_new(FALSE, 0);\ - gtk_container_set_border_width(GTK_CONTAINER(hbox), _SPACE);\ - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);\ -}while(0) -#define VASP_NEW_LABEL(text) do{\ - label = gtk_label_new(text);\ - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);\ -}while(0) -#define VASP_TEXT_ENTRY(name,value,wilde) do{\ - name=gtk_entry_new();\ - if(value!=NULL) gtk_entry_set_text(GTK_ENTRY(name),g_strdup_printf("%s",value));\ - gtk_box_pack_start(GTK_BOX(hbox), name, wilde, wilde, 0);\ -}while(0) -#define VASP_ENTRY(name,value,format,size) do{\ - name=gtk_entry_new();\ - gtk_entry_set_text(GTK_ENTRY(name),g_strdup_printf(format,value));\ - gtk_entry_set_width_chars (GTK_ENTRY(name),size);\ - gtk_box_pack_start(GTK_BOX(hbox), name, FALSE, FALSE, 0);\ -}while(0) -#define VASP_NEW_SEPARATOR() do{\ - separator=gtk_hseparator_new();\ - gtk_box_pack_start(GTK_BOX(hbox), separator, TRUE, FALSE, 0);\ -}while(0) -#define VASP_REG_COMBO(name,default_text,function) do{\ - name = gtk_combo_new();\ - gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(name)->entry), FALSE);\ - gtk_combo_set_popdown_strings(GTK_COMBO(name), list);\ - g_list_free(list);\ - gtk_box_pack_start(GTK_BOX(hbox), name, FALSE, FALSE, 0);\ - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(name)->entry),default_text);\ - g_signal_connect(GTK_OBJECT(GTK_COMBO(name)->entry), "changed",GTK_SIGNAL_FUNC(function),data);\ -}while(0) -/* DEFINES: table interface */ -#define VASP_TEXT_TABLE(name,value,caption,l,r,t,b) do{\ - hbox = gtk_hbox_new(FALSE, 0);\ - VASP_NEW_LABEL(caption);\ - VASP_TEXT_ENTRY(name,value,TRUE);\ - gtk_table_attach_defaults(GTK_TABLE(table),hbox,l,r,t,b);\ -}while(0) -#define VASP_ENTRY_TABLE(name,value,format,caption,l,r,t,b) do{\ - hbox = gtk_hbox_new(FALSE, 0);\ - VASP_NEW_LABEL(caption);\ - VASP_NEW_SEPARATOR();\ - VASP_ENTRY(name,value,format,8);\ - gtk_table_attach_defaults(GTK_TABLE(table),hbox,l,r,t,b);\ -}while(0) -#define VASP_CHECK_TABLE(name,value,function,caption,l,r,t,b) do{\ - hbox = gtk_hbox_new(FALSE, 0);\ - name = gui_direct_check(caption,&(value),function,NULL,hbox);\ - gtk_table_attach_defaults(GTK_TABLE(table),hbox,l,r,t,b);\ -}while(0) -#define VASP_COMBO_TABLE(name,default_text,function,caption,l,r,t,b) do{\ - hbox = gtk_hbox_new(FALSE, 0);\ - VASP_NEW_LABEL(caption);\ - VASP_NEW_SEPARATOR();\ - VASP_REG_COMBO(name,default_text,function);\ - gtk_table_attach_defaults(GTK_TABLE(table),hbox,l,r,t,b);\ -}while(0) -#define VASP_SEPARATOR_TABLE(l,r,t,b) do{\ - separator=gtk_hseparator_new();\ - gtk_table_attach_defaults(GTK_TABLE(table),separator,l,r,t,b);\ -}while(0) -#define VASP_COMBOBOX_TABLE(name,caption,l,r,t,b) do{\ - hbox = gtk_hbox_new(FALSE, 0);\ - label = gtk_label_new(caption);\ - gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);\ - name=gtk_combo_box_text_new_with_entry();\ - gtk_entry_set_editable(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(name))),FALSE);\ - gtk_box_pack_start(GTK_BOX(hbox),name,TRUE,TRUE,0);\ - gtk_table_attach_defaults(GTK_TABLE(table),hbox,l,r,t,b);\ -}while(0) -#define VASP_COMBOBOX_ADD(combobox,text) do{\ - gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combobox),text);\ -}while(0) -#define VASP_COMBOBOX_SETUP(combobox,default_value,function) do{\ - gtk_combo_box_set_active(GTK_COMBO_BOX(combobox),default_value);\ - g_signal_connect(GTK_COMBO_BOX_TEXT(combobox),"changed",GTK_SIGNAL_FUNC(function),data);\ -}while(0) -/*default spin is always [1,100]*/ -#define VASP_SPIN_TABLE(name,value,function,caption,l,r,t,b) do{\ - hbox = gtk_hbox_new(FALSE, 0);\ - name = gui_direct_spin(caption,&(value),1.0,100.0,1.0,function,NULL,hbox);\ - gtk_table_attach_defaults(GTK_TABLE(table),hbox,l,r,t,b);\ -}while(0) -#define VASP_BUTTON_TABLE(name,type,function,l,r,t,b) do{\ - name=gtk_button_new_from_stock(type);\ - gtk_table_attach_defaults(GTK_TABLE(table),name,l,r,t,b);\ - g_signal_connect(GTK_OBJECT(name),"clicked",GTK_SIGNAL_FUNC(function),NULL);\ -}while(0) -#define VASP_2BUTTONS_TABLE(name_1,name_2,function_1,function_2,l,r,t,b) do{\ - hbox = gtk_hbox_new(FALSE, 0);\ - name_1 = gui_stock_button(GTK_STOCK_APPLY,function_1,NULL,hbox);\ - name_2 = gui_stock_button(GTK_STOCK_DELETE,function_2,NULL,hbox);\ - gtk_table_attach_defaults(GTK_TABLE(table),hbox,l,r,t,b);\ -}while(0) -/*left aligned labels*/ -#define VASP_LABEL_TABLE(caption,l,r,t,b) do{\ - hbox = gtk_hbox_new(FALSE, 0);\ - label = gtk_label_new(caption);\ - gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0);\ - VASP_NEW_SEPARATOR();\ - gtk_table_attach_defaults(GTK_TABLE(table),hbox,l,r,t,b);\ -}while(0) -#define VASP_TOOLTIP(widget,text) gtk_widget_set_tooltip_text(widget,text) - /*page numbers*/ #define VASP_PAGE_SIMPLIFIED 0 #define VASP_PAGE_CONVERGENCE 1 @@ -153,207 +39,206 @@ if(gtk_entry_get_text_length(GTK_ENTRY(vasp_gui.value))>0){\ #define VASP_PAGE_KPOINTS 5 #define VASP_PAGE_POTCAR 6 #define VASP_PAGE_EXEC 7 - /* gui structure */ struct vasp_calc_gui{ /*just a recall*/ - GtkWidget *window; + GUI_OBJ *window; vasp_calc_struct calc; /*actual GUI*/ /*simple interface*/ - GtkWidget *simple_calcul; - GtkWidget *simple_system; + GUI_OBJ *simple_calcul; + GUI_OBJ *simple_system; gboolean simple_rgeom; - GtkWidget *simple_dim; + GUI_OBJ *simple_dim; gdouble dimension; - GtkWidget *simple_kgrid; - GtkWidget *simple_poscar; - GtkWidget *simple_species; - GtkWidget *simple_potcar; - GtkWidget *simple_potcar_button; - GtkWidget *simple_np; - GtkWidget *simple_ncore; - GtkWidget *simple_kpar; - GtkWidget *simple_apply; - GtkWidget *simple_message; - GtkTextBuffer *simple_message_buff; + GUI_OBJ *simple_kgrid; + GUI_OBJ *simple_poscar; + GUI_OBJ *simple_species; + GUI_OBJ *simple_potcar; + GUI_OBJ *simple_potcar_button; + GUI_OBJ *simple_np; + GUI_OBJ *simple_ncore; + GUI_OBJ *simple_kpar; + GUI_OBJ *simple_apply; + GUI_OBJ *simple_message; + GUI_TEXTVIEW_BUFFER *simple_message_buff; /*full interface*/ gint cur_page; - GtkWidget *name; - GtkWidget *file_entry; - GtkWidget *prec; - GtkWidget *encut; - GtkWidget *enaug; - GtkWidget *ediff; - GtkWidget *algo; - GtkWidget *ialgo; - GtkWidget *nsim; - GtkWidget *vtime; - GtkWidget *nbands; - GtkWidget *nelect; - GtkWidget *iwavpr; - GtkWidget *ismear; - GtkWidget *ismear_3;/*intentional duplicate*/ - GtkWidget *sigma; - GtkWidget *fermwe; - GtkWidget *fermdo; - GtkWidget *kgamma; - GtkWidget *kgamma_3;/*intentional duplicates*/ - GtkWidget *kspacing; - GtkWidget *kspacing_3;/*intentional duplicates*/ - GtkWidget *lreal; - GtkWidget *ropt; - GtkWidget *lmaxmix; - GtkWidget *lmaxpaw; - GtkWidget *istart; - GtkWidget *icharg; - GtkWidget *nupdown; - GtkWidget *magmom; - GtkWidget *lmaxtau; - GtkWidget *lnoncoll; - GtkWidget *saxis; - GtkWidget *gga; - GtkWidget *lsorbit; - GtkWidget *metagga; - GtkWidget *cmbj; - GtkWidget *cmbja; - GtkWidget *cmbjb; - GtkWidget *ldau; - GtkWidget *ldau_print; - GtkWidget *ldaul; - GtkWidget *ldauu; - GtkWidget *ldauj; + GUI_OBJ *name; + GUI_OBJ *file_entry; + GUI_OBJ *prec; + GUI_OBJ *encut; + GUI_OBJ *enaug; + GUI_OBJ *ediff; + GUI_OBJ *algo; + GUI_OBJ *ialgo; + GUI_OBJ *nsim; + GUI_OBJ *vtime; + GUI_OBJ *nbands; + GUI_OBJ *nelect; + GUI_OBJ *iwavpr; + GUI_OBJ *ismear; + GUI_OBJ *ismear_3;/*intentional duplicate*/ + GUI_OBJ *sigma; + GUI_OBJ *fermwe; + GUI_OBJ *fermdo; + GUI_OBJ *kgamma; + GUI_OBJ *kgamma_3;/*intentional duplicates*/ + GUI_OBJ *kspacing; + GUI_OBJ *kspacing_3;/*intentional duplicates*/ + GUI_OBJ *lreal; + GUI_OBJ *ropt; + GUI_OBJ *lmaxmix; + GUI_OBJ *lmaxpaw; + GUI_OBJ *istart; + GUI_OBJ *icharg; + GUI_OBJ *nupdown; + GUI_OBJ *magmom; + GUI_OBJ *lmaxtau; + GUI_OBJ *lnoncoll; + GUI_OBJ *saxis; + GUI_OBJ *gga; + GUI_OBJ *lsorbit; + GUI_OBJ *metagga; + GUI_OBJ *cmbj; + GUI_OBJ *cmbja; + GUI_OBJ *cmbjb; + GUI_OBJ *ldau; + GUI_OBJ *ldau_print; + GUI_OBJ *ldaul; + GUI_OBJ *ldauu; + GUI_OBJ *ldauj; /*mixer*/ - GtkWidget *nelm; - GtkWidget *nelmdl; - GtkWidget *nelmin; - GtkWidget *mixer; - GtkWidget *amix; - GtkWidget *bmix; - GtkWidget *amin; - GtkWidget *amix_mag; - GtkWidget *bmix_mag; - GtkWidget *maxmix; - GtkWidget *wc; - GtkWidget *inimix; - GtkWidget *mixpre; + GUI_OBJ *nelm; + GUI_OBJ *nelmdl; + GUI_OBJ *nelmin; + GUI_OBJ *mixer; + GUI_OBJ *amix; + GUI_OBJ *bmix; + GUI_OBJ *amin; + GUI_OBJ *amix_mag; + GUI_OBJ *bmix_mag; + GUI_OBJ *maxmix; + GUI_OBJ *wc; + GUI_OBJ *inimix; + GUI_OBJ *mixpre; /* dipol */ - GtkWidget *idipol; - GtkWidget *ldipol; - GtkWidget *lmono; - GtkWidget *dipol; - GtkWidget *epsilon; - GtkWidget *efield; + GUI_OBJ *idipol; + GUI_OBJ *ldipol; + GUI_OBJ *lmono; + GUI_OBJ *dipol; + GUI_OBJ *epsilon; + GUI_OBJ *efield; /* dos */ - GtkWidget *lorbit; - GtkWidget *have_paw; - GtkWidget *nedos; - GtkWidget *emin; - GtkWidget *emax; - GtkWidget *efermi; - GtkWidget *rwigs; + GUI_OBJ *lorbit; + GUI_OBJ *have_paw; + GUI_OBJ *nedos; + GUI_OBJ *emin; + GUI_OBJ *emax; + GUI_OBJ *efermi; + GUI_OBJ *rwigs; /* linear response */ - GtkWidget *loptics; - GtkWidget *lepsilon; - GtkWidget *lrpa; - GtkWidget *lnabla; - GtkWidget *lcalceps; - GtkWidget *cshift; + GUI_OBJ *loptics; + GUI_OBJ *lepsilon; + GUI_OBJ *lrpa; + GUI_OBJ *lnabla; + GUI_OBJ *lcalceps; + GUI_OBJ *cshift; /* grid */ - GtkWidget *ngx; - GtkWidget *ngy; - GtkWidget *ngz; - GtkWidget *ngxf; - GtkWidget *ngyf; - GtkWidget *ngzf; + GUI_OBJ *ngx; + GUI_OBJ *ngy; + GUI_OBJ *ngz; + GUI_OBJ *ngxf; + GUI_OBJ *ngyf; + GUI_OBJ *ngzf; /*ionic*/ - GtkWidget *nsw; - GtkWidget *ibrion; - GtkWidget *isif; - GtkWidget *relax_ions; - GtkWidget *relax_shape; - GtkWidget *relax_volume; - GtkWidget *ediffg; - GtkWidget *pstress; - GtkWidget *nfree; - GtkWidget *potim; + GUI_OBJ *nsw; + GUI_OBJ *ibrion; + GUI_OBJ *isif; + GUI_OBJ *relax_ions; + GUI_OBJ *relax_shape; + GUI_OBJ *relax_volume; + GUI_OBJ *ediffg; + GUI_OBJ *pstress; + GUI_OBJ *nfree; + GUI_OBJ *potim; /*md*/ - GtkWidget *tebeg; - GtkWidget *teend; - GtkWidget *smass; - GtkWidget *nblock; - GtkWidget *kblock; - GtkWidget *npaco; - GtkWidget *apaco; + GUI_OBJ *tebeg; + GUI_OBJ *teend; + GUI_OBJ *smass; + GUI_OBJ *nblock; + GUI_OBJ *kblock; + GUI_OBJ *npaco; + GUI_OBJ *apaco; /*symmetry*/ - GtkWidget *isym; - GtkWidget *sym_prec; + GUI_OBJ *isym; + GUI_OBJ *sym_prec; /* POSCAR */ - GtkWidget *poscar_free; - GtkWidget *poscar_direct; - GtkWidget *poscar_a0; - GtkWidget *poscar_ux; - GtkWidget *poscar_uy; - GtkWidget *poscar_uz; - GtkWidget *poscar_vx; - GtkWidget *poscar_vy; - GtkWidget *poscar_vz; - GtkWidget *poscar_wx; - GtkWidget *poscar_wy; - GtkWidget *poscar_wz; - GtkWidget *poscar_atoms; - GtkWidget *poscar_index; - GtkWidget *poscar_symbol; - GtkWidget *poscar_x; - GtkWidget *poscar_y; - GtkWidget *poscar_z; - GtkWidget *poscar_tx; - GtkWidget *poscar_ty; - GtkWidget *poscar_tz; + GUI_OBJ *poscar_free; + GUI_OBJ *poscar_direct; + GUI_OBJ *poscar_a0; + GUI_OBJ *poscar_ux; + GUI_OBJ *poscar_uy; + GUI_OBJ *poscar_uz; + GUI_OBJ *poscar_vx; + GUI_OBJ *poscar_vy; + GUI_OBJ *poscar_vz; + GUI_OBJ *poscar_wx; + GUI_OBJ *poscar_wy; + GUI_OBJ *poscar_wz; + GUI_OBJ *poscar_atoms; + GUI_OBJ *poscar_index; + GUI_OBJ *poscar_symbol; + GUI_OBJ *poscar_x; + GUI_OBJ *poscar_y; + GUI_OBJ *poscar_z; + GUI_OBJ *poscar_tx; + GUI_OBJ *poscar_ty; + GUI_OBJ *poscar_tz; /* KPOINTS */ - GtkWidget *kpoints_nkpts; - GtkWidget *kpoints_mode; - GtkWidget *kpoints_cart; - GtkWidget *kpoints_kx; - GtkWidget *kpoints_ky; - GtkWidget *kpoints_kz; - GtkWidget *kpoints_sx; - GtkWidget *kpoints_sy; - GtkWidget *kpoints_sz; - GtkWidget *kpoints_coord; - GtkWidget *have_tetra; - GtkWidget *kpoints_kpts; - GtkWidget *kpoints_i; - GtkWidget *kpoints_x; - GtkWidget *kpoints_y; - GtkWidget *kpoints_z; - GtkWidget *kpoints_w; - GtkWidget *kpoints_tetra; - GtkWidget *tetra; - GtkWidget *tetra_total; - GtkWidget *tetra_volume; - GtkWidget *tetra_i; - GtkWidget *tetra_w; - GtkWidget *tetra_a; - GtkWidget *tetra_b; - GtkWidget *tetra_c; - GtkWidget *tetra_d; + GUI_OBJ *kpoints_nkpts; + GUI_OBJ *kpoints_mode; + GUI_OBJ *kpoints_cart; + GUI_OBJ *kpoints_kx; + GUI_OBJ *kpoints_ky; + GUI_OBJ *kpoints_kz; + GUI_OBJ *kpoints_sx; + GUI_OBJ *kpoints_sy; + GUI_OBJ *kpoints_sz; + GUI_OBJ *kpoints_coord; + GUI_OBJ *have_tetra; + GUI_OBJ *kpoints_kpts; + GUI_OBJ *kpoints_i; + GUI_OBJ *kpoints_x; + GUI_OBJ *kpoints_y; + GUI_OBJ *kpoints_z; + GUI_OBJ *kpoints_w; + GUI_OBJ *kpoints_tetra; + GUI_OBJ *tetra; + GUI_OBJ *tetra_total; + GUI_OBJ *tetra_volume; + GUI_OBJ *tetra_i; + GUI_OBJ *tetra_w; + GUI_OBJ *tetra_a; + GUI_OBJ *tetra_b; + GUI_OBJ *tetra_c; + GUI_OBJ *tetra_d; /* POTCAR */ - GtkWidget *poscar_species; - GtkWidget *species_flavor; - GtkWidget *species_button; + GUI_OBJ *poscar_species; + GUI_OBJ *species_flavor; + GUI_OBJ *species_button; gboolean have_potcar_folder; - GtkWidget *potcar_select_file; - GtkWidget *potcar_file; - GtkWidget *potcar_file_button; - GtkWidget *potcar_select_folder; - GtkWidget *potcar_folder; - GtkWidget *potcar_folder_button; - GtkWidget *potcar_species; - GtkWidget *potcar_species_flavor; + GUI_OBJ *potcar_select_file; + GUI_OBJ *potcar_file; + GUI_OBJ *potcar_file_button; + GUI_OBJ *potcar_select_folder; + GUI_OBJ *potcar_folder; + GUI_OBJ *potcar_folder_button; + GUI_OBJ *potcar_species; + GUI_OBJ *potcar_species_flavor; /* PERF */ - GtkWidget *ncore; - GtkWidget *kpar; + GUI_OBJ *ncore; + GUI_OBJ *kpar; /*switches*/ gboolean have_xml; gboolean poscar_dirty; @@ -362,13 +247,13 @@ struct vasp_calc_gui{ gboolean rvolume; gboolean have_result; /* CALCUL */ - GtkWidget *job_vasp_exe;/*will be taken directly from gdis in the future*/ - GtkWidget *job_mpirun; - GtkWidget *job_path; - GtkWidget *job_nproc; + GUI_OBJ *job_vasp_exe;/*will be taken directly from gdis in the future*/ + GUI_OBJ *job_mpirun; + GUI_OBJ *job_path; + GUI_OBJ *job_nproc; /*buttons*/ - GtkWidget *button_save; - GtkWidget *button_exec; + GUI_OBJ *button_save; + GUI_OBJ *button_exec; }; /*methods of interest*/ diff --git a/src/interface.h b/src/interface.h index 280aa0e..f978c4c 100644 --- a/src/interface.h +++ b/src/interface.h @@ -66,7 +66,7 @@ NODATA, DATA, BIOSYM, CIF, FDF, GULP, MONTY, MARVIN, MORPH, META_DATA, XML, XTL, XYZ, MOL2, AUTO, CSSR, GAMOUT, PDB, GEOMVIEW_OFF, PROJECT, DOCKING, MDI, CREATOR, MVNOUT, GULPOUT, GULP_TRJ, SIESTA_OUT, VASP, CVASP, -USPEX, REPLACE_ATOMS, DYNAMICS, ZMATRIX, +USPEX, CUSPEX, REPLACE_ATOMS, DYNAMICS, ZMATRIX, OPENGL, OPENGL_OPTIONS, GAMESS, GAMESS_OUT, DIFFAX, DIFFAX_INP, DMOL_INPUT, ABINIT, ABINIT_OUT, NWCHEM, NWCHEM_OUT, CASTEP, CASTEP_OUT, GAUSS, GAUSS_OUT, QE, QE_OUT, @@ -149,6 +149,7 @@ void gui_defect_dialog(void); void gui_setup_dialog(void); void gui_siesta_dialog(void); void gui_vasp_dialog(void); +void gui_uspex_dialog(void); void gui_surface_widget(GtkWidget *); void gui_surface_setup(GtkWidget *); diff --git a/src/main.c b/src/main.c index 8e4ca47..6457da6 100644 --- a/src/main.c +++ b/src/main.c @@ -346,6 +346,8 @@ if (sysenv.gamess_path) fprintf(fp,"gamess_path %s\n", sysenv.gamess_path); if (sysenv.vasp_path) fprintf(fp,"vasp_path %s\n", sysenv.vasp_path); +if (sysenv.uspex_path) + fprintf(fp,"uspex_path %s\n", sysenv.uspex_path); if (sysenv.mpirun_path) fprintf(fp,"mpirun_path %s\n", sysenv.mpirun_path); if (sysenv.povray_path) @@ -359,6 +361,7 @@ fprintf(fp,"convert_exe %s\n", sysenv.convert_exe); fprintf(fp,"gulp_exe %s\n", sysenv.gulp_exe); fprintf(fp,"gamess_exe %s\n", sysenv.gamess_exe); fprintf(fp,"vasp_exe %s\n", sysenv.vasp_exe); +fprintf(fp,"uspex_exe %s\n", sysenv.uspex_exe); fprintf(fp,"mpirun_exe %s\n", sysenv.mpirun_exe); fprintf(fp,"povray_exe %s\n", sysenv.povray_exe); fprintf(fp,"viewer_exe %s\n", sysenv.viewer_exe); @@ -385,6 +388,7 @@ FILE *fp; /* top level structure initialization */ sysenv.vasp_calc_list = NULL;/*to be removed soon*/ +sysenv.uspex_calc_list = NULL; sysenv.max_threads = 1; sysenv.task_list = NULL; sysenv.host_list = NULL; @@ -587,6 +591,7 @@ sysenv.viewer_exe = g_strdup("display"); sysenv.gulp_exe = g_strdup("gulp"); sysenv.gamess_exe = g_strdup("run_gms_for_gdis"); sysenv.vasp_exe = g_strdup("vasp"); +sysenv.uspex_exe = g_strdup("run_uspex"); sysenv.mpirun_exe = g_strdup("mpirun"); #endif @@ -624,6 +629,7 @@ sysenv.convert_path = NULL; sysenv.gulp_path = NULL; sysenv.gamess_path = NULL; sysenv.vasp_path = NULL; +sysenv.uspex_path = NULL; sysenv.mpirun_path = NULL; sysenv.povray_path = NULL; sysenv.viewer_path = NULL; @@ -647,6 +653,8 @@ if (!sysenv.gulp_path) sysenv.gulp_path = g_find_program_in_path(sysenv.gulp_exe); if (!sysenv.vasp_path) sysenv.vasp_path = g_find_program_in_path(sysenv.vasp_exe); +if (!sysenv.uspex_path) + sysenv.uspex_path = g_find_program_in_path(sysenv.uspex_exe); if (!sysenv.mpirun_path) sysenv.mpirun_path = g_find_program_in_path(sysenv.mpirun_exe); if (!sysenv.povray_path) diff --git a/src/makefile.src b/src/makefile.src index 24a83d9..434d56d 100644 --- a/src/makefile.src +++ b/src/makefile.src @@ -18,7 +18,7 @@ SRC = main.c model.c coords.c connect.c matrix.c module.c task.c \ ifeq ($(USE_GUI), YES) SRC := $(SRC) gui_main.c gui_canvas.c gui_shorts.c \ gl_main.c gl_primitives.c gl_stereo.c gl_graph.c gl_varray.c \ - gui_gulp.c gui_siesta.c gui_vasp.c gui_render.c gui_mdi.c gui_animate.c \ + gui_gulp.c gui_siesta.c gui_vasp.c gui_uspex.c gui_render.c gui_mdi.c gui_animate.c \ gui_edit.c gui_surface.c gui_analysis.c gui_defect.c \ gui_molsurf.c gui_diffract.c gui_gms.c gui_library.c gui_setup.c \ gui_gperiodic.c gui_plots.c gui_space.c gui_measure.c gui_symmetry.c gui_zmatrix.c \ diff --git a/src/pak.h b/src/pak.h index 9fb3c3d..4d57661 100644 --- a/src/pak.h +++ b/src/pak.h @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. The GNU GPL can also be found at http://www.gnu.org */ -#define MAX_VALUE_SIZE 64 /*_BUG_OVHPA_1*/ +#define MAX_VALUE_SIZE 128 /*_BUG_OVHPA_1*/ /**********************************/ /* global unified rendering setup */ @@ -153,6 +153,9 @@ gchar *gamess_path; gchar *vasp_exe; gchar *vasp_path; +gchar *uspex_exe; +gchar *uspex_path; + gchar *mpirun_exe; gchar *mpirun_path; @@ -278,6 +281,7 @@ GThreadPool *thread_pool; /* temporary vasp calculation tasks. Will remove when remote job execution is ready --OVHPA*/ GSList *vasp_calc_list; +GSList *uspex_calc_list; /* CURRENT - task successor (remote job execution) */ GSList *host_list; @@ -1393,6 +1397,7 @@ void delay(gint); gint read_elem_data(FILE *, gint); gint write_elem_data(FILE *); +GSList *find_unique(gint mode, struct model_pak *model); void cmd_init(gint, gchar **); diff --git a/src/project.c b/src/project.c index 5b94211..8addfcc 100644 --- a/src/project.c +++ b/src/project.c @@ -293,6 +293,9 @@ fullname = g_build_filename(sysenv.cwd, filename, NULL); model_init(&temp_model); temp_model.grafted = TRUE; +grid[0]=0; +grid[1]=0; + /* CURRENT */ project = project_new("solvent"); project_model_add(model, project);