1 |
|
/********************************************************************** |
2 |
|
|
3 |
|
This basic Periodic Table class was originally taken from the data.cpp |
4 |
< |
file in OpenBabel. The code has been modified to match the OOPSE coding style. |
4 |
> |
file in OpenBabel. The code has been modified to match the OpenMD coding style. |
5 |
|
|
6 |
|
We have retained the OpenBabel copyright and GPL license on this class: |
7 |
|
|
53 |
|
#define BUFF_SIZE 32768 |
54 |
|
#endif |
55 |
|
|
56 |
< |
namespace oopse { |
56 |
> |
namespace OpenMD { |
57 |
|
|
58 |
|
ElementsTable etab; |
59 |
|
|
78 |
|
RealType red, green, blue; |
79 |
|
|
80 |
|
// skip comment line (at the top) |
81 |
– |
|
81 |
|
if (line[0] != '#') { |
82 |
|
sscanf(line,"%d %5s %lf %*f %lf %d %lf %lf %lf %lf %lf %lf %lf %255s", |
83 |
|
&num, |
109 |
|
return elements_.size(); |
110 |
|
} |
111 |
|
|
112 |
< |
char *ElementsTable::GetSymbol(int atomicnum) { |
112 |
> |
const char *ElementsTable::GetSymbol(int atomicnum) { |
113 |
|
if (!init_) |
114 |
|
Init(); |
115 |
|
|
294 |
|
buffer = getenv(envvar_.c_str()); |
295 |
|
buffer += FILE_SEP_CHAR; |
296 |
|
|
297 |
+ |
|
298 |
+ |
|
299 |
+ |
|
300 |
|
if (!subdir_.empty()) { |
301 |
|
subbuffer = buffer; |
302 |
|
subbuffer += subdir_; |
303 |
|
subbuffer += FILE_SEP_CHAR; |
304 |
|
} |
305 |
|
|
306 |
+ |
|
307 |
+ |
|
308 |
|
buffer += filename_; |
309 |
|
subbuffer += filename_; |
310 |
+ |
|
311 |
|
|
312 |
|
ifs1.open(subbuffer.c_str()); |
313 |
|
ifsP= &ifs1; |
314 |
< |
if (!(*ifsP)) { |
314 |
> |
if (!(ifsP->is_open())) { |
315 |
|
ifs2.open(buffer.c_str()); |
316 |
|
ifsP = &ifs2; |
317 |
|
} |
318 |
+ |
|
319 |
|
} else { |
320 |
|
sprintf( painCave.errMsg, |
321 |
|
"ElementsTable error.\n" |
328 |
|
if ((*ifsP)) { |
329 |
|
while(ifsP->getline(charBuffer,BUFF_SIZE)) |
330 |
|
ParseLine(charBuffer); |
331 |
< |
|
331 |
> |
|
332 |
|
if (ifs1) |
333 |
|
ifs1.close(); |
334 |
|
if (ifs2) |