Changes in / [e6317b:f8e486]
- Files:
-
- 19 added
- 4 deleted
- 71 edited
Legend:
- Unmodified
- Added
- Removed
-
configure.ac
re6317b rf8e486 27 27 28 28 # Boost libraries 29 AX_BOOST_BASE([1. 40])29 AX_BOOST_BASE([1.33.1]) 30 30 AX_BOOST_PROGRAM_OPTIONS 31 31 #AX_BOOST_FOREACH 32 32 #AX_BOOST_FILESYSTEM 33 33 AX_BOOST_THREAD 34 #AX_BOOST_PROGRAM_OPTIONS 34 35 #AX_BOOST_SERIALIZATION 35 36 -
src/Actions/ActionRegistry.cpp
re6317b rf8e486 39 39 } 40 40 41 bool ActionRegistry::isActionByNamePresent(const std::string name){42 map<const string,Action*>::iterator iter;43 iter = actionMap.find(name);44 return iter!=actionMap.end();45 }46 47 41 void ActionRegistry::registerAction(Action* action){ 48 42 pair<map<const string,Action*>::iterator,bool> ret; -
src/Actions/ActionRegistry.hpp
re6317b rf8e486 21 21 public: 22 22 Action* getActionByName(const std::string); 23 bool isActionByNamePresent(const std::string name);24 23 void registerAction(Action*); 25 24 void unregisterAction(Action*); -
src/Actions/AnalysisAction/MolecularVolumeAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/AnalysisAction/MolecularVolumeAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "boundary.hpp" 12 13 #include "config.hpp" -
src/Actions/AnalysisAction/PairCorrelationAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/AnalysisAction/PairCorrelationAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "analysis_correlation.hpp" 12 #include "boundary.hpp"13 #include "linkedcell.hpp"14 13 #include "log.hpp" 15 14 #include "element.hpp" 16 #include "molecule.hpp"17 15 #include "periodentafel.hpp" 18 #include "vector.hpp"19 16 #include "World.hpp" 20 17 … … 40 37 Dialog *dialog = UIFactory::getInstance().makeDialog(); 41 38 int ranges[3] = {1, 1, 1}; 39 double BinStart = 0.; 42 40 double BinEnd = 0.; 43 double BinStart = 0.;44 double BinWidth = 0.;45 molecule *Boundary = NULL;46 41 string outputname; 47 42 string binoutputname; … … 49 44 ofstream output; 50 45 ofstream binoutput; 51 std::vector< element *> elements; 52 string type; 53 Vector Point; 54 BinPairMap *binmap = NULL; 55 MoleculeListClass *molecules = World::getInstance().getMolecules(); 46 const element *elemental1; 47 const element *elemental2; 56 48 57 // first dialog: Obtain which type of correlation 58 dialog->queryString(NAME, &type, MapOfActions::getInstance().getDescription(NAME)); 59 if(dialog->display()) { 60 delete dialog; 61 } else { 62 delete dialog; 63 return Action::failure; 64 } 65 66 // second dialog: Obtain parameters specific to this type 67 dialog = UIFactory::getInstance().makeDialog(); 68 if (type == "P") 69 dialog->queryVector("position", &Point, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription("position")); 70 if (type == "S") 71 dialog->queryMolecule("molecule-by-id", &Boundary, MapOfActions::getInstance().getDescription("molecule-by-id")); 72 dialog->queryElement("elements", &elements, MapOfActions::getInstance().getDescription("elements")); 49 dialog->queryElement("elements", &elemental1, MapOfActions::getInstance().getDescription("elements")); 50 dialog->queryElement("elements", &elemental2, MapOfActions::getInstance().getDescription("elements")); 73 51 dialog->queryDouble("bin-start", &BinStart, MapOfActions::getInstance().getDescription("bin-start")); 74 dialog->queryDouble("bin-width", &BinWidth, MapOfActions::getInstance().getDescription("bin-width"));75 52 dialog->queryDouble("bin-end", &BinEnd, MapOfActions::getInstance().getDescription("bin-end")); 76 53 dialog->queryString("output-file", &outputname, MapOfActions::getInstance().getDescription("output-file")); … … 82 59 binoutput.open(binoutputname.c_str()); 83 60 PairCorrelationMap *correlationmap = NULL; 84 if (type == "E") { 85 PairCorrelationMap *correlationmap = NULL; 86 if (periodic) 87 correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elements, ranges); 88 else 89 correlationmap = PairCorrelation(World::getInstance().getMolecules(), elements); 90 //OutputCorrelationToSurface(&output, correlationmap); 91 binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd ); 92 } else if (type == "P") { 93 cout << "Point to correlate to is " << Point << endl; 94 CorrelationToPointMap *correlationmap = NULL; 95 if (periodic) 96 correlationmap = PeriodicCorrelationToPoint(molecules, elements, &Point, ranges); 97 else 98 correlationmap = CorrelationToPoint(molecules, elements, &Point); 99 //OutputCorrelationToSurface(&output, correlationmap); 100 binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd ); 101 } else if (type == "S") { 102 ASSERT(Boundary != NULL, "No molecule specified for SurfaceCorrelation."); 103 const double radius = 4.; 104 double LCWidth = 20.; 105 if (BinEnd > 0) { 106 if (BinEnd > 2.*radius) 107 LCWidth = BinEnd; 108 else 109 LCWidth = 2.*radius; 110 } 111 112 // get the boundary 113 class Tesselation *TesselStruct = NULL; 114 const LinkedCell *LCList = NULL; 115 // find biggest molecule 116 int counter = molecules->ListOfMolecules.size(); 117 bool *Actives = new bool[counter]; 118 counter = 0; 119 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 120 Actives[counter++] = (*BigFinder)->ActiveFlag; 121 (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true; 122 } 123 LCList = new LinkedCell(Boundary, LCWidth); 124 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL); 125 CorrelationToSurfaceMap *surfacemap = NULL; 126 if (periodic) 127 surfacemap = PeriodicCorrelationToSurface( molecules, elements, TesselStruct, LCList, ranges); 128 else 129 surfacemap = CorrelationToSurface( molecules, elements, TesselStruct, LCList); 130 OutputCorrelationToSurface(&output, surfacemap); 131 // check whether radius was appropriate 132 { 133 double start; double end; 134 GetMinMax( surfacemap, start, end); 135 if (LCWidth < end) 136 DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell width is smaller than the found range of values! Bins can only be correct up to: " << radius << "." << endl); 137 } 138 binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd ); 139 } else 140 return Action::failure; 61 if (periodic) 62 correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elemental1, elemental2, ranges); 63 else 64 correlationmap = PairCorrelation(World::getInstance().getMolecules(), elemental1, elemental2); 65 //OutputCorrelationToSurface(&output, correlationmap); 66 BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd ); 141 67 OutputCorrelation ( &binoutput, binmap ); 142 68 output.close(); -
src/Actions/AnalysisAction/PrincipalAxisSystemAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "molecule.hpp" 12 13 #include "log.hpp" -
src/Actions/AtomAction/AddAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/AtomAction/AddAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "atom.hpp" 12 13 #include "element.hpp" 13 14 #include "log.hpp" 14 #include " molecule.hpp"15 #include "periodentafel.hpp" 15 16 #include "vector.hpp" 16 17 #include "verbose.hpp" … … 37 38 Action::state_ptr AtomAddAction::performCall() { 38 39 Dialog *dialog = UIFactory::getInstance().makeDialog(); 39 std::vector<element *> elements;40 int Z = -1; 40 41 Vector position; 41 42 42 dialog->query Element(NAME, &elements, MapOfActions::getInstance().getDescription(NAME));43 dialog->queryInt(NAME, &Z, MapOfActions::getInstance().getDescription(NAME)); 43 44 dialog->queryVector("position", &position, World::getInstance().getDomain(), true, MapOfActions::getInstance().getDescription("position")); 44 cout << "pre-dialog" << endl;45 45 46 46 if(dialog->display()) { 47 cout << "post-dialog" << endl;48 47 delete dialog; 49 if (elements.size() == 1) {50 atom * first = World::getInstance().createAtom();51 first->type = *(elements.begin());52 first->x = position;48 atom * first = World::getInstance().createAtom(); 49 first->type = World::getInstance().getPeriode()->FindElement(Z); 50 first->x = position; 51 if (first->type != NULL) { 53 52 DoLog(1) && (Log() << Verbose(1) << "Adding new atom with element " << first->type->name << " at " << (first->x) << "." << endl); 54 // TODO: remove when all of World's atoms are stored.55 std::vector<molecule *> molecules = World::getInstance().getAllMolecules();56 if (!molecules.empty()) {57 std::vector<molecule *>::iterator iter = molecules.begin();58 (*iter)->AddAtom(first);59 }60 53 return Action::success; 61 54 } else { 62 55 DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the specified element." << endl); 56 World::getInstance().destroyAtom(first); 63 57 return Action::failure; 64 58 } -
src/Actions/AtomAction/ChangeElementAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/AtomAction/ChangeElementAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "atom.hpp" 12 13 #include "log.hpp" … … 35 36 Action::state_ptr AtomChangeElementAction::performCall() { 36 37 Dialog *dialog = UIFactory::getInstance().makeDialog(); 38 int Z = -1; 37 39 atom *first = NULL; 38 std::vector<element *> elements;40 element *elemental = NULL; 39 41 40 dialog->query Atom(NAME, &first, MapOfActions::getInstance().getDescription(NAME));41 dialog->query Element("element", &elements, MapOfActions::getInstance().getDescription("element"));42 dialog->queryElement(NAME, (const element **) &elemental, MapOfActions::getInstance().getDescription(NAME)); 43 dialog->queryAtom("atom-by-id", &first, MapOfActions::getInstance().getDescription("atom-by-id")); 42 44 43 45 if(dialog->display()) { 44 46 delete dialog; 45 ASSERT(elements.size() == 1, "Unequal to one element specified when changing an atom's element"); 46 ASSERT(first != NULL, "No valid atom specified"); 47 DoLog(1) && (Log() << Verbose(1) << "Changing atom " << *first << " to element " << elements.at(0) << "." << endl); 48 if (elements.at(0) != NULL) { 49 first->type = elements.at(0); 47 DoLog(1) && (Log() << Verbose(1) << "Changing atom " << *first << " to element " << elemental << "." << endl); 48 if (elemental != NULL) { 49 first->type = elemental; 50 50 return Action::success; 51 51 } else -
src/Actions/AtomAction/RemoveAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/AtomAction/RemoveAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "atom.hpp" 12 13 #include "Descriptors/AtomDescriptor.hpp" 13 14 #include "log.hpp" 14 #include "molecule.hpp"15 15 #include "verbose.hpp" 16 16 #include "World.hpp" … … 43 43 delete dialog; 44 44 DoLog(1) && (Log() << Verbose(1) << "Removing atom " << first->getId() << "." << endl); 45 // TODO: this is not necessary when atoms and their storing to file are handled by the World46 // simply try to erase in every molecule found47 std::vector<molecule *> molecules = World::getInstance().getAllMolecules();48 for (std::vector<molecule *>::iterator iter = molecules.begin();iter != molecules.end(); ++iter) {49 (*iter)->erase(first);50 }51 45 World::getInstance().destroyAtom(first); 52 46 return Action::success; -
src/Actions/CmdAction/BondLengthTableAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/CmdAction/BondLengthTableAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "config.hpp" 12 13 #include "log.hpp" … … 41 42 42 43 if(dialog->display()) { 43 DoLog(0) && (Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl);44 44 delete dialog; 45 45 } else { 46 46 delete dialog; 47 return Action::failure;48 47 } 49 48 -
src/Actions/CmdAction/ElementDbAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/CmdAction/ElementDbAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "config.hpp" 12 13 #include "log.hpp" … … 42 43 config *configuration = World::getInstance().getConfig(); 43 44 dialog->queryString(NAME, &databasepath, MapOfActions::getInstance().getDescription(NAME)); 45 strcpy(configuration->databasepath, databasepath.c_str()); 44 46 45 47 if(dialog->display()) { 46 strcpy(configuration->databasepath, databasepath.c_str());47 48 delete dialog; 48 49 } else { 49 50 delete dialog; 50 return Action::failure;51 51 } 52 52 -
src/Actions/CmdAction/FastParsingAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/CmdAction/FastParsingAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "config.hpp" 12 13 #include "log.hpp" -
src/Actions/CmdAction/VerboseAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/CmdAction/VerboseAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "log.hpp" 12 13 #include "verbose.hpp" -
src/Actions/CmdAction/VersionAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/CmdAction/VersionAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 12 13 #include <iostream> -
src/Actions/FragmentationAction/DepthFirstSearchAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/FragmentationAction/DepthFirstSearchAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "atom.hpp" 12 13 #include "config.hpp" -
src/Actions/FragmentationAction/FragmentationAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/FragmentationAction/FragmentationAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "atom.hpp" 12 13 #include "config.hpp" … … 26 27 #include "Actions/MapOfActions.hpp" 27 28 28 const char FragmentationFragmentationAction::NAME[] = " fragment-mol";29 const char FragmentationFragmentationAction::NAME[] = "subspace-dissect"; 29 30 30 31 FragmentationFragmentationAction::FragmentationFragmentationAction() : … … 37 38 Action::state_ptr FragmentationFragmentationAction::performCall() { 38 39 Dialog *dialog = UIFactory::getInstance().makeDialog(); 39 clock_t start,end;40 molecule *mol = NULL;41 double distance = -1.;42 int order = 0;43 config *configuration = World::getInstance().getConfig();44 int ExitFlag = 0;45 40 46 cout << "pre-dialog"<< endl; 47 dialog->queryMolecule(NAME, &mol, MapOfActions::getInstance().getDescription(NAME)); 48 dialog->queryDouble("distance", &distance, MapOfActions::getInstance().getDescription("distance")); 49 dialog->queryInt("order", &order, MapOfActions::getInstance().getDescription("order")); 41 dialog->queryEmpty(NAME, MapOfActions::getInstance().getDescription(NAME)); 50 42 51 43 if(dialog->display()) { 52 cout << "POST-dialog"<< endl;53 ASSERT(mol != NULL, "No molecule has been picked for fragmentation.");54 DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with bond distance " << distance << " angstroem, order of " << order << "." << endl);55 DoLog(0) && (Log() << Verbose(0) << "Creating connection matrix..." << endl);56 start = clock();57 mol->CreateAdjacencyList(distance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL);58 DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl);59 if (mol->hasBondStructure()) {60 ExitFlag = mol->FragmentMolecule(order, configuration);61 }62 World::getInstance().setExitFlag(ExitFlag);63 end = clock();64 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl);65 44 delete dialog; 66 45 return Action::success; -
src/Actions/FragmentationAction/SubgraphDissectionAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/FragmentationAction/SubgraphDissectionAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "atom.hpp" 12 13 #include "config.hpp" … … 26 27 #include "Actions/MapOfActions.hpp" 27 28 28 const char FragmentationSubgraphDissectionAction::NAME[] = "sub graph-dissect";29 const char FragmentationSubgraphDissectionAction::NAME[] = "subspace-dissect"; 29 30 30 31 FragmentationSubgraphDissectionAction::FragmentationSubgraphDissectionAction() : … … 41 42 42 43 if(dialog->display()) { 43 DoLog(1) && (Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl);44 // @TODO rather do the dissection afterwards45 MoleculeListClass *molecules = World::getInstance().getMolecules();46 molecules->DissectMoleculeIntoConnectedSubgraphs(World::getInstance().getPeriode(), World::getInstance().getConfig());47 44 delete dialog; 48 45 return Action::success; -
src/Actions/Makefile.am
re6317b rf8e486 30 30 ${TESSELATIONACTIONHEADER} \ 31 31 ${WORLDACTIONHEADER} \ 32 MapOfActions.hpp \ 33 Values.hpp 32 MapOfActions.hpp 34 33 35 34 ANALYSISACTIONSOURCE = \ 36 35 AnalysisAction/MolecularVolumeAction.cpp \ 37 36 AnalysisAction/PairCorrelationAction.cpp \ 37 AnalysisAction/PairCorrelationToPointAction.cpp \ 38 AnalysisAction/PairCorrelationToSurfaceAction.cpp \ 38 39 AnalysisAction/PrincipalAxisSystemAction.cpp 39 40 ANALYSISACTIONHEADER = \ 40 41 AnalysisAction/MolecularVolumeAction.hpp \ 41 42 AnalysisAction/PairCorrelationAction.hpp \ 43 AnalysisAction/PairCorrelationToPointAction.hpp \ 44 AnalysisAction/PairCorrelationToSurfaceAction.hpp \ 42 45 AnalysisAction/PrincipalAxisSystemAction.hpp 43 46 -
src/Actions/MapOfActions.cpp
re6317b rf8e486 14 14 #include "Helpers/Assert.hpp" 15 15 16 #include <boost/lexical_cast.hpp>17 #include <boost/optional.hpp>18 #include <boost/program_options.hpp>19 20 16 #include "CommandLineParser.hpp" 21 17 #include "log.hpp" 22 18 #include "verbose.hpp" 23 24 #include "Actions/Values.hpp"25 26 void validate(boost::any& v, const std::vector<std::string>& values, VectorValue *, int)27 {28 VectorValue VV;29 if (values.size() != 3) {30 cerr << "Specified vector does not have three components but " << values.size() << endl;31 throw boost::program_options::validation_error("Specified vector does not have three components");32 }33 VV.x = boost::lexical_cast<double>(values.at(0));34 VV.y = boost::lexical_cast<double>(values.at(1));35 VV.z = boost::lexical_cast<double>(values.at(2));36 v = boost::any(VectorValue(VV));37 }38 39 void validate(boost::any& v, const std::vector<std::string>& values, BoxValue *, int)40 {41 BoxValue BV;42 if (values.size() != 6) {43 cerr << "Specified vector does not have three components but " << values.size() << endl;44 throw boost::program_options::validation_error("Specified symmetric box matrix does not have six components");45 }46 BV.xx = boost::lexical_cast<double>(values.at(0));47 BV.xy = boost::lexical_cast<double>(values.at(1));48 BV.xz = boost::lexical_cast<double>(values.at(2));49 BV.yy = boost::lexical_cast<double>(values.at(3));50 BV.yz = boost::lexical_cast<double>(values.at(4));51 BV.zz = boost::lexical_cast<double>(values.at(5));52 v = boost::any(BoxValue(BV));53 }54 19 55 20 /** Constructor of class MapOfActions. … … 86 51 DescriptionMap["nonconvex-envelope"] = "create the non-convex envelope for a molecule"; 87 52 DescriptionMap["molecular-volume"] = "calculate the volume of a given molecule"; 88 DescriptionMap["pair-correlation"] = "pair correlation analysis between two elements, element and point or element and surface"; 53 DescriptionMap["pair-correlation"] = "pair correlation analysis between two elements"; 54 DescriptionMap["pair-correlation-point"] = "pair correlation analysis between atoms of a element to a given point"; 55 DescriptionMap["pair-correlation-surface"] = "pair correlation analysis between atoms of a given element and a surface"; 89 56 DescriptionMap["parse-xyz"] = "parse xyz file into World"; 90 57 DescriptionMap["principal-axis-system"] = "calculate the principal axis system of the specified molecule"; … … 98 65 DescriptionMap["save-temperature"] = "name of the temperature file to write to"; 99 66 DescriptionMap["scale-box"] = "scale box and atomic positions inside"; 100 DescriptionMap["sub graph-dissect"] = "dissect the molecular system into molecules representing disconnected subgraphs";67 DescriptionMap["subspace-dissect"] = "dissect the molecular system into molecules representing disconnected subgraphs"; 101 68 DescriptionMap["suspend-in-water"] = "suspend the given molecule in water such that in the domain the mean density is as specified"; 102 69 DescriptionMap["translate-mol"] = "translate molecule by given vector"; … … 105 72 DescriptionMap["version"] = "show version"; 106 73 // keys for values 107 DescriptionMap["atom-by-id"] = "index of an atom";108 74 DescriptionMap["bin-output-file"] = "name of the bin output file"; 109 75 DescriptionMap["bin-end"] = "start of the last bin"; 110 76 DescriptionMap["bin-start"] = "start of the first bin"; 111 77 DescriptionMap["bin-width"] = "width of the bins"; 112 DescriptionMap["convex-file"] = "filename of the non-convex envelope";113 78 DescriptionMap["distance"] = "distance in space"; 114 79 DescriptionMap["distances"] = "list of three of distances in space, one for each axis direction"; 115 DescriptionMap["DoRotate"] = "whether to rotate or just report angles"; 116 DescriptionMap["element"] = "single element"; 117 DescriptionMap["elements"] = "set of elements"; 118 DescriptionMap["end-step"] = "last or end step"; 119 DescriptionMap["id-mapping"] = "whether the identity shall be used in mapping atoms onto atoms or some closest distance measure shall be used"; 80 DescriptionMap["element"] = "set of elements"; 81 DescriptionMap["end-mol"] = "last or end step"; 120 82 DescriptionMap["input"] = "name of input file"; 121 83 DescriptionMap["length"] = "length in space"; … … 123 85 DescriptionMap["MaxDistance"] = "maximum distance in space"; 124 86 DescriptionMap["molecule-by-id"] = "index of a molecule"; 125 DescriptionMap["molecule-by-name"] = "name of a molecule";126 DescriptionMap["nonconvex-file"] = "filename of the non-convex envelope";127 DescriptionMap["order"] = "order of a discretization, dissection, ...";128 87 DescriptionMap["output-file"] = "name of the output file"; 129 88 DescriptionMap["periodic"] = "system is constraint to periodic boundary conditions (y/n)"; 130 89 DescriptionMap["position"] = "position in R^3 space"; 131 DescriptionMap["sphere-radius"] = "radius of tesselation sphere"; 132 DescriptionMap["start-step"] = "first or start step"; 90 DescriptionMap["start-mol"] = "first or start step"; 133 91 134 92 // short forms for the actions … … 152 110 ShortFormMap["linear-interpolate"] = "L"; 153 111 ShortFormMap["nonconvex-envelope"] = "N"; 154 ShortFormMap["pair-correlation"] = "C"; 112 ShortFormMap["pair-correlation"] = "CE"; 113 ShortFormMap["pair-correlation-point"] = "CP"; 114 ShortFormMap["pair-correlation-surface"] = "CS"; 155 115 ShortFormMap["parse-xyz"] = "p"; 156 116 ShortFormMap["remove-atom"] = "r"; … … 163 123 ShortFormMap["scale-box"] = "s"; 164 124 ShortFormMap["set-basis"] = "M"; 165 ShortFormMap["sub graph-dissect"] = "I";166 ShortFormMap["suspend-in-water"] = " u";125 ShortFormMap["subspace-dissect"] = "I"; 126 ShortFormMap["suspend-in-water"] = "U"; 167 127 ShortFormMap["translate-mol"] = "t"; 168 128 ShortFormMap["verbose"] = "v"; … … 171 131 172 132 // value types for the actions 173 TypeMap["add-atom"] = Element;133 TypeMap["add-atom"] = Atom; 174 134 TypeMap["bond-file"] = String; 175 135 TypeMap["bond-table"] = String; 176 136 TypeMap["boundary"] = Vector; 177 TypeMap["center-in-box"] = Box;178 TypeMap["change-box"] = Box;179 TypeMap["change-element"] = Atom;137 TypeMap["center-in-box"] = ListOfDoubles; 138 TypeMap["change-box"] = ListOfDoubles; 139 TypeMap["change-element"] = Element; 180 140 TypeMap["change-molname"] = String; 181 141 TypeMap["convex-envelope"] = Molecule; … … 183 143 TypeMap["depth-first-search"] = Double; 184 144 TypeMap["element-db"] = String; 145 TypeMap["end-mol"] = Molecule; 185 146 TypeMap["fastparsing"] = Boolean; 186 147 TypeMap["fill-molecule"] = String; … … 191 152 TypeMap["nonconvex-envelope"] = Molecule; 192 153 TypeMap["parse-xyz"] = String; 193 TypeMap["pair-correlation"] = String; 194 TypeMap["principal-axis-system"] = Molecule; 154 TypeMap["principal-axis-system"] = Axis; 195 155 TypeMap["remove-atom"] = Atom; 196 TypeMap["remove-sphere"] = Double;156 TypeMap["remove-sphere"] = Atom; 197 157 TypeMap["repeat-box"] = Vector; 198 158 TypeMap["rotate-to-pas"] = Molecule; … … 202 162 TypeMap["scale-box"] = Vector; 203 163 TypeMap["set-basis"] = String; 204 TypeMap["s ubgraph-dissect"] = None;205 TypeMap["suspend-in-water"] = Double;164 TypeMap["start-mol"] = Molecule; 165 TypeMap["suspend-in-water"] = Molecule; 206 166 TypeMap["translate-mol"] = Vector; 207 167 TypeMap["verlet-integrate"] = String; … … 209 169 210 170 // value types for the values 211 TypeMap["atom-by-id"] = Atom;212 171 TypeMap["bin-output-file"] = String; 213 172 TypeMap["bin-end"] = Double; 214 173 TypeMap["bin-start"] = Double; 215 TypeMap["bin-width"] = Double;216 TypeMap["convex-file"] = String;217 174 TypeMap["distance"] = Double; 218 TypeMap["distances"] = Vector; 219 TypeMap["DoRotate"] = Boolean; 220 TypeMap["element"] = Element; 175 TypeMap["distances"] = ListOfDoubles; 176 TypeMap["elements"] = Element; 221 177 TypeMap["elements"] = ListOfElements; 222 TypeMap["end-step"] = Integer;223 TypeMap["id-mapping"] = Boolean;224 178 TypeMap["length"] = Double; 225 TypeMap["lengths"] = Vector;179 TypeMap["lengths"] = ListOfDoubles; 226 180 TypeMap["MaxDistance"] = Double; 227 181 TypeMap["molecule-by-id"] = Molecule; 228 TypeMap["molecule-by-name"] = Molecule;229 TypeMap["nonconvex-file"] = String;230 TypeMap["order"] = Integer;231 182 TypeMap["output-file"] = String; 232 183 TypeMap["periodic"] = Boolean; 233 184 TypeMap["position"] = Vector; 234 TypeMap["sphere-radius"] = Double;235 TypeMap["start-step"] = Integer;236 185 237 186 // default values for any action that needs one (always string!) 238 DefaultValue["bin-width"] = "0.5";239 DefaultValue["fastparsing"] = "0";240 DefaultValue["atom-by-id"] = "-1";241 187 DefaultValue["molecule-by-id"] = "-1"; 242 DefaultValue["periodic"] = "0";243 188 244 189 245 190 // list of generic actions 246 generic.insert("add-atom");247 generic.insert("bond-file");248 generic.insert("bond-table");191 // generic.insert("add-atom"); 192 // generic.insert("bond-file"); 193 // generic.insert("bond-table"); 249 194 generic.insert("boundary"); 250 195 // generic.insert("bound-in-box"); … … 253 198 generic.insert("change-box"); 254 199 // generic.insert("change-molname"); 255 generic.insert("change-element");256 generic.insert("convex-envelope");257 generic.insert("default-molname");258 generic.insert("depth-first-search");259 generic.insert("element-db");260 generic.insert("fastparsing");261 generic.insert("fill-molecule");262 generic.insert("fragment-mol");200 // generic.insert("change-element"); 201 // generic.insert("convex-envelope"); 202 // generic.insert("default-molname"); 203 // generic.insert("depth-first-search"); 204 // generic.insert("element-db"); 205 // generic.insert("fastparsing"); 206 // generic.insert("fill-molecule"); 207 // generic.insert("fragment-mol"); 263 208 generic.insert("help"); 264 generic.insert("linear-interpolate");209 // generic.insert("linear-interpolate"); 265 210 // generic.insert("molecular-volume"); 266 generic.insert("nonconvex-envelope"); 267 generic.insert("pair-correlation"); 211 // generic.insert("nonconvex-envelope"); 212 // generic.insert("pair-correlation"); 213 // generic.insert("pair-correlation-point"); 214 // generic.insert("pair-correlation-surface"); 268 215 // generic.insert("parse-xyz"); 269 216 // generic.insert("principal-axis-system"); 270 generic.insert("remove-atom");271 generic.insert("remove-sphere");272 generic.insert("repeat-box");273 generic.insert("rotate-to-pas");274 generic.insert("save-adjacency");275 generic.insert("save-bonds");276 generic.insert("save-temperature");217 // generic.insert("remove-atom"); 218 // generic.insert("remove-sphere"); 219 generic.insert("repeat-box"); 220 // generic.insert("rotate-to-pas"); 221 // generic.insert("save-adjacency"); 222 // generic.insert("save-bonds"); 223 // generic.insert("save-temperature"); 277 224 generic.insert("scale-box"); 278 generic.insert("set-basis");279 generic.insert("subgraph-dissect");280 generic.insert("suspend-in-water");281 generic.insert("translate-mol");225 // generic.insert("set-basis"); 226 // generic.insert("subspace-dissect"); 227 // generic.insert("suspend-in-water"); 228 // generic.insert("translate-mol"); 282 229 generic.insert("verbose"); 283 generic.insert("verlet-integrate");230 // generic.insert("verlet-integrate"); 284 231 generic.insert("version"); 232 // // list of generic values 233 // generic.insert("bin-output-file"); 234 // generic.insert("bin-end"); 235 // generic.insert("bin-start"); 236 // generic.insert("distance"); 237 // generic.insert("distances"); 238 // generic.insert("element"); 239 // generic.insert("end-mol"); 240 generic.insert("input"); 241 // generic.insert("length"); 242 // generic.insert("lengths"); 243 // generic.insert("MaxDistance"); 244 // generic.insert("molecule-by-id"); 245 // generic.insert("output-file"); 246 // generic.insert("periodic"); 247 // generic.insert("position"); 248 // generic.insert("start-mol"); 285 249 286 250 // positional arguments 287 generic.insert("input"); 288 inputfile.insert("input"); 289 290 // hidden arguments 291 generic.insert("atom-by-id"); 292 generic.insert("bin-end"); 293 generic.insert("bin-output-file"); 294 generic.insert("bin-start"); 295 generic.insert("bin-width"); 296 generic.insert("convex-file"); 297 generic.insert("distance"); 298 generic.insert("DoRotate"); 299 generic.insert("distances"); 300 generic.insert("element"); 301 generic.insert("elements"); 302 generic.insert("end-step"); 303 generic.insert("id-mapping"); 304 generic.insert("lengths"); 305 generic.insert("MaxDistance"); 306 generic.insert("molecule-by-id"); 307 generic.insert("molecule-by-name"); 308 generic.insert("nonconvex-file"); 309 generic.insert("order"); 310 generic.insert("output-file"); 311 generic.insert("periodic"); 312 generic.insert("position"); 313 generic.insert("sphere-radius"); 314 generic.insert("start-step"); 251 inputfile.insert("input"); 315 252 } 316 253 … … 349 286 ; 350 287 break; 351 case Box:352 ListRunner->second->add_options()353 (getKeyAndShortForm(*OptionRunner).c_str(),354 po::value<BoxValue>()->multitoken(),355 getDescription(*OptionRunner).c_str())356 ;357 break;358 288 case Integer: 359 289 ListRunner->second->add_options() … … 409 339 ListRunner->second->add_options() 410 340 (getKeyAndShortForm(*OptionRunner).c_str(), 411 po::value<VectorValue>()->multitoken(), 341 po::value< vector<double> >()->multitoken(), 342 getDescription(*OptionRunner).c_str()) 343 ; 344 break; 345 case Box: 346 ListRunner->second->add_options() 347 (getKeyAndShortForm(*OptionRunner).c_str(), 348 po::value< vector<double> >(), 412 349 getDescription(*OptionRunner).c_str()) 413 350 ; … … 448 385 ListRunner->second->add_options() 449 386 (getKeyAndShortForm(*OptionRunner).c_str(), 450 po::value< vector<int> >(), 387 DefaultValue.find(*OptionRunner) != DefaultValue.end() ? 388 po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) : 389 po::value< int >(), 451 390 getDescription(*OptionRunner).c_str()) 452 391 ; … … 558 497 } 559 498 560 /** Returns the inverse to MapOfActions::ShortFormMap, i.e. lookup actionname for its short form.561 * \return map from short form of action to name of action562 */563 map <std::string, std::string> MapOfActions::getShortFormToActionMap()564 {565 map <std::string, std::string> result;566 567 for (map<std::string, std::string>::iterator iter = ShortFormMap.begin(); iter != ShortFormMap.end(); ++iter)568 result[iter->second] = iter->first;569 570 return result;571 }572 499 573 500 -
src/Actions/MapOfActions.hpp
re6317b rf8e486 30 30 std::string getKeyAndShortForm(string actionname); 31 31 std::string getShortForm(string actionname); 32 map <std::string, std::string> getShortFormToActionMap();33 32 34 33 void AddOptionsToParser(); -
src/Actions/MoleculeAction/FillWithMoleculeAction.cpp
re6317b rf8e486 68 68 69 69 if(dialog->display()) { 70 DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules, lengths(" << lengths[0] << "," << lengths[1] << "," << lengths[2] << "), distances (" << distances[0] << "," << distances[1] << "," << distances[2] << "), MaxDistance " << MaxDistance << ", DoRotate " << DoRotate << "." << endl);71 70 // construct water molecule 72 71 molecule *filler = World::getInstance().createMolecule(); 73 if (!filler->AddXYZFile(filename)) {74 DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << filename << "." << endl);75 }76 filler->SetNameFromFilename(filename.c_str());72 // if (!filler->AddXYZFile(filename)) { 73 // DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << filename << "." << endl); 74 // } 75 // filler->SetNameFromFilename(filename); 77 76 molecule *Filling = NULL; 78 //atom *first = NULL, *second = NULL, *third = NULL;79 //first = World::getInstance().createAtom();80 //first->type = World::getInstance().getPeriode()->FindElement(1);81 //first->x = Vector(0.441, -0.143, 0.);82 //filler->AddAtom(first);83 //second = World::getInstance().createAtom();84 //second->type = World::getInstance().getPeriode()->FindElement(1);85 //second->x = Vector(-0.464, 1.137, 0.0);86 //filler->AddAtom(second);87 //third = World::getInstance().createAtom();88 //third->type = World::getInstance().getPeriode()->FindElement(8);89 //third->x = Vector(-0.464, 0.177, 0.);90 //filler->AddAtom(third);91 //filler->AddBond(first, third, 1);92 //filler->AddBond(second, third, 1);77 atom *first = NULL, *second = NULL, *third = NULL; 78 first = World::getInstance().createAtom(); 79 first->type = World::getInstance().getPeriode()->FindElement(1); 80 first->x = Vector(0.441, -0.143, 0.); 81 filler->AddAtom(first); 82 second = World::getInstance().createAtom(); 83 second->type = World::getInstance().getPeriode()->FindElement(1); 84 second->x = Vector(-0.464, 1.137, 0.0); 85 filler->AddAtom(second); 86 third = World::getInstance().createAtom(); 87 third->type = World::getInstance().getPeriode()->FindElement(8); 88 third->x = Vector(-0.464, 0.177, 0.); 89 filler->AddAtom(third); 90 filler->AddBond(first, third, 1); 91 filler->AddBond(second, third, 1); 93 92 World::getInstance().getConfig()->BG->ConstructBondGraph(filler); 94 //filler->SetNameFromFilename("water");93 filler->SetNameFromFilename("water"); 95 94 // call routine 96 95 double distance[NDIM]; -
src/Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp
re6317b rf8e486 60 60 61 61 dialog->queryString(NAME, &filename, MapOfActions::getInstance().getDescription(NAME)); 62 dialog->queryInt("start- step", &start, MapOfActions::getInstance().getDescription("start-step"));63 dialog->queryInt("end- step", &end, MapOfActions::getInstance().getDescription("end-step"));62 dialog->queryInt("start-mol", &start, MapOfActions::getInstance().getDescription("start")); 63 dialog->queryInt("end-mol", &start, MapOfActions::getInstance().getDescription("end")); 64 64 dialog->queryMolecule("molecule-by-id", &mol, MapOfActions::getInstance().getDescription("molecule-by-id")); 65 65 dialog->queryBoolean("id-mapping", &IdMapping, MapOfActions::getInstance().getDescription("id-mapping")); -
src/Actions/MoleculeAction/TranslateAction.cpp
re6317b rf8e486 58 58 dialog->queryMolecule("molecule-by-id", &mol, MapOfActions::getInstance().getDescription("molecule-by-id")); 59 59 dialog->queryBoolean("periodic", &periodic, MapOfActions::getInstance().getDescription("periodic")); 60 cout << "pre-dialog" << endl;61 60 62 61 if(dialog->display()) { 63 cout << "post-dialog" << endl;64 62 DoLog(1) && (Log() << Verbose(1) << "Translating all ions by given vector." << endl); 65 63 if (periodic) -
src/Actions/TesselationAction/ConvexEnvelopeAction.cpp
re6317b rf8e486 21 21 #include "atom.hpp" 22 22 #include "boundary.hpp" 23 #include "config.hpp"24 23 #include "linkedcell.hpp" 25 24 #include "log.hpp" … … 57 56 molecule * mol = NULL; 58 57 bool Success = false; 59 config *configuration = World::getInstance().getConfig();60 58 61 59 dialog->queryMolecule(NAME, &mol, MapOfActions::getInstance().getDescription(NAME)); 62 dialog->queryString(" convex-file", &filenameConvex, MapOfActions::getInstance().getDescription("convex-file"));63 dialog->queryString(" nonconvex-file", &filenameNonConvex, MapOfActions::getInstance().getDescription("nonconvex-file"));60 dialog->queryString("output", &filenameConvex, MapOfActions::getInstance().getDescription("output")); 61 dialog->queryString("output", &filenameNonConvex, MapOfActions::getInstance().getDescription("output")); 64 62 65 63 if(dialog->display()) { … … 74 72 FindNonConvexBorder(mol, TesselStruct, LCList, 50., filenameNonConvex.c_str()); 75 73 //RemoveAllBoundaryPoints(TesselStruct, mol, argv[argptr]); 76 const double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, filenameConvex.c_str()); 77 const double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration); 78 DoLog(0) && (Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration->GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl); 79 DoLog(0) && (Log() << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration->GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl); 74 ConvexizeNonconvexEnvelope(TesselStruct, mol, filenameConvex.c_str()); 80 75 delete(TesselStruct); 81 76 delete(LCList); -
src/Actions/TesselationAction/NonConvexEnvelopeAction.cpp
re6317b rf8e486 58 58 clock_t start,end; 59 59 60 dialog->query Molecule(NAME, &Boundary, MapOfActions::getInstance().getDescription(NAME));61 dialog->queryString(" nonconvex-file", &filename, MapOfActions::getInstance().getDescription("nonconvex-file"));62 dialog->query Double("sphere-radius", &SphereRadius, MapOfActions::getInstance().getDescription("sphere-radius"));60 dialog->queryDouble(NAME, &SphereRadius, MapOfActions::getInstance().getDescription(NAME)); 61 dialog->queryString("output", &filename, MapOfActions::getInstance().getDescription("output")); 62 dialog->queryMolecule("molecule-by-id", &Boundary, MapOfActions::getInstance().getDescription("molecule-by-id")); 63 63 64 64 if(dialog->display()) { -
src/Actions/WorldAction/AddEmptyBoundaryAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/WorldAction/AddEmptyBoundaryAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "atom.hpp" 12 13 #include "log.hpp" -
src/Actions/WorldAction/BoundInBoxAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/WorldAction/BoundInBoxAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "log.hpp" 12 13 #include "molecule.hpp" -
src/Actions/WorldAction/CenterInBoxAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/WorldAction/CenterInBoxAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "log.hpp" 12 13 #include "molecule.hpp" -
src/Actions/WorldAction/CenterOnEdgeAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/WorldAction/CenterOnEdgeAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "atom.hpp" 12 13 #include "log.hpp" -
src/Actions/WorldAction/ChangeBoxAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/WorldAction/ChangeBoxAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "log.hpp" 12 13 #include "verbose.hpp" -
src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/WorldAction/RemoveSphereOfAtomsAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "atom.hpp" 12 13 #include "Descriptors/AtomDescriptor.hpp" 13 14 #include "log.hpp" 14 #include "molecule.hpp"15 15 #include "vector.hpp" 16 16 #include "verbose.hpp" … … 38 38 Dialog *dialog = UIFactory::getInstance().makeDialog(); 39 39 double radius = 0.; 40 Vector point;40 atom *first = NULL; 41 41 42 42 dialog->queryDouble(NAME, &radius, MapOfActions::getInstance().getDescription(NAME)); 43 dialog->query Vector("position", &point, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription("position"));43 dialog->queryAtom("atom-by-id", &first, MapOfActions::getInstance().getDescription("atom-by-id")); 44 44 45 45 if(dialog->display()) { 46 46 delete dialog; 47 DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << point<< " with radius " << radius << "." << endl);47 DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << first->nr << " with radius " << radius << "." << endl); 48 48 vector<atom*> AllAtoms = World::getInstance().getAllAtoms(); 49 vector<molecule *> molecules = World::getInstance().getAllMolecules(); 50 for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) { 51 if (point.DistanceSquared((*AtomRunner)->x) > radius*radius) { // distance to first above radius ... 52 // TODO: This is not necessary anymore when atoms are completely handled by World (create/destroy and load/save) 53 for (vector<molecule *>::iterator iter = molecules.begin();iter != molecules.end();++iter) 54 (*iter)->erase(*AtomRunner); 55 World::getInstance().destroyAtom(*AtomRunner); 56 } 49 vector<atom*>::iterator AtomAdvancer = AllAtoms.begin(); 50 for (vector<atom*>::iterator AtomRunner = AtomAdvancer; AtomRunner != AllAtoms.end(); ) { 51 ++AtomAdvancer; 52 if (first != *AtomRunner) // dont't destroy reference ... 53 if (first->x.DistanceSquared((*AtomRunner)->x) > radius*radius) // distance to first above radius ... 54 World::getInstance().destroyAtom(*AtomRunner); 57 55 } 56 World::getInstance().destroyAtom(first); 58 57 return Action::success; 59 58 } else { -
src/Actions/WorldAction/RepeatBoxAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/WorldAction/RepeatBoxAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "atom.hpp" 12 13 #include "log.hpp" -
src/Actions/WorldAction/ScaleBoxAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/WorldAction/ScaleBoxAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "atom.hpp" 12 13 #include "log.hpp" -
src/Actions/WorldAction/SetDefaultNameAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/WorldAction/SetDefaultNameAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "log.hpp" 12 #include "verbose.hpp"13 13 #include "World.hpp" 14 14 … … 39 39 40 40 if(dialog->display()) { 41 World::getInstance().setDefaultName(defaultname); 42 DoLog(0) && (Log() << Verbose(0) << "Default name of new molecules set to " << World::getInstance().getDefaultName() << "." << endl); 41 char outputname[MAXSTRINGSIZE]; 42 strcpy(outputname, defaultname.c_str()); 43 World::getInstance().setDefaultName(outputname); 43 44 delete dialog; 44 45 return Action::success; -
src/Actions/WorldAction/SetGaussianBasisAction.cpp
re6317b rf8e486 9 9 10 10 #include "Actions/WorldAction/SetGaussianBasisAction.hpp" 11 #include "CommandLineParser.hpp" 11 12 #include "config.hpp" 12 #include "log.hpp"13 #include "verbose.hpp"14 13 #include "World.hpp" 15 14 … … 34 33 Action::state_ptr WorldSetGaussianBasisAction::performCall() { 35 34 Dialog *dialog = UIFactory::getInstance().makeDialog(); 36 config *configuration = World::getInstance().getConfig(); 37 dialog->queryString(NAME, & (configuration->basis), MapOfActions::getInstance().getDescription(NAME));35 36 dialog->queryString(NAME, &World::getInstance().getConfig()->basis, MapOfActions::getInstance().getDescription(NAME)); 38 37 39 38 if(dialog->display()) { 40 DoLog(1) && (Log() << Verbose(1) << "Setting MPQC basis to " << configuration->basis << "." << endl);41 39 delete dialog; 42 40 return Action::success; -
src/CommandLineParser.cpp
re6317b rf8e486 11 11 #include <fstream> 12 12 #include <iostream> 13 #include <map>14 13 15 14 #include "Patterns/Singleton_impl.hpp" 16 15 #include "CommandLineParser.hpp" 17 #include "log.hpp"18 #include "verbose.hpp"19 16 20 17 using namespace std; … … 50 47 } 51 48 52 /** Scan the argument list for -a or --arguments and store their order for later use.53 * \param &ShortFormToActionMap e.g. gives "help" for "h"54 */55 void CommandLineParser::scanforSequenceOfArguments(map <std::string, std::string> &ShortFormToActionMap)56 {57 // go through all arguments58 for (int i=1;i<argc;i++) {59 (cout << Verbose(1) << "Checking on " << argv[i] << endl);60 // check whether they begin with - or -- and check that next letter is not numeric, if so insert61 if (argv[i][0] == '-') {62 (cout << Verbose(1) << "Possible argument: " << argv[i] << endl);63 if (argv[i][1] == '-') {64 (cout << Verbose(1) << "Putting " << argv[i] << " into the sequence." << endl);65 SequenceOfActions.push_back(&(argv[i][2]));66 } else if (((argv[i][1] < '0') || (argv[i][1] > '9')) && ((argv[i][1] != '.'))) {67 map <std::string, std::string>::iterator iter = ShortFormToActionMap.find(&(argv[i][1]));68 if (iter != ShortFormToActionMap.end()) {69 (cout << Verbose(1) << "Putting " << iter->second << " for " << iter->first << " into the sequence." << endl);70 SequenceOfActions.push_back(iter->second);71 }72 }73 }74 }75 }76 49 77 50 … … 101 74 * \param **_argv argument array from main() 102 75 */ 103 void CommandLineParser::Run(int _argc, char **_argv , map <std::string, std::string> &ShortFormToActionMap)76 void CommandLineParser::Run(int _argc, char **_argv) 104 77 { 105 78 setOptions(_argc,_argv); 106 79 Parse(); 107 scanforSequenceOfArguments(ShortFormToActionMap);108 80 } 109 81 -
src/CommandLineParser.hpp
re6317b rf8e486 15 15 #include "Patterns/Singleton.hpp" 16 16 17 #include <list>18 17 19 18 class CommandLineParser : public Singleton<CommandLineParser> { … … 22 21 23 22 // Parses the command line arguments in CommandLineParser::**argv with currently known options. 24 void Run(int _argc, char **_argv , std::map <std::string, std::string> &ShortFormToActionMap);23 void Run(int _argc, char **_argv); 25 24 26 25 // Checks whether there have been any commands on the command line. … … 41 40 po::variables_map vm; 42 41 43 // private sequence of actions as they appeared on the command line44 std::list<std::string> SequenceOfActions;45 46 42 private: 47 43 // private constructor and destructor … … 61 57 void Parse(); 62 58 63 // as boost's program_options does not care about of order of appearance but we do for actions,64 // we have to have a list and a function to obtain it.65 void scanforSequenceOfArguments(std::map <std::string, std::string> &ShortFormToActionMap);66 67 59 // argument counter and array passed on from main() 68 60 int argc; -
src/Helpers/MemDebug.hpp
re6317b rf8e486 33 33 // to be loaded before the define 34 34 #include <string> 35 #include <boost/optional.hpp>36 35 #include <boost/shared_ptr.hpp> 37 36 #include <boost/function.hpp> -
src/Legacy/oldmenu.cpp
re6317b rf8e486 87 87 Dialog *dialog = UIFactory::getInstance().makeDialog(); 88 88 first = World::getInstance().createAtom(); 89 std::vector<element *> elements;90 89 dialog->queryVector("Please enter coordinates: ",&first->x,World::getInstance().getDomain(), false); 91 dialog->queryElement("Please choose element: ",& elements);90 dialog->queryElement("Please choose element: ",&first->type); 92 91 if(dialog->display()){ 93 if (elements.size() == 1) { 94 first->type = elements.at(0); 95 mol->AddAtom(first); // add to molecule 96 } else { 97 DoeLog(1) && (eLog() << Verbose(1) << "Unequal to one element given for element of new atom." << endl); 98 } 92 mol->AddAtom(first); // add to molecule 99 93 } 100 94 else{ -
src/Makefile.am
re6317b rf8e486 114 114 Descriptors/MoleculeDescriptor.cpp \ 115 115 Descriptors/MoleculeIdDescriptor.cpp \ 116 Descriptors/MoleculeNameDescriptor.cpp \117 116 Descriptors/MoleculePtrDescriptor.cpp 118 117 … … 123 122 Descriptors/MoleculeDescriptor.hpp \ 124 123 Descriptors/MoleculeIdDescriptor.hpp \ 125 Descriptors/MoleculeNameDescriptor.hpp \126 124 Descriptors/MoleculePtrDescriptor.hpp 127 125 … … 239 237 libmolecuilder_a_SOURCES = ${SOURCE} ${HEADER} 240 238 libgslwrapper_a_SOURCES = ${LINALGSOURCE} ${LINALGHEADER} 241 molecuilder_DATA = elements.db valence.db orbitals.db Hbonddistance.db Hbondangle.db242 239 molecuilder_LDFLAGS = $(BOOST_LDFLAGS) 243 240 molecuilder_SOURCES = builder.cpp -
src/UIElements/CommandLineUI/CommandLineDialog.cpp
re6317b rf8e486 8 8 #include "Helpers/MemDebug.hpp" 9 9 10 #include <cassert> 10 11 #include <iostream> 11 #include <vector>12 12 13 13 #include <Descriptors/AtomDescriptor.hpp> … … 16 16 #include <Descriptors/MoleculeIdDescriptor.hpp> 17 17 #include "CommandLineUI/CommandLineDialog.hpp" 18 19 #include "Actions/Values.hpp"20 18 21 19 #include "element.hpp" … … 81 79 } 82 80 83 void CommandLineDialog::queryElement(const char* title, std::vector<element *>*target, string _description){81 void CommandLineDialog::queryElement(const char* title, const element **target, string _description){ 84 82 registerQuery(new ElementCommandLineQuery(title,target, _description)); 85 83 } … … 108 106 tmp = CommandLineParser::getInstance().vm[getTitle()].as<int>(); 109 107 return true; 110 } else { 111 DoeLog(1) && (eLog() << Verbose(1) << "CommandLineUI parsing error: Missing integer for " << getTitle() << "." << endl); 112 return false; 113 } 108 } else 109 return false; 114 110 } 115 111 … … 121 117 122 118 bool CommandLineDialog::BooleanCommandLineQuery::handle() { 123 if (CommandLineParser::getInstance().vm.count(getTitle())) { 124 tmp = CommandLineParser::getInstance().vm[getTitle()].as<bool>(); 125 return true; 126 } else { 127 DoeLog(1) && (eLog() << Verbose(1) << "CommandLineUI parsing error: Missing boolean for " << getTitle() << "." << endl); 128 return false; 129 } 119 bool badInput = false; 120 char input = ' '; 121 do{ 122 badInput = false; 123 Log() << Verbose(0) << getTitle(); 124 cin >> input; 125 if ((input == 'y' ) || (input == 'Y')) { 126 tmp = true; 127 } else if ((input == 'n' ) || (input == 'N')) { 128 tmp = false; 129 } else { 130 badInput=true; 131 cin.clear(); 132 cin.ignore(std::numeric_limits<streamsize>::max(),'\n'); 133 Log() << Verbose(0) << "Input was not of [yYnN]!" << endl; 134 } 135 } while(badInput); 136 // clear the input buffer of anything still in the line 137 cin.ignore(std::numeric_limits<streamsize>::max(),'\n'); 138 return true; 130 139 } 131 140 … … 140 149 tmp = CommandLineParser::getInstance().vm[getTitle()].as<string>(); 141 150 return true; 142 } else { 143 DoeLog(1) && (eLog() << Verbose(1) << "CommandLineUI parsing error: Missing string for " << getTitle() << "." << endl); 144 return false; 145 } 151 } else 152 return false; 146 153 } 147 154 … … 156 163 tmp = CommandLineParser::getInstance().vm[getTitle()].as<double>(); 157 164 return true; 158 } else { 159 DoeLog(1) && (eLog() << Verbose(1) << "CommandLineUI parsing error: Missing double for " << getTitle() << "." << endl); 160 return false; 161 } 165 } else 166 return false; 162 167 } 163 168 … … 174 179 tmp = World::getInstance().getAtom(AtomById(IdxOfAtom)); 175 180 return true; 176 } else { 177 DoeLog(1) && (eLog() << Verbose(1) << "CommandLineUI parsing error: Missing atom for " << getTitle() << "." << endl); 178 return false; 179 } 181 } else 182 return false; 180 183 } 181 184 … … 196 199 tmp = NULL; 197 200 return true; 198 } else { 199 DoeLog(1) && (eLog() << Verbose(1) << "CommandLineUI parsing error: Missing molecule for " << getTitle() << "." << endl); 200 return false; 201 } 201 } else 202 return false; 202 203 } 203 204 … … 210 211 211 212 bool CommandLineDialog::VectorCommandLineQuery::handle() { 212 VectorValue temp; 213 if (CommandLineParser::getInstance().vm.count(getTitle())) { 214 temp = CommandLineParser::getInstance().vm[getTitle()].as< VectorValue >(); 215 tmp->at(0) = temp.x; 216 tmp->at(1) = temp.y; 217 tmp->at(2) = temp.z; 218 return true; 219 } else { 220 DoeLog(1) && (eLog() << Verbose(1) << "CommandLineUI parsing error: Missing vector for " << getTitle() << "." << endl); 221 return false; 222 } 213 vector<double> temp; 214 if (CommandLineParser::getInstance().vm.count(getTitle())) { 215 temp = CommandLineParser::getInstance().vm[getTitle()].as<vector<double> >(); 216 assert((temp.size() == 3) && "Vector from command line does not have three components."); 217 for (int i=0;i<NDIM;i++) 218 tmp->at(i) = temp[i]; 219 return true; 220 } else 221 return false; 223 222 } 224 223 … … 232 231 233 232 bool CommandLineDialog::BoxCommandLineQuery::handle() { 234 BoxValue temp; 235 if (CommandLineParser::getInstance().vm.count(getTitle())) { 236 temp = CommandLineParser::getInstance().vm[getTitle()].as< BoxValue >(); 237 tmp[0] = temp.xx; 238 tmp[1] = temp.xy; 239 tmp[2] = temp.xz; 240 tmp[3] = temp.yy; 241 tmp[4] = temp.yz; 242 tmp[5] = temp.zz; 243 return true; 244 } else { 245 DoeLog(1) && (eLog() << Verbose(1) << "CommandLineUI parsing error: Missing symmetric box matrix for " << getTitle() << "." << endl); 246 return false; 247 } 248 } 249 250 CommandLineDialog::ElementCommandLineQuery::ElementCommandLineQuery(string title, std::vector<element *> *target, string _description) : 233 vector<double> temp; 234 if (CommandLineParser::getInstance().vm.count(getTitle())) { 235 temp = CommandLineParser::getInstance().vm[getTitle()].as<vector<double> >(); 236 assert((temp.size() == 6) && "Symmetric box matrix from command line does not have six components."); 237 for (int i=0;i<6;i++) { 238 tmp[i] = temp[i]; 239 } 240 return true; 241 } else 242 return false; 243 } 244 245 CommandLineDialog::ElementCommandLineQuery::ElementCommandLineQuery(string title, const element **target, string _description) : 251 246 Dialog::ElementQuery(title,target, _description) 252 247 {} … … 257 252 bool CommandLineDialog::ElementCommandLineQuery::handle() { 258 253 // TODO: vector of ints and removing first is not correctly implemented yet. How to remove from a vector? 259 periodentafel *periode = World::getInstance().getPeriode(); 260 element *elemental = NULL; 254 int Z; 261 255 if (CommandLineParser::getInstance().vm.count(getTitle())) { 262 256 vector<int> AllElements = CommandLineParser::getInstance().vm[getTitle()].as< vector<int> >(); 263 for (vector<int>::iterator ZRunner = AllElements.begin(); ZRunner != AllElements.end(); ++ZRunner) { 264 elemental = periode->FindElement(*ZRunner); 265 ASSERT(elemental != NULL, "Invalid element specified in ElementCommandLineQuery"); 266 elements.push_back(elemental); 267 } 268 return true; 269 } else { 270 DoeLog(1) && (eLog() << Verbose(1) << "CommandLineUI parsing error: Missing element for " << getTitle() << "." << endl); 271 return false; 272 } 273 } 257 vector<int>::iterator ElementRunner = AllElements.begin(); 258 Z = *ElementRunner; 259 // TODO: So far, this does not really erase the element in the parsed list. 260 AllElements.erase(ElementRunner); 261 tmp = World::getInstance().getPeriode()->FindElement(Z); 262 return true; 263 } else 264 return false; 265 } -
src/UIElements/CommandLineUI/CommandLineDialog.hpp
re6317b rf8e486 36 36 virtual void queryVector(const char*,Vector *,const double * const,bool, std::string = ""); 37 37 virtual void queryBox(const char*,double ** const, std::string = ""); 38 virtual void queryElement(const char*, std::vector<element *>*, std::string = "");38 virtual void queryElement(const char*,const element **, std::string = ""); 39 39 40 40 protected: … … 105 105 class ElementCommandLineQuery : public Dialog::ElementQuery { 106 106 public: 107 ElementCommandLineQuery(std::string title, std::vector<element *>*_target, std::string _description = "");107 ElementCommandLineQuery(std::string title, const element **_target, std::string _description = ""); 108 108 virtual ~ElementCommandLineQuery(); 109 109 virtual bool handle(); -
src/UIElements/CommandLineUI/CommandLineWindow.cpp
re6317b rf8e486 14 14 15 15 #include "Actions/ActionRegistry.hpp" 16 #include "Actions/AnalysisAction/MolecularVolumeAction.hpp"17 16 #include "Actions/AnalysisAction/PairCorrelationAction.hpp" 18 #include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp" 17 #include "Actions/AnalysisAction/PairCorrelationToPointAction.hpp" 18 #include "Actions/AnalysisAction/PairCorrelationToSurfaceAction.hpp" 19 19 #include "Actions/AtomAction/AddAction.hpp" 20 20 #include "Actions/AtomAction/ChangeElementAction.hpp" … … 28 28 #include "Actions/FragmentationAction/DepthFirstSearchAction.hpp" 29 29 #include "Actions/FragmentationAction/SubgraphDissectionAction.hpp" 30 #include "Actions/FragmentationAction/FragmentationAction.hpp"31 30 #include "Actions/MoleculeAction/BondFileAction.hpp" 32 31 #include "Actions/MoleculeAction/ChangeNameAction.hpp" … … 36 35 #include "Actions/MoleculeAction/SaveBondsAction.hpp" 37 36 #include "Actions/MoleculeAction/SaveTemperatureAction.hpp" 38 #include "Actions/MoleculeAction/TranslateAction.hpp"39 37 #include "Actions/MoleculeAction/VerletIntegrationAction.hpp" 40 38 #include "Actions/ParserAction/LoadXyzAction.hpp" … … 77 75 CommandLineWindow::~CommandLineWindow() 78 76 { 77 // // go through all possible actions 78 // for(std::map<const std::string,Action*>::iterator ActionRunner = ActionRegistry::getInstance().getBeginIter(); ActionRegistry::getInstance().getBeginIter() != ActionRegistry::getInstance().getEndIter(); ActionRunner = ActionRegistry::getInstance().getBeginIter()) { 79 // ActionRegistry::getInstance().unregisterAction(ActionRunner->second); 80 // delete(ActionRunner->second); 81 // } 82 79 83 delete statusIndicator; 80 84 } … … 82 86 void CommandLineWindow::display() { 83 87 // go through all possible actions 84 for (std::list<std::string>::iterator CommandRunner = CommandLineParser::getInstance().SequenceOfActions.begin(); CommandRunner != CommandLineParser::getInstance().SequenceOfActions.end(); ++CommandRunner) { 85 cout << "Checking presence of " << *CommandRunner << endl; 86 if (ActionRegistry::getInstance().isActionByNamePresent(*CommandRunner)) 87 ActionRegistry::getInstance().getActionByName(*CommandRunner)->call(); 88 for(std::map<const std::string,Action*>::iterator ActionRunner = ActionRegistry::getInstance().getBeginIter(); ActionRunner != ActionRegistry::getInstance().getEndIter(); ActionRunner++) { 89 // check whether action is present in command line 90 if (CommandLineParser::getInstance().vm.count(ActionRunner->first)) { 91 ActionRunner->second->call(); 92 } 88 93 } 89 94 } … … 91 96 void CommandLineWindow::populateAnalysisActions() 92 97 { 93 new AnalysisMolecularVolumeAction();94 98 new AnalysisPairCorrelationAction(); 95 new AnalysisPrincipalAxisSystemAction(); 99 new AnalysisPairCorrelationToPointAction(); 100 new AnalysisPairCorrelationToSurfaceAction(); 96 101 } 97 102 … … 116 121 { 117 122 new FragmentationDepthFirstSearchAction(); 118 new FragmentationFragmentationAction();119 new FragmentationSubgraphDissectionAction();120 123 } 121 124 … … 129 132 new MoleculeSaveBondsAction(); 130 133 new MoleculeSaveTemperatureAction(); 131 new MoleculeTranslateAction();132 134 new MoleculeVerletIntegrationAction(); 133 135 } -
src/UIElements/Dialog.cpp
re6317b rf8e486 41 41 retval &= (*iter)->handle(); 42 42 // if any query fails (is canceled), we can end the handling process 43 if(!retval) { 44 DoeLog(1) && (eLog() << Verbose(1) << "The following query failed: " << (**iter).getTitle() << "." << endl); 43 if(!retval) 45 44 break; 46 }47 45 } 48 46 if (retval){ … … 203 201 204 202 // Element Queries 205 Dialog::ElementQuery::ElementQuery(std::string title, std::vector<element *>*_target, std::string _description) :203 Dialog::ElementQuery::ElementQuery(std::string title, const element **_target, std::string _description) : 206 204 Query(title, _description), 205 tmp(0), 207 206 target(_target) 208 207 {} … … 211 210 212 211 void Dialog::ElementQuery::setResult(){ 213 *target= elements;214 } 212 *target=tmp; 213 } -
src/UIElements/Dialog.hpp
re6317b rf8e486 11 11 #include<string> 12 12 #include<list> 13 #include<vector>14 13 15 14 class atom; … … 33 32 virtual void queryVector(const char*,Vector *,const double *const,bool, std::string = "")=0; 34 33 virtual void queryBox(const char*,double ** const, std::string = "")=0; 35 virtual void queryElement(const char*, std::vector<element *>*, std::string = "")=0;34 virtual void queryElement(const char*,const element **, std::string = "")=0; 36 35 37 36 virtual bool display(); … … 50 49 //base class for all queries 51 50 class Query { 52 friend class Dialog;53 51 public: 54 52 Query(std::string _title, std::string _description = ""); … … 174 172 class ElementQuery : public Query { 175 173 public: 176 ElementQuery(std::string title, std::vector<element *>*_target, std::string _description = "");174 ElementQuery(std::string title, const element**_target, std::string _description = ""); 177 175 virtual ~ElementQuery(); 178 176 virtual bool handle()=0; 179 177 virtual void setResult(); 180 178 protected: 181 std::vector<element *> elements;179 const element *tmp; 182 180 private: 183 std::vector<element *> * consttarget;181 const element **target; 184 182 }; 185 183 -
src/UIElements/TextUI/TextDialog.cpp
re6317b rf8e486 74 74 } 75 75 76 void TextDialog::queryElement(const char* title, std::vector<element *>*target, string description){76 void TextDialog::queryElement(const char* title, const element **target, string description){ 77 77 registerQuery(new ElementTextQuery(title,target,description)); 78 78 } … … 283 283 } 284 284 285 TextDialog::ElementTextQuery::ElementTextQuery(std::string title, std::vector<element *> *_target, std::string _description) :286 Dialog::ElementQuery(title, _target,_description)285 TextDialog::ElementTextQuery::ElementTextQuery(std::string title, const element **target, std::string _description) : 286 Dialog::ElementQuery(title,target,_description) 287 287 {} 288 288 … … 293 293 bool badInput=false; 294 294 bool aborted = false; 295 element * tmp = NULL;296 295 do{ 297 296 badInput = false; … … 310 309 Log() << Verbose(0) << "No element with this atomic number!" << endl; 311 310 badInput = true; 312 } else {313 elements.push_back(tmp);314 311 } 315 312 } … … 334 331 Log() << Verbose(0) << "No element with this shorthand!" << endl; 335 332 badInput = true; 336 } else {337 elements.push_back(tmp);338 333 } 339 334 } -
src/UIElements/TextUI/TextDialog.hpp
re6317b rf8e486 33 33 virtual void queryVector(const char*,Vector *,const double * const,bool, std::string = ""); 34 34 virtual void queryBox(const char*,double ** const, std::string = ""); 35 virtual void queryElement(const char*, std::vector<element *>*, std::string = "");35 virtual void queryElement(const char*,const element **, std::string = ""); 36 36 37 37 protected: … … 102 102 class ElementTextQuery : public Dialog::ElementQuery { 103 103 public: 104 ElementTextQuery(std::string title, std::vector<element *>*_target, std::string _description = NULL);104 ElementTextQuery(std::string title, const element **_target, std::string _description = NULL); 105 105 virtual ~ElementTextQuery(); 106 106 virtual bool handle(); -
src/World.cpp
re6317b rf8e486 81 81 } 82 82 83 std::stringWorld::getDefaultName() {83 char * World::getDefaultName() { 84 84 return defaultName; 85 85 } 86 86 87 void World::setDefaultName( std::stringname)87 void World::setDefaultName(char * name) 88 88 { 89 defaultName = name; 89 delete[](defaultName); 90 const int length = strlen(name); 91 if (length < MAXSTRINGSIZE) { 92 defaultName = new char[length+2]; 93 strncpy(defaultName, name, length); 94 } else { 95 defaultName = new char[MAXSTRINGSIZE]; 96 strncpy(defaultName, "none", MAXSTRINGSIZE-1); 97 } 90 98 }; 91 99 92 int World::getExitFlag() {93 return ExitFlag;94 }95 96 void World::setExitFlag(int flag) {97 if (ExitFlag < flag)98 ExitFlag = flag;99 }100 100 101 101 /******************** Methods to change World state *********************/ … … 127 127 128 128 double *World::cell_size = NULL; 129 char *World::defaultName = NULL; 129 130 130 131 atom *World::createAtom(){ … … 281 282 periode(new periodentafel), 282 283 configuration(new config), 283 ExitFlag(0),284 284 atoms(), 285 285 currAtomId(0), … … 295 295 cell_size[4] = 0.; 296 296 cell_size[5] = 20.; 297 defaultName = "none"; 297 defaultName = new char[MAXSTRINGSIZE]; 298 strcpy(defaultName, "none"); 298 299 molecules_deprecated->signOn(this); 299 300 } … … 303 304 molecules_deprecated->signOff(this); 304 305 delete[] cell_size; 306 delete[] defaultName; 305 307 delete molecules_deprecated; 306 308 delete periode; -
src/World.hpp
re6317b rf8e486 135 135 * get the default name 136 136 */ 137 std::stringgetDefaultName();137 char * getDefaultName(); 138 138 139 139 /** 140 140 * set the default name 141 141 */ 142 void setDefaultName(std::string name); 143 144 /* 145 * get the ExitFlag 146 */ 147 int getExitFlag(); 148 149 /* 150 * set the ExitFlag 151 */ 152 void setExitFlag(int flag); 142 void setDefaultName(char * name); 153 143 154 144 /***** Methods to work with the World *****/ … … 253 243 config *configuration; 254 244 static double *cell_size; 255 std::string defaultName; 256 int ExitFlag; 245 static char *defaultName; 257 246 public: 258 247 AtomSet atoms; -
src/analysis_correlation.cpp
re6317b rf8e486 25 25 /** Calculates the pair correlation between given elements. 26 26 * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si)) 27 * \param *molecules list of molecules structure 28 * \param &elements vector of elements to correlate 27 * \param *out output stream for debugging 28 * \param *molecules list of molecules structure 29 * \param *type1 first element or NULL (if any element) 30 * \param *type2 second element or NULL (if any element) 29 31 * \return Map of doubles with values the pair of the two atoms. 30 32 */ 31 PairCorrelationMap *PairCorrelation(MoleculeListClass * const &molecules, const std::vector<element *> &elements)33 PairCorrelationMap *PairCorrelation(MoleculeListClass * const &molecules, const element * const type1, const element * const type2 ) 32 34 { 33 35 Info FunctionInfo(__func__); 34 36 PairCorrelationMap *outmap = NULL; 35 37 double distance = 0.; 36 double *domain = World::getInstance().getDomain();37 38 38 39 if (molecules->ListOfMolecules.empty()) { … … 42 43 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 43 44 (*MolWalker)->doCountAtoms(); 44 45 // create all possible pairs of elements46 set <pair<element *, element *> > PairsOfElements;47 if (elements.size() >= 2) {48 for (vector<element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)49 for (vector<element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)50 if (type1 != type2) {51 PairsOfElements.insert( pair<element *, element*>(*type1,*type2) );52 DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << (*type1)->symbol << " and " << (*type2)->symbol << "." << endl);53 }54 } else if (elements.size() == 1) { // one to all are valid55 element *elemental = *elements.begin();56 PairsOfElements.insert( pair<element *, element*>(elemental,(element *)NULL) );57 PairsOfElements.insert( pair<element *, element*>((element *)NULL,elemental) );58 } else { // all elements valid59 PairsOfElements.insert( pair<element *, element*>((element *)NULL, (element *)NULL) );60 }61 62 45 outmap = new PairCorrelationMap; 63 46 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++){ … … 67 50 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 68 51 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 69 for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++){70 if ((*MolOtherWalker)->ActiveFlag){71 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);72 for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {73 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);74 if ((*iter)->getId() < (*runner)->getId()){75 for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)76 if (( PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {77 distance = (*iter)->node->PeriodicDistance(*(*runner)->node, domain);52 if ((type1 == NULL) || ((*iter)->type == type1)) { 53 for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++){ 54 if ((*MolOtherWalker)->ActiveFlag) { 55 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl); 56 for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) { 57 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl); 58 if ((*iter)->getId() < (*runner)->getId()){ 59 if ((type2 == NULL) || ((*runner)->type == type2)) { 60 distance = (*iter)->node->PeriodicDistance(*(*runner)->node, World::getInstance().getDomain()); 78 61 //Log() << Verbose(1) <<"Inserting " << *(*iter) << " and " << *(*runner) << endl; 79 62 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) ); 80 63 } 64 } 81 65 } 82 66 } … … 91 75 /** Calculates the pair correlation between given elements. 92 76 * Note given element order is unimportant (i.e. g(Si, O) === g(O, Si)) 93 * \param *molecules list of molecules structure 94 * \param &elements vector of elements to correlate 77 * \param *out output stream for debugging 78 * \param *molecules list of molecules structure 79 * \param *type1 first element or NULL (if any element) 80 * \param *type2 second element or NULL (if any element) 95 81 * \param ranges[NDIM] interval boundaries for the periodic images to scan also 96 82 * \return Map of doubles with values the pair of the two atoms. 97 83 */ 98 PairCorrelationMap *PeriodicPairCorrelation(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const int ranges[NDIM] )84 PairCorrelationMap *PeriodicPairCorrelation(MoleculeListClass * const &molecules, const element * const type1, const element * const type2, const int ranges[NDIM] ) 99 85 { 100 86 Info FunctionInfo(__func__); … … 114 100 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 115 101 (*MolWalker)->doCountAtoms(); 116 117 // create all possible pairs of elements118 set <pair<element *, element *> > PairsOfElements;119 if (elements.size() >= 2) {120 for (vector<element *>::const_iterator type1 = elements.begin(); type1 != elements.end(); ++type1)121 for (vector<element *>::const_iterator type2 = elements.begin(); type2 != elements.end(); ++type2)122 if (type1 != type2) {123 PairsOfElements.insert( pair<element *, element*>(*type1,*type2) );124 DoLog(1) && (Log() << Verbose(1) << "Creating element pair " << (*type1)->symbol << " and " << (*type2)->symbol << "." << endl);125 }126 } else if (elements.size() == 1) { // one to all are valid127 element *elemental = *elements.begin();128 PairsOfElements.insert( pair<element *, element*>(elemental,(element *)NULL) );129 PairsOfElements.insert( pair<element *, element*>((element *)NULL,elemental) );130 } else { // all elements valid131 PairsOfElements.insert( pair<element *, element*>((element *)NULL, (element *)NULL) );132 }133 134 102 outmap = new PairCorrelationMap; 135 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) {103 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 136 104 if ((*MolWalker)->ActiveFlag) { 137 105 double * FullMatrix = ReturnFullMatrixforSymmetric(World::getInstance().getDomain()); 138 106 double * FullInverseMatrix = InverseMatrix(FullMatrix); 139 107 DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 140 eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;141 108 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 142 109 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 143 periodicX = *(*iter)->node;144 periodicX.MatrixMultiplication(FullInverseMatrix); // x now in [0,1)^3145 // go through every range in xyz and get distance146 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++)147 for (n[ 1]=-ranges[1]; n[1] <= ranges[1]; n[1]++)148 for (n[ 2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) {149 checkX = Vector(n[0], n[1], n[2]) + periodicX;150 checkX.MatrixMultiplication(FullMatrix);151 for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++){152 if ((*MolOtherWalker)->ActiveFlag) {153 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl);154 for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) {155 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl);156 if ((*iter)->getId() < (*runner)->getId()){157 for (set <pair<element *, element *> >::iterator PairRunner = PairsOfElements.begin(); PairRunner != PairsOfElements.end(); ++PairRunner)158 if (( PairRunner->first == (**iter).type) && (PairRunner->second == (**runner).type)) {110 if ((type1 == NULL) || ((*iter)->type == type1)) { 111 periodicX = *(*iter)->node; 112 periodicX.MatrixMultiplication(FullInverseMatrix); // x now in [0,1)^3 113 // go through every range in xyz and get distance 114 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++) 115 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++) 116 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) { 117 checkX = Vector(n[0], n[1], n[2]) + periodicX; 118 checkX.MatrixMultiplication(FullMatrix); 119 for (MoleculeList::const_iterator MolOtherWalker = MolWalker; MolOtherWalker != molecules->ListOfMolecules.end(); MolOtherWalker++) 120 if ((*MolOtherWalker)->ActiveFlag) { 121 DoLog(2) && (Log() << Verbose(2) << "Current other molecule is " << *MolOtherWalker << "." << endl); 122 for (molecule::const_iterator runner = (*MolOtherWalker)->begin(); runner != (*MolOtherWalker)->end(); ++runner) { 123 DoLog(3) && (Log() << Verbose(3) << "Current otheratom is " << **runner << "." << endl); 124 if ((*iter)->nr < (*runner)->nr) 125 if ((type2 == NULL) || ((*runner)->type == type2)) { 159 126 periodicOtherX = *(*runner)->node; 160 127 periodicOtherX.MatrixMultiplication(FullInverseMatrix); // x now in [0,1)^3 … … 170 137 } 171 138 } 172 }173 139 } 174 }175 140 } 176 141 } 142 } 177 143 } 178 144 delete[](FullMatrix); 179 145 delete[](FullInverseMatrix); 180 146 } 181 }182 147 183 148 return outmap; … … 185 150 186 151 /** Calculates the distance (pair) correlation between a given element and a point. 187 * \param *molecules list of molecules structure 188 * \param &elements vector of elements to correlate with point 152 * \param *out output stream for debugging 153 * \param *molecules list of molecules structure 154 * \param *type element or NULL (if any element) 189 155 * \param *point vector to the correlation point 190 156 * \return Map of dobules with values as pairs of atom and the vector 191 157 */ 192 CorrelationToPointMap *CorrelationToPoint(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Vector *point )158 CorrelationToPointMap *CorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point ) 193 159 { 194 160 Info FunctionInfo(__func__); 195 161 CorrelationToPointMap *outmap = NULL; 196 162 double distance = 0.; 197 double *cell_size = World::getInstance().getDomain();198 163 199 164 if (molecules->ListOfMolecules.empty()) { … … 209 174 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 210 175 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 211 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 212 if ((*type == NULL) || ((*iter)->type == *type)) { 213 distance = (*iter)->node->PeriodicDistance(*point, cell_size); 214 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl); 215 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) ); 216 } 176 if ((type == NULL) || ((*iter)->type == type)) { 177 distance = (*iter)->node->PeriodicDistance(*point, World::getInstance().getDomain()); 178 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl); 179 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) ); 180 } 217 181 } 218 182 } … … 222 186 223 187 /** Calculates the distance (pair) correlation between a given element, all its periodic images and a point. 224 * \param *molecules list of molecules structure 225 * \param &elements vector of elements to correlate to point 188 * \param *out output stream for debugging 189 * \param *molecules list of molecules structure 190 * \param *type element or NULL (if any element) 226 191 * \param *point vector to the correlation point 227 192 * \param ranges[NDIM] interval boundaries for the periodic images to scan also 228 193 * \return Map of dobules with values as pairs of atom and the vector 229 194 */ 230 CorrelationToPointMap *PeriodicCorrelationToPoint(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Vector *point, const int ranges[NDIM] )195 CorrelationToPointMap *PeriodicCorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point, const int ranges[NDIM] ) 231 196 { 232 197 Info FunctionInfo(__func__); … … 251 216 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 252 217 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 253 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 254 if ((*type == NULL) || ((*iter)->type == *type)) { 255 periodicX = *(*iter)->node; 256 periodicX.MatrixMultiplication(FullInverseMatrix); // x now in [0,1)^3 257 // go through every range in xyz and get distance 258 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++) 259 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++) 260 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) { 261 checkX = Vector(n[0], n[1], n[2]) + periodicX; 262 checkX.MatrixMultiplication(FullMatrix); 263 distance = checkX.distance(*point); 264 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl); 265 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (*iter, point) ) ); 266 } 267 } 218 if ((type == NULL) || ((*iter)->type == type)) { 219 periodicX = *(*iter)->node; 220 periodicX.MatrixMultiplication(FullInverseMatrix); // x now in [0,1)^3 221 // go through every range in xyz and get distance 222 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++) 223 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++) 224 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) { 225 checkX = Vector(n[0], n[1], n[2]) + periodicX; 226 checkX.MatrixMultiplication(FullMatrix); 227 distance = checkX.distance(*point); 228 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl); 229 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (*iter, point) ) ); 230 } 231 } 268 232 } 269 233 delete[](FullMatrix); … … 275 239 276 240 /** Calculates the distance (pair) correlation between a given element and a surface. 277 * \param *molecules list of molecules structure 278 * \param &elements vector of elements to correlate to surface 241 * \param *out output stream for debugging 242 * \param *molecules list of molecules structure 243 * \param *type element or NULL (if any element) 279 244 * \param *Surface pointer to Tesselation class surface 280 245 * \param *LC LinkedCell structure to quickly find neighbouring atoms 281 246 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest 282 247 */ 283 CorrelationToSurfaceMap *CorrelationToSurface(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC )248 CorrelationToSurfaceMap *CorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC ) 284 249 { 285 250 Info FunctionInfo(__func__); … … 303 268 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 304 269 DoLog(1) && (Log() << Verbose(1) << "\tCurrent atom is " << *(*iter) << "." << endl); 305 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 306 if ((*type == NULL) || ((*iter)->type == *type)) { 307 TriangleIntersectionList Intersections((*iter)->node,Surface,LC); 308 distance = Intersections.GetSmallestDistance(); 309 triangle = Intersections.GetClosestTriangle(); 310 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> ((*iter), triangle) ) ); 311 } 270 if ((type == NULL) || ((*iter)->type == type)) { 271 TriangleIntersectionList Intersections((*iter)->node,Surface,LC); 272 distance = Intersections.GetSmallestDistance(); 273 triangle = Intersections.GetClosestTriangle(); 274 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> ((*iter), triangle) ) ); 275 } 312 276 } 313 277 } else { … … 323 287 * axis an integer from [ -ranges[i], ranges[i] ] onto it and multiply with the domain matrix to bring it back into 324 288 * the real space. Then, we Tesselation::FindClosestTriangleToPoint() and DistanceToTrianglePlane(). 325 * \param *molecules list of molecules structure 326 * \param &elements vector of elements to correlate to surface 289 * \param *out output stream for debugging 290 * \param *molecules list of molecules structure 291 * \param *type element or NULL (if any element) 327 292 * \param *Surface pointer to Tesselation class surface 328 293 * \param *LC LinkedCell structure to quickly find neighbouring atoms … … 330 295 * \return Map of doubles with values as pairs of atom and the BoundaryTriangleSet that's closest 331 296 */ 332 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] )297 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] ) 333 298 { 334 299 Info FunctionInfo(__func__); … … 357 322 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 358 323 DoLog(3) && (Log() << Verbose(3) << "Current atom is " << **iter << "." << endl); 359 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 360 if ((*type == NULL) || ((*iter)->type == *type)) { 361 periodicX = *(*iter)->node; 362 periodicX.MatrixMultiplication(FullInverseMatrix); // x now in [0,1)^3 363 // go through every range in xyz and get distance 364 ShortestDistance = -1.; 365 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++) 366 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++) 367 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) { 368 checkX = Vector(n[0], n[1], n[2]) + periodicX; 369 checkX.MatrixMultiplication(FullMatrix); 370 TriangleIntersectionList Intersections(&checkX,Surface,LC); 371 distance = Intersections.GetSmallestDistance(); 372 triangle = Intersections.GetClosestTriangle(); 373 if ((ShortestDistance == -1.) || (distance < ShortestDistance)) { 374 ShortestDistance = distance; 375 ShortestTriangle = triangle; 376 } 324 if ((type == NULL) || ((*iter)->type == type)) { 325 periodicX = *(*iter)->node; 326 periodicX.MatrixMultiplication(FullInverseMatrix); // x now in [0,1)^3 327 // go through every range in xyz and get distance 328 ShortestDistance = -1.; 329 for (n[0]=-ranges[0]; n[0] <= ranges[0]; n[0]++) 330 for (n[1]=-ranges[1]; n[1] <= ranges[1]; n[1]++) 331 for (n[2]=-ranges[2]; n[2] <= ranges[2]; n[2]++) { 332 checkX = Vector(n[0], n[1], n[2]) + periodicX; 333 checkX.MatrixMultiplication(FullMatrix); 334 TriangleIntersectionList Intersections(&checkX,Surface,LC); 335 distance = Intersections.GetSmallestDistance(); 336 triangle = Intersections.GetClosestTriangle(); 337 if ((ShortestDistance == -1.) || (distance < ShortestDistance)) { 338 ShortestDistance = distance; 339 ShortestTriangle = triangle; 377 340 } 378 // insert 379 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (*iter, ShortestTriangle) ) ); 380 //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl; 381 } 341 } 342 // insert 343 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (*iter, ShortestTriangle) ) ); 344 //Log() << Verbose(1) << "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "." << endl; 345 } 382 346 } 383 347 delete[](FullMatrix); -
src/analysis_correlation.hpp
re6317b rf8e486 45 45 /********************************************** declarations *******************************/ 46 46 47 PairCorrelationMap *PairCorrelation(MoleculeListClass * const &molecules, const std::vector<element *> &elements);48 CorrelationToPointMap *CorrelationToPoint(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Vector *point );49 CorrelationToSurfaceMap *CorrelationToSurface(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC );50 PairCorrelationMap *PeriodicPairCorrelation(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const int ranges[NDIM] );51 CorrelationToPointMap *PeriodicCorrelationToPoint(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Vector *point, const int ranges[NDIM] );52 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(MoleculeListClass * const &molecules, const std::vector<element *> &elements, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] );47 PairCorrelationMap *PairCorrelation(MoleculeListClass * const &molecules, const element * const type1, const element * const type2 ); 48 CorrelationToPointMap *CorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point ); 49 CorrelationToSurfaceMap *CorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC ); 50 PairCorrelationMap *PeriodicPairCorrelation(MoleculeListClass * const &molecules, const element * const type1, const element * const type2, const int ranges[NDIM] ); 51 CorrelationToPointMap *PeriodicCorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point, const int ranges[NDIM] ); 52 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] ); 53 53 int GetBin ( const double value, const double BinWidth, const double BinStart ); 54 54 void OutputCorrelation( ofstream * const file, const BinPairMap * const map ); -
src/builder.cpp
re6317b rf8e486 1531 1531 break; 1532 1532 case 'v': 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 } 1533 setVerbosity(atoi(argv[argptr])); 1534 ArgcList.insert(argptr-1); 1535 ArgcList.insert(argptr); 1536 argptr++; 1542 1537 break; 1543 1538 case 'V': … … 1546 1541 break; 1547 1542 case 'B': 1543 ArgcList.insert(argptr-1); 1544 ArgcList.insert(argptr); 1545 ArgcList.insert(argptr+1); 1546 ArgcList.insert(argptr+2); 1547 ArgcList.insert(argptr+3); 1548 ArgcList.insert(argptr+4); 1549 ArgcList.insert(argptr+5); 1550 argptr+=6; 1548 1551 if (ExitFlag == 0) ExitFlag = 1; 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 }1562 1552 break; 1563 1553 case 'e': … … 1566 1556 performCriticalExit(); 1567 1557 } else { 1568 ArgcList.insert(argptr-1); 1569 ArgcList.insert(argptr); 1558 DoLog(0) && (Log() << Verbose(0) << "Using " << argv[argptr] << " as elements database." << endl); 1559 strncpy (configuration.databasepath, argv[argptr], MAXSTRINGSIZE-1); 1560 DatabasePathGiven = true; 1570 1561 argptr+=1; 1571 1562 } … … 1576 1567 performCriticalExit(); 1577 1568 } else { 1578 ArgcList.insert(argptr-1);1579 ArgcList.insert(argptr);1569 BondGraphFileName = argv[argptr]; 1570 DoLog(0) && (Log() << Verbose(0) << "Using " << BondGraphFileName << " as bond length table." << endl); 1580 1571 argptr+=1; 1581 1572 } … … 1587 1578 performCriticalExit(); 1588 1579 } else { 1589 ArgcList.insert(argptr-1);1590 ArgcList.insert(argptr);1580 configuration.basis = argv[argptr]; 1581 DoLog(1) && (Log() << Verbose(1) << "Setting MPQC basis to " << configuration.basis << "." << endl); 1591 1582 argptr+=1; 1592 1583 } 1593 1584 break; 1594 1585 case 'n': 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 } 1586 DoLog(0) && (Log() << Verbose(0) << "I won't parse trajectories." << endl); 1587 configuration.FastParsing = true; 1604 1588 break; 1605 1589 case 'X': 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; 1590 { 1591 World::getInstance().setDefaultName(argv[argptr]); 1592 DoLog(0) && (Log() << Verbose(0) << "Default name of new molecules set to " << World::getInstance().getDefaultName() << "." << endl); 1614 1593 } 1615 1594 break; … … 1622 1601 } while (argptr < argc); 1623 1602 1603 // 3a. Parse the element database 1604 if (DatabasePathGiven) 1605 if (periode->LoadPeriodentafel(configuration.databasepath)) { 1606 DoLog(0) && (Log() << Verbose(0) << "Element list loaded successfully." << endl); 1607 //periode->Output(); 1608 } else { 1609 DoLog(0) && (Log() << Verbose(0) << "Element list loading failed." << endl); 1610 return 1; 1611 } 1624 1612 // 3b. Find config file name and parse if possible, also BondGraphFileName 1625 1613 if (argv[1][0] != '-') { … … 1676 1664 molecules->insert(mol); 1677 1665 } 1666 if (configuration.BG == NULL) { 1667 configuration.BG = new BondGraph(configuration.GetIsAngstroem()); 1668 if ((!BondGraphFileName.empty()) && (configuration.BG->LoadBondLengthTable(BondGraphFileName))) { 1669 DoLog(0) && (Log() << Verbose(0) << "Bond length table loaded successfully." << endl); 1670 } else { 1671 DoeLog(1) && (eLog()<< Verbose(1) << "Bond length table loading failed." << endl); 1672 } 1673 } 1678 1674 1679 1675 // 4. parse again through options, now for those depending on elements db and config presence … … 1704 1700 case 'a': 1705 1701 if (ExitFlag == 0) ExitFlag = 1; 1706 if ((argptr +4 >= argc) || (argv[argptr][0] == '-')) {1702 if ((argptr >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3]))) { 1707 1703 ExitFlag = 255; 1708 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough arguments for adding atom: -a <Z> --position<x> <y> <z>" << endl);1704 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for adding atom: -a <element> <x> <y> <z>" << endl); 1709 1705 performCriticalExit(); 1710 1706 } else { 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; 1707 SaveFlag = true; 1708 Log() << Verbose(1) << "Adding new atom with element " << argv[argptr] << " at (" << argv[argptr+1] << "," << argv[argptr+2] << "," << argv[argptr+3] << "), "; 1709 first = World::getInstance().createAtom(); 1710 first->type = periode->FindElement(atoi(argv[argptr])); 1711 if (first->type != NULL) 1712 DoLog(2) && (Log() << Verbose(2) << "found element " << first->type->name << endl); 1713 for (int i=NDIM;i--;) 1714 first->x[i] = atof(argv[argptr+1+i]); 1715 if (first->type != NULL) { 1716 mol->AddAtom(first); // add to molecule 1717 if ((configPresent == empty) && (mol->getAtomCount() != 0)) 1718 configPresent = present; 1719 } else 1720 DoeLog(1) && (eLog()<< Verbose(1) << "Could not find the specified element." << endl); 1721 argptr+=4; 1718 1722 } 1719 1723 break; … … 1726 1730 case 'D': 1727 1731 if (ExitFlag == 0) ExitFlag = 1; 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; 1736 } 1732 { 1733 DoLog(1) && (Log() << Verbose(1) << "Depth-First-Search Analysis." << endl); 1734 MoleculeLeafClass *Subgraphs = NULL; // list of subgraphs from DFS analysis 1735 int *MinimumRingSize = new int[mol->getAtomCount()]; 1736 atom ***ListOfLocalAtoms = NULL; 1737 class StackClass<bond *> *BackEdgeStack = NULL; 1738 class StackClass<bond *> *LocalBackEdgeStack = NULL; 1739 mol->CreateAdjacencyList(atof(argv[argptr]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL); 1740 Subgraphs = mol->DepthFirstSearchAnalysis(BackEdgeStack); 1741 if (Subgraphs != NULL) { 1742 int FragmentCounter = 0; 1743 while (Subgraphs->next != NULL) { 1744 Subgraphs = Subgraphs->next; 1745 Subgraphs->FillBondStructureFromReference(mol, FragmentCounter, ListOfLocalAtoms, false); // we want to keep the created ListOfLocalAtoms 1746 LocalBackEdgeStack = new StackClass<bond *> (Subgraphs->Leaf->BondCount); 1747 Subgraphs->Leaf->PickLocalBackEdges(ListOfLocalAtoms[FragmentCounter], BackEdgeStack, LocalBackEdgeStack); 1748 Subgraphs->Leaf->CyclicStructureAnalysis(LocalBackEdgeStack, MinimumRingSize); 1749 delete(LocalBackEdgeStack); 1750 delete(Subgraphs->previous); 1751 FragmentCounter++; 1752 } 1753 delete(Subgraphs); 1754 for (int i=0;i<FragmentCounter;i++) 1755 delete[](ListOfLocalAtoms[i]); 1756 delete[](ListOfLocalAtoms); 1757 } 1758 delete(BackEdgeStack); 1759 delete[](MinimumRingSize); 1760 } 1761 //argptr+=1; 1737 1762 break; 1738 1763 case 'I': 1739 1764 DoLog(1) && (Log() << Verbose(1) << "Dissecting molecular system into a set of disconnected subgraphs ... " << endl); 1740 ArgcList.insert(argptr-1); 1741 argptr+=0; 1765 // @TODO rather do the dissection afterwards 1766 molecules->DissectMoleculeIntoConnectedSubgraphs(periode, &configuration); 1767 mol = NULL; 1768 if (molecules->ListOfMolecules.size() != 0) { 1769 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 1770 if ((*ListRunner)->ActiveFlag) { 1771 mol = *ListRunner; 1772 break; 1773 } 1774 } 1775 if ((mol == NULL) && (!molecules->ListOfMolecules.empty())) { 1776 mol = *(molecules->ListOfMolecules.begin()); 1777 if (mol != NULL) 1778 mol->ActiveFlag = true; 1779 } 1742 1780 break; 1743 1781 case 'C': 1744 1782 { 1783 int ranges[3] = {1, 1, 1}; 1784 bool periodic = (argv[argptr-1][2] =='p'); 1745 1785 if (ExitFlag == 0) ExitFlag = 1; 1746 if ((argptr +11>= argc)) {1786 if ((argptr >= argc)) { 1747 1787 ExitFlag = 255; 1748 1788 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); … … 1751 1791 switch(argv[argptr][0]) { 1752 1792 case 'E': 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; 1793 { 1794 if ((argptr+6 >= argc) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+5])) || (!IsValidNumber(argv[argptr+6])) || (!IsValidNumber(argv[argptr+2])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-') || (argv[argptr+4][0] == '-')) { 1795 ExitFlag = 255; 1796 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C E <Z1> <Z2> <output> <bin output> <binstart> <binend>" << endl); 1797 performCriticalExit(); 1798 } else { 1799 ofstream output(argv[argptr+3]); 1800 ofstream binoutput(argv[argptr+4]); 1801 const double BinStart = atof(argv[argptr+5]); 1802 const double BinEnd = atof(argv[argptr+6]); 1803 1804 const element *elemental = periode->FindElement((const int) atoi(argv[argptr+1])); 1805 const element *elemental2 = periode->FindElement((const int) atoi(argv[argptr+2])); 1806 PairCorrelationMap *correlationmap = NULL; 1807 if (periodic) 1808 correlationmap = PeriodicPairCorrelation(molecules, elemental, elemental2, ranges); 1809 else 1810 correlationmap = PairCorrelation(molecules, elemental, elemental2); 1811 OutputPairCorrelation(&output, correlationmap); 1812 BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd ); 1813 OutputCorrelation ( &binoutput, binmap ); 1814 output.close(); 1815 binoutput.close(); 1816 delete(binmap); 1817 delete(correlationmap); 1818 argptr+=7; 1819 } 1820 } 1767 1821 break; 1768 1822 1769 1823 case 'P': 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; 1824 { 1825 if ((argptr+8 >= argc) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+7])) || (!IsValidNumber(argv[argptr+8])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-') || (argv[argptr+4][0] == '-') || (argv[argptr+5][0] == '-') || (argv[argptr+6][0] == '-')) { 1826 ExitFlag = 255; 1827 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C P <Z1> <x> <y> <z> <output> <bin output> <binstart> <binend>" << endl); 1828 performCriticalExit(); 1829 } else { 1830 ofstream output(argv[argptr+5]); 1831 ofstream binoutput(argv[argptr+6]); 1832 const double BinStart = atof(argv[argptr+7]); 1833 const double BinEnd = atof(argv[argptr+8]); 1834 1835 const element *elemental = periode->FindElement((const int) atoi(argv[argptr+1])); 1836 Vector *Point = new Vector((const double) atof(argv[argptr+1]),(const double) atof(argv[argptr+2]),(const double) atof(argv[argptr+3])); 1837 CorrelationToPointMap *correlationmap = NULL; 1838 if (periodic) 1839 correlationmap = PeriodicCorrelationToPoint(molecules, elemental, Point, ranges); 1840 else 1841 correlationmap = CorrelationToPoint(molecules, elemental, Point); 1842 OutputCorrelationToPoint(&output, correlationmap); 1843 BinPairMap *binmap = BinData( correlationmap, 0.5, BinStart, BinEnd ); 1844 OutputCorrelation ( &binoutput, binmap ); 1845 output.close(); 1846 binoutput.close(); 1847 delete(Point); 1848 delete(binmap); 1849 delete(correlationmap); 1850 argptr+=9; 1851 } 1852 } 1787 1853 break; 1788 1854 1789 1855 case 'S': 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; 1856 { 1857 if ((argptr+6 >= argc) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) || (!IsValidNumber(argv[argptr+6])) || (argv[argptr+1][0] == '-') || (argv[argptr+2][0] == '-') || (argv[argptr+3][0] == '-')) { 1858 ExitFlag = 255; 1859 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for pair correlation analysis: -C S <Z> <output> <bin output> <BinWidth> <BinStart> <BinEnd>" << endl); 1860 performCriticalExit(); 1861 } else { 1862 ofstream output(argv[argptr+2]); 1863 ofstream binoutput(argv[argptr+3]); 1864 const double radius = 4.; 1865 const double BinWidth = atof(argv[argptr+4]); 1866 const double BinStart = atof(argv[argptr+5]); 1867 const double BinEnd = atof(argv[argptr+6]); 1868 double LCWidth = 20.; 1869 if (BinEnd > 0) { 1870 if (BinEnd > 2.*radius) 1871 LCWidth = BinEnd; 1872 else 1873 LCWidth = 2.*radius; 1874 } 1875 1876 // get the boundary 1877 class molecule *Boundary = NULL; 1878 class Tesselation *TesselStruct = NULL; 1879 const LinkedCell *LCList = NULL; 1880 // find biggest molecule 1881 int counter = 0; 1882 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 1883 if ((Boundary == NULL) || (Boundary->getAtomCount() < (*BigFinder)->getAtomCount())) { 1884 Boundary = *BigFinder; 1885 } 1886 counter++; 1887 } 1888 bool *Actives = new bool[counter]; 1889 counter = 0; 1890 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 1891 Actives[counter++] = (*BigFinder)->ActiveFlag; 1892 (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true; 1893 } 1894 LCList = new LinkedCell(Boundary, LCWidth); 1895 const element *elemental = periode->FindElement((const int) atoi(argv[argptr+1])); 1896 FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL); 1897 CorrelationToSurfaceMap *surfacemap = NULL; 1898 if (periodic) 1899 surfacemap = PeriodicCorrelationToSurface( molecules, elemental, TesselStruct, LCList, ranges); 1900 else 1901 surfacemap = CorrelationToSurface( molecules, elemental, TesselStruct, LCList); 1902 OutputCorrelationToSurface(&output, surfacemap); 1903 // check whether radius was appropriate 1904 { 1905 double start; double end; 1906 GetMinMax( surfacemap, start, end); 1907 if (LCWidth < end) 1908 DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell width is smaller than the found range of values! Bins can only be correct up to: " << radius << "." << endl); 1909 } 1910 BinPairMap *binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd ); 1911 OutputCorrelation ( &binoutput, binmap ); 1912 output.close(); 1913 binoutput.close(); 1914 counter = 0; 1915 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) 1916 (*BigFinder)->ActiveFlag = Actives[counter++]; 1917 delete[](Actives); 1918 delete(LCList); 1919 delete(TesselStruct); 1920 delete(binmap); 1921 delete(surfacemap); 1922 argptr+=7; 1923 } 1924 } 1807 1925 break; 1808 1926 … … 1818 1936 case 'E': 1819 1937 if (ExitFlag == 0) ExitFlag = 1; 1820 if ((argptr+ 2 >= argc) || (!IsValidNumber(argv[argptr]))) {1938 if ((argptr+1 >= argc) || (!IsValidNumber(argv[argptr])) || (argv[argptr+1][0] == '-')) { 1821 1939 ExitFlag = 255; 1822 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> --element <Z>" << endl);1940 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for changing element: -E <atom nr.> <element>" << endl); 1823 1941 performCriticalExit(); 1824 1942 } else { 1825 ArgcList.insert(argptr-1); 1826 ArgcList.insert(argptr); 1827 ArgcList.insert(argptr+1); 1828 ArgcList.insert(argptr+2); 1829 argptr+=3; 1943 mol->getAtomCount(); 1944 SaveFlag = true; 1945 DoLog(1) && (Log() << Verbose(1) << "Changing atom " << argv[argptr] << " to element " << argv[argptr+1] << "." << endl); 1946 first = mol->FindAtom(atoi(argv[argptr])); 1947 first->type = periode->FindElement(atoi(argv[argptr+1])); 1948 argptr+=2; 1830 1949 } 1831 1950 break; 1832 1951 case 'F': 1833 1952 if (ExitFlag == 0) ExitFlag = 1; 1834 if ((argptr+12 >= argc) || (argv[argptr][0] == '-')) { 1953 MaxDistance = -1; 1954 if (argv[argptr-1][2] == 'F') { // option is -FF? 1955 // fetch first argument as max distance to surface 1956 MaxDistance = atof(argv[argptr++]); 1957 DoLog(0) && (Log() << Verbose(0) << "Filling with maximum layer distance of " << MaxDistance << "." << endl); 1958 } 1959 if ((argptr+7 >=argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3])) || (!IsValidNumber(argv[argptr+4])) || (!IsValidNumber(argv[argptr+5])) || (!IsValidNumber(argv[argptr+6])) || (!IsValidNumber(argv[argptr+7]))) { 1835 1960 ExitFlag = 255; 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);1961 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for filling box with water: -F <xyz of filler> <dist_x> <dist_y> <dist_z> <boundary> <randatom> <randmol> <DoRotate>" << endl); 1837 1962 performCriticalExit(); 1838 1963 } else { 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; 1964 SaveFlag = true; 1965 DoLog(1) && (Log() << Verbose(1) << "Filling Box with water molecules." << endl); 1966 // construct water molecule 1967 molecule *filler = World::getInstance().createMolecule(); 1968 if (!filler->AddXYZFile(argv[argptr])) { 1969 DoeLog(0) && (eLog()<< Verbose(0) << "Could not parse filler molecule from " << argv[argptr] << "." << endl); 1970 } 1971 filler->SetNameFromFilename(argv[argptr]); 1972 configuration.BG->ConstructBondGraph(filler); 1973 molecule *Filling = NULL; 1974 // call routine 1975 double distance[NDIM]; 1976 for (int i=0;i<NDIM;i++) 1977 distance[i] = atof(argv[argptr+i+1]); 1978 Filling = FillBoxWithMolecule(molecules, filler, configuration, MaxDistance, distance, atof(argv[argptr+4]), atof(argv[argptr+5]), atof(argv[argptr+6]), atoi(argv[argptr+7])); 1979 if (Filling != NULL) { 1980 Filling->ActiveFlag = false; 1981 molecules->insert(Filling); 1982 } 1983 World::getInstance().destroyMolecule(filler); 1984 argptr+=6; 1854 1985 } 1855 1986 break; 1856 1987 case 'A': 1857 1988 if (ExitFlag == 0) ExitFlag = 1; 1858 if ((argptr +2>= argc) || (argv[argptr][0] == '-')) {1989 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1859 1990 ExitFlag =255; 1860 DoeLog(0) && (eLog()<< Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile> --molecule-by-id <molecule_id>" << endl);1991 DoeLog(0) && (eLog()<< Verbose(0) << "Missing source file for bonds in molecule: -A <bond sourcefile>" << endl); 1861 1992 performCriticalExit(); 1862 1993 } else { 1863 ArgcList.insert(argptr-1);1864 ArgcList.insert(argptr);1865 ArgcList.insert(argptr+1);1866 ArgcList.insert(argptr+2);1867 argptr+= 3;1994 DoLog(0) && (Log() << Verbose(0) << "Parsing bonds from " << argv[argptr] << "." << endl); 1995 ifstream input(argv[argptr]); 1996 mol->CreateAdjacencyListFromDbondFile(&input); 1997 input.close(); 1998 argptr+=1; 1868 1999 } 1869 2000 break; … … 1871 2002 case 'J': 1872 2003 if (ExitFlag == 0) ExitFlag = 1; 1873 if ((argptr +2>= argc) || (argv[argptr][0] == '-')) {2004 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1874 2005 ExitFlag =255; 1875 DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of adjacency file: - J <path> --molecule-by-id <molecule_id>" << endl);2006 DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of adjacency file: -j <path>" << endl); 1876 2007 performCriticalExit(); 1877 2008 } else { 1878 ArgcList.insert(argptr-1); 1879 ArgcList.insert(argptr); 1880 ArgcList.insert(argptr+1); 1881 ArgcList.insert(argptr+2); 1882 argptr+=3; 2009 DoLog(0) && (Log() << Verbose(0) << "Storing adjacency to path " << argv[argptr] << "." << endl); 2010 configuration.BG->ConstructBondGraph(mol); 2011 mol->StoreAdjacencyToFile(NULL, argv[argptr]); 2012 argptr+=1; 1883 2013 } 1884 2014 break; … … 1888 2018 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1889 2019 ExitFlag =255; 1890 DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of bonds file: -j <path> --molecule-by-id <molecule_id>" << endl);2020 DoeLog(0) && (eLog()<< Verbose(0) << "Missing path of bonds file: -j <path>" << endl); 1891 2021 performCriticalExit(); 1892 2022 } else { 1893 ArgcList.insert(argptr-1); 1894 ArgcList.insert(argptr); 1895 ArgcList.insert(argptr+1); 1896 ArgcList.insert(argptr+2); 1897 argptr+=3; 2023 DoLog(0) && (Log() << Verbose(0) << "Storing bonds to path " << argv[argptr] << "." << endl); 2024 configuration.BG->ConstructBondGraph(mol); 2025 mol->StoreBondsToFile(NULL, argv[argptr]); 2026 argptr+=1; 1898 2027 } 1899 2028 break; … … 1901 2030 case 'N': 1902 2031 if (ExitFlag == 0) ExitFlag = 1; 1903 if ((argptr+ 4 >= argc) || (argv[argptr][0] == '-')){2032 if ((argptr+1 >= argc) || (argv[argptr+1][0] == '-')){ 1904 2033 ExitFlag = 255; 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);2034 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for non-convex envelope: -o <radius> <tecplot output file>" << endl); 1906 2035 performCriticalExit(); 1907 2036 } else { 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; 2037 class Tesselation *T = NULL; 2038 const LinkedCell *LCList = NULL; 2039 molecule * Boundary = NULL; 2040 //string filename(argv[argptr+1]); 2041 //filename.append(".csv"); 2042 DoLog(0) && (Log() << Verbose(0) << "Evaluating non-convex envelope of biggest molecule."); 2043 DoLog(1) && (Log() << Verbose(1) << "Using rolling ball of radius " << atof(argv[argptr]) << " and storing tecplot data in " << argv[argptr+1] << "." << endl); 2044 // find biggest molecule 2045 int counter = 0; 2046 for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) { 2047 if ((Boundary == NULL) || (Boundary->getAtomCount() < (*BigFinder)->getAtomCount())) { 2048 Boundary = *BigFinder; 2049 } 2050 counter++; 2051 } 2052 DoLog(1) && (Log() << Verbose(1) << "Biggest molecule has " << Boundary->getAtomCount() << " atoms." << endl); 2053 start = clock(); 2054 LCList = new LinkedCell(Boundary, atof(argv[argptr])*2.); 2055 if (!FindNonConvexBorder(Boundary, T, LCList, atof(argv[argptr]), argv[argptr+1])) 2056 ExitFlag = 255; 2057 //FindDistributionOfEllipsoids(T, &LCList, N, number, filename.c_str()); 2058 end = clock(); 2059 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl); 2060 delete(LCList); 2061 delete(T); 2062 argptr+=2; 1915 2063 } 1916 2064 break; 1917 2065 case 'S': 1918 2066 if (ExitFlag == 0) ExitFlag = 1; 1919 if ((argptr +2>= argc) || (argv[argptr][0] == '-')) {2067 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1920 2068 ExitFlag = 255; 1921 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file> --molecule-by-id 0" << endl);2069 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for storing tempature: -S <temperature file>" << endl); 1922 2070 performCriticalExit(); 1923 2071 } else { 1924 ArgcList.insert(argptr-1); 1925 ArgcList.insert(argptr); 1926 ArgcList.insert(argptr+1); 1927 ArgcList.insert(argptr+2); 1928 argptr+=3; 2072 DoLog(1) && (Log() << Verbose(1) << "Storing temperatures in " << argv[argptr] << "." << endl); 2073 ofstream *output = new ofstream(argv[argptr], ios::trunc); 2074 if (!mol->OutputTemperatureFromTrajectories(output, 0, mol->MDSteps)) 2075 DoLog(2) && (Log() << Verbose(2) << "File could not be written." << endl); 2076 else 2077 DoLog(2) && (Log() << Verbose(2) << "File stored." << endl); 2078 output->close(); 2079 delete(output); 2080 argptr+=1; 1929 2081 } 1930 2082 break; 1931 2083 case 'L': 1932 2084 if (ExitFlag == 0) ExitFlag = 1; 1933 if ((argptr +8>= argc) || (argv[argptr][0] == '-')) {2085 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1934 2086 ExitFlag = 255; 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);2087 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for linear interpolation: -L <step0> <step1> <prefix> <identity mapping?>" << endl); 1936 2088 performCriticalExit(); 1937 2089 } else { 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; 2090 SaveFlag = true; 2091 DoLog(1) && (Log() << Verbose(1) << "Linear interpolation between configuration " << argv[argptr] << " and " << argv[argptr+1] << "." << endl); 2092 if (atoi(argv[argptr+3]) == 1) 2093 DoLog(1) && (Log() << Verbose(1) << "Using Identity for the permutation map." << endl); 2094 if (!mol->LinearInterpolationBetweenConfiguration(atoi(argv[argptr]), atoi(argv[argptr+1]), argv[argptr+2], configuration, atoi(argv[argptr+3])) == 1 ? true : false) 2095 DoLog(2) && (Log() << Verbose(2) << "Could not store " << argv[argptr+2] << " files." << endl); 2096 else 2097 DoLog(2) && (Log() << Verbose(2) << "Steps created and " << argv[argptr+2] << " files stored." << endl); 2098 argptr+=4; 1949 2099 } 1950 2100 break; 1951 2101 case 'P': 1952 2102 if (ExitFlag == 0) ExitFlag = 1; 1953 if ((argptr +2>= argc) || (argv[argptr][0] == '-')) {2103 if ((argptr >= argc) || (argv[argptr][0] == '-')) { 1954 2104 ExitFlag = 255; 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);2105 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for parsing and integrating forces: -P <forces file>" << endl); 1956 2106 performCriticalExit(); 1957 2107 } else { 1958 ArgcList.insert(argptr-1); 1959 ArgcList.insert(argptr); 1960 ArgcList.insert(argptr+1); 1961 ArgcList.insert(argptr+2); 1962 argptr+=3; 2108 SaveFlag = true; 2109 DoLog(1) && (Log() << Verbose(1) << "Parsing forces file and Verlet integrating." << endl); 2110 if (!mol->VerletForceIntegration(argv[argptr], configuration)) 2111 DoLog(2) && (Log() << Verbose(2) << "File not found." << endl); 2112 else 2113 DoLog(2) && (Log() << Verbose(2) << "File found and parsed." << endl); 2114 argptr+=1; 1963 2115 } 1964 2116 break; 1965 2117 case 'R': 1966 2118 if (ExitFlag == 0) ExitFlag = 1; 1967 if ((argptr+ 4 >= argc) || (argv[argptr][0] == '-')) {2119 if ((argptr+3 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) || (!IsValidNumber(argv[argptr+3]))) { 1968 2120 ExitFlag = 255; 1969 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R < distance> --position <x> <y> <z>" << endl);2121 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for removing atoms: -R <x> <y> <z> <distance>" << endl); 1970 2122 performCriticalExit(); 1971 2123 } else { 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; 2124 SaveFlag = true; 2125 const double radius = atof(argv[argptr+3]); 2126 Vector point(atof(argv[argptr]),atof(argv[argptr+1]),atof(argv[argptr+2])); 2127 DoLog(1) && (Log() << Verbose(1) << "Removing atoms around " << point << " with radius " << radius << "." << endl); 2128 atom *Walker = NULL; 2129 molecule::iterator advancer = mol->begin(); 2130 for(molecule::iterator iter = advancer; advancer != mol->end();) { 2131 iter = advancer++; 2132 if ((*iter)->x.DistanceSquared(point) > radius*radius){ // distance to first above radius ... 2133 Walker = (*iter); 2134 DoLog(1) && (Log() << Verbose(1) << "Removing atom " << *Walker << "." << endl); 2135 mol->RemoveAtom(*(iter)); 2136 World::getInstance().destroyAtom(Walker); 2137 } 2138 } 2139 argptr+=4; 1979 2140 } 1980 2141 break; 1981 2142 case 't': 1982 2143 if (ExitFlag == 0) ExitFlag = 1; 1983 if ((argptr+ 4>= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) {2144 if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 1984 2145 ExitFlag = 255; 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);2146 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for translation: -t <x> <y> <z>" << endl); 1986 2147 performCriticalExit(); 1987 2148 } else { 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; 2149 if (ExitFlag == 0) ExitFlag = 1; 2150 SaveFlag = true; 2151 DoLog(1) && (Log() << Verbose(1) << "Translating all ions by given vector." << endl); 2152 for (int i=NDIM;i--;) 2153 x[i] = atof(argv[argptr+i]); 2154 mol->Translate((const Vector *)&x); 2155 argptr+=3; 2156 } 2157 break; 2158 case 'T': 2159 if (ExitFlag == 0) ExitFlag = 1; 2160 if ((argptr+2 >= argc) || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1])) || (!IsValidNumber(argv[argptr+2])) ) { 2161 ExitFlag = 255; 2162 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for periodic translation: -T <x> <y> <z>" << endl); 2163 performCriticalExit(); 2164 } else { 2165 if (ExitFlag == 0) ExitFlag = 1; 2166 SaveFlag = true; 2167 DoLog(1) && (Log() << Verbose(1) << "Translating all ions periodically by given vector." << endl); 2168 for (int i=NDIM;i--;) 2169 x[i] = atof(argv[argptr+i]); 2170 mol->TranslatePeriodically((const Vector *)&x); 2171 argptr+=3; 1997 2172 } 1998 2173 break; … … 2071 2246 performCriticalExit(); 2072 2247 } else { 2073 ArgcList.insert(argptr-1); 2074 ArgcList.insert(argptr); 2248 mol->getAtomCount(); 2249 SaveFlag = true; 2250 DoLog(1) && (Log() << Verbose(1) << "Removing atom " << argv[argptr] << "." << endl); 2251 atom *first = mol->FindAtom(atoi(argv[argptr])); 2252 mol->RemoveAtom(first); 2075 2253 argptr+=1; 2076 2254 } … … 2078 2256 case 'f': 2079 2257 if (ExitFlag == 0) ExitFlag = 1; 2080 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') ) {2258 if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (!IsValidNumber(argv[argptr])) || (!IsValidNumber(argv[argptr+1]))) { 2081 2259 ExitFlag = 255; 2082 2260 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments for fragmentation: -f <max. bond distance> <bond order>" << endl); 2083 2261 performCriticalExit(); 2084 2262 } else { 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; 2263 DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl); 2264 DoLog(0) && (Log() << Verbose(0) << "Creating connection matrix..." << endl); 2265 start = clock(); 2266 mol->CreateAdjacencyList(atof(argv[argptr]), configuration.GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL); 2267 DoLog(0) && (Log() << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl); 2268 if (mol->hasBondStructure()) { 2269 ExitFlag = mol->FragmentMolecule(atoi(argv[argptr+1]), &configuration); 2270 } 2271 end = clock(); 2272 DoLog(0) && (Log() << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl); 2273 argptr+=2; 2092 2274 } 2093 2275 break; … … 2102 2284 SaveFlag = true; 2103 2285 DoLog(0) && (Log() << Verbose(0) << "Converting to prinicipal axis system." << endl); 2104 mol->PrincipalAxisSystem((bool)j);2105 2286 } else 2106 ArgcList.insert(argptr-1);2107 argptr+=0;2287 DoLog(0) && (Log() << Verbose(0) << "Evaluating prinicipal axis." << endl); 2288 mol->PrincipalAxisSystem((bool)j); 2108 2289 break; 2109 2290 case 'o': 2110 2291 if (ExitFlag == 0) ExitFlag = 1; 2111 if ((argptr+ 4>= argc) || (argv[argptr][0] == '-')){2292 if ((argptr+1 >= argc) || (argv[argptr][0] == '-')){ 2112 2293 ExitFlag = 255; 2113 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o < molecule_id> --output-file <output file> --output-file <binnedoutput file>" << endl);2294 DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for convex envelope: -o <convex output file> <non-convex output file>" << endl); 2114 2295 performCriticalExit(); 2115 2296 } else { 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; 2297 class Tesselation *TesselStruct = NULL; 2298 const LinkedCell *LCList = NULL; 2299 DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope."); 2300 DoLog(1) && (Log() << Verbose(1) << "Storing tecplot convex data in " << argv[argptr] << "." << endl); 2301 DoLog(1) && (Log() << Verbose(1) << "Storing tecplot non-convex data in " << argv[argptr+1] << "." << endl); 2302 LCList = new LinkedCell(mol, 10.); 2303 //FindConvexBorder(mol, LCList, argv[argptr]); 2304 FindNonConvexBorder(mol, TesselStruct, LCList, 5., argv[argptr+1]); 2305 // RemoveAllBoundaryPoints(TesselStruct, mol, argv[argptr]); 2306 double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, argv[argptr]); 2307 double clustervolume = VolumeOfConvexEnvelope(TesselStruct, &configuration); 2308 DoLog(0) && (Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl); 2309 DoLog(0) && (Log() << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration.GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl); 2310 delete(TesselStruct); 2311 delete(LCList); 2312 argptr+=2; 2123 2313 } 2124 2314 break; … … 2141 2331 performCriticalExit(); 2142 2332 } else { 2143 ArgcList.insert(argptr-1); 2144 ArgcList.insert(argptr); 2145 argptr+=1; 2333 double density; 2334 SaveFlag = true; 2335 DoLog(0) && (Log() << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water."); 2336 density = atof(argv[argptr++]); 2337 if (density < 1.0) { 2338 DoeLog(1) && (eLog()<< Verbose(1) << "Density must be greater than 1.0g/cm^3 !" << endl); 2339 density = 1.3; 2340 } 2341 // for(int i=0;i<NDIM;i++) { 2342 // repetition[i] = atoi(argv[argptr++]); 2343 // if (repetition[i] < 1) 2344 // DoeLog(1) && (eLog()<< Verbose(1) << "repetition value must be greater 1!" << endl); 2345 // repetition[i] = 1; 2346 // } 2347 PrepareClustersinWater(&configuration, mol, volume, density); // if volume == 0, will calculate from ConvexEnvelope 2146 2348 } 2147 2349 break; … … 2241 2443 // handle arguments by ParseCommandLineOptions() 2242 2444 ExitFlag = ParseCommandLineOptions(argc,argv,World::getInstance().getMolecules(),World::getInstance().getPeriode(),*World::getInstance().getConfig(), &ConfigFileName, ArgcList); 2243 World::getInstance().setExitFlag(ExitFlag);2244 2445 // copy all remaining arguments to a new argv 2245 2446 Arguments = new char *[ArgcList.size()]; … … 2255 2456 // handle remaining arguments by CommandLineParser 2256 2457 MapOfActions::getInstance().AddOptionsToParser(); 2257 map <std::string, std::string> ShortFormToActionMap = MapOfActions::getInstance().getShortFormToActionMap(); 2258 CommandLineParser::getInstance().Run(ArgcSize,Arguments, ShortFormToActionMap); 2458 CommandLineParser::getInstance().Run(ArgcSize,Arguments); 2259 2459 if (!CommandLineParser::getInstance().isEmpty()) { 2260 2460 DoLog(0) && (Log() << Verbose(0) << "Setting UI to CommandLine." << endl); … … 2283 2483 delete[](ConfigFileName); 2284 2484 2285 ExitFlag = World::getInstance().getExitFlag();2286 2485 return (ExitFlag == 1 ? 0 : ExitFlag); 2287 2486 } -
src/molecule.cpp
re6317b rf8e486 48 48 for(int i=MAX_ELEMENTS;i--;) 49 49 ElementsInMolecule[i] = 0; 50 strcpy(name,World::getInstance().getDefaultName() .c_str());50 strcpy(name,World::getInstance().getDefaultName()); 51 51 }; 52 52 -
src/moleculelist.cpp
re6317b rf8e486 802 802 strncat(molecules[i]->name, number, MAXSTRINGSIZE - strlen(mol->name) - 1); 803 803 } 804 DoLog(1) && (Log() << Verbose(1) << "MolName is " << molecules[i]->name << ", id is " << molecules[i]->getId() <<endl);804 DoLog(1) && (Log() << Verbose(1) << "MolName is " << molecules[i]->name << endl); 805 805 for (molecule::iterator iter = MolecularWalker->Leaf->begin(); iter != MolecularWalker->Leaf->end(); ++iter) { 806 806 DoLog(1) && (Log() << Verbose(1) << **iter << endl); -
src/periodentafel.cpp
re6317b rf8e486 32 32 periodentafel::periodentafel() 33 33 { 34 bool status = true; 35 status = LoadElementsDatabase(new stringstream(elementsDB,ios_base::in)); 36 ASSERT(status, "General element initialization failed"); 37 status = LoadValenceDatabase(new stringstream(valenceDB,ios_base::in)); 38 ASSERT(status, "Valence entry of element initialization failed"); 39 status = LoadOrbitalsDatabase(new stringstream(orbitalsDB,ios_base::in)); 40 ASSERT(status, "Orbitals entry of element initialization failed"); 41 status = LoadHBondAngleDatabase(new stringstream(HbondangleDB,ios_base::in)); 42 ASSERT(status, "HBond angle entry of element initialization failed"); 43 status = LoadHBondLengthsDatabase(new stringstream(HbonddistanceDB,ios_base::in)); 44 ASSERT(status, "HBond distance entry of element initialization failed"); 34 ASSERT(LoadElementsDatabase(new stringstream(elementsDB,ios_base::in)), "General element initialization failed"); 35 ASSERT(LoadValenceDatabase(new stringstream(valenceDB,ios_base::in)), "Valence entry of element initialization failed"); 36 ASSERT(LoadOrbitalsDatabase(new stringstream(orbitalsDB,ios_base::in)), "Orbitals entry of element initialization failed"); 37 ASSERT(LoadHBondAngleDatabase(new stringstream(HbondangleDB,ios_base::in)), "HBond angle entry of element initialization failed"); 38 ASSERT(LoadHBondLengthsDatabase(new stringstream(HbonddistanceDB,ios_base::in)), "HBond distance entry of element initialization failed"); 45 39 }; 46 40 … … 72 66 * \param *pointer element to be removed 73 67 */ 74 size_tperiodentafel::RemoveElement(element * const pointer)75 { 76 returnRemoveElement(pointer->getNumber());68 void periodentafel::RemoveElement(element * const pointer) 69 { 70 RemoveElement(pointer->getNumber()); 77 71 }; 78 72 … … 80 74 * \param Z element to be removed 81 75 */ 82 size_tperiodentafel::RemoveElement(atomicNumber_t Z)83 { 84 returnelements.erase(Z);76 void periodentafel::RemoveElement(atomicNumber_t Z) 77 { 78 elements.erase(Z); 85 79 }; 86 80 … … 235 229 strncat(filename, STANDARDELEMENTSDB, MAXSTRINGSIZE-strlen(filename)); 236 230 input.open(filename); 237 if (!input.fail())238 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as elements database." << endl);239 231 status = status && LoadElementsDatabase(&input); 240 input.close();241 input.clear();242 232 243 233 // fill valence DB per element … … 246 236 strncat(filename, STANDARDVALENCEDB, MAXSTRINGSIZE-strlen(filename)); 247 237 input.open(filename); 248 if (!input.fail())249 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as valence database." << endl);250 238 otherstatus = otherstatus && LoadValenceDatabase(&input); 251 input.close();252 input.clear();253 239 254 240 // fill orbitals DB per element … … 257 243 strncat(filename, STANDARDORBITALDB, MAXSTRINGSIZE-strlen(filename)); 258 244 input.open(filename); 259 if (!input.fail())260 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as orbitals database." << endl);261 245 otherstatus = otherstatus && LoadOrbitalsDatabase(&input); 262 input.close();263 input.clear();264 246 265 247 // fill H-BondAngle DB per element … … 268 250 strncat(filename, STANDARDHBONDANGLEDB, MAXSTRINGSIZE-strlen(filename)); 269 251 input.open(filename); 270 if (!input.fail())271 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as H bond angle database." << endl);272 252 otherstatus = otherstatus && LoadHBondAngleDatabase(&input); 273 input.close();274 input.clear();275 253 276 254 // fill H-BondDistance DB per element … … 279 257 strncat(filename, STANDARDHBONDDISTANCEDB, MAXSTRINGSIZE-strlen(filename)); 280 258 input.open(filename); 281 if (!input.fail())282 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as H bond length database." << endl);283 259 otherstatus = otherstatus && LoadHBondLengthsDatabase(&input); 284 input.close();285 input.clear();286 260 287 261 if (!otherstatus){ … … 300 274 bool status = true; 301 275 int counter = 0; 302 pair< std::map<atomicNumber_t,element*>::iterator, bool > InserterTest;303 276 if (!(*input).fail()) { 304 277 (*input).getline(header1, MAXSTRINGSIZE); … … 326 299 //(*input) >> ws; 327 300 (*input) >> ws; 301 if (elements.count(neues->Z)) {// if element already present, remove and delete it 302 element * const Elemental = FindElement(neues->Z); 303 ASSERT(Elemental != NULL, "element should be present but is not??"); 304 RemoveElement(Elemental); 305 delete(Elemental); 306 } 328 307 //neues->Output((ofstream *)&cout); 329 if ((neues->getNumber() > 0) && (neues->getNumber() < MAX_ELEMENTS)) { 330 if (elements.count(neues->getNumber())) {// if element already present, remove and delete old one (i.e. replace it) 331 //cout << neues->symbol << " is present already." << endl; 332 element * const Elemental = FindElement(neues->getNumber()); 333 ASSERT(Elemental != NULL, "element should be present but is not??"); 334 *Elemental = *neues; 335 } else { 336 InserterTest = elements.insert(pair <atomicNumber_t,element*> (neues->getNumber(), neues)); 337 ASSERT(InserterTest.second, "Could not insert new element into periodentafel on LoadElementsDatabase()."); 338 } 339 DoLog(0) && (Log() << Verbose(0) << " " << elements[neues->getNumber()]->symbol); 308 if ((neues->Z > 0) && (neues->Z < MAX_ELEMENTS)) { 309 DoLog(0) && (Log() << Verbose(0) << " " << neues->symbol); 310 elements[neues->getNumber()] = neues; 340 311 counter++; 341 312 } else { … … 346 317 } 347 318 DoLog(0) && (Log() << Verbose(0) << endl); 348 } else { 349 DoeLog(1) && (eLog() << Verbose(1) << "Could not open the database." << endl); 319 } else 350 320 status = false; 351 }352 321 353 322 if (counter == 0) -
src/periodentafel.hpp
re6317b rf8e486 44 44 45 45 iterator AddElement(element * const pointer); 46 size_tRemoveElement(element * const pointer);47 size_tRemoveElement(atomicNumber_t);46 void RemoveElement(element * const pointer); 47 void RemoveElement(atomicNumber_t); 48 48 void CleanupPeriodtable(); 49 49 element * const FindElement(atomicNumber_t) const; -
src/unittests/AnalysisCorrelationToPointUnitTest.cpp
re6317b rf8e486 44 44 point = NULL; 45 45 46 // construct element list 47 std::vector<element *> elements; 46 // construct molecule (tetraeder of hydrogens) 48 47 hydrogen = World::getInstance().getPeriode()->FindElement(1); 49 48 CPPUNIT_ASSERT(hydrogen != NULL && "hydrogen element not found"); 50 elements.push_back(hydrogen);51 // construct molecule (tetraeder of hydrogens)52 49 TestMolecule = World::getInstance().createMolecule(); 53 50 Walker = World::getInstance().createAtom(); … … 79 76 80 77 // init maps 81 pointmap = CorrelationToPoint( (MoleculeListClass * const)TestList, elements, (const Vector *)point );78 pointmap = CorrelationToPoint( (MoleculeListClass * const)TestList, (const element * const)hydrogen, (const Vector *)point ); 82 79 binmap = NULL; 83 80 -
src/unittests/AnalysisCorrelationToPointUnitTest.hpp
re6317b rf8e486 37 37 MoleculeListClass *TestList; 38 38 molecule *TestMolecule; 39 element *hydrogen;39 const element *hydrogen; 40 40 41 41 CorrelationToPointMap *pointmap; -
src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
re6317b rf8e486 52 52 LC = NULL; 53 53 54 // prepare element list54 // construct molecule (tetraeder of hydrogens) base 55 55 hydrogen = World::getInstance().getPeriode()->FindElement(1); 56 CPPUNIT_ASSERT(hydrogen != NULL && "hydrogen element not found");57 elements.clear();58 59 // construct molecule (tetraeder of hydrogens) base60 56 TestSurfaceMolecule = World::getInstance().createMolecule(); 61 57 … … 155 151 { 156 152 // do the pair correlation 157 elements.push_back(hydrogen); 158 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC ); 153 surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC ); 159 154 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); 160 155 CPPUNIT_ASSERT( surfacemap != NULL ); … … 165 160 { 166 161 BinPairMap::iterator tester; 167 elements.push_back(hydrogen); 168 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC ); 162 surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC ); 169 163 // put pair correlation into bins and check with no range 170 164 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); … … 181 175 { 182 176 BinPairMap::iterator tester; 183 elements.push_back(hydrogen); 184 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC ); 177 surfacemap = CorrelationToSurface( TestList, hydrogen, Surface, LC ); 185 178 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); 186 179 // ... and check with [0., 2.] range … … 200 193 { 201 194 BinPairMap::iterator tester; 202 elements.push_back(carbon); 203 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC ); 195 surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC ); 204 196 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); 205 197 // put pair correlation into bins and check with no range … … 220 212 { 221 213 BinPairMap::iterator tester; 222 elements.push_back(carbon); 223 surfacemap = CorrelationToSurface( TestList, elements, Surface, LC ); 214 surfacemap = CorrelationToSurface( TestList, carbon, Surface, LC ); 224 215 // OutputCorrelationToSurface ( (ofstream *)&cout, surfacemap ); 225 216 // ... and check with [0., 2.] range -
src/unittests/AnalysisCorrelationToSurfaceUnitTest.hpp
re6317b rf8e486 45 45 MoleculeListClass *TestList; 46 46 molecule *TestSurfaceMolecule; 47 element *hydrogen; 48 element *carbon; 49 std::vector<element *> elements; 47 const element *hydrogen; 48 const element *carbon; 50 49 51 50 CorrelationToSurfaceMap *surfacemap; -
src/unittests/AnalysisPairCorrelationUnitTest.cpp
re6317b rf8e486 47 47 binmap = NULL; 48 48 49 // construct element list 50 std::vector<element *> elements; 49 // construct molecule (tetraeder of hydrogens) 51 50 hydrogen = World::getInstance().getPeriode()->FindElement(1); 52 CPPUNIT_ASSERT(hydrogen != NULL && "hydrogen element not found");53 elements.push_back(hydrogen);54 elements.push_back(hydrogen);55 56 // construct molecule (tetraeder of hydrogens)57 51 TestMolecule = World::getInstance().createMolecule(); 58 52 Walker = World::getInstance().createAtom(); … … 81 75 82 76 // init maps 83 correlationmap = PairCorrelation( TestList, elements);77 correlationmap = PairCorrelation( TestList, hydrogen, hydrogen ); 84 78 binmap = NULL; 85 79 -
src/unittests/AnalysisPairCorrelationUnitTest.hpp
re6317b rf8e486 37 37 MoleculeListClass *TestList; 38 38 molecule *TestMolecule; 39 element *hydrogen;39 const element *hydrogen; 40 40 41 41 PairCorrelationMap *correlationmap; -
tests/Tesselations/defs.in
re6317b rf8e486 54 54 #echo "Current dir is `pwd`, calling $MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz -N $RADIUS $FILENAME." 55 55 if [ -e $mol.dbond ]; then 56 $MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz -A $mol.dbond -N 0 --sphere-radius $RADIUS --nonconvex-file$FILENAME 2>stderr >stdout || exitcode=$?56 $MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz -A $mol.dbond -N $RADIUS $FILENAME 2>stderr >stdout || exitcode=$? 57 57 else 58 $MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz -N 0 --sphere-radius $RADIUS --nonconvex-file$FILENAME 2>stderr >stdout || exitcode=$?58 $MOLECUILDER $mol.conf -e $exec_prefix -p ../$mol.xyz -N $RADIUS $FILENAME 2>stderr >stdout || exitcode=$? 59 59 fi 60 60 #echo "Molecuilder done with exitcode $exitcode." -
tests/regression/Analysis/3/post/bin_output.csv
re6317b rf8e486 5 5 1.5 0 6 6 2 0 7 2.5 18 3 19 3.5 610 4 711 4.5 1012 5 813 5.5 1314 6 57 2.5 0 8 3 0 9 3.5 0 10 4 0 11 4.5 0 12 5 3 13 5.5 2 14 6 3 15 15 6.5 6 16 7 417 7.5 118 8 019 8.5 020 9 021 9.5 022 10 023 10.5 024 11 025 11.5 016 7 2 17 7.5 5 18 8 4 19 8.5 5 20 9 9 21 9.5 9 22 10 5 23 10.5 7 24 11 1 25 11.5 1 26 26 12 0 27 27 12.5 0 -
tests/regression/testsuite-analysis.at
re6317b rf8e486 4 4 AT_KEYWORDS([analysis]) 5 5 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/1/pre/test.conf .], 0) 6 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -C E --elements 1 8 --output-file output.csv --bin-output-file bin_output.csv --bin-start 0 --bin-end20], 0, [stdout], [stderr])6 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -C E 1 8 output.csv bin_output.csv 0 20], 0, [stdout], [stderr]) 7 7 AT_CHECK([fgrep "Begin of PairCorrelation" stdout], 0, [ignore], [ignore]) 8 8 #AT_CHECK([file=output.csv; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/1/post/$file], 0, [ignore], [ignore]) … … 14 14 AT_KEYWORDS([analysis]) 15 15 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/2/pre/test.conf .], 0) 16 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -C E --elements 1 8 --output-file output-5.csv --bin-output-file bin_output-5.csv --bin-start 0 --bin-end5], 0, [stdout], [stderr])16 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -C E 1 8 output-5.csv bin_output-5.csv 0 5], 0, [stdout], [stderr]) 17 17 #AT_CHECK([file=output-5.csv; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/2/post/$file], 0, [ignore], [ignore]) 18 18 AT_CHECK([file=bin_output-5.csv; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/2/post/$file], 0, [ignore], [ignore]) 19 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -C E --elements 1 8 --output-file output-10.csv --bin-output-file bin_output-10.csv --bin-start 5 --bin-end10], 0, [stdout], [stderr])19 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -C E 1 8 output-10.csv bin_output-10.csv 5 10], 0, [stdout], [stderr]) 20 20 #AT_CHECK([file=output-10.csv; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/2/post/$file], 0, [ignore], [ignore]) 21 21 AT_CHECK([file=bin_output-10.csv; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/2/post/$file], 0, [ignore], [ignore]) 22 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -C E --elements 1 8 --output-file output-20.csv --bin-output-file bin_output-20.csv --bin-start 10 --bin-end20], 0, [stdout], [stderr])22 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -C E 1 8 output-20.csv bin_output-20.csv 10 20], 0, [stdout], [stderr]) 23 23 #AT_CHECK([file=output-20.csv; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/2/post/$file], 0, [ignore], [ignore]) 24 24 AT_CHECK([file=bin_output-20.csv; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/2/post/$file], 0, [ignore], [ignore]) … … 29 29 AT_KEYWORDS([analysis]) 30 30 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/3/pre/test.conf .], 0) 31 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 7 -C P --elements 1 --position 10. 10. 10. --output-file output.csv --bin-output-file bin_output.csv --bin-start 0 --bin-end20], 0, [stdout], [stderr])31 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -C P 1 10. 10. 10. output.csv bin_output.csv 0 20], 0, [stdout], [stderr]) 32 32 AT_CHECK([fgrep "Begin of CorrelationToPoint" stdout], 0, [ignore], [ignore]) 33 33 #AT_CHECK([file=output.csv; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/3/post/$file], 0, [ignore], [ignore]) … … 39 39 AT_KEYWORDS([analysis]) 40 40 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/4/pre/test.conf .], 0) 41 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -I -C S --elements 1 --output-file output.csv --bin-output-file bin_output.csv --bin-start 0 --bin-width 1. --bin-end 20 --molecule-by-id 208], 0, [stdout], [stderr])41 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -I -C S 1 output.csv bin_output.csv 1. 0 20], 0, [stdout], [stderr]) 42 42 AT_CHECK([fgrep "Begin of CorrelationToSurface" stdout], 0, [ignore], [ignore]) 43 43 #AT_CHECK([file=output.csv; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/4/post/$file], 0, [ignore], [ignore]) … … 45 45 AT_CLEANUP 46 46 47 # 5. principal axis system48 #AT_SETUP([Analysis - principal axis system])49 #AT_KEYWORDS([analysis])50 #AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/5/pre/test.conf .], 0)51 #AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -m 0], 0, [stdout], [stderr])52 #AT_CHECK([fgrep "eigenvalue = 4382.53," stdout], 0, [ignore], [ignore])53 #AT_CHECK([fgrep "eigenvalue = 4369.24," stdout], 0, [ignore], [ignore])54 #AT_CHECK([fgrep "eigenvalue = 28.9359," stdout], 0, [ignore], [ignore])55 #AT_CLEANUP47 # 4. principal axis system 48 AT_SETUP([Analysis - principal axis system]) 49 AT_KEYWORDS([analysis]) 50 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Analysis/5/pre/test.conf .], 0) 51 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -m 0], 0, [stdout], [stderr]) 52 AT_CHECK([fgrep "eigenvalue = 4382.53," stdout], 0, [ignore], [ignore]) 53 AT_CHECK([fgrep "eigenvalue = 4369.24," stdout], 0, [ignore], [ignore]) 54 AT_CHECK([fgrep "eigenvalue = 28.9359," stdout], 0, [ignore], [ignore]) 55 AT_CLEANUP -
tests/regression/testsuite-filling.at
re6317b rf8e486 10 10 H 0.758602 0. -0.504284 11 11 ]]) 12 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -F water.xyz --MaxDistance -1 --distances 3.1 3.1 3.1 --lengths 2.1 0. 0. --DoRotate0], 0, [stdout], [stderr])12 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 3 -F water.xyz 3.1 3.1 3.1 2.1 0. 0. 0], 0, [stdout], [stderr]) 13 13 AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Filling/1/post/$file], 0, [ignore], [ignore]) 14 14 AT_CLEANUP -
tests/regression/testsuite-fragmentation.at
re6317b rf8e486 12 12 AT_SETUP([Fragmentation - Fragmentation]) 13 13 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Fragmentation/2/pre/test.conf .], 0) 14 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ - v 1 -f 0 --distance 1.55 --order2], 0, [ignore], [ignore])14 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -f 1.55 2], 0, [ignore], [ignore]) 15 15 AT_CHECK([ls -l BondFragment*.conf | wc -l], 0, [5 16 16 ], [ignore]) … … 18 18 19 19 # 3. check whether parsing of BondFragment files and re-rwriting config files is working (exit code is 2 as we don't need to continue wrt to ...OrderAtSite) 20 # NOTE: Result code of 2 is not returned if "-v 1" is missing, then sequence of atoms is changed all the time and Adjacency files never match. 21 AT_SETUP([Fragmentation - BROKEN: Fragmentation is at MaxOrder]) 22 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Fragmentation/3/pre/test.conf .], 0) 23 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 1 -f 0 --distance 1.55 --order 2], 0, [ignore], [ignore]) 24 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 1 -f 0 --distance 1.55 --order 2], [ignore], [ignore], [ignore]) 20 AT_SETUP([Fragmentation - Fragmentation is at MaxOrder]) 21 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Fragmentation/3/pre/* .], 0) 22 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -f 1.55 2], 0, [ignore], [ignore]) 23 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -f 1.55 2], 2, [ignore], [ignore]) 25 24 AT_CLEANUP -
tests/regression/testsuite-molecules.at
re6317b rf8e486 4 4 AT_KEYWORDS([Molecules]) 5 5 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/1/pre/test.* .], 0) 6 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 4 -A test.dbond --molecule-by-id 0], 0, [stdout], [stderr])6 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 4 -A test.dbond], 0, [stdout], [stderr]) 7 7 AT_CHECK([fgrep "Looking for atoms 2 and 9." stdout], 0, [ignore], [ignore]) 8 8 AT_CLEANUP … … 12 12 AT_KEYWORDS([Molecules]) 13 13 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/2/pre/test.conf .], 0) 14 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 1 -j test.dbond --molecule-by-id 0], 0, [stdout], [stderr])14 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 1 -j test.dbond], 0, [stdout], [stderr]) 15 15 AT_CHECK([file=test.dbond; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/2/post/$file], 0, [ignore], [ignore]) 16 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 1 -J test.adj --molecule-by-id 0], 0, [stdout], [stderr])16 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -v 1 -J test.adj], 0, [stdout], [stderr]) 17 17 AT_CHECK([file=test.adj; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/2/post/$file], 0, [ignore], [ignore]) 18 18 AT_CLEANUP … … 22 22 AT_KEYWORDS([Molecules]) 23 23 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/3/pre/test.conf .], 0) 24 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -S test.ekin --molecule-by-id 0], 0, [stdout], [stderr])24 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -S test.ekin], 0, [stdout], [stderr]) 25 25 AT_CHECK([file=test.ekin; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/3/post/$file], 0, [ignore], [ignore]) 26 26 AT_CLEANUP … … 30 30 AT_KEYWORDS([Molecules]) 31 31 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/4/pre/test.conf .], 0) 32 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -L teststep --start-step 0 --end-step 1 --molecule-by-id 0 --id-mapping1], 0, [stdout], [stderr])32 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -L 0 1 teststep 1], 0, [stdout], [stderr]) 33 33 AT_CLEANUP 34 34 … … 37 37 AT_KEYWORDS([Molecules]) 38 38 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/5/pre/test.* .], 0) 39 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -P test.forces --molecule-by-id 0], 134, [stdout], [stderr])39 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -P test.forces], 134, [stdout], [stderr]) 40 40 #AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/5/post/$file], 0, [ignore], [ignore]) 41 41 AT_CLEANUP … … 45 45 AT_KEYWORDS([Molecules]) 46 46 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/6/pre/test.* .], 0) 47 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -t 1. 1. 1. --molecule-by-id 0 --periodic 0], 0, [stdout], [stderr])47 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -t 1. 1. 1.], 0, [stdout], [stderr]) 48 48 AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/6/post/$file], 0, [ignore], [ignore]) 49 49 AT_CLEANUP … … 53 53 AT_KEYWORDS([Molecules]) 54 54 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/7/pre/test.* .], 0) 55 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ - t 12. 12. 12. --molecule-by-id 0 --periodic 1], 0, [stdout], [stderr])55 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -T 12. 12. 12.], 0, [stdout], [stderr]) 56 56 AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Molecules/7/post/$file], 0, [ignore], [ignore]) 57 57 AT_CLEANUP 58 58 59 # 8. Rotate to PAS59 # 8. Periodic translation 60 60 AT_SETUP([Molecules - BROKEN: Rotate to PAS]) 61 61 AT_KEYWORDS([Molecules]) -
tests/regression/testsuite-simple_configuration.at
re6317b rf8e486 25 25 AT_SETUP([Simple configuration - adding atom]) 26 26 AT_KEYWORDS([configuration]) 27 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -a 1 --position10. 10. 10.], 0, [ignore], [ignore])27 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -a 1 10. 10. 10.], 0, [ignore], [ignore]) 28 28 AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore]) 29 29 AT_CHECK([file=test.conf.in; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/3/post/$file], 0, [ignore], [ignore]) … … 35 35 AT_KEYWORDS([configuration]) 36 36 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/pre/test.conf test.conf], 0) 37 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -E 0 --element6], 0, [ignore], [ignore])37 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -E 0 6], 0, [ignore], [ignore]) 38 38 AT_CHECK([file=test.conf; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/4/post/$file], 0, [ignore], [ignore]) 39 39 AT_CLEANUP … … 53 53 AT_KEYWORDS([configuration]) 54 54 AT_CHECK([../../molecuilder empty.conf -e ${abs_top_srcdir}/src/ -t -s -b -E -c -b -a -U -T -u], 255, [ignore], [stderr]) 55 AT_CHECK([fgrep -c "Not enough " stderr], 0, [155 AT_CHECK([fgrep -c "Not enough or invalid" stderr], 0, [1 56 56 ], [ignore]) 57 57 AT_CLEANUP … … 62 62 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/7/pre/test.conf .], 0) 63 63 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -t], 255, [ignore], [stderr]) 64 AT_CHECK([fgrep -c "CRITICAL: Not enough " stderr], 0, [ignore], [ignore])64 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 65 65 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -s -b -E -c -b -a -U -T -u], 255, [ignore], [stderr]) 66 AT_CHECK([fgrep -c "CRITICAL: Not enough " stderr], 0, [ignore], [ignore])66 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 67 67 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -b -E -c -b -a -U -T -u], 255, [ignore], [stderr]) 68 AT_CHECK([fgrep -c "CRITICAL: Not enough " stderr], 0, [ignore], [ignore])68 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 69 69 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -E -c -b -a -U -T -u], 255, [ignore], [stderr]) 70 AT_CHECK([fgrep -c "CRITICAL: Not enough " stderr], 0, [ignore], [ignore])70 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 71 71 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -c -b -a -U -T -u], 255, [ignore], [stderr]) 72 AT_CHECK([fgrep -c "CRITICAL: Not enough " stderr], 0, [ignore], [ignore])72 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 73 73 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -b -a -U -T -u], 255, [ignore], [stderr]) 74 AT_CHECK([fgrep -c "CRITICAL: Not enough " stderr], 0, [ignore], [ignore])74 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 75 75 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -a -U -T -u], 255, [ignore], [stderr]) 76 AT_CHECK([fgrep -c "CRITICAL: Not enough " stderr], 0, [ignore], [ignore])76 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 77 77 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -U -T -u], 255, [ignore], [stderr]) 78 AT_CHECK([fgrep -c "CRITICAL: Not enough " stderr], 0, [ignore], [ignore])78 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 79 79 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -T -u], 255, [ignore], [stderr]) 80 AT_CHECK([fgrep -c "CRITICAL: Not enough " stderr], 0, [ignore], [ignore])80 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 81 81 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -u], 255, [ignore], [stderr]) 82 AT_CHECK([fgrep -c "CRITICAL: Not enough " stderr], 0, [ignore], [ignore])82 AT_CHECK([fgrep -c "CRITICAL: Not enough or invalid" stderr], 0, [ignore], [ignore]) 83 83 AT_CLEANUP 84 84 … … 87 87 AT_KEYWORDS([configuration]) 88 88 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/pre/test.* .], 0) 89 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -R 7. --position 7.283585982 3.275186040 3.535886037], 0, [stdout], [stderr])89 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -R 7.283585982 3.275186040 3.535886037 7.], 0, [stdout], [stderr]) 90 90 AT_CHECK([sort -n test.conf.xyz | grep -v "Created by" >test.conf.xyz-sorted], 0, [ignore], [ignore]) 91 91 AT_CHECK([sort -n ${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/test.conf.xyz | grep -v "Created by" >${abs_top_srcdir}/${AUTOTEST_PATH}/Simple_configuration/8/post/test.conf.xyz-sorted], 0, [ignore], [ignore]) -
tests/regression/testsuite-standard_options.at
re6317b rf8e486 51 51 AT_SETUP([Standard Options - fast trajectories]) 52 52 AT_KEYWORDS([options]) 53 AT_CHECK([../../molecuilder test.conf -n 1], 0, [stdout], [stderr])53 AT_CHECK([../../molecuilder test.conf -n], 0, [stdout], [stderr]) 54 54 AT_CHECK([fgrep "I won't parse trajectories" stdout], 0, [ignore], [ignore]) 55 55 AT_CLEANUP -
tests/regression/testsuite-tesselation.at
re6317b rf8e486 4 4 AT_KEYWORDS([Tesselation]) 5 5 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/1/pre/* .], 0) 6 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -N 0 --sphere-radius 4. --nonconvex-fileNonConvexEnvelope], 0, [stdout], [stderr])6 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -N 4. NonConvexEnvelope], 0, [stdout], [stderr]) 7 7 AT_CHECK([file=NonConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/1/post/$file], 0, [ignore], [ignore]) 8 8 AT_CHECK([file=NonConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/1/post/$file], 0, [ignore], [ignore]) … … 12 12 AT_SETUP([Tesselation - Convex Envelope]) 13 13 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/2/pre/* .], 0) 14 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -o 0 --convex-file ConvexEnvelope --nonconvex-file NonConvexEnvelope], 0, [stdout], [stderr])14 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -o ConvexEnvelope NonConvexEnvelope], 0, [stdout], [stderr]) 15 15 AT_CHECK([file=ConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/2/post/$file], 0, [ignore], [ignore]) 16 16 AT_CHECK([file=ConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/2/post/$file], 0, [ignore], [ignore]) … … 22 22 AT_SETUP([Tesselation - Big non-Convex Envelope]) 23 23 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/3/pre/* .], 0) 24 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -N 0 --sphere-radius 4. --nonconvex-fileNonConvexEnvelope], 0, [stdout], [stderr])24 AT_CHECK([../../molecuilder test.conf -e ${abs_top_srcdir}/src/ -N 4. NonConvexEnvelope], 0, [stdout], [stderr]) 25 25 AT_CHECK([file=NonConvexEnvelope.dat; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/3/post/$file], 0, [ignore], [ignore]) 26 26 AT_CHECK([file=NonConvexEnvelope.r3d; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Tesselation/3/post/$file], 0, [ignore], [ignore])
Note:
See TracChangeset
for help on using the changeset viewer.