- Timestamp:
- Jun 30, 2010, 1:55:42 PM (15 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 4907a3
- Parents:
- 9df5c6
- Location:
- src
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/AnalysisAction/PairCorrelationAction.cpp
r9df5c6 r84c494 67 67 dialog = UIFactory::getInstance().makeDialog(); 68 68 if (type == "P") 69 dialog->queryVector("position", &Point, World::getInstance().getDomain(),false, MapOfActions::getInstance().getDescription("position"));69 dialog->queryVector("position", &Point, false, MapOfActions::getInstance().getDescription("position")); 70 70 if (type == "S") 71 71 dialog->queryMolecule("molecule-by-id", &Boundary, MapOfActions::getInstance().getDescription("molecule-by-id")); -
src/Actions/AtomAction/AddAction.cpp
r9df5c6 r84c494 41 41 42 42 dialog->queryElement(NAME, &elements, MapOfActions::getInstance().getDescription(NAME)); 43 dialog->queryVector("position", &position, World::getInstance().getDomain(),true, MapOfActions::getInstance().getDescription("position"));43 dialog->queryVector("position", &position, true, MapOfActions::getInstance().getDescription("position")); 44 44 cout << "pre-dialog" << endl; 45 45 -
src/Actions/MoleculeAction/FillWithMoleculeAction.cpp
r9df5c6 r84c494 62 62 63 63 dialog->queryString(NAME, &filename, MapOfActions::getInstance().getDescription(NAME)); 64 dialog->queryVector("distances", &distances, World::getInstance().getDomain(),false, MapOfActions::getInstance().getDescription("distances"));65 dialog->queryVector("lengths", &lengths, World::getInstance().getDomain(),false, MapOfActions::getInstance().getDescription("lengths"));64 dialog->queryVector("distances", &distances, false, MapOfActions::getInstance().getDescription("distances")); 65 dialog->queryVector("lengths", &lengths, false, MapOfActions::getInstance().getDescription("lengths")); 66 66 dialog->queryBoolean("DoRotate", &DoRotate, MapOfActions::getInstance().getDescription("DoRotate")); 67 67 dialog->queryDouble("MaxDistance", &MaxDistance, MapOfActions::getInstance().getDescription("MaxDistance")); -
src/Actions/MoleculeAction/TranslateAction.cpp
r9df5c6 r84c494 55 55 bool periodic = false; 56 56 57 dialog->queryVector(NAME, &x, World::getInstance().getDomain(),false, MapOfActions::getInstance().getDescription(NAME));57 dialog->queryVector(NAME, &x, false, MapOfActions::getInstance().getDescription(NAME)); 58 58 dialog->queryMolecule("molecule-by-id", &mol, MapOfActions::getInstance().getDescription("molecule-by-id")); 59 59 dialog->queryBoolean("periodic", &periodic, MapOfActions::getInstance().getDescription("periodic")); -
src/Actions/WorldAction/AddEmptyBoundaryAction.cpp
r9df5c6 r84c494 41 41 int j=0; 42 42 43 dialog->queryVector(NAME, &boundary, World::getInstance().getDomain(),false, MapOfActions::getInstance().getDescription(NAME));43 dialog->queryVector(NAME, &boundary, false, MapOfActions::getInstance().getDescription(NAME)); 44 44 45 45 if(dialog->display()) { … … 59 59 } 60 60 // set new box size 61 double * const cell_size = World::getInstance().getDomain();61 double * const cell_size = new double[6]; 62 62 for (j=0;j<6;j++) 63 63 cell_size[j] = 0.; … … 67 67 cell_size[j] = (Max[i]-Min[i]+2.*boundary[i]); 68 68 } 69 World::getInstance().setDomain(cell_size); 70 delete[] cell_size; 69 71 // translate all atoms, such that Min is aty (0,0,0) 70 72 AtomRunner = AllAtoms.begin(); -
src/Actions/WorldAction/CenterInBoxAction.cpp
r9df5c6 r84c494 34 34 Dialog *dialog = UIFactory::getInstance().makeDialog(); 35 35 36 double *cell_size = World::getInstance().getDomain();36 Box& cell_size = World::getInstance().getDomain(); 37 37 dialog->queryBox(NAME, &cell_size, MapOfActions::getInstance().getDescription(NAME)); 38 38 -
src/Actions/WorldAction/CenterOnEdgeAction.cpp
r9df5c6 r84c494 13 13 #include "vector.hpp" 14 14 #include "World.hpp" 15 #include "Matrix.hpp" 15 16 16 17 #include <iostream> … … 37 38 Vector Min; 38 39 Vector Max; 39 int j=0;40 40 41 41 dialog->queryEmpty(NAME, MapOfActions::getInstance().getDescription(NAME)); … … 57 57 } 58 58 // set new box size 59 double * const cell_size = World::getInstance().getDomain(); 60 for (j=0;j<6;j++) 61 cell_size[j] = 0.; 62 j=-1; 59 Matrix domain; 63 60 for (int i=0;i<NDIM;i++) { 64 j += i+1; 65 cell_size[j] = (Max[i]-Min[i]); 61 double tmp = Max[i]-Min[i]; 62 tmp = fabs(tmp)>=1. ? tmp : 1.0; 63 domain.at(i,i) = tmp; 66 64 } 65 cout << "new domain is: " << domain << endl; 66 World::getInstance().setDomain(domain); 67 67 // translate all atoms, such that Min is aty (0,0,0) 68 68 for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) -
src/Actions/WorldAction/ChangeBoxAction.cpp
r9df5c6 r84c494 12 12 #include "verbose.hpp" 13 13 #include "World.hpp" 14 #include "Box.hpp" 14 15 15 16 #include <iostream> … … 34 35 Dialog *dialog = UIFactory::getInstance().makeDialog(); 35 36 36 double *cell_size = World::getInstance().getDomain();37 Box& cell_size = World::getInstance().getDomain(); 37 38 dialog->queryBox(NAME, &cell_size, MapOfActions::getInstance().getDescription(NAME)); 38 39 39 40 if(dialog->display()) { 40 DoLog(0) && (Log() << Verbose(0) << "Setting box domain to " << cell_size [0] << "," << cell_size[1] << "," << cell_size[2] << "," << cell_size[3] << "," << cell_size[4] << "," << cell_size[5] << ","<< endl);41 DoLog(0) && (Log() << Verbose(0) << "Setting box domain to " << cell_size.getM() << endl); 41 42 delete dialog; 42 43 return Action::success; -
src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp
r9df5c6 r84c494 41 41 42 42 dialog->queryDouble(NAME, &radius, MapOfActions::getInstance().getDescription(NAME)); 43 dialog->queryVector("position", &point, World::getInstance().getDomain(),false, MapOfActions::getInstance().getDescription("position"));43 dialog->queryVector("position", &point, false, MapOfActions::getInstance().getDescription("position")); 44 44 45 45 if(dialog->display()) { -
src/Actions/WorldAction/RepeatBoxAction.cpp
r9df5c6 r84c494 16 16 #include "verbose.hpp" 17 17 #include "World.hpp" 18 #include "Box.hpp" 18 19 19 20 #include <iostream> … … 47 48 MoleculeListClass *molecules = World::getInstance().getMolecules(); 48 49 49 dialog->queryVector(NAME, &Repeater, World::getInstance().getDomain(),false, MapOfActions::getInstance().getDescription(NAME));50 dialog->queryVector(NAME, &Repeater, false, MapOfActions::getInstance().getDescription(NAME)); 50 51 //dialog->queryMolecule("molecule-by-id", &mol,MapOfActions::getInstance().getDescription("molecule-by-id")); 51 52 vector<molecule *> AllMolecules; … … 60 61 if(dialog->display()) { 61 62 (cout << "Repeating box " << Repeater << " times for (x,y,z) axis." << endl); 62 double * const cell_size = World::getInstance().getDomain();63 Matrix M = ReturnFullMatrixforSymmetric(cell_size);63 const Matrix &M = World::getInstance().getDomain().getM(); 64 Matrix newM = M; 64 65 Vector x,y; 65 66 int n[NDIM]; … … 70 71 Repeater[axis] = 1; 71 72 } 72 cell_size[(abs(axis+1) == 2) ? 2 : ((abs(axis+2) == 3) ? 5 : 0)]*= Repeater[axis];73 newM.at(axis,axis) *= Repeater[axis]; 73 74 } 75 World::getInstance().getDomain().setM(newM); 74 76 75 77 molecule *newmol = NULL; -
src/Actions/WorldAction/ScaleBoxAction.cpp
r9df5c6 r84c494 14 14 #include "verbose.hpp" 15 15 #include "World.hpp" 16 #include "Box.hpp" 16 17 17 18 #include <iostream> … … 37 38 Vector Scaler; 38 39 double x[NDIM]; 39 int j=0;40 40 41 dialog->queryVector(NAME, &Scaler, World::getInstance().getDomain(),false, MapOfActions::getInstance().getDescription(NAME));41 dialog->queryVector(NAME, &Scaler, false, MapOfActions::getInstance().getDescription(NAME)); 42 42 43 43 if(dialog->display()) { … … 49 49 (*AtomRunner)->x.ScaleAll(x); 50 50 } 51 j = -1; 52 double * const cell_size = World::getInstance().getDomain();51 52 Matrix M = World::getInstance().getDomain().getM(); 53 53 for (int i=0;i<NDIM;i++) { 54 j += i+1; 55 cell_size[j]*=x[i]; 54 M.at(i,i) *= x[i]; 56 55 } 57 56 -
src/Parser/PcpParser.cpp
r9df5c6 r84c494 20 20 #include "verbose.hpp" 21 21 #include "World.hpp" 22 #include "Matrix.hpp" 23 #include "Box.hpp" 22 24 23 25 /** Constructor of PcpParser. … … 209 211 // Unit cell and magnetic field 210 212 ParseForParameter(verbose,FileBuffer, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */ 211 double * const cell_size = World::getInstance().getDomain();213 double *cell_size = new double[6]; 212 214 cell_size[0] = BoxLength[0]; 213 215 cell_size[1] = BoxLength[3]; … … 216 218 cell_size[4] = BoxLength[7]; 217 219 cell_size[5] = BoxLength[8]; 220 World::getInstance().setDomain(cell_size); 221 delete[] cell_size; 218 222 //if (1) fprintf(stderr,"\n"); 219 223 … … 326 330 void PcpParser::save(std::ostream* file) 327 331 { 328 const double * const cell_size = World::getInstance().getDomain();332 const Matrix &domain = World::getInstance().getDomain().getM(); 329 333 class ThermoStatContainer *Thermostats = World::getInstance().getThermostats(); 330 334 if (!file->fail()) { … … 411 415 *file << endl; 412 416 *file << "BoxLength\t\t\t# (Length of a unit cell)" << endl; 413 *file << cell_size[0]<< "\t" << endl;414 *file << cell_size[1] << "\t" << cell_size[2]<< "\t" << endl;415 *file << cell_size[3] << "\t" << cell_size[4] << "\t" << cell_size[5]<< "\t" << endl;417 *file << domain.at(0,0) << "\t" << endl; 418 *file << domain.at(1,0) << "\t" << domain.at(1,1) << "\t" << endl; 419 *file << domain.at(2,0) << "\t" << domain.at(2,1) << "\t" << domain.at(2,2) << "\t" << endl; 416 420 // FIXME 417 421 *file << endl; -
src/UIElements/CommandLineUI/CommandLineDialog.cpp
r9df5c6 r84c494 27 27 #include "verbose.hpp" 28 28 #include "World.hpp" 29 #include "Box.hpp" 29 30 30 31 #include "atom.hpp" … … 73 74 } 74 75 75 void CommandLineDialog::queryVector(const char* title, Vector *target, const double *const cellSize,bool check, string _description) {76 registerQuery(new VectorCommandLineQuery(title,target,c ellSize,check, _description));77 } 78 79 void CommandLineDialog::queryBox(const char* title, double ** constcellSize, string _description) {76 void CommandLineDialog::queryVector(const char* title, Vector *target, bool check, string _description) { 77 registerQuery(new VectorCommandLineQuery(title,target,check, _description)); 78 } 79 80 void CommandLineDialog::queryBox(const char* title, Box* cellSize, string _description) { 80 81 registerQuery(new BoxCommandLineQuery(title,cellSize,_description)); 81 82 } … … 202 203 } 203 204 204 CommandLineDialog::VectorCommandLineQuery::VectorCommandLineQuery(string title, Vector *_target, const double *const _cellSize,bool _check, string _description) :205 Dialog::VectorQuery(title,_target,_c ellSize,_check, _description)205 CommandLineDialog::VectorCommandLineQuery::VectorCommandLineQuery(string title, Vector *_target, bool _check, string _description) : 206 Dialog::VectorQuery(title,_target,_check, _description) 206 207 {} 207 208 … … 224 225 225 226 226 CommandLineDialog::BoxCommandLineQuery::BoxCommandLineQuery(string title, double ** const_cellSize, string _description) :227 CommandLineDialog::BoxCommandLineQuery::BoxCommandLineQuery(string title, Box* _cellSize, string _description) : 227 228 Dialog::BoxQuery(title,_cellSize, _description) 228 229 {} -
src/UIElements/CommandLineUI/CommandLineDialog.hpp
r9df5c6 r84c494 34 34 virtual void queryAtom(const char*,atom**, std::string = ""); 35 35 virtual void queryMolecule(const char*,molecule**,std::string = ""); 36 virtual void queryVector(const char*,Vector *, const double * const,bool, std::string = "");37 virtual void queryBox(const char*, double ** const, std::string = "");36 virtual void queryVector(const char*,Vector *,bool, std::string = ""); 37 virtual void queryBox(const char*,Box *, std::string = ""); 38 38 virtual void queryElement(const char*, std::vector<element *> *, std::string = ""); 39 39 … … 91 91 class VectorCommandLineQuery : public Dialog::VectorQuery { 92 92 public: 93 VectorCommandLineQuery(std::string title,Vector *_target, const double *const _cellSize,bool _check, std::string _description = "");93 VectorCommandLineQuery(std::string title,Vector *_target,bool _check, std::string _description = ""); 94 94 virtual ~VectorCommandLineQuery(); 95 95 virtual bool handle(); … … 98 98 class BoxCommandLineQuery : public Dialog::BoxQuery { 99 99 public: 100 BoxCommandLineQuery(std::string title, double ** const_cellSize, std::string _description = "");100 BoxCommandLineQuery(std::string title,Box* _cellSize, std::string _description = ""); 101 101 virtual ~BoxCommandLineQuery(); 102 102 virtual bool handle(); -
src/UIElements/Dialog.cpp
r9df5c6 r84c494 14 14 #include "molecule.hpp" 15 15 #include "vector.hpp" 16 #include "Matrix.hpp" 17 #include "Box.hpp" 16 18 17 19 using namespace std; … … 162 164 // Vector Queries 163 165 164 Dialog::VectorQuery::VectorQuery(std::string title,Vector *_target, const double *const _cellSize,bool _check, std::string _description) :166 Dialog::VectorQuery::VectorQuery(std::string title,Vector *_target,bool _check, std::string _description) : 165 167 Query(title, _description), 166 cellSize(_cellSize),167 168 check(_check), 168 169 target(_target) … … 182 183 // Box Queries 183 184 184 Dialog::BoxQuery::BoxQuery(std::string title, double ** const_cellSize, std::string _description) :185 Dialog::BoxQuery::BoxQuery(std::string title, Box* _cellSize, std::string _description) : 185 186 Query(title, _description), 186 187 target(_cellSize) … … 195 196 196 197 void Dialog::BoxQuery::setResult() { 197 for (int i=0;i<6;i++) { 198 (*target)[i] = tmp[i]; 199 } 198 (*target)= ReturnFullMatrixforSymmetric(tmp); 200 199 } 201 200 -
src/UIElements/Dialog.hpp
r9df5c6 r84c494 14 14 15 15 class atom; 16 class Box; 16 17 class element; 17 18 class molecule; … … 31 32 virtual void queryAtom(const char*,atom**,std::string = "")=0; 32 33 virtual void queryMolecule(const char*,molecule**, std::string = "")=0; 33 virtual void queryVector(const char*,Vector *, const double *const,bool, std::string = "")=0;34 virtual void queryBox(const char*, double ** const, std::string = "")=0;34 virtual void queryVector(const char*,Vector *,bool, std::string = "")=0; 35 virtual void queryBox(const char*,Box*, std::string = "")=0; 35 36 virtual void queryElement(const char*, std::vector<element *> *, std::string = "")=0; 36 37 … … 148 149 class VectorQuery : public Query { 149 150 public: 150 VectorQuery(std::string title,Vector *_target, const double *const _cellSize,bool _check, std::string _description = "");151 VectorQuery(std::string title,Vector *_target,bool _check, std::string _description = ""); 151 152 virtual ~VectorQuery(); 152 153 virtual bool handle()=0; … … 154 155 protected: 155 156 Vector *tmp; 156 const double *const cellSize;157 157 bool check; 158 158 private: … … 162 162 class BoxQuery : public Query { 163 163 public: 164 BoxQuery(std::string title, double ** const_cellSize, std::string _description = "");164 BoxQuery(std::string title,Box *_cellSize, std::string _description = ""); 165 165 virtual ~BoxQuery(); 166 166 virtual bool handle()=0; 167 167 virtual void setResult(); 168 168 protected: 169 double *tmp;169 double* tmp; 170 170 private: 171 double **target;171 Box* target; 172 172 }; 173 173 -
src/UIElements/TextUI/TextDialog.cpp
r9df5c6 r84c494 25 25 #include "molecule.hpp" 26 26 #include "vector.hpp" 27 #include "Matrix.hpp" 28 #include "Box.hpp" 27 29 28 30 using namespace std; … … 66 68 } 67 69 68 void TextDialog::queryVector(const char* title, Vector *target, const double *const cellSize,bool check, string description) {69 registerQuery(new VectorTextQuery(title,target,c ellSize,check,description));70 } 71 72 void TextDialog::queryBox(const char* title, double ** constcellSize, string description) {70 void TextDialog::queryVector(const char* title, Vector *target, bool check, string description) { 71 registerQuery(new VectorTextQuery(title,target,check,description)); 72 } 73 74 void TextDialog::queryBox(const char* title,Box* cellSize, string description) { 73 75 registerQuery(new BoxTextQuery(title,cellSize,description)); 74 76 } … … 243 245 } 244 246 245 TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, const double *const _cellSize,bool _check, std::string _description) :246 Dialog::VectorQuery(title,_target,_c ellSize,_check,_description)247 TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, bool _check, std::string _description) : 248 Dialog::VectorQuery(title,_target,_check,_description) 247 249 {} 248 250 … … 253 255 Log() << Verbose(0) << getTitle(); 254 256 257 const Matrix &M = World::getInstance().getDomain().getM(); 255 258 char coords[3] = {'x','y','z'}; 256 int j = -1;257 259 for (int i=0;i<3;i++) { 258 j += i+1;259 260 do { 260 Log() << Verbose(0) << coords[i] << "[0.." << cellSize[j]<< "]: ";261 Log() << Verbose(0) << coords[i] << "[0.." << M.at(i,i) << "]: "; 261 262 cin >> (*tmp)[i]; 262 } while ((((*tmp)[i] < 0) || ((*tmp)[i] >= cellSize[j])) && (check));263 } while ((((*tmp)[i] < 0) || ((*tmp)[i] >= M.at(i,i))) && (check)); 263 264 } 264 265 return true; 265 266 } 266 267 267 TextDialog::BoxTextQuery::BoxTextQuery(std::string title, double ** const_cellSize, std::string _description) :268 TextDialog::BoxTextQuery::BoxTextQuery(std::string title, Box* _cellSize, std::string _description) : 268 269 Dialog::BoxQuery(title,_cellSize,_description) 269 270 {} -
src/UIElements/TextUI/TextDialog.hpp
r9df5c6 r84c494 31 31 virtual void queryAtom(const char*,atom**,std::string = ""); 32 32 virtual void queryMolecule(const char*,molecule**,std::string = ""); 33 virtual void queryVector(const char*,Vector *, const double * const,bool, std::string = "");34 virtual void queryBox(const char*, double ** const, std::string = "");33 virtual void queryVector(const char*,Vector *,bool, std::string = ""); 34 virtual void queryBox(const char*,Box*, std::string = ""); 35 35 virtual void queryElement(const char*, std::vector<element *> *, std::string = ""); 36 36 … … 88 88 class VectorTextQuery : public Dialog::VectorQuery { 89 89 public: 90 VectorTextQuery(std::string title,Vector *_target, const double *const _cellSize,bool _check, std::string _description = NULL);90 VectorTextQuery(std::string title,Vector *_target,bool _check, std::string _description = NULL); 91 91 virtual ~VectorTextQuery(); 92 92 virtual bool handle(); … … 95 95 class BoxTextQuery : public Dialog::BoxQuery { 96 96 public: 97 BoxTextQuery(std::string title, double ** const_cellSize, std::string _description = NULL);97 BoxTextQuery(std::string title,Box* _cellSize, std::string _description = NULL); 98 98 virtual ~BoxTextQuery(); 99 99 virtual bool handle(); -
src/World.cpp
r9df5c6 r84c494 22 22 #include "Actions/ManipulateAtomsProcess.hpp" 23 23 #include "Helpers/Assert.hpp" 24 #include "Box.hpp" 25 #include "Matrix.hpp" 24 26 25 27 #include "Patterns/Singleton_impl.hpp" … … 74 76 // system 75 77 76 double * World::getDomain() { 77 return cell_size; 78 Box& World::getDomain() { 79 return *cell_size; 80 } 81 82 void World::setDomain(const Matrix &mat){ 83 *cell_size = mat; 78 84 } 79 85 80 86 void World::setDomain(double * matrix) 81 87 { 82 88 Matrix M = ReturnFullMatrixforSymmetric(matrix); 89 cell_size->setM(M); 83 90 } 84 91 … … 133 140 molecules.erase(id); 134 141 } 135 136 double *World::cell_size = NULL;137 142 138 143 atom *World::createAtom(){ … … 297 302 molecules_deprecated(new MoleculeListClass(this)) 298 303 { 299 cell_size = new double[6]; 300 cell_size[0] = 20.; 301 cell_size[1] = 0.; 302 cell_size[2] = 20.; 303 cell_size[3] = 0.; 304 cell_size[4] = 0.; 305 cell_size[5] = 20.; 304 cell_size = new Box; 305 Matrix domain; 306 domain.at(0,0) = 20; 307 domain.at(1,1) = 20; 308 domain.at(2,2) = 20; 309 cell_size->setM(domain); 306 310 defaultName = "none"; 307 311 molecules_deprecated->signOn(this); … … 311 315 { 312 316 molecules_deprecated->signOff(this); 313 delete []cell_size;317 delete cell_size; 314 318 delete molecules_deprecated; 315 319 delete periode; -
src/World.hpp
r9df5c6 r84c494 34 34 class AtomDescriptor_impl; 35 35 template<typename T> class AtomsCalculation; 36 class Box; 36 37 class config; 37 38 class ManipulateAtomsProcess; 39 class Matrix; 38 40 class molecule; 39 41 class MoleculeDescriptor; … … 125 127 * get the domain size as a symmetric matrix (6 components) 126 128 */ 127 double * getDomain(); 129 Box& getDomain(); 130 131 /** 132 * Set the domain size from a matrix object 133 * 134 * Matrix needs to be symmetric 135 */ 136 void setDomain(const Matrix &mat); 128 137 129 138 /** … … 257 266 periodentafel *periode; 258 267 config *configuration; 259 static double*cell_size;268 Box *cell_size; 260 269 std::string defaultName; 261 270 class ThermoStatContainer *Thermostats; -
src/analysis_correlation.cpp
r9df5c6 r84c494 22 22 #include "verbose.hpp" 23 23 #include "World.hpp" 24 #include "Box.hpp" 24 25 25 26 … … 35 36 PairCorrelationMap *outmap = NULL; 36 37 double distance = 0.; 37 double *domain = World::getInstance().getDomain();38 const Matrix &domain = World::getInstance().getDomain().getM(); 38 39 39 40 if (molecules->ListOfMolecules.empty()) { … … 136 137 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++){ 137 138 if ((*MolWalker)->ActiveFlag) { 138 Matrix FullMatrix = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());139 Matrix FullInverseMatrix = FullMatrix.invert();139 Matrix FullMatrix = World::getInstance().getDomain().getM(); 140 Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv(); 140 141 DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 141 142 eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl; … … 190 191 CorrelationToPointMap *outmap = NULL; 191 192 double distance = 0.; 192 double *cell_size = World::getInstance().getDomain();193 const Matrix &domain = World::getInstance().getDomain().getM(); 193 194 194 195 if (molecules->ListOfMolecules.empty()) { … … 206 207 for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type) 207 208 if ((*type == NULL) || ((*iter)->type == *type)) { 208 distance = (*iter)->node->PeriodicDistance(*point, cell_size);209 distance = (*iter)->node->PeriodicDistance(*point, domain); 209 210 DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl); 210 211 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) ); … … 241 242 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 242 243 if ((*MolWalker)->ActiveFlag) { 243 Matrix FullMatrix = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());244 Matrix FullInverseMatrix = FullMatrix.invert();244 Matrix FullMatrix = World::getInstance().getDomain().getM(); 245 Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv(); 245 246 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 246 247 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { … … 343 344 for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++) 344 345 if ((*MolWalker)->ActiveFlag) { 345 Matrix FullMatrix = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());346 Matrix FullInverseMatrix = FullMatrix.invert();346 Matrix FullMatrix = World::getInstance().getDomain().getM(); 347 Matrix FullInverseMatrix = World::getInstance().getDomain().getMinv(); 347 348 DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl); 348 349 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { -
src/boundary.cpp
r9df5c6 r84c494 23 23 #include "Plane.hpp" 24 24 #include "Matrix.hpp" 25 #include "Box.hpp" 25 26 26 27 #include<gsl/gsl_poly.h> … … 765 766 int N[NDIM]; 766 767 int n[NDIM]; 767 Matrix M = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());768 const Matrix &M = World::getInstance().getDomain().getM(); 768 769 Matrix Rotations; 769 Matrix MInverse = M.invert();770 const Matrix &MInverse = World::getInstance().getDomain().getMinv(); 770 771 Vector AtomTranslations; 771 772 Vector FillerTranslations; -
src/config.cpp
r9df5c6 r84c494 26 26 #include "ThermoStatContainer.hpp" 27 27 #include "World.hpp" 28 #include "Matrix.hpp" 29 #include "Box.hpp" 28 30 29 31 /************************************* Functions for class config ***************************/ … … 679 681 // Unit cell and magnetic field 680 682 ParseForParameter(verbose,FileBuffer, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */ 681 double * c onst cell_size = World::getInstance().getDomain();683 double * cell_size = new double[6]; 682 684 cell_size[0] = BoxLength[0]; 683 685 cell_size[1] = BoxLength[3]; … … 686 688 cell_size[4] = BoxLength[7]; 687 689 cell_size[5] = BoxLength[8]; 690 World::getInstance().setDomain(cell_size); 691 delete cell_size; 688 692 //if (1) fprintf(stderr,"\n"); 689 693 … … 883 887 884 888 ParseForParameter(verbose,file, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */ 885 double * c onst cell_size = World::getInstance().getDomain();889 double * cell_size = new double[6]; 886 890 cell_size[0] = BoxLength[0]; 887 891 cell_size[1] = BoxLength[3]; … … 890 894 cell_size[4] = BoxLength[7]; 891 895 cell_size[5] = BoxLength[8]; 896 World::getInstance().setDomain(cell_size); 897 delete[] cell_size; 892 898 if (1) fprintf(stderr,"\n"); 893 899 config::DoPerturbation = 0; … … 1027 1033 // bring MaxTypes up to date 1028 1034 mol->CountElements(); 1029 const double * const cell_size = World::getInstance().getDomain();1035 const Matrix &domain = World::getInstance().getDomain().getM(); 1030 1036 ofstream * const output = new ofstream(filename, ios::out); 1031 1037 if (output != NULL) { … … 1098 1104 *output << endl; 1099 1105 *output << "BoxLength\t\t\t# (Length of a unit cell)" << endl; 1100 *output << cell_size[0]<< "\t" << endl;1101 *output << cell_size[1] << "\t" << cell_size[2]<< "\t" << endl;1102 *output << cell_size[3] << "\t" << cell_size[4] << "\t" << cell_size[5]<< "\t" << endl;1106 *output << domain.at(0,0) << "\t" << endl; 1107 *output << domain.at(1,0) << "\t" << domain.at(1,1) << "\t" << endl; 1108 *output << domain.at(2,0) << "\t" << domain.at(2,1) << "\t" << domain.at(2,2) << "\t" << endl; 1103 1109 // FIXME 1104 1110 *output << endl; -
src/molecule.cpp
r9df5c6 r84c494 30 30 #include "Matrix.hpp" 31 31 #include "World.hpp" 32 #include "Box.hpp" 32 33 #include "Plane.hpp" 33 34 #include "Exceptions/LinearDependenceException.hpp" … … 286 287 Vector Orthovector1, Orthovector2; // temporary vectors in coordination construction 287 288 Vector InBondvector; // vector in direction of *Bond 288 Matrix matrix;289 const Matrix &matrix = World::getInstance().getDomain().getM(); 289 290 bond *Binder = NULL; 290 double * const cell_size = World::getInstance().getDomain();291 291 292 292 // Log() << Verbose(3) << "Begin of AddHydrogenReplacementAtom." << endl; … … 309 309 } // (signs are correct, was tested!) 310 310 } 311 matrix = ReturnFullMatrixforSymmetric(cell_size);312 311 Orthovector1 *= matrix; 313 312 InBondvector -= Orthovector1; // subtract just the additional translation … … 754 753 void molecule::SetBoxDimension(Vector *dim) 755 754 { 756 double * const cell_size = World::getInstance().getDomain(); 757 cell_size[0] = dim->at(0); 758 cell_size[1] = 0.; 759 cell_size[2] = dim->at(1); 760 cell_size[3] = 0.; 761 cell_size[4] = 0.; 762 cell_size[5] = dim->at(2); 755 Matrix domain; 756 for(int i =0; i<NDIM;++i) 757 domain.at(i,i) = dim->at(i); 758 World::getInstance().setDomain(domain); 763 759 }; 764 760 … … 853 849 bool molecule::CheckBounds(const Vector *x) const 854 850 { 855 double * const cell_size = World::getInstance().getDomain();851 const Matrix &domain = World::getInstance().getDomain().getM(); 856 852 bool result = true; 857 int j =-1;858 853 for (int i=0;i<NDIM;i++) { 859 j += i+1; 860 result = result && ((x->at(i) >= 0) && (x->at(i) < cell_size[j])); 854 result = result && ((x->at(i) >= 0) && (x->at(i) < domain.at(i,i))); 861 855 } 862 856 //return result; -
src/molecule_fragmentation.cpp
r9df5c6 r84c494 23 23 #include "World.hpp" 24 24 #include "Matrix.hpp" 25 #include "Box.hpp" 25 26 26 27 /************************************* Functions for class molecule *********************************/ … … 1709 1710 atom *Walker = NULL; 1710 1711 atom *OtherWalker = NULL; 1711 double * const cell_size = World::getInstance().getDomain(); 1712 Matrix matrix = ReturnFullMatrixforSymmetric(cell_size); 1712 Matrix matrix = World::getInstance().getDomain().getM(); 1713 1713 enum Shading *ColorList = NULL; 1714 1714 double tmp; -
src/molecule_geometry.cpp
r9df5c6 r84c494 20 20 #include "Plane.hpp" 21 21 #include "Matrix.hpp" 22 #include "Box.hpp" 22 23 #include <boost/foreach.hpp> 23 24 … … 34 35 const Vector *Center = DetermineCenterOfAll(); 35 36 const Vector *CenterBox = DetermineCenterOfBox(); 36 double * const cell_size = World::getInstance().getDomain(); 37 Matrix M = ReturnFullMatrixforSymmetric(cell_size); 38 Matrix Minv = M.invert(); 37 const Matrix &M = World::getInstance().getDomain().getM(); 38 const Matrix &Minv = World::getInstance().getDomain().getMinv(); 39 39 40 40 // go through all atoms … … 56 56 { 57 57 bool status = true; 58 double * const cell_size = World::getInstance().getDomain(); 59 Matrix M = ReturnFullMatrixforSymmetric(cell_size); 60 Matrix Minv = M.invert(); 58 const Matrix &M = World::getInstance().getDomain().getM(); 59 const Matrix &Minv = World::getInstance().getDomain().getMinv(); 61 60 62 61 // go through all atoms … … 153 152 { 154 153 Vector *a = new Vector(0.5,0.5,0.5); 155 156 const double *cell_size = World::getInstance().getDomain(); 157 Matrix M = ReturnFullMatrixforSymmetric(cell_size); 154 const Matrix &M = World::getInstance().getDomain().getM(); 158 155 (*a) *= M; 159 160 156 return a; 161 157 }; … … 243 239 void molecule::TranslatePeriodically(const Vector *trans) 244 240 { 245 double * const cell_size = World::getInstance().getDomain(); 246 Matrix M = ReturnFullMatrixforSymmetric(cell_size); 247 Matrix Minv = M.invert(); 241 const Matrix &M = World::getInstance().getDomain().getM(); 242 const Matrix &Minv = World::getInstance().getDomain().getMinv(); 248 243 249 244 // go through all atoms … … 273 268 void molecule::DeterminePeriodicCenter(Vector ¢er) 274 269 { 275 double * const cell_size = World::getInstance().getDomain(); 276 Matrix matrix = ReturnFullMatrixforSymmetric(cell_size); 277 Matrix inversematrix = matrix.invert(); 270 const Matrix &matrix = World::getInstance().getDomain().getM(); 271 const Matrix &inversematrix = World::getInstance().getDomain().getM(); 278 272 double tmp; 279 273 bool flag; -
src/molecule_graph.cpp
r9df5c6 r84c494 25 25 #include "Helpers/Assert.hpp" 26 26 #include "Matrix.hpp" 27 #include "Box.hpp" 27 28 28 29 … … 122 123 LinkedCell *LC = NULL; 123 124 bool free_BG = false; 124 double * const cell_size = World::getInstance().getDomain(); 125 Matrix M = ReturnFullMatrixforSymmetric(cell_size); 125 const Matrix &M = World::getInstance().getDomain().getM(); 126 126 127 127 if (BG == NULL) { -
src/moleculelist.cpp
r9df5c6 r84c494 24 24 #include "periodentafel.hpp" 25 25 #include "Helpers/Assert.hpp" 26 #include "Matrix.hpp" 27 #include "Box.hpp" 26 28 27 29 #include "Helpers/Assert.hpp" … … 631 633 int FragmentCounter = 0; 632 634 ofstream output; 633 double cell_size_backup[6]; 634 double * const cell_size = World::getInstance().getDomain(); 635 636 // backup cell_size 637 for (int i=0;i<6;i++) 638 cell_size_backup[i] = cell_size[i]; 635 Matrix cell_size = World::getInstance().getDomain().getM(); 636 Matrix cell_size_backup = cell_size; 637 639 638 // store the fragments as config and as xyz 640 639 for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) { … … 674 673 (*ListRunner)->CenterEdge(&BoxDimension); 675 674 (*ListRunner)->SetBoxDimension(&BoxDimension); // update Box of atoms by boundary 676 int j = -1;677 675 for (int k = 0; k < NDIM; k++) { 678 j += k + 1;679 676 BoxDimension[k] = 2.5 * (World::getInstance().getConfig()->GetIsAngstroem() ? 1. : 1. / AtomicLengthToAngstroem); 680 cell_size[j] = BoxDimension[k] * 2.; 681 } 677 cell_size.at(k,k) = BoxDimension[k] * 2.; 678 } 679 World::getInstance().setDomain(cell_size); 682 680 (*ListRunner)->Translate(&BoxDimension); 683 681 … … 725 723 726 724 // restore cell_size 727 for (int i=0;i<6;i++) 728 cell_size[i] = cell_size_backup[i]; 725 World::getInstance().setDomain(cell_size_backup); 729 726 730 727 return result; … … 887 884 // center at set box dimensions 888 885 mol->CenterEdge(¢er); 889 World::getInstance().getDomain()[0] = center[0]; 890 World::getInstance().getDomain()[1] = 0; 891 World::getInstance().getDomain()[2] = center[1]; 892 World::getInstance().getDomain()[3] = 0; 893 World::getInstance().getDomain()[4] = 0; 894 World::getInstance().getDomain()[5] = center[2]; 886 Matrix domain; 887 for(int i =0;i<NDIM;++i) 888 domain.at(i,i) = center[i]; 889 World::getInstance().setDomain(domain); 895 890 insert(mol); 896 891 }
Note:
See TracChangeset
for help on using the changeset viewer.