Changes in / [f03705:001f8a]


Ignore:
Files:
15 added
8 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/Makefile.am

    rf03705 r001f8a  
    9696  MoleculeAction/FillVoidWithMoleculeAction.cpp \
    9797  MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp \
     98  MoleculeAction/LoadAction.cpp \
    9899  MoleculeAction/RotateAroundSelfByAngleAction.cpp \
    99100  MoleculeAction/RotateToPrincipalAxisSystemAction.cpp \
     101  MoleculeAction/SaveAction.cpp \
    100102  MoleculeAction/SaveAdjacencyAction.cpp \
    101103  MoleculeAction/SaveBondsAction.cpp \
     
    110112  MoleculeAction/FillVoidWithMoleculeAction.hpp \
    111113  MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp \
     114  MoleculeAction/LoadAction.cpp \
    112115  MoleculeAction/RotateAroundSelfByAngleAction.hpp \
    113116  MoleculeAction/RotateToPrincipalAxisSystemAction.hpp \
     117  MoleculeAction/SaveAction.hpp \
    114118  MoleculeAction/SaveAdjacencyAction.hpp \
    115119  MoleculeAction/SaveBondsAction.hpp \
     
    118122  MoleculeAction/VerletIntegrationAction.hpp
    119123                 
    120 PARSERACTIONSOURCE = \
    121   ParserAction/LoadXyzAction.cpp \
    122   ParserAction/SaveXyzAction.cpp       
    123 PARSERACTIONHEADER = \
    124   ParserAction/LoadXyzAction.hpp \
    125   ParserAction/SaveXyzAction.hpp
    126 
    127124SELECTIONACTIONSOURCE = \
    128125        SelectionAction/AllAtomsAction.cpp \
  • src/Actions/WorldAction/InputAction.cpp

    rf03705 r001f8a  
    2323#include "molecule.hpp"
    2424#include "Parser/FormatParserStorage.hpp"
    25 #include "Parser/PcpParser.hpp"
    2625#include "Helpers/Verbose.hpp"
    2726#include "World.hpp"
  • src/Actions/WorldAction/ScaleBoxAction.def

    rf03705 r001f8a  
    3232// finally the information stored in the ActionTrait specialization
    3333#define DESCRIPTION "scale box and atomic positions inside"
    34 #define SHORTFORM "s"
     34#undef SHORTFORM
  • src/Parser/FormatParserStorage.cpp

    rf03705 r001f8a  
    243243}
    244244
     245
     246/** Stores world in an ostream depending on its suffix
     247 * \param &output output stream
     248 * \param suffix
     249 * \return true - storing ok, false - suffix unknown
     250 */
     251bool FormatParserStorage::put(std::ostream &output, std::string suffix)
     252{
     253  if (suffix == ParserSuffixes[mpqc]) {
     254    getMpqc().save(&output);
     255  } else if (suffix == ParserSuffixes[pcp]) {
     256    getPcp().save(&output);
     257  } else if (suffix == ParserSuffixes[pdb]) {
     258    getPdb().save(&output);
     259  } else if (suffix == ParserSuffixes[tremolo]) {
     260    getTremolo().save(&output);
     261  } else if (suffix == ParserSuffixes[xyz]) {
     262    getXyz().save(&output);
     263  } else {
     264    DoeLog(1) && (eLog() << Verbose(1) << "Unknown suffix " << suffix << " to for FormatParserStorage::put()." << endl);
     265    return false;
     266  }
     267  return true;
     268}
     269
    245270/** Returns reference to the output MpqcParser, adds if not present.
    246271 * \return reference to the output MpqcParser
  • src/Parser/FormatParserStorage.hpp

    rf03705 r001f8a  
    4646
    4747  bool get(std::istream &input, std::string suffix);
     48  bool put(std::ostream &output, std::string suffix);
    4849  MpqcParser &getMpqc();
    4950  PcpParser &getPcp();
  • src/Parser/Makefile.am

    rf03705 r001f8a  
    1414  MpqcParser.cpp \
    1515  PcpParser.cpp \
     16  PdbAtomInfoContainer.cpp \
    1617  PdbParser.cpp \
    1718  TremoloParser.cpp \
     
    2425  MpqcParser.hpp \
    2526  PcpParser.hpp \
     27  PdbAtomInfoContainer.hpp \
     28  PdbKey.hpp \
    2629  PdbParser.hpp \
    2730  TremoloParser.hpp \
  • src/Parser/PdbParser.cpp

    rf03705 r001f8a  
    2222#include "Helpers/Assert.hpp"
    2323#include "Helpers/Log.hpp"
     24#include "Helpers/toString.hpp"
    2425#include "Helpers/Verbose.hpp"
    25 #include "PdbParser.hpp"
    2626#include "World.hpp"
    2727#include "atom.hpp"
     
    3131#include "periodentafel.hpp"
    3232#include "Descriptors/AtomIdDescriptor.hpp"
     33#include "Parser/PdbParser.hpp"
    3334
    3435#include <map>
     
    4445 */
    4546PdbParser::PdbParser() {
    46   knownKeys[" "] = PdbKey::noKey; // with this we can detect invalid keys
    47   knownKeys["x"] = PdbKey::x;
    48   knownKeys["Id"] = PdbKey::Id;
    49   knownKeys["Type"] = PdbKey::Type;
    50   knownKeys["extType"] = PdbKey::extType;
    51   knownKeys["name"] = PdbKey::name;
    52   knownKeys["resName"] = PdbKey::resName;
    53   knownKeys["chainID"] = PdbKey::chainID;
    54   knownKeys["resSeq"] = PdbKey::resSeq;
    55   knownKeys["occupancy"] = PdbKey::occupancy;
    56   knownKeys["tempFactor"] = PdbKey::tempFactor;
    57   knownKeys["segID"] = PdbKey::segID;
    58   knownKeys["charge"] = PdbKey::charge;
     47  knownTokens["ATOM"] = PdbKey::Atom;
     48  knownTokens["TER"] = PdbKey::Filler;
     49  knownTokens["END"] = PdbKey::EndOfFile;
     50  knownTokens["CONECT"] = PdbKey::Connect;
     51  knownTokens["REMARK"] = PdbKey::Remark;
     52  knownTokens[""] = PdbKey::EndOfFile;
    5953}
    6054
     
    6559  additionalAtomData.clear();
    6660  atomIdMap.clear();
    67   knownKeys.clear();
    68 }
    69 
    70 /**
    71  * Loads atoms from a tremolo-formatted file.
    72  *
    73  * \param tremolo file
     61}
     62
     63
     64/** Parses the initial word of the given \a line and returns the token type.
     65 *
     66 * @param line line to scan
     67 * @return token type
     68 */
     69enum PdbKey::KnownTokens PdbParser::getToken(string &line)
     70{
     71  // look for first space
     72  const size_t space_location = line.find(' ');
     73  const size_t tab_location = line.find('\t');
     74  size_t location = space_location < tab_location ? space_location : tab_location;
     75  string token;
     76  if (location != string::npos) {
     77    //DoLog(1) && (Log() << Verbose(1) << "Found space at position " << space_location << std::endl);
     78    token = line.substr(0,space_location);
     79  } else {
     80    token = line;
     81  }
     82
     83  //DoLog(1) && (Log() << Verbose(1) << "Token is " << token << std::endl);
     84  if (knownTokens.count(token) == 0)
     85    return PdbKey::NoToken;
     86  else
     87    return knownTokens[token];
     88
     89  return PdbKey::NoToken;
     90}
     91
     92/**
     93 * Loads atoms from a PDB-formatted file.
     94 *
     95 * \param PDB file
    7496 */
    7597void PdbParser::load(istream* file) {
    76   // TODO: PdbParser::load implementation
    77   ASSERT(false, "Not implemented yet");
    78 //  string line;
    79 //  string::size_type location;
    80 //
    81 //  usedFields.clear();
    82 //  while (file->good()) {
    83 //    std::getline(*file, line, '\n');
    84 //    if (usedFields.empty()) {
    85 //      location = line.find("ATOMDATA", 0);
    86 //      if (location != string::npos) {
    87 //       parseAtomDataKeysLine(line, location + 8);
    88 //      }
    89 //    }
    90 //    if (line.length() > 0 && line.at(0) != '#') {
    91 //      readAtomDataLine(line);
    92 //    }
    93 //  }
    94 //
    95 //  processNeighborInformation();
    96 //  adaptImprData();
    97 //  adaptTorsion();
    98 }
    99 
    100 /**
    101  * Saves the World's current state into as a tremolo file.
     98  string line;
     99  size_t linecount  = 0;
     100  enum PdbKey::KnownTokens token;
     101
     102  molecule *newmol = World::getInstance().createMolecule();
     103  newmol->ActiveFlag = true;
     104  bool NotEndOfFile = true;
     105  // TODO: Remove the insertion into molecule when saving does not depend on them anymore. Also, remove molecule.hpp include
     106  World::getInstance().getMolecules()->insert(newmol);
     107  while (NotEndOfFile) {
     108    std::getline(*file, line, '\n');
     109    // extract first token
     110    token = getToken(line);
     111    //DoLog(1) && (Log() << Verbose(1) << " Recognized token of type : " << token << std::endl);
     112    switch (token) {
     113      case PdbKey::Atom:
     114        readAtomDataLine(line, newmol);
     115        break;
     116      case PdbKey::Remark:
     117        break;
     118      case PdbKey::Connect:
     119        readNeighbors(line);
     120        break;
     121      case PdbKey::Filler:
     122        break;
     123      case PdbKey::EndOfFile:
     124        NotEndOfFile = false;
     125        break;
     126      default:
     127        // TODO: put a throw here
     128        DoeLog(2) && (eLog() << Verbose(2) << "Unknown token: '" << line << "'" << std::endl);
     129        //ASSERT(0, "PdbParser::load() - Unknown token in line "+toString(linecount)+": "+line+".");
     130        break;
     131    }
     132    NotEndOfFile = NotEndOfFile && (file->good());
     133    linecount++;
     134  }
     135}
     136
     137/**
     138 * Saves the World's current state into as a PDB file.
    102139 *
    103140 * \param file where to save the state
     
    120157  }
    121158
     159  // we distribute new atom numbers, hence clear map beforehand
     160  atomIdMap.clear();
    122161  {
    123162    vector<atom *> AtomList = World::getInstance().getAllAtoms();
     
    155194
    156195/**
    157  * Writes one line of tremolo-formatted data to the provided stream.
     196 * Writes one line of PDB-formatted data to the provided stream.
    158197 *
    159198 * \param stream where to write the line to
     
    198237  if (!currentAtom->ListOfBonds.empty()) {
    199238    *file << "CONECT";
    200     *file << setw(5) << getAtomId(currentAtom->getId());
     239    *file << setw(5) << getSerial(currentAtom->getId());
    201240    int MaxNo = 0;
    202241    for(BondList::iterator currentBond = currentAtom->ListOfBonds.begin(); currentBond != currentAtom->ListOfBonds.end(); ++currentBond) {
    203242      if (MaxNo < MaxnumberOfNeighbors) {
    204         *file << setw(5) << getAtomId((*currentBond)->GetOtherAtom(currentAtom)->getId());
     243        *file << setw(5) << getSerial((*currentBond)->GetOtherAtom(currentAtom)->getId());
    205244      }
    206245      MaxNo++;
     
    215254 * \return value
    216255 */
    217 int PdbParser::getAtomId(int atomid) const
     256size_t PdbParser::getSerial(const size_t atomid) const
     257{
     258  ConvertTo<size_t> toSize_t;
     259  ASSERT(additionalAtomData.find(atomid) != additionalAtomData.end(),
     260      "PdbParser::getSerial: atomid "+toString(atomid)+" not present in Map.");
     261  const PdbAtomInfoContainer &atomInfo = additionalAtomData.at(atomid);
     262
     263  return toSize_t(atomInfo.get(PdbKey::serial));
     264}
     265
     266/** Retrieves a value from PdbParser::atomIdMap.
     267 * \param atomid key
     268 * \return value
     269 */
     270size_t PdbParser::getAtomId(const size_t atomid) const
    218271{
    219272  ASSERT(atomIdMap.find(atomid) != atomIdMap.end(), "PdbParser::getAtomId: atomid not present in Map.");
     
    226279 * \return true - key not present, false - value present
    227280 */
    228 void PdbParser::setAtomId(int localatomid, int atomid)
    229 {
    230   pair<std::map<int,int>::iterator, bool > inserter;
    231   inserter = atomIdMap.insert( pair<int, int>(localatomid, atomid) );
     281void PdbParser::setAtomId(const size_t localatomid, const size_t atomid)
     282{
     283  pair<std::map<size_t,size_t>::iterator, bool > inserter;
     284  inserter = atomIdMap.insert( make_pair(localatomid, atomid) );
    232285  ASSERT(inserter.second, "PdbParser::setAtomId: atomId already present in Map.");
    233286}
    234287
    235 /**
    236  * Reads one data line of a tremolo file and interprets it according to the keys
    237  * obtained from the ATOMDATA line.
     288/** Parse an ATOM line from a PDB file.
     289 *
     290 * Reads one data line of a pdstatus file and interprets it according to the
     291 * specifications of the PDB 3.2 format: http://www.wwpdb.org/docs.html
     292 *
     293 *  A new atom is created and filled with available information, non-
     294 *  standard information is placed in additionalAtomData at the atom's id.
    238295 *
    239296 * \param line to parse as an atom
    240  */
    241 void PdbParser::readAtomDataLine(string line) {
    242 //  vector<string>::iterator it;
    243 //  stringstream lineStream;
    244 //  atom* newAtom = World::getInstance().createAtom();
    245 //  PdbAtomInfoContainer *atomInfo = NULL;
    246 //  additionalAtomData[newAtom->getId()] = *(new PdbAtomInfoContainer);
    247 //  atomInfo = &additionalAtomData[newAtom->getId()];
    248 //  PdbKey::atomDataKey currentField;
    249 //  string word;
    250 //  int oldId;
    251 //  double tmp;
    252 //
    253 //  lineStream << line;
    254 //  for (it = usedFields.begin(); it < usedFields.end(); it++) {
    255 //    currentField = knownKeys[it->substr(0, it->find("="))];
    256 //    switch (currentField) {
    257 //      case PdbKey::x :
    258 //        // for the moment, assume there are always three dimensions
    259 //        for (int i=0;i<NDIM;i++) {
    260 //          lineStream >> tmp;
    261 //          newAtom->set(i, tmp);
    262 //        }
    263 //        break;
    264 //      case PdbKey::u :
    265 //        // for the moment, assume there are always three dimensions
    266 //        lineStream >> newAtom->AtomicVelocity[0];
    267 //        lineStream >> newAtom->AtomicVelocity[1];
    268 //        lineStream >> newAtom->AtomicVelocity[2];
    269 //        break;
    270 //      case PdbKey::Type :
    271 //        char type[3];
    272 //        lineStream >> type;
    273 //        newAtom->setType(World::getInstance().getPeriode()->FindElement(type));
    274 //        ASSERT(newAtom->getType(), "Type was not set for this atom");
    275 //        break;
    276 //      case PdbKey::Id :
    277 //        lineStream >> oldId;
    278 //        atomIdMap[oldId] = newAtom->getId();
    279 //        break;
    280 //      case PdbKey::neighbors :
    281 //        readNeighbors(&lineStream,
    282 //            atoi(it->substr(it->find("=") + 1, 1).c_str()), newAtom->getId());
    283 //        break;
    284 //      default :
    285 //        lineStream >> word;
    286 //        atomInfo->set(currentField, word);
    287 //        break;
    288 //    }
     297 * \param newmol molecule to add parsed atoms to
     298 */
     299void PdbParser::readAtomDataLine(std::string &line, molecule *newmol = NULL) {
     300  vector<string>::iterator it;
     301  stringstream lineStream;
     302  atom* newAtom = World::getInstance().createAtom();
     303  additionalAtomData[newAtom->getId()] = *(new PdbAtomInfoContainer);
     304  PdbAtomInfoContainer &atomInfo = additionalAtomData[newAtom->getId()];
     305  string word;
     306  ConvertTo<size_t> toSize_t;
     307  double tmp;
     308
     309  lineStream << line;
     310  atomInfo.set(PdbKey::serial, line.substr(6,5));
     311  std::pair< std::set<size_t>::const_iterator, bool> Inserter =
     312    SerialSet.insert(toSize_t(atomInfo.get(PdbKey::serial)));
     313  ASSERT(Inserter.second,
     314      "PdbParser::readAtomDataLine() - ATOM contains entry with serial "
     315      +atomInfo.get(PdbKey::serial)+" already present!");
     316  // assign hightest+1 instead, but then beware of CONECT entries! Another map needed!
     317//  if (!Inserter.second) {
     318//    const size_t id = (*SerialSet.rbegin())+1;
     319//    SerialSet.insert(id);
     320//    atomInfo.set(PdbKey::serial, toString(id));
     321//    DoeLog(2) && (eLog() << Verbose(2)
     322//        << "Serial " << atomInfo.get(PdbKey::serial) << " already present, "
     323//        << "assigning " << toString(id) << " instead." << std::endl);
    289324//  }
     325
     326  // check whether serial exists, if so, assign next available
     327
     328//  DoLog(2) && (Log() << Verbose(2) << "Split line:"
     329//      << line.substr(6,5) << "|"
     330//      << line.substr(12,4) << "|"
     331//      << line.substr(16,1) << "|"
     332//      << line.substr(17,3) << "|"
     333//      << line.substr(21,1) << "|"
     334//      << line.substr(22,4) << "|"
     335//      << line.substr(26,1) << "|"
     336//      << line.substr(30,8) << "|"
     337//      << line.substr(38,8) << "|"
     338//      << line.substr(46,8) << "|"
     339//      << line.substr(54,6) << "|"
     340//      << line.substr(60,6) << "|"
     341//      << line.substr(76,2) << "|"
     342//      << line.substr(78,2) << std::endl);
     343
     344  setAtomId(toSize_t(atomInfo.get(PdbKey::serial)), newAtom->getId());
     345  atomInfo.set(PdbKey::name, line.substr(12,4));
     346  atomInfo.set(PdbKey::altloc, line.substr(16,1));
     347  atomInfo.set(PdbKey::resName, line.substr(17,3));
     348  atomInfo.set(PdbKey::chainID, line.substr(21,1));
     349  atomInfo.set(PdbKey::resSeq, line.substr(22,4));
     350  atomInfo.set(PdbKey::iCode, line.substr(26,1));
     351  PdbAtomInfoContainer::ScanKey(tmp, line.substr(30,8));
     352  newAtom->set(0, tmp);
     353  PdbAtomInfoContainer::ScanKey(tmp, line.substr(38,8));
     354  newAtom->set(1, tmp);
     355  PdbAtomInfoContainer::ScanKey(tmp, line.substr(46,8));
     356  newAtom->set(2, tmp);
     357  atomInfo.set(PdbKey::occupancy, line.substr(54,6));
     358  atomInfo.set(PdbKey::tempFactor, line.substr(60,6));
     359  atomInfo.set(PdbKey::charge, line.substr(78,2));
     360  PdbAtomInfoContainer::ScanKey(word, line.substr(76,2));
     361  newAtom->setType(World::getInstance().getPeriode()->FindElement(word));
     362
     363  if (newmol != NULL)
     364    newmol->AddAtom(newAtom);
     365
     366//  printAtomInfo(newAtom);
     367}
     368
     369/** Prints all PDB-specific information known about an atom.
     370 *
     371 */
     372void PdbParser::printAtomInfo(const atom * const newAtom) const
     373{
     374  const PdbAtomInfoContainer &atomInfo = additionalAtomData.at(newAtom->getId()); // operator[] const does not exist
     375
     376  DoLog(1) && (Log() << Verbose(1) << "We know about atom " << newAtom->getId() << ":" << std::endl);
     377  DoLog(1) && (Log() << Verbose(1) << "\tserial is " << atomInfo.get(PdbKey::serial) << std::endl);
     378  DoLog(1) && (Log() << Verbose(1) << "\tname is " << atomInfo.get(PdbKey::name) << std::endl);
     379  DoLog(1) && (Log() << Verbose(1) << "\taltloc is " << atomInfo.get(PdbKey::altloc) << std::endl);
     380  DoLog(1) && (Log() << Verbose(1) << "\tresName is " << atomInfo.get(PdbKey::resName) << std::endl);
     381  DoLog(1) && (Log() << Verbose(1) << "\tchainID is " << atomInfo.get(PdbKey::chainID) << std::endl);
     382  DoLog(1) && (Log() << Verbose(1) << "\tresSeq is " << atomInfo.get(PdbKey::resSeq) << std::endl);
     383  DoLog(1) && (Log() << Verbose(1) << "\tiCode is " << atomInfo.get(PdbKey::iCode) << std::endl);
     384  DoLog(1) && (Log() << Verbose(1) << "\tx is " << newAtom->getPosition() << std::endl);
     385  DoLog(1) && (Log() << Verbose(1) << "\toccupancy is " << atomInfo.get(PdbKey::occupancy) << std::endl);
     386  DoLog(1) && (Log() << Verbose(1) << "\ttempFactor is " << atomInfo.get(PdbKey::tempFactor) << std::endl);
     387  DoLog(1) && (Log() << Verbose(1) << "\telement is '" << *(newAtom->getType()) << "'" << std::endl);
     388  DoLog(1) && (Log() << Verbose(1) << "\tcharge is " << atomInfo.get(PdbKey::charge) << std::endl);
    290389}
    291390
     
    293392 * Reads neighbor information for one atom from the input.
    294393 *
    295  * \param stream where to read the information from
    296  * \param number of neighbors to read
    297  * \param world id of the atom the information belongs to
    298  */
    299 void PdbParser::readNeighbors(stringstream* line, int numberOfNeighbors, int atomId) {
    300 //  int neighborId = 0;
    301 //  for (int i = 0; i < numberOfNeighbors; i++) {
    302 //    *line >> neighborId;
    303 //    // 0 is used to fill empty neighbor positions in the tremolo file.
    304 //    if (neighborId > 0) {
    305 //      additionalAtomData[atomId].neighbors.push_back(neighborId);
    306 //    }
    307 //  }
    308 }
    309 
    310 /**
    311  * Adds the collected neighbor information to the atoms in the world. The atoms
    312  * are found by their current ID and mapped to the corresponding atoms with the
    313  * Id found in the parsed file.
    314  */
    315 void PdbParser::processNeighborInformation() {
    316 //  if (!isUsedField("neighbors")) {
    317 //    return;
    318 //  }
    319 //
    320 //  for(map<int, PdbAtomInfoContainer>::iterator currentInfo = additionalAtomData.begin();
    321 //    currentInfo != additionalAtomData.end(); currentInfo++
    322 //  ) {
    323 //    for(vector<int>::iterator neighbor = currentInfo->second.neighbors.begin();
    324 //      neighbor != currentInfo->second.neighbors.end(); neighbor++
    325 //    ) {
    326 //      World::getInstance().getAtom(AtomById(currentInfo->first))
    327 //          ->addBond(World::getInstance().getAtom(AtomById(atomIdMap[*neighbor])));
    328 //    }
    329 //  }
     394 * \param line to parse as an atom
     395 */
     396void PdbParser::readNeighbors(std::string &line)
     397{
     398  const size_t length = line.length();
     399  std::list<size_t> ListOfNeighbors;
     400  ConvertTo<size_t> toSize_t;
     401
     402  // obtain neighbours
     403  // show split line for debugging
     404  string output;
     405  ASSERT(length >=16,
     406      "PdbParser::readNeighbors() - CONECT entry has not enough entries: "+line+"!");
     407//  output = "Split line:|";
     408//  output += line.substr(6,5) + "|";
     409  const size_t id = toSize_t(line.substr(6,5));
     410  for (size_t index = 11; index <= 26; index+=5) {
     411    if (index+5 <= length) {
     412//      output += line.substr(index,5) + "|";
     413      const size_t otherid = toSize_t(line.substr(index,5));
     414      ListOfNeighbors.push_back(otherid);
     415    } else  {
     416      break;
     417    }
     418  }
     419//  DoLog(2) && (Log() << Verbose(2) << output << std::endl);
     420
     421  // add neighbours
     422  atom *_atom = World::getInstance().getAtom(AtomById(getAtomId(id)));
     423  for (std::list<size_t>::const_iterator iter = ListOfNeighbors.begin();
     424      iter != ListOfNeighbors.end();
     425      ++iter) {
     426//    DoLog(1) && (Log() << Verbose(1) << "Adding Bond (" << getAtomId(id) << "," << getAtomId(*iter) << ")" << std::endl);
     427    atom * const _Otheratom = World::getInstance().getAtom(AtomById(getAtomId(*iter)));
     428    _atom->addBond(_Otheratom);
     429  }
    330430}
    331431
     
    339439 * \return input string with modified atom IDs
    340440 */
    341 string PdbParser::adaptIdDependentDataString(string data) {
     441//string PdbParser::adaptIdDependentDataString(string data) {
    342442//  // there might be no IDs
    343443//  if (data == "-") {
     
    358458//
    359459//  return result.str();
    360   return "";
    361 }
    362 
    363 
    364 PdbAtomInfoContainer::PdbAtomInfoContainer() :
    365   name("-"),
    366   resName("-"),
    367   chainID("0"),
    368   resSeq("0"),
    369   occupancy("0"),
    370   tempFactor("0"),
    371   segID("0"),
    372   charge("0")
    373 {}
    374 
    375 void PdbAtomInfoContainer::set(PdbKey::PdbDataKey key, string value) {
    376   switch (key) {
    377     case PdbKey::extType :
    378       extType = value;
    379       break;
    380     case PdbKey::name :
    381       name = value;
    382       break;
    383     case PdbKey::resName :
    384       resName = value;
    385       break;
    386     case PdbKey::chainID :
    387       chainID = value;
    388       break;
    389     case PdbKey::resSeq :
    390       resSeq = value;
    391       break;
    392     case PdbKey::occupancy :
    393       occupancy = value;
    394       break;
    395     case PdbKey::tempFactor :
    396       tempFactor = value;
    397       break;
    398     case PdbKey::segID :
    399       segID = value;
    400       break;
    401     case PdbKey::charge :
    402       charge = value;
    403       break;
    404     default :
    405       cout << "Unknown key: " << key << ", value: " << value << endl;
    406       break;
    407   }
    408 }
    409 
    410 string PdbAtomInfoContainer::get(PdbKey::PdbDataKey key) {
    411   switch (key) {
    412     case PdbKey::extType :
    413       return extType;
    414     case PdbKey::name :
    415       return name;
    416     case PdbKey::resName :
    417       return resName;
    418     case PdbKey::chainID :
    419       return chainID;
    420     case PdbKey::resSeq :
    421       return resSeq;
    422     case PdbKey::occupancy :
    423       return occupancy;
    424     case PdbKey::tempFactor :
    425       return tempFactor;
    426     case PdbKey::segID :
    427       return segID;
    428     case PdbKey::charge :
    429       return charge;
    430     default :
    431       cout << "Unknown key: " << key << endl;
    432       return "";
    433   }
    434 }
    435 
     460//  return "";
     461//}
     462
     463
     464bool PdbParser::operator==(const PdbParser& b) const
     465{
     466  bool status = true;
     467  World::AtomComposite atoms = World::getInstance().getAllAtoms();
     468  for (World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {
     469    if ((additionalAtomData.find((*iter)->getId()) != additionalAtomData.end())
     470        && (b.additionalAtomData.find((*iter)->getId()) != b.additionalAtomData.end())) {
     471      const PdbAtomInfoContainer &atomInfo = additionalAtomData.at((*iter)->getId());
     472      const PdbAtomInfoContainer &OtheratomInfo = b.additionalAtomData.at((*iter)->getId());
     473
     474      status = status && (atomInfo.get(PdbKey::serial) == OtheratomInfo.get(PdbKey::serial));
     475      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in serials!" << std::endl);
     476      status = status && (atomInfo.get(PdbKey::name) == OtheratomInfo.get(PdbKey::name));
     477      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in names!" << std::endl);
     478      status = status && (atomInfo.get(PdbKey::altloc) == OtheratomInfo.get(PdbKey::altloc));
     479      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in altlocs!" << std::endl);
     480      status = status && (atomInfo.get(PdbKey::resName) == OtheratomInfo.get(PdbKey::resName));
     481      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in resNames!" << std::endl);
     482      status = status && (atomInfo.get(PdbKey::chainID) == OtheratomInfo.get(PdbKey::chainID));
     483      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in chainIDs!" << std::endl);
     484      status = status && (atomInfo.get(PdbKey::resSeq) == OtheratomInfo.get(PdbKey::resSeq));
     485      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in resSeqs!" << std::endl);
     486      status = status && (atomInfo.get(PdbKey::iCode) == OtheratomInfo.get(PdbKey::iCode));
     487      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in iCodes!" << std::endl);
     488      status = status && (atomInfo.get(PdbKey::occupancy) == OtheratomInfo.get(PdbKey::occupancy));
     489      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in occupancies!" << std::endl);
     490      status = status && (atomInfo.get(PdbKey::tempFactor) == OtheratomInfo.get(PdbKey::tempFactor));
     491      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in tempFactors!" << std::endl);
     492      status = status && (atomInfo.get(PdbKey::charge) == OtheratomInfo.get(PdbKey::charge));
     493      if (!status) DoeLog(1) && (eLog() << Verbose(1) << "Mismatch in charges!" << std::endl);
     494    }
     495  }
     496
     497  return status;
     498}
     499
  • src/Parser/PdbParser.hpp

    rf03705 r001f8a  
    1010
    1111#include <string>
    12 #include "Parser/FormatParser.hpp"
     12#include "FormatParser.hpp"
     13#include "PdbAtomInfoContainer.hpp"
     14#include "PdbKey.hpp"
    1315
    1416/**
    15  * Known keys for the Pdb line.
    16  */
    17 class PdbKey {
    18 public:
    19   enum PdbDataKey {
    20     noKey,
    21     x,
    22     Id,
    23     Type,
    24     extType,
    25     name,
    26     resName,
    27     chainID,
    28     resSeq,
    29     occupancy,
    30     tempFactor,
    31     segID,
    32     charge
    33   };
    34 };
    35 
    36 /**
    37  * Holds tremolo-specific information which is not store in the atom class.
    38  */
    39 class PdbAtomInfoContainer {
    40 public:
    41   PdbAtomInfoContainer();
    42   void set(PdbKey::PdbDataKey key, std::string value);
    43   std::string get(PdbKey::PdbDataKey key);
    44   std::string name;
    45   std::string extType;
    46   std::string resName;
    47   std::string chainID;
    48   std::string resSeq;
    49   std::string occupancy;
    50   std::string tempFactor;
    51   std::string segID;
    52   std::string charge;
    53 };
    54 
    55 /**
    56  * Loads a tremolo file into the World and saves the World as a tremolo file.
     17 * Loads a PDB format 3.2 file into the World and saves the World as a PDB file.
    5718 */
    5819class PdbParser : public FormatParser
     
    6425  void save(std::ostream* file);
    6526
     27  bool operator==(const PdbParser& b) const;
     28  void printAtomInfo(const atom *newAtom) const;
    6629
    6730private:
    68   void readAtomDataLine(string line);
     31  enum PdbKey::KnownTokens getToken(string &line);
     32  void readAtomDataLine(string &line, molecule *newmol);
    6933  void parseAtomDataKeysLine(string line, int offset);
    70   void readNeighbors(std::stringstream* line, int numberOfNeighbors, int atomId);
    71   void processNeighborInformation();
    72   void adaptImprData();
    73   void adaptTorsion();
    74   std::string adaptIdDependentDataString(std::string data);
     34  void readNeighbors(std::string &line);
     35//  void adaptImprData();
     36//  void adaptTorsion();
     37//  std::string adaptIdDependentDataString(std::string data);
    7538  bool isUsedField(std::string fieldName);
    7639  void writeNeighbors(std::ostream* file, int numberOfNeighbors, atom* currentAtom);
    7740  void saveLine(ostream* file, const atom* currentAtom, const char *name, const int AtomNo, const int ResdueNo);
    78   int getAtomId(int atomid) const;
    79   void setAtomId(int localatomid, int atomid);
     41
     42  // internal getter and setter
     43  size_t getSerial(const size_t atomid) const;
     44  size_t getAtomId(const size_t atomid) const;
     45  void setAtomId(const size_t localatomid, const size_t atomid);
    8046
    8147  /**
    8248   * Map to associate the known keys with numbers.
    8349   */
    84   std::map<std::string, PdbKey::PdbDataKey> knownKeys;
     50  std::map<std::string, PdbKey::KnownTokens> knownTokens;
    8551
    8652  /**
     
    8854   * file.
    8955   */
    90   std::map<int, PdbAtomInfoContainer> additionalAtomData;
     56  std::map<size_t, PdbAtomInfoContainer> additionalAtomData;
    9157
    9258  /**
     
    9965   * world.
    10066   */
    101   std::map<int, int> atomIdMap;
     67  std::map<size_t, size_t> atomIdMap;
     68
     69  /**
     70   * Maps original atom IDs received from the parsed file to atom IDs in the
     71   * world.
     72   */
     73  std::set<size_t> SerialSet;
     74
    10275};
    10376
  • src/Parser/XyzParser.cpp

    rf03705 r001f8a  
    8484void XyzParser::save(ostream* file) {
    8585  DoLog(0) && (Log() << Verbose(0) << "Saving changes to xyz." << std::endl);
    86   if (comment == "") {
     86  //if (comment == "") {
    8787    time_t now = time((time_t *)NULL);   // Get the system time and put it into 'now' as 'calender time'
    8888    comment = "Created by molecuilder on ";
     
    9494    else
    9595      comment += time;
    96   }
     96  //}
    9797  *file << World::getInstance().numAtoms() << endl << "\t" << comment << endl;
    9898
  • src/unittests/Makefile.am

    rf03705 r001f8a  
    3535  MoleculeDescriptorTest \
    3636  ObserverTest \
    37   ParserUnitTest \
     37  ParserCommonUnitTest \
     38  ParserTremoloUnitTest \
    3839  periodentafelTest \
    3940  PlaneUnittest \
     
    4849  VectorContentUnitTest \
    4950  VectorUnitTest
    50  
    51  
     51
     52
    5253check_PROGRAMS = $(TESTS)
    5354noinst_PROGRAMS = $(TESTS) TestRunner
     
    9697  MoleculeDescriptorTest.cpp \
    9798  ObserverTest.cpp \
    98   ParserUnitTest.cpp \
     99  ParserCommonUnitTest.cpp \
     100  ParserTremoloUnitTest.cpp \
    99101  periodentafelTest.cpp \
    100102  PlaneUnittest.cpp \
     
    137139  ObserverTest.hpp \
    138140  periodentafelTest.hpp \
    139   ParserUnitTest.hpp \
     141  ParserCommonUnitTest.hpp \
     142  ParserTremoloUnitTest.hpp \
    140143  PlaneUnittest.hpp \
    141144  RegistryUnitTest.hpp \
     
    203206LineUnittest_LDADD = ${ALLLIBS}
    204207
    205 LinkedCellUnitTest_SOURCES = UnitTestMain.cpp LinkedCellUnitTest.cpp LinkedCellUnitTest.hpp 
     208LinkedCellUnitTest_SOURCES = UnitTestMain.cpp LinkedCellUnitTest.cpp LinkedCellUnitTest.hpp
    206209LinkedCellUnitTest_LDADD = ${ALLLIBS}
    207210
     
    209212ListOfBondsUnitTest_LDADD = ${ALLLIBS}
    210213
    211 LogUnitTest_SOURCES = UnitTestMain.cpp logunittest.cpp logunittest.hpp 
     214LogUnitTest_SOURCES = UnitTestMain.cpp logunittest.cpp logunittest.hpp
    212215LogUnitTest_LDADD = ${ALLLIBS}
    213216
     
    227230ObserverTest_LDADD = ${ALLLIBS}
    228231
    229 ParserUnitTest_SOURCES = UnitTestMain.cpp ParserUnitTest.cpp ParserUnitTest.hpp
    230 ParserUnitTest_LDADD = ${ALLLIBS}
     232ParserCommonUnitTest_SOURCES = UnitTestMain.cpp ParserCommonUnitTest.cpp ParserCommonUnitTest.hpp
     233ParserCommonUnitTest_LDADD = ${ALLLIBS}
     234
     235ParserTremoloUnitTest_SOURCES = UnitTestMain.cpp ParserTremoloUnitTest.cpp ParserTremoloUnitTest.hpp
     236ParserTremoloUnitTest_LDADD = ${ALLLIBS}
    231237
    232238periodentafelTest_SOURCES = UnitTestMain.cpp periodentafelTest.cpp periodentafelTest.hpp
  • tests/regression/Simple_configuration/2/post/test.conf

    rf03705 r001f8a  
    2828OutSrcStep      5       # Output "restart" data every ..th step
    2929TargetTemp      0.000950045     # Target temperature
    30 MaxPsiStep      0       # number of Minimisation steps per state (0 - default)
     30MaxPsiStep      3       # number of Minimisation steps per state (0 - default)
    3131EpsWannier      1e-07   # tolerance value for spread minimisation of orbitals
    3232
     
    3636RelEpsKineticE  1e-05   # relative change in kinetic energy
    3737MaxMinStopStep  1       # check every ..th steps
    38 MaxMinGapStopStep       0       # check every ..th steps
     38MaxMinGapStopStep       1       # check every ..th steps
    3939
    4040# Values specifying when to stop for INIT, otherwise same as above
     
    4343InitRelEpsKineticE      0.0001  # relative change in kinetic energy
    4444InitMaxMinStopStep      1       # check every ..th steps
    45 InitMaxMinGapStopStep   0       # check every ..th steps
     45InitMaxMinGapStopStep   1       # check every ..th steps
    4646
    4747BoxLength                       # (Length of a unit cell)
  • tests/regression/Simple_configuration/2/post/test.pdb

    rf03705 r001f8a  
    11REMARK created by molecuilder on Fri Aug 27 12:18:33 2010
    2 ATOM      1  H01 non b   0        10.0    10.0    10.0   1.0   1.0         0 H 0
     2ATOM      1  H01 tes b   0        10.0    10.0    10.0   1.0   1.0         0 H 0
    33END
  • tests/regression/Simple_configuration/2/pre/test.xyz

    rf03705 r001f8a  
    111
    2  # test configuration, created by molecuilder test suite
    3 H       10.     10.     10.
     2        Created by molecuilder on Tue Oct  6 18:34:23 2009
     3H       10      10      10
  • tests/regression/testsuite-domain.at

    rf03705 r001f8a  
    3636AT_KEYWORDS([domain])
    3737AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Domain/5/pre/test.conf .], 0)
    38 AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -s "0.5, 1., 0.9"], 0, [stdout], [stderr])
     38AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ --scale-box "0.5, 1., 0.9"], 0, [stdout], [stderr])
    3939AT_CHECK([diff test.conf ${abs_top_srcdir}/${AUTOTEST_PATH}/Domain/5/post/test.conf], 0, [stdout], [stderr])
    4040AT_CLEANUP
  • tests/regression/testsuite-molecules.at

    rf03705 r001f8a  
    5757AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/pre/test-*.xyz .], 0)
    5858AT_CHECK([../../molecuilder -i test-rotated-z90.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
    59 AT_CHECK([file="test-rotated-z90.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
     59AT_CHECK([file="test-rotated-z90.xyz"; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
    6060AT_CHECK([../../molecuilder -i test-rotated-z180.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
    61 AT_CHECK([file="test-rotated-z180.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
     61AT_CHECK([file="test-rotated-z180.xyz"; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
    6262AT_CHECK([../../molecuilder -i test-rotated-z360.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
    63 AT_CHECK([file="test-rotated-z360.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
     63AT_CHECK([file="test-rotated-z360.xyz"; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
    6464AT_CHECK([../../molecuilder -i test-rotated-xYz20.xyz -e ${abs_top_srcdir}/src/ --select-molecule-by-id 0 -m "0,0,1"], 0, [stdout], [stderr])
    65 AT_CHECK([file="test-rotated-xYz20.xyz"; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
     65AT_CHECK([file="test-rotated-xYz20.xyz"; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/8/post/$file], 0, [ignore], [ignore])
    6666AT_CLEANUP
    6767
     
    7171AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
    7272AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-atoms --rotate-origin 90. --position "0,0,1"], 0, [stdout], [stderr])
    73 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z90.xyz], 0, [ignore], [ignore])
     73AT_CHECK([diff -I '.*Created by molecuilder.*' test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z90.xyz], 0, [ignore], [ignore])
    7474AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
    7575AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-atoms --rotate-origin 180. --position "0,0,1"], 0, [stdout], [stderr])
    76 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z180.xyz], 0, [ignore], [ignore])
     76AT_CHECK([diff -I '.*Created by molecuilder.*' test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z180.xyz], 0, [ignore], [ignore])
    7777AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
    7878AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-atoms --rotate-origin 360. --position "0,0,1"], 0, [stdout], [stderr])
    79 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z360.xyz], 0, [ignore], [ignore])
    80 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz], 0, [ignore], [ignore])
     79AT_CHECK([diff -I '.*Created by molecuilder.*' test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-z360.xyz], 0, [ignore], [ignore])
     80AT_CHECK([diff -I '.*Created by molecuilder.*' test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz], 0, [ignore], [ignore])
    8181AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/pre/test.xyz .], 0)
    8282AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-atoms --rotate-origin 20. --position "1,2,1"], 0, [stdout], [stderr])
    83 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-xYz20.xyz], 0, [ignore], [ignore])
     83AT_CHECK([diff -I '.*Created by molecuilder.*' test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/9/post/test-rotated-xYz20.xyz], 0, [ignore], [ignore])
    8484AT_CLEANUP
    8585
     
    8989AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
    9090AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 90. --position "0,0,1"], 0, [stdout], [stderr])
    91 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z90.xyz], 0, [ignore], [ignore])
     91AT_CHECK([diff -I '.*Created by molecuilder.*' test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z90.xyz], 0, [ignore], [ignore])
    9292AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
    9393AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 180. --position "0,0,1"], 0, [stdout], [stderr])
    94 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z180.xyz], 0, [ignore], [ignore])
     94AT_CHECK([diff -I '.*Created by molecuilder.*' test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z180.xyz], 0, [ignore], [ignore])
    9595AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
    9696AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 360. --position "0,0,1"], 0, [stdout], [stderr])
    97 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z360.xyz], 0, [ignore], [ignore])
    98 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz], 0, [ignore], [ignore])
     97AT_CHECK([diff -I '.*Created by molecuilder.*' test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-z360.xyz], 0, [ignore], [ignore])
     98AT_CHECK([diff -I '.*Created by molecuilder.*' test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz], 0, [ignore], [ignore])
    9999AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/pre/test.xyz .], 0)
    100100AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-all-molecules --rotate-self 20. --position "1,2,1"], 0, [stdout], [stderr])
    101 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-xYz20.xyz], 0, [ignore], [ignore])
     101AT_CHECK([diff -I '.*Created by molecuilder.*' test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/10/post/test-rotated-xYz20.xyz], 0, [ignore], [ignore])
    102102AT_CLEANUP
    103103
     
    107107AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/pre/test.xyz test-copy.xyz], 0)
    108108AT_CHECK([../../molecuilder -i test-copy.xyz -e ${abs_top_srcdir}/src/ --copy-molecule 0 --position "0,0,10"], 0, [stdout], [stderr])
    109 AT_CHECK([diff test-copy.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/post/test-copy.xyz], 0, [ignore], [ignore])
     109AT_CHECK([diff -I '.*Created by molecuilder.*' test-copy.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/post/test-copy.xyz], 0, [ignore], [ignore])
    110110AT_CLEANUP
    111111
     
    114114AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/pre/test.xyz test-copy.xyz], 0)
    115115AT_CHECK([../../molecuilder -i test-copy.xyz -e ${abs_top_srcdir}/src/ --copy-molecule 0 --position "0,0,10" --undo], 0, [stdout], [stderr])
    116 AT_CHECK([diff test-copy.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/pre/test.xyz], 0, [ignore], [ignore])
     116AT_CHECK([diff -I '.*Created by molecuilder.*' test-copy.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/pre/test.xyz], 0, [ignore], [ignore])
    117117AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/pre/test.xyz test-copy.xyz], 0)
    118118AT_CHECK([../../molecuilder -i test-copy.xyz -e ${abs_top_srcdir}/src/ --copy-molecule 0 --position "0,0,10" --undo --redo], 0, [stdout], [stderr])
    119 AT_CHECK([diff test-copy.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/post/test-copy.xyz], 0, [ignore], [ignore])
     119AT_CHECK([diff -I '.*Created by molecuilder.*' test-copy.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/11/post/test-copy.xyz], 0, [ignore], [ignore])
    120120AT_CLEANUP
  • tests/regression/testsuite-simple_configuration.at

    rf03705 r001f8a  
    1010AT_CLEANUP
    1111
    12 # 2. parsing an xyz
    13 AT_SETUP([Simple configuration - parsing xyz file])
    14 AT_KEYWORDS([configuration])
    15 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.xyz parsertest.xyz], 0)
    16 AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -o mpqc pcp pdb xyz -p parsertest.xyz], 0, [ignore], [ignore])
    17 AT_CHECK([fgrep "Ion_Type1_1" test.conf], 0, [Ion_Type1_1       10.000000000    10.000000000    10.000000000    0 # molecule nr 0
    18 ], [ignore])
     12# 2. parsing and storing an xyz
     13AT_SETUP([Simple configuration - loading conf file])
     14AT_KEYWORDS([configuration])
     15AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -o pcp -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.conf], 0, [ignore], [ignore])
    1916AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/$file], 0, [ignore], [ignore])
     17AT_CLEANUP
     18AT_SETUP([Simple configuration - not implemented: loading mpqc file])
     19AT_KEYWORDS([configuration])
     20#AT_CHECK([../../molecuilder -i test.in -e ${abs_top_srcdir}/src/ -o mpqc -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.in], 139, [ignore], [ignore])
     21# not working with NDEBUG it's 139, without its 132
     22AT_CLEANUP
     23AT_SETUP([Simple configuration - storing mpqc from loaded xyz file])
     24AT_KEYWORDS([configuration])
     25AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ -o mpqc -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.xyz], 0, [ignore], [ignore])
    2026AT_CHECK([file=test.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/$file], 0, [ignore], [ignore])
     27AT_CLEANUP
     28AT_SETUP([Simple configuration - loading mpqc file])
     29AT_KEYWORDS([configuration])
     30#AT_CHECK([../../molecuilder -i test.in -e ${abs_top_srcdir}/src/ -o mpqc -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.in], 139, [ignore], [ignore])
     31# not working with NDEBUG it's 139, without its 132
     32AT_CLEANUP
     33AT_SETUP([Simple configuration - loading pdb file])
     34AT_KEYWORDS([configuration])
     35AT_CHECK([../../molecuilder -i test.pdb -e ${abs_top_srcdir}/src/ -o pdb -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.pdb], 0, [ignore], [ignore])
     36AT_CHECK([file=test.pdb; diff -I '.*created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/$file], 0, [ignore], [ignore])
     37AT_CLEANUP
     38AT_SETUP([Simple configuration - loading xyz file])
     39AT_KEYWORDS([configuration])
     40AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ -o xyz -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.xyz], 0, [ignore], [ignore])
    2141AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/$file], 0, [ignore], [ignore])
    22 AT_CHECK([file=test.pdb; diff -I '.*created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/$file], 0, [ignore], [ignore])
     42AT_CLEANUP
     43AT_SETUP([Simple configuration - saving conf file])
     44AT_KEYWORDS([configuration])
     45AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -o pcp -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.conf -s store.conf], 0, [ignore], [ignore])
     46AT_CHECK([diff store.conf ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/test.conf], 0, [ignore], [ignore])
     47AT_CLEANUP
     48AT_SETUP([Simple configuration - saving mpqc (from parsed xyz) file])
     49AT_KEYWORDS([configuration])
     50AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ -o mpqc -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.xyz -s store.in], 0, [ignore], [ignore])
     51AT_CHECK([diff store.in ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/test.in], 0, [ignore], [ignore])
     52AT_CLEANUP
     53AT_SETUP([Simple configuration - saving pdb file])
     54AT_KEYWORDS([configuration])
     55AT_CHECK([../../molecuilder -i test.pdb -e ${abs_top_srcdir}/src/ -o pdb -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.pdb -s store.pdb], 0, [ignore], [ignore])
     56AT_CHECK([diff -I '.*created by molecuilder.*' store.pdb ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/test.pdb], 0, [ignore], [ignore])
     57AT_CLEANUP
     58AT_SETUP([Simple configuration - saving xyz file])
     59AT_KEYWORDS([configuration])
     60AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ -o xyz -l ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/pre/test.xyz -s store.xyz], 0, [ignore], [ignore])
     61AT_CHECK([diff -I '.*Created by molecuilder.*' store.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/2/post/test.xyz], 0, [ignore], [ignore])
    2362AT_CLEANUP
    2463
     
    4786AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/test.xyz test.xyz], 0)
    4887AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-atom-by-id 0 -E 6 ], 0, [ignore], [ignore])
    49 AT_CHECK([file=test.xyz; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/post/$file], 0, [ignore], [ignore])
     88AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/post/$file], 0, [ignore], [ignore])
    5089AT_CLEANUP
    5190AT_SETUP([Simple configuration - Changing element with Undo/Redo])
     
    5392AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/test.xyz test.xyz], 0)
    5493AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-atom-by-id 0 -E 6 --undo], 0, [ignore], [ignore])
    55 AT_CHECK([file=test.xyz; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/$file], 0, [ignore], [ignore])
     94AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/$file], 0, [ignore], [ignore])
    5695AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/test.xyz test.xyz], 0)
    5796AT_CHECK([../../molecuilder -i test.xyz -e ${abs_top_srcdir}/src/ --select-atom-by-id 0 -E 6 --undo --redo], 0, [ignore], [ignore])
    58 AT_CHECK([file=test.xyz; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/post/$file], 0, [ignore], [ignore])
     97AT_CHECK([file=test.xyz; diff -I '.*Created by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/post/$file], 0, [ignore], [ignore])
    5998AT_CLEANUP
    6099
     
    172211AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/pre/test.xyz .], 0)
    173212AT_CHECK([../../molecuilder -i test.xyz --select-all-atoms -t "1,0,0"], 0, [stdout], [stderr])
    174 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/post/test-shifted.xyz], 0, [ignore], [ignore])
     213AT_CHECK([diff -I '.*Created by molecuilder.*' test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/post/test-shifted.xyz], 0, [ignore], [ignore])
    175214AT_CLEANUP
    176215AT_SETUP([Simple configuration - Translation with Undo/Redo])
     
    178217AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/pre/test.xyz .], 0)
    179218AT_CHECK([../../molecuilder -i test.xyz --select-all-atoms -t "1,0,0" --undo], 0, [stdout], [stderr])
    180 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/pre/test.xyz], 0, [ignore], [ignore])
     219AT_CHECK([diff -I '.*Created by molecuilder.*' test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/pre/test.xyz], 0, [ignore], [ignore])
    181220AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/pre/test.xyz .], 0)
    182221AT_CHECK([../../molecuilder -i test.xyz --select-all-atoms -t "1,0,0" --undo --redo], 0, [stdout], [stderr])
    183 AT_CHECK([diff test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/post/test-shifted.xyz], 0, [ignore], [ignore])
    184 AT_CLEANUP
     222AT_CHECK([diff -I '.*Created by molecuilder.*' test.xyz ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/9/post/test-shifted.xyz], 0, [ignore], [ignore])
     223AT_CLEANUP
Note: See TracChangeset for help on using the changeset viewer.