1 |
+ |
|
2 |
|
#include <cstdlib> |
3 |
|
#include <cstdio> |
4 |
|
#include <cstring> |
12 |
|
|
13 |
|
#include "sysBuild.hpp" |
14 |
|
#include "bilayerSys.hpp" |
15 |
+ |
#include "nanoBuilder.hpp" |
16 |
|
|
17 |
|
// this routine is defined in BASS_interface.cpp |
18 |
|
extern void set_interface_stamps( MakeStamps* ms, Globals* g ); |
20 |
|
|
21 |
|
// case asignments |
22 |
|
#define BILAYER 1 |
23 |
+ |
#define NANOPARTICLE 2 |
24 |
|
|
22 |
– |
|
25 |
|
char* program_name; |
26 |
|
bassInfo bsInfo; |
27 |
|
void usage(void); |
43 |
|
|
44 |
|
MakeStamps* the_stamps = NULL; |
45 |
|
Globals* the_globals = NULL; |
46 |
< |
MoleculeStamp** the_components = NULL; |
46 |
> |
Component** the_components = NULL; |
47 |
|
LinkedMolStamp* headStamp = NULL; |
48 |
|
LinkedMolStamp* currStamp; |
49 |
|
|
48 |
– |
if( |
49 |
– |
|
50 |
|
// initialize all functions and variables |
51 |
|
|
52 |
|
initSimError(); |
61 |
|
bsInfo.componentsNmol = NULL; |
62 |
|
bsInfo.compStamps = NULL; |
63 |
|
bsInfo.havePressure = 0; |
64 |
< |
bsInfo.haveTauBarrostat = 0; |
64 |
> |
bsInfo.haveTauBarostat = 0; |
65 |
|
bsInfo.haveTauThermostat = 0; |
66 |
|
bsInfo.haveQmass = 0; |
67 |
|
|
90 |
|
simError(); |
91 |
|
usage(); |
92 |
|
} |
93 |
+ |
|
94 |
|
sysType = BILAYER; |
95 |
+ |
|
96 |
+ |
i++; |
97 |
+ |
if( i>=argc ){ |
98 |
+ |
sprintf( painCave.errMsg, |
99 |
+ |
"\n" |
100 |
+ |
"not enough arguments for bilayer\n"); |
101 |
+ |
painCave.isFatal = 0; |
102 |
+ |
simError(); |
103 |
+ |
usage(); |
104 |
+ |
} |
105 |
+ |
strcpy( bsInfo.lipidName, argv[i] ); |
106 |
+ |
|
107 |
+ |
i++; |
108 |
+ |
if( i>=argc ){ |
109 |
+ |
sprintf( painCave.errMsg, |
110 |
+ |
"\n" |
111 |
+ |
"not enough arguments for bilayer\n"); |
112 |
+ |
painCave.isFatal = 0; |
113 |
+ |
simError(); |
114 |
+ |
usage(); |
115 |
+ |
} |
116 |
+ |
strcpy( bsInfo.waterName, argv[i] ); |
117 |
+ |
|
118 |
+ |
} |
119 |
+ |
|
120 |
+ |
else{ |
121 |
+ |
sprintf( painCave.errMsg, |
122 |
+ |
"Invalid option \"%s\"\n", argv[i] ); |
123 |
+ |
painCave.isFatal = 0; |
124 |
+ |
simError(); |
125 |
+ |
usage(); |
126 |
+ |
} |
127 |
+ |
} |
128 |
+ |
else if( !strcmp( argv[i], "--nanoparticle" ) ){ |
129 |
+ |
if( sysType > 0 ){ |
130 |
+ |
sprintf( painCave.errMsg, |
131 |
+ |
"You cannot specify more than one system to build.\n" ); |
132 |
+ |
painCave.isFatal = 0; |
133 |
+ |
simError(); |
134 |
+ |
usage(); |
135 |
+ |
} |
136 |
+ |
|
137 |
+ |
sysType = NANOPARTICLE; |
138 |
+ |
|
139 |
+ |
i++; |
140 |
+ |
if( i>=argc ){ |
141 |
+ |
sprintf( painCave.errMsg, |
142 |
+ |
"\n" |
143 |
+ |
"not enough arguments for nanoparticle\n"); |
144 |
+ |
painCave.isFatal = 0; |
145 |
+ |
simError(); |
146 |
+ |
usage(); |
147 |
+ |
} |
148 |
+ |
strcpy( bsInfo.coreName, argv[i] ); |
149 |
+ |
|
150 |
+ |
i++; |
151 |
+ |
if( i>=argc ){ |
152 |
+ |
sprintf( painCave.errMsg, |
153 |
+ |
"\n" |
154 |
+ |
"not enough arguments for nanoparticle\n"); |
155 |
+ |
painCave.isFatal = 0; |
156 |
+ |
simError(); |
157 |
+ |
usage(); |
158 |
+ |
} |
159 |
+ |
strcpy( bsInfo.shellName, argv[i] ); |
160 |
+ |
|
161 |
|
} |
162 |
|
|
163 |
|
else{ |
196 |
|
if( headInc == NULL ){ |
197 |
|
headInc = new includeLinked; |
198 |
|
headInc->next = NULL; |
199 |
< |
strcopy( headInc->name, argv[i] ); |
199 |
> |
strcpy( headInc->name, argv[i] ); |
200 |
|
} |
201 |
|
else{ |
202 |
|
prevInc = headInc; |
203 |
|
currInc = headInc->next; |
204 |
|
while( currInc != NULL ){ |
205 |
|
prevInc = currInc; |
206 |
< |
currInc = previnc->next; |
206 |
> |
currInc = prevInc->next; |
207 |
|
} |
208 |
|
currInc = new includeLinked; |
209 |
|
currInc->next = NULL; |
210 |
< |
strcopy( currInc->name, argv[i] ); |
210 |
> |
strcpy( currInc->name, argv[i] ); |
211 |
|
prevInc->next = currInc; |
212 |
|
} |
213 |
|
|
288 |
|
// open and parse the bass file. |
289 |
|
|
290 |
|
set_interface_stamps( the_stamps, the_globals ); |
291 |
< |
yacc_BASS( info.in_name ); |
291 |
> |
yacc_BASS( in_name ); |
292 |
|
|
293 |
|
// set the easy ones first |
294 |
|
bsInfo.targetTemp = the_globals->getTargetTemp(); |
321 |
|
bsInfo.haveTauThermostat = 1;; |
322 |
|
} |
323 |
|
else if (the_globals->haveQmass()){ |
324 |
< |
bsinfo.Qmass = the_globals->getQmass(); |
324 |
> |
bsInfo.Qmass = the_globals->getQmass(); |
325 |
|
bsInfo.haveQmass = 1; |
326 |
|
} |
327 |
|
else { |
375 |
|
sprintf( painCave.errMsg, |
376 |
|
"sysBuild Warning. Unrecognized Ensemble -> %s, " |
377 |
|
"reverting to NVE for this simulation.\n", |
378 |
< |
ensemble ); |
378 |
> |
bsInfo.ensemble ); |
379 |
|
painCave.isFatal = 0; |
380 |
|
simError(); |
381 |
|
strcpy( bsInfo.ensemble, "NVE" ); |
438 |
|
if( the_globals->haveBox() ){ |
439 |
|
bsInfo.boxX = the_globals->getBox(); |
440 |
|
bsInfo.boxY = the_globals->getBox(); |
441 |
< |
bsinfo.boxZ = the_globals->getBox(); |
441 |
> |
bsInfo.boxZ = the_globals->getBox(); |
442 |
|
} |
443 |
|
else if( the_globals->haveDensity() ){ |
444 |
|
|
445 |
|
double vol; |
446 |
< |
vol = (double)tot_nmol / the_globals->getDensity(); |
446 |
> |
vol = (double)bsInfo.totNmol / the_globals->getDensity(); |
447 |
|
bsInfo.boxX = pow( vol, ( 1.0 / 3.0 ) ); |
448 |
< |
bsInfo.boxY = simnfo->box_x; |
449 |
< |
bsInfo.boxZ = simnfo->box_x; |
448 |
> |
bsInfo.boxY = bsInfo.boxX; |
449 |
> |
bsInfo.boxZ = bsInfo.boxY; |
450 |
|
} |
451 |
|
else{ |
452 |
|
if( !the_globals->haveBoxX() ){ |
488 |
|
buildBilayer( isRandom ); |
489 |
|
break; |
490 |
|
|
491 |
+ |
case NANO: |
492 |
+ |
|
493 |
+ |
|
494 |
+ |
break; |
495 |
+ |
|
496 |
|
default: |
497 |
|
sprintf( painCave.errMsg, |
498 |
|
"Unknown system type: %d\n", sysType ); |
499 |
|
painCave.isFatal = 1; |
500 |
|
simError(); |
501 |
+ |
|
502 |
|
} |
503 |
|
|
504 |
|
|
545 |
|
"\n" |
546 |
|
" long:\n" |
547 |
|
" -----\n" |
548 |
< |
" --bilayer Tries to build a basic bilayer with the specified number\n" |
549 |
< |
" of lipids in the input bass file. The bilayer will be\n" |
550 |
< |
" surrounded by the number of solvent molecules given\n" |
551 |
< |
" in the bass file.\n" |
552 |
< |
" -note: combined with \"-r\" the simulation will start in\n" |
553 |
< |
" an FCC lattice with randomly assigned latice\n" |
481 |
< |
" sites for all atoms involved.\n" |
548 |
> |
" --bilayer <lipid> <water> Tries to build a basic bilayer with the specified number\n" |
549 |
> |
" of lipids in the input bass file. The bilayer will be\n" |
550 |
> |
" surrounded by the number of solvent molecules given\n" |
551 |
> |
" in the bass file.\n" |
552 |
> |
" -note: combined with \"-r\" the simulation will start\n" |
553 |
> |
" the lipids randomly oriented in a sea of waters.\n" |
554 |
|
"\n" |
555 |
|
"\n", |
556 |
|
program_name); |