AFLOW
 
Loading...
Searching...
No Matches
aflow.cpp
Go to the documentation of this file.
1// ***************************************************************************
2// * *
3// * aflow - Automatic FLOW for materials discovery project *
4// * Stefano Curtarolo - Duke University - 2003-2023 *
5// * *
6// ***************************************************************************
7//
8// Copyright 2003-2023 - Stefano Curtarolo - AFLOW.ORG consortium
9//
10// This file is part of AFLOW software.
11//
12// AFLOW is free software: you can redistribute it and/or modify
13// it under the terms of the GNU General Public License as published by
14// the Free Software Foundation, either version 3 of the License, or
15// (at your option) any later version.
16//
17// This program is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU General Public License for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program. If not, see <http://www.gnu.org/licenses/>.
24//
25// ***************************************************************************
26
27#include "aflow.h"
28
29#include <cstddef>
30#include <cstdio>
31#include <deque>
32#include <fstream>
33#include <iostream>
34#include <istream>
35#include <ostream>
36#include <sstream>
37#include <string>
38#include <vector>
39
40#include <curl/curl.h>
41
42#include "AUROSTD/aurostd.h"
51
52#include "aflow_aflowrc.h"
53#include "aflow_defs.h"
54#include "aflow_init.h"
55#include "aflow_xhost.h"
56#include "aflowlib/aflowlib_libraries_scrubber.h"
57#include "aflowlib/aflowlib_web_outreach.h"
58#include "extern/SQLITE/sqlite3.h"
59#include "flow/aflow_ivasp.h"
60#include "flow/aflow_pflow.h"
61#include "interfaces/aflow_pthreads.h"
62#include "modules/POCC/aflow_pocc.h" //CO20200624
63#include "structure/aflow_xatom.h"
64#include "structure/aflow_xstructure.h"
65#include "test/aflow_test.cpp" // todo ST: this is bad
66#include "test/aflow_unit_test.h"
67
68using std::cerr;
69using std::cout;
70using std::endl;
71using std::ifstream;
72using std::istream;
73using std::ofstream;
74using std::ostream;
75using std::stringstream;
76using std::vector;
77
78int main(int _argc, char **_argv) {
79 ostream &oss = cout; // CO20180419
80 try {
81 const bool LDEBUG = false; // true;
82 int return_code = 0; // ME20200901
83 if (LDEBUG) {
84 cerr << "AFLOW-MAIN [1]" << endl;
85 }
86 std::vector<string> argv(aurostd::get_arguments_from_input(_argc, _argv));
87 if (LDEBUG) {
88 cerr << "AFLOW-MAIN [2]" << endl;
89 }
90 std::vector<string> cmds;
91
92 // init curl library (only needs to be called once) HE20250602
93 curl_global_init(CURL_GLOBAL_SSL);
94
95 // MACHINE
96 // ME20200724
97 const int code = init::InitMachine(false, argv, cmds, cerr);
98 if (code >= 0) {
99 return code;
100 }
101 if (LDEBUG || XHOST.DEBUG) {
102 cerr << "AFLOW-MAIN [3]" << endl;
103 }
104
105 // aurostd::TmpDirectoryCreate("test");
106 // cerr << args2flag(argv,"--aaa|--bbb |--ccc") << endl;
107 // CHECK USERS MACHINES - DEBUG
108
109 // initialize_templates_never_call_this_procedure(1);
110
111 // INITIALIZE ***************************************************
112 // INIT LOOK UP TABLES
113 atoms_initialize();
116 // spacegroup::SpaceGroupInitialize(); only if necessary
117 // INFORMATION **************************************************
118 AFLOW_PTHREADS::FLAG = AFLOW_PTHREADS::Check_Threads(argv, !XHOST.QUIET);
119
120 bool Arun = false;
121 if (!Arun && aurostd::args2flag(argv, cmds, "--pocc_old2new|--pocc_o2n")) {
122 Arun = true;
123 pocc::poccOld2New();
124 } // CO20200624
125 if (!Arun && aurostd::args2flag(argv, cmds, "--prx|--prx=")) {
126 Arun = true;
127 PERFORM_PRX(cout);
128 }
129 if (!Arun && aurostd::args2flag(argv, cmds, "--test_getpp")) {
130 if (KBIN::VASP_PseudoPotential_CleanName_TEST()) {
131 return 0;
132 }
133 return 1;
134 }
135
136 if (!Arun && aurostd::args2flag(argv, cmds, "--test_xmatrix")) { // CO20190911
137 const bool LDEBUG = true;// true;
138 xmatrix<double> mat;
139 mat(1, 1) = 5;
140 mat(1, 2) = 9;
141 mat(1, 3) = 12;
142 mat(2, 1) = 7;
143 mat(2, 2) = 10;
144 mat(2, 3) = 13;
145 mat(3, 1) = 8;
146 mat(3, 2) = 11;
147 mat(3, 3) = 14;
148 if (LDEBUG) {
149 cerr << __AFLOW_FUNC__ << " mat=" << endl;
150 cerr << mat << endl;
151 }
152 // getxmat()
153 xmatrix<double> submat;
154 mat.getxmatInPlace(submat, 2, 3, 2, 3);
155 if (LDEBUG) {
156 cerr << __AFLOW_FUNC__ << " submat=" << endl;
157 cerr << submat << endl;
158 }
159 // setmat()
160 mat.setmat(submat, 1, 1); // do nothing
161 if (LDEBUG) {
162 cerr << __AFLOW_FUNC__ << " replacing with submat at 1,1" << endl;
163 cerr << __AFLOW_FUNC__ << " mat=" << endl;
164 cerr << mat << endl;
165 }
166 const xvector<double> xv;
167 xv(1) = 2;
168 xv(2) = 3;
169 xv(3) = 4;
170 if (LDEBUG) {
171 cerr << __AFLOW_FUNC__ << " xv=" << xv << endl;
172 }
173 mat.setmat(xv, 1, false); // row
174 if (LDEBUG) {
175 cerr << __AFLOW_FUNC__ << " replacing with xv at row=1" << endl;
176 cerr << __AFLOW_FUNC__ << " mat=" << endl;
177 cerr << mat << endl;
178 }
179 mat.setmat(xv, 2, true); // col
180 if (LDEBUG) {
181 cerr << __AFLOW_FUNC__ << " replacing with xv at col=2" << endl;
182 cerr << __AFLOW_FUNC__ << " mat=" << endl;
183 cerr << mat << endl;
184 }
185 // setrow()
186 mat.setrow(xv, 2);
187 if (LDEBUG) {
188 cerr << __AFLOW_FUNC__ << " replacing with xv at row=2" << endl;
189 cerr << __AFLOW_FUNC__ << " mat=" << endl;
190 cerr << mat << endl;
191 }
192 // setcol()
193 mat.setcol(xv, 3);
194 if (LDEBUG) {
195 cerr << __AFLOW_FUNC__ << " replacing with xv at col=3" << endl;
196 cerr << __AFLOW_FUNC__ << " mat=" << endl;
197 cerr << mat << endl;
198 }
199 return 1;
200 }
201 if (!Arun && aurostd::args2flag(argv, cmds, "--test_stefano")) {
202 uint y = 2017;
203 uint m = 11;
204 m += 1;
205 for (uint i = 0; i < 200; i++) {
206 if (m == 0) {
207 cout << "mv \"unknown.pdf\" stefano_" << y << m << ".pdf" << endl;
208 } else {
209 if (m < 10) {
210 cout << "mv \"unknown(" << i << ").pdf\" stefano_" << y << "0" << m << ".pdf" << endl;
211 } else {
212 cout << "mv \"unknown(" << i << ").pdf\" stefano_" << y << m << ".pdf" << endl;
213 }
214 }
215 m--;
216 if (m == 0) {
217 y--;
218 m += 12;
219 }
220 }
221 return 0; // CO20180419
222 }
223 // ME20220128
224 if (!Arun && aurostd::args2attachedflag(argv, cmds, "--unit_test")) {
225 aurostd::xoption unittest_options;
226 unittest_options.args2addattachedscheme(argv, cmds, "UNIT_TESTS", "--unit_test=", "all");
227 vector<string> tests;
228 aurostd::string2tokens(unittest_options.getattachedscheme("UNIT_TESTS"), tests, ",");
229 unittest::UnitTest ut(std::cout);
230 return (ut.runTestSuites(tests) ? 0 : 1);
231 }
232 if (!Arun && aurostd::args2flag(argv, cmds, "--test")) {
233 if (XHOST.vext.size() != XHOST.vcat.size()) {
234 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "XHOST.vext.size()!=XHOST.vcat.size(), aborting.", _RUNTIME_ERROR_);
235 }
236
237 for (size_t iext = 0; iext < XHOST.vext.size(); iext++) {
238 cout << "\"" << XHOST.vext[iext] << "\"" << " " << "\"" << XHOST.vcat[iext] << "\"" << endl;
239 }
240
241 const int dim = 7;
242 cout << "dimm=" << dim << endl;
243
244 xmatrix<double> m(dim, dim);
245 xmatrix<double> mi(dim, dim);
246 for (int i = 1; i <= dim; i++) {
247 for (int j = 1; j <= dim; j++) {
248 m(i, j) = aurostd::ran0();
249 }
250 }
251 cout << "m=" << endl << m << endl;
252 mi = inverse(m);
253 cout << "mi=" << endl << mi << endl;
254 cout << "mi*m=" << endl << det(mi * m) << endl;
255
256 // CO how to create 64bit string from binary file
257 // string b64String;
258 // aurostd::bin2base64("aflow_logo.pdf",b64String);
259 // cout << b64String << endl;
260
261 const string test = "2.730747137 -2.730747137-12.397646334";
262 vector<string> _tokens;
263 aurostd::string2tokens(test, _tokens, "-");
264 for (size_t i = 0; i < _tokens.size(); i++) {
265 cerr << _tokens[i] << endl;
266 }
267 return 0; // CO20180419
268 // CO START 20170614 - some SQLITE tests
269 // http://zetcode.com/db/sqlitec/ - more tests here
270 // this will create test.db file
271 sqlite3 *db;
272 char *err_msg = nullptr;
273 int rc = sqlite3_open("test.db", &db);
274 if (rc != SQLITE_OK) {
275 fprintf(stderr, "Cannot open database: %s\n", sqlite3_errmsg(db));
276 sqlite3_close(db);
277 return 1;
278 }
279 const char *sql =
280 "DROP TABLE IF EXISTS Cars;"
281 "CREATE TABLE Cars(Id INT, Name TEXT, Price INT);"
282 "INSERT INTO Cars VALUES(1, 'Audi', 52642);"
283 "INSERT INTO Cars VALUES(2, 'Mercedes', 57127);"
284 "INSERT INTO Cars VALUES(3, 'Skoda', 9000);"
285 "INSERT INTO Cars VALUES(4, 'Volvo', 29000);"
286 "INSERT INTO Cars VALUES(5, 'Bentley', 350000);"
287 "INSERT INTO Cars VALUES(6, 'Citroen', 21000);"
288 "INSERT INTO Cars VALUES(7, 'Hummer', 41400);"
289 "INSERT INTO Cars VALUES(8, 'Volkswagen', 21600);";
290 rc = sqlite3_exec(db, sql, nullptr, nullptr, &err_msg);
291 if (rc != SQLITE_OK) {
292 fprintf(stderr, "SQL error: %s\n", err_msg);
293 sqlite3_free(err_msg);
294 sqlite3_close(db);
295 return 1;
296 }
297 sqlite3_close(db);
298 // return 0;
299
300 // MORE TESTS
301 // printf("%s\n,sqlite3_libversion()");
302 // sqlite3 *db;
303 // sqlite3_stmt *res;
304 // int rc = sqlite3_open(":memory:", &db);
305 // if(rc != SQLITE_OK) {
306 // fprintf(stderr, "Cannot open database: %s\n", sqlite3_errmsg(db));
307 // sqlite3_close(db);
308 // return 1;
309 // }
310 // rc = sqlite3_prepare_v2(db, "SELECT SQLITE_VERSION()", -1, &res, 0);
311 // if(rc != SQLITE_OK) {
312 // fprintf(stderr, "Failed to fetch data: %s\n", sqlite3_errmsg(db));
313 // sqlite3_close(db);
314 // return 1;
315 // }
316 // rc = sqlite3_step(res);
317 // if(rc == SQLITE_ROW) {
318 // printf("%s\n", sqlite3_column_text(res, 0));
319 // }
320 // sqlite3_finalize(res);
321 // sqlite3_close(db);
322 // return 0;
323
324 // quick easy test
325 cerr << sqlite3_libversion() << endl;
326 // CO END 20170614 - some SQLITE tests
327 aurostd::xcomplex<double> x(123.0, 456.0);
328 cout << x.re << "," << x.im << " - " << x.real() << "," << x.imag() << " - " << x << endl;
329 x.re = 111;
330 x.im = 222;
331 cout << x.re << "," << x.im << " - " << x.real() << "," << x.imag() << " - " << x << endl;
332 cout << aurostd::PaddedPOST("EMIN= -30.0", 10) << endl;
333 ;
334 stringstream for_corey;
335 for_corey << "scatter/use mapped color={draw=black,fill=mapped color,solid}";
336 const string corey = for_corey.str();
337 cout << corey << endl;
338 stringstream aus;
339 aus << "************************ 00000 MESSAGE KPOINTS KSHIFT=[" << 1 << " " << 2 << " " << 3 << "]" << " ************************ " << endl;
340 cout << aus.str() << endl;
341 return 0; // CO20180419
342 }
343
344 if (!Arun && aurostd::args2attachedflag(argv, "--bin2base64=")) {
345 string b64String;
346 aurostd::bin2base64(aurostd::args2attachedstring(argv, "--bin2base64=", ""), b64String);
347 cout << b64String << endl;
348 return 0; // CO20180419
349 }
350
351 if (!Arun && aurostd::args2flag(argv, cmds,
352 "--test=POTCAR|--test=POTCAR.relax1" + DEFAULT_KZIP_EXT + "|--test=POTCAR.relax2" + DEFAULT_KZIP_EXT + "|--test=POTCAR.static" + DEFAULT_KZIP_EXT + "|--test=POTCAR.bands" +
353 DEFAULT_KZIP_EXT + "")) {
354 XHOST.DEBUG = true;
355 xPOTCAR(aurostd::args2attachedstring(argv, "--test=", ""));
356 return 0;
357 } // CO20180419
358 if (!Arun && aurostd::args2flag(argv, cmds,
359 "--test=DOSCAR|--test=DOSCAR.relax1" + DEFAULT_KZIP_EXT + "|--test=DOSCAR.relax2" + DEFAULT_KZIP_EXT + "|--test=DOSCAR.static" + DEFAULT_KZIP_EXT + "|--test=DOSCAR.bands" +
360 DEFAULT_KZIP_EXT + "")) {
361 XHOST.DEBUG = true;
362 xDOSCAR(aurostd::args2attachedstring(argv, "--test=", ""));
363 return 0;
364 } // CO20180419
365 if (!Arun && aurostd::args2flag(argv, cmds,
366 "--test=EIGENVAL|--test=EIGENVAL.relax1" + DEFAULT_KZIP_EXT + "|--test=EIGENVAL.relax2" + DEFAULT_KZIP_EXT + "|--test=EIGENVAL.static" + DEFAULT_KZIP_EXT +
367 "|--test=EIGENVAL.bands" + DEFAULT_KZIP_EXT + "")) {
368 XHOST.DEBUG = true;
369 xEIGENVAL(aurostd::args2attachedstring(argv, "--test=", ""));
370 return 0;
371 } // CO20180419
372 if (!Arun && aurostd::args2flag(argv, cmds,
373 "--test=OUTCAR|--test=OUTCAR.relax1" + DEFAULT_KZIP_EXT + "|--test=OUTCAR.relax2" + DEFAULT_KZIP_EXT + "|--test=OUTCAR.static" + DEFAULT_KZIP_EXT + "|--test=OUTCAR.bands" +
374 DEFAULT_KZIP_EXT + "")) {
375 XHOST.DEBUG = true;
376 xOUTCAR(aurostd::args2attachedstring(argv, "--test=", ""));
377 return 0;
378 } // CO20180419
379 if (!Arun && aurostd::args2flag(argv, cmds,
380 "--test=KPOINTS|--test=KPOINTS.relax1" + DEFAULT_KZIP_EXT + "|--test=KPOINTS.relax2" + DEFAULT_KZIP_EXT + "|--test=KPOINTS.static" + DEFAULT_KZIP_EXT +
381 "|--test=KPOINTS.bands" + DEFAULT_KZIP_EXT + "")) {
382 XHOST.DEBUG = true;
383 xKPOINTS(aurostd::args2attachedstring(argv, "--test=", ""));
384 return 0;
385 } // CO20180419
386 if (!Arun && aurostd::args2flag(argv, cmds,
387 "--test=vasprun|--test=vasprun.xml.relax1" + DEFAULT_KZIP_EXT + "|--test=vasprun.xml.relax2" + DEFAULT_KZIP_EXT + "|--test=vasprun.xml.static" + DEFAULT_KZIP_EXT +
388 "|--test=vasprun.xml.bands" + DEFAULT_KZIP_EXT + "")) {
389 XHOST.DEBUG = true;
390 xVASPRUNXML(aurostd::args2attachedstring(argv, "--test=", ""));
391 return 0;
392 } // CO20180419
393 if (!Arun && aurostd::args2flag(argv, cmds,
394 "--test=IBZKPT|--test=IBZKPT.relax1" + DEFAULT_KZIP_EXT + "|--test=IBZKPT.relax2" + DEFAULT_KZIP_EXT + "|--test=IBZKPT.static" + DEFAULT_KZIP_EXT + "|--test=IBZKPT.bands" +
395 DEFAULT_KZIP_EXT + "")) {
396 XHOST.DEBUG = true;
397 xIBZKPT(aurostd::args2attachedstring(argv, "--test=", ""));
398 return 0;
399 } // CO20180419
400 if (!Arun && aurostd::args2flag(argv, cmds,
401 "--test=CHGCAR|--test=CHGCAR.relax1" + DEFAULT_KZIP_EXT + "|--test=CHGCAR.relax2" + DEFAULT_KZIP_EXT + "|--test=CHGCAR.static" + DEFAULT_KZIP_EXT + "|--test=CHGCAR.bands" +
402 DEFAULT_KZIP_EXT + "")) {
403 XHOST.DEBUG = true;
404 xCHGCAR(aurostd::args2attachedstring(argv, "--test=", ""));
405 return 0;
406 } // CO20180419
407
408 // SCRUB things
409 if (!Arun && aurostd::args2flag(argv, cmds, "--scrub=POTCAR")) {
410 XHOST.DEBUG = false;
411 XHOST.PSEUDOPOTENTIAL_GENERATOR = true;
412 vector<string> vfile(aurostd::args2vectorstring(argv, "--FILE|--file|--F|--f", "./"));
413 for (size_t ifile = 0; ifile < vfile.size(); ifile++) {
414 cerr << "PROCESSING = " << vfile[ifile] << endl;
415 const xPOTCAR xPOT(vfile[ifile]);
416 }
417 return 0; // CO20180419
418 }
419 if (!Arun && aurostd::args2flag(argv, cmds, "--scrub=OUTCAR")) {
420 XHOST.DEBUG = false;
421 XHOST.PSEUDOPOTENTIAL_GENERATOR = false;
422 vector<string> vfile(aurostd::args2vectorstring(argv, "--FILE|--file|--F|--f", "./"));
423 for (size_t ifile = 0; ifile < vfile.size(); ifile++) {
424 cerr << "PROCESSING = " << vfile[ifile] << endl;
425 const xOUTCAR xOUT(vfile[ifile]);
426 // cout << xOUT << endl;
427 }
428 return 0; // CO20180419
429 }
430
431 if (!Arun && (aurostd::args2flag(argv, cmds, "--scrub") || aurostd::args2attachedflag(argv, "--scrub="))) {
432 // XHOST.DEBUG=true;
433 aflowlib::LIB2SCRUB(aurostd::args2attachedstring(argv, "--scrub=", "ALL"), true);
434 return 0; // CO20180419
435 }
436 if (!Arun && (aurostd::args2attachedflag(argv, "--lib2auid="))) {
437 // XHOST.DEBUG=true;
438 aflowlib::LIB2AUID(aurostd::args2attachedstring(argv, "--lib2auid=", "ALL"), false, true); // no test, act
439 return 0; // CO20180419
440 }
441 if (!Arun && (aurostd::args2flag(argv, cmds, "--mosfet") || aurostd::args2attachedflag(argv, "--mosfet="))) {
442 // XHOST.DEBUG=true;
443 aflowlib::MOSFET(aurostd::args2attachedutype<int>(argv, "--mosfet=", 0), true);
444 return 0; // CO20180419
445 }
446 if (!Arun && (aurostd::args2flag(argv, cmds, "--mail2scan") || aurostd::args2attachedflag(argv, "--mail2scan="))) {
447 // XHOST.DEBUG=true;
448 aflowlib::MAIL2SCAN(aurostd::args2attachedstring(argv, "--mail2scan=", "/var/mail/auro"), true);
449 return 0; // CO20180419
450 }
451
452 if (!Arun && aurostd::args2flag(argv, cmds, "--test_proto1")) {
453 vector<xstructure> vstr;
454 aflowlib::_aflowlib_entry data;
455 vector<aflowlib::_aflowlib_entry> vdata;
456 for (size_t i = 4; i < BRAVAIS_LATTICES.size(); i++) { // HE20220420 switch to global bravais lattices list
457 data.clear();
458 data.url2aflowlib("materials.duke.edu:AFLOWDATA/ICSD_WEB/" + BRAVAIS_LATTICES[i] + "/?format=text", cout, false);
459 vdata.push_back(data);
460 cout << "AFLOWLIB " << BRAVAIS_LATTICES[i] << "=" << data.vaflowlib_entries.size() << endl;
461 for (size_t j = 0; j < data.vaflowlib_entries.size(); j++) {
462 aflowlib::_aflowlib_entry dataj;
463 dataj.url2aflowlib("materials.duke.edu:AFLOWDATA/ICSD_WEB/" + BRAVAIS_LATTICES[i] + "/" + data.vaflowlib_entries[j], cout, true);
464 aurostd::StringSubstInPlace(dataj.aurl, "aflowlib", "materials");
465 if (!dataj.aurl.empty()) {
466 const xstructure str(dataj.aurl, "CONTCAR.relax.vasp", IOAFLOW_AUTO);
468 xEIGENVAL.GetPropertiesUrlFile(dataj.aurl, "EIGENVAL.bands" + DEFAULT_KZIP_EXT + "", false);
470 xOUTCAR.GetPropertiesUrlFile(dataj.aurl, "OUTCAR.static" + DEFAULT_KZIP_EXT + "", false);
472 xDOSCAR.GetPropertiesUrlFile(dataj.aurl, "DOSCAR.static" + DEFAULT_KZIP_EXT + "", false);
473 // if(aurostd::args2flag(argv,cmds,"--vasp")) aurostd::url2stringstream(dataj.aurl+"/CONTCAR.relax.vasp",stream);
474 // if(aurostd::args2flag(argv,cmds,"--qe")) aurostd::url2stringstream(dataj.aurl+"/CONTCAR.relax.qe",stream);
475 // if(aurostd::args2flag(argv,cmds,"--abinit")) aurostd::url2stringstream(dataj.aurl+"/CONTCAR.relax.abinit",stream);
476 // if(aurostd::args2flag(argv,cmds,"--aims")) aurostd::url2stringstream(dataj.aurl+"/CONTCAR.relax.aims",stream);
477 vstr.push_back(str);
478 cerr << "vstr.size()=" << vstr.size() << " "
479 << "str.atoms.size()=" << str.atoms.size() << " "
480 << "OUTCAR.static" + DEFAULT_KZIP_EXT + ".size()=" << xOUTCAR.vcontent.size() << " "
481 << "DOSCAR.static" + DEFAULT_KZIP_EXT + ".size()=" << xDOSCAR.vcontent.size() << " "
482 << "EIGENVAL.static" + DEFAULT_KZIP_EXT + ".size()=" << xEIGENVAL.vcontent.size() << " " << endl;
483 // cerr << str << endl;
484 }
485 }
486 }
487 return 0; // CO20180419
488 }
489
490 if (!Arun && aurostd::args2flag(argv, cmds, "--testJ")) {
491 Arun = true;
492 PERFORM_TESTJ(cout);
493 }
494 if (!Arun && aurostd::args2flag(argv, cmds, "--test3")) {
495 Arun = true;
496 PERFORM_TEST3(cout);
497 }
498 if (!Arun && XHOST.vflag_control.flag("MACHINE")) {
499 // ME20200724
500 const int code = init::InitMachine(false, argv, cmds, cerr);
501 if (code >= 0) {
502 return code;
503 }
504 }
505
506 // **************************************************************
507 // INTERCEPT AFLOW
508 if (!Arun && XHOST.vflag_control.flag("SWITCH_AFLOW")) {
509 Arun = true;
510 AFLOW_main(argv);
511 }
512 // DX
513 if (!Arun && XHOST.vflag_control.flag("AFLOWIN_SYM")) {
514 Arun = true;
515 AFLOW_main(argv);
516 }
517 // DX
518 if (!Arun && (XHOST.vflag_aflow.flag("CLEAN") || XHOST.vflag_aflow.flag("XCLEAN") || XHOST.AFLOW_RUNDIRflag || XHOST.AFLOW_MULTIflag || XHOST.AFLOW_RUNXflag)) {
519 Arun = true;
520 AFLOW_main(argv);
521 }
522
523 // **************************************************************
524 // INTERCEPT aconvasp/aqe by title
525 if (!Arun && aurostd::substring2bool(XHOST.progname, "aconvasp", "convasp")) {
526 Arun = true;
527 pflow::main(argv, cmds);
528 }
529 if (!Arun && aurostd::substring2bool(XHOST.progname, "aqe")) {
530 Arun = true;
531 pflow::main(argv, cmds);
532 }
533
534 // **************************************************************
535 // intercept commands
536 if (!Arun && XHOST.vflag_control.flag("MULTI=SH")) {
537 Arun = true;
538 AFLOW_PTHREADS::MULTI_sh(argv);
539 return 0;
540 } // CO20180419
541 if (!Arun && XHOST.vflag_control.flag("MONITOR")) {
542 Arun = true;
543 AFLOW_monitor(argv);
544 return 0;
545 } // CO20180419
546 if (!Arun && XHOST.vflag_control.flag("MONITOR_VASP")) {
547 Arun = true;
549 return 0;
550 } // CO20180419
551 if (!Arun && XHOST.vflag_control.flag("GETTEMP")) {
552 Arun = true;
553 AFLOW_getTEMP(argv);
554 return 0;
555 } // CO20180419
556
557 // **************************************************************
558 // INTERCEPT HELP
559 // ME20200921 - Restructured to make web processing easier
560 stringstream banner_message;
561 if (XHOST.vflag_control.flag("AFLOW_HELP")) {
562 banner_message << aflow::Banner("BANNER_BIG") << endl << aflow::Intro_HELP("aflow") << aflow::Banner("BANNER_BIG") << endl;
563 } else if (XHOST.vflag_control.flag("AFLOW_EXCEPTIONS")) {
564 banner_message << aflow::Banner("BANNER_BIG") << endl << aflow::Banner("EXCEPTIONS") << endl;
565 } else if (XHOST.vflag_control.flag("README_AFLOW_LICENSE_GPL3")) {
566 banner_message << aflow::License_Preamble_aflow() << endl;
567 banner_message << " " << endl;
568 banner_message << aurostd::EmbData::get_content("README_AFLOW_LICENSE_GPL3.TXT", "README") << endl;
569 banner_message << " " << endl;
570 banner_message << "*************************************************************************** " << endl;
571 } else if (XHOST.vflag_control.flag("README_AFLOW")) {
572 banner_message << aurostd::EmbData::get_content("README_AFLOW.TXT", "README") << endl;
573 } else if (XHOST.vflag_control.flag("README_AFLOW_VERSIONS_HISTORY")) {
574 banner_message << aurostd::EmbData::get_content("README_AFLOW_VERSIONS_HISTORY.TXT", "README") << endl;
575 } else if (XHOST.vflag_control.flag("README_AFLOW_PFLOW")) {
576 banner_message << aurostd::EmbData::get_content("README_AFLOW_PFLOW.TXT", "README") << endl;
577 } else if (XHOST.vflag_control.flag("README_FROZSL")) {
578 banner_message << aurostd::EmbData::get_content("README_AFLOW_FROZSL.TXT", "README") << endl;
579 } else if (XHOST.vflag_control.flag("README_APL")) {
580 banner_message << aurostd::EmbData::get_content("README_AFLOW_APL.TXT", "README") << endl;
581 } else if (XHOST.vflag_control.flag("README_QHA")) {
582 banner_message << aurostd::EmbData::get_content("README_AFLOW_APL.TXT", "README") << endl;
583 } else if (XHOST.vflag_control.flag("README_AAPL")) {
584 banner_message << aurostd::EmbData::get_content("README_AFLOW_APL.TXT", "README") << endl;
585 } else if (XHOST.vflag_control.flag("README_AGL")) {
586 banner_message << aurostd::EmbData::get_content("README_AFLOW_AGL.TXT", "README") << endl;
587 } else if (XHOST.vflag_control.flag("README_AEL")) {
588 banner_message << aurostd::EmbData::get_content("README_AFLOW_AEL.TXT", "README") << endl;
589 } else if (XHOST.vflag_control.flag("README_ANRL")) {
590 banner_message << aurostd::EmbData::get_content("README_AFLOW_ANRL.TXT", "README") << endl;
591 } else if (XHOST.vflag_control.flag("README_COMPARE")) { // CO20190401
592 banner_message << aurostd::EmbData::get_content("README_AFLOW_COMPARE.TXT", "README") << endl; // CO20190401
593 } else if (XHOST.vflag_control.flag("README_GFA")) {
594 banner_message << aurostd::EmbData::get_content("README_AFLOW_GFA.TXT", "README") << endl;
595 } else if (XHOST.vflag_control.flag("README_SYMMETRY")) {
596 banner_message << aurostd::EmbData::get_content("README_AFLOW_SYM.TXT", "README") << endl;
597 } else if (XHOST.vflag_control.flag("README_CCE")) {
598 banner_message << aurostd::EmbData::get_content("README_AFLOW_CCE.TXT", "README") << endl;
599 } else if (XHOST.vflag_control.flag("README_CHULL")) {
600 banner_message << aurostd::EmbData::get_content("README_AFLOW_CHULL.TXT", "README") << endl;
601 } else if (XHOST.vflag_control.flag("README_PARTIAL_OCCUPATION")) {
602 banner_message << aurostd::EmbData::get_content("README_AFLOW_POCC.TXT", "README") << endl;
603 } else if (XHOST.vflag_control.flag("README_SCRIPTING")) {
604 banner_message << aurostd::EmbData::get_content("README_AFLOW_SCRIPTING.TXT", "README") << endl;
605 } else if (XHOST.vflag_control.flag("README_EXCEPTIONS")) {
606 banner_message << aurostd::EmbData::get_content("README_AFLOW_EXCEPTIONS.TXT", "README") << endl;
607 } else if (XHOST.vflag_control.flag("README_XAFLOW")) {
608 banner_message << aurostd::EmbData::get_content("README_AFLOW_XAFLOW.TXT", "README") << endl;
609 } else if (XHOST.vflag_control.flag("README_AFLOWRC")) {
610 banner_message << aurostd::EmbData::get_content("README_AFLOW_AFLOWRC.TXT", "README") << endl;
611 }
612
613 if (!banner_message.str().empty()) {
614 std::cout << (XHOST.vflag_control.flag("WWW") ? aurostd::text2html(banner_message.str()) : banner_message.str()) << std::endl;
615 return 0;
616 }
617
618 // **************************************************************
619 // PHP-WEB AND CURRICULUM AND HIGH-THROUGHPUT STUFF
620 if (ProcessPhpLatexCv()) {
621 return 0;
622 }
623 // ProcessSecurityOptions(argv,cmds); OLD STUFF AFLOW SECURITY
624
625 // **************************************************************
626 const bool VVERSION = aurostd::args2flag(argv, cmds, "-v|--version");
627 // ME20200921 - Added web mode
628 if (!Arun && VVERSION) {
629 // look for version IMMEDIATELY //CO20180419
630 Arun = true;
631 cout << (XHOST.vflag_control.flag("WWW") ? aurostd::text2html(aflow::Banner("AFLOW_VERSION")) : aflow::Banner("AFLOW_VERSION"));
632 return 0;
633 }
634 if (!Arun && XHOST.TEST) {
635 Arun = true;
636 cerr << "test" << endl;
637 return 0;
638 } // CO20180419
639
640 if (!Arun && XHOST.argv.size() == 1 && (aurostd::substring2bool(XHOST.progname, "aflow") || aurostd::substring2bool(XHOST.progname, "aflowd"))) {
641 // Arun=true;AFLOW_main(argv);
642 Arun = true;
643 // cout << "******************************************************************************************************" << endl;
644 // cout << aflow::Banner("BANNER_TINY") << endl;
645 cout << aflow::Banner("BANNER_BIG") << endl;
646 cout << aflow::Intro_aflow("aflow") << endl;
647 cout << pflow::Intro_pflow("aflow") << endl;
648 cout << aflow::Intro_sflow("aflow") << endl;
649 cout << aflow::Intro_HELP("aflow") << endl;
650 cout << aflow::Banner("BANNER_BIG") << endl;
651 // cout << "XHOST.argv.size()=" << XHOST.argv.size()<< endl;
652 // cout << "******************************************************************************************************" << endl;
653 }
654
655 // **************************************************************
656 // LAST RESOURCE PFLOW
657 if (!Arun) {
658 Arun = true;
659 return_code = pflow::main(argv, cmds); // ME20200901 - use pflow::main return code for database handling
660 }
661 // **************************************************************
662 // END
663 curl_global_cleanup();
664 return (Arun ? return_code : 1); // Arun==true is 1, so flip because return 0 is normal //CO20190629 - more explicit return 0//ME20200901 - use return_code
665 } catch (aurostd::xerror &excpt) {
666 pflow::logger(excpt.whereFileName(), excpt.whereFunction(), excpt.buildMessageString(), oss, _LOGGER_ERROR_);
667 return excpt.whatCode();
668 }
669}
670
671// ***************************************************************************
672// AFLOW_main
673// ***************************************************************************
674int AFLOW_main(vector<string> &argv) {
675 if (!XHOST.QUIET) {
676 cout << aflow::Banner("INTRODUCTION");// << endl;
677 }
678 KBIN::KBIN_Main(argv);
679 // if(!XHOST.QUIET) cout << "MMMMM AFLOW VERSION " << string(AFLOW_VERSION) << " " << endl;
680 return 0; // 1; //CO20180419 - return 0 is normal
681}
682
683// ***************************************************************************
684// aflow::License_aflow
685// ***************************************************************************
686namespace aflow {
688 //(C) 2003-2023 Stefano Curtarolo, MIT-Duke University stefano@duke.edu
689 stringstream strstream;
690 strstream << endl;
691 strstream << "***************************************************************************" << endl;
692 strstream << "* *" << endl;
693 strstream << "* AFLOW - Duke University 2003-2024 *" << endl; // CO20200502 - SC -> AFLOW consortium
694 strstream << "* *" << endl;
695 strstream << "***************************************************************************" << endl;
696 strstream << "Copyright 2003-2023 - AFLOW.ORG consortium" << endl; // CO20200502 - SC -> AFLOW consortium
697 strstream << endl;
698 strstream << "This file is part of AFLOW software." << endl;
699 strstream << endl;
700 strstream << "AFLOW is free software: you can redistribute it and/or modify" << endl;
701 strstream << "it under the terms of the GNU General Public License as published by" << endl;
702 strstream << "the Free Software Foundation, either version 3 of the License, or" << endl;
703 strstream << "(at your option) any later version." << endl;
704 strstream << endl;
705 strstream << "This program is distributed in the hope that it will be useful," << endl;
706 strstream << "but WITHOUT ANY WARRANTY; without even the implied warranty of" << endl;
707 strstream << "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" << endl;
708 strstream << "GNU General Public License for more details." << endl;
709 strstream << endl;
710 strstream << "You should have received a copy of the GNU General Public License" << endl;
711 strstream << "along with this program. If not, see <http://www.gnu.org/licenses/>." << endl;
712 strstream << endl;
713 strstream << "***************************************************************************" << endl;
714 strstream << endl;
715 return strstream.str();
716 }
717} // namespace aflow
718
719// ***************************************************************************
720// aflow::Intro_aflow
721// ***************************************************************************
722// patched by CO20200106 to avoid long string construction (patching for indents)
723namespace aflow {
724 string Intro_aflow(string x) {
725 //(C) 2003-2023 Stefano Curtarolo, MIT-Duke University stefano@duke.edu
726 stringstream strstream;
727 const string tab = " ";
728 string xspaces;
729 for (size_t i = 0; i < x.size(); i++) {
730 xspaces += " ";
731 } // spaces size of x
732 strstream << endl;
733 strstream << "******* BEGIN INFORMATION MODE *********************************************************************" << endl;
734 strstream << tab << x << " -h|--help|--readme_aflow CHECK" << endl;
735 strstream << tab << x << " --version|-v CHECK" << endl;
736 strstream << tab << x << " --machine CHECK" << endl;
737 strstream << "******* END INFORMATION MODE ***********************************************************************" << endl;
738 strstream << endl;
739 strstream << "******* BEGIN RUNNING MODE *************************************************************************" << endl;
740 strstream << tab << x << " --run|--run=multi|--run=N COMMANDS for running" << endl;
741 strstream << tab << x << " --clean|-c COMMAND for cleaning " << endl;
742 strstream << endl;
743 strstream << " MODIFIERS" << endl;
744 strstream << tab << " --DIRECTORY[=| ]dir|--D[=| ]dir|--d[=| ]dir" << endl;
745 strstream << tab << " --FILE[=| ]file|--F[=| ]file|--f[=| ]file " << endl;
746 strstream << tab << " --quiet|-quiet|-q " << endl;
747 strstream << tab << " --loop " << endl;
748 strstream << tab << " --sort|-sort" << endl;
749 strstream << tab << " --reverse|-rsort" << endl;
750 strstream << tab << " --random|-rnd" << endl;
751 strstream << tab << " --force|-force" << endl;
752 strstream << tab << " --mem=XX|--maxmem=XX" << endl;
753 strstream << tab << " --readme= xaflow|aflow|aconvasp|aflowrc|scripting|apl|agl|ael|anrl|compare|gfa|symmetry|chull|errors|exceptions|frozsl CHECK !!!!" << endl;
754 strstream << tab << " --np=NUMBER|--npmax" << endl;
755 strstream << tab << " --generate_aflowin_from_vasp" << endl;
756 strstream << tab << " --generate_vasp_from_aflowin|--generate" << endl;
757 strstream << tab << " --use_aflow.in=XXX" << endl;
758 strstream << tab << " --use_LOCK=XXX" << endl;
759 strstream << tab << " --use_tmpfs=XXXX " << endl;
760 strstream << endl;
761 strstream << " MODIFIERS MPI/SERIAL PARAMETERS" << endl;
762 strstream << tab << " --mpi|-nompi|--serial " << endl;
763 strstream << endl;
764 strstream << " HOST ORIENTED OPTION" << endl;
765 strstream << tab << " --machine=beta|beta_openmpi|qrats|qflow|x|conrad|eos|materials|habana|aflowlib|ranger|kraken" << endl;
766 strstream << tab << " marylou|parsons|jellium|ohad|host1" << endl;
767 strstream << tab << " raptor --np=N|diamond --np=N" << endl;
768 strstream << tab << " --machine_name=XXXX " << endl;
769 strstream << "******* END RUNNING MODE ***************************************************************************" << endl;
770 strstream << endl;
771 // --readme=htresources
772 return strstream.str();
773 }
774} // namespace aflow
775
776// ***************************************************************************
777// aflow::Intro_sflow
778// ***************************************************************************
779// patched by CO20200106 to avoid long string construction (patching for indents)
780namespace aflow {
781 string Intro_sflow(string x) {
782 stringstream strstream;
783 const string tab = " ";
784 // string xspaces="";for(size_t i=0;i<x.size();i++){xspaces+=" ";} //spaces size of x
785 strstream << "******* BEGIN SCRIPTING MODE ***********************************************************************" << endl;
786 strstream << " AFLOW SCRIPTING COMMANDS" << endl;
787 strstream << tab << x << " --justafter=string" << endl;
788 strstream << tab << x << " --justbefore=string" << endl;
789 strstream << tab << x << " --justbetween=string_from[,string_to]" << endl;
790 strstream << tab << x << " --qsub=N,file" << endl;
791 strstream << tab << x << " --qdel=aaa,nnn:mmm,aaa,bbb,ccc" << endl;
792 strstream << tab << x << " --bsub=N,file" << endl;
793 strstream << tab << x << " --bkill=aaa,nnn:mmm,aaa,bbb,ccc" << endl;
794 strstream << tab << x << " --sbatch=N,file" << endl;
795 strstream << tab << x << " --scancel=aaa,nnn:mmm,aaa,bbb,ccc" << endl;
796 strstream << tab << x << " --kill=aaa,nnn:mmm,aaa,bbb,ccc" << endl;
797 strstream << tab << x << " --multi=sh [--np=NUMBER|npmax|nothing] [--F[ILE]] file" << endl;
798 strstream << tab << x << " --getTEMP [--runstat|--runbar|--refresh=X|--warning_beep=T|--warning_halt=T|--mem=XX]" << endl;
799 strstream << tab << x << " --monitor [--mem=XX]" << endl;
800 strstream << "******* END SCRIPTING MODE *************************************************************************" << endl;
801 strstream << endl;
802 return strstream.str();
803 }
804} // namespace aflow
805
806// ***************************************************************************
807// aflow::Intro_HELP
808// ***************************************************************************
809// patched by CO20200106 to avoid long string construction (patching for indents)
810namespace aflow {
811 string Intro_HELP(string x) {
812 stringstream strstream;
813 const string tab = " ";
814 string xspaces;
815 for (size_t i = 0; i < x.size(); i++) {
816 xspaces += " ";
817 } // xspacess size of x
818 strstream << "******* BEGIN HELP MODE ****************************************************************************" << endl;
819 strstream << " AFLOW HELP AVAILABLE HELPS" << endl;
820 strstream << tab << x << " --license" << endl;
821 strstream << tab << xspaces << " " << tab << "License information." << endl;
822 strstream << tab << x << " --help" << endl;
823 strstream << tab << xspaces << " " << tab << "This help." << endl;
824 strstream << tab << x << " --readme" << endl;
825 strstream << tab << xspaces << " " << tab << "The list of all the commands available." << endl;
826 strstream << tab << x << " --readme=xaflow" << endl;
827 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the installation of aflow." << endl;
828 strstream << tab << x << " --readme=aflow|--readme=run|--readme_aflow" << endl;
829 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"running machinery\"." << endl;
830 strstream << tab << x << " --readme=aflowrc" << endl;
831 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the installation of aflow." << endl;
832 strstream << tab << x << " --readme=pflow|--readme=processor|--readme=aconvasp|--readme_aconvasp" << endl;
833 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"processing machinery\"." << endl;
834 strstream << tab << x << " --readme=scripting|--readme_scripting" << endl;
835 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"scripting\" operations." << endl;
836 strstream << tab << x << " --readme=apl|--readme_apl" << endl;
837 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"aflow-harmonic-phonon-library\"." << endl;
838 strstream << tab << x << " --readme=qha|--readme_qha|--readme=qha3p|--readme_qha3p|--readme=scqha|--readme_scqha" << endl;
839 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"aflow-quasi-harmonic-library\"." << endl;
840 strstream << tab << x << " --readme=aapl|--readme_aapl" << endl;
841 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"aflow-anharmonic-phonon-library (AFLOW-AAPL)\"." << endl;
842 strstream << tab << x << " --readme=agl|--readme_agl" << endl;
843 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"aflow-gibbs-library (AFLOW-AGL)\"." << endl;
844 strstream << tab << x << " --readme=ael|--readme_ael" << endl;
845 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"aflow-elastic-library (AFLOW-AEL)\"." << endl;
846 strstream << tab << x << " --readme=prototypes|--readme_prototypes|--readme=anrl|--readme_anrl" << endl;
847 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"aflow library of prototypes\"." << endl;
848 strstream << tab << x << " --readme=xtalfinder|--readme_xtalfinder|--readme=compare|--readme_compare" << endl;
849 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"aflow-crystal-finder (AFLOW-XtalFinder) code\"." << endl;
850 strstream << tab << x << " --readme=gfa|--readme_gfa" << endl;
851 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"glass-forming-ability code\"." << endl;
852 strstream << tab << x << " --readme=symmetry|--readme_symmetry" << endl;
853 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"symmetry library (AFLOW-SYM)\"." << endl;
854 strstream << tab << x << " --readme=chull|--readme_chull" << endl;
855 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"convex hull library (AFLOW-hull)\"." << endl;
856 strstream << tab << x << " --readme=errors|--readme=exceptions|--readme_errors|--readme_exceptions" << endl;
857 strstream << tab << xspaces << " " << tab << "Returns the HELP information for exception handling in AFLOW." << endl;
858 strstream << tab << x << " --readme=partial_occupation|--readme=pocc|--readme_pocc" << endl;
859 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"partial occupation library\"." << endl;
860 strstream << tab << x << " --readme=frozsl|--readme_frozsl" << endl;
861 strstream << tab << xspaces << " " << tab << "Returns the HELP information for the \"frozsl\" add ons." << endl;
862 strstream << "******* END HELP MODE ******************************************************************************" << endl;
863 strstream << endl;
864 return strstream.str();
865 }
866} // namespace aflow
867
868// ***************************************************************************
869// aflow::Banner
870// ***************************************************************************
871namespace aflow {
872 string Banner(string type) {
873 stringstream oss;
874 if (type == "VERSION" || type == "AFLOW_VERSION") {
875 oss << "" << endl;
876 oss << "AFLOW VERSION " << string(AFLOW_VERSION) << " Automatic-FLOW [(C) " << XHOST.Copyright_Years << " aflow.org consortium]" << endl;
877 oss << "New versions are available here: <http://" << XHOST.AFLOW_MATERIALS_SERVER << "/AFLOW/>" << endl;
878 oss << "" << endl;
879 oss << "AFLOW is free software: you can redistribute it and/or modify it under the terms of the" << endl;
880 oss << "GNU General Public License as published by the Free Software Foundation, either version 3" << endl;
881 oss << "of the License, or (at your option) any later version." << endl;
882 oss << "" << endl;
883 oss << "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;" << endl;
884 oss << "without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." << endl;
885 oss << "See the GNU General Public License for more details." << endl;
886 oss << "" << endl;
887 oss << "You should have received a copy of the GNU General Public License along with this program." << endl;
888 oss << "If not, see <http://www.gnu.org/licenses/>." << endl;
889 oss << "" << endl;
890 oss << "AFLOW V" << string(AFLOW_VERSION) << " [" << XHOST.hostname << "] [" << XHOST.machine_type << "] [" << XHOST.CPU_Cores << "] [" << XHOST.Find_Parameters << "]" << endl;
891 // oss << endl;
892 return oss.str();
893 }
894 if (type == "INTRODUCTION") {
895 stringstream oss;
896 oss << "MMMMM AFLOW VERSION " << string(AFLOW_VERSION) << " Automatic-FLOW for materials discovery - [" << TODAY << "] -" << aflow_get_time_string() << endl;
897 // oss << "MMMMM AFLOW VERSION " << aurostd::PaddedPOST(string(AFLOW_VERSION),5) <<" - BUILT ["<<TODAY<<"] - (C) " << XHOST.Copyright_Years << " " << endl;
898 oss << "MMMMM AFLOW.org consortium - High-Throughput ab-initio Computing Project - (C) " << XHOST.Copyright_Years << " " << endl;
899 oss << "MMMMM ";// << endl;
900 oss << "MMMMM AFLOW is free software: you can redistribute it and/or modify it under the terms of the" << endl;
901 oss << "MMMMM GNU General Public License as published by the Free Software Foundation, either version 3" << endl;
902 oss << "MMMMM of the License, or (at your option) any later version." << endl;
903 oss << "MMMMM " << endl;
904 oss << "MMMMM This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;" << endl;
905 oss << "MMMMM without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." << endl;
906 oss << "MMMMM See the GNU General Public License for more details." << endl;
907 oss << "MMMMM " << endl;
908 oss << "MMMMM You should have received a copy of the GNU General Public License along with this program." << endl;
909 oss << "MMMMM If not, see <http://www.gnu.org/licenses/>." << endl;
910 oss << "MMMMM " << endl;
911 return oss.str();
912 }
913 if (type == "BANNER_NORMAL") {
914 oss << "****************************************************************************************************" << endl;
915 oss << "MMMMM AFLOW V" << string(AFLOW_VERSION) << " Automatic-FLOW [" << TODAY << "] - " << endl; // << aflow_get_time_string() << endl; //CO
916 oss << "****************************************************************************************************" << endl;
917 return oss.str();
918 }
919 if (type == "BANNER_BIG") {
920 oss << "****************************************************************************************************" << endl;
921 oss << "* *" << endl;
922 oss << "* aflow - Automatic-FLOW for materials discovery *" << endl;
923 oss << "* aflow.org consortium - High-Throughput ab-initio Computing Project *" << endl;
924 oss << "*"
925 << aurostd::PaddedCENTER(string("version " + string(AFLOW_VERSION) + " - g++/gcc " + aurostd::utype2string(__GNUC__) + "." + aurostd::utype2string(__GNUC_MINOR__) + "." +
926 aurostd::utype2string(__GNUC_PATCHLEVEL__) + " - built [" + string(TODAY) + "] - (C) " + XHOST.Copyright_Years),
927 100)
928 << "*" << endl;
929 oss << "* *" << endl;
930 oss << "****************************************************************************************************" << endl;
931 oss << "* *" << endl;
932 oss << "* AFLOW is free software: you can redistribute it and/or modify it under the terms of the *" << endl;
933 oss << "* GNU General Public License as published by the Free Software Foundation, either version 3 *" << endl;
934 oss << "* of the License, or (at your option) any later version. *" << endl;
935 oss << "* *" << endl;
936 oss << "* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; *" << endl;
937 oss << "* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *" << endl;
938 oss << "* See the GNU General Public License for more details. *" << endl;
939 oss << "* *" << endl;
940 oss << "* You should have received a copy of the GNU General Public License along with this program. *" << endl;
941 oss << "* If not, see <http://www.gnu.org/licenses/>. *" << endl;
942 oss << "* *" << endl;
943 oss << "****************************************************************************************************" << endl;
944 oss << "* *" << endl;
945 oss << "* Use of AFLOW software and repositories welcomes references to the following publications: *" << endl;
946 oss << "* *" << endl;
947 oss << "* Eckert et al. npj Comput. Mater. 11, 40 (2025) 10.1038/s41524-025-01529-1 (Soliquidy) *" << endl;
948 oss << "* Eckert et al. Comp. Mat. Sci. 240, 112988 (2024) 10.1016/j.commatsci.2024.112988 (proto4) *" << endl;
949 oss << "* Divilov et al. Acta Mater. 266, 119667 (2024) 10.1016/j.actamat.2024.119667 (spinodal) *" << endl;
950 oss << "* Divilov et al. Nature 625, 66-73 (2024) 10.1038/s41586-023-06786-y (DEED) *" << endl;
951 oss << "* Friedrich et al. J. Chem. Phys. 160, 042501 (2024) 10.1063/5.0184917 (CCE2) *" << endl;
952 oss << "* Esters et al. Comp. Mat. Sci. 216, 111808 (2023) 10.1016/j.commatsci.2022.111808 (AFLOW.org) *" << endl;
953 oss << "* Oses et al. Comp. Mat. Sci. 217, 111889 (2023) 10.1016/j.commatsci.2022.111889 (aflow++) *" << endl;
954 oss << "* Friedrich et al. npj Comput. Mater. 5, 59 (2019) 10.1038/s41524-019-0192-1 (CCE) *" << endl;
955 oss << "* Hicks et al. Comp. Mat. Sci. 161, S1 (2019) 10.1016/j.commatsci.2018.10.043 (ANRL proto2) *" << endl;
956 oss << "* Oses et al. J. Chem. Inf. Model. (2018) 10.1021/acs.jcim.8b00393 (AFLOW-CHULL) *" << endl;
957 oss << "* Gossett et al. Comp. Mat. Sci. 152, 134 (2018) 10.1016/j.commatsci.2018.03.075 (AFLOW-ML) *" << endl;
958 oss << "* Hicks et al. Acta Cryst. A74, 184-203 (2018) 10.1107/S2053273318003066 (AFLOW-SYM) *" << endl;
959 oss << "* MBNardelli et al Comp. Mat. Sci. 143, 462 (2018) 10.1016/j.commatsci.2017.11.034 (PAOFLOW) *" << endl;
960 oss << "* Rose et al. Comp. Mat. Sci. 137, 362 (2017) 10.1016/j.commatsci.2017.04.036 (AFLUX lang) *" << endl;
961 oss << "* Supka et al. Comp. Mat. Sci. 136, 76 (2017) 10.1016/j.commatsci.2017.03.055 (AFLOWpi) *" << endl;
962 oss << "* Plata et al. npj Comput. Mater. 3, 45 (2017) 10.1038/s41524-017-0046-7 (AAPL kappa) *" << endl;
963 oss << "* Toher et al. Phys. Rev.Mater.1, 015401 (2017) 10.1103/PhysRevMaterials.1.015401 (AEL elast) *" << endl;
964 oss << "* Mehl et al. Comp. Mat. Sci. 136, S1 (2017) 10.1016/j.commatsci.2017.01.017 (ANRL proto1) *" << endl;
965 oss << "* Calderon et al. Comp. Mat. Sci. 108A, 233 (2015) 10.1016/j.commatsci.2015.07.019 (standard) *" << endl;
966 oss << "* Toher et al. Phys. Rev. B 90, 174107 (2014) 10.1103/PhysRevB.90.174107 (AGL Gibbs) *" << endl;
967 oss << "* Taylor et al. Comp. Mat. Sci. 93, 178 (2014) 10.1016/j.commatsci.2014.05.014 (REST-API) *" << endl;
968 oss << "* Curtarolo et al. Comp. Mat. Sci. 58, 227 (2012) 10.1016/j.commatsci.2012.02.002 (AFLOW.org) *" << endl;
969 oss << "* Curtarolo et al. Comp. Mat. Sci. 58, 218 (2012) 10.1016/j.commatsci.2012.02.005 (AFLOW C++) *" << endl;
970 oss << "* *" << endl;
971 oss << "****************************************************************************************************" << endl;
972 oss << "* *" << endl;
973 oss << "*" << aurostd::PaddedCENTER(string("aflow/aflow.org - CONTRIBUTORS"), 100) << "*" << endl;
974 oss << "* 2000-2019 Stefano Curtarolo (aflow); 2002-2004 Dane Morgan (convasp); 2007-2011 Wahyu Setyawan *" << endl;
975 oss << "* (--rsm --edos --kband --icsd*); 2008-2011 Roman Chepulskyy (--edos --kband surfaces); *" << endl;
976 oss << "* 2008 Gus Hart (lattice reductions - prototypes); 2009-2011, Ohad Levy (prototypes); *" << endl;
977 oss << "* 2009-2010, Michal Jahnatek (APL); 2010-2013 Shidong Wang (cluster expansion); 2010-2013 *" << endl;
978 oss << "* Richard Taylor (surfaces, apennsy); 2010-2013 Junkai Xue (prototyper); 2010-2013 Kesong Yang *" << endl;
979 oss << "* (findsym, frozsl, plotband/dos); 2013-2019 Cormac Toher (AGL Debye-Gruneisen, AEL elastic); *" << endl;
980 oss << "* 2013-2019 Frisco Rose (API, Aflux); 2013-2018 Pinku Nath (Quasi-harmonic approximation); *" << endl;
981 oss << "* 2013-2017 Jose J. Plata (AAPL, thermal cond.); 2014-2019 David Hicks (symmetry, structure *" << endl;
982 oss << "* comparison, prototypes); 2014-2019 Corey Oses (Egap, bader, chull, APL, pocc); 2018-2019 Marco *" << endl;
983 oss << "* Esters (AAPL, thermal cond.); 2016-2019 Denise Ford (GFA); 2018-2019 Rico Friedrich (CCE); *" << endl;
984 oss << "* 2021-2023 Simon Divilov (QCA, fitting); 2021-2023 Hagen Eckert (GFA, entry loader, JSON); *" << endl;
985 oss << "* *" << endl;
986 oss << "****************************************************************************************************" << endl;
987 oss << "*"
988 << aurostd::PaddedCENTER(string("version " + string(AFLOW_VERSION) + " - g++/gcc " + aurostd::utype2string(__GNUC__) + "." + aurostd::utype2string(__GNUC_MINOR__) + "." +
989 aurostd::utype2string(__GNUC_PATCHLEVEL__) + " - built [" + string(TODAY) + "] - (C) " + XHOST.Copyright_Years),
990 100)
991 << "*" << endl;
992 oss << "****************************************************************************************************" << endl;
993 return oss.str();
994 }
995 if (type == "BANNER_TINY") {
996 // called 63 times
997 oss << "AFLOW VERSION " << AFLOW_VERSION << ": [aflow.org consortium - 2003-2023] ";
998 return oss.str();
999 }
1000 if (type == "EXCEPTIONS") {
1001 oss << "List of AFLOW exceptions with error codes. See README_AFLOW_EXCEPTIONS.TXT for more information" << endl;
1002 oss << endl;
1003 oss << "----------------------------------------------------------------------------------------------------" << endl;
1004 oss << "Error Code Error Type Error Name of Constant " << endl;
1005 oss << "----------------------------------------------------------------------------------------------------" << endl;
1006 oss << " 1 N/A Generic error _GENERIC_ERROR_ " << endl;
1007 oss << " 2 Illegal error code _ILLEGAL_CODE_ " << endl;
1008 oss << " 10 Input Error generic _INPUT_ERROR_ " << endl;
1009 oss << " 11 unknown flag _INPUT_UNKNOWN_ " << endl;
1010 oss << " 12 missing flag _INPUT_MISSING_ " << endl;
1011 oss << " 13 input ambiguous _INPUT_AMBIGUOUS_ " << endl;
1012 oss << " 14 illegal parameter _INPUT_ILLEGAL_ " << endl;
1013 oss << " 15 number of parameters _INPUT_NUMBER_ " << endl;
1014 oss << " 20 File Error generic _FILE_ERROR_ " << endl;
1015 oss << " 21 file not found _FILE_NOT_FOUND_ " << endl;
1016 oss << " 22 wrong format _FILE_WRONG_FORMAT_ " << endl;
1017 oss << " 23 file corrupt _FILE_CORRUPT_ " << endl;
1018 oss << " 30 Value Error generic _VALUE_ERROR_ " << endl;
1019 oss << " 31 illegal value _VALUE_ILLEGAL_ " << endl;
1020 oss << " 32 out of range _VALUE_RANGE_ " << endl;
1021 oss << " 40 Index Error generic _INDEX_ERROR_ " << endl;
1022 oss << " 41 illegal value _INDEX_ILLEGAL_ " << endl;
1023 oss << " 42 out of bounds _INDEX_BOUNDS_ " << endl;
1024 oss << " 43 mismatch _INDEX_MISMATCH_ " << endl;
1025 oss << " 50 Runtime Error generic _RUNTIME_ERROR_ " << endl;
1026 oss << " 51 not initialized _RUNTIME_INIT_ " << endl;
1027 oss << " 52 SQL error _RUNTIME_SQL_ " << endl;
1028 oss << " 53 busy _RUNTIME_BUSY_ " << endl;
1029 oss << " 54 external command not found _RUNTIME_EXTERNAL_MISS_ " << endl; // CO20200531
1030 oss << " 55 external command failed _RUNTIME_EXTERNAL_FAIL_ " << endl; // CO20200531
1031 oss << " 60 Allocation Error generic _ALLOC_ERROR_ " << endl;
1032 oss << " 61 could not allocate memory _ALLOC_ALLOCATE_ " << endl;
1033 oss << " 62 insufficient memory _ALLOC_INSUFFICIENT_ " << endl;
1034 oss << "----------------------------------------------------------------------------------------------------" << endl;
1035 return oss.str();
1036 }
1037 cerr << XPID << "aflow::Banner type=" << type << " not found..." << endl;
1038 oss << "aflow::Banner type=" << type << " not found..." << endl;
1039 return oss.str();
1040 }
1041} // namespace aflow
1042
1043// ***************************************************************************
1044// * *
1045// * aflow - Automatic FLOW for materials discovery project *
1046// * *
1047// ***************************************************************************
1048
1049// Update Mon Mar 7 14:05:40 EST 2011 (by WSETYAWAN):
1050// ICSD prototypes of compounds used in aflow are generated using the following
1051// command:
1052// xzcat /common/NIST/$1ary.icsd.xz | pflow --icsd_nobrokenbasis |
1053// pflow --icsd_nopartialocc | pflow --icsd2proto > README_LIBRARY_ICSD$1.TXT
1054
1055// #include "AFLOW3_AURO/aflow_auro.cpp"
1056
1057// ***************************************************************************
1058#ifndef _AFLOW_AURO_CPP_
1059
1060#endif
1061
1062// ***************************************************************************
1063// * *
1064// * aflow - Automatic FLOW for materials discovery project *
1065// * *
1066// ***************************************************************************
int main(int _argc, char **_argv)
Definition aflow.cpp:78
int AFLOW_main(vector< string > &argv)
Definition aflow.cpp:674
static const std::vector< std::string > BRAVAIS_LATTICES
Definition aflow.h:60
uint xPOTCAR_Initialize()
double det(const xvector< double > &v1, const xvector< double > &v2, const xvector< double > &v3)
#define DEFAULT_KZIP_EXT
#define IOAFLOW_AUTO
Definition aflow_defs.h:216
void AFLOW_monitor_VASP()
uint AFLOW_monitor(const vector< string > &argv)
uint AFLOW_getTEMP(const vector< string > &argv)
_XHOST XHOST
#define XPID
Definition aflow_xhost.h:17
unsigned uint
Definition aurostd.h:39
#define __AFLOW_FILE__
Definition aurostd.h:44
#define __AFLOW_FUNC__
Definition aurostd.h:43
string aflow_get_time_string()
#define _RUNTIME_ERROR_
std::string buildMessageString()
std::string whereFileName()
std::string whereFunction()
void setmat(const xmatrix< utype > &mat, int irow=1, int icol=1)
void setcol(const xvector< utype > &col, int icol=1)
void getxmatInPlace(xmatrix< utype > &mat_out, int lrow, int urow, int lcol, int ucol, int lrows_out=1, int lcols_out=1) const
Convert xmatrix into a submatrix given a set of indices.
void setrow(const xvector< utype > &row, int irow=1)
bool args2addattachedscheme(std::vector< std::string > &argv, const std::string scheme, const std::string &_s_search, std::string string_default)
std::string getattachedscheme(const std::string &scheme) const
bool GetPropertiesUrlFile(const std::string &url, const std::string &file, bool=true)
std::vector< std::string > vcontent
Definition aflow.h:872
bool GetPropertiesUrlFile(const std::string &url, const std::string &file, bool=true)
std::vector< std::string > vcontent
Definition aflow.h:962
std::vector< std::string > vcontent
Definition aflow.h:663
bool GetPropertiesUrlFile(const std::string &url, const std::string &file, bool=true)
int KBIN_Main(std::vector< std::string > argv)
string Intro_sflow(string x)
Definition aflow.cpp:781
string Intro_aflow(string x)
Definition aflow.cpp:724
string Banner(string type)
Definition aflow.cpp:872
string License_Preamble_aflow()
Definition aflow.cpp:687
string Intro_HELP(string x)
Definition aflow.cpp:811
std::string get_content(const std::string &filename, const std::string &collection)
get the content of an embedded file
void StringSubstInPlace(string &work_string, const string &old_string, const string &new_string)
substitute parts of a strings in place
string text2html(const string &str) __xprototype
string PaddedCENTER(utype, int, string=" ")
double ran0()
uint string2tokens(const string &str, vector< string > &tokens, const string &delimiters=" ", bool consecutive=false) __xprototype
string PaddedPOST(utype, int, string=" ")
bool args2flag(const vector< string > &argv, const string &s0)
string utype2string(const utype &from, int precision=AUROSTD_DEFAULT_PRECISION, char FORMAT=DEFAULT_STREAM) __xprototype
vector< string > get_arguments_from_input(int _argc, char **_argv)
string args2attachedutype(const vector< string > &argv, const string &s0, const string &s_def)
bool args2attachedflag(const vector< string > &argv, const string &s0)
bool bin2base64(const std::string &b_file, std::string &b64String)
string args2attachedstring(const vector< string > &argv, const string &s0, string s_def)
vector< string > args2vectorstring(const vector< string > &argv, const string &s0, const string &s_def)
bool substring2bool(const string &strstream, const string &strsub1, bool RemoveWS=false, bool RemoveComments=true)
int InitMachine(bool INIT_VERBOSE, vector< string > &argv, vector< string > &cmds, std::ostream &oss)
void logger(const string &filename, const string &function_name, stringstream &message, const char &type, ostream &oss, bool silent, const string &message_metadata)
int main(vector< string > &argv, vector< string > &cmds)
string Intro_pflow(string x)
void Initialize()