Changeset 961b75 for pcp/src/init.c
- Timestamp:
- Apr 21, 2008, 2:19:24 PM (18 years ago)
- 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)
- File:
-
- 1 edited
-
pcp/src/init.c (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pcp/src/init.c
re00f47 r961b75 1299 1299 * \param type Type of the Parameter to be read 1300 1300 * \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 1301 1302 * \param critical necessity of this keyword being specified (optional, critical) 1302 1303 * \return 1 - found, 0 - not found 1303 1304 * \sa ReadMainParameterFile Calling routine 1304 1305 */ 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) {1306 int 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) { 1306 1307 int i,j; // loop variables 1307 1308 int me, length, maxlength = -1; 1308 1309 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 1310 1316 dummy1 = free_dummy = (char *) Malloc(256 * sizeof(char),"ParseForParameter: MemAlloc for dummy1 failed"); 1311 1317 MPI_Comm_rank(MPI_COMM_WORLD, &me); 1312 1318 1313 1319 //fprintf(stderr,"(%i) Parsing for %s\n",me,name); 1314 1315 1320 int line = 0; // marks line where parameter was found 1316 1321 int found = (type >= grid) ? 0 : (-yth + 1); // marks if yth parameter name was found 1317 while((found != 1)) {1322 while((found != repetition)) { 1318 1323 dummy1 = dummy = free_dummy; 1319 1324 do { … … 1348 1353 if (name != NULL) { 1349 1354 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 space1352 while ((dummy != NULL) && ((*dummy == '\t') || (*dummy == ' '))) // skip some more tabs and spaces if necessary1353 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; 1354 1359 } 1355 1360 if (dummy == NULL) { … … 1359 1364 //Error(FileOpenParams, NULL); 1360 1365 } 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)); 1362 1367 } 1363 1368 } else dummy = dummy1; 1364 1369 // ... 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)))) { 1366 1371 found++; // found the parameter! 1367 1372 //fprintf(stderr,"(%i) found %s at line %i\n",me, name, line); 1368 1373 1369 if (found == 1) {1374 if (found == repetition) { 1370 1375 for (i=0;i<xth;i++) { // i = rows 1371 1376 if (type >= grid) { … … 1413 1418 // otherwise we must skip all interjacent tabs and spaces and find next value 1414 1419 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++; 1420 1428 } 1421 1429 /* while ((dummy != NULL) && ((*dummy == '\t') || (*dummy == ' '))) // skip some more tabs and spaces if necessary 1422 1430 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 ... 1424 1434 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 } 1429 1446 //Error(FileOpenParams, NULL); 1430 1447 } … … 1482 1499 } 1483 1500 if ((type >= row_int) && (verbose)) fprintf(stderr,"\n"); 1501 if (!sequential) fseek(file, file_position, SEEK_SET); // rewind to start position 1484 1502 Free(free_dummy, "ParseForParameter: free_dummy"); 1485 if (!sequential) fseek(file, file_position, SEEK_SET); // rewind to start position1486 1503 //fprintf(stderr, "(%i) End of Parsing\n\n",me); 1487 1504 … … 1503 1520 FILE *file; 1504 1521 int i, di, me; 1505 double BField[NDIM_NDIM];1522 //double BField[NDIM]; 1506 1523 1507 1524 MPI_Comm_rank(MPI_COMM_WORLD, &me); … … 1516 1533 1517 1534 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); 1519 1536 //debug(P,"mainname"); 1520 1537 CreateMainname(P, filename); 1521 1538 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); 1523 1540 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); 1527 1544 if (P->Call.proc[PEPsi]) { /* Kommandozeilenoption */ 1528 1545 P->Par.proc[PEPsi] = P->Call.proc[PEPsi]; … … 1532 1549 Run 1533 1550 */ 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)) 1535 1552 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)) 1537 1554 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)) 1539 1556 R->Lambda = 1.; 1540 1557 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)) { 1542 1559 F->DoOutOrbitals = 0; 1543 1560 } else { … … 1545 1562 if (F->DoOutOrbitals > 1) F->DoOutOrbitals = 1; 1546 1563 } 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); 1548 1565 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)) 1551 1568 R->VectorPlane = -1; 1552 1569 if (R->VectorPlane < -1 || R->VectorPlane > 2) { … … 1554 1571 R->VectorPlane = -1; 1555 1572 } 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)) 1557 1574 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); 1559 1576 if (F->DoOutMes < 0) F->DoOutMes = 0; 1560 1577 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)) 1562 1579 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; 1563 1582 if (F->DoOutCurr < 0) F->DoOutCurr = 0; 1564 1583 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); 1566 1585 if (R->UseAddGramSch < 0) R->UseAddGramSch = 0; 1567 1586 if (R->UseAddGramSch > 2) R->UseAddGramSch = 2; 1568 1587 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)) { 1570 1589 R->CommonWannier = 0; 1571 1590 } else { … … 1573 1592 if (R->CommonWannier > 4) R->CommonWannier = 4; 1574 1593 } 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)) { 1576 1595 P->Lat.SawtoothStart = 0.01; 1577 1596 } else { … … 1579 1598 if (P->Lat.SawtoothStart > 1.) P->Lat.SawtoothStart = 1.; 1580 1599 } 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)) { 1582 1601 R->DoBrent = 0; 1583 1602 } else { … … 1587 1606 1588 1607 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 } 1590 1617 // 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)) 1594 1621 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)) 1596 1623 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)) 1598 1625 R->TargetTemp = 0; 1599 if (!ParseForParameter(P->Call.out[ReadOut],file,"ScaleTempStep", 0, 1, 1, int_type, &R->ScaleTempStep, optional))1600 R->ScaleTempStep = 25;1601 1626 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)) 1603 1628 R->EpsWannier = 1e-8; 1604 1629 … … 1607 1632 //if (R->MaxOuterStep <= 0) R->MaxOuterStep = 1; 1608 1633 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); 1611 1636 if (R->MaxPsiStep <= 0) R->MaxPsiStep = 3; 1612 1637 if(P->Call.out[NormalOut]) fprintf(stderr,"(%i)MaxPsiStep = %i\n",me,R->MaxPsiStep); 1613 1638 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); 1619 1644 if (R->MaxMinStep <= 0) R->MaxMinStep = R->MaxPsiStep; 1620 1645 if (R->MaxMinStopStep < 1) R->MaxMinStopStep = 1; … … 1622 1647 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); 1623 1648 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); 1629 1654 if (R->MaxInitMinStep <= 0) R->MaxInitMinStep = R->MaxPsiStep; 1630 1655 if (R->InitMaxMinStopStep < 1) R->InitMaxMinStopStep = 1; … … 1633 1658 1634 1659 // 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); 1637 1662 if (!R->DoPerturbation) { 1638 if (!ParseForParameter(P->Call.out[ReadOut],file, "BField", 0, 1, 3, grid, & BField, optional)) { // old parameter for perturbation with field direction1663 if (!ParseForParameter(P->Call.out[ReadOut],file, "BField", 0, 1, 3, grid, &R->BField, 1, optional)) { // old parameter for perturbation with field direction 1639 1664 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); 1642 1667 F->DoOutCurr = 0; 1668 F->DoOutNICS = 0; 1643 1669 R->DoPerturbation = 0; 1644 1670 } … … 1653 1679 RMatReci3(P->Lat.InvBasis, P->Lat.RealBasis); 1654 1680 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)) 1656 1682 R->DoFullCurrent = 0; 1657 1683 if (R->DoFullCurrent < 0) R->DoFullCurrent = 0; … … 1662 1688 } 1663 1689 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); 1665 1691 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); 1668 1694 if (P->Lat.Lev0Factor < 2) { 1669 1695 if(P->Call.out[ReadOut]) fprintf(stderr,"(%i) Set Lev0Factor to 2!\n",me); 1670 1696 P->Lat.Lev0Factor = 2; 1671 1697 } 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); 1673 1699 if (di >= 0 && di < 2) { 1674 1700 P->Lat.RT.Use = (enum UseRiemannTensor)di; … … 1691 1717 P->Lat.MaxLevel = 3; 1692 1718 } 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); 1694 1720 if(P->Call.out[ReadOut]) fprintf(stderr,"(%i)!RiemannLevel = %i\n",me,P->Lat.RT.RiemannLevel); 1695 1721 if (P->Lat.RT.RiemannLevel < 2) { … … 1701 1727 P->Lat.RT.RiemannLevel = P->Lat.MaxLevel-1; 1702 1728 } 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); 1704 1730 if(P->Call.out[ReadOut]) fprintf(stderr,"(%i)!LevRFactor = %i\n",me,P->Lat.LevRFactor); 1705 1731 if (P->Lat.LevRFactor < 2) { … … 1711 1737 break; 1712 1738 } 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); 1714 1740 if (di >= 0 && di < 2) { 1715 1741 P->Lat.Psi.Use = (enum UseSpinType)di; … … 1722 1748 switch (P->Lat.Psi.Use) { 1723 1749 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)) 1726 1752 P->Lat.Psi.GlobalNo[PsiMaxAdd] = 0; 1727 1753 if (P->Lat.Psi.GlobalNo[PsiMaxAdd] != 0) … … 1735 1761 case UseSpinUpDown: 1736 1762 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)) 1740 1766 P->Lat.Psi.GlobalNo[PsiMaxAdd] = 0; 1741 1767 if (P->Lat.Psi.GlobalNo[PsiMaxAdd] != 0)
Note:
See TracChangeset
for help on using the changeset viewer.
