Ignore:
Timestamp:
Aug 7, 2009, 9:13:21 AM (16 years ago)
Author:
Frederik Heber <heber@…>
Children:
ef5521
Parents:
8f9a8e
Message:

Test case of filling a simulation domain with water included.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/molecules.cpp

    r8f9a8e r0fc0b5  
    741741  delete(Minv);
    742742  delete(Center);
     743  return status;
     744};
     745
     746
     747/** Bounds the molecule in the box whose lengths are defined by vector \a *BoxLengths.
     748 * \param *out output stream for debugging
     749 */
     750bool molecule::BoundInBox(ofstream *out)
     751{
     752  bool status = true;
     753  Vector x;
     754  double *M = ReturnFullMatrixforSymmetric(cell_size);
     755  double *Minv = x.InverseMatrix(M);
     756
     757  // go through all atoms
     758  atom *ptr = start;  // start at first in list
     759  while (ptr->next != end) {  // continue with second if present
     760    ptr = ptr->next;
     761    //ptr->Output(1,1,out);
     762    // multiply its vector with matrix inverse
     763    x.CopyVector(&ptr->x);
     764    x.MatrixMultiplication(Minv);
     765    // truncate to [0,1] for each axis
     766    for (int i=0;i<NDIM;i++) {
     767      while (x.x[i] >= 1.)
     768        x.x[i] -= 1.;
     769      while (x.x[i] < 0.)
     770        x.x[i] += 1.;
     771    }
     772    x.MatrixMultiplication(M);
     773    ptr->x.CopyVector(&x);
     774  }
     775  delete(M);
     776  delete(Minv);
    743777  return status;
    744778};
Note: See TracChangeset for help on using the changeset viewer.