source: src/builder.cpp@ ba9f5b

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 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 ba9f5b was b9c847, checked in by Frederik Heber <heber@…>, 14 years ago

New SetOutputFormatsAction introduced.

Fixes:

new SetOutputFormatsAction:

  • new action SetOutputFormatsAction which instantiates various specializations of FormatParser in FormatParserStorage.
  • main(): mpqc, pcp and xyz and no more added by default to FormatParserStorage, this now has to be done by specifying them (e.g. on the command line as -o pcp mpqc xyz)
  • TESTFIXES: case 10,11,13,16,17,22 all failed due to the missing -o specification which has been added (this has been intended in this way from the very beginning of the ParseCommandLineOptions() refactoring)
  • action "convex-envelope" now more has ShortForm "-o" due to obvious reasons.
  • Property mode set to 100755
File size: 7.0 KB
Line 
1/** \file builder.cpp
2 *
3 * date: Jan 1, 2007
4 * author: heber
5 *
6 */
7
8/*! \mainpage MoleCuilder - a molecular set builder
9 *
10 * This introductory shall briefly make acquainted with the program, helping in installing and a first run.
11 *
12 * \section about About the Program
13 *
14 * MoleCuilder is a program, written entirely in C++, that enables the construction of a coordinate set for the
15 * atoms making up an molecule. It allows for both building of simple molecules by adding atom-wise giving bond
16 * angles and distances or absolute coordinates, but also using them as templates. Regions can be specified and
17 * ordered to be filled with a molecule in a certain manner. Greater conglomerations of molecules can be tesselated
18 * and recognized as a region themselves to be subsequently surrounded by other (surface solvated) molecules.
19 * In the end, MoleCuilder allows the construction of arbitrary nano structures, whether they be crystalline or
20 * amorphic in nature.
21 *
22 *
23 * \section install Installation
24 *
25 * Installation should without problems succeed as follows:
26 * -# ./configure (or: mkdir build;mkdir run;cd build; ../configure --bindir=../run)
27 * -# make
28 * -# make install
29 *
30 * Further useful commands are
31 * -# make clean uninstall: deletes .o-files and removes executable from the given binary directory\n
32 * -# make doxygen-doc: Creates these html pages out of the documented source
33 * -# make check: Runs an extensive set of unit tests and a testsuite which also gives a good overview on the set of
34 * functions.
35 *
36 * \section run Running
37 *
38 * The program can be executed by running: ./molecuilder
39 *
40 * MoleCuilder has three interfaces at your disposal:
41 * -# Textmenu: A simple interactive console-based menu, where awaits your choices and inputs in order to set atoms
42 * as you like
43 * -# CommandLineUI: Every command can also be chained up as a sequence of actions on the command line to be executed
44 * with any user interaction.
45 * -# GraphicalUI: A graphical user interface that also display the molecular structure being built and lots of other
46 * informations to ease the construction of bigger geometries.
47 *
48 * The supported output formats right now are:
49 * -# mpqc: Configuration files of the Massively Parallel Quantum Chemistry package (Sandia labs)
50 * -# pcp: Configuration files of the Parallel Car-Parrinello program (Institute for Numerical Simulation)
51 * -# tremolo: Configuration files of TREMOLO (Institute for Numerical Simulation)
52 * -# xyz: the most basic format for the 3d arrangement of atoms consisting of a list of element and 3 coordinates.
53 *
54 */
55
56#include "Helpers/MemDebug.hpp"
57
58#include "bondgraph.hpp"
59#include "CommandLineParser.hpp"
60#include "config.hpp"
61#include "log.hpp"
62#include "memoryusageobserver.hpp"
63#include "molecule.hpp"
64#include "periodentafel.hpp"
65#include "tesselationhelpers.hpp"
66#include "UIElements/UIFactory.hpp"
67#include "UIElements/TextUI/TextUIFactory.hpp"
68#include "UIElements/CommandLineUI/CommandLineUIFactory.hpp"
69#ifdef USE_GUI_QT
70#include "UIElements/QT4/QTUIFactory.hpp"
71#endif
72#include "UIElements/MainWindow.hpp"
73#include "UIElements/Dialog.hpp"
74#include "Menu/ActionMenuItem.hpp"
75#include "verbose.hpp"
76#include "World.hpp"
77
78#include "Actions/ActionRegistry.hpp"
79#include "Actions/ActionHistory.hpp"
80#include "Actions/MapOfActions.hpp"
81
82#include "Parser/ChangeTracker.hpp"
83#include "Parser/FormatParserStorage.hpp"
84
85#include "UIElements/UIFactory.hpp"
86#include "UIElements/TextUI/TextUIFactory.hpp"
87#include "UIElements/CommandLineUI/CommandLineUIFactory.hpp"
88#include "UIElements/MainWindow.hpp"
89#include "UIElements/Dialog.hpp"
90
91#include "version.h"
92
93
94/********************************************** Main routine **************************************/
95
96void cleanUp(){
97 FormatParserStorage::purgeInstance();
98 ChangeTracker::purgeInstance();
99 World::purgeInstance();
100 logger::purgeInstance();
101 errorLogger::purgeInstance();
102 UIFactory::purgeInstance();
103 MapOfActions::purgeInstance();
104 CommandLineParser::purgeInstance();
105 ActionRegistry::purgeInstance();
106 ActionHistory::purgeInstance();
107#ifdef LOG_OBSERVER
108 cout << observerLog().getLog();
109#endif
110 Memory::getState();
111}
112
113int main(int argc, char **argv)
114{
115 // while we are non interactive, we want to abort from asserts
116 //ASSERT_DO(Assert::Abort);
117 string line;
118 char **Arguments = NULL;
119 int ArgcSize = 0;
120 int ExitFlag = 0;
121 bool ArgumentsCopied = false;
122 std::string BondGraphFileName("\n");
123
124 // print version check whether arguments are present at all
125 cout << ESPACKVersion << endl;
126
127 setVerbosity(0);
128 // need to init the history before any action is created
129 ActionHistory::init();
130
131 // In the interactive mode, we can leave the user the choice in case of error
132 ASSERT_DO(Assert::Ask);
133
134 // from this moment on, we need to be sure to deeinitialize in the correct order
135 // this is handled by the cleanup function
136 atexit(cleanUp);
137
138 // Parse command line options and if present create respective UI
139 {
140 // construct bond graph
141 if (World::getInstance().getConfig()->BG == NULL) {
142 World::getInstance().getConfig()->BG = new BondGraph(World::getInstance().getConfig()->GetIsAngstroem());
143 if (World::getInstance().getConfig()->BG->LoadBondLengthTable(BondGraphFileName)) {
144 DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl);
145 } else {
146 DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl);
147 }
148 }
149 // handle remaining arguments by CommandLineParser
150 if (argc>1) {
151 MapOfActions::getInstance().AddOptionsToParser();
152 map <std::string, std::string> ShortFormToActionMap = MapOfActions::getInstance().getShortFormToActionMap();
153 CommandLineParser::getInstance().Run(argc,argv, ShortFormToActionMap);
154 DoLog(0) && (Log() << Verbose(0) << "Setting UI to CommandLine." << endl);
155 UIFactory::registerFactory(new CommandLineUIFactory::description());
156 UIFactory::makeUserInterface("CommandLine");
157 } else {
158 #ifdef USE_GUI_QT
159 DoLog(0) && (Log() << Verbose(0) << "Setting UI to QT4." << endl);
160 UIFactory::registerFactory(new QTUIFactory::description());
161 UIFactory::makeUserInterface("QT4");
162 #else
163 DoLog(0) && (Log() << Verbose(0) << "Setting UI to Text." << endl);
164 cout << ESPACKVersion << endl;
165 UIFactory::registerFactory(new TextUIFactory::description());
166 UIFactory::makeUserInterface("Text");
167 #endif
168 }
169 }
170
171 {
172 MainWindow *mainWindow = UIFactory::getInstance().makeMainWindow();
173 mainWindow->display();
174 delete mainWindow;
175 }
176
177 FormatParserStorage::getInstance().SaveAll();
178 ChangeTracker::getInstance().saveStatus();
179
180 // free the new argv
181 if (ArgumentsCopied) {
182 for (int i=0; i<ArgcSize;i++)
183 delete[](Arguments[i]);
184 delete[](Arguments);
185 }
186 //delete[](ConfigFileName);
187
188 ExitFlag = World::getInstance().getExitFlag();
189 return (ExitFlag == 1 ? 0 : ExitFlag);
190}
191
192/********************************************** E N D **************************************************/
Note: See TracBrowser for help on using the repository browser.