ComputeStir Class Reference

#include <ComputeStir.h>

Inheritance diagram for ComputeStir:

ComputeHomePatch Compute List of all members.

Public Member Functions

 ComputeStir (ComputeID c, PatchID pid)
virtual ~ComputeStir ()
virtual void doForce (FullAtom *p, Results *r)

Public Attributes

SubmitReductionreduction

Detailed Description

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

Definition at line 18 of file ComputeStir.h.


Constructor & Destructor Documentation

ComputeStir::ComputeStir ( ComputeID  c,
PatchID  pid 
)

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

Definition at line 19 of file ComputeStir.C.

References ReductionMgr::Object(), Node::Object(), reduction, REDUCTIONS_BASIC, Node::simParameters, simParams, and ReductionMgr::willSubmit().

00020   : ComputeHomePatch(c,pid)
00021 {
00022 
00023   
00024 
00025   
00026   SimParameters* simParams = Node::Object()->simParameters;
00027   axisUnit = simParams->stirAxis.unit();
00028   pivot = simParams->stirPivot;
00029   
00030   
00031   reduction = ReductionMgr::Object()->willSubmit(REDUCTIONS_BASIC);
00032   
00033   //nitVars(p, axisDir);
00034   initVars();
00035 }

ComputeStir::~ComputeStir (  )  [virtual]

Definition at line 39 of file ComputeStir.C.

References reduction.

00041 {
00042 delete reduction;
00043 }


Member Function Documentation

void ComputeStir::doForce ( FullAtom p,
Results r 
) [virtual]

Implements ComputeHomePatch.

Definition at line 288 of file ComputeStir.C.

References ADD_TENSOR_OBJECT, ADD_VECTOR_OBJECT, cross(), Vector::dot(), Results::f, Patch::flags, forces, Molecule::get_stir_startTheta(), ComputeHomePatch::homePatch, CompAtomExt::id, Molecule::is_atom_stirred(), SubmitReduction::item(), Patch::lattice, Vector::length(), Node::molecule, Results::normal, ComputeHomePatch::numAtoms, CollectionMgr::Object(), Node::Object(), outer(), ComputeHomePatch::patch, reduction, REDUCTION_EXT_FORCE_NORMAL, REDUCTION_MISC_ENERGY, REDUCTION_VIRIAL_NORMAL, Lattice::reverse_transform(), CollectionMgr::sendDataStream(), Node::simParameters, simParams, Flags::step, SubmitReduction::submit(), Vector::x, Vector::y, and Vector::z.

00288                                                   {
00289   
00290   
00291   Molecule *molecule = Node::Object()->molecule;
00292   SimParameters *simParams = Node::Object()->simParameters;
00293   Lattice &lattice = homePatch->lattice;
00294   char statbuf[1024];
00295   Vector curPos; //current atom position
00296   Vector proj;  //projection on the axis ray
00297   Vector forceDir;  //direction to apply force in for torque
00298   Vector theForce; // the force to apply
00299   Vector targPos; //target Position
00300   BigReal rayDist, height,targTheta,forceMag;
00301   //intermediate calc. results for readability
00302 
00303   //convert from degrees/timestep to radians/timestep
00304   int currentStep = patch->flags.step;
00305 
00306   //Vector  = simParams->eField;
00308 
00309   int GlobalId;
00310   Force *forces = r->f[Results::normal];
00311   BigReal energy = 0;
00312   Force extForce = 0.;
00313   Tensor extVirial;
00314   
00315   //CkPrintf("DEBUG: In ComputeStir::doForce");
00316   //  Loop through and check each atom
00317   //CkPrintf ("DEBUG: now to loop atoms, numAtoms = %d\n",numAtoms);    
00318     for (int i=0; i<numAtoms; i++) {
00319       if (molecule->is_atom_stirred(p[i].id))
00320       {
00321         //CkPrintf ("DEBUG: now to get stir params");   
00322 
00323 
00324         molecule->get_stir_startTheta (p[i].id);
00325         
00326         curPos = lattice.reverse_transform(p[i].position,p[i].transform);
00327 
00328         rayDist = distanceToRay(axisUnit,pivot,curPos);
00329         proj = projectionOnRay (axisUnit,pivot,curPos);
00330         height = findHeight (proj);
00331         targTheta = (omega * currentStep) + \
00332                      startingTheta + \
00333                       molecule->get_stir_startTheta (p[i].id);
00334 
00335         targPos = placeThetaRadius (targTheta,height,rayDist);
00336 
00337         //project the actual displacement ontoh a unit vector along ( (axis) cross (moment arm) ),
00338         //so we are applying only  a torque
00339       
00340         forceDir = (cross(axisUnit, (curPos - proj))).unit();
00341         forceMag = forceDir.dot(targPos - curPos); 
00342         
00343                        //unitDisp = disp.unit();
00344         
00345         theForce = (simParams->stirK) * forceMag * forceDir;
00346         
00347         forces[i]  += theForce;
00348         extForce += theForce;
00349         extVirial += outer(theForce,curPos);
00350 
00351                              
00352           //CkPrintf ("DEBUG: now to get sprintf x y z's");
00353           sprintf (statbuf, "DEBUG: step= %d atom i= %d globID= %d T= %g %g %g C= %g %g %g F= %g %g %g startTheta= %g targTheta= %g forceMag= %g F.len= %g FC.len= %g\n",currentStep,i,p[i].id, targPos.x, targPos.y, targPos.z, curPos.x, curPos.y, curPos.z,theForce.x, theForce.y, theForce.z, molecule->get_stir_startTheta (p[i].id),  targTheta,  forceMag, theForce.length(), forces[i].length());
00354 
00355         
00356           CollectionMgr::Object()->sendDataStream(statbuf);     
00357           
00359 
00360       }
00361 
00362       //CkPrintf ("DEBUG: got past check for stirred\n");       
00363       //GlobalId = p[i].id;
00364       //sprintf (statbuf, "DEBUG: i= %d Global= %d\n",i,GlobalId);
00365       //dout << "DEBUG: i= " << i << " Global=" << GlobalId <<"\n"<<endd;
00366       //CollectionMgr::Object()->sendDataStream(statbuf);
00367     
00368     }
00369 
00370   reduction->item(REDUCTION_MISC_ENERGY) += energy;
00371   ADD_VECTOR_OBJECT(reduction,REDUCTION_EXT_FORCE_NORMAL,extForce);
00372   ADD_TENSOR_OBJECT(reduction,REDUCTION_VIRIAL_NORMAL,extVirial);
00373   reduction->submit();
00374 
00375 }


Member Data Documentation

SubmitReduction* ComputeStir::reduction

Definition at line 27 of file ComputeStir.h.

Referenced by ComputeStir(), doForce(), and ~ComputeStir().


The documentation for this class was generated from the following files:
Generated on Wed Sep 20 01:17:17 2017 for NAMD by  doxygen 1.4.7