bool Cube::parse(TextStream& textStream) { // Header information textStream.skipLine(2); int nAtoms(parseGridAxes(textStream)); if (nAtoms == 0) { QString msg("Incorrect format on line "); msg += QString::number(textStream.lineNumber()); msg += "\nExpected: <int> <double> <double> <double>"; m_errors.append(msg); return false; } if (!parseCoordinates(textStream, nAtoms)) return false; parseGridData(textStream); return m_errors.isEmpty(); }
QList<Data::SurfaceType> QChemPlot::parseForProperties(TextStream& textStream) { QString firstLine; while (!textStream.atEnd() && !firstLine.contains("Grid point positions")) { firstLine = textStream.nextLine(); } bool esp(firstLine.contains("esp values")); bool rho(firstLine.contains("electronic density values")); textStream.skipLine(); QString secondLine(textStream.nextLine()); QList<Data::SurfaceType> surfaceTypes; unsigned count(1); while (!secondLine.isEmpty()) { QString field(secondLine.left(13)); secondLine.remove(0, 13); field = field.trimmed(); if (field == "X" || field == "Y" || field == "Z") { // ignore }else if(field.contains("ALPHA")) { surfaceTypes.append( Data::SurfaceType(Data::SurfaceType::AlphaOrbital, count++)); }else if(field.contains("BETA")) { surfaceTypes.append( Data::SurfaceType(Data::SurfaceType::BetaOrbital, count++)); }else if (esp) { surfaceTypes.append( Data::SurfaceType(Data::SurfaceType::ElectrostaticPotential, count++)); }else if (rho) { surfaceTypes.append( Data::SurfaceType(Data::SurfaceType::TotalDensity, count++)); } } return surfaceTypes; }