source: src/builder.cpp@ fc6053

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 fc6053 was e6317b, checked in by Tillmann Crueger <crueger@…>, 15 years ago

Broken: Merge commit 'Gitosis/stable' into stable

Conflicts:

molecuilder/src/Actions/AnalysisAction/PairCorrelationToPointAction.cpp
molecuilder/src/Actions/AnalysisAction/PairCorrelationToSurfaceAction.cpp
molecuilder/src/Makefile.am

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