source: src/builder.cpp@ fdd840

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 Candidate_v1.7.0 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since fdd840 was 68d781, checked in by Tillmann Crueger <crueger@…>, 16 years ago

Merge branch 'MenuRefactoring' into QT4Refactoring

Conflicts:

molecuilder/src/Makefile.am
molecuilder/src/defs.hpp

  • Property mode set to 100755
File size: 98.6 KB
RevLine 
[14de469]1/** \file builder.cpp
[a8bcea6]2 *
[14de469]3 * By stating absolute positions or binding angles and distances atomic positions of a molecule can be constructed.
4 * The output is the complete configuration file for PCP for direct use.
5 * Features:
6 * -# Atomic data is retrieved from a file, if not found requested and stored there for later re-use
7 * -# step-by-step construction of the molecule beginning either at a centre of with a certain atom
[a8bcea6]8 *
[14de469]9 */
10
11/*! \mainpage Molecuilder - a molecular set builder
[a8bcea6]12 *
[14de469]13 * This introductory shall briefly make aquainted with the program, helping in installing and a first run.
[a8bcea6]14 *
[14de469]15 * \section about About the Program
[a8bcea6]16 *
[042f82]17 * Molecuilder is a short program, written in C++, that enables the construction of a coordinate set for the
18 * atoms making up an molecule by the successive statement of binding angles and distances and referencing to
19 * already constructed atoms.
[a8bcea6]20 *
[042f82]21 * A configuration file may be written that is compatible to the format used by PCP - a parallel Car-Parrinello
22 * molecular dynamics implementation.
[a8bcea6]23 *
[14de469]24 * \section install Installation
[a8bcea6]25 *
[042f82]26 * Installation should without problems succeed as follows:
27 * -# ./configure (or: mkdir build;mkdir run;cd build; ../configure --bindir=../run)
28 * -# make
29 * -# make install
[a8bcea6]30 *
[042f82]31 * Further useful commands are
32 * -# make clean uninstall: deletes .o-files and removes executable from the given binary directory\n
33 * -# make doxygen-doc: Creates these html pages out of the documented source
[a8bcea6]34 *
[14de469]35 * \section run Running
[a8bcea6]36 *
[042f82]37 * The program can be executed by running: ./molecuilder
[a8bcea6]38 *
[042f82]39 * Note, that it uses a database, called "elements.db", in the executable's directory. If the file is not found,
40 * it is created and any given data on elements of the periodic table will be stored therein and re-used on
41 * later re-execution.
[a8bcea6]42 *
[14de469]43 * \section ref References
[a8bcea6]44 *
[042f82]45 * For the special configuration file format, see the documentation of pcp.
[a8bcea6]46 *
[14de469]47 */
48
49
[12b845]50#include <boost/bind.hpp>
51
[14de469]52using namespace std;
53
[49e1ae]54#include <cstring>
55
[db6bf74]56#include "analysis_correlation.hpp"
[f66195]57#include "atom.hpp"
58#include "bond.hpp"
[b70721]59#include "bondgraph.hpp"
[6ac7ee]60#include "boundary.hpp"
[f66195]61#include "config.hpp"
62#include "element.hpp"
[6ac7ee]63#include "ellipsoid.hpp"
[14de469]64#include "helpers.hpp"
[f66195]65#include "leastsquaremin.hpp"
66#include "linkedcell.hpp"
[e138de]67#include "log.hpp"
[aac3ef]68#include "memoryusageobserver.hpp"
[cee0b57]69#include "molecule.hpp"
[f66195]70#include "periodentafel.hpp"
[cc04b7]71#include "UIElements/UIFactory.hpp"
72#include "UIElements/MainWindow.hpp"
[45f5d6]73#include "UIElements/Dialog.hpp"
[12b845]74#include "Menu/ActionMenuItem.hpp"
75#include "Actions/ActionRegistry.hpp"
[d56640]76#include "Actions/ActionHistory.hpp"
[12b845]77#include "Actions/MethodAction.hpp"
[a6f180]78#include "Actions/small_actions.hpp"
[354859]79#include "World.hpp"
[a8eb4a]80#include "version.h"
[12b845]81
[1907a7]82/********************************************* Subsubmenu routine ************************************/
[1ca488f]83#if 0
[14de469]84/** Submenu for adding atoms to the molecule.
85 * \param *periode periodentafel
[1907a7]86 * \param *molecule molecules with atoms
[14de469]87 */
[7f3b9d]88static void AddAtoms(periodentafel *periode, molecule *mol)
[14de469]89{
[042f82]90 atom *first, *second, *third, *fourth;
91 Vector **atoms;
92 Vector x,y,z,n; // coordinates for absolute point in cell volume
93 double a,b,c;
94 char choice; // menu choice char
95 bool valid;
96
[e138de]97 Log() << Verbose(0) << "===========ADD ATOM============================" << endl;
98 Log() << Verbose(0) << " a - state absolute coordinates of atom" << endl;
99 Log() << Verbose(0) << " b - state relative coordinates of atom wrt to reference point" << endl;
100 Log() << Verbose(0) << " c - state relative coordinates of atom wrt to already placed atom" << endl;
101 Log() << Verbose(0) << " d - state two atoms, two angles and a distance" << endl;
102 Log() << Verbose(0) << " e - least square distance position to a set of atoms" << endl;
103 Log() << Verbose(0) << "all else - go back" << endl;
104 Log() << Verbose(0) << "===============================================" << endl;
105 Log() << Verbose(0) << "Note: Specifiy angles in degrees not multiples of Pi!" << endl;
106 Log() << Verbose(0) << "INPUT: ";
[042f82]107 cin >> choice;
108
109 switch (choice) {
[1907a7]110 default:
[717e0c]111 eLog() << Verbose(2) << "Not a valid choice." << endl;
[1907a7]112 break;
[042f82]113 case 'a': // absolute coordinates of atom
[e138de]114 Log() << Verbose(0) << "Enter absolute coordinates." << endl;
[1907a7]115 first = new atom;
116 first->x.AskPosition(mol->cell_size, false);
[042f82]117 first->type = periode->AskElement(); // give type
118 mol->AddAtom(first); // add to molecule
119 break;
[6ac7ee]120
[042f82]121 case 'b': // relative coordinates of atom wrt to reference point
[1907a7]122 first = new atom;
123 valid = true;
124 do {
[717e0c]125 if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
[e138de]126 Log() << Verbose(0) << "Enter reference coordinates." << endl;
[1907a7]127 x.AskPosition(mol->cell_size, true);
[e138de]128 Log() << Verbose(0) << "Enter relative coordinates." << endl;
[1907a7]129 first->x.AskPosition(mol->cell_size, false);
130 first->x.AddVector((const Vector *)&x);
[e138de]131 Log() << Verbose(0) << "\n";
[1907a7]132 } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
[042f82]133 first->type = periode->AskElement(); // give type
134 mol->AddAtom(first); // add to molecule
135 break;
[6ac7ee]136
[042f82]137 case 'c': // relative coordinates of atom wrt to already placed atom
[1907a7]138 first = new atom;
139 valid = true;
140 do {
[717e0c]141 if (!valid) eLog() << Verbose(2) << "Resulting position out of cell." << endl;
[1907a7]142 second = mol->AskAtom("Enter atom number: ");
[e138de]143 Log() << Verbose(0) << "Enter relative coordinates." << endl;
[1907a7]144 first->x.AskPosition(mol->cell_size, false);
145 for (int i=NDIM;i--;) {
146 first->x.x[i] += second->x.x[i];
147 }
148 } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
[042f82]149 first->type = periode->AskElement(); // give type
150 mol->AddAtom(first); // add to molecule
[1907a7]151 break;
152
153 case 'd': // two atoms, two angles and a distance
154 first = new atom;
155 valid = true;
156 do {
157 if (!valid) {
[717e0c]158 eLog() << Verbose(2) << "Resulting coordinates out of cell - " << first->x << endl;
[1907a7]159 }
[e138de]160 Log() << Verbose(0) << "First, we need two atoms, the first atom is the central, while the second is the outer one." << endl;
[1907a7]161 second = mol->AskAtom("Enter central atom: ");
162 third = mol->AskAtom("Enter second atom (specifying the axis for first angle): ");
163 fourth = mol->AskAtom("Enter third atom (specifying a plane for second angle): ");
164 a = ask_value("Enter distance between central (first) and new atom: ");
165 b = ask_value("Enter angle between new, first and second atom (degrees): ");
166 b *= M_PI/180.;
167 bound(&b, 0., 2.*M_PI);
168 c = ask_value("Enter second angle between new and normal vector of plane defined by first, second and third atom (degrees): ");
169 c *= M_PI/180.;
170 bound(&c, -M_PI, M_PI);
[e138de]171 Log() << Verbose(0) << "radius: " << a << "\t phi: " << b*180./M_PI << "\t theta: " << c*180./M_PI << endl;
[14de469]172/*
[1907a7]173 second->Output(1,1,(ofstream *)&cout);
174 third->Output(1,2,(ofstream *)&cout);
175 fourth->Output(1,3,(ofstream *)&cout);
176 n.MakeNormalvector((const vector *)&second->x, (const vector *)&third->x, (const vector *)&fourth->x);
177 x.Copyvector(&second->x);
178 x.SubtractVector(&third->x);
179 x.Copyvector(&fourth->x);
180 x.SubtractVector(&third->x);
181
182 if (!z.SolveSystem(&x,&y,&n, b, c, a)) {
[e138de]183 Log() << Verbose(0) << "Failure solving self-dependent linear system!" << endl;
[1907a7]184 continue;
185 }
[e138de]186 Log() << Verbose(0) << "resulting relative coordinates: ";
187 z.Output();
188 Log() << Verbose(0) << endl;
[1907a7]189 */
190 // calc axis vector
191 x.CopyVector(&second->x);
192 x.SubtractVector(&third->x);
193 x.Normalize();
[e138de]194 Log() << Verbose(0) << "x: ",
195 x.Output();
196 Log() << Verbose(0) << endl;
[1907a7]197 z.MakeNormalVector(&second->x,&third->x,&fourth->x);
[e138de]198 Log() << Verbose(0) << "z: ",
199 z.Output();
200 Log() << Verbose(0) << endl;
[1907a7]201 y.MakeNormalVector(&x,&z);
[e138de]202 Log() << Verbose(0) << "y: ",
203 y.Output();
204 Log() << Verbose(0) << endl;
[1907a7]205
206 // rotate vector around first angle
207 first->x.CopyVector(&x);
208 first->x.RotateVector(&z,b - M_PI);
[e138de]209 Log() << Verbose(0) << "Rotated vector: ",
210 first->x.Output();
211 Log() << Verbose(0) << endl;
[1907a7]212 // remove the projection onto the rotation plane of the second angle
213 n.CopyVector(&y);
[658efb]214 n.Scale(first->x.ScalarProduct(&y));
[e138de]215 Log() << Verbose(0) << "N1: ",
216 n.Output();
217 Log() << Verbose(0) << endl;
[1907a7]218 first->x.SubtractVector(&n);
[e138de]219 Log() << Verbose(0) << "Subtracted vector: ",
220 first->x.Output();
221 Log() << Verbose(0) << endl;
[1907a7]222 n.CopyVector(&z);
[658efb]223 n.Scale(first->x.ScalarProduct(&z));
[e138de]224 Log() << Verbose(0) << "N2: ",
225 n.Output();
226 Log() << Verbose(0) << endl;
[1907a7]227 first->x.SubtractVector(&n);
[e138de]228 Log() << Verbose(0) << "2nd subtracted vector: ",
229 first->x.Output();
230 Log() << Verbose(0) << endl;
[1907a7]231
232 // rotate another vector around second angle
233 n.CopyVector(&y);
234 n.RotateVector(&x,c - M_PI);
[e138de]235 Log() << Verbose(0) << "2nd Rotated vector: ",
236 n.Output();
237 Log() << Verbose(0) << endl;
[1907a7]238
239 // add the two linear independent vectors
240 first->x.AddVector(&n);
241 first->x.Normalize();
242 first->x.Scale(a);
243 first->x.AddVector(&second->x);
244
[e138de]245 Log() << Verbose(0) << "resulting coordinates: ";
246 first->x.Output();
247 Log() << Verbose(0) << endl;
[1907a7]248 } while (!(valid = mol->CheckBounds((const Vector *)&first->x)));
[042f82]249 first->type = periode->AskElement(); // give type
250 mol->AddAtom(first); // add to molecule
251 break;
[6ac7ee]252
[042f82]253 case 'e': // least square distance position to a set of atoms
[1907a7]254 first = new atom;
255 atoms = new (Vector*[128]);
256 valid = true;
257 for(int i=128;i--;)
258 atoms[i] = NULL;
259 int i=0, j=0;
[e138de]260 Log() << Verbose(0) << "Now we need at least three molecules.\n";
[1907a7]261 do {
[e138de]262 Log() << Verbose(0) << "Enter " << i+1 << "th atom: ";
[1907a7]263 cin >> j;
264 if (j != -1) {
265 second = mol->FindAtom(j);
266 atoms[i++] = &(second->x);
267 }
268 } while ((j != -1) && (i<128));
269 if (i >= 2) {
[776b64]270 first->x.LSQdistance((const Vector **)atoms, i);
[e138de]271 first->x.Output();
[042f82]272 first->type = periode->AskElement(); // give type
273 mol->AddAtom(first); // add to molecule
[1907a7]274 } else {
275 delete first;
[e138de]276 Log() << Verbose(0) << "Please enter at least two vectors!\n";
[1907a7]277 }
[042f82]278 break;
279 };
[14de469]280};
281
282/** Submenu for centering the atoms in the molecule.
[1907a7]283 * \param *mol molecule with all the atoms
[14de469]284 */
[7f3b9d]285static void CenterAtoms(molecule *mol)
[14de469]286{
[042f82]287 Vector x, y, helper;
288 char choice; // menu choice char
289
[e138de]290 Log() << Verbose(0) << "===========CENTER ATOMS=========================" << endl;
291 Log() << Verbose(0) << " a - on origin" << endl;
292 Log() << Verbose(0) << " b - on center of gravity" << endl;
293 Log() << Verbose(0) << " c - within box with additional boundary" << endl;
294 Log() << Verbose(0) << " d - within given simulation box" << endl;
295 Log() << Verbose(0) << "all else - go back" << endl;
296 Log() << Verbose(0) << "===============================================" << endl;
297 Log() << Verbose(0) << "INPUT: ";
[042f82]298 cin >> choice;
299
300 switch (choice) {
301 default:
[e138de]302 Log() << Verbose(0) << "Not a valid choice." << endl;
[042f82]303 break;
304 case 'a':
[e138de]305 Log() << Verbose(0) << "Centering atoms in config file on origin." << endl;
306 mol->CenterOrigin();
[042f82]307 break;
308 case 'b':
[e138de]309 Log() << Verbose(0) << "Centering atoms in config file on center of gravity." << endl;
310 mol->CenterPeriodic();
[042f82]311 break;
312 case 'c':
[e138de]313 Log() << Verbose(0) << "Centering atoms in config file within given additional boundary." << endl;
[042f82]314 for (int i=0;i<NDIM;i++) {
[e138de]315 Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
[042f82]316 cin >> y.x[i];
317 }
[e138de]318 mol->CenterEdge(&x); // make every coordinate positive
[437922]319 mol->Center.AddVector(&y); // translate by boundary
[042f82]320 helper.CopyVector(&y);
321 helper.Scale(2.);
322 helper.AddVector(&x);
323 mol->SetBoxDimension(&helper); // update Box of atoms by boundary
324 break;
325 case 'd':
[e138de]326 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
[042f82]327 for (int i=0;i<NDIM;i++) {
[e138de]328 Log() << Verbose(0) << "Enter axis " << i << " boundary: ";
[042f82]329 cin >> x.x[i];
330 }
331 // update Box of atoms by boundary
332 mol->SetBoxDimension(&x);
[36ec71]333 // center
[e138de]334 mol->CenterInBox();
[042f82]335 break;
336 }
[14de469]337};
338
339/** Submenu for aligning the atoms in the molecule.
340 * \param *periode periodentafel
[1907a7]341 * \param *mol molecule with all the atoms
[14de469]342 */
[7f3b9d]343static void AlignAtoms(periodentafel *periode, molecule *mol)
[14de469]344{
[042f82]345 atom *first, *second, *third;
346 Vector x,n;
347 char choice; // menu choice char
348
[e138de]349 Log() << Verbose(0) << "===========ALIGN ATOMS=========================" << endl;
350 Log() << Verbose(0) << " a - state three atoms defining align plane" << endl;
351 Log() << Verbose(0) << " b - state alignment vector" << endl;
352 Log() << Verbose(0) << " c - state two atoms in alignment direction" << endl;
353 Log() << Verbose(0) << " d - align automatically by least square fit" << endl;
354 Log() << Verbose(0) << "all else - go back" << endl;
355 Log() << Verbose(0) << "===============================================" << endl;
356 Log() << Verbose(0) << "INPUT: ";
[042f82]357 cin >> choice;
358
359 switch (choice) {
360 default:
361 case 'a': // three atoms defining mirror plane
362 first = mol->AskAtom("Enter first atom: ");
363 second = mol->AskAtom("Enter second atom: ");
364 third = mol->AskAtom("Enter third atom: ");
365
366 n.MakeNormalVector((const Vector *)&first->x,(const Vector *)&second->x,(const Vector *)&third->x);
367 break;
368 case 'b': // normal vector of mirror plane
[e138de]369 Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;
[042f82]370 n.AskPosition(mol->cell_size,0);
371 n.Normalize();
372 break;
373 case 'c': // three atoms defining mirror plane
374 first = mol->AskAtom("Enter first atom: ");
375 second = mol->AskAtom("Enter second atom: ");
376
377 n.CopyVector((const Vector *)&first->x);
378 n.SubtractVector((const Vector *)&second->x);
379 n.Normalize();
380 break;
381 case 'd':
382 char shorthand[4];
383 Vector a;
384 struct lsq_params param;
385 do {
386 fprintf(stdout, "Enter the element of atoms to be chosen: ");
387 fscanf(stdin, "%3s", shorthand);
388 } while ((param.type = periode->FindElement(shorthand)) == NULL);
[e138de]389 Log() << Verbose(0) << "Element is " << param.type->name << endl;
[042f82]390 mol->GetAlignvector(&param);
391 for (int i=NDIM;i--;) {
392 x.x[i] = gsl_vector_get(param.x,i);
393 n.x[i] = gsl_vector_get(param.x,i+NDIM);
394 }
395 gsl_vector_free(param.x);
[e138de]396 Log() << Verbose(0) << "Offset vector: ";
397 x.Output();
398 Log() << Verbose(0) << endl;
[042f82]399 n.Normalize();
400 break;
401 };
[e138de]402 Log() << Verbose(0) << "Alignment vector: ";
403 n.Output();
404 Log() << Verbose(0) << endl;
[042f82]405 mol->Align(&n);
[14de469]406};
407
408/** Submenu for mirroring the atoms in the molecule.
[1907a7]409 * \param *mol molecule with all the atoms
[14de469]410 */
[7f3b9d]411static void MirrorAtoms(molecule *mol)
[14de469]412{
[042f82]413 atom *first, *second, *third;
414 Vector n;
415 char choice; // menu choice char
416
[e138de]417 Log() << Verbose(0) << "===========MIRROR ATOMS=========================" << endl;
418 Log() << Verbose(0) << " a - state three atoms defining mirror plane" << endl;
419 Log() << Verbose(0) << " b - state normal vector of mirror plane" << endl;
420 Log() << Verbose(0) << " c - state two atoms in normal direction" << endl;
421 Log() << Verbose(0) << "all else - go back" << endl;
422 Log() << Verbose(0) << "===============================================" << endl;
423 Log() << Verbose(0) << "INPUT: ";
[042f82]424 cin >> choice;
425
426 switch (choice) {
427 default:
428 case 'a': // three atoms defining mirror plane
429 first = mol->AskAtom("Enter first atom: ");
430 second = mol->AskAtom("Enter second atom: ");
431 third = mol->AskAtom("Enter third atom: ");
432
433 n.MakeNormalVector((const Vector *)&first->x,(const Vector *)&second->x,(const Vector *)&third->x);
434 break;
435 case 'b': // normal vector of mirror plane
[e138de]436 Log() << Verbose(0) << "Enter normal vector of mirror plane." << endl;
[042f82]437 n.AskPosition(mol->cell_size,0);
438 n.Normalize();
439 break;
440 case 'c': // three atoms defining mirror plane
441 first = mol->AskAtom("Enter first atom: ");
442 second = mol->AskAtom("Enter second atom: ");
443
444 n.CopyVector((const Vector *)&first->x);
445 n.SubtractVector((const Vector *)&second->x);
446 n.Normalize();
447 break;
448 };
[e138de]449 Log() << Verbose(0) << "Normal vector: ";
450 n.Output();
451 Log() << Verbose(0) << endl;
[042f82]452 mol->Mirror((const Vector *)&n);
[14de469]453};
[b8d1aeb]454>>>>>>> MenuRefactoring:molecuilder/src/builder.cpp
[14de469]455
456/** Submenu for removing the atoms from the molecule.
[1907a7]457 * \param *mol molecule with all the atoms
[14de469]458 */
[7f3b9d]459static void RemoveAtoms(molecule *mol)
[14de469]460{
[042f82]461 atom *first, *second;
462 int axis;
463 double tmp1, tmp2;
464 char choice; // menu choice char
465
[e138de]466 Log() << Verbose(0) << "===========REMOVE ATOMS=========================" << endl;
467 Log() << Verbose(0) << " a - state atom for removal by number" << endl;
468 Log() << Verbose(0) << " b - keep only in radius around atom" << endl;
469 Log() << Verbose(0) << " c - remove this with one axis greater value" << endl;
470 Log() << Verbose(0) << "all else - go back" << endl;
471 Log() << Verbose(0) << "===============================================" << endl;
472 Log() << Verbose(0) << "INPUT: ";
[042f82]473 cin >> choice;
474
475 switch (choice) {
476 default:
477 case 'a':
478 if (mol->RemoveAtom(mol->AskAtom("Enter number of atom within molecule: ")))
[e138de]479 Log() << Verbose(1) << "Atom removed." << endl;
[042f82]480 else
[e138de]481 Log() << Verbose(1) << "Atom not found." << endl;
[042f82]482 break;
483 case 'b':
484 second = mol->AskAtom("Enter number of atom as reference point: ");
[e138de]485 Log() << Verbose(0) << "Enter radius: ";
[042f82]486 cin >> tmp1;
487 first = mol->start;
[c54da3]488 second = first->next;
[375b458]489 while(second != mol->end) {
490 first = second;
[c54da3]491 second = first->next;
[042f82]492 if (first->x.DistanceSquared((const Vector *)&second->x) > tmp1*tmp1) // distance to first above radius ...
493 mol->RemoveAtom(first);
494 }
495 break;
496 case 'c':
[e138de]497 Log() << Verbose(0) << "Which axis is it: ";
[042f82]498 cin >> axis;
[e138de]499 Log() << Verbose(0) << "Lower boundary: ";
[042f82]500 cin >> tmp1;
[e138de]501 Log() << Verbose(0) << "Upper boundary: ";
[042f82]502 cin >> tmp2;
503 first = mol->start;
[a5b2c3a]504 second = first->next;
505 while(second != mol->end) {
506 first = second;
507 second = first->next;
[375b458]508 if ((first->x.x[axis] < tmp1) || (first->x.x[axis] > tmp2)) {// out of boundary ...
[e138de]509 //Log() << Verbose(0) << "Atom " << *first << " with " << first->x.x[axis] << " on axis " << axis << " is out of bounds [" << tmp1 << "," << tmp2 << "]." << endl;
[042f82]510 mol->RemoveAtom(first);
[375b458]511 }
[042f82]512 }
513 break;
514 };
[e138de]515 //mol->Output();
[042f82]516 choice = 'r';
[14de469]517};
518
519/** Submenu for measuring out the atoms in the molecule.
520 * \param *periode periodentafel
[1907a7]521 * \param *mol molecule with all the atoms
[14de469]522 */
[d52ea1b]523static void MeasureAtoms(periodentafel *periode, molecule *mol, config *configuration)
[14de469]524{
[042f82]525 atom *first, *second, *third;
526 Vector x,y;
527 double min[256], tmp1, tmp2, tmp3;
528 int Z;
529 char choice; // menu choice char
530
[e138de]531 Log() << Verbose(0) << "===========MEASURE ATOMS=========================" << endl;
532 Log() << Verbose(0) << " a - calculate bond length between one atom and all others" << endl;
533 Log() << Verbose(0) << " b - calculate bond length between two atoms" << endl;
534 Log() << Verbose(0) << " c - calculate bond angle" << endl;
535 Log() << Verbose(0) << " d - calculate principal axis of the system" << endl;
536 Log() << Verbose(0) << " e - calculate volume of the convex envelope" << endl;
537 Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl;
538 Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl;
539 Log() << Verbose(0) << "all else - go back" << endl;
540 Log() << Verbose(0) << "===============================================" << endl;
541 Log() << Verbose(0) << "INPUT: ";
[042f82]542 cin >> choice;
543
544 switch(choice) {
545 default:
[e138de]546 Log() << Verbose(1) << "Not a valid choice." << endl;
[042f82]547 break;
548 case 'a':
549 first = mol->AskAtom("Enter first atom: ");
550 for (int i=MAX_ELEMENTS;i--;)
551 min[i] = 0.;
552
553 second = mol->start;
554 while ((second->next != mol->end)) {
555 second = second->next; // advance
556 Z = second->type->Z;
557 tmp1 = 0.;
558 if (first != second) {
559 x.CopyVector((const Vector *)&first->x);
560 x.SubtractVector((const Vector *)&second->x);
561 tmp1 = x.Norm();
562 }
563 if ((tmp1 != 0.) && ((min[Z] == 0.) || (tmp1 < min[Z]))) min[Z] = tmp1;
[e138de]564 //Log() << Verbose(0) << "Bond length between Atom " << first->nr << " and " << second->nr << ": " << tmp1 << " a.u." << endl;
[042f82]565 }
566 for (int i=MAX_ELEMENTS;i--;)
[e138de]567 if (min[i] != 0.) Log() << Verbose(0) << "Minimum Bond length between " << first->type->name << " Atom " << first->nr << " and next Ion of type " << (periode->FindElement(i))->name << ": " << min[i] << " a.u." << endl;
[042f82]568 break;
569
570 case 'b':
571 first = mol->AskAtom("Enter first atom: ");
572 second = mol->AskAtom("Enter second atom: ");
573 for (int i=NDIM;i--;)
574 min[i] = 0.;
575 x.CopyVector((const Vector *)&first->x);
576 x.SubtractVector((const Vector *)&second->x);
577 tmp1 = x.Norm();
[e138de]578 Log() << Verbose(1) << "Distance vector is ";
579 x.Output();
580 Log() << Verbose(0) << "." << endl << "Norm of distance is " << tmp1 << "." << endl;
[042f82]581 break;
582
583 case 'c':
[e138de]584 Log() << Verbose(0) << "Evaluating bond angle between three - first, central, last - atoms." << endl;
[042f82]585 first = mol->AskAtom("Enter first atom: ");
586 second = mol->AskAtom("Enter central atom: ");
587 third = mol->AskAtom("Enter last atom: ");
588 tmp1 = tmp2 = tmp3 = 0.;
589 x.CopyVector((const Vector *)&first->x);
590 x.SubtractVector((const Vector *)&second->x);
591 y.CopyVector((const Vector *)&third->x);
592 y.SubtractVector((const Vector *)&second->x);
[e138de]593 Log() << Verbose(0) << "Bond angle between first atom Nr." << first->nr << ", central atom Nr." << second->nr << " and last atom Nr." << third->nr << ": ";
594 Log() << Verbose(0) << (acos(x.ScalarProduct((const Vector *)&y)/(y.Norm()*x.Norm()))/M_PI*180.) << " degrees" << endl;
[042f82]595 break;
596 case 'd':
[e138de]597 Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;
598 Log() << Verbose(0) << "Shall we rotate? [0/1]: ";
[042f82]599 cin >> Z;
600 if ((Z >=0) && (Z <=1))
[e138de]601 mol->PrincipalAxisSystem((bool)Z);
[042f82]602 else
[e138de]603 mol->PrincipalAxisSystem(false);
[042f82]604 break;
605 case 'e':
[d30402]606 {
[e138de]607 Log() << Verbose(0) << "Evaluating volume of the convex envelope.";
[d30402]608 class Tesselation *TesselStruct = NULL;
[776b64]609 const LinkedCell *LCList = NULL;
610 LCList = new LinkedCell(mol, 10.);
[e138de]611 FindConvexBorder(mol, TesselStruct, LCList, NULL);
612 double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration);
613 Log() << Verbose(0) << "The tesselated surface area is " << clustervolume << "." << endl;\
[776b64]614 delete(LCList);
[d30402]615 delete(TesselStruct);
616 }
[042f82]617 break;
618 case 'f':
[e138de]619 mol->OutputTemperatureFromTrajectories((ofstream *)&cout, mol->MDSteps-1, mol->MDSteps);
[042f82]620 break;
621 case 'g':
622 {
623 char filename[255];
[e138de]624 Log() << Verbose(0) << "Please enter filename: " << endl;
[042f82]625 cin >> filename;
[e138de]626 Log() << Verbose(1) << "Storing temperatures in " << filename << "." << endl;
[042f82]627 ofstream *output = new ofstream(filename, ios::trunc);
[e138de]628 if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps))
629 Log() << Verbose(2) << "File could not be written." << endl;
[042f82]630 else
[e138de]631 Log() << Verbose(2) << "File stored." << endl;
[042f82]632 output->close();
633 delete(output);
634 }
635 break;
636 }
[14de469]637};
638
639/** Submenu for measuring out the atoms in the molecule.
[1907a7]640 * \param *mol molecule with all the atoms
[14de469]641 * \param *configuration configuration structure for the to be written config files of all fragments
642 */
[7f3b9d]643static void FragmentAtoms(molecule *mol, config *configuration)
[14de469]644{
[042f82]645 int Order1;
646 clock_t start, end;
647
[e138de]648 Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
649 Log() << Verbose(0) << "What's the desired bond order: ";
[042f82]650 cin >> Order1;
651 if (mol->first->next != mol->last) { // there are bonds
652 start = clock();
[e138de]653 mol->FragmentMolecule(Order1, configuration);
[042f82]654 end = clock();
[e138de]655 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
[042f82]656 } else
[e138de]657 Log() << Verbose(0) << "Connection matrix has not yet been generated!" << endl;
[14de469]658};
659
[1907a7]660/********************************************** Submenu routine **************************************/
661
662/** Submenu for manipulating atoms.
663 * \param *periode periodentafel
664 * \param *molecules list of molecules whose atoms are to be manipulated
665 */
666static void ManipulateAtoms(periodentafel *periode, MoleculeListClass *molecules, config *configuration)
667{
[4777e9]668 atom *first, *second;
[1907a7]669 molecule *mol = NULL;
670 Vector x,y,z,n; // coordinates for absolute point in cell volume
671 double *factor; // unit factor if desired
[f1cccd]672 double bond, minBond;
[1907a7]673 char choice; // menu choice char
674 bool valid;
675
[e138de]676 Log() << Verbose(0) << "=========MANIPULATE ATOMS======================" << endl;
677 Log() << Verbose(0) << "a - add an atom" << endl;
678 Log() << Verbose(0) << "r - remove an atom" << endl;
679 Log() << Verbose(0) << "b - scale a bond between atoms" << endl;
680 Log() << Verbose(0) << "u - change an atoms element" << endl;
681 Log() << Verbose(0) << "l - measure lengths, angles, ... for an atom" << endl;
682 Log() << Verbose(0) << "all else - go back" << endl;
683 Log() << Verbose(0) << "===============================================" << endl;
[63f06e]684 if (molecules->NumberOfActiveMolecules() > 1)
[717e0c]685 eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
[e138de]686 Log() << Verbose(0) << "INPUT: ";
[1907a7]687 cin >> choice;
688
689 switch (choice) {
690 default:
[e138de]691 Log() << Verbose(0) << "Not a valid choice." << endl;
[1907a7]692 break;
693
694 case 'a': // add atom
[63f06e]695 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
696 if ((*ListRunner)->ActiveFlag) {
[1907a7]697 mol = *ListRunner;
[e138de]698 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
[1907a7]699 AddAtoms(periode, mol);
700 }
701 break;
702
703 case 'b': // scale a bond
[63f06e]704 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
705 if ((*ListRunner)->ActiveFlag) {
[1907a7]706 mol = *ListRunner;
[e138de]707 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
708 Log() << Verbose(0) << "Scaling bond length between two atoms." << endl;
[1907a7]709 first = mol->AskAtom("Enter first (fixed) atom: ");
710 second = mol->AskAtom("Enter second (shifting) atom: ");
[f1cccd]711 minBond = 0.;
[1907a7]712 for (int i=NDIM;i--;)
[f1cccd]713 minBond += (first->x.x[i]-second->x.x[i])*(first->x.x[i] - second->x.x[i]);
714 minBond = sqrt(minBond);
[e138de]715 Log() << Verbose(0) << "Current Bond length between " << first->type->name << " Atom " << first->nr << " and " << second->type->name << " Atom " << second->nr << ": " << minBond << " a.u." << endl;
716 Log() << Verbose(0) << "Enter new bond length [a.u.]: ";
[1907a7]717 cin >> bond;
718 for (int i=NDIM;i--;) {
[f1cccd]719 second->x.x[i] -= (second->x.x[i]-first->x.x[i])/minBond*(minBond-bond);
[1907a7]720 }
[e138de]721 //Log() << Verbose(0) << "New coordinates of Atom " << second->nr << " are: ";
722 //second->Output(second->type->No, 1);
[1907a7]723 }
724 break;
725
726 case 'c': // unit scaling of the metric
[63f06e]727 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
728 if ((*ListRunner)->ActiveFlag) {
[1907a7]729 mol = *ListRunner;
[e138de]730 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
731 Log() << Verbose(0) << "Angstroem -> Bohrradius: 1.8897261\t\tBohrradius -> Angstroem: 0.52917721" << endl;
732 Log() << Verbose(0) << "Enter three factors: ";
[1907a7]733 factor = new double[NDIM];
734 cin >> factor[0];
735 cin >> factor[1];
736 cin >> factor[2];
737 valid = true;
[776b64]738 mol->Scale((const double ** const)&factor);
[1907a7]739 delete[](factor);
740 }
741 break;
742
743 case 'l': // measure distances or angles
[63f06e]744 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
745 if ((*ListRunner)->ActiveFlag) {
[1907a7]746 mol = *ListRunner;
[e138de]747 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
[1907a7]748 MeasureAtoms(periode, mol, configuration);
749 }
750 break;
751
752 case 'r': // remove atom
[63f06e]753 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
754 if ((*ListRunner)->ActiveFlag) {
[1907a7]755 mol = *ListRunner;
[e138de]756 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
[1907a7]757 RemoveAtoms(mol);
758 }
759 break;
760
761 case 'u': // change an atom's element
[63f06e]762 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
763 if ((*ListRunner)->ActiveFlag) {
[1907a7]764 int Z;
765 mol = *ListRunner;
[e138de]766 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
[1907a7]767 first = NULL;
768 do {
[e138de]769 Log() << Verbose(0) << "Change the element of which atom: ";
[1907a7]770 cin >> Z;
771 } while ((first = mol->FindAtom(Z)) == NULL);
[e138de]772 Log() << Verbose(0) << "New element by atomic number Z: ";
[1907a7]773 cin >> Z;
774 first->type = periode->FindElement(Z);
[e138de]775 Log() << Verbose(0) << "Atom " << first->nr << "'s element is " << first->type->name << "." << endl;
[1907a7]776 }
777 break;
778 }
779};
[12b845]780
[1907a7]781/** Submenu for manipulating molecules.
782 * \param *periode periodentafel
783 * \param *molecules list of molecule to manipulate
784 */
785static void ManipulateMolecules(periodentafel *periode, MoleculeListClass *molecules, config *configuration)
786{
[4777e9]787 atom *first = NULL;
[1907a7]788 Vector x,y,z,n; // coordinates for absolute point in cell volume
789 int j, axis, count, faktor;
790 char choice; // menu choice char
791 molecule *mol = NULL;
792 element **Elements;
793 Vector **vectors;
794 MoleculeLeafClass *Subgraphs = NULL;
795
[e138de]796 Log() << Verbose(0) << "=========MANIPULATE GLOBALLY===================" << endl;
797 Log() << Verbose(0) << "c - scale by unit transformation" << endl;
798 Log() << Verbose(0) << "d - duplicate molecule/periodic cell" << endl;
799 Log() << Verbose(0) << "f - fragment molecule many-body bond order style" << endl;
800 Log() << Verbose(0) << "g - center atoms in box" << endl;
801 Log() << Verbose(0) << "i - realign molecule" << endl;
802 Log() << Verbose(0) << "m - mirror all molecules" << endl;
803 Log() << Verbose(0) << "o - create connection matrix" << endl;
804 Log() << Verbose(0) << "t - translate molecule by vector" << endl;
805 Log() << Verbose(0) << "all else - go back" << endl;
806 Log() << Verbose(0) << "===============================================" << endl;
[63f06e]807 if (molecules->NumberOfActiveMolecules() > 1)
[717e0c]808 eLog() << Verbose(2) << "There is more than one molecule active! Atoms will be added to each." << endl;
[e138de]809 Log() << Verbose(0) << "INPUT: ";
[1907a7]810 cin >> choice;
811
812 switch (choice) {
813 default:
[e138de]814 Log() << Verbose(0) << "Not a valid choice." << endl;
[1907a7]815 break;
816
817 case 'd': // duplicate the periodic cell along a given axis, given times
[63f06e]818 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
819 if ((*ListRunner)->ActiveFlag) {
[1907a7]820 mol = *ListRunner;
[e138de]821 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
822 Log() << Verbose(0) << "State the axis [(+-)123]: ";
[1907a7]823 cin >> axis;
[e138de]824 Log() << Verbose(0) << "State the factor: ";
[1907a7]825 cin >> faktor;
826
[e138de]827 mol->CountAtoms(); // recount atoms
[1907a7]828 if (mol->AtomCount != 0) { // if there is more than none
829 count = mol->AtomCount; // is changed becausing of adding, thus has to be stored away beforehand
830 Elements = new element *[count];
831 vectors = new Vector *[count];
832 j = 0;
833 first = mol->start;
834 while (first->next != mol->end) { // make a list of all atoms with coordinates and element
835 first = first->next;
836 Elements[j] = first->type;
837 vectors[j] = &first->x;
838 j++;
839 }
840 if (count != j)
[717e0c]841 eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
[1907a7]842 x.Zero();
843 y.Zero();
844 y.x[abs(axis)-1] = mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
845 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times
846 x.AddVector(&y); // per factor one cell width further
847 for (int k=count;k--;) { // go through every atom of the original cell
848 first = new atom(); // create a new body
849 first->x.CopyVector(vectors[k]); // use coordinate of original atom
850 first->x.AddVector(&x); // translate the coordinates
851 first->type = Elements[k]; // insert original element
852 mol->AddAtom(first); // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
853 }
854 }
855 if (mol->first->next != mol->last) // if connect matrix is present already, redo it
[e138de]856 mol->CreateAdjacencyList(mol->BondDistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
[1907a7]857 // free memory
858 delete[](Elements);
859 delete[](vectors);
860 // correct cell size
861 if (axis < 0) { // if sign was negative, we have to translate everything
862 x.Zero();
863 x.AddVector(&y);
864 x.Scale(-(faktor-1));
865 mol->Translate(&x);
866 }
867 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
868 }
869 }
870 break;
871
872 case 'f':
873 FragmentAtoms(mol, configuration);
874 break;
875
876 case 'g': // center the atoms
[63f06e]877 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
878 if ((*ListRunner)->ActiveFlag) {
[1907a7]879 mol = *ListRunner;
[e138de]880 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
[1907a7]881 CenterAtoms(mol);
882 }
883 break;
884
885 case 'i': // align all atoms
[63f06e]886 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
887 if ((*ListRunner)->ActiveFlag) {
[1907a7]888 mol = *ListRunner;
[e138de]889 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
[1907a7]890 AlignAtoms(periode, mol);
891 }
892 break;
893
894 case 'm': // mirror atoms along a given axis
[63f06e]895 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
896 if ((*ListRunner)->ActiveFlag) {
[1907a7]897 mol = *ListRunner;
[e138de]898 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
[1907a7]899 MirrorAtoms(mol);
900 }
901 break;
902
903 case 'o': // create the connection matrix
[63f06e]904 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
905 if ((*ListRunner)->ActiveFlag) {
[b6d8a9]906 mol = *ListRunner;
907 double bonddistance;
908 clock_t start,end;
[e138de]909 Log() << Verbose(0) << "What's the maximum bond distance: ";
[b6d8a9]910 cin >> bonddistance;
911 start = clock();
[e138de]912 mol->CreateAdjacencyList(bonddistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
[b6d8a9]913 end = clock();
[e138de]914 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
[b6d8a9]915 }
[1907a7]916 break;
917
918 case 't': // translate all atoms
[63f06e]919 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
920 if ((*ListRunner)->ActiveFlag) {
[1907a7]921 mol = *ListRunner;
[e138de]922 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl;
923 Log() << Verbose(0) << "Enter translation vector." << endl;
[1907a7]924 x.AskPosition(mol->cell_size,0);
[63f06e]925 mol->Center.AddVector((const Vector *)&x);
[1907a7]926 }
927 break;
928 }
929 // Free all
930 if (Subgraphs != NULL) { // free disconnected subgraph list of DFS analysis was performed
931 while (Subgraphs->next != NULL) {
932 Subgraphs = Subgraphs->next;
933 delete(Subgraphs->previous);
934 }
935 delete(Subgraphs);
936 }
937};
938
939
940/** Submenu for creating new molecules.
941 * \param *periode periodentafel
942 * \param *molecules list of molecules to add to
943 */
944static void EditMolecules(periodentafel *periode, MoleculeListClass *molecules)
945{
946 char choice; // menu choice char
[63f06e]947 Vector center;
[1907a7]948 int nr, count;
949 molecule *mol = NULL;
950
[e138de]951 Log() << Verbose(0) << "==========EDIT MOLECULES=====================" << endl;
952 Log() << Verbose(0) << "c - create new molecule" << endl;
953 Log() << Verbose(0) << "l - load molecule from xyz file" << endl;
954 Log() << Verbose(0) << "n - change molecule's name" << endl;
955 Log() << Verbose(0) << "N - give molecules filename" << endl;
956 Log() << Verbose(0) << "p - parse atoms in xyz file into molecule" << endl;
957 Log() << Verbose(0) << "r - remove a molecule" << endl;
958 Log() << Verbose(0) << "all else - go back" << endl;
959 Log() << Verbose(0) << "===============================================" << endl;
960 Log() << Verbose(0) << "INPUT: ";
[1907a7]961 cin >> choice;
962
963 switch (choice) {
964 default:
[e138de]965 Log() << Verbose(0) << "Not a valid choice." << endl;
[1907a7]966 break;
967 case 'c':
968 mol = new molecule(periode);
969 molecules->insert(mol);
970 break;
971
[63f06e]972 case 'l': // load from XYZ file
973 {
974 char filename[MAXSTRINGSIZE];
[e138de]975 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
[63f06e]976 mol = new molecule(periode);
977 do {
[e138de]978 Log() << Verbose(0) << "Enter file name: ";
[63f06e]979 cin >> filename;
980 } while (!mol->AddXYZFile(filename));
981 mol->SetNameFromFilename(filename);
982 // center at set box dimensions
[e138de]983 mol->CenterEdge(&center);
[63f06e]984 mol->cell_size[0] = center.x[0];
985 mol->cell_size[1] = 0;
986 mol->cell_size[2] = center.x[1];
987 mol->cell_size[3] = 0;
988 mol->cell_size[4] = 0;
989 mol->cell_size[5] = center.x[2];
990 molecules->insert(mol);
991 }
[1907a7]992 break;
993
994 case 'n':
[63f06e]995 {
996 char filename[MAXSTRINGSIZE];
997 do {
[e138de]998 Log() << Verbose(0) << "Enter index of molecule: ";
[63f06e]999 cin >> nr;
1000 mol = molecules->ReturnIndex(nr);
1001 } while (mol == NULL);
[e138de]1002 Log() << Verbose(0) << "Enter name: ";
[63f06e]1003 cin >> filename;
1004 strcpy(mol->name, filename);
1005 }
[1907a7]1006 break;
1007
1008 case 'N':
[63f06e]1009 {
1010 char filename[MAXSTRINGSIZE];
1011 do {
[e138de]1012 Log() << Verbose(0) << "Enter index of molecule: ";
[63f06e]1013 cin >> nr;
1014 mol = molecules->ReturnIndex(nr);
1015 } while (mol == NULL);
[e138de]1016 Log() << Verbose(0) << "Enter name: ";
[63f06e]1017 cin >> filename;
1018 mol->SetNameFromFilename(filename);
1019 }
[1907a7]1020 break;
1021
1022 case 'p': // parse XYZ file
[63f06e]1023 {
1024 char filename[MAXSTRINGSIZE];
1025 mol = NULL;
1026 do {
[e138de]1027 Log() << Verbose(0) << "Enter index of molecule: ";
[63f06e]1028 cin >> nr;
1029 mol = molecules->ReturnIndex(nr);
1030 } while (mol == NULL);
[e138de]1031 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl;
[63f06e]1032 do {
[e138de]1033 Log() << Verbose(0) << "Enter file name: ";
[63f06e]1034 cin >> filename;
1035 } while (!mol->AddXYZFile(filename));
1036 mol->SetNameFromFilename(filename);
1037 }
[1907a7]1038 break;
1039
1040 case 'r':
[e138de]1041 Log() << Verbose(0) << "Enter index of molecule: ";
[1907a7]1042 cin >> nr;
1043 count = 1;
[f7f7a4]1044 for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
[63f06e]1045 if (nr == (*ListRunner)->IndexNr) {
1046 mol = *ListRunner;
1047 molecules->ListOfMolecules.erase(ListRunner);
1048 delete(mol);
[f7f7a4]1049 break;
[63f06e]1050 }
[1907a7]1051 break;
1052 }
1053};
1054
1055
1056/** Submenu for merging molecules.
1057 * \param *periode periodentafel
1058 * \param *molecules list of molecules to add to
1059 */
1060static void MergeMolecules(periodentafel *periode, MoleculeListClass *molecules)
1061{
1062 char choice; // menu choice char
1063
[e138de]1064 Log() << Verbose(0) << "===========MERGE MOLECULES=====================" << endl;
1065 Log() << Verbose(0) << "a - simple add of one molecule to another" << endl;
1066 Log() << Verbose(0) << "e - embedding merge of two molecules" << endl;
1067 Log() << Verbose(0) << "m - multi-merge of all molecules" << endl;
1068 Log() << Verbose(0) << "s - scatter merge of two molecules" << endl;
1069 Log() << Verbose(0) << "t - simple merge of two molecules" << endl;
1070 Log() << Verbose(0) << "all else - go back" << endl;
1071 Log() << Verbose(0) << "===============================================" << endl;
1072 Log() << Verbose(0) << "INPUT: ";
[1907a7]1073 cin >> choice;
1074
1075 switch (choice) {
1076 default:
[e138de]1077 Log() << Verbose(0) << "Not a valid choice." << endl;
[1907a7]1078 break;
1079
[63f06e]1080 case 'a':
1081 {
1082 int src, dest;
1083 molecule *srcmol = NULL, *destmol = NULL;
1084 {
1085 do {
[e138de]1086 Log() << Verbose(0) << "Enter index of destination molecule: ";
[63f06e]1087 cin >> dest;
1088 destmol = molecules->ReturnIndex(dest);
1089 } while ((destmol == NULL) && (dest != -1));
1090 do {
[e138de]1091 Log() << Verbose(0) << "Enter index of source molecule to add from: ";
[63f06e]1092 cin >> src;
1093 srcmol = molecules->ReturnIndex(src);
1094 } while ((srcmol == NULL) && (src != -1));
1095 if ((src != -1) && (dest != -1))
1096 molecules->SimpleAdd(srcmol, destmol);
1097 }
1098 }
1099 break;
1100
[1907a7]1101 case 'e':
[f7f7a4]1102 {
1103 int src, dest;
1104 molecule *srcmol = NULL, *destmol = NULL;
1105 do {
[e138de]1106 Log() << Verbose(0) << "Enter index of matrix molecule (the variable one): ";
[f7f7a4]1107 cin >> src;
1108 srcmol = molecules->ReturnIndex(src);
1109 } while ((srcmol == NULL) && (src != -1));
1110 do {
[e138de]1111 Log() << Verbose(0) << "Enter index of molecule to merge into (the fixed one): ";
[f7f7a4]1112 cin >> dest;
1113 destmol = molecules->ReturnIndex(dest);
1114 } while ((destmol == NULL) && (dest != -1));
1115 if ((src != -1) && (dest != -1))
1116 molecules->EmbedMerge(destmol, srcmol);
1117 }
[1907a7]1118 break;
1119
1120 case 'm':
[63f06e]1121 {
1122 int nr;
1123 molecule *mol = NULL;
1124 do {
[e138de]1125 Log() << Verbose(0) << "Enter index of molecule to merge into: ";
[63f06e]1126 cin >> nr;
1127 mol = molecules->ReturnIndex(nr);
1128 } while ((mol == NULL) && (nr != -1));
1129 if (nr != -1) {
1130 int N = molecules->ListOfMolecules.size()-1;
1131 int *src = new int(N);
1132 for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
1133 if ((*ListRunner)->IndexNr != nr)
1134 src[N++] = (*ListRunner)->IndexNr;
1135 molecules->SimpleMultiMerge(mol, src, N);
1136 delete[](src);
1137 }
1138 }
[1907a7]1139 break;
1140
1141 case 's':
[e138de]1142 Log() << Verbose(0) << "Not implemented yet." << endl;
[1907a7]1143 break;
1144
1145 case 't':
[63f06e]1146 {
1147 int src, dest;
1148 molecule *srcmol = NULL, *destmol = NULL;
1149 {
1150 do {
[e138de]1151 Log() << Verbose(0) << "Enter index of destination molecule: ";
[63f06e]1152 cin >> dest;
1153 destmol = molecules->ReturnIndex(dest);
1154 } while ((destmol == NULL) && (dest != -1));
1155 do {
[e138de]1156 Log() << Verbose(0) << "Enter index of source molecule to merge into: ";
[63f06e]1157 cin >> src;
1158 srcmol = molecules->ReturnIndex(src);
1159 } while ((srcmol == NULL) && (src != -1));
1160 if ((src != -1) && (dest != -1))
1161 molecules->SimpleMerge(srcmol, destmol);
1162 }
1163 }
[1907a7]1164 break;
1165 }
1166};
1167
[14de469]1168/********************************************** Test routine **************************************/
1169
1170/** Is called always as option 'T' in the menu.
[1907a7]1171 * \param *molecules list of molecules
[14de469]1172 */
[1907a7]1173static void testroutine(MoleculeListClass *molecules)
[14de469]1174{
[042f82]1175 // the current test routine checks the functionality of the KeySet&Graph concept:
1176 // We want to have a multiindex (the KeySet) describing a unique subgraph
[1907a7]1177 int i, comp, counter=0;
1178
1179 // create a clone
1180 molecule *mol = NULL;
1181 if (molecules->ListOfMolecules.size() != 0) // clone
1182 mol = (molecules->ListOfMolecules.front())->CopyMolecule();
1183 else {
[e138de]1184 eLog() << Verbose(0) << "I don't have anything to test on ... ";
[e359a8]1185 performCriticalExit();
[1907a7]1186 return;
1187 }
1188 atom *Walker = mol->start;
[6ac7ee]1189
[042f82]1190 // generate some KeySets
[e138de]1191 Log() << Verbose(0) << "Generating KeySets." << endl;
[042f82]1192 KeySet TestSets[mol->AtomCount+1];
1193 i=1;
1194 while (Walker->next != mol->end) {
1195 Walker = Walker->next;
1196 for (int j=0;j<i;j++) {
1197 TestSets[j].insert(Walker->nr);
1198 }
1199 i++;
1200 }
[e138de]1201 Log() << Verbose(0) << "Testing insertion of already present item in KeySets." << endl;
[042f82]1202 KeySetTestPair test;
1203 test = TestSets[mol->AtomCount-1].insert(Walker->nr);
1204 if (test.second) {
[e138de]1205 Log() << Verbose(1) << "Insertion worked?!" << endl;
[042f82]1206 } else {
[e138de]1207 Log() << Verbose(1) << "Insertion rejected: Present object is " << (*test.first) << "." << endl;
[042f82]1208 }
1209 TestSets[mol->AtomCount].insert(mol->end->previous->nr);
1210 TestSets[mol->AtomCount].insert(mol->end->previous->previous->previous->nr);
1211
1212 // constructing Graph structure
[e138de]1213 Log() << Verbose(0) << "Generating Subgraph class." << endl;
[042f82]1214 Graph Subgraphs;
1215
1216 // insert KeySets into Subgraphs
[e138de]1217 Log() << Verbose(0) << "Inserting KeySets into Subgraph class." << endl;
[042f82]1218 for (int j=0;j<mol->AtomCount;j++) {
1219 Subgraphs.insert(GraphPair (TestSets[j],pair<int, double>(counter++, 1.)));
1220 }
[e138de]1221 Log() << Verbose(0) << "Testing insertion of already present item in Subgraph." << endl;
[042f82]1222 GraphTestPair test2;
1223 test2 = Subgraphs.insert(GraphPair (TestSets[mol->AtomCount],pair<int, double>(counter++, 1.)));
1224 if (test2.second) {
[e138de]1225 Log() << Verbose(1) << "Insertion worked?!" << endl;
[042f82]1226 } else {
[e138de]1227 Log() << Verbose(1) << "Insertion rejected: Present object is " << (*(test2.first)).second.first << "." << endl;
[042f82]1228 }
1229
1230 // show graphs
[e138de]1231 Log() << Verbose(0) << "Showing Subgraph's contents, checking that it's sorted." << endl;
[042f82]1232 Graph::iterator A = Subgraphs.begin();
1233 while (A != Subgraphs.end()) {
[e138de]1234 Log() << Verbose(0) << (*A).second.first << ": ";
[042f82]1235 KeySet::iterator key = (*A).first.begin();
1236 comp = -1;
1237 while (key != (*A).first.end()) {
1238 if ((*key) > comp)
[e138de]1239 Log() << Verbose(0) << (*key) << " ";
[042f82]1240 else
[e138de]1241 Log() << Verbose(0) << (*key) << "! ";
[042f82]1242 comp = (*key);
1243 key++;
1244 }
[e138de]1245 Log() << Verbose(0) << endl;
[042f82]1246 A++;
1247 }
1248 delete(mol);
[14de469]1249};
1250
[1ca488f]1251#endif
[dbe929]1252
[ca2b83]1253/** Parses the command line options.
1254 * \param argc argument count
1255 * \param **argv arguments array
[1907a7]1256 * \param *molecules list of molecules structure
[ca2b83]1257 * \param *periode elements structure
1258 * \param configuration config file structure
1259 * \param *ConfigFileName pointer to config file name in **argv
[d7d29c]1260 * \param *PathToDatabases pointer to db's path in **argv
[ca2b83]1261 * \return exit code (0 - successful, all else - something's wrong)
1262 */
[85bc8e]1263static int ParseCommandLineOptions(int argc, char **argv, MoleculeListClass *&molecules, periodentafel *&periode,\
[235bed]1264 config& configuration, char *&ConfigFileName)
[14de469]1265{
[042f82]1266 Vector x,y,z,n; // coordinates for absolute point in cell volume
1267 double *factor; // unit factor if desired
1268 ifstream test;
1269 ofstream output;
1270 string line;
1271 atom *first;
1272 bool SaveFlag = false;
1273 int ExitFlag = 0;
1274 int j;
1275 double volume = 0.;
[f1cccd]1276 enum ConfigStatus configPresent = absent;
[042f82]1277 clock_t start,end;
1278 int argptr;
[b6d8a9]1279 molecule *mol = NULL;
[6a7f78c]1280 string BondGraphFileName("\n");
[717e0c]1281 int verbosity = 0;
[989bf6]1282 strncpy(configuration.databasepath, LocalPath, MAXSTRINGSIZE-1);
[6ac7ee]1283
[042f82]1284 if (argc > 1) { // config file specified as option
1285 // 1. : Parse options that just set variables or print help
1286 argptr = 1;
1287 do {
1288 if (argv[argptr][0] == '-') {
[e138de]1289 Log() << Verbose(0) << "Recognized command line argument: " << argv[argptr][1] << ".\n";
[042f82]1290 argptr++;
1291 switch(argv[argptr-1][1]) {
1292 case 'h':
1293 case 'H':
1294 case '?':
[e138de]1295 Log() << Verbose(0) << "MoleCuilder suite" << endl << "==================" << endl << endl;
1296 Log() << Verbose(0) << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl;
1297 Log() << Verbose(0) << "or simply " << argv[0] << " without arguments for interactive session." << endl;
1298 Log() << Verbose(0) << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl;
1299 Log() << Verbose(0) << "\t-A <source>\tCreate adjacency list from bonds parsed from 'dbond'-style file." <<endl;
1300 Log() << Verbose(0) << "\t-b xx xy xz yy yz zz\tCenter atoms in domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl;
1301 Log() << Verbose(0) << "\t-B xx xy xz yy yz zz\tBound atoms by domain with given symmetric matrix of (xx,xy,xz,yy,yz,zz)." << endl;
1302 Log() << Verbose(0) << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl;
[3930eb]1303 Log() << Verbose(0) << "\t-C <Z> <output> <bin output>\tPair Correlation analysis." << endl;
[e138de]1304 Log() << Verbose(0) << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl;
1305 Log() << Verbose(0) << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl;
1306 Log() << Verbose(0) << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl;
1307 Log() << Verbose(0) << "\t-E <id> <Z>\tChange atom <id>'s element to <Z>, <id> begins at 0." << endl;
[241485]1308 Log() << Verbose(0) << "\t-f <dist> <order>\tFragments the molecule in BOSSANOVA manner (with/out rings compressed) and stores config files in same dir as config (return code 0 - fragmented, 2 - no fragmentation necessary)." << endl;
1309 Log() << Verbose(0) << "\t-F <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl;
[e138de]1310 Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl;
1311 Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl;
[3930eb]1312 Log() << Verbose(0) << "\t-I\t Dissect current system of molecules into a set of disconnected (subgraphs of) molecules." << endl;
[1f1b23]1313 Log() << Verbose(0) << "\t-j\t<path> Store all bonds to file." << endl;
1314 Log() << Verbose(0) << "\t-J\t<path> Store adjacency per atom to file." << endl;
[e138de]1315 Log() << Verbose(0) << "\t-L <step0> <step1> <prefix>\tStore a linear interpolation between two configurations <step0> and <step1> into single config files with prefix <prefix> and as Trajectories into the current config file." << endl;
1316 Log() << Verbose(0) << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl;
1317 Log() << Verbose(0) << "\t-M <basis>\tSetting basis to store to MPQC config files." << endl;
1318 Log() << Verbose(0) << "\t-n\tFast parsing (i.e. no trajectories are looked for)." << endl;
1319 Log() << Verbose(0) << "\t-N <radius> <file>\tGet non-convex-envelope." << endl;
1320 Log() << Verbose(0) << "\t-o <out>\tGet volume of the convex envelope (and store to tecplot file)." << endl;
1321 Log() << Verbose(0) << "\t-O\tCenter atoms in origin." << endl;
1322 Log() << Verbose(0) << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl;
1323 Log() << Verbose(0) << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl;
1324 Log() << Verbose(0) << "\t-r <id>\t\tRemove an atom with given id." << endl;
1325 Log() << Verbose(0) << "\t-R <id> <radius>\t\tRemove all atoms out of sphere around a given one." << endl;
1326 Log() << Verbose(0) << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl;
1327 Log() << Verbose(0) << "\t-S <file> Store temperatures from the config file in <file>." << endl;
1328 Log() << Verbose(0) << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl;
1329 Log() << Verbose(0) << "\t-T x1 x2 x3\tTranslate periodically all atoms by this vector (x1,x2,x3)." << endl;
1330 Log() << Verbose(0) << "\t-u rho\tsuspend in water solution and output necessary cell lengths, average density rho and repetition." << endl;
[717e0c]1331 Log() << Verbose(0) << "\t-v\t\tsets verbosity (more is more)." << endl;
1332 Log() << Verbose(0) << "\t-V\t\tGives version information." << endl;
[e138de]1333 Log() << Verbose(0) << "Note: config files must not begin with '-' !" << endl;
[042f82]1334 return (1);
1335 break;
1336 case 'v':
[717e0c]1337 while (argv[argptr-1][verbosity+1] == 'v') {
1338 verbosity++;
1339 }
1340 setVerbosity(verbosity);
1341 Log() << Verbose(0) << "Setting verbosity to " << verbosity << "." << endl;
1342 break;
[042f82]1343 case 'V':
[e138de]1344 Log() << Verbose(0) << argv[0] << " " << VERSIONSTRING << endl;
1345 Log() << Verbose(0) << "Build your own molecule position set." << endl;
[042f82]1346 return (1);
1347 break;
1348 case 'e':
1349 if ((argptr >= argc) || (argv[argptr][0] == '-')) {
[e138de]1350 eLog() << Verbose(0) << "Not enough or invalid arguments for specifying element db: -e <db file>" << endl;
[e359a8]1351 performCriticalExit();
[042f82]1352 } else {
[e138de]1353 Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl;
[042f82]1354 strncpy (configuration.databasepath, argv[argptr], MAXSTRINGSIZE-1);
1355 argptr+=1;
1356 }
1357 break;
[b21a64]1358 case 'g':
1359 if ((argptr >= argc) || (argv[argptr][0] == '-')) {
[e138de]1360 eLog() << Verbose(0) << "Not enough or invalid arguments for specifying bond length table: -g <table file>" << endl;
[e359a8]1361 performCriticalExit();
[b21a64]1362 } else {
1363 BondGraphFileName = argv[argptr];
[e138de]1364 Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl;
[b21a64]1365 argptr+=1;
1366 }
1367 break;
[042f82]1368 case 'n':
[e138de]1369 Log() << Verbose(0) << "I won't parse trajectories." << endl;
[042f82]1370 configuration.FastParsing = true;
1371 break;
1372 default: // no match? Step on
1373 argptr++;
1374 break;
1375 }
1376 } else
1377 argptr++;
1378 } while (argptr < argc);
1379
[b21a64]1380 // 3a. Parse the element database
[042f82]1381 if (periode->LoadPeriodentafel(configuration.databasepath)) {
[e138de]1382 Log() << Verbose(0) << "Element list loaded successfully." << endl;
1383 //periode->Output();
[042f82]1384 } else {
[e138de]1385 Log() << Verbose(0) << "Element list loading failed." << endl;
[042f82]1386 return 1;
1387 }
[34e0013]1388 // 3b. Find config file name and parse if possible, also BondGraphFileName
[042f82]1389 if (argv[1][0] != '-') {
[b6d8a9]1390 // simply create a new molecule, wherein the config file is loaded and the manipulation takes place
[e138de]1391 Log() << Verbose(0) << "Config file given." << endl;
[042f82]1392 test.open(argv[1], ios::in);
1393 if (test == NULL) {
1394 //return (1);
1395 output.open(argv[1], ios::out);
1396 if (output == NULL) {
[e138de]1397 Log() << Verbose(1) << "Specified config file " << argv[1] << " not found." << endl;
[f1cccd]1398 configPresent = absent;
[042f82]1399 } else {
[e138de]1400 Log() << Verbose(0) << "Empty configuration file." << endl;
[042f82]1401 ConfigFileName = argv[1];
[f1cccd]1402 configPresent = empty;
[042f82]1403 output.close();
1404 }
1405 } else {
1406 test.close();
1407 ConfigFileName = argv[1];
[e138de]1408 Log() << Verbose(1) << "Specified config file found, parsing ... ";
[fa649a]1409 switch (configuration.TestSyntax(ConfigFileName, periode)) {
[042f82]1410 case 1:
[e138de]1411 Log() << Verbose(0) << "new syntax." << endl;
[fa649a]1412 configuration.Load(ConfigFileName, BondGraphFileName, periode, molecules);
[f1cccd]1413 configPresent = present;
[042f82]1414 break;
1415 case 0:
[e138de]1416 Log() << Verbose(0) << "old syntax." << endl;
[fa649a]1417 configuration.LoadOld(ConfigFileName, BondGraphFileName, periode, molecules);
[f1cccd]1418 configPresent = present;
[042f82]1419 break;
1420 default:
[e138de]1421 Log() << Verbose(0) << "Unknown syntax or empty, yet present file." << endl;
[f1cccd]1422 configPresent = empty;
[042f82]1423 }
1424 }
1425 } else
[f1cccd]1426 configPresent = absent;
[fa649a]1427 // set mol to first active molecule
1428 if (molecules->ListOfMolecules.size() != 0) {
1429 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
1430 if ((*ListRunner)->ActiveFlag) {
1431 mol = *ListRunner;
1432 break;
1433 }
1434 }
1435 if (mol == NULL) {
[23b547]1436 mol = World::getInstance().createMolecule();
[fa649a]1437 mol->ActiveFlag = true;
[6a7f78c]1438 if (ConfigFileName != NULL)
1439 mol->SetNameFromFilename(ConfigFileName);
[fa649a]1440 molecules->insert(mol);
1441 }
[6a7f78c]1442 if (configuration.BG == NULL) {
1443 configuration.BG = new BondGraph(configuration.GetIsAngstroem());
[244a84]1444 if ((!BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) {
[6a7f78c]1445 Log() << Verbose(0) << "Bond length table loaded successfully." << endl;
1446 } else {
1447 eLog() << Verbose(1) << "Bond length table loading failed." << endl;
1448 }
1449 }
[fa649a]1450
[042f82]1451 // 4. parse again through options, now for those depending on elements db and config presence
1452 argptr = 1;
1453 do {
[e138de]1454 Log() << Verbose(0) << "Current Command line argument: " << argv[argptr] << "." << endl;
[042f82]1455 if (argv[argptr][0] == '-') {
1456 argptr++;
[f1cccd]1457 if ((configPresent == present) || (configPresent == empty)) {
[042f82]1458 switch(argv[argptr-1][1]) {
1459 case 'p':
[ebcade]1460 if (ExitFlag == 0) ExitFlag = 1;
[042f82]1461 if ((argptr >= argc) || (argv[argptr][0] == '-')) {
1462 ExitFlag = 255;
[e138de]1463 eLog() << Verbose(0) << "Not enough arguments for parsing: -p <xyz file>" << endl;
[e359a8]1464 performCriticalExit();
[042f82]1465 } else {
1466 SaveFlag = true;
[e138de]1467 Log() << Verbose(1) << "Parsing xyz file for new atoms." << endl;
[042f82]1468 if (!mol->AddXYZFile(argv[argptr]))
[e138de]1469 Log() << Verbose(2) << "File not found." << endl;
[042f82]1470 else {
[e138de]1471 Log() << Verbose(2) << "File found and parsed." << endl;
[f1cccd]1472 configPresent = present;
[042f82]1473 }
1474 }
1475 break;
1476 case 'a':
[ebcade]1477 if (ExitFlag == 0) ExitFlag = 1;
[09048c]1478 if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3]))) {
[042f82]1479 ExitFlag = 255;
[e138de]1480 eLog() << Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl;
[e359a8]1481 performCriticalExit();
[042f82]1482 } else {
1483 SaveFlag = true;
[e138de]1484 Log() << Verbose(1) << "Adding new atom with element " << argv[argptr] << " at (" << argv[argptr+1] << "," << argv[argptr+2] << "," << argv[argptr+3] << "), ";
[23b547]1485 first = World::getInstance().createAtom();
[042f82]1486 first->type = periode->FindElement(atoi(argv[argptr]));
1487 if (first->type != NULL)
[e138de]1488 Log() << Verbose(2) << "found element " << first->type->name << endl;
[042f82]1489 for (int i=NDIM;i--;)
1490 first->x.x[i] = atof(argv[argptr+1+i]);
1491 if (first->type != NULL) {
1492 mol->AddAtom(first); // add to molecule
[f1cccd]1493 if ((configPresent == empty) && (mol->AtomCount != 0))
1494 configPresent = present;
[042f82]1495 } else
[e138de]1496 eLog() << Verbose(1) << "Could not find the specified element." << endl;
[042f82]1497 argptr+=4;
1498 }
1499 break;
1500 default: // no match? Don't step on (this is done in next switch's default)
1501 break;
1502 }
1503 }
[f1cccd]1504 if (configPresent == present) {
[042f82]1505 switch(argv[argptr-1][1]) {
[f3278b]1506 case 'M':
[042f82]1507 if ((argptr >= argc) || (argv[argptr][0] == '-')) {
1508 ExitFlag = 255;
[e138de]1509 eLog() << Verbose(0) << "Not enough or invalid arguments given for setting MPQC basis: -B <basis name>" << endl;
[e359a8]1510 performCriticalExit();
[042f82]1511 } else {
1512 configuration.basis = argv[argptr];
[e138de]1513 Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl;
[042f82]1514 argptr+=1;
1515 }
1516 break;
1517 case 'D':
[ebcade]1518 if (ExitFlag == 0) ExitFlag = 1;
[042f82]1519 {
[e138de]1520 Log() << Verbose(1) << "Depth-First-Search Analysis." << endl;
[042f82]1521 MoleculeLeafClass *Subgraphs = NULL; // list of subgraphs from DFS analysis
1522 int *MinimumRingSize = new int[mol->AtomCount];
1523 atom ***ListOfLocalAtoms = NULL;
1524 class StackClass<bond *> *BackEdgeStack = NULL;
1525 class StackClass<bond *> *LocalBackEdgeStack = NULL;
[e138de]1526 mol->CreateAdjacencyList(atof(argv[argptr]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
1527 Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack);
[042f82]1528 if (Subgraphs != NULL) {
[7218f8]1529 int FragmentCounter = 0;
[042f82]1530 while (Subgraphs->next != NULL) {
1531 Subgraphs = Subgraphs->next;
[e138de]1532 Subgraphs->FillBondStructureFromReference(mol, FragmentCounter, ListOfLocalAtoms, false); // we want to keep the created ListOfLocalAtoms
[042f82]1533 LocalBackEdgeStack = new StackClass<bond *> (Subgraphs->Leaf->BondCount);
[e138de]1534 Subgraphs->Leaf->PickLocalBackEdges(ListOfLocalAtoms[FragmentCounter], BackEdgeStack, LocalBackEdgeStack);
1535 Subgraphs->Leaf->CyclicStructureAnalysis(LocalBackEdgeStack, MinimumRingSize);
[042f82]1536 delete(LocalBackEdgeStack);
1537 delete(Subgraphs->previous);
[7218f8]1538 FragmentCounter++;
[042f82]1539 }
1540 delete(Subgraphs);
1541 for (int i=0;i<FragmentCounter;i++)
[7218f8]1542 Free(&ListOfLocalAtoms[i]);
[b66c22]1543 Free(&ListOfLocalAtoms);
[042f82]1544 }
1545 delete(BackEdgeStack);
1546 delete[](MinimumRingSize);
1547 }
1548 //argptr+=1;
1549 break;
[3930eb]1550 case 'I':
1551 Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl;
1552 // @TODO rather do the dissection afterwards
[244a84]1553 molecules->DissectMoleculeIntoConnectedSubgraphs(periode, &configuration);
[3930eb]1554 mol = NULL;
1555 if (molecules->ListOfMolecules.size() != 0) {
1556 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++)
1557 if ((*ListRunner)->ActiveFlag) {
1558 mol = *ListRunner;
1559 break;
1560 }
1561 }
1562 if (mol == NULL) {
1563 mol = *(molecules->ListOfMolecules.begin());
1564 mol->ActiveFlag = true;
1565 }
1566 break;
[db6bf74]1567 case 'C':
1568 if (ExitFlag == 0) ExitFlag = 1;
[f4e1f5]1569 if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr][0] == '-') || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-')) {
[db6bf74]1570 ExitFlag = 255;
[e138de]1571 eLog() << Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C <Z> <output> <bin output>" << endl;
[e359a8]1572 performCriticalExit();
[db6bf74]1573 } else {
[09048c]1574 ofstream output(argv[argptr+1]);
1575 ofstream binoutput(argv[argptr+2]);
[db6bf74]1576 const double radius = 5.;
[09048c]1577
1578 // get the boundary
[f4e1f5]1579 class molecule *Boundary = NULL;
[776b64]1580 class Tesselation *TesselStruct = NULL;
1581 const LinkedCell *LCList = NULL;
[f4e1f5]1582 // find biggest molecule
[a5551b]1583 int counter = 0;
[f4e1f5]1584 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
1585 if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
1586 Boundary = *BigFinder;
1587 }
[a5551b]1588 counter++;
1589 }
1590 bool *Actives = Malloc<bool>(counter, "ParseCommandLineOptions() - case C -- *Actives");
1591 counter = 0;
1592 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
[3930eb]1593 Actives[counter++] = (*BigFinder)->ActiveFlag;
[a5551b]1594 (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
[f4e1f5]1595 }
[776b64]1596 LCList = new LinkedCell(Boundary, 2.*radius);
[ead4e6]1597 const element *elemental = periode->FindElement((atomicNumber_t) atoi(argv[argptr]));
[e138de]1598 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
[7ea9e6]1599 int ranges[NDIM] = {1,1,1};
[e138de]1600 CorrelationToSurfaceMap *surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges );
[481601]1601 OutputCorrelationToSurface(&output, surfacemap);
[1f1b23]1602 BinPairMap *binmap = BinData( surfacemap, 0.5, 0., 20. );
[db6bf74]1603 OutputCorrelation ( &binoutput, binmap );
1604 output.close();
1605 binoutput.close();
[a5551b]1606 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++)
[3930eb]1607 (*BigFinder)->ActiveFlag = Actives[counter++];
[a5551b]1608 Free(&Actives);
[776b64]1609 delete(LCList);
1610 delete(TesselStruct);
[09048c]1611 argptr+=3;
[db6bf74]1612 }
1613 break;
[042f82]1614 case 'E':
[ebcade]1615 if (ExitFlag == 0) ExitFlag = 1;
[042f82]1616 if ((argptr+1 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr+1][0] == '-')) {
1617 ExitFlag = 255;
[e138de]1618 eLog() << Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl;
[e359a8]1619 performCriticalExit();
[042f82]1620 } else {
1621 SaveFlag = true;
[e138de]1622 Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl;
[042f82]1623 first = mol->FindAtom(atoi(argv[argptr]));
1624 first->type = periode->FindElement(atoi(argv[argptr+1]));
1625 argptr+=2;
1626 }
1627 break;
[9f97c5]1628 case 'F':
[ebcade]1629 if (ExitFlag == 0) ExitFlag = 1;
[3930eb]1630 if (argptr+6 >=argc) {
[9f97c5]1631 ExitFlag = 255;
[9473f6]1632 eLog() << Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <dist_x> <dist_y> <dist_z> <boundary> <randatom> <randmol> <DoRotate>" << endl;
[e359a8]1633 performCriticalExit();
[9f97c5]1634 } else {
1635 SaveFlag = true;
[e138de]1636 Log() << Verbose(1) << "Filling Box with water molecules." << endl;
[9f97c5]1637 // construct water molecule
[23b547]1638 molecule *filler = World::getInstance().createMolecule();
[9f97c5]1639 molecule *Filling = NULL;
1640 atom *second = NULL, *third = NULL;
[3930eb]1641// first = new atom();
[244a84]1642// first->type = periode->FindElement(5);
1643// first->x.Zero();
[3930eb]1644// filler->AddAtom(first);
[23b547]1645 first = World::getInstance().createAtom();
[9f97c5]1646 first->type = periode->FindElement(1);
1647 first->x.Init(0.441, -0.143, 0.);
1648 filler->AddAtom(first);
[23b547]1649 second = World::getInstance().createAtom();
[9f97c5]1650 second->type = periode->FindElement(1);
1651 second->x.Init(-0.464, 1.137, 0.0);
1652 filler->AddAtom(second);
[23b547]1653 third = World::getInstance().createAtom();
[9f97c5]1654 third->type = periode->FindElement(8);
1655 third->x.Init(-0.464, 0.177, 0.);
1656 filler->AddAtom(third);
1657 filler->AddBond(first, third, 1);
1658 filler->AddBond(second, third, 1);
1659 // call routine
1660 double distance[NDIM];
1661 for (int i=0;i<NDIM;i++)
1662 distance[i] = atof(argv[argptr+i]);
[9473f6]1663 Filling = FillBoxWithMolecule(molecules, filler, configuration, distance, atof(argv[argptr+3]), atof(argv[argptr+4]), atof(argv[argptr+5]), atoi(argv[argptr+6]));
[9f97c5]1664 if (Filling != NULL) {
[3930eb]1665 Filling->ActiveFlag = false;
[9f97c5]1666 molecules->insert(Filling);
1667 }
[23b547]1668 World::getInstance().destroyMolecule(filler);
[9f97c5]1669 argptr+=6;
1670 }
1671 break;
[042f82]1672 case 'A':
[ebcade]1673 if (ExitFlag == 0) ExitFlag = 1;
[042f82]1674 if ((argptr >= argc) || (argv[argptr][0] == '-')) {
1675 ExitFlag =255;
[e138de]1676 eLog() << Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl;
[e359a8]1677 performCriticalExit();
[042f82]1678 } else {
[e138de]1679 Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl;
[042f82]1680 ifstream *input = new ifstream(argv[argptr]);
[e138de]1681 mol->CreateAdjacencyListFromDbondFile(input);
[042f82]1682 input->close();
1683 argptr+=1;
1684 }
1685 break;
[1f1b23]1686
1687 case 'J':
1688 if (ExitFlag == 0) ExitFlag = 1;
1689 if ((argptr >= argc) || (argv[argptr][0] == '-')) {
1690 ExitFlag =255;
1691 eLog() << Verbose(0) << "Missing path of adjacency file: -j <path>" << endl;
1692 performCriticalExit();
1693 } else {
1694 Log() << Verbose(0) << "Storing adjacency to path " << argv[argptr] << "." << endl;
1695 configuration.BG->ConstructBondGraph(mol);
1696 mol->StoreAdjacencyToFile(argv[argptr]);
1697 argptr+=1;
1698 }
1699 break;
1700
1701 case 'j':
1702 if (ExitFlag == 0) ExitFlag = 1;
1703 if ((argptr >= argc) || (argv[argptr][0] == '-')) {
1704 ExitFlag =255;
1705 eLog() << Verbose(0) << "Missing path of bonds file: -j <path>" << endl;
1706 performCriticalExit();
1707 } else {
1708 Log() << Verbose(0) << "Storing bonds to path " << argv[argptr] << "." << endl;
1709 configuration.BG->ConstructBondGraph(mol);
1710 mol->StoreBondsToFile(argv[argptr]);
1711 argptr+=1;
1712 }
1713 break;
1714
[042f82]1715 case 'N':
[ebcade]1716 if (ExitFlag == 0) ExitFlag = 1;
[042f82]1717 if ((argptr+1 >= argc) || (argv[argptr+1][0] == '-')){
1718 ExitFlag = 255;
[e138de]1719 eLog() << Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl;
[e359a8]1720 performCriticalExit();
[042f82]1721 } else {
[776b64]1722 class Tesselation *T = NULL;
1723 const LinkedCell *LCList = NULL;
[9a0dc8]1724 molecule * Boundary = NULL;
1725 //string filename(argv[argptr+1]);
1726 //filename.append(".csv");
1727 Log() << Verbose(0) << "Evaluating non-convex envelope of biggest molecule.";
[e138de]1728 Log() << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl;
[9a0dc8]1729 // find biggest molecule
1730 int counter = 0;
1731 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
1732 (*BigFinder)->CountAtoms();
1733 if ((Boundary == NULL) || (Boundary->AtomCount < (*BigFinder)->AtomCount)) {
1734 Boundary = *BigFinder;
1735 }
1736 counter++;
1737 }
1738 Log() << Verbose(1) << "Biggest molecule has " << Boundary->AtomCount << " atoms." << endl;
[f7f7a4]1739 start = clock();
[9a0dc8]1740 LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.);
[4fc93f]1741 if (!FindNonConvexBorder(Boundary, T, LCList, atof(argv[argptr]), argv[argptr+1]))
1742 ExitFlag = 255;
[e138de]1743 //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str());
[f7f7a4]1744 end = clock();
[e138de]1745 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
[776b64]1746 delete(LCList);
[f67b6e]1747 delete(T);
[042f82]1748 argptr+=2;
1749 }
1750 break;
1751 case 'S':
[ebcade]1752 if (ExitFlag == 0) ExitFlag = 1;
[042f82]1753 if ((argptr >= argc) || (argv[argptr][0] == '-')) {
1754 ExitFlag = 255;
[e138de]1755 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl;
[e359a8]1756 performCriticalExit();
[042f82]1757 } else {
[e138de]1758 Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl;
[042f82]1759 ofstream *output = new ofstream(argv[argptr], ios::trunc);
[e138de]1760 if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps))
1761 Log() << Verbose(2) << "File could not be written." << endl;
[042f82]1762 else
[e138de]1763 Log() << Verbose(2) << "File stored." << endl;
[042f82]1764 output->close();
1765 delete(output);
1766 argptr+=1;
1767 }
1768 break;
[85bac0]1769 case 'L':
[ebcade]1770 if (ExitFlag == 0) ExitFlag = 1;
[f7f7a4]1771 if ((argptr >= argc) || (argv[argptr][0] == '-')) {
1772 ExitFlag = 255;
[e138de]1773 eLog() << Verbose(0) << "Not enough or invalid arguments given for storing tempature: -L <step0> <step1> <prefix> <identity mapping?>" << endl;
[e359a8]1774 performCriticalExit();
[f7f7a4]1775 } else {
1776 SaveFlag = true;
[e138de]1777 Log() << Verbose(1) << "Linear interpolation between configuration " << argv[argptr] << " and " << argv[argptr+1] << "." << endl;
[f7f7a4]1778 if (atoi(argv[argptr+3]) == 1)
[e138de]1779 Log() << Verbose(1) << "Using Identity for the permutation map." << endl;
1780 if (!mol->LinearInterpolationBetweenConfiguration(atoi(argv[argptr]), atoi(argv[argptr+1]), argv[argptr+2], configuration, atoi(argv[argptr+3])) == 1 ? true : false)
1781 Log() << Verbose(2) << "Could not store " << argv[argptr+2] << " files." << endl;
[f7f7a4]1782 else
[e138de]1783 Log() << Verbose(2) << "Steps created and " << argv[argptr+2] << " files stored." << endl;
[f7f7a4]1784 argptr+=4;
1785 }
[85bac0]1786 break;
[042f82]1787 case 'P':
[ebcade]1788 if (ExitFlag == 0) ExitFlag = 1;
[042f82]1789 if ((argptr >= argc) || (argv[argptr][0] == '-')) {
1790 ExitFlag = 255;
[e138de]1791 eLog() << Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl;
[e359a8]1792 performCriticalExit();
[042f82]1793 } else {
1794 SaveFlag = true;
[e138de]1795 Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl;
1796 if (!mol->VerletForceIntegration(argv[argptr], configuration))
1797 Log() << Verbose(2) << "File not found." << endl;
[042f82]1798 else
[e138de]1799 Log() << Verbose(2) << "File found and parsed." << endl;
[042f82]1800 argptr+=1;
1801 }
1802 break;
[a5b2c3a]1803 case 'R':
[ebcade]1804 if (ExitFlag == 0) ExitFlag = 1;
1805 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) {
[a5b2c3a]1806 ExitFlag = 255;
[e138de]1807 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <id> <distance>" << endl;
[e359a8]1808 performCriticalExit();
[a5b2c3a]1809 } else {
1810 SaveFlag = true;
[e138de]1811 Log() << Verbose(1) << "Removing atoms around " << argv[argptr] << " with radius " << argv[argptr+1] << "." << endl;
[a5b2c3a]1812 double tmp1 = atof(argv[argptr+1]);
1813 atom *third = mol->FindAtom(atoi(argv[argptr]));
1814 atom *first = mol->start;
1815 if ((third != NULL) && (first != mol->end)) {
1816 atom *second = first->next;
1817 while(second != mol->end) {
1818 first = second;
1819 second = first->next;
1820 if (first->x.DistanceSquared((const Vector *)&third->x) > tmp1*tmp1) // distance to first above radius ...
1821 mol->RemoveAtom(first);
1822 }
1823 } else {
[717e0c]1824 eLog() << Verbose(1) << "Removal failed due to missing atoms on molecule or wrong id." << endl;
[a5b2c3a]1825 }
1826 argptr+=2;
1827 }
1828 break;
[042f82]1829 case 't':
[ebcade]1830 if (ExitFlag == 0) ExitFlag = 1;
[09048c]1831 if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
[042f82]1832 ExitFlag = 255;
[e138de]1833 eLog() << Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl;
[e359a8]1834 performCriticalExit();
[042f82]1835 } else {
[ebcade]1836 if (ExitFlag == 0) ExitFlag = 1;
[042f82]1837 SaveFlag = true;
[e138de]1838 Log() << Verbose(1) << "Translating all ions by given vector." << endl;
[042f82]1839 for (int i=NDIM;i--;)
1840 x.x[i] = atof(argv[argptr+i]);
1841 mol->Translate((const Vector *)&x);
1842 argptr+=3;
1843 }
[f7f7a4]1844 break;
[21c017]1845 case 'T':
[ebcade]1846 if (ExitFlag == 0) ExitFlag = 1;
[09048c]1847 if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
[21c017]1848 ExitFlag = 255;
[e138de]1849 eLog() << Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl;
[e359a8]1850 performCriticalExit();
[21c017]1851 } else {
[ebcade]1852 if (ExitFlag == 0) ExitFlag = 1;
[21c017]1853 SaveFlag = true;
[e138de]1854 Log() << Verbose(1) << "Translating all ions periodically by given vector." << endl;
[21c017]1855 for (int i=NDIM;i--;)
1856 x.x[i] = atof(argv[argptr+i]);
1857 mol->TranslatePeriodically((const Vector *)&x);
1858 argptr+=3;
1859 }
1860 break;
[042f82]1861 case 's':
[ebcade]1862 if (ExitFlag == 0) ExitFlag = 1;
[09048c]1863 if ((argptr >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
[042f82]1864 ExitFlag = 255;
[e138de]1865 eLog() << Verbose(0) << "Not enough or invalid arguments given for scaling: -s <factor_x> [factor_y] [factor_z]" << endl;
[e359a8]1866 performCriticalExit();
[042f82]1867 } else {
1868 SaveFlag = true;
1869 j = -1;
[e138de]1870 Log() << Verbose(1) << "Scaling all ion positions by factor." << endl;
[042f82]1871 factor = new double[NDIM];
1872 factor[0] = atof(argv[argptr]);
[09048c]1873 factor[1] = atof(argv[argptr+1]);
1874 factor[2] = atof(argv[argptr+2]);
[776b64]1875 mol->Scale((const double ** const)&factor);
[042f82]1876 for (int i=0;i<NDIM;i++) {
1877 j += i+1;
1878 x.x[i] = atof(argv[NDIM+i]);
1879 mol->cell_size[j]*=factor[i];
1880 }
1881 delete[](factor);
[09048c]1882 argptr+=3;
[042f82]1883 }
1884 break;
1885 case 'b':
[ebcade]1886 if (ExitFlag == 0) ExitFlag = 1;
1887 if ((argptr+5 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) ) {
[042f82]1888 ExitFlag = 255;
[e138de]1889 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering in box: -b <xx> <xy> <xz> <yy> <yz> <zz>" << endl;
[e359a8]1890 performCriticalExit();
[042f82]1891 } else {
1892 SaveFlag = true;
[a8b9d61]1893 j = -1;
[e138de]1894 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
[042f82]1895 for (int i=0;i<6;i++) {
1896 mol->cell_size[i] = atof(argv[argptr+i]);
1897 }
1898 // center
[e138de]1899 mol->CenterInBox();
[21c017]1900 argptr+=6;
[042f82]1901 }
1902 break;
[f3278b]1903 case 'B':
[ebcade]1904 if (ExitFlag == 0) ExitFlag = 1;
1905 if ((argptr+5 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) ) {
[f3278b]1906 ExitFlag = 255;
[e138de]1907 eLog() << Verbose(0) << "Not enough or invalid arguments given for bounding in box: -B <xx> <xy> <xz> <yy> <yz> <zz>" << endl;
[e359a8]1908 performCriticalExit();
[f3278b]1909 } else {
1910 SaveFlag = true;
1911 j = -1;
[e138de]1912 Log() << Verbose(1) << "Centering atoms in config file within given simulation box." << endl;
[f3278b]1913 for (int i=0;i<6;i++) {
1914 mol->cell_size[i] = atof(argv[argptr+i]);
1915 }
1916 // center
[e138de]1917 mol->BoundInBox();
[f3278b]1918 argptr+=6;
1919 }
1920 break;
[042f82]1921 case 'c':
[ebcade]1922 if (ExitFlag == 0) ExitFlag = 1;
1923 if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
[042f82]1924 ExitFlag = 255;
[e138de]1925 eLog() << Verbose(0) << "Not enough or invalid arguments given for centering with boundary: -c <boundary_x> <boundary_y> <boundary_z>" << endl;
[e359a8]1926 performCriticalExit();
[042f82]1927 } else {
1928 SaveFlag = true;
1929 j = -1;
[e138de]1930 Log() << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl;
[042f82]1931 // make every coordinate positive
[e138de]1932 mol->CenterEdge(&x);
[042f82]1933 // update Box of atoms by boundary
1934 mol->SetBoxDimension(&x);
1935 // translate each coordinate by boundary
1936 j=-1;
1937 for (int i=0;i<NDIM;i++) {
1938 j += i+1;
[36ec71]1939 x.x[i] = atof(argv[argptr+i]);
[042f82]1940 mol->cell_size[j] += x.x[i]*2.;
1941 }
1942 mol->Translate((const Vector *)&x);
[21c017]1943 argptr+=3;
[042f82]1944 }
1945 break;
1946 case 'O':
[ebcade]1947 if (ExitFlag == 0) ExitFlag = 1;
[042f82]1948 SaveFlag = true;
[e138de]1949 Log() << Verbose(1) << "Centering atoms on edge and setting box dimensions." << endl;
[36ec71]1950 x.Zero();
[e138de]1951 mol->CenterEdge(&x);
[042f82]1952 mol->SetBoxDimension(&x);
[21c017]1953 argptr+=0;
[042f82]1954 break;
1955 case 'r':
[ebcade]1956 if (ExitFlag == 0) ExitFlag = 1;
1957 if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr]))) {
1958 ExitFlag = 255;
[e138de]1959 eLog() << Verbose(0) << "Not enough or invalid arguments given for removing atoms: -r <id>" << endl;
[e359a8]1960 performCriticalExit();
[ebcade]1961 } else {
1962 SaveFlag = true;
[e138de]1963 Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl;
[ebcade]1964 atom *first = mol->FindAtom(atoi(argv[argptr]));
1965 mol->RemoveAtom(first);
1966 argptr+=1;
1967 }
[042f82]1968 break;
1969 case 'f':
[ebcade]1970 if (ExitFlag == 0) ExitFlag = 1;
1971 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) {
[042f82]1972 ExitFlag = 255;
[e138de]1973 eLog() << Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl;
[e359a8]1974 performCriticalExit();
[042f82]1975 } else {
[e138de]1976 Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl;
1977 Log() << Verbose(0) << "Creating connection matrix..." << endl;
[042f82]1978 start = clock();
[e138de]1979 mol->CreateAdjacencyList(atof(argv[argptr++]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);
1980 Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
[042f82]1981 if (mol->first->next != mol->last) {
[e138de]1982 ExitFlag = mol->FragmentMolecule(atoi(argv[argptr]), &configuration);
[042f82]1983 }
1984 end = clock();
[e138de]1985 Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
[042f82]1986 argptr+=2;
1987 }
1988 break;
1989 case 'm':
[ebcade]1990 if (ExitFlag == 0) ExitFlag = 1;
[042f82]1991 j = atoi(argv[argptr++]);
1992 if ((j<0) || (j>1)) {
[717e0c]1993 eLog() << Verbose(1) << "Argument of '-m' should be either 0 for no-rotate or 1 for rotate." << endl;
[042f82]1994 j = 0;
1995 }
1996 if (j) {
1997 SaveFlag = true;
[e138de]1998 Log() << Verbose(0) << "Converting to prinicipal axis system." << endl;
[042f82]1999 } else
[e138de]2000 Log() << Verbose(0) << "Evaluating prinicipal axis." << endl;
2001 mol->PrincipalAxisSystem((bool)j);
[042f82]2002 break;
2003 case 'o':
[ebcade]2004 if (ExitFlag == 0) ExitFlag = 1;
[f7f7a4]2005 if ((argptr+1 >= argc) || (argv[argptr][0] == '-')){
[042f82]2006 ExitFlag = 255;
[e138de]2007 eLog() << Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl;
[e359a8]2008 performCriticalExit();
[042f82]2009 } else {
[776b64]2010 class Tesselation *TesselStruct = NULL;
2011 const LinkedCell *LCList = NULL;
[e138de]2012 Log() << Verbose(0) << "Evaluating volume of the convex envelope.";
2013 Log() << Verbose(1) << "Storing tecplot convex data in " << argv[argptr] << "." << endl;
2014 Log() << Verbose(1) << "Storing tecplot non-convex data in " << argv[argptr+1] << "." << endl;
[776b64]2015 LCList = new LinkedCell(mol, 10.);
[e138de]2016 //FindConvexBorder(mol, LCList, argv[argptr]);
2017 FindNonConvexBorder(mol, TesselStruct, LCList, 5., argv[argptr+1]);
2018// RemoveAllBoundaryPoints(TesselStruct, mol, argv[argptr]);
2019 double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, argv[argptr]);
2020 double clustervolume = VolumeOfConvexEnvelope(TesselStruct, &configuration);
2021 Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;
2022 Log() << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl;
[776b64]2023 delete(TesselStruct);
2024 delete(LCList);
[f7f7a4]2025 argptr+=2;
[042f82]2026 }
2027 break;
2028 case 'U':
[ebcade]2029 if (ExitFlag == 0) ExitFlag = 1;
2030 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) ) {
[042f82]2031 ExitFlag = 255;
[e138de]2032 eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension with specified volume: -U <volume> <density>" << endl;
[e359a8]2033 performCriticalExit();
[042f82]2034 } else {
2035 volume = atof(argv[argptr++]);
[e138de]2036 Log() << Verbose(0) << "Using " << volume << " angstrom^3 as the volume instead of convex envelope one's." << endl;
[042f82]2037 }
2038 case 'u':
[ebcade]2039 if (ExitFlag == 0) ExitFlag = 1;
2040 if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) ) {
[042f82]2041 if (volume != -1)
2042 ExitFlag = 255;
[482373]2043 eLog() << Verbose(0) << "Not enough or invalid arguments given for suspension: -u <density>" << endl;
[e359a8]2044 performCriticalExit();
[042f82]2045 } else {
2046 double density;
2047 SaveFlag = true;
[e138de]2048 Log() << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water.";
[042f82]2049 density = atof(argv[argptr++]);
2050 if (density < 1.0) {
[e359a8]2051 eLog() << Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl;
[042f82]2052 density = 1.3;
2053 }
2054// for(int i=0;i<NDIM;i++) {
2055// repetition[i] = atoi(argv[argptr++]);
2056// if (repetition[i] < 1)
[717e0c]2057// eLog() << Verbose(1) << "repetition value must be greater 1!" << endl;
[042f82]2058// repetition[i] = 1;
2059// }
[e138de]2060 PrepareClustersinWater(&configuration, mol, volume, density); // if volume == 0, will calculate from ConvexEnvelope
[042f82]2061 }
2062 break;
2063 case 'd':
[ebcade]2064 if (ExitFlag == 0) ExitFlag = 1;
2065 if ((argptr+2 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {
[042f82]2066 ExitFlag = 255;
[e138de]2067 eLog() << Verbose(0) << "Not enough or invalid arguments given for repeating cells: -d <repeat_x> <repeat_y> <repeat_z>" << endl;
[e359a8]2068 performCriticalExit();
[042f82]2069 } else {
2070 SaveFlag = true;
2071 for (int axis = 1; axis <= NDIM; axis++) {
2072 int faktor = atoi(argv[argptr++]);
2073 int count;
[ead4e6]2074 const element ** Elements;
[042f82]2075 Vector ** vectors;
2076 if (faktor < 1) {
[ead4e6]2077 eLog() << Verbose(1) << "Repetition factor must be greater than 1!" << endl;
[042f82]2078 faktor = 1;
2079 }
[e138de]2080 mol->CountAtoms(); // recount atoms
[042f82]2081 if (mol->AtomCount != 0) { // if there is more than none
2082 count = mol->AtomCount; // is changed becausing of adding, thus has to be stored away beforehand
[ead4e6]2083 Elements = new const element *[count];
[042f82]2084 vectors = new Vector *[count];
2085 j = 0;
2086 first = mol->start;
2087 while (first->next != mol->end) { // make a list of all atoms with coordinates and element
2088 first = first->next;
2089 Elements[j] = first->type;
2090 vectors[j] = &first->x;
2091 j++;
2092 }
2093 if (count != j)
[717e0c]2094 eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl;
[042f82]2095 x.Zero();
2096 y.Zero();
2097 y.x[abs(axis)-1] = mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
2098 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times
2099 x.AddVector(&y); // per factor one cell width further
2100 for (int k=count;k--;) { // go through every atom of the original cell
[23b547]2101 first = World::getInstance().createAtom(); // create a new body
[042f82]2102 first->x.CopyVector(vectors[k]); // use coordinate of original atom
2103 first->x.AddVector(&x); // translate the coordinates
2104 first->type = Elements[k]; // insert original element
2105 mol->AddAtom(first); // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
2106 }
2107 }
2108 // free memory
2109 delete[](Elements);
2110 delete[](vectors);
2111 // correct cell size
2112 if (axis < 0) { // if sign was negative, we have to translate everything
2113 x.Zero();
2114 x.AddVector(&y);
2115 x.Scale(-(faktor-1));
2116 mol->Translate(&x);
2117 }
2118 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
2119 }
2120 }
2121 }
2122 break;
2123 default: // no match? Step on
2124 if ((argptr < argc) && (argv[argptr][0] != '-')) // if it started with a '-' we've already made a step!
2125 argptr++;
2126 break;
2127 }
2128 }
2129 } else argptr++;
2130 } while (argptr < argc);
2131 if (SaveFlag)
[235bed]2132 configuration.SaveAll(ConfigFileName, periode, molecules);
[042f82]2133 } else { // no arguments, hence scan the elements db
2134 if (periode->LoadPeriodentafel(configuration.databasepath))
[e138de]2135 Log() << Verbose(0) << "Element list loaded successfully." << endl;
[042f82]2136 else
[e138de]2137 Log() << Verbose(0) << "Element list loading failed." << endl;
[042f82]2138 configuration.RetrieveConfigPathAndName("main_pcp_linux");
2139 }
2140 return(ExitFlag);
[ca2b83]2141};
2142
[12b845]2143/***************************************** Functions used to build all menus **********************/
2144
2145void populateEditMoleculesMenu(Menu* editMoleculesMenu,MoleculeListClass *molecules, config *configuration, periodentafel *periode){
2146 // build the EditMoleculesMenu
2147 Action *createMoleculeAction = new MethodAction("createMoleculeAction",boost::bind(&MoleculeListClass::createNewMolecule,molecules,periode));
2148 new ActionMenuItem('c',"create new molecule",editMoleculesMenu,createMoleculeAction);
2149
2150 Action *loadMoleculeAction = new MethodAction("loadMoleculeAction",boost::bind(&MoleculeListClass::loadFromXYZ,molecules,periode));
2151 new ActionMenuItem('l',"load molecule from xyz file",editMoleculesMenu,loadMoleculeAction);
2152
[a6f180]2153 Action *changeFilenameAction = new ChangeMoleculeNameAction(molecules);
[12b845]2154 new ActionMenuItem('n',"change molecule's name",editMoleculesMenu,changeFilenameAction);
2155
2156 Action *giveFilenameAction = new MethodAction("giveFilenameAction",boost::bind(&MoleculeListClass::setMoleculeFilename,molecules));
2157 new ActionMenuItem('N',"give molecules filename",editMoleculesMenu,giveFilenameAction);
2158
2159 Action *parseAtomsAction = new MethodAction("parseAtomsAction",boost::bind(&MoleculeListClass::parseXYZIntoMolecule,molecules));
2160 new ActionMenuItem('p',"parse atoms in xyz file into molecule",editMoleculesMenu,parseAtomsAction);
2161
2162 Action *eraseMoleculeAction = new MethodAction("eraseMoleculeAction",boost::bind(&MoleculeListClass::eraseMolecule,molecules));
2163 new ActionMenuItem('r',"remove a molecule",editMoleculesMenu,eraseMoleculeAction);
[b8d1aeb]2164
[12b845]2165}
2166
2167
[ca2b83]2168/********************************************** Main routine **************************************/
[14de469]2169
[354859]2170void cleanUp(config *configuration){
[326a43b]2171 UIFactory::purgeInstance();
[23b547]2172 World::purgeInstance();
[354859]2173 delete(configuration);
2174 Log() << Verbose(0) << "Maximum of allocated memory: "
2175 << MemoryUsageObserver::getInstance()->getMaximumUsedMemory() << endl;
2176 Log() << Verbose(0) << "Remaining non-freed memory: "
2177 << MemoryUsageObserver::getInstance()->getUsedMemorySize() << endl;
2178 MemoryUsageObserver::purgeInstance();
2179 logger::purgeInstance();
2180 errorLogger::purgeInstance();
[e73a8a2]2181 ActionRegistry::purgeInstance();
[354859]2182}
2183
[ca2b83]2184int main(int argc, char **argv)
2185{
[85bc8e]2186 molecule *mol = NULL;
2187 config *configuration = new config;
2188 Vector x, y, z, n;
2189 ifstream test;
2190 ofstream output;
2191 string line;
2192 char *ConfigFileName = NULL;
2193 int j;
[229e3c]2194
[85bc8e]2195 setVerbosity(0);
[d56640]2196 // need to init the history before any action is created
2197 ActionHistory::init();
[85bc8e]2198 /* structure of ParseCommandLineOptions will be refactored later */
[23b547]2199 j = ParseCommandLineOptions(argc, argv, World::getInstance().getMolecules(), World::getInstance().getPeriode(), *configuration, ConfigFileName);
[85bc8e]2200 switch (j){
2201 case 255:
2202 case 2:
2203 case 1:
[354859]2204 cleanUp(configuration);
[85bc8e]2205 return (j == 1 ? 0 : j);
2206 default:
2207 break;
[1907a7]2208 }
[23b547]2209 if(World::getInstance().numMolecules() == 0){
2210 mol = World::getInstance().createMolecule();
2211 World::getInstance().getMolecules()->insert(mol);
[85bc8e]2212 if(mol->cell_size[0] == 0.){
2213 Log() << Verbose(0) << "enter lower tridiagonal form of basis matrix" << endl << endl;
2214 for(int i = 0;i < 6;i++){
2215 Log() << Verbose(1) << "Cell size" << i << ": ";
2216 cin >> mol->cell_size[i];
2217 }
[1907a7]2218 }
[85bc8e]2219 mol->ActiveFlag = true;
2220 }
[6ac7ee]2221
[12b845]2222 {
[1ca488f]2223 setVerbosity(0);
[6ac7ee]2224
[12b845]2225 menuPopulaters populaters;
2226 populaters.MakeEditMoleculesMenu = populateEditMoleculesMenu;
[6ac7ee]2227
[3027f8]2228#ifdef USE_GUI_QT
2229 UIFactory::makeUserInterface(UIFactory::QT4);
2230#else
[6a661c]2231 cout << ESPACKVersion << endl;
[12b845]2232 UIFactory::makeUserInterface(UIFactory::Text);
[3027f8]2233#endif
[d7940e]2234 MainWindow *mainWindow = UIFactory::getInstance().makeMainWindow(populaters,World::getInstance().getMolecules(), configuration, World::getInstance().getPeriode(), ConfigFileName);
[12b845]2235 mainWindow->display();
[b8d1aeb]2236
[12b845]2237 delete mainWindow;
2238 }
[6ac7ee]2239
[23b547]2240 if(World::getInstance().getPeriode()->StorePeriodentafel(configuration->databasepath))
[85bc8e]2241 Log() << Verbose(0) << "Saving of elements.db successful." << endl;
[042f82]2242
[85bc8e]2243 else
2244 Log() << Verbose(0) << "Saving of elements.db failed." << endl;
[042f82]2245
[354859]2246 cleanUp(configuration);
[042f82]2247 return (0);
[14de469]2248}
2249
2250/********************************************** E N D **************************************************/
Note: See TracBrowser for help on using the repository browser.