Changeset d6f7f3 for pcp/src


Ignore:
Timestamp:
May 24, 2008, 12:47:21 PM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
ccd028
Parents:
cd028d
Message:

CallOptions#ReadSrcFile is now enumerated ParseSrcDensities

This is done to distinguish between when only Occ are parsed (i.e. when StructOpt has been done before and now we do perturbed run), all or we pare and minimise subsequently.

Location:
pcp/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • pcp/src/data.h

    rcd028d rd6f7f3  
    5353               OutAllP      //!< not used
    5454             };
     55
     56//! enumerating whether to parse source coefficients from file
     57enum ParseSrcDensities { DoNotParse,
     58                         DoReadAllSrcDensities,
     59                         DoReadOccupiedSrcDensities,
     60                         DoReadAndMinimise
     61};
     62             
    5563//! enumerating usage status
    5664enum UseType { NotInUse,  //!< is not in use
     
    222230  unsigned int alarm;           //!< set alarm after alarm seconds
    223231  int proc[PROCDIM];                //!< process per gamma point, process per wave fct
    224   int ReadSrcFiles;                         //!< 0 - don't, 1 - read old source file containing previous calculations
     232  enum ParseSrcDensities ReadSrcFiles;  //!< whether to parse source coefficients from file or use minimisation
    225233  int WriteSrcFiles;                //!< 0 - don't, 1 - write source file on exit with so far made calculations
    226234  int AddNFactor;                             //!< ugly hack to fix read srcpsi
  • pcp/src/init.c

    rcd028d rd6f7f3  
    19841984  InitPsis(P);
    19851985  InitDensity(P);
    1986   if (P->Call.ReadSrcFiles) {
     1986  if (P->Call.ReadSrcFiles != DoNotParse) {
    19871987    if (ReadSrcIons(P)) {
    19881988      if (P->Call.out[NormalOut]) fprintf(stderr,"(%i) Ionic structure read successfully.\n", P->Par.me);
  • pcp/src/opt.c

    rcd028d rd6f7f3  
    5959  Call->proc[PEPsi] = 0;
    6060  Call->proc[PEGamma] = 0;
    61   Call->ReadSrcFiles = 0;
     61  Call->ReadSrcFiles = DoNotParse;
    6262  Call->WriteSrcFiles = 0;
    6363  Call->AddNFactor = 1;
  • pcp/src/output.c

    rcd028d rd6f7f3  
    626626    // and optional items ...
    627627    if (ParseForParameter(0,SrcPsiDoc,"Epsilon",0,2,1,row_double,&Eps[0],1,optional))
    628       if ((P->Call.ReadSrcFiles == 1) && ((Eps[1] < R->RelEpsKineticEnergy) || (Eps[0] < R->RelEpsTotalEnergy))) {
     628      if (((P->Call.ReadSrcFiles == DoReadAllSrcDensities) || (P->Call.ReadSrcFiles == DoReadOccupiedSrcDensities)) && ((Eps[1] < R->RelEpsKineticEnergy) || (Eps[0] < R->RelEpsTotalEnergy))) {
    629629        //fprintf(stderr,"(%i) Eps %lg %lg\tRelEps %lg %lg\n", P->Par.me, Eps[0], Eps[1], R->RelEpsTotalEnergy, R->RelEpsKineticEnergy);
    630630        fprintf(stderr,"(%i) NOTE: Doing minimization after source file parsing due to smaller specified epsilon stop conditions.\n",P->Par.me);
    631         P->Call.ReadSrcFiles = 2; // do minimisation even after loading
     631        P->Call.ReadSrcFiles = DoReadAndMinimise; // do minimisation even after loading
    632632      }
    633633    if (readnr != 7) { // check number of items read
  • pcp/src/perturbed.c

    rcd028d rd6f7f3  
    121121
    122122    if(P->Call.out[MinOut]) fprintf(stderr, "(%i) Re-initializing perturbed psi array for type %s ", P->Par.me, R->MinimisationName[type]);
    123     if (P->Call.ReadSrcFiles && (flag = ReadSrcPsiDensity(P,type,1, R->LevS->LevelNo))) {// in flag store whether stored Psis are readible or not
     123    if ((P->Call.ReadSrcFiles == DoReadAllSrcDensities) && (flag = ReadSrcPsiDensity(P,type,1, R->LevS->LevelNo))) {// in flag store whether stored Psis are readible or not
    124124      SpeedMeasure(P, InitSimTime, StartTimeDo); 
    125125      if(P->Call.out[MinOut]) fprintf(stderr,"from source file of recent calculation\n");
     
    136136      SpeedMeasure(P, InitSimTime, StopTimeDo); 
    137137    }
    138     if ((P->Call.ReadSrcFiles != 1) || (!flag)) {  // read and don't minimise only if SrcPsi were parsable!
     138    if ((P->Call.ReadSrcFiles != DoReadAllSrcDensities) || (!flag)) {  // read and don't minimise only if SrcPsi were parsable!
    139139      SpeedMeasure(P, InitSimTime, StartTimeDo); 
    140140      ResetGramSchTagType(P, Psi, type, NotOrthogonal); // perturbed now shall be orthonormalized
    141       if ((P->Call.ReadSrcFiles != 2) || (!flag)) {
     141      if ((P->Call.ReadSrcFiles != DoReadAndMinimise) || (!flag)) {
    142142        if (R->LevSNo == Lat->MaxLevel-1) { // is it the starting level? (see InitRunLevel())
    143143          if(P->Call.out[MinOut]) fprintf(stderr, "randomly.\n");
     
    41734173    UpdateActualPsiNo(P, type); // step on to next perturbed one
    41744174    fprintf(stderr, "(%i) Re-initializing perturbed psi array for type %s ", P->Par.me, R->MinimisationName[type]);
    4175     if (P->Call.ReadSrcFiles && ReadSrcPsiDensity(P,type,1, R->LevSNo)) {
     4175    if ((P->Call.ReadSrcFiles == DoReadAllSrcDensities) && ReadSrcPsiDensity(P,type,1, R->LevSNo)) {
    41764176      SpeedMeasure(P, InitSimTime, StartTimeDo); 
    41774177      fprintf(stderr,"from source file of recent calculation\n");
     
    41884188      SpeedMeasure(P, InitSimTime, StopTimeDo); 
    41894189    }
    4190     if (P->Call.ReadSrcFiles != 1) {
     4190    if (P->Call.ReadSrcFiles != DoReadAllSrcDensities) {
    41914191      SpeedMeasure(P, InitSimTime, StartTimeDo); 
    41924192      ResetGramSchTagType(P, Psi, type, NotOrthogonal); // perturbed now shall be orthonormalized
    4193       if (P->Call.ReadSrcFiles != 2) {
     4193      if (P->Call.ReadSrcFiles != DoReadAndMinimise) {
    41944194        if (R->LevSNo == Lat->MaxLevel-1) { // is it the starting level? (see InitRunLevel())
    41954195          fprintf(stderr, "randomly.\n");
  • pcp/src/run.c

    rcd028d rd6f7f3  
    745745  ResetBrent(P,Psi);
    746746  *Stop = 0;
    747   if (P->Call.ReadSrcFiles) {
     747  if (P->Call.ReadSrcFiles != DoNotParse) {
    748748    if (!ReadSrcPsiDensity(P,Occupied,1, R->LevSNo)) {  // if file for level exists and desired, read from file
    749       P->Call.ReadSrcFiles = 0; // -r was bogus, remove it, have to start anew
     749      P->Call.ReadSrcFiles = DoNotParse; // -r was bogus, remove it, have to start anew
    750750      if(P->Call.out[MinOut]) fprintf(stderr,"(%i) Re-initializing, files are missing/corrupted...\n", P->Par.me);
    751751      InitPsisValue(P, Psi->TypeStartIndex[Occupied], Psi->TypeStartIndex[Occupied+1]);  // initialize perturbed array for this run
     
    776776    EnergyOutput(P,0);
    777777  }
    778   if (P->Call.ReadSrcFiles != 1) {  // otherwise minimise oneself
     778  if ((P->Call.ReadSrcFiles != DoReadAllSrcDensities) && (P->Call.ReadSrcFiles != DoReadOccupiedSrcDensities)) {  // otherwise minimise oneself
    779779    if(P->Call.out[LeaderOut]) fprintf(stderr,"(%i)Beginning minimisation of type %s ...\n", P->Par.me, R->MinimisationName[Occupied]);
    780780    while (*Stop != 1) {  // loop testing condition over all Psis
     
    967967  R->OldActualLocalPsiNo = R->ActualLocalPsiNo; // reset, otherwise OldActualLocalPsiNo still points to occupied wave function
    968968  UpdateGramSchOldActualPsiNo(P,Psi);
    969   if (P->Call.ReadSrcFiles && ReadSrcPsiDensity(P,UnOccupied,1, R->LevSNo)) {
     969  if ((P->Call.ReadSrcFiles == DoReadAllSrcDensities) && ReadSrcPsiDensity(P,UnOccupied,1, R->LevSNo)) {
    970970    SpeedMeasure(P, InitSimTime, StartTimeDo); 
    971971    if(P->Call.out[MinOut]) fprintf(stderr, "(%i) Re-initializing %s psi array from source file of recent calculation\n", P->Par.me, R->MinimisationName[R->CurrentMin]);
    972972    ReadSrcPsiDensity(P, UnOccupied, 0, R->LevSNo);
    973     if (P->Call.ReadSrcFiles != 2) {
     973    if (P->Call.ReadSrcFiles < DoReadAndMinimise) {
    974974      ResetGramSchTagType(P, Psi, UnOccupied, IsOrthonormal); // loaded values are orthonormal
    975975      SpeedMeasure(P, DensityTime, StartTimeDo);
     
    987987    SpeedMeasure(P, InitSimTime, StopTimeDo); 
    988988  }
    989   if (P->Call.ReadSrcFiles != 1) {
     989  if (P->Call.ReadSrcFiles != DoReadAllSrcDensities) {
    990990    SpeedMeasure(P, InitSimTime, StartTimeDo); 
    991991    ResetGramSchTagType(P, Psi, UnOccupied, NotOrthogonal);
     
    10861086      MinimiseOccupied(P, &Stop, &SuperStop);
    10871087      if (!I->StructOpt) {
    1088         if ((P->Call.ReadSrcFiles != 1) || (!ParseWannierFile(P))) { // only localize and store if they have just been minimised (hence don't come solely from file), otherwise read stored values from file (if possible)
     1088        if (((P->Call.ReadSrcFiles != DoReadAllSrcDensities) || (P->Call.ReadSrcFiles != DoReadOccupiedSrcDensities)) || (!ParseWannierFile(P))) { // only localize and store if they have just been minimised (hence don't come solely from file), otherwise read stored values from file (if possible)
    10891089          SpeedMeasure(P, WannierTime, StartTimeDo);
    10901090          ComputeMLWF(P);   // localization of orbitals
Note: See TracChangeset for help on using the changeset viewer.