| 42 |
|
|
| 43 |
|
if (!ifs.getline(buffer,BUFF_SIZE)) |
| 44 |
|
{ |
| 45 |
< |
obErrorLog.ThrowError(__FUNCTION__, |
| 45 |
> |
obErrorLog.ThrowError(__func__, |
| 46 |
|
"Problems reading an XYZ file: Cannot read the first line.", obWarning); |
| 47 |
|
return(false); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
if (sscanf(buffer, "%d", &natoms) == 0 || !natoms) |
| 51 |
|
{ |
| 52 |
< |
obErrorLog.ThrowError(__FUNCTION__, |
| 52 |
> |
obErrorLog.ThrowError(__func__, |
| 53 |
|
"Problems reading an XYZ file: The first line must contain the number of atoms.", obWarning); |
| 54 |
|
return(false); |
| 55 |
|
} |
| 61 |
|
// empty. Otherwise, use the title given by the calling function. |
| 62 |
|
if (!ifs.getline(buffer,BUFF_SIZE)) |
| 63 |
|
{ |
| 64 |
< |
obErrorLog.ThrowError(__FUNCTION__, |
| 64 |
> |
obErrorLog.ThrowError(__func__, |
| 65 |
|
"Problems reading an XYZ file: Could not read the second line (title/comments).", obWarning); |
| 66 |
|
return(false); |
| 67 |
|
} |
| 84 |
|
<< " According to line one, there should be " << natoms |
| 85 |
|
<< " atoms, and therefore " << natoms+2 << " lines in the file."; |
| 86 |
|
|
| 87 |
< |
obErrorLog.ThrowError(__FUNCTION__, errorMsg.str() , obWarning); |
| 87 |
> |
obErrorLog.ThrowError(__func__, errorMsg.str() , obWarning); |
| 88 |
|
return(false); |
| 89 |
|
} |
| 90 |
|
tokenize(vs,buffer); |
| 96 |
|
<< "According to the specifications, this line should contain exactly 4 entries, separated by white space." << endl |
| 97 |
|
<< "However, OpenBabel found " << vs.size() << " items."; |
| 98 |
|
|
| 99 |
< |
obErrorLog.ThrowError(__FUNCTION__, errorMsg.str() , obWarning); |
| 99 |
> |
obErrorLog.ThrowError(__func__, errorMsg.str() , obWarning); |
| 100 |
|
return(false); |
| 101 |
|
} |
| 102 |
|
|
| 124 |
|
<< "According to the specifications, this line should contain exactly 4 entries, separated by white space." << endl |
| 125 |
|
<< "OpenBabel could not interpret item #1 as a number."; |
| 126 |
|
|
| 127 |
< |
obErrorLog.ThrowError(__FUNCTION__, errorMsg.str() , obWarning); |
| 127 |
> |
obErrorLog.ThrowError(__func__, errorMsg.str() , obWarning); |
| 128 |
|
return(false); |
| 129 |
|
} |
| 130 |
|
double y = strtod((char*)vs[2].c_str(),&endptr); |
| 136 |
|
<< "According to the specifications, this line should contain exactly 4 entries, separated by white space." << endl |
| 137 |
|
<< "OpenBabel could not interpret item #2 as a number."; |
| 138 |
|
|
| 139 |
< |
obErrorLog.ThrowError(__FUNCTION__, errorMsg.str() , obWarning); |
| 139 |
> |
obErrorLog.ThrowError(__func__, errorMsg.str() , obWarning); |
| 140 |
|
return(false); |
| 141 |
|
} |
| 142 |
|
double z = strtod((char*)vs[3].c_str(),&endptr); |
| 148 |
|
<< "According to the specifications, this line should contain exactly 4 entries, separated by white space." << endl |
| 149 |
|
<< "OpenBabel could not interpret item #3 as a number."; |
| 150 |
|
|
| 151 |
< |
obErrorLog.ThrowError(__FUNCTION__, errorMsg.str() , obWarning); |
| 151 |
> |
obErrorLog.ThrowError(__func__, errorMsg.str() , obWarning); |
| 152 |
|
return(false); |
| 153 |
|
} |
| 154 |
|
atom->SetVector(x,y,z); //set coordinates |