Changeset 84c494 for src


Ignore:
Timestamp:
Jun 30, 2010, 1:55:42 PM (15 years ago)
Author:
Tillmann Crueger <crueger@…>
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
Message:

Made the world store the cell_size within a Box object.

Location:
src
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/AnalysisAction/PairCorrelationAction.cpp

    r9df5c6 r84c494  
    6767  dialog = UIFactory::getInstance().makeDialog();
    6868  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"));
    7070  if (type == "S")
    7171    dialog->queryMolecule("molecule-by-id", &Boundary, MapOfActions::getInstance().getDescription("molecule-by-id"));
  • src/Actions/AtomAction/AddAction.cpp

    r9df5c6 r84c494  
    4141
    4242  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"));
    4444  cout << "pre-dialog" << endl;
    4545
  • src/Actions/MoleculeAction/FillWithMoleculeAction.cpp

    r9df5c6 r84c494  
    6262
    6363  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"));
    6666  dialog->queryBoolean("DoRotate", &DoRotate, MapOfActions::getInstance().getDescription("DoRotate"));
    6767  dialog->queryDouble("MaxDistance", &MaxDistance, MapOfActions::getInstance().getDescription("MaxDistance"));
  • src/Actions/MoleculeAction/TranslateAction.cpp

    r9df5c6 r84c494  
    5555  bool periodic = false;
    5656
    57   dialog->queryVector(NAME, &x, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription(NAME));
     57  dialog->queryVector(NAME, &x, false, MapOfActions::getInstance().getDescription(NAME));
    5858  dialog->queryMolecule("molecule-by-id", &mol, MapOfActions::getInstance().getDescription("molecule-by-id"));
    5959  dialog->queryBoolean("periodic", &periodic, MapOfActions::getInstance().getDescription("periodic"));
  • src/Actions/WorldAction/AddEmptyBoundaryAction.cpp

    r9df5c6 r84c494  
    4141  int j=0;
    4242
    43   dialog->queryVector(NAME, &boundary, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription(NAME));
     43  dialog->queryVector(NAME, &boundary, false, MapOfActions::getInstance().getDescription(NAME));
    4444
    4545  if(dialog->display()) {
     
    5959    }
    6060    // set new box size
    61     double * const cell_size = World::getInstance().getDomain();
     61    double * const cell_size = new double[6];
    6262    for (j=0;j<6;j++)
    6363      cell_size[j] = 0.;
     
    6767      cell_size[j] = (Max[i]-Min[i]+2.*boundary[i]);
    6868    }
     69    World::getInstance().setDomain(cell_size);
     70    delete[] cell_size;
    6971    // translate all atoms, such that Min is aty (0,0,0)
    7072    AtomRunner = AllAtoms.begin();
  • src/Actions/WorldAction/CenterInBoxAction.cpp

    r9df5c6 r84c494  
    3434  Dialog *dialog = UIFactory::getInstance().makeDialog();
    3535
    36   double * cell_size = World::getInstance().getDomain();
     36  Box& cell_size = World::getInstance().getDomain();
    3737  dialog->queryBox(NAME, &cell_size, MapOfActions::getInstance().getDescription(NAME));
    3838
  • src/Actions/WorldAction/CenterOnEdgeAction.cpp

    r9df5c6 r84c494  
    1313#include "vector.hpp"
    1414#include "World.hpp"
     15#include "Matrix.hpp"
    1516
    1617#include <iostream>
     
    3738  Vector Min;
    3839  Vector Max;
    39   int j=0;
    4040
    4141  dialog->queryEmpty(NAME, MapOfActions::getInstance().getDescription(NAME));
     
    5757    }
    5858    // 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;
    6360    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;
    6664    }
     65    cout << "new domain is: " << domain << endl;
     66    World::getInstance().setDomain(domain);
    6767    // translate all atoms, such that Min is aty (0,0,0)
    6868    for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner)
  • src/Actions/WorldAction/ChangeBoxAction.cpp

    r9df5c6 r84c494  
    1212#include "verbose.hpp"
    1313#include "World.hpp"
     14#include "Box.hpp"
    1415
    1516#include <iostream>
     
    3435  Dialog *dialog = UIFactory::getInstance().makeDialog();
    3536
    36   double * cell_size = World::getInstance().getDomain();
     37  Box& cell_size = World::getInstance().getDomain();
    3738  dialog->queryBox(NAME, &cell_size, MapOfActions::getInstance().getDescription(NAME));
    3839
    3940  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);
    4142    delete dialog;
    4243    return Action::success;
  • src/Actions/WorldAction/RemoveSphereOfAtomsAction.cpp

    r9df5c6 r84c494  
    4141
    4242  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"));
    4444
    4545  if(dialog->display()) {
  • src/Actions/WorldAction/RepeatBoxAction.cpp

    r9df5c6 r84c494  
    1616#include "verbose.hpp"
    1717#include "World.hpp"
     18#include "Box.hpp"
    1819
    1920#include <iostream>
     
    4748  MoleculeListClass *molecules = World::getInstance().getMolecules();
    4849
    49   dialog->queryVector(NAME, &Repeater, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription(NAME));
     50  dialog->queryVector(NAME, &Repeater, false, MapOfActions::getInstance().getDescription(NAME));
    5051  //dialog->queryMolecule("molecule-by-id", &mol,MapOfActions::getInstance().getDescription("molecule-by-id"));
    5152  vector<molecule *> AllMolecules;
     
    6061  if(dialog->display()) {
    6162    (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;
    6465    Vector x,y;
    6566    int n[NDIM];
     
    7071        Repeater[axis] = 1;
    7172      }
    72       cell_size[(abs(axis+1) == 2) ? 2 : ((abs(axis+2) == 3) ? 5 : 0)] *= Repeater[axis];
     73      newM.at(axis,axis) *= Repeater[axis];
    7374    }
     75    World::getInstance().getDomain().setM(newM);
    7476
    7577    molecule *newmol = NULL;
  • src/Actions/WorldAction/ScaleBoxAction.cpp

    r9df5c6 r84c494  
    1414#include "verbose.hpp"
    1515#include "World.hpp"
     16#include "Box.hpp"
    1617
    1718#include <iostream>
     
    3738  Vector Scaler;
    3839  double x[NDIM];
    39   int j=0;
    4040
    41   dialog->queryVector(NAME, &Scaler, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription(NAME));
     41  dialog->queryVector(NAME, &Scaler, false, MapOfActions::getInstance().getDescription(NAME));
    4242
    4343  if(dialog->display()) {
     
    4949      (*AtomRunner)->x.ScaleAll(x);
    5050    }
    51     j = -1;
    52     double * const cell_size = World::getInstance().getDomain();
     51
     52    Matrix M = World::getInstance().getDomain().getM();
    5353    for (int i=0;i<NDIM;i++) {
    54       j += i+1;
    55       cell_size[j]*=x[i];
     54      M.at(i,i) *= x[i];
    5655    }
    5756
  • src/Parser/PcpParser.cpp

    r9df5c6 r84c494  
    2020#include "verbose.hpp"
    2121#include "World.hpp"
     22#include "Matrix.hpp"
     23#include "Box.hpp"
    2224
    2325/** Constructor of PcpParser.
     
    209211  // Unit cell and magnetic field
    210212  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];
    212214  cell_size[0] = BoxLength[0];
    213215  cell_size[1] = BoxLength[3];
     
    216218  cell_size[4] = BoxLength[7];
    217219  cell_size[5] = BoxLength[8];
     220  World::getInstance().setDomain(cell_size);
     221  delete[] cell_size;
    218222  //if (1) fprintf(stderr,"\n");
    219223
     
    326330void PcpParser::save(std::ostream* file)
    327331{
    328   const double * const cell_size = World::getInstance().getDomain();
     332  const Matrix &domain = World::getInstance().getDomain().getM();
    329333  class ThermoStatContainer *Thermostats = World::getInstance().getThermostats();
    330334  if (!file->fail()) {
     
    411415    *file << endl;
    412416    *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;
    416420    // FIXME
    417421    *file << endl;
  • src/UIElements/CommandLineUI/CommandLineDialog.cpp

    r9df5c6 r84c494  
    2727#include "verbose.hpp"
    2828#include "World.hpp"
     29#include "Box.hpp"
    2930
    3031#include "atom.hpp"
     
    7374}
    7475
    75 void CommandLineDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check, string _description) {
    76   registerQuery(new VectorCommandLineQuery(title,target,cellSize,check, _description));
    77 }
    78 
    79 void CommandLineDialog::queryBox(const char* title, double ** const cellSize, string _description) {
     76void CommandLineDialog::queryVector(const char* title, Vector *target, bool check, string _description) {
     77  registerQuery(new VectorCommandLineQuery(title,target,check, _description));
     78}
     79
     80void CommandLineDialog::queryBox(const char* title, Box* cellSize, string _description) {
    8081  registerQuery(new BoxCommandLineQuery(title,cellSize,_description));
    8182}
     
    202203}
    203204
    204 CommandLineDialog::VectorCommandLineQuery::VectorCommandLineQuery(string title, Vector *_target, const double *const _cellSize, bool _check, string _description) :
    205     Dialog::VectorQuery(title,_target,_cellSize,_check, _description)
     205CommandLineDialog::VectorCommandLineQuery::VectorCommandLineQuery(string title, Vector *_target, bool _check, string _description) :
     206    Dialog::VectorQuery(title,_target,_check, _description)
    206207{}
    207208
     
    224225
    225226
    226 CommandLineDialog::BoxCommandLineQuery::BoxCommandLineQuery(string title, double ** const _cellSize, string _description) :
     227CommandLineDialog::BoxCommandLineQuery::BoxCommandLineQuery(string title, Box* _cellSize, string _description) :
    227228    Dialog::BoxQuery(title,_cellSize, _description)
    228229{}
  • src/UIElements/CommandLineUI/CommandLineDialog.hpp

    r9df5c6 r84c494  
    3434  virtual void queryAtom(const char*,atom**, std::string = "");
    3535  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 = "");
    3838  virtual void queryElement(const char*, std::vector<element *> *, std::string = "");
    3939
     
    9191  class VectorCommandLineQuery : public Dialog::VectorQuery {
    9292  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 = "");
    9494    virtual ~VectorCommandLineQuery();
    9595    virtual bool handle();
     
    9898  class BoxCommandLineQuery : public Dialog::BoxQuery {
    9999  public:
    100     BoxCommandLineQuery(std::string title,double ** const _cellSize, std::string _description = "");
     100    BoxCommandLineQuery(std::string title,Box* _cellSize, std::string _description = "");
    101101    virtual ~BoxCommandLineQuery();
    102102    virtual bool handle();
  • src/UIElements/Dialog.cpp

    r9df5c6 r84c494  
    1414#include "molecule.hpp"
    1515#include "vector.hpp"
     16#include "Matrix.hpp"
     17#include "Box.hpp"
    1618
    1719using namespace std;
     
    162164// Vector Queries
    163165
    164 Dialog::VectorQuery::VectorQuery(std::string title,Vector *_target,const double *const _cellSize,bool _check, std::string _description) :
     166Dialog::VectorQuery::VectorQuery(std::string title,Vector *_target,bool _check, std::string _description) :
    165167  Query(title, _description),
    166   cellSize(_cellSize),
    167168  check(_check),
    168169  target(_target)
     
    182183// Box Queries
    183184
    184 Dialog::BoxQuery::BoxQuery(std::string title, double ** const _cellSize, std::string _description) :
     185Dialog::BoxQuery::BoxQuery(std::string title, Box* _cellSize, std::string _description) :
    185186  Query(title, _description),
    186187  target(_cellSize)
     
    195196
    196197void Dialog::BoxQuery::setResult() {
    197   for (int i=0;i<6;i++) {
    198     (*target)[i] = tmp[i];
    199   }
     198  (*target)= ReturnFullMatrixforSymmetric(tmp);
    200199}
    201200
  • src/UIElements/Dialog.hpp

    r9df5c6 r84c494  
    1414
    1515class atom;
     16class Box;
    1617class element;
    1718class molecule;
     
    3132  virtual void queryAtom(const char*,atom**,std::string = "")=0;
    3233  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;
    3536  virtual void queryElement(const char*, std::vector<element *> *, std::string = "")=0;
    3637
     
    148149  class VectorQuery : public Query {
    149150  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 = "");
    151152      virtual ~VectorQuery();
    152153      virtual bool handle()=0;
     
    154155    protected:
    155156      Vector *tmp;
    156       const double *const cellSize;
    157157      bool check;
    158158    private:
     
    162162  class BoxQuery : public Query {
    163163  public:
    164       BoxQuery(std::string title,double ** const _cellSize, std::string _description = "");
     164      BoxQuery(std::string title,Box *_cellSize, std::string _description = "");
    165165      virtual ~BoxQuery();
    166166      virtual bool handle()=0;
    167167      virtual void setResult();
    168168    protected:
    169       double *tmp;
     169      double* tmp;
    170170    private:
    171       double **target;
     171      Box* target;
    172172  };
    173173
  • src/UIElements/TextUI/TextDialog.cpp

    r9df5c6 r84c494  
    2525#include "molecule.hpp"
    2626#include "vector.hpp"
     27#include "Matrix.hpp"
     28#include "Box.hpp"
    2729
    2830using namespace std;
     
    6668}
    6769
    68 void TextDialog::queryVector(const char* title, Vector *target,const double *const cellSize, bool check, string description) {
    69   registerQuery(new VectorTextQuery(title,target,cellSize,check,description));
    70 }
    71 
    72 void TextDialog::queryBox(const char* title,double ** const cellSize, string description) {
     70void TextDialog::queryVector(const char* title, Vector *target, bool check, string description) {
     71  registerQuery(new VectorTextQuery(title,target,check,description));
     72}
     73
     74void TextDialog::queryBox(const char* title,Box* cellSize, string description) {
    7375  registerQuery(new BoxTextQuery(title,cellSize,description));
    7476}
     
    243245}
    244246
    245 TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, const double *const _cellSize, bool _check, std::string _description) :
    246     Dialog::VectorQuery(title,_target,_cellSize,_check,_description)
     247TextDialog::VectorTextQuery::VectorTextQuery(std::string title, Vector *_target, bool _check, std::string _description) :
     248    Dialog::VectorQuery(title,_target,_check,_description)
    247249{}
    248250
     
    253255  Log() << Verbose(0) << getTitle();
    254256
     257  const Matrix &M = World::getInstance().getDomain().getM();
    255258  char coords[3] = {'x','y','z'};
    256   int j = -1;
    257259  for (int i=0;i<3;i++) {
    258     j += i+1;
    259260    do {
    260       Log() << Verbose(0) << coords[i] << "[0.." << cellSize[j] << "]: ";
     261      Log() << Verbose(0) << coords[i] << "[0.." << M.at(i,i) << "]: ";
    261262      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));
    263264  }
    264265  return true;
    265266}
    266267
    267 TextDialog::BoxTextQuery::BoxTextQuery(std::string title, double ** const _cellSize, std::string _description) :
     268TextDialog::BoxTextQuery::BoxTextQuery(std::string title, Box* _cellSize, std::string _description) :
    268269    Dialog::BoxQuery(title,_cellSize,_description)
    269270{}
  • src/UIElements/TextUI/TextDialog.hpp

    r9df5c6 r84c494  
    3131  virtual void queryAtom(const char*,atom**,std::string = "");
    3232  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 = "");
    3535  virtual void queryElement(const char*, std::vector<element *> *, std::string = "");
    3636
     
    8888  class VectorTextQuery : public Dialog::VectorQuery {
    8989  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);
    9191    virtual ~VectorTextQuery();
    9292    virtual bool handle();
     
    9595  class BoxTextQuery : public Dialog::BoxQuery {
    9696  public:
    97     BoxTextQuery(std::string title,double ** const _cellSize, std::string _description = NULL);
     97    BoxTextQuery(std::string title,Box* _cellSize, std::string _description = NULL);
    9898    virtual ~BoxTextQuery();
    9999    virtual bool handle();
  • src/World.cpp

    r9df5c6 r84c494  
    2222#include "Actions/ManipulateAtomsProcess.hpp"
    2323#include "Helpers/Assert.hpp"
     24#include "Box.hpp"
     25#include "Matrix.hpp"
    2426
    2527#include "Patterns/Singleton_impl.hpp"
     
    7476// system
    7577
    76 double * World::getDomain() {
    77   return cell_size;
     78Box& World::getDomain() {
     79  return *cell_size;
     80}
     81
     82void World::setDomain(const Matrix &mat){
     83  *cell_size = mat;
    7884}
    7985
    8086void World::setDomain(double * matrix)
    8187{
    82 
     88  Matrix M = ReturnFullMatrixforSymmetric(matrix);
     89  cell_size->setM(M);
    8390}
    8491
     
    133140  molecules.erase(id);
    134141}
    135 
    136 double *World::cell_size = NULL;
    137142
    138143atom *World::createAtom(){
     
    297302    molecules_deprecated(new MoleculeListClass(this))
    298303{
    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);
    306310  defaultName = "none";
    307311  molecules_deprecated->signOn(this);
     
    311315{
    312316  molecules_deprecated->signOff(this);
    313   delete[] cell_size;
     317  delete cell_size;
    314318  delete molecules_deprecated;
    315319  delete periode;
  • src/World.hpp

    r9df5c6 r84c494  
    3434class AtomDescriptor_impl;
    3535template<typename T> class AtomsCalculation;
     36class Box;
    3637class config;
    3738class ManipulateAtomsProcess;
     39class Matrix;
    3840class molecule;
    3941class MoleculeDescriptor;
     
    125127   * get the domain size as a symmetric matrix (6 components)
    126128   */
    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);
    128137
    129138  /**
     
    257266  periodentafel *periode;
    258267  config *configuration;
    259   static double *cell_size;
     268  Box *cell_size;
    260269  std::string defaultName;
    261270  class ThermoStatContainer *Thermostats;
  • src/analysis_correlation.cpp

    r9df5c6 r84c494  
    2222#include "verbose.hpp"
    2323#include "World.hpp"
     24#include "Box.hpp"
    2425
    2526
     
    3536  PairCorrelationMap *outmap = NULL;
    3637  double distance = 0.;
    37   double *domain = World::getInstance().getDomain();
     38  const Matrix &domain = World::getInstance().getDomain().getM();
    3839
    3940  if (molecules->ListOfMolecules.empty()) {
     
    136137  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++){
    137138    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();
    140141      DoeLog(2) && (eLog()<< Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    141142      eLog() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl;
     
    190191  CorrelationToPointMap *outmap = NULL;
    191192  double distance = 0.;
    192   double *cell_size = World::getInstance().getDomain();
     193  const Matrix &domain = World::getInstance().getDomain().getM();
    193194
    194195  if (molecules->ListOfMolecules.empty()) {
     
    206207        for (vector<element *>::const_iterator type = elements.begin(); type != elements.end(); ++type)
    207208          if ((*type == NULL) || ((*iter)->type == *type)) {
    208             distance = (*iter)->node->PeriodicDistance(*point, cell_size);
     209            distance = (*iter)->node->PeriodicDistance(*point, domain);
    209210            DoLog(4) && (Log() << Verbose(4) << "Current distance is " << distance << "." << endl);
    210211            outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) );
     
    241242  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    242243    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();
    245246      DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    246247      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
     
    343344  for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin(); MolWalker != molecules->ListOfMolecules.end(); MolWalker++)
    344345    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();
    347348      DoLog(2) && (Log() << Verbose(2) << "Current molecule is " << *MolWalker << "." << endl);
    348349      for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) {
  • src/boundary.cpp

    r9df5c6 r84c494  
    2323#include "Plane.hpp"
    2424#include "Matrix.hpp"
     25#include "Box.hpp"
    2526
    2627#include<gsl/gsl_poly.h>
     
    765766  int N[NDIM];
    766767  int n[NDIM];
    767   Matrix M = ReturnFullMatrixforSymmetric(World::getInstance().getDomain());
     768  const Matrix &M = World::getInstance().getDomain().getM();
    768769  Matrix Rotations;
    769   Matrix MInverse = M.invert();
     770  const Matrix &MInverse = World::getInstance().getDomain().getMinv();
    770771  Vector AtomTranslations;
    771772  Vector FillerTranslations;
  • src/config.cpp

    r9df5c6 r84c494  
    2626#include "ThermoStatContainer.hpp"
    2727#include "World.hpp"
     28#include "Matrix.hpp"
     29#include "Box.hpp"
    2830
    2931/************************************* Functions for class config ***************************/
     
    679681  // Unit cell and magnetic field
    680682  ParseForParameter(verbose,FileBuffer, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */
    681   double * const cell_size = World::getInstance().getDomain();
     683  double * cell_size = new double[6];
    682684  cell_size[0] = BoxLength[0];
    683685  cell_size[1] = BoxLength[3];
     
    686688  cell_size[4] = BoxLength[7];
    687689  cell_size[5] = BoxLength[8];
     690  World::getInstance().setDomain(cell_size);
     691  delete cell_size;
    688692  //if (1) fprintf(stderr,"\n");
    689693
     
    883887
    884888  ParseForParameter(verbose,file, "BoxLength", 0, 3, 3, lower_trigrid, BoxLength, 1, critical); /* Lattice->RealBasis */
    885   double * const cell_size = World::getInstance().getDomain();
     889  double * cell_size = new double[6];
    886890  cell_size[0] = BoxLength[0];
    887891  cell_size[1] = BoxLength[3];
     
    890894  cell_size[4] = BoxLength[7];
    891895  cell_size[5] = BoxLength[8];
     896  World::getInstance().setDomain(cell_size);
     897  delete[] cell_size;
    892898  if (1) fprintf(stderr,"\n");
    893899  config::DoPerturbation = 0;
     
    10271033  // bring MaxTypes up to date
    10281034  mol->CountElements();
    1029   const double * const cell_size = World::getInstance().getDomain();
     1035  const Matrix &domain = World::getInstance().getDomain().getM();
    10301036  ofstream * const output = new ofstream(filename, ios::out);
    10311037  if (output != NULL) {
     
    10981104    *output << endl;
    10991105    *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;
    11031109    // FIXME
    11041110    *output << endl;
  • src/molecule.cpp

    r9df5c6 r84c494  
    3030#include "Matrix.hpp"
    3131#include "World.hpp"
     32#include "Box.hpp"
    3233#include "Plane.hpp"
    3334#include "Exceptions/LinearDependenceException.hpp"
     
    286287  Vector Orthovector1, Orthovector2;  // temporary vectors in coordination construction
    287288  Vector InBondvector;    // vector in direction of *Bond
    288   Matrix matrix;
     289  const Matrix &matrix =  World::getInstance().getDomain().getM();
    289290  bond *Binder = NULL;
    290   double * const cell_size = World::getInstance().getDomain();
    291291
    292292//  Log() << Verbose(3) << "Begin of AddHydrogenReplacementAtom." << endl;
     
    309309      } // (signs are correct, was tested!)
    310310    }
    311     matrix = ReturnFullMatrixforSymmetric(cell_size);
    312311    Orthovector1 *= matrix;
    313312    InBondvector -= Orthovector1; // subtract just the additional translation
     
    754753void molecule::SetBoxDimension(Vector *dim)
    755754{
    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);
    763759};
    764760
     
    853849bool molecule::CheckBounds(const Vector *x) const
    854850{
    855   double * const cell_size = World::getInstance().getDomain();
     851  const Matrix &domain = World::getInstance().getDomain().getM();
    856852  bool result = true;
    857   int j =-1;
    858853  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)));
    861855  }
    862856  //return result;
  • src/molecule_fragmentation.cpp

    r9df5c6 r84c494  
    2323#include "World.hpp"
    2424#include "Matrix.hpp"
     25#include "Box.hpp"
    2526
    2627/************************************* Functions for class molecule *********************************/
     
    17091710  atom *Walker = NULL;
    17101711  atom *OtherWalker = NULL;
    1711   double * const cell_size = World::getInstance().getDomain();
    1712   Matrix matrix = ReturnFullMatrixforSymmetric(cell_size);
     1712  Matrix matrix = World::getInstance().getDomain().getM();
    17131713  enum Shading *ColorList = NULL;
    17141714  double tmp;
  • src/molecule_geometry.cpp

    r9df5c6 r84c494  
    2020#include "Plane.hpp"
    2121#include "Matrix.hpp"
     22#include "Box.hpp"
    2223#include <boost/foreach.hpp>
    2324
     
    3435  const Vector *Center = DetermineCenterOfAll();
    3536  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();
    3939
    4040  // go through all atoms
     
    5656{
    5757  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();
    6160
    6261  // go through all atoms
     
    153152{
    154153  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();
    158155  (*a) *= M;
    159 
    160156  return a;
    161157};
     
    243239void molecule::TranslatePeriodically(const Vector *trans)
    244240{
    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();
    248243
    249244  // go through all atoms
     
    273268void molecule::DeterminePeriodicCenter(Vector &center)
    274269{
    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();
    278272  double tmp;
    279273  bool flag;
  • src/molecule_graph.cpp

    r9df5c6 r84c494  
    2525#include "Helpers/Assert.hpp"
    2626#include "Matrix.hpp"
     27#include "Box.hpp"
    2728
    2829
     
    122123  LinkedCell *LC = NULL;
    123124  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();
    126126
    127127  if (BG == NULL) {
  • src/moleculelist.cpp

    r9df5c6 r84c494  
    2424#include "periodentafel.hpp"
    2525#include "Helpers/Assert.hpp"
     26#include "Matrix.hpp"
     27#include "Box.hpp"
    2628
    2729#include "Helpers/Assert.hpp"
     
    631633  int FragmentCounter = 0;
    632634  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
    639638  // store the fragments as config and as xyz
    640639  for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
     
    674673    (*ListRunner)->CenterEdge(&BoxDimension);
    675674    (*ListRunner)->SetBoxDimension(&BoxDimension); // update Box of atoms by boundary
    676     int j = -1;
    677675    for (int k = 0; k < NDIM; k++) {
    678       j += k + 1;
    679676      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);
    682680    (*ListRunner)->Translate(&BoxDimension);
    683681
     
    725723
    726724  // 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);
    729726
    730727  return result;
     
    887884  // center at set box dimensions
    888885  mol->CenterEdge(&center);
    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);
    895890  insert(mol);
    896891}
Note: See TracChangeset for help on using the changeset viewer.