wrap of coordinates

Asked by Chiara Modenese

Hi,

how to wrap particles coordinates inside the periodic cell? Currently, I can only access their absolute values in space. Is there a function to do so? I guess there should be since we must remember how far from the main cell a particle has travelled.

Thanks,
Chiara

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#1

Cell.hpp :

The most general ones:

/*! Return point inside periodic cell, even if shear is applied */
Vector3r wrapShearedPt(const Vector3r& pt) const { return
shearPt(wrapPt(unshearPt(pt))); }
/*! Return point inside periodic cell, even if shear is applied; store
cell coordinates in period. */
Vector3r wrapShearedPt(const Vector3r& pt, Vector3i& period) const {
return shearPt(wrapPt(unshearPt(pt),period)); }

If there is no shear (faster):

/*! Wrap point to inside the periodic cell; don't compute number of
periods wrapped */
Vector3r wrapPt(const Vector3r& pt) const {
        Vector3r ret; for(int i=0;i<3;i++)
ret[i]=wrapNum(pt[i],_size[i]); return ret;}
/*! Wrap point to inside the periodic cell; period will contain by how
many cells it was wrapped. */
Vector3r wrapPt(const Vector3r& pt, Vector3i& period) const {
        Vector3r ret; for(int i=0; i<3; i++){
ret[i]=wrapNum(pt[i],_size[i],period[i]); } return ret;}

Can you help with this problem?

Provide an answer of your own, or ask Chiara Modenese for more information if necessary.

To post a message you must log in.