AFLOW
 
Loading...
Searching...
No Matches
aflow_aconvasp_main.cpp
Go to the documentation of this file.
1// ***************************************************************************
2// * *
3// * Aflow STEFANO CURTAROLO - Duke University 2003-2024 *
4// * *
5// ***************************************************************************
6// Stefano Curtarolo
7// Dane Morgan (up to 2003)
8// Wahyu Setyawan (up to 2009)
9
10#ifndef _AFLOW_PFLOW_MAIN_CPP_
11#define _AFLOW_PFLOW_MAIN_CPP_
12
13#include <algorithm>
14#include <cctype>
15#include <cmath>
16#include <cstdio>
17#include <cstdlib>
18#include <cstring>
19#include <ctime>
20#include <deque>
21#include <filesystem>
22#include <fstream>
23#include <functional>
24#include <iomanip>
25#include <ios>
26#include <iostream>
27#include <istream>
28#include <ostream>
29#include <regex>
30#include <sstream>
31#include <string>
32#include <vector>
33
34#include <stdlib.h>
35
36#include "AUROSTD/aurostd.h"
49
50#include "aflow.h"
51#include "aflow_aflowrc.h"
52#include "aflow_defs.h"
53#include "aflow_init.h"
54#include "aflow_xhost.h"
55#include "aflowlib/aflowlib_database.h"
56#include "aflowlib/aflowlib_libraries.h"
57#include "aflowlib/aflowlib_web_interface.h"
58#include "flow/aflow_avasp.h"
59#include "flow/aflow_bader.h"
60#include "flow/aflow_ivasp.h"
61#include "flow/aflow_kvasp.h"
62#include "flow/aflow_pflow.h"
63#include "flow/aflow_support_types.h"
64#include "flow/aflow_xclasses.h"
65#include "interfaces/aflow_pthreads.h"
66#include "modules/APL/aflow_apl.h" //ME20200330
67#include "modules/CCE/aflow_cce.h" //RF20200203
68#include "modules/COMPARE/aflow_compare_structure.h" //DX20181023
69#include "modules/GFA/aflow_gfa.h" //DF20190329
70#include "modules/HULL/aflow_chull.h"
71#include "modules/POCC/aflow_pocc.h" //CO20181226
72#include "modules/POCC/aflow_pocc_old.h"
73#include "modules/PROTOTYPES/aflow_anrl.h"
74#include "modules/QCA/aflow_qca.h" //SD20220323
75#include "modules/SYM/aflow_spacegroup.h"
76#include "modules/SYM/aflow_symmetry.h"
77#include "modules/SYM/aflow_symmetry_spacegroup.h"
78#include "modules/SYM/aflow_wyckoff.h"
79#include "structure/aflow_defects.h"
80#include "structure/aflow_lattice.h"
81#include "structure/aflow_surface.h"
82#include "structure/aflow_xatom.h"
83#include "structure/aflow_xstructure.h"
84
85using std::cerr;
86using std::cin;
87using std::cout;
88using std::deque;
89using std::endl;
90using std::ifstream;
91using std::istream;
92using std::istringstream;
93using std::ofstream;
94using std::ostream;
95using std::ostringstream;
96using std::setprecision;
97using std::setw;
98using std::stringstream;
99using std::vector;
100
101using aurostd::xmatrix;
102using aurostd::xvector;
103
104extern double NearestNeighbor(const xstructure& a);
105
106// ***************************************************************************
107
108uint PflowARGs(vector<string>& argv, vector<string>& cmds, aurostd::xoption& vpflow) { // vpflow is really XHOST.vflag_pflow
109 const bool LDEBUG = (false || XHOST.DEBUG);
110 // GENERAL STUFF
111
112 vpflow.flag("PFLOW_HELP", aurostd::args2flag(argv, cmds, "--HELP|--help"));
113 vpflow.flag("PROTOS", (aurostd::args2flag(argv, cmds, "--protos|--prototypes") || aurostd::args2flag(argv, cmds, "--proto")));// && (argv.size()==2));
114
115 vpflow.args2addattachedscheme(argv, cmds, "PROTOS_ICSD", "--protos_icsd=|--prototypes_icsd=", "");
116
117 if (!vpflow.flag("PROTOS_ICSD")) {
118 vpflow.flag("PROTOS_ICSD", aurostd::args2flag(argv, cmds, "--protos_icsd|--prototypes_icsd"));
119 }
120
121 // bool XXX=aurostd::args2flag(argv,cmds,"--xxx") && argv.at(1)=="--xxx";
122 // bool YYY=aurostd::args2flag(argv,cmds,"--yyy");
123
124 vpflow.flag("ACE", aurostd::args2flag(argv, cmds, "--ace"));
125 // DX20170818 - Added tolerance and no_scan options to Xgroups - START
126 vpflow.args2addattachedscheme(argv, cmds, "AGROUP", "--sitepointgroup=|--agroup=", "");
127 if (vpflow.flag("AGROUP")) {
128 vpflow.flag("SYMMETRY::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
129 if (aurostd::args2attachedflag(argv, "--sitepointgroup=|--agroup=")) { // DX20170803
130 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::TOLERANCE", "--sitepointgroup=|--agroup=", ""); // DX20200907 - default is system specific, leaving empty
131 }
132 vpflow.flag("SYMMETRY::SCREEN_ONLY", aurostd::args2flag(argv, cmds, "--screen_only")); // DX20170803
133 // DX20170921 - MAGNETIC SYMMETRY - START
134 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::MAGNETIC", "--mag=|--magnetic=|--magmom=", ""); // DX20170803
135 // DX20170921 - MAGNETIC SYMMETRY - END
136 // ME20210206 - web mode
137 if (XHOST.vflag_control.flag("WWW")) {
138 vpflow.flag("SYMMETRY::SCREEN_ONLY", true);
139 XHOST.QUIET = true;
140 }
141 }
142 // DX20170818 - Added tolerance and no_scan options to Xgroups - END
143 vpflow.flag("AGROUP2", aurostd::args2flag(argv, cmds, "--sitepointgroup2|--agroup2"));
144 vpflow.flag("AGROUP2m", aurostd::args2flag(argv, cmds, "--sitepointgroup2m|--agroup2m"));
145 vpflow.flag("AFLOWIN", aurostd::args2flag(argv, cmds, "--aflowin"));
146 vpflow.flag("ALPHABETIC", aurostd::args2flag(argv, cmds, "--alpha|--alphabetic"));
147 vpflow.args2addattachedscheme(argv, cmds, "ALPHA_COMPOUND", "--alpha_compound=|--alpha_compounds=", "");
148 vpflow.args2addattachedscheme(argv, cmds, "ALPHA_SPECIES", "--alpha_species=|--alpha_specie=", "");
149 vpflow.args2addattachedscheme(argv, cmds, "ANGLES", "--angle=|--angles=", "0.0");
150
151 vpflow.args2addattachedscheme(argv, cmds, "AFLOWLIB::ENTRY_JSON", "--aflowlib2=|--aflowlib=", ""); // SC20190812
152 vpflow.args2addattachedscheme(argv, cmds, "AFLOWLIB_AUID2AURL", "--aflowlib_auid2aurl=|--auid2aurl=", "");
153 vpflow.args2addattachedscheme(argv, cmds, "AFLOWLIB_AURL2AUID", "--aflowlib_aurl2auid=|--aurl2auid=", "");
154 vpflow.args2addattachedscheme(argv, cmds, "AFLOWLIB_AUID2LOOP", "--aflowlib_auid2loop=|--auid2loop=", "");
155 vpflow.args2addattachedscheme(argv, cmds, "AFLOWLIB_AURL2LOOP", "--aflowlib_aurl2loop=|--aurl2loop=", "");
156
157 vpflow.flag("AFLOWSYM_PYTHON", aurostd::args2attachedflag(argv, cmds, "--aflow_sym_python|--aflowsym_python")); // DX20210202
158
159 // DX20190206 - add AFLUX functionality to command line - START
160 vpflow.args2addattachedscheme(argv, cmds, "AFLUX::SUMMONS", "--aflux=", ""); // CO20200520 - AFLUX::SUMMONS
161 if (vpflow.flag("AFLUX::SUMMONS")) { // CO20200520 - AFLUX::SUMMONS
162 vpflow.flag("AFLUX::USAGE", aurostd::args2flag(argv, cmds, "--usage"));
163 }
164 // DX20190206 - add AFLUX functionality to command line - END
165 vpflow.flag("ANALYZEDB", aurostd::args2flag(argv, cmds, "--analyze_database")); // ME20191001
166
167 // Commands for serializing bands and DOS data to JSON
168 vpflow.args2addattachedscheme(argv, cmds, "DOSDATA2JSON", "--dosdata2json=", "./"); // EG
169 if (vpflow.flag("DOSDATA2JSON")) {
170 vpflow.args2addattachedscheme(argv, cmds, "DOSDATA2JSON::PARAMS", "--dos_parameters=", "");
171 } // CO20180214 removed params confusion
172 vpflow.args2addattachedscheme(argv, cmds, "BANDSDATA2JSON", "--bandsdata2json=", "./"); // EG
173 // End commands
174
175 vpflow.flag("STRUCTURE2JSON", aurostd::args2flag(argv, cmds, "--structure2json|--struct2json")); // DX20190508
176
177 // CO
178 vpflow.flag("BADER", aurostd::args2flag(argv, cmds, "--bader"));
179 if (vpflow.flag("BADER")) { // CO
180 // manage directory, ASSUME LOCAL IF NOT SPECIFIED
181 if (XHOST.vflag_control.flag("DIRECTORY")) {
182 vpflow.push_attached("BADER::DIRECTORY", XHOST.vflag_control.getattachedscheme("DIRECTORY"));
183 } else {
184 vpflow.push_attached("BADER::DIRECTORY", ".");
185 }
186 // XHOST.vflag_control.getattachedscheme("DIRECTORY"); //this is not doing anything //CO20190520
187 vpflow.flag("BADER::USAGE", aurostd::args2flag(argv, cmds, "--usage")); // usage
188 vpflow.flag("BADER::CRITICAL_POINTS", aurostd::args2flag(argv, cmds, "--critical_points|--cp")); // critical points
189 vpflow.args2addattachedscheme(argv, cmds, "BADER::CALCULATE", "--calculate=|--calc=", ""); // -c
190 vpflow.args2addattachedscheme(argv, cmds, "BADER::NOCALCULATE", "--nocalculate=|--nocalc=", ""); // -n
191 vpflow.args2addattachedscheme(argv, cmds, "BADER::PARTITION", "--partition=|--part=", ""); // -b
192 vpflow.args2addattachedscheme(argv, cmds, "BADER::REFINE_EDGE_METHOD", "--refine_edge_method=|--rem=|--r=", ""); // -r
193 vpflow.args2addattachedscheme(argv, cmds, "BADER::REFERENCE", "--reference=|--ref=", ""); // -ref
194 vpflow.args2addattachedscheme(argv, cmds, "BADER::VACUUM", "--vacuum=|--vac=", ""); // -vac
195 vpflow.args2addattachedscheme(argv, cmds, "BADER::TERMINATE", "--terminate=|--term=", ""); // -m
196 vpflow.args2addattachedscheme(argv, cmds, "BADER::PRINT_ALL", "--print_all=", ""); // -p all_atom | -p all_bader
197 vpflow.args2addattachedscheme(argv, cmds, "BADER::PRINT_INDEX", "--print_index=|--print_idx=", ""); // -p sel_atom | -p sel_bader
198 vpflow.args2addattachedscheme(argv, cmds, "BADER::PRINT_SELECT_ATOM", "--print_select_atom=|--print_sel_atom=", ""); // -p sel_atom
199 vpflow.args2addattachedscheme(argv, cmds, "BADER::PRINT_SELECT_BADER", "--print_select_bader=|--print_sel_bader=", ""); // -p sel_bader
200 vpflow.args2addattachedscheme(argv, cmds, "BADER::PRINT_SUM_ATOM", "--print_sum_atom=", ""); // -p sum_atom
201 vpflow.args2addattachedscheme(argv, cmds, "BADER::PRINT_SUM_BADER", "--print_sum_bader=", ""); // -p sum_bader
202 vpflow.flag("BADER::QUIET", aurostd::args2flag(argv, cmds, "--quiet|--q")); // quiets output
203 vpflow.flag("BADER::CONSOLIDATE_ATOMS2SPECIES", aurostd::args2flag(argv, cmds, "--consolidate_atoms2species|--a2s")); // quiets output
204 if (vpflow.flag("BADER::CONSOLIDATE_ATOMS2SPECIES")) {
205 // we can consolidate and delete summing chgcars
206 vpflow.flag("BADER::REMOVE_BADER_ATOMS", aurostd::args2flag(argv, cmds, "--remove_bader_atoms|--rba")); // keep only consolidated files
207 }
208 vpflow.args2addattachedscheme(argv, cmds, "BADER::JVXL_ALL_SPECIES", "--jvxl_all_species=|--jvxl=", ""); // allows jvxl output for atoms2species
209 if (vpflow.flag("BADER::JVXL_ALL_SPECIES")) {
210 // when jvxl-ing, we can just remove summing chgcars and keep full consolidated chgcar, or delete all and just keep jvxl
211 vpflow.flag("BADER::REMOVE_BADER_ATOMS", aurostd::args2flag(argv, cmds, "--remove_bader_atoms|--rba")); // keep only consolidated files
212 vpflow.flag("BADER::KEEP::JVXL_ONLY", aurostd::args2flag(argv, cmds, "--keep=jvxl_only|--keep_jvxl_only|--jvxl_only")); // removes consolidated chgcar_files, keeps only jvxl
213 }
214 }
215
216 vpflow.args2addattachedscheme(argv, cmds, "BANDS", "--bands=", "");
217
218 vpflow.flag("BANDSTRUCTURE", aurostd::args2flag(argv, cmds, "--bandstructure|--bandsstructures|--bands_structures|--band_structures|--bands_structure|--band_structure|--bs"));
219 vpflow.flag("BZPLOT", aurostd::args2flag(argv, cmds, "--plotbz|--bzplot"));
220 vpflow.args2addattachedscheme(argv, cmds, "BZPLOTUSEKPOINTS", "--bzplotuseKPOINTS=|--bzplotdusekpoints=", "");
221 vpflow.flag("BZPLOTDATA", aurostd::args2flag(argv, cmds, "--bzplotdata"));
222 vpflow.args2addattachedscheme(argv, cmds, "BZPLOTDATAUSEKPOINTS", "--bzplotdatauseKPOINTS=|--bzplotdatausekpoints=", "");
223
224 vpflow.args2addattachedscheme(argv, cmds, "FIX_BANDS", "--fix_bands=", "");
225
226 // DX+CO START
227
228 vpflow.args2addattachedscheme(argv, cmds, "FULLSYMMETRY", "--aflow-sym=|--AFLOW-SYM=|--AFLOWSYM=|--aflowSYM=|--aflowsym=|--full_symmetry=|--full_sym=|--fullsym=", ""); // DX20170803 Added other aliases
229 if (vpflow.flag("FULLSYMMETRY")) {
230 vpflow.flag("FULLSYMMETRY::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
231 if (aurostd::args2attachedflag(argv, "--aflow-sym=|--AFLOW-SYM=|--AFLOWSYM=|--aflowSYM=|--aflowsym=|--full_symmetry=|--full_sym=|--fullsym=")) { // DX20170803
232 vpflow.args2addattachedscheme(argv, cmds, "FULLSYMMETRY::TOLERANCE",
233 "--aflow-sym=|--AFLOW-SYM=|--AFLOWSYM=|--aflowSYM=|--aflowsym=|--full_symmetry=|--full_sym=|--fullsym=", ""); // DX20170803 //DX20200907 - default is system specific, leaving empty
234 }
235 vpflow.flag("FULLSYMMETRY::SCREEN_ONLY", aurostd::args2flag(argv, cmds, "--screen_only")); // DX20170803
236 // DX20170921 - MAGNETIC SYMMETRY - START
237 vpflow.args2addattachedscheme(argv, cmds, "FULLSYMMETRY::MAGNETIC", "--mag=|--magnetic=|--magmom=", ""); // DX20170803
238 // DX20170921 - MAGNETIC SYMMETRY - END
239 }
240 // DX+CO END
241
242 vpflow.flag("BANDGAP_WAHYU", aurostd::args2flag(argv, cmds, "--bandgap_wahyu|--gap_wahyu"));
243 vpflow.args2addattachedscheme(argv, cmds, "BANDGAP", "--bandgap=", "./");
244
245 vpflow.flag("BANDGAPS", aurostd::args2flag(argv, cmds, "--bandgaps|--gaps"));
246 //[CO20191004]vpflow.flag("BANDGAPDOS",aurostd::args2flag(argv,cmds,"--bandgap_from_dos|--bandgap_from_DOS|--bandgap_dos|--bandgapdos")); //CO20191004
247 vpflow.args2addattachedscheme(argv, cmds, "BANDGAPDOS", "--bandgap_from_dos=|--bandgap_from_DOS=|--bandgap_dos=|--bandgapdos=", "./"); // CO20191004
248 vpflow.flag("BANDGAPLISTDOS", aurostd::args2flag(argv, cmds, "--bandgaplist_from_dos|--bandgaplist_from_DOS"));
249 vpflow.args2addattachedscheme(argv, cmds, "BZDIRECTION", "--bzdirection=|--bzdirections=|--bzd=", "");
250 // DX20181102 - add transform2original option - START
251 if (vpflow.flag("BZDIRECTION")) {
252 if (aurostd::args2attachedflag(argv, "--bzdirection=|--bzdirections=|--bzd=")) {
253 vpflow.args2addattachedscheme(argv, cmds, "BZDIRECTION::LATTICE", "--bzdirection=|--bzdirections=|--bzd=", "1");
254 }
255 vpflow.flag("BZDIRECTION::TRANSFORM2ORIGINAL", aurostd::args2flag(argv, cmds, "--transform2original"));
256 vpflow.flag("BZDIRECTION::PRINT_TRANSFORMATION_MATRIX", aurostd::args2flag(argv, cmds, "--print_transformation_matrix"));
257 }
258 // DX20181102 - add transform2original option - END
259 vpflow.flag("BZMAX", aurostd::args2flag(argv, cmds, "--BZmax"));
260
261 vpflow.args2addattachedscheme(argv, cmds, "CAGES", "--cages=", "-1.0");
262 // cerr << "vpflow.flag(\"CAGES\")=" << vpflow.flag("CAGES") << endl;
263 // cerr << "vpflow.getattachedscheme(\"CAGES\")=" << vpflow.getattachedscheme("CAGES") << endl;
264
265 vpflow.flag("CALCULATED_ICSD_RANDOM", (aurostd::args2flag(argv, cmds, "--calculated=icsd")) && aurostd::args2flag(argv, cmds, "--random|--rnd"));
266 vpflow.args2addattachedscheme(argv, cmds, "CALCULATED", "--calculated=", "all");
267 // cerr << "vpflow.flag(\"CALCULATED\")=" << vpflow.flag("CALCULATED") << endl;
268 // cerr << vpflow.getattachedscheme("CALCULATED") << endl;
269
270 vpflow.flag("CART", aurostd::args2flag(argv, cmds, "--cart|-cart|-c|--cartesian"));
271
272 vpflow.flag("CCE_CORRECTION::USAGE", aurostd::args2flag(argv, cmds, "--cce_correction|--cce"));
273 vpflow.args2addattachedscheme(argv, cmds, "CCE_CORRECTION::POSCAR_PATH", "--cce_correction=|--cce=", "");
274 vpflow.flag("CCE_CORRECTION::POSCAR2CCE", aurostd::args2flag(argv, cmds, "--poscar2cce")); // ME
275 vpflow.flag("CCE_CORRECTION::GET_CCE_CORRECTION", aurostd::args2flag(argv, cmds, "--get_cce_correction|--get_cce_cor|--get_cce_corrections|--get_cce_cors"));
276 vpflow.flag("CCE_CORRECTION", vpflow.flag("CCE_CORRECTION::USAGE") || !vpflow.getattachedscheme("CCE_CORRECTION::POSCAR_PATH").empty());
277 if (vpflow.flag("CCE_CORRECTION") && aurostd::args2flag(argv, cmds, "--usage")) {
278 vpflow.flag("CCE_CORRECTION::USAGE", true);
279 }
281 argv, cmds, "CCE_CORRECTION::ENTHALPIES_FORMATION_DFT",
282 "--enthalpies_formation_dft=|--enthalpy_formation_dft=|--dft_formation_enthalpies=|--dft_formation_energies=|--dft_formation_enthalpy=|--dft_formation_energy=|--dftes=|--dfte=", "");
283 vpflow.args2addattachedscheme(argv, cmds, "CCE_CORRECTION::FUNCTIONALS", "--functional=|--func=|--functionals=|--funcs=", "");
284 vpflow.args2addattachedscheme(argv, cmds, "CCE_CORRECTION::OXIDATION_NUMBERS", "--oxidation_numbers=|--ox_nums=|--oxidation_number=|--ox_num=", "");
285 vpflow.args2addattachedscheme(argv, cmds, "CCE_CORRECTION::PRINT", "--print=", "OUT"); // ME
286 vpflow.flag("CCE_CORRECTION::UNIT_TEST", aurostd::args2flag(argv, cmds, "--cce_test")); // RF20200409
287 vpflow.flag("CCE_CORRECTION::GET_OXIDATION_NUMBERS", aurostd::args2flag(argv, cmds, "--get_oxidation_numbers|--get_ox_nums|--get_oxidation_number|--get_ox_num|--poscar2ox_nums|--poscar2ox_num")); // RF20200725
288 vpflow.flag("CCE_CORRECTION::GET_CATION_COORDINATION_NUMBERS", aurostd::args2flag(argv, cmds,
289 "--get_cation_coordination_numbers|--get_cation_coord_nums|--get_cation_coordination_number|--get_cation_coord_num|--get_"
290 "coordination_numbers_cation|--get_coordination_number_cation|--get_coordination_numbers_cations|--get_coordination_number_"
291 "cations|--get_coord_num_cation|--get_coord_nums_cation|--get_coord_nums_cations|--get_coord_num_cations|--poscar2cation_"
292 "coord_nums|--poscar2cation_coord_num")); // RF20200814
293 vpflow.args2addattachedscheme(argv, cmds, "CCE_CORRECTION::DIST_TOL", "--tolerance=|dist_tol=|distance_tolerance=|dist_tolerance=|distance_tol=", ""); // RF20200819
294
295 vpflow.flag("CHECKINTEGRITIY", aurostd::args2flag(argv, cmds, "--check_integrity|--checki"));
296 vpflow.args2addattachedscheme(argv, cmds, "CHANGESUFFIX", "--suffix=", "./");
297
298 // CO
299 vpflow.args2addattachedscheme(argv, cmds, "CHGCAR2JVXL", "--chgcar2jvxl=|--c2j=", ""); // create JVXL from CHGCAR, CO
300 if (vpflow.flag("CHGCAR2JVXL")) {
301 vpflow.flag("CHGCAR2JVXL::USAGE", aurostd::args2flag(argv, cmds, "--usage")); // usage
302 vpflow.args2addattachedscheme(argv, cmds, "CHGCAR2JVXL::OUTPUT", "--output=|--o=", "");
303 }
304
305 // CO
306 vpflow.args2addattachedscheme(argv, cmds, "CHGDIFF", "--chgdiff=", "");
307 if (vpflow.flag("CHGDIFF")) { // CO
308 vpflow.flag("CHGDIFF::USAGE", aurostd::args2flag(argv, cmds, "--usage")); // usage
309 vpflow.args2addattachedscheme(argv, cmds, "CHGDIFF:OUTPUT", "--output=|--o=", "");
310 }
311
312 vpflow.flag("CHGINT", aurostd::args2flag(argv, cmds, "--chgint") && argv.at(1) == "--chgint");
313 // CO
314 vpflow.args2addattachedscheme(argv, cmds, "CHGSUM", "--chgsum=", "");
315 if (vpflow.flag("CHGSUM")) { // CO
316 vpflow.flag("CHGSUM::USAGE", aurostd::args2flag(argv, cmds, "--usage")); // usage
317 vpflow.args2addattachedscheme(argv, cmds, "CHGSUM::OUTPUT", "--output=|--o=", "");
318 }
319
320 vpflow.flag("CLEANALL", aurostd::args2flag(argv, cmds, "--cleanall|--clean_all"));
321
322 vpflow.args2addattachedscheme(argv, cmds, "COMPARE", "--compare=", "");
323 vpflow.flag("CMPSTR", aurostd::args2flag(argv, cmds, "--cmp_str") && argv.at(1) == "--cmp_str");
324
325 vpflow.flag("CHULL::INIT", aurostd::args2flag(argv, cmds, "--convex_hull|--chull")); // initiate chull calculation
326 vpflow.args2addattachedscheme(argv, cmds, "PFLOW::ALLOY", "--alloy=", ""); // define alloy
327 vpflow.flag("PFLOW::LOAD_API", aurostd::args2flag(argv, cmds, "--load_API|--load_api|--loadapi|--lapi|--api")); // force load api
328 vpflow.flag("PFLOW::LOAD_ENTRIES_ENTRY_OUTPUT", aurostd::args2flag(argv, cmds, "--load_entries_entry_output|--loadentriesentryoutput|--leo")); // verbose loading entries output
329 if (vpflow.flag("CHULL::INIT")) {
330 // do NOT rearrange flags, order is important!
331 vpflow.args2addattachedscheme(argv, cmds, "CHULL::PATH", "--destination=|--path=", ""); // determine how to get output
332 vpflow.flag("CHULL::USAGE", aurostd::args2flag(argv, cmds, "--usage")); // usage
333 vpflow.flag("CHULL::GNUPLOT_DOC", false); // depreciated, NO gnuplot options, all LATEX
334 vpflow.flag("CHULL::SCREEN_ONLY", aurostd::args2flag(argv, cmds, "--screen_only")); // print to screen
335 if (vpflow.flag("CHULL::SCREEN_ONLY")) {
336 XHOST.QUIET = true;
337 }
338 if (XHOST.QUIET && vpflow.flag("PFLOW::LOAD_ENTRIES_ENTRY_OUTPUT")) {
339 vpflow.flag("PFLOW::LOAD_ENTRIES_ENTRY_OUTPUT", false);
340 } // keep quiet
341 vpflow.args2addattachedscheme(argv, cmds, "CHULL::KEEP", "--keep=", "");
342 vector<string> keep_parts;
343 if (vpflow.flag("CHULL::KEEP")) {
344 aurostd::string2tokens(vpflow.getattachedscheme("CHULL::KEEP"), keep_parts, ",");
345 }
346 vpflow.flag("CHULL::LOG", aurostd::args2flag(argv, cmds, "--keep=log|--keep_log|--keeplog|--log"));
347 if (!vpflow.flag("CHULL::LOG")) { // only turn on if not already on
348 for (size_t i = 0; i < keep_parts.size(); i++) {
349 if (!keep_parts[i].empty()) {
350 if (keep_parts[i][0] == 'L' || keep_parts[i][0] == 'l') {
351 vpflow.flag("CHULL::LOG", true);
352 }
353 }
354 }
355 }
356 vpflow.args2addattachedscheme(argv, cmds, "PFLOW::LOAD_LIBRARY", "--load_library=|--loadlibrary=|--ll=", ""); // get libraries to load
357 vpflow.args2addattachedscheme(argv, cmds, "CHULL::NEGLECT", "--neglect=|--ban=", ""); // remove by auid from chull calculation
358 vpflow.flag("CHULL::SEE_NEGLECT", aurostd::args2flag(argv, cmds, "--see_neglect|--seeneglect|--sn")); // see why compounds get neglected
359 vpflow.args2addattachedscheme(argv, cmds, "CHULL::REMOVE_EXTREMA", "--remove_extreme_points=|--removeextremepoints=|--remove_extrema=|--removeextrema=|--rep=",
360 ""); // set threshold, from bottom for enthalpy of formation, from top for entropic temperature, units of meV OR K
361 vpflow.flag("CHULL::ENTROPIC_TEMPERATURE", aurostd::args2flag(argv, cmds, "--entropic_temperature|--entropictemperature|--entroptemp")); // use entropic temperature instead of enthalpy of formation
362 vpflow.flag("CHULL::INCLUDE_PAW_GGA", aurostd::args2flag(argv, cmds, "--include_paw_gga|--paw_gga")); // include entries calculated with PAW_GGA
363 vpflow.flag("CHULL::SKIP_STRUCTURE_COMPARISON", aurostd::args2flag(argv, cmds, "--skip_structure_comparison|--skipstructruecomparison|--skipstructcomp|--ssc")); // use entropic temperature instead of enthalpy of formation
364 vpflow.flag("CHULL::SKIP_STABILITY_CRITERION_ANALYSIS", aurostd::args2flag(argv, cmds,
365 "--skip_stability_criterion_analysis|--skip_stability_criterion|--skipstabilitycriterionanalysis|--skipstabilitycriterion|--skip_"
366 "scriterion|--skipscriterion|--sscriterion")); // use entropic temperature instead of enthalpy of formation
367 vpflow.flag("CHULL::SKIP_N+1_ENTHALPY_GAIN_ANALYSIS", aurostd::args2flag(argv, cmds,
368 "--skip_n_plus_1_enthalpy_gain_analysis|--skip_n_plus_1_energy_gain_analysis|--skipnplus1enthalpygainanalysis|--"
369 "skipnplus1energygainanalysis|--skip_nplus1|--skipnplus1|--snp1|--snpo")); // use entropic temperature instead of enthalpy of formation
370 vpflow.flag("CHULL::INCLUDE_SKEWED_HULLS", aurostd::args2flag(argv, cmds, "--include_skewed_hulls|--include_skewed|--ish")); // use entropic temperature instead of enthalpy of formation
371 vpflow.flag("CHULL::INCLUDE_UNRELIABLE_HULLS", aurostd::args2flag(argv, cmds, "--include_unreliable_hulls|--include_unreliable|--iuh")); // use entropic temperature instead of enthalpy of formation
372 vpflow.flag("CHULL::INCLUDE_OUTLIERS", aurostd::args2flag(argv, cmds, "--include_outliers|--io")); // use entropic temperature instead of enthalpy of formation
373 vpflow.flag("CHULL::STRICT_OUTLIER_ANALYSIS", aurostd::args2flag(argv, cmds, "--strict_outlier_analysis|--soa"));
374 vpflow.flag("CHULL::INCLUDE_ILL_CONVERGED", aurostd::args2flag(argv, cmds, "--include_ill_converged|--iic")); // use entropic temperature instead of enthalpy of formation
375 vpflow.flag("CHULL::LATEX_OUTPUT", aurostd::args2flag(argv, cmds, "--latex_output|--latexoutput")); // verbose latex output (cout and FileMESSAGE)
376 vpflow.flag("CHULL::LATEX_INTERACTIVE", aurostd::args2flag(argv, cmds, "--latex_interactive|--latexinteractive")); // interact with latex (execute vs. execute2string)
377 if (vpflow.flag("CHULL::LATEX_INTERACTIVE") && !vpflow.flag("CHULL::LATEX_OUTPUT")) {
378 vpflow.flag("CHULL::LATEX_OUTPUT", true);
379 } // keep verbose latex output
380 vpflow.flag("CHULL::PLOT_ISO_MAX_LATENT_HEAT", aurostd::args2flag(argv, cmds, "--plot_iso_max_latent_heat|--plot_isomax|--iso_max|--isomax")); // plot iso-max latent heat lines for hull points
381 // need to determine output type immediately, so we can accept/ignore output specific flags (SAFE)
382 vpflow.args2addattachedscheme(argv, cmds, "CHULL::OUTPUT", "--print=|--p=|--output=|--o=", ""); // determine how to get output, could pull from XHOST, but --output was used previously (backwards compatibility)
383 if (vpflow.flag("CHULL::OUTPUT")) {
384 vector<string> out_forms;
385 string out_form;
386 aurostd::string2tokens(vpflow.getattachedscheme("CHULL::OUTPUT"), out_forms, ",");
387 if (out_forms.size() > 1) {
388 vpflow.flag("CHULL::MULTI_OUTPUT", true);
389 } // CO20180409
390 for (size_t i = 0; i < out_forms.size(); i++) {
391 out_form = aurostd::toupper(out_forms[i]);
392 if (out_form[0] == 'A') {
393 vpflow.flag("CHULL::APOOL_OUT", true); // turn on
394 } else if (out_form[0] == 'F') {
395 vpflow.flag("CHULL::TEXT_DOC", true); // turn on
396 vpflow.flag("CHULL::JSON_DOC", true); // turn on
397 vpflow.flag("CHULL::LATEX_DOC", true); // turn on default
398 } else if (out_form[0] == 'T') {
399 vpflow.flag("CHULL::TEXT_DOC", true); // turn on
400 } else if (out_form[0] == 'J') { // MB20190305
401 if (out_form == "JUPYTER2") {
402 vpflow.flag("CHULL::WRITE_JUPYTER2", true);
403 } else if (out_form == "JUPYTER3") {
404 vpflow.flag("CHULL::WRITE_JUPYTER3", true);
405 } else if (out_form == "JUPYTER") {
406 vpflow.flag("CHULL::WRITE_JUPYTER3", true);
407 } else {
408 vpflow.flag("CHULL::JSON_DOC", true);
409 } // turn on
410 } else if (out_form[0] == 'W') {
411 vpflow.flag("CHULL::WEB_DOC", true); // turn on
412 //[WSCHMITT20190620 - stability criterion error otherwise for Pd1]vpflow.flag("CHULL::SKIP_STRUCTURE_COMPARISON",true); //the app cannot handle more than one g-state in the visualization
413 vpflow.flag("FORCE", true); // just include everything!
414 XHOST.vflag_control.flag("WWW", true); // CO20201215
415 // vpflow.flag("CHULL::INCLUDE_UNRELIABLE",true); //we include colors on the website
416 } else if (out_form[0] == 'L' || (out_form[0] == 'P' && out_form != "PNG") || out_form == "PDF") { // Latex or Pdf
417 vpflow.flag("CHULL::LATEX_DOC", true); // turn on default
418 } else if (out_form == "PNG") { // PNG
419 vpflow.flag("CHULL::PNG_IMAGE", true);
420 } // else { //deal with later //[CO20200106 - close bracket for indenting]}
421 }
422 // fix CHULL::MULTI_OUTPUT, PDF + PNG not really considered "different" outputs
423 if (out_forms.size() == 2 && vpflow.flag("CHULL::LATEX_DOC") && vpflow.flag("CHULL::PNG_IMAGE")) {
424 vpflow.flag("CHULL::MULTI_OUTPUT", false);
425 }
426 } else {
427 vpflow.flag("CHULL::LATEX_DOC", true);
428 } // default
429 vpflow.args2addattachedscheme(argv, cmds, "CHULL::DIST2HULL", "--distance_to_hull=|--distancetohull=|--distance2hull=|--dist2hull=|--d2h=", ""); // calculate distance to hull for point
430 vpflow.args2addattachedscheme(argv, cmds, "CHULL::STABILITY_CRITERION", "--stability_criterion=|--stabilitycriterion=|--stable_criterion=|--scriterion=|--sc=", ""); // calculate stable criterion for point
431 vpflow.args2addattachedscheme(argv, cmds, "CHULL::N+1_ENTHALPY_GAIN",
432 "--n+1_enthalpy_gain=|--n+1_energy_gain=|--n+1enthalpygain=|--n+1energygain=|--n+1egain=|--n1egain=|--n+1_enthalpygain=|--n+1+energygain=|--n+1_egain=|--nplus1=", ""); // calculate stable criterion for point
433 vpflow.args2addattachedscheme(argv, cmds, "CHULL::CALCULATE_FAKE_HULL_STABILITY_CRITERION", "--fake_hull_sc=", ""); // CO20210315
434 vpflow.flag("CHULL::CALCULATE_FAKE_HULL_N+1_ENTHALPY_GAIN", aurostd::args2flag(argv, cmds, "--fake_hull_np1eg")); // SK20200325 - skip all n-dimensional points and calculate new hull
435 vpflow.flag("CHULL::CALCULATE_HIGHEST_DIMENSION_ONLY", aurostd::args2flag(argv, cmds, "--calculate_highest_dimension_only|--calc_ND_only")); // CO20210407
436 vpflow.args2addattachedscheme(argv, cmds, "CHULL::HULL_FORMATION_ENTHALPY", "--hull_formation_enthalpy=|--hull_enthalpy=|--hull_energy=", ""); // calculate stable criterion for point
437 if (vpflow.flag("CHULL::STABILITY_CRITERION") || vpflow.flag("CHULL::N+1_ENTHALPY_GAIN") || vpflow.flag("CHULL::HULL_FORMATION_ENTHALPY")) {
438 // vpflow.flag("CHULL::TEXT_DOC",false); //turn off //leave on, as user might request json/text format output
439 // vpflow.flag("CHULL::JSON_DOC",false); //turn off //leave on, as user might request json/text format output
440 //[CO20210201 - chull-web SS plotter]vpflow.flag("CHULL::WEB_DOC",false); //turn off
441 vpflow.flag("CHULL::LATEX_DOC", false); // turn off
442 }
443 if (vpflow.flag("CHULL::LATEX_DOC") || vpflow.flag("CHULL::PNG_IMAGE")) { // latex specific options
444 vpflow.flag("CHULL::DOC_ONLY", aurostd::args2flag(argv, cmds, "--document_only|--documentonly|--doc_only|--doconly|--doc")); // no convex hull picture
445 vpflow.flag("CHULL::NO_DOC", aurostd::args2flag(argv, cmds, "--no_document|--nodocument|--no_doc|--nodoc|--full_page_image|--fullpageimage")); // no convex hull picture
446 if (vpflow.flag("CHULL::NO_DOC") && vpflow.flag("CHULL::DOC_ONLY")) {
447 vpflow.flag("CHULL::DOC_ONLY", false);
448 }
449 vpflow.flag("CHULL::KEEP_TEX", aurostd::args2flag(argv, cmds, "--keep=tex|--keep_tex|--keeptex|--tex")); // keep .tex file to edit
450 if (!vpflow.flag("CHULL::KEEP_TEX")) { // only turn on if not already on
451 for (size_t i = 0; i < keep_parts.size(); i++) {
452 if (!keep_parts[i].empty()) {
453 if (keep_parts[i][0] == 'T' || keep_parts[i][0] == 't') {
454 vpflow.flag("CHULL::KEEP_TEX", true);
455 }
456 }
457 }
458 }
459 vpflow.flag("CHULL::IMAGE_ONLY", aurostd::args2flag(argv, cmds, "--image_only|--imageonly|--image|--picture_only|--pictureonly|--picture|--pic")); // image only, no doc or links, special compilation
460 if (vpflow.flag("CHULL::IMAGE_ONLY") && vpflow.flag("CHULL::DOC_ONLY")) {
461 vpflow.flag("CHULL::IMAGE_ONLY", false);
462 } // doc takes precedence
463 vpflow.flag("CHULL::LIGHT_CONTRAST", aurostd::args2flag(argv, cmds, "--light_contrast|--lightcontrast|--lc")); // lighter blue
464 vpflow.flag("CHULL::LARGE_FONT", aurostd::args2flag(argv, cmds, "--large_font|--largefont|--large|--lf")); // keeps hyperlinks
465 if (vpflow.flag("CHULL::PNG_IMAGE") &&
466 !(vpflow.flag("CHULL::NO_DOC") || vpflow.flag("CHULL::IMAGE_ONLY"))) { // that means we get full report //!vpflow.flag("CHULL::MULTI_OUTPUT")&& removing this because png means IMAGE_ONLY exclusively, report cannot be created with png
467 vpflow.flag("CHULL::IMAGE_ONLY", true);
468 }
469 if (vpflow.flag("CHULL::PNG_IMAGE")) {
470 vpflow.args2addattachedscheme(argv, cmds, "CHULL::PNG_RESOLUTION", "--png_resolution=|--pngresolution=|--pngr=", ""); // calculate distance to hull for point
471 }
472 }
473 vpflow.args2addattachedscheme(argv, cmds, "CHULL::DIST_FOR_EQUIVALENCE_ANALYSIS", "--distance_for_equivalence_analysis=|--dist4equi=|--d4e=", "0.0"); // calculate distance to hull for point
474 if (vpflow.flag("CHULL::DIST_FOR_EQUIVALENCE_ANALYSIS")) {
475 vpflow.flag("CHULL::DIST_FOR_EQUIVALENCE_ANALYSIS_ND_ONLY", aurostd::args2attachedflag(argv, cmds, "--d4e_ND|--d4e_nd"));
476 }
477 }
478
479 vpflow.args2addattachedscheme(argv, cmds, "CLAT", "--clat=", "");
480 vpflow.args2addattachedscheme(argv, cmds, "COMPARE", "--compare=", "");
481
482 // DX20201220 - put all comparison functions prior to general options - START
483 vpflow.flag("COMPARE_DATABASE_ENTRIES", aurostd::args2attachedflag(argv, cmds, "--compare_database_entries"));
484 vpflow.flag("COMPARE_MATERIAL", aurostd::args2attachedflag(argv, cmds, "--compare_material|--compare_materials")); // DX20190424 - added plural variant
485 vpflow.flag("COMPARE_STRUCTURE", aurostd::args2attachedflag(argv, cmds, "--compare_structure|--compare_structures")); // DX20190424 - added plural variant
486 vpflow.flag("COMPARE_PERMUTATION", aurostd::args2attachedflag(argv, cmds,
487 "--compare_atom_decoration|--compare_atom_decorations|--unique_atom_decoration|--unique_atom_decorations|--compare_permutation|--compare_"
488 "permutations|--unique_permutation|--unique_permutations"));
489 vpflow.flag("COMPARE2DATABASE", aurostd::args2attachedflag(argv, cmds, "--compare2database"));
490 vpflow.flag("COMPARE2PROTOTYPES", aurostd::args2attachedflag(argv, cmds, "--compare2protos|--compare2prototypes"));
491
492 // COMPARISON: GENERAL OPTIONS
493 if (vpflow.flag("COMPARE_DATABASE_ENTRIES") || vpflow.flag("COMPARE_MATERIAL") || vpflow.flag("COMPARE_STRUCTURE") || vpflow.flag("COMPARE_PERMUTATION") || vpflow.flag("COMPARE2DATABASE") ||
494 vpflow.flag("COMPARE2PROTOTYPES")) {
495 // input values
496 vpflow.args2addattachedscheme(argv, cmds, "COMPARE::MISFIT_MATCH", "--misfit_match=", ""); // DX20201118
497 vpflow.args2addattachedscheme(argv, cmds, "COMPARE::MISFIT_FAMILY", "--misfit_family=", ""); // DX20201118
498 vpflow.args2addattachedscheme(argv, cmds, "COMPARE::NP", "--np=|--num_proc=", "");
499 vpflow.args2addattachedscheme(argv, cmds, "COMPARE::PAGE_SIZE", "--page_size=", ""); // ME20220426 - page size for AFLUX
500 vpflow.args2addattachedscheme(argv, cmds, "COMPARE::MAGNETIC", "--mag=|--magnetic=|--magmom=|--magmoms=|--magnetic_moment=|--magnetic_moments=", ""); // DX20170803
501 // booleans
502 vpflow.flag("COMPARE::USAGE", aurostd::args2flag(argv, cmds, "--usage"));
503 vpflow.flag("COMPARE::OPTIMIZE_MATCH", aurostd::args2flag(argv, cmds, "--optimize|--optimize_match")); // DX20190201 - changed from fast_match to optimize_match
504 vpflow.flag("COMPARE::NO_SCALE_VOLUME", aurostd::args2flag(argv, cmds, "--no_scale_volume"));
505 vpflow.flag("COMPARE::KEEP_UNMATCHED", aurostd::args2flag(argv, cmds, "--keep_unmatched")); // DX20190424
506 vpflow.flag("COMPARE::IGNORE_SYMMETRY", aurostd::args2flag(argv, cmds, "--ignore_symmetry")); // DX20190424
507 vpflow.flag("COMPARE::IGNORE_WYCKOFF", aurostd::args2flag(argv, cmds, "--ignore_Wyckoff")); // DX20190424
508 vpflow.flag("COMPARE::IGNORE_ENVIRONMENT_ANALYSIS", aurostd::args2flag(argv, cmds, "--ignore_environment|--ignore_environment_analysis|--ignore_env")); // DX20190807
509 vpflow.flag("COMPARE::REMOVE_DUPLICATE_COMPOUNDS", aurostd::args2flag(argv, cmds, "--remove_duplicates|--remove_duplicate_compounds")); // DX20190201
510 vpflow.flag("COMPARE::MATCH_TO_AFLOW_PROTOS", aurostd::args2flag(
511 argv, cmds, "--match_to_aflow_prototypes|--add_matching_aflow_prototypes|--add_matching_aflow_protos|--add_matching_prototypes|--add_matching_protos")); // DX20190724 //DX20220411 - added --match_to_aflow_prototypes
512 vpflow.flag("COMPARE::ADD_AFLOW_PROTOTYPE_DESIGNATION",
513 aurostd::args2flag(argv, cmds, "--add_prototype_designation|--add_aflow_prototype_designation|--add_anrl_designation|--add_prototype|--add_prototype_information")); // DX20190724
514 vpflow.flag("COMPARE::UNDECORATED_COMPARISON", aurostd::args2flag(argv, cmds, "--undecorated_comparison|--undecorated|--no_atom_decoration")); // DX20191212
515 vpflow.flag("COMPARE::PRIMITIVIZE", aurostd::args2flag(argv, cmds, "--primitive|--primitivize|--prim")); // DX20201006
516 vpflow.flag("COMPARE::MINKOWSKI", aurostd::args2flag(argv, cmds, "--minkowski|--minkowski_reduction|--minkowski_lattice_reduction")); // DX20201006
517 vpflow.flag("COMPARE::NIGGLI", aurostd::args2flag(argv, cmds, "--niggli|--niggli_reduction|--niggli_lattice_reduction")); // DX20201006
518 vpflow.flag("COMPARE::SCREEN_ONLY", aurostd::args2flag(argv, cmds, "--screen_only")); // DX20170803
519 vpflow.flag("COMPARE::ICSD_COMPARISON", aurostd::args2flag(argv, cmds, "--ICSD")); // DX20190201
520 vpflow.flag("COMPARE::DO_NOT_CALCULATE_UNIQUE_PERMUTATIONS", aurostd::args2flag(argv, cmds, "--ignore_atom_decoration_comparison|--ignore_decoration_comparison|--ignore_decorations")); // DX20190424
521 // ME20210206 - web mode
522 if (XHOST.vflag_control.flag("WWW")) {
523 vpflow.flag("COMPARE::SCREEN_ONLY", true);
524 XHOST.QUIET = true;
525 }
526 }
527
528 if (vpflow.flag("COMPARE_DATABASE_ENTRIES")) {
529 // FUNCTION_SPECIFIC
530 // booleans
531 vpflow.flag("COMPARE_DATABASE_ENTRIES::STRUCTURE", aurostd::args2flag(argv, cmds, "--structure|--structure_comparison|--ignore_species"));
532 // input values
533 vpflow.args2addattachedscheme(argv, cmds, "COMPARE_DATABASE_ENTRIES::ALLOY", "--compare_alloy=|--alloy=|--species=", "");
534 vpflow.args2addattachedscheme(argv, cmds, "COMPARE_DATABASE_ENTRIES::ARITY", "--arity=|--nspecies=", "");
535 vpflow.args2addattachedscheme(argv, cmds, "COMPARE_DATABASE_ENTRIES::CATALOG", "--catalog=|--library=", "");
536 vpflow.args2addattachedscheme(argv, cmds, "COMPARE_DATABASE_ENTRIES::PROPERTY_LIST", "--properties=|--property_list=|--property=", "");
537 vpflow.args2addattachedscheme(argv, cmds, "COMPARE_DATABASE_ENTRIES::RELAXATION_STEP", "--relaxation_step=|--relaxation=", "");
538 vpflow.args2addattachedscheme(argv, cmds, "COMPARE_DATABASE_ENTRIES::SPACE_GROUP", "--space_group=|--spacegroup=|--sg=", "");
539 vpflow.args2addattachedscheme(argv, cmds, "COMPARE_DATABASE_ENTRIES::STOICHIOMETRY", "--stoichiometry=|--stoich=", "");
540 vpflow.args2addattachedscheme(argv, cmds, "COMPARE_DATABASE_ENTRIES::WYCKOFF", "--Wyckoff=|--wyckoff=", "");
541 }
542 if (vpflow.flag("COMPARE_MATERIAL") || vpflow.flag("COMPARE_STRUCTURE")) {
543 vpflow.flag("COMPARE_STRUCTURE::PRINT", aurostd::args2flag(argv, cmds, "--print|--print_mapping|--print_mappings"));
544 // structures appended to command
545 if (aurostd::args2attachedflag(argv, "--compare_material=|--compare_materials=|--compare_structure=|--compare_structures=")) { // DX20170803
546 vpflow.args2addattachedscheme(argv, cmds, "COMPARE_STRUCTURE::STRUCTURE_LIST", "--compare_material=|--compare_materials=|--compare_structure=|--compare_structures=", "");
547 }
548 // structures from directory
549 if (XHOST.vflag_control.flag("DIRECTORY")) {
550 vpflow.push_attached("COMPARE_STRUCTURE::DIRECTORY", XHOST.vflag_control.getattachedscheme("DIRECTORY"));
551 } else if (aurostd::args2attachedflag(argv, "--compare_material_directory|--compare_material_dir|--compare_structure_directory|--compare_structure_dir")) { // legacy
552 vpflow.push_attached("COMPARE_STRUCTURE::DIRECTORY", ".");
553 }
554 // structures from file
555 if (XHOST.vflag_control.flag("FILE")) {
556 vpflow.push_attached("COMPARE_STRUCTURE::FILE", XHOST.vflag_control.getattachedscheme("FILE"));
557 }
558 }
559 if (vpflow.flag("COMPARE_PERMUTATION")) {
560 vpflow.flag("COMPARE_PERMUTATION::PRINT", aurostd::args2flag(argv, cmds, "--print_misfit|--print|--misfit"));
561 }
562 if (vpflow.flag("COMPARE2DATABASE")) {
563 vpflow.args2addattachedscheme(argv, cmds, "COMPARE2DATABASE::PROPERTY_LIST", "--properties=|--property_list=|--property=", "");
564 vpflow.args2addattachedscheme(argv, cmds, "COMPARE2DATABASE::RELAXATION_STEP", "--relaxation_step=|--relaxation=", "");
565 vpflow.args2addattachedscheme(argv, cmds, "COMPARE2DATABASE::CATALOG", "--catalog=|--library=", "");
566 }
567 if (vpflow.flag("COMPARE2PROTOTYPES")) {
568 vpflow.args2addattachedscheme(argv, cmds, "COMPARE2PROTOTYPES::CATALOG", "--catalog=|--library=", "");
569 }
570 // DX20201220 - put all comparison functions prior to general options - END
571
572 vpflow.flag("AFLOWMACHL::CoordCE_CSV", aurostd::args2flag(argv, cmds, "--coordce_csv")); // CO20200930
573 vpflow.flag("CORNERS", aurostd::args2flag(argv, cmds, "--corner|--corners"));
574
575 // DX20210301 - consolidated all DATA functions
576 vpflow.flag("DATA", aurostd::args2attachedflag(argv, cmds, "--data"));
577 vpflow.flag("DATA_CRYSTAL_POINT_GROUP", aurostd::args2attachedflag(argv, cmds, "--point_group_crystal_data|--pointgroup_crystal_data|--pgroupxtal_data|--pgroup_xtal_data")); // DX20210209
578 vpflow.flag("DATA_EDATA", aurostd::args2attachedflag(argv, cmds, "--edata"));
579 vpflow.flag("DATA_REAL_LATTICE", aurostd::args2attachedflag(argv, cmds, "--lattice_data|--data_lattice|--real_lattice_data|--data_real_lattice")); // DX20210209
580 vpflow.flag("DATA_RECIPROCAL_LATTICE", aurostd::args2attachedflag(argv, cmds, "--reciprocal_lattice_data|--reciprocallattice_data|--klattice_data|--data_reciprocal_lattice")); // DX20210209
581 vpflow.flag("DATA_SGDATA", aurostd::args2attachedflag(argv, cmds, "--sgdata|--space_group_data"));
582 vpflow.flag("DATA_SUPERLATTICE", aurostd::args2attachedflag(argv, cmds, "--superlattice_data|--data_superlattice")); // DX20210209
583
584 // EDATA/SGDATA/LATTICE DATA: GENERAL OPTIONS
585 if (vpflow.flag("DATA") || vpflow.flag("DATA_CRYSTAL_POINT_GROUP") || vpflow.flag("DATA_EDATA") || vpflow.flag("DATA_REAL_LATTICE") || vpflow.flag("DATA_RECIPROCAL_LATTICE") || vpflow.flag("DATA_SGDATA") ||
586 vpflow.flag("DATA_SUPERLATTICE")) {
587 vpflow.flag("DATA::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
588 vpflow.flag("DATA::SUPPRESS_WYCKOFF_PRINTING", aurostd::args2flag(argv, cmds, "--suppress_Wyckoff|--suppress_Wyckoff_printing|--suppress_wyckoff|--suppress_wyckoff_printing")); // DX20210211
589 vpflow.args2addattachedscheme(argv, cmds, "DATA::SETTING", "--setting=", "1");
590 vpflow.args2addattachedscheme(argv, cmds, "DATA::MAGNETIC", "--mag=|--magnetic=|--magmom=", "");
592 "--data=|--lattice_data=|--data_lattice=|--real_lattice_data=|--data_real_lattice=|--point_group_crystal_data=|--pointgroup_crystal_data=|--pgroupxtal_data=|--pgroup_xtal_"
593 "data=|--reciprocal_lattice_data=|--reciprocallattice_data=|--klattice_data=|--data_reciprocal_lattice=|--superlattice_data=|--data_superlattice=|--edata=|--sgdata=|--space_"
594 "group_data=")) {
595 vpflow.args2addattachedscheme(argv, cmds, "DATA::TOLERANCE",
596 "--data=|--lattice_data=|--data_lattice=|--real_lattice_data=|--data_real_lattice=|--point_group_crystal_data=|--pointgroup_crystal_data=|--pgroupxtal_data=|--pgroup_xtal_"
597 "data=|--reciprocal_lattice_data=|--reciprocallattice_data=|--klattice_data=|--data_reciprocal_lattice=|--superlattice_data=|--data_superlattice=|--edata=|--sgdata=|--space_"
598 "group_data=",
599 "");
600 }
601 vpflow.flag("DATA::USAGE", aurostd::args2flag(argv, cmds, "--usage"));
602 }
603
604 vpflow.args2addattachedscheme(argv, cmds, "DATA1", "--data1=", "");
605 vpflow.flag("DATA2", aurostd::args2flag(argv, cmds, "--data2"));
606 vpflow.args2addattachedscheme(argv, cmds, "DEBYE", "--debye=", "");
607 vpflow.args2addattachedscheme(argv, cmds, "DIFF", "--diff=", "./");
608
609 vpflow.args2addattachedscheme(argv, cmds, "DISP", "--disp=", "");
610 vpflow.args2addattachedscheme(argv, cmds, "DIST", "--dist=", "");
611
612 vpflow.flag("EDOS", aurostd::args2flag(argv, cmds, "--edos"));
613 vpflow.flag("EFFMASS", aurostd::args2flag(argv, cmds, "--em")); // CAMILO
614 vpflow.args2addattachedscheme(argv, cmds, "EWALD", "--ewald=", "");
615
616 // DX20170818 - Added tolerance and no_scan options to Xgroups - START
617 vpflow.args2addattachedscheme(argv, cmds, "EQUIVALENT", "--equivalent=|--equiv=|--inequivalent=|--inequiv=|--iatoms=|--eatoms=", "");
618 if (vpflow.flag("EQUIVALENT")) {
619 vpflow.flag("SYMMETRY::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
620 if (aurostd::args2attachedflag(argv, "--equivalent=|--equiv=|--inequivalent=|--inequiv=|--iatoms=|--eatoms=")) { // DX20170803
621 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::TOLERANCE", "--equivalent=|--equiv=|--inequivalent=|--inequiv=|--iatoms=|--eatoms=", ""); // DX20200907 - default is system specific, leaving empty
622 }
623 // DX20170921 - MAGNETIC SYMMETRY - START
624 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::MAGNETIC", "--mag=|--magnetic=|--magmom=", ""); // DX20170803
625 // DX20170921 - MAGNETIC SYMMETRY - END
626 }
627 // DX20170818 - Added tolerance and no_scan options to Xgroups - END
628 vpflow.flag("EXTRACT_SYMMETRY", aurostd::args2flag(argv, cmds, "--extract_symmetry|--xsymmetry"));
629
630 vpflow.args2addattachedscheme(argv, cmds, "EIGCURV", "--eigcurv=", "./"); // CAMILO
631
632 // DX20170818 - Added tolerance and no_scan options to Xgroups - START
633 vpflow.args2addattachedscheme(argv, cmds, "FGROUP", "--factorgroup=|--fgroup=", "");
634 if (vpflow.flag("FGROUP")) {
635 vpflow.flag("SYMMETRY::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
636 if (aurostd::args2attachedflag(argv, "--factorgroup=|--fgroup=")) { // DX20170803
637 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::TOLERANCE", "--factorgroup=|--fgroup=", ""); // DX20200907 - default is system specific, leaving empty
638 }
639 vpflow.flag("SYMMETRY::SCREEN_ONLY", aurostd::args2flag(argv, cmds, "--screen_only")); // DX20170803
640 // DX20170921 - MAGNETIC SYMMETRY - START
641 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::MAGNETIC", "--mag=|--magnetic=|--magmom=", ""); // DX20170803
642 // DX20170921 - MAGNETIC SYMMETRY - END
643 // ME20210206 - web mode
644 if (XHOST.vflag_control.flag("WWW")) {
645 vpflow.flag("SYMMETRY::SCREEN_ONLY", true);
646 XHOST.QUIET = true;
647 }
648 }
649 // DX20170818 - Added tolerance and no_scan options to Xgroups - END
650
651 vpflow.flag("FIND_CLOSED_PACKING_PLANE", aurostd::args2flag(argv, cmds, "--find_closed_packing_plane")); // CO20191110
652
653 vpflow.flag("FRAC", aurostd::args2flag(argv, cmds, "--frac|-frac|--fractional|-fract|--fract|--direct|-direct|-f|-d"));
654 vpflow.flag("FROZSL_VASPSETUP_AFLOW", aurostd::args2flag(argv, cmds, "--frozsl_vaspsetup_aflow|--frozsl_vaspsetup|--frozsl_vasp|--frozsl_setup|--phvaspsetup"));
655 vpflow.flag("FROZSL_VASPSETUP_POSCAR", aurostd::args2flag(argv, cmds, "--frozsl_vaspsetup_poscar"));
656 vpflow.flag("FROZSL_INPUT", aurostd::args2flag(argv, cmds, "--frozsl_input"));
657 vpflow.flag("FROZSL_OUTPUT", aurostd::args2flag(argv, cmds, "--frozsl_output"));
658 vpflow.flag("FROZSL_ANALYZE", aurostd::args2flag(argv, cmds, "--frozsl_analyze"));
659 vpflow.flag("FROZSL_README", aurostd::args2flag(argv, cmds, "--readme=frozsl"));
660
661 vpflow.flag("GFA::INIT", aurostd::args2flag(argv, cmds, "--gfa|--glass_forming_ability")); // DF20190329 - GFA
662 if (vpflow.flag("GFA::INIT")) { // DF20190329
663 vpflow.args2addattachedscheme(argv, cmds, "GFA::AE_FILE", "--atomic_environments_file=|--ae_file=|aef=", "none"); // DF20190329
664 vpflow.args2addattachedscheme(argv, cmds, "GFA::FORMATION_ENTHALPY_CUTOFF", "--cutoff_formation_enthalpy=|--cutoff_enthalpy=|--cutoff_energy=|--cut=", "0.05"); // DF20190619
665 } // DF20190329
666
667 vpflow.flag("ATOMIC_ENVIRONMENT::INIT", aurostd::args2flag(argv, cmds, "--ae|--atomic_environment")); // HE20210331 - Testing
668 if (vpflow.flag("ATOMIC_ENVIRONMENT::INIT")) { // HE20210331
669 vpflow.args2addattachedscheme(argv, cmds, "ATOMIC_ENVIRONMENT::AUID", "--auid=", "none");
670 vpflow.args2addattachedscheme(argv, cmds, "ATOMIC_ENVIRONMENT::MODE", "--mode=", "1");
671 vpflow.args2addattachedscheme(argv, cmds, "ATOMIC_ENVIRONMENT::RADIUS", "--radius=", "4");
672
673 } // HE20210331
674
675 vpflow.flag("GENERATE_CERAMICS", aurostd::args2flag(argv, cmds, "--generate_ceramics|--gen_ceram")); // CO20200731
676 if (vpflow.flag("GENERATE_CERAMICS")) { // CO20200731
677 vpflow.args2addattachedscheme(argv, cmds, "GENERATE_CERAMICS::NON_METALS", "--non_metals=|--nm=", "C");
678 vpflow.args2addattachedscheme(argv, cmds, "GENERATE_CERAMICS::METALS", "--metals=|--m=", "Mo,Nb,Ta,V,W");
679 vpflow.args2addattachedscheme(argv, cmds, "GENERATE_CERAMICS::METAL_ARITY", "--N=", "5");
680 }
681
682 vpflow.flag("GEOMETRY", aurostd::args2flag(argv, cmds, "--geometry|--abc_angles")); // CO20190808
683
684 vpflow.flag("GULP", aurostd::args2flag(argv, cmds, "--gulp"));
685 vpflow.flag("GETTEMP", aurostd::args2flag(argv, cmds, "--getTEMP|--getTEMPS|--Init::GetTEMPs|--gettemp|--gettemps|--getemp|--getemps"));
686
687 vpflow.args2addattachedscheme(argv, cmds, "KPOINTS", "--kpoints=|--kppra=|-kpoints=|-kppra=|-k=", "1");
688 vpflow.args2addattachedscheme(argv, cmds, "FLAG::XVASP_KPOINTS_DELTA", "--delta_kpoints=|--dkpoints=|-dkpoints=|-dk=", "0.01"); // CO20171025
689
690 vpflow.flag("KPATH", aurostd::args2flag(argv, cmds, "--kpath"));
691
692 vpflow.flag("JOINSTRLIST", aurostd::args2flag(argv, cmds, "--join_strlist") && argv.at(1) == "--join_strlist");
693
694 vpflow.args2addattachedscheme(argv, cmds, "HKL", "--hkl=", "");
695 vpflow.args2addattachedscheme(argv, cmds, "HKL_SEARCH_TRIVIAL", "--hkl_search=", "");
696 vpflow.args2addattachedscheme(argv, cmds, "HKL_SEARCH_SIMPLE", "--hkl_search_simple=", "");
697 vpflow.args2addattachedscheme(argv, cmds, "HKL_SEARCH_COMPLETE", "--hkl_search_complete=", "");
698
699 vpflow.flag("IAP::INIT", aurostd::args2flag(argv, cmds, "--iap|--IAP")); // initiate IAP writer
700 if (vpflow.flag("IAP::INIT")) {
701 vpflow.args2addattachedscheme(argv, cmds, "IAP::FORMAT", "--format=|--f=", "");
702 vpflow.args2addattachedscheme(argv, cmds, "IAP::AFLOWLIBPATH", "--aflowlibpath=|--path=", "");
703 }
704
705 vpflow.flag("ICSD", aurostd::args2flag(argv, cmds, "--icsd"));
706 vpflow.flag("ICSD_ALLLESSTHAN", aurostd::args2flag(argv, cmds, "--icsd_alllessthan"));
707 vpflow.flag("ICSD_ALLMORETHAN", aurostd::args2flag(argv, cmds, "--icsd_allmorethan"));
708 vpflow.flag("ICSD_BASISLT", aurostd::args2flag(argv, cmds, "--icsd_basislessthan"));
709 vpflow.flag("ICSD_BASISGT", aurostd::args2flag(argv, cmds, "--icsd_basismorethan"));
710 vpflow.flag("ICSD_CHEM", aurostd::args2flag(argv, cmds, "--icsd_chem"));
711 vpflow.flag("ICSD_CUBIC", aurostd::args2flag(argv, cmds, "--icsd_cubic"));
712 vpflow.flag("ICSD_DENSLESSTHAN", aurostd::args2flag(argv, cmds, "--icsd_denslessthan"));
713 vpflow.flag("ICSD_DENSMORETHAN", aurostd::args2flag(argv, cmds, "--icsd_densmorethan"));
714 vpflow.flag("ICSD_HEXAGONAL", aurostd::args2flag(argv, cmds, "--icsd_hexagonal"));
715 vpflow.flag("ICSD_ID", aurostd::args2flag(argv, cmds, "--icsd_id|--icsd_ID"));
716 vpflow.flag("ICSD_MAKELABEL", aurostd::args2flag(argv, cmds, "--icsd_makelabel"));
717 vpflow.flag("ICSD_LESSTHAN", aurostd::args2flag(argv, cmds, "--icsd_lessthan"));
718 vpflow.flag("ICSD_LISTMETALS", aurostd::args2flag(argv, cmds, "--icsd_listmetals"));
719 vpflow.flag("ICSD_MONOCLINIC", aurostd::args2flag(argv, cmds, "--icsd_monoclinic"));
720 vpflow.flag("ICSD_MORETHAN", aurostd::args2flag(argv, cmds, "--icsd_morethan"));
721 vpflow.flag("ICSD_N_ARY", aurostd::args2flag(argv, cmds, "--icsd_n_ary"));
722 vpflow.flag("ICSD_NOBROKENBASIS", aurostd::args2flag(argv, cmds, "--icsd_nobrokenbasis|--icsd_completebasis"));
723 vpflow.flag("ICSD_NOPARTIALOCC", aurostd::args2flag(argv, cmds, "--icsd_nopartialocc"));
724 vpflow.flag("ICSD_ORTHORHOMBIC", aurostd::args2flag(argv, cmds, "--icsd_orthorhombic|--icsd_orthorombic|--icsd_ortorhombic|--icsd_ortorombic"));
725 vpflow.flag("ICSD_PROTO", aurostd::args2flag(argv, cmds, "--icsd_proto"));
726 vpflow.flag("ICSD_RHOMBOHEDRAL", aurostd::args2flag(argv, cmds, "--icsd_rhombohedral|--icsd_rombohedral|--icsd_trigonal"));
727 vpflow.flag("ICSD_REMOVE_AND", aurostd::args2flag(argv, cmds, "--icsd_remove_and"));
728 vpflow.flag("ICSD_REMOVE_OR", aurostd::args2flag(argv, cmds, "--icsd_remove_or"));
729 vpflow.flag("ICSD_REMOVEMETALS", aurostd::args2flag(argv, cmds, "--icsd_removemetals"));
730 vpflow.flag("ICSD_SG", aurostd::args2flag(argv, cmds, "--icsd_sg"));
731 vpflow.flag("ICSD_SGLESSTHAN", aurostd::args2flag(argv, cmds, "--icsd_sglessthan"));
732 vpflow.flag("ICSD_SGMORETHAN", aurostd::args2flag(argv, cmds, "--icsd_sgmorethan"));
733 vpflow.flag("ICSD_TETRAGONAL", aurostd::args2flag(argv, cmds, "--icsd_tetragonal"));
734 vpflow.flag("ICSD_TRICLINIC", aurostd::args2flag(argv, cmds, "--icsd_triclinic"));
735 vpflow.flag("ICSD_TRIGONAL", aurostd::args2flag(argv, cmds, "--icsd_trigonal"));
736 vpflow.flag("ICSD_TRI", aurostd::args2flag(argv, cmds, "--icsd_tri|--icsd_TRI"));
737 vpflow.flag("ICSD_MCL", aurostd::args2flag(argv, cmds, "--icsd_mcl|--icsd_MCL"));
738 vpflow.flag("ICSD_MCLC", aurostd::args2flag(argv, cmds, "--icsd_mclc|--icsd_MCLC"));
739 vpflow.flag("ICSD_ORC", aurostd::args2flag(argv, cmds, "--icsd_orc|--icsd_ORC"));
740 vpflow.flag("ICSD_ORCC", aurostd::args2flag(argv, cmds, "--icsd_orcc|--icsd_ORCC"));
741 vpflow.flag("ICSD_ORCF", aurostd::args2flag(argv, cmds, "--icsd_orcf|--icsd_ORCF"));
742 vpflow.flag("ICSD_ORCI", aurostd::args2flag(argv, cmds, "--icsd_orci|--icsd_ORCI"));
743 vpflow.flag("ICSD_TET", aurostd::args2flag(argv, cmds, "--icsd_tet|--icsd_TET"));
744 vpflow.flag("ICSD_BCT", aurostd::args2flag(argv, cmds, "--icsd_bct|--icsd_BCT"));
745 vpflow.flag("ICSD_RHL", aurostd::args2flag(argv, cmds, "--icsd_rhl|--icsd_RHL"));
746 vpflow.flag("ICSD_HEX", aurostd::args2flag(argv, cmds, "--icsd_hex|--icsd_HEX"));
747 vpflow.flag("ICSD_CUB", aurostd::args2flag(argv, cmds, "--icsd_cub|--icsd_CUB"));
748 vpflow.flag("ICSD_FCC", aurostd::args2flag(argv, cmds, "--icsd_fcc|--icsd_FCC"));
749 vpflow.flag("ICSD_BCC", aurostd::args2flag(argv, cmds, "--icsd_bcc|--icsd_BCC"));
750 vpflow.flag("ICSD_UNIQUE", aurostd::args2flag(argv, cmds, "--icsd_unique"));
751 vpflow.flag("ICSD2POSCAR", aurostd::args2flag(argv, cmds, "--icsd2poscar|--icsd2POSCAR"));
752 vpflow.flag("ICSD2PROTO", aurostd::args2flag(argv, cmds, "--icsd2proto"));
753 vpflow.flag("ICSD2WYCK", aurostd::args2flag(argv, cmds, "--icsd2wyck|--icsdwyck"));
754
755 vpflow.flag("IDENTICAL", aurostd::args2flag(argv, cmds, "--identical"));
756 vpflow.flag("INCELL", aurostd::args2flag(argv, cmds, "--incell"));
757 vpflow.flag("INCOMPACT", aurostd::args2flag(argv, cmds, "--incompact"));
758 vpflow.flag("INSPHERE", aurostd::args2flag(argv, cmds, "--insphere"));
759 vpflow.args2addattachedscheme(argv, cmds, "INTPOL", "--intpol=", "");
760
761 vpflow.flag("INWS", aurostd::args2flag(argv, cmds, "--inwignerseitz|--inws"));
762
763 // DX20200131 - add isopointal prototype function - START
764 vpflow.flag("ISOPOINTAL_PROTOTYPES", aurostd::args2attachedflag(argv, cmds, "--get_isopointal_prototypes|--isopointal_prototypes|--get_same_symmetry_prototypes"));
765 if (vpflow.flag("ISOPOINTAL_PROTOTYPES")) {
766 vpflow.flag("ISOPOINTAL_PROTOTYPES::USAGE", aurostd::args2flag(argv, cmds, "--usage"));
767 vpflow.args2addattachedscheme(argv, cmds, "ISOPOINTAL_PROTOTYPES::CATALOG", "--catalog=|--library=", "");
768 }
769 // DX20200131 - add isopointal prototype function - END
770
771 vpflow.args2addattachedscheme(argv, cmds, "INFLATE_LATTICE", "--inflate_lattice=|--ilattice=", "");
772 vpflow.args2addattachedscheme(argv, cmds, "INFLATE_VOLUME", "--inflate_volume=|--ivolume=", "");
773
774 vpflow.flag("KBAND", aurostd::args2flag(argv, cmds, "--kband"));
775 vpflow.args2addattachedscheme(argv, cmds, "KILL", "--kill=", "");
776
777 vpflow.flag("HNF", (aurostd::args2flag(argv, cmds, "--hnf|--HNF|--hfn|--HFN|--hnftol|--HNFTOL|--hfntol|--HFNTOL|--pocc_hnf"))); // CO20181226
778 vpflow.flag("HNFCELL", aurostd::args2flag(argv, cmds, "--hnfcell|--hfncell|--pocc_show_unique_structures|--pocc_show_unique|--pocc_print_unique")); // CO20181226
779 vpflow.flag("POCC_COUNT_TOTAL", aurostd::args2flag(argv, cmds, "--pocc_count_total_structures|--pocc_count_total")); // CO20181226
780 vpflow.flag("POCC_COUNT_UNIQUE", aurostd::args2flag(argv, cmds, "--pocc_count_unique_structures|--pocc_count_unique")); // CO20181226
781 vpflow.flag("POCC_COUNT_UNIQUE_FAST", aurostd::args2flag(argv, cmds, "--pocc_count_unique_fast")); // SD20230609
782 vpflow.flag("POCC_SKIP_WRITING_FILES", aurostd::args2flag(argv, cmds, "--pocc_skip_writing_files")); // CO20181226
783 if (vpflow.flag("HNF") || vpflow.flag("POCC_COUNT_TOTAL") || vpflow.flag("POCC_COUNT_UNIQUE") || vpflow.flag("POCC_COUNT_UNIQUE_FAST")) {
784 vpflow.flag("HNFCELL", true);
785 } // funnel all of these through command_line function
786 if (vpflow.flag("HNFCELL")) {
787 vpflow.flag("POCC_SKIP_WRITING_FILES", true);
788 } // CO20190401 //no point writing files if through command_line
789 if (XHOST.vflag_control.flag("WWW")) {
790 vpflow.flag("POCC_SKIP_WRITING_FILES", true);
791 } // CO20190401 //CO20200404 - new web flag
792 vpflow.flag("MULTIENUMALL", aurostd::args2flag(argv, cmds, "--multienum|--enum"));
793 vpflow.flag("MULTIENUMSORT", aurostd::args2flag(argv, cmds, "--multienumsort|--enumsort"));
794 vpflow.flag("POSCAR2ENUM", (aurostd::args2flag(argv, cmds, "--poscar2multienum|--poscar2enum")));
795 vpflow.flag("POSCAR2GULP", (aurostd::args2flag(argv, cmds, "--poscar2gulp")));
796 vpflow.flag("POCC_INPUT", aurostd::args2flag(argv, cmds, "--pocc_input|--enum_input"));
797 vpflow.args2addattachedscheme(argv, cmds, "POCC::CONVOLUTION", "--pocc_convolution=|--pocc_conv=|--poccconv=", "");
798
799 vpflow.args2addattachedscheme(argv, cmds, "JMOL", "--jmol=", "");
800
801 vpflow.flag("JMOLGIF", aurostd::args2flag(argv, cmds, "--jgif"));
802 vpflow.args2addattachedscheme(argv, cmds, "JUSTAFTER", "--justafter=", "");
803 vpflow.args2addattachedscheme(argv, cmds, "JUSTBEFORE", "--justbefore=", "");
804 vpflow.args2addattachedscheme(argv, cmds, "JUSTBETWEEN", "--justbetween=", "");
805
806 vpflow.flag("LATTICEREDUCTION", aurostd::args2flag(argv, cmds, "--latticereduction|--latreduction"));
807
808 vpflow.args2addattachedscheme(argv, cmds, "LTCELL", "--ltcell=", "");
809 vpflow.args2addattachedscheme(argv, cmds, "LTCELLFV", "--ltcellfv=", "");
810
811 vpflow.args2addattachedscheme(argv, cmds, "LATTICE_TYPE", "--lattice_type=|--lattice=|--lattice_crystal=", ""); // DX20200820 - allow tolerance to be added
812 if (aurostd::args2attachedflag(argv, "--lattice_type=|--lattice=|--lattice_crystal=")) { // DX20200820 - add tolerance
813 vpflow.args2addattachedscheme(argv, cmds, "LATTICE::TOLERANCE", "--lattice_type=|--lattice=|--lattice_crystal=", ""); // DX20200907 - default is system specific, leaving empty
814 }
815 vpflow.args2addattachedscheme(argv, cmds, "LATTICE_LATTICE_TYPE", "--lattice_lattice_type=|--lattice_lattice=", ""); // DX20200820 - allow tolerance to be added
816 if (aurostd::args2attachedflag(argv, "--lattice_lattice_type=|--lattice_lattice=")) { // DX20200820 - add tolerance
817 vpflow.args2addattachedscheme(argv, cmds, "LATTICE_LATTICE::TOLERANCE", "--lattice_lattice_type=|--lattice_lattice=", ""); // DX20200907 - default is system specific, leaving empty
818 }
819 vpflow.flag("LATTICE_HISTOGRAM", aurostd::args2flag(argv, cmds, "--latticehistogram"));
820
821 // DX20181023 - list prototype labels - START
822 vpflow.flag("LIST_PROTOTYPE_LABELS", (aurostd::args2flag(argv, cmds, "--prototype_labels|--proto_labels"))); // && (argv.size()==2));
823 if (vpflow.flag("LIST_PROTOTYPE_LABELS")) {
824 vpflow.args2addattachedscheme(argv, cmds, "LIST_PROTOTYPE_LABELS::LIBRARY", "--library=|--catalog=", ""); // DX20190509 - added catalog variant
825 vpflow.args2addattachedscheme(argv, cmds, "LIST_PROTOTYPE_LABELS::ARITY", "--arity=|--number_of_species=|--species_count=", "");
826 vpflow.args2addattachedscheme(argv, cmds, "LIST_PROTOTYPE_LABELS::STOICHIOMETRY", "--stoichiometry=|--stoich=", "");
827 vpflow.args2addattachedscheme(argv, cmds, "LIST_PROTOTYPE_LABELS::SPACE_GROUP", "--space_group_number=|--space_group=|--sg=", "");
828 vpflow.args2addattachedscheme(argv, cmds, "LIST_PROTOTYPE_LABELS::WYCKOFF_STRING", "--Wyckoff_letters=|--wyckoff_letters=|--Wyckoff=|--wyckoff=", "");
829 vpflow.flag("LIST_PROTOTYPE_LABELS::JSON", aurostd::args2flag(argv, cmds, "--json"));
830 }
831 // DX20181023 - list prototype labels - END
832
833 vpflow.flag("MAGNETICPARAMETERS", aurostd::args2flag(argv, cmds, "--magpara") || aurostd::args2attachedflag(argv, cmds, "--magpara="));
834
835 vpflow.args2addattachedscheme(argv, cmds, "MAXATOMS", "--maxatoms=|--max_atoms=|--atomsmax=|--atoms_max=", "");
836
837 vpflow.flag("MAKESTRLIST", aurostd::args2flag(argv, cmds, "--make_strlist") && argv.at(1) == "--make_strlist");
838
839 vpflow.flag("MINKOWSKI_BASIS_REDUCTION", aurostd::args2flag(argv, cmds, "--minkowski_basis_reduction|--minkowski|--mink"));
840 vpflow.flag("MISCIBILITY", aurostd::args2flag(argv, cmds, "--MIX|--mix|--MISCIBILITY|--miscibility|--MISCIBILE|--miscibile"));
841 vpflow.flag("MOM", aurostd::args2flag(argv, cmds, "--mom"));
842 vpflow.flag("MSI", aurostd::args2flag(argv, cmds, "--msi"));
843
844 vpflow.flag("MULTI=SH", aurostd::args2flag(argv, cmds, "--multi=sh|--multish"));
845
846 vpflow.flag("NATOMS", aurostd::args2flag(argv, cmds, "--natoms|--numatoms"));
847 vpflow.flag("NBONDXX", aurostd::args2flag(argv, cmds, "--nbondxx")); // CO20171025
848 vpflow.flag("NAMES", (aurostd::args2flag(argv, cmds, "--names|--species") && (argv.at(1) == "--names" || argv.at(1) == "--species")));
849 vpflow.flag("NANOPARTICLE", (aurostd::args2flag(argv, cmds, "--nanoparticle") && argv.at(1) == "--nanoparticle"));
850 vpflow.flag("NDATA", aurostd::args2flag(argv, cmds, "--ndata"));
851 vpflow.flag("NIGGLI", aurostd::args2flag(argv, cmds, "--niggli"));
852 // vpflow.flag("NOSD",aurostd::args2flag(argv,cmds,"--nosd"));
853 vpflow.flag("NNDIST", aurostd::args2flag(argv, cmds, "--nn|--nearestneighbour|--nearestneighbor"));
854 vpflow.flag("NOORDERPARAMETER", aurostd::args2flag(argv, cmds, "--noorderparameter|--norderparameter|--noorder|--norder"));
855
856 vpflow.flag("NUMNAMES", aurostd::args2flag(argv, cmds, "--numnames") && argv.at(1) == "--numnames");
857 vpflow.flag("NSPECIES", aurostd::args2flag(argv, cmds, "--nspecies|--numspecies"));
858
859 vpflow.flag("PEARSON_SYMBOL", aurostd::args2attachedflag(argv, cmds, "--pearson_symbol|--pearson|--Pearson_symbol|--Pearson")); // DX20210611 - added capitalized variants and changed to args2attachedflag
860 // DX20210611 - START
861 if (vpflow.flag("PEARSON_SYMBOL")) {
862 vpflow.flag("PEARSON::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
863 if (aurostd::args2attachedflag(argv, "--pearson_symbol=|--pearson=|--Pearson_symbol=|--Pearson=")) {
864 vpflow.args2addattachedscheme(argv, cmds, "PEARSON_SYMBOL::TOLERANCE", "--pearson_symbol=|--pearson=|--Pearson_symbol=|--Pearson=", "");
865 }
866 if (aurostd::args2attachedflag(argv, "--tolerance_spectrum=|--tol_spectrum=")) {
867 vpflow.args2addattachedscheme(argv, cmds, "PEARSON_SYMBOL::TOLERANCE_SPECTRUM", "--tolerance_spectrum=|--tol_spectrum=", "0.01,1.0,100");
868 }
869 vpflow.args2addattachedscheme(argv, cmds, "PEARSON_SYMBOL::MAGNETIC", "--mag=|--magnetic=|--magmom=", "");
870 vpflow.flag("PEARSON_SYMBOL::USAGE", aurostd::args2flag(argv, cmds, "--usage"));
871 }
872 // DX20210611 - STOP
873 // vpflow.flag("POCCUPATION",aurostd::args2flag(argv,cmds,"--poccupation|--partial_occupation|--partialoccupation|--pocc"));
874 // vpflow.flag("OPARAMETER",aurostd::args2flag(argv,cmds,"--oparameter|--order_parameter|--orderparameter|--opar"));
875
876 vpflow.flag("PDB", aurostd::args2flag(argv, cmds, "--pdb"));
877 vpflow.flag("PDOS", aurostd::args2flag(argv, cmds, "--pdos") && argv.at(1) == "--pdos");
878 // DX20170818 - Added tolerance and no_scan options to Xgroups - START
879 vpflow.args2addattachedscheme(argv, cmds, "PGROUP", "--pointgroup=|--pgroup=", "");
880 if (vpflow.flag("PGROUP")) {
881 vpflow.flag("SYMMETRY::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
882 if (aurostd::args2attachedflag(argv, "--pointgroup=|--pgroup=")) { // DX20170803
883 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::TOLERANCE", "--pointgroup=|--pgroup=", ""); // DX20200907 - default is system specific, leaving empty
884 }
885 vpflow.flag("SYMMETRY::SCREEN_ONLY", aurostd::args2flag(argv, cmds, "--screen_only")); // DX20170803
886 // ME20210206 - web mode
887 if (XHOST.vflag_control.flag("WWW")) {
888 vpflow.flag("SYMMETRY::SCREEN_ONLY", true);
889 XHOST.QUIET = true;
890 }
891 }
892 // DX20170818 - Added tolerance and no_scan options to Xgroups - END
893 // DX20170818 - Added tolerance and no_scan options to Xgroups - START
894 vpflow.args2addattachedscheme(argv, cmds, "PGROUPX", "--pointgroup_crystal=|--pgroup_crystal=|--pgroup_xtal=|--pgroupx=|--pgroupX=", "");
895 if (vpflow.flag("PGROUPX")) {
896 vpflow.flag("SYMMETRY::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
897 if (aurostd::args2attachedflag(argv, "--pointgroup_crystal=|--pgroup_crystal=|--pgroup_xtal=|--pgroupx=|--pgroupX=")) { // DX20170803
898 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::TOLERANCE", "--pointgroup_crystal=|--pgroup_crystal=|--pgroup_xtal=|--pgroupx=|--pgroupX=", ""); // DX20200907 - default is system specific, leaving empty
899 }
900 vpflow.flag("SYMMETRY::SCREEN_ONLY", aurostd::args2flag(argv, cmds, "--screen_only")); // DX20170803
901 // DX20170921 - MAGNETIC SYMMETRY - START
902 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::MAGNETIC", "--mag=|--magnetic=|--magmom=", ""); // DX20170803
903 // DX20170921 - MAGNETIC SYMMETRY - END
904 // ME20210206 - web mode
905 if (XHOST.vflag_control.flag("WWW")) {
906 vpflow.flag("SYMMETRY::SCREEN_ONLY", true);
907 XHOST.QUIET = true;
908 }
909 }
910 // DX20170818 - Added tolerance and no_scan options to Xgroups - END
911 // DX20170818 - Added tolerance and no_scan options to Xgroups - START
912 vpflow.args2addattachedscheme(argv, cmds, "PGROUPK", "--pointgroupklattice=|--pgroupk=", "");
913 if (vpflow.flag("PGROUPK")) {
914 vpflow.flag("SYMMETRY::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
915 if (aurostd::args2attachedflag(argv, "--pointgroupklattice=|--pgroupk=")) { // DX20170803
916 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::TOLERANCE", "--pointgroupklattice=|--pgroupk=", ""); // DX20200907 - default is system specific, leaving empty
917 }
918 vpflow.flag("SYMMETRY::SCREEN_ONLY", aurostd::args2flag(argv, cmds, "--screen_only")); // DX20170803
919 // ME20210206 - web mode
920 if (XHOST.vflag_control.flag("WWW")) {
921 vpflow.flag("SYMMETRY::SCREEN_ONLY", true);
922 XHOST.QUIET = true;
923 }
924 }
925 // DX20170818 - Added tolerance and no_scan options to Xgroups - END
926 // DX20200206 - add Patterson symmetry - START
927 vpflow.args2addattachedscheme(argv, cmds, "PGROUPK_PATTERSON", "--pointgroupk_Patterson=|--pgroupk_Patterson=", "");
928 if (vpflow.flag("PGROUPK_PATTERSON")) {
929 vpflow.flag("SYMMETRY::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
930 if (aurostd::args2attachedflag(argv, "--pointgroupk_Patterson=|--pgroupk_Patterson=")) { // DX20170803
931 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::TOLERANCE", "--pointgroupk_Patterson=|--pgroupk_Patterson=", ""); // DX20200907 - default is system specific, leaving empty
932 }
933 vpflow.flag("SYMMETRY::SCREEN_ONLY", aurostd::args2flag(argv, cmds, "--screen_only")); // DX20170803
934 // ME20210206 - web mode
935 if (XHOST.vflag_control.flag("WWW")) {
936 vpflow.flag("SYMMETRY::SCREEN_ONLY", true);
937 XHOST.QUIET = true;
938 }
939 }
940 // DX20200206 - add Patterson symmetry - END
941 // DX20171205 - Added pgroupk_xtal - START
942 vpflow.args2addattachedscheme(argv, cmds, "PGROUPK_XTAL", "--pointgroupkcrystal=|--pgroupk_xtal=", "");
943 if (vpflow.flag("PGROUPK_XTAL")) {
944 vpflow.flag("SYMMETRY::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
945 if (aurostd::args2attachedflag(argv, "--pointgroupkcrystal=|--pgroupk_xtal=")) { // DX20170803
946 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::TOLERANCE", "--pointgroupkcrystal=|--pgroupk_xtal=", ""); // DX20200907 - default is system specific, leaving empty
947 }
948 vpflow.flag("SYMMETRY::SCREEN_ONLY", aurostd::args2flag(argv, cmds, "--screen_only")); // DX20170803
949 // ME20210206 - web mode
950 if (XHOST.vflag_control.flag("WWW")) {
951 vpflow.flag("SYMMETRY::SCREEN_ONLY", true);
952 XHOST.QUIET = true;
953 }
954 }
955 // DX20171205 - Added pgroupk_xtal - END
956 vpflow.flag("PLANEDENS", aurostd::args2flag(argv, cmds, "--planedens") && argv.at(1) == "--planedens");
957 vpflow.args2addattachedscheme(argv, cmds, "PLATON", "--platon=", "");
958
959 // ME20200313 - Added guards for when plots commands are used without = sign
960 if (aurostd::args2flag(argv, cmds, "--plotband|--plotbands|--plot_band|--plot_bands")) {
961 vpflow.flag("PLOT_BAND", true);
962 vpflow.addattachedscheme("PLOT_BAND", "./", true);
963 } else {
964 vpflow.args2addattachedscheme(argv, cmds, "PLOT_BAND", "--plotband=|--plotbands=|--plot_band=|--plot_bands=", "./"); // ME20190614
965 }
966 vpflow.args2addattachedscheme(argv, cmds, "PLOT_BANDSPINSPLIT", "--plotband_spinsplit=|--plot_band_spin_split=|--plotbands_spinsplit=|--plot_bands_spin_split=", "./");
967 vpflow.args2addattachedscheme(argv, cmds, "PLOT_BAND2", "--plotband2=|--plot_band2=|--plotbands2=|--plot_bands2=", "./");
968 if (aurostd::args2flag(argv, cmds, "--plotbanddos|--plotbandsdos|--plot_band_dos|--plot_bands_dos|--plotdosband|--plotdosbands|--plot_dos_band|--plot_dos_bands")) { // CO20210712
969 vpflow.flag("PLOT_BANDDOS", true);
970 vpflow.addattachedscheme("PLOT_BANDDOS", "./", true);
971 } else {
972 vpflow.args2addattachedscheme(argv, cmds, "PLOT_BANDDOS", "--plotbanddos=|--plotbandsdos=|--plot_band_dos=|--plot_bands_dos=|--plotdosband=|--plotdosbands=|--plot_dos_band=|--plot_dos_bands=", "./"); // ME20190614 //CO20210712
973 }
974 if (aurostd::args2flag(argv, cmds, "--plotdos|--plot_dos")) {
975 vpflow.flag("PLOT_DOS", true);
976 vpflow.addattachedscheme("PLOT_DOS", "./", true);
977 } else {
978 vpflow.args2addattachedscheme(argv, cmds, "PLOT_DOS", "--plotdos=|--plot_dos=", "./");
979 }
980 vpflow.flag("PLOT_ALL_ATOMS", aurostd::args2flag(argv, cmds, "--plot_all_atoms|--plotallatoms")); // CO20191010
981 vpflow.args2addattachedscheme(argv, cmds, "PLOT_DOSWEB", "--plotdosweb=|--plot_dos_web=", "./");
982 if (aurostd::args2flag(argv, cmds, "--plotpedos|--plotpdos|--plot_pedos|--plot_pdos")) {
983 vpflow.flag("PLOT_PDOS", true);
984 vpflow.addattachedscheme("PLOT_PDOS", "./", true);
985 } else {
986 vpflow.args2addattachedscheme(argv, cmds, "PLOT_PDOS", "--plotpedos=|--plotpdos=|--plot_pedos=|--plot_pdos=", "./"); // ME20190614
987 }
988 if (aurostd::args2flag(argv, cmds, "--plotpedosall|--plotpdosall|--plot_pedos_all|--plot_pdos_all")) {
989 vpflow.flag("PLOT_PDOSALL", true);
990 vpflow.addattachedscheme("PLOT_PDOSALL", "./", true);
991 } else {
992 vpflow.args2addattachedscheme(argv, cmds, "PLOT_PDOSALL", "--plotpedosall=|--plotpdosall=|--plot_pedos_all=|--plot_pdos_all=", "./"); // ME20190614
993 }
994 vpflow.args2addattachedscheme(argv, cmds, "PLOT_PEDOSALL_AFLOWLIB", "--plotpedos_nonequivalent=", "./");
995 // ME20190614 BEGIN
996 if (aurostd::args2flag(argv, cmds, "--plotthermo|--plot_thermo")) {
997 vpflow.flag("PLOT_THERMO", true);
998 vpflow.addattachedscheme("PLOT_THERMO", "./", true);
999 } else {
1000 vpflow.args2addattachedscheme(argv, cmds, "PLOT_THERMO", "--plotthermo=|--plot_thermo=", "./");
1001 }
1002 if (aurostd::args2flag(argv, cmds, "--plottcond|--plotthermalconductivity|--plot_tcond|--plot_thermal_conductivity")) {
1003 vpflow.flag("PLOT_TCOND", true);
1004 vpflow.addattachedscheme("PLOT_TCOND", "./", true);
1005 } else {
1006 vpflow.args2addattachedscheme(argv, cmds, "PLOT_TCOND", "--plottcond=|--plotthermalconductivity=|--plot_tcond=|--plot_thermal_conductivity=", "./");
1007 }
1008 if (aurostd::args2flag(argv, cmds, "--plotphdos|--plot_phdos")) {
1009 vpflow.flag("PLOT_PHDOS", true);
1010 vpflow.addattachedscheme("PLOT_PHDOS", "./", true);
1011 } else {
1012 vpflow.args2addattachedscheme(argv, cmds, "PLOT_PHDOS", "--plotphdos=|--plot_phdos=", "./");
1013 }
1014 if (aurostd::args2flag(argv, cmds, "--plotphdisp|--plotphonondispersion|--plotphononsdispersion|--pphdis|--plot_phdisp|--plot_phonon_dispersion|--plot_phonons_dispersion")) {
1015 vpflow.flag("PLOT_PHDISP", true);
1016 vpflow.addattachedscheme("PLOT_PHDISP", "./", true);
1017 } else {
1018 vpflow.args2addattachedscheme(argv, cmds, "PLOT_PHDISP", "--plotphdisp=|--plotphonondispersion=|--plotphononsdispersion=|--pphdis=|--plot_phdisp=|--plot_phonon_dispersion=|--plot_phonons_dispersion=", "./");
1019 }
1020 if (aurostd::args2flag(argv, cmds, "--plotphdispdos|--plot_phdispdos")) {
1021 vpflow.flag("PLOT_PHDISPDOS", true);
1022 vpflow.addattachedscheme("PLOT_PHDISPDOS", "./", true);
1023 } else {
1024 vpflow.args2addattachedscheme(argv, cmds, "PLOT_PHDISPDOS", "--plotphdispdos=|--plot_phdispdos=", "./");
1025 }
1026 // Additional DOS/band structure options
1027 vpflow.flag("PLOTTER::NOSHIFT", aurostd::args2flag(argv, cmds, "--noshift"));
1028 vpflow.flag("PLOTTER::NOWATERMARK", aurostd::args2flag(argv, cmds, "--nowatermark"));
1029 vpflow.args2addattachedscheme(argv, cmds, "PLOTTER::PROJECTION", "--projection=", "ORBITALS");
1030 vpflow.args2addattachedscheme(argv, cmds, "PLOTTER::UNIT", "--unit=", "EV");
1031 vpflow.args2addattachedscheme(argv, cmds, "PLOTTER::PRINT", "--print=", "pdf");
1032 vpflow.args2addattachedscheme(argv, cmds, "PLOTTER::TITLE", "--title=", "");
1033 vpflow.args2addattachedscheme(argv, cmds, "PLOTTER::OUTFILE", "--outfile=", ""); // ME20200313 - user defined output file name
1034 // ME20190614 END
1035 // AS20200909 BEGIN
1036 if (aurostd::args2flag(argv, cmds, "--plotthermoqha")) {
1037 vpflow.flag("PLOT_THERMO_QHA", true);
1038 vpflow.addattachedscheme("PLOT_THERMO_QHA", "./", true);
1039 } else {
1040 vpflow.args2addattachedscheme(argv, cmds, "PLOT_THERMO_QHA", "--plotthermoqha=", "./");
1041 }
1042 vpflow.args2addattachedscheme(argv, cmds, "PLOTTER::EOSMODEL", "--eosmodel=", "SJ"); // AS20210705
1043 // AS20200909 END
1044 // AS20210701 BEGIN
1045 if (aurostd::args2flag(argv, cmds, "--plotgrdisp|--plotgruneisendispersion|--plotgrueneisendispersion")) {
1046 vpflow.flag("PLOT_GRUENEISEN_DISPERSION", true);
1047 vpflow.addattachedscheme("PLOT_GRUENEISEN_DISPERSION", "./", true);
1048 } else {
1049 vpflow.args2addattachedscheme(argv, cmds, "PLOT_GRUENEISEN_DISPERSION", "--plotgrdisp=", "./");
1050 }
1051 // AS20210701 END
1052
1053 vpflow.flag("POCC", aurostd::args2flag(argv, cmds, "--pocc") && argv.at(1) == "--pocc");
1054 vpflow.args2addattachedscheme(argv, cmds, "POCC_DOS", "--pocc_dos=", "./");
1055 vpflow.args2addattachedscheme(argv, cmds, "POCC_MAG", "--pocc_mag=", "./");
1056 vpflow.args2addattachedscheme(argv, cmds, "POCC_BANDGAP", "--pocc_bandgap=", "./");
1057 vpflow.args2addattachedscheme(argv, cmds, "POCC_MINIMUM_CONFIGURATION", "--pocc_minimum_configuration|--pocc_min", "./"); // CO20190803
1058
1059 // ME20181113
1060 // vpflow.args2addattachedscheme(argv,cmds,"MODULE","--module=",""); //ME20190112
1061
1062 // AFLOW modules
1063 vpflow.args2addattachedscheme(argv, cmds, "AFLOW::MODULE", "--module=", ""); // CO20180214
1064
1065 vpflow.flag("RENDER", aurostd::args2flag(argv, cmds, "--render"));
1066 if (vpflow.flag("RENDER")) {
1067 vpflow.args2addattachedscheme(argv, cmds, "RENDER_OUT", "--directory=|-d=", "");
1068 }
1069 vpflow.flag("POSCAR", aurostd::args2flag(argv, cmds, "--poscar"));
1070 vpflow.flag("POSCAR2AFLOWIN", aurostd::args2flag(argv, cmds, "--poscar2aflowin|--poscaraflowin|--poscar2aflow|--poscaraflow"));
1071 vpflow.flag("POSCAR2WYCKOFF", aurostd::args2flag(argv, cmds, "--poscar2wyckoff"));
1072 // CO
1073 vpflow.args2addattachedscheme(argv, cmds, "PREPARE_CHGCAR_4_JMOL", "--prepare_chgcar_4_jmol=|--prep4jmol=", ""); // can be multiple
1074 if (vpflow.flag("PREPARE_CHGCAR_4_JMOL")) {
1075 vpflow.flag("PREPARE_CHGCAR_4_JMOL::USAGE", aurostd::args2flag(argv, cmds, "--usage")); // usage
1076 vpflow.args2addattachedscheme(argv, cmds, "PREPARE_CHGCAR_4_JMOL::OUTCAR", "--outcar=", ""); // singular
1077 vpflow.flag("PREPARE_CHGCAR_4_JMOL::ZIP", aurostd::args2flag(argv, cmds, "--zip"));
1078 }
1079 vpflow.flag("PRIM", aurostd::args2flag(argv, cmds, "--prim|--prim0"));
1080 vpflow.flag("PRIM1", aurostd::args2flag(argv, cmds, "--prim1"));
1081 vpflow.flag("PRIM2", aurostd::args2flag(argv, cmds, "--prim2"));
1082 vpflow.flag("PRIM3", aurostd::args2flag(argv, cmds, "--prim3"));
1083
1084 vpflow.args2addattachedscheme(argv, cmds, "PROTO", "--proto=|--proto_icsd=", ""); // --proto=123:A:B:C --proto_icsd=Gd1Mn2Si2_ICSD_54947
1085 vpflow.args2addattachedscheme(argv, cmds, "PARAMS", "--params=|--parameters=", ""); // --proto=123:A:B:C --proto_icsd=Gd1Mn2Si2_ICSD_54947
1086 vpflow.args2addattachedscheme(argv, cmds, "POCC_PARAMS", "--pocc_params=", ""); // --pocc_params=S0-1xC_S1-0.5xE-0.5xF_S2-0.3333xA-0.3333xB-0.3333xD
1087 vpflow.args2addattachedscheme(argv, cmds, "POCC_TOL", "--pocc_tol=", ""); // --pocc_params=S0-1xC_S1-0.5xE-0.5xF_S2-0.3333xA-0.3333xB-0.3333xD
1088 if (vpflow.flag("POCC_PARAMS")) {
1089 if (LDEBUG) {
1090 cerr << "PflowARGs(): BEFORE pocc_params=" << vpflow.getattachedscheme("POCC_PARAMS") << endl;
1091 }
1092 vpflow.push_attached("POCC_PARAMS", vpflow.getattachedscheme("POCC_PARAMS")); // CO20190126 - do later //pflow::FIX_POCC_PARAMS()
1093 if (LDEBUG) {
1094 cerr << "PflowARGs(): AFTER pocc_params=" << vpflow.getattachedscheme("POCC_PARAMS") << endl;
1095 }
1096 }
1097 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW", "--aflow_proto=|--aflow_proto_icsd=", ""); // --aflow_proto=123:A:B:C --aflow_proto_icsd=Gd1Mn2Si2_ICSD_54947
1098 if (vpflow.flag("PROTO") || vpflow.flag("PROTO_AFLOW")) { // CO20180622 - set these flags if structure is downloaded from web
1099 vpflow.flag("PROTO::VASP", aurostd::args2flag(argv, cmds, "--vasp") || (!aurostd::args2flag(argv, cmds, "--qe") && !aurostd::args2flag(argv, cmds, "--abinit") && !aurostd::args2flag(argv, cmds, "--aims") &&
1100 !aurostd::args2flag(argv, cmds, "--cif") && !aurostd::args2flag(argv, cmds, "--elk") && aurostd::args2flag(argv, cmds, "--lmp"))); // DX20190131 //DX20200313 - added elk /SD20240111 - added lmp
1101 vpflow.flag("PROTO::ITC", aurostd::args2flag(argv, cmds, "--itc")); // CO20220613
1102 vpflow.flag("PROTO::QE", aurostd::args2flag(argv, cmds, "--qe"));
1103 vpflow.flag("PROTO::ABCCAR", aurostd::args2flag(argv, cmds, "--abccar")); // DX20190123 - add abccar output
1104 vpflow.flag("PROTO::ABINIT", aurostd::args2flag(argv, cmds, "--abinit"));
1105 vpflow.flag("PROTO::AIMS", aurostd::args2flag(argv, cmds, "--aims"));
1106 vpflow.flag("PROTO::CIF", aurostd::args2flag(argv, cmds, "--cif")); // DX20190123 - add cif output
1107 vpflow.flag("PROTO::ELK", aurostd::args2flag(argv, cmds, "--elk")); // DX20200313 - add elk output
1108 vpflow.flag("PROTO::LMP", aurostd::args2flag(argv, cmds, "--lmp")); // SD20240111 - add lmp output
1109 vpflow.flag("PROTO::HEX", aurostd::args2flag(argv, cmds, "--hex"));
1110 vpflow.flag("PROTO::RHL", aurostd::args2flag(argv, cmds, "--rhl"));
1111 vpflow.flag("PROTO::ADD_EQUATIONS", aurostd::args2flag(argv, cmds, "--add_equations")); // DX20180615 - add equation info
1112 vpflow.flag("PROTO::EQUATIONS_ONLY", aurostd::args2flag(argv, cmds, "--equations_only")); // DX20180615 - add equation info
1113 vpflow.flag("PROTO::SYMBOLS_ONLY", aurostd::args2flag(argv, cmds, "--parameter_symbols_only")); // HE20250524 - add parameter info
1114 vpflow.flag("PROTO::WEBPAGE", aurostd::args2flag(argv, cmds, "--webpage")); // HE20250524 - allow different rules for the webpage generation
1115 vpflow.flag("PROTO::STRICT", aurostd::args2flag(argv, cmds, "--strict")); // HE20250527 - enforce atom count check
1116 vpflow.flag("PROTO::USE_ANRL_LATTICE_PARAM", aurostd::args2flag(argv, cmds, "--use_anrl_lattice_param|--use_anrl_lattice_parameter")); // DX20190227 - add original lattice parameter option
1117 vpflow.flag("BADER", false); // CO20181226 don't run bader
1118 vpflow.flag("ITC", false); // PRIORITIES //CO20220613
1119 vpflow.flag("QE", false); // PRIORITIES
1120 vpflow.flag("ABCCAR", false); // PRIORITIES //DX20190123 - add ABCCAR
1121 vpflow.flag("ABINIT", false); // PRIORITIES
1122 vpflow.flag("AIMS", false); // PRIORITIES
1123 vpflow.flag("CIF", false); // PRIORITIES //DX20190123 - add CIF
1124 vpflow.flag("ELK", false); // PRIORITIES //DX20200313 - add ELK
1125 vpflow.flag("LMP", false); // PRIORITIES //SD20240111 - add LMP
1126 }
1127 //[CO20180627 - MOVED UP]vpflow.args2addattachedscheme(argv,cmds,"PROTO_AFLOW","--aflow_proto=|--aflow_proto_icsd=",""); // --aflow_proto=123:A:B:C --aflow_proto_icsd=Gd1Mn2Si2_ICSD_54947
1128 if (vpflow.flag("PROTO_AFLOW")) {
1129 string vlist;
1130 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::PRESSURE", "--pressure=|--PRESSURE=|--pstress=|--PSTRESS=", "");
1131 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::POTENTIAL", "--potential=|--pp=|--potentials=", "");
1132 if (vpflow.flag("PROTO_AFLOW::POTENTIAL")) {
1133 vlist += "--potential=" + vpflow.getattachedscheme("PROTO_AFLOW::POTENTIAL") + " ";
1134 }
1135
1136 // AFLOW modules
1137 if (vpflow.flag("AFLOW::MODULE")) {
1138 vlist += "--module=" + vpflow.getattachedscheme("AFLOW::MODULE") + " ";
1139 }
1140 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::APL_SUPERCELL", "--apl_supercell=", ""); // CO20180214
1141 if (vpflow.flag("PROTO_AFLOW::APL_SUPERCELL")) {
1142 vlist += "--apl_supercell=" + vpflow.getattachedscheme("PROTO_AFLOW::APL_SUPERCELL") + " ";
1143 }
1144
1145 vpflow.flag("PROTO_AFLOW::BADER", aurostd::args2flag(argv, cmds, "--bader|--run_bader|--BADER|--RUN_BADER")); // CO20180214
1146 if (vpflow.flag("PROTO_AFLOW::BADER")) {
1147 vlist += "--bader "; // CO20180214
1148 }
1149 vpflow.flag("PROTO_AFLOW::SPIN_REMOVE_RELAX_1", aurostd::args2flag(argv, cmds, "--spin_remove_relax_1|--SPIN_REMOVE_RELAX_1")); // CO20180214
1150 if (vpflow.flag("PROTO_AFLOW::SPIN_REMOVE_RELAX_1")) {
1151 vlist += "--spin_remove_relax_1 "; // CO20180214
1152 }
1153 vpflow.flag("PROTO_AFLOW::SPIN_REMOVE_RELAX_2", aurostd::args2flag(argv, cmds, "--spin_remove_relax_2|--SPIN_REMOVE_RELAX_2")); // CO20180214
1154 if (vpflow.flag("PROTO_AFLOW::SPIN_REMOVE_RELAX_2")) {
1155 vlist += "--spin_remove_relax_2 "; // CO20180214
1156 }
1157
1158 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::POTIM", "--potim=|--POTIM=", "");
1159 if (vpflow.flag("PROTO_AFLOW::POTIM")) {
1160 vlist += "--potim=" + vpflow.getattachedscheme("PROTO_AFLOW::POTIM") + " ";
1161 }
1162 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::RELAX_TYPE", "--relax_type=|--RELAX_TYPE=", ""); // CO20180214
1163 if (vpflow.flag("PROTO_AFLOW::RELAX_TYPE")) {
1164 vlist += "--relax_type=" + vpflow.getattachedscheme("PROTO_AFLOW::RELAX_TYPE") + " ";
1165 }
1166 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::RELAX_MODE", "--relax_mode=|--RELAX_MODE=", "");
1167 if (vpflow.flag("PROTO_AFLOW::RELAX_MODE")) {
1168 vlist += "--relax_mode=" + vpflow.getattachedscheme("PROTO_AFLOW::RELAX_MODE") + " ";
1169 }
1170 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::RELAX_COUNT", "--relax_count=|--RELAX_COUNT=", ""); // CO20181226
1171 if (vpflow.flag("PROTO_AFLOW::RELAX_COUNT")) {
1172 vlist += "--relax_count=" + vpflow.getattachedscheme("PROTO_AFLOW::RELAX_COUNT") + " ";
1173 }
1174 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::RUN_RELAX_STATIC", "--run_relax_static|--RUN_RELAX_STATIC|--relax_static", ""); // CO20181226
1175 if (vpflow.flag("PROTO_AFLOW::RUN_RELAX_STATIC")) {
1176 vlist += "--run_relax_static ";
1177 }
1178 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::RUN_RELAX_STATIC_BANDS", "--run_relax_static_bands|--RUN_RELAX_STATIC_BANDS|--relax_static_bands|--bands|--band", ""); // CO20181226
1179 if (vpflow.flag("PROTO_AFLOW::RUN_RELAX_STATIC_BANDS")) {
1180 vlist += "--run_relax_static_bands ";
1181 }
1182 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::RUN_RELAX_STATIC_DIELECTRIC", "--run_relax_static_dielectric|--RUN_RELAX_STATIC_DIELECTRIC|--relax_static_dielectric|--dielectric", ""); // CO20181226
1183 if (vpflow.flag("PROTO_AFLOW::RUN_RELAX_STATIC_DIELECTRIC")) {
1184 vlist += "--run_relax_static_dielectric ";
1185 }
1186 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::RUN_STATIC", "--run_static|--RUN_STATIC|--static", ""); // CO20181226
1187 if (vpflow.flag("PROTO_AFLOW::RUN_STATIC")) {
1188 vlist += "--run_static ";
1189 }
1190 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::RUN_STATIC_BANDS", "--run_static_bands|--RUN_STATIC_BANDS|--static_bands", ""); // CO20181226
1191 if (vpflow.flag("PROTO_AFLOW::RUN_STATIC_BANDS")) {
1192 vlist += "--run_static_bands ";
1193 }
1194 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::RUN_STATIC_DIELECTRIC", "--run_static_dielectric|--RUN_STATIC_DIELECTRIC|--static_dielectric", ""); // CO20181226
1195 if (vpflow.flag("PROTO_AFLOW::RUN_STATIC_DIELECTRIC")) {
1196 vlist += "--run_static_dielectric ";
1197 }
1198 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::PRECISION", "--prec=|--PREC=|--precision=|--PRECISION=", "");
1199 if (vpflow.flag("PROTO_AFLOW::PRECISION")) {
1200 vlist += "--precision=" + vpflow.getattachedscheme("PROTO_AFLOW::PRECISION") + " ";
1201 }
1202 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::ALGORITHM", "--algo=|--ALGO=|--algorithm=|--ALGORITHM=", "");
1203 if (vpflow.flag("PROTO_AFLOW::ALGORITHM")) {
1204 vlist += "--algorithm=" + vpflow.getattachedscheme("PROTO_AFLOW::ALGORITHM") + " ";
1205 }
1206 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::METAGGA", "--metagga=|--METAGGA=", "");
1207 if (vpflow.flag("PROTO_AFLOW::METAGGA")) {
1208 vlist += "--metagga=" + vpflow.getattachedscheme("PROTO_AFLOW::METAGGA") + " ";
1209 }
1210 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::IVDW", "--ivdw=|--IVDW=", "");
1211 if (vpflow.flag("PROTO_AFLOW::IVDW")) {
1212 vlist += "--ivdw=" + vpflow.getattachedscheme("PROTO_AFLOW::IVDW") + " ";
1213 }
1214 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::TYPE", "--type=|--TYPE=", "");
1215 if (vpflow.flag("PROTO_AFLOW::TYPE")) {
1216 vlist += "--type=" + vpflow.getattachedscheme("PROTO_AFLOW::TYPE") + " ";
1217 }
1218 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::CONVERT_UNIT_CELL", "--convert_unit_cell=|--CONVERT_UNIT_CELL=", "");
1219 if (vpflow.flag("PROTO_AFLOW::CONVERT_UNIT_CELL")) {
1220 vlist += "--convert_unit_cell=" + vpflow.getattachedscheme("PROTO_AFLOW::CONVERT_UNIT_CELL") + " ";
1221 }
1222 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::VOLUME_PLUS_EQUAL", "--volume_plus_equal=|--VOLUME_PLUS_EQUAL=", "");
1223 if (vpflow.flag("PROTO_AFLOW::VOLUME_PLUS_EQUAL")) {
1224 vlist += "--volume_plus_equal=" + vpflow.getattachedscheme("PROTO_AFLOW::VOLUME_PLUS_EQUAL") + " ";
1225 }
1226 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::VOLUME_MULTIPLY_EQUAL", "--volume_multiply_equal=|--VOLUME_MULTIPLY_EQUAL=", "");
1227 if (vpflow.flag("PROTO_AFLOW::VOLUME_MULTIPLY_EQUAL")) {
1228 vlist += "--volume_multiply_equal=" + vpflow.getattachedscheme("PROTO_AFLOW::VOLUME_MULTIPLY_EQUAL") + " ";
1229 }
1230 vpflow.flag("PROTO_AFLOW::VOLUME_PRESERVED", aurostd::args2flag(argv, cmds, "--volume_preserved|--no_volume_adjustment")); // CO20180214
1231 if (vpflow.flag("PROTO_AFLOW::VOLUME_PRESERVED")) {
1232 vlist += "--volume_preserved "; // CO20180214
1233 }
1234 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::EDIFFG", "--ediffg=|--EDIFFG=", "");
1235 if (vpflow.flag("PROTO_AFLOW::EDIFFG")) {
1236 vlist += "--ediffg=" + vpflow.getattachedscheme("PROTO_AFLOW::EDIFFG") + " ";
1237 }
1238
1239 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::KSCHEME", "--kscheme=|--KSCHEME=", ""); // CO20181226
1240 if (vpflow.flag("PROTO_AFLOW::KSCHEME")) {
1241 vlist += "--kscheme=" + vpflow.getattachedscheme("PROTO_AFLOW::KSCHEME") + " ";
1242 }
1243 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::KSCHEME_STATIC", "--kscheme_static=|--KSCHEME_STATIC=", ""); // CO20181226
1244 if (vpflow.flag("PROTO_AFLOW::KSCHEME_STATIC")) {
1245 vlist += "--kscheme_static=" + vpflow.getattachedscheme("PROTO_AFLOW::KSCHEME_STATIC") + " ";
1246 }
1247 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::KSCHEME_DIELECTRIC", "--kscheme_dielectric=|--KSCHEME_DIELECTRIC=", "");
1248 if (vpflow.flag("PROTO_AFLOW::KSCHEME_DIELECTRIC")) {
1249 vlist += "--kscheme_dielectric=" + vpflow.getattachedscheme("PROTO_AFLOW::KSCHEME_DIELECTRIC") + " ";
1250 }
1251
1252 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::KPPRA", "--kppra=|--KPPRA=", "");
1253 if (vpflow.flag("PROTO_AFLOW::KPPRA") && vpflow.flag("KPOINTS")) {
1254 vpflow.flag("KPOINTS", false);
1255 } // CO20200223 - --kppra collision
1256 if (vpflow.flag("PROTO_AFLOW::KPPRA")) {
1257 vlist += "--kppra=" + vpflow.getattachedscheme("PROTO_AFLOW::KPPRA") + " ";
1258 }
1259 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::KPPRA_STATIC", "--kppra_static=|--KPPRA_STATIC=", "");
1260 if (vpflow.flag("PROTO_AFLOW::KPPRA_STATIC")) {
1261 vlist += "--kppra_static=" + vpflow.getattachedscheme("PROTO_AFLOW::KPPRA_STATIC") + " ";
1262 }
1263 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::KPPRA_DIELECTRIC", "--kppra_dielectric=|--KPPRA_DIELECTRIC=", "");
1264 if (vpflow.flag("PROTO_AFLOW::KPPRA_DIELECTRIC")) {
1265 vlist += "--kppra_dielectric=" + vpflow.getattachedscheme("PROTO_AFLOW::KPPRA_DIELECTRIC") + " ";
1266 }
1267 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::BANDS_GRID", "--bands_grid=|--BANDS_GRID=", "");
1268 if (vpflow.flag("PROTO_AFLOW::BANDS_GRID")) {
1269 vlist += "--bands_grid=" + vpflow.getattachedscheme("PROTO_AFLOW::BANDS_GRID") + " ";
1270 }
1271
1272 vpflow.args2addattachedscheme(argv, cmds, "PROTO_AFLOW::ENMAX_MULTIPLY", "--enmax_multiply=|--ENMAX_MULTIPLY=", "");
1273 if (vpflow.flag("PROTO_AFLOW::ENMAX_MULTIPLY")) {
1274 vlist += "--enmax_multiply=" + vpflow.getattachedscheme("PROTO_AFLOW::ENMAX_MULTIPLY") + " ";
1275 }
1276
1277 vpflow.flag("PROTO_AFLOW::USAGE", aurostd::args2flag(argv, cmds, "--usage"));
1278 vpflow.flag("PROTO_AFLOW::POTENTIAL_TYPE", aurostd::args2flag(argv, cmds, "--potential_type|--pottype|--potentials_type|--potstype|--pott")); // CO20191110
1279 if (vpflow.flag("PROTO_AFLOW::POTENTIAL_TYPE")) {
1280 vlist += "--potential_type ";
1281 }
1282 vpflow.flag("PROTO_AFLOW::POTENTIAL_COMPLETE", aurostd::args2flag(argv, cmds, "--potential_complete|--potcomplete|--potentials_complete|--potscomplete|--potc|--potential_type_date|--potentialtypedate")); // CO20191110
1283 if (vpflow.flag("PROTO_AFLOW::POTENTIAL_COMPLETE")) {
1284 vlist += "--potential_complete ";
1285 }
1286 vpflow.flag("PROTO_AFLOW::MISSING", aurostd::args2flag(argv, cmds, "--missing"));
1287 if (vpflow.flag("PROTO_AFLOW::MISSING")) {
1288 vlist += "--missing ";
1289 }
1290 vpflow.flag("PROTO_AFLOW::NOAUTOPP", aurostd::args2flag(argv, cmds, "--noautopp"));
1291 if (vpflow.flag("PROTO_AFLOW::NOAUTOPP")) {
1292 vlist += "--noautopp ";
1293 }
1294 vpflow.flag("PROTO_AFLOW::LDAU", aurostd::args2flag(argv, cmds, "--ldau|--ldau2"));
1295 if (vpflow.flag("PROTO_AFLOW::LDAU")) {
1296 vlist += "--ldau ";
1297 }
1298 vpflow.flag("PROTO_AFLOW::NOLDAU", aurostd::args2flag(argv, cmds, "--noldau|--noldau2"));
1299 if (vpflow.flag("PROTO_AFLOW::NOLDAU")) {
1300 vlist += "--noldau ";
1301 }
1302 vpflow.flag("PROTO_AFLOW::NEGLECT_NOMIX", aurostd::args2flag(argv, cmds, "--neglect_nomix|--neglectnomix"));
1303 if (vpflow.flag("PROTO_AFLOW::NEGLECT_NOMIX")) {
1304 vlist += "--neglect_nomix ";
1305 }
1306 vpflow.flag("PROTO_AFLOW::STDOUT", aurostd::args2flag(argv, cmds, "--stdout"));
1307 if (vpflow.flag("PROTO_AFLOW::STDOUT")) {
1308 vlist += "--stdout ";
1309 }
1310 vpflow.flag("PROTO_AFLOW::QE", aurostd::args2flag(argv, cmds, "--qe"));
1311 if (vpflow.flag("PROTO_AFLOW::QE")) {
1312 vlist += "--qe ";
1313 }
1314 vpflow.flag("PROTO_AFLOW::ABCCAR", aurostd::args2flag(argv, cmds, "--abccar")); // DX20190131 //DX20190123 - added CIF
1315 if (vpflow.flag("PROTO_AFLOW::ABCCAR")) {
1316 vlist += "--abccar "; // DX20190131
1317 }
1318 vpflow.flag("PROTO_AFLOW::ABINIT", aurostd::args2flag(argv, cmds, "--abinit"));
1319 if (vpflow.flag("PROTO_AFLOW::ABINIT")) {
1320 vlist += "--abinit ";
1321 }
1322 vpflow.flag("PROTO_AFLOW::AIMS", aurostd::args2flag(argv, cmds, "--aims"));
1323 if (vpflow.flag("PROTO_AFLOW::AIMS")) {
1324 vlist += "--aims ";
1325 }
1326 vpflow.flag("PROTO_AFLOW::CIF", aurostd::args2flag(argv, cmds, "--cif")); // DX20190131 //DX20190123 - added CIF
1327 if (vpflow.flag("PROTO_AFLOW::CIF")) {
1328 vlist += "--cif "; // DX20190131
1329 }
1330 vpflow.flag("PROTO_AFLOW::ELK", aurostd::args2flag(argv, cmds, "--elk")); // DX20200313 - added ELK
1331 if (vpflow.flag("PROTO_AFLOW::ELK")) {
1332 vlist += "--elk ";
1333 }
1334 vpflow.flag("PROTO_AFLOW::LMP", aurostd::args2flag(argv, cmds, "--lmp")); // SD20240111 - added LMP
1335 if (vpflow.flag("PROTO_AFLOW::LMP")) {
1336 vlist += "--lmp ";
1337 }
1338 vpflow.flag("PROTO_AFLOW::HEX", aurostd::args2flag(argv, cmds, "--hex"));
1339 if (vpflow.flag("PROTO_AFLOW::HEX")) {
1340 vlist += "--hex ";
1341 }
1342 vpflow.flag("PROTO_AFLOW::RHL", aurostd::args2flag(argv, cmds, "--rhl"));
1343 if (vpflow.flag("PROTO_AFLOW::RHL")) {
1344 vlist += "--rhl ";
1345 }
1346 vpflow.flag("PROTO_AFLOW::VASP", aurostd::args2flag(argv, cmds, "--vasp"));
1347 if (vpflow.flag("PROTO_AFLOW::VASP")) {
1348 vlist += "--vasp ";
1349 }
1350 vpflow.flag("PROTO_AFLOW::ITC", aurostd::args2flag(argv, cmds, "--itc")); // CO20220613
1351 if (vpflow.flag("PROTO_AFLOW::ITC")) {
1352 vlist += "--itc ";
1353 }
1354 vpflow.flag("PROTO_AFLOW::HTQC", aurostd::args2flag(argv, "--htqc"));
1355 if (vpflow.flag("PROTO_AFLOW::HTQC")) {
1356 vlist += "--htqc ";
1357 }
1358 vpflow.flag("PROTO_AFLOW::LIST", aurostd::args2flag(argv, cmds, "--list"));
1359 // if(vpflow.flag("PROTO_AFLOW::LIST")) vlist+="--listDEBUG ";
1360 if (vpflow.flag("PROTO_AFLOW::LIST")) {
1361 vpflow.push_attached("PROTO_AFLOW::LIST_VCMD", vlist);
1362 }
1363 vpflow.flag("KPOINTS", false); // PRIORITIES
1364 vpflow.flag("ITC", false); // PRIORITIES //CO20220613
1365 vpflow.flag("QE", false); // PRIORITIES
1366 vpflow.flag("ABCCAR", false); // PRIORITIES //DX20190123 - add ABCCAR
1367 vpflow.flag("ABINIT", false); // PRIORITIES
1368 vpflow.flag("AIMS", false); // PRIORITIES
1369 vpflow.flag("CIF", false); // PRIORITIES //DX20190123 - add CIF
1370 vpflow.flag("ELK", false); // PRIORITIES //DX20200313 - add ELK
1371 vpflow.flag("LMP", false); // PRIORITIES //SD20240111 - add LMP
1372 }
1373
1374 vpflow.flag("PROTOINITIAL", aurostd::args2flag(argv, cmds, "--initial"));
1375
1376 // PSEUDOPOTENTIAL CHECK
1377 vpflow.args2addattachedscheme(argv, cmds, "PSEUDOPOTENTIALS_CHECK", "--pseudopotentials_check=|--pp_check=|--ppk=", "");
1378 if (vpflow.flag("PSEUDOPOTENTIALS_CHECK")) {
1379 vpflow.flag("PSEUDOPOTENTIALS_CHECK::USAGE", aurostd::args2flag(argv, cmds, "--usage"));
1380 }
1381
1382 // ME20211103
1383 if (aurostd::args2flag(argv, cmds, "--python_modules|--create_python_modules")) {
1384 vpflow.flag("PYTHON_MODULES", true);
1385 vpflow.addattachedscheme("PYTHON_MODULES", "", true);
1386 } else {
1387 vpflow.args2addattachedscheme(argv, cmds, "PYTHON_MODULES", "--python_modules=|--create_python_modules=", "");
1388 }
1389
1390 // MOVE ON
1391 vpflow.flag("ITC", aurostd::args2flag(argv, cmds, "--itc") && !vpflow.flag("PROTO_AFLOW") && !vpflow.flag("PROTO")); // CO20220613
1392 vpflow.flag("QE", aurostd::args2flag(argv, cmds, "--qe") && !vpflow.flag("PROTO_AFLOW") && !vpflow.flag("PROTO"));
1393 vpflow.flag("ABCCAR", aurostd::args2flag(argv, cmds, "--abccar") && !vpflow.flag("PROTO_AFLOW") && !vpflow.flag("PROTO")); // DX20190123 - moved ABCCAR to here
1394 vpflow.flag("ABINIT", aurostd::args2flag(argv, cmds, "--abinit") && !vpflow.flag("PROTO_AFLOW") && !vpflow.flag("PROTO"));
1395 vpflow.flag("AIMS", aurostd::args2flag(argv, cmds, "--aims") && !vpflow.flag("PROTO_AFLOW") && !vpflow.flag("PROTO"));
1396 vpflow.flag("ELK", aurostd::args2flag(argv, cmds, "--elk") && !vpflow.flag("PROTO_AFLOW") && !vpflow.flag("PROTO")); // DX20200313
1397 vpflow.flag("ATAT", aurostd::args2flag(argv, cmds, "--atat") && !vpflow.flag("PROTO_AFLOW") && !vpflow.flag("PROTO")); // SD20220123
1398 vpflow.flag("LMP", aurostd::args2flag(argv, cmds, "--lmp") && !vpflow.flag("PROTO_AFLOW") && !vpflow.flag("PROTO")); // SD20240111
1399
1400 // DX20190123 - CIF to work with PROTO - START
1401 // CO20220715 - rewriting a bit for clarity
1402 if (!(vpflow.flag("PROTO_AFLOW") || vpflow.flag("PROTO"))) { // DX20190123 - to differentiate between proto and istream //DX20190123 - ensure not a prototype run
1403 vpflow.flag("CIF", aurostd::args2flag(argv, cmds, "--cif"));
1404 vpflow.args2addattachedscheme(argv, cmds, "CIF", "--cif=|--CIF=", "");
1405 if (vpflow.flag("CIF")) {
1406 vpflow.flag("CIF::USAGE", aurostd::args2flag(argv, cmds, "--usage|--USAGE"));
1407 vpflow.flag("CIF::NO_SYMMETRY", aurostd::args2flag(argv, cmds, "--no_symmetry|--no_sym"));
1408 vpflow.flag("CIF::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan")); // DX20210610
1409 if (aurostd::args2attachedflag(argv, "--cif=|--CIF=")) { // DX20170803
1410 vpflow.args2addattachedscheme(argv, cmds, "CIF::TOLERANCE", "--cif=|--CIF=", ""); // DX20200907 - default is system specific, leaving empty
1411 }
1412 if (aurostd::args2attachedflag(argv, "--setting=")) {
1413 vpflow.args2addattachedscheme(argv, cmds, "CIF::SETTING", "--setting=", "1");
1414 }
1415 }
1416 }
1417 // DX20190123 - CIF to work with PROTO - END
1418 vpflow.args2addattachedscheme(argv, cmds, "QSUB", "--qsub=|--qstart=|--bsub=|--sbatch=", "");
1419 vpflow.args2addattachedscheme(argv, cmds, "QDEL", "--qdel=|--scancel=|--bkill=", "");
1420
1421 vpflow.flag("QMVASP", aurostd::args2flag(argv, cmds, "--qmvasp"));
1422
1423 vpflow.flag("PFLOW::QUEUE_STATUS", aurostd::args2flag(argv, cmds, "--queue_status|--queue|--q")); // CO20200526
1424
1425 vpflow.flag("QCA::INIT", aurostd::args2flag(argv, cmds, "--quasi_chem_approx|--qca")); // SD20220323 - initiate quasi-chemical approx calculation
1426 if (vpflow.flag("QCA::INIT")) {
1427 vpflow.flag("QCA::USAGE", aurostd::args2flag(argv, cmds, "--usage"));
1428 vpflow.flag("QCA::BINODAL", aurostd::args2flag(argv, cmds, "--binodal"));
1429 vpflow.flag("QCA::USE_SG", aurostd::args2flag(argv, cmds, "--use_sg"));
1430 vpflow.flag("QCA::SCREEN_ONLY", aurostd::args2flag(argv, cmds, "--screen_only"));
1431 vpflow.flag("QCA::IMAGE_ONLY", aurostd::args2flag(argv, cmds, "--image_only|--image"));
1432 vpflow.args2addattachedscheme(argv, cmds, "QCA::PRINT", "--print=|--p=|--output=|--o=", "");
1433 vpflow.args2addattachedscheme(argv, cmds, "QCA::DIRECTORY", "--directory=", "./");
1434 vpflow.args2addattachedscheme(argv, cmds, "QCA::PLATTICE", "--plattice=|--plat=", "");
1435 vpflow.args2addattachedscheme(argv, cmds, "QCA::ELEMENTS", "--elements=|--elem=", "");
1436 vpflow.args2addattachedscheme(argv, cmds, "QCA::MAX_NUM_ATOMS", "--max_num_atoms=|--mna=", "");
1437 vpflow.args2addattachedscheme(argv, cmds, "QCA::CV_CUTOFF", "--cv_cutoff=|--cv_cut=", "");
1438 vpflow.args2addattachedscheme(argv, cmds, "QCA::CONC_CURVE_RANGE", "--conc_curve_range=|--conc_curve=", "");
1439 vpflow.args2addattachedscheme(argv, cmds, "QCA::CONC_NPTS", "--conc_npts=", "");
1440 vpflow.args2addattachedscheme(argv, cmds, "QCA::TEMP_RANGE", "--temp_range=|--temp=", "");
1441 vpflow.args2addattachedscheme(argv, cmds, "QCA::TEMP_NPTS", "--temp_npts=", "");
1442 vpflow.args2addattachedscheme(argv, cmds, "QCA::AFLOWLIB_DIRECTORY", "--aflowlib_directory=|--aflowlib_dir=", "");
1443 vpflow.args2addattachedscheme(argv, cmds, "QCA::AFLOW_MAX_NUM_ATOMS", "--aflow_max_num_atoms=", "");
1444 }
1445
1446 vpflow.flag("SOLIQUIDY::INIT", aurostd::args2flag(argv, cmds, "--soliquidy"));
1447 if (vpflow.flag("SOLIQUIDY::INIT")) {
1448 vpflow.args2addattachedscheme(argv, cmds, "SOLIQUIDY::OUTPUT", "--out=|--outfolder=|--output=|-o=", "");
1449 vpflow.args2addattachedscheme(argv, cmds, "SOLIQUIDY::WORKLIST", "--worklist=|--work=", "");
1450 vpflow.args2addattachedscheme(argv, cmds, "SOLIQUIDY::AUID", "--auid=", "");
1451 vpflow.flag("SOLIQUIDY::X3D", aurostd::args2flag(argv, cmds, "--x3d|--3d|--render"));
1452 }
1453
1454 vpflow.args2addattachedscheme(argv, cmds, "RASMOL", "--rasmol=", "");
1455
1456 vpflow.flag("RAYTRACE", (aurostd::args2flag(argv, cmds, "--raytrace") && argv.at(1) == "--raytrace"));
1457 vpflow.flag("RBANAL", aurostd::args2flag(argv, cmds, "--rbanal") && argv.at(1) == "--rbanal");
1458 vpflow.flag("RBDIST", aurostd::args2flag(argv, cmds, "--rbdist") && argv.at(1) == "--rbdist");
1459 vpflow.flag("RDF", aurostd::args2flag(argv, cmds, "--rdf")); // CO20220711
1460 if (!vpflow.flag("RDF")) {
1461 vpflow.args2addattachedscheme(argv, cmds, "RDF", "--rdf=", "");
1462 } // CO20220711 - also look for '=' variant, must be XOR with flag (without '=')
1463 vpflow.flag("RDF::RAW_COUNTS", aurostd::args2flag(argv, cmds, "--raw_counts")); // CO20220627
1464 vpflow.args2addattachedscheme(argv, cmds, "RDFCMP", "--rdfcmp=", "");
1465
1466 vpflow.flag("RMATOM", aurostd::args2flag(argv, cmds, "--rm_atom") && argv.at(1) == "--rm_atom");
1467 vpflow.flag("RMCOPIES", aurostd::args2flag(argv, cmds, "--rm_copies") && argv.at(1) == "--rm_copies");
1468 vpflow.flag("RSM", aurostd::args2flag(argv, cmds, "--rsm"));
1469
1470 vpflow.args2addattachedscheme(argv, cmds, "SCALE", "--scale=", "0.0");
1471
1472 vpflow.flag("SD", (aurostd::args2flag(argv, cmds, "--sd") && argv.at(1) == "--sd"));
1473 vpflow.flag("SETCM", (aurostd::args2flag(argv, cmds, "--setcm") && argv.at(1) == "--setcm"));
1474 vpflow.flag("SETORIGIN", (aurostd::args2flag(argv, cmds, "--setorigin") && argv.at(1) == "--setorigin"));
1475 vpflow.flag("SEWALD", aurostd::args2flag(argv, cmds, "--sewald") && argv.at(1) == "--sewald");
1476 vpflow.args2addattachedscheme(argv, cmds, "SHELL", "--shell=", "");
1477 vpflow.args2addattachedscheme(argv, cmds, "SHIFT", "--shift=", "");
1478 // DX20170818 - Added tolerance and no_scan options to Xgroups - START
1479 vpflow.args2addattachedscheme(argv, cmds, "SGROUP", "--spacegroup=|--sgroup=", "");
1480 if (vpflow.flag("SGROUP")) {
1481 vpflow.flag("SYMMETRY::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
1482 if (aurostd::args2attachedflag(argv, "--spacegroup=|--sgroup=")) { // DX20170803
1483 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::TOLERANCE", "--spacegroup=|--sgroup=", ""); // DX20200907 - default is system specific, leaving empty
1484 }
1485 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::SGROUP_RADIUS", "--radius=", ""); // DX20170803
1486 vpflow.flag("SYMMETRY::SCREEN_ONLY", aurostd::args2flag(argv, cmds, "--screen_only")); // DX20170803
1487 // DX20170921 - MAGNETIC SYMMETRY - START
1488 vpflow.args2addattachedscheme(argv, cmds, "SYMMETRY::MAGNETIC", "--mag=|--magnetic=|--magmom=", ""); // DX20170803
1489 // DX20170921 - MAGNETIC SYMMETRY - END
1490 // ME20210206 - web mode
1491 if (XHOST.vflag_control.flag("WWW")) {
1492 vpflow.flag("SYMMETRY::SCREEN_ONLY", true);
1493 XHOST.QUIET = true;
1494 }
1495 }
1496 // DX20170818 - Added tolerance and no_scan options to Xgroups - END
1497 // vpflow.flag("SPLINE",aurostd::args2flag(argv,cmds,"--spline") && argv.at(1)=="--spline");
1498
1499 if (!vpflow.flag("LIST_PROTOTYPE_LABELS")) { // DX20210708 - protect against other commands
1500 vpflow.args2addattachedscheme(argv, cmds, "SG::AFLOW", "--aflowSG=|--space_group=|--sg=", ""); // DX20210611 - added aliases
1501 vpflow.args2addattachedscheme(argv, cmds, "SG::AFLOW_LABEL", "--aflowSG_label=|--space_group_label=|--sg_label=", ""); // DX20210611 - added aliases
1502 vpflow.args2addattachedscheme(argv, cmds, "SG::AFLOW_NUMBER", "--aflowSG_number=|--space_group_number=|--sg_number=", ""); // DX20210611 - added aliases
1503 }
1504 // DX20170926 - Create flags for SG functions - START
1505 if (vpflow.flag("SG::AFLOW") || vpflow.flag("SG::AFLOW_LABEL") || vpflow.flag("SG::AFLOW_NUMBER")) {
1506 vpflow.flag("SG::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
1507 if (aurostd::args2attachedflag(argv, "--aflowSG=|--aflowSG_label=|--aflowSG_number=|--space_group=|--space_group_label=|--space_group_number=|--sg=|--sg_label=|--sg_number=")) { // DX20210611 - added aliases
1508 vpflow.args2addattachedscheme(argv, cmds, "SG::TOLERANCE", "--aflowSG=|--aflowSG_label=|--aflowSG_number=|--space_group=|--space_group_label=|--space_group_number=|--sg=|--sg_label=|--sg_number=", ""); // DX20200907 - default is system specific, leaving empty //DX20210611 - added aliases
1509 }
1510 if (aurostd::args2attachedflag(argv, "--tolerance_spectrum=|--tol_spectrum=")) {
1511 vpflow.args2addattachedscheme(argv, cmds, "SG::TOLERANCE_SPECTRUM", "--tolerance_spectrum=|--tol_spectrum=", "0.01,1.0,100"); // DX20200907 - added default
1512 }
1513 // DX20170921 - MAGNETIC SYMMETRY - START
1514 vpflow.args2addattachedscheme(argv, cmds, "SG::MAGNETIC", "--mag=|--magnetic=|--magmom=", ""); // DX20170803
1515 // DX20170921 - MAGNETIC SYMMETRY - END
1516 }
1517 // DX20170926 - Create flags for SG functions - END
1518
1519 vpflow.args2addattachedscheme(argv, cmds, "SG::PLATON", "--platonSG=", "");
1520 vpflow.args2addattachedscheme(argv, cmds, "SG::PLATON_LABEL", "--platonSG_label=", "");
1521 vpflow.args2addattachedscheme(argv, cmds, "SG::PLATON_NUMBER", "--platonSG_number=", "");
1522 // DX20170926 - Create flags for SG functions - START
1523 if (vpflow.flag("SG::PLATON") || vpflow.flag("SG::PLATON_LABEL") || vpflow.flag("SG::PLATON_NUMBER")) {
1524 if (aurostd::args2attachedflag(argv, "--platonSG=|--platonSG_label=|--platonSG_number=")) {
1525 vpflow.args2addattachedscheme(argv, cmds, "SG::TOLERANCE", "--platonSG=|--platonSG_label=|--platonSG_number=", "1");
1526 }
1527 }
1528 // DX20170926 - Create flags for SG functions - END
1529
1530 vpflow.args2addattachedscheme(argv, cmds, "SG::FINDSYM", "--findsymSG=", "");
1531 vpflow.args2addattachedscheme(argv, cmds, "SG::FINDSYM_LABEL", "--findsymSG_label=", "");
1532 vpflow.args2addattachedscheme(argv, cmds, "SG::FINDSYM_NUMBER", "--findsymSG_number=", "");
1533 vpflow.args2addattachedscheme(argv, cmds, "SG::FINDSYM_PRINT", "--findsym_print=", "");
1534 vpflow.args2addattachedscheme(argv, cmds, "SG::FINDSYM_EXEC", "--findsym=", "");
1535 // DX20170926 - Create flags for SG functions - START
1536 if (vpflow.flag("SG::FINDSYM") || vpflow.flag("SG::FINDSYM_LABEL") || vpflow.flag("SG::FINDSYM_NUMBER") || vpflow.flag("SG::FINDSYM_PRINT") || vpflow.flag("SG::FINDSYM_EXEC")) {
1537 if (aurostd::args2attachedflag(argv, "--findsymSG=|--findsymSG_label=|--findsymSG_number=|--findsym_print=|--findsym=")) {
1538 vpflow.args2addattachedscheme(argv, cmds, "SG::TOLERANCE", "--findsymSG=|--findsymSG_label=|--findsymSG_number=|--findsym_print=|--findsym=", "1");
1539 }
1540 }
1541 // DX20170926 - Create flags for SG functions - END
1542
1543 vpflow.args2addattachedscheme(argv, cmds, "SLAB", "--slab=", "");
1544
1545 vpflow.flag("SOF", aurostd::args2flag(argv, cmds, "--sof"));
1546 vpflow.flag("SPECIES", aurostd::args2flag(argv, cmds, "--species"));
1547 vpflow.flag("STATDIEL", aurostd::args2flag(argv, cmds, "--statdiel")); // CAMILO
1548
1549 vpflow.flag("GENERALIZED_STACKING_FAULT_ENERGY", aurostd::args2flag(argv, cmds, "--stacking_fault")); // CO20190321
1550 if (vpflow.flag("GENERALIZED_STACKING_FAULT_ENERGY")) {
1551 vpflow.args2addattachedscheme(argv, cmds, "GENERALIZED_STACKING_FAULT_ENERGY::SHEAR_DIRECTION", "--shear_direction=|--shear=", ""); // CO20190321
1552 vpflow.args2addattachedscheme(argv, cmds, "GENERALIZED_STACKING_FAULT_ENERGY::STEP_SIZE", "--step_size=", ""); // CO20190321
1553 vpflow.args2addattachedscheme(argv, cmds, "GENERALIZED_STACKING_FAULT_ENERGY::STEPS", "--steps=", ""); // CO20190321
1554 vpflow.args2addattachedscheme(argv, cmds, "GENERALIZED_STACKING_FAULT_ENERGY::FIXED_LAYERS", "--fixed_layers=", ""); // CO20190321
1555 vpflow.flag("GENERALIZED_STACKING_FAULT_ENERGY::SPIN_OFF", aurostd::args2flag(argv, cmds, "--spin_off")); // CO20190321
1556 vpflow.flag("GENERALIZED_STACKING_FAULT_ENERGY::PARTIAL_DISSOCIATION", aurostd::args2flag(argv, cmds, "--partial_dissociation")); // CO20190321
1557 }
1558
1559 vpflow.flag("CLEAVAGE_ENERGY", aurostd::args2flag(argv, cmds, "--cleavage_energy")); // CO20190321
1560 if (vpflow.flag("CLEAVAGE_ENERGY")) {
1561 vpflow.args2addattachedscheme(argv, cmds, "CLEAVAGE_ENERGY::RELAXATION_LAYERS", "--relaxation_layers=", ""); // CO20190321
1562 vpflow.flag("CLEAVAGE_ENERGY::SPIN_OFF", aurostd::args2flag(argv, cmds, "--spin_off")); // CO20190321
1563 }
1564 vpflow.args2addattachedscheme(argv, cmds, "CREATE_SLAB::PLANE_INTEREST", "--plane_interest=|--plane=", ""); // CO20190321
1565 vpflow.args2addattachedscheme(argv, cmds, "CREATE_SLAB::TOTAL_LAYERS", "--total_layers=", ""); // CO20190321
1566 vpflow.args2addattachedscheme(argv, cmds, "CREATE_SLAB::VACUUM", "--vacuum=", ""); // CO20190321
1567
1568 vpflow.flag("STDCONVCELL", aurostd::args2flag(argv, cmds, "--sc|--standard_conventional|--std_conv|--sconv"));
1569 vpflow.flag("STDPRIMCELL", aurostd::args2flag(argv, cmds, "--sp|--standard_primitive|--std_prim|--sprim"));
1570 // DX20190128 - add structure2ANRL - START
1571 vpflow.flag("STRUCTURE2ANRL", aurostd::args2attachedflag(argv, cmds, "--prototype") && !vpflow.flag("LIST_PROTOTYPE_LABELS")); // DX20190416 - changed from --anrl to --prototype //DX20190509 - added check for prototype labels
1572 if (vpflow.flag("STRUCTURE2ANRL")) {
1573 vpflow.args2addattachedscheme(argv, cmds, "STRUCTURE2ANRL::SETTING", "--setting=", "");
1574 vpflow.args2addattachedscheme(argv, cmds, "STRUCTURE2ANRL::TOLERANCE", "--tolerance=", ""); // DX20191028
1575 vpflow.args2addattachedscheme(argv, cmds, "STRUCTURE2ANRL::TOLERANCE_SPECTRUM", "--tolerance_spectrum=", ""); // DX20200820
1576 vpflow.flag("STRUCTURE2ANRL::FORCE_WYCKOFF", aurostd::args2flag(argv, cmds, "--force_Wyckoff|--force_wyckoff|--force_Wyckoff_order|--force_wyckoff_order")); // DX20191028
1577 vpflow.flag("STRUCTURE2ANRL::PRINT_ELEMENT_NAMES", aurostd::args2flag(argv, cmds, "--print_element_names|--print_element_name|--print_element")); // DX20210622
1578 vpflow.flag("STRUCTURE2ANRL::PRINT_ATOMIC_NUMBERS", aurostd::args2flag(argv, cmds, "--print_atomic_numbers|--print_atomic_number")); // DX20210622
1579 }
1580 // DX20190128 - add structure2ANRL - END
1581
1582 vpflow.flag("SUMPDOS", (aurostd::args2flag(argv, cmds, "--sumpdos") && argv.at(1) == "--sumpdos"));
1583
1584 vpflow.args2addattachedscheme(argv, cmds, "SUPERCELL", "--supercell=", "");
1585 vpflow.args2addattachedscheme(argv, cmds, "SUPERCELLSTRLIST", "--supercell_strlist=", "");
1586
1587 vpflow.flag("SWAP", aurostd::args2flag(argv, cmds, "--swap"));
1588
1589 vpflow.flag("TERDATA", aurostd::args2flag(argv, cmds, "--terdata") || aurostd::args2attachedflag(argv, cmds, "--terdata="));
1590 vpflow.flag("TERDATA_EXIST", aurostd::args2flag(argv, cmds, "--terdata_exist"));
1591
1592 vpflow.flag("UFFENERGY", aurostd::args2flag(argv, cmds, "--uffenergy|--ue"));
1593
1594 // DATABASE
1595 vpflow.flag("PATCHDB", aurostd::args2flag(argv, cmds, "--patch_database")); // ME20200829
1596 vpflow.flag("UPDATEDB", aurostd::args2flag(argv, cmds, "--update_database")); // ME20191001
1597 vpflow.flag("REBUILDDB", aurostd::args2flag(argv, cmds, "--rebuild_database")); // ME20191001
1598 vpflow.args2addattachedscheme(argv, cmds, "DBPATCHFILES", "--patchfiles=", "");
1599
1600 // DX20180710 - we do not want to run if the flag was used in proto - vpflow.flag("VASP",aurostd::args2flag(argv,cmds,"--vasp"));
1601 vpflow.flag("VASP", aurostd::args2flag(argv, cmds, "--vasp|--vasp4") && !vpflow.flag("PROTO_AFLOW") && !vpflow.flag("PROTO")); // DX20180710 - check if used in proto //CO20210119 - added vasp4
1602 vpflow.flag("VASP5", aurostd::args2flag(argv, cmds, "--vasp5") && !vpflow.flag("PROTO_AFLOW") && !vpflow.flag("PROTO")); // DX20180710 - check if used in proto //CO20210119 - added vasp5
1603
1604 // ME20200330
1605 vpflow.flag("VISUALIZE_PHONONS", aurostd::args2flag(argv, cmds, "--visualize_phonons"));
1606 if (vpflow.flag("VISUALIZE_PHONONS")) {
1607 vpflow.args2addattachedscheme(argv, cmds, "ADISP::AMPLITUDE", "--amplitude=", "");
1608 vpflow.args2addattachedscheme(argv, cmds, "ADISP::BRANCHES", "--branches=", "");
1609 vpflow.args2addattachedscheme(argv, cmds, "ADISP::FORMAT", "--format=", "");
1610 vpflow.args2addattachedscheme(argv, cmds, "ADISP::PERIODS", "--periods=", "");
1611 vpflow.args2addattachedscheme(argv, cmds, "ADISP::QPOINTS", "--qpoints=|--qpoint=|--q=", "");
1612 vpflow.args2addattachedscheme(argv, cmds, "ADISP::STEPS", "--steps=", "");
1613 vpflow.args2addattachedscheme(argv, cmds, "ADISP::SUPERCELL", "--scell=", "");
1614 vpflow.push_attached("ADISP::DIRECTORY", XHOST.vflag_control.getattachedscheme("DIRECTORY"));
1615 }
1616
1617 vpflow.args2addattachedscheme(argv, cmds, "VOLUME::EQUAL", "--volume=", "");
1618 vpflow.args2addattachedscheme(argv, cmds, "VOLUME::MULTIPLY_EQUAL", "--volume*=", "");
1619 vpflow.args2addattachedscheme(argv, cmds, "VOLUME::PLUS_EQUAL", "--volume+=", "");
1620
1621 //[CO20200404 - refer to XHOST]vpflow.flag("WWW",aurostd::args2flag(argv,cmds,"--web|--www|--http"));
1622 vpflow.flag("WYCKOFF", aurostd::args2flag(argv, cmds, "--wyckoff|--wy"));
1623
1624 vpflow.args2addattachedscheme(argv, cmds, "XRAY", "--xray=", "");
1625 vpflow.args2addattachedscheme(argv, cmds, "XRAY_PEAKS", "--xray_peaks=", ""); // CO20190520
1626 vpflow.args2addattachedscheme(argv, cmds, "PLOT_XRAY", "--plot_xray=", ""); // CO20190520
1627 vpflow.flag("PLOT_XRAY::FORCE_GENERIC_TITLE", aurostd::args2flag(argv, cmds, "--force_generic_title|--force_title|--title")); // CO20190629
1628 vpflow.args2addattachedscheme(argv, cmds, "PLOT_XRAY_FILE", "--plot_xray_file=", ""); // CO20190520
1629 vpflow.args2addattachedscheme(argv, cmds, "XYZ", "--xyz=", "");
1630 vpflow.flag("XYZWS", aurostd::args2flag(argv, cmds, "--xyzwignerseitz|--xyzws"));
1631
1632 // vpflow.flag("XXX",aurostd::args2flag(argv,cmds,"--xxx"));
1633 vpflow.flag("XFIXX", (aurostd::args2flag(argv, cmds, "--xfixX|--xfixx") && argv.size() == 4));
1634
1635 vpflow.flag("XTALFINDER_PYTHON", aurostd::args2attachedflag(argv, cmds, "--aflow_xtalfinder_python|--xtalfinder_python")); // DX20201228
1636
1637 vpflow.flag("XXX", (aurostd::args2flag(argv, cmds, "--xxx")));
1638 if (vpflow.flag("XXX")) {
1639 cout << "XXX" << endl;
1640 }
1641
1642 vpflow.args2addattachedscheme(argv, cmds, "LIB2RAW", "--lib2raw=", "");
1643 if (vpflow.flag("LIB2RAW")) {
1644 vpflow.flag("LIB2RAW_LOCAL", aurostd::args2flag(argv, cmds, "--local"));
1645 }
1646 vpflow.args2addattachedscheme(argv, cmds, "LIB2LIB", "--lib2lib=", ""); // CT20181212
1647 if (vpflow.flag("LIB2LIB")) {
1648 vpflow.flag("LIB2LIB_LOCAL", aurostd::args2flag(argv, cmds, "--local"));
1649 } // CT20181212
1650 vpflow.flag("FORCE", aurostd::args2flag(argv, cmds, "--force"));
1651
1652 vpflow.flag("XPLUG::INIT", aurostd::args2flag(argv, cmds, "--xplug"));
1653 if (vpflow.flag("XPLUG::INIT")) {
1654 vpflow.flag("XPLUG::CLEAN", aurostd::args2flag(argv, cmds, "--clean|--C"));
1655 vpflow.args2addattachedscheme(argv, cmds, "XPLUG::DIRECTORY", "--directory=|--D=", "./");
1656 vpflow.args2addattachedscheme(argv, cmds, "XPLUG::LAST_MOD_DAYS", "--last_mod=|--lm=|--mod_last=|--ml=", "3.0");
1657 vpflow.args2addattachedscheme(argv, cmds, "XPLUG::ZIP_SIZE_GB", "--zip_size=|--zs=|--size_zip=|--sz=", "9");
1658 vpflow.args2addattachedscheme(argv, cmds, "XPLUG::PREFIX", "--prefix=", "");
1659 vpflow.args2addattachedscheme(argv, cmds, "XPLUG::RELATIVE", "--relative=", "");
1660 }
1661
1662 // cerr << "vpflow.flag(\"LIB2RAW\")=" << vpflow.flag("LIB2RAW") << endl;
1663 // cerr << "vpflow.getattachedscheme(\"LIB2RAW\")=" << vpflow.getattachedscheme("LIB2RAW") << endl;
1664
1665 vpflow.args2addattachedscheme(argv, cmds, "XRD_DIST", "--xrd_dist=|--XRD_DIST=", "");
1666
1667 // XELEMENTS STUFF
1668 vpflow.args2addattachedscheme(argv, cmds, "XELEMENT", "--xelement=|--XELEMENT=|--element=|--ELEMENT=", "");
1669
1670 vpflow.args2addattachedscheme(argv, cmds, "ZVAL", "--zval=|--ZVAL=", "");
1671 vpflow.args2addattachedscheme(argv, cmds, "ZVAL::CELL", "--zval_cell=|--ZVAL_CELL=|--zvalcell=|--ZVALCELL=", "");
1672 vpflow.args2addattachedscheme(argv, cmds, "ZVAL::ATOM", "--zval_atom=|--ZVAL_ATOM=|--zvalatom=|--ZVALATOM=", "");
1673 vpflow.args2addattachedscheme(argv, cmds, "POMASS", "--pomass=|--POMASS=", "");
1674 vpflow.args2addattachedscheme(argv, cmds, "POMASS::CELL", "--pomass_cell=|--POMASS_CELL=", "");
1675 vpflow.args2addattachedscheme(argv, cmds, "POMASS::ATOM", "--pomass_atom=|--POMASS_ATOM=|--pomassatom=|--POMASSATOM=", "");
1676
1677 // Richard's symmetry functions (RHT)
1678 // DX START
1679 vpflow.flag("ORTHODEFECT_RHT", aurostd::args2flag(argv, cmds, "--OrthoDefect")); // RHT
1680 vpflow.flag("REVERSE_SPACEGROUP_RHT", aurostd::args2flag(argv, cmds, "--revsg")); // RHT
1681 vpflow.flag("PRIMITIVE_LATTICE_RHT", aurostd::args2flag(argv, cmds, "--primr | --fastprimitivecell | --fprim")); // RHT
1682 // DX20210610 - START
1683 vpflow.args2addattachedscheme(argv, cmds, "WYCKOFF_POSITIONS", "--Wyckoff=|--Wyckoff_positions=|--wyckoff=|--wyckoff_positions=|--wyccar=", "");
1684 if (vpflow.flag("WYCKOFF_POSITIONS")) {
1685 // DX20180807 - added more wyccar flags (--usage, --no_scan, setting, --magmom) - START
1686 vpflow.flag("WYCKOFF_POSITIONS::USAGE", aurostd::args2flag(argv, cmds, "--usage|--USAGE"));
1687 vpflow.flag("WYCKOFF_POSITIONS::NO_SCAN", aurostd::args2flag(argv, cmds, "--no_scan"));
1688 vpflow.args2addattachedscheme(argv, cmds, "WYCKOFF_POSITIONS::PRINT_WYCCAR",
1689 "--wyccar=", ""); // DX20210525 - treat wyccar as a special way of printing //DX20210708 - needs to be args2addattachedscheme to account for possible tolerance input
1690 vpflow.flag("WYCKOFF_POSITIONS::PRINT_LETTERS_ONLY", aurostd::args2flag(argv, cmds, "--letters_only"));
1691 vpflow.flag("WYCKOFF_POSITIONS::PRINT_SITE_SYMMETRIES_ONLY", aurostd::args2flag(argv, cmds, "--site_symmetries_only"));
1692 vpflow.flag("WYCKOFF_POSITIONS::PRINT_MULTIPLICITIES_ONLY", aurostd::args2flag(argv, cmds, "--multiplicities_only"));
1693 if (aurostd::args2attachedflag(argv, "--Wyckoff=|--Wyckoff_positions=|--wyckoff=|--wyckoff_positions=|--wyccar=")) {
1694 vpflow.args2addattachedscheme(argv, cmds, "WYCKOFF_POSITIONS::TOLERANCE", "--Wyckoff=|--Wyckoff_positions=|--wyckoff=|--wyckoff_positions=|--wyccar=", ""); // DX20200907 - default is system specific, leaving empty
1695 }
1696 if (aurostd::args2attachedflag(argv, "--setting=")) {
1697 vpflow.args2addattachedscheme(argv, cmds, "WYCKOFF_POSITIONS::SETTING", "--setting=", "1");
1698 }
1699 vpflow.args2addattachedscheme(argv, cmds, "WYCKOFF_POSITIONS::MAGNETIC", "--mag=|--magnetic=|--magmom=", "");
1700 // DX20180807 - added more wyccar flags (--usage, --no_scan, setting, --magmom) - END
1701 }
1702 // DX20210610 - END
1703 // end Richard's symmetry (RHT)
1704 // WE MIGHT NEED TO PUT THEM AROUND IN ALPHABETIC ORDER, keep the //RHT
1705 // DX END
1706
1707 // *************************************
1708 // cluster expansion method
1709 vpflow.args2addattachedscheme(argv, cmds, "CE::CLUSTEREXPANSION", "--cluster-expansion=|--ce=", "");
1710
1711 // special Quasirandom Structure (SQS)
1712 vpflow.args2addattachedscheme(argv, cmds, "CE::SQS", "--special-quasirandom-structure=|--sqs=", "");
1713 // get all clusters
1714 vpflow.args2addattachedscheme(argv, cmds, "CE::CLUSTERS", "--cluster=|--clusters=", "");
1715 // get all superlattices
1716 vpflow.args2addattachedscheme(argv, cmds, "CE::SUPERLATTICE", "--superlattice=", "");
1717
1718 // *************************************
1719 // effective mass
1720 vpflow.flag("EFFECTIVEMASS", aurostd::args2flag(argv, cmds, "--effective-mass|--em")); // && (argv.size() == 3));
1721
1722 // QHA
1723
1724 if (LDEBUG) {
1725 cout << "PflowARGs: xscheme=" << vpflow.xscheme << endl;
1726 }
1727 if (LDEBUG) {
1728 cout << "PflowARGs: vxscheme.size()=" << vpflow.vxscheme.size() << endl;
1729 }
1730 if (LDEBUG) {
1731 cout << "PflowARGs: argv.size()=" << argv.size() << endl;
1732 }
1733
1734 return vpflow.vxscheme.size();
1735}
1736
1737namespace pflow {
1738 int main(vector<string>& argv, vector<string>& cmds) {
1739 const bool LDEBUG = (false || XHOST.DEBUG);
1740 if (LDEBUG) {
1741 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
1742 }
1743 // cerr << "C username=" << XHOST.user << endl;
1744 // cerr << "C groupname=" << XHOST.group << endl;
1745 // cerr << "C XHOST.ostrPID=" << XHOST.ostrPID.str() << endl;
1746 // cerr << "C XHOST.ostrTID=" << XHOST.ostrTID.str() << endl; //CO20200502 - threadID
1747 // cerr.flush();
1748 // cerr << argv.size() << endl;
1749 aurostd::xoption vpflow;
1750 const ostringstream aus;
1751 // GENERAL **************************************************
1752 const string progname = argv.at(0);
1753 // std::vector<string> cmds;
1754 // INFORMATION **************************************************
1755
1756 // cerr << "************************************************************" << endl;
1757 // cerr << "* AFLOW IN mode PFLOW *" << endl;
1758 // cerr << "************************************************************" << endl;
1759
1760 _aflags aflags;
1761 aflags.Directory = "./";
1762 aurostd::args2flag(argv, cmds, "--np="); // put them in cmds
1763 aurostd::args2flag(argv, cmds, "--npmax"); // put them in cmds
1764
1765 vpflow = XHOST.vflag_pflow;
1766
1767 if (vpflow.flag("PFLOW_HELP") && argv.size() == 2) {
1768 cout << "**************************************************************************************************" << endl;
1769 cout << " aflow --readme=pflow | --readme=processor | --readme=aconvasp | --readme_aconvasp" << endl;
1770 cout << " Returns the HELP information for the \"processing machinery\"" << endl;
1771 // cout << AFLOW_AConvaspHelp();
1772 cout << aflow::Banner("BANNER_BIG");
1773 return 1;
1774 }
1775 if (vpflow.flag("PFLOW_HELP") && argv.size() == 3) {
1777 }
1778 if (vpflow.flag("PROTOS")) {
1779 cout << aflowlib::PrototypesHelp();
1780 cout << aflow::Banner("BANNER_BIG");
1781 return 1;
1782 }
1783
1784 if (vpflow.flag("FIX_BANDS")) {
1785 pflow::FIXBANDS(aflags, vpflow.getattachedscheme("FIX_BANDS"));
1786 return 0;
1787 }
1788
1789 const string EXTRACT_KPOINTS = aurostd::args2string(argv, cmds, "--extract_kpoints|--xkpoints", "nan");
1790 const string EXTRACT_INCAR = aurostd::args2string(argv, cmds, "--extract_incar|--xincar", "nan");
1791 const string EXTRACT_POSCAR = aurostd::args2string(argv, cmds, "--extract_poscar|--xposcar", "nan");
1792 const string EXTRACT_POTCAR = aurostd::args2string(argv, cmds, "--extract_potcar|--xpotcar", "nan");
1793 const string EXTRACT_PARTCAR = aurostd::args2string(argv, cmds, "--extract_partcar|--xpartcar", "nan"); // CO20181226
1794
1795 // aflow style operations
1796 aflags.AFLOW_PERFORM_CLEAN = XHOST.vflag_aflow.flag("CLEAN");
1797 vpflow.flag("CLEAN", aflags.AFLOW_PERFORM_CLEAN);
1798 aflags.AFLOW_PERFORM_DIRECTORY = XHOST.vflag_control.flag("DIRECTORY");
1799 aflags.AFLOW_PERFORM_FILE = XHOST.vflag_control.flag("FILE");
1800 if (vpflow.flag("CLEAN")) {
1801 if (!aflags.AFLOW_PERFORM_DIRECTORY) {
1802 cerr << "AFLOW: to use --clean, you must specify the directory" << endl;
1803 return 0;
1804 } else {
1805 aurostd::xoption opts_clean; // CO20210716
1806 opts_clean.flag("SAVE_CONTCAR", aurostd::args2flag(argv, cmds, "--contcar_save|--save_contcar")); // CO20210716 - saves contcar no matter what
1807 opts_clean.flag("SAVE_CONTCAR_OUTCAR_COMPLETE", aurostd::args2flag(argv, cmds, "--contcar_save_outcar_complete|--save_contcar_outcar_complete")); // CO20210716 - saves contcar only if outcar is complete
1808 KBIN::Clean(aflags, opts_clean);
1809 }
1810 }
1811
1812 // if(XXX) pflow::XXX(argv,cin);
1813 // if(pflow::CheckCommands(argv,cmds)==false) return 0;
1814
1815 xstructure a;
1816 // a.iomode=IOAFLOW_AUTO;
1817 a.iomode = IOVASP_AUTO;
1818 const xvector<double> _emptyv(1);
1819 const xmatrix<double> _emptym(1, 1);
1820
1821 // check whether a function is run or not
1822 // if not, give an error message
1823 bool _PROGRAMRUN = false;
1824 // *********************************************************************
1825 if (argv.size() == 1 && !_PROGRAMRUN) {
1826 cout << aflow::Banner("BANNER_TINY") << endl;
1827 // cout << pflow::Intro_pflow("aconvasp");
1828 cout << pflow::Intro_pflow("aflow");
1829 cout << aflow::Banner("BANNER_TINY") << endl;
1830 _PROGRAMRUN = true;
1831 }
1832 // CO
1833 if (!argv.empty() && !_PROGRAMRUN) {
1834 if (vpflow.flag("BADER")) {
1835 cout << bader_functions::BaderCalc(vpflow);
1836 _PROGRAMRUN = true;
1837 }
1838 if (vpflow.flag("AFLOWMACHL::CoordCE_CSV")) {
1840 _PROGRAMRUN = true;
1841 } // CO20200930
1842 if (vpflow.flag("CHGCAR2JVXL")) {
1843 cout << pflow::CHGCAR2JVXL(vpflow);
1844 _PROGRAMRUN = true;
1845 }
1846 if (vpflow.flag("CHGDIFF")) {
1847 cout << pflow::CHGDIFF(vpflow);
1848 _PROGRAMRUN = true;
1849 }
1850 if (vpflow.flag("CHGSUM")) {
1851 cout << pflow::CHGSUM(vpflow);
1852 _PROGRAMRUN = true;
1853 }
1854 if (vpflow.flag("CLEAVAGE_ENERGY")) {
1855 pflow::CleavageEnergyCalculation(vpflow, cin);
1856 _PROGRAMRUN = true;
1857 } // CO20190520
1858 // DX20190425 START
1859 if (vpflow.flag("COMPARE_DATABASE_ENTRIES")) {
1860 cout << compare::compareDatabaseEntries(vpflow);
1861 _PROGRAMRUN = true;
1862 }
1863 if (vpflow.flag("COMPARE_MATERIAL") || vpflow.flag("COMPARE_STRUCTURE")) {
1864 if (XHOST.vflag_control.flag("DIRECTORY") || XHOST.vflag_control.flag("FILE") || vpflow.flag("COMPARE_STRUCTURE::STRUCTURE_LIST")) {
1865 cout << compare::compareInputStructures(vpflow);
1866 _PROGRAMRUN = true;
1867 } else { // ME20210429 - Use std::cin otherwise
1868 cout << compare::compareInputStructures(vpflow, cin);
1869 _PROGRAMRUN = true;
1870 }
1871 }
1872 // DX20190425 END
1873 if (vpflow.flag("COMPARE_PERMUTATION")) {
1874 cout << compare::compareAtomDecorations(cin, vpflow);
1875 _PROGRAMRUN = true;
1876 } // DX20190201
1877 if (vpflow.flag("GFA::INIT")) {
1879 _PROGRAMRUN = true;
1880 } // DF20190329 - GFA
1881 if (vpflow.flag("ATOMIC_ENVIRONMENT::INIT")) {
1883 _PROGRAMRUN = true;
1884 } // HE20210331 - Testing
1885 if (vpflow.flag("FIND_CLOSED_PACKING_PLANE")) {
1886 pflow::findClosedPackingPlane(cin);
1887 _PROGRAMRUN = true;
1888 } // CO20190808
1889 if (vpflow.flag("GENERATE_CERAMICS")) {
1890 cout << pflow::GENERATE_CERAMICS_PRINT(vpflow) << endl;
1891 _PROGRAMRUN = true;
1892 } // CO20200731
1893 // DX+CO START
1894 if (vpflow.flag("FULLSYMMETRY")) {
1895 pflow::CalculateFullSymmetry(cin, vpflow, cout);
1896 _PROGRAMRUN = true;
1897 }
1898 // DX+CO END
1899 if (vpflow.flag("STRUCTURE2ANRL")) {
1900 cout << anrl::structure2anrl(cin, vpflow);
1901 _PROGRAMRUN = true;
1902 }
1903 if (vpflow.flag("COMPARE2PROTOTYPES")) {
1904 cout << compare::printMatchingPrototypes(cin, vpflow);
1905 _PROGRAMRUN = true;
1906 } // DX20190314
1907 if (vpflow.flag("COMPARE2DATABASE")) {
1908 cout << compare::printCompare2Database(cin, vpflow);
1909 _PROGRAMRUN = true;
1910 } // DX20190201
1911 if (vpflow.flag("GENERALIZED_STACKING_FAULT_ENERGY")) {
1912 pflow::GeneralizedStackingFaultEnergyCalculation(vpflow, cin);
1913 _PROGRAMRUN = true;
1914 } // CO20190520
1915 if (vpflow.flag("PREPARE_CHGCAR_4_JMOL")) {
1916 cout << bader_functions::prepare_CHGCAR_4_Jmol(vpflow);
1917 _PROGRAMRUN = true;
1918 }
1919 if (vpflow.flag("PFLOW::QUEUE_STATUS")) {
1920 cout << pflow::getQueueStatus(vpflow);
1921 _PROGRAMRUN = true;
1922 } // CO20200526
1923 // DX
1924 if (vpflow.flag("SOLIQUIDY::INIT")) {
1925 soliquidy::run_cmd(vpflow, cin);
1926 _PROGRAMRUN = true;
1927 } // HE20240528
1928 }
1929 // *********************************************************************
1930 if (argv.size() == 2 && !_PROGRAMRUN) {
1931 // put cartesian or fractional
1932 if (vpflow.flag("BZPLOT")) {
1933 LATTICE::BZPLOTDATA("", cin, 1);
1934 _PROGRAMRUN = true;
1935 }
1936 if (vpflow.flag("BZPLOTDATA")) {
1937 LATTICE::BZPLOTDATA("", cin, 0);
1938 _PROGRAMRUN = true;
1939 }
1940 if (vpflow.flag("ICSD_MAKELABEL")) {
1941 pflow::ICSD(argv, cin);
1942 _PROGRAMRUN = true;
1943 }
1944 if (vpflow.flag("KPATH")) {
1945 pflow::KPATH(cin, aurostd::args2attachedutype<double>(argv, "--grid=", -1), XHOST.vflag_control.flag("WWW"));
1946 _PROGRAMRUN = true;
1947 } // CO20200329 - default value -1 so we can decide grid automatically //CO20200404 - new web flag
1948 if (vpflow.flag("NANOPARTICLE")) {
1949 cout << pflow::NANOPARTICLE(cin, xvector<double>(0));
1950 _PROGRAMRUN = true;
1951 }
1952 // if(vpflow.flag("PROTO_GUS_CPP")) {pflow::PROTO_GUS_CPP(argv); _PROGRAMRUN=true;}
1953 // QHA
1954 }
1955 // *********************************************************************
1956 if (argv.size() >= 2 && !_PROGRAMRUN) {
1957 // CO20220613 - must go first, as many manipulations are now possible at once
1958 // do not micromanage the user, if they want to run nonsensical options simultaneously, let them
1959 if (vpflow.flag("ABCCAR") || vpflow.flag("ABINIT") || vpflow.flag("AIMS") || vpflow.flag("ATAT") || vpflow.flag("CIF") || vpflow.flag("ELK") || vpflow.flag("LMP") || vpflow.flag("QE") ||
1960 vpflow.flag("VASP") || vpflow.flag("VASP5") || vpflow.flag("ITC") || vpflow.flag("INCELL") || vpflow.flag("INCOMPACT") || vpflow.flag("INWS") || vpflow.flag("MINKOWSKI_BASIS_REDUCTION") ||
1961 vpflow.flag("NIGGLI") || vpflow.flag("STDCONVCELL") || vpflow.flag("STDPRIMCELL") || vpflow.flag("CART") || vpflow.flag("FRAC")) {
1962 // use functions as much as possible to avoid repetition of the workflow
1963 xstructure xstr(cin);
1964 // change iomode - will also ReScale(1.0)
1965 if (vpflow.flag("ABCCAR")) {
1966 xstr.xstructure2abccar();
1967 }
1968 if (vpflow.flag("ABINIT")) {
1969 xstr.xstructure2abinit();
1970 }
1971 if (vpflow.flag("AIMS")) {
1972 xstr.xstructure2aims();
1973 }
1974 if (vpflow.flag("ATAT")) {
1975 xstr.xstructure2atat();
1976 }
1977 if (vpflow.flag("CIF")) {
1978 pflow::getCIFOptions(xstr, vpflow);
1979 xstr.xstructure2cif();
1980 } // DX20250319 - CIF options are required here (since the code was moved)
1981 if (vpflow.flag("ELK")) {
1982 xstr.xstructure2elk();
1983 }
1984 if (vpflow.flag("LMP")) {
1985 xstr.xstructure2lmp();
1986 }
1987 if (vpflow.flag("QE")) {
1988 xstr.xstructure2qe();
1989 }
1990 if (vpflow.flag("VASP") || vpflow.flag("VASP5")) {
1991 xstr.xstructure2vasp();
1992 if (vpflow.flag("VASP5")) {
1993 a.is_vasp4_poscar_format = false;
1994 a.is_vasp5_poscar_format = true;
1995 }
1996 }
1997 if (vpflow.flag("ITC")) {
1998 xstr.xstructure2itc();
1999 }
2000 // perform structure/lattice normalization
2001 if (vpflow.flag("INCELL")) {
2002 xstr.BringInCell();
2003 }
2004 if (vpflow.flag("INCOMPACT")) {
2005 xstr.BringInCompact();
2006 }
2007 if (vpflow.flag("INWS")) {
2008 xstr.BringInWignerSeitz();
2009 }
2010 if (vpflow.flag("MINKOWSKI_BASIS_REDUCTION")) {
2011 xstr.MinkowskiBasisReduction();
2012 }
2013 if (vpflow.flag("NIGGLI")) {
2014 xstr.NiggliUnitCellForm();
2015 }
2016 if (vpflow.flag("STDCONVCELL")) {
2017 xstr.Standard_Conventional_UnitCellForm();
2018 }
2019 if (vpflow.flag("STDPRIMCELL")) {
2020 xstr.Standard_Primitive_UnitCellForm();
2021 }
2022 // change coord_flag
2023 if (vpflow.flag("CART")) {
2024 xstr.SetCoordinates(_COORDS_CARTESIAN_);
2025 }
2026 if (vpflow.flag("FRAC")) {
2027 xstr.SetCoordinates(_COORDS_FRACTIONAL_);
2028 }
2029 cout << xstr;
2030 _PROGRAMRUN = true;
2031 }
2032
2033 // A
2034 if (vpflow.flag("ACE")) {
2035 pflow::ACE(cin);
2036 _PROGRAMRUN = true;
2037 }
2038 if (vpflow.flag("AFLOWIN")) {
2039 cout << pflow::AFLOWIN(cin);
2040 _PROGRAMRUN = true;
2041 }
2042 if (vpflow.flag("AGROUP")) {
2043 pflow::SYMMETRY_GROUPS(aflags, cin, vpflow, cout);
2044 _PROGRAMRUN = true;
2045 } // DX20170818
2046 if (vpflow.flag("AGROUP2")) {
2047 pflow::AGROUP2(cin);
2048 _PROGRAMRUN = true;
2049 }
2050 if (vpflow.flag("AGROUP2m")) {
2051 pflow::AGROUP2m(cin);
2052 _PROGRAMRUN = true;
2053 }
2054 if (vpflow.flag("ALPHABETIC")) {
2055 cout << pflow::ALPHABETIC(cin);
2056 _PROGRAMRUN = true;
2057 }
2058 if (vpflow.flag("ANGLES")) {
2059 pflow::ANGLES(vpflow.getattachedscheme("ANGLES"), cin);
2060 _PROGRAMRUN = true;
2061 }
2062 if (vpflow.flag("ALPHA_COMPOUND")) {
2063 cout << pflow::ALPHACompound(vpflow.getattachedscheme("ALPHA_COMPOUND"));
2064 _PROGRAMRUN = true;
2065 }
2066 if (vpflow.flag("ALPHA_SPECIES")) {
2067 cout << pflow::ALPHASpecies(vpflow.getattachedscheme("ALPHA_SPECIES"));
2068 _PROGRAMRUN = true;
2069 }
2070 if (vpflow.flag("AFLOWLIB::ENTRY_JSON")) {
2071 aflowlib::WEB_Aflowlib_Entry(vpflow.getattachedscheme("AFLOWLIB::ENTRY_JSON"), cout);
2072 _PROGRAMRUN = true;
2073 } // SC20190812
2074 if (vpflow.flag("AFLOWLIB_AUID2AURL")) {
2075 cout << aflowlib::AflowlibLocator(vpflow.getattachedscheme("AFLOWLIB_AUID2AURL"), "AFLOWLIB_AUID2AURL");
2076 _PROGRAMRUN = true;
2077 }
2078 if (vpflow.flag("AFLOWLIB_AURL2AUID")) {
2079 cout << aflowlib::AflowlibLocator(vpflow.getattachedscheme("AFLOWLIB_AURL2AUID"), "AFLOWLIB_AURL2AUID");
2080 _PROGRAMRUN = true;
2081 }
2082 if (vpflow.flag("AFLOWLIB_AUID2LOOP")) {
2083 cout << aflowlib::AflowlibLocator(vpflow.getattachedscheme("AFLOWLIB_AUID2LOOP"), "AFLOWLIB_AUID2LOOP");
2084 _PROGRAMRUN = true;
2085 }
2086 if (vpflow.flag("AFLOWLIB_AURL2LOOP")) {
2087 cout << aflowlib::AflowlibLocator(vpflow.getattachedscheme("AFLOWLIB_AURL2LOOP"), "AFLOWLIB_AURL2LOOP");
2088 _PROGRAMRUN = true;
2089 }
2090 if (vpflow.flag("AFLUX::SUMMONS")) {
2091 cout << aflowlib::AFLUXCall(vpflow) << endl;
2092 _PROGRAMRUN = true;
2093 } // DX20190206 - add AFLUX command line functionality //CO20200520 - AFLUX::SUMMONS
2094 if (vpflow.flag("AFLOWSYM_PYTHON")) {
2095 SYM::writePythonScript(cout);
2096 _PROGRAMRUN = true;
2097 } // DX20210202
2098 if (vpflow.flag("AFLUX")) {
2099 cout << aflowlib::AFLUXCall(vpflow) << endl;
2100 _PROGRAMRUN = true;
2101 } // DX20190206 - add AFLUX command line functionality
2102 //[CO20220614 - moved up]if(vpflow.flag("ATAT")) {cout << input2ATATxstr(cin); _PROGRAMRUN=true;} //SD20220123
2103 // B
2104 if (vpflow.flag("BANDGAP_WAHYU")) {
2105 AConvaspBandgap(argv);
2106 _PROGRAMRUN = true;
2107 }
2108 if (vpflow.flag("BANDGAP")) {
2109 pflow::BANDGAP(vpflow, cout);
2110 _PROGRAMRUN = true;
2111 } // CAMILO //CO20171006
2112 if (vpflow.flag("BZPLOTDATAUSEKPOINTS")) {
2113 LATTICE::BZPLOTDATA(vpflow.getattachedscheme("BZPLOTDATAUSEKPOINTS"), cin, 10);
2114 _PROGRAMRUN = true;
2115 }
2116 if (vpflow.flag("BZPLOTUSEKPOINTS")) {
2117 LATTICE::BZPLOTDATA(vpflow.getattachedscheme("BZPLOTUSEKPOINTS"), cin, 11);
2118 _PROGRAMRUN = true;
2119 }
2120 if (vpflow.flag("BANDSTRUCTURE")) {
2121 pflow::BANDSTRUCTURE(aflags);
2122 _PROGRAMRUN = true;
2123 }
2124 if (vpflow.flag("BANDGAPS")) {
2125 AConvaspBandgaps(cin, cout);
2126 _PROGRAMRUN = true;
2127 }
2128 if (vpflow.flag("BANDGAPDOS")) {
2129 pflow::BANDGAP_DOS(vpflow, cout);
2130 _PROGRAMRUN = true;
2131 } // CO20191004
2132 if (vpflow.flag("BANDGAPDOS_WAHYU")) {
2133 AConvaspBandgapFromDOS(cin);
2134 _PROGRAMRUN = true;
2135 }
2136 if (vpflow.flag("BANDGAPLISTDOS")) {
2137 AConvaspBandgapListFromDOS(cin);
2138 _PROGRAMRUN = true;
2139 }
2140 if (vpflow.flag("BZDIRECTION")) {
2141 if (vpflow.flag("BZDIRECTION::LATTICE")) {
2142 cerr << "[" << vpflow.getattachedscheme("BZDIRECTION") << "]" << endl;
2143 cout << pflow::BZDirectionsLATTICE(vpflow.getattachedscheme("BZDIRECTION::LATTICE"));
2144 } else {
2145 cout << pflow::BZDirectionsSTRUCTURE(cin, vpflow); // DX20181101
2146 }
2147 _PROGRAMRUN = true;
2148 }
2149 if (vpflow.flag("BZMAX")) {
2150 pflow::BZMAX(cin);
2151 _PROGRAMRUN = true;
2152 }
2153 if (vpflow.flag("BANDS")) {
2154 pflow::BANDS(vpflow.getattachedscheme("BANDS"), cin);
2155 _PROGRAMRUN = true;
2156 }
2157 // C
2158 if (vpflow.flag("CAGES") && !AFLOW_PTHREADS::FLAG) {
2159 pflow::CAGES(aflags, vpflow.getattachedscheme("CAGES"), cin);
2160 _PROGRAMRUN = true;
2161 }
2162 if (vpflow.flag("CAGES") && AFLOW_PTHREADS::FLAG) {
2163 pflow::CAGES(aflags, vpflow.getattachedscheme("CAGES"), cin);
2164 _PROGRAMRUN = true;
2165 }
2166 //[CO20220614 - moved up]if(vpflow.flag("CART")) {cout << pflow::CART(cin); _PROGRAMRUN=true;}
2167 if (vpflow.flag("CCE_CORRECTION")) {
2168 cce::run(vpflow);
2169 _PROGRAMRUN = true;
2170 }
2171 if (vpflow.flag("CCE_CORRECTION::POSCAR2CCE")) {
2172 cce::run(vpflow, std::cin);
2173 _PROGRAMRUN = true;
2174 } // ME20200508 //CO20201105
2175 if (vpflow.flag("CCE_CORRECTION::GET_CCE_CORRECTION")) {
2176 cce::run(vpflow, std::cin);
2177 _PROGRAMRUN = true;
2178 } // RF20200916 //CO20201105
2179 if (vpflow.flag("CCE_CORRECTION::GET_OXIDATION_NUMBERS")) {
2180 cce::run(vpflow, std::cin);
2181 _PROGRAMRUN = true;
2182 } // RF20200725 //CO20201105
2183 if (vpflow.flag("CCE_CORRECTION::GET_CATION_COORDINATION_NUMBERS")) {
2184 cce::run(vpflow, std::cin);
2185 _PROGRAMRUN = true;
2186 } // RF20200814 //CO20201105
2187 if (vpflow.flag("CHECKINTEGRITIY")) {
2189 _PROGRAMRUN = true;
2190 }
2191 if (vpflow.flag("CHANGESUFFIX")) {
2192 pflow::ChangeSuffix(vpflow.getattachedscheme("CHANGESUFFIX"));
2193 _PROGRAMRUN = true;
2194 } // KY20131222
2195 //[CO20220614 - moved up]if(vpflow.flag("CIF") && !vpflow.flag("PROTO_AFLOW") && !vpflow.flag("PROTO")) {pflow::CIF(cin,vpflow); _PROGRAMRUN=true;} //DX20180806 - added vpflow
2196 if (vpflow.flag("CLEANALL")) {
2197 pflow::CLEANALL(cin);
2198 _PROGRAMRUN = true;
2199 }
2200 if (vpflow.flag("CORNERS")) {
2201 cout << pflow::CORNERS(cin);
2202 _PROGRAMRUN = true;
2203 }
2204 if (vpflow.flag("CALCULATED_ICSD_RANDOM")) {
2206 _PROGRAMRUN = true;
2207 return 0;
2208 }
2209 if (vpflow.flag("CALCULATED")) {
2210 cout << aflowlib::CALCULATED();
2211 _PROGRAMRUN = true;
2212 }
2213 if (vpflow.flag("CLAT")) {
2214 pflow::CLAT(vpflow.getattachedscheme("CLAT"));
2215 _PROGRAMRUN = true;
2216 }
2217 if (vpflow.flag("CHULL::INIT")) {
2218 chull::convexHull(vpflow);
2219 _PROGRAMRUN = true;
2220 }
2221 if (vpflow.flag("COMPARE")) {
2222 pflow::COMPARE(vpflow.getattachedscheme("COMPARE"));
2223 _PROGRAMRUN = true;
2224 }
2225 // D
2226 if (vpflow.flag("DATA")) {
2227 pflow::DATA(cin, vpflow, "DATA", cout);
2228 _PROGRAMRUN = true;
2229 }
2230 if (vpflow.flag("DATA_CRYSTAL_POINT_GROUP")) {
2231 pflow::DATA(cin, vpflow, "CRYSTAL_POINT_GROUP", cout);
2232 _PROGRAMRUN = true;
2233 } // DX20210209
2234 if (vpflow.flag("DATA_EDATA")) {
2235 pflow::DATA(cin, vpflow, "EDATA", cout);
2236 _PROGRAMRUN = true;
2237 }
2238 if (vpflow.flag("DATA_REAL_LATTICE")) {
2239 pflow::DATA(cin, vpflow, "REAL_LATTICE", cout);
2240 _PROGRAMRUN = true;
2241 } // DX20210209
2242 if (vpflow.flag("DATA_RECIPROCAL_LATTICE")) {
2243 pflow::DATA(cin, vpflow, "RECIPROCAL_LATTICE", cout);
2244 _PROGRAMRUN = true;
2245 } // DX20210209
2246 if (vpflow.flag("DATA_SGDATA")) {
2247 pflow::DATA(cin, vpflow, "SGDATA", cout);
2248 _PROGRAMRUN = true;
2249 } // DX20170818 //DX20210301 - consolidated into pflow::DATA()
2250 if (vpflow.flag("DATA_SUPERLATTICE")) {
2251 pflow::DATA(cin, vpflow, "SUPERLATTICE", cout);
2252 _PROGRAMRUN = true;
2253 } // DX20210209
2254 if (vpflow.flag("DEBYE")) {
2255 pflow::DEBYE(vpflow.getattachedscheme("DEBYE"));
2256 _PROGRAMRUN = true;
2257 }
2258 if (vpflow.flag("DIFF")) {
2259 pocc::DIFF(vpflow.getattachedscheme("DIFF"));
2260 _PROGRAMRUN = true;
2261 }
2262 if (vpflow.flag("DISP")) {
2263 pflow::DISP(vpflow.getattachedscheme("DISP"), cin);
2264 _PROGRAMRUN = true;
2265 }
2266 if (vpflow.flag("DIST")) {
2267 pflow::DIST(vpflow.getattachedscheme("DIST"), cin);
2268 _PROGRAMRUN = true;
2269 }
2270 // if(DYNADIEL) {pflow::DYNADIEL(argv) ; _PROGRAMRUN=true ;} // CAMILO
2271 // E
2272 if (vpflow.flag("EDOS")) {
2273 pflow::EDOS(argv);
2274 _PROGRAMRUN = true;
2275 }
2276 if (vpflow.flag("EFFMASS")) {
2277 pflow::EFFMASS(argv, cout);
2278 _PROGRAMRUN = true;
2279 } // CAMILO
2280 // if(vpflow.flag("EFFECTIVEMASS")) {pflow::EffectiveMass(argv,aurostd::args2string(argv,"--em","./"),cout); _PROGRAMRUN=true;}
2281 if (vpflow.flag("EIGCURV")) {
2282 pflow::EIGCURV(vpflow.getattachedscheme("EIGCURV"), cout);
2283 _PROGRAMRUN = true;
2284 } // CAMILO
2285 //[CO20220614 - moved up]if(vpflow.flag("ELK")) {cout << input2ELKxstr(cin); _PROGRAMRUN=true;} //DX20200313
2286 if (vpflow.flag("EQUIVALENT")) {
2287 cout << pflow::EQUIVALENT(aflags, cin, vpflow);
2288 _PROGRAMRUN = true;
2289 }
2290 if (vpflow.flag("EWALD")) {
2291 pflow::EWALD(vpflow.getattachedscheme("EWALD"), cin);
2292 _PROGRAMRUN = true;
2293 }
2294 // F
2295 if (vpflow.flag("FROZSL_VASPSETUP_AFLOW")) {
2296 cout << pflow::FROZSL_VASPSETUP(argv, 0);
2297 _PROGRAMRUN = true;
2298 }
2299 if (vpflow.flag("FROZSL_VASPSETUP_POSCAR")) {
2300 cout << pflow::FROZSL_VASPSETUP(argv, 1);
2301 _PROGRAMRUN = true;
2302 }
2303 if (vpflow.flag("FROZSL_ANALYZE")) {
2304 cout << pflow::FROZSL_ANALYZE(cin);
2305 _PROGRAMRUN = true;
2306 }
2307
2308 if (vpflow.flag("FROZSL_README")) {
2309 cout << aurostd::EmbData::get_content("README_AFLOW_FROZSL.TXT", "README") << endl;
2310 _PROGRAMRUN = true;
2311 }
2312 if (vpflow.flag("FROZSL_INPUT")) {
2313 cout << pflow::FROZSL_INPUT();
2314 _PROGRAMRUN = true;
2315 }
2316 if (vpflow.flag("FROZSL_OUTPUT")) {
2317 cout << pflow::FROZSL_OUTPUT();
2318 _PROGRAMRUN = true;
2319 }
2320 if (vpflow.flag("FGROUP")) {
2321 pflow::SYMMETRY_GROUPS(aflags, cin, vpflow, cout);
2322 _PROGRAMRUN = true;
2323 } // DX20170818
2324 //[CO20220614 - moved up]if(vpflow.flag("FRAC")) {cout << pflow::FRAC(cin); _PROGRAMRUN=true;}
2325 // G
2326 if (vpflow.flag("GETTEMP")) {
2327 AFLOW_getTEMP(argv);
2328 _PROGRAMRUN = true;
2329 // cout << "TEMPERATURE " << Message(__AFLOW_FILE__) << endl;return 0; _PROGRAMRUN=true;
2330 } // CO20200106 - patching for auto-indenting
2331 if (vpflow.flag("GEOMETRY")) {
2332 cout << pflow::GEOMETRY(cin) << endl;
2333 _PROGRAMRUN = true;
2334 } // CO20191110
2335 if (vpflow.flag("GULP")) {
2336 pflow::GULP(cin);
2337 _PROGRAMRUN = true;
2338 }
2339 // H
2340 if (vpflow.flag("HKL")) {
2341 pflow::HKL(vpflow.getattachedscheme("HKL"), aflags, cin);
2342 _PROGRAMRUN = true;
2343 }
2344 if (vpflow.flag("HKL_SEARCH_TRIVIAL")) {
2345 pflow::HKLSearch(vpflow.getattachedscheme("HKL_SEARCH_TRIVIAL"), aflags, cin, "HKL_SEARCH_TRIVIAL");
2346 _PROGRAMRUN = true;
2347 }
2348 if (vpflow.flag("HKL_SEARCH_SIMPLE")) {
2349 pflow::HKLSearch(vpflow.getattachedscheme("HKL_SEARCH_SIMPLE"), aflags, cin, "HKL_SEARCH_SIMPLE");
2350 _PROGRAMRUN = true;
2351 }
2352 if (vpflow.flag("HKL_SEARCH_COMPLETE")) {
2353 pflow::HKLSearch(vpflow.getattachedscheme("HKL_SEARCH_COMPLETE"), aflags, cin, "HKL_SEARCH_COMPLETE");
2354 _PROGRAMRUN = true;
2355 }
2356 if (vpflow.flag("HNFCELL")) {
2357 pflow::POCC_COMMAND_LINE(vpflow, cin, cout);
2358 _PROGRAMRUN = true;
2359 } // CO20181226
2360 // I
2361 if (vpflow.flag("IAP::INIT")) {
2363 _PROGRAMRUN = true;
2364 }
2365 if (vpflow.flag("ICSD") || vpflow.flag("ICSD_CHEM") || vpflow.flag("ICSD_PROTO") || vpflow.flag("ICSD_ID") || vpflow.flag("ICSD_LESSTHAN") || vpflow.flag("ICSD_MORETHAN") ||
2366 vpflow.flag("ICSD_DENSLESSTHAN") || vpflow.flag("ICSD_DENSMORETHAN") || vpflow.flag("ICSD_SG") || vpflow.flag("ICSD_SGLESSTHAN") || vpflow.flag("ICSD_SGMORETHAN") || vpflow.flag("ICSD_TRICLINIC") ||
2367 vpflow.flag("ICSD_MONOCLINIC") || vpflow.flag("ICSD_ORTHORHOMBIC") || vpflow.flag("ICSD_TETRAGONAL") || vpflow.flag("ICSD_RHOMBOHEDRAL") || vpflow.flag("ICSD_TRIGONAL") || vpflow.flag("ICSD_HEXAGONAL") ||
2368 vpflow.flag("ICSD_CUBIC") || vpflow.flag("ICSD_UNIQUE") || vpflow.flag("ICSD_BASISLT") || vpflow.flag("ICSD_BASISGT") || vpflow.flag("ICSD_NOBROKENBASIS") || vpflow.flag("ICSD_NOPARTIALOCC") ||
2369 vpflow.flag("ICSD_N_ARY") || vpflow.flag("ICSD_REMOVE_AND") || vpflow.flag("ICSD_REMOVE_OR") || vpflow.flag("ICSD_REMOVEMETALS") || vpflow.flag("ICSD_ALLLESSTHAN") || vpflow.flag("ICSD_ALLMORETHAN") ||
2370 vpflow.flag("ICSD_TRI") || vpflow.flag("ICSD_MCL") || vpflow.flag("ICSD_MCLC") || vpflow.flag("ICSD_ORC") || vpflow.flag("ICSD_ORCC") || vpflow.flag("ICSD_ORCF") || vpflow.flag("ICSD_ORCI") ||
2371 vpflow.flag("ICSD_TET") || vpflow.flag("ICSD_BCT") || vpflow.flag("ICSD_RHL") || vpflow.flag("ICSD_HEX") || vpflow.flag("ICSD_CUB") || vpflow.flag("ICSD_FCC") || vpflow.flag("ICSD_BCC")) {
2372 pflow::ICSD(argv, cin);
2373 _PROGRAMRUN = true;
2374 }
2375 if (vpflow.flag("ICSD_LISTMETALS")) {
2376 pflow::ICSD_ListMetals();
2377 _PROGRAMRUN = true;
2378 }
2379 if (vpflow.flag("ICSD2POSCAR")) {
2380 pflow::ICSD_2POSCAR(cin);
2381 _PROGRAMRUN = true;
2382 }
2383 if (vpflow.flag("ICSD2PROTO")) {
2384 pflow::ICSD_2PROTO(cin);
2385 _PROGRAMRUN = true;
2386 }
2387 if (vpflow.flag("ICSD2WYCK")) {
2388 pflow::ICSD_2WYCK(cin, vpflow.flag("SOF"));
2389 _PROGRAMRUN = true;
2390 }
2391 if (vpflow.flag("IDENTICAL")) {
2392 cout << pflow::IDENTICAL(cin);
2393 _PROGRAMRUN = true;
2394 }
2395 //[CO20220614 - moved up]if(vpflow.flag("INCELL")) {cout << pflow::INCELL(cin); _PROGRAMRUN=true;}
2396 //[CO20220614 - moved up]if(vpflow.flag("INCOMPACT")) {cout << pflow::INCOMPACT(cin); _PROGRAMRUN=true;}
2397 if (vpflow.flag("INTPOL")) {
2398 pflow::INTPOL(vpflow.getattachedscheme("INTPOL"));
2399 _PROGRAMRUN = true;
2400 }
2401 //[CO20220614 - moved up]if(vpflow.flag("INWS")) {cout << pflow::INWS(cin); _PROGRAMRUN=true;}
2402 if (vpflow.flag("INFLATE_LATTICE")) {
2403 cout << pflow::INFLATE_LATTICE(vpflow.getattachedscheme("INFLATE_LATTICE"), cin);
2404 _PROGRAMRUN = true;
2405 }
2406 if (vpflow.flag("INFLATE_VOLUME")) {
2407 cout << pflow::INFLATE_VOLUME(vpflow.getattachedscheme("INFLATE_VOLUME"), cin);
2408 _PROGRAMRUN = true;
2409 }
2410 if (vpflow.flag("ISOPOINTAL_PROTOTYPES")) {
2411 cout << compare::isopointalPrototypes(cin, vpflow) << endl;
2412 _PROGRAMRUN = true;
2413 } // DX20200131
2414 // J
2415 if (vpflow.flag("JUSTAFTER")) {
2416 sflow::JUST(vpflow.getattachedscheme("JUSTAFTER"), cin, "JUSTAFTER");
2417 _PROGRAMRUN = true;
2418 }
2419 if (vpflow.flag("JUSTBEFORE")) {
2420 sflow::JUST(vpflow.getattachedscheme("JUSTBEFORE"), cin, "JUSTBEFORE");
2421 _PROGRAMRUN = true;
2422 }
2423 if (vpflow.flag("JUSTBETWEEN")) {
2424 sflow::JUST(vpflow.getattachedscheme("JUSTBETWEEN"), cin, "JUSTBETWEEN");
2425 _PROGRAMRUN = true;
2426 }
2427 if (vpflow.flag("JMOL")) {
2428 pflow::JMOL(vpflow.getattachedscheme("JMOL"), cin);
2429 _PROGRAMRUN = true;
2430 }
2431 // K
2432 if (vpflow.flag("KBAND")) {
2433 pflow::KBAND(argv);
2434 _PROGRAMRUN = true;
2435 }
2436 if (vpflow.flag("KPOINTS")) {
2437 pflow::KPOINTS(vpflow.getattachedscheme("KPOINTS"), cin, cout);
2438 _PROGRAMRUN = true;
2439 }
2440 if (vpflow.flag("FLAG::XVASP_KPOINTS_DELTA")) {
2441 pflow::KPOINTS_DELTA(vpflow, cin, cout);
2442 _PROGRAMRUN = true;
2443 }
2444 if (vpflow.flag("KILL")) {
2445 sflow::KILL(vpflow.getattachedscheme("KILL"));
2446 _PROGRAMRUN = true;
2447 }
2448 // L
2449 if (vpflow.flag("LATTICEREDUCTION")) {
2450 cout << pflow::LATTICEREDUCTION(cin);
2451 _PROGRAMRUN = true;
2452 }
2453 // DX20200820 [OBSOELTE] if(vpflow.flag("LATTICE_TYPE")) {cout << pflow::LATTICE_TYPE(cin); _PROGRAMRUN=true;}
2454 // DX20200820 [OBSOELTE] if(vpflow.flag("LATTICE_LATTICE_TYPE")) {cout << pflow::LATTICE_LATTICE_TYPE(cin); _PROGRAMRUN=true;}
2455 if (vpflow.flag("LATTICE_TYPE")) {
2456 cout << pflow::LATTICE_TYPE(cin, vpflow);
2457 _PROGRAMRUN = true;
2458 } // DX20200820 - added vpflow
2459 if (vpflow.flag("LATTICE_LATTICE_TYPE")) {
2460 cout << pflow::LATTICE_LATTICE_TYPE(cin, vpflow);
2461 _PROGRAMRUN = true;
2462 } // DX20200820 - added vpflow
2463 if (vpflow.flag("LATTICE_HISTOGRAM")) {
2464 CheckLatticeHistogram();
2465 _PROGRAMRUN = true;
2466 }
2467 if (vpflow.flag("LIST_PROTOTYPE_LABELS")) {
2468 cout << pflow::listPrototypeLabels(vpflow) << endl;
2469 _PROGRAMRUN = true;
2470 } // DX20190201
2471 if (vpflow.flag("LIB2RAW")) {
2472 XHOST.sensors_allowed = false;
2473 aflowlib::LIB2RAW(vpflow.getattachedscheme("LIB2RAW"), vpflow.flag("FORCE"), vpflow.flag("LIB2RAW_LOCAL"));
2474 XHOST.sensors_allowed = true;
2475 _PROGRAMRUN = true;
2476 }
2477 if (vpflow.flag("LIB2LIB")) {
2478 XHOST.sensors_allowed = false;
2479 aflowlib::LIB2LIB(vpflow.getattachedscheme("LIB2LIB"), vpflow.flag("FORCE"), vpflow.flag("LIB2LIB_LOCAL"));
2480 XHOST.sensors_allowed = true;
2481 _PROGRAMRUN = true;
2482 } // CT20181212
2483 if (vpflow.flag("LTCELL")) {
2484 cout << pflow::LTCELL(vpflow.getattachedscheme("LTCELL"), cin);
2485 _PROGRAMRUN = true;
2486 }
2487 if (vpflow.flag("LTCELLFV")) {
2488 cout << pflow::LTCELL(vpflow.getattachedscheme("LTCELLFV"), cin);
2489 _PROGRAMRUN = true;
2490 }
2491 // M
2492 if (vpflow.flag("MULTI=SH")) {
2493 AFLOW_PTHREADS::MULTI_sh(argv);
2494 _PROGRAMRUN = true;
2495 }
2496 if (vpflow.flag("MAGNETICPARAMETERS")) {
2497 pflow::MagneticParameters(aurostd::args2attachedstring(argv, "--magpara=", "./"), cout);
2498 _PROGRAMRUN = true;
2499 }
2500 //[CO20220614 - moved up]if(vpflow.flag("MINKOWSKI_BASIS_REDUCTION")) {cout << pflow::MINKOWSKIBASISREDUCTION(cin); _PROGRAMRUN=true;}
2501 if (vpflow.flag("MSI")) {
2502 pflow::MSI(cin);
2503 _PROGRAMRUN = true;
2504 }
2505 if (vpflow.flag("MOM")) {
2506 pflow::MOM(cin);
2507 _PROGRAMRUN = true;
2508 }
2509 if (vpflow.flag("MULTIENUMALL")) {
2510 pocc::MultienumPrintAllXstr(cin);
2511 _PROGRAMRUN = true;
2512 }
2513 if (vpflow.flag("MULTIENUMSORT")) {
2514 pocc::MultienumPrintSortedXstr(cin);
2515 _PROGRAMRUN = true;
2516 }
2517 if (vpflow.flag("MAXATOMS")) {
2518 cout << pflow::ATOMSMAX(vpflow.getattachedscheme("MAXATOMS"), cin);
2519 _PROGRAMRUN = true;
2520 }
2521 // N
2522 if (vpflow.flag("NAMES") && argv.size() >= 2) {
2523 cout << pflow::NAMES(argv, cin);
2524 _PROGRAMRUN = true;
2525 }
2526 if (vpflow.flag("NUMNAMES") && argv.size() >= 2) {
2527 cout << pflow::NUMNAMES(argv, cin);
2528 _PROGRAMRUN = true;
2529 }
2530 if (vpflow.flag("NATOMS")) {
2531 cout << pflow::NATOMS(cin) << endl;
2532 _PROGRAMRUN = true;
2533 }
2534 if (vpflow.flag("NBONDXX")) {
2535 cout << pflow::NBONDXX(cin);
2536 _PROGRAMRUN = true;
2537 } // CO20171025
2538 if (vpflow.flag("NDATA")) {
2539 pflow::NDATA(cin);
2540 _PROGRAMRUN = true;
2541 }
2542 //[CO20220614 - moved up]if(vpflow.flag("NIGGLI")) {cout << pflow::NIGGLI(cin); _PROGRAMRUN=true;}
2543 if (vpflow.flag("NNDIST")) {
2544 cout << pflow::NNDIST(cin) << endl;
2545 _PROGRAMRUN = true;
2546 }
2547 if (vpflow.flag("NOORDERPARAMETER")) {
2548 cout << pflow::NOORDERPARAMETER(cin);
2549 _PROGRAMRUN = true;
2550 }
2551 if (vpflow.flag("NSPECIES")) {
2552 cout << pflow::NSPECIES(cin) << endl;
2553 _PROGRAMRUN = true;
2554 }
2555 // O
2556 // if(vpflow.flag("OPARAMETER")) {pflow::OPARAMETER(argv,cin); _PROGRAMRUN=true;}
2557 // P
2558
2559 // Serializers for DOS and bands
2560 if (vpflow.flag("DOSDATA2JSON")) {
2561 estructure::DOSDATA_JSON(vpflow, cout);
2562 _PROGRAMRUN = true;
2563 } // EG
2564 if (vpflow.flag("BANDSDATA2JSON")) {
2565 estructure::BANDSDATA_JSON(vpflow, cout);
2566 _PROGRAMRUN = true;
2567 } // EG
2568 // End serializers
2569
2570 if (vpflow.flag("PLOT_BANDSPINSPLIT")) {
2571 estructure::PLOT_BAND_SPINSPLIT(vpflow.getattachedscheme("PLOT_BANDSPINSPLIT"));
2572 _PROGRAMRUN = true;
2573 }
2574 if (vpflow.flag("PLOT_BAND2")) {
2575 estructure::PLOT_BAND2(vpflow.getattachedscheme("PLOT_BAND2"));
2576 _PROGRAMRUN = true;
2577 }
2578 if (vpflow.flag("PLOT_DOSWEB")) {
2579 estructure::PLOT_DOSWEB(vpflow.getattachedscheme("PLOT_DOSWEB"));
2580 _PROGRAMRUN = true;
2581 }
2582 if (vpflow.flag("PLOT_PEDOS")) {
2583 estructure::PLOT_PEDOS(vpflow.getattachedscheme("PLOT_PEDOS"));
2584 _PROGRAMRUN = true;
2585 }
2586 if (vpflow.flag("PLOT_PEDOSALL")) {
2587 estructure::PLOT_PEDOSALL(vpflow.getattachedscheme("PLOT_PEDOSALL"));
2588 _PROGRAMRUN = true;
2589 }
2590 if (vpflow.flag("PLOT_PEDOSALL_AFLOWLIB")) {
2591 estructure::PLOT_PEDOSALL_AFLOWLIB(vpflow.getattachedscheme("PLOT_PEDOSALL_AFLOWLIB"), aflags);
2592 _PROGRAMRUN = true;
2593 }
2594 // ME20190614 BEGIN
2595 if (vpflow.flag("PLOT_BAND")) {
2596 aurostd::xoption pltopts = plotter::getPlotOptionsEStructure(vpflow, "PLOT_BAND");
2597 plotter::PLOT_BAND(pltopts);
2598 _PROGRAMRUN = true;
2599 }
2600 if (vpflow.flag("PLOT_DOS")) {
2601 aurostd::xoption pltopts = plotter::getPlotOptionsEStructure(vpflow, "PLOT_DOS");
2602 plotter::PLOT_DOS(pltopts);
2603 _PROGRAMRUN = true;
2604 }
2605 if (vpflow.flag("PLOT_BANDDOS")) {
2606 aurostd::xoption pltopts = plotter::getPlotOptionsEStructure(vpflow, "PLOT_BANDDOS");
2607 plotter::PLOT_BANDDOS(pltopts);
2608 _PROGRAMRUN = true;
2609 }
2610 if (vpflow.flag("PLOT_PDOS")) {
2611 aurostd::xoption pltopts = plotter::getPlotOptionsEStructure(vpflow, "PLOT_PDOS", true);
2612 plotter::PLOT_PDOS(pltopts);
2613 _PROGRAMRUN = true;
2614 }
2615 if (vpflow.flag("PLOT_PDOSALL")) {
2616 aurostd::xoption pltopts = plotter::getPlotOptionsEStructure(vpflow, "PLOT_PDOSALL", false);
2617 pltopts.push_attached("DATASET", "-1");
2618 plotter::PLOT_PDOS(pltopts);
2619 _PROGRAMRUN = true;
2620 }
2621 if (vpflow.flag("PLOT_PHDOS")) {
2622 aurostd::xoption pltopts = plotter::getPlotOptionsPhonons(vpflow, "PLOT_PHDOS");
2623 plotter::PLOT_PHDOS(pltopts);
2624 _PROGRAMRUN = true;
2625 }
2626 if (vpflow.flag("PLOT_PHDISP")) {
2627 aurostd::xoption pltopts = plotter::getPlotOptionsPhonons(vpflow, "PLOT_PHDISP");
2628 plotter::PLOT_PHDISP(pltopts);
2629 _PROGRAMRUN = true;
2630 }
2631 if (vpflow.flag("PLOT_PHDISPDOS")) {
2632 aurostd::xoption pltopts = plotter::getPlotOptionsPhonons(vpflow, "PLOT_PHDISPDOS");
2633 plotter::PLOT_PHDISPDOS(pltopts);
2634 _PROGRAMRUN = true;
2635 }
2636 if (vpflow.flag("PLOT_THERMO")) {
2637 aurostd::xoption plotopts = plotter::getPlotOptions(vpflow, "PLOT_THERMO");
2638 plotter::PLOT_THERMO(plotopts);
2639 _PROGRAMRUN = true;
2640 }
2641 if (vpflow.flag("PLOT_TCOND")) {
2642 aurostd::xoption plotopts = plotter::getPlotOptions(vpflow, "PLOT_TCOND");
2643 plotter::PLOT_TCOND(plotopts);
2644 _PROGRAMRUN = true;
2645 }
2646 // ME20190614 END
2647 // AS20200909 BEGIN
2648 if (vpflow.flag("PLOT_THERMO_QHA")) {
2649 aurostd::xoption plotopts = plotter::getPlotOptionsQHAthermo(vpflow, "PLOT_THERMO_QHA");
2650 plotter::PLOT_THERMO_QHA(plotopts);
2651 _PROGRAMRUN = true;
2652 }
2653 // AS20200909 END
2654 // AS20210701 BEGIN
2655 if (vpflow.flag("PLOT_GRUENEISEN_DISPERSION")) {
2656 aurostd::xoption plotopts = plotter::getPlotOptionsPhonons(vpflow, "PLOT_GRUENEISEN_DISPERSION");
2658 _PROGRAMRUN = true;
2659 }
2660 // AS20210701 END
2661 if (vpflow.flag("PROTOS_ICSD")) {
2662 cout << aflowlib::PrototypesIcsdHelp(vpflow.getattachedscheme("PROTOS_ICSD"));
2663 cout << aflow::Banner("BANNER_BIG");
2664 return 1;
2665 }
2666 // if(POCCUPATION) {pflow::POCCUPATION(argv,cin); _PROGRAMRUN=true;}
2667 if (vpflow.flag("POCC_DOS")) {
2668 pocc::POCC_DOS(cout, vpflow.getattachedscheme("POCC_DOS"));
2669 _PROGRAMRUN = true;
2670 }
2671 if (vpflow.flag("POCC_MAG")) {
2672 pocc::POCC_MAG(vpflow.getattachedscheme("POCC_MAG"));
2673 _PROGRAMRUN = true;
2674 }
2675 if (vpflow.flag("POCC_BANDGAP")) {
2676 pocc::POCC_BANDGAP(vpflow.getattachedscheme("POCC_BANDGAP"));
2677 _PROGRAMRUN = true;
2678 }
2679 if (vpflow.flag("POCC_MINIMUM_CONFIGURATION")) {
2680 cout << pocc::POCC_MINIMUM_CONFIGURATION(vpflow) << endl;
2681 _PROGRAMRUN = true;
2682 } // CO20191110
2683 //
2684 if (vpflow.flag("PROTO")) {
2685 if ((vpflow.flag("PROTO::SYMBOLS_ONLY")) || (vpflow.flag("PROTO::EQUATIONS_ONLY"))) {
2686 pflow::PROTO_LIBRARIES(vpflow);
2687 _PROGRAMRUN = true;
2688 } else {
2689 cout << pflow::PROTO_LIBRARIES(vpflow);
2690 _PROGRAMRUN = true;
2691 }
2692 }
2693 if (vpflow.flag("PROTO_AFLOW")) {
2694 pflow::PROTO_AFLOW(vpflow, false);
2695 _PROGRAMRUN = true;
2696 } // non reversed
2697 if (vpflow.flag("PLATON") && argv.size() >= 2) {
2698 cout << pflow::PLATON(vpflow.getattachedscheme("PLATON"), cin);
2699 _PROGRAMRUN = true;
2700 } // << endl;
2701 if (vpflow.flag("POMASS")) {
2702 pflow::ZVAL("POMASS," + vpflow.getattachedscheme("POMASS"));
2703 _PROGRAMRUN = true;
2704 }
2705 if (vpflow.flag("POMASS::CELL")) {
2706 pflow::ZVAL("POMASS::CELL," + vpflow.getattachedscheme("POMASS::CELL"));
2707 _PROGRAMRUN = true;
2708 }
2709 if (vpflow.flag("POMASS::ATOM")) {
2710 pflow::ZVAL("POMASS::ATOM," + vpflow.getattachedscheme("POMASS::ATOM"));
2711 _PROGRAMRUN = true;
2712 }
2713 if (vpflow.flag("PEARSON_SYMBOL")) {
2714 cout << pflow::PEARSON_SYMBOL(cin, vpflow);
2715 _PROGRAMRUN = true;
2716 } // DX20210611 - addded vpflow
2717 if (vpflow.flag("PDB")) {
2718 pflow::PDB(cin);
2719 _PROGRAMRUN = true;
2720 }
2721 if (vpflow.flag("PGROUP")) {
2722 pflow::SYMMETRY_GROUPS(aflags, cin, vpflow, cout);
2723 _PROGRAMRUN = true;
2724 } // DX20170818
2725 if (vpflow.flag("PGROUPX")) {
2726 pflow::SYMMETRY_GROUPS(aflags, cin, vpflow, cout);
2727 _PROGRAMRUN = true;
2728 } // DX20170818
2729 if (vpflow.flag("PGROUPK")) {
2730 pflow::SYMMETRY_GROUPS(aflags, cin, vpflow, cout);
2731 _PROGRAMRUN = true;
2732 } // DX20170818
2733 if (vpflow.flag("PGROUPK_PATTERSON")) {
2734 pflow::SYMMETRY_GROUPS(aflags, cin, vpflow, cout);
2735 _PROGRAMRUN = true;
2736 } // DX20200206
2737 if (vpflow.flag("PGROUPK_XTAL")) {
2738 pflow::SYMMETRY_GROUPS(aflags, cin, vpflow, cout);
2739 _PROGRAMRUN = true;
2740 } // DX20171205
2741 if (vpflow.flag("POSCAR")) {
2742 cout << pflow::POSCAR(cin);
2743 _PROGRAMRUN = true;
2744 }
2745 if (vpflow.flag("RENDER")) {
2746 pflow::RENDER(cin, vpflow.getattachedscheme("RENDER_OUT"));
2747 _PROGRAMRUN = true;
2748 }
2749 if (vpflow.flag("POSCAR2AFLOWIN")) {
2750 cout << pflow::POSCAR2AFLOWIN(cin, vpflow.getattachedscheme("AFLOW_PROTO::MODULE"));
2751 _PROGRAMRUN = true;
2752 } // Modified - ME20181113//ME20190112
2753 if (vpflow.flag("POSCAR2ENUM")) {
2754 pocc::POSCAR2ENUM(cin);
2755 _PROGRAMRUN = true;
2756 }
2757 if (vpflow.flag("POSCAR2GULP")) {
2758 pocc::POSCAR2GULP(cin);
2759 _PROGRAMRUN = true;
2760 }
2761 if (vpflow.flag("POCC_INPUT")) {
2762 pflow::POCC_INPUT();
2763 _PROGRAMRUN = true;
2764 }
2765 if (vpflow.flag("POCC::CONVOLUTION")) {
2766 pocc::POCC_Convolution(vpflow);
2767 _PROGRAMRUN = true;
2768 }
2769 if (vpflow.flag("POSCAR2WYCKOFF")) {
2771 _PROGRAMRUN = true;
2772 }
2773 if (vpflow.flag("PRIM")) {
2774 cout << pflow::PRIM(cin, 0);
2775 _PROGRAMRUN = true;
2776 }
2777 if (vpflow.flag("PRIM1")) {
2778 cout << pflow::PRIM(cin, 1);
2779 _PROGRAMRUN = true;
2780 }
2781 if (vpflow.flag("PRIM2")) {
2782 cout << pflow::PRIM(cin, 2);
2783 _PROGRAMRUN = true;
2784 }
2785 if (vpflow.flag("PRIM3")) {
2786 cout << pflow::PRIM(cin, 3);
2787 _PROGRAMRUN = true;
2788 }
2789 if (vpflow.flag("PSEUDOPOTENTIALS_CHECK")) {
2790 pflow::PSEUDOPOTENTIALS_CHECK(vpflow, vpflow.getattachedscheme("PSEUDOPOTENTIALS_CHECK"), cout);
2791 _PROGRAMRUN = true;
2792 }
2793 if (vpflow.flag("PYTHON_MODULES")) {
2794 pflow::PYTHON_MODULES(vpflow.getattachedscheme("PYTHON_MODULES"));
2795 _PROGRAMRUN = true;
2796 } // ME20211103
2797
2798 // Q
2799 //[CO20220614 - moved up]if(vpflow.flag("QE")) {cout << input2QExstr(cin); _PROGRAMRUN=true;}
2800 if (vpflow.flag("QCA::INIT")) {
2801 qca::quasiChemicalApprox(vpflow);
2802 _PROGRAMRUN = true;
2803 } // SD20220323
2804 if (vpflow.flag("QDEL")) {
2805 sflow::QDEL(vpflow.getattachedscheme("QDEL"));
2806 _PROGRAMRUN = true;
2807 } // NEW
2808 if (vpflow.flag("QMVASP")) {
2809 pflow::QMVASP(vpflow);
2810 _PROGRAMRUN = true;
2811 }
2812 if (vpflow.flag("QSUB")) {
2813 sflow::QSUB(vpflow.getattachedscheme("QSUB"));
2814 _PROGRAMRUN = true;
2815 } // NEW
2816 // R
2817 if (vpflow.flag("RDF")) {
2818 pflow::RDF(vpflow.getattachedscheme("RDF"), cin, vpflow.flag("RDF::RAW_COUNTS"));
2819 _PROGRAMRUN = true;
2820 } // CO20220627
2821 if (vpflow.flag("RDFCMP")) {
2822 pflow::RDFCMP(vpflow.getattachedscheme("RDFCMP"));
2823 _PROGRAMRUN = true;
2824 }
2825 if (vpflow.flag("RMCOPIES")) {
2826 cout << pflow::RMCOPIES(cin);
2827 _PROGRAMRUN = true;
2828 }
2829 if (vpflow.flag("RSM")) {
2830 pflow::RSM(argv, cin);
2831 _PROGRAMRUN = true;
2832 }
2833 if (vpflow.flag("RASMOL")) {
2834 pflow::RASMOL(vpflow.getattachedscheme("RASMOL"), cin);
2835 _PROGRAMRUN = true;
2836 }
2837 // ME20191001 START
2838 // ME20200829 - Added patch functionality
2839 if (vpflow.flag("REBUILDDB") || vpflow.flag("UPDATEDB") || vpflow.flag("PATCHDB")) {
2840 int return_code = 199; // Placeholder: return code in the 100s do not run the analysis
2841 aflowlib::AflowDB db(DEFAULT_AFLOW_DB_FILE, DEFAULT_AFLOW_DB_DATA_PATH, DEFAULT_AFLOW_DB_LOCK_FILE, XHOST.vschema, XHOST.vschema_internal);
2842 const string patchfiles = vpflow.getattachedscheme("DBPATCHFILES");
2843 // Hierarchy: rebuild > update > patch
2844 if (vpflow.flag("REBUILDDB") || vpflow.flag("UPDATEDB")) {
2845 return_code = db.rebuildDatabase(patchfiles, vpflow.flag("REBUILDDB"));
2846 } else if (vpflow.flag("PATCHDB")) {
2847 // false: do not check timestamps (always patch)
2848 return_code = db.patchDatabase(patchfiles, false);
2849 }
2850 if ((return_code < 100) || (return_code >= 200)) {
2851 db.analyzeDatabase(DEFAULT_AFLOW_DB_STATS_FILE);
2852 }
2853 _PROGRAMRUN = true;
2854 return return_code;
2855 }
2856 if (vpflow.flag("ANALYZEDB")) {
2857 aflowlib::AflowDB db(DEFAULT_AFLOW_DB_FILE, XHOST.vschema, XHOST.vschema_internal);
2858 db.analyzeDatabase(DEFAULT_AFLOW_DB_STATS_FILE);
2859 _PROGRAMRUN = true;
2860 }
2861 // ME20191001 END
2862
2863 if (vpflow.flag("RMATOM")) {
2864 cout << pflow::RMATOM(cin, aurostd::args2utype(argv, "--rm_atom", 0));
2865 _PROGRAMRUN = true;
2866 }
2867 // S
2868 if (vpflow.flag("SHELL")) {
2869 pflow::SHELL(vpflow.getattachedscheme("SHELL"), cin);
2870 _PROGRAMRUN = true;
2871 }
2872 if (vpflow.flag("SHIFT")) {
2873 cout << pflow::SHIFT(vpflow.getattachedscheme("SHIFT"), cin);
2874 _PROGRAMRUN = true;
2875 }
2876 if (vpflow.flag("SLAB")) {
2877 cout << slab::MAKE_SLAB(vpflow.getattachedscheme("SLAB"), cin);
2878 _PROGRAMRUN = true;
2879 }
2880 if (vpflow.flag("STATDIEL")) {
2881 pflow::STATDIEL(argv);
2882 _PROGRAMRUN = true;
2883 } // CAMILO
2884
2885 if (vpflow.flag("SG::AFLOW") && argv.size() >= 2) {
2886 cout << pflow::SG(vpflow, cin, "AFLOW", "ALL") << endl;
2887 _PROGRAMRUN = true;
2888 } // DX20170926
2889 if (vpflow.flag("SG::AFLOW_LABEL") && argv.size() >= 2) {
2890 cout << pflow::SG(vpflow, cin, "AFLOW", "LABEL") << endl;
2891 _PROGRAMRUN = true;
2892 } // DX20170926
2893 if (vpflow.flag("SG::AFLOW_NUMBER") && argv.size() >= 2) {
2894 cout << pflow::SG(vpflow, cin, "AFLOW", "NUMBER") << endl;
2895 _PROGRAMRUN = true;
2896 } // DX20170926
2897 if (vpflow.flag("SG::PLATON") && argv.size() >= 2) {
2898 cout << pflow::SG(vpflow, cin, "PLATON", "ALL") << endl;
2899 _PROGRAMRUN = true;
2900 } // DX20170926
2901 if (vpflow.flag("SG::PLATON_LABEL") && argv.size() >= 2) {
2902 cout << pflow::SG(vpflow, cin, "PLATON", "LABEL") << endl;
2903 _PROGRAMRUN = true;
2904 } // DX20170926
2905 if (vpflow.flag("SG::PLATON_NUMBER") && argv.size() >= 2) {
2906 cout << pflow::SG(vpflow, cin, "PLATON", "NUMBER") << endl;
2907 _PROGRAMRUN = true;
2908 } // DX20170926
2909 if (vpflow.flag("SG::FINDSYM") && argv.size() >= 2) {
2910 cout << pflow::SG(vpflow, cin, "FINDSYM", "ALL") << endl;
2911 _PROGRAMRUN = true;
2912 } // DX20170926
2913 if (vpflow.flag("SG::FINDSYM_LABEL") && argv.size() >= 2) {
2914 cout << pflow::SG(vpflow, cin, "FINDSYM", "LABEL") << endl;
2915 _PROGRAMRUN = true;
2916 } // DX20170926
2917 if (vpflow.flag("SG::FINDSYM_NUMBER") && argv.size() >= 2) {
2918 cout << pflow::SG(vpflow, cin, "FINDSYM", "NUMBER") << endl;
2919 _PROGRAMRUN = true;
2920 } // DX20170926
2921
2922 if (vpflow.flag("SG::FINDSYM_PRINT")) {
2923 pflow::FINDSYM(vpflow, 0, cin);
2924 _PROGRAMRUN = true;
2925 } // DX20170926
2926 if (vpflow.flag("SG::FINDSYM_EXEC")) {
2927 pflow::FINDSYM(vpflow, 1, cin);
2928 _PROGRAMRUN = true;
2929 } // DX20170926
2930
2931 if (vpflow.flag("SUPERCELL")) {
2932 cout << pflow::SUPERCELL(vpflow.getattachedscheme("SUPERCELL"), cin);
2933 _PROGRAMRUN = true;
2934 }
2935 if (vpflow.flag("SUPERCELLSTRLIST")) {
2936 pflow::SUPERCELLSTRLIST(vpflow.getattachedscheme("SUPERCELLSTRLIST"));
2937 _PROGRAMRUN = true;
2938 }
2939 if (vpflow.flag("SD") && argv.size() >= 2) {
2940 cout << pflow::SD(argv, cin);
2941 _PROGRAMRUN = true;
2942 }
2943 if (vpflow.flag("SG")) {
2944 pflow::SG(cin);
2945 _PROGRAMRUN = true;
2946 }
2947 if (vpflow.flag("SGROUP")) {
2948 pflow::SYMMETRY_GROUPS(aflags, cin, vpflow, cout);
2949 _PROGRAMRUN = true;
2950 } // DX20170818
2951 if (vpflow.flag("SPECIES")) {
2952 cout << pflow::SPECIES(cin);
2953 _PROGRAMRUN = true;
2954 }
2955 //[CO20220614 - moved up]if(vpflow.flag("STDCONVCELL")) {cout << GetStandardConventional(xstructure(cin,IOAFLOW_AUTO)); _PROGRAMRUN=true;}
2956 //[CO20220614 - moved up]if(vpflow.flag("STDPRIMCELL")) {cout << GetStandardPrimitive(xstructure(cin,IOAFLOW_AUTO)); _PROGRAMRUN=true;}
2957 if (vpflow.flag("SCALE")) {
2958 cout << pflow::SCALE(vpflow.getattachedscheme("SCALE"), cin);
2959 _PROGRAMRUN = true;
2960 }
2961 if (vpflow.flag("STRUCTURE2JSON")) {
2962 const xstructure xstr(cin, IOAFLOW_AUTO);
2963 cout << xstructure2json(xstr).toString() << endl;
2964 _PROGRAMRUN = true;
2965 } // DX20190508
2966
2967 // T
2968 // U
2969 if (vpflow.flag("UFFENERGY")) {
2970 pocc::UFFENERGY(cin);
2971 _PROGRAMRUN = true;
2972 }
2973 // V
2974 //[CO20220614 - moved up]if(vpflow.flag("VASP")||vpflow.flag("VASP5")) {cout << input2VASPxstr(cin,vpflow.flag("VASP5")); _PROGRAMRUN=true;} //added bool for vasp5
2975 if (vpflow.flag("VISUALIZE_PHONONS")) {
2976 apl::createAtomicDisplacementSceneFile(vpflow);
2977 _PROGRAMRUN = true;
2978 } // ME20200330
2979 if (vpflow.flag("VOLUME::EQUAL")) {
2980 cout << pflow::VOLUME("VOLUME::EQUAL," + vpflow.getattachedscheme("VOLUME::EQUAL"), cin);
2981 _PROGRAMRUN = true;
2982 }
2983 if (vpflow.flag("VOLUME::MULTIPLY_EQUAL")) {
2984 cout << pflow::VOLUME("VOLUME::MULTIPLY_EQUAL," + vpflow.getattachedscheme("VOLUME::MULTIPLY_EQUAL"), cin);
2985 _PROGRAMRUN = true;
2986 }
2987 if (vpflow.flag("VOLUME::PLUS_EQUAL")) {
2988 cout << pflow::VOLUME("VOLUME::PLUS_EQUAL," + vpflow.getattachedscheme("VOLUME::PLUS_EQUAL"), cin);
2989 _PROGRAMRUN = true;
2990 }
2991 // X
2992 if (vpflow.flag("XPLUG::INIT")) {
2993 aflowlib::XPLUG(vpflow);
2994 _PROGRAMRUN = true;
2995 }
2996 if (vpflow.flag("XYZ")) {
2997 pflow::XYZ(vpflow.getattachedscheme("XYZ"), cin);
2998 _PROGRAMRUN = true;
2999 }
3000 if (vpflow.flag("XYZWS")) {
3001 pflow::XYZWS(cin);
3002 _PROGRAMRUN = true;
3003 }
3004 if (vpflow.flag("XRAY")) {
3005 pflow::XRAY(vpflow.getattachedscheme("XRAY"), cin);
3006 _PROGRAMRUN = true;
3007 }
3008 if (vpflow.flag("XRAY_PEAKS")) {
3009 pflow::XRAY_PEAKS(vpflow, cin);
3010 _PROGRAMRUN = true;
3011 } // CO20190520
3012 if (vpflow.flag("PLOT_XRAY")) {
3013 pflow::PLOT_XRAY(vpflow, cin);
3014 _PROGRAMRUN = true;
3015 } // CO20190520
3016 if (vpflow.flag("PLOT_XRAY_FILE")) {
3017 pflow::PLOT_XRAY(vpflow);
3018 _PROGRAMRUN = true;
3019 } // CO20190520
3020 if (vpflow.flag("XRD_DIST")) {
3021 pflow::GetAtomicPlaneDist(vpflow.getattachedscheme("XRD_DIST"), cin);
3022 _PROGRAMRUN = true;
3023 }
3024 if (vpflow.flag("XELEMENT")) {
3025 pflow::XelementPrint(vpflow.getattachedscheme("XELEMENT"), cout);
3026 _PROGRAMRUN = true;
3027 }
3028 if (vpflow.flag("XTALFINDER_PYTHON")) {
3029 compare::writePythonScript(cout);
3030 _PROGRAMRUN = true;
3031 }
3032 // Y
3033 // Z
3034 if (vpflow.flag("ZVAL")) {
3035 pflow::ZVAL("ZVAL," + vpflow.getattachedscheme("ZVAL"));
3036 _PROGRAMRUN = true;
3037 }
3038 if (vpflow.flag("ZVAL::CELL")) {
3039 pflow::ZVAL("ZVAL::CELL," + vpflow.getattachedscheme("ZVAL::CELL"));
3040 _PROGRAMRUN = true;
3041 }
3042 if (vpflow.flag("ZVAL::ATOM")) {
3043 pflow::ZVAL("ZVAL::ATOM," + vpflow.getattachedscheme("ZVAL::ATOM"));
3044 _PROGRAMRUN = true;
3045 }
3046
3047 // Richard's Functions:
3048 if (vpflow.flag("REVERSE_SPACEGROUP_RHT")) {
3049 cout << SYM::ReverseSpaceGroup(argv) << endl;
3050 _PROGRAMRUN = true;
3051 }
3052 if (vpflow.flag("ORTHODEFECT_RHT")) {
3053 SYM::OrthoDefect(cin);
3054 _PROGRAMRUN = true;
3055 }
3056 if (vpflow.flag("PRIMITIVE_LATTICE_RHT")) {
3057 xstructure str(cin);
3058 str.GetPrimitiveCell();
3059 cout << str << endl;
3060 _PROGRAMRUN = true;
3061 }
3062 // DX START
3063 // WYCCAR FUNCTIONS (AUTO and MANUAL)
3064
3065 if (vpflow.flag("WYCKOFF_POSITIONS")) {
3066 cout << pflow::WyckoffPositions(vpflow, cin);
3067 _PROGRAMRUN = true;
3068 } // DX20180807 - put into pflow function
3069 // End Richard's Functions
3070 // DX END
3071 }
3072 // *********************************************************************
3073 if (argv.size() == 3 && !_PROGRAMRUN) {
3074 if (vpflow.flag("CHGINT")) {
3075 pflow::CHGINT(argv);
3076 _PROGRAMRUN = true;
3077 }
3078 if (EXTRACT_KPOINTS != "nan") {
3079 cout << pflow::EXTRACT_xcar(aflags, argv, "KPOINTS", EXTRACT_KPOINTS);
3080 _PROGRAMRUN = true;
3081 }
3082 if (EXTRACT_INCAR != "nan") {
3083 cout << pflow::EXTRACT_xcar(aflags, argv, "INCAR", EXTRACT_INCAR);
3084 _PROGRAMRUN = true;
3085 }
3086 if (EXTRACT_POSCAR != "nan") {
3087 cout << pflow::EXTRACT_xcar(aflags, argv, "POSCAR", EXTRACT_POSCAR);
3088 _PROGRAMRUN = true;
3089 }
3090 if (EXTRACT_POTCAR != "nan") {
3091 cout << pflow::EXTRACT_xcar(aflags, argv, "POTCAR", EXTRACT_POTCAR);
3092 _PROGRAMRUN = true;
3093 }
3094 if (EXTRACT_PARTCAR != "nan") {
3095 cout << pflow::EXTRACT_xcar(aflags, argv, "PARTCAR", EXTRACT_PARTCAR);
3096 _PROGRAMRUN = true;
3097 } // CO20181226
3098 if (vpflow.flag("EXTRACT_SYMMETRY")) {
3099 cout << pflow::EXTRACT_Symmetry(aflags, argv);
3100 _PROGRAMRUN = true;
3101 }
3102 if (vpflow.flag("KPATH")) {
3103 pflow::KPATH(cin, aurostd::args2attachedutype<double>(argv, "--grid=", -1), XHOST.vflag_control.flag("WWW"));
3104 _PROGRAMRUN = true;
3105 } // CO20200329 - default value -1 so we can decide grid automatically //CO20200404 - new web flag
3106 if (vpflow.flag("INSPHERE")) {
3107 pflow::XYZINSPHERE(cin, aurostd::args2utype(argv, "--insphere", 0.0));
3108 _PROGRAMRUN = true;
3109 }
3110 if (vpflow.flag("NANOPARTICLE")) {
3111 cout << pflow::NANOPARTICLE(cin, aurostd::args2xvectorutype<double>(argv, "--nanoparticle", argv.size() - 2));
3112 _PROGRAMRUN = true;
3113 }
3114 if (vpflow.flag("POCC")) {
3115 pflow::POCC(argv);
3116 _PROGRAMRUN = true;
3117 }
3118
3119 if (vpflow.flag("RAYTRACE")) {
3120 pflow::RAYTRACE(argv);
3121 _PROGRAMRUN = true;
3122 }
3123 if (vpflow.flag("SETORIGIN")) {
3124 cout << pflow::SETORIGIN(cin, (uint) aurostd::string2utype<int>(argv.at(2)));
3125 _PROGRAMRUN = true;
3126 }
3127 if (vpflow.flag("SEWALD")) {
3128 pflow::SEWALD(argv, cin);
3129 _PROGRAMRUN = true;
3130 }
3131 if (vpflow.flag("SGROUP")) {
3132 pflow::SGROUP(aflags, cin, aurostd::args2utype(argv, "--sgroup|--spacegroup", KBIN_SYMMETRY_SGROUP_RADIUS_DEFAULT));
3133 _PROGRAMRUN = true;
3134 }
3135
3136 if (vpflow.flag("WYCKOFF")) {
3137 cout << pflow::WYCKOFF(argv, cin);
3138 _PROGRAMRUN = true;
3139 }
3140 }
3141 // *********************************************************************
3142 if (argv.size() >= 3 && !_PROGRAMRUN) {
3143 if (vpflow.flag("MISCIBILITY")) {
3144 cout << pflow::MISCIBILITY(argv);
3145 _PROGRAMRUN = true;
3146 }
3147 }
3148 // *********************************************************************
3149 if (argv.size() == 4 && !_PROGRAMRUN) {
3150 if (vpflow.flag("JOINSTRLIST")) {
3151 pflow::JOINSTRLIST(argv);
3152 _PROGRAMRUN = true;
3153 }
3154 if (vpflow.flag("MAKESTRLIST")) {
3155 pflow::MAKESTRLIST(argv);
3156 _PROGRAMRUN = true;
3157 }
3158 if (vpflow.flag("NANOPARTICLE")) {
3159 cout << pflow::NANOPARTICLE(cin, aurostd::args2xvectorutype<double>(argv, "--nanoparticle", argv.size() - 2));
3160 _PROGRAMRUN = true;
3161 }
3162 if (vpflow.flag("PDOS")) {
3163 pflow::PDOS(argv);
3164 _PROGRAMRUN = true;
3165 }
3166 if (vpflow.flag("PLANEDENS")) {
3167 pflow::PLANEDENS(argv);
3168 _PROGRAMRUN = true;
3169 }
3170 if (vpflow.flag("PRIM") && AFLOW_PTHREADS::FLAG) {
3171 cout << pflow::PRIM(cin, 0);
3172 _PROGRAMRUN = true;
3173 }
3174 if (vpflow.flag("RBANAL")) {
3175 pflow::RBANAL(argv);
3176 _PROGRAMRUN = true;
3177 }
3178 if (vpflow.flag("SUMPDOS")) {
3179 pflow::SUMPDOS(argv);
3180 _PROGRAMRUN = true;
3181 }
3182 if (vpflow.flag("SWAP")) {
3183 cout << pflow::xstrSWAP(argv, cin);
3184 _PROGRAMRUN = true;
3185 }
3186 if (vpflow.flag("XFIXX")) {
3187 aflowlib::XFIX_LIBRARY_ALL("LIB2", argv);
3188 _PROGRAMRUN = true;
3189 }
3190 }
3191 // *********************************************************************
3192 if (argv.size() == 5 && !_PROGRAMRUN) {
3193 if (vpflow.flag("RBDIST")) {
3194 pflow::RBDIST(argv);
3195 _PROGRAMRUN = true;
3196 }
3197 if (vpflow.flag("SETCM")) {
3198 cout << pflow::SETCM(cin, aurostd::args2xvectorutype<double>(argv, "--setcm", 3));
3199 _PROGRAMRUN = true;
3200 }
3201 if (vpflow.flag("SETORIGIN")) {
3202 cout << pflow::SETORIGIN(cin, aurostd::args2xvectorutype<double>(argv, "--setorigin", 3));
3203 _PROGRAMRUN = true;
3204 }
3205 if (vpflow.flag("CMPSTR")) {
3206 pflow::CMPSTR(argv);
3207 _PROGRAMRUN = true;
3208 }
3209 // superlattice
3210 }
3211 // *********************************************************************
3212 // ----------------------------------------------- ERRORS
3213
3214 if (!_PROGRAMRUN) {
3215 cerr << "aflow: the number of arguments is not correct" << endl;
3216 cerr << "Try \'aflow --help\' for more information" << endl;
3217 for (size_t i = 0; i < argv.size(); i++) {
3218 // cerr << "argv.at(" << i << ")=" << argv.at(i) << endl; // return 0;
3219 cerr << argv[i] << " ";
3220 }
3221 cerr << endl;
3222 }
3223 // *********************************************************************
3224 // return 1;
3225 return 0; // CO
3226 }
3227} // namespace pflow
3228
3229// ***************************************************************************
3230// pflow::CheckCommands
3231// ***************************************************************************
3232namespace pflow {
3233 bool CheckCommands(vector<string> argv, const vector<string>& cmds) {
3234 string _cmd;
3235 vector<string> tokens;
3236 bool found = false;
3237 // check identities
3238 for (int i = argv.size() - 1; i >= 1 && !found; i--) {
3239 _cmd = aurostd::RemoveWhiteSpaces(string(argv.at(i)));
3240 for (size_t j = 0; j < cmds.size() && !found; j++) { // cerr << _cmd << " " << cmds[j] << endl;
3241 if (_cmd == cmds[j]) {
3242 found = true;
3243 }
3244 }
3245 }
3246 // check with =
3247 for (int i = argv.size() - 1; i >= 1 && !found; i--) {
3248 aurostd::RemoveWhiteSpaces(string(argv.at(i)));
3249 aurostd::string2tokens(aurostd::RemoveWhiteSpaces(string(argv.at(i))), tokens, "=");
3250 _cmd = tokens.at(0) + "=";
3251 for (size_t j = 0; j < cmds.size() && !found; j++) { // cerr << _cmd << " " << cmds[j] << endl;
3252 if (_cmd == cmds[j]) {
3253 found = true;
3254 }
3255 }
3256 }
3257 // not found
3258 if (!found) {
3259 cerr << aflow::Banner("BANNER_TINY") << endl;
3260 cerr << "ERROR - pflow::CheckCommands: command not found: " << _cmd << endl;
3261 return false;
3262 }
3263 return true;
3264 }
3265} // namespace pflow
3266
3267// ***************************************************************************
3268// pflow::Intro_pflow
3269// ***************************************************************************
3270// patched by CO20200106 to avoid long string construction (patching for indents)
3271namespace pflow {
3272 string Intro_pflow(string x) {
3273 stringstream strstream;
3274 const string tab = " ";
3275 string xspaces;
3276 for (size_t i = 0; i < x.size(); i++) {
3277 xspaces += " ";
3278 } // spaces size of x
3279 // intro(strstream);
3280 strstream << "******* BEGIN POSTPROCESSING MODE ******************************************************************" << endl;
3281 strstream << tab << x << " --help [-h] option_name" << endl;
3282 strstream << endl;
3283 strstream << tab << x << " --abccar < POSCAR | WYCCAR" << endl;
3284 strstream << tab << x << " --abinit < POSCAR" << endl;
3285 strstream << tab << x << " --aims < POSCAR" << endl;
3286 strstream << tab << x << " --ace < POSCAR" << endl;
3287 strstream << tab << x << " --use_aflow.in=XXX" << endl;
3288 strstream << tab << x << " --aflowin < POSCAR" << endl;
3289 strstream << tab << x << " --aflowSG[_label,_number][=<tolerance_value>|=tight|=loose] < POSCAR" << endl;
3290 strstream << tab << x
3291 << " --aflow-sym|--AFLOW-SYM|--AFLOWSYM|--aflowSYM|--aflowsym|--full_symmetry|--full_sym|--fullsym[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|json] [--screen_only] "
3292 "[--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]] < POSCAR"
3293 << endl;
3294 strstream << tab << x << " --poscar2aflowin < POSCAR" << endl;
3295 strstream << tab << x << " --angle=cutoff < POSCAR" << endl;
3296 strstream << tab << x << " --agroup|--sitepointgroup[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|json] [--screen_only] [--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]] < POSCAR" << endl;
3297 strstream << tab << x << " --agroup2 < POSCAR" << endl;
3298 strstream << tab << x << " --agroup2m < POSCAR" << endl;
3299 strstream << tab << x << " --alphabetic < POSCAR" << endl;
3300 strstream << tab << x << " --alpha_compound=string1,string2...." << endl;
3301 strstream << tab << x << " --alpha_species=string1,string2..." << endl;
3302 strstream << tab << x << " --aflowlib=entry [--print=txt|json]" << endl;
3303 strstream << tab << x << " --aflowlib_auid2aurl=auid1,auid2....|--auid2aurl=..." << endl;
3304 strstream << tab << x << " --aflowlib_aurl2auid=aurl1,aurl2.... [ --aurl2auid=..." << endl;
3305 strstream << tab << x << " --aflowlib_auid2loop=auid1,auid2....|--auid2loop=..." << endl;
3306 strstream << tab << x << " --aflowlib_aurl2loop=aurl1,aurl2.... [ --aurl2loop=..." << endl;
3307 strstream << tab << x << " --atat < POSCAR" << endl;
3308 strstream << tab << x << " [options] --bader -D DIRECTORY" << endl;
3309 strstream << tab << xspaces << " " << "options are: --usage" << endl;
3310 strstream << tab << xspaces << " " << " --critical_points|--cp" << endl;
3311 strstream << tab << xspaces << " " << " --calculate=|--calc=bader|voronoi" << endl;
3312 strstream << tab << xspaces << " " << " --nocalculate=|--nocalc=bader|voronoi" << endl;
3313 strstream << tab << xspaces << " " << " --partition=|--part=neargrid|ongrid" << endl;
3314 strstream << tab << xspaces << " " << " --refine_edge_method=|--rem=-1|-2|-3" << endl;
3315 strstream << tab << xspaces << " " << " --reference=|--ref=REF_FILE" << endl;
3316 strstream << tab << xspaces << " " << " --vacuum=|--vac=off|auto|DENSITY_THRESHOLD" << endl;
3317 strstream << tab << xspaces << " " << " --terminate=|--term=known|max" << endl;
3318 strstream << tab << xspaces << " " << " --print_all=atom|bader|both" << endl;
3319 strstream << tab << xspaces << " " << " --print_index=|--print_idx=atom|bader|both" << endl;
3320 strstream << tab << xspaces << " " << " --print_select_atom=|--print_sel_atom=[LIST OR RANGE]" << endl;
3321 strstream << tab << xspaces << " " << " --print_select_bader=|--print_sel_bader=[LIST OR RANGE]" << endl;
3322 strstream << tab << xspaces << " " << " --print_sum_atom=[LIST OR RANGE]" << endl;
3323 strstream << tab << xspaces << " " << " --print_sum_bader=[LIST OR RANGE]" << endl;
3324 strstream << tab << xspaces << " " << " --quiet|--q" << endl;
3325 strstream << tab << xspaces << " " << " --consolidate_atoms2species|--a2s" << endl;
3326 strstream << tab << xspaces << " " << " --remove_bader_atoms|--rba" << endl;
3327 strstream << tab << xspaces << " " << " --jvxl_all_species=|--jvxl=CUTOFF1,CUTOFF2...[::DOWNSAMPLE1,DOWNSAMPLE2,..]|CUTOFF1[,DOWNSAMPLE1:CUTOFF2,DOWNSAMPLE2:...]|CUTOFF[,DOWNSAMPLE]" << endl;
3328 strstream << tab << xspaces << " " << " --keep=jvxl_only|--jvxl_only" << endl;
3329 strstream << tab << x << " --bands=PROOUT < POSCAR [AFLOW: NEED VERIFICATION]" << endl;
3330 strstream << tab << x << " --bandgap[=bands_directory1[,bands_directory2,...]]" << endl;
3331 strstream << tab << x << " --bandgaps < file_containing_bands_directories" << endl;
3332 strstream << tab << x << " --bandgapdos[=bands_directory1[,bands_directory2,...]]" << endl;
3333 strstream << tab << x << " --bandgaplistdos < DOSCAR_list" << endl;
3334 strstream << tab << x << " --bandstructure|--bs" << endl;
3335 strstream << tab << x << " --bzdirections|--bzd < POSCAR" << endl;
3336 strstream << tab << x << " --bzdirections=|--bzd=LATTICE" << endl;
3337 strstream << tab << x << " --BZmax < POSCAR" << endl;
3338 strstream << tab << x << " --bzplot|--plotbz < POSCAR" << endl;
3339 strstream << tab << x << " --bzplotuseKPOINTS=KPOINTS < POSCAR" << endl;
3340 strstream << tab << x << " --bzplotdata < POSCAR" << endl;
3341 strstream << tab << x << " --bzplotdatauseKPOINTS=KPOINTS < POSCAR" << endl;
3342 strstream << tab << x << " --cart [-c] < POSCAR" << endl;
3343 strstream << tab << x
3344 << " [--cce (prints user instructions and exits)] --cce=POSCAR_FILE_PATH [--oxidation_numbers=ox_num_1,ox_num_2,...] [--enthalpies_formation_dft=form_enthalpy_1,form_enthalpy_2,...] "
3345 "[--functionals=functional_1,functional_2,...]"
3346 << endl;
3347 strstream << tab << x << " [options] --chgcar2jvxl=|--c2j=CHGCAR11[,CHGCAR2,...]::CUTOFF1,CUTOFF2...[::DOWNSAMPLE1,DOWNSAMPLE2,...]|CHGCAR1,CUTOFF1[,DOWNSAMPLE1:CHGCAR2,CUTOFF2[,DOWNSAMPLE2:...]]|CHGCAR,CUTOFF[,DOWNSAMPLE]"
3348 << endl;
3349 strstream << tab << xspaces << " " << "options are: --usage" << endl;
3350 strstream << tab << xspaces << " " << " --output=|--o=OUTPUT_FILE" << endl;
3351 strstream << tab << x << " [options]--chgdiff=CHGCAR1,CHGCAR2" << endl;
3352 strstream << tab << xspaces << " " << "options are: --usage" << endl;
3353 strstream << tab << xspaces << " " << " --output=|--o=CHGCAR_OUT" << endl;
3354 strstream << tab << x << " --chgsum=CHGCAR1,CHGCAR2,..." << endl;
3355 strstream << tab << xspaces << " " << "options are: --usage" << endl;
3356 strstream << tab << xspaces << " " << " --output=|--o=CHGCAR_OUT" << endl;
3357 strstream << tab << x << " --check_integrity|--checki" << endl;
3358 strstream << tab << x << " --cif < POSCAR" << endl;
3359 strstream << tab << x << " --clean -D DIRECTORY" << endl;
3360 strstream << tab << x << " --clean_all < LIST_DIRECTORIES" << endl;
3361 strstream << tab << x << " --compare2database < POSCAR" << endl; // DX20210611
3362 strstream << tab << x << " --compare2prototypes < POSCAR" << endl; // DX20210611
3363 strstream << tab << x << " --compare_database_entries [--alloy=AlgAlMn...] [--nspecies=<number>] [--stoichiometry=1,2,3,...] [--space_group=225,186,227,...]" << endl; // DX20210611
3364 strstream << tab << x << " --compare_materials=POSCAR1,POSCAR2,...| -D <path> | -F=<filename> [--np=xx (default 1)]" << endl; // DX20210611
3365 strstream << tab << x << " --compare_structures=POSCAR1,POSCAR2,...| -D <path> | -F=<filename> [--np=xx (default 1)]" << endl; // DX20210611
3366 strstream << tab << x << " --convex_hull=|--chull --alloy=MnPdPt[,AlCuZn,...] [--np=1] [chull_options] [--destination=[DIRECTORY]]" << endl;
3367 strstream << tab << xspaces << " " << "chull_options are:" << endl;
3368 strstream << endl;
3369 strstream << tab << xspaces << " " << "GENERAL OPTIONS:" << endl;
3370 strstream << tab << xspaces << " " << " --usage" << endl;
3371 strstream << tab << xspaces << " " << " --output=|--o=|--print=|--p=latex|pdf|png|json|text|jupyter|jupyter2|jupyter3" << endl;
3372 strstream << tab << xspaces << " " << " --screen_only" << endl;
3373 strstream << tab << xspaces << " " << " --keep=tex|--keep_tex|--keeptex|--tex" << endl;
3374 strstream << tab << xspaces << " " << " --keep=log|--keep_log|--keeplog|--log" << endl;
3375 strstream << tab << xspaces << " " << " --keep=tex,log" << endl;
3376 strstream << endl;
3377 strstream << tab << xspaces << " " << "LOADING OPTIONS:" << endl;
3378 strstream << tab << xspaces << " " << " --load_library=|--loadlibrary=|--ll=icsd|lib1|lib2|lib3" << endl;
3379 strstream << tab << xspaces << " " << " --load_API|--load_api|--loadapi|--lapi|--api" << endl;
3380 strstream << tab << xspaces << " " << " --load_entries_entry_output|--loadentriesentryoutput|--leo" << endl;
3381 strstream << tab << xspaces << " " << " --neglect=|--ban=aflow:bb0d45ab555bc208);aflow:fb9eaa58604ce774" << endl;
3382 strstream << tab << xspaces << " " << " --see_neglect|--seeneglect|--sn" << endl;
3383 strstream << tab << xspaces << " " << " --remove_extreme_points=|--removeextremepoints=|--remove_extrema=|--removeextrema=|--rep=-1000" << endl;
3384 strstream << tab << xspaces << " " << " --entropic_temperature|--entropictemperature|--entroptemp" << endl;
3385 strstream << tab << xspaces << " " << " --include_paw_gga|--paw_gga" << endl;
3386 strstream << endl;
3387 strstream << tab << xspaces << " " << "ANALYSIS OPTIONS:" << endl;
3388 strstream << tab << xspaces << " " << " --distance_to_hull=|--distancetohull=|--distance2hull=|--dist2hull=|--d2h=aflow:bb0d45ab555bc208,aflow:fb9eaa58604ce774" << endl;
3389 strstream << tab << xspaces << " " << " --stability_criterion=|--stabilitycriterion=|--stable_criterion=|--scriterion=|--sc=aflow:bb0d45ab555bc208,aflow:fb9eaa58604ce774" << endl;
3390 strstream << tab << xspaces << " "
3391 << " "
3392 "--n+1_enthalpy_gain=|--=|--n+1enthalpygain=|--n+1energygain=|--n+1egain=|--n1egain=|--n+1_enthalpygain=|--n+1+energygain=|--n+1_egain=|--nplus1=aflow:bb0d45ab555bc208,aflow:fb9eaa58604ce774"
3393 << endl;
3394 strstream << tab << xspaces << " " << " --hull_formation_enthalpy=|--hull_enthalpy=|--hull_energy=0.25,0.25" << endl;
3395 strstream << tab << xspaces << " " << " --skip_structure_comparison|--skipstructruecomparison|--skipstructcomp|--ssc" << endl;
3396 strstream << tab << xspaces << " " << " --skip_stability_criterion_analysis|--skipstabilitycriterionanalysis|--skipscriterion|--sscriterion" << endl;
3397 strstream << tab << xspaces << " "
3398 << " --skip_n_plus_1_enthalpy_gain_analysis|--skip_n_plus_1_energy_gain_analysis|--skipnplus1enthalpygainanalysis|--skipnplus1energygainanalysis|--skipnplus1|--snp1|--snpo" << endl;
3399 strstream << tab << xspaces << " " << " --include_skewed_hulls|--include_skewed|--ish" << endl;
3400 strstream << tab << xspaces << " " << " --include_unreliable_hulls|--include_unreliable|--iuh" << endl;
3401 strstream << tab << xspaces << " " << " --include_outliers|--io" << endl;
3402 strstream << tab << xspaces << " " << " --strict_outlier_analysis|--soa" << endl;
3403 strstream << tab << xspaces << " " << " --include_ill_converged|--iic" << endl;
3404 strstream << tab << xspaces << " " << " --force" << endl;
3405 strstream << endl;
3406 strstream << tab << xspaces << " " << "LATEX/PDF/PNG OPTIONS:" << endl;
3407 strstream << tab << xspaces << " " << " --image_only|--imageonly|--image" << endl;
3408 strstream << tab << xspaces << " " << " --no_document|--nodocument|--no_doc|--nodoc|--full_page_image|--fullpageimage" << endl;
3409 strstream << tab << xspaces << " " << " --document_only|--documentonly|--doc_only|--doconly|--doc" << endl;
3410 strstream << tab << xspaces << " " << " --latex_output|--latexoutput" << endl;
3411 strstream << tab << xspaces << " " << " --latex_interactive|--latexinteractive" << endl;
3412 strstream << tab << xspaces << " " << " --light_contrast|--lightcontrast|--lc" << endl;
3413 strstream << tab << xspaces << " " << " --large_font|--largefont|--large|--lf" << endl;
3414 strstream << tab << xspaces << " " << " --png_resolution=|--pngresolution=|--pngr=300" << endl;
3415 strstream << tab << xspaces << " " << " --plot_iso_max_latent_heat|--plot_isomax|--iso_max|--isomax" << endl;
3416 strstream << tab << x << " --corners|--corner < POSCAR" << endl;
3417 strstream << tab << x << " --data[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|json] < POSCAR" << endl;
3418 strstream << tab << x << " --data1=rcut < POSCAR" << endl;
3419 strstream << tab << x << " --data2 < POSCAR" << endl;
3420 strstream << tab << x << " --debye=THERMO[.bz2|.gz|.xz]" << endl;
3421 strstream << tab << x << " --diff=POSCAR1,POSCAR2" << endl;
3422 strstream << tab << x << " --disp=cutoff < POSCAR" << endl;
3423 strstream << tab << x << " --dist=cutoff < POSCAR" << endl;
3424 strstream << tab << x << " --delta_kpoints=number [or --dkpoints=number|-dkpoints=number|-dk=number] < POSCAR" << endl;
3425 strstream << tab << x << " --edata[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|json] < POSCAR" << endl;
3426 strstream << tab << x << " --effective-mass|--em DIRECTORY" << endl;
3427 strstream << tab << x << " --eigcurv=DIRECTORY(with bands)" << endl;
3428 strstream << tab << x << " --element=Z|name|symbol[,property[,property]....]" << endl;
3429 strstream << tab << x << " --enum|--multienum < POSCAR" << endl;
3430 strstream << tab << x << " --enumsort|--multienumsort < POSCAR" << endl;
3431 strstream << tab << x << " --equivalent|--equiv|--inequivalent|--inequiv|--iatoms|--eatoms[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|json] [--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]] < POSCAR"
3432 << endl;
3433 strstream << tab << x << " --ewald[=eta] < POSCAR" << endl;
3434 strstream << tab << x << " --findsym[=tolerance_relative: default " << DEFAULT_FINDSYM_TOL << "] < POSCAR" << endl;
3435 strstream << tab << x << " --findsym_print[=tolerance_relative: default " << DEFAULT_FINDSYM_TOL << "] < POSCAR" << endl;
3436 strstream << tab << x << " --findsymSG[_label,_number][=tolerance_relative: default " << DEFAULT_FINDSYM_TOL << "] < POSCAR" << endl;
3437 strstream << tab << x << " --frac [-f,-d,--fract,--fractional,--direct] < POSCAR" << endl;
3438 strstream << tab << x << " --getTEMP [--runstat|--runbar|--refresh=X|--warning_beep=T|--warning_halt=T]" << endl;
3439 strstream << tab << x << " --gfa --alloy=CaCu [--ae_file=All_atomic_environments_read.dat] [--cutoff_energy=0.05]" << endl;
3440 strstream << tab << x << " --generate_ceramics --nm=C --m=Mo,Nb,Ta,V,W -N=5" << endl; // CO20200731
3441 strstream << tab << x << " --get_isopointal_prototype < POSCAR" << endl; // DX20210611
3442 strstream << tab << x << " --gulp < POSCAR" << endl;
3443 strstream << tab << x << " --identical < POSCAR" << endl;
3444 strstream << tab << x << " --incell < POSCAR" << endl;
3445 strstream << tab << x << " --incompact < POSCAR" << endl;
3446 strstream << tab << x << " --insphere radius < POSCAR" << endl;
3447 strstream << tab << x << " --inwignerseitz [--inws] < POSCAR" << endl;
3448 strstream << tab << x << " --inflate_lattice=coefficient|--ilattice coefficient=coefficient < POSCAR" << endl;
3449 strstream << tab << x << " --inflate_volume=coefficient|--ivolume=coefficient < POSCAR" << endl;
3450 strstream << tab << x << " --jgif < POSCAR" << endl;
3451 strstream << tab << x << " --jmol[=n1[,n2[,n3[,color[,true/false]]]]] < POSCAR" << endl;
3452 strstream << tab << x << " --pocc_hnf < POSCAR" << endl;
3453 strstream << tab << x << " --pocc_count_total < PARTCAR" << endl;
3454 strstream << tab << x << " --pocc_count_unique < PARTCAR" << endl;
3455 strstream << tab << x << " --pocc_show_unique < PARTCAR" << endl;
3456 strstream << tab << x << " --kpath [--grid=XX] < POSCAR" << endl;
3457 strstream << tab << x << " --kpoints=KDENS [or --kppra=KDENS|-k=KDENS] < POSCAR" << endl;
3458 strstream << tab << x << " --maxatoms=N|--max_atoms=N|--atoms_max=N|--atomsmax=N < POSCAR" << endl;
3459 strstream << tab << x << " --msi < POSCAR" << endl;
3460 strstream << tab << x << " --latticehistogram < POSCAR" << endl;
3461 strstream << tab << x << " --latticereduction < POSCAR" << endl;
3462 strstream << tab << x << " --lattice_type|--lattice|--lattice_crystal < POSCAR" << endl;
3463 strstream << tab << x << " --lattice_lattice_type|--lattice_lattice < POSCAR" << endl;
3464 strstream << tab << x << " --latticehistogram < POSCAR" << endl;
3465 strstream << tab << x << " --use_LOCK=XXX" << endl;
3466 strstream << tab << x << " --ltcell=a11,a12,a13,a21,a22,a23,a31,a32,a33 < POSCAR" << endl;
3467 strstream << tab << x << " --ltcell=a11,a22,a33 < POSCAR" << endl;
3468 strstream << tab << x << " --ltcell=file < POSCAR" << endl;
3469 strstream << tab << x << " --ltcellfv=v1,v2,v3,phi < POSCAR" << endl;
3470 strstream << tab << x << " --magpara=directory|--magpara" << endl;
3471 strstream << tab << x << " --minkowski_basis_reduction|--minkowski|--mink < POSCAR" << endl;
3472 strstream << tab << x << " --miscibility|--mix string" << endl;
3473 strstream << tab << x << " --mom < POSCAR" << endl;
3474 strstream << tab << x << " --natoms|--numatoms < POSCAR" << endl;
3475 strstream << tab << x << " --nbondxx < POSCAR" << endl;
3476 strstream << tab << x << " --names|--species A1 A2 ... < POSCAR" << endl;
3477 strstream << tab << x << " --nanoparticle radius distance < POSCAR" << endl;
3478 strstream << tab << x << " --ndata < POSCAR" << endl;
3479 strstream << tab << x << " --niggli < POSCAR" << endl;
3480 strstream << tab << x << " --nn < POSCAR" << endl;
3481 strstream << tab << x << " --noorderparameter < POSCAR" << endl;
3482 strstream << tab << x << " --nosd < POSCAR" << endl;
3483 strstream << tab << x << " --numnames A1 A2 ... < POSCAR" << endl;
3484 strstream << tab << x << " --nspecies|--numspecies< POSCAR" << endl;
3485 strstream << tab << x << " --OrthoDefect < POSCAR" << endl;
3486 strstream << tab << x << " --pdb < POSCAR" << endl;
3487 strstream << tab << x << " --rsm < POSCAR" << endl;
3488 strstream << tab << x << " --rsm --z atom_num1 atom_num2 atom_num3 < POSCAR" << endl;
3489 strstream << tab << x << " --rsm --z atom_symbol1 atom_symbol2 atom_symbol3 < POSCAR" << endl;
3490 strstream << tab << x << " --pearson_symbol|--pearson < POSCAR" << endl;
3491 strstream << tab << x << " --platon[=EQUAL|EXACT][,ang,d1,d2,d3] < POSCAR|platonSG" << endl;
3492 strstream << tab << x << " --platonSG[_label,_number][=EQUAL|EXACT][,ang,d1,d2,d3] < POSCAR" << endl;
3493 strstream << tab << x << " --plotband|--plotbands[=directory[,Emin[,Emax]]]] [--keep=gpl] [--print=pdf|gif|eps|jpg|png] [--title=] [--outfile=]" << endl;
3494 strstream << tab << x << " --plotband_spinsplit[=directory[,DOS_Emin[,DOS_Emax[,DOSSCALE]]]]]" << endl;
3495 strstream << tab << x << " --plotbanddos|--plotbandsdos[=directory[,Emin[,Emax[,DOSSCALE]]]]] [--keep=gpl] [--noshift] [--print=pdf|eps|gif|jpg|png] [--projection=atoms|lm|none|orbitals] [--title=] [--outfile=]" << endl;
3496 strstream << tab << x << " --plotdos[=directory[,Emin[,Emax[,DOSSCALE]]]]] [--print=pdf|eps|gif|jpg|png] [--keep=gpl] [--noshift] [--projection=atoms|lm|none|orbitals] [--title=] [--outfile=]" << endl;
3497 strstream << tab << x << " --plotdosweb[=directory[,DOS_Emin[,DOS_Emax[,DOSSCALE]]]]" << endl;
3498 strstream << tab << x << " --plotpdos|--plotpedos[=directory[,atom[,Emin[,Emax[,DOSSCALE]]]]] [--keep=gpl] [--noshift] [--print=pdf|eps|gif|jpg|png] [--projection=lm|none|orbitals] [--title=] [--outfile=]" << endl;
3499 strstream << tab << x << " --plotpdosall|--plotpedosall[=directory[,Emin[,Emax[,DOSSCALE]]]] [--keep=gpl] [--noshift] [--print=pdf|eps|gif|jpg|png] [--projection=lm|none|orbitals] [--title=] [--outfile=]" << endl;
3500 strstream << tab << x << " --plotpedosall_nonquivalent[=directory[,DOS_Emin[,DOS_Emax[,DOSSCALE]]]]" << endl;
3501 strstream << tab << x << " --plotphdisp|--plotphonondispersion|--pphdis[=directory,[Emin,[Emax]]] [--keep=gpl] [--print=pdf|eps|gif|jpg|png] [--title=] [--unit=THz|Hz|eV|meV|rcm|cm-1] [--outfile=]" << endl;
3502 strstream << tab << x << " --plotphdos[=directory,[Emin,[Emax[,DOSSCALE]]]] [--keep=gpl] [--print=pdf|eps|gif|jpg|png] [--title=] [--unit=THz|Hz|eV|meV|rcm|cm-1] [--outfile=]" << endl;
3503 strstream << tab << x << " --plotphdispdos[=directory,[Emin,[Emax[,DOSSCALE]]]] [--keep=gpl] [--print=pdf|eps|gif|jpg|png] [--title=] [--unit=THz|Hz|eV|meV|rcm|cm-1] [--outfile=]" << endl;
3504 strstream << tab << x << " --plotthermo[=directory[,Tmin[,Tmax]]] [--keep=gpl] [--print=pdf|eps|gif|jpg|png] [--title=] [--outfile=]" << endl;
3505 strstream << tab << x << " --plotcond|--plothermalconductivity[=directory[,Tmin[,Tmax]]] [--keep=gpl] [--print=pdf|eps|gif|jpg|png] [--title=] [--outfile=]" << endl;
3506 strstream << tab << x << " --plotthermoqha[=directory[,Tmin[,Tmax]]] [--keep=gpl] [--print=pdf|eps|gif|jpg|png] [--title=] [--eosmodel=] [--outfile=]" << endl; // AS202210705
3507 strstream << tab << x << " --plotgrdisp|--plotgrueneisendispersion|--plotgruneisendispersion[=directory,[Emin,[Emax]]] [--keep=gpl] [--print=pdf|eps|gif|jpg|png] [--title=] [--outfile=]" << endl; // AS20210705
3508 strstream << tab << x << " --pomass[=directory]" << endl;
3509 strstream << tab << x << " --pomass_atom[=directory]" << endl;
3510 strstream << tab << x << " --pomass_cell[=directory]" << endl;
3511 strstream << tab << x << " --pocc_input" << endl;
3512 strstream << tab << x << " --pocc_dos[=directory[,T[,DOS_Emin[,DOS_Emax[,DOSSCALE]]]]]" << endl;
3513 strstream << tab << x << " --pocc_mag[=directory[,T[,DOS_Emin[,DOS_Emax[,DOSSCALE]]]]]" << endl;
3514 strstream << tab << x << " --pocc_bandgap[=directory[,T[,DOS_Emin[,DOS_Emax[,DOSSCALE]]]]]" << endl;
3515 strstream << tab << x << " --pocc_minimum_configuration[=directory]" << endl;
3516 strstream << tab << x << " --poscar < ABCCAR | WYCCAR" << endl;
3517 strstream << tab << x << " --poscar2aflowin < POSCAR" << endl;
3518 strstream << tab << x << " --poscar2wyckoff < POSCAR" << endl;
3519 strstream << tab << x << " --poscar2gulp < POSCAR" << endl;
3520 strstream << tab << x << " [options] --prepare_chgcar_4_jmol=|--prep4jmol=CHGCAR1[,CHGACAR2,...]" << endl;
3521 strstream << tab << xspaces << " " << "options are: --usage" << endl;
3522 strstream << tab << xspaces << " " << " --outcar=OUTCAR" << endl;
3523 strstream << tab << xspaces << " " << " --zip" << endl;
3524 strstream << tab << x << " --prim < POSCAR" << endl;
3525 strstream << tab << x << " --prim2 < POSCAR" << endl;
3526 strstream << tab << x << " --primr|--fastprimitivecell|--fprim < POSCAR" << endl;
3527 strstream << tab << x << " --prototype < POSCAR" << endl;
3528 strstream << tab << x
3529 << " --pseudopotentials_check=[POTCAR|OUTCAR]["
3530 "|.bz2|.gz|.xz] | --pp_check= | --ppk="
3531 << endl;
3532 strstream << tab << x << " --python_modules[=module1,module2] | --create_python_modules=[module1,module2] [-D directory]" << endl;
3533 strstream << tab << x << " --qe < POSCAR" << endl;
3534 strstream << tab << x << " --qmvasp [--static] [-D directory]" << endl;
3535 strstream << tab << x << " --quasi_chem_approx|--qca --plattice=|--plat=fcc --elements=|--elem=Au,Pt[,Zn] [qca_options] [--directory=[DIRECTORY]]" << endl;
3536 strstream << tab << xspaces << " " << "options are:" << endl;
3537 strstream << endl;
3538 strstream << tab << xspaces << " " << "GENERAL OPTIONS:" << endl;
3539 strstream << tab << xspaces << " " << " --usage" << endl;
3540 strstream << tab << xspaces << " " << " --screen_only" << endl;
3541 strstream << tab << xspaces << " " << " --image_only|--image" << endl;
3542 strstream << tab << xspaces << " " << " --aflowlib_directory=|--aflowlib_dir=..." << endl;
3543 strstream << tab << xspaces << " " << " --print=|--p=|--output=|--o=txt" << endl;
3544 strstream << endl;
3545 strstream << tab << xspaces << " " << "BINODAL OPTIONS:" << endl;
3546 strstream << tab << xspaces << " " << " --binodal" << endl;
3547 strstream << tab << xspaces << " " << " --use_sg" << endl;
3548 strstream << tab << xspaces << " " << " --aflow_max_num_atoms=4" << endl;
3549 strstream << tab << xspaces << " " << " --max_num_atoms=|--mna=8" << endl;
3550 strstream << tab << xspaces << " " << " --cv_cutoff=|--cv_cut=0.05" << endl;
3551 strstream << tab << xspaces << " " << " --conc_curve_range=|--conc_curve=0,1,1,0" << endl;
3552 strstream << tab << xspaces << " " << " --conc_npts=20" << endl;
3553 strstream << tab << xspaces << " " << " --temp_range=|--temp=300,5000" << endl;
3554 strstream << tab << xspaces << " " << " --temp_npts=150" << endl;
3555 strstream << tab << x << " --rasmol[=n1[,n2[,n3]]] < POSCAR" << endl;
3556 strstream << tab << x << " --revsg [#] [n] [l] [m]" << endl;
3557 strstream << tab << x << " --rm_atom iatom < POSCAR" << endl;
3558 strstream << tab << x << " --rm_copies < POSCAR" << endl;
3559 strstream << tab << x << " --rdf[=rmax[,nbins[,sigma[,window_gaussian]]]] [--raw_counts] < POSCAR" << endl; // CO20220627
3560 strstream << tab << x << " --scale=s < POSCAR" << endl;
3561 strstream << tab << x << " --sd A1 A2 ... < POSCAR" << endl;
3562 strstream << tab << x << " --setcm cm1 cm2 cm3 < POSCAR" << endl;
3563 strstream << tab << x << " --setorigin r1 r2 r3 | atom# < POSCAR" << endl;
3564 strstream << tab << x << " --sewald eta < POSCAR" << endl;
3565 strstream << tab << x << " --sgdata|--space_group_data[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|json] [--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]] < POSCAR" << endl;
3566 strstream << tab << x << " --shell=ns,r1,r2,name,dens < POSCAR" << endl;
3567 strstream << tab << x << " --shift=Sx,Sy,Sz[,cCdD] < POSCAR" << endl;
3568 strstream << tab << x << " --sitepointgroup|--agroup < POSCAR" << endl;
3569 strstream << tab << x << " --slab=h,k,l[,#filled_layers[,#vacuum layers]] < POSCAR" << endl;
3570 strstream << tab << x << " --spacegroup radius < POSCAR" << endl;
3571 strstream << tab << x << " --species < POSCAR" << endl;
3572 strstream << tab << x << " --statdiel OUTCAR*" << endl;
3573 strstream << tab << x << " --std_conv|--standard_conventional|--sconv|--sc < POSCAR" << endl;
3574 strstream << tab << x << " --std_prim|--standard_primitive|--sprim|--sp < POSCAR" << endl;
3575 strstream << tab << x << " --suffix=[directory,]\"from2to\" where from/to=[n=none;r1=relax1;r2=relax2;r3=relax3;s=static;b=bands] or without abbreviations" << endl;
3576 strstream << tab << x << " --supercell=a11,a12,a13,a21,a22,a23,a31,a32,a33 < POSCAR" << endl;
3577 strstream << tab << x << " --supercell=a11,a22,a33 < POSCAR" << endl;
3578 strstream << tab << x << " --supercell=file < POSCAR" << endl;
3579 strstream << tab << x << " --supercell_strlist=a11,a12,a13,a21,a22,a23,a31,a32,a33,strlist" << endl;
3580 strstream << tab << x << " --supercell_strlist=a11,a22,a33,strlist" << endl;
3581 strstream << tab << x << " --supercell_strlist=file,strlist" << endl;
3582 strstream << tab << x << " --swap specie0 specie1 < POSCAR" << endl;
3583 strstream << tab << x << " --uffenergy|--ue < POSCAR" << endl;
3584 strstream << tab << x << " --unique_atom_decorations < POSCAR" << endl; // DX20210611
3585 strstream << tab << x << " --vasp < GEOM" << endl;
3586 strstream << tab << x << " --itc < GEOM" << endl; // CO20220613
3587 strstream << tab << x << " --volume=x|--volume*=x|--volume+=x < POSCAR" << endl;
3588 strstream << tab << x << " --wyccar [TOL] < POSCAR" << endl;
3589 strstream << tab << x << " --wyccman|--WyccarManual|--wm [TOL] [ITERATION] < POSCAR" << endl;
3590 strstream << tab << x << " --xray=lambda < POSCAR" << endl;
3591 strstream << tab << x << " --xray_peaks=lambda < POSCAR" << endl;
3592 strstream << tab << x << " --xrd_dist=h,k,l < POSCAR" << endl;
3593 strstream << tab << x << " --xyz[=n1[,n2[,n3]]] < POSCAR" << endl;
3594 strstream << tab << x << " --xyzwignerseitz [--xyzws] < POSCAR" << endl;
3595 strstream << tab << x << " --zval[=directory]" << endl;
3596 strstream << tab << x << " --zval_atom[=directory]" << endl;
3597 strstream << tab << x << " --zval_cell[=directory]" << endl;
3598 strstream << endl;
3599 strstream << tab << x << " --pointgroup|--pgroup[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|json] [--screen_only] < POSCAR" << endl;
3600 strstream << tab << x
3601 << " --pointgroup_crystal|--pgroup_crystal|--pgroup_xtal|--pgroupx|--pgroupX[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|json] [--screen_only] "
3602 "[--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]] < POSCAR"
3603 << endl;
3604 strstream << tab << x << " --pgl < POSCAR" << endl;
3605 strstream << tab << x << " --pgx < POSCAR" << endl;
3606 strstream << tab << x << " --factorgroup|--fgroup[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|=json] [--screen_only] [--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]] < POSCAR" << endl;
3607 strstream << tab << x << " --sitepointgroup|--agroup < POSCAR" << endl;
3608 strstream << tab << x << " --spacegroup|--sgroup[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|=json] [--screen_only] [--radius] [--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]] < POSCAR" << endl;
3609 strstream << tab << x << " --pointgroupklattice|--pgroupk[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|json] [--screen_only] < POSCAR" << endl;
3610 strstream << tab << x << " --pointgroupkcrystal|--pgroupk_xtal[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|json] [--screen_only] [--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]] < POSCAR" << endl;
3611 strstream << tab << x << " --pointgroupk_Patterson|--pgroupk_Patterson[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|json] [--screen_only] [--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]] < POSCAR"
3612 << endl;
3613 strstream << endl;
3614 strstream << " Prototypes HTQC" << endl;
3615 strstream << tab << x << " --prototypes|--protos" << endl;
3616 strstream << tab << x << " [options] --proto=label*[:speciesA*[:speciesB*]..[:volumeA*[:volumeB*]..|:volume]] [--params=... [--hex]]" << endl;
3617 strstream << endl;
3618 strstream << " Prototypes ICSD (from the local machine or aflowlib servers)" << endl;
3619 strstream << tab << x << " [--server=nnnnnnnnnn] --prototypes_icsd[=N]|--protos_icsd[=N]" << endl;
3620 strstream << tab << x << " [--server=nnnnnnnnnn] [--vasp|--itc|--qe|--abinit|--aims] --proto_icsd=label" << endl; // CO20220613
3621 strstream << endl;
3622 strstream << " Order Parameter [EXPERIMENTA]" << endl;
3623 strstream << tab << x << " --order_parameter [--order_parameter_sum XXX] [--Li8Mn16O32] < POSCAR [EXPERIMENTA]" << endl;
3624 strstream << endl;
3625 strstream << " Partial Occupation [EXPERIMENTA]" << endl;
3626 strstream << tab << x << " --partial_occupation|--partialoccupation|--pocc < POSCAR [EXPERIMENTA]" << endl;
3627 strstream << endl;
3628 strstream << " AFLOW Operations" << endl;
3629 strstream << tab << x << " [options] --aflow_proto=label*:speciesA*[:speciesB*][:volumeA*[:volumeB*]|:volume]" << endl;
3630 strstream << tab << x << " [options] --aflow_proto_icsd=label* potential_type (ICSD capable)" << endl;
3631 strstream << tab << xspaces << " " << "options are: --potential=pot_LDA|pot_GGA|potpaw_LDA|potpaw_GGA|potpaw_PBE|potpaw_LDA_KIN|potpaw_PBE_KIN" << endl;
3632 strstream << tab << xspaces << " " << " --potential_complete" << endl;
3633 strstream << tab << xspaces << " " << " --module=[APL|QHA|AAPL]" << endl;
3634 strstream << tab << xspaces << " " << " --apl_supercell=NxNxN" << endl;
3635 strstream << tab << xspaces << " " << " --usage" << endl;
3636 strstream << tab << xspaces << " " << " --missing" << endl;
3637 strstream << tab << xspaces << " " << " --noautopp" << endl;
3638 strstream << tab << xspaces << " " << " --bader (default: DEFAULT_VASP_FORCE_OPTION_BADER)" << endl;
3639 strstream << tab << xspaces << " " << " --spin_remove_relax_1 (default: DEFAULT_VASP_FORCE_OPTION_SPIN_REMOVE_RELAX_1)" << endl;
3640 strstream << tab << xspaces << " " << " --spin_remove_relax_2 (default: DEFAULT_VASP_FORCE_OPTION_SPIN_REMOVE_RELAX_2)" << endl;
3641 strstream << tab << xspaces << " " << " --kscheme=[M|G] (default: DEFAULT_KSCHEME in .aflow.rc) --kscheme_static=[M|G] (default: DEFAULT_KSCHEME_STATIC in .aflow.rc)" << endl;
3642 strstream << tab << xspaces << " " << " --kppra=NNNN (default: DEFAULT_KPPRA in .aflow.rc) --kppra_static=NNNN (default: DEFAULT_KPPRA_STATIC in .aflow.rc) --bands_grid=NNNN (default: DEFAULT_BANDS_GRID in .aflow.rc )"
3643 << endl;
3644 strstream << tab << xspaces << " " << " --enmax_multiply=NNNN (default: VASP_PREC_ENMAX_XXXX in .aflow.rc)" << endl;
3645 strstream << tab << xspaces << " " << " --pressure=0,1,2 (kB) (default:0.0)" << endl;
3646 strstream << tab << xspaces << " " << " --potim=XXX (default 0.05) (VASP)" << endl;
3647 strstream << tab << xspaces << " " << " --relax_type=[ALL|IONS|CELL_SHAPE|CELL_VOLUME|IONS_CELL_VOLUME|IONS_CELL_SHAPE]" << endl;
3648 strstream << tab << xspaces << " " << " --relax_mode=[ENERGY|FORCES|ENERGY_FORCES|FORCES_ENERGY] (default: DEFAULT_VASP_FORCE_OPTION_RELAX_MODE_SCHEME in .aflow.rc) (VASP)" << endl;
3649 strstream << tab << xspaces << " " << " --relax_count=XX (default: DEFAULT_VASP_FORCE_OPTION_RELAX_COUNT in .aflow.rc) (VASP)" << endl;
3650 strstream << tab << xspaces << " " << " --run_relax_static" << endl;
3651 strstream << tab << xspaces << " " << " --run_relax_static_bands" << endl;
3652 strstream << tab << xspaces << " " << " --run_static" << endl;
3653 strstream << tab << xspaces << " " << " --run_static_bands" << endl;
3654 strstream << tab << xspaces << " " << " --precision=[(LOW|MEDIUM|NORMAL|HIGH|ACCURATE), PRESERVED] (default: DEFAULT_VASP_FORCE_OPTION_PREC_SCHEME in .aflow.rc) (VASP)" << endl;
3655 strstream << tab << xspaces << " " << " --algorithm=[(NORMAL|VERYFAST|FAST|ALL|DAMPED), PRESERVED] (default: DEFAULT_VASP_FORCE_OPTION_ALGO_SCHEME in .aflow.rc) (VASP)" << endl;
3656 strstream << tab << xspaces << " " << " --metagga=[TPSS|RTPSS|M06L|MBJL|SCAN|MS0|MS1|MS2|NONE] (default: DEFAULT_VASP_FORCE_OPTION_METAGGA_SCHEME in .aflow.rc) (VASP)" << endl;
3657 strstream << tab << xspaces << " " << " --ivdw=[number_for_VASP_see_manual_for_IVDW|0] (default: DEFAULT_VASP_FORCE_OPTION_IVDW_SCHEME in .aflow.rc) (VASP)" << endl;
3658 strstream << tab << xspaces << " " << " --type=[METAL|INSULATOR|SEMICONDUCTOR|DEFAULT] (default: DEFAULT_VASP_FORCE_OPTION_TYPE_SCHEME in .aflow.rc (VASP)" << endl;
3659 strstream << tab << xspaces << " " << " --convert_unit_cell=[SPRIM, SCONV, NIGGLI, MINK, INCELL, COMPACT, WS, CART, FRAC, PRES]" << endl;
3660 strstream << tab << xspaces << " " << " --volume_plus_equal=XXX" << endl;
3661 strstream << tab << xspaces << " " << " --volume_multiply_equal=XXX" << endl;
3662 strstream << tab << xspaces << " " << " --volume_preserved" << endl;
3663 strstream << tab << xspaces << " " << " --ediffg=XXX (default: DEFAULT_VASP_PREC_EDIFFG in .aflow.rc)" << endl;
3664 strstream << tab << xspaces << " " << " --ldau2" << endl;
3665 strstream << tab << xspaces << " " << " --noldau2" << endl;
3666 strstream << tab << xspaces << " " << " --neglect_nomix" << endl;
3667 strstream << tab << xspaces << " " << " --stdout" << endl;
3668 strstream << tab << xspaces << " " << " --qe" << endl;
3669 strstream << tab << xspaces << " " << " --abinit" << endl;
3670 strstream << tab << xspaces << " " << " --aims" << endl;
3671 strstream << tab << xspaces << " " << " --params=... { check aflow --readme=anrl }" << endl;
3672 strstream << tab << xspaces << " " << " --hex { check aflow --readme=anrl }" << endl;
3673 strstream << tab << xspaces << " " << " --list" << endl;
3674 strstream << tab << x << " --extract_kpoints|--xkpoints " << _AFLOWIN_ << "" << endl;
3675 strstream << tab << x << " --extract_incar|--xincar " << _AFLOWIN_ << "" << endl;
3676 strstream << tab << x << " --extract_poscar|--xposcar " << _AFLOWIN_ << "" << endl;
3677 strstream << tab << x << " --extract_potcar|--xpotcar " << _AFLOWIN_ << "" << endl;
3678 strstream << endl;
3679 strstream << " CAGES SEARCH" << endl;
3680 strstream << tab << x << " --cages[=roughness] < POSCAR" << endl;
3681 strstream << endl;
3682 strstream << " HKL and HKL searches for surfaces" << endl;
3683 strstream << tab << x << " --miller=h,k,l[,nlayer[,elayer]] < POSCAR" << endl;
3684 strstream << tab << x << " --hkl=h,k,l[,bond] < POSCAR" << endl;
3685 strstream << tab << x << " --hkl_search[=khlmax[,bond[,step]]] < POSCAR" << endl;
3686 strstream << tab << x << " --hkl_search_simple[=cutoff[,bond[,khlmax[,step]]]] < POSCAR " << endl;
3687 strstream << tab << x << " --hkl_search_complete[=cutoff[,bond[,khlmax[,step]]]] < POSCAR" << endl;
3688 strstream << endl;
3689 strstream << tab << x << " --chgint CHGCAR" << endl;
3690 strstream << tab << x << " --clat=a,b,c,alpha,beta,gamma" << endl;
3691 strstream << tab << x << " --cmp_str POSCAR1 POSCAR2 rcut" << endl;
3692 strstream << tab << x << " --compare=a,b,c,d,e,f,g,h,k,j,i,l" << endl;
3693 strstream << tab << x << " --intpol=file1,file2,nimages,nearest_image_flag" << endl;
3694 strstream << tab << x << " --join_strlist strlist1 strlist2" << endl;
3695 strstream << tab << x << " --make_strlist OUTCAR XDATCAR" << endl;
3696 strstream << tab << x << " --pdos pdos.in PROOUT [AFLOW: NEED VERIFICATION]" << endl;
3697 strstream << tab << x << " --planedens dens2d.in CHGCAR" << endl;
3698 strstream << tab << x << " --pocc PROOUT [AFLOW: NEED VERIFICATION]" << endl;
3699 strstream << tab << x << " --raytrace rtfile" << endl;
3700 strstream << tab << x << " --rbanal nim nearest_image_flag" << endl;
3701 strstream << tab << x << " --rbdist POSCAR1 POSCAR2 n|N|e|E" << endl;
3702 strstream << tab << x << " --rdfcmp=rmax,nbins,sigma,nshmax,POSCAR1,POSCAR2" << endl;
3703 strstream << tab << x << " --spline npt < file" << endl;
3704 strstream << tab << x << " --sumpdos pdos.in PROOUT [AFLOW: NEED VERIFICATION]" << endl;
3705 strstream << endl;
3706 strstream << " ICSD MODE" << endl;
3707 strstream << tab << "ICSD input can be ternary.icsd, binary.icsd or other collections" << endl;
3708 strstream << tab << "of databases like sub-databases generated with and/or as follow." << endl;
3709 strstream << tab << x << " --icsd symbol/Z symbol/Z symbol/Z < input.icsd" << endl;
3710 strstream << tab << x << " --icsd_alllessthan symbol/Z" << endl;
3711 strstream << tab << x << " --icsd_allmorethan symbol/Z" << endl;
3712 strstream << tab << x << " --icsd_basislessthan #basis < input.icsd" << endl;
3713 strstream << tab << x << " --icsd_basismorethan #basis < input.icsd" << endl;
3714 strstream << tab << x << " --icsd_chem MgB4 < input.icsd" << endl;
3715 strstream << tab << x << " --icsd_cubic < input.icsd" << endl;
3716 strstream << tab << x << " --icsd_triclinic < input.icsd" << endl;
3717 strstream << tab << x << " --icsd_monoclinic < input.icsd" << endl;
3718 strstream << tab << x << " --icsd_orthorhombic < input.icsd" << endl;
3719 strstream << tab << x << " --icsd_tetragonal < input.icsd" << endl;
3720 strstream << tab << x << " --icsd_rhombohedral < input.icsd" << endl;
3721 strstream << tab << x << " --icsd_trigonal < input.icsd" << endl;
3722 strstream << tab << x << " --icsd_hexagonal < input.icsd" << endl;
3723 strstream << tab << x << " --icsd_cubic --icsd_orthorhombic < input.icsd" << endl;
3724 strstream << tab << x << " --icsd_tri < input.icsd" << endl;
3725 strstream << tab << x << " --icsd_mcl < input.icsd" << endl;
3726 strstream << tab << x << " --icsd_mclc < input.icsd" << endl;
3727 strstream << tab << x << " --icsd_orc < input.icsd" << endl;
3728 strstream << tab << x << " --icsd_orcc < input.icsd" << endl;
3729 strstream << tab << x << " --icsd_orcf < input.icsd" << endl;
3730 strstream << tab << x << " --icsd_orci < input.icsd" << endl;
3731 strstream << tab << x << " --icsd_tet < input.icsd" << endl;
3732 strstream << tab << x << " --icsd_bct < input.icsd" << endl;
3733 strstream << tab << x << " --icsd_rhl < input.icsd" << endl;
3734 strstream << tab << x << " --icsd_hex < input.icsd" << endl;
3735 strstream << tab << x << " --icsd_cub < input.icsd" << endl;
3736 strstream << tab << x << " --icsd_fcc < input.icsd" << endl;
3737 strstream << tab << x << " --icsd_bcc < input.icsd" << endl;
3738 strstream << tab << x << " --icsd_denslessthan X.X < input.icsd" << endl;
3739 strstream << tab << x << " --icsd_densmorethan Y.Y < input.icsd" << endl;
3740 strstream << tab << x << " --icsd_denslessthan X.X --icsd_densmorethan Y.Y < input.icsd" << endl;
3741 strstream << tab << x << " --icsd_id #ICSD_ID < input.icsd" << endl;
3742 strstream << tab << x << " --icsd_makelabel < input" << endl;
3743 strstream << tab << x << " --icsd_lessthan symbol/Z < input.icsd" << endl;
3744 strstream << tab << x << " --icsd_morethan symbol/Z < input.icsd" << endl;
3745 strstream << tab << x << " --icsd_lessthan symbol/Z --icsd_morethan symbol/Z < input.icsd" << endl;
3746 strstream << tab << x << " --icsd_listmetals" << endl;
3747 strstream << tab << x << " --icsd_nobrokenbasis < input.icsd" << endl;
3748 strstream << tab << x << " --icsd_nopartialocc < input.icsd" << endl;
3749 strstream << tab << x << " --icsd_n_ary #species < input.icsd" << endl;
3750 strstream << tab << x << " --icsd_proto #Nspecies1 #Nspecies2 #Nspecies3 ... < input.icsd" << endl;
3751 strstream << tab << x << " --icsd_remove_all symbol/Z symbol/Z" << endl;
3752 strstream << tab << x << " --icsd_remove_or symbol/Z symbol/Z" << endl;
3753 strstream << tab << x << " --icsd_removemetals" << endl;
3754 strstream << tab << x << " --icsd_sg #SG < input.icsd" << endl;
3755 strstream << tab << x << " --icsd_sglessthan #SG < input.icsd" << endl;
3756 strstream << tab << x << " --icsd_sgmorethan #SG < input.icsd" << endl;
3757 strstream << tab << x << " --icsd_sgmorethan #SG --icsd_sglessthan #SG < input.icsd" << endl;
3758 strstream << tab << x << " --icsd_unique < input.icsd" << endl;
3759 strstream << tab << x << " --icsd2aflowin < input.icsd" << endl;
3760 strstream << tab << x << " --icsd2poscar < input.icsd" << endl;
3761 strstream << tab << x << " --icsd2proto < input.icsd" << endl;
3762 strstream << tab << x << " --icsd2wyck < input.icsd" << endl;
3763 strstream << tab << x << " --icsd2wyck --sof < input.icsd" << endl;
3764 strstream << tab << x << " --icsdproto2aflowin < input.proto" << endl;
3765 strstream << endl;
3766 strstream << " FROZSL" << endl;
3767 strstream << tab << "scripting for using the FROZSL phonon framework" << endl;
3768 strstream << tab << x << " --frozsl_vaspsetup_aflow|--frozsl_vaspsetup < FROZSL.output" << endl;
3769 strstream << tab << x << " --frozsl_vaspsetup_aflow --file" << endl;
3770 strstream << tab << x << " --frozsl_vaspsetup_poscar < FROZSL.output" << endl;
3771 strstream << tab << x << " --frozsl_vaspsetup_poscar --file" << endl;
3772 strstream << tab << x << " --frozsl_analyze < aflow.frozsl.out" << endl;
3773 strstream << tab << x << " --frozsl_input" << endl;
3774 strstream << tab << x << " --frozsl_output" << endl;
3775 strstream << tab << x << " --readme=frozsl" << endl;
3776 strstream << endl;
3777 strstream << " ICSD/LIBN MODE (only for duke.edu computers)" << endl;
3778 strstream << tab << "scripting for the ICSD/LIBN libraries" << endl;
3779 strstream << tab << x << " [--force] --lib2raw=FCC/La1Se1_ICSD_27104" << endl;
3780 strstream << tab << x << " [--force] --lib2raw=AgCdZr/T0001.A2BC" << endl;
3781 strstream << tab << x << " [--force] --lib2raw=all[,directory]" << endl;
3782 strstream << tab << x << " [--force] --lib2scrub=[all,lib0,lib1,...,lib9,icsd]" << endl;
3783 strstream << endl;
3784 strstream << tab << x << " --xfixX system structure" << endl;
3785 strstream << endl;
3786 strstream << " CALCULATED DATABASE" << endl;
3787 strstream << tab << x << " --calculated" << endl;
3788 strstream << tab << x << " --calculated=icsd --random" << endl;
3789 strstream << tab << x << " --calculated[[=]all|icsd|lib1|lib2|lib3]" << endl;
3790 strstream << endl;
3791 strstream << " CLUSTER EXPANSION (very primitive, only fcc and bcc)" << endl;
3792 strstream << tab << x << " --cluster-expansion=...|--ce=structure_type,A,B,EA,EB" << endl;
3793 strstream << tab << x << " --superlattice=structure_type,n_min,n_max < POSCAR" << endl;
3794 strstream << tab << x << " --superlattice=VASP,structure_type,A,B < superlattice_name (CHECK) ???" << endl;
3795 strstream << tab << x << " --cluster=structure_type,n_min,n_max,m_min,m_max" << endl;
3796 strstream << tab << x << " --special-quasirandom-structure=..|--sqs=structure_type,atom_num,neighbor_num,sl_num_min,sl_num_max,A,B" << endl;
3797 strstream << tab << x << " --special-quasirandom-structure=..|--sqs=structure_type n1 n2 < POSCAR (CHECK)" << endl;
3798 strstream << endl;
3799 strstream << " TERNARY CONVEX HULL (only for duke.edu computers)" << endl;
3800 strstream << tab << x << " --terdata=A:B:C [--fonts=XX|--keep=eps|--print=jpg|--print=gif|--print=png]" << endl;
3801 strstream << tab << x << " --terdata_exist list" << endl;
3802 strstream << endl;
3803 strstream << "******* END POSTPROCESSING MODE ********************************************************************" << endl;
3804 strstream << endl;
3805 // strstream << "Note: all the routines, except **, are tested to conform to convasp output" << endl;
3806 return strstream.str();
3807 }
3808} // namespace pflow
3809
3810// ***************************************************************************
3811// pflow::ABCCAR
3812// ***************************************************************************
3813namespace pflow {
3814 xstructure ABCCAR(istream& input) {
3815 xstructure str(input, IOAFLOW_AUTO);
3816 str.iomode = IOVASP_ABCCAR;
3817 return str;
3818 }
3819} // namespace pflow
3820
3821// ***************************************************************************
3822// pflow::ACE
3823// ***************************************************************************
3824namespace pflow {
3825 void ACE(istream& input) {
3826 // xstructure a(input,IOAFLOW_AUTO);
3827 // pflow::PrintACE(a,cout);
3828 pflow::PrintACE(xstructure(input, IOAFLOW_AUTO), cout);
3829 }
3830} // namespace pflow
3831
3832// DX20170927 - add spin info to xstructure - START
3833// ***************************************************************************
3834// pflow::AddSpinToXstructure (collinear version)
3835// ***************************************************************************
3836namespace pflow {
3837 bool AddSpinToXstructure(xstructure& a, vector<double>& vmag) {
3838 const bool LDEBUG = (false || XHOST.DEBUG);
3839 if (vmag.size() != a.atoms.size()) {
3840 cerr << XPID << "pflow::AddSpinToXstructure (collinear): ERROR: Number of magnetic moments (" << vmag.size() << ") does not match the number of atoms (" << a.atoms.size() << ")." << endl;
3841 return false;
3842 }
3843 // Only collinear for now 20170927
3844 for (size_t i = 0; i < a.atoms.size(); i++) {
3845 a.atoms[i].spin = vmag[i];
3846 a.atoms[i].spin_is_given = true;
3847 if (LDEBUG) {
3848 cerr << XPID << "pflow::AddSpinToXstructure (collinear): atom " << i << " magnetic moment: " << a.atoms[i].spin << endl;
3849 }
3850 }
3851 return true;
3852 }
3853} // namespace pflow
3854// DX20170927 - add spin info to xstructure - START
3855
3856// DX20171205 - add spin info to xstructure - START
3857// ***************************************************************************
3858// pflow::AddSpinToXstructure (non-collinear version)
3859// ***************************************************************************
3860namespace pflow {
3861 bool AddSpinToXstructure(xstructure& a, vector<xvector<double>>& vmag_noncoll) {
3862 const bool LDEBUG = (false || XHOST.DEBUG);
3863 if (vmag_noncoll.size() != a.atoms.size()) {
3864 cerr << XPID << "pflow::AddSpinToXstructure (non-collinear): ERROR: Number of magnetic moments (" << vmag_noncoll.size() << ") does not match the number of atoms (" << a.atoms.size() << ")." << endl;
3865 return false;
3866 }
3867 // Only collinear for now 20170927
3868 for (size_t i = 0; i < a.atoms.size(); i++) {
3869 a.atoms[i].noncoll_spin = vmag_noncoll[i];
3870 a.atoms[i].noncoll_spin_is_given = true;
3871 if (LDEBUG) {
3872 cerr << XPID << "pflow::AddSpinToXstructure (non-collinear): atom " << i << " magnetic moment: " << a.atoms[i].noncoll_spin << endl;
3873 }
3874 }
3875 return true;
3876 }
3877} // namespace pflow
3878// DX20171205 - add spin info to xstructure - START
3879
3880// DX20190801 - consolidated to a function - START
3881// ***************************************************************************
3882// pflow::ProcessAndAddSpinToXstructure
3883// ***************************************************************************
3884namespace pflow {
3885 void ProcessAndAddSpinToXstructure(xstructure& a, const string& magmom_info) {
3886 const bool LDEBUG = (false || XHOST.DEBUG);
3887 stringstream message;
3888
3889 // ---------------------------------------------------------------------------
3890 // check if spin information is empty
3891 if (magmom_info.empty()) {
3892 if (LDEBUG) {
3893 cerr << __AFLOW_FUNC__ << " Spin information is empty; no spin information added to structure." << endl;
3894 }
3895 return;
3896 }
3897
3898 const uint num_atoms = a.atoms.size(); // DX20191107 - int to uint
3899 bool is_noncoll = false;
3900 vector<xvector<double>> vmag_noncoll;
3901 bool is_coll = false;
3902 vector<double> vmag;
3903
3904 // ---------------------------------------------------------------------------
3905 // check for non-collinear spin
3906 if (GetNonCollinearMagneticInfo(num_atoms, magmom_info, vmag_noncoll)) {
3907 if (LDEBUG) {
3908 cerr << __AFLOW_FUNC__ << " Non-collinear spin system detected." << endl;
3909 }
3910 is_noncoll = true;
3911 if (!AddSpinToXstructure(a, vmag_noncoll)) {
3912 message << "(non-collinear): Number of magnetic moments (" << vmag_noncoll.size() << ") does not match the number of atoms (" << a.atoms.size() << ")." << endl;
3913 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, message, _INPUT_ERROR_); // DX20171205 - added non-collinear
3914 }
3915 }
3916 // ---------------------------------------------------------------------------
3917 // check for non-collinear spin
3918 if (!is_noncoll) {
3919 if (GetCollinearMagneticInfo(num_atoms, magmom_info, vmag)) {
3920 if (LDEBUG) {
3921 cerr << __AFLOW_FUNC__ << " Collinear spin system detected." << endl;
3922 }
3923 is_coll = true;
3924 if (!AddSpinToXstructure(a, vmag)) {
3925 message << "(collinear): Number of magnetic moments (" << vmag.size() << ") does not match the number of atoms (" << a.atoms.size() << ")." << endl;
3926 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, message, _INPUT_ERROR_); // DX20171205 - added non-collinear
3927 }
3928 }
3929 }
3930 // ---------------------------------------------------------------------------
3931 // could not detect; input error
3932 if (!is_noncoll && !is_coll) {
3933 message << "Could not detect collinear or non-collinear spin(s). Check spin input.";
3934 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, message, _INPUT_ERROR_); // DX20171205 - added non-collinear
3935 }
3936 }
3937} // namespace pflow
3938
3939// ***************************************************************************
3940// pflow::AFLOWIN
3941// ***************************************************************************
3942namespace pflow {
3943 string AFLOWIN(istream& input) {
3944 stringstream oss;
3945 const xstructure str(input, IOAFLOW_AUTO);
3946 oss << AFLOWIN_SEPARATION_LINE << endl;
3947 oss << _VASP_POSCAR_MODE_EXPLICIT_START_ << endl;
3948 oss << str << "";
3949 oss << _VASP_POSCAR_MODE_EXPLICIT_STOP_ << endl;
3950 oss << AFLOWIN_SEPARATION_LINE << endl;
3951 return oss.str();
3952 }
3953} // namespace pflow
3954
3955// ***************************************************************************
3956// pflow::POSCAR2AFLOWIN
3957// ***************************************************************************
3958namespace pflow {
3959 string POSCAR2AFLOWIN(istream& input, const string& module) {
3960 const stringstream oss;
3961 xstructure str(input, IOAFLOW_AUTO);
3962 _xvasp xvasp;
3963 AVASP_DefaultValuesBinary_AFLOWIN(xvasp);
3964 xvasp.AVASP_prototype_mode = LIBRARY_MODE_PROTOTYPE;
3965 xvasp.AVASP_flag_PRECISION_scheme = "H";
3966 str.iomode = IOVASP_POSCAR; // ME20220113 - set to POSCAR or else the input format will be used
3967 xvasp.str = str;
3968 if (xvasp.str.atoms.empty()) {
3969 throw aurostd::xerror(__AFLOW_FILE__, "pflow::POSCAR2AFLOWIN():", "POSCAR has no atoms", _INPUT_ILLEGAL_);
3970 } // CO20200102
3971 if (xvasp.str.atoms[0].name_is_given == false) {
3972 throw aurostd::xerror(__AFLOW_FILE__, "pflow::POSCAR2AFLOWIN():", "POSCAR is missing species information", _INPUT_ILLEGAL_);
3973 } // CO20200102
3974 if (!module.empty()) {
3975 xvasp.aopts.push_attached("AFLOWIN_FLAG::MODULE", module); // ME20181113
3976 }
3977 KBIN::setModules(xvasp); // ME20181110
3978 stringstream aflowin;
3979 AVASP_MakeSingleAFLOWIN(xvasp, aflowin, false, -1);
3980 return oss.str();
3981 }
3982} // namespace pflow
3983
3984namespace pflow {
3985 bool SYMMETRY_GROUPS(_aflags& aflags, istream& input, aurostd::xoption& vpflow, ostream& oss) {
3986 const bool LDEBUG = (false || XHOST.DEBUG);
3987 if (LDEBUG) {
3988 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
3989 }
3990 _kflags kflags; // DX20170815 - Add in consistency checks
3991 const xstructure _a(input, IOAFLOW_AUTO);
3992 bool osswrite = true;
3993
3994 char mode = '\0';
3995 string aliases;
3996 string sym_specific_options;
3997 string options;
3998
3999 // DX20201228 - print python script
4000 if (XHOST.vflag_control.flag("PRINT_MODE::PYTHON")) {
4001 SYM::writePythonScript(oss);
4002 return true;
4003 }
4004
4005 // AGROUP
4006 if (vpflow.flag("AGROUP")) {
4007 mode = _AGROUP_;
4008 aliases = "--sitepointgroup|--agroup";
4009 sym_specific_options = "[--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]]";
4010 options = vpflow.getattachedscheme("AGROUP");
4011 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true; // DX20170815 - Add in consistency checks
4012 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = false; // DX20170815 - Add in consistency checks
4013 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = true; // DX20170815 - Add in consistency checks
4014 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = true; // DX20170815 - Add in consistency checks
4015 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = false; // DX20170815 - Add in consistency checks //DX20171205 - Added pgroupk_xtal
4016 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_PATTERSON = false; // DX20200129
4017 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = false; // DX20170815 - Add in consistency checks
4018 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = true; // DX20170815 - Add in consistency checks
4019 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = true; // DX20170815 - Add in consistency checks
4020 kflags.KBIN_SYMMETRY_PGROUP_WRITE = true;
4021 kflags.KBIN_SYMMETRY_PGROUPK_WRITE = false;
4022 kflags.KBIN_SYMMETRY_FGROUP_WRITE = true;
4023 kflags.KBIN_SYMMETRY_PGROUP_XTAL_WRITE = true;
4024 kflags.KBIN_SYMMETRY_PGROUPK_XTAL_WRITE = false;
4025 kflags.KBIN_SYMMETRY_PGROUPK_PATTERSON_WRITE = false; // DX20200129
4026 kflags.KBIN_SYMMETRY_SGROUP_WRITE = false;
4027 kflags.KBIN_SYMMETRY_IATOMS_WRITE = true;
4028 kflags.KBIN_SYMMETRY_AGROUP_WRITE = true;
4029 }
4030 // FGROUP
4031 else if (vpflow.flag("FGROUP")) {
4032 mode = _FGROUP_;
4033 aliases = "--factorgroup|--fgroup";
4034 sym_specific_options = "[--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]]";
4035 options = vpflow.getattachedscheme("FGROUP");
4036 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true; // DX20170815 - Add in consistency checks
4037 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = false; // DX20170815 - Add in consistency checks
4038 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = true; // DX20170815 - Add in consistency checks
4039 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = false; // DX20170815 - Add in consistency checks
4040 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = false; // DX20170815 - Add in consistency checks //DX20171205 - Added pgroupk_xtal
4041 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_PATTERSON = false; // DX20200129
4042 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = false; // DX20170815 - Add in consistency checks
4043 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = false; // DX20170815 - Add in consistency checks
4044 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = false; // DX20170815 - Add in consistency checks
4045 kflags.KBIN_SYMMETRY_PGROUP_WRITE = true;
4046 kflags.KBIN_SYMMETRY_PGROUPK_WRITE = false;
4047 kflags.KBIN_SYMMETRY_FGROUP_WRITE = true;
4048 kflags.KBIN_SYMMETRY_PGROUP_XTAL_WRITE = false;
4049 kflags.KBIN_SYMMETRY_PGROUPK_XTAL_WRITE = false;
4050 kflags.KBIN_SYMMETRY_PGROUPK_PATTERSON_WRITE = false; // DX20200129
4051 kflags.KBIN_SYMMETRY_SGROUP_WRITE = false;
4052 kflags.KBIN_SYMMETRY_IATOMS_WRITE = false;
4053 kflags.KBIN_SYMMETRY_AGROUP_WRITE = false;
4054 }
4055 // PGROUP
4056 else if (vpflow.flag("PGROUP")) {
4057 mode = _PGROUP_;
4058 aliases = "--pointgroup|--pgroup";
4059 options = vpflow.getattachedscheme("PGROUP");
4060 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true; // DX20170815 - Add in consistency checks
4061 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = false; // DX20170815 - Add in consistency checks
4062 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = false; // DX20170815 - Add in consistency checks
4063 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = false; // DX20170815 - Add in consistency checks
4064 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = false; // DX20170815 - Add in consistency checks //DX20171205 - Added pgroupk_xtal
4065 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_PATTERSON = false; // DX20200129
4066 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = false; // DX20170815 - Add in consistency checks
4067 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = false; // DX20170815 - Add in consistency checks
4068 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = false; // DX20170815 - Add in consistency checks
4069 kflags.KBIN_SYMMETRY_PGROUP_WRITE = true;
4070 kflags.KBIN_SYMMETRY_PGROUPK_WRITE = false;
4071 kflags.KBIN_SYMMETRY_FGROUP_WRITE = false;
4072 kflags.KBIN_SYMMETRY_PGROUP_XTAL_WRITE = false;
4073 kflags.KBIN_SYMMETRY_PGROUPK_XTAL_WRITE = false;
4074 kflags.KBIN_SYMMETRY_PGROUPK_PATTERSON_WRITE = false; // DX20200129
4075 kflags.KBIN_SYMMETRY_SGROUP_WRITE = false;
4076 kflags.KBIN_SYMMETRY_IATOMS_WRITE = false;
4077 kflags.KBIN_SYMMETRY_AGROUP_WRITE = false;
4078 }
4079 // PGROUPK
4080 else if (vpflow.flag("PGROUPK")) {
4081 mode = _PGROUPK_;
4082 aliases = "--pointgroupklattice|--pgroupk";
4083 options = vpflow.getattachedscheme("PGROUPK");
4084 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true; // DX20170815 - Add in consistency checks
4085 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = true; // DX20170815 - Add in consistency checks
4086 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = false; // DX20170815 - Add in consistency checks
4087 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = false; // DX20170815 - Add in consistency checks
4088 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = false; // DX20170815 - Add in consistency checks //DX20171205 - Added pgroupk_xtal
4089 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_PATTERSON = false; // DX20200129
4090 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = false; // DX20170815 - Add in consistency checks
4091 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = false; // DX20170815 - Add in consistency checks
4092 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = false; // DX20170815 - Add in consistency checks
4093 kflags.KBIN_SYMMETRY_PGROUP_WRITE = true;
4094 kflags.KBIN_SYMMETRY_PGROUPK_WRITE = true;
4095 kflags.KBIN_SYMMETRY_FGROUP_WRITE = false;
4096 kflags.KBIN_SYMMETRY_PGROUP_XTAL_WRITE = false;
4097 kflags.KBIN_SYMMETRY_PGROUPK_XTAL_WRITE = false;
4098 kflags.KBIN_SYMMETRY_PGROUPK_PATTERSON_WRITE = false; // DX20200129
4099 kflags.KBIN_SYMMETRY_SGROUP_WRITE = false;
4100 kflags.KBIN_SYMMETRY_IATOMS_WRITE = false;
4101 kflags.KBIN_SYMMETRY_AGROUP_WRITE = false;
4102 }
4103 // PGROUPX
4104 else if (vpflow.flag("PGROUPX")) {
4105 mode = _PGROUP_XTAL_;
4106 aliases = "--pointgroup_crystal|--pgroup_crystal|--pgroup_xtal|--pgroupx|--pgroupX";
4107 sym_specific_options = "[--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]]";
4108 options = vpflow.getattachedscheme("PGROUPX");
4109 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true; // DX20170815 - Add in consistency checks
4110 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = false; // DX20170815 - Add in consistency checks
4111 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = true; // DX20170815 - Add in consistency checks
4112 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = true; // DX20170815 - Add in consistency checks
4113 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = false; // DX20170815 - Add in consistency checks //DX20171205 - Added pgroupk_xtal
4114 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_PATTERSON = false; // DX20200129
4115 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = false; // DX20170815 - Add in consistency checks
4116 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = false; // DX20170815 - Add in consistency checks
4117 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = false; // DX20170815 - Add in consistency checks
4118 kflags.KBIN_SYMMETRY_PGROUP_WRITE = true;
4119 kflags.KBIN_SYMMETRY_PGROUPK_WRITE = false;
4120 kflags.KBIN_SYMMETRY_FGROUP_WRITE = true;
4121 kflags.KBIN_SYMMETRY_PGROUP_XTAL_WRITE = true;
4122 kflags.KBIN_SYMMETRY_PGROUPK_XTAL_WRITE = false;
4123 kflags.KBIN_SYMMETRY_PGROUPK_PATTERSON_WRITE = false; // DX20200129
4124 kflags.KBIN_SYMMETRY_SGROUP_WRITE = false;
4125 kflags.KBIN_SYMMETRY_IATOMS_WRITE = false;
4126 kflags.KBIN_SYMMETRY_AGROUP_WRITE = false;
4127 }
4128 // PGROUPK_XTAL
4129 else if (vpflow.flag("PGROUPK_XTAL")) {
4130 mode = _PGROUPK_XTAL_;
4131 aliases = "--pointgroupkcrystal|--pgroupk_xtal";
4132 sym_specific_options = "[--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]]";
4133 options = vpflow.getattachedscheme("PGROUPK_XTAL");
4134 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true; // DX20170815 - Add in consistency checks
4135 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = false; // DX20170815 - Add in consistency checks
4136 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = true; // DX20170815 - Add in consistency checks
4137 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = true; // DX20170815 - Add in consistency checks
4138 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = true; // DX20170815 - Add in consistency checks //DX20171205 - Added pgroupk_xtal
4139 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_PATTERSON = false; // DX20200129
4140 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = false; // DX20170815 - Add in consistency checks
4141 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = false; // DX20170815 - Add in consistency checks
4142 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = false; // DX20170815 - Add in consistency checks
4143 kflags.KBIN_SYMMETRY_PGROUP_WRITE = true;
4144 kflags.KBIN_SYMMETRY_PGROUPK_WRITE = false;
4145 kflags.KBIN_SYMMETRY_FGROUP_WRITE = true;
4146 kflags.KBIN_SYMMETRY_PGROUP_XTAL_WRITE = true;
4147 kflags.KBIN_SYMMETRY_PGROUPK_XTAL_WRITE = true;
4148 kflags.KBIN_SYMMETRY_PGROUPK_PATTERSON_WRITE = false; // DX20200129
4149 kflags.KBIN_SYMMETRY_SGROUP_WRITE = false;
4150 kflags.KBIN_SYMMETRY_IATOMS_WRITE = false;
4151 kflags.KBIN_SYMMETRY_AGROUP_WRITE = false;
4152 }
4153 // DX20200206 - add Patterson symmetry - START
4154 // PGROUPK_PATTERSON
4155 else if (vpflow.flag("PGROUPK_PATTERSON")) {
4156 mode = _PGROUPK_PATTERSON_;
4157 aliases = "--pointgroupk_Patterson|--pgroupk_Patterson";
4158 sym_specific_options = "[--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]]";
4159 options = vpflow.getattachedscheme("PGROUPK_PATTERSON");
4160 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true;
4161 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = false;
4162 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = true;
4163 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = true;
4164 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = true;
4165 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_PATTERSON = true;
4166 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = false;
4167 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = false;
4168 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = false;
4169 kflags.KBIN_SYMMETRY_PGROUP_WRITE = true;
4170 kflags.KBIN_SYMMETRY_PGROUPK_WRITE = false;
4171 kflags.KBIN_SYMMETRY_FGROUP_WRITE = true;
4172 kflags.KBIN_SYMMETRY_PGROUP_XTAL_WRITE = true;
4173 kflags.KBIN_SYMMETRY_PGROUPK_XTAL_WRITE = true;
4174 kflags.KBIN_SYMMETRY_PGROUPK_PATTERSON_WRITE = true;
4175 kflags.KBIN_SYMMETRY_SGROUP_WRITE = false;
4176 kflags.KBIN_SYMMETRY_IATOMS_WRITE = false;
4177 kflags.KBIN_SYMMETRY_AGROUP_WRITE = false;
4178 }
4179 // DX20200206 - add Patterson symmetry - END
4180 // SGROUP
4181 else if (vpflow.flag("SGROUP")) {
4182 mode = _SGROUP_;
4183 aliases = "--spacegroup|--sgroup";
4184 sym_specific_options = "[--radius] [--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]]";
4185 options = vpflow.getattachedscheme("SGROUP");
4186 kflags.KBIN_SYMMETRY_SGROUP_RADIUS = KBIN_SYMMETRY_SGROUP_RADIUS_DEFAULT;
4187 if (vpflow.flag("SYMMETRY::SGROUP_RADIUS")) {
4188 kflags.KBIN_SYMMETRY_SGROUP_RADIUS = aurostd::string2utype<double>(vpflow.getattachedscheme("SYMMETRY::SGROUP_RADIUS"));
4189 }
4190 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true; // DX20170815 - Add in consistency checks
4191 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = false; // DX20170815 - Add in consistency checks
4192 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = true; // DX20170815 - Add in consistency checks
4193 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = false; // DX20170815 - Add in consistency checks
4194 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = false; // DX20170815 - Add in consistency checks //DX20171205 - Added pgroupk_xtal
4195 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_PATTERSON = false; // DX20200129
4196 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = true; // DX20170815 - Add in consistency checks
4197 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = false; // DX20170815 - Add in consistency checks
4198 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = false; // DX20170815 - Add in consistency checks
4199 kflags.KBIN_SYMMETRY_PGROUP_WRITE = true;
4200 kflags.KBIN_SYMMETRY_PGROUPK_WRITE = false;
4201 kflags.KBIN_SYMMETRY_FGROUP_WRITE = true;
4202 kflags.KBIN_SYMMETRY_PGROUP_XTAL_WRITE = false;
4203 kflags.KBIN_SYMMETRY_PGROUPK_XTAL_WRITE = false;
4204 kflags.KBIN_SYMMETRY_PGROUPK_PATTERSON_WRITE = false; // DX20200129
4205 kflags.KBIN_SYMMETRY_SGROUP_WRITE = true;
4206 kflags.KBIN_SYMMETRY_IATOMS_WRITE = false;
4207 kflags.KBIN_SYMMETRY_AGROUP_WRITE = false;
4208 }
4209 // EQUIVALENT / IATOMS (performed in "EQUIVALENT" function)
4210
4211 vector<string> tokens;
4212 aurostd::string2tokens(options, tokens, ",");
4213 if (tokens.size() == 1) {
4214 if (tokens[0] == "usage" || tokens[0] == "USAGE") {
4216 aurostd::liststring2string("aflow " + aliases + "[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|json] [--screen_only] " + sym_specific_options +
4217 " < POSCAR default: tolerance=(minimum_interatomic_distance)/100.0, print=txt")); // DX20200724 - removed return
4218 }
4219 }
4220 // DX20170804 - need to rescale, so we make a fast copy and calculate
4221 xstructure a(_a);
4222 a.ReScale(1.0);
4223 string directory = aurostd::getPWD();
4224 if (XHOST.vflag_control.flag("DIRECTORY")) {
4225 directory = XHOST.vflag_control.getattachedscheme("DIRECTORY");
4226 }
4227 aflags.Directory = directory;
4228 const string print_directory = " [dir=" + a.directory + "]";
4229 if (!aurostd::FileExist(directory)) {
4230 oss << "ERROR: Unable to locate " << directory << "." << endl;
4231 oss << "Exiting." << endl;
4232 oss << endl;
4233 // return oss.str();
4234 return false;
4235 }
4236
4237 // DX20170921 - MAGNETIC SYMMETRY - START
4238 if (vpflow.flag("SYMMETRY::MAGNETIC") && (mode == _AGROUP_ || mode == _FGROUP_ || mode == _PGROUP_XTAL_ || mode == _PGROUPK_XTAL_ || mode == _SGROUP_)) {
4239 const string magmom_info = vpflow.getattachedscheme("SYMMETRY::MAGNETIC");
4240 ProcessAndAddSpinToXstructure(a, magmom_info); // DX20191108 - condensed into a single function
4241 }
4242 // DX20170921 - MAGNETIC SYMMETRY - END
4243
4244 // Set tolerance
4245 double tolerance = pflow::getSymmetryTolerance(a, vpflow.getattachedscheme("SYMMETRY::TOLERANCE")); // DX20200820 - consolidated setting tolerance into a function
4246 // DX20170803 - Add format flag - START
4247 string format = "txt";
4248 if (XHOST.vflag_control.flag("PRINT_MODE::TXT")) {
4249 format = "txt";
4250 } else if (XHOST.vflag_control.flag("PRINT_MODE::JSON")) {
4251 format = "json";
4252 } else { // default is txt
4253 format = "txt";
4254 }
4255 bool print = false;
4256 if (vpflow.flag("SYMMETRY::SCREEN_ONLY")) {
4257 print = true;
4258 kflags.KBIN_SYMMETRY_PGROUP_WRITE = false;
4259 kflags.KBIN_SYMMETRY_PGROUPK_WRITE = false;
4260 kflags.KBIN_SYMMETRY_FGROUP_WRITE = false;
4261 kflags.KBIN_SYMMETRY_PGROUP_XTAL_WRITE = false;
4262 kflags.KBIN_SYMMETRY_PGROUPK_XTAL_WRITE = false;
4263 kflags.KBIN_SYMMETRY_SGROUP_WRITE = false;
4264 kflags.KBIN_SYMMETRY_IATOMS_WRITE = false;
4265 kflags.KBIN_SYMMETRY_AGROUP_WRITE = false;
4266 osswrite = false;
4267 }
4268 // Perform full scan
4269 const bool force_perform = true; // if no_scan fails, still return true at default tolerance (even though it cannot be validated)
4270 if (vpflow.flag("SYMMETRY::NO_SCAN")) {
4271 a.sym_eps_no_scan = true; // DX20210406
4272 }
4273
4274 bool tocompress = true;
4275 ofstream FileMESSAGE("/dev/null");
4276
4277 // while(symmetry_commensurate==false)
4278 if (print == false) // DX20170803 - PRINT
4279 { // CO20200106 - patching for auto-indenting
4280 for (size_t iext = 1; iext < XHOST.vext.size(); iext++) { // SKIP uncompressed
4281 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_OUT + XHOST.vext[iext]) ||
4282 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_PATTERSON_OUT + XHOST.vext[iext]) || // DX20200129
4283 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT + XHOST.vext[iext]) || // DX20180118 - added pgroupk_xtal
4284 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_OUT + XHOST.vext[iext]) ||
4285 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_OUT + XHOST.vext[iext])) {
4286 tocompress = true;
4287 }
4288 }
4289 for (size_t iext = 1; iext < XHOST.vext.size(); iext++) { // SKIP uncompressed
4290 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_OUT)) {
4291 aurostd::RemoveFile(directory, std::regex("/" + DEFAULT_AFLOW_PGROUP_OUT + ".*"));
4292 }
4293 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_OUT)) {
4294 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUP_XTAL_OUT + ".*"));
4295 }
4297 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_PATTERSON_OUT + ".*"));
4298 } // DX20200129
4299 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_OUT)) {
4300 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_OUT + ".*"));
4301 }
4302 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT)) {
4303 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_XTAL_OUT + ".*"));
4304 } // DX20180118 - added pgroupk_xtal
4305 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_OUT)) {
4306 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_FGROUP_OUT + ".*"));
4307 }
4308 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_OUT)) {
4309 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_AGROUP_OUT + ".*"));
4310 }
4311 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_OUT)) {
4312 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_SGROUP_OUT + ".*"));
4313 }
4314 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_OUT)) {
4315 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_IATOMS_OUT + ".*"));
4316 }
4317 }
4318 for (size_t iext = 1; iext < XHOST.vext.size(); iext++) { // SKIP uncompressed
4319 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_JSON + XHOST.vext[iext]) ||
4320 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_PATTERSON_JSON + XHOST.vext[iext]) || // DX20200129
4321 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_JSON + XHOST.vext[iext]) || // DX20180118 - added pgroupk_xtal
4322 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_JSON + XHOST.vext[iext]) ||
4323 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_JSON + XHOST.vext[iext])) {
4324 tocompress = true;
4325 }
4326 }
4327 for (size_t iext = 1; iext < XHOST.vext.size(); iext++) { // SKIP uncompressed
4328 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_JSON)) {
4329 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUP_JSON + ".*"));
4330 }
4331 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_JSON)) {
4332 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUP_XTAL_JSON + ".*"));
4333 }
4335 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_PATTERSON_JSON + ".*"));
4336 } // DX20200129
4337 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_JSON)) {
4338 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_JSON + ".*"));
4339 }
4340 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_JSON)) {
4341 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_XTAL_JSON + ".*"));
4342 } // DX20180118 - added pgroupk_xtal
4343 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_JSON)) {
4344 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_FGROUP_JSON + ".*"));
4345 }
4346 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_JSON)) {
4347 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_AGROUP_JSON + ".*"));
4348 }
4349 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_JSON)) {
4350 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_SGROUP_JSON + ".*"));
4351 }
4352 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_JSON)) {
4353 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_IATOMS_JSON + ".*"));
4354 }
4355 }
4356 }
4357 if (!pflow::PerformFullSymmetry(a, tolerance, a.sym_eps_no_scan, force_perform, FileMESSAGE, aflags, kflags, osswrite, oss, format)) {
4358 return false;
4359 }
4360 // DX20170803 - Print to symmetry operators to screen - START
4361 if (print == true) {
4362 if (XHOST.vflag_control.flag("WWW")) {
4363 KBIN_SymmetryToScreenWeb(a, oss, mode);
4364 } else {
4365 KBIN_SymmetryToScreen(a, format, oss, mode);
4366 }
4367 }
4368 // DX20170803 - Print to symmetry operators to screen - END
4369 // BZIP if necessary
4370 if (tocompress) {
4371 if (format == "txt") { // DX20170803 - FORMAT
4372 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_OUT)) {
4374 }
4375 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_OUT)) {
4377 }
4379 aurostd::CompressFile(directory + "/" + DEFAULT_AFLOW_PGROUPK_PATTERSON_OUT); // DX20200129
4380 }
4381 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_OUT)) {
4383 }
4384 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT)) {
4385 aurostd::CompressFile(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT); // DX20180118 - added pgroupk_xtal
4386 }
4387 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_OUT)) {
4389 }
4390 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_OUT)) {
4392 }
4393 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_OUT)) {
4395 }
4396 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_OUT)) {
4398 }
4399 } else if (format == "json") { // DX20170803 - FORMAT
4400 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_JSON)) {
4402 }
4403 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_JSON)) {
4405 }
4407 aurostd::CompressFile(directory + "/" + DEFAULT_AFLOW_PGROUPK_PATTERSON_JSON); // DX20200129
4408 }
4409 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_JSON)) {
4411 }
4412 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_JSON)) {
4413 aurostd::CompressFile(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_JSON); // DX20180118 - added pgroupk_xtal
4414 }
4415 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_JSON)) {
4417 }
4418 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_JSON)) {
4420 }
4421 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_JSON)) {
4423 }
4424 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_JSON)) {
4426 }
4427 }
4428 }
4429 // return oss.str(); //string("AFLOW "+string(AFLOW_VERSION)+" Symmetry Fixed in "+directory+" (need aflow>=2948)\n");
4430 return true; // string("AFLOW "+string(AFLOW_VERSION)+" Symmetry Fixed in "+directory+" (need aflow>=2948)\n");
4431 }
4432} // namespace pflow
4433
4434// ***************************************************************************
4435// pflow::AGROUP
4436// ***************************************************************************
4437namespace pflow {
4438 void AGROUP(_aflags& aflags, istream& input) {
4439 // cout << aflow::Banner("BANNER_TINY") << endl;
4440 aflags.QUIET = true;
4441 xstructure a(input, IOAFLOW_AUTO);
4442 const bool WRITE = true;
4443 ofstream File("/dev/null");
4444 // DX20170815 - Add in consistency checks bool verbose=true;
4445 // DX20170815 - Add in consistency checks SYM::CalculatePointGroup(File,a,aflags,WRITE,verbose,cout);
4446 // DX20170815 - Add in consistency checks SYM::CalculateFactorGroup(File,a,aflags,WRITE,verbose,cout);
4447 // DX20170815 - Add in consistency checks SYM::CalculateSpaceGroup(File,a,aflags,false,verbose,cout);
4448 // DX20170815 - Add in consistency checks SYM::CalculateInequivalentAtoms(File,a,aflags,WRITE,verbose,cout);
4449 // DX20170815 - Add in consistency checks SYM::CalculateSitePointGroup(File,a,aflags,WRITE,true,cout);
4450 _kflags kflags; // DX20170815 - Add in consistency checks
4451 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true; // DX20170815 - Add in consistency checks
4452 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = false; // DX20170815 - Add in consistency checks
4453 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = true; // DX20170815 - Add in consistency checks
4454 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = true; // DX20170815 - Add in consistency checks
4455 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = false; // DX20170815 - Add in consistency checks //DX20171205 - Added pgroupk_xtal
4456 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_PATTERSON = false; // DX20200129
4457 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = false; // DX20170815 - Add in consistency checks
4458 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = true; // DX20170815 - Add in consistency checks
4459 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = true; // DX20170815 - Add in consistency checks
4460 pflow::PerformFullSymmetry(a, File, aflags, kflags, WRITE, cout); // DX20170815 - Add in consistency checks
4461 }
4462} // namespace pflow
4463
4464// ***************************************************************************
4465// pflow::AGROUP2
4466// ***************************************************************************
4467namespace pflow {
4468 void AGROUP2(istream& input) {
4469 xstructure a(input, IOAFLOW_AUTO);
4470 const int Nbasis = a.atoms.size();
4471 const vector<vector<uint>> Bsitesym(Nbasis);
4472 const bool ComMidss = false; // calculate common site symmetry of A,B,and middle_AB?
4473 SYM::CalculateSitePointGroup2(a, ComMidss);
4474 }
4475} // namespace pflow
4476
4477// ***************************************************************************
4478// pflow::AGROUP2m
4479// ***************************************************************************
4480namespace pflow {
4481 void AGROUP2m(istream& input) {
4482 xstructure a(input, IOAFLOW_AUTO);
4483 const int Nbasis = a.atoms.size();
4484 const vector<vector<uint>> Bsitesym(Nbasis);
4485 const bool ComMidss = true; // calculate common site symmetry of A,B,and middle_AB?
4486 SYM::CalculateSitePointGroup2(a, ComMidss);
4487 }
4488} // namespace pflow
4489
4490// ***************************************************************************
4491// pflow::ALPHABETIC
4492// ***************************************************************************
4493namespace pflow {
4494 xstructure ALPHABETIC(istream& input) {
4495 xstructure a(input, IOAFLOW_AUTO);
4496 // cerr << "ALPHA=" << a.SpeciesGetAlphabetic() << endl;
4497 a.SpeciesPutAlphabetic();
4498 return a;
4499 }
4500} // namespace pflow
4501
4502// ***************************************************************************
4503// pflow::ALPHACompound
4504// ***************************************************************************
4505namespace pflow {
4506 string ALPHACompound(const string& options) {
4507 const bool LDEBUG = (false || XHOST.DEBUG);
4508 if (LDEBUG) {
4509 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
4510 }
4511 vector<string> tokens;
4512 aurostd::string2tokens(options, tokens, ",");
4513 if (tokens.empty()) {
4514 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --alpha_compound=string1,string2,....");
4515 }
4516 // move on
4517 stringstream output;
4518 for (size_t i = 0; i < tokens.size(); i++) {
4519 string system = string(tokens[i]);
4520 vector<string> vsystem;
4521 vector<double> vnumber;
4522 XATOM_AlphabetizationCompound(system, vsystem, vnumber);
4523 output << system << endl;
4524 }
4525 if (LDEBUG) {
4526 cerr << __AFLOW_FUNC__ << " END" << endl;
4527 }
4528 return output.str();
4529 }
4530} // namespace pflow
4531
4532// ***************************************************************************
4533// pflow::ALPHASpecies
4534// ***************************************************************************
4535namespace pflow {
4536 string ALPHASpecies(const string& options) {
4537 const bool LDEBUG = (false || XHOST.DEBUG);
4538 if (LDEBUG) {
4539 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
4540 }
4541 vector<string> tokens;
4542 aurostd::string2tokens(options, tokens, ",");
4543 if (tokens.empty()) {
4544 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --alpha_species=string1,string2,....");
4545 }
4546 // move on
4547 stringstream output;
4548 for (size_t i = 0; i < tokens.size(); i++) {
4549 string system = string(tokens[i]);
4550 vector<string> vsystem;
4551 vector<double> vnumber;
4552 XATOM_AlphabetizationSpecies(system, vsystem, vnumber);
4553 output << system << endl;
4554 }
4555 if (LDEBUG) {
4556 cerr << __AFLOW_FUNC__ << " END" << endl;
4557 }
4558 return output.str();
4559 }
4560} // namespace pflow
4561
4562// ***************************************************************************
4563// pflow::ANGLES
4564// ***************************************************************************
4565namespace pflow {
4566 void ANGLES(const string& options, istream& input) {
4567 const bool LDEBUG = (false || XHOST.DEBUG);
4568 if (LDEBUG) {
4569 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
4570 }
4571 vector<string> tokens;
4572 aurostd::string2tokens(options, tokens, ",");
4573 if (tokens.size() != 1) {
4574 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --angle=cutoff < POSCAR");
4575 }
4576 // move on
4577 double cutoff = 0.0; // some defaults
4578 if (!tokens.empty()) {
4579 cutoff = aurostd::string2utype<double>(tokens[0]);
4580 }
4581
4582 const xstructure a(input, IOAFLOW_AUTO);
4583 cout << aflow::Banner("BANNER_TINY") << endl;
4584 pflow::PrintAngles(a, cutoff, cout);
4585 if (LDEBUG) {
4586 cerr << __AFLOW_FUNC__ << " END" << endl;
4587 }
4588 }
4589} // namespace pflow
4590
4591// ***************************************************************************
4592// pflow::ATOMSMAX
4593// ***************************************************************************
4594namespace pflow {
4595 string ATOMSMAX(const string& options, istream& input) {
4596 const bool LDEBUG = (false || XHOST.DEBUG);
4597 if (LDEBUG) {
4598 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
4599 }
4600 vector<string> tokens;
4601 aurostd::string2tokens(options, tokens, ",");
4602 if (tokens.size() != 1) {
4603 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --maxatoms=N | --max_atoms=N | --atoms_max=N | --atomsmax=N < POSCAR");
4604 }
4605 // move on
4606 uint N = 0; // some defaults
4607 if (!tokens.empty()) {
4608 N = aurostd::string2utype<uint>(tokens[0]);
4609 }
4610
4611 const xstructure a(input, IOAFLOW_AUTO);
4612 stringstream oss;
4613 if (a.atoms.size() > N) {
4614 oss << "MAX ATOMS SIZE = " << N << endl;
4615 oss << "your structure has " << a.atoms.size() << " atoms" << endl;
4616 } else {
4617 oss << a;
4618 }
4619 if (LDEBUG) {
4620 cerr << __AFLOW_FUNC__ << " END" << endl;
4621 }
4622 return oss.str();
4623 }
4624} // namespace pflow
4625
4626// ***************************************************************************
4627// pflow::BANDS
4628// ***************************************************************************
4629namespace pflow {
4630 void BANDS(const string& options, istream& input) {
4631 const bool LDEBUG = (false || XHOST.DEBUG);
4632 if (LDEBUG) {
4633 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
4634 }
4635 vector<string> tokens;
4636 aurostd::string2tokens(options, tokens, ",");
4637 if (tokens.size() != 1) {
4638 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --bands=PROOUT < POSCAR");
4639 }
4640 // move on
4641 string filename; // some defaults
4642 if (!tokens.empty()) {
4643 filename = (tokens[0]);
4644 }
4645
4646 // cout << aflow::Banner("BANNER_TINY") << endl;
4647 const xstructure str(input, IOAFLOW_AUTO);
4648 pflow::projdata prd;
4649 prd.PROOUTinfile = filename;
4650 pflow::ReadInProj(prd);
4651 prd.lat = pflow::GetScaledLat(str);
4652 pflow::PrintBands(prd);
4653 if (LDEBUG) {
4654 cerr << __AFLOW_FUNC__ << " END" << endl;
4655 }
4656 }
4657} // namespace pflow
4658
4659// ***************************************************************************
4660// pflow::BANDGAP // CAMILO
4661// ***************************************************************************
4662namespace pflow {
4663 void BANDGAP(aurostd::xoption& vpflow, ostream& oss) {
4664 const bool LDEBUG = (false || XHOST.DEBUG);
4665 if (LDEBUG) {
4666 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
4667 }
4668 const string input = aurostd::RemoveWhiteSpaces(vpflow.getattachedscheme("BANDGAP"));
4669 if (input.empty()) {
4671 }
4672 vector<string> dirs;
4673 aurostd::string2tokens(input, dirs, ",");
4674 for (size_t i = 0; i < dirs.size(); i++) {
4675 if (!PrintBandGap(dirs[i], oss)) {
4676 oss << __AFLOW_FUNC__ << " " + dirs[i] + " failed" << endl;
4677 }
4678 }
4679 if (LDEBUG) {
4680 cerr << __AFLOW_FUNC__ << " END" << endl;
4681 }
4682 }
4683 void BANDGAP_DOS(aurostd::xoption& vpflow, ostream& oss) { // CO20191004
4684 const bool LDEBUG = (false || XHOST.DEBUG);
4685 const string input = aurostd::RemoveWhiteSpaces(vpflow.getattachedscheme("BANDGAPDOS"));
4686 if (input.empty()) {
4688 }
4689 vector<string> dirs;
4690 aurostd::string2tokens(input, dirs, ",");
4691 for (size_t i = 0; i < dirs.size(); i++) {
4692 if (!PrintBandGap_DOS(dirs[i], oss)) {
4693 oss << __AFLOW_FUNC__ << " " + dirs[i] + " failed" << endl;
4694 }
4695 }
4696 if (LDEBUG) {
4697 cerr << __AFLOW_FUNC__ << " END" << endl;
4698 }
4699 }
4700} // namespace pflow
4701
4702// ***************************************************************************
4703// pflow::BANDSTRUCTURE
4704// ***************************************************************************
4705namespace pflow {
4706 void BANDSTRUCTURE(_aflags& aflags) {
4707 // cout << aflow::Banner("BANNER_TINY") << endl;
4708 aflags.QUIET = true;
4709 string directory_LIB;
4710 string directory_RAW;
4711 directory_LIB = aflags.Directory;
4712 directory_RAW = directory_LIB + "./BANDS";
4713 aurostd::RemoveDirectory(directory_RAW);
4714 aurostd::DirectoryMake(directory_RAW);
4715 vector<string> vspecies;
4716 vector<string> vfiles;
4717 aflowlib::_aflowlib_entry data;
4718 aflowlib::GetSpeciesDirectory(directory_LIB, vspecies);
4719 for (size_t i = 0; i < vspecies.size(); i++) {
4720 data.species += vspecies[i];
4721 if (i < vspecies.size() - 1) {
4722 data.species += ",";
4723 }
4724 }
4725 aflowlib::LIB2RAW_Loop_Bands(directory_LIB, directory_RAW, vfiles, data, "pflow::BANDSTRUCTURE");
4726 }
4727} // namespace pflow
4728
4729// ***************************************************************************
4730// pflow::BZDirectionsLATTICE
4731// ***************************************************************************
4732namespace pflow {
4733 string BZDirectionsLATTICE(const string& options) {
4734 const bool LDEBUG = (false || XHOST.DEBUG);
4735 if (LDEBUG) {
4736 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
4737 }
4738 vector<string> tokens;
4739 aurostd::string2tokens(options, tokens, ",");
4740 if (tokens.size() != 1) {
4741 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --bzdirections= | --bzd=LATTICE");
4742 } else { // move on
4743 if (tokens.at(0) != "TRI1a" && tokens.at(0) != "TRI1b" && tokens.at(0) != "TRI2a" && tokens.at(0) != "TRI2b" && tokens.at(0) != "MCL" && tokens.at(0) != "MCLC1" && tokens.at(0) != "MCLC2" &&
4744 tokens.at(0) != "MCLC3" && tokens.at(0) != "MCLC4" && tokens.at(0) != "MCLC5" && tokens.at(0) != "ORC" && tokens.at(0) != "ORCC" && tokens.at(0) != "ORCF1" && tokens.at(0) != "ORCF2" &&
4745 tokens.at(0) != "ORCF3" && tokens.at(0) != "ORCI" && tokens.at(0) != "TET" && tokens.at(0) != "BCT1" && tokens.at(0) != "BCT2" && tokens.at(0) != "RHL1" && tokens.at(0) != "RHL2" &&
4746 tokens.at(0) != "HEX" && tokens.at(0) != "CUB" && tokens.at(0) != "FCC" && tokens.at(0) != "BCC") {
4747 cout << "LATTICES = (the ones with \"\") " << endl;
4748 cout << "1. TRI order: kalpha,kbeta,kgamma > 90 (kgamma<kalpha, kgamma<kbeta) " << endl;
4749 cout << " or kalpha,kbeta,kgamma < 90 (kgamma>kalpha, kgamma>kbeta) " << endl;
4750 cout << " special case when kgamma=90 " << endl;
4751 cout << " \"TRI1a\" kalpha>90 kbeta>90 kgamma>90 " << endl;
4752 cout << " \"TRI1b\" kalpha<90 kbeta<90 kgamma<90 " << endl;
4753 cout << " \"TRI2a\" kalpha>90 kbeta>90 kgamma=90 " << endl;
4754 cout << " \"TRI2b\" kalpha<90 kbeta<90 kgamma=90 " << endl;
4755 cout << "2. \"MCL\" unique (order b<=c) " << endl;
4756 cout << "3. MCLC (order alpha<90) " << endl;
4757 cout << " \"MCLC1\" kgamma>90 " << endl;
4758 cout << " \"MCLC2\" kgamma=90 " << endl;
4759 cout << " \"MCLC3\" kgamma<90, b*cos(alpha)/c + (b*sin(alpha)/a)^2 < 1 " << endl;
4760 cout << " \"MCLC4\" kgamma<90, b*cos(alpha)/c + (b*sin(alpha)/a)^2 = 1 " << endl;
4761 cout << " \"MCLC5\" kgamma<90, b*cos(alpha)/c + (b*sin(alpha)/a)^2 > 1 " << endl;
4762 cout << "4. \"ORC\" unique (order a<b<c) " << endl;
4763 cout << "5. \"ORCC\" unique (order a<b) " << endl;
4764 cout << "6. ORCF (order a<b<c) " << endl;
4765 cout << R"( "ORCF1" "ORCF_invb2+invc2<inva2" for 1/a^2 > 1/b^2 + 1/c^2 )" << endl;
4766 cout << R"( "ORCF2" "ORCF_inva2<invb2+invc2" for 1/a^2 < 1/b^2 + 1/c^2 )" << endl;
4767 cout << " \"ORCF3\" for 1/a^2 = 1/b^2 + 1/c^2 " << endl;
4768 cout << "7. \"ORCI\" unique (order a<b<c) " << endl;
4769 cout << "8. \"TET\" unique (order a a c) " << endl;
4770 cout << "9. BCT (order a a c) " << endl;
4771 cout << R"( "BCT1" "BCT_c<a" for c<a )" << endl;
4772 cout << R"( "BCT2" "BCT_c>a" for c>a )" << endl;
4773 cout << "10. \"RHL1\" alpha<90 " << endl;
4774 cout << " \"RHL2\" alpha>90 " << endl;
4775 cout << "11. \"HEX\" unique (order 60 90 90) " << endl;
4776 cout << "12. \"CUB\" unique " << endl;
4777 cout << "13. \"FCC\" unique (order 60 60 60) " << endl;
4778 cout << "14. \"BCC\" unique " << endl;
4779 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --bzdirections= | --bzd=LATTICE");
4780 }
4781 }
4782
4783 const double grid = 20.0;
4784 const xmatrix<double> rlattice(3, 3);
4785 bool foundBZ;
4786 rlattice[1][1] = 1.0;
4787 rlattice[2][2] = 1.0;
4788 rlattice[3][3] = 1.0;
4789 if (LDEBUG) {
4790 cerr << __AFLOW_FUNC__ << " END" << endl;
4791 }
4792 return LATTICE::KPOINTS_Directions(tokens.at(0), rlattice, grid, IOVASP_AUTO, foundBZ);
4793 }
4794} // namespace pflow
4795
4796// ***************************************************************************
4797// pflow::BZDirectionsSTRUCTURE
4798// ***************************************************************************
4799namespace pflow {
4800 string BZDirectionsSTRUCTURE(istream& input, aurostd::xoption& vpflow) {
4801 xstructure a(input, IOAFLOW_AUTO);
4802 bool foundBZ;
4803 const double grid = 20.0;
4804 xstructure str_sp;
4805 xstructure str_sc; // DX20181213 - need primitive lattice information for kpoint directions
4806 a.GetLatticeType(str_sp, str_sc); // DX20181213 - need primitive lattice information for kpoint directions
4807
4808 // if not transforming kpoints, set transformation matrix to identity
4809 if (!vpflow.flag("BZDIRECTION::TRANSFORM2ORIGINAL")) {
4810 a.transform_coordinates_original2new = aurostd::eye<double>(); // CO20190520
4811 } else if (a.volume_changed_original2new == true) {
4812 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "The volume changed between the input and final structure; cannot transform kpoints", _RUNTIME_ERROR_); // CO20200624
4813 }
4814 cerr << "LATTICE INFORMATION" << endl;
4815 cerr << " Real space lattice primitive = " << a.bravais_lattice_type << endl;
4816 cerr << " Real space lattice variation = " << a.bravais_lattice_variation_type << endl; // WSETYAWAN mod
4817 // cerr << " Real space conventional lattice = " << a.bravais_conventional_lattice_type << endl;
4818 cerr << " Real space Pearson symbol = " << a.pearson_symbol << endl;
4819 cerr << " Reciprocal lattice primitive = " << a.reciprocal_lattice_type << endl;
4820 cerr << " Reciprocal lattice variation = " << a.reciprocal_lattice_variation_type << endl; // WSETYAWAN mod
4821 if (vpflow.flag("BZDIRECTION::TRANSFORM2ORIGINAL") && vpflow.flag("BZDIRECTION::PRINT_TRANSFORMATION_MATRIX")) {
4822 cerr << "TRANSFORMATION MATRIX (P)" << endl;
4823 cerr << roundoff(aurostd::inverse(a.transform_coordinates_original2new), 1e-8) << endl;
4824 cerr << "TRANSFORMATION MATRIX (Q=P^-1)" << endl;
4825 cerr << roundoff(a.transform_coordinates_original2new, 1e-8) << endl;
4826 }
4827 // cerr << " Reciprocal conventional lattice = " << a.reciprocal_conventional_lattice_type << endl;
4828 cerr << "KPOINTS FILE" << endl;
4829 // DX20181101 return LATTICE::KPOINTS_Directions(a.bravais_lattice_variation_type,a.lattice,grid,a.iomode,foundBZ);
4830 return LATTICE::KPOINTS_Directions(a.bravais_lattice_variation_type, str_sp.lattice, a.transform_coordinates_original2new, grid, a.iomode, foundBZ); // DX20181213 - pass primitive lattice, not the original
4831 }
4832} // namespace pflow
4833
4834// ***************************************************************************
4835// pflow::CAGES
4836// ***************************************************************************
4837namespace pflow {
4838 void CAGES(_aflags& aflags, const string& options, istream& input) {
4839 const bool LDEBUG = (false || XHOST.DEBUG);
4840 if (LDEBUG) {
4841 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
4842 }
4843 vector<string> tokens;
4844 aurostd::string2tokens(options, tokens, ",");
4845 if (!tokens.empty() && tokens.size() != 1) {
4846 init::ErrorOption(options, __AFLOW_FUNC__, "aflow [--np=NP] --cages[=roughness] < POSCAR");
4847 }
4848 double roughness = -1.0;
4849 if (!tokens.empty()) {
4850 roughness = aurostd::string2utype<double>(tokens.at(0));
4851 }
4852 const xstructure a(input, IOAFLOW_AUTO);
4853 vector<acage> cagesirreducible;
4854 vector<acage> cagesreducible;
4855 vector<acage> cages4;
4856 vector<acage> cages3;
4857 vector<acage> cages2;
4858 // ME20210521
4859 const bool ofwrite = !XHOST.vflag_control.flag("WWW");
4860 GetCages(a, aflags, cagesirreducible, cagesreducible, cages4, cages3, cages2, roughness, ofwrite, true, cout);
4861 // cout << "REDUCIBLE_SIZE " << cagesreducible.size() << endl;
4862 // cout << "IRREDUCIBLE_SIZE " << cagesirreducible.size() << endl;
4863 if (LDEBUG) {
4864 cerr << __AFLOW_FUNC__ << " END" << endl;
4865 }
4866 }
4867} // namespace pflow
4868
4869// ***************************************************************************
4870// pflow::CART
4871// ***************************************************************************
4872namespace pflow {
4873 xstructure CART(istream& input) {
4874 const xstructure a(input, IOAFLOW_AUTO);
4875 xstructure b(a);
4876 b.SetCoordinates(_COORDS_CARTESIAN_);
4877 return b;
4878 }
4879} // namespace pflow
4880
4881// ***************************************************************************
4882// pflow::ChangeSuffix(const string& options)
4883// ***************************************************************************
4884namespace pflow {
4885 void ChangeSuffix(const string& _operation) {
4886 // aflow --suffix=[directory,]"from2to"
4887 // Change the suffixes of VASP files. Easy conversion between AFLOW format and VASP format. (KY20131222)
4888 // Mnemonic: from2to with from/to =[n=none;r1=relax1;r2=relax2;r3=relax3;s=static;b=bands] or without abbreviations.
4889 vector<string> vfile{"AECCAR0", "AECCAR1", "AECCAR2", "INCAR", "POSCAR", "POTCAR", "KPOINTS", "CONTCAR", "OUTCAR", "EIGENVAL", "DOSCAR", "IBZKPT",
4890 "OSZICAR", "PCDAT", "XDATCAR", "CHG", "CHGCAR", "PROCAR", "ELFCAR", "WAVECAR", "LOCPOT", "vasprun.xml", DEFAULT_VASP_OUT};
4891 vector<string> tokens;
4892 aurostd::string2tokens(_operation, tokens, ",");
4893 string directory;
4894 string operation;
4895 if (tokens.empty()) {
4896 directory = "";
4897 operation = _operation;
4898 }
4899 if (tokens.size() == 1) {
4900 directory = "";
4901 operation = tokens.at(0);
4902 }
4903 if (tokens.size() == 2) {
4904 directory = tokens.at(0) + "/";
4905 operation = tokens.at(1);
4906 }
4907 if (!operation.empty()) {
4908 for (size_t i = 0; i < vfile.size(); i++) {
4909 string from = "";
4910 string to = "";
4911 string f = aurostd::CleanFileName(directory + vfile[i]);
4912 for (size_t iext = 1; iext < XHOST.vext.size(); iext++) { // SKIP uncompressed
4913 if (aurostd::FileExist(f + XHOST.vext[iext])) {
4914 aurostd::execute(XHOST.command(XHOST.vzip.at(iext)) + " -dqf " + f + XHOST.vext[iext]);
4915 }
4916 if (aurostd::FileExist(f + ".relax1" + XHOST.vext[iext])) {
4917 aurostd::execute(XHOST.command(XHOST.vzip.at(iext)) + " -dqf " + f + ".relax1" + XHOST.vext[iext]);
4918 }
4919 if (aurostd::FileExist(f + ".relax2" + XHOST.vext[iext])) {
4920 aurostd::execute(XHOST.command(XHOST.vzip.at(iext)) + " -dqf " + f + ".relax2" + XHOST.vext[iext]);
4921 }
4922 if (aurostd::FileExist(f + ".relax3" + XHOST.vext[iext])) {
4923 aurostd::execute(XHOST.command(XHOST.vzip.at(iext)) + " -dqf " + f + ".relax3" + XHOST.vext[iext]);
4924 }
4925 if (aurostd::FileExist(f + ".static" + XHOST.vext[iext])) {
4926 aurostd::execute(XHOST.command(XHOST.vzip.at(iext)) + " -dqf " + f + ".static" + XHOST.vext[iext]);
4927 }
4928 if (aurostd::FileExist(f + ".bands" + XHOST.vext[iext])) {
4929 aurostd::execute(XHOST.command(XHOST.vzip.at(iext)) + " -dqf " + f + ".bands" + XHOST.vext[iext]);
4930 }
4931 }
4932 if (aurostd::substring2bool(operation, "n2") || aurostd::substring2bool(operation, "none2") || aurostd::substring2bool(operation, "normal2")) {
4933 from = "";
4934 }
4935 if (aurostd::substring2bool(operation, "r12") || aurostd::substring2bool(operation, "relax12")) {
4936 from = ".relax1";
4937 }
4938 if (aurostd::substring2bool(operation, "r22") || aurostd::substring2bool(operation, "relax22")) {
4939 from = ".relax2";
4940 }
4941 if (aurostd::substring2bool(operation, "r32") || aurostd::substring2bool(operation, "relax32")) {
4942 from = ".relax3";
4943 }
4944 if (aurostd::substring2bool(operation, "s2") || aurostd::substring2bool(operation, "static2")) {
4945 from = ".static";
4946 }
4947 if (aurostd::substring2bool(operation, "b2") || aurostd::substring2bool(operation, "bands2")) {
4948 from = ".bands";
4949 }
4950 if (aurostd::substring2bool(operation, "2n") || aurostd::substring2bool(operation, "2none") || aurostd::substring2bool(operation, "2normal")) {
4951 to = "";
4952 }
4953 if (aurostd::substring2bool(operation, "2r1") || aurostd::substring2bool(operation, "2relax1")) {
4954 to = ".relax1";
4955 }
4956 if (aurostd::substring2bool(operation, "2r2") || aurostd::substring2bool(operation, "2relax2")) {
4957 to = ".relax2";
4958 }
4959 if (aurostd::substring2bool(operation, "2r3") || aurostd::substring2bool(operation, "2relax3")) {
4960 to = ".relax3";
4961 }
4962 if (aurostd::substring2bool(operation, "2s") || aurostd::substring2bool(operation, "2static")) {
4963 to = ".static";
4964 }
4965 if (aurostd::substring2bool(operation, "2b") || aurostd::substring2bool(operation, "2bands")) {
4966 to = ".bands";
4967 }
4968
4969 if (!from.empty() || !to.empty()) {
4970 if (aurostd::FileExist(f + from)) {
4971 cout << XPID << "pflow::ChangeSuffix: mv " << f << from << " " << f << to << endl;
4972 aurostd::file2file(f + from, f + to);
4973 }
4974 }
4975 }
4976 }
4977 }
4978} // namespace pflow
4979
4980// ***************************************************************************
4981// pflow::CheckIntegritiy
4982// ***************************************************************************
4983// Shidong Wang 2011
4984namespace pflow {
4986 // Check whether function `isequal', `isdifferent', `identical' etc
4987 // give correct answer or not
4988 // issue of g++ optimization (-O -O1 -O2 -O3).
4989
4990 // xvector operators
4991
4992 const int test_xv_size = 5;
4993 const int _max_int = 100;
4994 const int _tol_int = 0;
4995 const float _tol_float = 1.0e-6;
4996 const double _tol_double = 1.0e-6;
4997
4998 xvector<int> test_int_xv_a(test_xv_size);
4999 xvector<int> test_int_xv_b(test_xv_size);
5000 xvector<float> test_float_xv_a(test_xv_size);
5001 xvector<float> test_float_xv_b(test_xv_size);
5002 xvector<double> test_double_xv_a(test_xv_size);
5003 xvector<double> test_double_xv_b(test_xv_size);
5004
5005 // initialze random seed
5006 srand(time(nullptr));
5007
5008 // initializae test xvectors
5009 for (int i = 1; i < test_xv_size + 1; i++) {
5010 test_int_xv_a[i] = rand() % _max_int;
5011 test_int_xv_b[i] = rand() % _max_int;
5012 test_float_xv_a[i] = PI * float((rand() % _max_int));
5013 test_float_xv_b[i] = PI * float((rand() % _max_int));
5014 test_double_xv_a[i] = EULERSNUMBER * float((rand() % _max_int));
5015 test_double_xv_b[i] = EULERSNUMBER * float((rand() % _max_int));
5016 }
5017
5018 const int line_width = 60;
5019 for (int i = 0; i < line_width; i++) {
5020 cout << "*";
5021 }
5022 cout << endl;
5023 cout << "Shidong Wang - 2011 " << endl;
5024 for (int i = 0; i < line_width; i++) {
5025 cout << "*";
5026 }
5027 cout << endl;
5028 cout << "xvector\n";
5029
5030 // template<class utype> bool
5031 // identical(const xvector<utype>&,const xvector<utype>&,const utype&) __xprototype;
5032 // cout << "Indentical Integer with given tolerance " << _tol_int << " : \n"
5033
5034 if (identical(test_int_xv_a, test_int_xv_a, _tol_int) && (!identical(test_int_xv_a, test_int_xv_b, _tol_int))) {
5035 cout << ">>> Testing Integer INDENTICAL with given tolerance: PASS\n";
5036 } else {
5037 cout << ">>> Testing Integer INDENTICAL with given tolerance: ***FAIL***!\n"
5038 << " 1) \n"
5039 << test_int_xv_a << endl
5040 << " and \n"
5041 << test_int_xv_a << endl
5042 << " are identical? " << std::boolalpha << identical(test_int_xv_a, test_int_xv_a, _tol_int) << endl;
5043 cout << "2) \n" << test_int_xv_a << endl << " and \n" << test_int_xv_b << endl << " are not identical? " << std::boolalpha << (!identical(test_int_xv_a, test_int_xv_b, _tol_int)) << endl;
5044 }
5045
5046 if (identical(test_float_xv_a, test_float_xv_a, _tol_float) && (!identical(test_float_xv_a, test_float_xv_b, _tol_float))) {
5047 cout << ">>> Testing Float INDENTICAL with given tolerance: PASS\n";
5048 } else {
5049 cout << ">>> Testing Float INDENTICAL with given tolerance: ***FAIL***!\n"
5050 << " 1) \n"
5051 << test_float_xv_a << endl
5052 << " and \n"
5053 << test_float_xv_a << endl
5054 << " are identical? " << std::boolalpha << identical(test_float_xv_a, test_float_xv_a, _tol_float) << endl;
5055 cout << "2) \n" << test_float_xv_a << endl << " and \n" << test_float_xv_b << endl << " are not identical? " << std::boolalpha << (!identical(test_float_xv_a, test_float_xv_b, _tol_float)) << endl;
5056 }
5057
5058 if (identical(test_double_xv_a, test_double_xv_a, _tol_double) && (!identical(test_double_xv_a, test_double_xv_b, _tol_double))) {
5059 cout << ">>> Testing Double INDENTICAL with default tolerance: PASS\n";
5060 } else {
5061 cout << ">>> Testing Double INDENTICAL with default tolerance: ***FAIL***!\n"
5062 << " 1) \n"
5063 << test_double_xv_a << endl
5064 << " and \n"
5065 << test_double_xv_a << endl
5066 << " are identical? " << std::boolalpha << identical(test_double_xv_a, test_double_xv_a, _tol_double) << endl;
5067 cout << "2) \n" << test_double_xv_a << endl << " and \n" << test_double_xv_b << endl << " are not identical? " << std::boolalpha << (!identical(test_double_xv_a, test_double_xv_b, _tol_double)) << endl;
5068 }
5069
5070 // template<class utype> bool
5071 // identical(const xvector<utype>&,const xvector<utype>&) __xprototype;
5072 if (identical(test_int_xv_a, test_int_xv_a) && (!identical(test_int_xv_a, test_int_xv_b))) {
5073 cout << ">>> Testing Integer INDENTICAL with default tolerance: PASS\n";
5074 } else {
5075 cout << ">>> Testing Integer INDENTICAL with default tolerance: ***FAIL***!\n"
5076 << " 1) \n"
5077 << test_int_xv_a << endl
5078 << " and \n"
5079 << test_int_xv_a << endl
5080 << " are identical? " << std::boolalpha << identical(test_int_xv_a, test_int_xv_a) << endl;
5081 cout << "2) \n" << test_int_xv_a << endl << " and \n" << test_int_xv_b << endl << " are not identical? " << std::boolalpha << (!identical(test_int_xv_a, test_int_xv_b)) << endl;
5082 }
5083
5084 if (identical(test_float_xv_a, test_float_xv_a) && (!identical(test_float_xv_a, test_float_xv_b))) {
5085 cout << ">>> Testing Float INDENTICAL with default tolerance: PASS\n";
5086 } else {
5087 cout << ">>> Testing Float INDENTICAL with default tolerance: ***FAIL***!\n"
5088 << " 1) \n"
5089 << test_float_xv_a << endl
5090 << " and \n"
5091 << test_float_xv_a << endl
5092 << " are identical? " << std::boolalpha << identical(test_float_xv_a, test_float_xv_a) << endl;
5093 cout << "2) \n" << test_float_xv_a << endl << " and \n" << test_float_xv_b << endl << " are not identical? " << std::boolalpha << (!identical(test_float_xv_a, test_float_xv_b)) << endl;
5094 }
5095
5096 if (identical(test_double_xv_a, test_double_xv_a) && (!identical(test_double_xv_a, test_double_xv_b))) {
5097 cout << ">>> Testing Double INDENTICAL with default tolerance: PASS\n";
5098 } else {
5099 cout << ">>> Testing Double INDENTICAL with default tolerance: ***FAIL***!\n"
5100 << " 1) \n"
5101 << test_double_xv_a << endl
5102 << " and \n"
5103 << test_double_xv_a << endl
5104 << " are identical? " << std::boolalpha << identical(test_double_xv_a, test_double_xv_a) << endl;
5105 cout << "2) \n" << test_double_xv_a << endl << " and \n" << test_double_xv_b << endl << " are not identical? " << std::boolalpha << (!identical(test_double_xv_a, test_double_xv_b)) << endl;
5106 }
5107
5108 // template<class utype> bool
5109 // operator==(const xvector<utype>&,const xvector<utype>&) __xprototype;
5110 if ((test_int_xv_a == test_int_xv_a) && !(test_int_xv_a == test_int_xv_b)) {
5111 cout << ">>> Testing Integer == with default tolerance: PASS\n";
5112 } else {
5113 cout << ">>> Testing Integer == with default tolerance: ***FAIL***!\n"
5114 << " 1) \n"
5115 << test_int_xv_a << endl
5116 << " and \n"
5117 << test_int_xv_a << endl
5118 << " are identical? " << std::boolalpha << identical(test_int_xv_a, test_int_xv_a) << endl;
5119 cout << "2) \n" << test_int_xv_a << endl << " and \n" << test_int_xv_b << endl << " are not identical? " << std::boolalpha << (!identical(test_int_xv_a, test_int_xv_b)) << endl;
5120 }
5121
5122 if ((test_float_xv_a == test_float_xv_a) && (!(test_float_xv_a == test_float_xv_b))) {
5123 cout << ">>> Testing Float == with default tolerance: PASS\n";
5124 } else {
5125 cout << ">>> Testing Float == with default tolerance: ***FAIL***!\n"
5126 << " 1) \n"
5127 << test_float_xv_a << endl
5128 << " and \n"
5129 << test_float_xv_a << endl
5130 << " are identical? " << std::boolalpha << (test_float_xv_a == test_float_xv_a) << endl;
5131 cout << "2) \n" << test_float_xv_a << endl << " and \n" << test_float_xv_b << endl << " are not identical? " << std::boolalpha << (!(test_float_xv_a == test_float_xv_b)) << endl;
5132 }
5133
5134 if (identical(test_double_xv_a, test_double_xv_a) && (!identical(test_double_xv_a, test_double_xv_b))) {
5135 cout << ">>> Testing Double == with default tolerance: PASS\n";
5136 } else {
5137 cout << ">>> Testing Double == with default tolerance: ***FAIL***!\n"
5138 << " 1) \n"
5139 << test_double_xv_a << endl
5140 << " and \n"
5141 << test_double_xv_a << endl
5142 << " are identical? " << std::boolalpha << (test_double_xv_a == test_double_xv_a) << endl;
5143 cout << "2) \n" << test_double_xv_a << endl << " and \n" << test_double_xv_b << endl << " are not identical? " << std::boolalpha << (!(test_double_xv_a == test_double_xv_b)) << endl;
5144 }
5145
5146 // template<class utype> bool
5147 // isdifferent(const xvector<utype>&,const xvector<utype>&,const utype&) __xprototype;
5148 if (!isdifferent(test_int_xv_a, test_int_xv_a, _tol_int) && isdifferent(test_int_xv_a, test_int_xv_b, _tol_int)) {
5149 cout << ">>> Testing Integer ISDIFFERENT with given tolerance: PASS\n";
5150 } else {
5151 cout << ">>> Testing Integer ISDIFFERENT with default tolerance: ***FAIL***!\n"
5152 << " 1) \n"
5153 << test_float_xv_a << endl
5154 << " and \n"
5155 << test_float_xv_a << endl
5156 << " are different? " << std::boolalpha << isdifferent(test_int_xv_a, test_int_xv_a, _tol_int) << endl;
5157 cout << "2) \n" << test_float_xv_a << endl << " and \n" << test_float_xv_b << endl << " are not different? " << std::boolalpha << (!isdifferent(test_int_xv_a, test_int_xv_b, _tol_int)) << endl;
5158 }
5159
5160 if (!isdifferent(test_float_xv_a, test_float_xv_a, _tol_float) && (isdifferent(test_float_xv_a, test_float_xv_b, _tol_float))) {
5161 cout << ">>> Testing Float ISDIFFERENT with given tolerance: PASS\n";
5162 } else {
5163 cout << ">>> Testing Float ISDIFFERENT with given tolerance: ***FAIL***!\n"
5164 << " 1) \n"
5165 << test_float_xv_a << endl
5166 << " and \n"
5167 << test_float_xv_a << endl
5168 << " are different? " << std::boolalpha << isdifferent(test_float_xv_a, test_float_xv_a, _tol_float) << endl;
5169 cout << "2) \n" << test_float_xv_a << endl << " and \n" << test_float_xv_b << endl << " are not different? " << std::boolalpha << (isdifferent(test_float_xv_a, test_float_xv_b, _tol_float)) << endl;
5170 }
5171
5172 if (!isdifferent(test_double_xv_a, test_double_xv_a, _tol_double) && (isdifferent(test_double_xv_a, test_double_xv_b, _tol_double))) {
5173 cout << ">>> Testing Double ISDIFFERENT with given tolerance: PASS\n";
5174 } else {
5175 cout << ">>> Testing Double ISDIFFERENT with given tolerance: ***FAIL***!\n"
5176 << " 1) \n"
5177 << test_double_xv_a << endl
5178 << " and \n"
5179 << test_double_xv_a << endl
5180 << " are different? " << std::boolalpha << isdifferent(test_double_xv_a, test_double_xv_a, _tol_double) << endl;
5181 cout << "2) \n" << test_double_xv_a << endl << " and \n" << test_double_xv_b << endl << " are not different? " << std::boolalpha << (!isdifferent(test_double_xv_a, test_double_xv_b, _tol_double)) << endl;
5182 }
5183
5184 // template<class utype> bool
5185 // isdifferent(const xvector<utype>&,const xvector<utype>&) __xprototype;
5186 if (!isdifferent(test_int_xv_a, test_int_xv_a) && isdifferent(test_int_xv_a, test_int_xv_b)) {
5187 cout << ">>> Testing Integer ISDIFFERENT xvector with default tolerance: PASS\n";
5188 } else {
5189 cout << ">>> Testing Integer ISDIFFERENT xvector with default tolerance: ***FAIL***!\n"
5190 << " 1) \n"
5191 << test_int_xv_a << endl
5192 << " and \n"
5193 << test_int_xv_a << endl
5194 << " are different? " << std::boolalpha << isdifferent(test_int_xv_a, test_int_xv_a) << endl;
5195 cout << "2) \n" << test_int_xv_a << endl << " and \n" << test_int_xv_b << endl << " are not different? " << std::boolalpha << (!isdifferent(test_int_xv_a, test_int_xv_b)) << endl;
5196 }
5197
5198 if (!isdifferent(test_float_xv_a, test_float_xv_a) && (isdifferent(test_float_xv_a, test_float_xv_b))) {
5199 cout << ">>> Testing Float ISDIFFERENT with default tolerance: PASS\n";
5200 } else {
5201 cout << ">>> Testing Float ISDIFFERENT with default tolerance: ***FAIL***!\n"
5202 << " 1) \n"
5203 << test_float_xv_a << endl
5204 << " and \n"
5205 << test_float_xv_a << endl
5206 << " are different? " << std::boolalpha << isdifferent(test_float_xv_a, test_float_xv_a) << endl;
5207 cout << "2) \n" << test_int_xv_a << endl << " and \n" << test_int_xv_b << endl << " are not different? " << std::boolalpha << (isdifferent(test_float_xv_a, test_float_xv_b)) << endl;
5208 }
5209
5210 if (!isdifferent(test_double_xv_a, test_double_xv_a) && (isdifferent(test_double_xv_a, test_double_xv_b))) {
5211 cout << ">>> Testing Double ISDIFFERENT with default tolerance: PASS\n";
5212 } else {
5213 cout << ">>> Testing Double ISDIFFERENT with default tolerance: ***FAIL***!\n"
5214 << " 1) \n"
5215 << test_double_xv_a << endl
5216 << " and \n"
5217 << test_double_xv_a << endl
5218 << " are different? " << std::boolalpha << isdifferent(test_double_xv_a, test_double_xv_a) << endl;
5219 cout << "2) \n" << test_int_xv_a << endl << " and \n" << test_int_xv_b << endl << " are not different? " << std::boolalpha << (!isdifferent(test_double_xv_a, test_double_xv_b)) << endl;
5220 }
5221
5222 // template<class utype> bool
5223 // aurostd::isequal(const xvector<utype>&,const xvector<utype>&,const utype&) __xprototype;
5224 if (aurostd::isequal(test_int_xv_a, test_int_xv_a, _tol_int) && (!aurostd::isequal(test_int_xv_a, test_int_xv_b, _tol_int))) {
5225 cout << ">>> Testing Integer ISEQUAL with given tolerance: PASS\n";
5226 } else {
5227 cout << ">>> Testing Integer ISEQUAL with given tolerance: ***FAIL***!\n"
5228 << " 1) \n"
5229 << test_int_xv_a << endl
5230 << " and \n"
5231 << test_int_xv_a << endl
5232 << " are identical? " << std::boolalpha << aurostd::isequal(test_int_xv_a, test_int_xv_a, _tol_int) << endl;
5233 cout << "2) \n" << test_int_xv_a << endl << " and \n" << test_int_xv_b << endl << " are not identical? " << std::boolalpha << (!aurostd::isequal(test_int_xv_a, test_int_xv_b, _tol_int)) << endl;
5234 }
5235
5236 if (aurostd::isequal(test_float_xv_a, test_float_xv_a, _tol_float) && (!aurostd::isequal(test_float_xv_a, test_float_xv_b, _tol_float))) {
5237 cout << ">>> Testing Float ISEQUAL with given tolerance: PASS\n";
5238 } else {
5239 cout << ">>> Testing Float ISEQUAL with given tolerance: ***FAIL***!\n"
5240 << " 1) \n"
5241 << test_float_xv_a << endl
5242 << " and \n"
5243 << test_float_xv_a << endl
5244 << " are identical? " << std::boolalpha << aurostd::isequal(test_float_xv_a, test_float_xv_a, _tol_float) << endl;
5245 cout << "2) \n" << test_float_xv_a << endl << " and \n" << test_float_xv_b << endl << " are not identical? " << std::boolalpha << (!aurostd::isequal(test_float_xv_a, test_float_xv_b, _tol_float)) << endl;
5246 }
5247
5248 if (aurostd::isequal(test_double_xv_a, test_double_xv_a, _tol_double) && (!aurostd::isequal(test_double_xv_a, test_double_xv_b, _tol_double))) {
5249 cout << ">>> Testing Double ISEQUAL with default tolerance: PASS\n";
5250 } else {
5251 cout << ">>> Testing Double ISEQUAL with default tolerance: ***FAIL***!\n"
5252 << " 1) \n"
5253 << test_double_xv_a << endl
5254 << " and \n"
5255 << test_double_xv_a << endl
5256 << " are identical? " << std::boolalpha << aurostd::isequal(test_double_xv_a, test_double_xv_a, _tol_double) << endl;
5257 cout << "2) \n"
5258 << test_double_xv_a << endl
5259 << " and \n"
5260 << test_double_xv_b << endl
5261 << " are not identical? " << std::boolalpha << (!aurostd::isequal(test_double_xv_a, test_double_xv_b, _tol_double)) << endl;
5262 }
5263
5264 // template<class utype> bool
5265 // isequal(const xvector<utype>&,const xvector<utype>&) __xprototype;
5266 if (aurostd::isequal(test_int_xv_a, test_int_xv_a) && (!aurostd::isequal(test_int_xv_a, test_int_xv_b))) {
5267 cout << ">>> Testing Integer ISEQUAL with default tolerance: PASS\n";
5268 } else {
5269 cout << ">>> Testing Integer ISEQUAL with default tolerance: ***FAIL***!\n"
5270 << " 1) \n"
5271 << test_int_xv_a << endl
5272 << " and \n"
5273 << test_int_xv_a << endl
5274 << " are identical? " << std::boolalpha << aurostd::isequal(test_int_xv_a, test_int_xv_a) << endl;
5275 cout << "2) \n" << test_int_xv_a << endl << " and \n" << test_int_xv_b << endl << " are not identical? " << std::boolalpha << (!aurostd::isequal(test_int_xv_a, test_int_xv_b)) << endl;
5276 }
5277
5278 if (aurostd::isequal(test_float_xv_a, test_float_xv_a) && (!aurostd::isequal(test_float_xv_a, test_float_xv_b))) {
5279 cout << ">>> Testing Float ISEQUAL with default tolerance: PASS\n";
5280 } else {
5281 cout << ">>> Testing Float ISEQUAL with default tolerance: ***FAIL***!\n"
5282 << " 1) \n"
5283 << test_float_xv_a << endl
5284 << " and \n"
5285 << test_float_xv_a << endl
5286 << " are identical? " << std::boolalpha << aurostd::isequal(test_float_xv_a, test_float_xv_a) << endl;
5287 cout << "2) \n" << test_float_xv_a << endl << " and \n" << test_float_xv_b << endl << " are not identical? " << std::boolalpha << (!aurostd::isequal(test_float_xv_a, test_float_xv_b)) << endl;
5288 }
5289
5290 if (aurostd::isequal(test_double_xv_a, test_double_xv_a) && (!aurostd::isequal(test_double_xv_a, test_double_xv_b))) {
5291 cout << ">>> Testing Double ISEQUAL with default tolerance: PASS\n";
5292 } else {
5293 cout << ">>> Testing Double ISEQUAL with default tolerance: ***FAIL***!\n"
5294 << " 1) \n"
5295 << test_double_xv_a << endl
5296 << " and \n"
5297 << test_double_xv_a << endl
5298 << " are identical? " << std::boolalpha << aurostd::isequal(test_double_xv_a, test_double_xv_a) << endl;
5299 cout << "2) \n" << test_double_xv_a << endl << " and \n" << test_double_xv_b << endl << " are not identical? " << std::boolalpha << (!aurostd::isequal(test_double_xv_a, test_double_xv_b)) << endl;
5300 }
5301
5302 // template<class utype> bool
5303 // operator!=(const xvector<utype>&,const xvector<utype>&) __xprototype;
5304 if (!(test_int_xv_a != test_int_xv_a) && ((test_int_xv_a != test_int_xv_b))) {
5305 cout << ">>> Testing Integer != with default tolerance: PASS\n";
5306 } else {
5307 cout << ">>> Testing Integer != with default tolerance: ***FAIL***!\n"
5308 << " 1) \n"
5309 << test_int_xv_a << endl
5310 << " and \n"
5311 << test_int_xv_a << endl
5312 << " are different? " << std::boolalpha << (test_int_xv_a != test_int_xv_a) << endl;
5313 cout << "2) \n" << test_int_xv_a << endl << " and \n" << test_int_xv_b << endl << " are not different? " << std::boolalpha << ((test_int_xv_a != test_int_xv_b)) << endl;
5314 }
5315
5316 if (!(test_float_xv_a != test_float_xv_a) && ((test_float_xv_a != test_float_xv_b))) {
5317 cout << ">>> Testing Float != with default tolerance: PASS\n";
5318 } else {
5319 cout << ">>> Testing Float != with default tolerance: ***FAIL***!\n"
5320 << " 1) \n"
5321 << test_int_xv_a << endl
5322 << " and \n"
5323 << test_int_xv_a << endl
5324 << " are different? " << std::boolalpha << (test_float_xv_a != test_float_xv_a) << endl;
5325 cout << "2) \n" << test_int_xv_a << endl << " and \n" << test_int_xv_b << endl << " are not different? " << std::boolalpha << ((test_float_xv_a != test_float_xv_b)) << endl;
5326 }
5327
5328 if (!(test_double_xv_a != test_double_xv_a) && ((test_double_xv_a != test_double_xv_b))) {
5329 cout << ">>> Testing Double != with default tolerance: PASS\n";
5330 } else {
5331 cout << ">>> Testing Double != with default tolerance: ***FAIL***!\n"
5332 << " 1) \n"
5333 << test_int_xv_a << endl
5334 << " and \n"
5335 << test_int_xv_a << endl
5336 << " are different? " << std::boolalpha << (test_double_xv_a != test_double_xv_a) << endl;
5337 cout << "2) \n" << test_int_xv_a << endl << " and \n" << test_int_xv_b << endl << " are not different? " << std::boolalpha << ((test_double_xv_a != test_double_xv_b)) << endl;
5338 }
5339
5340 const int test_xm_size = 3;
5341 xmatrix<int> test_int_xm_a(test_xm_size, test_xm_size);
5342 xmatrix<int> test_int_xm_b(test_xm_size, test_xm_size);
5343 xmatrix<float> test_float_xm_a(test_xm_size, test_xm_size);
5344 xmatrix<float> test_float_xm_b(test_xm_size, test_xm_size);
5345 xmatrix<double> test_double_xm_a(test_xm_size, test_xm_size);
5346 xmatrix<double> test_double_xm_b(test_xm_size, test_xm_size);
5347
5348 // initialze random seed
5349 srand(time(nullptr));
5350
5351 // initializae test xmatrices
5352 for (int i = 1; i < test_xm_size + 1; i++) {
5353 for (int j = 1; j < test_xm_size + 1; j++) {
5354 test_int_xm_a[i][j] = rand() % _max_int;
5355 test_int_xm_b[i][j] = rand() % _max_int;
5356 test_float_xm_a[i][j] = PI * float((rand() % _max_int));
5357 test_float_xm_b[i][j] = PI * float((rand() % _max_int));
5358 test_double_xm_a[i][j] = EULERSNUMBER * double((rand() % _max_int));
5359 test_double_xm_b[i][j] = EULERSNUMBER * double((rand() % _max_int));
5360 }
5361 }
5362
5363 for (int i = 0; i < line_width; i++) {
5364 cout << "*";
5365 }
5366 cout << endl;
5367
5368 cout << "xmatrix\n";
5369
5370 // template<class utype> bool
5371 // identical(const xmatrix<utype>&,const xmatrix<utype>&,const utype&) __xprototype;
5372 // cout << "Indentical Integer with given tolerance " << _tol_int << " : \n"
5373
5374 if (identical(test_int_xm_a, test_int_xm_a, _tol_int) && (!identical(test_int_xm_a, test_int_xm_b, _tol_int))) {
5375 cout << ">>> Testing Integer INDENTICAL with given tolerance: PASS\n";
5376 } else {
5377 cout << ">>> Testing Integer INDENTICAL with given tolerance: ***FAIL***!\n"
5378 << " 1) \n"
5379 << test_int_xm_a << endl
5380 << " and \n"
5381 << test_int_xm_a << endl
5382 << " are identical? " << std::boolalpha << identical(test_int_xm_a, test_int_xm_a, _tol_int) << endl;
5383 cout << "2) \n" << test_int_xm_a << endl << " and \n" << test_int_xm_b << endl << " are not identical? " << std::boolalpha << (!identical(test_int_xm_a, test_int_xm_b, _tol_int)) << endl;
5384 }
5385
5386 if (identical(test_float_xm_a, test_float_xm_a, _tol_float) && (!identical(test_float_xm_a, test_float_xm_b, _tol_float))) {
5387 cout << ">>> Testing Float INDENTICAL with given tolerance: PASS\n";
5388 } else {
5389 cout << ">>> Testing Float INDENTICAL with given tolerance: ***FAIL***!\n"
5390 << " 1) \n"
5391 << test_float_xm_a << endl
5392 << " and \n"
5393 << test_float_xm_a << endl
5394 << " are identical? " << std::boolalpha << identical(test_float_xm_a, test_float_xm_a, _tol_float) << endl;
5395 cout << "2) \n" << test_float_xm_a << endl << " and \n" << test_float_xm_b << endl << " are not identical? " << std::boolalpha << (!identical(test_float_xm_a, test_float_xm_b, _tol_float)) << endl;
5396 }
5397
5398 if (identical(test_double_xm_a, test_double_xm_a, _tol_double) && (!identical(test_double_xm_a, test_double_xm_b, _tol_double))) {
5399 cout << ">>> Testing Double INDENTICAL with default tolerance: PASS\n";
5400 } else {
5401 cout << ">>> Testing Double INDENTICAL with default tolerance: ***FAIL***!\n"
5402 << " 1) \n"
5403 << test_double_xm_a << endl
5404 << " and \n"
5405 << test_double_xm_a << endl
5406 << " are identical? " << std::boolalpha << identical(test_double_xm_a, test_double_xm_a, _tol_double) << endl;
5407 cout << "2) \n" << test_double_xm_a << endl << " and \n" << test_double_xm_b << endl << " are not identical? " << std::boolalpha << (!identical(test_double_xm_a, test_double_xm_b, _tol_double)) << endl;
5408 }
5409
5410 // template<class utype> bool
5411 // identical(const xmatrix<utype>&,const xmatrix<utype>&) __xprototype;
5412 if (identical(test_int_xm_a, test_int_xm_a) && (!identical(test_int_xm_a, test_int_xm_b))) {
5413 cout << ">>> Testing Integer INDENTICAL with default tolerance: PASS\n";
5414 } else {
5415 cout << ">>> Testing Integer INDENTICAL with default tolerance: ***FAIL***!\n"
5416 << " 1) \n"
5417 << test_int_xm_a << endl
5418 << " and \n"
5419 << test_int_xm_a << endl
5420 << " are identical? " << std::boolalpha << identical(test_int_xm_a, test_int_xm_a) << endl;
5421 cout << "2) \n" << test_int_xm_a << endl << " and \n" << test_int_xm_b << endl << " are not identical? " << std::boolalpha << (!identical(test_int_xm_a, test_int_xm_b)) << endl;
5422 }
5423
5424 if (identical(test_float_xm_a, test_float_xm_a) && (!identical(test_float_xm_a, test_float_xm_b))) {
5425 cout << ">>> Testing Float INDENTICAL with default tolerance: PASS\n";
5426 } else {
5427 cout << ">>> Testing Float INDENTICAL with default tolerance: ***FAIL***!\n"
5428 << " 1) \n"
5429 << test_float_xm_a << endl
5430 << " and \n"
5431 << test_float_xm_a << endl
5432 << " are identical? " << std::boolalpha << identical(test_float_xm_a, test_float_xm_a) << endl;
5433 cout << "2) \n" << test_float_xm_a << endl << " and \n" << test_float_xm_b << endl << " are not identical? " << std::boolalpha << (!identical(test_float_xm_a, test_float_xm_b)) << endl;
5434 }
5435
5436 if (identical(test_double_xm_a, test_double_xm_a) && (!identical(test_double_xm_a, test_double_xm_b))) {
5437 cout << ">>> Testing Double INDENTICAL with default tolerance: PASS\n";
5438 } else {
5439 cout << ">>> Testing Double INDENTICAL with default tolerance: ***FAIL***!\n"
5440 << " 1) \n"
5441 << test_double_xm_a << endl
5442 << " and \n"
5443 << test_double_xm_a << endl
5444 << " are identical? " << std::boolalpha << identical(test_double_xm_a, test_double_xm_a) << endl;
5445 cout << "2) \n" << test_double_xm_a << endl << " and \n" << test_double_xm_b << endl << " are not identical? " << std::boolalpha << (!identical(test_double_xm_a, test_double_xm_b)) << endl;
5446 }
5447
5448 // template<class utype> bool
5449 // operator==(const xvector<utype>&,const xvector<utype>&) __xprototype;
5450 if ((test_int_xm_a == test_int_xm_a) && !(test_int_xm_a == test_int_xm_b)) {
5451 cout << ">>> Testing Integer == with default tolerance: PASS\n";
5452 } else {
5453 cout << ">>> Testing Integer == with default tolerance: ***FAIL***!\n"
5454 << " 1) \n"
5455 << test_int_xm_a << endl
5456 << " and \n"
5457 << test_int_xm_a << endl
5458 << " are identical? " << std::boolalpha << identical(test_int_xm_a, test_int_xm_a) << endl;
5459 cout << "2) \n" << test_int_xm_a << endl << " and \n" << test_int_xm_b << endl << " are not identical? " << std::boolalpha << (!identical(test_int_xm_a, test_int_xm_b)) << endl;
5460 }
5461
5462 if ((test_float_xm_a == test_float_xm_a) && (!(test_float_xm_a == test_float_xm_b))) {
5463 cout << ">>> Testing Float == with default tolerance: PASS\n";
5464 } else {
5465 cout << ">>> Testing Float == with default tolerance: ***FAIL***!\n"
5466 << " 1) \n"
5467 << test_float_xm_a << endl
5468 << " and \n"
5469 << test_float_xm_a << endl
5470 << " are identical? " << std::boolalpha << (test_float_xm_a == test_float_xm_a) << endl;
5471 cout << "2) \n" << test_float_xm_a << endl << " and \n" << test_float_xm_b << endl << " are not identical? " << std::boolalpha << (!(test_float_xm_a == test_float_xm_b)) << endl;
5472 }
5473
5474 if (identical(test_double_xm_a, test_double_xm_a) && (!identical(test_double_xm_a, test_double_xm_b))) {
5475 cout << ">>> Testing Double == with default tolerance: PASS\n";
5476 } else {
5477 cout << ">>> Testing Double == with default tolerance: ***FAIL***!\n"
5478 << " 1) \n"
5479 << test_double_xm_a << endl
5480 << " and \n"
5481 << test_double_xm_a << endl
5482 << " are identical? " << std::boolalpha << (test_double_xm_a == test_double_xm_a) << endl;
5483 cout << "2) \n" << test_double_xm_a << endl << " and \n" << test_double_xm_b << endl << " are not identical? " << std::boolalpha << (!(test_double_xm_a == test_double_xm_b)) << endl;
5484 }
5485
5486 // template<class utype> bool
5487 // isdifferent(const xmatrix<utype>&,const xmatrix<utype>&,const utype&) __xprototype;
5488 if (!isdifferent(test_int_xm_a, test_int_xm_a, _tol_int) && isdifferent(test_int_xm_a, test_int_xm_b, _tol_int)) {
5489 cout << ">>> Testing Integer ISDIFFERENT with given tolerance: PASS\n";
5490 } else {
5491 cout << ">>> Testing Integer ISDIFFERENT with default tolerance: ***FAIL***!\n"
5492 << " 1) \n"
5493 << test_int_xm_a << endl
5494 << " and \n"
5495 << test_int_xm_a << endl
5496 << " are different? " << std::boolalpha << isdifferent(test_int_xm_a, test_int_xm_a, _tol_int) << endl;
5497 cout << "2) \n" << test_int_xm_a << endl << " and \n" << test_int_xm_b << endl << " are not different? " << std::boolalpha << (!isdifferent(test_int_xm_a, test_int_xm_b, _tol_int)) << endl;
5498 }
5499
5500 if (!isdifferent(test_float_xm_a, test_float_xm_a, _tol_float) && (isdifferent(test_float_xm_a, test_float_xm_b, _tol_float))) {
5501 cout << ">>> Testing Float ISDIFFERENT with given tolerance: PASS\n";
5502 } else {
5503 cout << ">>> Testing Float ISDIFFERENT with given tolerance: ***FAIL***!\n"
5504 << " 1) \n"
5505 << test_float_xm_a << endl
5506 << " and \n"
5507 << test_float_xm_a << endl
5508 << " are different? " << std::boolalpha << isdifferent(test_float_xm_a, test_float_xm_a, _tol_float) << endl;
5509 cout << "2) \n" << test_float_xm_a << endl << " and \n" << test_float_xm_b << endl << " are not different? " << std::boolalpha << (isdifferent(test_float_xm_a, test_float_xm_b, _tol_float)) << endl;
5510 }
5511
5512 if (!isdifferent(test_double_xm_a, test_double_xm_a, _tol_double) && (isdifferent(test_double_xm_a, test_double_xm_b, _tol_double))) {
5513 cout << ">>> Testing Double ISDIFFERENT with given tolerance: PASS\n";
5514 } else {
5515 cout << ">>> Testing Double ISDIFFERENT with given tolerance: ***FAIL***!\n"
5516 << " 1) \n"
5517 << test_double_xm_a << endl
5518 << " and \n"
5519 << test_double_xm_a << endl
5520 << " are different? " << std::boolalpha << isdifferent(test_double_xm_a, test_double_xm_a, _tol_double) << endl;
5521 cout << "2) \n" << test_double_xm_a << endl << " and \n" << test_double_xm_b << endl << " are not different? " << std::boolalpha << (!isdifferent(test_double_xm_a, test_double_xm_b, _tol_double)) << endl;
5522 }
5523
5524 // template<class utype> bool
5525 // isdifferent(const xmatrix<utype>&,const xmatrix<utype>&) __xprototype;
5526 if (!isdifferent(test_int_xm_a, test_int_xm_a) && isdifferent(test_int_xm_a, test_int_xm_b)) {
5527 cout << ">>> Testing Integer ISDIFFERENT xvector with default tolerance: PASS\n";
5528 } else {
5529 cout << ">>> Testing Integer ISDIFFERENT xvector with default tolerance: ***FAIL***!\n"
5530 << " 1) \n"
5531 << test_int_xm_a << endl
5532 << " and \n"
5533 << test_int_xm_a << endl
5534 << " are different? " << std::boolalpha << isdifferent(test_int_xm_a, test_int_xm_a) << endl;
5535 cout << "2) \n" << test_int_xm_a << endl << " and \n" << test_int_xm_b << endl << " are not different? " << std::boolalpha << (!isdifferent(test_int_xm_a, test_int_xm_b)) << endl;
5536 }
5537
5538 if (!isdifferent(test_float_xm_a, test_float_xm_a) && (isdifferent(test_float_xm_a, test_float_xm_b))) {
5539 cout << ">>> Testing Float ISDIFFERENT with default tolerance: PASS\n";
5540 } else {
5541 cout << ">>> Testing Float ISDIFFERENT with default tolerance: ***FAIL***!\n"
5542 << " 1) \n"
5543 << test_float_xm_a << endl
5544 << " and \n"
5545 << test_float_xm_a << endl
5546 << " are different? " << std::boolalpha << isdifferent(test_float_xm_a, test_float_xm_a) << endl;
5547 cout << "2) \n" << test_float_xm_a << endl << " and \n" << test_float_xm_b << endl << " are not different? " << std::boolalpha << (isdifferent(test_float_xm_a, test_float_xm_b)) << endl;
5548 }
5549
5550 if (!isdifferent(test_double_xm_a, test_double_xm_a) && (isdifferent(test_double_xm_a, test_double_xm_b))) {
5551 cout << ">>> Testing Double ISDIFFERENT with default tolerance: PASS\n";
5552 } else {
5553 cout << ">>> Testing Double ISDIFFERENT with default tolerance: ***FAIL***!\n"
5554 << " 1) \n"
5555 << test_double_xm_a << endl
5556 << " and \n"
5557 << test_double_xm_a << endl
5558 << " are different? " << std::boolalpha << isdifferent(test_double_xm_a, test_double_xm_a) << endl;
5559 cout << "2) \n" << test_double_xm_a << endl << " and \n" << test_double_xm_b << endl << " are not different? " << std::boolalpha << (!isdifferent(test_double_xm_a, test_double_xm_b)) << endl;
5560 }
5561
5562 // template<class utype> bool
5563 // isequal(const xmatrix<utype>&,const xmatrix<utype>&,const utype&) __xprototype;
5564 if (aurostd::isequal(test_int_xm_a, test_int_xm_a, _tol_int) && (!aurostd::isequal(test_int_xm_a, test_int_xm_b, _tol_int))) {
5565 cout << ">>> Testing Integer ISEQUAL with given tolerance: PASS\n";
5566 } else {
5567 cout << ">>> Testing Integer ISEQUAL with given tolerance: ***FAIL***!\n"
5568 << " 1) \n"
5569 << test_int_xm_a << endl
5570 << " and \n"
5571 << test_int_xm_a << endl
5572 << " are identical? " << std::boolalpha << aurostd::isequal(test_int_xm_a, test_int_xm_a, _tol_int) << endl;
5573 cout << "2) \n" << test_int_xm_a << endl << " and \n" << test_int_xm_b << endl << " are not identical? " << std::boolalpha << (!aurostd::isequal(test_int_xm_a, test_int_xm_b, _tol_int)) << endl;
5574 }
5575
5576 if (aurostd::isequal(test_float_xm_a, test_float_xm_a, _tol_float) && (!aurostd::isequal(test_float_xm_a, test_float_xm_b, _tol_float))) {
5577 cout << ">>> Testing Float ISEQUAL with given tolerance: PASS\n";
5578 } else {
5579 cout << ">>> Testing Float ISEQUAL with given tolerance: ***FAIL***!\n"
5580 << " 1) \n"
5581 << test_float_xm_a << endl
5582 << " and \n"
5583 << test_float_xm_a << endl
5584 << " are identical? " << std::boolalpha << aurostd::isequal(test_float_xm_a, test_float_xm_a, _tol_float) << endl;
5585 cout << "2) \n" << test_float_xm_a << endl << " and \n" << test_float_xm_b << endl << " are not identical? " << std::boolalpha << (!aurostd::isequal(test_float_xm_a, test_float_xm_b, _tol_float)) << endl;
5586 }
5587
5588 if (aurostd::isequal(test_double_xm_a, test_double_xm_a, _tol_double) && (!aurostd::isequal(test_double_xm_a, test_double_xm_b, _tol_double))) {
5589 cout << ">>> Testing Double ISEQUAL with default tolerance: PASS\n";
5590 } else {
5591 cout << ">>> Testing Double ISEQUAL with default tolerance: ***FAIL***!\n"
5592 << " 1) \n"
5593 << test_double_xm_a << endl
5594 << " and \n"
5595 << test_double_xm_a << endl
5596 << " are identical? " << std::boolalpha << aurostd::isequal(test_double_xm_a, test_double_xm_a, _tol_double) << endl;
5597 cout << "2) \n"
5598 << test_double_xm_a << endl
5599 << " and \n"
5600 << test_double_xm_b << endl
5601 << " are not identical? " << std::boolalpha << (!aurostd::isequal(test_double_xm_a, test_double_xm_b, _tol_double)) << endl;
5602 }
5603
5604 // template<class utype> bool
5605 // isequal(const xmatrix<utype>&,const xmatrix<utype>&) __xprototype;
5606 if (aurostd::isequal(test_int_xm_a, test_int_xm_a) && (!aurostd::isequal(test_int_xm_a, test_int_xm_b))) {
5607 cout << ">>> Testing Integer ISEQUAL with default tolerance: PASS\n";
5608 } else {
5609 cout << ">>> Testing Integer ISEQUAL with default tolerance: ***FAIL***!\n"
5610 << " 1) \n"
5611 << test_int_xm_a << endl
5612 << " and \n"
5613 << test_int_xm_a << endl
5614 << " are identical? " << std::boolalpha << aurostd::isequal(test_int_xm_a, test_int_xm_a) << endl;
5615 cout << "2) \n" << test_int_xm_a << endl << " and \n" << test_int_xm_b << endl << " are not identical? " << std::boolalpha << (!aurostd::isequal(test_int_xm_a, test_int_xm_b)) << endl;
5616 }
5617
5618 if (aurostd::isequal(test_float_xm_a, test_float_xm_a) && (!aurostd::isequal(test_float_xm_a, test_float_xm_b))) {
5619 cout << ">>> Testing Float ISEQUAL with default tolerance: PASS\n";
5620 } else {
5621 cout << ">>> Testing Float ISEQUAL with default tolerance: ***FAIL***!\n"
5622 << " 1) \n"
5623 << test_float_xm_a << endl
5624 << " and \n"
5625 << test_float_xm_a << endl
5626 << " are identical? " << std::boolalpha << aurostd::isequal(test_float_xm_a, test_float_xm_a) << endl;
5627 cout << "2) \n" << test_float_xm_a << endl << " and \n" << test_float_xm_b << endl << " are not identical? " << std::boolalpha << (!aurostd::isequal(test_float_xm_a, test_float_xm_b)) << endl;
5628 }
5629
5630 if (aurostd::isequal(test_double_xm_a, test_double_xm_a) && (!aurostd::isequal(test_double_xm_a, test_double_xm_b))) {
5631 cout << ">>> Testing Double ISEQUAL with default tolerance: PASS\n";
5632 } else {
5633 cout << ">>> Testing Double ISEQUAL with default tolerance: ***FAIL***!\n"
5634 << " 1) \n"
5635 << test_double_xm_a << endl
5636 << " and \n"
5637 << test_double_xm_a << endl
5638 << " are identical? " << std::boolalpha << aurostd::isequal(test_double_xm_a, test_double_xm_a) << endl;
5639 cout << "2) \n" << test_double_xm_a << endl << " and \n" << test_double_xm_b << endl << " are not identical? " << std::boolalpha << (!aurostd::isequal(test_double_xm_a, test_double_xm_b)) << endl;
5640 }
5641
5642 // template<class utype> bool
5643 // operator!=(const xmatrix<utype>&,const xmatrix<utype>&) __xprototype;
5644 if (!(test_int_xm_a != test_int_xm_a) && ((test_int_xm_a != test_int_xm_b))) {
5645 cout << ">>> Testing Integer != with default tolerance: PASS\n";
5646 } else {
5647 cout << ">>> Testing Integer != with default tolerance: ***FAIL***!\n"
5648 << " 1) \n"
5649 << test_int_xm_a << endl
5650 << " and \n"
5651 << test_int_xm_a << endl
5652 << " are different? " << std::boolalpha << (test_int_xm_a != test_int_xm_a) << endl;
5653 cout << "2) \n" << test_int_xm_a << endl << " and \n" << test_int_xm_b << endl << " are not different? " << std::boolalpha << ((test_int_xm_a != test_int_xm_b)) << endl;
5654 }
5655
5656 if (!(test_float_xm_a != test_float_xm_a) && ((test_float_xm_a != test_float_xm_b))) {
5657 cout << ">>> Testing Float != with default tolerance: PASS\n";
5658 } else {
5659 cout << ">>> Testing Float != with default tolerance: ***FAIL***!\n"
5660 << " 1) \n"
5661 << test_float_xm_a << endl
5662 << " and \n"
5663 << test_float_xm_a << endl
5664 << " are different? " << std::boolalpha << (test_float_xm_a != test_float_xm_a) << endl;
5665 cout << "2) \n" << test_float_xm_a << endl << " and \n" << test_float_xm_b << endl << " are not different? " << std::boolalpha << ((test_float_xm_a != test_float_xm_b)) << endl;
5666 }
5667
5668 if (!(test_double_xm_a != test_double_xm_a) && ((test_double_xm_a != test_double_xm_b))) {
5669 cout << ">>> Testing Double != with default tolerance: PASS\n";
5670 } else {
5671 cout << ">>> Testing Double != with default tolerance: ***FAIL***!\n"
5672 << " 1) \n"
5673 << test_double_xm_a << endl
5674 << " and \n"
5675 << test_double_xm_a << endl
5676 << " are different? " << std::boolalpha << (test_double_xm_a != test_double_xm_a) << endl;
5677 cout << "2) \n" << test_double_xm_a << endl << " and \n" << test_double_xm_b << endl << " are not different? " << std::boolalpha << ((test_double_xm_a != test_double_xm_b)) << endl;
5678 }
5679 }
5680} // namespace pflow
5681// ***************************************************************************
5682// pflow::CHGDIFF
5683// ***************************************************************************
5684namespace pflow {
5685 string CHGDIFF(aurostd::xoption vpflow) {
5686 // handles flags for CHGDIFF
5687 string chgcar1_file;
5688 string chgcar2_file;
5689 string output_file;
5690 ostringstream oss;
5691
5692 // DEBUG
5693 const bool LDEBUG = (false || XHOST.DEBUG);
5694 if (LDEBUG) {
5695 oss << __AFLOW_FUNC__ << "BEGIN FLAGS" << endl;
5696 }
5697
5698 const string usage_usage = "aflow --chgdiff=CHGCAR1,CHGCAR2 [chgdiff_options]";
5699 const string usage_options = aurostd::liststring2string("options = --usage", " --output=|-o=CHGCAR_OUT");
5700
5701 // output usage
5702 if (LDEBUG) {
5703 oss << __AFLOW_FUNC__ << "CHECK USAGE" << endl;
5704 }
5705 if (vpflow.flag("CHGDIFF::USAGE")) {
5706 init::MessageOption(vpflow.getattachedscheme("CHGDIFF"), "pflow::CHGDIFF()", aurostd::liststring2string(usage_usage, usage_options));
5707 return oss.str();
5708 }
5709
5710 // no input
5711 vector<string> input_tokens;
5712 if (LDEBUG) {
5713 oss << __AFLOW_FUNC__ << "CHECK INPUT" << endl;
5714 }
5715 if (!vpflow.flag("CHGDIFF")) {
5716 oss << endl;
5717 oss << __AFLOW_FUNC__ << "ERROR: No input given." << endl;
5718 oss << __AFLOW_FUNC__ << "Exiting." << endl;
5719 oss << endl;
5720 }
5721
5722 // check inputs
5723 string misc_option;
5724 if (LDEBUG) {
5725 oss << __AFLOW_FUNC__ << "vpflow.getattachedscheme(\"CHGDIFF\")=" << vpflow.getattachedscheme("CHGDIFF") << endl;
5726 }
5727 misc_option = vpflow.getattachedscheme("CHGDIFF");
5728 aurostd::string2tokens(misc_option, input_tokens, ",");
5729 if (input_tokens.size() != 2) {
5730 oss << endl;
5731 oss << __AFLOW_FUNC__ << "ERROR: Incorrect input arguments. List two CHGCARs separated by commas." << endl;
5732 oss << __AFLOW_FUNC__ << "Exiting." << endl;
5733 oss << endl;
5734 }
5735
5736 chgcar1_file = input_tokens.at(0);
5737 chgcar2_file = input_tokens.at(1);
5738
5739 // get output, if specified (or standardize)
5740 if (!vpflow.flag("CHGDIFF::OUTPUT")) {
5741 output_file = "aflow_CHGDIFF.out";
5742 } else {
5743 output_file = vpflow.getattachedscheme("CHGDIFF::OUTPUT");
5744 }
5745 if (LDEBUG) {
5746 oss << __AFLOW_FUNC__ << "CHGCAR_OUT=" << output_file << endl;
5747 }
5748
5749 CHGDIFF(chgcar1_file, chgcar2_file, output_file, oss);
5750 return oss.str();
5751 }
5752} // namespace pflow
5753
5754// ***************************************************************************
5755// pflow::CHGDIFF
5756// ***************************************************************************
5757namespace pflow {
5758 bool CHGDIFF(const string& chgcar1_file, const string& chgcar2_file, const string& output_file, ostream& oss) {
5759 // RETURNS CHGCAR_OUT=CHGCAR_INPUT_1-CHGCAR_INPUT_2
5760 // Read in CHGCAR or AECCAR files
5761 // format_dim is as follows: numcolumns chg_tot, npts and numcolumns for
5762 // augmentation occupancies, numcolumns chg_diff, npts and numcolumns for
5763 // augmentation occupancies
5764 // read chgcars
5765
5766 stringstream chgcar1_ss;
5767 stringstream chgcar2_ss;
5768 stringstream chgcar1_header;
5769 stringstream chgcar2_header;
5770 const double TOL = 1e-5;
5771 xstructure structure1;
5772 xstructure structure2;
5773 vector<int> ngrid1(3);
5774 vector<int> ngrid2(3);
5775 vector<int> format_dim1;
5776 vector<int> format_dim2;
5777 vector<double> chg_tot1;
5778 vector<double> chg_tot2;
5779 vector<double> chg_diff1;
5780 vector<double> chg_diff2;
5781
5782 // DEBUG
5783 const bool LDEBUG = (false || XHOST.DEBUG);
5784 if (LDEBUG) {
5785 oss << __AFLOW_FUNC__ << "BEGIN FUNCTION" << endl;
5786 }
5787
5788 // get input 1
5789 if (!aurostd::FileExist(chgcar1_file)) {
5790 oss << endl;
5791 oss << __AFLOW_FUNC__ << "ERROR: " << chgcar1_file << " does not exist." << endl;
5792 oss << __AFLOW_FUNC__ << "Exiting." << endl;
5793 oss << endl;
5794 return false;
5795 }
5796 if (LDEBUG) {
5797 oss << __AFLOW_FUNC__ << "CHGCAR1=" << chgcar1_file << endl;
5798 }
5799 aurostd::compressfile2stringstream(chgcar1_file, chgcar1_ss);
5800
5801 // get input 2
5802 if (!aurostd::FileExist(chgcar2_file)) {
5803 oss << endl;
5804 oss << __AFLOW_FUNC__ << "ERROR: " << chgcar2_file << " does not exist." << endl;
5805 oss << __AFLOW_FUNC__ << "Exiting." << endl;
5806 oss << endl;
5807 return false;
5808 }
5809 if (LDEBUG) {
5810 oss << __AFLOW_FUNC__ << "CHGCAR2=" << chgcar2_file << endl;
5811 }
5812 aurostd::compressfile2stringstream(chgcar2_file, chgcar2_ss);
5813
5814 if (LDEBUG) {
5815 oss << __AFLOW_FUNC__ << "CHECK FORMAT OF " << chgcar1_file << endl;
5816 }
5817 if (!pflow::ReadCHGCAR(structure1, chgcar1_header, ngrid1, format_dim1, chg_tot1, chg_diff1, chgcar1_ss, oss)) {
5818 oss << endl;
5819 oss << __AFLOW_FUNC__ << "ERROR: Input " << chgcar1_file << " format not recognized." << endl;
5820 oss << endl;
5821 return false; // CHGCAR format not recognized
5822 }
5823 if (LDEBUG) {
5824 oss << __AFLOW_FUNC__ << "SUCCESSFULLY READ " << chgcar1_file << endl;
5825 }
5826 if (LDEBUG) {
5827 oss << __AFLOW_FUNC__ << "CHECK FORMAT OF " << chgcar2_file << endl;
5828 }
5829 if (!pflow::ReadCHGCAR(structure2, chgcar2_header, ngrid2, format_dim2, chg_tot2, chg_diff2, chgcar2_ss, oss)) {
5830 oss << endl;
5831 oss << __AFLOW_FUNC__ << "ERROR: Input " << chgcar2_file << " format not recognized." << endl;
5832 oss << endl;
5833 return false; // CHGCAR format not recognized
5834 }
5835 if (LDEBUG) {
5836 oss << __AFLOW_FUNC__ << "SUCCESSFULLY READ " << chgcar2_file << endl;
5837 }
5838
5839 // check formats
5840 aurostd::matrix<double> lat1 = pflow::GetLat(structure1); // CO20200404 pflow::matrix()->aurostd::matrix()
5841 aurostd::matrix<double> lat2 = pflow::GetLat(structure2); // CO20200404 pflow::matrix()->aurostd::matrix()
5842 if (LDEBUG) {
5843 oss << __AFLOW_FUNC__ << "CHECK IF FORMATS OF CHGCARS MATCH" << endl;
5844 }
5845 if (format_dim1 != format_dim2) {
5846 oss << endl;
5847 oss << __AFLOW_FUNC__ << "WARNING: Format for input " << chgcar1_file << " does not match that of input " << chgcar2_file << "." << endl;
5848 oss << __AFLOW_FUNC__ << "WARNING: Using format from input " << chgcar1_file << "." << endl;
5849 oss << endl;
5850 }
5851 if (LDEBUG) {
5852 oss << __AFLOW_FUNC__ << "CHECK IF GRIDS OF CHGCARS MATCH" << endl;
5853 }
5854 if (ngrid1 != ngrid2) {
5855 oss << endl;
5856 oss << __AFLOW_FUNC__ << "ERROR: Grids for two CHGCAR's do not match. " << endl;
5857 oss << __AFLOW_FUNC__ << "ERROR: ngrid of " << chgcar1_file << ": " << ngrid1.at(0) << " " << ngrid1.at(1) << " " << ngrid1.at(2) << endl;
5858 oss << __AFLOW_FUNC__ << "ERROR: ngrid of " << chgcar2_file << ": " << ngrid2.at(0) << " " << ngrid2.at(1) << " " << ngrid2.at(2) << endl;
5859 oss << __AFLOW_FUNC__ << "ERROR: This will give nonsense. " << endl;
5860 oss << endl;
5861 return false;
5862 }
5863 if (LDEBUG) {
5864 oss << __AFLOW_FUNC__ << "CHECK IF LATTICE PARAMETERS OF CHGCARS MATCH" << endl;
5865 }
5866 if (pflow::norm(pflow::VVdiff(lat1[0], lat2[0])) > TOL || pflow::norm(pflow::VVdiff(lat1[1], lat2[1])) > TOL || pflow::norm(pflow::VVdiff(lat1[2], lat2[2])) > TOL) {
5867 oss << endl;
5868 oss << __AFLOW_FUNC__ << "WARNING: Lattice parameters for two CHGCARs do not match. " << endl;
5869 oss << __AFLOW_FUNC__ << "WARNING: lattice of " << chgcar1_file << ": " << endl;
5870 oss << __AFLOW_FUNC__ << matrix2xmatrix(lat1) << endl;
5871 oss << __AFLOW_FUNC__ << "WARNING: lattice of " << chgcar2_file << ": " << endl;
5872 oss << matrix2xmatrix(lat2) << endl;
5873 oss << __AFLOW_FUNC__ << "WARNING: This could give nonsense if there is much difference. " << endl;
5874 oss << __AFLOW_FUNC__ << "WARNING: Output will use lattice of " << chgcar1_file << "." << endl;
5875 oss << endl;
5876 }
5877 if (LDEBUG) {
5878 oss << __AFLOW_FUNC__ << "OVERALL FORMAT OF CHGCARS LOOKS OK" << endl;
5879 }
5880
5881 // Get difference
5882 const vector<double> chg_tot_2m1 = pflow::VVdiff(chg_tot1, chg_tot2);
5883 const vector<double> chg_diff_2m1 = pflow::VVdiff(chg_diff1, chg_diff2);
5884 if (LDEBUG) {
5885 oss << __AFLOW_FUNC__ << "PRINTING CHGDIFF TO " << output_file << endl;
5886 }
5887 pflow::PrintCHGCAR(structure1, chgcar1_header, ngrid1, format_dim1, chg_tot_2m1, chg_diff_2m1, output_file, oss);
5888 if (LDEBUG) {
5889 oss << __AFLOW_FUNC__ << "DONE" << endl;
5890 }
5891 oss << __AFLOW_FUNC__ << output_file << " generated." << endl;
5892 return true;
5893 }
5894} // namespace pflow
5895
5896// DX+CO START
5897// ***************************************************************************
5898// pflow::CHGINT
5899// ***************************************************************************
5900namespace pflow {
5901 void CHGINT(vector<string> argv) {
5902 ifstream chgfile(argv.at(2).c_str());
5903 xstructure str;
5904 vector<int> ngrid(3);
5905 // Read in charge
5906 vector<double> chg_tot;
5907 vector<double> chg_diff;
5908 pflow::ReadChg(str, ngrid, chg_tot, chg_diff, chgfile);
5909 // Integrate charge
5910 vector<aurostd::matrix<double>> rad_chg_int; // CO20200404 pflow::matrix()->aurostd::matrix()
5911 aurostd::matrix<double> vor_chg_int; // CO20200404 pflow::matrix()->aurostd::matrix()
5912 pflow::GetChgInt(rad_chg_int, vor_chg_int, str, ngrid, chg_tot, chg_diff);
5913 // Print results
5914 pflow::PrintChgInt(rad_chg_int, vor_chg_int, cout);
5915 }
5916} // namespace pflow
5917// DX+CO END
5918
5919// ***************************************************************************
5920// pflow::CHGSUM
5921// ***************************************************************************
5922namespace pflow {
5923 string CHGSUM(aurostd::xoption vpflow) {
5924 // handles flags for CHGSUM
5925
5926 vector<string> chgcar_files;
5927 ostringstream oss;
5928 string output_file;
5929
5930 // DEBUG
5931 const bool LDEBUG = (false || XHOST.DEBUG);
5932 if (LDEBUG) {
5933 oss << __AFLOW_FUNC__ << "BEGIN FLAGS" << endl;
5934 }
5935
5936 const string usage_usage = "aflow --chgsum=CHGCAR1,CHGCAR2,... [chgsum_options]";
5937 const string usage_options = aurostd::liststring2string("options = --usage", " --output=|-o=CHGCAR_OUT");
5938
5939 // output usage
5940 if (LDEBUG) {
5941 oss << __AFLOW_FUNC__ << "CHECK USAGE" << endl;
5942 }
5943 if (vpflow.flag("CHGSUM::USAGE")) {
5944 init::MessageOption(vpflow.getattachedscheme("CHGSUM"), "pflow::CHGSUM", aurostd::liststring2string(usage_usage, usage_options));
5945 return oss.str();
5946 }
5947
5948 // no input
5949 vector<string> input_tokens;
5950 if (LDEBUG) {
5951 oss << __AFLOW_FUNC__ << "CHECK INPUT" << endl;
5952 }
5953 if (!vpflow.flag("CHGSUM")) {
5954 oss << endl;
5955 oss << __AFLOW_FUNC__ << "ERROR: No input given." << endl;
5956 oss << __AFLOW_FUNC__ << "Exiting." << endl;
5957 oss << endl;
5958 oss << endl;
5959 return oss.str();
5960 }
5961
5962 // check inputs
5963 string misc_option;
5964 if (LDEBUG) {
5965 oss << __AFLOW_FUNC__ << "vpflow.getattachedscheme(\"CHGSUM\")=" << vpflow.getattachedscheme("CHGSUM") << endl;
5966 }
5967 misc_option = vpflow.getattachedscheme("CHGSUM");
5968 aurostd::string2tokens(misc_option, input_tokens, ",");
5969 if (input_tokens.size() < 2) {
5970 oss << endl;
5971 oss << __AFLOW_FUNC__ << "ERROR: Incorrect input arguments. List at least two CHGCARs separated by commas." << endl;
5972 oss << __AFLOW_FUNC__ << "Exiting." << endl;
5973 oss << endl;
5974 return oss.str();
5975 } else {
5976 // get inputs
5977 for (size_t i = 0; i < input_tokens.size(); i++) {
5978 chgcar_files.push_back(input_tokens[i]);
5979 }
5980 }
5981
5982 // get output, if specified (or standardize)
5983 if (!vpflow.flag("CHGSUM::OUTPUT")) {
5984 output_file = "aflow_CHGSUM.out";
5985 } else {
5986 output_file = vpflow.getattachedscheme("CHGSUM::OUTPUT");
5987 }
5988 if (LDEBUG) {
5989 oss << __AFLOW_FUNC__ << "CHGCAR_OUT=" << output_file << endl;
5990 }
5991 CHGSUM(chgcar_files, output_file, oss);
5992 return oss.str();
5993 }
5994} // namespace pflow
5995
5996// ***************************************************************************
5997// pflow::CHGSUM
5998// ***************************************************************************
5999namespace pflow {
6000 bool CHGSUM(const string& chgcar_in1, const string& chgcar_in2, ostream& oss) {
6001 // 2 INPUTS, NO OUTPUT
6002 const string output_file = "aflow_chgsum.out";
6003 return CHGSUM(chgcar_in1, chgcar_in2, output_file, oss);
6004 }
6005} // namespace pflow
6006
6007// ***************************************************************************
6008// pflow::CHGSUM
6009// ***************************************************************************
6010namespace pflow {
6011 bool CHGSUM(string& species_header, const string& chgcar_in1, const string& chgcar_in2, const string& output_file, ostream& oss) {
6012 // 2 INPUTS WITH SPECIES_HEADER
6013 vector<string> chgcar_files;
6014 chgcar_files.push_back(chgcar_in1);
6015 chgcar_files.push_back(chgcar_in2);
6016 return CHGSUM(species_header, chgcar_files, output_file, oss);
6017 }
6018} // namespace pflow
6019
6020// ***************************************************************************
6021// pflow::CHGSUM
6022// ***************************************************************************
6023namespace pflow {
6024 bool CHGSUM(const string& chgcar_in1, const string& chgcar_in2, const string& output_file, ostream& oss) {
6025 // 2 INPUTS, NO SPECIES_HEADER
6026 string species_header;
6027 return CHGSUM(species_header, chgcar_in1, chgcar_in2, output_file, oss);
6028 }
6029} // namespace pflow
6030
6031// ***************************************************************************
6032// pflow::CHGSUM
6033// ***************************************************************************
6034namespace pflow {
6035 bool CHGSUM(const vector<string>& chgcar_files, ostream& oss) {
6036 // VECTOR INPUT, NO SPECIES_HEADER OR OUTPUT
6037 string species_header;
6038 return CHGSUM(species_header, chgcar_files, oss);
6039 }
6040} // namespace pflow
6041
6042// ***************************************************************************
6043// pflow::CHGSUM
6044// ***************************************************************************
6045namespace pflow {
6046 bool CHGSUM(const vector<string>& chgcar_files, const string& output_file, ostream& oss) {
6047 // VECTOR INPUT, NO SPECIES_HEADER
6048 string species_header;
6049 return CHGSUM(species_header, chgcar_files, output_file, oss);
6050 }
6051} // namespace pflow
6052
6053// ***************************************************************************
6054// pflow::CHGSUM
6055// ***************************************************************************
6056namespace pflow {
6057 bool CHGSUM(string& species_header, const vector<string>& chgcar_files, ostream& oss) {
6058 // VECTOR INPUT, NO OUTPUT
6059 const string output_file = "aflow_chgsum.out";
6060 return CHGSUM(species_header, chgcar_files, output_file, oss);
6061 }
6062} // namespace pflow
6063
6064// ***************************************************************************
6065// pflow::CHGSUM
6066// ***************************************************************************
6067namespace pflow {
6068 bool CHGSUM(string& species_header, const vector<string>& chgcar_files, const string& output_file, ostream& oss) {
6069 // RETURNS CHGCAR_OUT=\sum CHGCAR_INPUTs
6070 // Read in CHGCAR or AECCAR files
6071 // format_dim is as follows: numcolumns chg_tot, npts and numcolumns for
6072 // augmentation occupancies, numcolumns chg_diff, npts and numcolumns for
6073 // augmentation occupancies
6074
6075 const double TOL = 1e-5;
6076 xstructure structure1;
6077 xstructure structure2;
6078 stringstream chgcar_ss;
6079 stringstream chgcar1_header;
6080 stringstream chgcar2_header;
6081
6082 // DEBUG
6083 const bool LDEBUG = (false || XHOST.DEBUG);
6084 if (LDEBUG) {
6085 oss << __AFLOW_FUNC__ << "BEGIN FUNCTION" << endl;
6086 }
6087
6088 for (size_t i = 0; i < chgcar_files.size(); i++) {
6089 if (!aurostd::FileExist(chgcar_files[i])) {
6090 oss << endl;
6091 oss << __AFLOW_FUNC__ << "ERROR: " << chgcar_files[i] << " does not exist." << endl;
6092 oss << __AFLOW_FUNC__ << "Exiting." << endl;
6093 oss << endl;
6094 return false;
6095 }
6096 if (LDEBUG) {
6097 oss << __AFLOW_FUNC__ << "CHGCAR_IN_" << i + 1 << "=" << chgcar_files[i] << endl;
6098 }
6099 }
6100
6101 // read first chgcar
6102 vector<int> ngrid1(3);
6103 vector<int> ngrid2(3);
6104 vector<int> format_dim1;
6105 vector<int> format_dim2;
6106 vector<double> chg_tot1;
6107 vector<double> chg_tot2;
6108 vector<double> chg_diff1;
6109 vector<double> chg_diff2;
6111 aurostd::matrix<double> lat2; // CO20200404 pflow::matrix()->aurostd::matrix()
6112
6113 if (LDEBUG) {
6114 oss << __AFLOW_FUNC__ << "CHECK " << chgcar_files.at(0) << endl;
6115 }
6116 aurostd::compressfile2stringstream(chgcar_files.at(0), chgcar_ss);
6117 if (!pflow::ReadCHGCAR(structure1, chgcar1_header, ngrid1, format_dim1, chg_tot1, chg_diff1, chgcar_ss, oss)) {
6118 oss << endl;
6119 oss << __AFLOW_FUNC__ << "ERROR: Input " << chgcar_files.at(0) << " format not recognized." << endl;
6120 oss << __AFLOW_FUNC__ << "Exiting." << endl;
6121 oss << endl;
6122 return false; // CHGCAR format not recognized
6123 }
6124 if (LDEBUG) {
6125 oss << __AFLOW_FUNC__ << "SUCCESSFULLY READ " << chgcar_files.at(0) << endl;
6126 }
6127
6128 // for later checks
6129 lat1 = pflow::GetLat(structure1);
6130
6131 // scroll through other structures
6132 for (size_t i = 1; i < chgcar_files.size(); i++) {
6133 chgcar_ss.str("");
6134 // structure2.~xstructure();
6135 chgcar2_header.str("");
6136 ngrid2.clear();
6137 format_dim2.clear();
6138 chg_tot2.clear();
6139 chg_diff2.clear();
6140
6141 if (LDEBUG) {
6142 oss << __AFLOW_FUNC__ << "CHECK " << chgcar_files.at(i) << endl;
6143 }
6144 aurostd::compressfile2stringstream(chgcar_files.at(i), chgcar_ss);
6145 if (!pflow::ReadCHGCAR(structure2, chgcar2_header, ngrid2, format_dim2, chg_tot2, chg_diff2, chgcar_ss, oss)) {
6146 oss << endl;
6147 oss << __AFLOW_FUNC__ << "ERROR: Input " << chgcar_files.at(i) << " format not recognized." << endl;
6148 oss << __AFLOW_FUNC__ << "Exiting." << endl;
6149 oss << endl;
6150 return false; // CHGCAR format not recognized
6151 }
6152 if (LDEBUG) {
6153 oss << __AFLOW_FUNC__ << "SUCCESSFULLY READ CHGCAR_INPUT_" << i << endl;
6154 }
6155 lat2 = pflow::GetLat(structure2);
6156
6157 // check formats
6158 if (LDEBUG) {
6159 oss << __AFLOW_FUNC__ << "CHECK IF FORMATS OF " << chgcar_files.at(0) << " and " << chgcar_files.at(i) << " MATCH" << endl;
6160 }
6161 if (format_dim1 != format_dim2) {
6162 oss << endl;
6163 oss << __AFLOW_FUNC__ << "WARNING: Format for " << chgcar_files.at(0) << " does not match that of " << chgcar_files.at(i) << "." << endl;
6164 oss << __AFLOW_FUNC__ << "WARNING: Using format from " << chgcar_files.at(0) << "." << endl;
6165 oss << endl;
6166 }
6167 if (LDEBUG) {
6168 oss << __AFLOW_FUNC__ << "CHECK IF GRIDS OF " << chgcar_files.at(0) << " and " << chgcar_files.at(i) << " MATCH" << endl;
6169 }
6170 if (ngrid1 != ngrid2) {
6171 oss << endl;
6172 oss << __AFLOW_FUNC__ << "ERROR: Grid for " << chgcar_files.at(0) << " does not match that of " << chgcar_files.at(i) << "." << endl;
6173 oss << __AFLOW_FUNC__ << "ERROR: ngrid of " << chgcar_files.at(0) << ": " << ngrid1.at(0) << " " << ngrid1.at(1) << " " << ngrid1.at(2) << endl;
6174 oss << __AFLOW_FUNC__ << "ERROR: ngrid of " << chgcar_files.at(i) << ": " << ngrid2.at(0) << " " << ngrid2.at(1) << " " << ngrid2.at(2) << endl;
6175 oss << __AFLOW_FUNC__ << "ERROR: This will give nonsense." << endl;
6176 oss << __AFLOW_FUNC__ << "Exiting." << endl;
6177 oss << endl;
6178 return false;
6179 }
6180 if (LDEBUG) {
6181 oss << __AFLOW_FUNC__ << "CHECK IF LATTICE PARAMETERS OF " << chgcar_files.at(0) << " and " << chgcar_files.at(i) << " MATCH" << endl;
6182 }
6183 if (pflow::norm(pflow::VVdiff(lat1[0], lat2[0])) > TOL || pflow::norm(pflow::VVdiff(lat1[1], lat2[1])) > TOL || pflow::norm(pflow::VVdiff(lat1[2], lat2[2])) > TOL) {
6184 oss << endl;
6185 oss << __AFLOW_FUNC__ << "WARNING: Lattice parameters for " << chgcar_files.at(0) << " and " << chgcar_files.at(i) << " do not match. " << endl;
6186 oss << __AFLOW_FUNC__ << "WARNING: lattice of " << chgcar_files.at(0) << ": " << endl;
6187 oss << __AFLOW_FUNC__ << matrix2xmatrix(lat1) << endl;
6188 oss << __AFLOW_FUNC__ << "WARNING: lattice " << chgcar_files.at(i) << ": " << endl;
6189 oss << matrix2xmatrix(lat2) << endl;
6190 oss << __AFLOW_FUNC__ << "WARNING: This could give nonsense if there is much difference." << endl;
6191 oss << __AFLOW_FUNC__ << "WARNING: Output will use lattice of " << chgcar_files.at(0) << "." << endl;
6192 oss << endl;
6193 }
6194 if (LDEBUG) {
6195 oss << __AFLOW_FUNC__ << "OVERALL FORMAT OF " << chgcar_files.at(i) << " LOOKS OK" << endl;
6196 }
6197
6198 // Get sum
6199 chg_tot1 = pflow::VVsum(chg_tot1, chg_tot2);
6200 chg_diff1 = pflow::VVsum(chg_diff1, chg_diff2);
6201 }
6202
6203 if (LDEBUG) {
6204 oss << __AFLOW_FUNC__ << "PRINTING CHGSUM TO " << output_file << endl;
6205 }
6206
6207 // EDIT CHGCAR_HEADER1 FORMATTING FOR BADER
6208 if (!species_header.empty()) {
6209 bader_functions::adjust_header(species_header, chgcar1_header);
6210 } // CO20180627
6211
6212 // print chgcar
6213 pflow::PrintCHGCAR(structure1, chgcar1_header, ngrid1, format_dim1, chg_tot1, chg_diff1, output_file, oss);
6214 if (LDEBUG) {
6215 oss << __AFLOW_FUNC__ << "DONE" << endl;
6216 }
6217 oss << __AFLOW_FUNC__ << output_file << " generated." << endl;
6218 return true;
6219 }
6220} // namespace pflow
6221
6222// ***************************************************************************
6223// pflow::CIF
6224// ***************************************************************************
6225namespace pflow {
6226 void CIF(istream& input, aurostd::xoption& vpflow) {
6227 if (vpflow.flag("CIF::USAGE")) {
6228 init::MessageOption("--usage", "pflow::CIF",
6229 aurostd::liststring2string("aflow --cif[=<tolerance_value>|=tight|=loose] [--setting=1|2|aflow] [--no_symmetry] < POSCAR default: tolerance=(minimum_interatomic_distance)/100.0, "
6230 "setting=1"));
6231 return;
6232 }
6233 xstructure a(input, IOAFLOW_AUTO);
6234 a.ReScale(1.0); // DX20190123 - rescale to 1.0
6235 bool no_symmetry = false;
6236 if (vpflow.flag("CIF::NO_SYMMETRY")) {
6237 no_symmetry = true;
6238 }
6239 // DX20180803 - consider space group - pflow::PrintCIF(cout,a);
6240 if (no_symmetry) {
6241 pflow::PrintCIF(cout, a, 1); // DX20180803 - add space group information
6242 } else {
6243 // put tolerance flag check in loop to save time if we aren't calculating, defaultTolerance can be expensive
6244 double tolerance = pflow::getSymmetryTolerance(a, vpflow.getattachedscheme("CIF::TOLERANCE")); // DX20200820 - consolidated setting tolerance into a function
6245 const uint setting = pflow::getSpaceGroupSetting(vpflow.getattachedscheme("CIF::SETTING")); // DX20210421 - consolidated space group setting into function
6246 if (vpflow.flag("DATA::NO_SCAN")) {
6247 a.sym_eps_no_scan = true;
6248 } // DX20210611
6249 a.spacegroupnumber = a.SpaceGroup_ITC(tolerance, -1, setting, a.sym_eps_no_scan); // DX20210611 - added no_scan
6250 a.lattice = a.standard_lattice_ITC; // DX20180904 - need to update the lattice; may have rotated
6251 pflow::PrintCIF(cout, a, a.spacegroupnumber, setting); // DX20180803 - add space group information
6252 }
6253 }
6254} // namespace pflow
6255
6256// ***************************************************************************
6257// pflow::getCIFSettings
6258// ***************************************************************************
6259namespace pflow {
6264 void getCIFOptions(xstructure& a, aurostd::xoption& vpflow) {
6265 if (vpflow.flag("CIF::USAGE")) {
6266 init::MessageOption("--usage", "pflow::CIF",
6267 aurostd::liststring2string("aflow --cif[=<tolerance_value>|=tight|=loose] [--setting=1|2|aflow] [--no_symmetry] < POSCAR default: tolerance=(minimum_interatomic_distance)/100.0, "
6268 "setting=1"));
6269 return;
6270 }
6271 if (vpflow.flag("CIF::NO_SYMMETRY")) {
6272 a.spacegroupnumber = 1; // force to CIF to print as P1 structure
6273 }
6274 // put tolerance flag check in loop to save time if we aren't calculating, defaultTolerance can be expensive
6275 a.sym_eps = pflow::getSymmetryTolerance(a, vpflow.getattachedscheme("CIF::TOLERANCE"));
6276 a.setting_ITC = pflow::getSpaceGroupSetting(vpflow.getattachedscheme("CIF::SETTING"));
6277 if (vpflow.flag("DATA::NO_SCAN")) {
6278 a.sym_eps_no_scan = true;
6279 }
6280 }
6281} // namespace pflow
6282
6283// ***************************************************************************
6284// pflow::CLAT
6285// ***************************************************************************
6286namespace pflow {
6287 void CLAT(const string& options) {
6288 const bool LDEBUG = (false || XHOST.DEBUG);
6289 if (LDEBUG) {
6290 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
6291 }
6292 vector<string> tokens;
6293 aurostd::string2tokens(options, tokens, ",");
6294 if (tokens.size() != 6) {
6295 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --clat=a,b,c,alpha,beta,gamma");
6296 }
6297 const xvector<double> data(6);
6298 if (!tokens.empty()) {
6299 data[1] = aurostd::string2utype<double>(tokens[0]);
6300 }
6301 if (tokens.size() >= 2) {
6302 data[2] = aurostd::string2utype<double>(tokens[1]);
6303 }
6304 if (tokens.size() >= 3) {
6305 data[3] = aurostd::string2utype<double>(tokens[2]);
6306 }
6307 if (tokens.size() >= 4) {
6308 data[1] = aurostd::string2utype<double>(tokens[3]);
6309 }
6310 if (tokens.size() >= 5) {
6311 data[2] = aurostd::string2utype<double>(tokens[4]);
6312 }
6313 if (tokens.size() >= 6) {
6314 data[3] = aurostd::string2utype<double>(tokens[5]);
6315 }
6316 cout << aflow::Banner("BANNER_TINY") << endl;
6317 pflow::PrintClat(data, cout);
6318 if (LDEBUG) {
6319 cerr << __AFLOW_FUNC__ << " END" << endl;
6320 }
6321 }
6322} // namespace pflow
6323
6324// ***************************************************************************
6325// pflow::CLEANALL
6326// ***************************************************************************
6327namespace pflow {
6328 void CLEANALL(istream& input) {
6329 vector<string> vinput;
6330 aurostd::stream2vectorstring(input, vinput);
6331 for (size_t iinput = 0; iinput < vinput.size(); iinput++) {
6332 cout << vinput[iinput] << endl;
6333 }
6334 }
6335} // namespace pflow
6336
6337// ***************************************************************************
6338// pflow::CMPSTR
6339// ***************************************************************************
6340namespace pflow {
6341 void CMPSTR(vector<string> argv) {
6342 cout << aflow::Banner("BANNER_TINY") << endl;
6343 // Read in input file.
6344 ifstream infile1(argv.at(2).c_str());
6345 ifstream infile2(argv.at(3).c_str());
6346 const double rcut = atof(argv.at(4).c_str());
6347 xstructure str1;
6348 xstructure str2;
6349 infile1 >> str1;
6350 infile2 >> str2;
6351 pflow::PrintCmpStr(str1, str2, rcut, cout);
6352 }
6353} // namespace pflow
6354
6355// ***************************************************************************
6356// pflow::COMPARE
6357// ***************************************************************************
6358namespace pflow {
6359 void COMPARE(const string& options) {
6360 const bool LDEBUG = (false || XHOST.DEBUG);
6361 if (LDEBUG) {
6362 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
6363 }
6364 vector<string> tokens;
6365 aurostd::string2tokens(options, tokens, ",");
6366 if (tokens.size() != 12) {
6367 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --compare=a,b,c,d,e,f,g,h,k,j,i,l");
6368 }
6369 const xvector<double> aa(12);
6370 for (int i = 1; i <= 12; i++) {
6371 aa(i) = aurostd::string2utype<double>(tokens.at(i - 1));
6372 }
6373 double bb1 = 0.0;
6374 double bb2 = 0.0;
6375 double bb3 = 0.0;
6376 double bb4 = 0.0;
6377 double bb5 = 0.0;
6378 double bb6 = 0.0;
6379 cout << "PERCENTAGES" << " ";
6380 cout << (bb1 = 100 * std::abs(aa(1) - aa(7)) / ((aa(1) + aa(7)) / 2.0)) << " ";
6381 cout << (bb2 = 100 * std::abs(aa(2) - aa(8)) / ((aa(2) + aa(8)) / 2.0)) << " ";
6382 cout << (bb3 = 100 * std::abs(aa(3) - aa(9)) / ((aa(3) + aa(9)) / 2.0)) << " ";
6383 cout << (bb4 = 100 * std::abs(aa(4) - aa(10)) / ((aa(4) + aa(10)) / 2.0)) << " ";
6384 cout << (bb5 = 100 * std::abs(aa(5) - aa(11)) / ((aa(5) + aa(11)) / 2.0)) << " ";
6385 cout << (bb6 = 100 * std::abs(aa(6) - aa(12)) / ((aa(6) + aa(12)) / 2.0)) << " ";
6386 cout << endl;
6387 cout << "MIN " << min(bb1, min(bb2, min(bb3, min(bb4, min(bb5, bb6))))) << endl;
6388 cout << "MAX " << max(bb1, max(bb2, max(bb3, max(bb4, max(bb5, bb6))))) << endl;
6389 }
6390} // namespace pflow
6391
6392// ***************************************************************************
6393// pflow::CORNERS
6394// ***************************************************************************
6395// Stefano Curtarolo (Dec-2009)
6396namespace pflow {
6397 xstructure CORNERS(istream& input) {
6398 xstructure a(input, IOAFLOW_AUTO);
6399 a.AddCorners();
6400 return a;
6401 }
6402} // namespace pflow
6403
6404// ***************************************************************************
6405// pflow::CPRIM
6406// ***************************************************************************
6407// Stefano Curtarolo (Dec-2009)
6408namespace pflow {
6409 xstructure CPRIM(istream& input) {
6410 cerr << XPID << "pflow::CPRIM: THIS IS A DEBUG FUNCTION FOR CODING PURPOSES" << endl;
6411 const xstructure str_in(input, IOAFLOW_AUTO);
6412 xstructure str_sp;
6413 xstructure str_sc;
6414 // str_in.SetCoordinates(_COORDS_CARTESIAN_);
6415 const bool full_sym = false; // DX20170829 - Speed increase
6416 LATTICE::Standard_Lattice_Structure(str_in, str_sp, str_sc, full_sym); // DX20170829 - Speed increase
6417 cerr << "ORIGINAL" << endl;
6418 cerr << Getabc_angles(str_in.lattice, DEGREES) << endl;
6419 cerr << str_in;
6420 cerr << "STANDARD_PRIMITIVE" << endl;
6421 cerr << Getabc_angles(str_sp.lattice, DEGREES) << endl;
6422 cerr << str_sp;
6423 cerr << "STANDARD_CONVENTIONAL" << endl;
6424 cerr << Getabc_angles(str_sc.lattice, DEGREES) << endl;
6425 cerr << str_sc;
6426 return str_sp;
6427 }
6428} // namespace pflow
6429
6430// ***************************************************************************
6431// pflow::DATA()
6432// ***************************************************************************
6433// Determines the crystallographic data (lattice data or extended)
6434// Stefano Curtarolo
6435// Updated by David Hicks (DX) //DX20210302
6436// Added separated real, reciprocal, and superlattice analyses
6437// Moved SGDATA() inside
6438namespace pflow {
6439 bool DATA(istream& input, const aurostd::xoption& vpflow, const string& smode, ostream& oss) {
6440 const bool LDEBUG = (false || XHOST.DEBUG);
6441
6442 if (LDEBUG) {
6443 cerr << __AFLOW_FUNC__ << " BEGIN: smode=" << smode << endl;
6444 }
6445
6446 // ---------------------------------------------------------------------------
6447 // usage
6448 if (vpflow.flag("DATA::USAGE")) {
6449 // main command
6450 string usage;
6451 if (smode == "DATA") {
6452 usage = "aflow --data";
6453 } else if (smode == "CRYSTAL_POINT_GROUP") {
6454 usage = "aflow --point_group_crystal_data|--pointgroup_crystal_data|--pgroupxtal_data|--pgroup_xtal_data[=<tolerance_value>|=tight|=loose]";
6455 } else if (smode == "EDATA") {
6456 usage = "aflow --edata[=<tolerance_value>|=tight|=loose]";
6457 } else if (smode == "REAL_LATTICE") {
6458 usage = "aflow --lattice_data|--data_lattice|--real_lattice_data|--data_real_lattice[=<tolerance_value>|=tight|=loose]";
6459 } else if (smode == "RECIPROCAL_LATTICE") {
6460 usage = "aflow --reciprocal_lattice_data|--reciprocallattice_data|--klattice_data|--data_reciprocal_lattice[=<tolerance_value>|=tight|=loose]";
6461 } else if (smode == "SGDATA") {
6462 usage = "aflow --sgdata|--space_group_data[=<tolerance_value>|=tight|=loose]";
6463 } else if (smode == "SUPERLATTICE") {
6464 usage = "aflow --superlattice_data|--data_superlattice[=<tolerance_value>|=tight|=loose]";
6465 }
6466
6467 // options
6468 string options = "options: [--no_scan] [--print=txt|json]";
6469 if (smode == "EDATA" || smode == "SGDATA") {
6470 options += " [--setting=1|2|aflow] [--suppress_Wyckoff|--suppress_Wyckoff_printing|--suppress_wyckoff|--suppress_wyckoff_printing] [--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]]";
6471 }
6472 vector<string> voptions;
6473 aurostd::string2tokens(options, voptions, " ");
6474 voptions.insert(voptions.begin(), usage);
6475
6476 init::MessageOption("--usage", "pflow::DATA()", voptions);
6477 return true; // CO20200624 - the option was expressed successfully
6478 }
6479
6480 // ---------------------------------------------------------------------------
6481 // load structure
6482 xstructure a(input, IOAFLOW_AUTO);
6483 a.ReScale(1.0);
6484
6485 // ---------------------------------------------------------------------------
6486 // get directory info
6487 if (a.directory.empty()) {
6488 a.directory = aurostd::getPWD();
6489 }
6490
6491 // ---------------------------------------------------------------------------
6492 // get magnetic moment information
6493 if (vpflow.flag("DATA::MAGNETIC")) {
6494 const string magmom_info = vpflow.getattachedscheme("DATA::MAGNETIC");
6495 ProcessAndAddSpinToXstructure(a, magmom_info); // DX20191108 - condensed into a single function
6496 }
6497
6498 // ---------------------------------------------------------------------------
6499 // get tolerance
6500 const double tolerance = pflow::getSymmetryTolerance(a, vpflow.getattachedscheme("DATA::TOLERANCE")); // DX20200820 - consolidated setting tolerance into a function
6501
6502 // ---------------------------------------------------------------------------
6503 // get space group setting
6504 const uint setting = pflow::getSpaceGroupSetting(vpflow.getattachedscheme("DATA::SETTING")); // DX20210421 - consolidated space group setting into function
6505
6506 // ---------------------------------------------------------------------------
6507 // file type //DX20210226 - string to filetype
6508 filetype ftype = txt_ft;
6509 if (XHOST.vflag_control.flag("PRINT_MODE::TXT")) {
6510 ftype = txt_ft;
6511 } else if (XHOST.vflag_control.flag("PRINT_MODE::JSON")) {
6512 ftype = json_ft;
6513 }
6514
6515 // ---------------------------------------------------------------------------
6516 // self-consistent tolerance scan
6517 if (vpflow.flag("DATA::NO_SCAN")) {
6518 a.sym_eps_no_scan = true;
6519 } // DX20210406
6520
6521 // ---------------------------------------------------------------------------
6522 // SGDATA: do not print all Wyckoff data (useful for web) //DX20210301
6523 const bool suppress_Wyckoff = (vpflow.flag("DATA::SUPPRESS_WYCKOFF_PRINTING") || XHOST.vflag_control.flag("WWW"));
6524
6525 // ---------------------------------------------------------------------------
6526 // add banner // ME20210402 - but not for web
6527 if (ftype == txt_ft && !XHOST.vflag_control.flag("WWW")) {
6528 cout << aflow::Banner("BANNER_TINY") << endl;
6529 }
6530
6531 // ---------------------------------------------------------------------------
6532 // perform relevant analysis
6533 const bool already_calculated = false;
6534 const bool standalone = true;
6535 if (smode == "EDATA" || smode == "DATA") {
6536 oss << PrintData(a, smode, ftype, already_calculated, tolerance, a.sym_eps_no_scan, setting);
6537 } else if (smode == "REAL_LATTICE") {
6538 oss << PrintRealLatticeData(a, "EDATA", ftype, standalone, already_calculated, tolerance);
6539 } else if (smode == "CRYSTAL_POINT_GROUP") {
6540 oss << PrintCrystalPointGroupData(a, ftype, standalone, already_calculated, tolerance);
6541 } else if (smode == "SUPERLATTICE") {
6542 oss << PrintSuperlatticeData(a, ftype, standalone, already_calculated, tolerance);
6543 } else if (smode == "RECIPROCAL_LATTICE") {
6544 oss << PrintReciprocalLatticeData(a, ftype, standalone, already_calculated, tolerance);
6545 } else if (smode == "SGDATA") {
6546 oss << pflow::PrintSGData(a, ftype, standalone, already_calculated, tolerance, a.sym_eps_no_scan, setting, suppress_Wyckoff);
6547 }
6548
6549 return true;
6550 }
6551} // namespace pflow
6552
6553// ***************************************************************************
6554// pflow::DISP
6555// ***************************************************************************
6556namespace pflow {
6557 void DISP(const string& options, istream& input) {
6558 const bool LDEBUG = (false || XHOST.DEBUG);
6559 if (LDEBUG) {
6560 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
6561 }
6562 vector<string> tokens;
6563 aurostd::string2tokens(options, tokens, ",");
6564 if (tokens.size() != 1) {
6565 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --disp=cutoff < POSCAR");
6566 }
6567 double cutoff = 0.0;
6568 if (!tokens.empty()) {
6569 cutoff = aurostd::string2utype<double>(tokens[0]);
6570 }
6571 const xstructure a(input, IOAFLOW_AUTO);
6572 cout << aflow::Banner("BANNER_TINY") << endl;
6573 pflow::PrintDisplacements(a, cutoff, cout);
6574 if (LDEBUG) {
6575 cerr << __AFLOW_FUNC__ << " END" << endl;
6576 }
6577 }
6578} // namespace pflow
6579
6580// ***************************************************************************
6581// pflow::DIST
6582// ***************************************************************************
6583namespace pflow {
6584 void DIST(const string& options, istream& input) {
6585 const bool LDEBUG = (false || XHOST.DEBUG);
6586 if (LDEBUG) {
6587 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
6588 }
6589 vector<string> tokens;
6590 aurostd::string2tokens(options, tokens, ",");
6591 if (tokens.size() != 1) {
6592 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --dist=cutoff < POSCAR");
6593 }
6594 double cutoff = 0.0;
6595 if (!tokens.empty()) {
6596 cutoff = aurostd::string2utype<double>(tokens[0]);
6597 }
6598 const xstructure a(input, IOAFLOW_AUTO);
6599 cout << aflow::Banner("BANNER_TINY") << endl;
6600 pflow::PrintDistances(a, cutoff, cout);
6601 if (LDEBUG) {
6602 cerr << __AFLOW_FUNC__ << " END" << endl;
6603 }
6604 }
6605} // namespace pflow
6606
6607// // ***************************************************************************
6608// // pflow::DYNADIEL // CAMILO
6609// // ***************************************************************************
6610// namespace pflow {
6611// void DYNADIEL(vector<string>& argv) { // loop pflow::DYNADIEL
6612// // modify this for the spectrum
6613// string outcar ;
6614// xvector<double> real(3), imag(3) ;
6615//
6616// if(argv.size() != 3)
6617// { // user control lines - aflow specific.
6618// init::ErrorOption("","pflow::DYNADIEL","aflow --dynadiel OUTCAR*");
6619// }
6620// outcar = argv.at(2) ;
6621// KBIN::GetDynaDiel(outcar, real, imag) ;
6622// } // loop pflow::DYNADIEL
6623// }
6624
6625// ***************************************************************************
6626// pflow::EDOS
6627// ***************************************************************************
6628namespace pflow {
6629 void EDOS(vector<string> argv) {
6630 // 2008 wahyu setyawan ws26@duke.edu
6631 // 2008 roman chepulskyy rc74@duke.edu
6632#define _MAXSPECIES_ 10
6633 // cout << " udos -h : help\n"
6634 // << " udos 1 s p : nonspin, includes s and p orbitals\n"
6635 // << " udos 2 s p d f : spin-polarized, includes s,p,d,and f orbitals.\n\n"
6636 // << " OUTPUT format:\n"
6637 // << " udos 1\n"
6638 // << " energy DOS\n"
6639 // << " udos 2\n"
6640 // << " energy DOSup DOSdown\n"
6641 // << " udos 2 f\n"
6642 // << " energy fDOSup_elemnt1 fDOSdown_elemnt1 ... fDOSup_elmntN fDOSdown_elmntN\n"
6643 // << " udos 2 s d\n"
6644 // << " energy sDOSup_elmnt1 sDOSdown_elmnt1 ... sDOSup_elmntN sDOSdown_elmntN dDOSup_elmnt1 dDOSdown_elmnt1 .. dDOSup_elmntN dDOSdown_elmntN"
6645 // << " udos 2 d s\n"
6646 // << " energy sDOSup_elmnt1 sDOSdown_elmnt1 ... sDOSup_elmntN sDOSdown_elmntN dDOSup_elmnt1 dDOSdown_elmnt1 .. dDOSup_elmntN dDOSdown_elmntN"
6647 // << " udos 2 s p d f\n"
6648 // << " energy DOSup DOSdown sDOSup_elmnt1 sDOSdown_elmnt1 ...sDOSup_elmntN sDOSdown_elmntN ... fDOSup_elmntN fDOSdown_elmntN\n\n"
6649 // << " "
6650 // << " note: DOS for spin down is given in (negative) sign.\n"
6651 // << " Splitting of the elements(or species) is according to POSCAR.\n";
6652
6653 const int argc = argv.size();
6654 if (argc == 2) {
6655 return;
6656 }
6657 if (!(atoi(&argv.at(2)[0]) == 1 or atoi(&argv.at(2)[0]) == 2)) {
6658 return;
6659 }
6660
6661 bool DO_S;
6662 bool DO_P;
6663 bool DO_D;
6664 bool DO_F;
6665 int i;
6666 int j;
6667 int itmp;
6668 int ispin;
6669 int natom;
6670 int nE;
6671 int ncol;
6672 int k;
6673 int ioffset;
6674 int iorb;
6675 int maxOrbital = 0;
6676 int nspec;
6677 int species[_MAXSPECIES_ + 1];
6678 float minE;
6679 float maxE;
6680 float Efermi;
6681 float ftmp;
6682 string tmpstr;
6683 ifstream pin;
6684 ifstream din;
6685
6686 ispin = atoi(&argv.at(2)[0]);
6687 if (!(ispin == 1 or ispin == 2)) {
6688 return;
6689 }
6690
6691 DO_S = false;
6692 DO_P = false;
6693 DO_D = false;
6694 DO_F = false;
6695
6696 if (argc > 3) {
6697 for (i = 3; i < argc; i++) {
6698 if (argv.at(i)[0] == 's' or argv.at(i)[0] == 'S') {
6699 DO_S = true;
6700 }
6701 if (argv.at(i)[0] == 'p' or argv.at(i)[0] == 'P') {
6702 DO_P = true;
6703 }
6704 if (argv.at(i)[0] == 'd' or argv.at(i)[0] == 'D') {
6705 DO_D = true;
6706 }
6707 if (argv.at(i)[0] == 'f' or argv.at(i)[0] == 'F') {
6708 DO_F = true;
6709 }
6710 }
6711 }
6712 // getting number of each species from POSCAR to accumulate s,p,d,f atomic DOS
6713 pin.open("POSCAR");
6714 for (i = 1; i <= 5; i++) {
6715 getline(pin, tmpstr);
6716 }
6717 i = 0;
6718 j = 0;
6719 pin >> tmpstr;
6720 do {
6721 species[++i] = atoi(&tmpstr[0]);
6722 pin >> tmpstr;
6723 } while (atoi(&tmpstr[0]) > 0);
6724 nspec = i;
6725 pin.close();
6726 // processing DOSCAR
6727 din.open("DOSCAR");
6728 din >> natom;
6729 itmp = 0;
6730 for (i = 1; i <= nspec; i++) {
6731 itmp += species[i];
6732 }
6733 if (itmp != natom) {
6734 cerr << "DOSCAR is INcompatible with POSCAR\n";
6735 return;
6736 }
6737 getline(din, tmpstr);
6738 getline(din, tmpstr);
6739 getline(din, tmpstr);
6740 getline(din, tmpstr);
6741 getline(din, tmpstr);
6742 din >> maxE >> minE >> nE >> Efermi;
6743 getline(din, tmpstr);
6744 // energy loop for DOS
6745 // only DOS will be considered and written out because the Integrated DOS
6746 // can be calculated from DOS and energy bins
6747 ncol = 1;
6748 if (DO_S) {
6749 ncol = 1 + 1 * nspec;
6750 }
6751 if (DO_P) {
6752 ncol = 1 + 2 * nspec;
6753 }
6754 if (DO_D) {
6755 ncol = 1 + 3 * nspec;
6756 }
6757 if (DO_F) {
6758 ncol = 1 + 4 * nspec;
6759 }
6760 if (ispin) {
6761 ncol = ncol * 2;
6762 }
6763 ncol++;
6764 const xmatrix<float> EDOS(nE, ncol);
6765 for (i = 1; i <= nE; i++) {
6766 din >> EDOS[i][1] >> EDOS[i][2];
6767 if (ispin == 2) {
6768 din >> EDOS[i][3];
6769 }
6770 getline(din, tmpstr);
6771 }
6772 // energy loop for DOS for s,p,d,f
6773 // sum over all atoms for the same SPECIES!
6774 // note that we read up to the highest between s,p,d,f
6775 // even though not all of them will be outputed
6776 // We will output only the orbitals that are requested
6777 // at the prompt input.
6778 if (DO_S) {
6779 maxOrbital = 1;
6780 }
6781 if (DO_P) {
6782 maxOrbital = 2;
6783 }
6784 if (DO_D) {
6785 maxOrbital = 3;
6786 }
6787 if (DO_F) {
6788 maxOrbital = 4;
6789 }
6790 if (maxOrbital > 0) {
6791 ioffset = 0;
6792 for (i = 1; i <= nspec; i++) {
6793 ioffset = (i - 1) * maxOrbital * ispin;
6794 for (j = 1; j <= species[i]; j++) {
6795 getline(din, tmpstr);
6796 for (k = 1; k <= nE; k++) {
6797 din >> ftmp; // discard energy
6798 if (ispin == 1) {
6799 for (iorb = 1; iorb <= maxOrbital; iorb++) {
6800 din >> ftmp;
6801 EDOS[k][ioffset + iorb + 2] += ftmp; // s
6802 }
6803 getline(din, tmpstr);
6804 }
6805 if (ispin == 2) {
6806 for (iorb = 1; iorb <= maxOrbital; iorb++) {
6807 din >> ftmp;
6808 EDOS[k][ioffset + (iorb - 1) * 2 + 4] += ftmp; // up
6809 din >> ftmp;
6810 EDOS[k][ioffset + (iorb - 1) * 2 + 5] -= ftmp; // down
6811 }
6812 getline(din, tmpstr);
6813 }
6814 }
6815 }
6816 }
6817 } // if maxOrbital>0
6818 // output
6819 for (i = 1; i <= nE; i++) {
6820 cout << " " << EDOS[i][1]; // energy
6821 for (j = 1; j <= ispin; j++) {
6822 cout << " " << EDOS[i][j + 1]; // DOS
6823 }
6824 if (DO_S) {
6825 // cerr << "do S\n";
6826 for (j = 1; j <= nspec; j++) {
6827 ioffset = (j - 1) * maxOrbital * ispin;
6828 for (k = 1; k <= ispin; k++) {
6829 cout << " " << EDOS[i][ioffset + k + 1 + ispin];
6830 }
6831 }
6832 }
6833 if (DO_P) {
6834 // cerr << "do P\n";
6835 for (j = 1; j <= nspec; j++) {
6836 ioffset = (j - 1) * maxOrbital * ispin + ispin;
6837 for (k = 1; k <= ispin; k++) {
6838 cout << " " << EDOS[i][ioffset + k + 1 + ispin];
6839 }
6840 }
6841 }
6842 if (DO_D) {
6843 // cerr << "do D\n";
6844 for (j = 1; j <= nspec; j++) {
6845 ioffset = (j - 1) * maxOrbital * ispin + 2 * ispin;
6846 for (k = 1; k <= ispin; k++) {
6847 cout << " " << EDOS[i][ioffset + k + 1 + ispin];
6848 }
6849 }
6850 }
6851 if (DO_F) {
6852 // cerr << "do F\n";
6853 for (j = 1; j <= nspec; j++) {
6854 ioffset = (j - 1) * maxOrbital * ispin + 3 * ispin;
6855 for (k = 1; k <= ispin; k++) {
6856 cout << " " << EDOS[i][ioffset + k + 1 + ispin];
6857 }
6858 }
6859 }
6860 cout << endl;
6861 }
6862 }
6863} // namespace pflow
6864
6865// ***************************************************************************
6866// pflow::EFFMASS // CAMILO
6867// ***************************************************************************
6868namespace pflow {
6869 void EFFMASS(vector<string>& argv, ostream& oss) {
6870 const bool LDEBUG = (false || XHOST.DEBUG);
6871 if (LDEBUG) {
6872 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
6873 }
6874 // aflow --effective_mass directory_name
6875 // aflow --em directory_name
6876 string WorkDir = argv.at(2);
6877 PrintEffectiveMass(WorkDir, oss);
6878 if (LDEBUG) {
6879 cerr << __AFLOW_FUNC__ << " END" << endl;
6880 }
6881 }
6882} // namespace pflow
6883
6884// ***************************************************************************
6885// pflow::EQUIVALENT
6886// ***************************************************************************
6887namespace pflow {
6888 string EQUIVALENT(_aflags& aflags, istream& input, aurostd::xoption& vpflow) {
6889 const bool LDEBUG = (false || XHOST.DEBUG);
6890 stringstream message;
6891 if (LDEBUG) {
6892 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
6893 }
6894 const xstructure _a(input, IOAFLOW_AUTO);
6895 const bool PRINT_SCREEN = false;
6896 aflags.QUIET = true;
6897 // DEBUG=true;
6898 ofstream FileMESSAGE("/dev/null");
6899 // DX+CO START
6900 _kflags kflags;
6901 // DX20170815 - Add in consistency checks pflow::PerformFullSymmetry(a,File,aflags,kflags,PRINT_SCREEN,cout);
6902 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true; // DX20170815 - Add in consistency checks
6903 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = false; // DX20170815 - Add in consistency checks
6904 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = true; // DX20170815 - Add in consistency checks
6905 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = true; // DX20170815 - Add in consistency checks
6906 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = false; // DX20170815 - Add in consistency checks //DX20171205 - Added pgroupk_xtal
6907 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_PATTERSON = false; // DX20200129
6908 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = false; // DX20170815 - Add in consistency checks
6909 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = true; // DX20170815 - Add in consistency checks
6910 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = false; // DX20170815 - Add in consistency checks
6911 const string options = vpflow.getattachedscheme("EQUIVALENT");
6912 vector<string> tokens;
6913 aurostd::string2tokens(options, tokens, ",");
6914 if (tokens.size() == 1) {
6915 if (tokens[0] == "usage" || tokens[0] == "USAGE") {
6917 aurostd::liststring2string("aflow --equivalent|--equiv|--inequivalent|--inequiv|--iatoms|--eatoms[=<tolerance_value>|=tight|=loose] [--no_scan] [--print=txt|json] "
6918 "[--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]] < POSCAR default: tolerance=(minimum_interatomic_distance)/100.0"));
6919 return "";
6920 }
6921 }
6922 // DX20170804 - need to rescale, so we make a fast copy and calculate
6923 xstructure a(_a);
6924 // DX20180221 - use pwd - START
6925 if (a.directory.empty()) {
6926 if (aflags.Directory != "./") {
6927 a.directory = aflags.Directory;
6928 } else {
6929 a.directory = aurostd::getPWD();
6930 aflags.Directory = a.directory;
6931 }
6932 }
6933 const string print_directory = " [dir=" + a.directory + "]";
6934 // DX20180221 - use pwd - END
6935 a.ReScale(1.0);
6936 // DX20170921 - MAGNETIC SYMMETRY - START
6937 if (vpflow.flag("SYMMETRY::MAGNETIC")) {
6938 const string magmom_info = vpflow.getattachedscheme("SYMMETRY::MAGNETIC");
6939 ProcessAndAddSpinToXstructure(a, magmom_info); // DX20191108 - condensed into a single function
6940 }
6941 // DX20170921 - MAGNETIC SYMMETRY - END
6942 // get tolerance
6943 double tolerance = pflow::getSymmetryTolerance(a, vpflow.getattachedscheme("SYMMETRY::TOLERANCE")); // DX20200820 - consolidated setting tolerance into a function
6944 // DX NOT REALLY NEEDED FOR THIS FUNCTION
6945 // DX20170803 - Add format flag - START
6946 string format = "txt";
6947 if (XHOST.vflag_control.flag("PRINT_MODE::TXT")) {
6948 format = "txt";
6949 } else if (XHOST.vflag_control.flag("PRINT_MODE::JSON")) {
6950 format = "json";
6951 } else { // default is txt
6952 format = "txt";
6953 }
6954 // Perform full scan
6955 const bool force_perform = true; // if no_scan fails, still return true at default tolerance (even though it cannot be validated)
6956 if (vpflow.flag("SYMMETRY::NO_SCAN")) {
6957 a.sym_eps_no_scan = true; // DX20210406
6958 }
6959
6960 if (!pflow::PerformFullSymmetry(a, tolerance, a.sym_eps_no_scan, force_perform, FileMESSAGE, aflags, kflags, PRINT_SCREEN, cout)) {
6961 message << "Could not find commensurate symmetry at tolerance = " << tolerance << " " << print_directory;
6962 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, message, _RUNTIME_ERROR_); // CO20200624
6963 }
6964 // pflow::PerformFullSymmetry(a,File,aflags,kflags,PRINT_SCREEN,cout); //DX20170815 - Add in consistency checks
6965 // SYM::CalculatePointGroup(File,a,aflags,true,PRINT_SCREEN,cout);
6966 // SYM::CalculateFactorGroup(File,a,aflags,true,PRINT_SCREEN,cout);
6967 // SYM::CalculateSpaceGroup(File,a,aflags,false,PRINT_SCREEN,cout);
6968 // SYM::CalculateInequivalentAtoms(File,a,aflags,true,PRINT_SCREEN,cout);
6969 // DX+CO END
6970 if (LDEBUG) {
6971 cerr << __AFLOW_FUNC__ << " END" << endl;
6972 }
6973 stringstream oss;
6974 if (format == "txt") {
6975 a.write_inequivalent_flag = true;
6976 stringstream oss;
6977 oss << a << endl;
6978 return oss.str();
6979 } else if (format == "json") {
6980 const char mode = _IATOMS_;
6981 KBIN_SymmetryToScreen(a, format, oss, mode);
6982 return oss.str();
6983 }
6984 return oss.str();
6985 }
6986} // namespace pflow
6987
6988// ***************************************************************************
6989// pflow::EWALD
6990// ***************************************************************************
6991namespace pflow {
6992 void EWALD(const string& options, istream& input) {
6993 const bool LDEBUG = (false || XHOST.DEBUG);
6994 if (LDEBUG) {
6995 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
6996 }
6997 vector<string> tokens;
6998 aurostd::string2tokens(options, tokens, ",");
6999 if (tokens.size() >= 2) {
7000 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --ewald[=eta] < POSCAR");
7001 }
7002 // move on
7003 double eta = -1.0;
7004 if (!tokens.empty()) {
7005 eta = aurostd::string2utype<double>(tokens[0]);
7006 }
7007 // cout << aflow::Banner("BANNER_TINY") << endl;
7008 const double SUMTOL = 1.0e-16;
7009 xstructure str(input, IOAFLOW_AUTO);
7010 str = GetNiggliStr(str);
7011 double epoint;
7012 double ereal;
7013 double erecip;
7014 double eewald;
7015 pflow::Ewald(str, epoint, ereal, erecip, eewald, eta, SUMTOL);
7016 pflow::PrintEwald(str, epoint, ereal, erecip, eewald, eta, SUMTOL, cout);
7017
7018 if (LDEBUG) {
7019 cerr << __AFLOW_FUNC__ << " END" << endl;
7020 }
7021 }
7022} // namespace pflow
7023
7024// ***************************************************************************
7025// pflow::EXTRACT_xcar
7026// ***************************************************************************
7027namespace pflow {
7028 string EXTRACT_xcar(_aflags& aflags, vector<string> argv, string mode, string file) {
7029 const bool LDEBUG = (false || XHOST.DEBUG);
7030 if (LDEBUG) {
7031 cerr << __AFLOW_FUNC__ << " mode=" << mode << endl;
7032 }
7033 if (LDEBUG) {
7034 cerr << __AFLOW_FUNC__ << " file=" << file << endl;
7035 }
7036 if (!argv.empty()) {
7037 ;
7038 } // phony just to keep argv busy no complaining about unused
7039 ofstream FileMESSAGE("/dev/null");
7040 _kflags kflags;
7041 kflags.AFLOW_MODE_VASP = true;
7042 _vflags vflags;
7043 _xvasp xvasp;
7044 xvasp.clear();
7045 if (!aurostd::FileExist(file)) {
7046 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "mode=" + mode + " file=" + file + " not found", _FILE_CORRUPT_); // CO20200624
7047 }
7048 string AflowIn;
7049 aurostd::file2string(file, AflowIn);
7050 AflowIn = aurostd::RemoveComments(AflowIn); // NOW Clean AFLOWIN //CO20180502
7051 aflags.QUIET = true;
7052 XHOST.QUIET = true;
7053 if (mode == "POSCAR") {
7054 vflags = KBIN::VASP_Get_Vflags_from_AflowIN(AflowIn, aflags, kflags);
7055 KBIN::VASP_Produce_POSCAR(xvasp, AflowIn, FileMESSAGE, aflags, kflags, vflags);
7056 return xvasp.POSCAR.str();
7057 }
7058 if (mode == "INCAR") {
7059 vflags = KBIN::VASP_Get_Vflags_from_AflowIN(AflowIn, aflags, kflags);
7060 KBIN::VASP_Produce_INCAR(xvasp, AflowIn, FileMESSAGE, aflags, kflags, vflags);
7061 KBIN::VASP_Modify_INCAR(xvasp, FileMESSAGE, aflags, kflags, vflags);
7062 return xvasp.INCAR.str();
7063 }
7064 if (mode == "KPOINTS") {
7065 vflags = KBIN::VASP_Get_Vflags_from_AflowIN(AflowIn, aflags, kflags);
7066 KBIN::VASP_Produce_POSCAR(xvasp, AflowIn, FileMESSAGE, aflags, kflags, vflags);
7067 KBIN::VASP_Produce_KPOINTS(xvasp, AflowIn, FileMESSAGE, aflags, kflags, vflags);
7068 KBIN::VASP_Modify_KPOINTS(xvasp, FileMESSAGE, aflags, vflags);
7069 return xvasp.KPOINTS.str();
7070 }
7071 if (mode == "POTCAR") {
7072 vflags = KBIN::VASP_Get_Vflags_from_AflowIN(AflowIn, aflags, kflags);
7073 KBIN::VASP_Produce_POTCAR(xvasp, AflowIn, FileMESSAGE, aflags, kflags, vflags);
7074 return xvasp.POTCAR.str();
7075 }
7076 if (mode == "PARTCAR") { // CO20181226
7077 const xstructure xstr = pocc::extractPARTCAR(AflowIn);
7078 stringstream output;
7079 output << xstr;
7080 return output.str();
7081 }
7082 return mode; // something must go out
7083 }
7084} // namespace pflow
7085
7086// ***************************************************************************
7087// pflow::EIGCURV // CAMILO
7088// ***************************************************************************
7089namespace pflow {
7090 void EIGCURV(const string& options, ostream& oss) {
7091 const bool LDEBUG = (false || XHOST.DEBUG);
7092 if (LDEBUG) {
7093 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
7094 }
7095 vector<string> tokens;
7096 aurostd::string2tokens(options, tokens, ",");
7097 if (tokens.size() != 1) {
7098 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --eigcurv=DIRECTORY(with bands)");
7099 }
7100 string filename;
7101 if (!tokens.empty()) {
7102 filename = (tokens[0]);
7103 }
7104 string WorkDir = filename;
7105 PrintEigCurv(WorkDir, oss);
7106 if (LDEBUG) {
7107 cerr << __AFLOW_FUNC__ << " END" << endl;
7108 }
7109 }
7110} // namespace pflow
7111
7112// DX+CO START
7113// ***************************************************************************
7114// pflow::PerformFullSymmetry
7115// ***************************************************************************
7116namespace pflow {
7117 bool PerformFullSymmetry(xstructure& a) {
7118 ofstream FileMESSAGE("/dev/null");
7119 _aflags aflags;
7120 aflags.Directory = ".";
7121 aflags.QUIET = true;
7122 _kflags kflags;
7123 defaultKFlags4SymWrite(kflags, false);
7124 defaultKFlags4SymCalc(kflags, true);
7125 const bool osswrite = false;
7126 const bool see_output = false; // true;
7127 ostream& oss_empty = cout;
7128 if (!see_output) {
7129 oss_empty.setstate(std::ios_base::badbit);
7130 } // like NULL
7131 const bool sym_done = PerformFullSymmetry(a, FileMESSAGE, aflags, kflags, osswrite, oss_empty);
7132 if (!see_output) {
7133 oss_empty.clear();
7134 } // clear NULL
7135 return sym_done;
7136 }
7137
7138 // ME20200224 - added directory option
7139 bool PerformFullSymmetry(xstructure& a, ofstream& FileMESSAGE, const string& directory, _kflags& kflags, bool osswrite, ostream& oss, string format) {
7140 _aflags aflags;
7141 aflags.Directory = directory;
7142 return PerformFullSymmetry(a, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7143 }
7144
7145 bool PerformFullSymmetry(xstructure& a, ofstream& FileMESSAGE, _aflags& aflags, _kflags& kflags, bool osswrite, ostream& oss, string format) {
7146 double tolerance = a.sym_eps;
7147 const bool no_scan = false;
7148 const bool force_perform = true; // if no_scan fails, still return true at default tolerance (even though it cannot be validated)
7149 return PerformFullSymmetry(a, tolerance, no_scan, force_perform, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7150 }
7151
7152 bool PerformFullSymmetry(xstructure& a, double& tolerance, bool no_scan, bool force_perform, ofstream& FileMESSAGE, _aflags& aflags, _kflags& kflags, bool osswrite, ostream& oss, string format) {
7153 a.ClearSymmetry(); // CO20190204
7154 const xstructure b(a); // save for later
7155 a.ReScale(1.0); // the nuclear option, only way to fix all of the issues with f2c/c2f/ctau/ctrasl/etc.
7156 const bool LDEBUG = (false || XHOST.DEBUG);
7157 bool symmetry_commensurate = false;
7158 // ME20210429 - use a function-wide QUIET flag
7159 const bool QUIET = (aflags.QUIET || XHOST.QUIET || XHOST.vflag_control.flag("WWW"));
7160 // ME20210429 - Do not write symmetry information for web; too much output
7161 osswrite = (osswrite && !XHOST.vflag_control.flag("WWW"));
7162 ostringstream aus;
7163
7164 // a.directory = aflags.Directory;
7165 // DX20180221 - use pwd - START
7166 if (a.directory.empty()) {
7167 if (aflags.Directory != "./") {
7168 a.directory = aflags.Directory;
7169 } else {
7170 a.directory = aurostd::getPWD();
7171 aflags.Directory = a.directory;
7172 }
7173 }
7174 const string print_directory = " [dir=" + a.directory + "]";
7175 // DX20180221 - use pwd - END
7176
7177 if (LDEBUG) {
7178 cerr << XPID << "pflow::PerformFullSymmetry: STRUCTURE" << endl;
7179 cerr << a << endl;
7180 }
7181
7182 if (a.atoms.empty()) {
7183 cerr << __AFLOW_FUNC__ << " ERROR! No atoms found in the structure" << print_directory << endl;
7184 return false;
7185 }
7186
7187 // MOVED DOWN A BIT if(!aflags.QUIET) aus << XPID << (aflags.QUIET?"":"00000 MESSAGE ") << "Symmetry: starting tolerance " << _EPS_sym_ << " " << Message(__AFLOW_FILE__,aflags) << endl;
7188 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7189 if (true || a.dist_nn_min == AUROSTD_NAN) { // CO20171024 - always recalculate min_dist (SAFE)
7190 if (LDEBUG) {
7191 cerr << XPID << "pflow::PerformFullSymmetry: CALCULATING MIN DISTANCE" << print_directory << endl;
7192 }
7193 a.MinDist();
7194 if (LDEBUG) {
7195 cerr << XPID << "pflow::PerformFullSymmetry: MIN DISTANCE DONE" << print_directory << endl;
7196 }
7197 }
7198 double min_dist = a.dist_nn_min;
7199 // CO20180420 - we need something tighter here, but this is good to kill POCC
7200 if (min_dist < _ZERO_TOL_) { //_XPROTO_TOO_CLOSE_ERROR_ perhaps?
7201 cerr << XPID << "pflow::PerformFullSymmetry: ERROR! Atoms too close (min_dist=" << min_dist << print_directory << endl;
7202 return false;
7203 }
7204 // if(a.sym_eps!=AUROSTD_NAN){ //Tolerance came from user or was calculated
7205 // a.sym_eps;
7206 // }
7207 // CO, I changed a bit, if tolerance is specified, it should override
7208 if (tolerance != AUROSTD_NAN) {
7209 a.sym_eps = tolerance;
7210 } else if (!a.sym_eps_calculated || a.sym_eps == AUROSTD_NAN) {
7211 a.sym_eps = SYM::defaultTolerance(a);
7212 }
7213 // if(a.sym_eps == AUROSTD_NAN && tolerance == AUROSTD_NAN){
7214 // a.sym_eps = SYM::defaultTolerance(a);
7215 // }
7216 // else if(!a.sym_eps_calculated && tolerance != AUROSTD_NAN){
7217 // a.sym_eps = tolerance;
7218 // }
7219 // a.sym_eps = SYM::defaultTolerance(a);
7220 double orig_tolerance = a.sym_eps;
7221 if (!aflags.QUIET) {
7222 aus << XPID << (aflags.QUIET ? "" : "00000 MESSAGE ") << "Symmetry: starting tolerance " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7223 }
7224 aurostd::PrintMessageStream(FileMESSAGE, aus, XHOST.QUIET, osswrite, oss);
7225
7226 a.sym_eps_no_scan = no_scan; // DX20210406
7227 if (LDEBUG) {
7228 cerr << XPID << "pflow::PerformFullSymmetry: no_scan=" << a.sym_eps_no_scan << endl;
7229 }
7230
7231 while (symmetry_commensurate == false) {
7232 a.sym_eps_calculated = true;
7233 // Calculate Lattice Point Group
7234 if (kflags.KBIN_SYMMETRY_CALCULATE_PGROUP) { // DX20170814
7235 if (!SYM::CalculatePointGroup(FileMESSAGE, a, aflags, kflags.KBIN_SYMMETRY_PGROUP_WRITE, osswrite, oss, format)) {
7236 if (LDEBUG) {
7237 cerr << __AFLOW_FUNC__ << " WARNING: PGROUP calculation is inconsisent." << endl;
7238 }
7239 if (!a.sym_eps_no_scan) {
7240 a.ClearSymmetry();
7241 if (!SYM::change_tolerance(a, a.sym_eps, min_dist, a.sym_eps_no_scan)) { // CO20200106 - patching for auto-indenting
7242 a = b; // pretty printing, unmodified structure
7243 if (force_perform) {
7244 cerr << __AFLOW_FUNC__ << " Scan failed [0]. Reverting back to original tolerance and recalculating as is (with aforementioned inconsistencies)." << print_directory << endl;
7245 PerformFullSymmetry(a, orig_tolerance, true, false, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7246 } else {
7247 return false;
7248 }
7249 }
7250 if (!QUIET) {
7251 aus << XPID << "00000 MESSAGE PGROUP Symmetry: changing tolerance to " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7252 }
7253 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7254 continue;
7255 }
7256 }
7257 } // DX20170814
7258 if (kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK) { // DX20170814
7259 if (!SYM::CalculatePointGroupKLattice(FileMESSAGE, a, aflags, kflags.KBIN_SYMMETRY_PGROUPK_WRITE, osswrite, oss, format)) {
7260 if (LDEBUG) {
7261 cerr << __AFLOW_FUNC__ << " WARNING: PGROUPK calculation is inconsisent." << endl;
7262 }
7263 if (!a.sym_eps_no_scan) {
7264 a.ClearSymmetry();
7265 if (!SYM::change_tolerance(a, a.sym_eps, min_dist, a.sym_eps_no_scan)) { // CO20200106 - patching for auto-indenting
7266 a = b; // pretty printing, unmodified structure
7267 if (force_perform) {
7268 cerr << __AFLOW_FUNC__ << " Scan failed [1]. Reverting back to original tolerance and recalculating as is (with aforementioned inconsistencies)." << print_directory << endl;
7269 PerformFullSymmetry(a, orig_tolerance, true, false, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7270 } else {
7271 return false;
7272 }
7273 }
7274 if (!QUIET) {
7275 aus << XPID << "00000 MESSAGE PGROUPK Symmetry: changing tolerance to " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7276 }
7277 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7278 continue;
7279 }
7280 }
7281 } // DX20170814
7282 // Check for identity element
7283 if (kflags.KBIN_SYMMETRY_CALCULATE_PGROUP && SYM::CheckForIdentity(a) == false) {
7284 if (LDEBUG) {
7285 cerr << __AFLOW_FUNC__ << " WARNING: Point group does not contain the identity element (impossible for a crystal)." << print_directory << endl;
7286 }
7287 if (!a.sym_eps_no_scan) {
7288 a.ClearSymmetry();
7289 if (!SYM::change_tolerance(a, a.sym_eps, min_dist, a.sym_eps_no_scan)) { // CO20200106 - patching for auto-indenting
7290 a = b; // pretty printing, unmodified structure
7291 if (force_perform) {
7292 cerr << __AFLOW_FUNC__ << " Scan failed [2]. Reverting back to original tolerance and recalculating as is (with aforementioned inconsistencies)." << print_directory << endl;
7293 PerformFullSymmetry(a, orig_tolerance, true, false, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7294 } else {
7295 return false;
7296 }
7297 }
7298 if (!QUIET) {
7299 aus << XPID << "00000 MESSAGE PGROUP Symmetry: changing tolerance to " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7300 }
7301 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7302 continue;
7303 }
7304 }
7305 // Calculate Factor Group
7306 if (kflags.KBIN_SYMMETRY_CALCULATE_FGROUP) { // DX20170814
7307 if (!SYM::CalculateFactorGroup(FileMESSAGE, a, aflags, kflags.KBIN_SYMMETRY_FGROUP_WRITE, osswrite, oss, format)) {
7308 if (LDEBUG) {
7309 cerr << __AFLOW_FUNC__ << " WARNING: FGROUP calculation is inconsisent." << endl;
7310 }
7311 if (!a.sym_eps_no_scan) {
7312 a.ClearSymmetry();
7313 if (!SYM::change_tolerance(a, a.sym_eps, min_dist, a.sym_eps_no_scan)) { // CO20200106 - patching for auto-indenting
7314 a = b; // pretty printing, unmodified structure
7315 if (force_perform) {
7316 cerr << __AFLOW_FUNC__ << " Scan failed [3]. Reverting back to original tolerance and recalculating as is (with aforementioned inconsistencies)." << print_directory << endl;
7317 PerformFullSymmetry(a, orig_tolerance, true, false, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7318 } else {
7319 return false;
7320 }
7321 }
7322 if (!QUIET) {
7323 aus << XPID << "00000 MESSAGE FGROUP Symmetry: changing tolerance to " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7324 }
7325 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7326 continue;
7327 }
7328 }
7329 } // DX20170814
7330 // Calculate Crystallographic Point Group
7331 if (kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL) { // DX20170814
7332 if (!SYM::CalculatePointGroupCrystal(FileMESSAGE, a, aflags, kflags.KBIN_SYMMETRY_PGROUP_XTAL_WRITE, osswrite, oss, format)) {
7333 if (LDEBUG) {
7334 cerr << __AFLOW_FUNC__ << " WARNING: PGROUP_XTAL calculation is inconsisent." << endl;
7335 }
7336 if (!a.sym_eps_no_scan) {
7337 a.ClearSymmetry();
7338 if (!SYM::change_tolerance(a, a.sym_eps, min_dist, a.sym_eps_no_scan)) { // CO20200106 - patching for auto-indenting
7339 a = b; // pretty printing, unmodified structure
7340 if (force_perform) {
7341 cerr << XPID << "pflow::PerformFullSymmetry: Scan failed [4]. Reverting back to original tolerance and recalculating as is (with aforementioned inconsistencies)." << print_directory << endl;
7342 PerformFullSymmetry(a, orig_tolerance, true, false, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7343 } else {
7344 return false;
7345 }
7346 }
7347 if (!QUIET) {
7348 aus << XPID << "00000 MESSAGE PGROUP_XTAL Symmetry: changing tolerance to " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7349 }
7350 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7351 continue;
7352 }
7353 }
7354 } // DX20170814
7355 // Check if a point group map was found; if not, change tolerance
7356 if (kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL && a.point_group_Hermann_Mauguin.empty() == true) { // DX20170814
7357 if (LDEBUG) {
7358 cerr << __AFLOW_FUNC__ << " WARNING: Point group crystal operations did not match with any Hermann-Mauguin symbols. (i.e. The set of symmetry elements found are not allowed possible for a crystal.) "
7359 << print_directory << endl;
7360 ;
7361 }
7362 if (!a.sym_eps_no_scan) {
7363 a.ClearSymmetry();
7364 if (!SYM::change_tolerance(a, a.sym_eps, min_dist, a.sym_eps_no_scan)) { // CO20200106 - patching for auto-indenting
7365 a = b; // pretty printing, unmodified structure
7366 if (force_perform) {
7367 cerr << __AFLOW_FUNC__ << " Scan failed [5]. Reverting back to original tolerance and recalculating as is (with aforementioned inconsistencies)." << print_directory << endl;
7368 PerformFullSymmetry(a, orig_tolerance, true, false, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7369 } else {
7370 return false;
7371 }
7372 }
7373 if (!QUIET) {
7374 aus << XPID << "00000 MESSAGE PGROUP_XTAL Symmetry: changing tolerance to " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7375 }
7376 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7377 continue;
7378 }
7379 }
7380 // Check if factor group is integer multiple of the crystallographic point group; if not, change tolerance
7381 int multiplicity_of_primitive = 0; // DX20170815 - Added consistency checks, need to initialize and calculate if we have those groups
7382 if (kflags.KBIN_SYMMETRY_CALCULATE_FGROUP && kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL) { // DX20170814
7383 multiplicity_of_primitive = a.fgroup.size() / a.pgroup_xtal.size();
7384 if (a.fgroup.size() % a.pgroup_xtal.size() != 0) { // DX20170814
7385 if (LDEBUG) {
7386 cerr << __AFLOW_FUNC__ << " WARNING: Number of factor groups is not an integer multiple of the point group crystal (fgroup: " << a.fgroup.size() << " vs pgroup_xtal: " << a.pgroup_xtal.size()
7387 << ")." << print_directory << endl;
7388 }
7389 if (!a.sym_eps_no_scan) {
7390 a.ClearSymmetry();
7391 if (!SYM::change_tolerance(a, a.sym_eps, min_dist, a.sym_eps_no_scan)) { // CO20200106 - patching for auto-indenting
7392 a = b; // pretty printing, unmodified structure
7393 if (force_perform) {
7394 cerr << __AFLOW_FUNC__ << " Scan failed [6]. Reverting back to original tolerance and recalculating as is (with aforementioned inconsistencies)." << print_directory << endl;
7395 PerformFullSymmetry(a, orig_tolerance, true, false, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7396 } else {
7397 return false;
7398 }
7399 }
7400 if (!QUIET) {
7401 aus << XPID << "00000 MESSAGE PGROUP_XTAL Symmetry: changing tolerance to " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7402 }
7403 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7404 continue;
7405 }
7406 }
7407 } // DX20170814
7408 if (kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL) { // DX20171205 - Added pgroupk_xtal
7409 if (!SYM::CalculatePointGroupKCrystal(FileMESSAGE, a, aflags, kflags.KBIN_SYMMETRY_PGROUPK_XTAL_WRITE, osswrite, oss, format)) { // DX20180118 - PGROUPK_XTAL not PGROUPK
7410 if (LDEBUG) {
7411 cerr << __AFLOW_FUNC__ << " WARNING: PGROUPK_XTAL calculation is inconsisent." << endl;
7412 }
7413 if (!a.sym_eps_no_scan) {
7414 a.ClearSymmetry();
7415 if (!SYM::change_tolerance(a, a.sym_eps, min_dist, a.sym_eps_no_scan)) { // CO20200106 - patching for auto-indenting
7416 a = b; // pretty printing, unmodified structure
7417 if (force_perform) {
7418 cerr << __AFLOW_FUNC__ << " Scan failed [7]. Reverting back to original tolerance and recalculating as is (with aforementioned inconsistencies)." << print_directory << endl;
7419 PerformFullSymmetry(a, orig_tolerance, true, false, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7420 } else {
7421 return false;
7422 }
7423 }
7424 if (!QUIET) {
7425 aus << XPID << "00000 MESSAGE PGROUPK_XTAL Symmetry: changing tolerance to " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7426 }
7427 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7428 continue;
7429 }
7430 }
7431 } // DX20170814
7432 // Calculate Patterson Point Group
7433 if (kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_PATTERSON) { // DX20200129
7434 if (!SYM::CalculatePointGroupKPatterson(FileMESSAGE, a, aflags, kflags.KBIN_SYMMETRY_PGROUPK_PATTERSON_WRITE, osswrite, oss, format)) {
7435 if (LDEBUG) {
7436 cerr << __AFLOW_FUNC__ << " WARNING: PGROUPK_PATTERSON calculation is inconsisent." << endl;
7437 }
7438 if (!a.sym_eps_no_scan) {
7439 a.ClearSymmetry();
7440 if (!SYM::change_tolerance(a, a.sym_eps, min_dist, a.sym_eps_no_scan)) { // CO20200106 - patching for auto-indenting
7441 a = b; // pretty printing, unmodified structure
7442 if (force_perform) {
7443 cerr << __AFLOW_FUNC__ << " Scan failed [0]. Reverting back to original tolerance and recalculating as is (with aforementioned inconsistencies)." << print_directory << endl;
7444 PerformFullSymmetry(a, orig_tolerance, true, false, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7445 } else {
7446 return false;
7447 }
7448 }
7449 if (!QUIET) {
7450 aus << XPID << "00000 MESSAGE PGROUPK_PATTERSON Symmetry: changing tolerance to " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7451 }
7452 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7453 continue;
7454 }
7455 }
7456 } // DX20200129
7457 if (kflags.KBIN_SYMMETRY_CALCULATE_SGROUP) { // DX20170814
7458 if (kflags.KBIN_SYMMETRY_SGROUP_RADIUS > 0.0) {
7459 if (!QUIET) {
7460 aus << XPID << "00000 MESSAGE POSCAR SGROUP: found RADIUS=" << kflags.KBIN_SYMMETRY_SGROUP_RADIUS << " " << Message(__AFLOW_FILE__, aflags) << endl;
7461 }
7462 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7463 } else {
7464 kflags.KBIN_SYMMETRY_SGROUP_RADIUS = KBIN_SYMMETRY_SGROUP_RADIUS_DEFAULT;
7465 if (!QUIET) {
7466 aus << XPID << "00000 MESSAGE POSCAR SGROUP: Default RADIUS=" << kflags.KBIN_SYMMETRY_SGROUP_RADIUS << " " << Message(__AFLOW_FILE__, aflags) << endl;
7467 }
7468 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7469 }
7470 a.sgroup_radius = kflags.KBIN_SYMMETRY_SGROUP_RADIUS;
7471 // Calculate Space Group
7472 if (!SYM::CalculateSpaceGroup(FileMESSAGE, a, aflags, kflags.KBIN_SYMMETRY_SGROUP_WRITE, osswrite, oss, format)) {
7473 if (LDEBUG) {
7474 cerr << __AFLOW_FUNC__ << " WARNING: SGROUP calculation is inconsisent." << endl;
7475 }
7476 if (!a.sym_eps_no_scan) {
7477 a.ClearSymmetry();
7478 if (!SYM::change_tolerance(a, a.sym_eps, min_dist, a.sym_eps_no_scan)) { // CO20200106 - patching for auto-indenting
7479 a = b; // pretty printing, unmodified structure
7480 if (force_perform) {
7481 cerr << XPID << "pflow::PerformFullSymmetry: Scan failed [8]. Reverting back to original tolerance and recalculating as is (with aforementioned inconsistencies)." << print_directory << endl;
7482 PerformFullSymmetry(a, orig_tolerance, true, false, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7483 } else {
7484 return false;
7485 }
7486 }
7487 if (!QUIET) {
7488 aus << XPID << "00000 MESSAGE SGROUP Symmetry: changing tolerance to " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7489 }
7490 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7491 continue;
7492 }
7493 }
7494 } // DX20170814
7495 // Calculate inequivalent atoms
7496 if (kflags.KBIN_SYMMETRY_CALCULATE_IATOMS) { // DX20170814
7497 if (!SYM::CalculateInequivalentAtoms(FileMESSAGE, a, aflags, kflags.KBIN_SYMMETRY_IATOMS_WRITE, osswrite, oss, format)) {
7498 if (LDEBUG) {
7499 cerr << __AFLOW_FUNC__ << " WARNING: IATOMS calculation is inconsisent." << endl;
7500 }
7501 if (!a.sym_eps_no_scan) {
7502 a.ClearSymmetry();
7503 if (!SYM::change_tolerance(a, a.sym_eps, min_dist, a.sym_eps_no_scan)) { // CO20200106 - patching for auto-indenting
7504 a = b; // pretty printing, unmodified structure
7505 if (force_perform) {
7506 cerr << __AFLOW_FUNC__ << " Scan failed [9]. Reverting back to original tolerance and recalculating as is (with aforementioned inconsistencies)." << print_directory << endl;
7507 PerformFullSymmetry(a, orig_tolerance, true, false, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7508 } else {
7509 return false;
7510 }
7511 }
7512 if (!QUIET) {
7513 aus << XPID << "00000 MESSAGE IATOMS ATOMS: changing tolerance to " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7514 }
7515 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7516 continue;
7517 }
7518 }
7519 // Check if number of equivalent atoms is consistent with cell ; if not, change tolerance
7520 bool iatoms_commensurate = true;
7521 for (size_t i = 0; i < a.iatoms.size(); i++) {
7522 if (a.iatoms[i].size() % multiplicity_of_primitive != 0) {
7523 iatoms_commensurate = false;
7524 break;
7525 }
7526 }
7527 if (iatoms_commensurate == false) {
7528 if (LDEBUG) {
7529 cerr << __AFLOW_FUNC__ << " WARNING: Number of equivalent atoms is not an integer multiple of the number factor groups." << print_directory << endl;
7530 }
7531 if (!a.sym_eps_no_scan) {
7532 a.ClearSymmetry();
7533 if (!SYM::change_tolerance(a, a.sym_eps, min_dist, a.sym_eps_no_scan)) { // CO20200106 - patching for auto-indenting
7534 a = b; // pretty printing, unmodified structure
7535 if (force_perform) {
7536 cerr << XPID << "pflow::PerformFullSymmetry: Scan failed [10]. Reverting back to original tolerance and recalculating as is (with aforementioned inconsistencies)." << print_directory << endl;
7537 PerformFullSymmetry(a, orig_tolerance, true, false, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7538 } else {
7539 return false;
7540 }
7541 }
7542 if (!QUIET) {
7543 aus << XPID << "00000 MESSAGE IATOMS ATOMS: changing tolerance to " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7544 }
7545 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7546 continue;
7547 }
7548 }
7549 } // DX20170814
7550 // Calculate site point group
7551 if (kflags.KBIN_SYMMETRY_CALCULATE_AGROUP) { // DX20170814
7552 if (!SYM::CalculateSitePointGroup(FileMESSAGE, a, aflags, kflags.KBIN_SYMMETRY_AGROUP_WRITE, osswrite, oss, format)) {
7553 if (LDEBUG) {
7554 cerr << __AFLOW_FUNC__ << " WARNING: AGROUP calculation is inconsisent." << endl;
7555 }
7556 if (!a.sym_eps_no_scan) {
7557 a.ClearSymmetry();
7558 if (!SYM::change_tolerance(a, a.sym_eps, min_dist, a.sym_eps_no_scan)) { // CO20200106 - patching for auto-indenting
7559 a = b; // pretty printing, unmodified structure
7560 if (force_perform) {
7561 cerr << __AFLOW_FUNC__ << " Scan failed [11]. Reverting back to original tolerance and recalculating as is (with aforementioned inconsistencies)." << print_directory << endl;
7562 PerformFullSymmetry(a, orig_tolerance, true, false, FileMESSAGE, aflags, kflags, osswrite, oss, format);
7563 } else {
7564 return false;
7565 }
7566 }
7567 if (!QUIET) {
7568 aus << XPID << "00000 MESSAGE AGROUP Symmetry: changing tolerance to " << a.sym_eps << " " << Message(__AFLOW_FILE__, aflags) << endl;
7569 }
7570 aurostd::PrintMessageStream(FileMESSAGE, aus, QUIET, osswrite, oss);
7571 continue;
7572 }
7573 }
7574 } // DX20170814
7575 symmetry_commensurate = true; // NOTE: This may not be entirely true if no_scan=true
7576 }
7577 a.ReScale(b.scale); // the nuclear option, only way to fix all of the issues with f2c/c2f/ctau/ctrasl/etc.
7578 a.lattice = b.lattice;
7579 a.scale = b.scale; // perfect printing, we should also fix cpos of all atoms, but not really worried since we usually print fpos
7580
7581 if (LDEBUG) {
7582 cerr << __AFLOW_FUNC__ << " SYMMETRY CALCULATION IS COMPLETE." << endl;
7583 cerr << __AFLOW_FUNC__ << " # pgroup: " << a.pgroup.size() << endl;
7584 cerr << __AFLOW_FUNC__ << " # pgroupk: " << a.pgroupk.size() << endl;
7585 cerr << __AFLOW_FUNC__ << " # fgroup: " << a.fgroup.size() << endl;
7586 cerr << __AFLOW_FUNC__ << " # pgroup_xtal: " << a.pgroup_xtal.size() << endl;
7587 cerr << __AFLOW_FUNC__ << " # pgroupk_xtal: " << a.pgroupk_xtal.size() << endl;
7588 cerr << __AFLOW_FUNC__ << " # pgroupk_Patterson: " << a.pgroupk_Patterson.size() << endl;
7589 cerr << __AFLOW_FUNC__ << " # sgroup: " << a.sgroup.size() << endl;
7590 cerr << __AFLOW_FUNC__ << " # agroup: " << a.agroup.size() << endl;
7591 }
7592 return symmetry_commensurate;
7593 }
7594} // namespace pflow
7595
7596namespace pflow {
7597 void defaultKFlags4SymWrite(_kflags& kflags, bool write) {
7598 kflags.KBIN_SYMMETRY_PGROUP_WRITE = write;
7599 kflags.KBIN_SYMMETRY_PGROUPK_WRITE = write;
7600 kflags.KBIN_SYMMETRY_FGROUP_WRITE = write;
7601 kflags.KBIN_SYMMETRY_PGROUP_XTAL_WRITE = write;
7602 kflags.KBIN_SYMMETRY_PGROUPK_XTAL_WRITE = write; // DX20171205 - Added pgroupk_xtal
7603 kflags.KBIN_SYMMETRY_PGROUPK_PATTERSON_WRITE = write; // DX20200129
7604 kflags.KBIN_SYMMETRY_IATOMS_WRITE = write;
7605 kflags.KBIN_SYMMETRY_AGROUP_WRITE = write;
7606 kflags.KBIN_SYMMETRY_SGROUP_WRITE = write;
7607 }
7608 void defaultKFlags4SymCalc(_kflags& kflags, bool calc) {
7609 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = calc;
7610 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = calc;
7611 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = calc;
7612 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = calc;
7613 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = calc; // DX20171205 - Added pgroupk_xtal
7614 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_PATTERSON = calc; // DX20200129
7615 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = calc;
7616 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = calc;
7617 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = calc;
7618 }
7619} // namespace pflow
7620
7621namespace pflow {
7622 // COMMAND LINE SYMMETRY CALCULATION, calls main function PerformFullSymmetry()!!!!!!!!!!!
7623 bool CalculateFullSymmetry(istream& input, aurostd::xoption& vpflow, ostream& oss) { // overload
7624
7625 // DX20201228 - print Python script
7626 if (XHOST.vflag_control.flag("PRINT_MODE::PYTHON")) {
7627 SYM::writePythonScript(oss);
7628 return true;
7629 }
7630
7631 xstructure a(input, IOAFLOW_AUTO);
7632
7633 // default aflags for command line
7634 _aflags aflags;
7635 aflags.Directory = ".";
7636 aflags.QUIET = false;
7637
7638 // default kflags
7639 _kflags kflags;
7640 defaultKFlags4SymWrite(kflags, true);
7641 defaultKFlags4SymCalc(kflags, true);
7642
7643 // write output to screen
7644 const bool osswrite = true;
7645
7646 return CalculateFullSymmetry(aflags, kflags, a, vpflow, osswrite, oss);
7647 }
7648
7649 // COMMAND LINE SYMMETRY CALCULATION, calls main function PerformFullSymmetry()!!!!!!!!!!!
7650 bool CalculateFullSymmetry(_aflags& aflags, _kflags& kflags, xstructure& _a, aurostd::xoption& vpflow, bool osswrite, ostream& oss) { // main function
7651 const bool LDEBUG = (false || XHOST.DEBUG);
7652 if (LDEBUG) {
7653 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
7654 }
7655 const string options = vpflow.getattachedscheme("FULLSYMMETRY");
7656 vector<string> tokens;
7657 aurostd::string2tokens(options, tokens, ",");
7658 if (tokens.size() == 1) {
7659 if (tokens[0] == "usage" || tokens[0] == "USAGE") {
7661 aurostd::liststring2string("aflow --aflow-sym|--AFLOW-SYM|--AFLOWSYM|--aflowSYM|--aflowsym|--full_symmetry|--full_sym|--fullsym[=<tolerance_value>|=tight|=loose] [--no_scan] "
7662 "[--print=txt|json] [--screen_only] [--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]] < POSCAR default: "
7663 "tolerance=(minimum_interatomic_distance)/100.0, print=txt")); // DX20200724 - removed return
7664 return false; // CO20200624 - there has been NO calculation of symmetry
7665 }
7666 }
7667
7668 // DX20201228 - print Python script
7669 if (XHOST.vflag_control.flag("PRINT_MODE::PYTHON")) {
7670 SYM::writePythonScript(oss);
7671 return true;
7672 }
7673
7674 // DX20170804 - need to rescale, so we make a fast copy and calculate
7675 xstructure a(_a);
7676 a.ReScale(1.0);
7677
7678 // DX20170921 - MAGNETIC SYMMETRY - START
7679 if (vpflow.flag("FULLSYMMETRY::MAGNETIC")) {
7680 const string magmom_info = vpflow.getattachedscheme("FULLSYMMETRY::MAGNETIC");
7681 ProcessAndAddSpinToXstructure(a, magmom_info); // DX20191108 - condensed into a single function
7682 }
7683 // DX20170921 - MAGNETIC SYMMETRY - END
7684
7685 // get tolerance
7686 double tolerance = pflow::getSymmetryTolerance(a, vpflow.getattachedscheme("FULLSYMMETRY::TOLERANCE")); // DX20200820 - consolidated setting tolerance into a function
7687
7688 // DX20170803 - Add format flag - START
7689 string format = "txt";
7690 if (XHOST.vflag_control.flag("PRINT_MODE::TXT")) {
7691 format = "txt";
7692 } else if (XHOST.vflag_control.flag("PRINT_MODE::JSON")) {
7693 format = "json";
7694 } else { // default is txt
7695 format = "txt";
7696 }
7697 // DX20170803 - Add format flag - END
7698 // DX20170803 - Print ouptut to screen - START
7699 bool print = false;
7700 if (vpflow.flag("FULLSYMMETRY::SCREEN_ONLY")) {
7701 print = true;
7702 defaultKFlags4SymWrite(kflags, false);
7703 // kflags.KBIN_SYMMETRY_PGROUP_WRITE=false;
7704 // kflags.KBIN_SYMMETRY_PGROUPK_WRITE=false;
7705 // kflags.KBIN_SYMMETRY_FGROUP_WRITE=false;
7706 // kflags.KBIN_SYMMETRY_PGROUP_XTAL_WRITE=false;
7707 // kflags.KBIN_SYMMETRY_SGROUP_WRITE=false;
7708 // kflags.KBIN_SYMMETRY_IATOMS_WRITE=false;
7709 // kflags.KBIN_SYMMETRY_AGROUP_WRITE=false;
7710 osswrite = false;
7711 }
7712 // DX20170803 - Print ouptut to screen - END
7713 // DX
7714 // if(tokens.size()==0) {tolerance=default_tolerance;}
7715 // if(tokens.size()>=1 && tokens.at(0) != "--debug" && tokens.at(0) != "--debug" ) {
7716 // if(tokens.at(0).at(0) == 't' || tokens.at(0).at(0) == 'T'){ //Tight
7717 // tolerance=default_tolerance;
7718 // }
7719 // else if(tokens.at(0).at(0) == 'l' || tokens.at(0).at(0) == 'L'){ //Loose
7720 // tolerance=default_tolerance*10.0;
7721 // }
7722 // else {
7723 // tolerance=aurostd::string2utype<double>(tokens.at(0));
7724 // }
7725 // }
7726 // DX
7727 // Perform full scan
7728 if (vpflow.flag("FULLSYMMETRY::NO_SCAN")) {
7729 a.sym_eps_no_scan = true; // DX20210406
7730 }
7731
7732 bool tocompress = true;
7733 ofstream FileMESSAGE("/dev/null");
7734 string directory = aurostd::getPWD();
7735 if (XHOST.vflag_control.flag("DIRECTORY")) {
7736 directory = XHOST.vflag_control.getattachedscheme("DIRECTORY");
7737 }
7738 aflags.Directory = directory;
7739 if (!aurostd::FileExist(directory)) {
7740 oss << "pflow::CalculateFullSymmetry: ERROR: Unable to locate " << directory << ". Exiting." << endl;
7741 // return oss.str();
7742 return false;
7743 }
7744
7745 // while(symmetry_commensurate==false)
7746 if (print == false) // DX20170803 - PRINT
7747 { // CO20200106 - patching for auto-indenting
7748 if (format == "txt") { // DX20200623 - only overwrite the specified file format
7749 for (size_t iext = 1; iext < XHOST.vext.size(); iext++) { // SKIP uncompressed
7750 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_OUT + XHOST.vext[iext]) ||
7751 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_PATTERSON_OUT + XHOST.vext[iext]) || // DX20200129
7752 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT + XHOST.vext[iext]) || // DX20171205 - Added pgroupk_xtal
7753 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_OUT + XHOST.vext[iext]) ||
7754 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_OUT + XHOST.vext[iext])) {
7755 tocompress = true;
7756 }
7757 }
7758 for (size_t iext = 1; iext < XHOST.vext.size(); iext++) { // SKIP uncompressed
7759 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_OUT)) {
7760 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUP_OUT + ".*"));
7761 }
7762 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_OUT)) {
7763 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUP_XTAL_OUT + ".*"));
7764 }
7766 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_PATTERSON_OUT + ".*"));
7767 } // DX20200129
7768 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_OUT)) {
7769 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_OUT + ".*"));
7770 }
7771 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT)) {
7772 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_XTAL_OUT + ".*"));
7773 } // DX20171205 - Added pgroupk_xtal
7774 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_OUT)) {
7775 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_FGROUP_OUT + ".*"));
7776 }
7777 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_OUT)) {
7778 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_AGROUP_OUT + ".*"));
7779 }
7780 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_OUT)) {
7781 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_SGROUP_OUT + ".*"));
7782 }
7783 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_OUT)) {
7784 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_IATOMS_OUT + ".*"));
7785 }
7786 }
7787 } else if (format == "json") { // DX20200623 - only overwrite the specified file format
7788 for (size_t iext = 1; iext < XHOST.vext.size(); iext++) { // SKIP uncompressed
7789 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_JSON + XHOST.vext[iext]) ||
7790 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_PATTERSON_JSON + XHOST.vext[iext]) || // DX20200129
7791 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_JSON + XHOST.vext[iext]) || // DX20171205 - Added pgroupk_xtal
7792 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_JSON + XHOST.vext[iext]) ||
7793 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_JSON + XHOST.vext[iext])) {
7794 tocompress = true;
7795 }
7796 }
7797 for (size_t iext = 1; iext < XHOST.vext.size(); iext++) { // SKIP uncompressed
7798 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_JSON)) {
7799 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUP_JSON + ".*"));
7800 }
7801 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_JSON)) {
7802 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUP_XTAL_JSON + ".*"));
7803 }
7805 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_PATTERSON_JSON + ".*"));
7806 } // DX20200129
7807 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_JSON)) {
7808 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_JSON + ".*"));
7809 }
7810 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_JSON)) {
7811 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_XTAL_JSON + ".*"));
7812 } // DX20180516 - added pgroupk_xtal
7813 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_JSON)) {
7814 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_FGROUP_JSON + ".*"));
7815 }
7816 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_JSON)) {
7817 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_AGROUP_JSON + ".*"));
7818 }
7819 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_JSON)) {
7820 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_SGROUP_JSON + ".*"));
7821 }
7822 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_JSON)) {
7823 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_IATOMS_JSON + ".*"));
7824 }
7825 }
7826 }
7827 }
7828
7829 if (!pflow::PerformFullSymmetry(a, tolerance, a.sym_eps_no_scan, true, FileMESSAGE, aflags, kflags, osswrite, oss, format)) {
7830 return false;
7831 }
7832
7833 // DX20170803 - Print to symmetry operators to screen - START
7834 if (print == true) {
7835 KBIN_SymmetryToScreen(a, format, oss);
7836 }
7837 // DX20170803 - Print to symmetry operators to screen - END
7838
7839 // BZIP if necessary
7840 if (tocompress) {
7841 if (format == "txt") { // DX20170803 - FORMAT
7842 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_OUT)) {
7844 }
7845 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_OUT)) {
7847 }
7849 aurostd::CompressFile(directory + "/" + DEFAULT_AFLOW_PGROUPK_PATTERSON_OUT); // DX20200129
7850 }
7851 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_OUT)) {
7853 }
7854 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT)) {
7855 aurostd::CompressFile(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT); // DX20171205 - Added pgroupk_xtal
7856 }
7857 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_OUT)) {
7859 }
7860 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_OUT)) {
7862 }
7863 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_OUT)) {
7865 }
7866 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_OUT)) {
7868 }
7869 } else if (format == "json") { // DX20170803 - FORMAT
7870 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_JSON)) {
7872 }
7873 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_JSON)) {
7875 }
7877 aurostd::CompressFile(directory + "/" + DEFAULT_AFLOW_PGROUPK_PATTERSON_JSON); // DX20200129
7878 }
7879 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_JSON)) {
7881 }
7882 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_JSON)) {
7883 aurostd::CompressFile(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_JSON); // DX20171205 - Added pgroupk_xtal
7884 }
7885 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_JSON)) {
7887 }
7888 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_JSON)) {
7890 }
7891 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_JSON)) {
7893 }
7894 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_JSON)) {
7896 }
7897 }
7898 }
7899 // return oss.str(); //string("AFLOW "+string(AFLOW_VERSION)+" Symmetry Fixed in "+directory+" (need aflow>=2948)\n");
7900 return true; // string("AFLOW "+string(AFLOW_VERSION)+" Symmetry Fixed in "+directory+" (need aflow>=2948)\n");
7901 }
7902} // namespace pflow
7903
7904// ***************************************************************************
7905// pflow::fixEmptyAtomNames
7906// ***************************************************************************
7907// fixes POSCARs lacking column of atom names
7908// grabs from POTCAR information of aflow.in
7909// force_fix: override if a column is present, this may be crucial to fix issues with write_inequivalent_flag
7910namespace pflow {
7911 bool fixEmptyAtomNames(xstructure& xstr, bool force_fix) { // CO20190219
7912 xstr.fixEmptyAtomNames(force_fix);
7913 return true;
7914 }
7915} // namespace pflow
7916// DX+CO END
7917
7918// ***************************************************************************
7919// pflow::EXTRACT_Symmetry
7920// ***************************************************************************
7921namespace pflow {
7922 string EXTRACT_Symmetry(_aflags& aflags, vector<string> argv) {
7923 string directory = argv.at(2);
7924 bool tocompress = false;
7925 directory = aurostd::RemoveSubStringFirst(directory, _AFLOWIN_);
7926 aflags.Directory = directory;
7927 if (aurostd::FileExist(directory + "/" + _AFLOWIN_) == false) {
7928 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "File/Directory not found, nothing to do", _FILE_CORRUPT_); // CO20200624
7929 }
7930 for (size_t iext = 1; iext < XHOST.vext.size(); iext++) { // SKIP uncompressed
7931 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_OUT + XHOST.vext[iext]) ||
7932 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT + XHOST.vext[iext]) ||
7933 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_OUT + XHOST.vext[iext]) ||
7934 aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_OUT + XHOST.vext[iext])) {
7935 tocompress = true;
7936 }
7937 }
7938 for (size_t iext = 1; iext < XHOST.vext.size(); iext++) { // SKIP uncompressed
7939 // txt
7940 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_OUT)) {
7941 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUP_OUT + ".*"));
7942 }
7943 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_OUT)) {
7944 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_OUT + ".*"));
7945 }
7946 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_OUT)) {
7947 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUP_XTAL_OUT + ".*"));
7948 }
7949 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT)) {
7950 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_XTAL_OUT + ".*"));
7951 }
7952 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_OUT)) {
7953 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_FGROUP_OUT + ".*"));
7954 }
7955 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_OUT)) {
7956 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_AGROUP_OUT + ".*"));
7957 }
7958 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_OUT)) {
7959 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_SGROUP_OUT + ".*"));
7960 }
7961 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_OUT + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_OUT)) {
7962 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_IATOMS_OUT + ".*"));
7963 }
7964 // json
7965 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_JSON)) {
7966 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUP_JSON + ".*"));
7967 }
7968 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_JSON)) {
7969 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_JSON + ".*"));
7970 }
7971 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_JSON)) {
7972 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUP_XTAL_JSON + ".*"));
7973 }
7974 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_JSON)) {
7975 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_PGROUPK_XTAL_JSON + ".*"));
7976 }
7977 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_JSON)) {
7978 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_FGROUP_JSON + ".*"));
7979 }
7980 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_JSON)) {
7981 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_AGROUP_JSON + ".*"));
7982 }
7983 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_JSON)) {
7984 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_SGROUP_JSON + ".*"));
7985 }
7986 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_JSON + XHOST.vext[iext]) || aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_JSON)) {
7987 aurostd::RemoveFile(directory, std::regex(DEFAULT_AFLOW_IATOMS_JSON + ".*"));
7988 }
7989 }
7990 // LOAD _AFLOWIN_
7991 ofstream FileMESSAGE("/dev/null");
7992 _kflags kflags;
7993 kflags.AFLOW_MODE_VASP = true;
7994 _vflags vflags;
7995 _xvasp xvasp;
7996 xvasp.clear();
7997 ifstream FileAFLOWIN(string(directory + string("/" + _AFLOWIN_)).c_str());
7998 aurostd::InFileExistCheck("pflow::EXTRACT_Symmetry", string(directory + string("/" + _AFLOWIN_)).c_str(), FileAFLOWIN);
7999 string AflowIn;
8000 AflowIn = "";
8001 char c;
8002 while (FileAFLOWIN.get(c)) {
8003 AflowIn += c; // READ _AFLOWIN_ and put into AflowIn
8004 }
8005 FileAFLOWIN.close();
8006 AflowIn = aurostd::RemoveComments(AflowIn); // NOW Clean AFLOWIN //CO20180502
8007 aflags.QUIET = true;
8008 XHOST.QUIET = true;
8009 vflags = KBIN::VASP_Get_Vflags_from_AflowIN(AflowIn, aflags, kflags);
8010 KBIN::VASP_Produce_POSCAR(xvasp, AflowIn, FileMESSAGE, aflags, kflags, vflags);
8011 // CREATE PGROUP/FGROUP/SGROUP
8012 bool PGROUPWRITE = true;
8013 bool PGROUPKWRITE = true;
8014 bool FGROUPWRITE = true;
8015 bool SGROUPWRITE = false;
8016 bool IATOMSWRITE = true;
8017 bool AGROUPWRITE = true;
8018 const bool OSSWRITE = true; // to FileMESSAGE, does not matter as it is /dev/null
8019 SYM::CalculatePointGroup(FileMESSAGE, xvasp.str, aflags, PGROUPWRITE, OSSWRITE, cout);
8020 SYM::CalculatePointGroupKLattice(FileMESSAGE, xvasp.str, aflags, PGROUPKWRITE, OSSWRITE, cout);
8021 SYM::CalculateFactorGroup(FileMESSAGE, xvasp.str, aflags, FGROUPWRITE, OSSWRITE, cout);
8022 SYM::CalculateSpaceGroup(FileMESSAGE, xvasp.str, aflags, SGROUPWRITE, OSSWRITE, cout);
8023 SYM::CalculateInequivalentAtoms(FileMESSAGE, xvasp.str, aflags, IATOMSWRITE, OSSWRITE, cout);
8024 SYM::CalculateSitePointGroup(FileMESSAGE, xvasp.str, aflags, AGROUPWRITE, OSSWRITE, cout);
8025 // COMPRESS if necessary
8026 if (tocompress) {
8027 // txt
8028 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_OUT)) {
8030 }
8031 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_OUT)) {
8033 }
8034 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_OUT)) {
8036 }
8037 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_OUT)) {
8039 }
8040 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_OUT)) {
8042 }
8043 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_OUT)) {
8045 }
8046 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_OUT)) {
8048 }
8049 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_OUT)) {
8051 }
8052 // json
8053 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_JSON)) {
8055 }
8056 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_JSON)) {
8058 }
8059 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUP_XTAL_JSON)) {
8061 }
8062 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_PGROUPK_XTAL_JSON)) {
8064 }
8065 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_FGROUP_JSON)) {
8067 }
8068 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_SGROUP_JSON)) {
8070 }
8071 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_AGROUP_JSON)) {
8073 }
8074 if (aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_IATOMS_JSON)) {
8076 }
8077 }
8078 return string("AFLOW " + string(AFLOW_VERSION) + " Symmetry Fixed in " + directory + " (need aflow>=2948)\n");
8079 }
8080} // namespace pflow
8081
8082// ***************************************************************************
8083// pflow::FGROUP
8084// ***************************************************************************
8085namespace pflow {
8086 void FGROUP(_aflags& aflags, istream& input) {
8087 cout << aflow::Banner("BANNER_TINY") << endl;
8088 aflags.QUIET = true;
8089 xstructure a(input, IOAFLOW_AUTO);
8090 const bool WRITE = true;
8091 ofstream FileMESSAGE("/dev/null");
8092 // DX20170815 - Add in consistency checks SYM::CalculatePointGroup(FileMESSAGE,a,aflags,WRITE,true,cout);
8093 // DX20170815 - Add in consistency checks SYM::CalculateFactorGroup(FileMESSAGE,a,aflags,WRITE,true,cout);
8094 _kflags kflags; // DX20170815 - Add in consistency checks
8095 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true; // DX20170815 - Add in consistency checks
8096 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = false; // DX20170815 - Add in consistency checks
8097 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = true; // DX20170815 - Add in consistency checks
8098 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = false; // DX20170815 - Add in consistency checks
8099 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = false; // DX20170815 - Add in consistency checks //DX20171205 - Added pgroupk_xtal
8100 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = false; // DX20170815 - Add in consistency checks
8101 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = false; // DX20170815 - Add in consistency checks
8102 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = false; // DX20170815 - Add in consistency checks
8103 pflow::PerformFullSymmetry(a, FileMESSAGE, aflags, kflags, WRITE, cout); // DX20170815 - Add in consistency checks
8104 }
8105} // namespace pflow
8106
8107// ***************************************************************************
8108// pflow::FINDSYM
8109// ***************************************************************************
8110namespace pflow {
8111 void FINDSYM(aurostd::xoption& vpflow, uint mode, istream& input) {
8112 const bool LDEBUG = (false || XHOST.DEBUG);
8113 if (LDEBUG) {
8114 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
8115 }
8116 string flag_name;
8117 if (mode == 0) {
8118 flag_name = "FINDSYM_PRINT";
8119 }
8120 if (mode == 1) {
8121 flag_name = "FINDSYM_EXEC";
8122 }
8123 const string options = vpflow.getattachedscheme(flag_name);
8124 vector<string> tokens;
8125 aurostd::string2tokens(options, tokens, ",");
8126 if (tokens.size() >= 2) {
8127 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --findsym[_print][=tolerance_relative] < POSCAR");
8128 }
8129 // move on
8130
8131 xstructure a(input, IOAFLOW_AUTO);
8132 double tolerance = DEFAULT_FINDSYM_TOL;
8133 if (vpflow.flag("SG::TOLERANCE")) {
8134 const string tolerance_string = vpflow.getattachedscheme("SG::TOLERANCE");
8135 vector<string> tol_tokens;
8136 aurostd::string2tokens(tolerance_string, tol_tokens, ",");
8137 if (tol_tokens.empty()) {
8138 tolerance = DEFAULT_FINDSYM_TOL;
8139 }
8140 if (tol_tokens.size() == 1) {
8141 tolerance = aurostd::string2utype<double>(tol_tokens[0]);
8142 }
8143 }
8144 // Read in input file.
8145 if (mode == 0) {
8146 cout << a.findsym2print(tolerance) << endl;
8147 }
8148 if (mode == 1) {
8149 cout << a.findsym2execute(tolerance) << endl;
8150 }
8151
8152 if (LDEBUG) {
8153 cerr << __AFLOW_FUNC__ << " END" << endl;
8154 }
8155 }
8156} // namespace pflow
8157
8158// ***************************************************************************
8159// pflow::FIXBANDS
8160// ***************************************************************************
8161namespace pflow {
8162 bool FIXBANDS(_aflags& aflags, string opts) {
8163 const bool LDEBUG = (false || XHOST.DEBUG);
8164 stringstream aus;
8165 vector<string> kpoints_old;
8166 vector<string> eigenval_old;
8167 vector<string> tokens;
8168 vector<string> kpoints_new_string;
8169 stringstream kpoints_new;
8170 stringstream eigenval_new;
8171 const string directory = aflags.Directory;
8172 cout << XPID << "pflow::FIXBANDS: aflow --fix_bands=POSCAR,KPOINTS.bands.old,EIGENVAL.bands.old,KPOINTS.bands.new,EIGENVAL.bands.new" << endl;
8173 double grid = 0;
8174 uint points_bz = 0;
8175 uint eigenval_size = 0;
8176 uint nbands = 0;
8177 bool foundBZ;
8178 double pos4 = 0.0;
8179
8180 vector<string> vopt;
8181 aurostd::string2tokens(opts, vopt, ",");
8182 uint vopt_counter = 0;
8183
8184 if (vopt.size() < 5) {
8185 return false;
8186 }
8187 // FILE_POSCAR_IN ---------------------------------------
8188 const string FILE_POSCAR_IN = directory + "/" + vopt.at(vopt_counter++);
8189 if (aurostd::FileExist(FILE_POSCAR_IN) == false) {
8190 cout << XPID << "pflow::FIXBANDS: File POSCAR: " << FILE_POSCAR_IN << " not found, nothing to do" << endl;
8191 return false;
8192 } else {
8193 cout << XPID << "pflow::FIXBANDS: Load File POSCAR: " << FILE_POSCAR_IN << endl;
8194 }
8195 ifstream File_POSCAR_IN(FILE_POSCAR_IN.c_str());
8196 const xstructure str(File_POSCAR_IN, IOAFLOW_AUTO);
8197 File_POSCAR_IN.close();
8198 // FILE_KPOINTS_BANDS_OLD_IN ---------------------------------------
8199 const string FILE_KPOINTS_BANDS_OLD_IN = directory + "/" + vopt.at(vopt_counter++);
8200 if (aurostd::FileExist(FILE_KPOINTS_BANDS_OLD_IN) == false) {
8201 cout << XPID << "pflow::FIXBANDS: File KPOINTS_BANDS_OLD: " << FILE_KPOINTS_BANDS_OLD_IN << " not found, nothing to do" << endl;
8202 return false;
8203 } else {
8204 cout << XPID << "pflow::FIXBANDS: Load File KPOINTS_BANDS_OLD: " << FILE_KPOINTS_BANDS_OLD_IN << endl;
8205 }
8206 aurostd::string2tokens(aurostd::file2string(FILE_KPOINTS_BANDS_OLD_IN), kpoints_old, "\n");
8207 aus << kpoints_old.at(1);
8208 aus >> grid;
8209 // LATTICE ---------------------------------------
8210 aurostd::string2tokens(kpoints_old.at(0), tokens, " ");
8211 string LATTICE = tokens.at(0);
8212 if (LATTICE == "KPOINTS:" && tokens.size() > 1) {
8213 LATTICE = tokens[1];
8214 }
8215 // FILE_EIGENVAL_BANDS_OLD_IN ---------------------------------------
8216 const string FILE_EIGENVAL_BANDS_OLD_IN = directory + "/" + vopt.at(vopt_counter++);
8217 if (aurostd::FileExist(FILE_EIGENVAL_BANDS_OLD_IN) == false) {
8218 cout << XPID << "pflow::FIXBANDS: File EIGENVAL_BANDS_OLD: " << FILE_EIGENVAL_BANDS_OLD_IN << " not found, nothing to do" << endl;
8219 return false;
8220 } else {
8221 cout << XPID << "pflow::FIXBANDS: Load File EIGENVAL_BANDS_OLD: " << FILE_EIGENVAL_BANDS_OLD_IN << endl;
8222 }
8223 string tmp_eigenval = aurostd::file2string(FILE_EIGENVAL_BANDS_OLD_IN); // to avoid empty lines
8224 aurostd::StringSubstInPlace(tmp_eigenval, "\n", " \n"); // to avoid empty lines
8225 aurostd::string2tokens(tmp_eigenval, eigenval_old, "\n"); // to avoid empty lines
8226 // loaded eigenval now operate
8227 aurostd::string2tokens(eigenval_old.at(8), tokens, " ");
8228 eigenval_size = tokens.size() - 1;
8229 eigenval_size++;
8230 aurostd::string2tokens(eigenval_old.at(5), tokens, " ");
8231 points_bz = aurostd::string2utype<uint>(tokens.at(1));
8232 aurostd::string2tokens(eigenval_old.at(5), tokens, " ");
8233 nbands = aurostd::string2utype<uint>(tokens.at(2));
8234 aurostd::string2tokens(eigenval_old.at(7), tokens, " ");
8235 pos4 = aurostd::string2utype<double>(tokens.at(3));
8236
8237 uint step = 7;
8238 vector<xvector<double>> vbzpoint;
8239 vector<xmatrix<double>> vbzband;
8240
8241 for (uint ivbz = 0; ivbz < points_bz; ivbz++) {
8242 const xvector<double> bzpoint(3);
8243 aus.clear();
8244 aus.str(eigenval_old.at(step++));
8245 aus.precision(20);
8246 aus >> bzpoint[1] >> bzpoint[2] >> bzpoint[3] >> pos4;
8247 vbzpoint.push_back(bzpoint);
8248 const xmatrix<double> bzband(nbands, eigenval_size);
8249 for (uint ivbands = 0; ivbands < nbands; ivbands++) {
8250 aus.clear();
8251 aus.str(eigenval_old.at(step++));
8252 for (uint ieig = 0; ieig < eigenval_size; ieig++) {
8253 aus >> bzband[ivbands + 1][ieig + 1];
8254 }
8255 }
8256 vbzband.push_back(bzband);
8257 step++;
8258 // cerr << step << endl;
8259 }
8260 for (uint ivbz = 0; ivbz < points_bz; ivbz++) {
8261 // cerr << vbzpoint.at(ivbz) << endl;
8262 }
8263
8264 ; // cerr << vbzband.at(0) << endl;
8265 if (LDEBUG) {
8266 cerr << "DEBUG eigenval_size=" << eigenval_size << endl;
8267 }
8268 if (LDEBUG) {
8269 cerr << "DEBUG points_bz=" << points_bz << endl;
8270 }
8271 if (LDEBUG) {
8272 cerr << "DEBUG nbands=" << nbands << endl;
8273 }
8274 if (LDEBUG) {
8275 cerr << "DEBUG pos4=" << pos4 << endl;
8276 }
8277
8278 cout << XPID << "pflow::FIXBANDS: LATTICE=" << LATTICE << endl;
8279 string tmp_kpoints = LATTICE::KPOINTS_Directions(LATTICE, str.lattice, grid, str.iomode, foundBZ); // to avoid empty lines
8280 aurostd::StringSubstInPlace(tmp_kpoints, "\n", " \n"); // to avoid empty lines
8281 aurostd::string2tokens(tmp_kpoints, kpoints_new_string, "\n"); // to avoid empty lines
8282 // loaded kpoints now operate
8283 cout << XPID << "pflow::FIXBANDS: PATH= " << kpoints_new_string.at(0) << endl;
8284 kpoints_new.clear();
8285 kpoints_new.str(std::string());
8286 for (uint i = 0; i <= 3; i++) {
8287 kpoints_new << kpoints_new_string.at(i) << endl;
8288 }
8289 eigenval_new.clear();
8290 eigenval_new.str(std::string());
8291 for (uint i = 0; i <= 4; i++) {
8292 eigenval_new << eigenval_old.at(i) << endl;
8293 }
8294
8295 // Patch for EIGENVAL.new (KY adds it)
8296 int kpoints_NEW;
8297 kpoints_NEW = (kpoints_new_string.size() - 3) * grid / 3;
8298 eigenval_new << " " << int(grid) << " " << kpoints_NEW << " " << nbands << endl;
8299 // eigenval_new << " " << endl; //Comment this, move the blank line before the bands data,
8300 // Make the total lines of EIGENVAL.aflow exactly same with EIGENVAL.vasp, KY
8301
8302 for (size_t ikpz = 4; ikpz < kpoints_new_string.size();) {
8303 aurostd::string2tokens(kpoints_new_string[ikpz], tokens);
8304 if (tokens.size() < 2) {
8305 kpoints_new << kpoints_new_string.at(ikpz++) << endl;
8306 } else {
8307 // FROM
8308 xvector<double> kpoint_from(3);
8309 string string_from;
8310 aus.clear();
8311 aus.str(kpoints_new_string[ikpz]);
8312 string_from = kpoints_new_string.at(ikpz++);
8313 aus >> kpoint_from[1] >> kpoint_from[2] >> kpoint_from[3];
8314 // TO
8315 const xvector<double> kpoint_to(3);
8316 string string_to;
8317 aus.clear();
8318 aus.str(kpoints_new_string[ikpz]);
8319 string_to = kpoints_new_string.at(ikpz++);
8320 aus >> kpoint_to[1] >> kpoint_to[2] >> kpoint_to[3];
8321 // DELTA
8322 xvector<double> kpoint_delta(3);
8323 kpoint_delta = (kpoint_to - kpoint_from) / (grid - 1.0);
8324 const double kpoins_delta_prec = 1.0 * modulus(kpoint_delta);
8325 for (uint jkpz = 0; jkpz < (uint) grid; jkpz++) {
8326 // generated and scan
8327 uint index = 0;
8328 double err = 1.0e6;
8329 for (size_t ivbz = 0; ivbz < vbzpoint.size(); ivbz++) {
8330 if (modulus(vbzpoint[ivbz] - kpoint_from) < err) {
8331 index = ivbz;
8332 err = modulus(vbzpoint[ivbz] - kpoint_from);
8333 }
8334 }
8335 if (err > kpoins_delta_prec) {
8336 cerr << "************************************************" << endl;
8337 cerr << "kpoint_from: not found (" << kpoint_from << ")" << endl;
8338 cerr << "closest is vbzpoint.at(index)=" << vbzpoint.at(index) << " with err=" << err << endl;
8339 cerr << "************************************************" << endl;
8340 return false;
8341 }
8342 // in index there is the good point
8343
8344 eigenval_new << endl; // Put the blank line before the bands data, KY
8345 eigenval_new.precision(7);
8346 eigenval_new.setf(std::ios::scientific, std::ios::floatfield);
8347 eigenval_new << " " << vbzpoint.at(index)[1] << " " << vbzpoint.at(index)[2] << " " << vbzpoint.at(index)[3] << " " << pos4 << endl;
8348 for (uint ivbands = 1; ivbands <= nbands; ivbands++) {
8349 eigenval_new << " " << (int) vbzband.at(index)[ivbands][1];
8350 eigenval_new.precision(5);
8351 eigenval_new.setf(std::ios::fixed, std::ios::floatfield);
8352 for (uint ieig = 2; ieig <= eigenval_size; ieig++) {
8353 eigenval_new << " " << vbzband.at(index)[ivbands][ieig];
8354 }
8355 eigenval_new << endl;
8356 }
8357 // eigenval_new << endl; //Remove the additional blank line, Put the blank line before the bands data, KY
8358 // new one
8359 kpoint_from = kpoint_from + kpoint_delta;
8360 }
8361 // if OK
8362 kpoints_new << string_from << endl;
8363 kpoints_new << string_to << endl;
8364 }
8365 }
8366 kpoints_new << endl;
8367 // FILE_KPOINTS_BANDS_NEW_OUT ---------------------------------------
8368 const string FILE_KPOINTS_BANDS_NEW_OUT = directory + "/" + vopt.at(vopt_counter++);
8369 aurostd::stringstream2file(kpoints_new, FILE_KPOINTS_BANDS_NEW_OUT);
8370 cout << XPID << "pflow::FIXBANDS: Save File KPOINTS_BANDS_NEW: " << FILE_KPOINTS_BANDS_NEW_OUT << endl;
8371 // FILE_EIGENVAL_BANDS_NEW_OUT ---------------------------------------
8372 const string FILE_EIGENVAL_BANDS_NEW_OUT = directory + "/" + vopt.at(vopt_counter++);
8373 aurostd::stringstream2file(eigenval_new, FILE_EIGENVAL_BANDS_NEW_OUT);
8374 cout << XPID << "pflow::FIXBANDS: Save File EIGENVAL_BANDS_NEW: " << FILE_EIGENVAL_BANDS_NEW_OUT << endl;
8375
8376 return true;
8377 }
8378} // namespace pflow
8379
8380// ***************************************************************************
8381// pflow::FRAC
8382// ***************************************************************************
8383namespace pflow {
8384 xstructure FRAC(istream& input) {
8385 const xstructure a(input, IOAFLOW_AUTO);
8386 xstructure b(a);
8387 b.SetCoordinates(_COORDS_FRACTIONAL_);
8388 return b;
8389 }
8390} // namespace pflow
8391
8392// ***************************************************************************
8393// pflow::FROZSL_ANALYZE
8394// ***************************************************************************
8395namespace pflow {
8396 string FROZSL_ANALYZE(istream& input) {
8397 ostringstream oss;
8398 oss.clear();
8399 oss.setf(std::ios::fixed, std::ios::floatfield);
8400 const uint _precision_ = 10; // was 16 SC 10 DM
8401 oss.precision(_precision_);
8402
8403 vector<string> vinput;
8404 vector<string> tokens;
8405 vector<string> Mrefs;
8406 vector<double> Erefs;
8407 aurostd::stream2vectorstring(input, tokens);
8408 // take the good ones
8409 for (size_t i = 0; i < tokens.size(); i++) {
8410 if (aurostd::substring2bool(tokens[i], ":")) {
8411 vinput.push_back(tokens[i]);
8412 }
8413 }
8414 // find m0a0
8415 for (size_t i = 0; i < vinput.size(); i++) {
8416 if (aurostd::substring2bool(vinput[i], "m0a0")) {
8417 aurostd::string2tokens(vinput[i], tokens, "m0a0");
8418 Mrefs.push_back(tokens.at(0) + "m");
8419 aurostd::string2tokens(vinput[i], tokens, "=");
8420 Erefs.push_back(aurostd::string2utype<double>(tokens.at(tokens.size() - 1)));
8421 }
8422 }
8423 // for(size_t i=0;i<Mrefs.size();i++) cout << Mrefs.at(i) << " " << Erefs.at(i) << endl;
8424 // now print
8425 const double frozsl_eps = 1.0e-6;
8426 const double ev2hartree = 1.0 / 27.211383;
8427 for (size_t i = 0; i < vinput.size(); i++) {
8428 for (size_t j = 0; j < Mrefs.size(); j++) {
8429 if (aurostd::substring2bool(vinput[i], Mrefs[j])) {
8430 // cout << Mrefs.at(j) << " " << Erefs.at(j) << endl;
8431 aurostd::string2tokens(vinput[i], tokens, "=");
8432 if (std::abs(aurostd::string2utype<double>(tokens.at(tokens.size() - 1)) - Erefs.at(j)) > frozsl_eps) {
8433 oss << aurostd::PaddedPOST(aurostd::utype2string(1000 * ev2hartree * (aurostd::string2utype<double>(tokens.at(tokens.size() - 1)) - Erefs.at(j))), 23, " ") << " ! ";
8434 aurostd::string2tokens(vinput[i], tokens);
8435 oss << tokens.at(0) << " - " << Mrefs[j] << "0a0" << endl;
8436 }
8437 }
8438 }
8439 }
8440 return oss.str();
8441 }
8442} // namespace pflow
8443
8444namespace pflow {
8445 string FROZSL_ANALYZE_old(istream& input) {
8446 // this one was looking for the minimum
8447 ostringstream oss;
8448 oss.clear();
8449 oss.setf(std::ios::fixed, std::ios::floatfield);
8450 const uint _precision_ = 10; // was 16 SC 10 DM
8451 oss.precision(_precision_);
8452
8453 vector<string> vinput;
8454 vector<string> tokens;
8455 aurostd::stream2vectorstring(input, tokens);
8456 // take the good ones
8457 for (size_t i = 0; i < tokens.size(); i++) {
8458 if (aurostd::substring2bool(tokens[i], ":")) {
8459 vinput.push_back(tokens[i]);
8460 }
8461 }
8462 // find minimum
8463 double minE = 1.0e6;
8464 for (size_t i = 0; i < vinput.size(); i++) {
8465 aurostd::string2tokens(vinput[i], tokens, "=");
8466 minE = min(minE, aurostd::string2utype<double>(tokens.at(tokens.size() - 1)));
8467 }
8468 const double frozsl_eps = 1.0e-6;
8469 const double ev2hartree = 1.0 / 27.211383;
8470 for (size_t i = 0; i < vinput.size(); i++) {
8471 aurostd::string2tokens(vinput[i], tokens, "=");
8472 if (std::abs(aurostd::string2utype<double>(tokens.at(tokens.size() - 1)) - minE) > frozsl_eps) {
8473 oss << 1000 * ev2hartree * (aurostd::string2utype<double>(tokens.at(tokens.size() - 1)) - minE) << " ! ";
8474 aurostd::string2tokens(vinput[i], tokens);
8475 oss << tokens.at(0) << endl;
8476 }
8477 }
8478 return oss.str();
8479 }
8480} // namespace pflow
8481
8482// ***************************************************************************
8483// pflow::FROZSL_INPUT
8484// ***************************************************************************
8485namespace pflow {
8486 string FROZSL_INPUT() {
8487 _aflags aflags;
8488 aflags.Directory = "./";
8489 _kflags kflags;
8490 ofstream oss;
8491 string aflowin;
8492 string MESSAGE = "pflow::FROZSL_INPUT ERROR";
8493 aflowin = string(aflags.Directory + _AFLOWIN_);
8494 if (!aurostd::FileExist(aflowin)) {
8495 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "file not found: " + aflowin, _FILE_CORRUPT_); // CO20200624
8496 }
8497
8498 string AflowIn;
8499 aurostd::file2string(aflowin, AflowIn);
8500 FROZSL::WGET_INPUT(oss, AflowIn, aflags, kflags);
8501 // cout << oss << endl;
8502 return "";
8503 }
8504} // namespace pflow
8505
8506// ***************************************************************************
8507// pflow::FROZSL_OUTPUT
8508// ***************************************************************************
8509namespace pflow {
8510 string FROZSL_OUTPUT() {
8511 _aflags aflags;
8512 aflags.Directory = "./";
8513 _kflags kflags;
8514 ofstream oss;
8515 string aflowin;
8516 string MESSAGE = "pflow::FROZSL_OUTPUT ERROR";
8517 aflowin = string(aflags.Directory + _AFLOWIN_);
8518 if (!aurostd::FileExist(aflowin)) {
8519 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "file not found: " + aflowin, _FILE_CORRUPT_); // CO20200624
8520 }
8521 FROZSL::WGET_OUTPUT(oss, aflags, kflags);
8522 stringstream sss;
8523 aurostd::file2stringstream(aflags.Directory + "/" + DEFAULT_AFLOW_FROZSL_EIGEN_OUT, sss);
8524 // cerr << sss.str() << endl;
8525 return "";
8526 }
8527} // namespace pflow
8528
8529// ***************************************************************************
8530// pflow::FROZSL_VASPSETUP
8531// ***************************************************************************
8532namespace pflow {
8533 string FROZSL_VASPSETUP(vector<string> argv, int mode) {
8534 string strout;
8535 const string strfile = _FROZSL_VASPSETUP_FILE_;
8536 // cerr << "HERE argv.size()=" << argv.size() << endl;
8537
8538 if (mode == 0) {
8539 strout = aurostd::EmbData::get_content("phvaspsetup_AFLOW", "PHVASP");
8540 }
8541 if (mode == 1) {
8542 strout = aurostd::EmbData::get_content("phvaspsetup_POSCAR", "PHVASP");
8543 }
8544 if (argv.size() == 2) {
8545 aurostd::string2file(strout, strfile);
8546 // cerr << "HERE argv.size()=" << argv.size() << endl;
8547 aurostd::Chmod(0755, strfile);
8548 strout = aurostd::execute2string(strfile);
8549 aurostd::RemoveFile(strfile);
8550 return strout;
8551 }
8552 return strout;
8553 }
8554} // namespace pflow
8555
8556// ***************************************************************************
8557// pflow::GEOMETRY
8558// ***************************************************************************
8559namespace pflow {
8560 string GEOMETRY(istream& input) { // CO20191110
8561 xstructure a(input, IOAFLOW_AUTO);
8562 a.ReScale(1.0); // DX+ME20201229 - included scaling in a,b,c,alpha,beta,gamma
8563 return aurostd::joinWDelimiter(aurostd::xvecDouble2vecString(Getabc_angles(a.lattice, DEGREES), 5, true), ","); // roundoff
8564 }
8565} // namespace pflow
8566
8567// DX20170927 - get collinear magnetic info - START
8568// ***************************************************************************
8569// pflow::GetCollinearMagneticInfo
8570// ***************************************************************************
8571namespace pflow {
8572 bool GetCollinearMagneticInfo(uint num_atoms, const string& magmom_info, vector<double>& vmag) { // DX20191107 - int to uint
8573 const bool LDEBUG = (false || XHOST.DEBUG);
8574 if (aurostd::substring2bool(magmom_info, "OUTCAR")) {
8575 if (aurostd::FileExist(magmom_info)) {
8576 xOUTCAR outcar;
8577 outcar.GetPropertiesFile(magmom_info);
8578 for (size_t i = 0; i < outcar.vmag.size(); i++) {
8579 vmag.push_back(outcar.vmag[i]);
8580 }
8581 } else {
8582 cerr << XPID << "pflow::GetCollinearMagneticInfo: ERROR: OUTCAR file does not exist." << endl;
8583 return false;
8584 }
8585 } else if (aurostd::substring2bool(magmom_info, "INCAR")) {
8586 if (aurostd::FileExist(magmom_info)) {
8587 stringstream sss;
8588 aurostd::compressfile2stringstream(magmom_info, sss);
8589 vector<string> vcontent;
8590 aurostd::string2vectorstring(sss.str(), vcontent);
8591 bool magmom_found = false;
8592 for (size_t i = 0; i < vcontent.size(); i++) {
8593 if (vcontent[i].find("MAGMOM=") != std::string::npos) {
8594 vcontent[i] = aurostd::RemoveComments(vcontent[i]); // DX20210517 - better way to check/remove comments
8595 if (vcontent[i].find("MAGMOM=") == std::string::npos) {
8596 cerr << XPID << "pflow::GetCollinearMagneticInfo: ERROR: MAGMOM tag is commented out." << endl;
8597 return false;
8598 } else {
8599 const string magmom_values = aurostd::RemoveWhiteSpacesFromTheFrontAndBack(aurostd::RemoveCharacter(aurostd::RemoveSubString(vcontent[i], "MAGMOM="), '\n')); // DX20210517 - need to pre-condition string
8600 vector<string> mag_tokens;
8601 aurostd::string2tokens(magmom_values, mag_tokens, " "); // DX20210517 - need to split on spaces
8602 for (size_t m = 0; m < mag_tokens.size(); m++) {
8603 // INCAR allows multiplication of elements to describe magnetic moment (i.e. 2*2.0)
8604 if (mag_tokens[m].find("*") != std::string::npos) {
8605 vector<string> tokens;
8606 aurostd::string2tokens(mag_tokens[m], tokens, "*");
8607 const uint num_magmoms = aurostd::string2utype<uint>(tokens[0]); // DX20191107 - int to uint
8608 for (uint n = 0; n < num_magmoms; n++) {
8609 vmag.push_back(aurostd::string2utype<double>(tokens[1]));
8610 }
8611 } else if (!mag_tokens[m].empty()) { // DX20210517 - ensure the token is not empty
8612 vmag.push_back(aurostd::string2utype<double>(mag_tokens[m]));
8613 }
8614 }
8615 magmom_found = true;
8616 }
8617 }
8618 }
8619 if (!magmom_found) {
8620 cerr << XPID << "pflow::GetCollinearMagneticInfo: ERROR: MAGMOM tag was not found in the INCAR." << endl;
8621 return false;
8622 }
8623 } else {
8624 cerr << XPID << "pflow::GetCollinearMagneticInfo: ERROR: INCAR file does not exist." << endl;
8625 return false;
8626 }
8627 } else {
8628 vector<string> mag_tokens;
8629 aurostd::string2tokens(magmom_info, mag_tokens, ",");
8630 for (size_t m = 0; m < mag_tokens.size(); m++) {
8631 // Allows multiplication of elements to describe magnetic moment (i.e. 2*2.0)
8632 if (mag_tokens[m].find("*") != std::string::npos) {
8633 vector<string> tokens;
8634 aurostd::string2tokens(mag_tokens[m], tokens, "*");
8635 const uint num_magmoms = aurostd::string2utype<uint>(tokens[0]); // DX20191107 - int to uint
8636 for (uint n = 0; n < num_magmoms; n++) {
8637 vmag.push_back(aurostd::string2utype<double>(tokens[1]));
8638 }
8639 } else {
8640 vmag.push_back(aurostd::string2utype<double>(mag_tokens[m]));
8641 }
8642 }
8643 }
8644 if (vmag.size() != num_atoms) { // DX20191107 - remove (int) type casting
8645 if (LDEBUG) {
8646 cerr << XPID << "pflow::GetCollinearMagneticInfo: WARNING: Number of magnetic moments is not equivalent to the number of atoms." << endl;
8647 }
8648 return false;
8649 }
8650 return true;
8651 }
8652} // namespace pflow
8653// DX20170927 - get collinear magnetic info - END
8654
8655// DX20171205 - get non-collinear magnetic info - START
8656// ***************************************************************************
8657// pflow::GetNonCollinearMagneticInfo
8658// ***************************************************************************
8659namespace pflow {
8660 bool GetNonCollinearMagneticInfo(uint num_atoms, const string& magmom_info, vector<xvector<double>>& vmag_noncoll) { // DX20191107 - int to uint
8661 const bool LDEBUG = (false || XHOST.DEBUG);
8662 if (aurostd::substring2bool(magmom_info, "OUTCAR")) {
8663 if (aurostd::FileExist(magmom_info)) {
8664 xOUTCAR outcar;
8665 outcar.GetPropertiesFile(magmom_info);
8666 for (size_t i = 0; i < outcar.vmag_noncoll.size(); i++) {
8667 vmag_noncoll.push_back(outcar.vmag_noncoll[i]);
8668 }
8669 } else {
8670 cerr << XPID << "pflow::GetNonCollinearMagneticInfo: ERROR: OUTCAR file does not exist." << endl;
8671 return false;
8672 }
8673 } else if (aurostd::substring2bool(magmom_info, "INCAR")) {
8674 if (aurostd::FileExist(magmom_info)) {
8675 stringstream sss;
8676 aurostd::compressfile2stringstream(magmom_info, sss);
8677 vector<string> vcontent;
8678 aurostd::string2vectorstring(sss.str(), vcontent);
8679 bool magmom_found = false;
8680 for (size_t i = 0; i < vcontent.size(); i++) {
8681 if (vcontent[i].find("MAGMOM=") != std::string::npos) {
8682 vcontent[i] = aurostd::RemoveComments(vcontent[i]); // DX20210517 - better way to check/remove comments
8683 if (vcontent[i].find("MAGMOM=") == std::string::npos) {
8684 cerr << XPID << "pflow::GetNonCollinearMagneticInfo: ERROR: MAGMOM tag is commented out." << endl;
8685 return false;
8686 } else {
8687 const string magmom_values = aurostd::RemoveWhiteSpacesFromTheFrontAndBack(aurostd::RemoveCharacter(aurostd::RemoveSubString(vcontent[i], "MAGMOM="), '\n')); // DX20210517 - need to pre-condition string
8688 vector<string> mag_tokens;
8689 aurostd::string2tokens(magmom_values, mag_tokens, " "); // DX20210517 - need to split on spaces
8690 // INCAR allows multiplication of elements to describe magnetic moment (i.e. 2*2.0)
8691 vector<double> all_magmom_tokens;
8692 for (size_t m = 0; m < mag_tokens.size(); m++) {
8693 if (mag_tokens[m].find("*") != std::string::npos) {
8694 vector<string> tokens;
8695 aurostd::string2tokens(mag_tokens[m], tokens, "*");
8696 const uint num_magmoms = aurostd::string2utype<uint>(tokens[0]); // DX20191107 - int to uint
8697 for (uint n = 0; n < num_magmoms; n++) {
8698 all_magmom_tokens.push_back(aurostd::string2utype<double>(tokens[1]));
8699 }
8700 } else if (!mag_tokens[m].empty()) { // DX20210517 - ensure the token is not empty
8701 all_magmom_tokens.push_back(aurostd::string2utype<double>(mag_tokens[m]));
8702 }
8703 }
8704 // non-collinear check (should be divisible by 3)
8705 if (all_magmom_tokens.size() != 3 * num_atoms) { // DX20191107 - removed (int) type casting
8706 if (LDEBUG) {
8707 cerr << XPID << "pflow::GetNonCollinearMagneticInfo: WARNING: From INCAR. Number of magnetic moments not divisible by 3; not non-collinear system." << endl;
8708 }
8709 return false;
8710 }
8711 const xvector<double> mag_xyz;
8712 uint index = 1;
8713 for (size_t m = 0; m < all_magmom_tokens.size(); m++) {
8714 mag_xyz(index) = all_magmom_tokens[m];
8715 index++;
8716 if (index == 4) {
8717 vmag_noncoll.push_back(mag_xyz);
8718 index = 1;
8719 }
8720 }
8721 magmom_found = true;
8722 }
8723 }
8724 }
8725 if (!magmom_found) {
8726 cerr << XPID << "pflow::GetNonCollinearMagneticInfo: ERROR: MAGMOM tag was not found in the INCAR." << endl;
8727 return false;
8728 }
8729 } else {
8730 cerr << XPID << "pflow::GetNonCollinearMagneticInfo: ERROR: INCAR file does not exist." << endl;
8731 return false;
8732 }
8733 } else {
8734 vector<string> mag_tokens;
8735 aurostd::string2tokens(magmom_info, mag_tokens, ",");
8736 // Allows multiplication of elements to describe magnetic moment (i.e. 2*2.0)
8737 vector<double> all_magmom_tokens;
8738 for (size_t m = 0; m < mag_tokens.size(); m++) {
8739 if (mag_tokens[m].find("*") != std::string::npos) {
8740 vector<string> tokens;
8741 aurostd::string2tokens(mag_tokens[m], tokens, "*");
8742 const uint num_magmoms = aurostd::string2utype<uint>(tokens[0]); // DX20191107 - int to uint
8743 for (uint n = 0; n < num_magmoms; n++) {
8744 all_magmom_tokens.push_back(aurostd::string2utype<double>(tokens[1]));
8745 }
8746 } else {
8747 all_magmom_tokens.push_back(aurostd::string2utype<double>(mag_tokens[m]));
8748 }
8749 }
8750 // non-collinear check (should be divisible by 3)
8751 if (all_magmom_tokens.size() != 3 * num_atoms) { // DX20191107 - removed (int) type casting
8752 if (LDEBUG) {
8753 cerr << XPID << "pflow::GetNonCollinearMagneticInfo: WARNING: From manual input. Number of magnetic moments is not three times the number of atoms; not non-collinear system." << endl;
8754 }
8755 return false;
8756 }
8757 const xvector<double> mag_xyz;
8758 uint index = 1;
8759 for (size_t m = 0; m < all_magmom_tokens.size(); m++) {
8760 mag_xyz(index) = all_magmom_tokens[m];
8761 index++;
8762 if (index == 4) {
8763 vmag_noncoll.push_back(mag_xyz);
8764 index = 1;
8765 }
8766 }
8767 }
8768 return true;
8769 }
8770} // namespace pflow
8771// DX20170927 - get collinear magnetic info - END
8772
8773// ***************************************************************************
8774// pflow::ATOMIC_ENVIRONMENT
8775// ***************************************************************************
8776namespace pflow { // HE20210331
8778 string auid;
8779 uint ae_mode = ATOM_ENVIRONMENT_MODE_1;
8780 double radius = 4.0;
8781 if (vpflow.flag("ATOMIC_ENVIRONMENT::AUID")) {
8782 auid = vpflow.getattachedscheme("ATOMIC_ENVIRONMENT::AUID");
8783 } else {
8784 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "missing auid - could not load structure", _INPUT_ERROR_);
8785 }
8786 if (vpflow.flag("ATOMIC_ENVIRONMENT::MODE")) {
8787 ae_mode = vpflow.getattachedutype<uint>("ATOMIC_ENVIRONMENT::MODE");
8788 }
8789 if (vpflow.flag("ATOMIC_ENVIRONMENT::RADIUS")) {
8790 radius = vpflow.getattachedutype<double>("ATOMIC_ENVIRONMENT::RADIUS");
8791 }
8792 pflow::outputAtomicEnvironment(auid, ae_mode, radius);
8793 }
8794} // namespace pflow
8795
8796// ***************************************************************************
8797// pflow::GLASS_FORMING_ABILITY
8798// ***************************************************************************
8799namespace pflow { // DF20190329
8800 void GLASS_FORMING_ABILITY(aurostd::xoption& vpflow) { // DF20190329
8801
8802 const string alloy = vpflow.getattachedscheme("PFLOW::ALLOY");
8803 string AE_file_read = vpflow.getattachedscheme("GFA::AE_FILE");
8804 //[CO20190628 - AFLOWRC default]double fe_cut = aurostd::string2utype<double>(vpflow.getattachedscheme("GFA::FORMATION_ENTHALPY_CUTOFF")); //DF20190619
8806
8807 if (!vpflow.flag("PFLOW::ALLOY")) {
8808 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "Must specify an alloy system; e.g.: --alloy=CaMg", _INPUT_MISSING_); // CO20200624
8809 }
8810
8811 cout << endl << "Calculating glass-forming ability for " << alloy << "." << endl;
8812
8813 if (!vpflow.flag("GFA::AE_FILE")) {
8814 AE_file_read = "none";
8815 cout << endl
8816 << "No AE input file? That's ok, will calculate the atomic environments." << endl
8817 << "alternatively, set --ae_file= to specify a file of atomic environments to read; e.g.: --ae_file=All_atomic_environments_read.dat" << endl;
8818 } else if (!aurostd::FileExist(AE_file_read)) {
8819 cout << endl << "Can't find " << AE_file_read << ". Will calculate all atomic environments." << endl;
8820 AE_file_read = "none";
8821 } else {
8822 cout << endl << "Reading atomic environments from file: " << AE_file_read << "." << endl;
8823 }
8824
8825 //[CO20190628 - AFLOWRC default]if(!vpflow.flag("GFA::FORMATION_ENTHALPY_CUTOFF")) { //DF20190619
8826 //[CO20190628 - AFLOWRC default] fe_cut = 0.05;
8827 //[CO20190628 - AFLOWRC default]}
8828 if (vpflow.flag("GFA::FORMATION_ENTHALPY_CUTOFF")) {
8829 fe_cut = aurostd::string2utype<double>(vpflow.getattachedscheme("GFA::FORMATION_ENTHALPY_CUTOFF"));
8830 } // CO20190628
8831 cout << endl << "Using " << fe_cut << " eV formation enthalpy cutoff for structures to include in the analysis." << endl;
8832
8833 pflow::CalculateGFA(vpflow, alloy, AE_file_read, fe_cut); // DF20190619
8834 }
8835} // namespace pflow
8836
8837// ***************************************************************************
8838// pflow::GULP
8839// ***************************************************************************
8840namespace pflow {
8841 void GULP(istream& input) {
8842 const xstructure a(input, IOAFLOW_AUTO);
8843 pflow::PrintGulp(a, cout);
8844 }
8845} // namespace pflow
8846
8847// ***************************************************************************
8848// pflow::HKL
8849// ***************************************************************************
8850namespace pflow {
8851 void HKL(const string& options, _aflags& aflags, istream& input) {
8852 const bool LDEBUG = (false || XHOST.DEBUG);
8853 if (LDEBUG) {
8854 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
8855 }
8856 vector<string> tokens;
8857 aurostd::string2tokens(options, tokens, ",");
8858 if (tokens.size() != 3 && tokens.size() != 4) {
8859 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --hkl=h,k,l[,bond] < POSCAR");
8860 }
8861 const xstructure a(input, IOAFLOW_AUTO);
8862 if (LDEBUG) {
8863 cerr << XPID << "pflow::HKL: a=" << a << endl;
8864 }
8865 vector<vector<double>> planesreducible;
8866 vector<vector<double>> planesirreducible;
8867
8868 if (LDEBUG) {
8869 cerr << XPID << "pflow::HKL: mode=" << tokens.size() << endl;
8870 }
8871 const xvector<double> iparams(tokens.size(), 1);
8872 if (!tokens.empty()) {
8873 iparams(1) = aurostd::string2utype<double>(tokens[0]);
8874 }
8875 if (tokens.size() > 1) {
8876 iparams(2) = aurostd::string2utype<double>(tokens[1]);
8877 }
8878 if (tokens.size() > 2) {
8879 iparams(3) = aurostd::string2utype<double>(tokens[2]);
8880 }
8881 if (tokens.size() > 3) {
8882 iparams(4) = aurostd::string2utype<double>(tokens[3]);
8883 }
8884 if (LDEBUG) {
8885 cerr << XPID << "pflow::HKL: iparams=" << iparams << endl;
8886 }
8887
8888 surface::GetSurfaceHKL(a, aflags, iparams, planesreducible, planesirreducible, cout);
8889 if (LDEBUG) {
8890 cerr << __AFLOW_FUNC__ << " END" << endl;
8891 }
8892 }
8893
8894} // namespace pflow
8895
8896// ***************************************************************************
8897// pflow::HKLSearchSearch Trivial/Simple/Complete
8898// ***************************************************************************
8899namespace pflow {
8900 void HKLSearch(const string& options, _aflags& aflags, istream& input, const string& smode) {
8901 const bool LDEBUG = true; //(false || XHOST.DEBUG);
8902 if (LDEBUG) {
8903 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
8904 }
8905 vector<string> tokens;
8906 aurostd::string2tokens(options, tokens, ",");
8907
8908 if (LDEBUG) {
8909 cerr << XPID << "pflow::HKLSearch: smode=" << smode << endl;
8910 }
8911 if (LDEBUG) {
8912 cerr << XPID << "pflow::HKLSearch: tokens.size()=" << tokens.size() << endl;
8913 }
8914 if (LDEBUG) {
8915 cerr << XPID << "pflow::HKLSearch: options=" << options << endl;
8916 }
8917
8918 if (smode == "HKL_SEARCH_TRIVIAL" && tokens.size() > 3) {
8919 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --hkl_search[=khlmax[,bond[,step]]] < POSCAR");
8920 }
8921 if (smode == "HKL_SEARCH_SIMPLE" && tokens.size() > 4) {
8922 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --hkl_search_simple[=cutoff[,bond[,khlmax[,step]]]] < POSCAR");
8923 }
8924 if (smode == "HKL_SEARCH_COMPLETE" && tokens.size() > 4) {
8925 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --hkl_search_complete[=cutoff[,bond[,khlmax[,step]]]] < POSCAR");
8926 }
8927 const xstructure a(input, IOAFLOW_AUTO);
8928 // if(LDEBUG) cerr << XPID << "pflow::HKL: a=" << a << endl;
8929 vector<vector<double>> planesreducible;
8930 vector<vector<double>> planesirreducible;
8931 vector<vector<uint>> planesirreducible_images;
8932
8933 if (LDEBUG) {
8934 cerr << XPID << "pflow::HKLSearch: tokens.size()=" << tokens.size() << endl;
8935 }
8936 const xvector<double> iparams(tokens.size(), (!tokens.empty()));
8937 // cerr << iparams.lrows << endl;
8938 // cerr << iparams.urows << endl;
8939 if (LDEBUG) {
8940 cerr << XPID << "pflow::HKLSearch: iparams.rows=" << iparams.rows << endl;
8941 }
8942
8943 if (!tokens.empty()) {
8944 iparams(1) = aurostd::string2utype<double>(tokens[0]);
8945 }
8946 if (tokens.size() > 1) {
8947 iparams(2) = aurostd::string2utype<double>(tokens[1]);
8948 }
8949 if (tokens.size() > 2) {
8950 iparams(3) = aurostd::string2utype<double>(tokens[2]);
8951 }
8952 if (tokens.size() > 3) {
8953 iparams(4) = aurostd::string2utype<double>(tokens[3]);
8954 }
8955 if (LDEBUG) {
8956 cerr << XPID << "pflow::HKLSearch: iparams=" << iparams << endl;
8957 }
8958
8959 surface::GetSurfaceHKLSearch(a, aflags, iparams, planesreducible, planesirreducible, planesirreducible_images, cout, smode);
8960 cout << "REDUCIBLE_SIZE " << planesreducible.size() << endl;
8961 cout << "IRREDUCIBLE_SIZE " << planesirreducible.size() << endl;
8962 if (LDEBUG) {
8963 cerr << __AFLOW_FUNC__ << " END" << endl;
8964 }
8965 }
8966} // namespace pflow
8967
8968// ***************************************************************************
8969// Function pflow::HNF
8970// ***************************************************************************
8971namespace pflow {
8972 bool setPOCCTOL(xstructure& xstr, const string& pocc_tol_string) { // CO20181226
8973 const bool LDEBUG = (false || XHOST.DEBUG);
8974 if (LDEBUG) {
8975 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
8976 cerr << __AFLOW_FUNC__ << " pocc_tol_string=" << pocc_tol_string << endl;
8977 }
8978 if (pocc_tol_string.empty()) {
8979 return false;
8980 }
8981 stringstream message;
8982 if (aurostd::substring2bool(pocc_tol_string, ",")) {
8983 message << "Cannot handle more than one pocc_tol specification";
8985 }
8986 vector<string> tokens;
8987 aurostd::string2tokens(pocc_tol_string, tokens, ":");
8988 double tol;
8989 if (!tokens.empty()) {
8990 if (!aurostd::isfloat(tokens[0])) {
8991 message << "Input is not a float [input=" << tokens[0] << "]";
8993 }
8994 tol = aurostd::string2utype<double>(tokens[0]);
8995 if (aurostd::isequal(tol, 0.0, _AFLOW_POCC_ZERO_TOL_)) {
8996 message << "Tolerance is too small (0) [input=" << tokens[0] << "]";
8998 }
8999 if (std::signbit(tol)) {
9000 xstr.neg_scale_second = true;
9001 xstr.partial_occupation_HNF = -1 * (int) tol;
9002 } else {
9003 // defaults both tols, stoich_tol to be overwritten if another tolerance is provided
9004 xstr.partial_occupation_site_tol = xstr.partial_occupation_stoich_tol = tol;
9005 }
9006 }
9007 if (tokens.size() > 1) {
9008 if (!aurostd::isfloat(tokens[1])) {
9009 message << "Input is not a float [input=" << tokens[1] << "]";
9011 }
9012 tol = aurostd::string2utype<double>(tokens[1]);
9013 if (aurostd::isequal(tol, 0.0, _AFLOW_POCC_ZERO_TOL_)) {
9014 message << "Tolerance is too small (0) [input=" << tokens[1] << "]";
9016 }
9017 if (std::signbit(tol)) {
9018 message << "Tolerance cannot be negative [input=" << tokens[1] << "]";
9020 }
9021 xstr.scale_third.isentry = true;
9022 xstr.partial_occupation_stoich_tol = tol;
9023 }
9024 return true;
9025 }
9026} // namespace pflow
9027
9028// ***************************************************************************
9029// Function pflow::POCC_COMMAND_LINE
9030// ***************************************************************************
9031namespace pflow {
9032 bool POCC_COMMAND_LINE(aurostd::xoption& vpflow, istream& input, ostream& oss) { // CO20181226
9033 // ME20210429 - Do not print banner for web output
9034 if (!XHOST.vflag_control.flag("WWW")) {
9035 oss << aflow::Banner("BANNER_NORMAL");
9036 }
9037 xstructure xstr(input, IOAFLOW_AUTO);
9038 if (vpflow.flag("POCC_TOL")) {
9039 setPOCCTOL(xstr, vpflow.getattachedscheme("POCC_TOL"));
9040 }
9041 pocc::POccCalculator pcalc(xstr, vpflow, oss); // CO20190319
9042 pcalc.m_count_unique_fast = vpflow.flag("POCC_COUNT_UNIQUE_FAST");
9043 if (!pcalc.m_initialized) {
9044 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "POccCalculator failed to initialized");
9045 }
9046 pcalc.calculateHNF();
9047 if (vpflow.flag("HNF")) {
9048 return pcalc.m_initialized;
9049 }
9050 pcalc.getTotalPermutationsCount();
9051 if (vpflow.flag("POCC_COUNT_TOTAL")) {
9052 return pcalc.m_initialized;
9053 }
9054 pcalc.calculate();
9055 if (vpflow.flag("POCC_COUNT_UNIQUE") || vpflow.flag("POCC_COUNT_UNIQUE_FAST")) {
9056 return pcalc.m_initialized;
9057 }
9058 oss << AFLOWIN_SEPARATION_LINE << endl;
9059 oss << "Creating list of unique derivative supercells." << endl; // CO20190116
9060 for (unsigned long long int i = 0; i < pcalc.getUniqueSuperCellsCount(); i++) {
9061 // populate POCC_UNIQUE_DERIVATIVE_STRUCTURES_FILE
9062 oss << AFLOWIN_SEPARATION_LINE << endl;
9063 oss << _VASP_POSCAR_MODE_EXPLICIT_START_ << endl; // ." << ss_pocc_count.str() << endl;
9064 oss << pcalc.getUniqueSuperCell(i);
9065 oss << _VASP_POSCAR_MODE_EXPLICIT_STOP_ << endl; // ." << ss_pocc_count.str() << endl;
9066 oss << AFLOWIN_SEPARATION_LINE << endl;
9067 }
9068 return pcalc.m_initialized;
9069 }
9070} // namespace pflow
9071
9072namespace pflow {
9073 string HNF(vector<string> argv, istream& input, ostream& oss) {
9074 oss << AFLOWIN_SEPARATION_LINE << endl; // --------------------------------
9075 oss << "[AFLOW] " << aflow::Banner("BANNER_TINY") << endl;
9076 // oss << "argv.size()=" << argv.size() << endl;
9077 xstructure str(input, IOAFLOW_AUTO);
9078 str.BringInCell();
9079 // str.partial_occupation_sum=0;
9080 // GET SYMMETRY
9081 str.CalculateSymmetryPointGroup();
9082 // str.CalculateSymmetryFactorGroup();
9083 oss << "[AFLOW] CALCULATION OF HNF xstructures" << endl;
9084 oss << "[AFLOW] pgroup operations = " << str.pgroup.size() << endl;
9085 oss.flush();
9086 // oss << "fgroup operations = " << str.fgroup.size() << endl;
9087 // oss << "pgroupk operations = " << str.pgroupk.size() << endl;
9088
9089 int choice = 2;
9090 if (argv.size() >= 3) {
9091 choice = aurostd::args2utype(argv, "--hnf", 2);
9092 }
9093 vector<int> vn;
9094 if (choice > 0) {
9095 vn.push_back(choice);
9096 }
9097 if (choice < 0) {
9098 for (int i = 2; i <= -choice; i++) {
9099 vn.push_back(i);
9100 }
9101 }
9102 if (choice == 0) {
9103 oss << "[AFLOW] pflow::HNF n=0" << endl << AFLOWIN_SEPARATION_LINE << endl;
9104 }
9105
9106 vector<xmatrix<double>> sHNF; // contains only the supercells HNF that are uniques
9107 for (size_t in = 0; in < vn.size(); in++) {
9108 const int n = vn[in];
9109 oss << AFLOWIN_SEPARATION_LINE << endl; // --------------------------------
9110 oss << "[AFLOW] n = " << n << endl;
9111 sHNF = CalculateHNF(str, n);
9112 // PHYSICAL REVIEW B 77, 224115 2008
9113 // Algorithm for generating derivative structures
9114 // Gus L. W. Hart and Rodney W. Forcade
9115 // xmatrix<double> HNF(3,3);
9116 // vector<xmatrix<double> > vHNF;
9117 // xmatrix<double> A(3,3),B(3,3),Bi(3,3),Bj(3,3),R(3,3),H(3,3);A=trasp(str.lattice);
9118 // vector<xmatrix<double> > vB; // contains lattices of the potential xstructures
9119 // vector<xmatrix<double> > sHNF; // contains only the supercells HNF that are uniques
9120 // long long int i=0;
9121 // bool found=false;
9122 // for(int a=1;a<=n;a++)
9123 // for(int c=1;c<=n/a;c++)
9124 // for(int f=1;f<=n/a/c;f++)
9125 // if(a*c*f==n)
9126 // for(int b=0;b<c;b++)
9127 // for(int d=0;d<f;d++)
9128 // for(int e=0;e<f;e++) {
9129 // i++;
9130 // HNF(1,1)=a;HNF(1,2)=0;HNF(1,3)=0;
9131 // HNF(2,1)=b;HNF(2,2)=c;HNF(2,3)=0;
9132 // HNF(3,1)=d;HNF(3,2)=e;HNF(3,3)=f;
9133 // vHNF.push_back(HNF);
9134 // }
9135 // oss << "[AFLOW] HNF = " << vHNF.size() << endl;
9136 // oss.flush();
9137 // for(i=0;i<(int) vHNF.size();i++) {
9138 // Bi=A*vHNF.at(i);
9139 // found=false;
9140 // for(size_t istr=0;istr<vB.size()&&found==false;istr++) { // cycle through the unique vBs
9141 // Bj=vB.at(istr);
9142 // for(size_t pgroup=0;pgroup<str.pgroup.size()&&found==false;pgroup++) { // cycle through the pgroup of str
9143 // R=trasp(str.pgroup.at(pgroup).Uc);
9144 // H=aurostd::inverse(Bj)*aurostd::inverse(R)*Bi;
9145 // if(aurostd::isinteger(H)) found=true;
9146 // }
9147 // }
9148 // if(found==false) { // not found, then plug
9149 // vB.push_back(Bi);
9150 // sHNF.push_back(vHNF.at(i));
9151 // // cerr << "+";
9152 // }
9153 //}
9154 // oss << endl;
9155 // oss << "[AFLOW] supercells = " << vB.size() << endl;
9156 oss << "[AFLOW] supercells = " << sHNF.size() << endl;
9157 oss << AFLOWIN_SEPARATION_LINE << endl; // --------------------------------
9158 oss.flush();
9159 for (size_t j = 0; j < sHNF.size(); j++) {
9160 xstructure strj = GetSuperCell(str, trasp(sHNF[j]));
9161 // strj.Standard_Conventional_UnitCellForm();
9162 // strj.iomode=IOVASP_ABCCAR;
9163 strj.title += " [HNF(" + aurostd::utype2string(n) + ")=" + aurostd::utype2string(j + 1) + "/" + aurostd::utype2string(sHNF.size()) + "=";
9164 for (uint ii = 1; ii <= 3; ii++) {
9165 for (uint jj = 1; jj <= 3; jj++) {
9166 strj.title += aurostd::utype2string(sHNF[j](ii, jj)) + (ii * jj < 9 ? "," : "]");
9167 }
9168 }
9169 oss << "[VASP_POSCAR_MODE_EXPLICIT]START.HNF_" << n << "_" << j + 1 << "_" << sHNF.size() << endl;
9170 oss << strj; // << endl;
9171 // oss << strj.title << endl;
9172 oss << "[VASP_POSCAR_MODE_EXPLICIT]STOP.HNF_" << n << "_" << j + 1 << "_" << sHNF.size() << endl;
9173 oss << AFLOWIN_SEPARATION_LINE << endl; // --------------------------------
9174 oss.flush();
9175 }
9176 }
9177 cerr << aurostd::ostream2string(oss) << endl;
9178 return aurostd::ostream2string(oss);
9179 }
9180} // namespace pflow
9181
9182// ***************************************************************************
9183// Function pflow::HNFTOL
9184// ***************************************************************************
9185namespace pflow {
9186 string HNFTOL(vector<string> argv, istream& input, ostream& oss) {
9187 oss << AFLOWIN_SEPARATION_LINE << endl; // --------------------------------
9188 oss << "[AFLOW] " << aflow::Banner("BANNER_TINY") << endl;
9189 // oss << "argv.size()=" << argv.size() << endl;
9190 xstructure str(input, IOAFLOW_AUTO);
9191 str.BringInCell();
9192 // str.partial_occupation_sum=0;
9193 // GET SYMMETRY
9194 // str.CalculateSymmetryPointGroup(); //CO, cannot calculate symmetry of a structure with overlapping atoms
9195 // str.CalculateSymmetryFactorGroup();
9196 oss << "[AFLOW] CALCULATION OF HNFTOL xstructures" << endl;
9197 // oss << "[AFLOW] pgroup operations = " << str.pgroup.size() << endl;
9198 oss.flush();
9199 // oss << "fgroup operations = " << str.fgroup.size() << endl;
9200 // oss << "pgroupk operations = " << str.pgroupk.size() << endl;
9201 uint digits = 6;
9202 uint digits1 = 4;
9203 uint digits2 = 2 * digits + 11;
9204
9205 double tolerance = DEFAULT_POCC_SITE_TOL; // DEFAULT_PARTIAL_OCCUPATION_TOLERANCE; //CO20181226
9206 if (argv.size() >= 3) {
9207 tolerance = aurostd::args2utype(argv, "--hnftol", (double) DEFAULT_POCC_SITE_TOL); // DEFAULT_PARTIAL_OCCUPATION_TOLERANCE); //CO20181226
9208 }
9209 if (argv.size() == 2) {
9210 tolerance = str.partial_occupation_site_tol;
9211 } // CO20180409
9212 oss << "[AFLOW] hnf_tolerance=" << tolerance << endl;
9213 oss << AFLOWIN_SEPARATION_LINE << endl; // --------------------------------
9214 oss << _VASP_POSCAR_MODE_EXPLICIT_START_ << endl;
9215 oss << str; // << endl;
9216 oss << _VASP_POSCAR_MODE_EXPLICIT_STOP_ << endl;
9217 oss << AFLOWIN_SEPARATION_LINE << endl; // --------------------------------
9218 oss.precision(digits);
9219 double error = 1.0;
9220 double eps;
9221 int HNFi = 0;
9222 vector<double> error_iatom;
9223 vector<double> effective_pocc_iatom;
9224 vector<uint> M_iatom;
9225 for (size_t iatom = 0; iatom < str.atoms.size(); iatom++) {
9226 error_iatom.push_back(1.0);
9227 }
9228 for (size_t iatom = 0; iatom < str.atoms.size(); iatom++) {
9229 effective_pocc_iatom.push_back(0.0);
9230 }
9231 for (size_t iatom = 0; iatom < str.atoms.size(); iatom++) {
9232 M_iatom.push_back(0);
9233 }
9234
9235 oss << aurostd::PaddedPRE(aurostd::utype2string(0), digits1) << " " << "--------" << " ";
9236 for (size_t iatom = 0; iatom < str.atoms.size(); iatom++) {
9237 if (str.atoms[iatom].partial_occupation_value < 1.0) {
9238 oss << "| " + aurostd::PaddedPOST("iatom=" + aurostd::utype2string(iatom) + "/" + aurostd::utype2string(str.atoms.size()), digits2) << " ";
9239 }
9240 }
9241 oss << " | " << "error" << endl;
9242 while (error > tolerance) {
9243 HNFi++;
9244 error = 1.0 / HNFi;
9245 oss << aurostd::PaddedPRE(aurostd::utype2string(HNFi), digits1) << " " << error << " "; // endl;
9246 for (size_t iatom = 0; iatom < str.atoms.size(); iatom++) {
9247 error_iatom.at(iatom) = 1.0;
9248 M_iatom.at(iatom) = 0;
9249 for (int j = 0; j <= HNFi; j++) {
9250 eps = std::abs((double) j / HNFi - str.atoms[iatom].partial_occupation_value);
9251 if (eps < error_iatom.at(iatom)) {
9252 error_iatom.at(iatom) = eps;
9253 M_iatom.at(iatom) = (uint) j;
9254 effective_pocc_iatom.at(iatom) = (double) M_iatom.at(iatom) / HNFi;
9255 }
9256 }
9257 }
9258 for (size_t iatom = 0; iatom < str.atoms.size(); iatom++) {
9259 if (str.atoms[iatom].partial_occupation_value < 1.0) {
9260 stringstream aus;
9261 aus.precision(digits);
9262 aus.setf(std::ios::fixed, std::ios::floatfield);
9263 aus << effective_pocc_iatom.at(iatom) << "," << error_iatom.at(iatom) << "," << M_iatom.at(iatom) << "/" << HNFi;
9264 oss << "| " << aurostd::PaddedPOST(aus.str(), digits2) << " ";
9265 }
9266 }
9267 error = aurostd::max(error_iatom);
9268 oss << " | " << error << endl;
9269 }
9270 oss << AFLOWIN_SEPARATION_LINE << endl; // --------------------------------
9271 // DONE
9272 return aurostd::ostream2string(oss);
9273 }
9274} // namespace pflow
9275
9276// ***************************************************************************
9277// pflow::IDENTICAL
9278// ***************************************************************************
9279namespace pflow {
9280 xstructure IDENTICAL(istream& input) {
9281 const xstructure a(input, IOAFLOW_AUTO);
9282 xstructure b(a);
9283 b = IdenticalAtoms(b);
9284 return b;
9285 }
9286} // namespace pflow
9287
9288// ***************************************************************************
9289// pflow::INCELL
9290// ***************************************************************************
9291namespace pflow {
9292 xstructure INCELL(istream& input) {
9293 const xstructure a(input, IOAFLOW_AUTO);
9294 xstructure b(a);
9295 b = BringInCell(b);
9296 return b;
9297 }
9298} // namespace pflow
9299
9300// ***************************************************************************
9301// pflow::INCOMPACR
9302// ***************************************************************************
9303namespace pflow {
9304 xstructure INCOMPACT(istream& input) {
9305 const xstructure a(input, IOAFLOW_AUTO);
9306 xstructure b;
9307 b = PutInCompact(a);
9308 return b;
9309 }
9310} // namespace pflow
9311
9312// ***************************************************************************
9313// pflow::INTPOL
9314// ***************************************************************************
9315namespace pflow {
9316 void INTPOL(const string& options) {
9317 const bool LDEBUG = (false || XHOST.DEBUG);
9318 if (LDEBUG) {
9319 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
9320 }
9321 vector<string> tokens;
9322 aurostd::string2tokens(options, tokens, ",");
9323 if (tokens.size() != 4) {
9324 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --intpol=file1,file2,nimages,nearest_image_flag");
9325 }
9326 if (!aurostd::FileExist(tokens.at(0))) {
9327 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "file not found: " + tokens[0], _FILE_CORRUPT_); // CO20200624
9328 }
9329 if (!aurostd::FileExist(tokens.at(1))) {
9330 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "file not found: " + tokens[1], _FILE_CORRUPT_); // CO20200624
9331 }
9332 const xstructure strA(tokens.at(0), IOAFLOW_AUTO);
9333 const xstructure strB(tokens.at(1), IOAFLOW_AUTO);
9334
9335 cout << aflow::Banner("BANNER_TINY") << endl;
9336 const int nimages = aurostd::string2utype<int>(tokens.at(2));
9337 const string nearest_image_flag = tokens.at(3);
9338 PrintImages(strA, strB, nimages, nearest_image_flag);
9339 if (LDEBUG) {
9340 cerr << __AFLOW_FUNC__ << " END" << endl;
9341 }
9342 }
9343} // namespace pflow
9344
9345// ***************************************************************************
9346// pflow::INWS
9347// ***************************************************************************
9348namespace pflow {
9349 xstructure INWS(istream& input) {
9350 const xstructure a(input, IOAFLOW_AUTO);
9351 xstructure b;
9352 b = BringInWignerSeitz(a);
9353 return b;
9354 }
9355} // namespace pflow
9356
9357// ***************************************************************************
9358// pflow::JMOL
9359// ***************************************************************************
9360// Stefano Curtarolo (Dec-2009) //modification Richard Taylor // modification SC Oct2014
9361namespace pflow {
9362 void JMOL(const string& options, istream& input) {
9363 const bool LDEBUG = (false || XHOST.DEBUG);
9364 if (LDEBUG) {
9365 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
9366 }
9367 string COLOR = "white"; // default
9368 bool WRITE = false; // default
9369 const xvector<int> ijk(3); // default
9370 ijk[1] = 1;
9371 ijk[2] = 1;
9372 ijk[3] = 1; // default
9373
9374 vector<string> tokens;
9375 aurostd::string2tokens(options, tokens, ",");
9376
9377 if (tokens.size() > 5) {
9378 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --jmol[=n1[,n2[,n3[,color[,true/false]]]]] < POSCAR");
9379 }
9380
9381 if (!tokens.empty()) {
9382 ijk[1] = aurostd::string2utype<int>(tokens[0]);
9383 }
9384 if (tokens.size() >= 2) {
9385 ijk[2] = aurostd::string2utype<int>(tokens[1]);
9386 }
9387 if (tokens.size() >= 3) {
9388 ijk[3] = aurostd::string2utype<int>(tokens[2]);
9389 }
9390 if (tokens.size() >= 4) {
9391 COLOR = tokens[3];
9392 }
9393 if (tokens.size() >= 5) {
9394 if (tokens[4] == "true" || tokens[4] == "1") {
9395 WRITE = true;
9396 cerr << XPID << "pflow::JMOL: saving output..." << endl;
9397 }
9398 }
9399 // ofstream script; //file to determine color of background, bond width etc
9400 ofstream ras;
9401 const string rasFILE = "ras." + XHOST.ostrPID.str() + "." + XHOST.ostrTID.str(); // CO20200502 - threadID
9402 ras.open(rasFILE.c_str(), std::ios::out);
9403 ras << "background " << COLOR << endl << "wireframe " << 0.05 << endl; // radius of bond in angstroms
9404 // anymore? (http://jmol.sourceforge.net/docs/JmolUserGuide/ch04.html)
9405 ras.close();
9406
9407 ofstream FileOUTPUT;
9408 const string FileOUTPUTName = "aflow.jmol.xyz." + XHOST.ostrPID.str() + "." + XHOST.ostrTID.str(); // CO20200502 - threadID
9409 FileOUTPUT.open(FileOUTPUTName.c_str(), std::ios::out);
9410 if (FileOUTPUT) {
9411 xvector<int> _ijk(vabs(ijk));
9412 if (max(_ijk) == 0) {
9413 _ijk.set(1);
9414 }
9415 ostringstream aus_exec;
9416 xstructure a(input, IOAFLOW_AUTO);
9417 if (_ijk(1) != 1 || _ijk(2) != 1 || _ijk(3) != 1) {
9418 a = GetSuperCell(a, _ijk);
9419 }
9420 pflow::PrintCIF(FileOUTPUT, a);
9421 FileOUTPUT.close();
9422 // cerr << _ijk << endl;
9423 aus_exec << XHOST.command("jmol") << " -s " << rasFILE << " " << FileOUTPUTName << endl; // " && rm -f " << FileOUTPUTName << endl;
9424 aurostd::execute(aus_exec);
9425 // aurostd::StringstreamClean(aus_exec);
9426 if (WRITE == false) {
9427 aurostd::RemoveFile(FileOUTPUTName);
9428 }
9429 aurostd::RemoveFile(rasFILE);
9430 } else {
9431 FileOUTPUT.close();
9432 }
9433 }
9434} // namespace pflow
9435
9436// ***************************************************************************
9437// pflow::KBAND
9438// ***************************************************************************
9439// Wahyu Setyawan (Nov-2009)
9440namespace pflow {
9441 void KBAND(vector<string> argv) {
9442 // 2008 wahyu setyawan ws26@duke.edu
9443 // 2008 roman chepulskyy rc74@duke.edu
9444 // cout << " uband -h : help\n"
9445 // << " uband 1 : nonspin\n"
9446 // << " uband 2 : spin-polarized.\n";
9447#define _NSEGMAX_ 50
9448
9449 int const argc = argv.size();
9450 ifstream kin;
9451 ifstream ein;
9452 ifstream din;
9453
9454 if (argc != 3) {
9455 return;
9456 }
9457 if (!(atoi(&argv.at(2)[0]) == 1 or atoi(&argv.at(2)[0]) == 2)) {
9458 return;
9459 }
9460
9461 int i;
9462 int ind;
9463 int ispin;
9464 int iseg;
9465 int itmp;
9466 int j;
9467 int ngrid;
9468 int nseg;
9469 int nband;
9470 float ftmp;
9471 float kseg[_NSEGMAX_][4];
9472 float kx1;
9473 float ky1;
9474 float kz1;
9475 float kx2;
9476 float ky2;
9477 float kz2;
9478 float dkx;
9479 float dky;
9480 float dkz;
9481 float dk;
9482 float koffset;
9483 string tmpstr;
9484
9485 ispin = atoi(&argv.at(2)[0]);
9486 kin.open("KPOINTS");
9487 getline(kin, tmpstr);
9488 kin >> ngrid;
9489 getline(kin, tmpstr);
9490 getline(kin, tmpstr);
9491 getline(kin, tmpstr);
9492 i = 0;
9493 while (!kin.eof()) {
9494 i++;
9495 kin >> kseg[i][1] >> kseg[i][2] >> kseg[i][3];
9496 getline(kin, tmpstr);
9497 }
9498 nseg = i / 2;
9499 kin.close();
9500 // constructing kline from the norm of kpoints cascaded for continuous plot
9501 const xvector<float> kline(nseg * ngrid);
9502 koffset = 0;
9503 ind = 1;
9504 for (iseg = 1; iseg <= nseg; iseg++) {
9505 i = 2 * iseg - 1;
9506 kx1 = kseg[i][1];
9507 ky1 = kseg[i][2];
9508 kz1 = kseg[i][3];
9509 kx2 = kseg[i + 1][1];
9510 ky2 = kseg[i + 1][2];
9511 kz2 = kseg[i + 1][3];
9512 // knorm1=sqrt(kx1*kx1 + ky1*ky1 + kz1*kz1); //kstart
9513 // knorm2=koffset+sqrt(kx2*kx2 + ky2*ky2 + kz2*kz2); //kstop
9514 dkx = kx2 - kx1;
9515 dky = ky2 - ky1;
9516 dkz = kz2 - kz1;
9517 dk = (sqrt(dkx * dkx + dky * dky + dkz * dkz)) / (ngrid - 1);
9518 kline[ind++] = koffset;
9519 for (j = 2; j <= ngrid; j++) {
9520 kline[ind++] = koffset + (j - 1) * dk;
9521 }
9522 koffset = koffset + dk * (ngrid - 1);
9523 }
9524 // creating overall kband data
9525 // format:
9526 // spinup spindown
9527 // kline[1] band1 band2 band3 ... band1 band2 band3 ...
9528 // kline[2] band1 band2 band3 ... band1 band2 band3 ...
9529 //...
9530 // this format is nice for plotting with kpoints as the x-axis
9531 ein.open("EIGENVAL");
9532 getline(ein, tmpstr);
9533 getline(ein, tmpstr);
9534 getline(ein, tmpstr);
9535 getline(ein, tmpstr);
9536 getline(ein, tmpstr);
9537 ein >> itmp >> itmp;
9538 if (nseg != itmp / ngrid) {
9539 cerr << "error nseg inconsistent between KPOINTS and EIGENVAL\n";
9540 return;
9541 }
9542 ein >> nband;
9543 getline(ein, tmpstr);
9544 const xmatrix<float> kband(nseg * ngrid, ispin * nband + 1);
9545 for (i = 1; i <= nseg * ngrid; i++) {
9546 ein >> ftmp >> ftmp >> ftmp >> ftmp;
9547 kband[i][1] = kline[i];
9548 for (j = 1; j <= nband; j++) {
9549 ein >> ftmp >> kband[i][j + 1];
9550 if (ispin == 2) {
9551 ein >> kband[i][nband + j + 1];
9552 }
9553 }
9554 }
9555 ein.close();
9556 // output
9557 for (i = 1; i <= nseg * ngrid; i++) {
9558 for (j = 1; j <= nband * ispin + 1; j++) {
9559 cout << " " << kband[i][j];
9560 }
9561 cout << endl;
9562 }
9563 }
9564} // namespace pflow
9565
9566// ***************************************************************************
9567// pflow::KPATH
9568// ***************************************************************************
9569namespace pflow {
9570 void KPATH(istream& input, bool WWW) { // CO20200329
9571 const xstructure str_in(input, IOAFLOW_AUTO);
9572 double grid = DEFAULT_BANDS_GRID;
9573 if (str_in.num_each_type.size() == 1) {
9575 }
9576 return KPATH(input, grid, WWW);
9577 }
9578 void KPATH(istream& input, double grid, bool WWW) {
9579 const xstructure str_in(input, IOAFLOW_AUTO);
9580 if (std::signbit(grid)) { // CO20200329
9581 grid = DEFAULT_BANDS_GRID;
9582 if (str_in.num_each_type.size() == 1) {
9584 }
9585 }
9586 xstructure str_sp;
9587 xstructure str_sc;
9588 const bool full_sym = false; // DX20170829 - Speed increase
9589 LATTICE::Standard_Lattice_Structure(str_in, str_sp, str_sc, full_sym); // DX20170829 - Speed increase
9590 string lattice_type;
9591 stringstream oss;
9592 string sss;
9593 bool foundBZ;
9594 // if(grid<=0.0) grid=16.0; // no more default
9595 lattice_type = str_sp.bravais_lattice_variation_type;
9596 // if(WWW) cout << "<pre>" << endl;
9597 cout << "! STRUCTURE TO RUN ***********************************************************************" << endl; // AZ202402022 switched from // to ! so this works in qe and vasp
9598 oss.clear();
9599 oss << str_sp;
9600 sss = oss.str();
9601 if (WWW) {
9602 aurostd::StringSubstInPlace(sss, "<", "&#60;");
9603 aurostd::StringSubstInPlace(sss, ">", "&#62;");
9604 }
9605 cout << sss;
9606 cout << "! KPOINTS TO RUN *************************************************************************" << endl; // AZ202402022 switched from // to ! so this works in qe and vasp
9607 sss = LATTICE::KPOINTS_Directions(lattice_type, str_sp.lattice, grid, str_sp.iomode, foundBZ);
9608 if (WWW) {
9609 aurostd::StringSubstInPlace(sss, "<", "&#60;");
9610 aurostd::StringSubstInPlace(sss, ">", "&#62;");
9611 }
9612 cout << sss;
9613 // cout << LATTICE::KPOINTS_Directions(lattice_type,str_sp.lattice,grid,foundBZ);
9614 // if(WWW) cout << "</pre>" << endl;
9615 if (WWW) {
9616 cout << "// PATH ***********************************************************************************" << endl;
9617 // cout << lattice_type << endl;
9618 // cout << str_sp.lattice << endl;
9619 cout << "</pre>" << endl;
9620 cout << "<img src=https://" << XHOST.AFLOW_MATERIALS_SERVER << "/SCIENCE/images/brillouin/" << lattice_type << ".PNG><br>" << endl; // ME+DX20210521 - remove height, let the CSS handle it
9621 // cout << "<br> [ ";
9622 // cout << "<a href=http://" << XHOST.AFLOW_MATERIALS_SERVER << "/SCIENCE/images/brillouin/" << lattice_type << ".PNG>png</a>";
9623 // cout << " | ";
9624 // cout << "<a href=http://" << XHOST.AFLOW_MATERIALS_SERVER << "/SCIENCE/images/brillouin/" << lattice_type << ".EPS>eps</a>";
9625 // cout << " ] ";
9626 cout << "<pre>" << endl;
9627 }
9628 cout << "! END ************************************************************************************" << endl;
9629 }
9630} // namespace pflow
9631
9632// ***************************************************************************
9633// pflow::KPOINTS
9634// ***************************************************************************
9635namespace pflow {
9636 xstructure KPOINTS(const string& options, istream& input, ostream& oss) {
9637 const bool LDEBUG = (false || XHOST.DEBUG);
9638 if (LDEBUG) {
9639 cerr << __AFLOW_FUNC__ << " BEGIN" << endl; // CO20190520
9640 }
9641 vector<string> tokens;
9642 aurostd::string2tokens(options, tokens, ",");
9643 if (tokens.size() != 1) {
9644 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --kpoints=KDENS [or --kppra=KDENS,-k=KDENS] < POSCAR"); // CO20190520
9645 }
9646 int NK = aurostd::string2utype<int>(tokens.at(0));
9647
9648 oss << aflow::Banner("BANNER_TINY") << endl;
9649 xstructure str(input, IOAFLOW_AUTO);
9650 if (NK == 0) {
9651 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "--kpoints=NUMBER: NUMBER must be bigger than zero", _INPUT_ILLEGAL_); // CO20200624
9652 } else {
9653 const ofstream FileDUMMY;
9654 if (NK > 10000000) {
9655 NK = 10000000;
9656 }
9657 oss << kintro << "KPPRA = " << NK << " (requested) " << endl;
9658 const double NK_tmp = (int) ((double) NK / str.atoms.size() + 0.5);
9659 if (NK < 1) {
9660 NK = 1; // CO20180226 - this is done inside KPPRA(), so don't overwrite NK
9661 }
9662 oss << kintro << "KPPRA/#AT = " << NK_tmp << endl; // CO20180226
9663 KPPRA(str, NK);
9664 if (LDEBUG) { // CO20190401
9665 cerr << __AFLOW_FUNC__ << " str.kpoints_k1=" << str.kpoints_k1 << endl;
9666 cerr << __AFLOW_FUNC__ << " str.kpoints_k2=" << str.kpoints_k2 << endl;
9667 cerr << __AFLOW_FUNC__ << " str.kpoints_k3=" << str.kpoints_k3 << endl;
9668 }
9669 // oss << kintro << "KPOINTS = [" << str.kpoints_k1 << "," << str.kpoints_k2 << "," << str.kpoints_k3 << "]" << endl;
9670 oss << kintro << "DKGRID = [" << modulus(str.klattice(1)) / str.kpoints_k1 << "," << modulus(str.klattice(2)) / str.kpoints_k2 << "," << modulus(str.klattice(3)) / str.kpoints_k3 << "]" << endl;
9671 oss << kintro << "KPPRA = " << str.kpoints_kppra << " (found) " << endl;
9672 // oss << kintro << "next line for automatic scripting (with cat POSCAR | aflow --kpoints | grep -i AUTO | sed \"s/AUTO//g\")" << endl;
9673 oss << kintro << "KPOINTS = " << str.kpoints_k1 << " " << str.kpoints_k2 << " " << str.kpoints_k3 << endl;
9674 if (LDEBUG) {
9675 cerr << __AFLOW_FUNC__ << " END" << endl; // CO20190520
9676 }
9677 return str;
9678 }
9679 }
9680} // namespace pflow
9681
9682// ***************************************************************************
9683// pflow::KPOINTS_DELTA
9684// ***************************************************************************
9685namespace pflow {
9686 xstructure KPOINTS_DELTA(aurostd::xoption& vpflow, istream& input, ostream& oss) {
9687 const bool LDEBUG = (false || XHOST.DEBUG);
9688 const double DK = aurostd::string2utype<double>(vpflow.getattachedscheme("FLAG::XVASP_KPOINTS_DELTA")); // tokens.at(0)); //CO20171010
9689
9690 oss << aflow::Banner("BANNER_TINY") << endl;
9691 xstructure str(input, IOAFLOW_AUTO);
9692 if (DK <= 1.0E-6) {
9693 stringstream message;
9694 message << "--delta_kpoints=NUMBER: NUMBER must be bigger than zero (dk=" << DK << ")";
9695 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, message, _INPUT_ILLEGAL_); // CO20200624
9696 } else {
9697 const ofstream FileDUMMY;
9698 oss << kintro << "DK = " << DK << " (requested) " << endl;
9699 KPPRA_DELTA(str, DK);
9700 // oss << kintro << "KPOINTS = [" << str.kpoints_k1 << "," << str.kpoints_k2 << "," << str.kpoints_k3 << "]" << endl;
9701 oss << kintro << "DKGRID = [" << modulus(str.klattice(1)) / str.kpoints_k1 << "," << modulus(str.klattice(2)) / str.kpoints_k2 << "," << modulus(str.klattice(3)) / str.kpoints_k3 << "]" << endl;
9702 oss << kintro << "KPPRA = " << str.kpoints_kppra << " (found) " << endl;
9703 // oss << kintro << "next line for automatic scripting (with cat POSCAR | aflow --kpoints | grep -i AUTO | sed \"s/AUTO//g\")" << endl;
9704 oss << kintro << "KPOINTS = " << str.kpoints_k1 << " " << str.kpoints_k2 << " " << str.kpoints_k3 << endl;
9705 if (LDEBUG) {
9706 cerr << __AFLOW_FUNC__ << " END" << endl;
9707 }
9708 return str;
9709 }
9710 }
9711} // namespace pflow
9712
9713// ***************************************************************************
9714// pflow::JOINSTRLIST
9715// ***************************************************************************
9716namespace pflow {
9717 void JOINSTRLIST(vector<string> argv) {
9718 ifstream list1_inf(argv.at(2).c_str());
9719 aurostd::InFileExistCheck("aflow", argv.at(2).c_str(), list1_inf);
9720 ifstream list2_inf(argv.at(3).c_str());
9721 aurostd::InFileExistCheck("aflow", argv.at(3).c_str(), list2_inf);
9722 std::vector<xstructure> str_vec_1(0);
9723 std::vector<xstructure> str_vec_2(0);
9724 std::vector<xstructure> str_vec_tot(0);
9725 pflow::ReadInStrVec(str_vec_1, list1_inf);
9726 pflow::ReadInStrVec(str_vec_2, list2_inf);
9727 pflow::JoinStrVec(str_vec_1, str_vec_2, str_vec_tot);
9728 pflow::PrintStrVec(str_vec_tot, cout);
9729 }
9730} // namespace pflow
9731
9732// ***************************************************************************
9733// pflow::LATTICEREDUCTION
9734// ***************************************************************************
9735namespace pflow {
9736 xstructure LATTICEREDUCTION(istream& input) {
9737 const xstructure a(input, IOAFLOW_AUTO);
9738 return LatticeReduction(a);
9739 }
9740} // namespace pflow
9741
9742// ***************************************************************************
9743// pflow::LATTICE_TYPE
9744// ***************************************************************************
9745namespace pflow {
9746 string LATTICE_TYPE(istream& input, aurostd::xoption& vpflow) { // DX20200820
9747 stringstream sss;
9748 xstructure a(input, IOAFLOW_AUTO);
9749 const double tolerance = pflow::getSymmetryTolerance(a, vpflow.getattachedscheme("LATTICE::TOLERANCE")); // DX20200820 - consolidated setting tolerance into a function
9750 a.sym_eps = tolerance; // DX20200820 - add tolerance
9751 xstructure str_sp;
9752 xstructure str_sc; // DX20170824 - Speed increase
9753 const bool full_sym = false; // DX20170829 - Speed increase
9754 LATTICE::Standard_Lattice_Structure(a, str_sp, str_sc, full_sym); // DX20170829 - Speed increase
9755 // sss << " Real space lattice primitive = " << a.bravais_lattice_type << endl;
9756 // sss << " Real space lattice variation = " << a.bravais_lattice_variation_type << endl;//WSETYAWAN mod
9757 // sss << " Real space conventional lattice = " << a.bravais_conventional_lattice_type << endl;
9758 // sss << " Real space Pearson symbol = " << a.pearson_symbol << endl;
9759 sss << str_sp.bravais_lattice_type << "," << str_sp.bravais_lattice_variation_type << endl; // WSETYAWAN mod //DX20170824 - a to str_sp
9760 // sss << a.bravais_lattice_type << "," << a.bravais_conventional_lattice_type << endl;
9761 return sss.str();
9762 }
9763} // namespace pflow
9764
9765// ***************************************************************************
9766// pflow::LATTICE_LATTICE_TYPE
9767// ***************************************************************************
9768namespace pflow {
9769 string LATTICE_LATTICE_TYPE(istream& input, aurostd::xoption& vpflow) { // DX20200820
9770 stringstream sss;
9771 xstructure a(input, IOAFLOW_AUTO);
9772 const double tolerance = pflow::getSymmetryTolerance(a, vpflow.getattachedscheme("LATTICE_LATTICE::TOLERANCE")); // DX20200820 - consolidated setting tolerance into a function
9773 a.sym_eps = tolerance; // DX20200820 - add tolerance
9774 xstructure str_sp;
9775 xstructure str_sc; // DX20170824 - Speed increase
9776 const bool full_sym = false; // DX20170829 - Speed increase
9777 LATTICE::Bravais_Lattice_StructureDefault(a, str_sp, str_sc, full_sym); // DX20170829 - Speed increase
9778 // sss << " Real space lattice primitive = " << a.bravais_lattice_lattice_type << endl;
9779 // sss << " Real space lattice variation = " << a.bravais_lattice_lattice_variation_type << endl;//WSETYAWAN mod
9780 // sss << " Real space conventional lattice = " << a.bravais_conventional_lattice_lattice_type << endl;
9781 // sss << " Real space Pearson symbol = " << a.pearson_symbol << endl;
9782 sss << str_sp.bravais_lattice_lattice_type << "," << str_sp.bravais_lattice_lattice_variation_type << endl; // WSETYAWAN mod //DX20170824 - a to str_sp
9783 // sss << a.bravais_lattice_lattice_type << "," << a.bravais_conventional_lattice_lattice_type << endl;
9784 return sss.str();
9785 }
9786} // namespace pflow
9787
9788// DX20190109 - list prototype labels - START
9789// ***************************************************************************
9790// pflow::listPrototypeLabels()
9791// ***************************************************************************
9792namespace pflow {
9794 const anrl::ProtoData pd = anrl::ProtoData::get();
9795
9796 // ----- mode -----//
9797 enum Mode {
9798 all, //< get all prototypes
9799 n_nary, //< get n-nary prototypes
9800 stoichiometry, //< get prototypes with given stoichiometry
9801 symmetry //< get prototypes with given symmetry
9802 };
9803 Mode mode = all;
9804
9805 // ----- library name ----- //
9806 string library = "all"; // default: all; legacy; encyclopedia
9807 if (vpflow.flag("LIST_PROTOTYPE_LABELS::LIBRARY")) {
9808 library = vpflow.getattachedscheme("LIST_PROTOTYPE_LABELS::LIBRARY");
9809 }
9810
9811 // ----- arity/number of species ----- //
9812 uint arity = 0; // default: 0=all; other options: 1=unary, 2=binary, etc.
9813 if (vpflow.flag("LIST_PROTOTYPE_LABELS::ARITY")) {
9814 mode = Mode::n_nary;
9815 arity = aurostd::string2utype<uint>(vpflow.getattachedscheme("LIST_PROTOTYPE_LABELS::ARITY"));
9816 }
9817
9818 // ----- stoichiometry ----- //
9819 std::string stoichiometry_key;
9820 // default: <empty>=any; other options: x,x,...
9821 if (vpflow.flag("LIST_PROTOTYPE_LABELS::STOICHIOMETRY")) {
9822 vector<string> tokens;
9823 stringstream message;
9824 vector<uint> stoichiometry;
9825 mode = Mode::stoichiometry;
9826 aurostd::string2tokens(vpflow.getattachedscheme("LIST_PROTOTYPE_LABELS::STOICHIOMETRY"), tokens, ",");
9827 for (size_t i = 0; i < tokens.size(); i++) {
9828 stoichiometry.push_back(aurostd::string2utype<uint>(tokens[i]));
9829 }
9830 if (arity != 0 && arity != stoichiometry.size()) {
9831 message << "arity=" << arity << " and stoichiometry=" << aurostd::joinWDelimiter(stoichiometry, ",") << " do not match.";
9832 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, message, _INPUT_ERROR_); // DX20191107 - exit -> throw
9833 }
9834 std::sort(stoichiometry.begin(), stoichiometry.end(), std::greater<>()); // must sort to properly filter
9835 stoichiometry_key = aurostd::joinWDelimiter(stoichiometry, ':');
9836 }
9837
9838 // ----- space group number ----- //
9839 uint space_group_number = 0; // default: 0=any; other options: 1-230.
9840 if (vpflow.flag("LIST_PROTOTYPE_LABELS::SPACE_GROUP")) {
9841 mode = Mode::symmetry;
9842 space_group_number = aurostd::string2utype<uint>(vpflow.getattachedscheme("LIST_PROTOTYPE_LABELS::SPACE_GROUP"));
9843 }
9844
9845 //-------------------------------------------------
9846 // get prototype uids
9847 vector<string> prototype_uid;
9848
9849 // get all prototype labels
9850 switch (mode) {
9851 case all: prototype_uid = pd.lookup[library]; break;
9852 // get n-nary prototype labels
9853 case n_nary: prototype_uid = pd.lookup["number_of_species"][arity]; break;
9854 // get prototype labels via stoichiometry
9855 case stoichiometry: prototype_uid = pd.lookup["stoichiometry"][stoichiometry_key]; break;
9856 // get prototype labels via symmetry
9857 case symmetry: prototype_uid = pd.lookup["space_group_number"][space_group_number]; break;
9858 }
9859 std::string output;
9860 if (vpflow.flag("LIST_PROTOTYPE_LABELS::JSON")) {
9862 for (const auto& uid : prototype_uid) {
9863 output_json[uid] = pd.content[uid]["label"];
9864 }
9865 output = output_json.toString();
9866 } else {
9867 for (const auto& uid : prototype_uid) {
9868 output += static_cast<string>(pd.content[uid]["label"]) + "(" + uid + ")\n";
9869 }
9870 }
9871 return output;
9872 }
9873} // namespace pflow
9874// DX20190109 - list prototype labels - END
9875
9878// START - all relevent functions for loading entries here
9879// Added by Corey Oses - May 2017
9880// load entries is heavily overloaded, mostly to accommodate entries separated as
9881// vector<vector<vector<> > > entries (unaries vs. binaries, then species-specific, good for convex hull),
9882// vector<vector<> > entries (unaries vs. binaries), OR
9883// vector<> entries (all together)
9884// ***************************************************************************
9885// pflow::loadEntries(aurostd::xoption& vpflow,vector<string>& velements,string server,
9886// ofstream& FileMESSAGE, ostream& oss)
9887// ***************************************************************************
9888namespace pflow {
9889 string arity_string(uint arity, bool capital, bool plural) { // for printing, so we don't need to make zillions of if statements elsewhere
9890 if (arity == 0) {
9891 return (capital ? string("N") : string("n")) + string("ullar") + (plural ? string("ies") : string("y"));
9892 }
9893 if (arity == 1) {
9894 return (capital ? string("U") : string("u")) + string("nar") + (plural ? string("ies") : string("y"));
9895 }
9896 if (arity == 2) {
9897 return (capital ? string("B") : string("b")) + string("inar") + (plural ? string("ies") : string("y"));
9898 }
9899 if (arity == 3) {
9900 return (capital ? string("T") : string("t")) + string("ernar") + (plural ? string("ies") : string("y"));
9901 }
9902 if (arity == 4) {
9903 return (capital ? string("Q") : string("q")) + string("uaternar") + (plural ? string("ies") : string("y"));
9904 }
9905 if (arity == 5) {
9906 return (capital ? string("Q") : string("q")) + string("uinar") + (plural ? string("ies") : string("y"));
9907 }
9908 if (arity == 6) {
9909 return (capital ? string("S") : string("s")) + string("enar") + (plural ? string("ies") : string("y"));
9910 }
9911 if (arity == 7) {
9912 return (capital ? string("S") : string("s")) + string("eptenar") + (plural ? string("ies") : string("y"));
9913 }
9914 if (arity == 8) {
9915 return (capital ? string("O") : string("o")) + string("ctonar") + (plural ? string("ies") : string("y"));
9916 }
9917 if (arity == 9) {
9918 return (capital ? string("N") : string("n")) + string("ovenar") + (plural ? string("ies") : string("y"));
9919 }
9920 if (arity == 10) {
9921 return (capital ? string("D") : string("d")) + string("enar") + (plural ? string("ies") : string("y"));
9922 }
9923 return aurostd::utype2string(arity) + string("-ar") + (plural ? string("ies") : string("y"));
9924 }
9925} // namespace pflow
9926namespace pflow {
9927 bool loadEntries(vector<string>& velements, vector<vector<vector<aflowlib::_aflowlib_entry>>>& entries, ostream& oss) { // overload
9928 ofstream FileMESSAGE;
9929 return loadEntries(velements, entries, FileMESSAGE, oss);
9930 }
9931 bool loadEntries(vector<string>& velements, vector<vector<vector<aflowlib::_aflowlib_entry>>>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
9932 string server;
9933 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
9934 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
9935 } else {
9936 server = AFLOWLIB_SERVER_DEFAULT;
9937 }
9938 return loadEntries(velements, server, entries, FileMESSAGE, oss);
9939 }
9940 bool loadEntries(vector<string>& velements, string server, vector<vector<vector<aflowlib::_aflowlib_entry>>>& entries, ostream& oss) { // overload
9941 ofstream FileMESSAGE;
9942 return loadEntries(velements, server, entries, FileMESSAGE, oss);
9943 }
9944 bool loadEntries(vector<string>& velements, string server, vector<vector<vector<aflowlib::_aflowlib_entry>>>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
9945 aurostd::xoption vpflow;
9946 pflow::defaultLoadEntriesFlags(vpflow, FileMESSAGE, oss, std::string("A"));
9947 return loadEntries(vpflow, velements, server, entries, FileMESSAGE, oss);
9948 }
9949 bool loadEntries(aurostd::xoption& vpflow, vector<string>& velements, vector<vector<vector<aflowlib::_aflowlib_entry>>>& entries,
9950 ostream& oss) { // overload
9951 ofstream FileMESSAGE;
9952 return loadEntries(vpflow, velements, entries, FileMESSAGE, oss);
9953 }
9954 bool loadEntries(aurostd::xoption& vpflow, vector<string>& velements, vector<vector<vector<aflowlib::_aflowlib_entry>>>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
9955 string server;
9956 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
9957 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
9958 } else {
9959 server = AFLOWLIB_SERVER_DEFAULT;
9960 }
9961 return loadEntries(vpflow, velements, server, entries, FileMESSAGE, oss);
9962 }
9963 bool loadEntries(aurostd::xoption& vpflow, vector<string>& velements, string server, vector<vector<vector<aflowlib::_aflowlib_entry>>>& entries,
9964 ostream& oss) { // overload
9965 ofstream FileMESSAGE;
9966 return loadEntries(vpflow, velements, server, entries, FileMESSAGE, oss);
9967 }
9968 bool loadEntries(aurostd::xoption& vpflow, vector<string>& velements, string server, vector<vector<vector<aflowlib::_aflowlib_entry>>>& entries, ofstream& FileMESSAGE, ostream& oss) { // main function
9969
9970 stringstream message;
9971
9972 // get directory info
9973 _aflags aflags;
9974 aflags.Directory = chull::getPath(); // default
9975 if (vpflow.flag("CHULL::PATH")) {
9976 aflags.Directory = chull::getPath(vpflow, FileMESSAGE, oss);
9977 }
9978
9979 vpflow.flag("PFLOW::LOAD_ENTRIES_COMING_FROM_LOADENTRIESX", true); // silence some output
9980
9981 message << "Loading entries for: " << aurostd::joinWDelimiter(velements, ",");
9982 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_MESSAGE_);
9983
9984 if (vpflow.flag("PFLOW::LOAD_ENTRIES_NON_ALPHABETICAL")) {
9985 message << "Loading NON-alphabetized entries as well";
9986 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_OPTION_);
9987 }
9988
9989 vector<vector<string>> combinations;
9990 vector<vector<vector<aflowlib::_aflowlib_entry>>> _entries; // unsorted
9991
9992 if (false) {
9993 // anticipating AFLUX integration
9994
9995 } else {
9996 const bool load_from_common = pflow::loadFromCommon(vpflow);
9997
9998 if (load_from_common) {
9999 message << "Loading entries from COMMON";
10000 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_OPTION_);
10001 } else {
10002 if ((server == AFLOW_MATERIALS_SERVER_DEFAULT) || (server == AFLOWLIB_SERVER_DEFAULT)) {
10003 message << "Using " << server << " as server";
10004 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_OPTION_);
10005 } else {
10006 message << "Server must be either " << AFLOW_MATERIALS_SERVER_DEFAULT << " or " << AFLOWLIB_SERVER_DEFAULT;
10007 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_ERROR_);
10008 return false; // entries;
10009 }
10010 }
10011
10012 string lib_name;
10013 string lib_count_string;
10014 string load_lib_flag_name;
10015
10017 // START loadLIBX
10019
10020 for (size_t lib = 1; lib <= velements.size() && lib <= _AFLOW_LIB_MAX_; lib++) {
10021 lib_count_string = aurostd::utype2string(lib);
10022 lib_name = std::string("LIB") + lib_count_string;
10023 load_lib_flag_name = "PFLOW::LOAD_ENTRIES_LOAD_" + lib_name;
10024 if (vpflow.flag(load_lib_flag_name)) {
10025 message << "Loading " + lib_name;
10026 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_MESSAGE_);
10027 combinations = pflow::elementalCombinations(velements, lib);
10028 for (size_t i = 0; i < combinations.size(); i++) {
10029 if (!loadAndMergeLIBX(vpflow, combinations[i], lib_count_string, server, _entries, FileMESSAGE, oss)) {
10030 message << "Merging entries for " + lib_name + " failed";
10031 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_ERROR_);
10032 return false;
10033 }
10034 }
10035 }
10036 }
10037
10039 // END loadLIBX
10041
10043 // START loadICSD
10045
10046 lib_name = std::string("ICSD");
10047 load_lib_flag_name = "PFLOW::LOAD_ENTRIES_LOAD_" + lib_name;
10048 if (vpflow.flag(load_lib_flag_name)) {
10049 message << "Loading " + lib_name;
10050 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_MESSAGE_);
10051 if (!loadAndMergeLIBX(vpflow, velements, lib_name, server, _entries, FileMESSAGE, oss)) {
10052 message << "Merging entries for " + lib_name + " failed";
10053 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_ERROR_);
10054 return false;
10055 }
10056 }
10057
10059 // END loadICSD
10061 }
10062
10064 // START Sort
10066
10067 bool found;
10068 vector<string> vspecies;
10069 // make space and sort correctly
10070 for (size_t i = 0; i < velements.size(); i++) {
10071 entries.emplace_back(0);
10072 combinations = pflow::elementalCombinations(velements, i + 1);
10073 for (size_t j = 0; j < combinations.size(); j++) {
10074 entries[i].emplace_back(0);
10075 }
10076 for (size_t j = 0; j < combinations.size(); j++) {
10077 found = false;
10078 if (_entries.size() > i) {
10079 for (size_t k = 0; k < _entries[i].size() && !found; k++) {
10080 if (!_entries[i][k].empty()) {
10081 vspecies = _entries[i][k][0].vspecies;
10082 if (vpflow.flag("PFLOW::LOAD_ENTRIES_NON_ALPHABETICAL")) {
10083 sort(vspecies.begin(), vspecies.end());
10084 }
10085 if (vspecies == combinations[j]) {
10086 entries[i][j] = _entries[i][k];
10087 found = true;
10088 }
10089 }
10090 }
10091 }
10092 }
10093 }
10094
10096 // END Sort
10098
10100 // START Print loaded entries summary
10102
10103 vector<uint> sizes;
10104 uint totalNum = 0;
10105
10106 for (size_t i = 0; i < entries.size(); i++) {
10107 sizes.push_back(0);
10108 for (size_t j = 0; j < entries[i].size(); j++) {
10109 for (size_t k = 0; k < entries[i][j].size(); k++) {
10110 sizes.at(i)++;
10111 }
10112 }
10113 totalNum += sizes.at(i);
10114 }
10115
10116 for (size_t i = 0; i < entries.size(); i++) {
10117 message << "Loaded ";
10118 message << entries[i].size() << " " << pflow::arity_string(i + 1, false, true) << ": " << sizes.at(i) << " entries";
10119 // if(i == 0) {
10120 // message << "unaries: ";
10121 // } else if(i == 1) {
10122 // message << "binaries: ";
10123 // } else if(i == 2) {
10124 // message << "ternaries: ";
10125 // } else {
10126 // message << (i + 1) << "-naries: ";
10127 // }
10128 // message << sizes.at(i) << " entries";
10129 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_MESSAGE_);
10130 }
10131 message << "Loaded " << totalNum << " entries total";
10132 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_MESSAGE_);
10133
10135 // END Print loaded entries summary
10137
10138 return true; // entries;
10139 }
10140} // namespace pflow
10141
10142namespace pflow {
10143 // ***************************************************************************
10144 // pflow::loadEntries(aurostd::xoption& vpflow,vector<string>& velements,string
10145 // server,ostream& oss,ofstream& FileMESSAGE)
10146 // ***************************************************************************
10147 bool loadEntries(vector<string>& velements, vector<vector<aflowlib::_aflowlib_entry>>& entries, ostream& oss) { // overload
10148 ofstream FileMESSAGE;
10149 return loadEntries(velements, entries, FileMESSAGE, oss);
10150 }
10151 bool loadEntries(vector<string>& velements, vector<vector<aflowlib::_aflowlib_entry>>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10152 string server;
10153 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
10154 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
10155 } else {
10156 server = AFLOWLIB_SERVER_DEFAULT;
10157 }
10158 return loadEntries(velements, server, entries, FileMESSAGE, oss);
10159 }
10160 bool loadEntries(vector<string>& velements, string server, vector<vector<aflowlib::_aflowlib_entry>>& entries,
10161 ostream& oss) { // overload
10162 ofstream FileMESSAGE;
10163 return loadEntries(velements, server, entries, FileMESSAGE, oss);
10164 }
10165 bool loadEntries(vector<string>& velements, string server, vector<vector<aflowlib::_aflowlib_entry>>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10166 aurostd::xoption vpflow;
10167 pflow::defaultLoadEntriesFlags(vpflow, FileMESSAGE, oss, std::string("A"));
10168 return loadEntries(vpflow, velements, server, entries, FileMESSAGE, oss);
10169 }
10170 bool loadEntries(aurostd::xoption& vpflow, vector<string>& velements, vector<vector<aflowlib::_aflowlib_entry>>& entries,
10171 ostream& oss) { // overload
10172 ofstream FileMESSAGE;
10173 return loadEntries(vpflow, velements, entries, FileMESSAGE, oss);
10174 }
10175 bool loadEntries(aurostd::xoption& vpflow, vector<string>& velements, vector<vector<aflowlib::_aflowlib_entry>>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10176 string server;
10177 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
10178 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
10179 } else {
10180 server = AFLOWLIB_SERVER_DEFAULT;
10181 }
10182 return loadEntries(vpflow, velements, server, entries, FileMESSAGE, oss);
10183 }
10184 bool loadEntries(aurostd::xoption& vpflow, vector<string>& velements, string server, vector<vector<aflowlib::_aflowlib_entry>>& entries,
10185 ostream& oss) { // overload
10186 ofstream FileMESSAGE;
10187 return loadEntries(vpflow, velements, server, entries, FileMESSAGE, oss);
10188 }
10189 bool loadEntries(aurostd::xoption& vpflow, vector<string>& velements, string server, vector<vector<aflowlib::_aflowlib_entry>>& entries, ofstream& FileMESSAGE, ostream& oss) { // main function
10190
10191 vector<vector<vector<aflowlib::_aflowlib_entry>>> naries;
10192 if (!loadEntries(vpflow, velements, server, naries, FileMESSAGE, oss)) {
10193 return false;
10194 }
10195 if (!aflowlib::mergeEntries(entries, naries, true)) {
10196 return false;
10197 }
10198 return true;
10199 }
10200} // namespace pflow
10201
10202namespace pflow {
10203 // ***************************************************************************
10204 // pflow::loadEntries(aurostd::xoption& vpflow,vector<string>
10205 // velements,string server,ostream& oss,ofstream& FileMESSAGE)
10206 // ***************************************************************************
10207 bool loadEntries(vector<string>& velements, vector<aflowlib::_aflowlib_entry>& entries, ostream& oss) { // overload
10208 ofstream FileMESSAGE;
10209 return loadEntries(velements, entries, FileMESSAGE, oss);
10210 }
10211 bool loadEntries(vector<string>& velements, vector<aflowlib::_aflowlib_entry>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10212 string server;
10213 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
10214 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
10215 } else {
10216 server = AFLOWLIB_SERVER_DEFAULT;
10217 }
10218 return loadEntries(velements, server, entries, FileMESSAGE, oss);
10219 }
10220 bool loadEntries(vector<string>& velements, string server, vector<aflowlib::_aflowlib_entry>& entries, ostream& oss) { // overload
10221 ofstream FileMESSAGE;
10222 return loadEntries(velements, server, entries, FileMESSAGE, oss);
10223 }
10224 bool loadEntries(vector<string>& velements, string server, vector<aflowlib::_aflowlib_entry>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10225 aurostd::xoption vpflow;
10226 pflow::defaultLoadEntriesFlags(vpflow, FileMESSAGE, oss, std::string("A"));
10227 return loadEntries(vpflow, velements, server, entries, FileMESSAGE, oss);
10228 }
10229 bool loadEntries(aurostd::xoption& vpflow, vector<string>& velements, vector<aflowlib::_aflowlib_entry>& entries,
10230 ostream& oss) { // overload
10231 ofstream FileMESSAGE;
10232 return loadEntries(vpflow, velements, entries, FileMESSAGE, oss);
10233 }
10234 bool loadEntries(aurostd::xoption& vpflow, vector<string>& velements, vector<aflowlib::_aflowlib_entry>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10235 string server;
10236 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
10237 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
10238 } else {
10239 server = AFLOWLIB_SERVER_DEFAULT;
10240 }
10241 return loadEntries(vpflow, velements, server, entries, FileMESSAGE, oss);
10242 }
10243 bool loadEntries(aurostd::xoption& vpflow, vector<string>& velements, string server, vector<aflowlib::_aflowlib_entry>& entries,
10244 ostream& oss) { // overload
10245 ofstream FileMESSAGE;
10246 return loadEntries(vpflow, velements, server, entries, FileMESSAGE, oss);
10247 }
10248 bool loadEntries(aurostd::xoption& vpflow, vector<string>& velements, string server, vector<aflowlib::_aflowlib_entry>& entries, ofstream& FileMESSAGE, ostream& oss) { // main function
10249
10250 vector<vector<vector<aflowlib::_aflowlib_entry>>> naries;
10251 if (!loadEntries(vpflow, velements, server, naries, FileMESSAGE, oss)) {
10252 return false;
10253 }
10254 if (!aflowlib::mergeEntries(entries, naries)) {
10255 return false;
10256 }
10257 return true;
10258 }
10259} // namespace pflow
10260
10261namespace pflow {
10262 // ***************************************************************************
10263 // pflow::loadFromCommon(aurostd::xoption& vpflow)
10264 // simple function for determining if we can load from common
10265 // it's a function because we call it a few times
10266 // ***************************************************************************
10268 const bool load_from_common =
10269 (!vpflow.flag("PFLOW::LOAD_API") && (aurostd::substring2bool(XHOST.hostname, "nietzsche") || aurostd::substring2bool(XHOST.hostname, "aflowlib") || aurostd::substring2bool(XHOST.hostname, "habana")));
10270 return load_from_common;
10271 }
10272} // namespace pflow
10273
10274namespace pflow {
10275 // ***************************************************************************
10276 // pflow::loadAndMergeLIBX(aurostd::xoption& vpflow, vector<string>& combination,
10277 // string LIB, string server,vector<vector<vector<aflowlib::_aflowlib_entry> > >& naries,
10278 // ofstream& FileMESSAGE, ostream& oss
10279 // ***************************************************************************
10280 // helper function for loadEntries, loads select library, LIB can be "LIB2" or "2" or "ICSD"
10281 bool loadAndMergeLIBX(string combination, string LIB, string server, vector<vector<vector<aflowlib::_aflowlib_entry>>>& naries, ostream& oss) {
10282 ofstream FileMESSAGE;
10283 return loadAndMergeLIBX(combination, LIB, server, naries, FileMESSAGE, oss);
10284 }
10285 bool loadAndMergeLIBX(string _combination, string LIB, string server, vector<vector<vector<aflowlib::_aflowlib_entry>>>& naries, ofstream& FileMESSAGE, ostream& oss) {
10286 vector<string> combination;
10287 combination.push_back(_combination);
10288 return loadAndMergeLIBX(combination, LIB, server, naries, FileMESSAGE, oss);
10289 }
10290 bool loadAndMergeLIBX(vector<string>& combination, string LIB, string server, vector<vector<vector<aflowlib::_aflowlib_entry>>>& naries, ostream& oss) {
10291 ofstream FileMESSAGE;
10292 return loadAndMergeLIBX(combination, LIB, server, naries, FileMESSAGE, oss);
10293 }
10294 bool loadAndMergeLIBX(vector<string>& combination, string LIB, string server, vector<vector<vector<aflowlib::_aflowlib_entry>>>& naries, ofstream& FileMESSAGE, ostream& oss) {
10295 aurostd::xoption vpflow;
10296 pflow::defaultLoadEntriesFlags(vpflow, FileMESSAGE, oss, LIB);
10297 return loadAndMergeLIBX(vpflow, combination, LIB, server, naries, oss);
10298 }
10299 bool loadAndMergeLIBX(aurostd::xoption& vpflow, string combination, string LIB, string server, vector<vector<vector<aflowlib::_aflowlib_entry>>>& naries, ostream& oss) {
10300 ofstream FileMESSAGE;
10301 return loadAndMergeLIBX(vpflow, combination, LIB, server, naries, FileMESSAGE, oss);
10302 }
10303 bool loadAndMergeLIBX(aurostd::xoption& vpflow, string _combination, string LIB, string server, vector<vector<vector<aflowlib::_aflowlib_entry>>>& naries, ofstream& FileMESSAGE, ostream& oss) {
10304 vector<string> combination;
10305 combination.push_back(_combination);
10306 return loadAndMergeLIBX(vpflow, combination, LIB, server, naries, FileMESSAGE, oss);
10307 }
10308 bool loadAndMergeLIBX(aurostd::xoption& vpflow, vector<string>& combination, string LIB, string server, vector<vector<vector<aflowlib::_aflowlib_entry>>>& naries, ostream& oss) {
10309 ofstream FileMESSAGE;
10310 return loadAndMergeLIBX(vpflow, combination, LIB, server, naries, FileMESSAGE, oss);
10311 }
10312 bool loadAndMergeLIBX(aurostd::xoption& vpflow, vector<string>& combination, string LIB, string server, vector<vector<vector<aflowlib::_aflowlib_entry>>>& naries, ofstream& FileMESSAGE, ostream& oss) {
10313 stringstream message;
10314
10315 // get directory info
10316 _aflags aflags;
10317 aflags.Directory = chull::getPath(); // default
10318 if (vpflow.flag("CHULL::PATH")) {
10319 aflags.Directory = chull::getPath(vpflow, FileMESSAGE, oss);
10320 }
10321
10322 LIB = aurostd::toupper(LIB); // removes ALL ambiguity with case
10323 vector<vector<aflowlib::_aflowlib_entry>> v_temp;
10324 if (!loadLIBX(vpflow, LIB, combination, server, v_temp, FileMESSAGE, oss)) {
10325 return false;
10326 }
10327 if (vpflow.flag("PFLOW::LOAD_ENTRIES_NARIES_MINUS_ONE")) {
10328 for (size_t i = 0; i < v_temp.size() - 1; i++) {
10329 if (!aflowlib::mergeEntries(naries, v_temp[i], false)) { // e.g. for ternary MnPdPt, there are 3 binary combinations
10330 if (LIB == "ICSD") // or LIB == "icsd")
10331 { // CO20200106 - patching for auto-indenting
10332 message << "Merging entries for ICSD (" + aurostd::utype2string(i + 1) + "-naries) failed";
10333 } else {
10334 message << "Merging entries for LIB" + LIB + " (" + aurostd::utype2string(i + 1) + "-naries) failed";
10335 }
10336 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_ERROR_);
10337 return false;
10338 }
10339 }
10340 }
10341 if (!aflowlib::mergeEntries(naries, v_temp[v_temp.size() - 1], true)) { // e.g. for ternary MnPdPt, there is only ONE ternary combination
10342 if (LIB == "ICSD") // or LIB == "icsd")
10343 { // CO20200106 - patching for auto-indenting
10344 message << "Merging entries for ICSD (" + aurostd::utype2string(v_temp.size()) + "-naries) failed";
10345 } else {
10346 message << "Merging entries for LIB" + LIB + " (" + aurostd::utype2string(v_temp.size()) + "-naries) failed";
10347 }
10348 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_ERROR_);
10349 return false;
10350 }
10351 return true;
10352 }
10353} // namespace pflow
10354
10355namespace pflow {
10356 uint SubLayersRestAPILS(const string& url, vector<string>& vsuburl) { // CO20200731 - mimicking SubDirectoryLS() in aurostd for REST-API
10357 vector<string> vtokens;
10358 vector<string> _vtokens;
10359 aurostd::httpGetTokens(url + "/?aflowlib_entries", vtokens, ",");
10360 for (size_t i = 0; i < vtokens.size(); i++) {
10361 aurostd::httpGetTokens(url + "/" + vtokens[i] + "/?aflowlib_entries", _vtokens, ",");
10362 if (!_vtokens.empty()) {
10363 vsuburl.push_back(url + "/" + vtokens[i]);
10364 SubLayersRestAPILS(url + "/" + vtokens[i], vsuburl);
10365 }
10366 }
10367 return vsuburl.size();
10368 }
10369} // namespace pflow
10370
10371namespace pflow {
10372 // ***************************************************************************
10373 // pflow::loadLIBX(aurostd::xoption& vpflow,string elements,string server,
10374 // ofstream& FileMESSAGE, ostream& oss)
10375 // ***************************************************************************
10376 // there are MANY loadLIBX overloads, basically variations of string/vector elements
10377 // and whether entries are loaded into vector<> or vector<vector<> > (unaries vs. binaries, etc.)
10378 // loadLIBX string elements
10379 bool loadLIBX(string LIB, string elements, vector<aflowlib::_aflowlib_entry>& entries,
10380 ostream& oss) { // overload
10381 ofstream FileMESSAGE;
10382 return loadLIBX(LIB, elements, entries, FileMESSAGE, oss);
10383 }
10384 bool loadLIBX(string LIB, string elements, vector<aflowlib::_aflowlib_entry>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10385 string server;
10386 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
10387 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
10388 } else {
10389 server = AFLOWLIB_SERVER_DEFAULT;
10390 }
10391 return loadLIBX(LIB, elements, server, entries, FileMESSAGE, oss);
10392 }
10393 bool loadLIBX(string LIB, string elements, string server, vector<aflowlib::_aflowlib_entry>& entries,
10394 ostream& oss) { // overload
10395 ofstream FileMESSAGE;
10396 return loadLIBX(LIB, elements, server, entries, FileMESSAGE, oss);
10397 }
10398 bool loadLIBX(string LIB, string elements, string server, vector<aflowlib::_aflowlib_entry>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10399 aurostd::xoption vpflow;
10400 pflow::defaultLoadEntriesFlags(vpflow, FileMESSAGE, oss, LIB);
10401 return loadLIBX(vpflow, LIB, elements, server, entries, FileMESSAGE, oss);
10402 }
10403 bool loadLIBX(aurostd::xoption& vpflow, string LIB, string elements, vector<aflowlib::_aflowlib_entry>& entries,
10404 ostream& oss) { // overload
10405 ofstream FileMESSAGE;
10406 return loadLIBX(vpflow, LIB, elements, entries, FileMESSAGE, oss);
10407 }
10408 bool loadLIBX(aurostd::xoption& vpflow, string LIB, string elements, vector<aflowlib::_aflowlib_entry>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10409 string server;
10410 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
10411 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
10412 } else {
10413 server = AFLOWLIB_SERVER_DEFAULT;
10414 }
10415 return loadLIBX(vpflow, LIB, elements, server, entries, FileMESSAGE, oss);
10416 }
10417 bool loadLIBX(aurostd::xoption& vpflow, string LIB, string elements, string server, vector<aflowlib::_aflowlib_entry>& entries,
10418 ostream& oss) { // overload
10419 ofstream FileMESSAGE;
10420 return loadLIBX(vpflow, LIB, elements, server, entries, FileMESSAGE, oss);
10421 }
10422 bool loadLIBX(aurostd::xoption& vpflow, string LIB, string elements, string server, vector<aflowlib::_aflowlib_entry>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10423
10424 vector<string> velements = aurostd::getElements(elements, composition_string, FileMESSAGE, true, true, false, oss); // clean and sort, do not keep_pp //CO20190712
10425 return loadLIBX(vpflow, LIB, velements, server, entries, FileMESSAGE, oss);
10426 }
10427 // ***************************************************************************
10428 // pflow::loadLIBX(aurostd::xoption& vpflow,string LIB,vector<string>& velements,string server,
10429 // ofstream& FileMESSAGE, ostream& oss)
10430 // ***************************************************************************
10431 // loadLIBX vector elements
10432 bool loadLIBX(string LIB, vector<string>& velements, vector<aflowlib::_aflowlib_entry>& entries,
10433 ostream& oss) { // overload
10434 ofstream FileMESSAGE;
10435 return loadLIBX(LIB, velements, entries, FileMESSAGE, oss);
10436 }
10437 bool loadLIBX(string LIB, vector<string>& velements, vector<aflowlib::_aflowlib_entry>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10438 string server;
10439 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
10440 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
10441 } else {
10442 server = AFLOWLIB_SERVER_DEFAULT;
10443 }
10444 return loadLIBX(LIB, velements, server, entries, FileMESSAGE, oss);
10445 }
10446 bool loadLIBX(string LIB, vector<string>& velements, string server, vector<aflowlib::_aflowlib_entry>& entries,
10447 ostream& oss) { // overload
10448 ofstream FileMESSAGE;
10449 return loadLIBX(LIB, velements, server, entries, FileMESSAGE, oss);
10450 }
10451 bool loadLIBX(string LIB, vector<string>& velements, string server, vector<aflowlib::_aflowlib_entry>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10452 aurostd::xoption vpflow;
10453 pflow::defaultLoadEntriesFlags(vpflow, FileMESSAGE, oss, LIB);
10454 return loadLIBX(vpflow, LIB, velements, server, entries, FileMESSAGE, oss);
10455 }
10456 bool loadLIBX(aurostd::xoption& vpflow, string LIB, vector<string>& velements, vector<aflowlib::_aflowlib_entry>& entries,
10457 ostream& oss) { // overload
10458 ofstream FileMESSAGE;
10459 return loadLIBX(vpflow, LIB, velements, entries, FileMESSAGE, oss);
10460 }
10461 bool loadLIBX(aurostd::xoption& vpflow, string LIB, vector<string>& velements, vector<aflowlib::_aflowlib_entry>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10462 string server;
10463 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
10464 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
10465 } else {
10466 server = AFLOWLIB_SERVER_DEFAULT;
10467 }
10468 return loadLIBX(vpflow, LIB, velements, server, entries, FileMESSAGE, oss);
10469 }
10470 bool loadLIBX(aurostd::xoption& vpflow, string LIB, vector<string>& velements, string server, vector<aflowlib::_aflowlib_entry>& entries,
10471 ostream& oss) { // overload
10472 ofstream FileMESSAGE;
10473 return loadLIBX(vpflow, LIB, velements, server, entries, FileMESSAGE, oss);
10474 }
10475 bool loadLIBX(aurostd::xoption& vpflow, string LIB, vector<string>& velements, string server, vector<aflowlib::_aflowlib_entry>& entries, ofstream& FileMESSAGE, ostream& oss) { // main function
10476
10477 vector<vector<aflowlib::_aflowlib_entry>> naries; // most intuitive structure from LIBs construction (unary, binaries, etc.), always start here and merge to get other variants
10478
10479 if (!loadLIBX(vpflow, LIB, velements, server, naries, FileMESSAGE, oss)) {
10480 return false;
10481 }
10482 if (!aflowlib::mergeEntries(entries, naries)) {
10483 return false;
10484 }
10485 return true;
10486 }
10487 // ***************************************************************************
10488 // pflow::loadLIBX(aurostd::xoption& vpflow,string elements,string server,
10489 // ofstream& FileMESSAGE, ostream& oss)
10490 // ***************************************************************************
10491 // loadLIBX string elements
10492 bool loadLIBX(string LIB, string elements, vector<vector<aflowlib::_aflowlib_entry>>& entries,
10493 ostream& oss) { // overload
10494 ofstream FileMESSAGE;
10495 return loadLIBX(LIB, elements, entries, FileMESSAGE, oss);
10496 }
10497 bool loadLIBX(string LIB, string elements, vector<vector<aflowlib::_aflowlib_entry>>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10498 string server;
10499 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
10500 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
10501 } else {
10502 server = AFLOWLIB_SERVER_DEFAULT;
10503 }
10504 return loadLIBX(LIB, elements, server, entries, FileMESSAGE, oss);
10505 }
10506 bool loadLIBX(string LIB, string elements, string server, vector<vector<aflowlib::_aflowlib_entry>>& entries,
10507 ostream& oss) { // overload
10508 ofstream FileMESSAGE;
10509 return loadLIBX(LIB, elements, server, entries, FileMESSAGE, oss);
10510 }
10511 bool loadLIBX(string LIB, string elements, string server, vector<vector<aflowlib::_aflowlib_entry>>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10512 aurostd::xoption vpflow;
10513 pflow::defaultLoadEntriesFlags(vpflow, FileMESSAGE, oss, LIB);
10514 return loadLIBX(vpflow, LIB, elements, server, entries, FileMESSAGE, oss);
10515 }
10516 bool loadLIBX(aurostd::xoption& vpflow, string LIB, string elements, vector<vector<aflowlib::_aflowlib_entry>>& entries,
10517 ostream& oss) { // overload
10518 ofstream FileMESSAGE;
10519 return loadLIBX(vpflow, LIB, elements, entries, FileMESSAGE, oss);
10520 }
10521 bool loadLIBX(aurostd::xoption& vpflow, string LIB, string elements, vector<vector<aflowlib::_aflowlib_entry>>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10522 string server;
10523 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
10524 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
10525 } else {
10526 server = AFLOWLIB_SERVER_DEFAULT;
10527 }
10528 return loadLIBX(vpflow, LIB, elements, server, entries, FileMESSAGE, oss);
10529 }
10530 bool loadLIBX(aurostd::xoption& vpflow, string LIB, string elements, string server, vector<vector<aflowlib::_aflowlib_entry>>& entries,
10531 ostream& oss) { // overload
10532 ofstream FileMESSAGE;
10533 return loadLIBX(vpflow, LIB, elements, server, entries, FileMESSAGE, oss);
10534 }
10535 bool loadLIBX(aurostd::xoption& vpflow, string LIB, string elements, string server, vector<vector<aflowlib::_aflowlib_entry>>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10536
10537 vector<string> velements = aurostd::getElements(elements, composition_string, FileMESSAGE, true, true, false, oss); // clean and sort, do not keep_pp //CO20190712
10538 return loadLIBX(vpflow, LIB, velements, server, entries, FileMESSAGE, oss);
10539 }
10540 // ***************************************************************************
10541 // pflow::loadLIBX(aurostd::xoption& vpflow,string LIB,vector<string>& velements,string server,
10542 // ofstream& FileMESSAGE, ostream& oss)
10543 // ***************************************************************************
10544 // loadLIBX vector elements
10545 bool loadLIBX(string LIB, vector<string>& velements, vector<vector<aflowlib::_aflowlib_entry>>& entries,
10546 ostream& oss) { // overload
10547 ofstream FileMESSAGE;
10548 return loadLIBX(LIB, velements, entries, FileMESSAGE, oss);
10549 }
10550 bool loadLIBX(string LIB, vector<string>& velements, vector<vector<aflowlib::_aflowlib_entry>>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10551 string server;
10552 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
10553 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
10554 } else {
10555 server = AFLOWLIB_SERVER_DEFAULT;
10556 }
10557 return loadLIBX(LIB, velements, server, entries, FileMESSAGE, oss);
10558 }
10559 bool loadLIBX(string LIB, vector<string>& velements, string server, vector<vector<aflowlib::_aflowlib_entry>>& entries,
10560 ostream& oss) { // overload
10561 ofstream FileMESSAGE;
10562 return loadLIBX(LIB, velements, server, entries, FileMESSAGE, oss);
10563 }
10564 bool loadLIBX(string LIB, vector<string>& velements, string server, vector<vector<aflowlib::_aflowlib_entry>>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10565 aurostd::xoption vpflow;
10566 pflow::defaultLoadEntriesFlags(vpflow, FileMESSAGE, oss, LIB);
10567 return loadLIBX(vpflow, LIB, velements, server, entries, FileMESSAGE, oss);
10568 }
10569 bool loadLIBX(aurostd::xoption& vpflow, string LIB, vector<string>& velements, vector<vector<aflowlib::_aflowlib_entry>>& entries,
10570 ostream& oss) { // overload
10571 ofstream FileMESSAGE;
10572 return loadLIBX(vpflow, LIB, velements, entries, FileMESSAGE, oss);
10573 }
10574 bool loadLIBX(aurostd::xoption& vpflow, string LIB, vector<string>& velements, vector<vector<aflowlib::_aflowlib_entry>>& entries, ofstream& FileMESSAGE, ostream& oss) { // overload
10575 string server;
10576 if (XHOST.vflag_control.flag("AFLOWLIB_SERVER")) {
10577 server = XHOST.vflag_control.getattachedscheme("AFLOWLIB_SERVER");
10578 } else {
10579 server = AFLOWLIB_SERVER_DEFAULT;
10580 }
10581 return loadLIBX(vpflow, LIB, velements, server, entries, FileMESSAGE, oss);
10582 }
10583 bool loadLIBX(aurostd::xoption& vpflow, string LIB, vector<string>& velements, string server, vector<vector<aflowlib::_aflowlib_entry>>& entries,
10584 ostream& oss) { // overload
10585 ofstream FileMESSAGE;
10586 return loadLIBX(vpflow, LIB, velements, server, entries, FileMESSAGE, oss);
10587 }
10588 bool loadLIBX(aurostd::xoption& vpflow, string LIB, vector<string>& velements, string server, vector<vector<aflowlib::_aflowlib_entry>>& entries, ofstream& FileMESSAGE, ostream& oss) { // main function
10589 const bool LDEBUG = (false || XHOST.DEBUG);
10590 stringstream message;
10591
10592 // get directory info
10593 _aflags aflags;
10594 aflags.Directory = chull::getPath(); // default
10595 if (vpflow.flag("CHULL::PATH")) {
10596 aflags.Directory = chull::getPath(vpflow, FileMESSAGE, oss);
10597 }
10598
10599 // vector<vector<aflowlib::_aflowlib_entry> > entries;
10600 for (size_t i = 0; i < velements.size(); i++) {
10601 entries.emplace_back(0);
10602 }
10603
10604 // categorize LIB
10605 string lib_name;
10606 const vector<string> symmetries{"BCC", "BCT", "CUB", "FCC", "HEX", "MCL", "MCLC", "ORC", "ORCC", "ORCF", "ORCI", "RHL", "TET", "TRI"};
10607 LIB = aurostd::toupper(LIB); // removes ALL ambiguity with case
10608 const bool isICSD = (LIB == "ICSD"); //(LIB == "ICSD" || LIB == "icsd");
10609 if (isICSD) {
10610 lib_name = LIB;
10611 // add here other special LIBS, i.e., not LIB2, LIB3, etc.
10612 } else {
10613 string lib_count_string;
10614 // make robust so input can be "LIB2" or "2"
10615 if (aurostd::substring2bool(LIB, "LIB")) {
10616 lib_name = LIB;
10617 lib_count_string = aurostd::RemoveSubString(LIB, "LIB");
10618 } else {
10619 lib_name = "LIB" + LIB;
10620 lib_count_string = LIB;
10621 }
10622 // check validity of input
10623 for (size_t i = 0; i < lib_count_string.size(); i++) {
10624 if (!isdigit(lib_count_string[i])) {
10625 message << "Unknown LIB specification (" << LIB << R"(), should be "LIB1", "LIB2", or "1", "2", etc.)";
10626 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_ERROR_);
10627 return false; // entries;
10628 }
10629 }
10630 const uint lib_count_uint = aurostd::string2utype<int>(lib_count_string);
10631 if (velements.size() != lib_count_uint) {
10632 message << "LIB" << lib_count_uint << " loads " << lib_count_uint << "-naries ONLY";
10633 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_ERROR_);
10634 return false; // entries;
10635 }
10636 }
10637
10638 message << "Loading " << lib_name << " entries for: " << aurostd::joinWDelimiter(velements, "");
10639 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_MESSAGE_);
10640
10641 bool load_from_common = pflow::loadFromCommon(vpflow);
10642 bool override_load_from_common = false;
10643
10644 string LIB_path; // will be actual directory path or URL, depending on machine
10645 if (load_from_common) {
10646 if (!vpflow.flag("PFLOW::LOAD_ENTRIES_COMING_FROM_LOADENTRIESX")) {
10647 message << "Loading entries from COMMON";
10648 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_OPTION_);
10649 }
10650 LIB_path = "/common/" + lib_name + "/RAW";
10651 if (!aurostd::IsDirectory(LIB_path)) {
10652 load_from_common = false;
10653 message << LIB_path << " does not exist! Cannot load from COMMON, switching to API";
10654 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_WARNING_);
10655 override_load_from_common = true;
10656 }
10657 }
10658 if (!load_from_common) {
10659 if ((server == AFLOW_MATERIALS_SERVER_DEFAULT) || (server == AFLOWLIB_SERVER_DEFAULT)) {
10660 if (override_load_from_common || (!vpflow.flag("PFLOW::LOAD_ENTRIES_COMING_FROM_LOADENTRIESX"))) {
10661 message << "Using " << server << " as server";
10662 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_OPTION_);
10663 }
10664 } else {
10665 message << "Server must be either " << AFLOW_MATERIALS_SERVER_DEFAULT << " or " << AFLOWLIB_SERVER_DEFAULT;
10666 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_ERROR_);
10667 return false; // entries;
10668 }
10669 if (isICSD) {
10670 LIB_path = server + "/AFLOWDATA/ICSD_WEB";
10671 } else {
10672 LIB_path = server + "/AFLOWDATA/" + lib_name + "_RAW";
10673 }
10674 }
10675
10677 // START Finding matches
10679 aflowlib::_aflowlib_entry _aflowlib_tmp;
10680 uint nary = 0;
10681 uint total_count = 0;
10682 string::size_type loc = 0;
10683 vector<string> input_velements;
10684 vector<double> input_vcomposition;
10685 vector<string> vloadpaths;
10686 if (isICSD) {
10687 const bool double_check_icsd = false; // NOT NECESSARY for ICSD since we load from the calculation layer
10688 string symmetry_path;
10689 string clean_icsd;
10690 vector<string> icsds;
10691 vector<string> tokens;
10692 vector<string> elements;
10693 for (size_t i = 0; i < symmetries.size(); i++) {
10694 symmetry_path = LIB_path + "/" + symmetries[i];
10695 if (load_from_common && !aurostd::IsDirectory(symmetry_path)) {
10696 continue;
10697 }
10698 // not many symmetries, so this boolean placement won't impact much
10699 if (load_from_common) {
10700 aurostd::DirectoryLS(symmetry_path, icsds);
10701 } else {
10702 aurostd::httpGetTokens(symmetry_path + "/?aflowlib_entries", icsds, ",");
10703 }
10704 if (!icsds.empty() && icsds[0] == "<!DOCTYPE") { // CO20180627
10705 message << "REST-API appears to be down";
10706 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_ERROR_);
10707 return false;
10708 }
10709 for (size_t j = 0; j < icsds.size(); j++) {
10710 loc = icsds[j].find("_ICSD_");
10711 if (loc != string::npos) { // found a good ICSD
10712 clean_icsd = icsds[j].substr(0, loc); // get just compound
10713 if (compoundsBelong(velements, clean_icsd, input_velements, input_vcomposition, FileMESSAGE, oss, false, vpflow.flag("PFLOW::LOAD_ENTRIES_NON_ALPHABETICAL"),
10714 composition_string)) { // NOT recommended, these are BS entries // no need to clean, ICSD compound format is already clean of pps
10715 // url2aflowlib has bad printing to screen options, so we mimic here
10716 vloadpaths.clear();
10717 if (load_from_common) {
10718 aurostd::SubDirectoryLS(symmetry_path + "/" + icsds[j], vloadpaths);
10719 } else {
10720 pflow::SubLayersRestAPILS(symmetry_path + "/" + icsds[j], vloadpaths);
10721 }
10722 if (LDEBUG) {
10723 cerr << __AFLOW_FUNC__ << " vloadpaths=" << aurostd::joinWDelimiter(vloadpaths, ",") << endl;
10724 }
10725 if (vloadpaths.size() > 1 && vloadpaths[1] == "<!DOCTYPE") { // CO20180627
10726 message << "REST-API appears to be down";
10727 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_ERROR_);
10728 return false;
10729 }
10730 for (size_t k = 0; k < vloadpaths.size(); k++) {
10731 const string& load_path = vloadpaths[k];
10732 message << "Loading " << (load_from_common ? "path" : "url") << "=" << load_path;
10733 pflow::logger(__AFLOW_FILE__, std::string("aurostd::") + std::string((load_from_common ? "file" : "url")) + std::string("2string():"), message, aflags, FileMESSAGE, oss, _LOGGER_MESSAGE_,
10734 !vpflow.flag("PFLOW::LOAD_ENTRIES_ENTRY_OUTPUT")); // print to log anyway
10735 // complicated ternary operator, returns bool, but necessary to avoid double code
10736 if ((load_from_common) ?
10737 // if load_from_common, check this bool
10738 // this part of the ternary operator will first look for a non-empty aflowlib.out,
10739 // then try to load it
10740 // the last part checks that the loaded entry has a set of species that belong to the original query (protection)
10741 (
10742 //(aurostd::FileExist(load_path + "/"+DEFAULT_FILE_AFLOWLIB_ENTRY_OUT)) &&
10743 (aurostd::FileNotEmpty(load_path + "/" + DEFAULT_FILE_AFLOWLIB_ENTRY_OUT)) && (_aflowlib_tmp.file2aflowlib(load_path + "/" + DEFAULT_FILE_AFLOWLIB_ENTRY_OUT, message) > 0) &&
10744 (double_check_icsd ? compoundsBelong(velements, _aflowlib_tmp.vspecies, FileMESSAGE, oss, vpflow.flag("PFLOW::LOAD_ENTRIES_NON_ALPHABETICAL"))
10745 : true) // sometimes we find odd entries in the wrong LIBS, better to be safe, NOT NECESSARY for ICSD since we load from the calculation layer
10746 )
10747 :
10748 // if load_from_api, check this bool
10749 // this part of the ternary operator loads in the url
10750 // the last part checks that the loaded entry has a set of species that belong to the original query (protection)
10751 ((_aflowlib_tmp.url2aflowlib(load_path, message, false) > 0) &&
10752 (double_check_icsd ? compoundsBelong(velements, _aflowlib_tmp.vspecies, FileMESSAGE, oss, vpflow.flag("PFLOW::LOAD_ENTRIES_NON_ALPHABETICAL"))
10753 : true) // sometimes we find odd entries in the wrong LIBS, better to be safe, NOT NECESSARY for ICSD since we load from the calculation layer
10754 )) {
10755 nary = _aflowlib_tmp.vspecies.size();
10756 if (entries.size() < nary) {
10757 continue;
10758 } // this entry is garbage (wrong directory)
10759 entries[nary - 1].push_back(_aflowlib_tmp);
10760 total_count++;
10761 if (vpflow.flag("PFLOW::LOAD_ENTRIES_LOAD_XSTRUCTURES")) {
10762 if (!loadXstructures(entries[nary - 1].back(), FileMESSAGE, oss, vpflow.flag("PFLOW::LOAD_ENTRIES_LOAD_XSTRUCTURES_RELAXED_ONLY"))) { // CO20171202 - let it decided whether to load from common or not
10763 entries[nary - 1].pop_back();
10764 total_count--;
10765 }
10766 }
10767 }
10768 message.str("");
10769 }
10770 }
10771 }
10772 }
10773 }
10774 } else {
10775 const bool double_check_lib = true; // while NOT NECESSARY for ICSD, LIBs are screwed up sometimes
10776 string clean_system;
10777 string calculation_path;
10778 string clean_calculation;
10779 vector<string> systems;
10780 vector<string> calculations;
10781 if (load_from_common) {
10782 aurostd::DirectoryLS(LIB_path, systems);
10783 } else {
10784 aurostd::httpGetTokens(LIB_path + "/?aflowlib_entries", systems, ",");
10785 }
10786 if (!systems.empty() && systems[0] == "<!DOCTYPE") { // CO20180627
10787 message << "REST-API appears to be down";
10788 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_ERROR_);
10789 return false;
10790 }
10791 for (size_t i = 0; i < systems.size(); i++) {
10792 calculation_path = LIB_path + "/" + systems[i];
10793 if (load_from_common && !aurostd::IsDirectory(calculation_path)) {
10794 continue;
10795 }
10796 loc = systems[i].find(":");
10797 clean_system = systems[i].substr(0, loc); // even if we don't find it, simply copy string
10798 if (compoundsBelong(velements, clean_system, input_velements, input_vcomposition, FileMESSAGE, oss, false, vpflow.flag("PFLOW::LOAD_ENTRIES_NON_ALPHABETICAL"), pp_string,
10799 true)) { // NOT recommended, these are BS entries // no need to clean, already done //use short_pp_string_AFLOW_database
10800 if (load_from_common) {
10801 aurostd::DirectoryLS(calculation_path, calculations);
10802 } else {
10803 aurostd::httpGetTokens(calculation_path + "/?aflowlib_entries", calculations, ",");
10804 }
10805 if (!calculations.empty() && calculations[0] == "<!DOCTYPE") { // CO20180627
10806 message << "REST-API appears to be down";
10807 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_ERROR_);
10808 return false;
10809 }
10810 for (size_t j = 0; j < calculations.size(); j++) {
10811 if (load_from_common && !aurostd::IsDirectory(calculation_path + "/" + calculations[j])) {
10812 continue;
10813 }
10814 // if(vpflow.flag("PFLOW::LOAD_ENTRIES_ENTRY_OUTPUT"))
10815 vloadpaths.clear();
10816 if (load_from_common) {
10817 aurostd::SubDirectoryLS(calculation_path + "/" + calculations[j], vloadpaths);
10818 } else {
10819 pflow::SubLayersRestAPILS(calculation_path + "/" + calculations[j], vloadpaths);
10820 }
10821 if (LDEBUG) {
10822 cerr << __AFLOW_FUNC__ << " vloadpaths=" << aurostd::joinWDelimiter(vloadpaths, ",") << endl;
10823 }
10824 if (vloadpaths.size() > 1 && vloadpaths[1] == "<!DOCTYPE") { // CO20180627
10825 message << "REST-API appears to be down";
10826 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_ERROR_);
10827 return false;
10828 }
10829 for (size_t k = 0; k < vloadpaths.size(); k++) {
10830 const string& load_path = vloadpaths[k];
10831 message << "Loading " << (load_from_common ? "path" : "url") << "=" << load_path;
10832 pflow::logger(__AFLOW_FILE__, std::string("aurostd::") + std::string((load_from_common ? "file" : "url")) + std::string("2string():"), message, aflags, FileMESSAGE, oss, _LOGGER_MESSAGE_,
10833 !vpflow.flag("PFLOW::LOAD_ENTRIES_ENTRY_OUTPUT")); // print to log anyway
10834 // complicated ternary operator, returns bool, but necessary to avoid double code
10835 if ((load_from_common) ?
10836 // if load_from_common, check this bool
10837 // this part of the ternary operator will first look for a non-empty aflowlib.out,
10838 // then try to load it
10839 // the last part checks that the loaded entry has a set of species that belong to the original query (protection)
10840 (
10841 //(aurostd::FileExist(load_path+"/"+DEFAULT_FILE_AFLOWLIB_ENTRY_OUT)) &&
10842 (aurostd::FileNotEmpty(load_path + "/" + DEFAULT_FILE_AFLOWLIB_ENTRY_OUT)) && (_aflowlib_tmp.file2aflowlib(load_path + "/" + DEFAULT_FILE_AFLOWLIB_ENTRY_OUT, message) > 0) &&
10843 (double_check_lib ? compoundsBelong(velements, _aflowlib_tmp.vspecies, FileMESSAGE, oss, vpflow.flag("PFLOW::LOAD_ENTRIES_NON_ALPHABETICAL")) : true) // sometimes we find odd entries in the wrong LIBS, better to be safe
10844 )
10845 :
10846 // if load_from_api, check this bool
10847 // this part of the ternary operator loads in the url
10848 // the last part checks that the loaded entry has a set of species that belong to the original query (protection)
10849 ((_aflowlib_tmp.url2aflowlib(load_path, message, false) > 0) &&
10850 (double_check_lib ? compoundsBelong(velements, _aflowlib_tmp.vspecies, FileMESSAGE, oss, vpflow.flag("PFLOW::LOAD_ENTRIES_NON_ALPHABETICAL")) : true) // sometimes we find odd entries in the wrong LIBS, better to be safe
10851 )) {
10852 nary = _aflowlib_tmp.vspecies.size();
10853 if (entries.size() < nary) {
10854 continue;
10855 } // this entry is garbage (wrong directory)
10856 entries[nary - 1].push_back(_aflowlib_tmp);
10857 total_count++;
10858 if (vpflow.flag("PFLOW::LOAD_ENTRIES_LOAD_XSTRUCTURES")) {
10859 if (!loadXstructures(entries[nary - 1].back(), FileMESSAGE, oss, vpflow.flag("PFLOW::LOAD_ENTRIES_LOAD_XSTRUCTURES_RELAXED_ONLY"))) { // CO20171202 - let it decided whether to load from common or not
10860 entries[nary - 1].pop_back();
10861 total_count--;
10862 }
10863 }
10864 }
10865 message.str("");
10866 }
10867 }
10868 }
10869 }
10870 }
10872 // END Finding matches
10874
10875 // Raises PureA and PureB flags
10876 if (velements.size() == 2) {
10877 if (!entries.empty() && !entries[0].empty()) {
10878 for (size_t j = 0; j < entries[0].size(); j++) {
10879 if (entries[0][j].vstoichiometry.size() == 1) {
10880 if (entries[0][j].species == velements[0]) {
10881 entries[0][j].pureA = true;
10882 } else if (entries[0][j].species == velements[1]) {
10883 entries[0][j].pureB = true;
10884 }
10885 }
10886 }
10887 }
10888 }
10889
10891 // START Print loaded entries summary
10893
10894 message << "Loaded " << total_count << " entries";
10895 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_MESSAGE_);
10896
10898 // END Print loaded entries summary
10900
10901 return true; // entries;
10902 }
10903} // namespace pflow
10904
10905namespace pflow {
10906 // ***************************************************************************
10907 // pflow::getCombination(vector<string>& velements,uint nary)
10908 // ***************************************************************************
10909 // for given set of elements, will return nary combinations
10910 // binary combinations of MnPdPt: MnPd, MnPt, PdPt
10911
10912 vector<vector<string>> elementalCombinations(const vector<string>& velements, uint nary) {
10913 // for given set of elements, will return nary combinations
10914 // binary combinations of MnPdPt: MnPd, MnPt, PdPt
10915 const bool LDEBUG = (false || XHOST.DEBUG);
10916 vector<vector<string>> combos;
10917 aurostd::xcombos xc(velements.size(), nary, 'C');
10918 while (xc.increment()) {
10919 combos.push_back(xc.applyCombo(velements));
10920 if (LDEBUG) {
10921 cerr << __AFLOW_FUNC__ << " combos.back()=";
10922 for (size_t i = 0; i < combos.back().size(); i++) {
10923 cerr << combos.back()[i];
10924 }
10925 cerr << endl;
10926 }
10927 }
10928 return combos;
10929 }
10930} // namespace pflow
10931
10932namespace pflow {
10933 // ***************************************************************************
10934 // pflow::compoundsBelong(vector<string>& velements, vector<string>& elements)
10935 // ***************************************************************************
10936 // let's you know if input (or elements) belongs on hull of velements
10937 // if sort_elements==True, will sort(elements) first before matching with velements,
10938 // sorting is generally NOT preferred as it would match unsorted compounds from database (NOT good)
10939
10940 // vector
10941 bool compoundsBelong(const vector<string>& velements2check, const string& input, ostream& oss, bool clean, bool sort_elements, elements_string_type e_str_type, bool shortcut_pp_string_AFLOW_database) {
10942 ofstream FileMESSAGE;
10943 return compoundsBelong(velements2check, input, FileMESSAGE, oss, clean, sort_elements, e_str_type, shortcut_pp_string_AFLOW_database);
10944 }
10945 bool compoundsBelong(const vector<string>& velements2check, const string& input, vector<string>& input_velements, vector<double>& input_vcomposition, ostream& oss, bool clean, bool sort_elements, elements_string_type e_str_type, bool shortcut_pp_string_AFLOW_database) {
10946 ofstream FileMESSAGE;
10947 return compoundsBelong(velements2check, input, input_velements, input_vcomposition, FileMESSAGE, oss, clean, sort_elements, e_str_type, shortcut_pp_string_AFLOW_database);
10948 }
10949 bool compoundsBelong(const vector<string>& velements2check, const string& input, ofstream& FileMESSAGE, ostream& oss, bool clean, bool sort_elements, elements_string_type e_str_type, bool shortcut_pp_string_AFLOW_database) {
10950 vector<string> input_velements;
10951 vector<double> input_vcomposition;
10952 return compoundsBelong(velements2check, input, input_velements, input_vcomposition, FileMESSAGE, oss, clean, sort_elements, e_str_type, shortcut_pp_string_AFLOW_database);
10953 }
10954 bool compoundsBelong(const vector<string>& velements2check,
10955 const string& input,
10956 vector<string>& input_velements,
10957 vector<double>& input_vcomposition,
10958 ofstream& FileMESSAGE,
10959 ostream& oss,
10960 bool clean,
10961 bool sort_elements,
10962 elements_string_type e_str_type,
10963 bool shortcut_pp_string_AFLOW_database) {
10964 const bool LDEBUG = (false || XHOST.DEBUG);
10965 if (e_str_type == pp_string && shortcut_pp_string_AFLOW_database == true) {
10966 // pp_string parsing is slow because of LONG list of strings to substitute in VASP_PseudoPotential_CleanName()
10967 // instead, we are safe with faster composition_string parsing IFF we only remove _GW, which will confuse elementsFromCompositionString()
10968 // all other characters are eliminated because we only look for A-Z a-z from substrings created from capital letters
10969 // these must be directory strings from REST-API/AFLUX
10970 // otherwise, we also need to be careful of "potpaw_PBE/Mn_pv" species (for example) inside aflow.in (LEGACY)
10971 // compoundsBelong is only used for loadEntries() (as of 20190712)
10972 string input_new = input;
10973 // aurostd::RemoveSubStringInPlace(input_new,"_GW"); //CO20190712
10974 aurostd::VASP_PseudoPotential_CleanName_InPlace(input_new, true); // capital_letters_only==true
10975 input_velements = aurostd::getElements(input_new, input_vcomposition, composition_string, FileMESSAGE, clean, sort_elements, false, oss); // use composition_string (FASTER) //do not keep_pp
10976 } else { // default
10977 input_velements = aurostd::getElements(input, input_vcomposition, e_str_type, FileMESSAGE, clean, sort_elements, false, oss); // do not keep_pp
10978 }
10979 if (LDEBUG) {
10980 cerr << __AFLOW_FUNC__ << " input=\"" << input << "\", elements=" << aurostd::joinWDelimiter(aurostd::wrapVecEntries(input_velements, "\""), ",") << endl;
10981 }
10982 return compoundsBelong(velements2check, input_velements, FileMESSAGE, oss, false); // already sorted
10983 }
10984 bool compoundsBelong(const vector<string>& velements2check, const vector<string>& input_velements, ostream& oss, bool sort_elements) {
10985 ofstream FileMESSAGE;
10986 return compoundsBelong(velements2check, input_velements, FileMESSAGE, oss, sort_elements);
10987 }
10988 bool compoundsBelong(const vector<string>& velements2check, const vector<string>& input_velements, ofstream& FileMESSAGE, ostream& oss, bool sort_elements) {
10989 stringstream message;
10990 if (velements2check.empty() || input_velements.empty()) { // null case, simply return false
10991 message << "Invalid input (velements2check.size()==" << velements2check.size() << ",input_velements.size()==" << input_velements.size() << ")";
10992 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, FileMESSAGE, oss, _LOGGER_ERROR_);
10993 return false;
10994 }
10995 if (input_velements.size() > velements2check.size()) {
10996 return false;
10997 } // fast return
10998 if (sort_elements) { // call recursion if sort needed
10999 vector<string> velements2check_sorted;
11000 vector<string> input_velements_sorted;
11001 for (size_t i = 0; i < velements2check.size(); i++) {
11002 velements2check_sorted.push_back(velements2check[i]);
11003 }
11004 for (size_t i = 0; i < input_velements.size(); i++) {
11005 input_velements_sorted.push_back(input_velements[i]);
11006 }
11007 sort(velements2check_sorted.begin(), velements2check_sorted.end());
11008 sort(input_velements_sorted.begin(), input_velements_sorted.end());
11009 return compoundsBelong(velements2check_sorted, input_velements_sorted, FileMESSAGE, oss, false);
11010 }
11011 // check if all input_velements are in velements2check (in order)
11012 bool found;
11013 uint starting_index = 0; // ensures we search in order
11014 for (size_t i = 0; i < input_velements.size(); i++) {
11015 found = false;
11016 for (size_t j = starting_index; j < velements2check.size() && !found; j++) {
11017 if (input_velements[i] == velements2check[j]) {
11018 found = true;
11019 starting_index = j + 1;
11020 } // start search at the next velement
11021 }
11022 if (!found) {
11023 return false;
11024 }
11025 }
11026 return true;
11027 }
11028
11029} // namespace pflow
11030
11031// functions for loading entries
11032namespace pflow {
11033 // ***************************************************************************
11034 // pflow::loadXstructures(aflowlib::_aflowlib_entry& entry,string path,bool
11035 // relaxed_only,ostream& oss,ofstream& FileMESSAGE)
11036 // ***************************************************************************
11037 // loads xstructures
11038 bool loadXstructures(aflowlib::_aflowlib_entry& entry, ostream& oss, bool relaxed_only, string path, bool is_url_path) {
11039 ofstream FileMESSAGE;
11040 vector<string> structure_files; // DX20200224
11041 return loadXstructures(entry, structure_files, FileMESSAGE, oss, relaxed_only, path, is_url_path); // DX20200224
11042 }
11043 bool loadXstructures(aflowlib::_aflowlib_entry& entry, ofstream& FileMESSAGE, ostream& oss, bool relaxed_only, string path, bool is_url_path) { // DX20200224
11044 vector<string> structure_files; // DX20200224
11045 return loadXstructures(entry, structure_files, FileMESSAGE, oss, relaxed_only, path, is_url_path); // DX20200224
11046 }
11047 bool loadXstructures(aflowlib::_aflowlib_entry& entry, vector<string>& structure_files, ofstream& FileMESSAGE, ostream& oss, bool relaxed_only, string path, bool is_url_path) { // DX20200224 - added structure_files as input
11048 const bool LDEBUG = (false || XHOST.DEBUG);
11049 stringstream message;
11050
11051 // get path if not provided
11052 if (path.empty()) {
11053 path = entry.getPathAURL(FileMESSAGE, oss, true);
11054 is_url_path = false;
11055 if (!(!path.empty() && aurostd::IsDirectory(path))) {
11056 path = "";
11057 } // reset
11058 }
11059 if (path.empty()) {
11060 path = entry.getPathAURL(FileMESSAGE, oss, false);
11061 is_url_path = true;
11062 }
11063 if (path.empty()) {
11064 message << "Path cannot be loaded from entry, skipping loadXstructure()";
11065 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, FileMESSAGE, oss, _LOGGER_WARNING_);
11066 return false;
11067 }
11068 if (LDEBUG) {
11069 cerr << __AFLOW_FUNC__ << " path=" << path << endl;
11070 }
11071
11072 vector<string> vspecies = entry.vspecies;
11073 //[CO20221110 - fails for unaries in LIB2]if(vspecies.empty()){vspecies=entry.getSpeciesAURL(FileMESSAGE,oss);}
11074 if (vspecies.empty()) {
11075 vspecies = entry.getSpecies();
11076 }
11077 if (LDEBUG) {
11078 cerr << __AFLOW_FUNC__ << " vspecies=" << aurostd::joinWDelimiter(vspecies, ",") << endl;
11079 }
11080
11081 xstructure xstrAux;
11082 stringstream ss;
11083 vector<string> files;
11084
11085 if (is_url_path) {
11086 aurostd::httpGetTokens(path + "/?files", files, ",");
11087 } else {
11088 aurostd::DirectoryLS(path, files);
11089 }
11090
11091 // CO20200404 - creating vectors for for-loops to reduce code
11092 const vector<string> poscar_files_orig{"POSCAR.orig", "POSCAR.relax1"}; // flipped order so orig is preferred if available //POSCAR.relax1,POSCAR.orig
11093 const vector<string> poscar_files_relax_mid{"POSCAR.relax2", "CONTCAR.relax1"};
11094 // flipped order for speed and likelihood of existence //POSCAR.bands,CONTCAR.bands,POSCAR.static,CONTCAR.static,CONTCAR.relax2,CONTCAR.relax
11095 const vector<string> poscar_files_relax_final{"CONTCAR.relax", "CONTCAR.relax2", "POSCAR.static", "POSCAR.bands", "CONTCAR.static", "CONTCAR.bands"};
11096
11097 // CO20200223 - substring2bool - > CompressFileWithinList()
11098 string efile;
11099 if ((!aurostd::CompressFileWithinList(files, "POSCAR.relax1", efile) && !aurostd::CompressFileWithinList(files, "POSCAR.orig", efile) && !relaxed_only) ||
11100 (!aurostd::CompressFileWithinList(files, "POSCAR.relax2", efile) && !aurostd::CompressFileWithinList(files, "CONTCAR.relax1", efile) && !relaxed_only) ||
11101 (!aurostd::CompressFileWithinList(files, "POSCAR.bands", efile) && !aurostd::CompressFileWithinList(files, "CONTCAR.bands", efile) && !aurostd::CompressFileWithinList(files, "POSCAR.static", efile) &&
11102 !aurostd::CompressFileWithinList(files, "CONTCAR.static", efile) && !aurostd::CompressFileWithinList(files, "CONTCAR.relax2", efile) && !aurostd::CompressFileWithinList(files, "CONTCAR.relax", efile) && true)) {
11103 if (entry.prototype.find("POCC") != string::npos) { // POCC entries have no composition
11104 message << "path=" << path << " is a POCC-structure and has no structure files. Ignoring entry";
11105 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, FileMESSAGE, oss, _LOGGER_MESSAGE_);
11106 return false;
11107 } else {
11108 message << "path=" << path << " missing structure files. Ignoring entry";
11109 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, FileMESSAGE, oss, _LOGGER_WARNING_);
11110 return false;
11111 }
11112 }
11113 if (!relaxed_only) {
11115 // START Loading original structures
11117
11118 for (size_t i = 0; i < poscar_files_orig.size() && xstrAux.atoms.empty(); i++) {
11119 if (aurostd::CompressFileWithinList(files, poscar_files_orig[i], efile)) {
11120 if (LDEBUG) {
11121 cerr << __AFLOW_FUNC__ << " looking for " << path + "/" + efile << endl;
11122 }
11123 ss.str("");
11124 if (is_url_path) {
11125 ss << aurostd::httpGetCompressedFileContent(path + "/" + efile);
11126 } else {
11127 aurostd::compressfile2stringstream(path + "/" + efile, ss);
11128 }
11129 if (!ss.str().empty()) {
11130 try {
11131 xstrAux = xstructure(ss, IOVASP_AUTO);
11132 if (xstrAux.GetElementsFromAtomNames().empty()) {
11133 if (vspecies.empty()) {
11134 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "could not extract species from AURL", _INPUT_ERROR_);
11135 }
11136 xstrAux.SetSpecies(aurostd::vector2deque(vspecies));
11137 }
11138 if (LDEBUG) {
11139 cerr << __AFLOW_FUNC__ << " xstrAux=" << endl;
11140 cerr << xstrAux << endl;
11141 }
11142 structure_files.push_back(poscar_files_orig[i]);
11143 } // DX20191210 - added try-catch //DX20200224 - added structure_files tag
11144 catch (aurostd::xerror& excpt) {
11145 xstrAux.clear(); // clear it if it is garbage //DX20191220 - uppercase to lowercase clear
11146 message << poscar_files_orig[i] << ": Path exists, but could not load structure (e.g., URL timeout or bad structure file).";
11147 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, FileMESSAGE, _LOGGER_WARNING_);
11148 } // DX20191210
11149 }
11150 }
11151 }
11152 if (xstrAux.atoms.empty()) {
11153 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, "Cannot load original structure", FileMESSAGE, oss, _LOGGER_WARNING_);
11154 return false;
11155 }
11156 entry.vstr.push_back(xstrAux);
11157 xstrAux.clear(); // DX20191220 - uppercase to lowercase clear
11158 if (LDEBUG) {
11159 cerr << __AFLOW_FUNC__ << " loaded ORIGINAL structure" << endl;
11160 }
11161
11163 // END Loading original structures
11165
11167 // START Loading singularly-relaxed structures
11169
11170 for (size_t i = 0; i < poscar_files_relax_mid.size() && xstrAux.atoms.empty(); i++) {
11171 if (aurostd::CompressFileWithinList(files, poscar_files_relax_mid[i], efile)) {
11172 if (LDEBUG) {
11173 cerr << __AFLOW_FUNC__ << " looking for " << path + "/" + efile << endl;
11174 }
11175 ss.str("");
11176 if (is_url_path) {
11177 ss << aurostd::httpGetCompressedFileContent(path + "/" + efile);
11178 } else {
11179 aurostd::compressfile2stringstream(path + "/" + efile, ss);
11180 }
11181 if (!ss.str().empty()) {
11182 try {
11183 xstrAux = xstructure(ss, IOVASP_AUTO);
11184 if (xstrAux.GetElementsFromAtomNames().empty()) {
11185 if (vspecies.empty()) {
11186 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "could not extract species from AURL", _INPUT_ERROR_);
11187 }
11188 xstrAux.SetSpecies(aurostd::vector2deque(vspecies));
11189 }
11190 if (LDEBUG) {
11191 cerr << __AFLOW_FUNC__ << " xstrAux=" << endl;
11192 cerr << xstrAux << endl;
11193 }
11194 structure_files.push_back(poscar_files_relax_mid[i]);
11195 } // DX20191210 - added try-catch //DX20200224 - added structure_files tag
11196 catch (aurostd::xerror& excpt) {
11197 xstrAux.clear(); // clear it if it is garbage //DX20191220 - uppercase to lowercase clear
11198 message << poscar_files_relax_mid[i] << ": Path exists, but could not load structure (e.g., URL timeout or bad structure file).";
11199 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, FileMESSAGE, _LOGGER_WARNING_);
11200 } // DX20191210
11201 }
11202 }
11203 }
11204 if (xstrAux.atoms.empty()) {
11205 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, "Cannot load mid-relaxed structure", FileMESSAGE, oss, _LOGGER_WARNING_);
11206 return false;
11207 }
11208 entry.vstr.push_back(xstrAux);
11209 xstrAux.clear(); // DX20191220 - uppercase to lowercase clear
11210 if (LDEBUG) {
11211 cerr << __AFLOW_FUNC__ << " loaded RELAX1 structure" << endl;
11212 }
11213
11215 // END Loading singularly-relaxed structures
11217 }
11218
11220 // START Loading fully-relaxed structures
11222
11223 for (size_t i = 0; i < poscar_files_relax_final.size() && xstrAux.atoms.empty(); i++) {
11224 if (aurostd::CompressFileWithinList(files, poscar_files_relax_final[i], efile)) {
11225 if (LDEBUG) {
11226 cerr << __AFLOW_FUNC__ << " looking for " << path + "/" + efile << endl;
11227 }
11228 ss.str("");
11229 if (is_url_path) {
11230 ss << aurostd::httpGetCompressedFileContent(path + "/" + efile);
11231 } else {
11232 aurostd::compressfile2stringstream(path + "/" + efile, ss);
11233 }
11234 if (!ss.str().empty()) {
11235 try {
11236 xstrAux = xstructure(ss, IOVASP_AUTO);
11237 if (xstrAux.GetElementsFromAtomNames().empty()) {
11238 if (vspecies.empty()) {
11239 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "could not extract species from AURL", _INPUT_ERROR_);
11240 }
11241 xstrAux.SetSpecies(aurostd::vector2deque(vspecies));
11242 }
11243 if (LDEBUG) {
11244 cerr << __AFLOW_FUNC__ << " xstrAux=" << endl;
11245 cerr << xstrAux << endl;
11246 }
11247 structure_files.push_back(poscar_files_relax_final[i]);
11248 } // DX20191210 - added try-catch //DX20200224 - added structure_files tag
11249 catch (aurostd::xerror& excpt) {
11250 xstrAux.clear(); // clear it if it is garbage //DX20191220 - uppercase to lowercase clear
11251 message << poscar_files_relax_final[i] << ": Path exists, but could not load structure (e.g., URL timeout or bad structure file).";
11252 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, FileMESSAGE, _LOGGER_WARNING_);
11253 } // DX20191210
11254 }
11255 }
11256 }
11257 if (xstrAux.atoms.empty()) {
11258 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, "Cannot load fully-relaxed structure", FileMESSAGE, oss, _LOGGER_WARNING_);
11259 return false;
11260 }
11261 entry.vstr.push_back(xstrAux);
11262 xstrAux.clear(); // DX20191220 - uppercase to lowercase clear
11263 if (LDEBUG) {
11264 cerr << __AFLOW_FUNC__ << " loaded FULLY-RELAXED structure" << endl;
11265 }
11266
11268 // END Loading fully-relaxed structures
11270
11271 return true;
11272 }
11273
11280 bool loadXstructureLibEntry(const aflowlib::_aflowlib_entry& entry, xstructure& new_structure) { // HE20220606
11281 if (entry.positions_cartesian.empty()) {
11282 return false;
11283 }
11284 new_structure.title = "Relaxed AFLUX: " + entry.aurl;
11285 new_structure.scale = 1.0;
11286 new_structure.neg_scale = false;
11287 new_structure.iomode = IOAFLOW_AUTO;
11288 std::vector<double> geometry;
11289 aurostd::string2tokens(entry.geometry, geometry, ",");
11290 new_structure.a = geometry[0];
11291 new_structure.b = geometry[1];
11292 new_structure.c = geometry[2];
11293 new_structure.alpha = geometry[3];
11294 new_structure.beta = geometry[4];
11295 new_structure.gamma = geometry[5];
11296 new_structure.lattice = GetClat(new_structure.a, new_structure.b, new_structure.c, new_structure.alpha, new_structure.beta, new_structure.gamma);
11297 new_structure.spacegroupnumber = entry.spacegroup_relax;
11298 new_structure.spacegrouplabel = GetSpaceGroupLabel(new_structure.spacegroupnumber);
11299 if (new_structure.spacegroupnumber > 0 && new_structure.spacegroupnumber <= 230) {
11300 new_structure.spacegroup = GetSpaceGroupName(new_structure.spacegroupnumber, new_structure.directory);
11301 } else {
11302 new_structure.spacegroup = "";
11303 }
11304 new_structure.coord_flag = _COORDS_FRACTIONAL_;
11305 strcpy(new_structure.coord_type, "D");
11306 new_structure.FixLattices();
11307
11308 std::vector<int> composition;
11309 aurostd::string2tokens(entry.composition, composition, ",");
11310 uint num_atoms = 0;
11311 std::vector<std::vector<double>> positions_fractional;
11312 std::vector<double> positions_fractional_raw;
11313 std::vector<std::string> positions_fractional_raw_str;
11314 aurostd::string2tokens(entry.positions_fractional, positions_fractional_raw_str, ";");
11315 for (std::vector<std::string>::const_iterator pf_str = positions_fractional_raw_str.begin(); pf_str != positions_fractional_raw_str.end(); pf_str++) {
11316 positions_fractional_raw.clear();
11317 aurostd::string2tokens(*pf_str, positions_fractional_raw, ",");
11318 positions_fractional.emplace_back(positions_fractional_raw);
11319 }
11320
11321 std::vector<std::string> species;
11322 aurostd::string2tokens(entry.species, species, ",");
11323 xvector<double> v(3);
11324 _atom atom;
11325 for (size_t type_idx = 0; type_idx < composition.size(); type_idx++) {
11326 for (int atom_idx = 0; atom_idx < composition[type_idx]; atom_idx++) {
11327 atom.clear();
11328 v.clear();
11329 v(1) = positions_fractional[num_atoms][0];
11330 v(2) = positions_fractional[num_atoms][1];
11331 v(3) = positions_fractional[num_atoms][2];
11332 atom.fpos = v;
11333 atom.cpos = new_structure.f2c * atom.fpos;
11334 atom.basis = num_atoms;
11335 atom.ijk(1) = 0;
11336 atom.ijk(2) = 0;
11337 atom.ijk(3) = 0;
11338 atom.corigin(1) = 0.0;
11339 atom.corigin(2) = 0.0;
11340 atom.corigin(3) = 0.0; // inside the zero cell
11341 atom.coord(1) = 0.0;
11342 atom.coord(2) = 0.0;
11343 atom.coord(3) = 0.0; // inside the zero cell
11344 atom.spin = 0.0;
11345 atom.noncoll_spin.clear();
11346 atom.type = type_idx;
11347 atom.order_parameter_value = 0;
11348 atom.order_parameter_atom = false;
11349 atom.partial_occupation_value = 1.0;
11350 atom.partial_occupation_flag = false;
11351 atom.name = species[type_idx];
11352 atom.cleanname = species[type_idx];
11353 atom.name_is_given = true;
11354 new_structure.AddAtom(atom, false); // CO20230319 - add by type
11355 num_atoms++;
11356 }
11357 }
11358 return true;
11359 }
11360} // namespace pflow
11361
11362namespace pflow {
11363 //***************************************************************************//
11364 // pflow::defaultLoadEntriesFlags(const string& input)
11365 //***************************************************************************//
11366 // sets some default flags
11367 void defaultLoadEntriesFlags(aurostd::xoption& vpflow, ostream& oss, string input, bool entry_output, bool silent) { // overload
11368 ofstream FileMESSAGE;
11369 return defaultLoadEntriesFlags(vpflow, FileMESSAGE, oss, input, entry_output, silent);
11370 }
11371 void defaultLoadEntriesFlags(aurostd::xoption& vpflow, ofstream& FileMESSAGE, ostream& oss, string input, bool entry_output, bool silent) { // main function
11372 stringstream message;
11373
11374 // get directory info
11375 _aflags aflags;
11376 aflags.Directory = chull::getPath(); // default
11377 if (vpflow.flag("CHULL::PATH")) {
11378 aflags.Directory = chull::getPath(vpflow, FileMESSAGE, oss);
11379 }
11380
11381 // common
11382 if (entry_output) {
11383 vpflow.flag("PFLOW::LOAD_ENTRIES_ENTRY_OUTPUT", true);
11384 if (!silent) {
11385 message << "PFLOW::LOAD_ENTRIES_ENTRY_OUTPUT set to true";
11386 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_OPTION_);
11387 }
11388 }
11389 //[CO20190715 - LOAD_ENTRIES_ONLY_ALPHABETICAL -> LOAD_ENTRIES_NON_ALPHABETICAL]vpflow.flag("PFLOW::LOAD_ENTRIES_ONLY_ALPHABETICAL", true); // un-alphabetized entries are crap
11390 if (!silent) {
11391 message << "PFLOW::LOAD_ENTRIES_NON_ALPHABETICAL set to true";
11392 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_OPTION_);
11393 }
11394 vpflow.flag("PFLOW::LOAD_ENTRIES_NARIES_MINUS_ONE", true); // if loading ternary, also load relevant binaries and unaries
11395 if (!silent) {
11396 message << "PFLOW::LOAD_ENTRIES_NARIES_MINUS_ONE set to true";
11397 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_OPTION_);
11398 }
11399 input = aurostd::toupper(input); // removes ALL ambiguity with case
11400 // must be specific LIB1, LIB2, etc.
11401 if (!(input == "A" || input == "ICSD")) //|| input == "icsd")) //put other special libs here
11402 { // CO20200106 - patching for auto-indenting
11403 string lib_name;
11404 string load_lib_flag_name;
11405 // make robust so input can be "LIB2" or "2"
11406 if (aurostd::substring2bool(input, "LIB")) {
11407 lib_name = input;
11408 } else {
11409 lib_name = "LIB" + input;
11410 }
11411 load_lib_flag_name = "PFLOW::LOAD_ENTRIES_LOAD_" + lib_name;
11412 vpflow.flag(load_lib_flag_name, true);
11413 if (!silent) {
11414 message << load_lib_flag_name << " set to true";
11415 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_OPTION_);
11416 }
11417 } else {
11418 if (input == "A") {
11419 // get appropriate size, slightly inefficient (as we got this before), but it's cheap
11420 // string system = vpflow.getattachedscheme("PFLOW::ALLOY"); //CO20170908 - don't want to have to set this everytime
11421 // vector<string> velements = aurostd::getElements(system, oss, FileMESSAGE); //un-sorted, okay
11422 string lib_count_string;
11423 string load_lib_flag_name;
11424 // for (size_t i = 0; i < velements.size() && i <= _AFLOW_LIB_MAX_; i++) //CO20170908 - simply load all, LoadEntries() limits appropriately by velements.size()
11425 for (uint lib = 1; lib <= _AFLOW_LIB_MAX_; lib++) { // CO20200106 - patching for auto-indenting
11426 // if(i == 0) { continue; } //skip LIB1 by default //CO20180316 - DON'T skip LIB1, Mn unary can be very skewed
11427 lib_count_string = aurostd::utype2string(lib);
11428 load_lib_flag_name = "PFLOW::LOAD_ENTRIES_LOAD_LIB" + lib_count_string;
11429 vpflow.flag(load_lib_flag_name, true);
11430 if (!silent) {
11431 message << load_lib_flag_name << " set to true";
11432 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_OPTION_);
11433 }
11434 }
11435 }
11436 if (input == "A" || input == "ICSD") //|| input == "icsd")
11437 { // CO20200106 - patching for auto-indenting
11438 vpflow.flag("PFLOW::LOAD_ENTRIES_LOAD_ICSD", true);
11439 if (!silent) {
11440 message << "PFLOW::LOAD_ENTRIES_LOAD_ICSD set to true";
11441 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_OPTION_);
11442 }
11443 }
11444 }
11445 }
11446} // namespace pflow
11447
11448// ***************************************************************************
11449// pflow::prototypeMatch(string p1,string p2)
11450// ***************************************************************************
11451// better than an exact match of proto_database and proto_search
11452// we match for 549 and 549.bis
11453// proto_database is "549.bis" and proto_search is "549"
11454// only knows "." and ":" for now
11455namespace pflow {
11456 bool prototypeMatch(string proto_database, string proto_search) {
11457 if (proto_database == proto_search) {
11458 return true;
11459 }
11460 if (proto_database.size() < (proto_search.size() + 1)) {
11461 return false;
11462 } // we only match "549" + something
11463 if (proto_database.substr(0, proto_search.size()) != proto_search) {
11464 return false;
11465 } // not something + "549"
11466 if (proto_database[proto_search.size()] == '.' || proto_database[proto_search.size()] == ':') {
11467 return true;
11468 }
11469 // cerr << "What is this: " << proto_database << endl;
11470 return false;
11471 }
11472} // namespace pflow
11473// Added by Corey Oses - May 2017
11474// END - all relevent functions for loading entries here
11477
11478namespace pflow {
11479
11480 // ME20200512 - Created by CO for POCC.
11481 const int BAR_WIDTH = 70;
11482 void updateProgressBar(unsigned long long int current, unsigned long long int end, ostream& oss) {
11483 // CO20220630 - decide if we should print
11484 // this is one of the few functions that escapes pflow::logger() and aurostd::PrintXXStream() for printing
11485 // all other printing should route through pflow::logger() (routing directly through aurostd::PrintXXStream() is obsolete)
11486 if (XHOST.QUIET || XHOST.QUIET_GLOBAL || XHOST.vflag_control.flag("WWW")) {
11487 return;
11488 } // CO20190520 - no progress bar for web stuff //CO20200404 - new web flag // ME20210428 - do not update when quiet either
11489 if ((&oss == &cout) && XHOST.QUIET_COUT) {
11490 return;
11491 }
11492 if ((&oss == &cerr) && XHOST.QUIET_CERR) {
11493 return;
11494 }
11495
11496 const double progress = (double) current / (double) end;
11497 const int pos = BAR_WIDTH * progress;
11498
11499 oss << "[";
11500 for (int i = 0; i < BAR_WIDTH; ++i) {
11501 if (i < pos) {
11502 oss << "=";
11503 } else if (i == pos) {
11504 oss << ">";
11505 } else {
11506 oss << " ";
11507 }
11508 }
11509 oss << "] " << int(progress * 100.0) << " %\r";
11510 oss.flush();
11511 if (current == end) {
11512 oss << endl;
11513 }
11514 }
11515
11516 //***************************************************************************//
11517 // pflow::logger(const char& type,const string& function_name,string
11518 // _message,bool silent,ostream& oss,ofstream& FileMESSAGE)
11519 //***************************************************************************//
11520 // added by Corey Oses - May 2017
11521 // effectively logs EVERYTHING, deals with colors, oss, and log files (very robust)
11522 // types include error, warning, options, and more as needed (see below)
11523 // raw is special, prints raw message
11524 // message can be string or stringstream (if stringstream, it gets cleared out)
11525 // oss = cout, cerr (as you prefer)
11526 // FileMESSAGE - logfile
11527 void logger(const string& filename, const string& function_name, stringstream& message, const char& type, ostream& oss, bool silent, const string& message_metadata) { // overload
11528 const string _message = message.str();
11529 logger(filename, function_name, _message, oss, type, silent, message_metadata);
11531 }
11532
11533 void logger(const string& filename, const string& function_name, stringstream& message, ostream& oss, const char& type, bool silent, const string& message_metadata) { // overload
11534 const string _message = message.str();
11535 logger(filename, function_name, _message, oss, type, silent, message_metadata);
11537 }
11538
11539 void logger(const string& filename, const string& function_name, stringstream& message, ofstream& FileMESSAGE, ostream& oss, const char& type, bool silent, const string& message_metadata) { // overload
11540 const string _message = message.str();
11541 logger(filename, function_name, _message, FileMESSAGE, oss, type, silent, message_metadata);
11543 }
11544
11545 void logger(const string& filename, const string& function_name, stringstream& message, const string& directory, ostream& oss, const char& type, bool silent, const string& message_metadata) { // overload
11546 const string _message = message.str();
11547 logger(filename, function_name, _message, directory, oss, type, silent, message_metadata);
11549 }
11550
11551 void logger(const string& filename, const string& function_name, stringstream& message, const string& directory, ofstream& FileMESSAGE, ostream& oss, const char& type, bool silent, const string& message_metadata) { // overload
11552 const string _message = message.str();
11553 logger(filename, function_name, _message, directory, FileMESSAGE, oss, type, silent, message_metadata);
11555 }
11556
11557 void logger(const string& filename, const string& function_name, stringstream& message, const _aflags& aflags, ostream& oss, const char& type, bool silent, const string& message_metadata) { // overload
11558 const string _message = message.str();
11559 logger(filename, function_name, _message, aflags, oss, type, silent, message_metadata);
11561 }
11562
11563 void logger(const string& filename, const string& function_name, stringstream& message, const _aflags& aflags, ofstream& FileMESSAGE, ostream& oss, const char& type, bool silent, const string& message_metadata) { // overload
11564 const string _message = message.str();
11565 logger(filename, function_name, _message, aflags, FileMESSAGE, oss, type, silent, message_metadata);
11567 }
11568
11569 void logger(const string& filename, const string& function_name, const string& _message, const char& type, ostream& oss, bool silent, const string& message_metadata) { // overload
11570 ofstream FileMESSAGE;
11571 logger(filename, function_name, _message, FileMESSAGE, oss, type, silent, message_metadata);
11572 }
11573
11574 void logger(const string& filename, const string& function_name, const string& _message, ostream& oss, const char& type, bool silent, const string& message_metadata) { // overload
11575 ofstream FileMESSAGE;
11576 logger(filename, function_name, _message, FileMESSAGE, oss, type, silent, message_metadata);
11577 }
11578
11579 void logger(const string& filename, const string& function_name, const string& _message, ofstream& FileMESSAGE, ostream& oss, const char& type, bool silent, const string& message_metadata) { // overload
11580 _aflags aflags;
11581 if (XHOST.vflag_control.flag("DIRECTORY_CLEAN")) {
11582 aflags.Directory = XHOST.vflag_control.getattachedscheme("DIRECTORY_CLEAN");
11583 } // CO20190402
11584 logger(filename, function_name, _message, aflags, FileMESSAGE, oss, type, silent, message_metadata);
11585 }
11586
11587 void logger(const string& filename, const string& function_name, const string& _message, const string& directory, ostream& oss, const char& type, bool silent, const string& message_metadata) { // overload
11588 ofstream FileMESSAGE;
11589 logger(filename, function_name, _message, directory, FileMESSAGE, oss, type, silent, message_metadata);
11590 }
11591
11592 void logger(const string& filename, const string& function_name, const string& _message, const _aflags& aflags, ostream& oss, const char& type, bool silent, const string& message_metadata) { // overload
11593 ofstream FileMESSAGE;
11594 logger(filename, function_name, _message, aflags, FileMESSAGE, oss, type, silent, message_metadata);
11595 }
11596
11597 void logger(const string& filename, const string& function_name, const string& _message, const string& directory, ofstream& FileMESSAGE, ostream& oss, const char& type, bool silent, const string& message_metadata) { // overload
11598 _aflags aflags;
11599 aflags.Directory = directory;
11600 logger(filename, function_name, _message, aflags, FileMESSAGE, oss, type, silent, message_metadata);
11601 }
11602
11603 void logger(const string& filename, const string& function_name, const string& _message, const _aflags& aflags, ofstream& FileMESSAGE, ostream& oss, const char& type, bool silent, const string& message_metadata) { // main function
11604 // five types: M - Message, W - Warning, E - Error, O - Option, C - Complete, R - RAW
11605 // treat E, W, O, C, and R as special, otherwise treat as a message
11606 // no need for function name for R, you can put ""
11607
11608 const string message = aurostd::RemoveWhiteSpacesFromTheBack(_message);
11609 if (message.empty()) {
11610 return;
11611 }
11612 // CO20181226 - split by newlines and print separately
11613 vector<string> message_parts;
11614 vector<string> _message_parts;
11615 aurostd::string2vectorstring(message, _message_parts);
11616 for (size_t i = 0; i < _message_parts.size(); i++) {
11617 if (!aurostd::RemoveWhiteSpacesFromTheBack(_message_parts[i]).empty()) {
11618 message_parts.push_back(_message_parts[i]);
11619 }
11620 }
11621 if (message_parts.empty()) {
11622 return;
11623 }
11624
11625 string tag_code = "00000";
11626 string tag_message = "MESSAGE";
11627 if (type == _LOGGER_ERROR_) {
11628 tag_code = "EEEEE";
11629 tag_message = "ERROR";
11630 } else if (type == _LOGGER_WARNING_) {
11631 tag_code = "WWWWW";
11632 tag_message = "WARNING";
11633 } else if (type == _LOGGER_COMPLETE_) {
11634 tag_code = "CCCCC";
11635 tag_message = "COMPLETE";
11636 } else if (type == _LOGGER_OPTION_) {
11637 tag_code = "-OPT-";
11638 tag_message = "MESSAGE-OPTION";
11639 } else if (type == _LOGGER_RAW_) {
11640 tag_code = "";
11641 tag_message = "";
11642 } else if (type == _LOGGER_NOTICE_) { // ME20200514
11643 tag_code = "00000";
11644 tag_message = "NOTICE";
11645 }
11646
11647 ostringstream stream;
11648 if (type == _LOGGER_RAW_) {
11649 for (size_t i = 0; i < message_parts.size(); i++) {
11650 stream << message_parts[i] << endl;
11651 } // CO20181226 //message;
11652 } else if (XHOST.vflag_control.flag("WWW")) { // ME20210429 - remove metadata for web output
11653 for (size_t i = 0; i < message_parts.size(); i++) {
11654 stream << tag_code;
11655 stream << " ";
11656 stream << tag_message;
11657 stream << " ";
11658 stream << message_parts[i];
11659 stream << endl;
11660 }
11661 } else {
11662 for (size_t i = 0; i < message_parts.size(); i++) {
11663 stream << XPID; // CO20200524
11664 stream << tag_code;
11665 stream << " ";
11666 stream << tag_message;
11667 stream << " ";
11668 stream << function_name; // CO20230319
11669 stream << " ";
11670 stream << message_parts[i]; // CO20181226 //message;
11671 stream << Message(filename, aflags, message_metadata);
11672 stream << endl;
11673 }
11674 }
11675 // HE+ME20220503
11676 // Be permissive and search for substrings to allow for white/black listing
11677 // of groups of functions or namespaces without implementing regexes
11678 // The white and black lists should be treated like a stack: only push and pop
11679 bool quiet = XHOST.QUIET;
11680 if (XHOST.QUIET) {
11681 quiet = !aurostd::substringlist2bool(function_name, XHOST.LOGGER_WHITELIST, false);
11682 } else {
11683 quiet = aurostd::substringlist2bool(function_name, XHOST.LOGGER_BLACKLIST, false);
11684 }
11685
11686 // CO20220630 - note about osswrite, it is redundant with quiet, so it would be nice to get rid of it in the future
11687 // but it would require a full overhaul of many critical aflow printing functions
11688 // better not to touch and leave the overloads
11689 const bool osswrite = !silent;
11690 if (type == _LOGGER_ERROR_) {
11691 aurostd::PrintErrorStream(FileMESSAGE, stream, quiet, osswrite);
11692 } // oss - DEFAULT TO cerr
11693 else if (type == _LOGGER_WARNING_) {
11694 aurostd::PrintWarningStream(FileMESSAGE, stream, quiet, osswrite);
11695 } // oss - DEFAULT TO cerr
11696 else {
11697 aurostd::PrintMessageStream(FileMESSAGE, stream, quiet, osswrite, oss);
11698 }
11699 }
11700} // namespace pflow
11701
11702// ***************************************************************************
11703// pflow::LTCELL
11704// ***************************************************************************
11705namespace pflow {
11706 xstructure LTCELL(const string& options, istream& input) {
11707 const bool LDEBUG = (false || XHOST.DEBUG);
11708 if (LDEBUG) {
11709 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
11710 }
11711 const xstructure str(input, IOAFLOW_AUTO);
11712 vector<string> tokens;
11713 aurostd::string2tokens(options, tokens, ",");
11714 const xmatrix<double> mlt(3, 3);
11715
11716 if (tokens.size() != 9 && tokens.size() != 3 && tokens.size() != 1 && tokens.size() != 4) {
11718 aurostd::liststring2string("aflow --ltcell=a11,a12,a13,a21,a22,a23,a31,a32,a33 < POSCAR", "aflow --ltcell=a11,a22,a33 < POSCAR", "aflow --ltcell=file < POSCAR",
11719 "aflow --ltcellfv=v1,v2,v3,phi < POSCAR"));
11720 }
11721
11722 if (tokens.size() == 9) {
11723 if (LDEBUG) {
11724 cerr << XPID << "pflow::LTCELL: 9 entries" << endl;
11725 }
11726 mlt(1, 1) = aurostd::string2utype<double>(tokens[0]);
11727 mlt(1, 2) = aurostd::string2utype<double>(tokens[1]);
11728 mlt(1, 3) = aurostd::string2utype<double>(tokens[2]);
11729 mlt(2, 1) = aurostd::string2utype<double>(tokens[3]);
11730 mlt(2, 2) = aurostd::string2utype<double>(tokens[4]);
11731 mlt(2, 3) = aurostd::string2utype<double>(tokens[5]);
11732 mlt(3, 1) = aurostd::string2utype<double>(tokens[6]);
11733 mlt(3, 2) = aurostd::string2utype<double>(tokens[7]);
11734 mlt(3, 3) = aurostd::string2utype<double>(tokens[8]);
11735 if (std::abs(det(mlt)) < 0.01) {
11736 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "singular ltcell matrix", _INPUT_ILLEGAL_); // CO20200624
11737 }
11738 if (LDEBUG) {
11739 cerr << __AFLOW_FUNC__ << " END" << endl;
11740 }
11741 return GetLTCell(mlt, str);
11742 }
11743
11744 if (tokens.size() == 3) {
11745 if (LDEBUG) {
11746 cerr << XPID << "pflow::LTCELL: 3 entries" << endl;
11747 }
11748 mlt(1, 1) = aurostd::string2utype<double>(tokens[0]);
11749 mlt(2, 2) = aurostd::string2utype<double>(tokens[1]);
11750 mlt(3, 3) = aurostd::string2utype<double>(tokens[2]);
11751 if (std::abs(det(mlt)) < 0.01) {
11752 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "singular ltcell matrix", _INPUT_ILLEGAL_); // CO20200624
11753 }
11754 if (LDEBUG) {
11755 cerr << __AFLOW_FUNC__ << " END" << endl;
11756 }
11757 return GetLTCell(mlt, str);
11758 }
11759
11760 if (tokens.size() == 1) {
11761 if (LDEBUG) {
11762 cerr << XPID << "pflow::LTCELL: 1 entries" << endl;
11763 }
11764 ifstream infile(tokens[0].c_str());
11765 aurostd::InFileExistCheck("pflow::LTCELL", tokens[0].c_str(), infile);
11766 for (int i = 1; i <= 3; i++) {
11767 for (int j = 1; j <= 3; j++) {
11768 infile >> mlt(i, j);
11769 }
11770 }
11771 if (std::abs(det(mlt)) < 0.01) {
11772 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "singular ltcell matrix", _INPUT_ILLEGAL_); // CO20200624
11773 }
11774 if (LDEBUG) {
11775 cerr << __AFLOW_FUNC__ << " END" << endl;
11776 }
11777 return GetLTCell(mlt, str);
11778 }
11779
11780 if (tokens.size() == 4) {
11781 if (LDEBUG) {
11782 cerr << XPID << "pflow::LTCELL: 4 entries => LTCELLFV mode" << endl;
11783 }
11784 const xvector<double> nvec(3);
11785 nvec(1) = aurostd::string2utype<double>(tokens[0]);
11786 nvec(2) = aurostd::string2utype<double>(tokens[1]);
11787 nvec(3) = aurostd::string2utype<double>(tokens[2]);
11788 const double angle = aurostd::string2utype<double>(tokens[3]) / rad2deg;
11789 if (LDEBUG) {
11790 cerr << __AFLOW_FUNC__ << " END" << endl;
11791 }
11792 return GetLTFVCell(nvec, angle, str);
11793 }
11794 return str;
11795 }
11796} // namespace pflow
11797
11798// ***************************************************************************
11799// pflow::MagneticParameters
11800// ***************************************************************************
11801namespace pflow {
11802 void MagneticParameters(string _directory, ostream& oss) {
11803 string directory(_directory);
11804 if (directory.empty()) {
11805 directory = "./";
11806 }
11807 directory = aurostd::CleanFileName(directory);
11808
11809 bool found = false;
11810 const vector<string> vtype{".static", ".relax1", ".relax2"};
11811
11812 vector<string> vfiles;
11813 vfiles.clear();
11814 vfiles.push_back(aurostd::CleanFileName(directory + "/OUTCAR"));
11815 for (size_t i = 0; i < vtype.size(); i++) {
11816 for (size_t iext = 0; iext < XHOST.vext.size(); iext++) {
11817 vfiles.push_back(aurostd::CleanFileName(directory + "/OUTCAR" + vtype[i] + XHOST.vext[iext]));
11818 }
11819 }
11820
11821 xOUTCAR outcar;
11822 for (size_t i = 0; i < vfiles.size() && !found; i++) {
11823 if (aurostd::FileExist(vfiles[i])) {
11824 found = true;
11825 outcar.GetPropertiesFile(vfiles[i]);
11826 oss << "pflow::MagneticParameters : using file=" << vfiles[i] << endl;
11827
11828 oss << "MAGNETIC MOMENTUM CELL : " << outcar.mag_cell << endl;
11829 oss << "MAGNETIC MOMENTUM ATOM : " << outcar.mag_atom << endl;
11830 oss << "VOLUME CELL : " << outcar.volume_cell << endl;
11831 oss << "VOLUME ATOM : " << outcar.volume_atom << endl;
11832 if (outcar.vmag.size() > 1) {
11833 oss << "SPIN DECOMPOSITION : " << outcar.vmag[0];
11834 for (size_t i = 1; i < outcar.vmag.size(); i++) {
11835 oss << "," << outcar.vmag[i];
11836 }
11837 oss << endl;
11838 }
11839 }
11840 }
11841
11842 found = false;
11843 vfiles.clear();
11844 for (size_t iext = 0; iext < XHOST.vext.size(); iext++) {
11845 vfiles.push_back(aurostd::CleanFileName(directory + "/DOSCAR.static" + XHOST.vext[iext]));
11846 }
11847 vfiles.push_back(aurostd::CleanFileName(directory + "/DOSCAR"));
11848
11849 xDOSCAR doscar;
11850 for (size_t i = 0; i < vfiles.size() && !found; i++) {
11851 if (aurostd::FileExist(vfiles[i])) {
11852 found = true;
11853 doscar.GetPropertiesFile(vfiles[i]);
11854 oss << "pflow::MagneticParameters : using file=" << vfiles[i] << endl;
11855 oss << "POLARIZATION FERMI : " << doscar.spinF << endl;
11856 }
11857 }
11858 }
11859} // namespace pflow
11860
11861// ***************************************************************************
11862// pflow::MAKESTRLIST
11863// ***************************************************************************
11864namespace pflow {
11865 void MAKESTRLIST(vector<string> argv) {
11866 ifstream outcar_inf(argv.at(2).c_str());
11867 aurostd::InFileExistCheck("convasp", argv.at(2).c_str(), outcar_inf);
11868 ifstream xdatcar_inf(argv.at(3).c_str());
11869 aurostd::InFileExistCheck("convasp", argv.at(3).c_str(), xdatcar_inf);
11870 const vector<xstructure> str_vec = pflow::GetStrVecFromOUTCAR_XDATCAR(outcar_inf, xdatcar_inf);
11871 pflow::PrintStrVec(str_vec, cout);
11872 }
11873} // namespace pflow
11874
11875// ***************************************************************************
11876// pflow::MINKOWSKIBASISREDUCTION
11877// ***************************************************************************
11878namespace pflow {
11879 xstructure MINKOWSKIBASISREDUCTION(istream& input) {
11880 const xstructure a(input, IOAFLOW_AUTO);
11881 xstructure b(a);
11882 b.MinkowskiBasisReduction();
11883 // b.BringInCell(); // not necessary
11884 return b;
11885 }
11886} // namespace pflow
11887
11888// ***************************************************************************
11889// pflow::MISCIBILITY
11890// ***************************************************************************
11891namespace pflow {
11892 string MISCIBILITY(vector<string> argv) {
11893 stringstream output;
11894 for (size_t i = 2; i < argv.size(); i++) {
11895 string system = string(argv[i]);
11896 XATOM_AlphabetizationSpecies(system);
11897 // XATOM_AlphabetizationCompound(system);
11898 const int mix = MiscibilityCheck(system);
11899 if (mix == MISCIBILITY_SYSTEM_NOMIX) {
11900 output << system << " " << "MISCIBILITY_SYSTEM_NOMIX" << endl;
11901 }
11902 if (mix == MISCIBILITY_SYSTEM_MISCIBLE) {
11903 output << system << " " << "MISCIBILITY_SYSTEM_MISCIBLE" << endl;
11904 }
11905 if (mix == MISCIBILITY_SYSTEM_UNKNOWN) {
11906 output << system << " " << "MISCIBILITY_SYSTEM_UNKNOWN" << endl;
11907 }
11908 }
11909 return output.str();
11910 };
11911} // namespace pflow
11912
11913// ***************************************************************************
11914// pflow::MOM
11915// ***************************************************************************
11916namespace pflow {
11917 void MOM(istream& input) {
11918 const xstructure str(input, IOAFLOW_AUTO);
11919 xvector<double> m(3);
11920 m = GetMom1(str);
11921 cout.setf(std::ios::left, std::ios::adjustfield);
11922 cout.setf(std::ios::fixed, std::ios::floatfield);
11923 cout << " Moment 1 : " << setw(15) << setprecision(10) << m(1) << setw(15) << setprecision(10) << m(2) << setw(15) << setprecision(10) << m(3) << endl;
11924 m = m / str.scale;
11925 cout << " (unscaled) " << setw(15) << setprecision(10) << m(1) << setw(15) << setprecision(10) << m(2) << setw(15) << setprecision(10) << m(3) << endl;
11926 }
11927} // namespace pflow
11928
11929// ***************************************************************************
11930// pflow::MSI
11931// ***************************************************************************
11932namespace pflow {
11933 void MSI(istream& input) {
11934 const xstructure str(input, IOAFLOW_AUTO);
11935 PrintMSI(str, cout);
11936 }
11937} // namespace pflow
11938
11939// ***************************************************************************
11940// pflow::NATOMS
11941// ***************************************************************************
11942namespace pflow {
11943 uint NATOMS(istream& input) {
11944 const xstructure a(input, IOAFLOW_AUTO);
11945 return a.atoms.size();
11946 }
11947} // namespace pflow
11948
11949// ***************************************************************************
11950// pflow::NBONDXX
11951// ***************************************************************************
11952namespace pflow {
11953 // CO20171025
11954 string NBONDXX(istream& input, bool aflowlib_legacy_format) {
11955 const xstructure a(input, IOAFLOW_AUTO);
11956 return NBONDXX(a, aflowlib_legacy_format);
11957 }
11958
11959 string NBONDXX(const xstructure& a, bool aflowlib_legacy_format) {
11960 vector<double> nbondxx = GetNBONDXX(a);
11961
11962 // return aurostd::joinWDelimiter(aurostd::vecDouble2vecString(nbondxx,9),',');
11963 // print nicely
11964
11965 // are there names in the atoms?
11966 bool atom_names = true;
11967 for (size_t i = 0; i < a.atoms.size() && atom_names; i++) {
11968 if (a.atoms[i].name.empty()) {
11969 atom_names = false;
11970 }
11971 }
11972
11973 // get names
11974 uint iat = 0;
11975 vector<int> first_itypes;
11976 first_itypes.push_back(0);
11977 bool found;
11978 for (size_t i = 1; i < a.atoms.size(); i++) {
11979 found = false;
11980 for (size_t j = 0; j < first_itypes.size() && !found; j++) {
11981 if (a.atoms[i].type == a.atoms[first_itypes[j]].type) {
11982 found = true;
11983 }
11984 }
11985 if (!found) {
11986 first_itypes.push_back(i);
11987 }
11988 }
11989
11990 if (aflowlib_legacy_format) {
11991 atom_names = false;
11992 }
11993
11994 vector<string> names;
11995 stringstream ss;
11996 if (atom_names) {
11997 for (size_t i = 0; i < first_itypes.size(); i++) {
11998 names.push_back(a.atoms[first_itypes[i]].name);
11999 }
12000 } else {
12001 for (size_t i = 0; i < first_itypes.size(); i++) {
12002 ss.str("");
12003 ss << char('A' + iat++);
12004 names.push_back(ss.str());
12005 }
12006 }
12007
12008 iat = 0;
12009 stringstream output;
12010 output.str("");
12011 if (aflowlib_legacy_format) {
12012 for (size_t itype = 0; itype < first_itypes.size(); itype++) {
12013 for (size_t jtype = itype; jtype < first_itypes.size(); jtype++) {
12014 output << aurostd::PaddedPOST("BOND_" + names[itype] + names[jtype], 11) << " " << aurostd::utype2string(nbondxx[iat++], 6, FIXED_STREAM) << " [Angst]" << endl; // CO20220627
12015 }
12016 }
12017 } else {
12018 for (size_t itype = 0; itype < first_itypes.size(); itype++) {
12019 for (size_t jtype = itype; jtype < first_itypes.size(); jtype++) {
12020 output << aurostd::PaddedPOST(names[itype] + "-" + names[jtype] + ":", 8) << " " << aurostd::utype2string(nbondxx[iat++], 6, FIXED_STREAM) << " [Angst]" << endl; // CO20220627
12021 }
12022 }
12023 }
12024
12025 return output.str();
12026 }
12027} // namespace pflow
12028
12029// ***************************************************************************
12030// pflow::NNDIST
12031// ***************************************************************************
12032namespace pflow {
12033 double NNDIST(istream& input) {
12034 const xstructure a(input, IOAFLOW_AUTO);
12035 return (NearestNeighbor(a));
12036 }
12037} // namespace pflow
12038
12039// ***************************************************************************
12040// pflow::NSPECIES
12041// ***************************************************************************
12042namespace pflow {
12043 uint NSPECIES(istream& input) {
12044 const xstructure a(input, IOAFLOW_AUTO);
12045 return a.num_each_type.size();
12046 }
12047} // namespace pflow
12048
12049// ***************************************************************************
12050// pflow::NAMES
12051// ***************************************************************************
12052namespace pflow {
12053 xstructure NAMES(vector<string> argv, istream& input) {
12054 xstructure a(input, IOAFLOW_AUTO);
12055 if (argv.size() != a.num_each_type.size() + 2) {
12056 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "you need to specify as many names as atom types", _INPUT_ILLEGAL_); // CO20200624
12057 }
12058 xstructure b = a;
12059 int iatom = 0;
12060 for (size_t itype = 0; itype < a.num_each_type.size(); itype++) {
12061 const string species = string(argv.at(2 + b.atoms.at(iatom).type));
12062 b.species.at(itype) = species;
12063 for (int j = 0; j < a.num_each_type[itype]; j++) {
12064 b.atoms.at(iatom).name = species; // CONVASP_MODE
12065 b.atoms.at(iatom).CleanName();
12066 b.atoms.at(iatom).CleanSpin();
12067 b.atoms.at(iatom).name_is_given = true;
12068 iatom++;
12069 }
12070 }
12071 return b;
12072 }
12073} // namespace pflow
12074
12075// ***************************************************************************
12076// pflow::NANOPARTICLE
12077// ***************************************************************************
12078namespace pflow {
12079 xstructure NANOPARTICLE(istream& input, const xvector<double>& iparams) {
12080 const bool LDEBUG = (false || XHOST.DEBUG); // CO20180226
12081 // cout << aflow::Banner("BANNER_TINY") << endl;
12082 double radius = NANOPARTICLE_RADIUS_DEFAULT;
12083 double distance = NANOPARTICLE_DISTANCE_DEFAULT;
12084 if (iparams.rows >= 1) {
12085 radius = iparams[1];
12086 }
12087 if (iparams.rows >= 2) {
12088 distance = iparams[2];
12089 }
12090 if (LDEBUG) { // CO20180226
12091 cerr << __AFLOW_FUNC__ << " radius=" << radius << endl;
12092 cerr << __AFLOW_FUNC__ << " distance=" << distance << endl;
12093 }
12094 xstructure a(input, IOAFLOW_AUTO);
12095 xstructure b;
12096 xvector<int> dims(3);
12097 xvector<double> fshift(3);
12098 xvector<double> cshift(3);
12099 xvector<double> ucell(3);
12100 a.ReScale(1.0);
12101
12102 b = a; // COPY
12103 while (!b.atoms.empty()) {
12104 b.RemoveAtom(0);
12105 } // EMPTY
12106 dims = LatticeDimensionSphere(a.lattice, 2 * radius + distance);
12107 if (LDEBUG) {
12108 cerr << __AFLOW_FUNC__ << " dims=" << dims << endl;
12109 } // CO20180226
12110 for (int i = 1; i <= 3; i++) {
12111 ucell(i) = ceil((2.0 * radius + distance) / modulus(b.lattice(i)));
12112 if (LDEBUG) {
12113 cerr << __AFLOW_FUNC__ << " ucell(i=" << i << ")=" << ucell(i) << endl;
12114 } // CO20180226
12115 for (int j = 1; j <= 3; j++) {
12116 b.lattice(i, j) = b.lattice(i, j) * ucell(i);
12117 }
12118 }
12119 b.FixLattices();
12120 for (size_t iat = 0; iat < a.atoms.size(); iat++) { // SHIFT
12121 for (int i = -dims(1); i <= dims(1); i++) {
12122 for (int j = -dims(2); j <= dims(2); j++) {
12123 for (int k = -dims(3); k <= dims(3); k++) {
12124 _atom atom = a.atoms[iat];
12125 atom.cpos = ((double) i) * a.lattice(1) + ((double) j) * a.lattice(2) + ((double) k) * a.lattice(3) + a.atoms[iat].cpos;
12126 atom.fpos = C2F(b.lattice, atom.cpos); // put in fractional of new basis
12127 if (modulus(atom.cpos) <= radius) {
12128 b.AddAtom(atom, false); // CO20230319 - add by species
12129 }
12130 }
12131 }
12132 }
12133 }
12134 cerr << "atoms=" << b.atoms.size() << endl;
12135 // b.SetCoordinates(_COORDS_FRACTIONAL_);
12136 b.SetCoordinates(_COORDS_CARTESIAN_);
12137 return b;
12138 }
12139} // namespace pflow
12140
12141// ***************************************************************************
12142// pflow::NDATA
12143// ***************************************************************************
12144namespace pflow {
12145 void NDATA(istream& input) {
12146 const xstructure a(input, IOAFLOW_AUTO);
12147 PrintNdata(a, cout);
12148 }
12149} // namespace pflow
12150
12151// ***************************************************************************
12152// pflow::NIGGLI
12153// ***************************************************************************
12154namespace pflow {
12155 xstructure NIGGLI(istream& input) {
12156 const xstructure a(input, IOAFLOW_AUTO);
12157 return GetNiggliStr(a);
12158 }
12159} // namespace pflow
12160
12161// ***************************************************************************
12162// pflow::NOORDERPARAMETER
12163// ***************************************************************************
12164namespace pflow {
12165 xstructure NOORDERPARAMETER(istream& input) {
12166 xstructure a(input, IOAFLOW_AUTO);
12167 a.order_parameter_structure = false;
12168 a.order_parameter_atoms.clear();
12169 for (size_t i = 0; i < a.atoms.size(); i++) {
12170 a.atoms[i].order_parameter_atom = false;
12171 a.atoms[i].order_parameter_value = 0;
12172 }
12173 return a;
12174 }
12175} // namespace pflow
12176
12177// ***************************************************************************
12178// pflow::NOSD
12179// ***************************************************************************
12180namespace pflow {
12181 xstructure NOSD(istream& input) {
12182 const xstructure a(input, IOAFLOW_AUTO);
12183 xstructure b = a;
12184 // Read in input file.
12185 b.isd = false;
12186 return b;
12187 }
12188} // namespace pflow
12189
12190// ***************************************************************************
12191// pflow::NUMNAMES
12192// ***************************************************************************
12193namespace pflow {
12194 xstructure NUMNAMES(vector<string> argv, istream& input) {
12195 xstructure a(input, IOAFLOW_AUTO);
12196 if (argv.size() != a.num_each_type.size() + 2) {
12197 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "you need to specify as many names as atom types", _INPUT_ILLEGAL_); // CO20200624
12198 }
12199 xstructure b = a;
12200 int iatom = 0;
12201 for (size_t itype = 0; itype < a.num_each_type.size(); itype++) {
12202 const string species = string(argv.at(2 + b.atoms.at(iatom).type));
12203 b.species.at(itype) = species;
12204 for (int j = 0; j < a.num_each_type[itype]; j++) {
12205 ostringstream aus;
12206 aus << species << j + 1; // CONVASP_MODE
12207 b.atoms.at(iatom).name = aus.str();
12208 b.atoms.at(iatom).CleanName();
12209 b.atoms.at(iatom).CleanSpin();
12210 b.atoms.at(iatom).name_is_given = true;
12211 iatom++;
12212 }
12213 }
12214 return b;
12215 }
12216} // namespace pflow
12217
12218// ***************************************************************************
12219// pflow::PDB
12220// ***************************************************************************
12221namespace pflow {
12222 void PDB(istream& input) {
12223 const xstructure a(input, IOAFLOW_AUTO);
12224 PrintPDB(a, cout);
12225 }
12226} // namespace pflow
12227
12228// ***************************************************************************
12229// pflow::PDOS
12230// ***************************************************************************
12231namespace pflow {
12232 void PDOS(vector<string> argv) {
12233 cerr << "# WARNING: THIS REQUIRES AN ALTERED VERSION OF VASP - SEE aflow --help" << endl;
12234 const int only_occ = 0; // Use unoccupied states in PDOS.
12235 pflow::projdata prd;
12236 pflow::pdosdata pdd;
12237 prd.PROOUTinfile = argv.at(3);
12238 pdd.PDOSinfile = argv.at(2);
12239 pflow::ReadInProj(prd);
12240 pflow::CalcNeatProj(prd, only_occ);
12241 pflow::ReadInPDOSData(prd, pdd);
12242 pflow::CalcPDOS(prd, pdd);
12243 pdd.PrintPDOS(cout, prd.sp);
12244 if (pdd.print_params) {
12245 pdd.PrintParams(cout, prd.LLMnames);
12246 }
12247 }
12248} // namespace pflow
12249
12250// ***************************************************************************
12251// pflow::PEARSON_SYMBOL
12252// ***************************************************************************
12253// DX20210610 - updated function: added overload and added options
12254namespace pflow {
12255 string PEARSON_SYMBOL(istream& input) { // DX20210611 - overloaded
12256 const aurostd::xoption vpflow;
12257 return PEARSON_SYMBOL(input, vpflow);
12258 }
12259} // namespace pflow
12260namespace pflow {
12261 string PEARSON_SYMBOL(istream& input, const aurostd::xoption& vpflow) { // DX20210611 - added xoption
12262 const bool LDEBUG = (false || XHOST.DEBUG);
12263 if (LDEBUG) {
12264 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
12265 }
12266
12267 // ---------------------------------------------------------------------------
12268 // usage
12269 if (vpflow.flag("PEARSON_SYMBOL::USAGE")) {
12270 const string usage = "aflow --pearson_symbol|--pearson|--Pearson_symbol|--Pearson[=<tolerance_value>|=tight|=loose]";
12271 const string options = "options: [--no_scan] [--tolerance_spectrum=<start>,<stop>,<nsteps>]";
12272 vector<string> voptions;
12273 aurostd::string2tokens(options, voptions, " ");
12274 voptions.insert(voptions.begin(), usage);
12275 init::MessageOption("--usage", "pflow::PEARSON_SYMBOL()", voptions);
12276 return "";
12277 }
12278
12279 stringstream sss;
12280
12281 // ---------------------------------------------------------------------------
12282 // load structure
12283 xstructure a(input, IOAFLOW_AUTO);
12284 if (LDEBUG) {
12285 cerr << __AFLOW_FUNC__ << " X1" << endl;
12286 }
12287
12288 // ---------------------------------------------------------------------------
12289 // get tolerance
12290 const double tolerance = pflow::getSymmetryTolerance(a, vpflow.getattachedscheme("PEARSON_SYMBOL::TOLERANCE"));
12291
12292 // ---------------------------------------------------------------------------
12293 // self-consistent tolerance scan
12294 if (vpflow.flag("PEARSON_SYMBOL::NO_SCAN")) {
12295 a.sym_eps_no_scan = true;
12296 } // DX20210406
12297
12298 // ---------------------------------------------------------------------------
12299 // tolerance spectrum
12300 bool tolerance_spectrum_analysis = false;
12301 vector<double> tolerance_spectrum;
12302 if (vpflow.flag("PEARSON_SYMBOL::TOLERANCE_SPECTRUM")) {
12303 tolerance_spectrum_analysis = true;
12304 tolerance_spectrum = pflow::getSymmetryToleranceSpectrum(vpflow.getattachedscheme("PEARSON_SYMBOL::TOLERANCE_SPECTRUM"));
12305 } else if (vpflow.flag("PEARSON_SYMBOL::TOLERANCE") && vpflow.flag("PEARSON_SYMBOL::TOLERANCE_SPECTRUM")) {
12306 sss << __AFLOW_FUNC__ << " ERROR: Cannot specify a single tolerance value and perform the tolerance spectrum at the same time. Please choose one or the other.";
12308 }
12309
12310 // ---------------------------------------------------------------------------
12311 // get magnetic moment information
12312 if (vpflow.flag("PEARSON_SYMBOL::MAGNETIC")) {
12313 const string magmom_info = vpflow.getattachedscheme("PEARSON_SYMBOL::MAGNETIC");
12314 ProcessAndAddSpinToXstructure(a, magmom_info);
12315 }
12316
12317 if (!tolerance_spectrum_analysis) {
12318 a.GetRealLatticeType(tolerance); // DX20210611 - more concise method for calling
12319 if (LDEBUG) {
12320 cerr << __AFLOW_FUNC__ << " X2" << endl;
12321 cerr << " Real space lattice primitive = " << a.bravais_lattice_type << endl;
12322 cerr << " Real space lattice variation = " << a.bravais_lattice_variation_type << endl;
12323 cerr << " Real space Pearson symbol = " << a.pearson_symbol << endl;
12324 }
12325 sss << a.pearson_symbol << endl;
12326 } else {
12327 // determine Pearson symbol through a range of tolerances
12328 const xstructure a_orig = a; // store clean xstructure (no symmetry), but keeps options from command line
12329 const uint ntolerances = tolerance_spectrum.size();
12330 for (uint i = 0; i < ntolerances; i++) {
12331 a = a_orig;
12332 a.GetRealLatticeType(tolerance_spectrum[i]);
12333 sss << "tol=" << tolerance_spectrum[i] << ": " << a.pearson_symbol << endl;
12334 }
12335 }
12336 return sss.str();
12337 }
12338} // namespace pflow
12339
12340// ***************************************************************************
12341// pflow::PLANEDENS
12342// ***************************************************************************
12343namespace pflow {
12344 void PLANEDENS(vector<string> argv) {
12345 // Read in charge
12346 xstructure str;
12347 ifstream chgfile(argv.at(3).c_str());
12348 vector<int> ngrid(3);
12349 vector<double> chg_tot;
12350 vector<double> chg_diff;
12351 pflow::ReadChg(str, ngrid, chg_tot, chg_diff, chgfile);
12352 // Read in planar density parameters.
12353 pflow::pd_params pdp;
12354 ifstream pdfile(argv.at(2).c_str());
12355 pflow::ReadPlaneDensParams(str, pdp, pdfile);
12356 // Get planar charge density
12357 vector<double> dens2d_tot;
12358 vector<double> dens2d_diff;
12359 pflow::GetPlaneDens(pdp, dens2d_tot, dens2d_diff, str, ngrid, chg_tot, chg_diff);
12360 pflow::PrintPlaneDens(pdp, dens2d_tot, dens2d_diff, str);
12361 }
12362} // namespace pflow
12363
12364// ***************************************************************************
12365// pflow::PLATON
12366// ***************************************************************************
12367namespace pflow {
12368 string PLATON(const string& options, istream& input) {
12369 const bool LDEBUG = (false || XHOST.DEBUG);
12370 if (LDEBUG) {
12371 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
12372 }
12373 vector<string> tokens;
12374 aurostd::string2tokens(options, tokens, ",");
12375 if (tokens.size() == 1) {
12376 if (tokens[0] == "usage" || tokens[0] == "USAGE") {
12378 aurostd::liststring2string("aflow --platonSG[_label,_number][=EQUAL| EXACT][,ang,d1,d2,d3] < POSCAR default:" + string("EQUAL=") + aurostd::utype2string<int>(DEFAULT_PLATON_P_EQUAL) +
12381 return ""; // CO20200624 - the option was expressed successfully
12382 }
12383 }
12384 // move on
12385
12386 if (LDEBUG) {
12387 cerr << XPID << "pflow::PLATON: tokens.size()=" << tokens.size() << endl;
12388 }
12389
12390 xstructure a(input, IOAFLOW_AUTO);
12391 bool Platon_EQUAL = DEFAULT_PLATON_P_EQUAL;
12392 bool Platon_EXACT = DEFAULT_PLATON_P_EXACT;
12393 double Platon_ang = DEFAULT_PLATON_P_ANG;
12394 double Platon_d1 = DEFAULT_PLATON_P_D1;
12395 double Platon_d2 = DEFAULT_PLATON_P_D2;
12396 double Platon_d3 = DEFAULT_PLATON_P_D3;
12397 // if(argv.size()==2) Platon_ang=1.0e-2;
12398 // if(argv.size()==3) Platon_ang=atof(tokens.at(0));
12399 // Read in input file.
12400 if ((!tokens.empty() && tokens[0] == "EQUAL") || (tokens.size() >= 2 && tokens[1] == "EQUAL")) {
12401 Platon_EQUAL = true;
12402 }
12403 if ((!tokens.empty() && tokens[0] == "EXACT") || (tokens.size() >= 2 && tokens[1] == "EXACT")) {
12404 Platon_EXACT = true;
12405 }
12406 if (tokens.size() >= 3) {
12407 Platon_ang = aurostd::string2utype<double>(tokens.at(tokens.size() - 4));
12408 Platon_d1 = aurostd::string2utype<double>(tokens.at(tokens.size() - 3));
12409 Platon_d2 = aurostd::string2utype<double>(tokens.at(tokens.size() - 2));
12410 Platon_d3 = aurostd::string2utype<double>(tokens.at(tokens.size() - 1));
12411 }
12412 a.DecorateWithElements(); // DX20200727 - FakeNames() -> DecorateWithElements();
12413 return a.platon2print(Platon_EQUAL, Platon_EXACT, Platon_ang, Platon_d1, Platon_d2, Platon_d3);
12414 // aflow --platon [EQUAL] [EXACT] [ang d1 d2 d3]
12415 // CALC ADDSYM (EQUAL) (EXACT) (ang d1 d2 d3)
12416 // EQUAL - Search with all atom type treated as equivalent.
12417 // EXACT - All atoms should fit for given criteria.
12418 // ang - Angle criterium in search for metrical symmetry of the
12419 // lattice (default 1.0 degree).
12420 // d1 - Distance criterium for coinciding atoms for non-inversion
12421 // (pseudo)symmetry elements (default 0.25 Angstrom).
12422 // d2 - Distance criterium for coinciding atoms for (pseudo)
12423 // inversion symmetry (default 0.45, 0.25 Angstrom).
12424 // d3 - Distance criterium for coinciding atoms for (pseudo)
12425 // translation symmetry (default 0.45, 0.25 Angstrom).
12426 // SEE: http://www.cryst.chem.uu.nl/platon/pl000401.html
12427 }
12428} // namespace pflow
12429
12430// ***************************************************************************
12431// pflow::POCC
12432// ***************************************************************************
12433namespace pflow {
12434 void POCC(vector<string> argv) {
12435 cerr << "# WARNING: THIS REQUIRES AN ALTERED VERSION OF VASP - SEE aflow --help" << endl;
12436 const int only_occ = 1; // Use occupied states only in projections.
12437 pflow::projdata proj_dat;
12438 proj_dat.PROOUTinfile = argv.at(2);
12439 pflow::ReadInProj(proj_dat);
12440 pflow::CalcNeatProj(proj_dat, only_occ);
12441 PrintNeatProj(proj_dat, cout);
12442 }
12443} // namespace pflow
12444
12445// ***************************************************************************
12446// pflow::RENDER //HE20250324
12447// ***************************************************************************
12448namespace pflow {
12452 void RENDER(istream& input, const fs::path& output) {
12453 const xstructure xstr(input, IOAFLOW_AUTO);
12454 const fs::path save_path = output / "structure.html";
12455 aurostd::x3DWriter w = xstr.render();
12456 const std::string html = w.toHTML();
12457 aurostd::string2file(html, save_path);
12458 for (int axis_idx = 0; axis_idx < 3; axis_idx++) {
12459 w.tachyon_lattice_views_idx = axis_idx;
12460 aurostd::string2file(w.toTachyon(), output / ("structure_view_" + std::to_string(axis_idx + 1) + ".dat"));
12461 }
12462 }
12463} // namespace pflow
12464
12465// ***************************************************************************
12466// pflow::POSCAR
12467// ***************************************************************************
12468namespace pflow {
12469 xstructure POSCAR(istream& input) {
12470 xstructure str(input, IOAFLOW_AUTO);
12471 str.iomode = IOVASP_POSCAR;
12472 return str;
12473 }
12474} // namespace pflow
12475
12476// ***************************************************************************
12477// pflow::POSCAR2WYCKOFF
12478// ***************************************************************************
12479namespace pflow {
12480 void POSCAR2WYCKOFF(istream& input) {
12481 // Call findsym to output the wyckoff position from POSCAR
12482 // Note that findsym must be installed properly
12483 const string findsym_in = aurostd::TmpFileCreate("findsym.in");
12484
12485 stringstream oss;
12486 xstructure str(input, IOAFLOW_AUTO);
12487 oss << str.findsym2print();
12488 aurostd::stringstream2file(oss, findsym_in);
12489 vector<string> stroutput;
12490 FINDSYM::Write("data_space.txt", "./");
12491 FINDSYM::Write("data_wyckoff.txt", "./");
12492 aurostd::string2vectorstring(aurostd::execute2string(XHOST.command("findsym") + " < " + findsym_in), stroutput);
12493 FROZSL::Delete("data_space.txt", "./");
12494 FROZSL::Delete("data_wyckoff.txt", "./");
12495
12496 bool flag = false;
12497 for (size_t i = 0; i < stroutput.size(); i++) {
12498 if (aurostd::substring2bool(stroutput[i], "----")) {
12499 flag = !flag;
12500 }
12501 if (flag) {
12502 if (!aurostd::substring2bool(stroutput[i], "----")) {
12503 cout << stroutput[i] << endl;
12504 }
12505 }
12506 }
12507 aurostd::RemoveFile("findsym.log " + findsym_in);
12508 }
12509} // namespace pflow
12510
12511// ***************************************************************************
12512// pflow::PGROUP
12513// ***************************************************************************
12514namespace pflow {
12515 void PGROUP(_aflags& aflags, istream& input) {
12516 cout << aflow::Banner("BANNER_TINY") << endl;
12517 aflags.QUIET = true;
12518 xstructure a(input, IOAFLOW_AUTO);
12519 const bool WRITE = true;
12520 ofstream File("/dev/null");
12521 _kflags kflags; // DX20170815 - Add in consistency checks
12522 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true; // DX20170815 - Add in consistency checks
12523 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = false; // DX20170815 - Add in consistency checks
12524 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = false; // DX20170815 - Add in consistency checks
12525 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = false; // DX20170815 - Add in consistency checks
12526 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = false; // DX20170815 - Add in consistency checks //DX20171205 - Added pgroupk_xtal
12527 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = false; // DX20170815 - Add in consistency checks
12528 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = false; // DX20170815 - Add in consistency checks
12529 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = false; // DX20170815 - Add in consistency checks
12530 pflow::PerformFullSymmetry(a, File, aflags, kflags, WRITE, cout); // DX20170815 - Add in consistency checks
12531 // DX20170815 - Add in consistency checks - SYM::CalculatePointGroup(File,a,aflags,WRITE,true,cout);
12532 }
12533} // namespace pflow
12534
12535// ***************************************************************************
12536// pflow::PGROUPK
12537// ***************************************************************************
12538namespace pflow {
12539 void PGROUPK(_aflags& aflags, istream& input) {
12540 cout << aflow::Banner("BANNER_TINY") << endl;
12541 aflags.QUIET = true;
12542 xstructure a(input, IOAFLOW_AUTO);
12543 const bool WRITE = true;
12544 ofstream File("/dev/null");
12545 // DX20170815 SYM::CalculatePointGroupKLattice(File,a,aflags,WRITE,true,cout);
12546 _kflags kflags; // DX20170815 - Add in consistency checks
12547 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true; // DX20170815 - Add in consistency checks
12548 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = true; // DX20170815 - Add in consistency checks
12549 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = false; // DX20170815 - Add in consistency checks
12550 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = false; // DX20170815 - Add in consistency checks
12551 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = false; // DX20170815 - Add in consistency checks //DX20171205 - Added pgroupk_xtal
12552 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = false; // DX20170815 - Add in consistency checks
12553 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = false; // DX20170815 - Add in consistency checks
12554 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = false; // DX20170815 - Add in consistency checks
12555 pflow::PerformFullSymmetry(a, File, aflags, kflags, WRITE, cout); // DX20170815 - Add in consistency checks
12556 }
12557} // namespace pflow
12558
12559// ***************************************************************************
12560// pflow::PGROUPXTAL
12561// ***************************************************************************
12562namespace pflow {
12563 void PGROUPXTAL(_aflags& aflags, istream& input) {
12564 // cout << aflow::Banner("BANNER_TINY") << endl;
12565 aflags.QUIET = true;
12566 xstructure a(input, IOAFLOW_AUTO);
12567 const bool WRITE = true;
12568 ofstream File("/dev/null");
12569 // DX20170815 - Add in consistency checks bool verbose=true;
12570 // DX20170815 - Add in consistency checks SYM::CalculatePointGroup(File,a,aflags,WRITE,verbose,cout);
12571 // DX SYM::CalculateFactorGroup(File,a,aflags,WRITE,verbose,cout);
12572 // SYM::CalculateSpaceGroup(File,a,aflags,false,verbose,cout);
12573 // SYM::CalculateInequivalentAtoms(File,a,aflags,WRITE,verbose,cout);
12574 // SYM::CalculateSitePointGroup(File,a,aflags,WRITE,true,cout);
12575 // DX20170815 - Add in consistency checks SYM::CalculatePointGroupCrystal(File,a,aflags,WRITE,verbose,cout);
12576 _kflags kflags; // DX20170815 - Add in consistency checks
12577 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP = true; // DX20170815 - Add in consistency checks
12578 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK = false; // DX20170815 - Add in consistency checks
12579 kflags.KBIN_SYMMETRY_CALCULATE_FGROUP = true; // DX20170815 - Add in consistency checks
12580 kflags.KBIN_SYMMETRY_CALCULATE_PGROUP_XTAL = true; // DX20170815 - Add in consistency checks
12581 kflags.KBIN_SYMMETRY_CALCULATE_PGROUPK_XTAL = false; // DX20170815 - Add in consistency checks //DX20171205 - Added pgroupk_xtal
12582 kflags.KBIN_SYMMETRY_CALCULATE_SGROUP = false; // DX20170815 - Add in consistency checks
12583 kflags.KBIN_SYMMETRY_CALCULATE_IATOMS = false; // DX20170815 - Add in consistency checks
12584 kflags.KBIN_SYMMETRY_CALCULATE_AGROUP = false; // DX20170815 - Add in consistency checks
12585 pflow::PerformFullSymmetry(a, File, aflags, kflags, WRITE, cout); // DX20170815 - Add in consistency checks
12586 }
12587} // namespace pflow
12588
12589// ***************************************************************************
12590// pflow::PRIM
12591// ***************************************************************************
12592namespace pflow {
12593 xstructure PRIM(istream& input, uint mode) {
12594 const xstructure a(input, IOAFLOW_AUTO);
12595 if (mode == 0) {
12596 return GetPrimitive(a); // DX20210406
12597 }
12598 if (mode == 1) {
12599 return GetPrimitive1(a);
12600 }
12601 if (mode == 2) {
12602 return GetPrimitive2(a);
12603 }
12604 if (mode == 3) {
12605 return GetPrimitive3(a);
12606 }
12607 return a;
12608 }
12609} // namespace pflow
12610
12611// ***************************************************************************
12612bool RequestedAlphabeticLabeling(string& label) {
12613 if (aurostd::substring2bool(label, ".alphabetic")) {
12614 aurostd::StringSubstInPlace(label, ".alphabetic", "");
12615 return true;
12616 }
12617 if (aurostd::substring2bool(label, ".alpha")) {
12618 aurostd::StringSubstInPlace(label, ".alpha", "");
12619 return true;
12620 }
12621 return false;
12622}
12623
12624bool AlphabetizePrototypeLabelSpecies(deque<string>& species, deque<string>& species_pp, deque<double>& vvolume, deque<double>& vmass, string& label) {
12625 const bool LDEBUG = (false || XHOST.DEBUG);
12626 // DEBUG=true;
12627 const uint nspeciesHTQC = species.size();
12628 if (LDEBUG) {
12629 cerr << __AFLOW_FUNC__ << " species.size()=" << species.size() << endl;
12630 }
12631 if (LDEBUG) {
12632 cerr << __AFLOW_FUNC__ << " species_pp.size()=" << species_pp.size() << endl;
12633 }
12634 if (LDEBUG) {
12635 cerr << __AFLOW_FUNC__ << " vvolume.size()=" << vvolume.size() << endl;
12636 }
12637 if (LDEBUG) {
12638 cerr << __AFLOW_FUNC__ << " vmass.size()=" << vmass.size() << endl;
12639 }
12640 if (LDEBUG) {
12641 cerr << __AFLOW_FUNC__ << " nspeciesHTQC=" << nspeciesHTQC << endl;
12642 }
12643 // if(LDEBUG) cerr << __AFLOW_FUNC__ << " alphabetic=" << alphabetic << endl;
12644 if (LDEBUG) {
12645 cerr << __AFLOW_FUNC__ << " label=" << label << endl;
12646 }
12647 aurostd::StringSubstInPlace(label, ".alphabetic", "");
12648 aurostd::StringSubstInPlace(label, ".alpha", "");
12649 deque<string> rnd_species;
12650 deque<string> rnd_species_pp;
12651 deque<string> rnd_label1;
12652 deque<string> rnd_label2;
12653 deque<double> rnd_vvolume;
12654 deque<double> rnd_vmass;
12655 if (nspeciesHTQC != species.size()) {
12656 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "nspeciesHTQC!=species.size", _INPUT_ILLEGAL_);
12657 } // CO20200624
12658 if (nspeciesHTQC != species_pp.size()) {
12659 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "nspeciesHTQC!=species_pp.size", _INPUT_ILLEGAL_);
12660 } // CO20200624
12661 if (nspeciesHTQC != vvolume.size()) {
12662 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "nspeciesHTQC!=vvolume.size", _INPUT_ILLEGAL_);
12663 } // CO20200624
12664 if (nspeciesHTQC != vmass.size()) {
12665 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "nspeciesHTQC!=vmass.size", _INPUT_ILLEGAL_);
12666 } // CO20200624
12667 for (uint i = 0; i < nspeciesHTQC; i++) {
12668 rnd_species.push_back(species[i]); // LOAD FROM SPECIES
12669 rnd_species_pp.push_back(species_pp[i]); // LOAD FROM SPECIES
12670 rnd_vvolume.push_back(vvolume[i]); // LOAD FROM SPECIES
12671 rnd_vmass.push_back(vmass[i]); // LOAD FROM SPECIES
12672 string A = "A";
12673 A[0] += i;
12674 rnd_label1.push_back(A);
12675 rnd_label2.push_back(A); // megatrick thanks C++ to have C inside (SC2011)
12676 }
12677 aurostd::sort(rnd_species, rnd_species_pp, rnd_vvolume, rnd_vmass, rnd_label1); // how to fix rnd_atomxX by shufflying rnd_label1
12678 aurostd::sort(rnd_label1, rnd_label2); // how to go back from rnd_labe1 to rnd_label2
12679 label = label + ".";
12680 for (size_t i = 0; i < rnd_label2.size(); i++) {
12681 label = label + rnd_label2[i]; // FIXING LABEL
12682 }
12683 if (LDEBUG) {
12684 cerr << __AFLOW_FUNC__ << " label=" << label << endl;
12685 }
12686 for (uint i = 0; i < nspeciesHTQC; i++) {
12687 if (LDEBUG) {
12688 cerr << __AFLOW_FUNC__ << " BEFORE species.at(" << i << ")=" << species.at(i) << " species_pp.at(" << i << ")=" << species_pp.at(i) << " vvolume.at(" << i << ")=" << vvolume.at(i) << " vmass.at(" << i
12689 << ")=" << vmass.at(i) << endl;
12690 }
12691 }
12692 for (uint i = 0; i < nspeciesHTQC; i++) {
12693 species[i] = rnd_species.at(i);
12694 }
12695 for (uint i = 0; i < nspeciesHTQC; i++) {
12696 species_pp[i] = rnd_species_pp.at(i);
12697 }
12698 for (uint i = 0; i < nspeciesHTQC; i++) {
12699 vvolume[i] = rnd_vvolume.at(i);
12700 }
12701 for (uint i = 0; i < nspeciesHTQC; i++) {
12702 vmass[i] = rnd_vmass.at(i);
12703 }
12704 for (uint i = 0; i < nspeciesHTQC; i++) {
12705 if (LDEBUG) {
12706 cerr << __AFLOW_FUNC__ << " AFTER species.at(" << i << ")=" << species.at(i) << " species_pp.at(" << i << ")=" << species_pp.at(i) << " vvolume.at(" << i << ")=" << vvolume.at(i) << " vmass.at(" << i
12707 << ")=" << vmass.at(i) << endl;
12708 }
12709 }
12710 if (LDEBUG) {
12711 cerr << __AFLOW_FUNC__ << " END" << endl;
12712 }
12713 return true;
12714}
12715
12716bool AlphabetizePrototypeLabelSpecies(deque<string>& species, deque<string>& species_pp, string& label) {
12717 deque<double> vvolume;
12718 for (size_t i = 0; i < species.size(); i++) {
12719 vvolume.push_back(double(0));
12720 }
12721 deque<double> vmass;
12722 for (size_t i = 0; i < species.size(); i++) {
12723 vmass.push_back(double(0));
12724 }
12725 return AlphabetizePrototypeLabelSpecies(species, species_pp, vvolume, vmass, label);
12726}
12727
12728bool AlphabetizePrototypeLabelSpecies(deque<string>& species, deque<double>& vvolume, string& label) {
12729 deque<string> species_pp;
12730 for (size_t i = 0; i < species.size(); i++) {
12731 species_pp.push_back(species[i]);
12732 }
12733 deque<double> vmass;
12734 for (size_t i = 0; i < species.size(); i++) {
12735 vmass.push_back(double(0));
12736 }
12737 return AlphabetizePrototypeLabelSpecies(species, species_pp, vvolume, vmass, label);
12738}
12739
12740bool AlphabetizePrototypeLabelSpecies(deque<string>& species, string& label) {
12741 deque<string> species_pp;
12742 for (size_t i = 0; i < species.size(); i++) {
12743 species_pp.push_back(species[i]);
12744 }
12745 deque<double> vvolume;
12746 for (size_t i = 0; i < species.size(); i++) {
12747 vvolume.push_back(double(0));
12748 }
12749 deque<double> vmass;
12750 for (size_t i = 0; i < species.size(); i++) {
12751 vmass.push_back(double(0));
12752 }
12753 return AlphabetizePrototypeLabelSpecies(species, species_pp, vvolume, vmass, label);
12754}
12755
12756string AlphabetizePrototypeLabelSpeciesArgv(vector<string>& argv) {
12757 const bool LDEBUG = (false || XHOST.DEBUG);
12758 // LDEBUG=true;
12759 string label = argv.at(2);
12760 const uint nspeciesHTQC = aflowlib::PrototypeLibrariesSpeciesNumber(label);
12761 if (LDEBUG) {
12762 cerr << "AlphabetizePrototypeLabelSpeciesArgv: nspeciesHTQC=" << nspeciesHTQC << endl;
12763 }
12764 if (LDEBUG) {
12765 cerr << "AlphabetizePrototypeLabelSpeciesArgv: label=" << label << endl;
12766 }
12767 deque<string> species;
12768 for (uint i = 0; i < nspeciesHTQC; i++) {
12769 species.push_back(argv.at(3 + i)); // LOAD FROM ARGV
12770 }
12771 AlphabetizePrototypeLabelSpecies(species, label);
12772 for (uint i = 0; i < nspeciesHTQC; i++) {
12773 argv.at(3 + i) = species.at(i);
12774 }
12775 argv.at(2) = label;
12776 return label;
12777}
12778
12779string AlphabetizePrototypeLabelSpeciesTokens(vector<string>& tokens) {
12780 const bool LDEBUG = (false || XHOST.DEBUG);
12781 // LDEBUG=true;
12782 string label = tokens.at(0);
12783 const uint nspeciesHTQC = aflowlib::PrototypeLibrariesSpeciesNumber(label);
12784 if (LDEBUG) {
12785 cerr << "AlphabetizePrototypeLabelSpeciesTokens: nspeciesHTQC=" << nspeciesHTQC << endl;
12786 }
12787 if (LDEBUG) {
12788 cerr << "AlphabetizePrototypeLabelSpeciesTokens: label=" << label << endl;
12789 }
12790 deque<string> species;
12791 for (uint i = 0; i < nspeciesHTQC; i++) {
12792 species.push_back(tokens.at(1 + i)); // LOAD FROM TOKENS
12793 }
12794 AlphabetizePrototypeLabelSpecies(species, label);
12795 for (uint i = 0; i < nspeciesHTQC; i++) {
12796 tokens.at(1 + i) = species.at(i);
12797 }
12798 tokens.at(0) = label;
12799 return label;
12800}
12801
12802// ***************************************************************************
12803// pflow::PROTO_PARSE_INPUT
12804// ***************************************************************************
12805namespace pflow {
12806 bool PROTO_PARSE_INPUT(const vector<string>& params, vector<vector<string>>& vvstr, vector<vector<double>>& vvnum, bool ignore_label, bool reverse) { // CO20181226
12807 stringstream message;
12808 for (size_t i = 0; i < vvstr.size(); i++) {
12809 vvstr[i].clear();
12810 }
12811 vvstr.clear();
12812 for (size_t i = 0; i < vvnum.size(); i++) {
12813 vvnum[i].clear();
12814 }
12815 vvnum.clear();
12816 if (params.empty()) {
12817 return false;
12818 } // nothing provided...
12819 if (ignore_label && params.size() == 1) {
12820 return true;
12821 } // could just be label, that's ok
12822 vector<string> tokens;
12823 bool isfloat1;
12824 bool isfloat2;
12825 const bool ignore_first = (ignore_label && !reverse);
12826 const bool ignore_last = (ignore_label && reverse);
12827 for (size_t i = (ignore_first ? 1 : 0); i < params.size() - (ignore_last ? 1 : 0); i++) {
12828 aurostd::string2tokens(params[i], tokens, ",");
12829 if (tokens.empty()) {
12830 message << "No inputs found in params[" << i << "]";
12832 }
12833 isfloat1 = aurostd::isfloat(tokens[0]);
12834 if (isfloat1) {
12835 vvnum.emplace_back(0);
12836 } else {
12837 vvstr.emplace_back(0);
12838 }
12839 for (size_t j = 0; j < tokens.size(); j++) {
12840 isfloat2 = aurostd::isfloat(tokens[j]);
12841 if (isfloat1 != isfloat2) {
12842 message << "Mixed string/number input at params[" << i << "]=" << params[i];
12844 }
12845 if (isfloat2) {
12846 vvnum.back().push_back(aurostd::string2utype<double>(tokens[j]));
12847 } else {
12848 vvstr.back().push_back(tokens[j]);
12849 }
12850 }
12851 }
12852 return true;
12853 }
12854} // namespace pflow
12855
12856// ***************************************************************************
12857// pflow::PROTO_TEST_INPUT
12858// ***************************************************************************
12859namespace pflow {
12860 bool PROTO_TEST_INPUT(const vector<vector<string>>& vvstr, const vector<vector<double>>& vvnum, uint& nspeciesHTQC, bool patch_nspecies) { // CO20181226
12861 stringstream message;
12862 // patch for ICSD/pocc
12863 uint nspecies = nspeciesHTQC;
12864 if (patch_nspecies) {
12865 nspecies = vvstr.size();
12866 }
12867 // do some checks
12868 // check nspecies vs. vvstr
12869 const bool check_volumes = (!vvnum.empty() && !(vvnum.size() == 1 && vvnum[0].size() == 1)); // either volumes not specified, or global volume specified, i.e., volume=str.atoms.size()*volume_in;
12870 if (!vvstr.empty() && vvstr.size() != nspecies) {
12871 message << "Invalid input specification, mismatch between nspecies and species inputs (nspecies==" << nspecies << ", vvstr.size()==" << vvstr.size() << ")" << endl;
12872 message << "aflow --aflow_proto[=]label*:specieA*[:specieB*][:volumeA*[:volumeB*] | :volume]" << endl;
12874 }
12875 if (check_volumes) {
12876 // check nspecies vs. vvnum
12877 if (vvnum.size() != nspecies) {
12878 message << "Invalid input specification, mismatch between nspecies and volume inputs (nspecies==" << nspecies << ", vvnum.size()==" << vvnum.size() << ")" << endl;
12879 message << "aflow --aflow_proto[=]label*:specieA*[:specieB*][:volumeA*[:volumeB*] | :volume]" << endl;
12881 }
12882 // check vvstr vs. vvnum
12883 if (vvstr.size() != vvnum.size()) {
12884 message << "Invalid input specification, mismatch between species and volume inputs (vvstr.size()==" << vvstr.size() << ", vvnum.size()==" << vvnum.size() << ")" << endl;
12885 message << "aflow --aflow_proto[=]label*:specieA*[:specieB*][:volumeA*[:volumeB*] | :volume]" << endl;
12887 }
12888 for (size_t i = 0; i < vvstr.size(); i++) {
12889 if (vvstr[i].size() != vvnum[i].size()) {
12890 message << "Invalid input specification, mismatch between combo species and volume inputs (vvstr[" << i << "].size()==" << vvstr[i].size() << ", vvnum[" << i << "].size()==" << vvnum[i].size() << ")" << endl;
12891 message << "aflow --aflow_proto[=]label*:specieA*[:specieB*][:volumeA*[:volumeB*] | :volume]" << endl;
12893 }
12894 }
12895 }
12896 // check no negative volumes
12897 for (size_t i = 0; i < vvnum.size(); i++) {
12898 for (size_t j = 0; j < vvnum[i].size(); j++) {
12899 if (vvnum[i][j] <= 0) { // also includes 0
12900 message << "Invalid input specification, negative/zero number input found (vvnum[" << i << "][" << j << "]=" << vvnum[i][j] << ")" << endl;
12901 message << "aflow --aflow_proto[=]label*:specieA*[:specieB*][:volumeA*[:volumeB*] | :volume]" << endl;
12903 }
12904 }
12905 }
12906 return true;
12907 }
12908} // namespace pflow
12909
12910namespace pflow {
12911 bool sortPOCCSites(const string& p1, const string& p2) { // CO20181226
12912 stringstream message;
12913 vector<string> tokens;
12914 string designation1;
12915 string designation2;
12916 char mode1;
12917 char mode2;
12918 string _site1;
12919 string _site2;
12920 uint site1;
12921 uint site2;
12922 // p1
12923 aurostd::string2tokens(p1, tokens, "-");
12924 if (tokens.empty()) {
12925 message << "No occupants specified for [designation=" << p1 << "]";
12927 }
12928 designation1 = tokens[0];
12929 if (designation1.empty()) {
12930 message << "No mode specified [designation=" << p1 << "]";
12932 }
12933 mode1 = designation1[0];
12934 _site1 = designation1;
12935 _site1.erase(_site1.begin());
12936 if (!aurostd::isfloat(_site1)) {
12937 message << "Designation ill-written, no site provided [designation=" << p1 << "]";
12939 }
12940 site1 = aurostd::string2utype<int>(_site1);
12941 // p2
12942 aurostd::string2tokens(p2, tokens, "-");
12943 if (tokens.empty()) {
12944 message << "No occupants specified for [designation=" << p2 << "]";
12946 }
12947 designation2 = tokens[0];
12948 if (designation2.empty()) {
12949 message << "No mode specified [designation=" << p2 << "]";
12951 }
12952 mode2 = designation2[0];
12953 _site2 = designation2;
12954 _site2.erase(_site2.begin());
12955 if (!aurostd::isfloat(_site2)) {
12956 message << "Designation ill-written, no site provided [designation=" << p2 << "]";
12958 }
12959 site2 = aurostd::string2utype<int>(_site2);
12960 // check sites first
12961 if (site1 != site2) {
12962 return site1 < site2;
12963 } // sort 1 then 2 then 3
12964 // check mode
12965 if (mode1 != mode2) { // sort P first, as S is a grouped designation
12966 if (mode1 == 'P') {
12967 return true;
12968 } // P < S
12969 else {
12970 return false;
12971 } // S > P
12972 }
12973 message << "Double specification for the same site [designation1=" << p1 << ",designation2=" << p2 << "]";
12975 return true;
12976 }
12977 bool sortPOCCOccs(const string& occ1, const string& occ2) { // CO20181226
12978 const bool LDEBUG = (false || XHOST.DEBUG);
12979 stringstream message;
12980 vector<string> tokens;
12981 string _occupancy1;
12982 string _occupant1;
12983 string _occupancy2;
12984 string _occupant2;
12985 int occupant1;
12986 int occupant2;
12987 double occupancy1;
12988 double occupancy2;
12989 // occ1
12990 aurostd::string2tokens(occ1, tokens, "x");
12991 if (tokens.size() != 2) {
12992 message << "Occupancy x Occupant pair ill-defined for [occupation=" << occ1 << "]";
12994 }
12995 _occupancy1 = tokens[0];
12996 _occupant1 = tokens[1];
12997 occupant1 = (int) _occupant1[0] - 65;
12998 if (LDEBUG) {
12999 cerr << __AFLOW_FUNC__ << " occupant to int conversion: " << _occupant1 << " == " << occupant1 << endl;
13000 } //[0] to convert to char
13001 if (!aurostd::isfloat(_occupancy1)) {
13002 message << "Occupancy is not a float for [occupation=" << occ1 << "]";
13004 }
13005 occupancy1 = aurostd::string2utype<double>(_occupancy1);
13006 // occ2
13007 aurostd::string2tokens(occ2, tokens, "x");
13008 if (tokens.size() != 2) {
13009 message << "Occupancy x Occupant pair ill-defined for [occupation=" << occ2 << "]";
13011 }
13012 _occupancy2 = tokens[0];
13013 _occupant2 = tokens[1];
13014 occupant2 = (int) _occupant2[0] - 65;
13015 if (LDEBUG) {
13016 cerr << __AFLOW_FUNC__ << " occupant to int conversion: " << _occupant2 << " == " << occupant2 << endl;
13017 } //[0] to convert to char
13018 if (!aurostd::isfloat(_occupancy2)) {
13019 message << "Occupancy is not a float for [occupation=" << occ2 << "]";
13021 }
13022 occupancy2 = aurostd::string2utype<double>(_occupancy2);
13023 if (occupant1 != occupant2) {
13024 return occupant1 < occupant2;
13025 } // sort A then B then C
13026 if (occupancy1 != occupancy2) {
13027 return occupancy1 > occupancy2;
13028 } // sort most preferred first
13029 message << "Double specification for the same occupant [occupation1=" << occ1 << ",occupation2=" << occ2 << "]";
13031 return true;
13032 }
13033 bool FIX_PRECISION_POCC(const string& occ, string& new_occ) { // CO20181226
13034 const bool LDEBUG = (false || XHOST.DEBUG);
13035 new_occ = "";
13036 stringstream message;
13037 vector<string> tokens;
13038 string _occupancy;
13039 string _occupant;
13040 string occupant;
13041 double occupancy;
13042 aurostd::string2tokens(occ, tokens, "x");
13043 if (tokens.size() != 2) {
13044 message << "Occupancy x Occupant pair ill-defined for [occupation=" << occ << "]";
13046 }
13047 _occupancy = tokens[0];
13048 _occupant = tokens[1];
13049 occupant = (int) _occupant[0] - 65;
13050 if (LDEBUG) {
13051 cerr << __AFLOW_FUNC__ << " occupant to int conversion: " << _occupant << " == " << occupant << endl;
13052 } //[0] to convert to char
13053 if (!aurostd::isfloat(_occupancy)) {
13054 message << "Occupancy is not a float for [occupation=" << occ << "]";
13056 }
13057 occupancy = aurostd::string2utype<double>(_occupancy);
13058 const double default_pocc_tol = DEFAULT_POCC_STOICH_TOL; // AFLOWRC_DEFAULT_POCC_STOICH_TOL; //1e-3
13059 if (occupancy < default_pocc_tol) {
13060 message << "Cannot set desired precision (" << default_pocc_tol << ") for [occupation=" << occ << "]" << endl;
13061 message << "Doping is VERY small, requiring MANY representative ordered structures (not recommended)" << endl;
13062 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, cout, _LOGGER_WARNING_);
13063 return false;
13064 }
13065 new_occ = occ;
13066 const int prec = (int) ceil(log10(1.0 / default_pocc_tol)); // AFLOWRC_DEFAULT_POCC_STOICH_TOL //use internal default here for consistency
13067 aurostd::StringSubstInPlace(new_occ, _occupancy, aurostd::utype2string(occupancy, prec));
13068 return true;
13069 }
13070 struct POCCSiteSpecification { // temporary container for sorting, do not put in .h (unless necessary)
13072 char mode;
13073 vector<uint> positions;
13074 };
13075 vector<POCCSiteSpecification> poccString2POCCSiteSpecification(const xstructure& xstr, const vector<string> pocc_sites) {
13076 const bool LDEBUG = (false || XHOST.DEBUG);
13077 if (LDEBUG) { // CO20230319
13078 cerr << __AFLOW_FUNC__ << " xstr=" << endl << xstr << endl;
13079 cerr << __AFLOW_FUNC__ << " pocc_sites=";
13080 for (size_t i = 0; i < pocc_sites.size(); i++) {
13081 cerr << pocc_sites[i] << (i < pocc_sites.size() - 1 ? "," : "");
13082 }
13083 cerr << endl;
13084 }
13085 stringstream message;
13086 vector<POCCSiteSpecification> vpss;
13087 if (pocc_sites.empty()) {
13088 return vpss;
13089 }
13090 vector<string> tokens;
13091 vector<string> tokenstmp;
13092 string designation;
13093 char mode;
13094 string _site;
13095 uint site;
13097 uint iatom;
13098 vector<string> pocc_designations; // quick way to check if there are duplicate specifications
13099 for (size_t i = 0; i < pocc_sites.size(); i++) {
13100 const string& ps = pocc_sites[i];
13101 if (ps.empty()) {
13102 message << "POCC_site[i=" << i << "] empty";
13104 }
13105 aurostd::string2tokens(ps, tokens, "-");
13106 if (tokens.empty()) {
13107 message << "No occupants specified for [designation=" << ps << "]";
13109 }
13110 designation = tokens[0];
13111 if (designation.empty()) {
13112 message << "No mode specified [designation=" << ps << "]";
13114 }
13115 if (aurostd::WithinList(pocc_designations, designation)) {
13116 message << "Duplicate POCC designation: " << designation;
13118 }
13119 pocc_designations.push_back(designation);
13120 mode = designation[0];
13121 _site = designation;
13122 _site.erase(_site.begin());
13123 if (!aurostd::isfloat(_site)) {
13124 message << "Designation ill-written, no site provided [designation=" << ps << "]";
13126 }
13127 site = aurostd::string2utype<int>(_site);
13128 pss.input_string = ps;
13129 pss.mode = mode;
13130 pss.positions.clear();
13131 pss.positions.push_back(site);
13132 if (pss.mode == 'S') {
13133 pss.positions.clear();
13134 iatom = 0;
13135 for (size_t ii = 0; ii < xstr.num_each_type.size(); ii++) {
13136 for (uint jj = 0; jj < (uint) xstr.num_each_type[ii]; jj++) {
13137 if (ii == site) {
13138 pss.positions.push_back(iatom);
13139 }
13140 iatom++;
13141 }
13142 }
13143 }
13144 if (pss.positions.empty()) {
13145 message << "No positions found: " << ps;
13147 }
13148 // replace P IFF positions.size()==1
13149 if (pss.mode != 'P' && pss.positions.size() == 1) {
13150 //[CO20190629 - need to replace designation + position]pss.input_string[0]='P';
13151 pss.mode = 'P';
13152 // CO20190629 START - small bug, need to change pss.input_string to map SPECIES 3 to POSITION X
13153 tokenstmp.clear();
13154 for (size_t it = 1; it < tokens.size(); it++) {
13155 tokenstmp.push_back(tokens[it]);
13156 } // skip 0, this is being changed
13157 pss.input_string = "P" + aurostd::utype2string(pss.positions[0]) + "-" + aurostd::joinWDelimiter(tokenstmp, "-");
13158 // CO20190629 STOP - small bug, need to change pss.input_string to map SPECIES 3 to POSITION X
13159 }
13160 if (LDEBUG) {
13161 cerr << __AFLOW_FUNC__ << " creating new POCCSiteSpecification():" << endl;
13162 cerr << __AFLOW_FUNC__ << " POCCSiteSpecification.input_string=" << pss.input_string << endl;
13163 cerr << __AFLOW_FUNC__ << " POCCSiteSpecification.positions=" << aurostd::joinWDelimiter(pss.positions, ",") << endl;
13164 }
13165 std::sort(pss.positions.begin(), pss.positions.end());
13166 vpss.push_back(pss);
13167 }
13168 return vpss;
13169 }
13171 stringstream message;
13172 if (p1.positions.empty()) {
13173 message << "No positions found: " << p1.input_string;
13175 }
13176 if (p2.positions.empty()) {
13177 message << "No positions found: " << p2.input_string;
13179 }
13180 const uint position1 = p1.positions[0];
13181 const uint position2 = p2.positions[0];
13182 if (p1.mode != p2.mode) {
13183 if (p1.mode == 'S' && p2.mode == 'P') {
13184 if (aurostd::WithinList(p1.positions, position2)) {
13185 return false;
13186 } // put p2 first
13187 } else if (p1.mode == 'P' && p2.mode == 'S') {
13188 if (aurostd::WithinList(p2.positions, position1)) {
13189 return true;
13190 } // put p1 first
13191 } else {
13192 message << "Unknown modes: p1.mode=" << p1.mode << ", p2.mode=" << p2.mode;
13194 }
13195 }
13196 return position1 < position2;
13197 }
13198 void FIX_POCC_PARAMS(const xstructure& xstr, string& pocc_params) { // CO20181226
13199 // this sorts and fixes precision of pocc params
13200 if (pocc_params.empty()) {
13201 return;
13202 }
13203 aurostd::StringSubstInPlace(pocc_params, "*", "x"); // sometimes it's more intuitive to write 1*A instead of 1xA, let's fix automatically
13204 const bool LDEBUG = (false || XHOST.DEBUG);
13205 if (LDEBUG) {
13206 ;
13207 } // dummy load
13208 stringstream message;
13209 vector<string> tokens0;
13210 vector<string> tokens1;
13211 vector<string> _tokens2;
13212 vector<string> tokens2;
13213 vector<string> tokens2_save;
13214 // START - do not modify pocc_params inside here
13215 aurostd::string2tokens(pocc_params, tokens0, ","); // does not modify pocc_params
13216 string occ;
13217 string new_occ;
13218 bool fix_precision_occupancy = true;
13219 vector<POCCSiteSpecification> vpss;
13220 for (size_t i = 0; i < tokens0.size(); i++) {
13221 aurostd::string2tokens(tokens0[i], tokens1, "_");
13222 vpss = poccString2POCCSiteSpecification(xstr, tokens1); // pack into tmp struct purely for sorting
13223 // std::sort(tokens1.begin(),tokens1.end(),sortPOCCSites);
13224 std::sort(vpss.begin(), vpss.end(), sortPOCCSiteSpecifications);
13225 tokens1.clear();
13226 for (size_t ip = 0; ip < vpss.size(); ip++) {
13227 tokens1.push_back(vpss[ip].input_string);
13228 } // unpack from tmp struct to tokens1
13229 if (LDEBUG) {
13230 for (size_t ip = 0; ip < tokens1.size(); ip++) {
13231 cerr << __AFLOW_FUNC__ << " tokens1[" << ip << "]=" << tokens1[ip] << " (NEW ORDER)" << endl;
13232 }
13233 }
13234 for (size_t j = 0; j < tokens1.size(); j++) {
13235 // second parse -
13236 aurostd::string2tokens(tokens1[j], _tokens2, "-");
13237 if (_tokens2.size() < 2) {
13238 message << "No occupants specified for [designation=" << tokens1[j] << "]";
13240 }
13241 tokens2.clear();
13242 tokens2_save.clear();
13243 fix_precision_occupancy = true;
13244 for (size_t k = 1; k < _tokens2.size(); k++) { // remove mode part
13245 tokens2_save.push_back(_tokens2[k]);
13246 // check that all occupancies are not smaller than desired precision (avoid setting to 0 completely)
13247 // CO - check that we do not have issues with vacancies, we may also need to check 1-sum(x)
13248 occ = new_occ = tokens2_save.back();
13249 fix_precision_occupancy = (fix_precision_occupancy && FIX_PRECISION_POCC(occ, new_occ));
13250 tokens2.push_back(new_occ);
13251 }
13252 if (!fix_precision_occupancy) {
13253 tokens2.clear();
13254 for (size_t k = 0; k < tokens2_save.size(); k++) {
13255 tokens2.push_back(tokens2_save[k]);
13256 }
13257 } // avoid setting precision if it's too small
13258 std::sort(tokens2.begin(), tokens2.end(), sortPOCCOccs);
13259 tokens2.insert(tokens2.begin(), _tokens2[0]); // add mode part back
13260 tokens1[j] = aurostd::joinWDelimiter(tokens2, "-");
13261 }
13262 tokens0[i] = aurostd::joinWDelimiter(tokens1, "_");
13263 }
13264 // STOP - do not modify pocc_params inside here
13265 pocc_params = aurostd::joinWDelimiter(tokens0, ","); // replace input in place
13266 }
13267} // namespace pflow
13268
13269// ***************************************************************************
13270// pflow::checkAnionSublattice
13271// ***************************************************************************
13272namespace pflow {
13273 bool checkAnionSublattice(const xstructure& xstr) { // CO20210201
13274 const bool LDEBUG = (false || XHOST.DEBUG);
13275 vector<string> vanions;
13277 vector<vector<string>> voccupants;
13278 vector<xvector<double>> vsites; // cpos
13279 vector<bool> vanions_found;
13280 uint i = 0;
13281 uint j = 0;
13282 bool found = false;
13283 for (i = 0; i < xstr.atoms.size(); i++) {
13284 found = false;
13285 for (j = 0; j < voccupants.size() && !found; j++) {
13286 if (aurostd::modulus(vsites[j] - xstr.atoms[i].cpos) < _AFLOW_POCC_ZERO_TOL_) {
13287 if (!aurostd::WithinList(voccupants[j], xstr.atoms[i].cleanname)) {
13288 voccupants[j].push_back(xstr.atoms[i].cleanname);
13289 if (aurostd::WithinList(vanions, xstr.atoms[i].cleanname)) {
13290 vanions_found[j] = true;
13291 }
13292 found = true;
13293 }
13294 }
13295 }
13296 if (!found) {
13297 vsites.push_back(xstr.atoms[i].cpos);
13298 voccupants.emplace_back(0);
13299 voccupants.back().push_back(xstr.atoms[i].cleanname);
13300 vanions_found.push_back(aurostd::WithinList(vanions, xstr.atoms[i].cleanname));
13301 }
13302 }
13303 if (vsites.size() != voccupants.size()) {
13304 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "vsites.size()!=voccupants.size()", _RUNTIME_ERROR_);
13305 }
13306 if (vsites.size() != vanions_found.size()) {
13307 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "vsites.size()!=vanions_found.size()", _RUNTIME_ERROR_);
13308 }
13309 if (LDEBUG) {
13310 for (j = 0; j < voccupants.size(); j++) {
13311 cerr << __AFLOW_FUNC__ << " site=" << j << " occupants=" << aurostd::joinWDelimiter(voccupants[j], ",") << " [ANIONS_SUBLATTICE=" << vanions_found[j] << "]" << endl;
13312 }
13313 }
13314 for (j = 0; j < voccupants.size(); j++) {
13315 if (vanions_found[j]) {
13316 for (i = 0; i < voccupants[j].size(); i++) {
13317 if (!aurostd::WithinList(vanions, voccupants[j][i])) {
13318 if (LDEBUG) {
13319 cerr << __AFLOW_FUNC__ << " found non-anion in anion_sublattice: " << voccupants[j][i] << endl;
13320 }
13321 return false;
13322 }
13323 }
13324 }
13325 }
13326 return true;
13327 }
13328} // namespace pflow
13329
13330namespace pflow {
13331 // ***************************************************************************
13332 // pflow::convertXStr2POCC
13333 // ***************************************************************************
13334 // ./aflow --proto=T0009.ABC:Br:Cl:Cs_sv:I:Pb_d:Sm --pocc_params=S0-1xC_S1-0.5xE-0.5xF_S2-0.3333xA-0.3333xB-0.3333xD
13335 bool convertXStr2POCC(xstructure& xstr, const string& pocc_params, const vector<string>& _vspecies, const vector<double>& vvolumes) { // CO20181226
13336 if (pocc_params.empty()) {
13337 return false;
13338 }
13339 vector<string> vspecies;
13340 if (_vspecies.empty()) {
13341 for (uint i = 0; i < 26; i++) {
13342 vspecies.push_back(string() + char('A' + i));
13343 } // put back ABC...
13344 } else {
13345 for (size_t i = 0; i < _vspecies.size(); i++) {
13346 vspecies.push_back(_vspecies[i]);
13347 }
13348 }
13349 const bool LDEBUG = (false || XHOST.DEBUG);
13350 stringstream message;
13351 xstructure xstr_orig(xstr);
13352 // first parse _
13353 vector<string> tokens1;
13354 vector<string> tokens2;
13355 vector<string> tokens3;
13356 string designation;
13357 string _occupancy;
13358 string _occupant;
13359 string _site;
13360 double occupancy;
13361 uint site;
13362 uint occupant;
13363 uint iatom;
13364 char mode;
13365 aurostd::string2tokens(pocc_params, tokens1, "_");
13366 _atom atom;
13367 vector<uint> atoms2remove;
13368 vector<_atom> atoms2add;
13369 vector<uint> positions_already_added;
13370 vector<uint> positions_already_added_tmp;
13371 for (size_t i = 0; i < tokens1.size(); i++) {
13372 // second parse -
13373 aurostd::string2tokens(tokens1[i], tokens2, "-");
13374 if (tokens2.empty()) {
13375 message << "No occupants specified for [designation=" << tokens1[i] << "]";
13377 }
13378 designation = tokens2[0];
13379 tokens2.erase(tokens2.begin());
13380 if (designation.empty()) {
13381 message << "Designation empty [i=" << i << "]";
13383 }
13384 mode = designation[0];
13385 _site = designation;
13386 _site.erase(_site.begin());
13387 if (!aurostd::isfloat(_site)) {
13388 message << "Designation ill-written, no site provided [designation=" << designation << "]";
13390 }
13391 site = aurostd::string2utype<uint>(_site); // this is a hash, so start from 0 //-1
13392 if (mode == 'P') {
13393 // site here refers to position (atom)
13394 if (site >= xstr_orig.atoms.size()) {
13395 message << "Invalid position index " << site << " >= xstr.atoms.size()=" << xstr_orig.atoms.size();
13397 }
13398 atoms2remove.push_back(site);
13399 } else if (mode == 'S') {
13400 if (site >= xstr_orig.num_each_type.size()) { // site here is type
13401 message << "Invalid type index " << site << " >= xstr.num_each_type.size()=" << xstr_orig.num_each_type.size();
13403 }
13404 iatom = 0;
13405 for (size_t ii = 0; ii < xstr_orig.num_each_type.size(); ii++) {
13406 for (uint jj = 0; jj < (uint) xstr_orig.num_each_type[ii]; jj++) {
13407 if (ii == site) {
13408 atoms2remove.push_back(iatom);
13409 }
13410 iatom++;
13411 }
13412 }
13413 } else {
13414 message << "Unknown POCC designation mode [designation=" << designation << "]";
13416 }
13417 positions_already_added_tmp.clear(); // do not ignore at the 'x' level
13418 for (size_t j = 0; j < tokens2.size(); j++) {
13419 // third parse x
13420 aurostd::string2tokens(tokens2[j], tokens3, "x");
13421 if (tokens3.size() != 2) {
13422 message << "Occupancy x Occupant pair ill-defined for [designation=" << tokens1[i] << ",occupant=" << j << "]";
13424 }
13425 _occupancy = tokens3[0];
13426 _occupant = tokens3[1];
13427 occupant = (int) _occupant[0] - 65;
13428 if (LDEBUG) {
13429 cerr << __AFLOW_FUNC__ << " occupant to int conversion: " << _occupant << " == " << occupant << endl;
13430 } //[0] to convert to char
13431 if (occupant >= vspecies.size()) {
13432 message << "Invalid occupant specification: occupant[char=" << _occupant << ",int=" << occupant << "] vs. vspecies.size()=" << vspecies.size();
13434 }
13435 if (!aurostd::isfloat(_occupancy)) {
13436 message << "Occupancy is not a float for [designation=" << tokens1[i] << ",occupant=" << j << "]";
13438 }
13439 occupancy = aurostd::string2utype<double>(_occupancy);
13440 if (LDEBUG) {
13441 cerr << __AFLOW_FUNC__ << " mode=" << mode << endl;
13442 cerr << __AFLOW_FUNC__ << " site=" << site << endl;
13443 cerr << __AFLOW_FUNC__ << " positions_already_added=" << aurostd::joinWDelimiter(positions_already_added, ",") << endl;
13444 }
13445 if (mode == 'P') {
13446 if (!aurostd::WithinList(positions_already_added, site)) { // do NOT over add, each position should be specified exactly once
13447 atom = xstr_orig.atoms[site];
13448 positions_already_added_tmp.push_back(site); // do NOT over add, each position should be specified exactly once
13449 atom.type = occupant;
13450 atom.name = vspecies[occupant];
13451 atom.CleanName();
13452 atom.CleanSpin();
13453 atom.name_is_given = true;
13454 atom.partial_occupation_value = occupancy;
13455 atom.partial_occupation_flag = !aurostd::isequal(atom.partial_occupation_value, 1.0, _AFLOW_POCC_ZERO_TOL_);
13456 if (atom.partial_occupation_flag) {
13457 xstr.partial_occupation_flag = true;
13458 }
13459 atoms2add.push_back(atom);
13460 }
13461 }
13462 if (mode == 'S') {
13463 iatom = 0;
13464 for (size_t ii = 0; ii < xstr_orig.num_each_type.size(); ii++) {
13465 for (uint jj = 0; jj < (uint) xstr_orig.num_each_type[ii]; jj++) {
13466 if (ii == site) {
13467 if (!aurostd::WithinList(positions_already_added, iatom)) { // do NOT over add, each position should be specified exactly once
13468 atom = xstr_orig.atoms[iatom];
13469 positions_already_added_tmp.push_back(iatom); // do NOT over add, each position should be specified exactly once
13470 atom.type = occupant;
13471 atom.name = vspecies[occupant];
13472 atom.CleanName();
13473 atom.CleanSpin();
13474 atom.name_is_given = true;
13475 atom.partial_occupation_value = occupancy;
13476 atom.partial_occupation_flag = !aurostd::isequal(atom.partial_occupation_value, 1.0, _AFLOW_POCC_ZERO_TOL_);
13477 if (atom.partial_occupation_flag) {
13478 xstr.partial_occupation_flag = true;
13479 }
13480 atoms2add.push_back(atom);
13481 }
13482 }
13483 iatom++;
13484 }
13485 }
13486 }
13487 if (LDEBUG) {
13488 cerr << __AFLOW_FUNC__ << " positions_already_added_tmp=" << aurostd::joinWDelimiter(positions_already_added_tmp, ",") << endl;
13489 }
13490 }
13491 positions_already_added.insert(positions_already_added.end(), positions_already_added_tmp.begin(), positions_already_added_tmp.end()); // insert positions_already_added_tmp into positions_already_added
13492 }
13493 xstr.RemoveAtom(atoms2remove);
13494 std::stable_sort(atoms2add.begin(), atoms2add.end(), sortAtomsTypes); // safe because we do AddAtom() below
13495 for (size_t i = 0; i < atoms2add.size(); i++) {
13496 xstr.AddAtom(atoms2add[i], false);
13497 } // CO20230319 - add by type
13498 // volumes
13499 // AddAtom() takes care of setting default volumes/masses
13500 if (vvolumes.size() == xstr.species_volume.size()) {
13501 for (size_t i = 0; i < vvolumes.size(); i++) {
13502 xstr.species_volume[i] = vvolumes[i];
13503 }
13504 }
13505 double volume = 0;
13506 if (vvolumes.size() == 1) {
13507 for (size_t i = 0; i < xstr.atoms.size(); i++) {
13508 volume += vvolumes[0] * xstr.atoms[i].partial_occupation_value;
13509 }
13510 } else {
13511 for (size_t i = 0; i < xstr.atoms.size(); i++) {
13512 for (size_t j = 0; j < xstr.num_each_type.size(); j++) {
13513 if (xstr.atoms[i].name == xstr.species[j]) {
13514 volume += xstr.species_volume[j] * xstr.atoms[i].partial_occupation_value;
13515 }
13516 }
13517 }
13518 }
13519 xstr.SetVolume(volume); // CO20190205 - more robust
13520 xstr.neg_scale = true;
13521 // patch title
13522 vector<string> tokens;
13523 aurostd::string2tokens(xstr.title, tokens, " ");
13524 if (!tokens.empty()) {
13525 const string tobereplaced = tokens[0];
13526 aurostd::string2tokens(tobereplaced, tokens, "/");
13527 if (tokens.size() == 2) {
13528 string pp = tokens[0];
13529 string proto = tokens[1];
13530 pp = aurostd::joinWDelimiter(xstr.species, ""); // rename
13531 proto = proto + ":POCC_" + pocc_params;
13532 aurostd::StringSubstInPlace(xstr.title, tobereplaced, pp + "/" + proto);
13533 }
13534 }
13535 return true;
13536 }
13537} // namespace pflow
13538
13539// ***************************************************************************
13540// pflow::POccInputs2Xstr
13541// ***************************************************************************
13542namespace pflow { // CO20211130
13543 bool POccInputs2Xstr(const string& pocc_input, aurostd::xoption& pocc_settings, xstructure& xstr, ostream& oss) {
13544 ofstream FileMESSAGE;
13545 return POccInputs2Xstr(pocc_input, pocc_settings, xstr, FileMESSAGE, oss);
13546 } // CO20211130
13547 bool POccInputs2Xstr(const string& pocc_input, aurostd::xoption& pocc_settings, xstructure& xstr, ofstream& FileMESSAGE, ostream& oss) { // CO20211130
13548 const bool LDEBUG = (false || XHOST.DEBUG);
13549 stringstream message;
13550 // example: Cs_svEuIPb_d:PAW_PBE.AB3C_cP5_221_a_c_b:POCC_S0-1xA_S1-1xC_S2-0.5xB-0.5xD
13551 // ARUN example: Cs_afEuIPb_d:PAW_PBE.AB3C_cP5_221_a_c_b:POCC_S0-1xA_S1-1xC_S2-0.5xB-0.5xD:ARUN.POCC_1_H0C0
13552 // convert to: --proto=AB3C_cP5_221_a_c_b:Cs_sv:Eu:I:Pb_d --pocc_params=S0-1xA_S1-1xC_S2-0.5xB-0.5xD
13553 // arun stuff separate
13554
13555 if (!aurostd::substring2bool(pocc_input, TAG_TITLE_POCC)) { // use generic
13556 message << "No TAG_TITLE_POCC found [" << TAG_TITLE_POCC << "], using generic SYSTEM name as title";
13557 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, FileMESSAGE, oss, _LOGGER_WARNING_); // CO20200404
13558 return false;
13559 }
13560 // Get all the pieces of the default title
13561 string::size_type loc1 = pocc_input.find(TAG_TITLE_POCC);
13562 const string elements_prototype_str = pocc_input.substr(0, loc1); // contains elements and prototype
13563 const string pocc_params_tol_arun_str = pocc_input.substr(loc1 + TAG_TITLE_POCC.length(), string::npos); // pocc_params and ARUN(?)
13564 if (LDEBUG) {
13565 cerr << __AFLOW_FUNC__ << " elements_prototype_str=" << elements_prototype_str << endl;
13566 cerr << __AFLOW_FUNC__ << " pocc_params_tol_arun_str=" << pocc_params_tol_arun_str << endl;
13567 }
13568 // parse elements_prototype_str by "."
13569 // PROBLEM: "." can exist in pp_string (not really important for standard PP, but it exists), as well
13570 // as proto: .ABC...
13571 // we will go in loop over "." parses until we get a structure!
13572 loc1 = elements_prototype_str.find('.');
13573 string pps;
13574 string proto;
13575 vector<string> velements;
13576 string tmp_str = "";
13577 string tmp_str2 = "";
13578 string pocc_params;
13579 string pocc_tol;
13580 string pocc_arun;
13581 string module_arun;
13582 string::size_type loc2 = 0;
13583 while (loc1 != string::npos && (loc1 + 1) < elements_prototype_str.length()) {
13584 pps = elements_prototype_str.substr(0, loc1);
13585 proto = elements_prototype_str.substr(loc1 + 1, string::npos);
13586 if (LDEBUG) {
13587 cerr << __AFLOW_FUNC__ << " pps=" << pps << endl;
13588 cerr << __AFLOW_FUNC__ << " proto=" << proto << endl;
13589 }
13590
13591 velements = aurostd::getElements(pps, pp_string, true, false, true); // clean, no sort_elements, pseudopotential string, keep_pp
13592 if (LDEBUG) {
13593 cerr << __AFLOW_FUNC__ << " velements=" << aurostd::joinWDelimiter(velements, ",") << endl;
13594 }
13595
13596 tmp_str = pocc_params_tol_arun_str;
13597 pocc_params = tmp_str;
13598 loc2 = tmp_str.find(TAG_TITLE_POCC_TOL);
13599 if (loc2 != string::npos && (loc2 + 1) < tmp_str.length()) {
13600 pocc_params = tmp_str.substr(0, loc2);
13601 tmp_str = tmp_str.substr(loc2 + 1, string::npos);
13602 pocc_tol = tmp_str;
13603 }
13604 if (LDEBUG) {
13605 cerr << __AFLOW_FUNC__ << " [1]" << endl;
13606 cerr << __AFLOW_FUNC__ << " proto=" << proto << endl;
13607 cerr << __AFLOW_FUNC__ << " pocc_params=" << pocc_params << endl;
13608 cerr << __AFLOW_FUNC__ << " pocc_tol=" << pocc_tol << endl;
13609 cerr << __AFLOW_FUNC__ << " pocc_arun=" << pocc_arun << endl;
13610 cerr << __AFLOW_FUNC__ << " module_arun=" << module_arun << endl;
13611 cerr << __AFLOW_FUNC__ << " tmp_str=" << tmp_str << endl;
13612 }
13613 loc2 = tmp_str.find(TAG_TITLE_POCC_ARUN);
13614 if (loc2 != string::npos && (loc2 + 1) < tmp_str.length()) {
13615 tmp_str2 = tmp_str.substr(0, loc2);
13616 if (tmp_str2.find(TAG_TITLE_POCC_TOL) != string::npos) {
13617 pocc_tol = tmp_str2;
13618 } else {
13619 pocc_params = tmp_str2;
13620 }
13621 tmp_str = tmp_str.substr(loc2 + 1, string::npos);
13622 pocc_arun = tmp_str;
13623 }
13624 if (LDEBUG) {
13625 cerr << __AFLOW_FUNC__ << " [2]" << endl;
13626 cerr << __AFLOW_FUNC__ << " proto=" << proto << endl;
13627 cerr << __AFLOW_FUNC__ << " pocc_params=" << pocc_params << endl;
13628 cerr << __AFLOW_FUNC__ << " pocc_tol=" << pocc_tol << endl;
13629 cerr << __AFLOW_FUNC__ << " pocc_arun=" << pocc_arun << endl;
13630 cerr << __AFLOW_FUNC__ << " module_arun=" << module_arun << endl;
13631 cerr << __AFLOW_FUNC__ << " tmp_str=" << tmp_str << endl;
13632 }
13633 // CO20210315 - might find pocc_params='P0-1xA_P1-0.2xB-0.2xC-0.2xD-0.2xE-0.2xF:ARUN.AGL_9_SF_0.95' which is a bad system name, missing ARUN.POCC
13634 loc2 = tmp_str.find(TAG_TITLE_ARUN);
13635 if (loc2 != string::npos && (loc2 + 1) < tmp_str.length()) {
13636 tmp_str2 = tmp_str.substr(0, loc2);
13637 if (tmp_str2.find(TAG_TITLE_POCC_ARUN) != string::npos) {
13638 pocc_arun = tmp_str2;
13639 } else if (tmp_str2.find(TAG_TITLE_POCC_TOL) != string::npos) {
13640 pocc_tol = tmp_str2;
13641 } else {
13642 pocc_params = tmp_str2;
13643 }
13644 tmp_str = tmp_str.substr(loc2 + 1, string::npos);
13645 module_arun = tmp_str;
13646 }
13647 if (LDEBUG) {
13648 cerr << __AFLOW_FUNC__ << " [3]" << endl;
13649 cerr << __AFLOW_FUNC__ << " proto=" << proto << endl;
13650 cerr << __AFLOW_FUNC__ << " pocc_params=" << pocc_params << endl;
13651 cerr << __AFLOW_FUNC__ << " pocc_tol=" << pocc_tol << endl;
13652 cerr << __AFLOW_FUNC__ << " pocc_arun=" << pocc_arun << endl;
13653 cerr << __AFLOW_FUNC__ << " module_arun=" << module_arun << endl;
13654 cerr << __AFLOW_FUNC__ << " tmp_str=" << tmp_str << endl;
13655 }
13656 loc2 = tmp_str.find(":");
13657 if (loc2 != string::npos && (loc2 + 1) < tmp_str.length()) {
13658 tmp_str2 = tmp_str.substr(0, loc2);
13659 if (tmp_str2.find(TAG_TITLE_POCC_ARUN) != string::npos) {
13660 pocc_arun = tmp_str2;
13661 } // more specific, look for first
13662 else if (tmp_str2.find(TAG_TITLE_ARUN) != string::npos) {
13663 module_arun = tmp_str2;
13664 } else if (tmp_str2.find(TAG_TITLE_POCC_TOL) != string::npos) {
13665 pocc_tol = tmp_str2;
13666 } else {
13667 pocc_params = tmp_str.substr(0, loc2);
13668 }
13669 tmp_str = pocc_arun.substr(loc2 + 1, string::npos);
13670 // what's next??
13671 }
13672 if (LDEBUG) {
13673 cerr << __AFLOW_FUNC__ << " [4]" << endl;
13674 cerr << __AFLOW_FUNC__ << " proto=" << proto << endl;
13675 cerr << __AFLOW_FUNC__ << " pocc_params=" << pocc_params << endl;
13676 cerr << __AFLOW_FUNC__ << " pocc_tol=" << pocc_tol << endl;
13677 cerr << __AFLOW_FUNC__ << " pocc_arun=" << pocc_arun << endl;
13678 cerr << __AFLOW_FUNC__ << " module_arun=" << module_arun << endl;
13679 cerr << __AFLOW_FUNC__ << " tmp_str=" << tmp_str << endl;
13680 }
13681
13682 aurostd::xoption proto_flags;
13683 proto_flags.push_attached("PROTO", proto + ":" + aurostd::joinWDelimiter(velements, ":"));
13684 proto_flags.push_attached("POCC_PARAMS", pocc_params);
13685 if (!pocc_tol.empty()) {
13686 tmp_str = pocc_tol;
13687 if (tmp_str.find(TAG_TOL) != string::npos) {
13688 aurostd::StringSubstInPlace(tmp_str, TAG_TITLE_POCC_TOL, ""); // remove 'TOL_'
13689 aurostd::StringSubstInPlace(tmp_str, TAG_TOL + SEP_TAG2, ""); // remove 'TOL_'
13690 aurostd::StringSubstInPlace(tmp_str, TAG_TOL, ""); // remove 'TOL_'
13691 aurostd::StringSubstInPlace(tmp_str, SEP_TAG2, ""); // remove 'TOL_'
13692 }
13693 proto_flags.push_attached("POCC_TOL", tmp_str);
13694 }
13695 if (LDEBUG) {
13696 cerr << __AFLOW_FUNC__ << " proto_flags.getattachedscheme(\"PROTO\")=" << proto_flags.getattachedscheme("PROTO") << endl;
13697 cerr << __AFLOW_FUNC__ << " proto_flags.getattachedscheme(\"POCC_PARAMS\")=" << proto_flags.getattachedscheme("POCC_PARAMS") << endl;
13698 cerr << __AFLOW_FUNC__ << " proto_flags.getattachedscheme(\"POCC_TOL\")=" << proto_flags.getattachedscheme("POCC_TOL") << endl;
13699 }
13700
13701 try {
13702 xstr = pflow::PROTO_LIBRARIES(proto_flags);
13703 break;
13704 } catch (aurostd::xerror& excpt) {
13705 xstr.clear(); // DX20191220 - uppercase to lowercase clear
13706 loc1 = elements_prototype_str.find('.', loc1 + 1);
13707 continue;
13708 }
13709 }
13710
13711 if (xstr.atoms.empty()) { // use generic
13712 message << "Cannot extract identifiable prototype from SYSTEM [" << pocc_input << "], using generic SYSTEM name as title";
13713 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, FileMESSAGE, oss, _LOGGER_WARNING_); // CO20200404
13714 return false;
13715 }
13716
13717 if (LDEBUG) {
13718 cerr << __AFLOW_FUNC__ << " xstr_found: " << endl;
13719 cerr << xstr << endl;
13720 }
13721
13722 if (xstr.species.size() != xstr.comp_each_type.size()) { // use generic
13723 message << "Cannot extract composition from prototype [" << proto << "], using generic SYSTEM name as title";
13724 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, FileMESSAGE, oss, _LOGGER_WARNING_); // CO20200404
13725 return false;
13726 }
13727
13728 pocc_settings.clear();
13729 pocc_settings.push_attached("PPS", pps);
13730 pocc_settings.push_attached("PROTO", proto);
13731 pocc_settings.push_attached("POCC_PARAMS", pocc_params);
13732 pocc_settings.push_attached("POCC_TOL", pocc_tol);
13733 pocc_settings.push_attached("POCC_ARUN", pocc_arun);
13734 pocc_settings.push_attached("MODULE_ARUN", module_arun);
13735
13736 return true;
13737 }
13738} // namespace pflow
13739
13740// ***************************************************************************
13741// pflow::PROTO_LIBRARIES
13742// ***************************************************************************
13743namespace pflow {
13745 const bool LDEBUG = (false || XHOST.DEBUG);
13746 stringstream message;
13747 if (LDEBUG) {
13748 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
13749 }
13750
13751 vector<string> tokens; // CO20181226
13752 vector<string> params;
13753 vector<string> vstr;
13754 vector<string> vstr_orig; // CO20181226
13755 vector<double> vnum;
13756 vector<double> vnum_orig; // CO20181226
13757 vector<vector<string>> vvstr; // CO20181226
13758 vector<vector<double>> vvnum; // CO20181226
13759 if (LDEBUG) {
13760 cerr << XPID << "pflow::PROTO: vpflow.getattachedscheme(\"PROTO\")=" << vpflow.getattachedscheme("PROTO") << endl;
13761 }
13762 if (LDEBUG) {
13763 cerr << XPID << "pflow::PROTO: vpflow.getattachedscheme(\"PROTO_ICSD_AFLOW\")=" << vpflow.getattachedscheme("PROTO_ICSD_AFLOW") << endl;
13764 }
13765 if (LDEBUG) {
13766 cerr << XPID << "pflow::PROTO: vpflow.flag(\"PROTO\")=" << vpflow.flag("PROTO") << endl;
13767 }
13768 if (LDEBUG) {
13769 cerr << XPID << "pflow::PROTO: vpflow.flag(\"PARAMS\")=" << vpflow.flag("PARAMS") << endl;
13770 }
13771 if (LDEBUG) {
13772 cerr << XPID << "pflow::PROTO: vpflow.flag(\"POCC_PARAMS\")=" << vpflow.flag("POCC_PARAMS") << endl; // CO20181226
13773 }
13774 if (LDEBUG) {
13775 cerr << XPID << "pflow::PROTO: vpflow.flag(\"POCC_TOL\")=" << vpflow.flag("POCC_TOL") << endl; // CO20181226
13776 }
13777 if (LDEBUG) {
13778 cerr << XPID << "pflow::PROTO: vpflow.flag(\"PROTO_ICSD_AFLOW\")=" << vpflow.flag("PROTO_ICSD_AFLOW") << endl;
13779 }
13780 if (LDEBUG) {
13781 cerr << XPID << "pflow::PROTO: vpflow.flag(\"PROTO::USE_ANRL_LATTICE_PARAM\")=" << vpflow.flag("PROTO::USE_ANRL_LATTICE_PARAM") << endl; // DX20190227 - add anrl params flag
13782 }
13783 aurostd::string2tokens(vpflow.getattachedscheme("PROTO"), params, ":");
13784
13785 if (params.empty()) {
13786 init::ErrorOption(vpflow.getattachedscheme("PROTO"), "pflow::PROTO",
13788 "aflow [options] --proto=label*[:speciesA*[:speciesB*]..[:volumeA*[:volumeB*].. | :volume]] [--params=..... [--hex]]",
13789 " --proto[_icsd]=ICSD_number.{ABC}[:speciesA*[:speciesB*]..[:volumeA*[:volumeB*].. | :volume]]", " --proto_icsd=label_ICSD_number",
13790 "options = [--server=xxxxxxx] [--vasp | --itc | --qe | --abinit | --aims | --cif | --abccar] [--params=... | --hex]]", "To get the list of prototypes --protos or --protos_icsd ."));
13791 }
13792
13793 // CO20181226 parsing label, species, volume, and pocc input
13794 const string labels_raw = params.at(0);
13795 aurostd::string2tokens(labels_raw, tokens, ",");
13796 if (tokens.size() != 1) {
13797 message << "Too many labels provided, --proto can only handle one label at at time: labels.size()==" << tokens.size();
13799 }
13800 string label; // params.at(0);
13801 if (!tokens.empty()) {
13802 label = tokens[0];
13803 }
13804
13805 PROTO_PARSE_INPUT(params, vvstr, vvnum, true, false); // CO20181226 - parse into vectors of strings (species) and numbers (volumes), skip first (label), no reverse (label)
13806 // ignore any multi-specifications
13807 vstr.clear();
13808 vstr_orig.clear();
13809 for (size_t i = 0; i < vvstr.size(); i++) {
13810 if (!vvstr[i].empty()) {
13811 vstr.push_back(vvstr[i][0]);
13812 vstr_orig.push_back(vvstr[i][0]);
13813 }
13814 } // SAVE ORIG
13815 vnum.clear();
13816 vnum_orig.clear();
13817 for (size_t i = 0; i < vvnum.size(); i++) {
13818 if (!vvnum[i].empty()) {
13819 vnum.push_back(vvnum[i][0]);
13820 vnum_orig.push_back(vvnum[i][0]);
13821 }
13822 } // SAVE ORIG
13823
13824 string parameters = vpflow.getattachedscheme("PARAMS");
13825
13826 // HE20250515
13827 // Check if the value in --proto is in the database
13828 const std::string uid = anrl::getPrototypeUID(label);
13829 const anrl::ProtoData pd = anrl::ProtoData::get();
13830
13831 // DX20190227 START
13832 // default without parameters is to use the atomic volume scaling method (i.e., a=-1)
13833 // --use_anrl_lattice_param forces the use of the original lattice parameter defined in ANRL (e.g., a=5.4)
13834 if (!parameters.empty() && vpflow.flag("PROTO::USE_ANRL_LATTICE_PARAM")) {
13835 message << "Cannot have both --params=<...> and --use_anrl_lattice_param at the same time; use one or the other.";
13837 } else if (parameters.empty() && vpflow.flag("PROTO::USE_ANRL_LATTICE_PARAM")) {
13838 parameters = "use_anrl_lattice_param";
13839 }
13840 // DX20190227 END
13841
13842 const string pocc_parameters_raw = vpflow.getattachedscheme("POCC_PARAMS"); // CO20181226
13843 const string pocc_tol = vpflow.getattachedscheme("POCC_TOL"); // CO20181226
13844 aurostd::string2tokens(pocc_parameters_raw, tokens, ",");
13845 if (!(tokens.empty() || tokens.size() == 1)) {
13846 message << "Too many sets of pocc_parameters provided, --proto can only handle one set of pocc_parameters at at time: pocc_parameters.size()==" << tokens.size();
13848 }
13849 string pocc_parameters;
13850 if (!tokens.empty()) {
13851 pocc_parameters = tokens[0];
13852 }
13853 const bool pocc = (!pocc_parameters.empty());
13854
13855 // cerr << params.at(0) << " " << params.size() << endl; for(size_t i=0;i<params.size();i++) cerr << params.at(i) << " "; cerr << endl;
13856
13857 xstructure str;
13858 deque<string> atomX;
13859 deque<double> volumeX;
13860 uint nspecies = 0; // CO20191110 - NOTE: nspeciesHTQC is what is expected from label (proto), nspecies is REAL input number of species separated by colons, not commas (different for pocc)
13861 bool alphabetic = true; // DEFAULT
13862
13863 // ***************************************************************************
13864 // MODE LIBRARY FROM HTQC OR ICSD
13865 if (uid.empty()) {
13866 nspecies = aflowlib::PrototypeLibrariesSpeciesNumber(label); // CO20181226 - recently revamped, now nspecies should be exact!
13867 } else {
13868 label = static_cast<string>(pd.content[uid]["label"]);
13869 nspecies = static_cast<uint>(pd.content[uid]["number_of_species"]);
13870 if (parameters.empty()) {
13871 parameters = static_cast<string>(pd.content[uid]["parameter_values"]);
13872 }
13873 }
13874 alphabetic = RequestedAlphabeticLabeling(label);
13875
13876 bool found = false;
13877 double vol = 0.0;
13878
13879 // CO20181226 START
13880 PROTO_TEST_INPUT(vvstr, vvnum, nspecies, pocc); // test if inputs are correct in number and type (not negative, etc.) //CO20191110 - note nspecies changes here if pocc, so below we use nspeciesHTQC to fetch correct proto
13881
13882 // CO20191110 - moved down from above so it prints updated values from pocc
13883 // DEBUG=true;
13884 if (LDEBUG) {
13885 cerr << __AFLOW_FUNC__ << " params.size()=" << params.size() << endl;
13886 }
13887 if (LDEBUG) {
13888 cerr << __AFLOW_FUNC__ << " vstr.size()=" << vstr.size() << endl; // CO20181226
13889 }
13890 if (LDEBUG) {
13891 cerr << __AFLOW_FUNC__ << " vnum.size()=" << vnum.size() << endl; // CO20181226
13892 }
13893 if (LDEBUG) {
13894 cerr << __AFLOW_FUNC__ << " pocc=" << pocc << endl;
13895 }
13896 if (LDEBUG) {
13897 cerr << __AFLOW_FUNC__ << " nspecies=" << nspecies << endl;
13898 }
13899 if (LDEBUG) {
13900 cerr << __AFLOW_FUNC__ << " alphabetic=" << alphabetic << endl;
13901 }
13902 if (LDEBUG) {
13903 cerr << __AFLOW_FUNC__ << " label=" << label << endl;
13904 }
13905 if (LDEBUG) {
13906 cerr << __AFLOW_FUNC__ << " parameters=" << parameters << endl;
13907 }
13908 if (LDEBUG) {
13909 cerr << __AFLOW_FUNC__ << " pocc_parameters=" << pocc_parameters << endl; // CO20181226
13910 }
13911
13912 // get a vector of species and volume that fits exactly what is expected for xproto
13913 if (pocc) {
13914 vstr.clear();
13915 for (size_t i = 0; i < nspecies && i < vstr_orig.size(); i++) {
13916 vstr.push_back(vstr_orig[i]);
13917 }
13918 vnum.clear();
13919 for (size_t i = 0; i < nspecies && i < vnum_orig.size(); i++) {
13920 vnum.push_back(vnum_orig[i]);
13921 }
13922 }
13923
13924 const int mode = 0;
13925 if (vstr.empty()) {
13926 if (LDEBUG) {
13927 cerr << __AFLOW_FUNC__ << " label" << endl;
13928 }
13929 str = aflowlib::PrototypeLibraries(cerr, label, parameters, mode);
13930 found = true; // good for binary, ternary etc etc...
13931 }
13932
13933 atomX.clear();
13934 for (size_t i = 0; i < nspecies && i < vstr.size(); i++) {
13935 atomX.push_back(vstr[i]);
13936 }
13937
13938 if (!found && vstr.size() == nspecies && vnum.empty()) {
13939 if (LDEBUG) {
13940 cerr << __AFLOW_FUNC__ << " label:species:species..." << endl;
13941 }
13942 if (LDEBUG) {
13943 for (size_t i = 0; i < atomX.size(); i++) {
13944 cerr << __AFLOW_FUNC__ << " atomX[" << i << "]=" << atomX[i] << endl;
13945 }
13946 }
13947 str = aflowlib::PrototypeLibraries(cerr, label, parameters, atomX, mode);
13948 found = true;
13949 }
13950
13951 if (!found && vstr.size() == nspecies && (vnum.size() == 1 || vstr.size() == vnum.size())) {
13952 volumeX.clear();
13953 if (vnum.size() == 1) {
13954 if (LDEBUG) {
13955 cerr << __AFLOW_FUNC__ << " label:species:species...:volume" << endl;
13956 }
13957 vol = vnum[0];
13958 for (size_t i = 0; i < nspecies && i < atomX.size(); i++) {
13959 volumeX.push_back(0);
13960 }
13961 } else {
13962 if (LDEBUG) {
13963 cerr << __AFLOW_FUNC__ << " label:species:species...:volume:volume..." << endl;
13964 }
13965 vol = -1.0;
13966 for (size_t i = 0; i < nspecies && i < vnum.size(); i++) {
13967 volumeX.push_back(vnum[i]);
13968 }
13969 }
13970 if (LDEBUG) {
13971 for (size_t i = 0; i < volumeX.size(); i++) {
13972 cerr << __AFLOW_FUNC__ << " volumeX[" << i << "]=" << volumeX[i] << endl;
13973 }
13974 cerr << __AFLOW_FUNC__ << " vol=" << vol << endl;
13975 }
13976 str = aflowlib::PrototypeLibraries(cerr, label, parameters, atomX, volumeX, vol, mode);
13977 found = true;
13978 }
13979
13980 // CO20181226 STOP
13981
13982 if (!found) {
13983 message << "Unknown label+input specification (label=" << label << ",nspecies=" << nspecies << ",ninput=" << params.size() - 1 << ")"; // params.size()-1 means skip label
13984 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, message, _INPUT_NUMBER_); // CO20180801
13985 }
13986
13987 // CO20181226 - try to POCC structure
13988 if (pocc) {
13989 pflow::FIX_POCC_PARAMS(str, pocc_parameters);
13990 convertXStr2POCC(str, pocc_parameters, vstr_orig, vnum_orig);
13991 setPOCCTOL(str, pocc_tol);
13992 if (!pflow::checkAnionSublattice(str)) { // CO20210201
13993 if (!XHOST.vflag_control.flag("FORCE_POCC")) {
13994 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "Found non-anion in anion sublattice. Please check (and run with --force_pocc).", _VALUE_ILLEGAL_);
13995 }
13996 }
13997 }
13998
13999 if (LDEBUG) {
14000 for (size_t i = 0; i < str.species.size(); i++) {
14001 if (!str.species[i].empty()) {
14002 cerr << "DEBUG specie(" << i << ")=" << str.species[i] << endl;
14003 }
14004 }
14005 }
14006 // if(str.AlphabeticSpecie(0,1)==false) str.SwapSpecie(0,1);
14007
14008 if (!pocc) { // CO20181226
14009 // now checking QUANTUM ESPRESSO
14010 if (vpflow.flag("PROTO::QE")) {
14011 str.xstructure2qe();
14012 }
14013
14014 // now checking ABINIT
14015 if (vpflow.flag("PROTO::ABINIT")) {
14016 str.xstructure2abinit();
14017 }
14018
14019 // now checking AIMS
14020 if (vpflow.flag("PROTO::AIMS")) {
14021 str.xstructure2aims();
14022 }
14023
14024 // now checking ELK //DX20200313
14025 if (vpflow.flag("PROTO::ELK")) {
14026 str.xstructure2elk();
14027 }
14028
14029 // now checking LMP //SD20240111
14030 if (vpflow.flag("PROTO::LMP")) {
14031 str.xstructure2lmp();
14032 }
14033
14034 // now checking ITC
14035 if (vpflow.flag("PROTO::ITC")) {
14036 str.xstructure2itc(); // CO20220613
14037 }
14038 }
14039
14040 // DX20190123 - add CIF/ABCCAR - START
14041 // now checking CIF
14042 if (vpflow.flag("PROTO::CIF")) {
14043 str.xstructure2cif();
14044 }
14045
14046 // now checking ABCCAR
14047 if (vpflow.flag("PROTO::ABCCAR")) {
14048 str.xstructure2abccar();
14049 }
14050 // DX20190123 - add CIF/ABCCAR - END
14051
14052 if (LDEBUG) {
14053 cerr << __AFLOW_FUNC__ << " END" << endl;
14054 }
14055 return str;
14056 }
14057} // namespace pflow
14058
14059// ***************************************************************************
14060// pflow::PROTO_AFLOW
14061// ***************************************************************************
14062// struct _AVASP_PROTO {
14063// vector<string> ucell;
14064// vector<int> vkppra;
14065// vector<double> vpressure;
14066// aurostd::xoptions vparams;
14067// };
14068
14069namespace pflow {
14070 bool PROTO_AFLOW(aurostd::xoption vpflow, bool flag_REVERSE) { // too many options
14071 const bool LDEBUG = (false || XHOST.DEBUG);
14072 if (LDEBUG) {
14073 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
14074 }
14075
14076 // check prototypes
14077 _AVASP_PROTO PARAMS;
14078 PARAMS.ucell.clear();
14079
14080 if (LDEBUG) {
14081 cerr << __AFLOW_FUNC__ << " vpflow.getattachedscheme(\"PROTO_AFLOW\")=" << vpflow.getattachedscheme("PROTO_AFLOW") << endl;
14082 }
14083 aurostd::string2tokens(vpflow.getattachedscheme("PROTO_AFLOW"), PARAMS.ucell, ":");
14084 if (LDEBUG) {
14085 cerr << __AFLOW_FUNC__ << " PARAMS.ucell.size()=" << PARAMS.ucell.size() << endl;
14086 }
14087
14088 // check usage
14089 if (LDEBUG) {
14090 cerr << __AFLOW_FUNC__ << " CHECK USAGE" << endl;
14091 }
14092 if (vpflow.flag("PROTO_AFLOW::USAGE") || PARAMS.ucell.empty()) {
14093 init::MessageOption(vpflow.getattachedscheme("PROTO_AFLOW"), "pflow::PROTO_AFLOW",
14095 "aflow [options] --aflow_proto[|_icsd]=label*:speciesA*[:speciesB*][:volumeA*[:volumeB*]|:volume] [--params=... [--hex]]", " options:", " --usage",
14096 " --potential=pot_LDA | pot_GGA | potpaw_LDA | potpaw_GGA | potpaw_PBE | potpaw_LDA_KIN | potpaw_PBE_KIN ", " --potential_complete",
14097 " --module=[APL|QHA|AAPL]", " --apl_supercell=NxNxN", " --usage", " --missing", " --noautopp",
14098 " --bader (default: DEFAULT_VASP_FORCE_OPTION_BADER)", " --spin_remove_relax_1 (default: DEFAULT_VASP_FORCE_OPTION_SPIN_REMOVE_RELAX_1)",
14099 " --spin_remove_relax_2 (default: DEFAULT_VASP_FORCE_OPTION_SPIN_REMOVE_RELAX_2)",
14100 " --kscheme=[M | G] (default: DEFAULT_KSCHEME in .aflow.rc) --kscheme_static=[M | G] (default: DEFAULT_KSCHEME_STATIC in .aflow.rc)",
14101 " --kppra=NNNN (default: DEFAULT_KPPRA in .aflow.rc) --kppra_static=NNNN (default: DEFAULT_KPPRA_STATIC in .aflow.rc) --bands_grid=NNNN (default: "
14102 "DEFAULT_BANDS_GRID in .aflow.rc)",
14103 " --enmax_multiply=NNNN (default:VASP_PREC_ENMAX_XXXX in .aflow.rc)", " --pressure=0,1,2 (kB) (default:0.0)",
14104 " --potim=XXX (default 0.05) (VASP) ", " --relax_type=[ALL | IONS | CELL_SHAPE | CELL_VOLUME | IONS_CELL_VOLUME] ",
14105 " --relax_mode=[ENERGY | FORCES | ENERGY_FORCES | FORCES_ENERGY] (default: DEFAULT_VASP_FORCE_OPTION_RELAX_MODE_SCHEME in .aflow.rc) (VASP) ",
14106 " --relax_count=XX (default: DEFAULT_VASP_FORCE_OPTION_RELAX_COUNT in .aflow.rc) (VASP) ", " --run_relax_static",
14107 " --run_relax_static_bands", " --run_static", " --run_static_bands",
14108 " --precision=[(LOW | MEDIUM | NORMAL | HIGH | ACCURATE), PRESERVED] (default: DEFAULT_VASP_FORCE_OPTION_PREC_SCHEME in .aflow.rc) (VASP) ",
14109 " --algorithm=[(NORMAL | VERYFAST | FAST | ALL | DAMPED), PRESERVED] (default: DEFAULT_VASP_FORCE_OPTION_ALGO_SCHEME in .aflow.rc) (VASP) ",
14110 " --metagga=[TPSS | RTPSS | M06L | MBJL | SCAN | MS0 | MS1 | MS2 | NONE] (default: DEFAULT_VASP_FORCE_OPTION_METAGGA_SCHEME in .aflow.rc) (VASP) ",
14111 " --ivdw=[number_for_VASP_see_manual_for_IVDW | 0] (default: DEFAULT_VASP_FORCE_OPTION_IVDW_SCHEME in .aflow.rc) (VASP) ",
14112 " --type=[METAL | INSULATOR | SEMICONDUCTOR | DEFAULT] (default: DEFAULT_VASP_FORCE_OPTION_TYPE_SCHEME in .aflow.rc) (VASP) ",
14113 " --convert_unit_cell= [SPRIM, SCONV, NIGGLI, MINK, INCELL, COMPACT, WS, CART, FRAC, PRES] ", " --volume_plus_equal=XXX ",
14114 " --volume_multiply_equal=XXX ", " --volume_preserved ", " --ediffg=XXX (default: DEFAULT_VASP_PREC_EDIFFG in .aflow.rc) (VASP) ",
14115 " --ldau2", " --noldau2", " --neglect_nomix", " --stdout", " --qe", " --abinit",
14116 " --aims", " --list", " --params=.... { check aflow --readme=anrl }", " --hex { check aflow --readme=anrl }"));
14117 return true; // CO20200624 - the option was expressed successfully
14118 }
14119 if (LDEBUG) {
14120 cerr << __AFLOW_FUNC__ << " vpflow.getattachedscheme(\"PROTO_AFLOW::USAGE\")=" << vpflow.flag("PROTO_AFLOW::USAGE") << endl;
14121 }
14122
14123 // label
14124 string string_LABEL = PARAMS.ucell.at(0);
14125
14126 // if(LDEBUG) { cerr << __AFLOW_FUNC__ << " " << string_LABEL << " " << PARAMS.ucell.size() << endl; for(size_t i=0;i<PARAMS.ucell.size();i++) cerr << PARAMS.ucell.at(i) << " "; cerr << endl;}
14127
14128 // check potential
14129 if (LDEBUG) {
14130 cerr << __AFLOW_FUNC__ << " CHECK POTENTIAL" << endl;
14131 }
14132
14133 string string_POTENTIAL = _AVASP_PSEUDOPOTENTIAL_AUTO_;
14134 if (LDEBUG) {
14135 cerr << __AFLOW_FUNC__ << " vpflow.getattachedscheme(\"PROTO_AFLOW::POTENTIAL\")=" << vpflow.getattachedscheme("PROTO_AFLOW::POTENTIAL") << endl;
14136 }
14137 string params_potential = vpflow.getattachedscheme("PROTO_AFLOW::POTENTIAL");
14138 if (params_potential == _AVASP_PSEUDOPOTENTIAL_AUTO_) {
14139 string_POTENTIAL = _AVASP_PSEUDOPOTENTIAL_AUTO_;
14140 }
14141 aurostd::StringSubstInPlace(params_potential, "pot", "");
14142 aurostd::StringSubstInPlace(params_potential, "POT", "");
14143 aurostd::StringSubstInPlace(params_potential, "_", "");
14144 aurostd::StringSubstInPlace(params_potential, "paw", "PAW");
14145 if (params_potential == "LDA") {
14146 string_POTENTIAL = DEFAULT_VASP_POTCAR_DIR_POT_LDA;
14147 }
14148 if (params_potential == "GGA") {
14149 string_POTENTIAL = DEFAULT_VASP_POTCAR_DIR_POT_GGA;
14150 }
14151 if (params_potential == "PBE") {
14152 string_POTENTIAL = DEFAULT_VASP_POTCAR_DIR_POT_PBE;
14153 }
14154 if (params_potential == "PAWLDA") {
14155 string_POTENTIAL = DEFAULT_VASP_POTCAR_DIR_POTPAW_LDA;
14156 }
14157 if (params_potential == "PAWGGA") {
14158 string_POTENTIAL = DEFAULT_VASP_POTCAR_DIR_POTPAW_GGA;
14159 }
14160 if (params_potential == "PAWPBE") {
14161 string_POTENTIAL = DEFAULT_VASP_POTCAR_DIR_POTPAW_PBE;
14162 }
14163 if (params_potential == "PAWLDAKIN") {
14164 string_POTENTIAL = DEFAULT_VASP_POTCAR_DIR_POTPAW_LDA_KIN;
14165 }
14166 if (params_potential == "PAWPBEKIN") {
14167 string_POTENTIAL = DEFAULT_VASP_POTCAR_DIR_POTPAW_PBE_KIN;
14168 }
14169 if (LDEBUG) {
14170 cerr << __AFLOW_FUNC__ << " string_POTENTIAL=" << string_POTENTIAL << endl;
14171 }
14172
14173 // PARAMS.vparams.flag("AFLOWING_STRING_POTENTIAL",vpflow.flag("PROTO_AFLOW::POTENTIAL"));
14174 // if(PARAMS.vparams.flag("AFLOWING_STRING_POTENTIAL")) PARAMS.vparams.push_attached("AFLOWING_STRING_POTENTIAL",vpflow.getattachedscheme("PROTO_AFLOW::POTENTIAL"));
14175
14176 // check potential_type //CO20191110
14177 if (LDEBUG) {
14178 cerr << __AFLOW_FUNC__ << " CHECK POTENTIAL_TYPE" << endl; // CO20191110
14179 }
14180 if (vpflow.flag("PROTO_AFLOW::POTENTIAL_TYPE")) {
14182 }
14183 if (LDEBUG) {
14184 cerr << __AFLOW_FUNC__ << " vpflow.getattachedscheme(\"PROTO_AFLOW::POTENTIAL_TYPE\")=" << vpflow.flag("PROTO_AFLOW::POTENTIAL_TYPE") << endl; // CO20191110
14185 }
14186
14187 // check potential_complete
14188 if (LDEBUG) {
14189 cerr << __AFLOW_FUNC__ << " CHECK POTENTIAL_COMPLETE" << endl;
14190 }
14191 if (vpflow.flag("PROTO_AFLOW::POTENTIAL_COMPLETE")) {
14193 }
14194 if (LDEBUG) {
14195 cerr << __AFLOW_FUNC__ << " vpflow.getattachedscheme(\"PROTO_AFLOW::POTENTIAL_COMPLETE\")=" << vpflow.flag("PROTO_AFLOW::POTENTIAL_COMPLETE") << endl;
14196 }
14197
14198 if (LDEBUG) {
14199 cerr << __AFLOW_FUNC__ << " string_POTENTIAL=" << string_POTENTIAL << endl;
14200 }
14201 PARAMS.vparams.push_attached("AFLOWIN_STRING::POTENTIAL", string_POTENTIAL);
14202
14203 // reverse
14204 if (LDEBUG) {
14205 cerr << __AFLOW_FUNC__ << " CHECK REVERSE" << endl;
14206 }
14207 PARAMS.vparams.flag("AFLOWIN_FLAG::REVERSE", flag_REVERSE);
14208 if (LDEBUG) {
14209 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::REVERSE\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::REVERSE") << endl;
14210 }
14211
14212 // check missing
14213 if (LDEBUG) {
14214 cerr << __AFLOW_FUNC__ << " CHECK MISSING" << endl;
14215 }
14216 PARAMS.vparams.flag("AFLOWIN_FLAG::MISSING", vpflow.flag("PROTO_AFLOW::MISSING"));
14217 if (LDEBUG) {
14218 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::MISSING\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::MISSING") << endl;
14219 }
14220
14221 // check noautopp
14222 if (LDEBUG) {
14223 cerr << __AFLOW_FUNC__ << " CHECK NOAUTOPP" << endl;
14224 }
14225 PARAMS.vparams.flag("AFLOWIN_FLAG::NOAUTOPP", vpflow.flag("PROTO_AFLOW::NOAUTOPP"));
14226 if (LDEBUG) {
14227 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::NOAUTOPP\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::NOAUTOPP") << endl;
14228 }
14229
14230 // check bader //CO20181226
14231 if (LDEBUG) {
14232 cerr << __AFLOW_FUNC__ << " CHECK BADER" << endl;
14233 }
14234 PARAMS.vparams.flag("AFLOWIN_FLAG::BADER", vpflow.flag("PROTO_AFLOW::BADER"));
14235 if (LDEBUG) {
14236 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::BADER\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::BADER") << endl;
14237 }
14238
14239 // check spin_remove_relax_1 //CO20181226
14240 if (LDEBUG) {
14241 cerr << __AFLOW_FUNC__ << " CHECK SPIN_REMOVE_RELAX_1" << endl;
14242 }
14243 PARAMS.vparams.flag("AFLOWIN_FLAG::SPIN_REMOVE_RELAX_1", vpflow.flag("PROTO_AFLOW::SPIN_REMOVE_RELAX_1"));
14244 if (LDEBUG) {
14245 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::SPIN_REMOVE_RELAX_1\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::SPIN_REMOVE_RELAX_1") << endl;
14246 }
14247
14248 // check spin_remove_relax_2 //CO20181226
14249 if (LDEBUG) {
14250 cerr << __AFLOW_FUNC__ << " CHECK SPIN_REMOVE_RELAX_2" << endl;
14251 }
14252 PARAMS.vparams.flag("AFLOWIN_FLAG::SPIN_REMOVE_RELAX_2", vpflow.flag("PROTO_AFLOW::SPIN_REMOVE_RELAX_2"));
14253 if (LDEBUG) {
14254 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::SPIN_REMOVE_RELAX_2\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::SPIN_REMOVE_RELAX_2") << endl;
14255 }
14256
14257 // check ldau
14258 if (LDEBUG) {
14259 cerr << __AFLOW_FUNC__ << " CHECK LDAU" << endl;
14260 }
14261 PARAMS.vparams.flag("AFLOWIN_FLAG::AUTOLDAU", vpflow.flag("PROTO_AFLOW::LDAU"));
14262 if (LDEBUG) {
14263 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::AUTOLDAU\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::AUTOLDAU") << endl;
14264 }
14265
14266 // check noldau
14267 if (LDEBUG) {
14268 cerr << __AFLOW_FUNC__ << " CHECK NOLDAU" << endl;
14269 }
14270 PARAMS.vparams.flag("AFLOWIN_FLAG::AUTONOLDAU", vpflow.flag("PROTO_AFLOW::NOLDAU"));
14271 if (LDEBUG) {
14272 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::AUTONOLDAU\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::AUTONOLDAU") << endl;
14273 }
14274
14275 // check neglect_nomix
14276 if (LDEBUG) {
14277 cerr << __AFLOW_FUNC__ << " CHECK NEGLECT_NOMIX" << endl;
14278 }
14279 PARAMS.vparams.flag("AFLOWIN_FLAG::NEGLECT_NOMIX", vpflow.flag("PROTO_AFLOW::NEGLECT_NOMIX"));
14280 if (LDEBUG) {
14281 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::NEGLECT_NOMIX\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::NEGLECT_NOMIX") << endl;
14282 }
14283
14284 // check stdout
14285 if (LDEBUG) {
14286 cerr << __AFLOW_FUNC__ << " CHECK STDOUT" << endl;
14287 }
14288 PARAMS.vparams.flag("AFLOWIN_FLAG::STDOUT", vpflow.flag("PROTO_AFLOW::STDOUT"));
14289 if (LDEBUG) {
14290 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::STDOUT\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::STDOUT") << endl;
14291 }
14292
14293 // check module
14294 if (LDEBUG) {
14295 cerr << __AFLOW_FUNC__ << " CHECK MODULE" << endl;
14296 }
14297 PARAMS.vparams.flag("AFLOWIN_FLAG::MODULE", vpflow.flag("AFLOW::MODULE"));
14298 if (vpflow.flag("AFLOW::MODULE")) {
14299 PARAMS.vparams.push_attached("AFLOWIN_FLAG::MODULE", vpflow.getattachedscheme("AFLOW::MODULE"));
14300 }
14301 if (LDEBUG) {
14302 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::MODULE\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::MODULE") << endl;
14303 }
14304
14305 // check apl_supercell
14306 if (LDEBUG) {
14307 cerr << __AFLOW_FUNC__ << " CHECK APL_SUPERCELL" << endl;
14308 }
14309 PARAMS.vparams.flag("AFLOWIN_FLAG::APL_SUPERCELL", vpflow.flag("PROTO_AFLOW::APL_SUPERCELL"));
14310 if (vpflow.flag("PROTO_AFLOW::APL_SUPERCELL")) {
14311 PARAMS.vparams.push_attached("AFLOWIN_FLAG::APL_SUPERCELL", vpflow.getattachedscheme("PROTO_AFLOW::APL_SUPERCELL"));
14312 }
14313 if (LDEBUG) {
14314 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::APL_SUPERCELL\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::APL_SUPERCELL") << endl;
14315 }
14316
14317 // check potim
14318 if (LDEBUG) {
14319 cerr << __AFLOW_FUNC__ << " CHECK POTIM" << endl;
14320 }
14321 PARAMS.vparams.flag("AFLOWIN_FLAG::POTIM", vpflow.flag("PROTO_AFLOW::POTIM"));
14322 if (vpflow.flag("PROTO_AFLOW::POTIM")) {
14323 PARAMS.vparams.push_attached("AFLOWIN_FLAG::POTIM", vpflow.getattachedscheme("PROTO_AFLOW::POTIM"));
14324 }
14325 if (LDEBUG) {
14326 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::POTIM\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::POTIM") << endl;
14327 }
14328
14329 // check precision
14330 if (LDEBUG) {
14331 cerr << __AFLOW_FUNC__ << " CHECK PRECISION" << endl;
14332 }
14333 PARAMS.vparams.flag("AFLOWIN_FLAG::PRECISION", vpflow.flag("PROTO_AFLOW::PRECISION"));
14334 if (vpflow.flag("PROTO_AFLOW::PRECISION")) {
14335 PARAMS.vparams.push_attached("AFLOWIN_FLAG::PRECISION", vpflow.getattachedscheme("PROTO_AFLOW::PRECISION"));
14336 }
14337 if (LDEBUG) {
14338 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::PRECISION\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::PRECISION") << endl;
14339 }
14340
14341 // check algorithm
14342 if (LDEBUG) {
14343 cerr << __AFLOW_FUNC__ << " CHECK ALGORITHM" << endl;
14344 }
14345 PARAMS.vparams.flag("AFLOWIN_FLAG::ALGORITHM", vpflow.flag("PROTO_AFLOW::ALGORITHM"));
14346 if (vpflow.flag("PROTO_AFLOW::ALGORITHM")) {
14347 PARAMS.vparams.push_attached("AFLOWIN_FLAG::ALGORITHM", vpflow.getattachedscheme("PROTO_AFLOW::ALGORITHM"));
14348 }
14349 if (LDEBUG) {
14350 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::ALGORITHM\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::ALGORITHM") << endl;
14351 }
14352
14353 // check metagga
14354 if (LDEBUG) {
14355 cerr << __AFLOW_FUNC__ << " CHECK METAGGA" << endl;
14356 }
14357 PARAMS.vparams.flag("AFLOWIN_FLAG::METAGGA", vpflow.flag("PROTO_AFLOW::METAGGA"));
14358 if (vpflow.flag("PROTO_AFLOW::METAGGA")) {
14359 PARAMS.vparams.push_attached("AFLOWIN_FLAG::METAGGA", vpflow.getattachedscheme("PROTO_AFLOW::METAGGA"));
14360 }
14361 if (LDEBUG) {
14362 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::METAGGA\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::METAGGA") << endl;
14363 }
14364
14365 // check ivdw
14366 if (LDEBUG) {
14367 cerr << __AFLOW_FUNC__ << " CHECK IVDW" << endl;
14368 }
14369 PARAMS.vparams.flag("AFLOWIN_FLAG::IVDW", vpflow.flag("PROTO_AFLOW::IVDW"));
14370 if (vpflow.flag("PROTO_AFLOW::IVDW")) {
14371 PARAMS.vparams.push_attached("AFLOWIN_FLAG::IVDW", vpflow.getattachedscheme("PROTO_AFLOW::IVDW"));
14372 }
14373 if (LDEBUG) {
14374 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::IVDW\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::IVDW") << endl;
14375 }
14376
14377 // check relax_type
14378 if (LDEBUG) {
14379 cerr << __AFLOW_FUNC__ << " CHECK RELAX_TYPE" << endl;
14380 }
14381 PARAMS.vparams.flag("AFLOWIN_FLAG::RELAX_TYPE", vpflow.flag("PROTO_AFLOW::RELAX_TYPE"));
14382 if (vpflow.flag("PROTO_AFLOW::RELAX_TYPE")) {
14383 PARAMS.vparams.push_attached("AFLOWIN_FLAG::RELAX_TYPE", vpflow.getattachedscheme("PROTO_AFLOW::RELAX_TYPE"));
14384 }
14385 if (LDEBUG) {
14386 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RELAX_TYPE\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RELAX_TYPE") << endl;
14387 }
14388
14389 // check relax_mode
14390 if (LDEBUG) {
14391 cerr << __AFLOW_FUNC__ << " CHECK RELAX_MODE" << endl;
14392 }
14393 PARAMS.vparams.flag("AFLOWIN_FLAG::RELAX_MODE", vpflow.flag("PROTO_AFLOW::RELAX_MODE"));
14394 if (vpflow.flag("PROTO_AFLOW::RELAX_MODE")) {
14395 PARAMS.vparams.push_attached("AFLOWIN_FLAG::RELAX_MODE", vpflow.getattachedscheme("PROTO_AFLOW::RELAX_MODE"));
14396 }
14397 if (LDEBUG) {
14398 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RELAX_MODE\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RELAX_MODE") << endl;
14399 }
14400
14401 // check relax_count //CO20181226
14402 if (LDEBUG) {
14403 cerr << __AFLOW_FUNC__ << " CHECK RELAX_COUNT" << endl;
14404 }
14405 PARAMS.vparams.flag("AFLOWIN_FLAG::RELAX_COUNT", vpflow.flag("PROTO_AFLOW::RELAX_COUNT"));
14406 if (vpflow.flag("PROTO_AFLOW::RELAX_COUNT")) {
14407 PARAMS.vparams.push_attached("AFLOWIN_FLAG::RELAX_COUNT", vpflow.getattachedscheme("PROTO_AFLOW::RELAX_COUNT"));
14408 }
14409 if (LDEBUG) {
14410 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RELAX_COUNT\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RELAX_COUNT") << endl;
14411 }
14412 if (LDEBUG) {
14413 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::RELAX_COUNT\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::RELAX_COUNT") << endl;
14414 }
14415
14416 // check run_relax_static //CO20181226
14417 if (LDEBUG) {
14418 cerr << __AFLOW_FUNC__ << " CHECK RUN_RELAX_STATIC" << endl;
14419 }
14420 PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_RELAX_STATIC", vpflow.flag("PROTO_AFLOW::RUN_RELAX_STATIC"));
14421 if (LDEBUG) {
14422 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RUN_RELAX_STATIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_RELAX_STATIC") << endl;
14423 }
14424
14425 // check run_relax_static_bands //CO20181226
14426 if (LDEBUG) {
14427 cerr << __AFLOW_FUNC__ << " CHECK RUN_RELAX_STATIC_BANDS" << endl;
14428 }
14429 PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_RELAX_STATIC_BANDS", vpflow.flag("PROTO_AFLOW::RUN_RELAX_STATIC_BANDS"));
14430 if (LDEBUG) {
14431 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RUN_RELAX_STATIC_BANDS\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_RELAX_STATIC_BANDS") << endl;
14432 }
14433
14434 // check run_relax_static_dielectric
14435 if (LDEBUG) {
14436 cerr << __AFLOW_FUNC__ << " CHECK RUN_RELAX_STATIC_DIELECTRIC" << endl;
14437 }
14438 PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_RELAX_STATIC_DIELECTRIC", vpflow.flag("PROTO_AFLOW::RUN_RELAX_STATIC_DIELECTRIC"));
14439 if (LDEBUG) {
14440 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RUN_RELAX_STATIC_DIELECTRIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_RELAX_STATIC_DIELECTRIC") << endl;
14441 }
14442
14443 // check run_static //CO20181226
14444 if (LDEBUG) {
14445 cerr << __AFLOW_FUNC__ << " CHECK RUN_STATIC" << endl;
14446 }
14447 PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_STATIC", vpflow.flag("PROTO_AFLOW::RUN_STATIC"));
14448 if (LDEBUG) {
14449 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RUN_STATIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_STATIC") << endl;
14450 }
14451
14452 // check run_static_bands //CO20181226
14453 if (LDEBUG) {
14454 cerr << __AFLOW_FUNC__ << " CHECK RUN_STATIC_BANDS" << endl;
14455 }
14456 PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_STATIC_BANDS", vpflow.flag("PROTO_AFLOW::RUN_STATIC_BANDS"));
14457 if (LDEBUG) {
14458 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RUN_STATIC_BANDS\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_STATIC_BANDS") << endl;
14459 }
14460
14461 if (LDEBUG) {
14462 cerr << __AFLOW_FUNC__ << " CHECK RUN_STATIC_DIELECTRIC" << endl;
14463 }
14464 PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_STATIC_DIELECTRIC", vpflow.flag("PROTO_AFLOW::RUN_STATIC_DIELECTRIC"));
14465 if (LDEBUG) {
14466 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RUN_STATIC_DIELECTRIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_STATIC_DIELECTRIC") << endl;
14467 }
14468
14469 // check type
14470 if (LDEBUG) {
14471 cerr << __AFLOW_FUNC__ << " CHECK TYPE" << endl;
14472 }
14473 PARAMS.vparams.flag("AFLOWIN_FLAG::TYPE", vpflow.flag("PROTO_AFLOW::TYPE"));
14474 if (vpflow.flag("PROTO_AFLOW::TYPE")) {
14475 PARAMS.vparams.push_attached("AFLOWIN_FLAG::TYPE", vpflow.getattachedscheme("PROTO_AFLOW::TYPE"));
14476 }
14477 if (LDEBUG) {
14478 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::TYPE\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::TYPE") << endl;
14479 }
14480
14481 // check CONVERT_UNIT_CELL
14482 if (LDEBUG) {
14483 cerr << __AFLOW_FUNC__ << " CHECK CONVERT_UNIT_CELL" << endl;
14484 }
14485 PARAMS.vparams.flag("AFLOWIN_FLAG::CONVERT_UNIT_CELL", vpflow.flag("PROTO_AFLOW::CONVERT_UNIT_CELL"));
14486 if (vpflow.flag("PROTO_AFLOW::CONVERT_UNIT_CELL")) {
14487 PARAMS.vparams.push_attached("AFLOWIN_FLAG::CONVERT_UNIT_CELL", vpflow.getattachedscheme("PROTO_AFLOW::CONVERT_UNIT_CELL"));
14488 }
14489 if (LDEBUG) {
14490 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::CONVERT_UNIT_CELL\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::CONVERT_UNIT_CELL") << endl;
14491 }
14492
14493 // check volume_plus_equal
14494 if (LDEBUG) {
14495 cerr << __AFLOW_FUNC__ << " CHECK VOLUME_PLUS_EQUAL" << endl;
14496 }
14497 PARAMS.vparams.flag("AFLOWIN_FLAG::VOLUME_PLUS_EQUAL", vpflow.flag("PROTO_AFLOW::VOLUME_PLUS_EQUAL"));
14498 if (vpflow.flag("PROTO_AFLOW::VOLUME_PLUS_EQUAL")) {
14499 PARAMS.vparams.push_attached("AFLOWIN_FLAG::VOLUME_PLUS_EQUAL", vpflow.getattachedscheme("PROTO_AFLOW::VOLUME_PLUS_EQUAL"));
14500 }
14501 if (LDEBUG) {
14502 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::VOLUME_PLUS_EQUAL\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::VOLUME_PLUS_EQUAL") << endl;
14503 }
14504
14505 // check volume_multiply_equal
14506 if (LDEBUG) {
14507 cerr << __AFLOW_FUNC__ << " CHECK VOLUME_MULTIPLY_EQUAL" << endl;
14508 }
14509 PARAMS.vparams.flag("AFLOWIN_FLAG::VOLUME_MULTIPLY_EQUAL", vpflow.flag("PROTO_AFLOW::VOLUME_MULTIPLY_EQUAL"));
14510 if (vpflow.flag("PROTO_AFLOW::VOLUME_MULTIPLY_EQUAL")) {
14511 PARAMS.vparams.push_attached("AFLOWIN_FLAG::VOLUME_MULTIPLY_EQUAL", vpflow.getattachedscheme("PROTO_AFLOW::VOLUME_MULTIPLY_EQUAL"));
14512 }
14513 if (LDEBUG) {
14514 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::VOLUME_MULTIPLY_EQUAL\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::VOLUME_MULTIPLY_EQUAL") << endl;
14515 }
14516
14517 // check volume_preserved //CO20181226
14518 if (LDEBUG) {
14519 cerr << __AFLOW_FUNC__ << " CHECK VOLUME_PRESERVED" << endl;
14520 }
14521 PARAMS.vparams.flag("AFLOWIN_FLAG::VOLUME_PRESERVED", vpflow.flag("PROTO_AFLOW::VOLUME_PRESERVED"));
14522 if (LDEBUG) {
14523 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::VOLUME_PRESERVED\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::VOLUME_PRESERVED") << endl;
14524 }
14525
14526 // check ediffg
14527 if (LDEBUG) {
14528 cerr << __AFLOW_FUNC__ << " CHECK EDIFFG" << endl;
14529 }
14530 PARAMS.vparams.flag("AFLOWIN_FLAG::EDIFFG", vpflow.flag("PROTO_AFLOW::EDIFFG"));
14531 if (vpflow.flag("PROTO_AFLOW::EDIFFG")) {
14532 PARAMS.vparams.push_attached("AFLOWIN_FLAG::EDIFFG", vpflow.getattachedscheme("PROTO_AFLOW::EDIFFG"));
14533 }
14534 if (LDEBUG) {
14535 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::EDIFFG\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::EDIFFG") << endl;
14536 }
14537
14538 // check kscheme //CO20181226
14539 if (LDEBUG) {
14540 cerr << __AFLOW_FUNC__ << " CHECK KSCHEME" << endl;
14541 }
14542 PARAMS.vparams.flag("AFLOWIN_FLAG::KSCHEME", vpflow.flag("PROTO_AFLOW::KSCHEME"));
14543 if (vpflow.flag("PROTO_AFLOW::KSCHEME")) {
14544 PARAMS.vparams.push_attached("AFLOWIN_FLAG::KSCHEME", vpflow.getattachedscheme("PROTO_AFLOW::KSCHEME"));
14545 }
14546 if (LDEBUG) {
14547 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::KSCHEME\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::KSCHEME") << endl;
14548 }
14549
14550 // check kscheme_static //CO20181226
14551 if (LDEBUG) {
14552 cerr << __AFLOW_FUNC__ << " CHECK KSCHEME_STATIC" << endl;
14553 }
14554 PARAMS.vparams.flag("AFLOWIN_FLAG::KSCHEME_STATIC", vpflow.flag("PROTO_AFLOW::KSCHEME_STATIC"));
14555 if (vpflow.flag("PROTO_AFLOW::KSCHEME_STATIC")) {
14556 PARAMS.vparams.push_attached("AFLOWIN_FLAG::KSCHEME_STATIC", vpflow.getattachedscheme("PROTO_AFLOW::KSCHEME_STATIC"));
14557 }
14558 if (LDEBUG) {
14559 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::KSCHEME_STATIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::KSCHEME_STATIC") << endl;
14560 }
14561
14562 // check kscheme_dielectric
14563 if (LDEBUG) {
14564 cerr << __AFLOW_FUNC__ << " CHECK KSCHEME_DIELECTRIC" << endl;
14565 }
14566 PARAMS.vparams.flag("AFLOWIN_FLAG::KSCHEME_DIELECTRIC", vpflow.flag("PROTO_AFLOW::KSCHEME_DIELECTRIC"));
14567 if (vpflow.flag("PROTO_AFLOW::KSCHEME_DIELECTRIC")) {
14568 PARAMS.vparams.push_attached("AFLOWIN_FLAG::KSCHEME_DIELECTRIC", vpflow.getattachedscheme("PROTO_AFLOW::KSCHEME_DIELECTRIC"));
14569 }
14570 if (LDEBUG) {
14571 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::KSCHEME_DIELECTRIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::KSCHEME_DIELECTRIC") << endl;
14572 }
14573
14574 // check kppra
14575 if (LDEBUG) {
14576 cerr << __AFLOW_FUNC__ << " CHECK KPPRA" << endl;
14577 }
14578 PARAMS.vparams.flag("AFLOWIN_FLAG::KPPRA", vpflow.flag("PROTO_AFLOW::KPPRA"));
14579 if (vpflow.flag("PROTO_AFLOW::KPPRA")) {
14580 PARAMS.vparams.push_attached("AFLOWIN_FLAG::KPPRA", vpflow.getattachedscheme("PROTO_AFLOW::KPPRA"));
14581 }
14582 if (LDEBUG) {
14583 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::KPPRA\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::KPPRA") << endl;
14584 }
14585
14586 // check kppra_static
14587 if (LDEBUG) {
14588 cerr << __AFLOW_FUNC__ << " CHECK KPPRA_STATIC" << endl;
14589 }
14590 PARAMS.vparams.flag("AFLOWIN_FLAG::KPPRA_STATIC", vpflow.flag("PROTO_AFLOW::KPPRA_STATIC"));
14591 if (vpflow.flag("PROTO_AFLOW::KPPRA_STATIC")) {
14592 PARAMS.vparams.push_attached("AFLOWIN_FLAG::KPPRA_STATIC", vpflow.getattachedscheme("PROTO_AFLOW::KPPRA_STATIC"));
14593 }
14594 if (LDEBUG) {
14595 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::KPPRA_STATIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::KPPRA_STATIC") << endl;
14596 }
14597
14598 // check kppra_dielectric
14599 if (LDEBUG) {
14600 cerr << __AFLOW_FUNC__ << " CHECK KPPRA_DIELECTRIC" << endl;
14601 }
14602 PARAMS.vparams.flag("AFLOWIN_FLAG::KPPRA_DIELECTRIC", vpflow.flag("PROTO_AFLOW::KPPRA_DIELECTRIC"));
14603 if (vpflow.flag("PROTO_AFLOW::KPPRA_DIELECTRIC")) {
14604 PARAMS.vparams.push_attached("AFLOWIN_FLAG::KPPRA_DIELECTRIC", vpflow.getattachedscheme("PROTO_AFLOW::KPPRA_DIELECTRIC"));
14605 }
14606 if (LDEBUG) {
14607 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::KPPRA_DIELECTRIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::KPPRA_DIELECTRIC") << endl;
14608 }
14609
14610 // check bands_grid
14611 if (LDEBUG) {
14612 cerr << __AFLOW_FUNC__ << " CHECK BANDS_GRID" << endl;
14613 }
14614 PARAMS.vparams.flag("AFLOWIN_FLAG::BANDS_GRID", vpflow.flag("PROTO_AFLOW::BANDS_GRID"));
14615 if (vpflow.flag("PROTO_AFLOW::BANDS_GRID")) {
14616 PARAMS.vparams.push_attached("AFLOWIN_FLAG::BANDS_GRID", vpflow.getattachedscheme("PROTO_AFLOW::BANDS_GRID"));
14617 }
14618 if (LDEBUG) {
14619 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::BANDS_GRID\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::BANDS_GRID") << endl;
14620 }
14621
14622 // check enmax_multiply
14623 if (LDEBUG) {
14624 cerr << __AFLOW_FUNC__ << " CHECK ENMAX_MULTIPLY" << endl;
14625 }
14626 PARAMS.vparams.flag("AFLOWIN_FLAG::ENMAX_MULTIPLY", vpflow.flag("PROTO_AFLOW::ENMAX_MULTIPLY"));
14627 if (vpflow.flag("PROTO_AFLOW::ENMAX_MULTIPLY")) {
14628 PARAMS.vparams.push_attached("AFLOWIN_FLAG::ENMAX_MULTIPLY", vpflow.getattachedscheme("PROTO_AFLOW::ENMAX_MULTIPLY"));
14629 }
14630 if (LDEBUG) {
14631 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::ENMAX_MULTIPLY\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::ENMAX_MULTIPLY") << endl;
14632 }
14633
14634 // check ABINIT QE VASP AIMS
14635 if (LDEBUG) {
14636 cerr << __AFLOW_FUNC__ << " CHECK VASP/ABCCAR/ITC/QE/ABINIT/AIMS/CIF/ELK/LMP" << endl; // DX20190123 - add CIF //DX20200313 - add ELK //CO20220613
14637 }
14638 PARAMS.vparams.flag("AFLOWIN_FLAG::VASP", true); // default
14639 PARAMS.vparams.flag("AFLOWIN_FLAG::ITC", vpflow.flag("PROTO_AFLOW::ITC")); // CO20220613
14640 PARAMS.vparams.flag("AFLOWIN_FLAG::QE", vpflow.flag("PROTO_AFLOW::QE"));
14641 PARAMS.vparams.flag("AFLOWIN_FLAG::ABCCAR", vpflow.flag("PROTO_AFLOW::ABCCAR")); // DX20190123 - add ABCCAR
14642 PARAMS.vparams.flag("AFLOWIN_FLAG::ABINIT", vpflow.flag("PROTO_AFLOW::ABINIT"));
14643 PARAMS.vparams.flag("AFLOWIN_FLAG::AIMS", vpflow.flag("PROTO_AFLOW::AIMS"));
14644 PARAMS.vparams.flag("AFLOWIN_FLAG::CIF", vpflow.flag("PROTO_AFLOW::CIF")); // DX20190123 - add CIF
14645 PARAMS.vparams.flag("AFLOWIN_FLAG::ELK", vpflow.flag("PROTO_AFLOW::ELK")); // DX20200313 - add ELK
14646 PARAMS.vparams.flag("AFLOWIN_FLAG::LMP", vpflow.flag("PROTO_AFLOW::LMP")); // SD20240111 - add LMP
14647 if (PARAMS.vparams.flag("AFLOWIN_FLAG::AIMS")) {
14648 PARAMS.vparams.flag("AFLOWIN_FLAG::QE", false);
14649 PARAMS.vparams.flag("AFLOWIN_FLAG::VASP", false);
14650 PARAMS.vparams.flag("AFLOWIN_FLAG::ABINIT", false);
14651 PARAMS.vparams.flag("AFLOWIN_FLAG::CIF", false); // DX20190123 - add CIF
14652 PARAMS.vparams.flag("AFLOWIN_FLAG::ABCCAR", false); // DX20190123 - add ABCCAR
14653 PARAMS.vparams.flag("AFLOWIN_FLAG::ELK", false); // DX20200313 - add ELK
14654 PARAMS.vparams.flag("AFLOWIN_FLAG::LMP", false); // SD20240111 - add LMP
14655 }
14656 if (PARAMS.vparams.flag("AFLOWIN_FLAG::ABINIT")) {
14657 PARAMS.vparams.flag("AFLOWIN_FLAG::QE", false);
14658 PARAMS.vparams.flag("AFLOWIN_FLAG::VASP", false);
14659 PARAMS.vparams.flag("AFLOWIN_FLAG::AIMS", false);
14660 PARAMS.vparams.flag("AFLOWIN_FLAG::CIF", false); // DX20190123 - add CIF
14661 PARAMS.vparams.flag("AFLOWIN_FLAG::ABCCAR", false); // DX20190123 - add ABCCAR
14662 PARAMS.vparams.flag("AFLOWIN_FLAG::ELK", false); // DX20200313 - add ELK
14663 PARAMS.vparams.flag("AFLOWIN_FLAG::LMP", false); // SD20240111 - add LMP
14664 }
14665 // CO20220613 - add ITC - START
14666 if (PARAMS.vparams.flag("AFLOWIN_FLAG::ITC")) { // CO20220613
14667 // CO20220613 - --itc can be added with another flag
14668 }
14669 // DX20190123 - add ABCCAR - START
14670 if (PARAMS.vparams.flag("AFLOWIN_FLAG::ABCCAR")) {
14671 PARAMS.vparams.flag("AFLOWIN_FLAG::QE", false);
14672 PARAMS.vparams.flag("AFLOWIN_FLAG::VASP", false);
14673 PARAMS.vparams.flag("AFLOWIN_FLAG::ABINIT", false);
14674 PARAMS.vparams.flag("AFLOWIN_FLAG::AIMS", false);
14675 PARAMS.vparams.flag("AFLOWIN_FLAG::CIF", false);
14676 PARAMS.vparams.flag("AFLOWIN_FLAG::ELK", false); // DX20200313 - add ELK
14677 PARAMS.vparams.flag("AFLOWIN_FLAG::LMP", false); // SD20240111 - add LMP
14678 }
14679 // DX20190123 - add ABCCAR - END
14680 // DX20190123 - add CIF - START
14681 if (PARAMS.vparams.flag("AFLOWIN_FLAG::CIF")) {
14682 PARAMS.vparams.flag("AFLOWIN_FLAG::QE", false);
14683 PARAMS.vparams.flag("AFLOWIN_FLAG::VASP", false);
14684 PARAMS.vparams.flag("AFLOWIN_FLAG::ABINIT", false);
14685 PARAMS.vparams.flag("AFLOWIN_FLAG::AIMS", false);
14686 PARAMS.vparams.flag("AFLOWIN_FLAG::ABCCAR", false); // DX20190123 - add ABCCAR
14687 PARAMS.vparams.flag("AFLOWIN_FLAG::ELK", false); // DX201200313 - add ELK
14688 PARAMS.vparams.flag("AFLOWIN_FLAG::LMP", false); // SD20240111 - add LMP
14689 }
14690 // DX20190123 - add CIF - END
14691 if (PARAMS.vparams.flag("AFLOWIN_FLAG::QE")) {
14692 PARAMS.vparams.flag("AFLOWIN_FLAG::VASP", false);
14693 PARAMS.vparams.flag("AFLOWIN_FLAG::ABINIT", false);
14694 PARAMS.vparams.flag("AFLOWIN_FLAG::AIMS", false);
14695 PARAMS.vparams.flag("AFLOWIN_FLAG::CIF", false); // DX20190123 - add CIF
14696 PARAMS.vparams.flag("AFLOWIN_FLAG::ABCCAR", false); // DX20190123 - add ABCCAR
14697 PARAMS.vparams.flag("AFLOWIN_FLAG::ELK", false); // DX201200313 - add ELK
14698 PARAMS.vparams.flag("AFLOWIN_FLAG::LMP", false); // SD20240111 - add LMP
14699 }
14700 if (PARAMS.vparams.flag("AFLOWIN_FLAG::VASP")) {
14701 PARAMS.vparams.flag("AFLOWIN_FLAG::ABINIT", false);
14702 PARAMS.vparams.flag("AFLOWIN_FLAG::QE", false);
14703 PARAMS.vparams.flag("AFLOWIN_FLAG::AIMS", false);
14704 PARAMS.vparams.flag("AFLOWIN_FLAG::CIF", false); // DX20190123 - add CIF
14705 PARAMS.vparams.flag("AFLOWIN_FLAG::ABCCAR", false); // DX20190123 - add ABCCAR
14706 PARAMS.vparams.flag("AFLOWIN_FLAG::ELK", false); // DX201200313 - add ELK
14707 PARAMS.vparams.flag("AFLOWIN_FLAG::LMP", false); // SD20240111 - add LMP
14708 }
14709 // DX20200313 - add ELK - START
14710 if (PARAMS.vparams.flag("AFLOWIN_FLAG::ELK")) {
14711 PARAMS.vparams.flag("AFLOWIN_FLAG::QE", false);
14712 PARAMS.vparams.flag("AFLOWIN_FLAG::VASP", false);
14713 PARAMS.vparams.flag("AFLOWIN_FLAG::ABINIT", false);
14714 PARAMS.vparams.flag("AFLOWIN_FLAG::AIMS", false);
14715 PARAMS.vparams.flag("AFLOWIN_FLAG::ABCCAR", false);
14716 PARAMS.vparams.flag("AFLOWIN_FLAG::CIF", false);
14717 }
14718 // DX20200313 - add ELK - END
14719 // SD20240111 - add LMP - START
14720 if (PARAMS.vparams.flag("AFLOWIN_FLAG::LMP")) {
14721 PARAMS.vparams.flag("AFLOWIN_FLAG::QE", false);
14722 PARAMS.vparams.flag("AFLOWIN_FLAG::VASP", false);
14723 PARAMS.vparams.flag("AFLOWIN_FLAG::ABINIT", false);
14724 PARAMS.vparams.flag("AFLOWIN_FLAG::AIMS", false);
14725 PARAMS.vparams.flag("AFLOWIN_FLAG::ABCCAR", false);
14726 PARAMS.vparams.flag("AFLOWIN_FLAG::CIF", false);
14727 PARAMS.vparams.flag("AFLOWIN_FLAG::ELK", false);
14728 }
14729 // SD20240111 - add LMP - END
14730 if (LDEBUG) {
14731 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::AIMS\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::AIMS") << endl;
14732 }
14733 if (LDEBUG) {
14734 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::ABINIT\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::ABINIT") << endl;
14735 }
14736 if (LDEBUG) {
14737 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::QE\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::QE") << endl;
14738 }
14739 if (LDEBUG) {
14740 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::VASP\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::VASP") << endl;
14741 }
14742 if (LDEBUG) {
14743 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::ITC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::ITC") << endl; // CO20220613
14744 }
14745 if (LDEBUG) {
14746 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::CIF\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::CIF") << endl; // DX20190123 - add CIF
14747 }
14748 if (LDEBUG) {
14749 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::ABCCAR\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::ABCCAR") << endl; // DX20190123 - add ABCCAR
14750 }
14751 if (LDEBUG) {
14752 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::ELK\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::ELK") << endl; // DX20200313 - add ELK
14753 }
14754 if (LDEBUG) {
14755 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::LMP\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::LMP") << endl; // SD20240111 - add LMP
14756 }
14757
14758 // check stdout
14759 if (LDEBUG) {
14760 cerr << __AFLOW_FUNC__ << " CHECK STDOUT" << endl;
14761 }
14762 PARAMS.vparams.flag("AFLOWIN_FLAG::STDOUT", vpflow.flag("PROTO_AFLOW::STDOUT"));
14763 if (LDEBUG) {
14764 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::STDOUT\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::STDOUT") << endl;
14765 }
14766
14767 // check list
14768 if (LDEBUG) {
14769 cerr << __AFLOW_FUNC__ << " CHECK LIST" << endl;
14770 }
14771 PARAMS.vparams.flag("AFLOWIN_FLAG::LIST", vpflow.flag("PROTO_AFLOW::LIST"));
14772 if (PARAMS.vparams.flag("AFLOWIN_FLAG::LIST")) {
14773 PARAMS.vparams.push_attached("AFLOWIN_FLAG::LIST_VCMD", vpflow.getattachedscheme("PROTO_AFLOW::LIST_VCMD"));
14774 }
14775 if (LDEBUG) {
14776 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::LIST\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::LIST") << endl;
14777 }
14778 if (LDEBUG) {
14779 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme((\"AFLOWIN_FLAG::LIST_VCMD\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::LIST_VCMD") << endl;
14780 }
14781
14782 // DX20180118 - Add ANRL functionality - START
14783 // check params
14784 if (LDEBUG) {
14785 cerr << __AFLOW_FUNC__ << " CHECK PARAMS" << endl;
14786 }
14787 PARAMS.vparams.flag("AFLOWIN_FLAG::PARAMS", vpflow.flag("PARAMS"));
14788 if (vpflow.flag("PARAMS")) {
14789 PARAMS.vparams.push_attached("AFLOWIN_FLAG::PARAMS", vpflow.getattachedscheme("PARAMS"));
14790 }
14791 if (LDEBUG) {
14792 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::PARAMS\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::PARAMS") << endl;
14793 }
14794 // DX20180118 - Add ANRL functionality - END
14795
14796 // DX20190227 - add anrl lattice parameter flag - START
14797 PARAMS.vparams.flag("AFLOWIN_FLAG::USE_ANRL_LATTICE_PARAM", vpflow.flag("PROTO::USE_ANRL_LATTICE_PARAM"));
14798 if (LDEBUG) {
14799 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::USE_ANRL_LATTICE_PARAM\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::USE_ANRL_LATTICE_PARAM") << endl;
14800 }
14801 // DX20190227 - add anrl lattice parameter flag - END
14802
14803 // check htqc
14804 if (LDEBUG) {
14805 cerr << __AFLOW_FUNC__ << " CHECK HTQC_ICSD" << endl;
14806 }
14807 PARAMS.vparams.flag("AFLOWIN_FLAG::HTQC_ICSD", vpflow.flag("PROTO_AFLOW::HTQC") || (!aurostd::substring2bool(string_LABEL, "_ICSD_") && aurostd::substring2bool(string_LABEL, "ICSD_")));
14808 if (LDEBUG) {
14809 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::HTQC_ICSD\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::HTQC_ICSD") << endl;
14810 }
14811
14812 // check pressure
14813 vector<string> params_pressure;
14814 if (LDEBUG) {
14815 cerr << __AFLOW_FUNC__ << " vpflow.getattachedscheme(\"PROTO_AFLOW::PRESSURE\")=" << vpflow.getattachedscheme("PROTO_AFLOW::PRESSURE") << endl;
14816 }
14817 aurostd::string2tokens(vpflow.getattachedscheme("PROTO_AFLOW::PRESSURE"), params_pressure, ",");
14818 PARAMS.vpressure.clear();
14819 if (!params_pressure.empty()) {
14820 for (size_t i = 0; i < params_pressure.size(); i++) {
14821 PARAMS.vpressure.push_back(aurostd::string2utype<double>(params_pressure[i]));
14822 }
14823 }
14824
14825 // CO20181226 - check pocc_params
14826 if (LDEBUG) {
14827 cerr << __AFLOW_FUNC__ << " CHECK POCC_PARAMS" << endl;
14828 }
14829 PARAMS.vparams.flag("AFLOWIN_FLAG::POCC_PARAMS", vpflow.flag("POCC_PARAMS"));
14830 if (vpflow.flag("POCC_PARAMS")) {
14831 PARAMS.vparams.push_attached("AFLOWIN_FLAG::POCC_PARAMS", vpflow.getattachedscheme("POCC_PARAMS"));
14832 }
14833 if (LDEBUG) {
14834 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::POCC_PARAMS\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::POCC_PARAMS") << endl;
14835 }
14836
14837 // CO20181226 - check pocc_tol
14838 if (LDEBUG) {
14839 cerr << __AFLOW_FUNC__ << " CHECK POCC_TOL" << endl;
14840 }
14841 PARAMS.vparams.flag("AFLOWIN_FLAG::POCC_TOL", vpflow.flag("POCC_TOL"));
14842 if (vpflow.flag("POCC_TOL")) {
14843 PARAMS.vparams.push_attached("AFLOWIN_FLAG::POCC_TOL", vpflow.getattachedscheme("POCC_TOL"));
14844 }
14845 if (LDEBUG) {
14846 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::POCC_TOL\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::POCC_TOL") << endl;
14847 }
14848
14849 if (LDEBUG) {
14850 cerr << __AFLOW_FUNC__ << " --- " << endl;
14851 }
14852
14853 const uint nspeciesHTQC = aflowlib::PrototypeLibrariesSpeciesNumber(string_LABEL);
14854 const bool alphabetic = RequestedAlphabeticLabeling(string_LABEL);
14855 PARAMS.vparams.push_attached("AFLOWIN_STRING::LABEL", string_LABEL);
14856
14857 if (LDEBUG) {
14858 cerr << __AFLOW_FUNC__ << " nspeciesHTQC=" << nspeciesHTQC << endl;
14859 }
14860 if (LDEBUG) {
14861 cerr << __AFLOW_FUNC__ << " alphabetic=" << alphabetic << endl;
14862 }
14863 if (LDEBUG) {
14864 cerr << __AFLOW_FUNC__ << " PARAMS.vpressure.size()=" << PARAMS.vpressure.size() << endl;
14865 }
14866 if (LDEBUG) {
14867 cerr << __AFLOW_FUNC__ << " PARAMS.vkppra.size()=" << PARAMS.vkppra.size() << " " << endl;
14868 }
14869 if (LDEBUG) {
14870 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme((\"AFLOWIN_STRING::LABEL\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_STRING::LABEL") << endl;
14871 }
14872 if (LDEBUG) {
14873 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme((\"AFLOWIN_STRING::POTENTIAL\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_STRING::POTENTIAL") << endl;
14874 }
14875 if (LDEBUG) {
14876 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::MODULE\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::MODULE") << endl; // CO20180214
14877 }
14878 if (LDEBUG) {
14879 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::MODULE\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::MODULE") << endl; // CO20180214
14880 }
14881 if (LDEBUG) {
14882 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::APL_SUPERCELL\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::APL_SUPERCELL") << endl; // CO20180214
14883 }
14884 if (LDEBUG) {
14885 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::APL_SUPERCELL\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::APL_SUPERCELL") << endl; // CO20180214
14886 }
14887 if (LDEBUG) {
14888 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::POTIM\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::POTIM") << endl;
14889 }
14890 if (LDEBUG) {
14891 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::POTIM\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::POTIM") << endl;
14892 }
14893 if (LDEBUG) {
14894 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::PRECISION\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::PRECISION") << endl;
14895 }
14896 if (LDEBUG) {
14897 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::PRECISION\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::PRECISION") << endl;
14898 }
14899 if (LDEBUG) {
14900 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::ALGORITHM\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::ALGORITHM") << endl;
14901 }
14902 if (LDEBUG) {
14903 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::ALGORITHM\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::ALGORITHM") << endl;
14904 }
14905 if (LDEBUG) {
14906 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::METAGGA\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::METAGGA") << endl;
14907 }
14908 if (LDEBUG) {
14909 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::METAGGA\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::METAGGA") << endl;
14910 }
14911 if (LDEBUG) {
14912 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::IVDW\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::IVDW") << endl;
14913 }
14914 if (LDEBUG) {
14915 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::IVDW\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::IVDW") << endl;
14916 }
14917 if (LDEBUG) {
14918 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RELAX_TYPE\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RELAX_TYPE") << endl; // CO20180214
14919 }
14920 if (LDEBUG) {
14921 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::RELAX_TYPE\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::RELAX_TYPE") << endl; // CO20180214
14922 }
14923 if (LDEBUG) {
14924 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RELAX_MODE\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RELAX_MODE") << endl;
14925 }
14926 if (LDEBUG) {
14927 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::RELAX_MODE\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::RELAX_MODE") << endl;
14928 }
14929 if (LDEBUG) {
14930 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RELAX_COUNT\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RELAX_COUNT") << endl; // CO20181226
14931 }
14932 if (LDEBUG) {
14933 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::RELAX_COUNT\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::RELAX_COUNT") << endl; // CO20181226
14934 }
14935 if (LDEBUG) {
14936 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RUN_RELAX_STATIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_RELAX_STATIC") << endl; // CO20181226
14937 }
14938 if (LDEBUG) {
14939 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RUN_RELAX_STATIC_BANDS\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_RELAX_STATIC_BANDS") << endl; // CO20181226
14940 }
14941 if (LDEBUG) {
14942 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RUN_RELAX_STATIC_DIELECTRIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_RELAX_STATIC_DIELECTRIC") << endl;
14943 }
14944 if (LDEBUG) {
14945 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RUN_STATIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_STATIC") << endl; // CO20181226
14946 }
14947 if (LDEBUG) {
14948 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RUN_STATIC_BANDS\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_STATIC_BANDS") << endl; // CO20181226
14949 }
14950 if (LDEBUG) {
14951 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::RUN_STATIC_DIELECTRIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::RUN_STATIC_DIELECTRIC") << endl;
14952 }
14953 if (LDEBUG) {
14954 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::TYPE\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::TYPE") << endl;
14955 }
14956 if (LDEBUG) {
14957 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::TYPE\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::TYPE") << endl;
14958 }
14959 if (LDEBUG) {
14960 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::CONVERT_UNIT_CELL\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::CONVERT_UNIT_CELL") << endl;
14961 }
14962 if (LDEBUG) {
14963 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::CONVERT_UNIT_CELL\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::CONVERT_UNIT_CELL") << endl;
14964 }
14965 if (LDEBUG) {
14966 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::VOLUME_PLUS_EQUAL\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::VOLUME_PLUS_EQUAL") << endl;
14967 }
14968 if (LDEBUG) {
14969 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::VOLUME_PLUS_EQUAL\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::VOLUME_PLUS_EQUAL") << endl;
14970 }
14971 if (LDEBUG) {
14972 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::VOLUME_MULTIPLY_EQUAL\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::VOLUME_MULTIPLY_EQUAL") << endl;
14973 }
14974 if (LDEBUG) {
14975 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::VOLUME_MULTIPLY_EQUAL\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::VOLUME_MULTIPLY_EQUAL") << endl;
14976 }
14977 if (LDEBUG) {
14978 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::VOLUME_PRESERVED\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::VOLUME_PRESERVED") << endl; // CO20180214
14979 }
14980 if (LDEBUG) {
14981 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::EDIFFG\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::EDIFFG") << endl;
14982 }
14983 if (LDEBUG) {
14984 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::EDIFFG\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::EDIFFG") << endl;
14985 }
14986 if (LDEBUG) {
14987 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::KPPRA\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::KPPRA") << endl;
14988 }
14989 if (LDEBUG) {
14990 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::KPPRA\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::KPPRA") << endl;
14991 }
14992 if (LDEBUG) {
14993 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::KPPRA_STATIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::KPPRA_STATIC") << endl;
14994 }
14995 if (LDEBUG) {
14996 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::KPPRA_STATIC\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::KPPRA_STATIC") << endl;
14997 }
14998 if (LDEBUG) {
14999 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::KPPRA_DIELECTRIC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::KPPRA_DIELECTRIC") << endl;
15000 }
15001 if (LDEBUG) {
15002 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::KPPRA_DIELECTRIC\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::KPPRA_DIELECTRIC") << endl;
15003 }
15004 if (LDEBUG) {
15005 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::BANDS_GRID\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::BANDS_GRID") << endl;
15006 }
15007 if (LDEBUG) {
15008 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::BANDS_GRID\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::BANDS_GRID") << endl;
15009 }
15010 if (LDEBUG) {
15011 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::ENMAX_MULTIPLY\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::ENMAX_MULTIPLY") << endl;
15012 }
15013 if (LDEBUG) {
15014 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme(\"AFLOWIN_FLAG::ENMAX_MULTIPLY\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::ENMAX_MULTIPLY") << endl;
15015 }
15016 if (LDEBUG) {
15017 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::USAGE\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::USAGE") << endl;
15018 }
15019 if (LDEBUG) {
15020 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::REVERSE\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::REVERSE") << endl;
15021 }
15022 if (LDEBUG) {
15023 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::MISSING\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::MISSING") << endl;
15024 }
15025 if (LDEBUG) {
15026 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::NOAUTOPP\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::NOAUTOPP") << endl;
15027 }
15028 if (LDEBUG) {
15029 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::AUTOLDAU\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::AUTOLDAU") << endl;
15030 }
15031 if (LDEBUG) {
15032 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::AUTONOLDAU\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::AUTONOLDAU") << endl;
15033 }
15034 if (LDEBUG) {
15035 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::STDOUT\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::STDOUT") << endl;
15036 }
15037 if (LDEBUG) {
15038 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::LIST\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::LIST") << endl;
15039 }
15040 if (LDEBUG) {
15041 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::PARAMS\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::PARAMS") << endl; // DX20180118 - Added ANRL functionality
15042 }
15043 if (LDEBUG) {
15044 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::POCC_PARAMS\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::POCC_PARAMS") << endl; // CO20181226
15045 }
15046 if (LDEBUG) {
15047 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::POCC_TOL\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::POCC_TOL") << endl; // CO20181226
15048 }
15049 if (LDEBUG) {
15050 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.getattachedscheme((\"AFLOWIN_FLAG::LIST_VCMD\")=" << PARAMS.vparams.getattachedscheme("AFLOWIN_FLAG::LIST_VCMD") << endl;
15051 }
15052 if (LDEBUG) {
15053 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::HTQC_ICSD\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::HTQC_ICSD") << endl;
15054 }
15055 if (LDEBUG) {
15056 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::NEGLECT_NOMIX\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::NEGLECT_NOMIX") << endl;
15057 }
15058 if (LDEBUG) {
15059 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::VASP\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::VASP") << endl;
15060 }
15061 if (LDEBUG) {
15062 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::ITC\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::ITC") << endl; // CO20220613
15063 }
15064 if (LDEBUG) {
15065 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::ABINIT\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::ABINIT") << endl;
15066 }
15067 if (LDEBUG) {
15068 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::AIMS\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::AIMS") << endl;
15069 }
15070 if (LDEBUG) {
15071 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::QE\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::QE") << endl;
15072 }
15073 if (LDEBUG) {
15074 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::CIF\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::CIF") << endl; // DX20190123 - add CIF
15075 }
15076 if (LDEBUG) {
15077 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::ABCCAR\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::ABCCAR") << endl; // DX20190123 - add ABCCAR
15078 }
15079 if (LDEBUG) {
15080 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::ELK\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::ELK") << endl; // DX202003133 - add ELK
15081 }
15082 if (LDEBUG) {
15083 cerr << __AFLOW_FUNC__ << " PARAMS.vparams.flag(\"AFLOWIN_FLAG::LMP\")=" << PARAMS.vparams.flag("AFLOWIN_FLAG::LMP") << endl; // SD202401111 - add LMP
15084 }
15085
15086 if (PARAMS.ucell.size() == 1 && aurostd::substring2bool(PARAMS.vparams.getattachedscheme("AFLOWIN_STRING::LABEL"), "_ICSD_") && !PARAMS.vparams.flag("AFLOWIN_FLAG::HTQC_ICSD")) {
15087 if (LDEBUG) {
15088 cerr << __AFLOW_FUNC__ << " running AVASP_MakePrototypeICSD_AFLOWIN" << endl;
15089 }
15090 // return AVASP_MakePrototypeICSD_AFLOWIN(PARAMS.ucell,false);
15091 return AVASP_MakePrototypeICSD_AFLOWIN((&PARAMS), false);
15092 } else {
15093 // if(alphabetic==true && (nspeciesHTQC==3 || nspeciesHTQC==4)) AlphabetizePrototypeLabelSpeciesArgv(argv); // it is going to fail if you want a big list of protos
15094 if (LDEBUG) {
15095 cerr << __AFLOW_FUNC__ << " running AVASP_MakePrototype_AFLOWIN" << endl;
15096 }
15097 return AVASP_MakePrototype_AFLOWIN((&PARAMS));
15098 }
15099 if (LDEBUG) {
15100 cerr << __AFLOW_FUNC__ << " END" << endl;
15101 }
15102
15103 return false;
15104 }
15105} // namespace pflow
15106
15107namespace pflow {
15108 vector<string> GENERATE_CERAMICS(const vector<string>& _vnonmetals, const vector<string>& _vmetals, uint metal_arity) { // CO20200731
15109 const bool LDEBUG = (false || XHOST.DEBUG);
15110 if (LDEBUG) {
15111 cerr << __AFLOW_FUNC__ << " nonmetals=" << aurostd::joinWDelimiter(_vnonmetals, ",") << endl;
15112 cerr << __AFLOW_FUNC__ << " metals=" << aurostd::joinWDelimiter(_vmetals, ",") << endl;
15113 cerr << __AFLOW_FUNC__ << " metal_arity=" << metal_arity << endl;
15114 }
15115 if (_vnonmetals.empty()) {
15116 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "vnonmetals.size()==0", _INPUT_MISSING_);
15117 } // CO20200624
15118 if (_vmetals.empty()) {
15119 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "vmetals.size()==0", _INPUT_MISSING_);
15120 } // CO20200624
15121 vector<string> vnonmetals(_vnonmetals);
15122 vector<string> vmetals(_vmetals);
15123 std::sort(vnonmetals.begin(), vnonmetals.end()); // SORT FIRST
15124 std::sort(vmetals.begin(), vmetals.end()); // SORT FIRST
15125
15126 uint i = 0;
15127 uint j = 0;
15128
15129 // get vmix
15130 vector<string> vmix = vnonmetals;
15131 vmix.insert(vmix.end(), vmetals.begin(), vmetals.end());
15132 std::sort(vmix.begin(), vmix.end());
15133
15134 // get vind_nm
15135 vector<uint> vind_nm;
15136 if (LDEBUG) {
15137 cerr << __AFLOW_FUNC__ << " vmix=" << aurostd::joinWDelimiter(vmix, ",") << endl;
15138 }
15139 std::vector<string>::iterator it;
15140 for (i = 0; i < vnonmetals.size(); i++) {
15141 it = std::find(vmix.begin(), vmix.end(), vnonmetals[i]);
15142 vind_nm.push_back(it - vmix.begin());
15143 }
15144 if (LDEBUG) {
15145 cerr << __AFLOW_FUNC__ << " vind_nm=" << aurostd::joinWDelimiter(vind_nm, ",") << endl;
15146 }
15147
15148 // get vvinbetween
15149 vector<vector<string>> vvinbetween;
15150 vvinbetween.resize(vnonmetals.size() + 1); // pre==vvinbetween[0], post==vvinbetween[-1]
15151 for (i = 0, j = 0; i < vmix.size(); i++) {
15152 if (aurostd::WithinList(vind_nm, i)) {
15153 j++;
15154 continue;
15155 }
15156 vvinbetween[j].push_back(vmix[i]);
15157 }
15158 if (LDEBUG) {
15159 for (i = 0; i < vvinbetween.size(); i++) {
15160 cerr << __AFLOW_FUNC__ << " vvinbetween[i=" << i << "]=" << aurostd::joinWDelimiter(vvinbetween[i], ",") << endl;
15161 }
15162 }
15163 // get vNinbetween
15164 vector<uint> vNinbetween;
15165 vNinbetween.assign(vvinbetween.size(), 0); // assign all 0
15166 uint sum_species = 0; // colons
15167 // think of it as drops of water into separate cups, start with first and fill until you have no more water
15168 sum_species = 0;
15169 for (i = 0; i < vvinbetween.size() && sum_species < metal_arity; i++) {
15170 for (j = 0; j < vvinbetween[i].size() && sum_species < metal_arity; j++) {
15171 vNinbetween[i]++;
15172 sum_species++;
15173 }
15174 }
15175 if (LDEBUG) {
15176 cerr << __AFLOW_FUNC__ << " vNinbetween=" << aurostd::joinWDelimiter(vNinbetween, ",") << endl;
15177 }
15178
15179 // get vNinbetween_std
15180 vector<uint> vNinbetween_std;
15181 vNinbetween_std.assign(vNinbetween.size(), 0);
15182 vNinbetween_std.back() = metal_arity;
15183
15184 uint k = 0; // index of nonmetals
15185 vector<string> vcommands;
15186 vector<string> vtmp;
15187 string command = "";
15188 string tmp;
15189 while (vcommands.size() < 1e4) { // not simple as number of combinations since we could have 2 or more nonmetals
15190 command = "";
15191
15192 for (i = 0, k = 0; i < vNinbetween.size(); i++) {
15193 tmp = aurostd::joinWDelimiter(vvinbetween[i], ",");
15194 vtmp.clear();
15195 if (vNinbetween[i] > 0) {
15196 if (!command.empty()) {
15197 command += ":";
15198 }
15199 for (j = 0; j < vNinbetween[i]; j++) {
15200 vtmp.push_back(tmp);
15201 }
15202 command += aurostd::joinWDelimiter(vtmp, ":");
15203 }
15204 if (k < vnonmetals.size()) {
15205 if (!command.empty()) {
15206 command += ":";
15207 }
15208 command += vnonmetals[k++];
15209 }
15210 }
15211
15212 if (LDEBUG) {
15213 cerr << __AFLOW_FUNC__ << " command=" << command << endl;
15214 }
15215 vcommands.push_back(command);
15216 if (vNinbetween == vNinbetween_std) {
15217 break;
15218 }
15219
15220 // adjust vNinbetween
15221 for (i = 0; i < vNinbetween.size() - 1; i++) {
15222 if (vNinbetween[i] == 0) {
15223 continue;
15224 }
15225 vNinbetween[i]--;
15226 vNinbetween[i + 1]++;
15227 }
15228 if (LDEBUG) {
15229 cerr << __AFLOW_FUNC__ << " vNinbetween=" << aurostd::joinWDelimiter(vNinbetween, ",") << endl;
15230 }
15231 }
15232
15233 return vcommands;
15234 }
15235 vector<string> GENERATE_CERAMICS(const aurostd::xoption& vpflow) { // CO20200731
15236 vector<string> vnonmetals;
15237 vector<string> vmetals;
15238 const string nonmetals = vpflow.getattachedscheme("GENERATE_CERAMICS::NON_METALS");
15239 aurostd::string2tokens(nonmetals, vnonmetals, ",");
15240 const string metals = vpflow.getattachedscheme("GENERATE_CERAMICS::METALS");
15241 aurostd::string2tokens(metals, vmetals, ",");
15242 const int metal_arity = vpflow.getattachedutype<uint>("GENERATE_CERAMICS::METAL_ARITY");
15243 return GENERATE_CERAMICS(vnonmetals, vmetals, metal_arity);
15244 }
15245 string GENERATE_CERAMICS_PRINT(const aurostd::xoption& vpflow) { // CO20200731
15246 return aurostd::joinWDelimiter(GENERATE_CERAMICS(vpflow), "\n");
15247 }
15248} // namespace pflow
15249
15250// ***************************************************************************
15251// pflow::PSEUDOPOTENTIALS_CHECK
15252// ***************************************************************************
15253
15254namespace pflow {
15255 bool PSEUDOPOTENTIALS_CHECK(const aurostd::xoption& vpflow, const string& file, ostream& oss) { // too many options
15256 const bool LDEBUG = (false || XHOST.DEBUG);
15257 if (LDEBUG) {
15258 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
15259 }
15260
15261 // check usage
15262 if (LDEBUG) {
15263 cerr << __AFLOW_FUNC__ << " CHECK USAGE" << endl;
15264 }
15265 if (vpflow.flag("PSEUDOPOTENTIALS_CHECK::USAGE") || file.empty()) {
15266 init::MessageOption(vpflow.getattachedscheme("PSEUDOPOTENTIALS_CHECK"), "pflow::PSEUDOPOTENTIALS_CHECK",
15267 aurostd::liststring2string("aflow [options] --pseudopotentials_check=[POTCAR|OUTCAR]["
15268 "|.bz2|.gz|.xz] | --pp_check= | --ppk=",
15269 " options:", " --usage"));
15270 return true; // CO20200624 - the option was expressed successfully
15271 }
15272 if (LDEBUG) {
15273 cerr << __AFLOW_FUNC__ << " vpflow.getattachedscheme(\"PSEUDOPOTENTIALS_CHECK::USAGE\")=" << vpflow.flag("PSEUDOPOTENTIALS_CHECK::USAGE") << endl;
15274 }
15275 if (LDEBUG) {
15276 cerr << __AFLOW_FUNC__ << " file=" << file << endl;
15277 }
15278 // now start
15279 if (aurostd::substring2bool(file, "POTCAR")) {
15280 XHOST.DEBUG = false;
15281 XHOST.PSEUDOPOTENTIAL_GENERATOR = false;
15282 const xPOTCAR xPOT(file);
15283 oss << xPOT << endl;
15284 }
15285 if (aurostd::substring2bool(file, "OUTCAR")) {
15286 XHOST.DEBUG = false;
15287 XHOST.PSEUDOPOTENTIAL_GENERATOR = false;
15288 xOUTCAR xOUT(file);
15289 const xPOTCAR xPOT;
15290 oss << " FROM OUTCAR" << endl;
15291 oss << " vTITEL.size()=" << xOUT.vTITEL.size() << ": ";
15292 for (size_t i = 0; i < xOUT.vTITEL.size(); i++) {
15293 oss << xOUT.vTITEL[i] << " ";
15294 }
15295 oss << endl;
15296 oss << " SYSTEM=" << xOUT.SYSTEM << endl;
15297 oss << " pp_type=" << xOUT.pp_type << endl;
15298 oss << " species.size()=" << xOUT.species.size() << ": ";
15299 for (size_t i = 0; i < xOUT.species.size(); i++) {
15300 oss << xOUT.species[i] << " ";
15301 }
15302 oss << endl;
15303 oss << " species_pp.size()=" << xOUT.species_pp.size() << ": ";
15304 for (size_t i = 0; i < xOUT.species_pp.size(); i++) {
15305 oss << xOUT.species_pp[i] << " ";
15306 }
15307 oss << endl;
15308 oss << " species_Z.size()=" << xOUT.species_Z.size() << ": ";
15309 for (size_t i = 0; i < xOUT.species_Z.size(); i++) {
15310 oss << xOUT.species_Z[i] << " ";
15311 }
15312 oss << endl;
15313 oss << " species_pp_type.size()=" << xOUT.species_pp_type.size() << ": ";
15314 for (size_t i = 0; i < xOUT.species_pp_type.size(); i++) {
15315 oss << xOUT.species_pp_type[i] << " ";
15316 }
15317 oss << endl;
15318 oss << " species_pp_version.size()=" << xOUT.species_pp_version.size() << ": ";
15319 for (size_t i = 0; i < xOUT.species_pp_version.size(); i++) {
15320 oss << xOUT.species_pp_version[i] << " ";
15321 }
15322 oss << endl;
15323 oss << " species_pp_AUID.size()=" << xOUT.species_pp_AUID.size() << ": ";
15324 for (size_t i = 0; i < xOUT.species_pp_AUID.size(); i++) {
15325 oss << xOUT.species_pp_AUID[i] << " ";
15326 }
15327 oss << endl;
15328 oss << " species_pp_AUID_collisions.size()=" << xOUT.species_pp_AUID_collisions.size() << ": ";
15329 for (size_t i = 0; i < xOUT.species_pp_AUID_collisions.size(); i++) {
15330 oss << xOUT.species_pp_AUID_collisions[i] << " ";
15331 }
15332 oss << endl;
15333 }
15334 //
15335 if (LDEBUG) {
15336 cerr << __AFLOW_FUNC__ << " END" << endl;
15337 }
15338 return true;
15339 }
15340} // namespace pflow
15341
15342// ***************************************************************************
15343// pflow::PYTHON_MODULES //ME20211103
15344// ***************************************************************************
15345
15346namespace pflow {
15347 void PYTHON_MODULES(const string& modules, ostream& oss) {
15348 ofstream FileMESSAGE;
15349 PYTHON_MODULES(modules, FileMESSAGE, oss);
15350 }
15351
15352 void PYTHON_MODULES(const string& modules, ofstream& FileMESSAGE, ostream& oss) {
15353 vector<string> vmodules;
15354 aurostd::string2tokens(modules, vmodules, ",");
15355 PYTHON_MODULES(vmodules, FileMESSAGE, oss);
15356 }
15357
15358 void PYTHON_MODULES(const vector<string>& vmodules_in, ostream& oss) {
15359 ofstream FileMESSAGE;
15360 PYTHON_MODULES(vmodules_in, FileMESSAGE, oss);
15361 }
15362
15363 void PYTHON_MODULES(const vector<string>& vmodules_in, ofstream& FileMESSAGE, ostream& oss) {
15364 string directory = XHOST.vflag_control.getattachedscheme("DIRECTORY");
15365 if (directory.empty()) {
15366 directory = ".";
15367 }
15368
15369 vector<string> vmodules;
15370 vector<string> vskip;
15371 const vector<string> vavailable{"aflow_cce", "aflow_chull", "aflow_chull_plotter", "aflow_sym", "aflow_xtal_finder"};
15372
15373 // Get available modules first
15374 if (!vmodules_in.empty()) {
15375 for (size_t i = 0; i < vmodules_in.size(); i++) {
15376 if (aurostd::WithinList(vavailable, vmodules_in[i]) || (vmodules_in[i] == "aflow_xtalfinder")) { // Need to account for inconsistency between aflow command and publication
15377 vmodules.push_back(vmodules_in[i]);
15378 } else {
15379 vskip.push_back(vmodules_in[i]); // For the warning message
15380 }
15381 }
15382 } else {
15383 vmodules = vavailable;
15384 }
15385
15386 stringstream message;
15387 if (!vskip.empty()) {
15388 message << "Could not find modules " << aurostd::joinWDelimiter(vskip, ", ") << "."
15389 << " Available modules: " << aurostd::joinWDelimiter(vavailable, ", ") << ".";
15390 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, directory, FileMESSAGE, oss, _LOGGER_WARNING_);
15391 }
15392 if (!vmodules.empty()) {
15393 // Dependencies
15394 if (aurostd::WithinList(vmodules, "aflow_chull_plotter") && !aurostd::WithinList(vmodules, "aflow_chull")) {
15395 vmodules.emplace_back("aflow_chull");
15396 }
15397 for (size_t i = 0; i < vmodules.size(); i++) {
15398 const string& mod = vmodules[i];
15399 const string moddir = aurostd::CleanFileName(directory + "/" + mod);
15400 if (!aurostd::FileExist(moddir)) {
15401 aurostd::DirectoryMake(moddir);
15402 }
15403 // Only include cpps here to avoid multiple definition errors
15404 if (mod == "aflow_cce") {
15405 aurostd::EmbData::save_to_file("aflow_cce_python.py", "SCRIPTS", moddir + "/__init__.py");
15406 } else if (mod == "aflow_chull") {
15407 aurostd::EmbData::save_to_file("aflow_chull_python.py", "SCRIPTS", moddir + "/__init__.py");
15408 } else if (mod == "aflow_chull_plotter") {
15409 aurostd::EmbData::save_to_file("aflow_chull_jupyter_plotter.py", "SCRIPTS", moddir + "/__init__.py");
15410 } else if (mod == "aflow_sym") {
15411 aurostd::EmbData::save_to_file("aflow_sym_python.py", "SCRIPTS", moddir + "/__init__.py");
15412 } else if ((mod == "aflow_xtal_finder") || (mod == "aflow_xtalfinder")) {
15413 aurostd::EmbData::save_to_file("aflow_xtalfinder_python.py", "SCRIPTS", moddir + "/__init__.py");
15414 }
15415 }
15416 message << "Successfully installed modules " << aurostd::joinWDelimiter(vmodules, ", ") << ".";
15417 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, directory, FileMESSAGE, oss, _LOGGER_NOTICE_);
15418 } else {
15419 message << "No modules left to write.";
15421 }
15422 }
15423} // namespace pflow
15424
15425// ***************************************************************************
15426// pflow::STATDIEL // CAMILO
15427// ***************************************************************************
15428namespace pflow {
15429 void STATDIEL(vector<string>& argv) { // loop pflow::STATDIEL
15430 string outcar;
15431 xvector<double> real(3);
15432 xvector<double> imag(3);
15433 if (argv.size() != 3) { // user control lines - aflow specific.
15434 init::ErrorOption("", "pflow::STATDIEL", "aflow --statdiel OUTCAR*");
15435 }
15436 outcar = argv.at(2);
15437 KBIN::GetStatDiel(outcar, real, imag);
15438 printf("%11.6f %11.6f %11.6f ", real(1), real(2), real(3));
15439 printf("%11.6f %11.6f %11.6f \n", imag(1), imag(2), imag(3));
15440 } // loop pflow::STATDIEL
15441} // namespace pflow
15442
15443// ***************************************************************************
15444// pflow::QMVASP
15445// ***************************************************************************
15446// CO20180703 - revamped for vpflow, and fixed INCAR search issue
15447namespace pflow {
15448 bool QMVASP(aurostd::xoption& vpflow) {
15449 // CO20180703
15450 const bool LDEBUG = (false || XHOST.DEBUG);
15451
15452 if (vpflow.flag()) {
15453 ;
15454 } // keep busy
15455
15456 // fix directory
15457 string directory;
15458 if (XHOST.vflag_control.flag("DIRECTORY")) {
15459 directory = XHOST.vflag_control.getattachedscheme("DIRECTORY");
15460 }
15461 if (directory.empty()) {
15462 directory = ".";
15463 }
15464 if (!aurostd::IsDirectory(directory)) {
15465 cerr << __AFLOW_FUNC__ << " invalid directory input" << endl;
15466 return false;
15467 }
15468
15469 // organize runs, e.g., .static, .relax2
15470 const vector<string> vruns{".relax1", ".relax2", ".relax3", ".relax4", ".static", ".bands"};
15471
15472 // organize CARs, e.g., CONCAR, OUTCAR
15473 const vector<string> vCARs{"CONTCAR", "OUTCAR", "INCAR", "vasprun.xml"}; // look in aflow_kvasp, KBIN::VASP_Analyze()
15474
15475 // remove aflow.qmvasp.out
15476 for (size_t k = 0; k < XHOST.vext.size(); k++) {
15477 aurostd::RemoveFile(directory + "/" + DEFAULT_AFLOW_QMVASP_OUT + XHOST.vext[k]);
15478 }
15479
15480 // go through runs sequentially to fill in aflow.qmvasp.out
15481 bool found_run = false; // i.e., found COMPLETE run, all files must be .static or all .relax2, no mix match
15482 string ext = "";
15483 string vCAR = "";
15484 string vCAR_compressed = "";
15485 _xvasp xvasp;
15486 xvasp.Directory = directory;
15487 for (size_t j = 0; j < vruns.size(); j++) {
15488 ext = vruns[j];
15489 aurostd::StringSubstInPlace(ext, ".", "");
15490 if (LDEBUG) {
15491 cerr << __AFLOW_FUNC__ << " checking run=" << aurostd::toupper(ext) << endl;
15492 }
15493 found_run = true;
15494 for (size_t i = 0; i < vCARs.size() && found_run == true; i++) {
15495 vCAR = directory + "/" + vCARs[i] + vruns[j];
15496 if (LDEBUG) {
15497 cerr << __AFLOW_FUNC__ << " looking for " << vCAR << endl;
15498 }
15499 if (!aurostd::CompressFileExist(vCAR, vCAR_compressed)) {
15500 if (LDEBUG) {
15501 cerr << __AFLOW_FUNC__ << " " << directory + "/" + vCAR << " NOT found" << endl;
15502 }
15503 found_run = false;
15504 break;
15505 }
15506 }
15507 if (!found_run) {
15508 continue;
15509 }
15510 for (size_t i = 0; i < vCARs.size(); i++) {
15511 if (aurostd::FileExist(directory + "/" + vCARs[i])) {
15512 cerr << __AFLOW_FUNC__ << directory + "/" + vCARs[i] << " already exists, cannot overwrite with relax1/relax2/static variant. ";
15513 cerr << "Do not want to overwrite. Please delete: " << directory + "/" + vCARs[i] << endl;
15514 return false;
15515 }
15516 }
15517 // now write!
15518 for (size_t i = 0; i < vCARs.size(); i++) {
15519 vCAR = directory + "/" + vCARs[i] + vruns[j];
15520 aurostd::CompressFileExist(vCAR, vCAR_compressed); // get compressed variant
15521 aurostd::DecompressFile(vCAR_compressed, directory + "/" + vCARs[i], true);
15522 }
15523 cout << __AFLOW_FUNC__ << " Performing dir=" << directory << " run=" << aurostd::toupper(ext) << endl;
15524 xvasp.AnalyzeLabel = ext;
15525 xvasp.str = xstructure(directory + "/CONTCAR", IOAFLOW_AUTO);
15526 KBIN::VASP_Analyze(xvasp, true);
15527 if (!aurostd::FileExist(directory + "/" + DEFAULT_AFLOW_QMVASP_OUT)) {
15528 cerr << __AFLOW_FUNC__ << directory + "/" + DEFAULT_AFLOW_QMVASP_OUT << " was not successfully generated" << endl;
15529 return false;
15530 }
15531 for (size_t i = 0; i < vCARs.size(); i++) {
15532 aurostd::RemoveFile(directory + "/" + vCARs[i]);
15533 }
15534 }
15535
15536 // zip in style of vCAR
15537 for (size_t i = 0; i < vCARs.size(); i++) {
15538 for (size_t j = 0; j < vruns.size(); j++) {
15539 for (size_t k = 0; k < XHOST.vext.size(); k++) {
15540 if (aurostd::FileExist(directory + "/" + vCARs[i] + vruns[j] + XHOST.vext[k])) {
15541 if (!XHOST.vzip.at(k).empty()) {
15542 aurostd::execute(XHOST.command(XHOST.vzip.at(k)) + " -9qf " + xvasp.Directory + "/" + DEFAULT_AFLOW_QMVASP_OUT);
15543 return true;
15544 }
15545 }
15546 }
15547 }
15548 }
15549 return true;
15550 }
15551} // namespace pflow
15552
15553// ***************************************************************************
15554// pflow::RAYTRACE
15555// ***************************************************************************
15556namespace pflow {
15557 void RAYTRACE(vector<string> argv) {
15558 // cout << aflow::Banner("BANNER_TINY") << endl;
15559 pflow::RayTraceManager(argv); // Manage ray tracing related activities.
15560 }
15561} // namespace pflow
15562
15563// ***************************************************************************
15564// pflow::RASMOL
15565// ***************************************************************************
15566namespace pflow {
15567 void RASMOL(const string& options, istream& input) {
15568 const bool LDEBUG = (false || XHOST.DEBUG);
15569 if (LDEBUG) {
15570 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
15571 }
15572 const xvector<int> ijk(3); // default
15573 ijk[1] = 1;
15574 ijk[2] = 1;
15575 ijk[3] = 1; // default
15576 vector<string> tokens;
15577 aurostd::string2tokens(options, tokens, ",");
15578
15579 if (tokens.size() > 3) {
15580 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --rasmol[=n1[,n2[,n3]]] < POSCAR");
15581 }
15582
15583 if (!tokens.empty()) {
15584 ijk[1] = aurostd::string2utype<int>(tokens[0]);
15585 }
15586 if (tokens.size() >= 2) {
15587 ijk[2] = aurostd::string2utype<int>(tokens[1]);
15588 }
15589 if (tokens.size() >= 3) {
15590 ijk[3] = aurostd::string2utype<int>(tokens[2]);
15591 }
15592
15593 ofstream FileOUTPUT;
15594 const string FileOUTPUTName = "aflow.rasmol.xyz." + XHOST.ostrPID.str() + "." + XHOST.ostrTID.str(); // CO20200502 - threadID
15595 FileOUTPUT.open(FileOUTPUTName.c_str(), std::ios::out);
15596 if (FileOUTPUT) {
15597 xvector<int> _ijk(vabs(ijk));
15598 if (max(_ijk) == 0) {
15599 _ijk.set(1);
15600 }
15601 ostringstream aus_exec;
15602 const xstructure a(input, IOAFLOW_AUTO);
15603 PrintXYZ(a, _ijk, FileOUTPUT);
15604 FileOUTPUT.close();
15605 // cerr << _ijk << endl;
15606 aus_exec << XHOST.command("rasmol") << " -xyz " << FileOUTPUTName << endl; // " && rm -f " << FileOUTPUTName << endl;
15607 aurostd::execute(aus_exec);
15608 // aurostd::StringstreamClean(aus_exec);
15609 aurostd::RemoveFile(FileOUTPUTName);
15610 } else {
15611 FileOUTPUT.close();
15612 }
15613 }
15614} // namespace pflow
15615
15616// ***************************************************************************
15617// pflow::RSM
15618// ***************************************************************************
15619namespace pflow {
15620 void RSM(vector<string> argv, istream& input) {
15621 int i;
15622 int j;
15623 int Ntypes = 0;
15624 string strtmp = "";
15625 string AtomSymbol = "";
15626 bool Z_flag = false;
15627 int Z[20]; // to store the z values following --z option
15628
15629 // FINDING -Z
15630 int iargv = 0;
15631 Ntypes = 0;
15632 for (i = 1; i < (int) argv.size(); i++) {
15633 strtmp = argv[i];
15634 if (strtmp == "--Z" or strtmp == "--z") {
15635 Z_flag = true;
15636 iargv = i + 1;
15637 break;
15638 }
15639 }
15640 Ntypes = (int) argv.size() - iargv;
15641 cerr << "Ntypes = " << Ntypes << endl;
15642 for (j = 0; j < Ntypes; j++) {
15643 AtomSymbol = argv.at(j + iargv);
15644 cerr << AtomSymbol << "(";
15645 if (AtomSymbol[0] < '0' || AtomSymbol[0] > '9') {
15646 Z[j] = (int) GetAtomNumber(AtomSymbol);
15647 } else {
15648 Z[j] = aurostd::string2utype<int>(AtomSymbol); // index in Z starts from ZERO
15649 }
15650 cerr << Z[j] << ") ";
15651 }
15652 cerr << endl;
15653
15654 xstructure a(input, IOAFLOW_AUTO);
15655
15656 if (Ntypes < 1) {
15657 Z_flag = false;
15658 Ntypes = a.num_each_type.size();
15659 }
15660 if ((int) a.num_each_type.size() != Ntypes) {
15661 cerr << "STOP: inconsistency in number of types in POSCAR and --z" << endl << "a.num_each_type.size() = " << a.num_each_type.size() << endl << "Ntypes = " << Ntypes << endl;
15662 abort();
15663 }
15664 if (!Z_flag) {
15665 for (i = 0; i < Ntypes; i++) {
15666 Z[i] = i + 1;
15667 }
15668 }
15669
15670 // fixing atoms.type
15671 int k;
15672 int ptr = 0;
15673 for (i = 0; i < Ntypes; i++) {
15674 for (j = 0; j < a.num_each_type.at(i); j++) {
15675 ptr = 0;
15676 for (k = 0; k < i + 1; k++) {
15677 ptr = ptr + a.num_each_type.at(k);
15678 }
15679 ptr = ptr - a.num_each_type.at(i) + j; // ptr=sum(species(1:i))-species(i)+j;
15680 a.atoms.at(ptr).type = Z[i];
15681 }
15682 }
15683
15684 //[CO20220623 - not used]int num_atoms=0;
15685 //[CO20220623 - not used]for(i=0;i<(int) a.num_each_type.size();i++)
15686 //[CO20220623 - not used] num_atoms+=a.num_each_type.at(i);
15687
15688 PrintRSM(a, cout);
15689 }
15690} // namespace pflow
15691
15692// ***************************************************************************
15693// pflow::RBANAL
15694// ***************************************************************************
15695namespace pflow {
15696 void RBANAL(vector<string> argv) {
15697 // cout << aflow::Banner("BANNER_TINY") << endl;
15698 // Read in input files.
15699 const int nim = atoi(argv.at(2).c_str());
15700 const string path_flag(argv.at(3));
15701 PrintRBAnal(nim, path_flag, cout);
15702 }
15703} // namespace pflow
15704
15705// ***************************************************************************
15706// pflow::RBDIST
15707// ***************************************************************************
15708namespace pflow {
15709 void RBDIST(vector<string> argv) {
15710 xstructure strA;
15711 xstructure strB;
15712 ifstream infileA(argv.at(2).c_str());
15713 ifstream infileB(argv.at(3).c_str());
15714 infileA >> strA;
15715 infileB >> strB;
15716 const string path_flag(argv.at(4).c_str());
15717 double totdist;
15718 aurostd::matrix<double> cm(2, 3, 999999); // CO20200404 pflow::matrix()->aurostd::matrix()
15719 xstructure diffstr;
15720 pflow::RBPoscarDisp(strA, strB, diffstr, totdist, cm, path_flag);
15721 PrintRBPoscarDisp(diffstr, totdist, cm, path_flag, cout);
15722 }
15723} // namespace pflow
15724
15725// ***************************************************************************
15726// pflow::RDF
15727// ***************************************************************************
15728namespace pflow {
15729 void RDF(const string& options, istream& input, bool raw_counts) { // CO220627 - rewritten
15730 const bool LDEBUG = (false || XHOST.DEBUG);
15731 if (LDEBUG) {
15732 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
15733 } // CO2020062
15734 vector<string> tokens;
15735 aurostd::string2tokens(options, tokens, ",");
15736 if (tokens.size() > 4) {
15737 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --rdf[=rmax[,nbins[,sigma[,window_gaussian]]]] [--raw_counts] < POSCAR");
15738 }
15739
15740 xstructure a(input, IOAFLOW_AUTO);
15741 if (a.species.empty()) {
15742 a.species = aurostd::vector2deque(pflow::getFakeElements(a.num_each_type.size()));
15743 }
15744 double rmax = 5.0;
15745 int nbins = 25;
15746 double sigma = 0;
15747 int window_gaussian = 0;
15748 if (LDEBUG) {
15749 cerr << __AFLOW_FUNC__ << " tokens.size()=" << tokens.size() << endl;
15750 }
15751 if (!tokens.empty()) {
15752 rmax = aurostd::string2utype<double>(tokens[0]);
15753 }
15754 if (tokens.size() >= 2) {
15755 nbins = aurostd::string2utype<int>(tokens[1]);
15756 }
15757 if (tokens.size() >= 3) {
15758 sigma = aurostd::string2utype<double>(tokens[2]);
15759 }
15760 if (tokens.size() >= 4) {
15761 window_gaussian = aurostd::string2utype<int>(tokens[3]);
15762 }
15763
15765 pflow::GetRDF(a, rdf_all, rmax, nbins, raw_counts, sigma, window_gaussian);
15766 // to be implemented/patched later: GetRDFShells()
15767 // this function is supposed to count the number of wiggles in the rdf above/below horizontal asymptote (constant)
15768 cout << aflow::Banner("BANNER_TINY") << endl;
15769 PrintRDF(a, rmax, nbins, rdf_all, cout);
15770
15771 // stringstream gout;
15772 // xoption plotoptions;
15773
15774 if (LDEBUG) {
15775 cerr << __AFLOW_FUNC__ << " END" << endl;
15776 }
15777 }
15778} // namespace pflow
15779
15780// ***************************************************************************
15781// pflow::RDFCMP
15782// ***************************************************************************
15783namespace pflow {
15784 void RDFCMP(const string& options) {
15785 const bool LDEBUG = (false || XHOST.DEBUG);
15786 if (LDEBUG) {
15787 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
15788 }
15789 vector<string> tokens;
15790 aurostd::string2tokens(options, tokens, ",");
15791 if (tokens.size() != 6) {
15792 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --rdfcmp=rmax,nbins,sigma,nshmax,POSCAR1,POSCAR2");
15793 }
15794 const double rmax = (double) aurostd::string2utype<double>(tokens.at(0));
15795 const int nbins = (int) aurostd::string2utype<int>(tokens.at(1));
15796 const int smooth_width = (int) aurostd::string2utype<int>(tokens.at(2));
15797 const int nsh = (int) aurostd::string2utype<int>(tokens.at(3));
15798
15799 if (!aurostd::FileExist(tokens.at(4))) {
15800 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "file not found: " + tokens.at(4), _FILE_CORRUPT_); // CO20200624
15801 }
15802 if (!aurostd::FileExist(tokens.at(5))) {
15803 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "file not found: " + tokens.at(5), _FILE_CORRUPT_); // CO20200624
15804 }
15805 const xstructure strA(tokens.at(4), IOAFLOW_AUTO);
15806 const xstructure strB(tokens.at(5), IOAFLOW_AUTO);
15807 // Get rdfs
15808 const aurostd::matrix<double> rdf_all_A; // CO20200404 pflow::matrix()->aurostd::matrix()
15809 const aurostd::matrix<double> rdf_all_B; // CO20200404 pflow::matrix()->aurostd::matrix()
15810 const aurostd::matrix<double> rdf_all_A_sm = pflow::GetSmoothRDF(rdf_all_A, smooth_width); // CO20200404 pflow::matrix()->aurostd::matrix()
15811 const aurostd::matrix<double> rdf_all_B_sm = pflow::GetSmoothRDF(rdf_all_B, smooth_width); // CO20200404 pflow::matrix()->aurostd::matrix()
15812 // Get shells
15813 aurostd::matrix<double> rdfsh_all_A; // CO20200404 pflow::matrix()->aurostd::matrix()
15814 aurostd::matrix<double> rdfsh_loc_A; // Radial location of rdf shells. //CO20200404 pflow::matrix()->aurostd::matrix()
15815 aurostd::matrix<double> rdfsh_all_B; // CO20200404 pflow::matrix()->aurostd::matrix()
15816 aurostd::matrix<double> rdfsh_loc_B; // Radial location of rdf shells. //CO20200404 pflow::matrix()->aurostd::matrix()
15817 pflow::GetRDFShells(strA, rmax, nbins, smooth_width, rdf_all_A_sm, rdfsh_all_A, rdfsh_loc_A);
15818 pflow::GetRDFShells(strB, rmax, nbins, smooth_width, rdf_all_B_sm, rdfsh_all_B, rdfsh_loc_B);
15819 vector<int> best_match;
15820 aurostd::matrix<double> rms_mat; // CO20200404 pflow::matrix()->aurostd::matrix()
15821 pflow::CmpRDFShells(strA, strB, rdfsh_all_A, rdfsh_all_B, nsh, best_match, rms_mat);
15822 PrintRDFCmp(strA, strB, rmax, nbins, smooth_width, nsh, rdfsh_all_A, rdfsh_all_B, best_match, rms_mat, cout);
15823 if (LDEBUG) {
15824 cerr << __AFLOW_FUNC__ << " END" << endl;
15825 }
15826 }
15827} // namespace pflow
15828
15829// ***************************************************************************
15830// pflow::RMATOM
15831// ***************************************************************************
15832namespace pflow {
15833 xstructure RMATOM(istream& input, const int& iatom) {
15834 xstructure a(input, IOAFLOW_AUTO);
15835 a.RemoveAtom(iatom);
15836 return a;
15837 }
15838} // namespace pflow
15839
15840// ***************************************************************************
15841// pflow::RMCOPIES
15842// ***************************************************************************
15843namespace pflow {
15844 xstructure RMCOPIES(istream& input) {
15845 xstructure a(input, IOAFLOW_AUTO);
15846 a.RemoveCopies();
15847 return a;
15848 }
15849} // namespace pflow
15850
15851// ***************************************************************************
15852// pflow::SCALE
15853// ***************************************************************************
15854namespace pflow {
15855 xstructure SCALE(const string& options, istream& input) {
15856 const bool LDEBUG = (false || XHOST.DEBUG);
15857 if (LDEBUG) {
15858 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
15859 }
15860 vector<string> tokens;
15861 aurostd::string2tokens(options, tokens, ",");
15862 if (tokens.size() != 1) {
15863 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --scale=s < POSCAR");
15864 }
15865 // move on
15866 const xstructure a(input, IOAFLOW_AUTO);
15867 xstructure b;
15868 b = a;
15869 double scale = 0.0; // some defaults
15870 if (!tokens.empty()) {
15871 scale = aurostd::string2utype<double>(tokens[0]);
15872 }
15873
15874 if (LDEBUG) {
15875 cerr << "DEBUG b.scale=" << b.scale << endl;
15876 }
15877 b = ReScale(b, scale);
15878 if (LDEBUG) {
15879 cerr << "DEBUG b.scale=" << b.scale << endl;
15880 }
15881 b.neg_scale = false;
15882 if (LDEBUG) {
15883 cerr << __AFLOW_FUNC__ << " END" << endl;
15884 }
15885 return b;
15886 }
15887} // namespace pflow
15888
15889// ***************************************************************************
15890// pflow::INFLATE_LATTICE
15891// ***************************************************************************
15892namespace pflow {
15893 xstructure INFLATE_LATTICE(const string& options, istream& input) {
15894 const bool LDEBUG = (false || XHOST.DEBUG);
15895 vector<string> tokens;
15896 aurostd::string2tokens(options, tokens, ",");
15897 if (tokens.size() != 1) {
15898 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --inflate_lattice=coefficient | --ilattice=coefficient < POSCAR");
15899 }
15900 // move on
15901 const xstructure a(input, IOAFLOW_AUTO);
15902 xstructure b;
15903 b = a;
15904 double coefficient = 0.0; // some defaults
15905 if (!tokens.empty()) {
15906 coefficient = aurostd::string2utype<double>(tokens[0]);
15907 }
15908 if (LDEBUG) {
15909 cerr << "DEBUG b.scale=" << b.scale << endl;
15910 }
15911 b = InflateLattice(b, coefficient);
15912 if (LDEBUG) {
15913 cerr << "DEBUG b.scale=" << b.scale << endl;
15914 }
15915 b.neg_scale = false;
15916 if (LDEBUG) {
15917 cerr << __AFLOW_FUNC__ << " END" << endl;
15918 }
15919 return b;
15920 }
15921} // namespace pflow
15922
15923// ***************************************************************************
15924// pflow::INFLATE_VOLUME
15925// ***************************************************************************
15926namespace pflow {
15927 xstructure INFLATE_VOLUME(const string& options, istream& input) {
15928 const bool LDEBUG = (false || XHOST.DEBUG);
15929 vector<string> tokens;
15930 aurostd::string2tokens(options, tokens, ",");
15931 if (tokens.size() != 1) {
15932 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --inflate_volume=coefficient | --ivolume=coefficient < POSCAR");
15933 }
15934 // move on
15935 const xstructure a(input, IOAFLOW_AUTO);
15936 xstructure b;
15937 b = a;
15938 double coefficient = 0.0; // some defaults
15939 if (!tokens.empty()) {
15940 coefficient = aurostd::string2utype<double>(tokens[0]);
15941 }
15942 if (LDEBUG) {
15943 cerr << "DEBUG b.scale=" << b.scale << endl;
15944 }
15945 b = InflateVolume(b, coefficient);
15946 if (LDEBUG) {
15947 cerr << "DEBUG b.scale=" << b.scale << endl;
15948 }
15949 b.neg_scale = false;
15950 if (LDEBUG) {
15951 cerr << __AFLOW_FUNC__ << " END" << endl;
15952 }
15953 return b;
15954 }
15955} // namespace pflow
15956
15957// ***************************************************************************
15958// pflow::SD
15959// ***************************************************************************
15960namespace pflow {
15961 xstructure SD(vector<string> argv, istream& input) {
15962 const xstructure a(input, IOAFLOW_AUTO);
15963 xstructure b;
15964 b = a;
15965 // Read in input file.
15966 // Set a sd vector
15967 const int num_types = a.num_each_type.size();
15968 vector<string> sd(num_types);
15969 for (int i = 0; i < num_types; i++) {
15970 sd[i] = "TTT";
15971 }
15972 // vector<string> sd(argv.size()-2);
15973 for (int i = 0; i < min(((int) argv.size() - 2), num_types); i++) {
15974 sd[i] = string(argv.at(i + 2));
15975 }
15976 b.isd = true;
15977 b = SetSDTypes(b, sd);
15978 return b;
15979 }
15980} // namespace pflow
15981
15982// ***************************************************************************
15983// pflow::SETCM
15984// ***************************************************************************
15985namespace pflow {
15986 xstructure SETCM(istream& input, const xvector<double>& newcm) {
15987 xstructure str(input, IOAFLOW_AUTO);
15988 const xvector<double> oldcm(GetMom1(str));
15989 str = ShiftCPos(str, (newcm - oldcm) / str.scale);
15990 return str;
15991 }
15992} // namespace pflow
15993
15994// ***************************************************************************
15995// pflow::SETORIGIN
15996// ***************************************************************************
15997namespace pflow {
15998 xstructure SETORIGIN(istream& input, const xvector<double>& neworigin) {
15999 xstructure str(input, IOAFLOW_AUTO);
16000 // xvector<double> oldorigin(GetMom1(str));
16001 xvector<double> oldorigin(3);
16002 oldorigin.clear();
16003 // str=ShiftCPos(str,(neworigin-oldorigin)/str.scale);
16004 if (str.coord_flag == _COORDS_CARTESIAN_) {
16005 str = ShiftCPos(str, -(neworigin - oldorigin));
16006 }
16007 if (str.coord_flag == _COORDS_FRACTIONAL_) {
16008 str = ShiftFPos(str, -(neworigin - oldorigin));
16009 }
16010 // str=pflow::SetOrigin(str,neworigin);
16011 return str;
16012 }
16013} // namespace pflow
16014
16015namespace pflow {
16016 xstructure SETORIGIN(istream& input, const int& natom) {
16017 xstructure str(input, IOAFLOW_AUTO);
16018 if (natom < 0) {
16019 return str;
16020 }
16021 if (natom < (int) str.atoms.size()) {
16022 if (str.coord_flag == _COORDS_CARTESIAN_) {
16023 str = ShiftCPos(str, -str.atoms.at((uint) natom).cpos);
16024 }
16025 if (str.coord_flag == _COORDS_FRACTIONAL_) {
16026 str = ShiftFPos(str, -str.atoms.at((uint) natom).fpos);
16027 }
16028 }
16029 return str;
16030 }
16031} // namespace pflow
16032
16033// ***************************************************************************
16034// pflow::SEWALD
16035// ***************************************************************************
16036namespace pflow {
16037 void SEWALD(vector<string> argv, istream& input) {
16038 // cout << aflow::Banner("BANNER_TINY") << endl;
16039 double Ks = atof(argv.at(2).c_str());
16040 const double SUMTOL = 1.0e-16;
16041 xstructure str(input, IOAFLOW_AUTO);
16042 str = GetNiggliStr(str);
16043 double epoint = 0.0;
16044 double ereal = 0.0;
16045 double erecip = 0.0;
16046 double eewald = 0.0;
16047 ereal = pflow::ScreenedESEner(str, Ks, SUMTOL);
16048 eewald = ereal;
16049 pflow::PrintEwald(str, epoint, ereal, erecip, eewald, Ks, SUMTOL, cout);
16050 }
16051} // namespace pflow
16052
16053// ***************************************************************************
16054// pflow::SG
16055// ***************************************************************************
16056namespace pflow {
16057 string SG(aurostd::xoption& vpflow, istream& input, string mode, string print) {
16058 const bool LDEBUG = (false || XHOST.DEBUG);
16059 string flag_name = "SG::" + mode; // DX20170926
16060 stringstream message; // DX20200103
16061 if (print == "LABEL" || print == "NUMBER") {
16062 flag_name += "_" + print;
16063 }
16064 const string options = vpflow.getattachedscheme(flag_name); // DX20170926
16065 if (LDEBUG) {
16066 cerr << XPID << "pflow::SG: mode=" << mode << endl;
16067 }
16068
16069 vector<string> tokens;
16070 aurostd::string2tokens(options, tokens, ",");
16071 if (tokens.size() == 1) {
16072 if (tokens[0] == "usage" || tokens[0] == "USAGE") {
16074 aurostd::liststring2string("aflow --aflowSG[=<tolerance_value>|=tight|=loose] [--mag|--magnetic|--magmom=[m1,m2,...|INCAR|OUTCAR]] < POSCAR default: "
16075 "(minimum_interatomic_distance)/100.0",
16076 "aflow --platonSG[_label,_number][=EQUAL| EXACT][,ang,d1,d2,d3] < POSCAR default:" + string("EQUAL=") + aurostd::utype2string<int>(DEFAULT_PLATON_P_EQUAL) +
16079 "aflow --findsymSG[_label,_number][=tolerance] < POSCAR default:" + aurostd::utype2string(DEFAULT_FINDSYM_TOL, 5)));
16080 return ""; // CO20200624 - the option was expressed successfully
16081 }
16082 }
16083 // move on
16084
16085 if (LDEBUG) {
16086 cerr << XPID << "pflow::SG: tokens.size()=" << tokens.size() << endl;
16087 }
16088
16089 // check usage
16090 // if(LDEBUG) cerr << XPID << "pflow::SG: vpflow.getattachedscheme(\"SG::USAGE\")=" << vpflow.flag("SG::USAGE") << endl;
16091
16092 if (input.peek() == EOF) {
16093 message << "File is empty. Check POSCAR.";
16094 throw aurostd::xerror(__AFLOW_FILE__, flag_name, message, _INPUT_MISSING_);
16095 }
16096 xstructure a(input, IOAFLOW_AUTO);
16097 // DX20180527 - use pwd - START
16098 if (a.directory.empty()) {
16099 a.directory = aurostd::getPWD();
16100 }
16101 // DX20180527 - use pwd - END
16102 // cerr << a << endl;
16103 // AFLOW ENGINE RHT
16104 if (mode == "AFLOW" || mode == "aflow") { // RHT
16105 if (LDEBUG) {
16106 cerr << XPID << "pflow::SG: aflow" << endl;
16107 }
16108 // DX START
16109 a.ReScale(1.0);
16110 // DX20170921 - MAGNETIC SYMMETRY - START
16111 if (vpflow.flag("SG::MAGNETIC")) {
16112 const string magmom_info = vpflow.getattachedscheme("SG::MAGNETIC");
16113 ProcessAndAddSpinToXstructure(a, magmom_info); // DX20191108 - condensed into a single function
16114 }
16115 // DX20170921 - MAGNETIC SYMMETRY - END
16116 // DX END
16117
16118 // get tolerance
16119 double tolerance = pflow::getSymmetryTolerance(a, vpflow.getattachedscheme("SG::TOLERANCE")); // DX20200820 - consolidated setting tolerance into a function
16120
16121 bool tolerance_spectrum_analysis = false;
16122 vector<double> tolerance_spectrum;
16123 // DX20200817 - SPACEGROUP SPECTRUM - START
16124 if (vpflow.flag("SG::TOLERANCE_SPECTRUM")) {
16125 tolerance_spectrum_analysis = true;
16126 tolerance_spectrum = pflow::getSymmetryToleranceSpectrum(vpflow.getattachedscheme("SG::TOLERANCE_SPECTRUM"));
16127 } else if (vpflow.flag("SG::TOLERANCE") && vpflow.flag("SG::TOLERANCE_SPECTRUM")) {
16128 message << "pflow::SG::ERROR: Cannot specify a single tolerance value and perform the tolerance spectrum at the same time. Please choose one or the other.";
16129 throw aurostd::xerror(__AFLOW_FILE__, flag_name, message, _INPUT_ILLEGAL_);
16130 }
16131 // DX20200817 - SPACEGROUP SPECTRUM - END
16132 // DX20170926 - NO SCAN - START
16133 if (vpflow.flag("SG::NO_SCAN")) {
16134 a.sym_eps_no_scan = true; // DX20210406
16135 }
16136 // DX20170926 - NO SCAN - END
16137 if (!tolerance_spectrum_analysis) {
16138 const uint sgroup = a.SpaceGroup_ITC(tolerance, a.sym_eps_no_scan);
16139 a.spacegroup = GetSpaceGroupName(sgroup, a.directory) + " #" + aurostd::utype2string(sgroup); // DX20190319 - put directory name
16140 } else {
16141 // perform space group analysis through a range of tolerances //DX20200820
16142 for (size_t i = 0; i < tolerance_spectrum.size(); i++) {
16143 const uint sgroup = a.SpaceGroup_ITC(tolerance_spectrum[i], a.sym_eps_no_scan);
16144 try {
16145 GetSpaceGroupName(sgroup, a.directory);
16146 cout << "tol=" << tolerance_spectrum[i] << ": " << GetSpaceGroupName(sgroup, a.directory) << " #" << aurostd::utype2string(sgroup) << endl;
16147 } catch (aurostd::xerror& excpt) {
16148 cout << "tol=" << tolerance_spectrum[i] << ": -" << endl;
16149 }
16150 }
16151 return "";
16152 }
16153 // return a.spacegroup; //RHT
16154 }
16155
16156 if (mode == "PLATON" || mode == "platon") {
16157 if (LDEBUG) {
16158 cerr << XPID << "pflow::SG: platon" << endl;
16159 }
16160 // SIMPLE CALCULATION
16161 // output << a.platon2sg() << endl;
16162 // PERFECT CALCULATION
16163 bool Platon_EQUAL = DEFAULT_PLATON_P_EQUAL;
16164 bool Platon_EXACT = DEFAULT_PLATON_P_EXACT;
16165 double Platon_ang = DEFAULT_PLATON_P_ANG;
16166 double Platon_d1 = DEFAULT_PLATON_P_D1;
16167 double Platon_d2 = DEFAULT_PLATON_P_D2;
16168 double Platon_d3 = DEFAULT_PLATON_P_D3;
16169 // DX20170926 - FLAGS - START
16170 if (vpflow.flag("SG::TOLERANCE")) {
16171 const string tolerance_string = vpflow.getattachedscheme("SG::TOLERANCE");
16172 vector<string> tol_tokens;
16173 aurostd::string2tokens(tolerance_string, tol_tokens, ",");
16174 // if(tokens.size()==0) Platon_ang=1.0e-2;
16175 // if(tokens.size()==1) Platon_ang=aurostd::string2utype<double>(tokens.at(0));
16176 // Read in input file.
16177 if ((!tol_tokens.empty() && tol_tokens[0] == "EQUAL") || (tol_tokens.size() >= 2 && tol_tokens[1] == "EQUAL")) {
16178 Platon_EQUAL = true;
16179 }
16180 if ((!tol_tokens.empty() && tol_tokens[0] == "EXACT") || (tol_tokens.size() >= 2 && tol_tokens[1] == "EXACT")) {
16181 Platon_EXACT = true;
16182 }
16183 if (tol_tokens.size() >= 3) {
16184 Platon_ang = aurostd::string2utype<double>(tol_tokens.at(tol_tokens.size() - 4));
16185 Platon_d1 = aurostd::string2utype<double>(tol_tokens.at(tol_tokens.size() - 3));
16186 Platon_d2 = aurostd::string2utype<double>(tol_tokens.at(tol_tokens.size() - 2));
16187 Platon_d3 = aurostd::string2utype<double>(tol_tokens.at(tol_tokens.size() - 1));
16188 }
16189 }
16190 // DX20170926 - FLAGS - END
16191 a.platon2sg(Platon_EQUAL, Platon_EXACT, Platon_ang, Platon_d1, Platon_d2, Platon_d3);
16192 // return a.spacegroup;
16193 }
16194
16195 if (mode == "FINDSYM" || mode == "findsym") {
16196 if (LDEBUG) {
16197 cerr << XPID << "pflow::SG: findsym" << endl;
16198 }
16199 // SIMPLE CALCULATION
16200 double tolerance = DEFAULT_FINDSYM_TOL;
16201 if (vpflow.flag("SG::TOLERANCE")) {
16202 const string tolerance_string = vpflow.getattachedscheme("SG::TOLERANCE");
16203 vector<string> tol_tokens;
16204 aurostd::string2tokens(tolerance_string, tol_tokens, ",");
16205 if (tol_tokens.empty()) {
16206 tolerance = DEFAULT_FINDSYM_TOL;
16207 }
16208 if (tol_tokens.size() == 1) {
16209 tolerance = aurostd::string2utype<double>(tol_tokens[0]);
16210 }
16211 }
16212 a.findsym2sg(tolerance);
16213 // return a.spacegroup;
16214 }
16215 // what to print
16216
16217 // vector<string> tokens;
16218 if (print == "LABEL" || print == "label") {
16219 aurostd::string2tokens(a.spacegroup, tokens, " ");
16220 return tokens[0];
16221 }
16222 if (print == "NUMBER" || print == "number") {
16223 aurostd::string2tokens(a.spacegroup, tokens, " ");
16224 return tokens[1];
16225 }
16226 return a.spacegroup;
16227
16228 // return NOSG;
16229 }
16230} // namespace pflow
16231
16232// ***************************************************************************
16233// pflow::SHELL
16234// ***************************************************************************
16235namespace pflow {
16236 void SHELL(const string& options, istream& input) {
16237 const bool LDEBUG = (false || XHOST.DEBUG);
16238 if (LDEBUG) {
16239 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
16240 }
16241 vector<string> tokens;
16242 aurostd::string2tokens(options, tokens, ",");
16243 if (tokens.size() != 5) {
16244 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --shell=ns,r1,r2,name,dens < POSCAR");
16245 }
16246
16247 int ns = 4; // some defaults
16248 double r1 = 1.8;
16249 double r2 = 2.2; // some defaults
16250 string name; // some defaults
16251 const int dens = 20; // some defaults
16252 if (!tokens.empty()) {
16253 ns = aurostd::string2utype<int>(tokens[0]);
16254 }
16255 if (tokens.size() >= 2) {
16256 r1 = aurostd::string2utype<double>(tokens[1]);
16257 }
16258 if (tokens.size() >= 3) {
16259 r2 = aurostd::string2utype<double>(tokens[2]);
16260 }
16261 if (tokens.size() >= 4) {
16262 name = tokens[3];
16263 }
16264 if (tokens.size() >= 5) {
16265 ns = aurostd::string2utype<int>(tokens[4]);
16266 }
16267
16268 cout << aflow::Banner("BANNER_TINY") << endl;
16269 const xstructure a(input, IOAFLOW_AUTO);
16270
16271 PrintShell(a, ns, r1, r2, name, dens, cout);
16272
16273 if (LDEBUG) {
16274 cerr << __AFLOW_FUNC__ << " END" << endl;
16275 }
16276 }
16277} // namespace pflow
16278
16279// ***************************************************************************
16280// pflow::SHIFT
16281// ***************************************************************************
16282namespace pflow {
16283 xstructure SHIFT(const string& options, istream& input) {
16284 const bool LDEBUG = (false || XHOST.DEBUG);
16285 if (LDEBUG) {
16286 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
16287 }
16288 vector<string> tokens;
16289 aurostd::string2tokens(options, tokens, ",");
16290 if (tokens.size() != 3 && tokens.size() != 4) {
16291 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --shift=Sx,Sy,Sz[,cCdD] < POSCAR");
16292 }
16293 // cout << aflow::Banner("BANNER_TINY") << endl;
16294 // Get shift vector
16295 const xvector<double> shift(3);
16296 for (int ic = 1; ic <= 3; ic++) {
16297 shift[ic] = aurostd::string2utype<double>(tokens.at(ic - 1));
16298 }
16299 // argv(4)=c cart,d for direct shift
16300 bool flag = false;
16301 if (tokens.size() == 3) {
16302 cerr << "WARNING - pflow::SHIFT: 4th argument can be [cCfFdD], defaulting to [cC]=Cartesian shift" << endl;
16303 } else {
16304 if (tokens.at(3) == "c" || tokens.at(3) == "C") {
16305 flag = false;
16306 } else {
16307 if (tokens.at(3) == "d" || tokens.at(3) == "D" || tokens.at(3) == "f" || tokens.at(3) == "F") {
16308 flag = true;
16309 } else {
16310 cerr << "WARNING - pflow::SHIFT: 4th argument can be [cCfFdD], Defaulting to [cC]=Cartesian shift" << endl;
16311 flag = false;
16312 } // else
16313 } // else
16314 } // else
16315 // Read in input file.
16316 xstructure str(input, IOAFLOW_AUTO);
16317 str = ShiftPos(str, shift, flag);
16318 if (LDEBUG) {
16319 cerr << __AFLOW_FUNC__ << " END" << endl;
16320 }
16321 return str;
16322 }
16323} // namespace pflow
16324
16325// ***************************************************************************
16326// pflow::SG
16327// ***************************************************************************
16328namespace pflow {
16329 void SG(istream& input) {
16330 xstructure a(input, IOAFLOW_AUTO);
16331 a.CalculateSymmetryFactorGroup(true);
16332 spacegroup::SpaceGroupInitialize();
16333 cerr << a.pgroup.size() << "," << a.fgroup.size() << endl;
16334 cerr.flush();
16335 xmatrix<double> I(3, 3);
16336 xmatrix<double> U(3, 3);
16337 xmatrix<double> A(3, 3);
16338 xvector<double> tau(3);
16339 I = identity(I);
16340 for (size_t i = 0; i < a.fgroup.size(); i++) {
16341 U = a.fgroup[i].Uf;
16342 tau = a.fgroup[i].ftau;
16343 A = I - U;
16344 if (std::abs(det(A)) > 0.01) {
16345 cerr << inverse(A) * tau << endl;
16346 }
16347 }
16348 // spacegroup::SpaceGroupNumberStructure(a);
16349 }
16350} // namespace pflow
16351
16352// ***************************************************************************
16353// pflow::SGROUP
16354// ***************************************************************************
16355namespace pflow {
16356 void SGROUP(_aflags& aflags, istream& input, double radius) {
16357 cout << aflow::Banner("BANNER_TINY") << endl;
16358 aflags.QUIET = true;
16359 xstructure a(input, IOAFLOW_AUTO);
16360 const bool WRITE = true;
16361 ofstream File("/dev/null");
16362 SYM::CalculatePointGroup(File, a, aflags, WRITE, true, cout);
16363 SYM::CalculatePointGroupKLattice(File, a, aflags, WRITE, true, cout);
16364 SYM::CalculateFactorGroup(File, a, aflags, WRITE, true, cout);
16365 SYM::CalculatePointGroupCrystal(File, a, aflags, WRITE, true, cout);
16366 a.sgroup_radius = radius;
16367 SYM::CalculateSpaceGroup(File, a, aflags, WRITE, true, cout);
16368 }
16369} // namespace pflow
16370
16371// ***************************************************************************
16372// pflow::SPECIES
16373// ***************************************************************************
16374namespace pflow {
16375 string SPECIES(istream& input) {
16376 xstructure a(input, IOAFLOW_AUTO);
16377 string strout = a.SpeciesString() + "\n";
16378 return strout;
16379 }
16380} // namespace pflow
16381
16382// ***************************************************************************
16383// pflow::SPLINE
16384// ***************************************************************************
16385namespace pflow {
16386 void SPLINE(vector<string> argv) {
16387 // Read in input data.
16388 vector<double> x;
16389 vector<double> y;
16390 double p;
16391 double q;
16392 char dum[500];
16393 while (cin >> p >> q) {
16394 x.push_back(p);
16395 y.push_back(q);
16396 cin.getline(dum, 500); // Get anything else on line.
16397 }
16398 const int npts = atoi(argv.at(2).c_str());
16399 pflow::PrintSpline(x, y, npts, cout);
16400 }
16401} // namespace pflow
16402
16403// ***************************************************************************
16404// pflow::SUMPDOS
16405// ***************************************************************************
16406namespace pflow {
16407 void SUMPDOS(vector<string> argv) {
16408 cerr << "# WARNING: THIS REQUIRES THAT YOU HAVE PDOS IN DOSCAR FILE - THIS IS OBTAINED BY RUNNING WITH LORBIT=2 - SEE aflow --h" << endl;
16409 ifstream SumPDOSParams_infile(argv.at(2).c_str());
16410 aurostd::InFileExistCheck("convasp.cc", argv.at(2), SumPDOSParams_infile);
16411 ifstream PDOS_infile(argv.at(3).c_str());
16412 aurostd::InFileExistCheck("convasp.cc", argv.at(3), PDOS_infile);
16413 pflow::pdosdata pdd;
16414 aurostd::matrix<aurostd::matrix<double>> allpdos; // CO20200404 pflow::matrix()->aurostd::matrix()
16415 pflow::ReadSumDOSParams(SumPDOSParams_infile, pdd);
16416 // projdata prd;
16417 // pdd.PrintParams(cout,prd.LMnames);
16418 pflow::ReadInPDOSData(allpdos, pdd, PDOS_infile);
16419 SumPDOS(allpdos, pdd);
16420 }
16421} // namespace pflow
16422
16423// ***************************************************************************
16424// pflow::SUPERCELL
16425// ***************************************************************************
16426namespace pflow {
16427 xstructure SUPERCELL(const string& options, istream& input) {
16428 const bool LDEBUG = (false || XHOST.DEBUG);
16429 if (LDEBUG) {
16430 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
16431 }
16432 const xstructure str(input, IOAFLOW_AUTO);
16433 vector<string> tokens;
16434 aurostd::string2tokens(options, tokens, ",");
16435 const xmatrix<double> msc(3, 3);
16436
16437 if (tokens.size() != 9 && tokens.size() != 3 && tokens.size() != 1) {
16439 aurostd::liststring2string("aflow --supercell=a11,a12,a13,a21,a22,a23,a31,a32,a33 < POSCAR", "aflow --supercell=a11,a22,a33 < POSCAR", "aflow --supercell=file < POSCAR"));
16440 }
16441
16442 if (tokens.size() == 9) {
16443 if (LDEBUG) {
16444 cerr << __AFLOW_FUNC__ << " 9 entries" << endl;
16445 }
16446 msc(1, 1) = aurostd::string2utype<double>(tokens[0]);
16447 msc(1, 2) = aurostd::string2utype<double>(tokens[1]);
16448 msc(1, 3) = aurostd::string2utype<double>(tokens[2]);
16449 msc(2, 1) = aurostd::string2utype<double>(tokens[3]);
16450 msc(2, 2) = aurostd::string2utype<double>(tokens[4]);
16451 msc(2, 3) = aurostd::string2utype<double>(tokens[5]);
16452 msc(3, 1) = aurostd::string2utype<double>(tokens[6]);
16453 msc(3, 2) = aurostd::string2utype<double>(tokens[7]);
16454 msc(3, 3) = aurostd::string2utype<double>(tokens[8]);
16455 if (std::abs(det(msc)) < 0.01) {
16456 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "singular supercell matrix", _INPUT_ILLEGAL_); // CO20200624
16457 }
16458 if (LDEBUG) {
16459 cerr << __AFLOW_FUNC__ << " END" << endl;
16460 }
16461 return GetSuperCell(str, msc);
16462 }
16463
16464 if (tokens.size() == 3) {
16465 if (LDEBUG) {
16466 cerr << __AFLOW_FUNC__ << " 3 entries" << endl;
16467 }
16468 msc(1, 1) = aurostd::string2utype<double>(tokens[0]);
16469 msc(2, 2) = aurostd::string2utype<double>(tokens[1]);
16470 msc(3, 3) = aurostd::string2utype<double>(tokens[2]);
16471 if (std::abs(det(msc)) < 0.01) {
16472 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "singular supercell matrix", _INPUT_ILLEGAL_); // CO20200624
16473 }
16474 if (LDEBUG) {
16475 cerr << __AFLOW_FUNC__ << " END" << endl;
16476 }
16477 return GetSuperCell(str, msc);
16478 }
16479
16480 if (tokens.size() == 1) {
16481 if (LDEBUG) {
16482 cerr << __AFLOW_FUNC__ << " 1 entries" << endl;
16483 }
16484 ifstream infile(tokens[0].c_str());
16485 aurostd::InFileExistCheck(__AFLOW_FUNC__, tokens[0].c_str(), infile);
16486 for (int i = 1; i <= 3; i++) {
16487 for (int j = 1; j <= 3; j++) {
16488 infile >> msc(i, j);
16489 }
16490 }
16491 if (std::abs(det(msc)) < 0.01) {
16492 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "singular supercell matrix", _INPUT_ILLEGAL_); // CO20200624
16493 }
16494 if (LDEBUG) {
16495 cerr << __AFLOW_FUNC__ << " END" << endl;
16496 }
16497 return GetSuperCell(str, msc);
16498 }
16499 return str;
16500 }
16501} // namespace pflow
16502
16503// ***************************************************************************
16504// pflow::SUPERCELLSTRLIST
16505// ***************************************************************************
16506namespace pflow {
16507 void SUPERCELLSTRLIST(const string& options) {
16508 const bool LDEBUG = (false || XHOST.DEBUG);
16509 if (LDEBUG) {
16510 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
16511 }
16512 vector<string> tokens;
16513 aurostd::string2tokens(options, tokens, ",");
16514 const xmatrix<double> msc(3, 3);
16515
16516 string infile_name;
16517
16518 if (tokens.size() != 10 && tokens.size() != 4 && tokens.size() != 2) {
16520 options, __AFLOW_FUNC__,
16521 aurostd::liststring2string("aflow --supercell_strlist=a11,a12,a13,a21,a22,a23,a31,a32,a33,strlist", "aflow --supercell_strlist=a11,a22,a33,strlist", "aflow --supercell_strlist=file,strlist"));
16522 }
16523
16524 if (tokens.size() == 10) {
16525 if (LDEBUG) {
16526 cerr << __AFLOW_FUNC__ << " 10 entries" << endl;
16527 }
16528 msc(1, 1) = aurostd::string2utype<double>(tokens[0]);
16529 msc(1, 2) = aurostd::string2utype<double>(tokens[1]);
16530 msc(1, 3) = aurostd::string2utype<double>(tokens[2]);
16531 msc(2, 1) = aurostd::string2utype<double>(tokens[3]);
16532 msc(2, 2) = aurostd::string2utype<double>(tokens[4]);
16533 msc(2, 3) = aurostd::string2utype<double>(tokens[5]);
16534 msc(3, 1) = aurostd::string2utype<double>(tokens[6]);
16535 msc(3, 2) = aurostd::string2utype<double>(tokens[7]);
16536 msc(3, 3) = aurostd::string2utype<double>(tokens[8]);
16537 infile_name = tokens[9];
16538 if (std::abs(det(msc)) < 0.01) {
16539 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "singular supercell matrix", _INPUT_ILLEGAL_); // CO20200624
16540 }
16541 }
16542 if (tokens.size() == 4) {
16543 if (LDEBUG) {
16544 cerr << __AFLOW_FUNC__ << " 4 entries" << endl;
16545 }
16546 msc(1, 1) = aurostd::string2utype<double>(tokens[0]);
16547 msc(2, 2) = aurostd::string2utype<double>(tokens[1]);
16548 msc(3, 3) = aurostd::string2utype<double>(tokens[2]);
16549 infile_name = tokens[3];
16550 if (std::abs(det(msc)) < 0.01) {
16551 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "singular supercell matrix", _INPUT_ILLEGAL_); // CO20200624
16552 }
16553 }
16554 if (tokens.size() == 2) {
16555 if (LDEBUG) {
16556 cerr << __AFLOW_FUNC__ << " 2 entries" << endl;
16557 }
16558 ifstream infile(tokens[0].c_str());
16559 aurostd::InFileExistCheck(__AFLOW_FUNC__, tokens[0].c_str(), infile);
16560 for (int i = 1; i <= 3; i++) {
16561 for (int j = 1; j <= 3; j++) {
16562 infile >> msc(i, j);
16563 }
16564 }
16565 infile_name = tokens[1];
16566 if (std::abs(det(msc)) < 0.01) {
16567 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "singular supercell matrix", _INPUT_ILLEGAL_); // CO20200624
16568 }
16569 }
16570 // ifstream infile(infile_name.c_str());
16571 // aurostd::InFileExistCheck("aflow",infile_name,infile,cerr);
16572 aurostd::matrix<double> mmsc(3, 3); // CO20200404 pflow::matrix()->aurostd::matrix()
16573 // if(LDEBUG) cerr << __AFLOW_FUNC__ << " msc=" << msc << endl;
16574 mmsc = aurostd::xmatrix2matrix(msc); // CO20200404 pflow::matrix()->aurostd::matrix()
16575 // pflow::Mout(mmsc,cout);
16576 ifstream list_inf(infile_name.c_str());
16577 aurostd::InFileExistCheck(__AFLOW_FUNC__, infile_name, list_inf);
16578 vector<xstructure> vstr;
16579 vector<xstructure> vstr_sc;
16580 pflow::ReadInStrVec(vstr, list_inf);
16581 for (size_t i = 0; i < vstr.size(); i++) {
16582 vstr_sc.push_back(vstr[i]);
16583 }
16584 pflow::SuperCellStrVec(vstr_sc, mmsc);
16585 pflow::PrintStrVec(vstr_sc, cout);
16586 cerr << __AFLOW_FUNC__ << " vstr_sc.size()=" << vstr_sc.size() << endl;
16587 }
16588} // namespace pflow
16589
16590// ***************************************************************************
16591// pflow::xstrSWAP
16592// ***************************************************************************
16593namespace pflow {
16594 xstructure xstrSWAP(vector<string> argv, istream& input) {
16595 xstructure a(input, IOAFLOW_AUTO);
16596 const int speciesA = aurostd::string2utype<int>(argv.at(2));
16597 const int speciesB = aurostd::string2utype<int>(argv.at(3));
16598 if (speciesA < 0) {
16599 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "speciesA<0 (speciesA=" + aurostd::utype2string(speciesA) + ")", _INPUT_ILLEGAL_); // CO20200624
16600 }
16601 if (speciesA >= (int) a.num_each_type.size()) {
16602 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "speciesA>=num_each_type.size() (speciesA=" + aurostd::utype2string(speciesA) + ")", _INPUT_ILLEGAL_); // CO20200624
16603 }
16604 if (speciesB < 0) {
16605 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "speciesB<0 (speciesB=" + aurostd::utype2string(speciesB) + ")", _INPUT_ILLEGAL_); // CO20200624
16606 }
16607 if (speciesB >= (int) a.num_each_type.size()) {
16608 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "speciesB>=num_each_type.size() (speciesB=" + aurostd::utype2string(speciesB) + ")", _INPUT_ILLEGAL_); // CO20200624
16609 }
16610 a.SpeciesSwap(speciesA, speciesB);
16611 return a;
16612 }
16613} // namespace pflow
16614
16615// ***************************************************************************
16616// pflow::VOLUME
16617// ***************************************************************************
16618namespace pflow {
16619 xstructure VOLUME(const string& options, istream& input) {
16620 const bool LDEBUG = (false || XHOST.DEBUG);
16621 if (LDEBUG) {
16622 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
16623 }
16624 vector<string> tokens;
16625 aurostd::string2tokens(options, tokens, ",");
16626 if (tokens.size() != 2) {
16627 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --volume[|*|+]=x < POSCAR");
16628 }
16629 xstructure a(input, IOAFLOW_AUTO);
16630 if (tokens.at(0) == "VOLUME::EQUAL") {
16631 a = SetVolume(a, aurostd::string2utype<double>(tokens.at(1)));
16632 }
16633 if (tokens.at(0) == "VOLUME::MULTIPLY_EQUAL") {
16634 a = SetVolume(a, a.Volume() * aurostd::string2utype<double>(tokens.at(1)));
16635 }
16636 if (tokens.at(0) == "VOLUME::PLUS_EQUAL") {
16637 a = SetVolume(a, a.Volume() + aurostd::string2utype<double>(tokens.at(1)));
16638 }
16639 if (LDEBUG) {
16640 cerr << __AFLOW_FUNC__ << " END" << endl;
16641 }
16642 return a;
16643 }
16644} // namespace pflow
16645
16646// DX20180807 - put wyccar options into pflow - START
16647// ***************************************************************************
16648// pflow::WyckoffPositions()
16649// ***************************************************************************
16650namespace pflow {
16651 string WyckoffPositions(aurostd::xoption& vpflow, istream& input) {
16652 const bool LDEBUG = (false || XHOST.DEBUG);
16653 if (LDEBUG) {
16654 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
16655 }
16656
16657 const string options = vpflow.getattachedscheme("WYCKOFF_POSITIONS");
16658 vector<string> tokens;
16659 aurostd::string2tokens(options, tokens, ",");
16660 if (vpflow.flag("WYCKOFF_POSITIONS::USAGE")) {
16662 aurostd::liststring2string("aflow --Wyckoff|--Wyckoff_positions|--wyckoff|--wyckoff_positions|--wyccar[=<tolerance_value>|=tight|=loose] [--no_scan] [--setting=1|2|aflow] "
16663 "[--magmom=[m1,m2,...|INCAR|OUTCAR]] < file default: tolerance=(minimum_interatomic_distance)/100.0, setting=1"));
16664 return ""; // CO20200624 - the option was expressed successfully
16665 }
16666 // DX20190201 START
16667 const bool wyccar = vpflow.flag("WYCKOFF_POSITIONS::PRINT_WYCCAR"); // DX20210525
16668 const bool letters_only = vpflow.flag("WYCKOFF_POSITIONS::PRINT_LETTERS_ONLY");
16669 const bool site_symmetries_only = vpflow.flag("WYCKOFF_POSITIONS::PRINT_SITE_SYMMETRIES_ONLY");
16670 const bool multiplicities_only = vpflow.flag("WYCKOFF_POSITIONS::PRINT_MULTIPLICITIES_ONLY");
16671
16672 // DX20190201 END
16673 xstructure str(input, IOAFLOW_AUTO);
16674 str.ReScale(1.0);
16675
16676 // get tolerance
16677 double tolerance = pflow::getSymmetryTolerance(str, vpflow.getattachedscheme("WYCKOFF_POSITIONS::TOLERANCE")); // DX20200820 - consolidated setting tolerance into a function
16678
16679 // ---------------------------------------------------------------------------
16680 // get space group setting
16681 const uint setting = pflow::getSpaceGroupSetting(vpflow.getattachedscheme("WYCKOFF_POSITIONS::SETTING")); // DX20210421 - consolidated space group setting into function
16682
16683 // get magnetic moment
16684 if (vpflow.flag("WYCKOFF_POSITIONS::MAGNETIC")) {
16685 const string magmom_info = vpflow.getattachedscheme("WYCKOFF_POSITIONS::MAGNETIC");
16686 ProcessAndAddSpinToXstructure(str, magmom_info); // DX20191108 - condensed into a single function
16687 }
16688
16689 // tolerance scan
16690 if (vpflow.flag("WYCKOFF_POSITIONS::NO_SCAN")) {
16691 str.sym_eps_no_scan = true; // DX20210406
16692 }
16693 // DX20190201 START
16694 const uint space_group_number = str.SpaceGroup_ITC(tolerance, -1, setting, str.sym_eps_no_scan);
16695
16696 if (wyccar) {
16697 stringstream ss_output;
16698 str.iomode = IOVASP_WYCKCAR;
16699 ss_output << str;
16700 return ss_output.str();
16701 } else if (letters_only) {
16702 const string letters = SYM::ExtractWyckoffLettersString(str.wyccar_ITC);
16703 string sym_info = "sg=" + aurostd::utype2string<uint>(space_group_number) + ": " + letters;
16704 return sym_info;
16705 } else if (site_symmetries_only) {
16706 const string site_symmetries = SYM::ExtractWyckoffSiteSymmetriesString(str.wyccar_ITC);
16707 string sym_info = "sg=" + aurostd::utype2string<uint>(space_group_number) + ": " + site_symmetries;
16708 return sym_info;
16709 } else if (multiplicities_only) {
16710 const string multiplicities = SYM::ExtractWyckoffMultiplicitiesString(str.wyccar_ITC);
16711 string sym_info = "sg=" + aurostd::utype2string<uint>(space_group_number) + ": " + multiplicities;
16712 return sym_info;
16713 }
16714
16715 const bool already_calculated = true;
16716 // ---------------------------------------------------------------------------
16717 // file type //DX20210525 - string to filetype
16718 filetype ftype = txt_ft;
16719 if (XHOST.vflag_control.flag("PRINT_MODE::TXT")) {
16720 ftype = txt_ft;
16721 } else if (XHOST.vflag_control.flag("PRINT_MODE::JSON")) {
16722 ftype = json_ft;
16723 }
16724
16725 return PrintWyckoffData(str, ftype, already_calculated); // no need to pass in setting info, etc. already calculated
16726 }
16727} // namespace pflow
16728
16729// ***************************************************************************
16730// pflow::WYCKOFF
16731// ***************************************************************************
16732namespace pflow {
16733 xstructure WYCKOFF(vector<string> argv, istream& input) {
16734 xstructure a(input, IOAFLOW_AUTO);
16735 const int sg = aurostd::string2utype<int>(argv.at(2));
16736 a = WyckoffPOSITIONS(sg, a);
16737 cerr << a.spacegroup << endl;
16738 cerr << a.spacegroupnumber << endl;
16739 cerr << a.spacegroupoption << endl;
16740 return a;
16741 }
16742} // namespace pflow
16743
16744// ***************************************************************************
16745// pflow::XRAY
16746// ***************************************************************************
16747namespace pflow {
16748 void XRAY(const string& options, istream& input) {
16749 const bool LDEBUG = (false || XHOST.DEBUG);
16750 if (LDEBUG) {
16751 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
16752 }
16753 vector<string> tokens;
16754 aurostd::string2tokens(options, tokens, ",");
16755 if (tokens.size() != 1) {
16756 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --xray=lambda < POSCAR");
16757 }
16758 double l = 0.0;
16759 if (!tokens.empty()) {
16760 l = aurostd::string2utype<double>(tokens[0]);
16761 }
16762
16763 const xstructure a(input, IOAFLOW_AUTO);
16764 cout << aflow::Banner("BANNER_TINY") << endl;
16765 PrintXray(a, l, cout);
16766 if (LDEBUG) {
16767 cerr << __AFLOW_FUNC__ << " END" << endl;
16768 }
16769 }
16770 void XRAY_PEAKS(const aurostd::xoption& vpflow, istream& input) { // CO20190520
16771 const bool LDEBUG = (false || XHOST.DEBUG);
16772 if (LDEBUG) {
16773 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
16774 }
16775
16776 const double lambda = aurostd::string2utype<double>(vpflow.getattachedscheme("XRAY_PEAKS"));
16777 if (LDEBUG) {
16778 cerr << __AFLOW_FUNC__ << " lambda=" << lambda << endl;
16779 }
16780 if (lambda <= 0.0 || aurostd::isequal(lambda, 0.0)) {
16782 }
16783
16784 cout << aflow::Banner("BANNER_TINY") << endl;
16785
16786 const xstructure a(input, IOAFLOW_AUTO);
16787
16788 vector<double> v_twotheta;
16789 vector<double> v_intensity;
16790 vector<double> v_intensity_smooth;
16791 vector<uint> peak_indices = GetXrayPeaks(a, v_twotheta, v_intensity, v_intensity_smooth, lambda);
16792 if (v_twotheta.size() != v_intensity.size()) {
16793 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "v_twotheta.size()!=v_intensity.size()", _VALUE_ILLEGAL_);
16794 }
16795 if (v_twotheta.size() != v_intensity_smooth.size()) {
16796 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "v_twotheta.size()!=v_intensity_smooth.size()", _VALUE_ILLEGAL_);
16797 }
16798
16799 // get amplitude
16800 vector<double> v_amplitude;
16801 vector<double> v_peaks_amplitude;
16802 double intmax = 1e-8;
16803 for (size_t i = 0; i < v_intensity.size(); i++) {
16804 if (v_intensity[i] > intmax) {
16805 intmax = v_intensity[i];
16806 }
16807 }
16808 for (size_t i = 0; i < v_intensity.size(); i++) {
16809 v_amplitude.push_back(100 * v_intensity[i] / intmax);
16810 }
16811
16812 // match peak_indices to peaks
16813 vector<double> v_peaks_twotheta;
16814 vector<double> v_peaks_intensity;
16815 for (size_t i = 0; i < peak_indices.size(); i++) {
16816 v_peaks_twotheta.push_back(v_twotheta[peak_indices[i]]);
16817 v_peaks_intensity.push_back(v_intensity[peak_indices[i]]);
16818 v_peaks_amplitude.push_back(v_amplitude[peak_indices[i]]);
16819 }
16820 if (v_peaks_twotheta.size() != v_peaks_intensity.size()) {
16821 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "v_peaks_twotheta.size()!=v_peaks_intensity.size()", _VALUE_ILLEGAL_);
16822 }
16823
16824 cout << "X-Ray Peaks:" << endl;
16825 cout << "Two-Theta=" << aurostd::joinWDelimiter(aurostd::vecDouble2vecString(v_peaks_twotheta, 5, false), ",") << endl; // no roff
16826 cout << "Intensity=" << aurostd::joinWDelimiter(aurostd::vecDouble2vecString(v_peaks_intensity, 10, false), ",") << endl; // no roff
16827 cout << "Amplitude=" << aurostd::joinWDelimiter(aurostd::vecDouble2vecString(v_peaks_amplitude, 5, false), ",") << endl; // no roff
16828
16829 if (LDEBUG) {
16830 cerr << __AFLOW_FUNC__ << " END" << endl;
16831 }
16832 }
16833 void READ_XRAY_DATA(const string& filename, vector<double>& v_twotheta, vector<double>& v_intensity) { // CO20190620
16834 const bool LDEBUG = (false || XHOST.DEBUG);
16835 if (LDEBUG) {
16836 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
16837 }
16838
16839 if (filename.empty()) {
16840 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "No filename provided", _FILE_ERROR_);
16841 }
16842 if (!aurostd::FileExist(filename)) {
16843 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "File does not exist: ", _FILE_NOT_FOUND_);
16844 }
16845 if (aurostd::FileEmpty(filename)) {
16847 }
16848
16849 vector<string> data_file_lines;
16850 aurostd::file2vectorstring(filename, data_file_lines);
16851 string line;
16852 string::size_type loc;
16853 vector<double> tokens;
16854 for (size_t i = 0; i < data_file_lines.size(); i++) {
16855 line = data_file_lines[i];
16856 loc = line.find("#");
16857 line = line.substr(0, loc);
16860 if (!line.empty()) {
16861 aurostd::string2tokens<double>(line, tokens, ","); // csv style
16862 // if(tokens.size()!=2){throw aurostd::xerror(__AFLOW_FILE__,__AFLOW_FUNC__,"Line[i="+aurostd::utype2string(i)+"] has "+aurostd::utype2string(tokens.size())+" tokens (expected 2): line=\""+line+"\"",_FILE_WRONG_FORMAT_);}
16863 if (tokens.size() != 2) {
16864 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "Line[i=" + aurostd::utype2string(i) + "] has " + aurostd::utype2string(tokens.size()) + " tokens (expected 2)", _FILE_WRONG_FORMAT_);
16865 }
16866 v_twotheta.push_back(tokens[0]);
16867 v_intensity.push_back(tokens[1]);
16868 }
16869 }
16870 if (LDEBUG) {
16871 cerr << __AFLOW_FUNC__ << " v_twotheta.size()=" << v_twotheta.size() << endl;
16872 cerr << __AFLOW_FUNC__ << " v_intensity.size()=" << v_intensity.size() << endl;
16873 }
16874 }
16875#define XRAY_DATA_PLOT_FILE "aflow_xray_data_plot_file.txt"
16876#define XRAY_DATA_PEAKS_FILE "aflow_xray_data_peaks_file.txt"
16877 void PRINT_XRAY_DATA_PLOT(const aurostd::xoption& vpflow, istream& input) {
16878 const xstructure str(input, IOAFLOW_AUTO);
16879 return PRINT_XRAY_DATA_PLOT(vpflow, str);
16880 } // CO20190520
16881 void PRINT_XRAY_DATA_PLOT(const aurostd::xoption& vpflow, const xstructure& str) {
16882 const double lambda = aurostd::string2utype<double>(vpflow.getattachedscheme("PRINT_XRAY_DATA_PLOT"));
16883 const string directory = vpflow.getattachedscheme("PRINT_XRAY_DATA_PLOT::DIRECTORY");
16884 return PRINT_XRAY_DATA_PLOT(str, lambda, directory);
16885 } // don't use XHOST.vflag_control.getattachedscheme("DIRECTORY") for directory, might interfere with LIB2RAW //CO20190520
16886 void PRINT_XRAY_DATA_PLOT(istream& input, double lambda, const string& directory) {
16887 const xstructure str(input, IOAFLOW_AUTO);
16888 return PRINT_XRAY_DATA_PLOT(str, lambda, directory);
16889 } // CO20190520
16890 void PRINT_XRAY_DATA_PLOT(const xstructure& str, double lambda, const string& directory) { // CO20190520
16891 const bool LDEBUG = (false || XHOST.DEBUG);
16892 if (LDEBUG) {
16893 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
16894 }
16895
16896 if (LDEBUG) {
16897 cerr << __AFLOW_FUNC__ << " lambda=" << lambda << endl;
16898 }
16899 if (lambda <= 0.0 || aurostd::isequal(lambda, 0.0)) {
16901 }
16902 vector<double> v_twotheta;
16903 vector<double> v_intensity;
16904 GetXray2ThetaIntensity(str, v_twotheta, v_intensity, lambda); // v_amplitude can be grabbed later
16905 if (v_twotheta.size() != v_intensity.size()) {
16906 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "v_twotheta.size()!=v_intensity.size()", _INDEX_MISMATCH_);
16907 }
16908 return PRINT_XRAY_DATA_PLOT(v_twotheta, v_intensity, directory);
16909 }
16910 void PRINT_XRAY_DATA_PLOT(const aurostd::xoption& vpflow, const string& directory) { // CO20190520
16911 // assume a file input from vpflow
16912 const bool LDEBUG = (false || XHOST.DEBUG);
16913
16914 const string filename = vpflow.getattachedscheme("PLOT_XRAY_FILE");
16915 if (LDEBUG) {
16916 cerr << __AFLOW_FUNC__ << " filename=" << filename << endl;
16917 }
16918
16919 return PRINT_XRAY_DATA_PLOT(filename, directory);
16920 }
16921 void PRINT_XRAY_DATA_PLOT(const string& filename, const string& directory) { // CO20190520
16922 vector<double> v_twotheta;
16923 vector<double> v_intensity;
16924 READ_XRAY_DATA(filename, v_twotheta, v_intensity);
16925 return PRINT_XRAY_DATA_PLOT(v_twotheta, v_intensity, directory);
16926 }
16927 void PRINT_XRAY_DATA_PLOT(const vector<double>& v_twotheta, const vector<double>& v_intensity, const string& _directory) { // CO20190620
16928 const bool LDEBUG = (false || XHOST.DEBUG);
16929
16930 string directory = _directory;
16931 if (directory.empty()) {
16932 directory = ".";
16933 }
16934 if (LDEBUG) {
16935 cerr << __AFLOW_FUNC__ << " directory=" << directory << endl;
16936 }
16937
16938 cout << aflow::Banner("BANNER_TINY") << endl;
16939
16940 vector<double> v_intensity_smooth;
16941 vector<uint> peak_indices = GetXrayPeaks(v_twotheta, v_intensity, v_intensity_smooth);
16942 if (v_twotheta.size() != v_intensity_smooth.size()) {
16943 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "v_twotheta.size()!=v_intensity_smooth.size()", _VALUE_ILLEGAL_);
16944 }
16945
16946 // get amplitude
16947 vector<double> v_amplitude;
16948 vector<double> v_peaks_amplitude;
16949 double intmax = 1e-8;
16950 for (size_t i = 0; i < v_intensity.size(); i++) {
16951 if (v_intensity[i] > intmax) {
16952 intmax = v_intensity[i];
16953 }
16954 }
16955 for (size_t i = 0; i < v_intensity.size(); i++) {
16956 v_amplitude.push_back(100 * v_intensity[i] / intmax);
16957 }
16958
16959 // match peak_indices to peaks
16960 vector<double> v_peaks_twotheta;
16961 vector<double> v_peaks_intensity;
16962 for (size_t i = 0; i < peak_indices.size(); i++) {
16963 v_peaks_twotheta.push_back(v_twotheta[peak_indices[i]]);
16964 v_peaks_intensity.push_back(v_intensity[peak_indices[i]]);
16965 v_peaks_amplitude.push_back(v_amplitude[peak_indices[i]]);
16966 }
16967 if (v_peaks_twotheta.size() != v_peaks_intensity.size()) {
16968 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "v_peaks_twotheta.size()!=v_peaks_intensity.size()", _INDEX_MISMATCH_);
16969 }
16970
16971 stringstream data_file_ss;
16972 string data_file;
16973
16974 // PLOT FOR TWO-THETA, INTENSITY, AMPLITUDE, AND SMOOTH
16975 data_file_ss.str("");
16976 data_file_ss << aurostd::PaddedPOST("#Two-theta(degrees)", 20) << " ";
16977 data_file_ss << aurostd::PaddedPOST("Intensity", 20) << " ";
16978 data_file_ss << aurostd::PaddedPOST("Amplitude", 20) << " ";
16979 data_file_ss << aurostd::PaddedPOST("Intensity_Smoothed", 20) << " ";
16980 data_file_ss << endl;
16981 for (size_t i = 0; i < v_twotheta.size(); i++) {
16982 data_file_ss << aurostd::PaddedPOST<double>(v_twotheta[i], 20) << " ";
16983 data_file_ss << aurostd::PaddedPOST<double>(v_intensity[i], 20) << " ";
16984 data_file_ss << aurostd::PaddedPOST<double>(v_amplitude[i], 20) << " ";
16985 data_file_ss << aurostd::PaddedPOST<double>(v_intensity_smooth[i], 20) << " ";
16986 data_file_ss << endl;
16987 }
16988 data_file = directory + "/" + XRAY_DATA_PLOT_FILE;
16989 aurostd::StringSubstInPlace(data_file, "//", "/");
16990 aurostd::stringstream2file(data_file_ss, data_file);
16991
16992 // PLOT FOR TWO-THETA, INTENSITY, AMPLITUDE, AND SMOOTH
16993 data_file_ss.str("");
16994 data_file_ss << aurostd::PaddedPOST("#Two-theta(degrees)", 20) << " ";
16995 data_file_ss << aurostd::PaddedPOST("Intensity", 20) << " ";
16996 data_file_ss << aurostd::PaddedPOST("Amplitude", 20) << " ";
16997 data_file_ss << endl;
16998 for (size_t i = 0; i < v_peaks_twotheta.size(); i++) {
16999 data_file_ss << aurostd::PaddedPOST<double>(v_peaks_twotheta[i], 20) << " ";
17000 data_file_ss << aurostd::PaddedPOST<double>(v_peaks_intensity[i], 20) << " ";
17001 data_file_ss << aurostd::PaddedPOST<double>(v_peaks_amplitude[i], 20) << " ";
17002 data_file_ss << endl;
17003 }
17004 data_file = directory + "/" + XRAY_DATA_PEAKS_FILE;
17005 aurostd::StringSubstInPlace(data_file, "//", "/");
17006 aurostd::stringstream2file(data_file_ss, data_file);
17007
17008 if (LDEBUG) {
17009 cerr << __AFLOW_FUNC__ << " END" << endl;
17010 }
17011 }
17012 void PLOT_XRAY(const aurostd::xoption& vpflow, istream& input) {
17013 const xstructure str(input, IOAFLOW_AUTO);
17014 return PLOT_XRAY(vpflow, str);
17015 } // CO20190520
17016 void PLOT_XRAY(const aurostd::xoption& vpflow, const xstructure& str) {
17017 const bool force_generic_title = vpflow.flag("PLOT_XRAY::FORCE_GENERIC_TITLE");
17018 const double lambda = aurostd::string2utype<double>(vpflow.getattachedscheme("PLOT_XRAY"));
17019 const string directory = vpflow.getattachedscheme("PLOT_XRAY::DIRECTORY");
17020 const bool keep_gp = vpflow.flag("PLOT_XRAY::KEEP_GP");
17021 return PLOT_XRAY(str, lambda, directory, keep_gp, force_generic_title);
17022 } // don't use XHOST.vflag_control.getattachedscheme("DIRECTORY") for directory, might interfere with LIB2RAW //CO20190520
17023 void PLOT_XRAY(istream& input, double lambda, const string& directory, bool keep_gp, bool force_generic_title) {
17024 const xstructure str(input, IOAFLOW_AUTO);
17025 return PLOT_XRAY(str, lambda, directory, keep_gp, force_generic_title);
17026 } // CO20190520
17027 void PLOT_XRAY(const xstructure& str, double lambda, const string& directory, bool keep_gp, bool force_generic_title) { // CO20190520
17028 const bool LDEBUG = (false || XHOST.DEBUG);
17029 if (LDEBUG) {
17030 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
17031 }
17032
17033 if (LDEBUG) {
17034 cerr << __AFLOW_FUNC__ << " lambda=" << lambda << endl;
17035 }
17036 if (lambda <= 0.0 || aurostd::isequal(lambda, 0.0)) {
17038 }
17039 vector<double> v_twotheta;
17040 vector<double> v_intensity;
17041 GetXray2ThetaIntensity(str, v_twotheta, v_intensity, lambda); // v_amplitude can be grabbed later
17042 if (v_twotheta.size() != v_intensity.size()) {
17043 throw aurostd::xerror(__AFLOW_FILE__, __AFLOW_FUNC__, "v_twotheta.size()!=v_intensity.size()", _INDEX_MISMATCH_);
17044 }
17045
17046 string title = aurostd::fixStringLatex(str.title, true, false); // double_back_slash==true (gnuplot), not symmetry sting
17047 if (false || force_generic_title) {
17048 title.clear();
17049 } // force generic
17050 if (title.empty()) {
17051 title = getGenericTitleXStructure(str, true);
17052 } // latex
17053 if (LDEBUG) {
17054 cerr << __AFLOW_FUNC__ << " title=\"" << title << "\"" << endl;
17055 }
17056
17057 return PLOT_XRAY(v_twotheta, v_intensity, title, directory, keep_gp);
17058 }
17059 void PLOT_XRAY(const aurostd::xoption& vpflow, const string& title, const string& directory, bool keep_gp) { // CO20190520
17060 // assume a file input from vpflow
17061 const bool LDEBUG = (false || XHOST.DEBUG);
17062
17063 const string filename = vpflow.getattachedscheme("PLOT_XRAY_FILE");
17064 if (LDEBUG) {
17065 cerr << __AFLOW_FUNC__ << " filename=" << filename << endl;
17066 }
17067
17068 return PLOT_XRAY(filename, title, directory, keep_gp);
17069 }
17070 void PLOT_XRAY(const string& filename, const string& title, const string& directory, bool keep_gp) { // CO20190520
17071 vector<double> v_twotheta;
17072 vector<double> v_intensity;
17073 READ_XRAY_DATA(filename, v_twotheta, v_intensity);
17074 return PLOT_XRAY(v_twotheta, v_intensity, title, directory, keep_gp);
17075 }
17076 void PLOT_XRAY(const vector<double>& v_twotheta, const vector<double>& v_intensity, const string& _title, const string& _directory, bool keep_gp) { // CO20190620
17077 const bool LDEBUG = (false || XHOST.DEBUG);
17078 stringstream message;
17079 if (LDEBUG) {
17080 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
17081 }
17082
17083 if (!aurostd::IsCommandAvailable("gnuplot")) {
17084 message << "gnuplot is not available, please put in path" << endl;
17086 }
17087 if (!aurostd::IsCommandAvailable("pdflatex")) {
17088 message << "pdflatex is not available, please put in path" << endl;
17090 }
17091
17092 string directory = _directory;
17093 if (directory.empty()) {
17094 directory = ".";
17095 }
17096 if (LDEBUG) {
17097 cerr << __AFLOW_FUNC__ << " directory=" << directory << endl;
17098 }
17099
17100 const string curdir = aurostd::getPWD();
17101
17102 const string PLOT_tmp_dir = aurostd::TmpDirectoryCreate("XRAY_PLOT");
17103 fs::current_path(PLOT_tmp_dir.c_str());
17104 PRINT_XRAY_DATA_PLOT(v_twotheta, v_intensity, ".");
17105
17106 const bool plot_intensity = true; // else plot amplitude
17107
17108 vector<string> data_file_lines;
17110 vector<double> x;
17111 vector<double> y1;
17112 vector<double> y2;
17113 vector<double> tokens;
17114 string::size_type loc;
17115 string line;
17116 double y_max = 0.0; // this is really all we are after
17117 for (size_t i = 0, fl_size_i = data_file_lines.size(); i < fl_size_i; i++) {
17118 line = data_file_lines[i];
17119 loc = line.find("#");
17120 line = line.substr(0, loc);
17122 if (!line.empty()) {
17123 aurostd::string2tokens<double>(line, tokens, " ");
17124 x.push_back(tokens[0]);
17125 y1.push_back(tokens[(plot_intensity ? 1 : 2)]);
17126 y2.push_back(tokens[3]);
17127 if (y1.back() > y_max) {
17128 y_max = y1.back();
17129 }
17130 if (y2.back() > y_max) {
17131 y_max = y2.back();
17132 }
17133 if (LDEBUG) {
17134 cerr << __AFLOW_FUNC__ << " x=" << x.back() << " y1=" << y1.back() << " y2=" << y2.back() << endl;
17135 }
17136 }
17137 }
17138
17139 const int exp = (int) floor(log10(y_max));
17140 if (LDEBUG) {
17141 cerr << __AFLOW_FUNC__ << " y_max=" << y_max << endl;
17142 cerr << __AFLOW_FUNC__ << " exp=" << exp << endl;
17143 }
17144
17145 string title = aurostd::fixStringLatex(_title, true, false); // double_back_slash==true (gnuplot), not symmetry sting
17146 if (title.empty()) {
17147 title = "X-Ray Plot";
17148 }
17149 if (LDEBUG) {
17150 cerr << __AFLOW_FUNC__ << " title=\"" << title << "\"" << endl;
17151 }
17152
17153 stringstream plot_file_ss;
17154 const string xray_tex = "aflow_xray_plot.tex";
17155 string xray_pdf = xray_tex;
17156 aurostd::StringSubstInPlace(xray_pdf, ".tex", ".pdf");
17157
17158 plot_file_ss << "set terminal epslatex color standalone" << endl;
17159 plot_file_ss << "set output \"" + xray_tex + "\"" << endl;
17160 plot_file_ss << endl;
17161 // plot_file_ss << "unset key" << endl;
17162 plot_file_ss << "set yrange [0:*]" << endl;
17163 plot_file_ss << "set xrange [0:180]" << endl;
17164 plot_file_ss << "set xlabel \"2$\\\\theta$ (degrees)\"" << endl;
17165 plot_file_ss << "set ylabel \"" << (plot_intensity ? string("intensity") : string("amplitude")) << R"( $\\left[\\times 10^{)" << exp << "}\\\\right]$" << "\"" << endl;
17166 // plot_file_ss << "set ylabel \"amplitude\"" << endl;
17167 plot_file_ss << "set title \"" << title << "\"" << endl;
17168 plot_file_ss << endl;
17169
17170 bool plot_smooth = true;
17171 const bool plot_peaks = true;
17172 plot_smooth = (plot_smooth && plot_intensity); // smooth is based on intensity, not amplitude
17173
17174 plot_file_ss << "plot \\" << endl;
17175 plot_file_ss << "\"" + string(XRAY_DATA_PLOT_FILE) + "\" using 1:(10**(-" << exp << ")*$" << (plot_intensity ? 2 : 3) << R"() with lines lc rgb "blue" lw 4 title ")"
17176 << (plot_intensity ? string("intensity") : string("amplitude")) << "\"" << (plot_smooth || plot_peaks ? string(", \\") : string("")) << endl;
17177 if (plot_smooth) {
17178 plot_file_ss << "\"" + string(XRAY_DATA_PLOT_FILE) + "\" using 1:(10**(-" << exp << ")*$" << 4 << R"() with lines lc rgb "red" lw 4 title "smoothed")" << (plot_peaks ? string(", \\") : string("")) << endl;
17179 } // can't plot this if we're plotting amplitude
17180 if (plot_peaks) {
17181 plot_file_ss << "\"" + string(XRAY_DATA_PEAKS_FILE) + "\" using 1:(10**(-" << exp << ")*$" << (plot_intensity ? 2 : 3) << R"() lt 2 lc rgb "#006400" ps 2 lw 4 title "peaks")" << endl;
17182 } // green - #006400
17183
17184 const string plot_file = "aflow_xray_plot.gp";
17185 aurostd::stringstream2file(plot_file_ss, plot_file);
17186 aurostd::execute2string("gnuplot " + plot_file); // 2string so it does not go into output, put to cout if you need
17187 aurostd::execute2string("pdflatex " + xray_tex); // 2string so it does not go into output, put to cout if you need
17188
17189 vector<string> files2move;
17190
17191 ostream& oss = cout;
17192 ofstream FileMESSAGE;
17193 _aflags aflags;
17194 aflags.Directory = directory;
17195
17196 if (false || keep_gp) {
17198 files2move.push_back(PLOT_tmp_dir + "/" + XRAY_DATA_PLOT_FILE);
17199 } else {
17200 message << XRAY_DATA_PLOT_FILE << " was not created";
17201 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_WARNING_);
17202 }
17204 files2move.push_back(PLOT_tmp_dir + "/" + XRAY_DATA_PEAKS_FILE);
17205 } else {
17206 message << XRAY_DATA_PEAKS_FILE << " was not created";
17207 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_WARNING_);
17208 }
17209 if (aurostd::FileExist(plot_file)) {
17210 files2move.push_back(PLOT_tmp_dir + "/" + plot_file);
17211 } else {
17212 message << plot_file << " was not created";
17213 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_WARNING_);
17214 }
17215 }
17216 if (aurostd::FileExist(xray_pdf)) {
17217 files2move.push_back(PLOT_tmp_dir + "/" + xray_pdf);
17218 } else {
17219 message << xray_pdf << " was not created";
17220 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_WARNING_);
17221 }
17222
17223 fs::current_path(curdir.c_str());
17224 aurostd::file2directory(files2move, directory);
17225 aurostd::RemoveDirectory(PLOT_tmp_dir);
17226
17227 string destination = directory + "/" + xray_pdf;
17228 aurostd::StringSubstInPlace(destination, "//", "/");
17229 message << "Done. See " << destination << "." << endl;
17230 pflow::logger(__AFLOW_FILE__, __AFLOW_FUNC__, message, aflags, FileMESSAGE, oss, _LOGGER_MESSAGE_);
17231
17232 if (LDEBUG) {
17233 cerr << __AFLOW_FUNC__ << " END" << endl;
17234 }
17235 }
17236} // namespace pflow
17237
17238// ***************************************************************************
17239// pflow::XYZ
17240// ***************************************************************************
17241namespace pflow {
17242 void XYZ(const string& options, istream& input) {
17243 const bool LDEBUG = (false || XHOST.DEBUG);
17244 if (LDEBUG) {
17245 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
17246 }
17247 const xvector<int> ijk(3); // default
17248 ijk[1] = 1;
17249 ijk[2] = 1;
17250 ijk[3] = 1; // default
17251 vector<string> tokens;
17252 aurostd::string2tokens(options, tokens, ",");
17253
17254 if (tokens.size() > 3) {
17255 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --xyz[=n1[,n2[,n3]]] < POSCAR");
17256 }
17257
17258 if (!tokens.empty()) {
17259 ijk[1] = aurostd::string2utype<int>(tokens[0]);
17260 }
17261 if (tokens.size() >= 2) {
17262 ijk[2] = aurostd::string2utype<int>(tokens[1]);
17263 }
17264 if (tokens.size() >= 3) {
17265 ijk[3] = aurostd::string2utype<int>(tokens[2]);
17266 }
17267
17268 const xstructure a(input, IOAFLOW_AUTO);
17269 PrintXYZ(a, ijk, cout);
17270 if (LDEBUG) {
17271 cerr << __AFLOW_FUNC__ << " END" << endl;
17272 }
17273 }
17274} // namespace pflow
17275
17276// ***************************************************************************
17277// pflow::XYZINSPHERE
17278// ***************************************************************************
17279namespace pflow {
17280 void XYZINSPHERE(istream& input, double radius) {
17281 cout << aflow::Banner("BANNER_TINY") << endl;
17282 const xstructure a(input, IOAFLOW_AUTO);
17283 PrintXYZInSphere(a, radius, cout);
17284 }
17285} // namespace pflow
17286
17287// ***************************************************************************
17288// pflow::XYZWS
17289// ***************************************************************************
17290namespace pflow {
17291 void XYZWS(istream& input) {
17292 cout << aflow::Banner("BANNER_TINY") << endl;
17293 const xstructure a(input, IOAFLOW_AUTO);
17294 PrintXYZws(a, cout);
17295 }
17296} // namespace pflow
17297
17298// ***************************************************************************
17299// pflow::ZVAL
17300// ***************************************************************************
17301namespace pflow {
17302 void ZVAL(const string& options) {
17303 const bool LDEBUG = (false || XHOST.DEBUG);
17304 if (LDEBUG) {
17305 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
17306 }
17307 vector<string> tokens;
17308 aurostd::string2tokens(options, tokens, ",");
17309 if (tokens.empty() || tokens.size() > 2) {
17310 init::ErrorOption(options, __AFLOW_FUNC__, "aflow " + tokens.at(0) + "[=directory]");
17311 }
17312 string Directory;
17313 if (tokens.size() == 1) {
17314 Directory = "./";
17315 }
17316 if (tokens.size() == 2) {
17317 Directory = tokens[1];
17318 }
17319
17320 vector<double> vZVAL;
17321 vector<double> sZVAL;
17322 vector<double> vPOMASS;
17323 vector<double> sPOMASS;
17324 if (tokens.at(0) == "ZVAL") {
17325 cout << "Total ZVAL (from PP) = " << GetZVAL(Directory, vZVAL) << endl;
17326 }
17327 if (tokens.at(0) == "ZVAL::CELL") {
17328 cout << "Total ZVAL_CELL (from PP and xstructure) = " << GetCellAtomZVAL(Directory, vZVAL, sZVAL, "CELL") << endl;
17329 }
17330 if (tokens.at(0) == "ZVAL::ATOM") {
17331 cout << "Total ZVAL_ATOM (from PP and xstructure) = " << GetCellAtomZVAL(Directory, vZVAL, sZVAL, "ATOM") << endl;
17332 }
17333 if (tokens.at(0) == "POMASS") {
17334 cout << "Total POMASS (from PP) = " << GetPOMASS(Directory, vPOMASS) << endl;
17335 }
17336 if (tokens.at(0) == "POMASS::CELL") {
17337 cout << "Total POMASS_CELL (from PP and xstructure) = " << GetCellAtomPOMASS(Directory, vPOMASS, sPOMASS, "CELL") << endl;
17338 }
17339 if (tokens.at(0) == "POMASS::ATOM") {
17340 cout << "Total POMASS_ATOM (from PP and xstructure) = " << GetCellAtomPOMASS(Directory, vPOMASS, sPOMASS, "ATOM") << endl;
17341 }
17342 if (LDEBUG) {
17343 cerr << __AFLOW_FUNC__ << " END" << endl;
17344 }
17345 }
17346} // namespace pflow
17347
17348// ***************************************************************************
17349// pflow::OPARAMETER
17350// ***************************************************************************
17351
17352bool AreAtomsEquivalent(const deque<_atom>& atoms1, const deque<_atom>& atoms2, bool oparameter_check, bool poccupation_check) {
17353 double epsilon = 0.0001;
17354 double epsilon_pocc = 0.05;
17355 if (atoms1.size() != atoms2.size()) {
17356 return false; // cant be equivalent if different numbers
17357 }
17358 for (size_t iat1 = 0; iat1 < atoms1.size(); iat1++) {
17359 bool found = false;
17360 for (size_t iat2 = 0; iat2 < atoms2.size() && found == false; iat2++) {
17361 if (atoms1[iat1].type == atoms2[iat2].type && aurostd::isequal(atoms1[iat1].fpos, atoms2[iat2].fpos, epsilon)) {
17362 if (oparameter_check == false && poccupation_check == false) {
17363 found = true;
17364 }
17365 if (oparameter_check == true && poccupation_check == false) {
17366 if (atoms1[iat1].order_parameter_value == atoms2[iat2].order_parameter_value) {
17367 found = true;
17368 }
17369 }
17370 // atoms1[iat1].order_parameter_atom==true && atoms2[iat2].order_parameter_atom==true &&
17371 if (oparameter_check == false && poccupation_check == true) {
17372 if (aurostd::isequal(atoms1[iat1].partial_occupation_value, atoms2[iat2].partial_occupation_value, epsilon_pocc)) {
17373 found = true;
17374 }
17375 }
17376 // atoms1[iat1].partial_occupation_atom==true && atoms2[iat2].partial_occupation_atom==true &&
17377 if (oparameter_check == true && poccupation_check == true) {
17378 if (atoms1[iat1].order_parameter_value == atoms2[iat2].order_parameter_value && aurostd::isequal(atoms1[iat1].partial_occupation_value, atoms2[iat2].partial_occupation_value, epsilon_pocc)) {
17379 found = true;
17380 }
17381 }
17382 // atoms1[iat1].order_parameter_atom==true && atoms2[iat2].order_parameter_atom==true &&
17383 // atoms1[iat1].partial_occupation_atom==true && atoms2[iat2].partial_occupation_atom==true &&
17384 }
17385 }
17386 if (found == false) {
17387 return false;
17388 }
17389 }
17390 return true; // survived everything
17391}
17392
17393bool AreAtomsEquivalent(const deque<_atom>& atoms1, const deque<_atom>& atoms2) {
17394 return AreAtomsEquivalent(atoms1, atoms2, false, false); // no order check
17395}
17396
17397bool AreAtomsOrderEquivalent(const deque<_atom>& atoms1, const deque<_atom>& atoms2) {
17398 return AreAtomsEquivalent(atoms1, atoms2, true, false); // no order check
17399}
17400
17401bool AreAtomsOccupationEquivalent(const deque<_atom>& atoms1, const deque<_atom>& atoms2) {
17402 return AreAtomsEquivalent(atoms1, atoms2, false, true); // no order check
17403}
17404
17405bool AreAtomsOccupationOrderEquivalent(const deque<_atom>& atoms1, const deque<_atom>& atoms2) {
17406 return AreAtomsEquivalent(atoms1, atoms2, true, true); // no order check
17407}
17408
17409class _sort_xstructure_order_parameter_orbit { // sorting through reference
17410public:
17411 bool operator()(const xstructure& str1, const xstructure& str2) const { return (bool) (str1.order_parameter_orbit < str2.order_parameter_orbit); }
17412};
17413
17414class _rsort_xstructure_order_parameter_orbit { // sorting through reference
17415public:
17416 bool operator()(const xstructure& str1, const xstructure& str2) const { return (bool) (str1.order_parameter_orbit > str2.order_parameter_orbit); }
17417};
17418
17419int order_parameter_sum(const xstructure& str) {
17420 int _sum = 0;
17421 for (size_t iat = 0; iat < str.order_parameter_atoms.size(); iat++) {
17422 _sum += (int) str.atoms.at(str.order_parameter_atoms[iat]).order_parameter_value;
17423 }
17424 return _sum;
17425}
17426
17427// ***************************************************************************
17428// helpIndividualOption
17429// ***************************************************************************
17430void helpIndividualOption(vector<string>& argv) {
17431 // "aflow --help option"
17432 // to print out the help information of given option
17433 // use the information stored in README_AFLOW_PFLOW.txt
17434
17435 stringstream help_file;
17436 help_file << aurostd::EmbData::get_content("README_AFLOW_PFLOW.TXT", "README");
17437
17438 bool help_found = false;
17439 string option = argv.at(2);
17440
17441 const string seperation_line_pattern = "******";
17442
17443 string line;
17444
17445 // to get standard form of option --option+" "
17446 option.append(" ");
17447 option.insert(0, "--");
17448
17449 bool output_flag = false;
17450 bool begin_section_flag = false;
17451 while (getline(help_file, line)) {
17452 // get the begining of the help section of an option
17453 // it begins with "aflow --option_name"
17454 // it may have one or several space between the two words
17455
17456 size_t pos = line.find(option);
17457 const string program_name = "aflow";
17458 const string option_prefix = "--";
17459 const size_t pos2 = line.find(program_name);
17460 const size_t pos3 = line.find(option_prefix);
17461 string::iterator str_itr;
17462
17463 if ((pos2 < pos3) && (pos3 != string::npos)) {
17464 for (str_itr = line.begin() + pos2 + program_name.size(); str_itr < line.begin() + pos3; str_itr++) {
17465 if (*str_itr != ' ') {
17466 begin_section_flag = false;
17467 break;
17468 }
17469 }
17470 begin_section_flag = true;
17471 } else {
17472 begin_section_flag = false;
17473 }
17474
17475 if (begin_section_flag && (pos != string::npos) && (!output_flag)) {
17476 // find the line with --option
17477 // output this line and lines below
17478 // until next line begining with "aflow --" pattern
17479
17480 const int last_space_pos = line.find_first_not_of(" ");
17481 line.erase(line.begin(), line.begin() + last_space_pos);
17482 cout << line << endl;
17483 output_flag = true;
17484 help_found = true;
17485 continue;
17486 } else if (begin_section_flag && output_flag) {
17487 // reset the flag and output
17488 // the other part of help information if found
17489
17490 pos = line.find(option);
17491 if ((pos != string::npos)) {
17492 const int last_space_pos = line.find_first_not_of(" ");
17493 line.erase(line.begin(), line.begin() + last_space_pos);
17494 cout << line << endl;
17495 output_flag = true;
17496 } else {
17497 output_flag = false;
17498 }
17499 } else if (!begin_section_flag && output_flag) {
17500 // output the part of help section not
17501 // beginning with "aflow --option" pattern
17502
17503 if (line.find(seperation_line_pattern) == string::npos) {
17504 // do not output seperation line
17505 const int last_space_pos = line.find_first_not_of(" ");
17506 line.erase(line.begin(), line.begin() + last_space_pos);
17507 cout << " " << line << endl;
17508 }
17509 }
17510 }
17511
17512 if (!help_found) {
17513 // not supported option
17514 const size_t pos = option.find_last_of(" ");
17515 const string option_raw = option.substr(2, pos - 2);
17516 cerr << "No option \"" << option_raw << "\" is found." << endl;
17517 cerr << "Try \"aflow --help\" to see all supported options." << endl;
17518 return;
17519 }
17520 return;
17521}
17522
17523// ***************************************************************************
17524
17525// ----------------------------------------------------------------------------
17526// get_itemized_vector_string_from_input
17527// Stefano Curtarolo
17528// namespace aurostd {
17529// bool get_itemized_vector_string_from_input(vector<string> &argv,const string& s0,vector<string>& tokens,const string& delimiter) {// =":") {
17530// string s0neq=s0,s0equ;aurostd::StringSubst(s0neq,"=","");s0equ=s0neq+"=";
17531// if(aurostd::args2attachedflag(argv,s0equ)) {aurostd::string2tokens(aurostd::args2attachedstring(argv,s0equ,EMPTY_WORDING),tokens,delimiter);}
17532// if(aurostd::args2flag(argv,s0neq)) {aurostd::args2string(argv,s0neq,EMPTY_WORDING);tokens=aurostd::args2vectorstring(argv,s0neq,EMPTY_WORDING);}
17533// if(tokens.size()==1 && aurostd::substring2bool(tokens.at(0),delimiter)) {s0equ=tokens.at(0);aurostd::string2tokens(s0equ,tokens,delimiter);}
17534// if(tokens.size()==0) return false;
17535// return true;
17536// }
17537// bool get_itemized_vector_string_from_input(vector<string> &argv,const string& s0,const string& s1,vector<string>& tokens,const string& delimiter) {// =":") {
17538// string s0neq=s0,s0equ;aurostd::StringSubst(s0neq,"=","");s0equ=s0neq+"=";
17539// string s1neq=s1,s1equ;aurostd::StringSubst(s1neq,"=","");s1equ=s1neq+"=";
17540// if(aurostd::args2attachedflag(argv,s0equ)) {aurostd::string2tokens(aurostd::args2attachedstring(argv,s0equ,EMPTY_WORDING),tokens,delimiter);}
17541// if(aurostd::args2attachedflag(argv,s1equ)) {aurostd::string2tokens(aurostd::args2attachedstring(argv,s1equ,EMPTY_WORDING),tokens,delimiter);}
17542// if(aurostd::args2flag(argv,s0neq)) {aurostd::args2string(argv,s0neq,EMPTY_WORDING);tokens=aurostd::args2vectorstring(argv,s0neq,EMPTY_WORDING);}
17543// if(aurostd::args2flag(argv,s1neq)) {aurostd::args2string(argv,s1neq,EMPTY_WORDING);tokens=aurostd::args2vectorstring(argv,s1neq,EMPTY_WORDING);}
17544// if(tokens.size()==1 && aurostd::substring2bool(tokens.at(0),delimiter)) {s0equ=tokens.at(0);aurostd::string2tokens(s0equ,tokens,delimiter);}
17545// if(tokens.size()==0) return false;
17546// return true;
17547// }
17548// bool get_itemized_vector_string_from_input(vector<string> &argv,const string& s0,const string& s1,const string& s2,vector<string>& tokens,const string& delimiter) {// =":") {
17549// string s0neq=s0,s0equ;aurostd::StringSubst(s0neq,"=","");s0equ=s0neq+"=";
17550// string s1neq=s1,s1equ;aurostd::StringSubst(s1neq,"=","");s1equ=s1neq+"=";
17551// string s2neq=s2,s2equ;aurostd::StringSubst(s2neq,"=","");s2equ=s2neq+"=";
17552// if(aurostd::args2attachedflag(argv,s0equ)) {aurostd::string2tokens(aurostd::args2attachedstring(argv,s0equ,EMPTY_WORDING),tokens,delimiter);}
17553// if(aurostd::args2attachedflag(argv,s1equ)) {aurostd::string2tokens(aurostd::args2attachedstring(argv,s1equ,EMPTY_WORDING),tokens,delimiter);}
17554// if(aurostd::args2attachedflag(argv,s2equ)) {aurostd::string2tokens(aurostd::args2attachedstring(argv,s2equ,EMPTY_WORDING),tokens,delimiter);}
17555// if(aurostd::args2flag(argv,s0neq)) {aurostd::args2string(argv,s0neq,EMPTY_WORDING);tokens=aurostd::args2vectorstring(argv,s0neq,EMPTY_WORDING);}
17556// if(aurostd::args2flag(argv,s1neq)) {aurostd::args2string(argv,s1neq,EMPTY_WORDING);tokens=aurostd::args2vectorstring(argv,s1neq,EMPTY_WORDING);}
17557// if(aurostd::args2flag(argv,s2neq)) {aurostd::args2string(argv,s2neq,EMPTY_WORDING);tokens=aurostd::args2vectorstring(argv,s2neq,EMPTY_WORDING);}
17558// if(tokens.size()==1 && aurostd::substring2bool(tokens.at(0),delimiter)) {s0equ=tokens.at(0);aurostd::string2tokens(s0equ,tokens,delimiter);}
17559// if(tokens.size()==0) return false;
17560// return true;
17561// }
17562// bool get_itemized_vector_string_from_input(vector<string> &argv,const string& s0,const string& s1,const string& s2,const string& s3,vector<string>& tokens,const string& delimiter) {// =":") {
17563// string s0neq=s0,s0equ;aurostd::StringSubst(s0neq,"=","");s0equ=s0neq+"=";
17564// string s1neq=s1,s1equ;aurostd::StringSubst(s1neq,"=","");s1equ=s1neq+"=";
17565// string s2neq=s2,s2equ;aurostd::StringSubst(s2neq,"=","");s2equ=s2neq+"=";
17566// string s3neq=s3,s3equ;aurostd::StringSubst(s3neq,"=","");s3equ=s3neq+"=";
17567// if(aurostd::args2attachedflag(argv,s0equ)) {aurostd::string2tokens(aurostd::args2attachedstring(argv,s0equ,EMPTY_WORDING),tokens,delimiter);}
17568// if(aurostd::args2attachedflag(argv,s1equ)) {aurostd::string2tokens(aurostd::args2attachedstring(argv,s1equ,EMPTY_WORDING),tokens,delimiter);}
17569// if(aurostd::args2attachedflag(argv,s2equ)) {aurostd::string2tokens(aurostd::args2attachedstring(argv,s2equ,EMPTY_WORDING),tokens,delimiter);}
17570// if(aurostd::args2attachedflag(argv,s3equ)) {aurostd::string2tokens(aurostd::args2attachedstring(argv,s3equ,EMPTY_WORDING),tokens,delimiter);}
17571// if(aurostd::args2flag(argv,s0neq)) {aurostd::args2string(argv,s0neq,EMPTY_WORDING);tokens=aurostd::args2vectorstring(argv,s0neq,EMPTY_WORDING);}
17572// if(aurostd::args2flag(argv,s1neq)) {aurostd::args2string(argv,s1neq,EMPTY_WORDING);tokens=aurostd::args2vectorstring(argv,s1neq,EMPTY_WORDING);}
17573// if(aurostd::args2flag(argv,s2neq)) {aurostd::args2string(argv,s2neq,EMPTY_WORDING);tokens=aurostd::args2vectorstring(argv,s2neq,EMPTY_WORDING);}
17574// if(aurostd::args2flag(argv,s3neq)) {aurostd::args2string(argv,s3neq,EMPTY_WORDING);tokens=aurostd::args2vectorstring(argv,s3neq,EMPTY_WORDING);}
17575// if(tokens.size()==1 && aurostd::substring2bool(tokens.at(0),delimiter)) {s0equ=tokens.at(0);aurostd::string2tokens(s0equ,tokens,delimiter);}
17576// if(tokens.size()==0) return false;
17577// return true;
17578// }
17579// }
17580
17581// // ----------------------------------------------------------------------------
17582// // getproto_itemized_vector_string_from_input
17583// // Stefano Curtarolo
17584// namespace aurostd {
17585// bool getproto_itemized_vector_string_from_input(vector<string> &argv,const string& s0,vector<string>& tokens,const string& delimiter) {// =":") {
17586// string ss;tokens.clear();vector<string> stokens;
17587// string s0neq=s0,s0equ;aurostd::StringSubst(s0neq,"=","");s0equ=s0neq+"=";
17588// if(aurostd::args2attachedflag(argv,s0equ)) ss=aurostd::args2attachedstring(argv,s0equ,EMPTY_WORDING);
17589// if(aurostd::args2flag(argv,s0neq)) ss=aurostd::args2string(argv,s0neq,EMPTY_WORDING);
17590// if(aurostd::substring2bool(ss,"./")) aurostd::StringSubst(ss,"./","");
17591// if(ss!="") {
17592// if(!aurostd::substring2bool(ss,"/")) { return get_itemized_vector_string_from_input(argv,s0,tokens,delimiter);
17593// } else {
17594// aurostd::string2tokens(ss,stokens,"/");
17595// tokens.push_back(stokens.at(1));
17596// KBIN::VASP_SplitAlloyPseudoPotentials(stokens.at(0),stokens);
17597// for(size_t i=0;i<stokens.size();i++) tokens.push_back(stokens.at(i));
17598// }
17599// }
17600// if(tokens.size()==1 && aurostd::substring2bool(tokens.at(0),delimiter)) {s0equ=tokens.at(0);aurostd::string2tokens(s0equ,tokens,delimiter);}
17601// if(tokens.size()==0) return false;
17602// return true;
17603// }
17604// bool getproto_itemized_vector_string_from_input(vector<string> &argv,const string& s0,const string& s1,vector<string>& tokens,const string& delimiter) {// =":") {
17605// string ss;tokens.clear();vector<string> stokens;
17606// string s0neq=s0,s0equ;aurostd::StringSubst(s0neq,"=","");s0equ=s0neq+"=";
17607// string s1neq=s1,s1equ;aurostd::StringSubst(s1neq,"=","");s1equ=s1neq+"=";
17608// if(aurostd::args2attachedflag(argv,s0equ)) ss=aurostd::args2attachedstring(argv,s0equ,EMPTY_WORDING);
17609// if(aurostd::args2flag(argv,s0neq)) ss=aurostd::args2string(argv,s0neq,EMPTY_WORDING);
17610// if(aurostd::args2attachedflag(argv,s1equ)) ss=aurostd::args2attachedstring(argv,s1equ,EMPTY_WORDING);
17611// if(aurostd::args2flag(argv,s1neq)) ss=aurostd::args2string(argv,s1neq,EMPTY_WORDING);
17612// if(aurostd::substring2bool(ss,"./")) aurostd::StringSubst(ss,"./","");
17613// if(ss!="") {
17614// if(!aurostd::substring2bool(ss,"/")) { return get_itemized_vector_string_from_input(argv,s0,s1,tokens,delimiter);
17615// } else {
17616// aurostd::string2tokens(ss,stokens,"/");
17617// tokens.push_back(stokens.at(1));
17618// KBIN::VASP_SplitAlloyPseudoPotentials(stokens.at(0),stokens);
17619// for(size_t i=0;i<stokens.size();i++) tokens.push_back(stokens.at(i));
17620// }
17621// }
17622// if(tokens.size()==1 && aurostd::substring2bool(tokens.at(0),delimiter)) {s0equ=tokens.at(0);aurostd::string2tokens(s0equ,tokens,delimiter);}
17623// if(tokens.size()==0) return false;
17624// return true;
17625// }
17626// bool getproto_itemized_vector_string_from_input(vector<string> &argv,const string& s0,const string& s1,const string& s2,vector<string>& tokens,const string& delimiter) {// =":") {
17627// string ss;tokens.clear();vector<string> stokens;
17628// string s0neq=s0,s0equ;aurostd::StringSubst(s0neq,"=","");s0equ=s0neq+"=";
17629// string s1neq=s1,s1equ;aurostd::StringSubst(s1neq,"=","");s1equ=s1neq+"=";
17630// string s2neq=s2,s2equ;aurostd::StringSubst(s2neq,"=","");s2equ=s2neq+"=";
17631// if(aurostd::args2attachedflag(argv,s0equ)) ss=aurostd::args2attachedstring(argv,s0equ,EMPTY_WORDING);
17632// if(aurostd::args2flag(argv,s0neq)) ss=aurostd::args2string(argv,s0neq,EMPTY_WORDING);
17633// if(aurostd::args2attachedflag(argv,s1equ)) ss=aurostd::args2attachedstring(argv,s1equ,EMPTY_WORDING);
17634// if(aurostd::args2flag(argv,s1neq)) ss=aurostd::args2string(argv,s1neq,EMPTY_WORDING);
17635// if(aurostd::args2attachedflag(argv,s2equ)) ss=aurostd::args2attachedstring(argv,s2equ,EMPTY_WORDING);
17636// if(aurostd::args2flag(argv,s2neq)) ss=aurostd::args2string(argv,s2neq,EMPTY_WORDING);
17637// if(aurostd::substring2bool(ss,"./")) aurostd::StringSubst(ss,"./","");
17638// if(ss!="") {
17639// if(!aurostd::substring2bool(ss,"/")) { return get_itemized_vector_string_from_input(argv,s0,s1,s2,tokens,delimiter);
17640// } else {
17641// aurostd::string2tokens(ss,stokens,"/");
17642// tokens.push_back(stokens.at(1));
17643// KBIN::VASP_SplitAlloyPseudoPotentials(stokens.at(0),stokens);
17644// for(size_t i=0;i<stokens.size();i++) tokens.push_back(stokens.at(i));
17645// }
17646// }
17647// if(tokens.size()==1 && aurostd::substring2bool(tokens.at(0),delimiter)) {s0equ=tokens.at(0);aurostd::string2tokens(s0equ,tokens,delimiter);}
17648// if(tokens.size()==0) return false;
17649// return true;
17650// }
17651// bool getproto_itemized_vector_string_from_input(vector<string> &argv,const string& s0,const string& s1,const string& s2,const string& s3,vector<string>& tokens,const string& delimiter) {// =":") {
17652// string ss;tokens.clear();vector<string> stokens;
17653// string s0neq=s0,s0equ;aurostd::StringSubst(s0neq,"=","");s0equ=s0neq+"=";
17654// string s1neq=s1,s1equ;aurostd::StringSubst(s1neq,"=","");s1equ=s1neq+"=";
17655// string s2neq=s2,s2equ;aurostd::StringSubst(s2neq,"=","");s2equ=s2neq+"=";
17656// string s3neq=s3,s3equ;aurostd::StringSubst(s3neq,"=","");s3equ=s3neq+"=";
17657// if(aurostd::args2attachedflag(argv,s0equ)) ss=aurostd::args2attachedstring(argv,s0equ,EMPTY_WORDING);
17658// if(aurostd::args2flag(argv,s0neq)) ss=aurostd::args2string(argv,s0neq,EMPTY_WORDING);
17659// if(aurostd::args2attachedflag(argv,s1equ)) ss=aurostd::args2attachedstring(argv,s1equ,EMPTY_WORDING);
17660// if(aurostd::args2flag(argv,s1neq)) ss=aurostd::args2string(argv,s1neq,EMPTY_WORDING);
17661// if(aurostd::args2attachedflag(argv,s2equ)) ss=aurostd::args2attachedstring(argv,s2equ,EMPTY_WORDING);
17662// if(aurostd::args2flag(argv,s2neq)) ss=aurostd::args2string(argv,s2neq,EMPTY_WORDING);
17663// if(aurostd::args2attachedflag(argv,s3equ)) ss=aurostd::args2attachedstring(argv,s3equ,EMPTY_WORDING);
17664// if(aurostd::args2flag(argv,s3neq)) ss=aurostd::args2string(argv,s3neq,EMPTY_WORDING);
17665// if(aurostd::substring2bool(ss,"./")) aurostd::StringSubst(ss,"./","");
17666// if(ss!="") {
17667// if(!aurostd::substring2bool(ss,"/")) { return get_itemized_vector_string_from_input(argv,s0,s1,s2,s3,tokens,delimiter);
17668// } else {
17669// aurostd::string2tokens(ss,stokens,"/");
17670// tokens.push_back(stokens.at(1));
17671// KBIN::VASP_SplitAlloyPseudoPotentials(stokens.at(0),stokens);
17672// for(size_t i=0;i<stokens.size();i++) tokens.push_back(stokens.at(i));
17673// }
17674// }
17675// if(tokens.size()==1 && aurostd::substring2bool(tokens.at(0),delimiter)) {s0equ=tokens.at(0);aurostd::string2tokens(s0equ,tokens,delimiter);}
17676// if(tokens.size()==0) return false;
17677// return true;
17678// }
17679// }
17680
17681// ***************************************************************************
17682// RICHARD stuff on XRD
17683namespace pflow {
17684 double GetAtomicPlaneDist(const string& options, istream& cin) {
17685 const bool LDEBUG = (false || XHOST.DEBUG);
17686 if (LDEBUG) {
17687 cerr << __AFLOW_FUNC__ << " BEGIN" << endl;
17688 }
17689 vector<string> tokens;
17690 aurostd::string2tokens(options, tokens, ",");
17691 if (tokens.size() != 3) {
17692 init::ErrorOption(options, __AFLOW_FUNC__, "aflow --xrd_dist=h,k,l < POSCAR");
17693 }
17694 // move on
17695 double h = 0;
17696 double k = 0;
17697 double l = 0;
17698 if (!tokens.empty()) {
17699 h = aurostd::string2utype<double>(tokens[0]);
17700 }
17701 if (tokens.size() >= 2) {
17702 k = aurostd::string2utype<double>(tokens[1]);
17703 }
17704 if (tokens.size() >= 3) {
17705 l = aurostd::string2utype<double>(tokens[2]);
17706 }
17707
17708 _aflags aflags;
17709 aflags.QUIET = true;
17710 const xstructure a(cin, IOVASP_AUTO);
17711 const double tol = 1e-6;
17712 double dist;
17713 // a = GetStandardConventional(a);
17714
17715 const xvector<double> origin;
17716 origin(1) = 0;
17717 origin(2) = 0;
17718 origin(3) = 0;
17719
17720 xvector<double> A(3);
17721 xvector<double> B(3);
17722 xvector<double> C(3);
17723
17724 // NO ZEROS
17725 if (h > tol && k > tol && l > tol) {
17726 A = (1 / h) * a.lattice(1);
17727 B = (1 / k) * a.lattice(2);
17728 C = (1 / l) * a.lattice(3);
17729 }
17730 // ONE ZERO
17731 if (h < tol && k > tol && l > tol) { // 0 k l
17732 B = (1 / k) * a.lattice(2);
17733 A = a.lattice(1) + B;
17734 C = (1 / l) * a.lattice(3);
17735 }
17736 if (h > tol && k < tol && l > tol) { // h 0 l
17737 A = (1 / h) * a.lattice(1);
17738 B = a.lattice(2) + A;
17739 C = (1 / l) * a.lattice(3);
17740 }
17741 if (h > tol && k > tol && l < tol) { // h k 0
17742 A = (1 / h) * a.lattice(1);
17743 B = (1 / k) * a.lattice(2);
17744 C = a.lattice(3) + B;
17745 }
17746 // TWO ZEROS
17747 if (h < tol && k < tol && l > tol) { // 0 0 l
17748 C = (1 / l) * a.lattice(3);
17749 A = a.lattice(1) + C;
17750 B = a.lattice(2) + C;
17751 }
17752 if (h < tol && k > tol && l < tol) { // 0 k 0
17753 B = (1 / k) * a.lattice(2);
17754 A = a.lattice(1) + B;
17755 C = a.lattice(3) + B;
17756 }
17757 if (h > tol && k < tol && l < tol) { // h 0 0
17758 A = (1 / h) * a.lattice(1);
17759 B = a.lattice(2) + A;
17760 C = a.lattice(3) + A;
17761 }
17762 // GET PLANE NORMAL VECTOR & NORMAL ALONG A
17763 const xvector<double> n = 1 / aurostd::modulus(aurostd::vector_product(A - B, A - C)) * aurostd::vector_product(A - B, A - C);
17764 const xvector<double> nA = 1 / aurostd::modulus(A) * A;
17765 dist = aurostd::modulus(A) * aurostd::scalar_product(nA, n);
17766 cout << setprecision(6) << dist << endl;
17767 if (LDEBUG) {
17768 cerr << __AFLOW_FUNC__ << " END" << endl;
17769 }
17770 return dist;
17771 }
17772} // namespace pflow
17773
17774namespace pflow {
17775 int whereischar(string str, char c) {
17776 int out = -1;
17777 for (size_t i = 0; i < str.size(); i++) {
17778 if (str[i] == c) {
17779 out = i;
17780 }
17781 }
17782 return out;
17783 }
17784} // namespace pflow
17785
17786namespace pflow {
17787 bool havechar(string str_in, char c) {
17788 bool contains = false;
17789 for (uint i = 0; i < str_in.length(); i++) {
17790 if (str_in[i] == c) {
17791 contains = true;
17792 }
17793 }
17794 return contains;
17795 }
17796} // namespace pflow
17797
17798namespace pflow {
17799 void cleanupstring(string& str) {
17800 uint i = str.size() - 1;
17801 while (str[i] == ' ') {
17802 i--;
17803 }
17804 str.erase(i + 1, str.size() - 1);
17805 i = 0;
17806 while (str[i] == ' ') {
17807 i++;
17808 }
17809 str.erase(0, i);
17810 }
17811} // namespace pflow
17812
17813namespace pflow {
17814 double frac2dbl(string str) {
17815 double out;
17816 bool neg = false;
17817 cleanupstring(str);
17818 if (str[0] == '-') {
17819 neg = true;
17820 str.erase(str.begin(), str.begin() + 1);
17821 }
17822 if (str[0] == '+') {
17823 str.erase(str.begin(), str.begin() + 1);
17824 }
17825 if (havechar(str, '/')) {
17826 double numerator;
17827 double denominator;
17828 const uint slash = whereischar(str, '/');
17829 char num[256];
17830 char den[256];
17831 for (uint i = 0; i < slash; i++) {
17832 num[i] = str[i];
17833 }
17834 for (size_t i = 0; i < (str.size() - slash); i++) {
17835 den[i] = str[i + slash + 1];
17836 }
17837 numerator = atof(num);
17838 denominator = atof(den);
17839 if (neg == true) {
17840 out = -numerator / denominator;
17841 } else {
17842 out = numerator / denominator;
17843 }
17844 } else {
17845 out = atof(str.c_str());
17846 }
17847 return out;
17848 }
17849} // namespace pflow
17850
17851#endif //
17852
17853// **************************************************************************
17854// * *
17855// * STEFANO CURTAROLO - Duke University 2003-2024 *
17856// * *
17857// **************************************************************************
utype mod(utype x, utype y)
xstructure InflateVolume(const xstructure &a, const double &coefficient)
xstructure ShiftCPos(const xstructure &a, const xvector< double > &shift)
std::string KPPRA(int &k1, int &k2, int &k3, const xmatrix< double > &rlattice, const int &NK)
double GetCellAtomPOMASS(const std::stringstream &sss, std::vector< double > &vPOMASS, const std::stringstream &sstr, std::vector< double > &sPOMASS, std::string mode)
bool PrintEffectiveMass(std::string &WorkDir, std::ostream &oss)
xstructure GetPrimitive3(const xstructure &a)
double NearestNeighbor(const xstructure &str_in)
std::vector< double > GetNBONDXX(const xstructure &a)
xstructure InflateLattice(const xstructure &a, const double &coefficient)
xstructure ReScale(const xstructure &a, const double &in_scale)
std::string KPPRA_DELTA(int &k1, int &k2, int &k3, const xmatrix< double > &rlattice, const double &DK)
xstructure GetSuperCell(const xstructure &a, const xmatrix< double > &sc)
int MiscibilityCheck(int speciesA, int speciesB)
utype max(const vector< utype > vec)
xstructure GetPrimitive1(const xstructure &a)
bool PrintBandGap_DOS(std::string &WorkDir, std::ostream &oss)
xstructure SetSDTypes(const xstructure &a, const std::vector< std::string > &in_sd)
std::string GetSpaceGroupLabel(int spacegroupnumber)
double BringInCell(double, double=_ZERO_TOL_, double=1.0, double=0.0)
xstructure GetPrimitive2(const xstructure &a)
xstructure GetLTFVCell(const xvector< double > &nvec, const double phi, const xstructure &str)
bool PrintEigCurv(std::string &WorkDir, std::ostream &oss)
bool PrintBandGap(std::string &WorkDir, std::ostream &oss)
std::string GetSpaceGroupName(int spacegroupnumber, const std::string &directory="")
xstructure SetVolume(const xstructure &a, const double &in_volume)
double GetPOMASS(const std::stringstream &sss, std::vector< double > &vPOMASS)
std::string _AFLOWIN_
xstructure ShiftFPos(const xstructure &a, const xvector< double > &shift)
xstructure BringInWignerSeitz(const xstructure &a)
static const std::string SEP_TAG2
Definition aflow.h:49
double GetCellAtomZVAL(const std::stringstream &sss, std::vector< double > &vZVAL, const std::stringstream &sstr, std::vector< double > &sZVAL, std::string mode)
utype min(const vector< utype > vec)
xstructure LatticeReduction(const xstructure &a)
double GetZVAL(const std::stringstream &sss, std::vector< double > &vZVAL)
xstructure GetLTCell(const xmatrix< double > &lt, const xstructure &str)
double det(const xvector< double > &v1, const xvector< double > &v2, const xvector< double > &v3)
xstructure IdenticalAtoms(const xstructure &a)
static const std::string TAG_TITLE_POCC_TOL
Definition aflow.h:54
xvector< double > C2F(const double &scale, const xmatrix< double > &lattice, const xvector< double > &cpos)
xvector< double > GetMom1(const xstructure &a)
xstructure GetNiggliStr(const xstructure &in_str)
xvector< int > LatticeDimensionSphere(const xmatrix< double > &lattice, double radius, double scale=1.0)
static const std::string TAG_TITLE_POCC
Definition aflow.h:53
xstructure ShiftPos(const xstructure &a, const xvector< double > &shift, bool is_frac)
static const std::string TAG_TOL
Definition aflow.h:51
xstructure PutInCompact(const xstructure &a)
xmatrix< double > GetClat(const xvector< double > &abc_angles)
static const std::string TAG_TITLE_ARUN
Definition aflow.h:55
static const std::string TAG_TITLE_POCC_ARUN
Definition aflow.h:56
xstructure GetPrimitive(const xstructure &a)
#define XRAY_DATA_PLOT_FILE
bool RequestedAlphabeticLabeling(string &label)
void helpIndividualOption(vector< string > &argv)
bool AreAtomsOrderEquivalent(const deque< _atom > &atoms1, const deque< _atom > &atoms2)
bool AreAtomsOccupationEquivalent(const deque< _atom > &atoms1, const deque< _atom > &atoms2)
double NearestNeighbor(const xstructure &a)
string AlphabetizePrototypeLabelSpeciesTokens(vector< string > &tokens)
bool AlphabetizePrototypeLabelSpecies(deque< string > &species, deque< string > &species_pp, deque< double > &vvolume, deque< double > &vmass, string &label)
string AlphabetizePrototypeLabelSpeciesArgv(vector< string > &argv)
#define _MAXSPECIES_
#define XRAY_DATA_PEAKS_FILE
#define _NSEGMAX_
bool AreAtomsEquivalent(const deque< _atom > &atoms1, const deque< _atom > &atoms2, bool oparameter_check, bool poccupation_check)
bool AreAtomsOccupationOrderEquivalent(const deque< _atom > &atoms1, const deque< _atom > &atoms2)
int order_parameter_sum(const xstructure &str)
uint PflowARGs(vector< string > &argv, vector< string > &cmds, aurostd::xoption &vpflow)
#define DEFAULT_AFLOW_PGROUP_XTAL_JSON
#define DEFAULT_AFLOW_PGROUPK_PATTERSON_JSON
#define DEFAULT_PLATON_P_ANG
#define DEFAULT_AFLOW_PGROUPK_XTAL_JSON
#define DEFAULT_VASP_POTCAR_DIR_POTPAW_PBE_KIN
#define DEFAULT_AFLOW_IATOMS_OUT
#define DEFAULT_VASP_POTCAR_DIR_POT_PBE
#define DEFAULT_AFLOW_FGROUP_OUT
#define DEFAULT_AFLOW_DB_LOCK_FILE
#define DEFAULT_PLATON_P_D1
#define DEFAULT_AFLOW_PGROUPK_XTAL_OUT
#define DEFAULT_AFLOW_IATOMS_JSON
#define DEFAULT_FINDSYM_TOL
#define DEFAULT_VASP_POTCAR_DIR_POTPAW_PBE
#define POCC_ANIONS_LIST
#define DEFAULT_PLATON_P_D3
#define DEFAULT_AFLOW_PGROUPK_JSON
#define DEFAULT_AFLOW_SGROUP_OUT
#define DEFAULT_AFLOW_PGROUP_JSON
#define DEFAULT_AFLOW_PGROUPK_PATTERSON_OUT
#define DEFAULT_POCC_STOICH_TOL
#define DEFAULT_AFLOW_AGROUP_JSON
#define DEFAULT_AFLOW_PGROUPK_OUT
#define DEFAULT_AFLOW_PGROUP_OUT
#define DEFAULT_PLATON_P_EXACT
#define DEFAULT_VASP_POTCAR_DIR_POTPAW_LDA_KIN
#define DEFAULT_VASP_POTCAR_DIR_POTPAW_GGA
#define DEFAULT_AFLOW_AGROUP_OUT
#define DEFAULT_AFLOW_SGROUP_JSON
#define DEFAULT_VASP_POTCAR_DIR_POTPAW_LDA
#define DEFAULT_BANDS_GRID
#define DEFAULT_AFLOW_DB_STATS_FILE
#define DEFAULT_AFLOW_DB_DATA_PATH
#define DEFAULT_POCC_SITE_TOL
#define DEFAULT_AFLOW_QMVASP_OUT
#define DEFAULT_AFLOW_DB_FILE
#define DEFAULT_VASP_OUT
#define DEFAULT_VASP_POTCAR_DIR_POT_GGA
#define DEFAULT_UNARY_BANDS_GRID
#define DEFAULT_PLATON_P_EQUAL
#define DEFAULT_AFLOW_FROZSL_EIGEN_OUT
#define DEFAULT_GFA_FORMATION_ENTHALPY_CUTOFF
#define DEFAULT_AFLOW_PGROUP_XTAL_OUT
#define DEFAULT_VASP_POTCAR_DIR_POT_LDA
#define DEFAULT_FILE_AFLOWLIB_ENTRY_OUT
#define DEFAULT_PLATON_P_D2
#define DEFAULT_AFLOW_FGROUP_JSON
#define _SGROUP_
Definition aflow_defs.h:207
#define _VASP_POSCAR_MODE_EXPLICIT_START_
Definition aflow_defs.h:132
#define _PGROUP_XTAL_
Definition aflow_defs.h:203
#define _PGROUPK_PATTERSON_
Definition aflow_defs.h:205
#define _AVASP_PSEUDOPOTENTIAL_DELIMITER_
Definition aflow_defs.h:290
#define NANOPARTICLE_DISTANCE_DEFAULT
Definition aflow_defs.h:162
#define _AVASP_PSEUDOPOTENTIAL_POTENTIAL_COMPLETE_
Definition aflow_defs.h:292
#define AFLOWLIB_SERVER_DEFAULT
Definition aflow_defs.h:104
#define MISCIBILITY_SYSTEM_NOMIX
Definition aflow_defs.h:298
#define ATOM_ENVIRONMENT_MODE_1
Definition aflow_defs.h:180
#define MISCIBILITY_SYSTEM_UNKNOWN
Definition aflow_defs.h:299
#define _PGROUPK_
Definition aflow_defs.h:202
#define _AVASP_PSEUDOPOTENTIAL_AUTO_
Definition aflow_defs.h:289
#define IOVASP_AUTO
Definition aflow_defs.h:217
#define _PGROUPK_XTAL_
Definition aflow_defs.h:204
#define AFLOW_MATERIALS_SERVER_DEFAULT
Definition aflow_defs.h:102
#define _VASP_POSCAR_MODE_EXPLICIT_STOP_
Definition aflow_defs.h:133
#define _PGROUP_
Definition aflow_defs.h:201
#define _FROZSL_VASPSETUP_FILE_
Definition aflow_defs.h:141
#define _IATOMS_
Definition aflow_defs.h:209
#define _AVASP_PSEUDOPOTENTIAL_POTENTIAL_TYPE_
Definition aflow_defs.h:291
#define DEGREES
Definition aflow_defs.h:240
#define IOAFLOW_AUTO
Definition aflow_defs.h:216
#define MISCIBILITY_SYSTEM_MISCIBLE
Definition aflow_defs.h:297
#define _AFLOW_POCC_ZERO_TOL_
Definition aflow_defs.h:42
#define IOVASP_WYCKCAR
Definition aflow_defs.h:220
#define IOVASP_ABCCAR
Definition aflow_defs.h:219
#define _COORDS_CARTESIAN_
Definition aflow_defs.h:197
#define AFLOWIN_SEPARATION_LINE
Definition aflow_defs.h:189
#define _AGROUP_
Definition aflow_defs.h:208
#define KBIN_SYMMETRY_SGROUP_RADIUS_DEFAULT
Definition aflow_defs.h:115
#define IOVASP_POSCAR
Definition aflow_defs.h:218
#define NANOPARTICLE_RADIUS_DEFAULT
Definition aflow_defs.h:161
#define _COORDS_FRACTIONAL_
Definition aflow_defs.h:196
#define _FGROUP_
Definition aflow_defs.h:206
#define _ZERO_TOL_
Definition aflow_defs.h:28
#define LIBRARY_MODE_PROTOTYPE
Definition aflow_defs.h:280
string Message(const string &filename, const string &list2print)
uint AFLOW_getTEMP(const vector< string > &argv)
_XHOST XHOST
#define _AFLOW_LIB_MAX_
Definition aflow_xhost.h:87
#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
#define rad2deg
#define EULERSNUMBER
#define FIXED_STREAM
#define PI
#define AUROSTD_NAN
#define _RUNTIME_INIT_
#define _INDEX_BOUNDS_
#define _RUNTIME_ERROR_
#define _INPUT_NUMBER_
#define _INPUT_ERROR_
#define _INDEX_MISMATCH_
#define _FILE_NOT_FOUND_
#define _INPUT_ILLEGAL_
#define _FILE_WRONG_FORMAT_
#define _VALUE_ILLEGAL_
#define _FILE_CORRUPT_
#define _FILE_ERROR_
#define _INPUT_MISSING_
elements_string_type
@ composition_string
@ pp_string
bool operator()(const xstructure &str1, const xstructure &str2) const
bool operator()(const xstructure &str1, const xstructure &str2) const
tools to create 3D scence and export them in different
int tachyon_lattice_views_idx
active lattice view (-1 default tachyon viewpoint is used)
std::string toHTML()
save scene as x3d and embed it in a html file
std::string toTachyon()
save scene for the tachyon renderer use tachyon to render the generated file
std::vector< utype > applyCombo(const std::vector< utype > &v_items) const
std::vector< std::string > vxscheme
std::string xscheme
uint push_attached(const std::string &scheme, const std::string &attached)
bool flag(const std::string &, bool)
bool args2addattachedscheme(std::vector< std::string > &argv, const std::string scheme, const std::string &_s_search, std::string string_default)
utype getattachedutype(const std::string &scheme) const
uint addattachedscheme(const std::string &scheme, const std::string &attached, bool flag)
std::string getattachedscheme(const std::string &scheme) const
void set(const utype &)
bool GetPropertiesFile(const std::string &fileIN, bool=true)
double spinF
Definition aflow.h:881
double mag_cell
Definition aflow.h:678
void clear()
std::vector< std::string > vTITEL
Definition aflow.h:721
double volume_cell
Definition aflow.h:681
bool GetPropertiesFile(const std::string &fileIN, bool=true)
std::string SYSTEM
Definition aflow.h:665
std::vector< std::string > species_pp_type
Definition aflow.h:728
std::vector< std::string > species
Definition aflow.h:725
double volume_atom
Definition aflow.h:681
double mag_atom
Definition aflow.h:678
std::string pp_type
Definition aflow.h:724
std::vector< std::string > species_pp
Definition aflow.h:727
std::vector< std::string > species_pp_AUID_collisions
Definition aflow.h:731
std::vector< std::string > species_pp_version
Definition aflow.h:729
std::vector< std::string > species_pp_AUID
Definition aflow.h:730
std::vector< double > vmag
Definition aflow.h:679
std::vector< int > species_Z
Definition aflow.h:726
std::vector< xvector< double > > vmag_noncoll
Definition aflow.h:680
bool Write(const std::string &filename, const std::string &directory)
bool WGET_INPUT(std::ofstream &FileMESSAGE, std::string AflowIn, _aflags &aflags, _kflags &kflags)
bool Delete(const std::string &filename, const std::string &directory)
bool WGET_OUTPUT(std::ofstream &FileMESSAGE, _aflags &aflags, _kflags &kflags)
void Clean(const _aflags &aflags)
void setModules(_xvasp &)
string Banner(string type)
Definition aflow.cpp:872
void WriteFileIAPCFG(const aurostd::xoption &vpflow)
void writeCoordCECSV()
string PrototypesHelp()
string PrototypesIcsdHelp(const string &options)
uint PrototypeLibrariesSpeciesNumber(const string &label)
string CALCULATED()
xstructure PrototypeLibraries(ostream &oss, const string &label, const string &parameters, int mode)
string CALCULATED_ICSD_RANDOM()
void save_to_file(const std::string &filename, const std::string &collection, const std::string &target_path)
write a embedded file into the filesystem
std::string get_content(const std::string &filename, const std::string &collection)
get the content of an embedded file
bool string2file(const string &StringOUTPUT, const std::string &FileNameRawOUTPUT, const compression_type ct, const string &mode)
write string into a file
std::string httpGetCompressedFileContent(const string &url, long &response_code, std::map< std::string, std::string > &header)
get the content of a file from the web, decompress locally if needed
void CompressFile(const string &file_raw, const compression_type ct, const bool keep)
compress file
utype scalar_product(const xvector< utype > &a, const xvector< utype > &b)
bool DirectoryLS(const string &directory_raw, vector< string > &vfiles)
returns the content of a directory
string fixStringLatex(const string &input, bool double_back_slash=false, bool symmetry_string=false)
string RemoveSubString(const string &str_orig, const string &str_rm) __xprototype
void PrintMessageStream(ostringstream &stream, bool quiet, std::ostream &oss=cout)
bool RemoveDirectory(const string &directory)
remove a file
void PrintWarningStream(ostringstream &stream, bool quiet)
vector< string > xvecDouble2vecString(const xvector< double > &vin, int precision=AUROSTD_DEFAULT_PRECISION, bool roff=false, double tol=(double) AUROSTD_ROUNDOFF_TOL, char FORMAT=DEFAULT_STREAM)
vector< string > wrapVecEntries(const vector< string > &vin, const string &wrap)
bool file2directory(const string &file, const string &destination)
move file to directory
void StringSubstInPlace(string &work_string, const string &old_string, const string &new_string)
substitute parts of a strings in place
string TmpFileCreate(const string &identifier, const string &tmpdir, const bool hidden)
create a string pointing to the location of a unique temp file
xmatrix< utype > inverse(const xmatrix< utype > &a)
calculates inverse of a square matrix
xvector< utype > vector_product(const xvector< utype > &a, const xvector< utype > &b)
utype modulus(const xmatrix< utype > &a)
string ostream2string(std::ostream &oss)
bool WithinList(const vector< utype > &list, const utype &input, size_t &index, bool sorted=false)
Determines whether a specific value exists inside a list.
vector< string > vecDouble2vecString(const vector< double > &vin, int precision=AUROSTD_DEFAULT_PRECISION, bool roff=false, double tol=(double) AUROSTD_ROUNDOFF_TOL, char FORMAT=DEFAULT_STREAM)
string RemoveComments(const string &s) __xprototype
deque< utype > vector2deque(const vector< utype > &vin)
void VASP_PseudoPotential_CleanName_InPlace(string &species, bool capital_letters_only, bool remove_floats)
bool CompressFileExist(const string &FileName)
check if a file or its compressed variant exits
string CleanFileName(const string &fileIN)
cleans file names from obvious things
uint string2tokens(const string &str, vector< string > &tokens, const string &delimiters=" ", bool consecutive=false) __xprototype
size_t file2string(const string &FileNameIN, string &StringIN)
read the content of a file into a string
void InFileExistCheck(const string &routine, const string &FileNameRaw, const ifstream &file_to_check)
checks if a filestream is empty
bool RemoveControlCodeCharactersFromString(const string &in, string &out)
size_t httpGetTokens(const string &url, vector< utype > &tokens, const string &delimiters)
get the data split into tokens
string PaddedPOST(utype, int, string=" ")
bool isequal(const xcomplex< utype > &a, const xcomplex< utype > &b, utype _tol_)
utype max(const vector< utype > vec)
bool IsCommandAvailable(const string &command)
bool DirectoryMake(const string &directory_raw)
create a directory
utype string2utype(const string &from, const uint base=10)
xmatrix< utype > eye(int nrh, int nch, int nrl, int ncl) __xprototype
bool args2flag(const vector< string > &argv, const string &s0)
string utype2string(const utype &from, int precision=AUROSTD_DEFAULT_PRECISION, char FORMAT=DEFAULT_STREAM) __xprototype
size_t string2vectorstring(const string &stringIN, vector< string > &vstringout, bool consecutive=false, bool trim_edges=false)
string RemoveCharacter(const string &s, const char character) __xprototype
string RemoveWhiteSpacesFromTheFrontAndBack(const string &s) __xprototype
bool FileExist(const string &FileName)
check if file exists
string liststring2string(string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="", string="")
void compressfile2stringstream(const string &file_raw, stringstream &content)
write the content of a compressed file into a stringstream
bool FileEmpty(const string &FileNameRaw)
check if file is empty
string TmpDirectoryCreate(const string &identifier, const string &tmpdir, const bool hidden)
create a string pointing to the location of a unique temp directory
bool FileNotEmpty(const string &FileName)
check if file is not empty
string PaddedPRE(utype, int, string=" ")
string args2string(const vector< string > &argv, const string &s0, const string &s_def)
string RemoveWhiteSpacesFromTheBack(const string &s) __xprototype
bool isfloat(const string &in)
string args2attachedutype(const vector< string > &argv, const string &s0, const string &s_def)
utype args2utype(const vector< string > &argv, const string &s0, utype def_out)
bool CompressFileWithinList(const vector< string > &list, const string &input)
Determines whether a compressed file is within the list.
bool Chmod(const uint chmod, const string &path, const std::filesystem::perm_options perm_opt=std::filesystem::perm_options::replace)
change permissions of the path
string execute2string(ostringstream &command)
void sort(vector< utype1 > &arr)
bool IsDirectory(const string &path)
check if path is a directory
bool SubDirectoryLS(const string &directory_raw, vector< string > &vsubd)
returns all the subdirectories of a directory, including itself
size_t stream2vectorstring(std::istream &istreamIN, vector< string > &vstringout)
string RemoveSubStringFirst(const string &str_orig, const string &str_rm) __xprototype
bool substringlist2bool(const string &strin, const vector< string > &substrings, bool match_all=true)
matrix< utype > xmatrix2matrix(const xmatrix< utype > &_xmatrix)
bool file2file(const string &file, const string &destination)
move file to another file
bool args2attachedflag(const vector< string > &argv, const string &s0)
string getPWD()
returns the current directory
void DecompressFile(const string &file_raw, const string &outfile_raw, const bool keep)
decompress file
bool stringstream2file(const stringstream &StringstreamOUTPUT, const string &FileNameOUTPUT, const compression_type ct, const string &mode)
write stringstream into a file
string toupper(const string &in) __xprototype
string args2attachedstring(const vector< string > &argv, const string &s0, string s_def)
void StringstreamClean(ostringstream &stream)
bool RemoveFile(const string &file)
remove a file
string RemoveWhiteSpaces(const string &s) __xprototype
size_t file2vectorstring(const string &FileNameIN, vector< string > &vline, bool consecutive, bool trim_edges)
write the content of a file into a vector of strings
void PrintErrorStream(ostringstream &stream, bool quiet)
void file2stringstream(const string &FileNameIN, stringstream &StringstreamIN)
write the content of a file into a stringstream 20241216 | Hagen Eckert - add transparent compression...
bool substring2bool(const string &strstream, const string &strsub1, bool RemoveWS=false, bool RemoveComments=true)
string joinWDelimiter(const xvector< utype > &ientries, const char delimiter)
vector< string > getElements(const string &input)
bool execute(ostringstream &command)
void PLOT_PEDOSALL(string options)
void PLOT_BAND2(string options)
void PLOT_PEDOS(string options)
bool DOSDATA_JSON(xoption &vpflow, ostream &oss=cout)
void PLOT_DOSWEB(string options)
void PLOT_BAND_SPINSPLIT(string options)
void PLOT_PEDOSALL_AFLOWLIB(string options, _aflags &aflags)
bool BANDSDATA_JSON(xoption &vpflow, ostream &oss=cout)
void ErrorOption(const string &options, const string &routine, vector< string > vusage)
void MessageOption(const string &options, const string &routine, vector< string > vusage)
void CIF(istream &input, aurostd::xoption &vpflow)
void cleanupstring(string &str)
void PDB(istream &input)
void DISP(const string &options, istream &input)
bool DATA(istream &input, const aurostd::xoption &vpflow, const string &smode, ostream &oss)
void XYZINSPHERE(istream &input, double radius)
void BANDGAP(aurostd::xoption &vpflow, ostream &oss)
xstructure NANOPARTICLE(istream &input, const xvector< double > &iparams)
void ANGLES(const string &options, istream &input)
void ProcessAndAddSpinToXstructure(xstructure &a, const string &magmom_info)
string AFLOWIN(istream &input)
xstructure INCELL(istream &input)
string BZDirectionsLATTICE(const string &options)
void logger(const string &filename, const string &function_name, stringstream &message, const char &type, ostream &oss, bool silent, const string &message_metadata)
void AGROUP(_aflags &aflags, istream &input)
bool loadAndMergeLIBX(string combination, string LIB, string server, vector< vector< vector< aflowlib::_aflowlib_entry > > > &naries, ostream &oss)
void RDFCMP(const string &options)
bool CheckCommands(vector< string > argv, const vector< string > &cmds)
xstructure MINKOWSKIBASISREDUCTION(istream &input)
void SPLINE(vector< string > argv)
bool loadLIBX(string LIB, string elements, vector< aflowlib::_aflowlib_entry > &entries, ostream &oss)
void INTPOL(const string &options)
string PEARSON_SYMBOL(istream &input)
string CHGDIFF(aurostd::xoption vpflow)
void RBDIST(vector< string > argv)
void PLANEDENS(vector< string > argv)
xstructure SETCM(istream &input, const xvector< double > &newcm)
bool AddSpinToXstructure(xstructure &a, vector< double > &vmag)
xstructure NIGGLI(istream &input)
string listPrototypeLabels(aurostd::xoption &vpflow)
xstructure POSCAR(istream &input)
string FROZSL_VASPSETUP(vector< string > argv, int mode)
string EXTRACT_Symmetry(_aflags &aflags, vector< string > argv)
bool convertXStr2POCC(xstructure &xstr, const string &pocc_params, const vector< string > &_vspecies, const vector< double > &vvolumes)
void XYZ(const string &options, istream &input)
string ALPHASpecies(const string &options)
int whereischar(string str, char c)
string arity_string(uint arity, bool capital, bool plural)
string EQUIVALENT(_aflags &aflags, istream &input, aurostd::xoption &vpflow)
bool setPOCCTOL(xstructure &xstr, const string &pocc_tol_string)
void PrintSpline(const vector< double > &x, const vector< double > &y, const int &npts, ostream &outf)
xstructure WYCKOFF(vector< string > argv, istream &input)
void GULP(istream &input)
vector< POCCSiteSpecification > poccString2POCCSiteSpecification(const xstructure &xstr, const vector< string > pocc_sites)
xstructure CART(istream &input)
void FGROUP(_aflags &aflags, istream &input)
bool sortPOCCSiteSpecifications(const POCCSiteSpecification &p1, const POCCSiteSpecification &p2)
bool sortPOCCSites(const string &p1, const string &p2)
bool POCC_COMMAND_LINE(aurostd::xoption &vpflow, istream &input, ostream &oss)
bool GetCollinearMagneticInfo(uint num_atoms, const string &magmom_info, vector< double > &vmag)
vector< double > VVdiff(const vector< double > &a, const vector< double > &b)
uint SubLayersRestAPILS(const string &url, vector< string > &vsuburl)
void NDATA(istream &input)
void MSI(istream &input)
double norm(const vector< double > &v)
string MISCIBILITY(vector< string > argv)
bool havechar(string str_in, char c)
void PGROUPK(_aflags &aflags, istream &input)
void PYTHON_MODULES(const string &modules, ostream &oss)
void COMPARE(const string &options)
xstructure LTCELL(const string &options, istream &input)
bool FIX_PRECISION_POCC(const string &occ, string &new_occ)
void defaultKFlags4SymWrite(_kflags &kflags, bool write)
xstructure VOLUME(const string &options, istream &input)
void GLASS_FORMING_ABILITY(aurostd::xoption &vpflow)
void KBAND(vector< string > argv)
void FIX_POCC_PARAMS(const xstructure &xstr, string &pocc_params)
xstructure KPOINTS_DELTA(aurostd::xoption &vpflow, istream &input, ostream &oss)
xstructure RMATOM(istream &input, const int &iatom)
bool PROTO_AFLOW(aurostd::xoption vpflow, bool flag_REVERSE)
void POCC(vector< string > argv)
bool loadXstructureLibEntry(const aflowlib::_aflowlib_entry &entry, xstructure &new_structure)
load a xstructure directly from a AFLOW lib entry
xstructure INFLATE_LATTICE(const string &options, istream &input)
void FINDSYM(aurostd::xoption &vpflow, uint mode, istream &input)
string NBONDXX(istream &input, bool aflowlib_legacy_format)
void PDOS(vector< string > argv)
void SEWALD(vector< string > argv, istream &input)
void PGROUPXTAL(_aflags &aflags, istream &input)
string BZDirectionsSTRUCTURE(istream &input, aurostd::xoption &vpflow)
bool QMVASP(aurostd::xoption &vpflow)
void ACE(istream &input)
string GENERATE_CERAMICS_PRINT(const aurostd::xoption &vpflow)
bool GetNonCollinearMagneticInfo(uint num_atoms, const string &magmom_info, vector< xvector< double > > &vmag_noncoll)
aurostd::matrix< double > GetScaledLat(const xstructure &a)
xstructure SCALE(const string &options, istream &input)
double NNDIST(istream &input)
void DIST(const string &options, istream &input)
void getCIFOptions(xstructure &a, aurostd::xoption &vpflow)
Extract command-line options to generate a CIF.
string HNF(vector< string > argv, istream &input, ostream &oss)
string SG(aurostd::xoption &vpflow, istream &input, string mode, string print)
void PGROUP(_aflags &aflags, istream &input)
void RSM(vector< string > argv, istream &input)
bool PerformFullSymmetry(xstructure &a)
void SHELL(const string &options, istream &input)
xstructure INFLATE_VOLUME(const string &options, istream &input)
void ATOMIC_ENVIRONMENT(const aurostd::xoption &vpflow)
uint NATOMS(istream &input)
bool loadEntries(vector< string > &velements, vector< vector< vector< aflowlib::_aflowlib_entry > > > &entries, ostream &oss)
void BANDSTRUCTURE(_aflags &aflags)
bool SYMMETRY_GROUPS(_aflags &aflags, istream &input, aurostd::xoption &vpflow, ostream &oss)
xstructure NOORDERPARAMETER(istream &input)
string GEOMETRY(istream &input)
void defaultKFlags4SymCalc(_kflags &kflags, bool calc)
string HNFTOL(vector< string > argv, istream &input, ostream &oss)
void SUMPDOS(vector< string > argv)
xstructure CORNERS(istream &input)
void AGROUP2(istream &input)
xstructure INWS(istream &input)
xstructure KPOINTS(const string &options, istream &input, ostream &oss)
void CHGINT(vector< string > argv)
bool PSEUDOPOTENTIALS_CHECK(const aurostd::xoption &vpflow, const string &file, ostream &oss)
void RDF(const string &options, istream &input, bool raw_counts)
void EIGCURV(const string &options, ostream &oss)
void JMOL(const string &options, istream &input)
double frac2dbl(string str)
void POSCAR2WYCKOFF(istream &input)
void RBANAL(vector< string > argv)
bool CalculateFullSymmetry(istream &input, aurostd::xoption &vpflow, ostream &oss)
void CLEANALL(istream &input)
int main(vector< string > &argv, vector< string > &cmds)
bool PROTO_PARSE_INPUT(const vector< string > &params, vector< vector< string > > &vvstr, vector< vector< double > > &vvnum, bool ignore_label, bool reverse)
string ALPHACompound(const string &options)
string EXTRACT_xcar(_aflags &aflags, vector< string > argv, string mode, string file)
void HKL(const string &options, _aflags &aflags, istream &input)
xstructure ALPHABETIC(istream &input)
double GetAtomicPlaneDist(const string &options, istream &cin)
void CMPSTR(vector< string > argv)
void CAGES(_aflags &aflags, const string &options, istream &input)
void EDOS(vector< string > argv)
xstructure PRIM(istream &input, uint mode)
const int BAR_WIDTH
xstructure NUMNAMES(vector< string > argv, istream &input)
xstructure FRAC(istream &input)
bool sortPOCCOccs(const string &occ1, const string &occ2)
xstructure SHIFT(const string &options, istream &input)
void AGROUP2m(istream &input)
void CLAT(const string &options)
void BANDGAP_DOS(aurostd::xoption &vpflow, ostream &oss)
bool loadFromCommon(aurostd::xoption &vpflow)
xstructure LATTICEREDUCTION(istream &input)
bool PROTO_TEST_INPUT(const vector< vector< string > > &vvstr, const vector< vector< double > > &vvnum, uint &nspeciesHTQC, bool patch_nspecies)
bool loadXstructures(aflowlib::_aflowlib_entry &entry, ostream &oss, bool relaxed_only, string path, bool is_url_path)
void defaultLoadEntriesFlags(aurostd::xoption &vpflow, ostream &oss, string input, bool entry_output, bool silent)
string FROZSL_ANALYZE_old(istream &input)
void XRAY_PEAKS(const aurostd::xoption &vpflow, istream &input)
xstructure ABCCAR(istream &input)
string SPECIES(istream &input)
xstructure xstrSWAP(vector< string > argv, istream &input)
string Intro_pflow(string x)
xstructure SETORIGIN(istream &input, const xvector< double > &neworigin)
xstructure INCOMPACT(istream &input)
bool POccInputs2Xstr(const string &pocc_input, aurostd::xoption &pocc_settings, xstructure &xstr, ostream &oss)
void PRINT_XRAY_DATA_PLOT(const aurostd::xoption &vpflow, istream &input)
xstructure IDENTICAL(istream &input)
vector< string > GENERATE_CERAMICS(const vector< string > &_vnonmetals, const vector< string > &_vmetals, uint metal_arity)
string WyckoffPositions(aurostd::xoption &vpflow, istream &input)
bool fixEmptyAtomNames(xstructure &xstr, bool force_fix)
bool prototypeMatch(string proto_database, string proto_search)
void HKLSearch(const string &options, _aflags &aflags, istream &input, const string &smode)
void JOINSTRLIST(vector< string > argv)
void RASMOL(const string &options, istream &input)
void MagneticParameters(string _directory, ostream &oss)
xstructure RMCOPIES(istream &input)
void RENDER(istream &input, const fs::path &output)
allow to render any structure from the command line
void updateProgressBar(unsigned long long int current, unsigned long long int end, ostream &oss)
void PLOT_XRAY(const aurostd::xoption &vpflow, istream &input)
void EFFMASS(vector< string > &argv, ostream &oss)
void XRAY(const string &options, istream &input)
xstructure CPRIM(istream &input)
void EWALD(const string &options, istream &input)
vector< double > VVsum(const vector< double > &a, const vector< double > &b)
void ZVAL(const string &options)
string CHGSUM(aurostd::xoption vpflow)
string LATTICE_LATTICE_TYPE(istream &input, aurostd::xoption &vpflow)
void KPATH(istream &input, bool WWW)
string PLATON(const string &options, istream &input)
bool FIXBANDS(_aflags &aflags, string opts)
uint NSPECIES(istream &input)
string ATOMSMAX(const string &options, istream &input)
bool checkAnionSublattice(const xstructure &xstr)
aurostd::matrix< double > GetLat(const xstructure &a)
void ChangeSuffix(const string &_operation)
string POSCAR2AFLOWIN(istream &input, const string &module)
void STATDIEL(vector< string > &argv)
vector< vector< string > > elementalCombinations(const vector< string > &velements, uint nary)
void MOM(istream &input)
string LATTICE_TYPE(istream &input, aurostd::xoption &vpflow)
xstructure SUPERCELL(const string &options, istream &input)
void BANDS(const string &options, istream &input)
xstructure NOSD(istream &input)
void RAYTRACE(vector< string > argv)
vector< double > Getabc_angles(const aurostd::matrix< double > &lat)
void READ_XRAY_DATA(const string &filename, vector< double > &v_twotheta, vector< double > &v_intensity)
xstructure NAMES(vector< string > argv, istream &input)
bool compoundsBelong(const vector< string > &velements2check, const string &input, ostream &oss, bool clean, bool sort_elements, elements_string_type e_str_type, bool shortcut_pp_string_AFLOW_database)
void SUPERCELLSTRLIST(const string &options)
void XYZWS(istream &input)
string FROZSL_OUTPUT()
string FROZSL_INPUT()
xstructure SD(vector< string > argv, istream &input)
xstructure PROTO_LIBRARIES(aurostd::xoption vpflow)
void SGROUP(_aflags &aflags, istream &input, double radius)
void MAKESTRLIST(vector< string > argv)
string FROZSL_ANALYZE(istream &input)
void PLOT_THERMO(aurostd::xoption &, ostream &oss=cout)
void PLOT_PHDISP(aurostd::xoption &, ostream &oss=cout)
void PLOT_BANDDOS(aurostd::xoption &, ostream &oss=cout)
aurostd::xoption getPlotOptionsQHAthermo(const aurostd::xoption &xopt, const string &key)
void PLOT_PHDOS(aurostd::xoption &, ostream &oss=cout)
void PLOT_DOS(aurostd::xoption &, ostream &oss=cout)
void PLOT_BAND(aurostd::xoption &, ostream &oss=cout)
void PLOT_PHDISPDOS(aurostd::xoption &, ostream &oss=cout)
void PLOT_PDOS(aurostd::xoption &, ostream &oss=cout)
void PLOT_TCOND(aurostd::xoption &, ostream &oss=cout)
aurostd::xoption getPlotOptionsPhonons(const aurostd::xoption &, const string &)
void PLOT_THERMO_QHA(aurostd::xoption &, ostream &oss=cout)
aurostd::xoption getPlotOptionsEStructure(const aurostd::xoption &, const string &, bool=false)
void PLOT_GRUENEISEN_DISPERSION(aurostd::xoption &, ostream &oss=cout)
aurostd::xoption getPlotOptions(const aurostd::xoption &, const string &, bool=false)
Definition aflow.h:1682
void UFFENERGY(std::istream &input)
void run_cmd(aurostd::xoption &vpflow, std::istream &input)
storge container for a JSON object
std::string toString(bool json_format=true, bool escape_unicode=true) const
converts a JSON::object into a string