Changeset 7b1cea for molecuilder


Ignore:
Timestamp:
Apr 29, 2008, 7:04:59 AM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
2456db
Parents:
36b128
Message:

configname is also stored in config structure, GetDefaultPath by config::configpath replaced

This stores fragment and affiliated files in same dir as the config, regardless of therein contained paths and is safer and makes the tests work.

Location:
molecuilder/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/config.cpp

    r36b128 r7b1cea  
    1717  pseudopotpath = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
    1818  configpath = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
     19  configname = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
    1920  strcpy(mainname,"pcp");
    2021  strcpy(defaultpath,"not specified");
     
    8889  Free((void **)&pseudopotpath, "config::~config: *pseudopotpath");
    8990  Free((void **)&configpath, "config::~config: *configpath");
     91  Free((void **)&configname, "config::~config: *configname");
    9092};
    9193
     
    406408 * \param *filename config file string
    407409 */
    408 void config::RetrieveConfigPath(char *filename)
     410void config::RetrieveConfigPathAndName(char *filename)
    409411{
     412  char *ptr = NULL;
    410413  int last = -1;
    411414  for(int i=0;i<255;i++) {
     
    417420  if (last == -1) { // no path in front, set to local directory.
    418421    strcpy(configpath, "./");
     422    ptr = filename;
    419423  } else {
    420424    strncpy(configpath, filename, last+1);
     425    ptr = &filename[last+1];
    421426    if (last < 254)
    422427      configpath[last+1]='\0';
    423428  }
    424   cout << "Found configpath: " << configpath << ", dir slash was found at " << last << "." << endl;
     429  strcpy(configname, ptr);
     430  cout << "Found configpath: " << configpath << ", dir slash was found at " << last << ", config name is " << configname << "." << endl;
    425431};
    426432
     
    438444    return;
    439445  }
    440   RetrieveConfigPath(filename);
     446  RetrieveConfigPathAndName(filename);
    441447  // ParseParameters
    442448 
     
    669675    return;
    670676  }
    671   RetrieveConfigPath(filename);
     677  RetrieveConfigPathAndName(filename);
    672678  // ParseParameters
    673679 
  • molecuilder/src/moleculelist.cpp

    r36b128 r7b1cea  
    319319  for(int i=0;i<NumberOfMolecules;i++) {
    320320    //if (TEList[i] != 0) {
    321       strcpy(PathBackup, configuration->GetDefaultPath());
     321      strcpy(PathBackup, configuration->configpath);
    322322
    323323      // scan all atoms in the current molecule for their fathers and write each vertex index to forces file
     
    349349      sprintf(FragmentName, "%s/%s%s.conf", PathBackup, prefix, FragmentNumber);
    350350      outputFragment.open(FragmentName, ios::out);
    351       strcpy(PathBackup, configuration->GetDefaultPath());
     351      strcpy(PathBackup, configuration->configpath);
    352352      sprintf(FragmentName, "%s/%s%s/", PathBackup, prefix, FragmentNumber);
    353353     
     
    383383    }
    384384
    385   strcpy(PathBackup, configuration->GetDefaultPath());
     385  strcpy(PathBackup, configuration->configpath);
    386386  // open file for the total energy factor
    387387  sprintf(TEFilename, "%s/%s%s", PathBackup, prefix, TEFACTORSFILE);
  • molecuilder/src/molecules.cpp

    r36b128 r7b1cea  
    20932093    status = false;
    20942094  }
    2095   status = status && CheckAdjacencyFileAgainstMolecule(out, configuration->GetDefaultPath(), ListOfAtoms);
     2095  status = status && CheckAdjacencyFileAgainstMolecule(out, configuration->configpath, ListOfAtoms);
    20962096  if (status) {  // NULL entries in ListOfAtoms contain NonMatches
    2097     status = status && ParseKeySetFile(out, configuration->GetDefaultPath(), ListOfAtoms, FragmentList, configuration->GetIsAngstroem());
     2097    status = status && ParseKeySetFile(out, configuration->configpath, ListOfAtoms, FragmentList, configuration->GetIsAngstroem());
    20982098  }
    20992099  Free((void **)&ListOfAtoms, "molecule::FragmentMolecule - **ListOfAtoms");
     
    21022102  if (!status) {
    21032103    // === store Adjacency file ===
    2104     StoreAdjacencyToFile(out, configuration->GetDefaultPath());
     2104    StoreAdjacencyToFile(out, configuration->configpath);
    21052105
    21062106    // === first perform a DFS analysis to gather info on cyclic structure and a list of disconnected subgraphs ===
  • molecuilder/src/molecules.hpp

    r36b128 r7b1cea  
    613613    int ProcPEPsi;
    614614    char *configpath;
     615    char *configname;
    615616   
    616617    private:
     
    678679  void Load(char *filename, periodentafel *periode, molecule *mol);
    679680  void LoadOld(char *filename, periodentafel *periode, molecule *mol);
    680   void RetrieveConfigPath(char *filename);
     681  void RetrieveConfigPathAndName(char *filename);
    681682  bool Save(ofstream *file, periodentafel *periode, molecule *mol) const;
    682683  void Edit(molecule *mol);
Note: See TracChangeset for help on using the changeset viewer.