1 |
– |
|
1 |
|
#include <cstdlib> |
2 |
|
#include <cstdio> |
3 |
|
#include <cstring> |
53 |
|
// char* in_name; |
54 |
|
char* id; |
55 |
|
|
56 |
< |
int* hasErrors; |
56 |
> |
int hasErrors; |
57 |
|
|
59 |
– |
|
60 |
– |
MakeStamps* the_stamps = NULL; |
61 |
– |
Globals* the_globals = NULL; |
62 |
– |
Component** the_components = NULL; |
63 |
– |
LinkedMolStamp* headStamp = NULL; |
64 |
– |
LinkedMolStamp* currStamp; |
65 |
– |
|
58 |
|
// initialize all functions and variables |
59 |
|
|
60 |
|
initSimError(); |
66 |
|
headInc = NULL; |
67 |
|
|
68 |
|
bsInfo.includes = NULL; |
77 |
– |
bsInfo.componentsNmol = NULL; |
78 |
– |
bsInfo.compStamps = NULL; |
79 |
– |
bsInfo.havePressure = 0; |
80 |
– |
bsInfo.haveTauBarostat = 0; |
81 |
– |
bsInfo.haveTauThermostat = 0; |
82 |
– |
bsInfo.haveQmass = 0; |
83 |
– |
|
84 |
– |
//Nanobuilder components. |
85 |
– |
bsInfo.latticeType = FCC_LATTICE_TYPE; // set lattice type to FCC. |
86 |
– |
bsInfo.hasVacancies = 0; //set vacancies to false. |
87 |
– |
bsInfo.buildCoreShell = 0; |
88 |
– |
|
89 |
– |
bsInfo.latticeSpacing = 0.0; |
90 |
– |
bsInfo.coreRadius = 0.0; |
91 |
– |
bsInfo.particleRadius = 0.0; |
92 |
– |
bsInfo.shellRadius = 0.0; |
93 |
– |
bsInfo.vacancyRadius = 0.0; |
94 |
– |
bsInfo.vacancyFraction = 0.0; |
95 |
– |
bsInfo.soluteX = 0.0; |
69 |
|
|
70 |
|
|
98 |
– |
|
99 |
– |
headStamp = new LinkedMolStamp(); |
100 |
– |
the_stamps = new MakeStamps(); |
101 |
– |
the_globals = new Globals(); |
102 |
– |
set_interface_stamps( the_stamps, the_globals ); |
103 |
– |
|
71 |
|
// parse command line arguments |
72 |
|
|
73 |
|
if (cmdline_parser (argc, argv, &args_info) != 0) |
76 |
|
// Handle command line arguments. |
77 |
|
sysType = grabCmdArgs(); |
78 |
|
|
79 |
< |
// Keep me |
80 |
< |
if(in_name == NULL){ |
79 |
> |
// Keep me |
80 |
> |
if(in_name == NULL){ |
81 |
|
sprintf( painCave.errMsg, |
82 |
|
"No input bass file was specified.\n"); |
83 |
|
painCave.isFatal = 0; |
84 |
|
simError(); |
85 |
< |
usage(); |
85 |
> |
cmdline_parser_print_help(); |
86 |
|
} |
87 |
|
|
88 |
|
if( sysType < 0 ){ |
90 |
|
"No system type was specified.\n"); |
91 |
|
painCave.isFatal = 0; |
92 |
|
simError(); |
93 |
< |
usage(); |
93 |
> |
cmdline_parser_print_help(); |
94 |
|
} |
95 |
|
|
96 |
|
|
105 |
|
bsInfo.outPrefix = out_prefix; |
106 |
|
bsInfo.includes = headInc; |
107 |
|
|
141 |
– |
|
108 |
|
// open and parse the bass file. |
109 |
|
|
110 |
|
set_interface_stamps( the_stamps, the_globals ); |
254 |
|
} |
255 |
|
|
256 |
|
// get and set the boxSize |
257 |
+ |
|
258 |
+ |
bsInfo.haveBox = false; |
259 |
|
|
260 |
+ |
std::cerr << "Box setting..."; |
261 |
+ |
|
262 |
+ |
std::cerr <<" haveBox= " << the_globals->haveBox() << "\n"; |
263 |
+ |
|
264 |
|
if( the_globals->haveBox() ){ |
265 |
|
bsInfo.boxX = the_globals->getBox(); |
266 |
|
bsInfo.boxY = the_globals->getBox(); |
267 |
|
bsInfo.boxZ = the_globals->getBox(); |
268 |
+ |
bsInfo.haveBox = true; |
269 |
+ |
std::cerr<< "box=>yes\n"; |
270 |
|
} |
271 |
|
else if( the_globals->haveDensity() ){ |
272 |
|
|
275 |
|
bsInfo.boxX = pow( vol, ( 1.0 / 3.0 ) ); |
276 |
|
bsInfo.boxY = bsInfo.boxX; |
277 |
|
bsInfo.boxZ = bsInfo.boxY; |
278 |
+ |
bsInfo.haveBox = true; |
279 |
+ |
|
280 |
+ |
std::cerr<< "dens=>yes\n"; |
281 |
|
} |
282 |
|
else{ |
283 |
< |
if( !the_globals->haveBoxX() ){ |
307 |
< |
sprintf( painCave.errMsg, |
308 |
< |
"sysBuild error, no periodic BoxX size given.\n" ); |
309 |
< |
painCave.isFatal = 1; |
310 |
< |
simError(); |
311 |
< |
} |
312 |
< |
bsInfo.boxX = the_globals->getBoxX(); |
313 |
< |
|
314 |
< |
if( !the_globals->haveBoxY() ){ |
315 |
< |
sprintf( painCave.errMsg, |
316 |
< |
"sysBuild error, no periodic BoxY size given.\n" ); |
317 |
< |
painCave.isFatal = 1; |
318 |
< |
simError(); |
319 |
< |
} |
320 |
< |
bsInfo.boxY = the_globals->getBoxY(); |
321 |
< |
|
322 |
< |
if( !the_globals->haveBoxZ() ){ |
323 |
< |
sprintf( painCave.errMsg, |
324 |
< |
"SimSetup error, no periodic BoxZ size given.\n" ); |
325 |
< |
painCave.isFatal = 1; |
326 |
< |
simError(); |
327 |
< |
} |
328 |
< |
bsInfo.boxZ = the_globals->getBoxZ(); |
283 |
> |
std::cerr<< "none.\n"; |
284 |
|
} |
285 |
|
|
286 |
|
|
287 |
< |
//************************************************************ |
287 |
> |
// ************************************************************ |
288 |
|
// that should be all we need from bass. now to switch to the |
289 |
|
// appropriate system builder. |
290 |
|
// *********************************************************** |
291 |
< |
|
292 |
< |
|
291 |
> |
|
292 |
> |
nanoBuilder* buildNano; |
293 |
> |
|
294 |
|
switch( sysType ){ |
295 |
|
|
296 |
|
case BILAYER: |
299 |
|
|
300 |
|
case NANOPARTICLE: |
301 |
|
|
302 |
< |
// nanoBuilder buildNano(hasErrors); |
303 |
< |
|
304 |
< |
// buildNano.buildNanoParticle(); |
305 |
< |
|
302 |
> |
buildNano = new nanoBuilder(hasErrors); |
303 |
> |
|
304 |
> |
buildNano->buildNanoParticle(); |
305 |
> |
|
306 |
|
break; |
307 |
|
|
308 |
|
default: |
320 |
|
if( headStamp!= NULL ) delete headStamp; |
321 |
|
if( the_stamps != NULL ) delete the_stamps; |
322 |
|
if( the_globals != NULL ) delete the_globals; |
323 |
< |
if( the_components != NULL ) delete[] the_components; |
323 |
> |
// if( the_components != NULL ) delete[] the_components; |
324 |
|
|
325 |
|
if( bsInfo.componentsNmol != NULL ) delete[] bsInfo.componentsNmol; |
326 |
|
if( bsInfo.compStamps != NULL ) delete[] bsInfo.compStamps; |
445 |
|
} |
446 |
|
|
447 |
|
if (args_info.inputs_num) { //Get input file name |
448 |
< |
in_name = args_info.inputs[1]; |
448 |
> |
in_name = args_info.inputs[0]; |
449 |
> |
cerr << in_name << "\n"; |
450 |
|
} |
451 |
|
else { |
452 |
|
sprintf( painCave.errMsg, |