Changeset 961b75 for pcp/src/init.c


Ignore:
Timestamp:
Apr 21, 2008, 2:19:24 PM (18 years ago)
Author:
Frederik Heber <heber@…>
Children:
b74e5e
Parents:
e00f47
git-author:
Frederik Heber <heber@…> (04/18/08 15:15:13)
git-committer:
Frederik Heber <heber@…> (04/21/08 14:19:24)
Message:

ParseForParameter() has new parameter repetition, which reads the repetition-th occurence of the given keyword

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pcp/src/init.c

    re00f47 r961b75  
    12991299 * \param type Type of the Parameter to be read
    13001300 * \param value address of the value to be read (must have been allocated)
     1301 * \param repetition determines, if the keyword appears multiply in the config file, which repetition shall be parsed, i.e. 1 if not multiply
    13011302 * \param critical necessity of this keyword being specified (optional, critical)
    13021303 * \return 1 - found, 0 - not found
    13031304 * \sa ReadMainParameterFile Calling routine
    13041305 */
    1305 int ParseForParameter(int verbose, FILE *file, const char *const name, int sequential, int const xth, int const yth, enum value_type type, void *value, enum necessity critical) {
     1306int ParseForParameter(int verbose, FILE *file, const char *const name, int sequential, int const xth, int const yth, enum value_type type, void *value, int repetition, enum necessity critical) {
    13061307        int i,j;        // loop variables
    13071308        int me, length, maxlength = -1;
    13081309        long file_position = ftell(file);       // mark current position
    1309         char *dummy1, *dummy, *free_dummy;              // pointers in the line that is read in per step
     1310        char *dummy2, *dummy1, *dummy, *free_dummy;             // pointers in the line that is read in per step
     1311
     1312  if (repetition == 0)
     1313    Error(SomeError, "ParseForParameter(): argument repetition must not be 0!");
     1314
     1315  // allocated memory and rank in multi-process word
    13101316        dummy1 = free_dummy = (char *) Malloc(256 * sizeof(char),"ParseForParameter: MemAlloc for dummy1 failed");
    13111317        MPI_Comm_rank(MPI_COMM_WORLD, &me);
    13121318
    13131319        //fprintf(stderr,"(%i) Parsing for %s\n",me,name);     
    1314 
    13151320        int line = 0;   // marks line where parameter was found
    13161321        int found = (type >= grid) ? 0 : (-yth + 1);    // marks if yth parameter name was found
    1317         while((found != 1)) {
     1322        while((found != repetition)) {
    13181323                dummy1 = dummy = free_dummy;
    13191324                do {
     
    13481353                if (name != NULL) {
    13491354                        dummy = strchr(dummy1,'\t');    // set dummy on first tab or space which ever nearer
    1350       if (dummy == NULL) {
    1351         dummy = strchr(dummy1, ' ');  // if not found seek for space
    1352         while ((dummy != NULL) && ((*dummy == '\t') || (*dummy == ' ')))    // skip some more tabs and spaces if necessary
    1353           dummy++;
     1355      dummy2 = strchr(dummy1, ' ');  // if not found seek for space
     1356      if ((dummy != NULL) || (dummy2 != NULL)) {
     1357        if ((dummy == NULL) || ((dummy2 != NULL) && (dummy2 < dummy)))
     1358          dummy = dummy2;
    13541359      }
    13551360                        if (dummy == NULL) {
     
    13591364                    //Error(FileOpenParams, NULL);                     
    13601365                        } else {
    1361                                 //fprintf(stderr,"(%i) found tab at %i\n",me,(char *)dummy-(char *)dummy1);
     1366                                //fprintf(stderr,"(%i) found tab at %li\n",me,(long)((char *)dummy-(char *)dummy1));
    13621367                        }
    13631368                } else dummy = dummy1;
    13641369                // ... and check if it is the keyword!
    1365                 if ((name == NULL) || ((dummy-dummy1 >= 3) && (strncmp(dummy1, name, strlen(name)) == 0))) {
     1370                if ((name == NULL) || ((dummy-dummy1 >= 3) && (strncmp(dummy1, name, strlen(name)) == 0) && (dummy-dummy1 == strlen(name)))) {
    13661371                        found++; // found the parameter!
    13671372                        //fprintf(stderr,"(%i) found %s at line %i\n",me, name, line);         
    13681373                       
    1369                         if (found == 1) {
     1374                        if (found == repetition) {
    13701375                                for (i=0;i<xth;i++) {   // i = rows
    13711376                                        if (type >= grid) {
     
    14131418                                                        // otherwise we must skip all interjacent tabs and spaces and find next value
    14141419                                                        dummy1 = dummy;
    1415                                                         dummy = strchr(dummy1, '\t');   // seek for tab or space
    1416               if (dummy == NULL) {
    1417                 dummy = strchr(dummy1, ' ');  // if not found seek for space
    1418                 while ((dummy != NULL) && ((*dummy == '\t') || (*dummy == ' ')))    // skip some more tabs and spaces if necessary
    1419                   dummy++;
     1420                                                        dummy = strchr(dummy1, '\t');   // seek for tab or space (space if appears sooner)
     1421              dummy2 = strchr(dummy1, ' ');
     1422              //fprintf(stderr,"dummy (%p) is %c\t dummy2 (%p) is %c\n", dummy, (dummy == NULL ? '-' : *dummy), dummy2, (dummy2 == NULL ? '-' : *dummy2));
     1423              if ((dummy != NULL) || (dummy2 != NULL)) {
     1424                if ((dummy == NULL) || ((dummy2 != NULL) && (dummy2 < dummy)))
     1425                  dummy = dummy2;
     1426                //while ((dummy != NULL) && ((*dummy == '\t') || (*dummy == ' ')))    // skip some more tabs and spaces if necessary
     1427                //  dummy++;
    14201428              }
    14211429/*                                                      while ((dummy != NULL) && ((*dummy == '\t') || (*dummy == ' ')))                // skip some more tabs and spaces if necessary
    14221430                                                                dummy++;*/
    1423                                                         if (dummy == NULL) { // if still zero returned ...
     1431              //fprintf(stderr,"dummy is %c\n", *dummy);
     1432              dummy2 = strchr(dummy1, '#');
     1433              if ((dummy == NULL) || ((dummy2 != NULL) && (dummy1 >= dummy2))) { // if still zero returned or in comment area ...
    14241434                                                                dummy = strchr(dummy1, '\n');    // ... at line end then
    1425                                                                 if ((j < yth-1) && (type < 4)) {        // check if xth value or not yet
    1426                                                                         if (verbose) fprintf(stderr,"(%i)Error: EoL at %i and still missing %i value(s) for parameter %s\n", me, line, yth-j, name);
    1427                   Free(free_dummy, "ParseForParameter: free_dummy");
    1428                                                                         return 0;
     1435                                                                if ((i < xth-1) && (type < 4)) {        // check if xth value or not yet
     1436                  if (critical) {
     1437                    if (verbose) fprintf(stderr,"(%i)Error: EoL or comment at %i and still missing %i value(s) for parameter %s\n", me, line, yth-j, name);
     1438                    Free(free_dummy, "ParseForParameter: free_dummy");
     1439                    Error(InitReading, name);
     1440                  } else {
     1441                    //if (!sequential)
     1442                    fseek(file, file_position, SEEK_SET);  // rewind to start position
     1443                    Free(free_dummy, "ParseForParameter: free_dummy");
     1444                    return 0;
     1445                  }
    14291446                                                            //Error(FileOpenParams, NULL);                     
    14301447                                                                }
     
    14821499        }       
    14831500  if ((type >= row_int) && (verbose)) fprintf(stderr,"\n");
     1501        if (!sequential) fseek(file, file_position, SEEK_SET);  // rewind to start position
    14841502  Free(free_dummy, "ParseForParameter: free_dummy");
    1485         if (!sequential) fseek(file, file_position, SEEK_SET);  // rewind to start position
    14861503        //fprintf(stderr, "(%i) End of Parsing\n\n",me);
    14871504       
     
    15031520  FILE *file;
    15041521  int i, di, me;
    1505   double BField[NDIM_NDIM];
     1522  //double BField[NDIM];
    15061523 
    15071524  MPI_Comm_rank(MPI_COMM_WORLD, &me);
     
    15161533
    15171534  P->Files.filename = MallocString(MAXDUMMYSTRING,"ReadParameters: filename");
    1518         ParseForParameter(P->Call.out[ReadOut],file, "mainname", 0, 1, 1, string_type, P->Files.filename, critical);
     1535        ParseForParameter(P->Call.out[ReadOut],file, "mainname", 0, 1, 1, string_type, P->Files.filename, 1, critical);
    15191536  //debug(P,"mainname");
    15201537  CreateMainname(P, filename);
    15211538  P->Files.default_path = MallocString(MAXDUMMYSTRING,"ReadParameters: default_path");
    1522   ParseForParameter(P->Call.out[ReadOut],file, "defaultpath", 0, 1, 1, string_type, P->Files.default_path, critical);
     1539  ParseForParameter(P->Call.out[ReadOut],file, "defaultpath", 0, 1, 1, string_type, P->Files.default_path, 1, critical);
    15231540  P->Files.pseudopot_path = MallocString(MAXDUMMYSTRING,"ReadParameters: pseudopot_path");
    1524   ParseForParameter(P->Call.out[ReadOut],file, "pseudopotpath", 0, 1, 1, string_type, P->Files.pseudopot_path, critical);
    1525   ParseForParameter(P->Call.out[ReadOut],file,"ProcPEGamma", 0, 1, 1, int_type, &(P->Par.proc[PEGamma]), critical);
    1526   ParseForParameter(P->Call.out[ReadOut],file,"ProcPEPsi", 0, 1, 1, int_type, &(P->Par.proc[PEPsi]), critical);
     1541  ParseForParameter(P->Call.out[ReadOut],file, "pseudopotpath", 0, 1, 1, string_type, P->Files.pseudopot_path, 1, critical);
     1542  ParseForParameter(P->Call.out[ReadOut],file,"ProcPEGamma", 0, 1, 1, int_type, &(P->Par.proc[PEGamma]), 1, critical);
     1543  ParseForParameter(P->Call.out[ReadOut],file,"ProcPEPsi", 0, 1, 1, int_type, &(P->Par.proc[PEPsi]), 1, critical);
    15271544  if (P->Call.proc[PEPsi]) { /* Kommandozeilenoption */
    15281545    P->Par.proc[PEPsi]  = P->Call.proc[PEPsi];
     
    15321549    Run
    15331550  */
    1534   if (!ParseForParameter(P->Call.out[ReadOut],file,"Seed", 0, 1, 1, int_type, &(R->Seed), optional))
     1551  if (!ParseForParameter(P->Call.out[ReadOut],file,"Seed", 0, 1, 1, int_type, &(R->Seed), 1, optional))
    15351552    R->Seed = 1;
    1536   if (!ParseForParameter(P->Call.out[ReadOut],file,"WaveNr", 0, 1, 1, int_type, &(R->WaveNr), optional))
     1553  if (!ParseForParameter(P->Call.out[ReadOut],file,"WaveNr", 0, 1, 1, int_type, &(R->WaveNr), 1, optional))
    15371554    R->WaveNr = 0;
    1538   if (!ParseForParameter(P->Call.out[ReadOut],file,"Lambda", 0, 1, 1, double_type, &R->Lambda, optional))
     1555  if (!ParseForParameter(P->Call.out[ReadOut],file,"Lambda", 0, 1, 1, double_type, &R->Lambda, 1, optional))
    15391556    R->Lambda = 1.;
    15401557
    1541   if(!ParseForParameter(P->Call.out[ReadOut],file,"DoOutOrbitals", 0, 1, 1, int_type, &F->DoOutOrbitals, optional)) {
     1558  if(!ParseForParameter(P->Call.out[ReadOut],file,"DoOutOrbitals", 0, 1, 1, int_type, &F->DoOutOrbitals, 1, optional)) {
    15421559    F->DoOutOrbitals = 0;
    15431560  } else {
     
    15451562    if (F->DoOutOrbitals > 1) F->DoOutOrbitals = 1;
    15461563  }
    1547   ParseForParameter(P->Call.out[ReadOut],file,"DoOutVis", 0, 1, 1, int_type, &F->DoOutVis, critical);
     1564  ParseForParameter(P->Call.out[ReadOut],file,"DoOutVis", 0, 1, 1, int_type, &F->DoOutVis, 1, critical);
    15481565  if (F->DoOutVis < 0) F->DoOutVis = 0;
    1549   if (F->DoOutVis > 1) F->DoOutVis = 1;
    1550   if (!ParseForParameter(P->Call.out[ReadOut],file,"VectorPlane", 0, 1, 1, int_type, &R->VectorPlane, optional))
     1566  if (F->DoOutVis > 2) F->DoOutVis = 1;
     1567  if (!ParseForParameter(P->Call.out[ReadOut],file,"VectorPlane", 0, 1, 1, int_type, &R->VectorPlane, 1, optional))
    15511568    R->VectorPlane = -1;
    15521569  if (R->VectorPlane < -1 || R->VectorPlane > 2) {
     
    15541571    R->VectorPlane = -1;
    15551572  }
    1556   if (!ParseForParameter(P->Call.out[ReadOut],file,"VectorCut", 0, 1, 1, double_type, &R->VectorCut, optional))
     1573  if (!ParseForParameter(P->Call.out[ReadOut],file,"VectorCut", 0, 1, 1, double_type, &R->VectorCut, 1, optional))
    15571574    R->VectorCut = 0.;
    1558   ParseForParameter(P->Call.out[ReadOut],file,"DoOutMes", 0, 1, 1, int_type, &F->DoOutMes, critical);
     1575  ParseForParameter(P->Call.out[ReadOut],file,"DoOutMes", 0, 1, 1, int_type, &F->DoOutMes, 1, critical);
    15591576  if (F->DoOutMes < 0) F->DoOutMes = 0;
    15601577  if (F->DoOutMes > 1) F->DoOutMes = 1;
    1561   if (!ParseForParameter(P->Call.out[ReadOut],file,"DoOutCurr", 0, 1, 1, int_type, &F->DoOutCurr, optional))
     1578  if (!ParseForParameter(P->Call.out[ReadOut],file,"DoOutCurr", 0, 1, 1, int_type, &F->DoOutCurr, 1, optional))
    15621579    F->DoOutCurr = 0;
     1580  if (!ParseForParameter(P->Call.out[ReadOut],file,"DoOutNICS", 0, 1, 1, int_type, &F->DoOutNICS, 1, optional))
     1581    F->DoOutNICS = 0;
    15631582  if (F->DoOutCurr < 0) F->DoOutCurr = 0;
    15641583  if (F->DoOutCurr > 1) F->DoOutCurr = 1;
    1565   ParseForParameter(P->Call.out[ReadOut],file,"AddGramSch", 0, 1, 1, int_type, &R->UseAddGramSch, critical);
     1584  ParseForParameter(P->Call.out[ReadOut],file,"AddGramSch", 0, 1, 1, int_type, &R->UseAddGramSch, 1, critical);
    15661585  if (R->UseAddGramSch < 0) R->UseAddGramSch = 0;
    15671586  if (R->UseAddGramSch > 2) R->UseAddGramSch = 2;
    15681587  if(P->Call.out[ReadOut]) fprintf(stderr,"(%i)UseAddGramSch = %i\n",me,R->UseAddGramSch);
    1569   if(!ParseForParameter(P->Call.out[ReadOut],file,"CommonWannier", 0, 1, 1, int_type, &R->CommonWannier, optional)) {
     1588  if(!ParseForParameter(P->Call.out[ReadOut],file,"CommonWannier", 0, 1, 1, int_type, &R->CommonWannier, 1, optional)) {
    15701589    R->CommonWannier = 0;
    15711590  } else {
     
    15731592    if (R->CommonWannier > 4) R->CommonWannier = 4;
    15741593  }
    1575   if(!ParseForParameter(P->Call.out[ReadOut],file,"SawtoothStart", 0, 1, 1, double_type, &P->Lat.SawtoothStart, optional)) {
     1594  if(!ParseForParameter(P->Call.out[ReadOut],file,"SawtoothStart", 0, 1, 1, double_type, &P->Lat.SawtoothStart, 1, optional)) {
    15761595    P->Lat.SawtoothStart = 0.01;
    15771596  } else {
     
    15791598    if (P->Lat.SawtoothStart > 1.) P->Lat.SawtoothStart = 1.;
    15801599  }
    1581   if (!ParseForParameter(P->Call.out[ReadOut],file,"DoBrent", 0, 1, 1, int_type, &R->DoBrent, optional)) {
     1600  if (!ParseForParameter(P->Call.out[ReadOut],file,"DoBrent", 0, 1, 1, int_type, &R->DoBrent, 1, optional)) {
    15821601    R->DoBrent = 0;
    15831602  } else {
     
    15871606   
    15881607 
    1589         ParseForParameter(P->Call.out[ReadOut],file,"MaxOuterStep", 0, 1, 1, int_type, &R->MaxOuterStep, critical);
     1608  if (!ParseForParameter(P->Call.out[ReadOut],file,"MaxOuterStep", 0, 1, 1, int_type, &R->MaxOuterStep, 1, optional))
     1609    R->MaxOuterStep = 0;
     1610  if (!ParseForParameter(P->Call.out[ReadOut],file,"MaxStructOptStep", 0, 1, 1, int_type, &R->MaxStructOptStep, 1, optional)) {
     1611    if (R->MaxOuterStep != 0) { // if StructOptStep not explicitely specified, then use OuterStep
     1612      R->MaxStructOptStep = R->MaxOuterStep;
     1613    } else {
     1614      R->MaxStructOptStep = 100;
     1615    }
     1616  }
    15901617  // the following values are MD specific and should be dropped in further revisions
    1591         if (!ParseForParameter(P->Call.out[ReadOut],file,"Deltat", 0, 1, 1, double_type, &R->delta_t, optional))
    1592     R->delta_t = 0;
    1593         if (!ParseForParameter(P->Call.out[ReadOut],file,"OutVisStep", 0, 1, 1, int_type, &R->OutVisStep, optional))
     1618        if (!ParseForParameter(P->Call.out[ReadOut],file,"Deltat", 0, 1, 1, double_type, &R->delta_t, 1, optional))
     1619    R->delta_t = 1.;
     1620        if (!ParseForParameter(P->Call.out[ReadOut],file,"OutVisStep", 0, 1, 1, int_type, &R->OutVisStep, 1, optional))
    15941621    R->OutVisStep = 10;
    1595         if (!ParseForParameter(P->Call.out[ReadOut],file,"OutSrcStep", 0, 1, 1, int_type, &R->OutSrcStep, optional))
     1622        if (!ParseForParameter(P->Call.out[ReadOut],file,"OutSrcStep", 0, 1, 1, int_type, &R->OutSrcStep, 1, optional))
    15961623    R->OutSrcStep = 5;
    1597         if (!ParseForParameter(P->Call.out[ReadOut],file,"TargetTemp", 0, 1, 1, double_type, &R->TargetTemp, optional))
     1624        if (!ParseForParameter(P->Call.out[ReadOut],file,"TargetTemp", 0, 1, 1, double_type, &R->TargetTemp, 1, optional))
    15981625    R->TargetTemp = 0;
    1599         if (!ParseForParameter(P->Call.out[ReadOut],file,"ScaleTempStep", 0, 1, 1, int_type, &R->ScaleTempStep, optional))
    1600     R->ScaleTempStep = 25;
    16011626   
    1602   if (!ParseForParameter(P->Call.out[ReadOut],file,"EpsWannier", 0, 1, 1, double_type, &R->EpsWannier, optional))
     1627  if (!ParseForParameter(P->Call.out[ReadOut],file,"EpsWannier", 0, 1, 1, double_type, &R->EpsWannier, 1, optional))
    16031628    R->EpsWannier = 1e-8;
    16041629 
     
    16071632  //if (R->MaxOuterStep <= 0) R->MaxOuterStep = 1;
    16081633  if(P->Call.out[NormalOut]) fprintf(stderr,"(%i)MaxOuterStep = %i\n",me,R->MaxOuterStep);
    1609   if(P->Call.out[NormalOut]) fprintf(stderr,"(%i)t = %g\n",me,R->t);
    1610   ParseForParameter(P->Call.out[ReadOut],file,"MaxPsiStep", 0, 1, 1, int_type, &R->MaxPsiStep, critical);
     1634  if(P->Call.out[NormalOut]) fprintf(stderr,"(%i)Deltat = %g\n",me,R->delta_t);
     1635  ParseForParameter(P->Call.out[ReadOut],file,"MaxPsiStep", 0, 1, 1, int_type, &R->MaxPsiStep, 1, critical);
    16111636  if (R->MaxPsiStep <= 0) R->MaxPsiStep = 3;
    16121637  if(P->Call.out[NormalOut]) fprintf(stderr,"(%i)MaxPsiStep = %i\n",me,R->MaxPsiStep);
    16131638 
    1614   ParseForParameter(P->Call.out[ReadOut],file,"MaxMinStep", 0, 1, 1, int_type, &R->MaxMinStep, critical);
    1615         ParseForParameter(P->Call.out[ReadOut],file,"RelEpsTotalE", 0, 1, 1, double_type, &R->RelEpsTotalEnergy, critical);
    1616         ParseForParameter(P->Call.out[ReadOut],file,"RelEpsKineticE", 0, 1, 1, double_type, &R->RelEpsKineticEnergy, critical);
    1617   ParseForParameter(P->Call.out[ReadOut],file,"MaxMinStopStep", 0, 1, 1, int_type, &R->MaxMinStopStep, critical);
    1618   ParseForParameter(P->Call.out[ReadOut],file,"MaxMinGapStopStep", 0, 1, 1, int_type, &R->MaxMinGapStopStep, critical);
     1639  ParseForParameter(P->Call.out[ReadOut],file,"MaxMinStep", 0, 1, 1, int_type, &R->MaxMinStep, 1, critical);
     1640        ParseForParameter(P->Call.out[ReadOut],file,"RelEpsTotalE", 0, 1, 1, double_type, &R->RelEpsTotalEnergy, 1, critical);
     1641        ParseForParameter(P->Call.out[ReadOut],file,"RelEpsKineticE", 0, 1, 1, double_type, &R->RelEpsKineticEnergy, 1, critical);
     1642  ParseForParameter(P->Call.out[ReadOut],file,"MaxMinStopStep", 0, 1, 1, int_type, &R->MaxMinStopStep, 1, critical);
     1643  ParseForParameter(P->Call.out[ReadOut],file,"MaxMinGapStopStep", 0, 1, 1, int_type, &R->MaxMinGapStopStep, 1, critical);
    16191644  if (R->MaxMinStep <= 0) R->MaxMinStep = R->MaxPsiStep;
    16201645  if (R->MaxMinStopStep < 1) R->MaxMinStopStep = 1;
     
    16221647  if(P->Call.out[NormalOut]) fprintf(stderr,"(%i)MaxMinStep = %i\tRelEpsTotalEnergy: %e\tRelEpsKineticEnergy %e\tMaxMinStopStep %i\n",me,R->MaxMinStep,R->RelEpsTotalEnergy,R->RelEpsKineticEnergy,R->MaxMinStopStep);
    16231648 
    1624   ParseForParameter(P->Call.out[ReadOut],file,"MaxInitMinStep", 0, 1, 1, int_type, &R->MaxInitMinStep, critical);
    1625         ParseForParameter(P->Call.out[ReadOut],file,"InitRelEpsTotalE", 0, 1, 1, double_type, &R->InitRelEpsTotalEnergy, critical);
    1626         ParseForParameter(P->Call.out[ReadOut],file,"InitRelEpsKineticE", 0, 1, 1, double_type, &R->InitRelEpsKineticEnergy, critical);
    1627   ParseForParameter(P->Call.out[ReadOut],file,"InitMaxMinStopStep", 0, 1, 1, int_type, &R->InitMaxMinStopStep, critical);
    1628   ParseForParameter(P->Call.out[ReadOut],file,"InitMaxMinGapStopStep", 0, 1, 1, int_type, &R->InitMaxMinGapStopStep, critical);
     1649  ParseForParameter(P->Call.out[ReadOut],file,"MaxInitMinStep", 0, 1, 1, int_type, &R->MaxInitMinStep, 1, critical);
     1650        ParseForParameter(P->Call.out[ReadOut],file,"InitRelEpsTotalE", 0, 1, 1, double_type, &R->InitRelEpsTotalEnergy, 1, critical);
     1651        ParseForParameter(P->Call.out[ReadOut],file,"InitRelEpsKineticE", 0, 1, 1, double_type, &R->InitRelEpsKineticEnergy, 1, critical);
     1652  ParseForParameter(P->Call.out[ReadOut],file,"InitMaxMinStopStep", 0, 1, 1, int_type, &R->InitMaxMinStopStep, 1, critical);
     1653  ParseForParameter(P->Call.out[ReadOut],file,"InitMaxMinGapStopStep", 0, 1, 1, int_type, &R->InitMaxMinGapStopStep, 1, critical);
    16291654  if (R->MaxInitMinStep <= 0) R->MaxInitMinStep = R->MaxPsiStep;
    16301655  if (R->InitMaxMinStopStep < 1) R->InitMaxMinStopStep = 1;
     
    16331658 
    16341659  // Unit cell and magnetic field
    1635   ParseForParameter(P->Call.out[ReadOut],file, "BoxLength", 0, 3, 3, lower_trigrid, &P->Lat.RealBasis, critical); /* Lattice->RealBasis */
    1636   ParseForParameter(P->Call.out[ReadOut],file, "DoPerturbation", 0, 1, 1, int_type, &R->DoPerturbation, optional);
     1660  ParseForParameter(P->Call.out[ReadOut],file, "BoxLength", 0, 3, 3, lower_trigrid, &P->Lat.RealBasis, 1, critical); /* Lattice->RealBasis */
     1661  ParseForParameter(P->Call.out[ReadOut],file, "DoPerturbation", 0, 1, 1, int_type, &R->DoPerturbation, 1, optional);
    16371662  if (!R->DoPerturbation) {
    1638     if (!ParseForParameter(P->Call.out[ReadOut],file, "BField", 0, 1, 3, grid, &BField, optional)) { // old parameter for perturbation with field direction
     1663    if (!ParseForParameter(P->Call.out[ReadOut],file, "BField", 0, 1, 3, grid, &R->BField, 1, optional)) { // old parameter for perturbation with field direction
    16391664      if (P->Call.out[ReadOut]) fprintf(stderr,"(%i) No perturbation specified.\n", P->Par.me);
    1640       if (F->DoOutCurr) {
    1641         if (P->Call.out[ReadOut]) fprintf(stderr,"(%i) DoOutCurr= 1 though no DoPerturbation specified: setting DoOutCurr = 0\n", P->Par.me);
     1665      if (F->DoOutCurr || F->DoOutNICS) {
     1666        if (P->Call.out[ReadOut]) fprintf(stderr,"(%i) DoOutCurr/DoOutNICS = 1 though no DoPerturbation specified: setting DoOutCurr = 0\n", P->Par.me);
    16421667        F->DoOutCurr = 0;
     1668        F->DoOutNICS = 0;
    16431669        R->DoPerturbation = 0;
    16441670      }
     
    16531679  RMatReci3(P->Lat.InvBasis,  P->Lat.RealBasis);
    16541680
    1655   if (!ParseForParameter(P->Call.out[ReadOut],file,"DoFullCurrent", 0, 1, 1, int_type, &R->DoFullCurrent, optional))
     1681  if (!ParseForParameter(P->Call.out[ReadOut],file,"DoFullCurrent", 0, 1, 1, int_type, &R->DoFullCurrent, 1, optional))
    16561682    R->DoFullCurrent = 0;
    16571683  if (R->DoFullCurrent < 0) R->DoFullCurrent = 0;
     
    16621688  }
    16631689
    1664         ParseForParameter(P->Call.out[ReadOut],file,"ECut", 0, 1, 1, double_type, &P->Lat.ECut, critical);
     1690        ParseForParameter(P->Call.out[ReadOut],file,"ECut", 0, 1, 1, double_type, &P->Lat.ECut, 1, critical);
    16651691  if(P->Call.out[NormalOut]) fprintf(stderr,"(%i) ECut = %e -> %e Rydberg\n", me, P->Lat.ECut, 2.*P->Lat.ECut);
    1666   ParseForParameter(P->Call.out[ReadOut],file,"MaxLevel", 0, 1, 1, int_type, &P->Lat.MaxLevel, critical);
    1667   ParseForParameter(P->Call.out[ReadOut],file,"Level0Factor", 0, 1, 1, int_type, &P->Lat.Lev0Factor, critical);
     1692  ParseForParameter(P->Call.out[ReadOut],file,"MaxLevel", 0, 1, 1, int_type, &P->Lat.MaxLevel, 1, critical);
     1693  ParseForParameter(P->Call.out[ReadOut],file,"Level0Factor", 0, 1, 1, int_type, &P->Lat.Lev0Factor, 1, critical);
    16681694  if (P->Lat.Lev0Factor < 2) {
    16691695    if(P->Call.out[ReadOut]) fprintf(stderr,"(%i) Set Lev0Factor to 2!\n",me);
    16701696    P->Lat.Lev0Factor = 2;
    16711697  }
    1672   ParseForParameter(P->Call.out[ReadOut],file,"RiemannTensor", 0, 1, 1, int_type, &di, critical);
     1698  ParseForParameter(P->Call.out[ReadOut],file,"RiemannTensor", 0, 1, 1, int_type, &di, 1, critical);
    16731699  if (di >= 0 && di < 2) {
    16741700    P->Lat.RT.Use = (enum UseRiemannTensor)di;
     
    16911717              P->Lat.MaxLevel = 3;
    16921718            }
    1693             ParseForParameter(P->Call.out[ReadOut],file,"RiemannLevel", 0, 1, 1, int_type, &P->Lat.RT.RiemannLevel, critical);
     1719            ParseForParameter(P->Call.out[ReadOut],file,"RiemannLevel", 0, 1, 1, int_type, &P->Lat.RT.RiemannLevel, 1, critical);
    16941720                  if(P->Call.out[ReadOut]) fprintf(stderr,"(%i)!RiemannLevel = %i\n",me,P->Lat.RT.RiemannLevel);
    16951721            if (P->Lat.RT.RiemannLevel < 2) {
     
    17011727              P->Lat.RT.RiemannLevel = P->Lat.MaxLevel-1;
    17021728            }
    1703             ParseForParameter(P->Call.out[ReadOut],file,"LevRFactor", 0, 1, 1, int_type, &P->Lat.LevRFactor, critical);
     1729            ParseForParameter(P->Call.out[ReadOut],file,"LevRFactor", 0, 1, 1, int_type, &P->Lat.LevRFactor, 1, critical);
    17041730            if(P->Call.out[ReadOut]) fprintf(stderr,"(%i)!LevRFactor = %i\n",me,P->Lat.LevRFactor);
    17051731            if (P->Lat.LevRFactor < 2) {
     
    17111737            break;
    17121738  }
    1713   ParseForParameter(P->Call.out[ReadOut],file,"PsiType", 0, 1, 1, int_type, &di, critical);
     1739  ParseForParameter(P->Call.out[ReadOut],file,"PsiType", 0, 1, 1, int_type, &di, 1, critical);
    17141740  if (di >= 0 && di < 2) {
    17151741    P->Lat.Psi.Use = (enum UseSpinType)di;
     
    17221748  switch (P->Lat.Psi.Use) {
    17231749  case UseSpinDouble:
    1724         ParseForParameter(P->Call.out[ReadOut],file,"MaxPsiDouble", 0, 1, 1, int_type, &P->Lat.Psi.GlobalNo[PsiMaxNoDouble], critical);
    1725     if (!ParseForParameter(P->Call.out[ReadOut],file,"AddPsis", 0, 1, 1, int_type, &P->Lat.Psi.GlobalNo[PsiMaxAdd], optional))
     1750        ParseForParameter(P->Call.out[ReadOut],file,"MaxPsiDouble", 0, 1, 1, int_type, &P->Lat.Psi.GlobalNo[PsiMaxNoDouble], 1, critical);
     1751    if (!ParseForParameter(P->Call.out[ReadOut],file,"AddPsis", 0, 1, 1, int_type, &P->Lat.Psi.GlobalNo[PsiMaxAdd], 1, optional))
    17261752      P->Lat.Psi.GlobalNo[PsiMaxAdd] = 0;
    17271753    if (P->Lat.Psi.GlobalNo[PsiMaxAdd] != 0)
     
    17351761  case UseSpinUpDown:
    17361762    if (P->Par.proc[PEPsi] % 2) Error(SomeError,"UseSpinUpDown & P->Par.proc[PEGamma] % 2");
    1737     ParseForParameter(P->Call.out[ReadOut],file,"PsiMaxNoUp", 0, 1, 1, int_type, &P->Lat.Psi.GlobalNo[PsiMaxNoUp], critical);
    1738     ParseForParameter(P->Call.out[ReadOut],file,"PsiMaxNoDown", 0, 1, 1, int_type, &P->Lat.Psi.GlobalNo[PsiMaxNoDown], critical);
    1739     if (!ParseForParameter(P->Call.out[ReadOut],file,"AddPsis", 0, 1, 1, int_type, &P->Lat.Psi.GlobalNo[PsiMaxAdd], optional))
     1763    ParseForParameter(P->Call.out[ReadOut],file,"PsiMaxNoUp", 0, 1, 1, int_type, &P->Lat.Psi.GlobalNo[PsiMaxNoUp], 1, critical);
     1764    ParseForParameter(P->Call.out[ReadOut],file,"PsiMaxNoDown", 0, 1, 1, int_type, &P->Lat.Psi.GlobalNo[PsiMaxNoDown], 1, critical);
     1765    if (!ParseForParameter(P->Call.out[ReadOut],file,"AddPsis", 0, 1, 1, int_type, &P->Lat.Psi.GlobalNo[PsiMaxAdd], 1, optional))
    17401766      P->Lat.Psi.GlobalNo[PsiMaxAdd] = 0;
    17411767    if (P->Lat.Psi.GlobalNo[PsiMaxAdd] != 0)
Note: See TracChangeset for help on using the changeset viewer.