ComputeMsmSerial.C File Reference

#include "InfoStream.h"
#include "Node.h"
#include "PatchMap.h"
#include "PatchMap.inl"
#include "AtomMap.h"
#include "ComputeMsmSerial.h"
#include "ComputeMsmSerialMgr.decl.h"
#include "PatchMgr.h"
#include "Molecule.h"
#include "ReductionMgr.h"
#include "ComputeMgr.h"
#include "ComputeMgr.decl.h"
#include "Debug.h"
#include "SimParameters.h"
#include "WorkDistrib.h"
#include "varsizemsg.h"
#include "msm.h"
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include "ComputeMsmSerialMgr.def.h"

Go to the source code of this file.

Classes

struct  ComputeMsmSerialAtom
class  MsmSerialCoordMsg
class  MsmSerialForceMsg
class  ComputeMsmSerialMgr

Defines

#define MIN_DEBUG_LEVEL   3

Typedefs

typedef Force MsmSerialForce

Functions

static void rescale_nonperiodic_cell (Vector &u, Vector &v, Vector &w, Vector &c, Vector &ru, Vector &rv, Vector &rw, int isperiodic, int numatoms, const ComputeMsmSerialAtom *coord, double padding, double gridspacing)


Define Documentation

#define MIN_DEBUG_LEVEL   3

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 20 of file ComputeMsmSerial.C.


Typedef Documentation

typedef Force MsmSerialForce

Definition at line 37 of file ComputeMsmSerial.C.


Function Documentation

static void rescale_nonperiodic_cell ( Vector u,
Vector v,
Vector w,
Vector c,
Vector ru,
Vector rv,
Vector rw,
int  isperiodic,
int  numatoms,
const ComputeMsmSerialAtom coord,
double  padding,
double  gridspacing 
) [static]

Definition at line 170 of file ComputeMsmSerial.C.

References if(), NL_MSM_PERIODIC_VEC1, NL_MSM_PERIODIC_VEC2, NL_MSM_PERIODIC_VEC3, ComputeMsmSerialAtom::position, Vector::rlength(), Vector::x, Vector::y, and Vector::z.

Referenced by ComputeMsmSerialMgr::recvCoord().

00174                                         {
00175   const double NL_ZERO_TOLERANCE = 1e-4;
00176   double xlen = 1, inv_xlen = 1;  /* don't rescale periodic directions */
00177   double ylen = 1, inv_ylen = 1;
00178   double zlen = 1, inv_zlen = 1;
00179   double ulen_1 = u.rlength();
00180   double vlen_1 = v.rlength();
00181   double wlen_1 = w.rlength();
00182   double rpadx = padding * ulen_1;  /* padding distance in recip space */
00183   double rpady = padding * vlen_1;
00184   double rpadz = padding * wlen_1;
00185   double rhx = gridspacing * ulen_1;  /* grid spacing in recip space */
00186   double rhy = gridspacing * vlen_1;
00187   double rhz = gridspacing * wlen_1;
00188   Vector s, d;
00189   Vector rc = 0;  // don't move center along periodic directions
00190   double xmin, xmax, ymin, ymax, zmin, zmax;
00191   int is_periodic_x = (isperiodic & NL_MSM_PERIODIC_VEC1);
00192   int is_periodic_y = (isperiodic & NL_MSM_PERIODIC_VEC2);
00193   int is_periodic_z = (isperiodic & NL_MSM_PERIODIC_VEC3);
00194   int i;
00195 
00196   /* affine linear transformation of coordinates to reciprocal space,
00197    * where periodic vector directions map into [-0.5, 0.5) */
00198   //printf("*** center=%.4f %.4f %.4f\n", c.x, c.y, c.z);
00199   d = coord[0].position - c;
00200   s.x = ru * d;  // dot product
00201   s.y = rv * d;
00202   s.z = rw * d;
00203   xmin = xmax = s.x;
00204   ymin = ymax = s.y;
00205   zmin = zmax = s.z;
00206   for (i = 1;  i < numatoms;  i++) {
00207     d = coord[i].position - c;
00208     s.x = ru * d;  // dot product
00209     s.y = rv * d;
00210     s.z = rw * d;
00211     if      (s.x < xmin)  xmin = s.x;
00212     else if (s.x > xmax)  xmax = s.x;
00213     if      (s.y < ymin)  ymin = s.y;
00214     else if (s.y > ymax)  ymax = s.y;
00215     if      (s.z < zmin)  zmin = s.z;
00216     else if (s.z > zmax)  zmax = s.z;
00217   }
00218 #if 0
00219   printf("*** xmin=%.4f  xmax=%.4f\n", xmin, xmax);
00220   printf("*** ymin=%.4f  ymax=%.4f\n", ymin, ymax);
00221   printf("*** zmin=%.4f  zmax=%.4f\n", zmin, zmax);
00222 #endif
00223 
00224   if ( ! is_periodic_x) {
00225     xmax += rpadx;  /* pad the edges */
00226     xmin -= rpadx;
00227     if (rhx > 0) {  /* restrict center to rhx lattice points */
00228       double mupper = ceil(xmax / (2*rhx));
00229       double mlower = floor(xmin / (2*rhx));
00230       xmax = 2*rhx*mupper;
00231       xmin = 2*rhx*mlower;
00232     }
00233     rc.x = 0.5*(xmin + xmax);
00234     xlen = xmax - xmin;
00235     if (xlen < NL_ZERO_TOLERANCE) {
00236       xlen = 1;  /* leave scaling unchanged */
00237     }
00238     else {
00239       inv_xlen = 1/xlen;
00240     }
00241   }
00242 
00243   if ( ! is_periodic_y) {
00244     ymax += rpady;  /* pad the edges */
00245     ymin -= rpady;
00246     if (rhy > 0) {  /* restrict center to rhy lattice points */
00247       double mupper = ceil(ymax / (2*rhy));
00248       double mlower = floor(ymin / (2*rhy));
00249       ymax = 2*rhy*mupper;
00250       ymin = 2*rhy*mlower;
00251     }
00252     rc.y = 0.5*(ymin + ymax);
00253     ylen = ymax - ymin;
00254     if (ylen < NL_ZERO_TOLERANCE) {
00255       ylen = 1;  /* leave scaling unchanged */
00256     }
00257     else {
00258       inv_ylen = 1/ylen;
00259     }
00260   }
00261 
00262   if ( ! is_periodic_z) {
00263     zmax += rpadz;  /* pad the edges */
00264     zmin -= rpadz;
00265     if (rhz > 0) {  /* restrict center to rhz lattice points */
00266       double mupper = ceil(zmax / (2*rhz));
00267       double mlower = floor(zmin / (2*rhz));
00268       zmax = 2*rhz*mupper;
00269       zmin = 2*rhz*mlower;
00270     }
00271     rc.z = 0.5*(zmin + zmax);
00272     zlen = zmax - zmin;
00273     if (zlen < NL_ZERO_TOLERANCE) {
00274       zlen = 1;  /* leave scaling unchanged */
00275     }
00276     else {
00277       inv_zlen = 1/zlen;
00278     }
00279   }
00280 
00281 #if 0
00282   printf("xmin=%g  xmax=%g\n", xmin, xmax);
00283   printf("ymin=%g  ymax=%g\n", ymin, ymax);
00284   printf("zmin=%g  zmax=%g\n", zmin, zmax);
00285   printf("xlen=%g  ylen=%g  zlen=%g\n", xlen, ylen, zlen);
00286   printf("rc_x=%g  rc_y=%g  rc_z=%g\n", rc.x, rc.y, rc.z);
00287 #endif
00288 
00289   /* transform new center back to real space, then rescale basis vectors */
00290   c.x = (u.x*rc.x + v.x*rc.y + w.x*rc.z) + c.x;
00291   c.y = (u.y*rc.x + v.y*rc.y + w.y*rc.z) + c.y;
00292   c.z = (u.z*rc.x + v.z*rc.y + w.z*rc.z) + c.z;
00293 
00294 #if 0
00295   printf("c_x=%g  c_y=%g  c_z=%g\n", c.x, c.y, c.z);
00296 #endif
00297 
00298   u *= xlen;
00299   v *= ylen;
00300   w *= zlen;
00301 
00302   ru *= inv_xlen;
00303   rv *= inv_ylen;
00304   rw *= inv_zlen;
00305 }


Generated on Tue Sep 26 01:17:15 2017 for NAMD by  doxygen 1.4.7