--- trunk/src/brains/DataStorage.hpp 2006/05/17 21:51:42 963 +++ trunk/src/brains/DataStorage.hpp 2014/04/29 17:32:31 1993 @@ -6,19 +6,10 @@ * redistribute this software in source and binary code form, provided * that the following conditions are met: * - * 1. Acknowledgement of the program authors must be made in any - * publication of scientific results based in part on use of the - * program. An acceptable form of acknowledgement is citation of - * the article in which the program was described (Matthew - * A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher - * J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented - * Parallel Simulation Engine for Molecular Dynamics," - * J. Comput. Chem. 26, pp. 252-271 (2005)) - * - * 2. Redistributions of source code must retain the above copyright + * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - * 3. Redistributions in binary form must reproduce the above copyright + * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. @@ -37,6 +28,16 @@ * arising out of the use of or inability to use software, even if the * University of Notre Dame has been advised of the possibility of * such damages. + * + * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your + * research, please cite the appropriate papers when you publish your + * work. Good starting points are: + * + * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). + * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). + * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). + * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ /** @@ -53,12 +54,13 @@ #include #include -namespace oopse { +using namespace std; +namespace OpenMD { /** * @class DataStorage * @warning do not try to insert element into (or ease element from) private member data * of DataStorage directly. - * @todo DataStorage may need refactorying. Every std::vector can inherit from the same base class + * @todo DataStorage may need refactoring. Every vector can inherit from the same base class * which will make it easy to maintain */ class DataStorage { @@ -67,35 +69,50 @@ namespace oopse { enum{ dslPosition = 1, dslVelocity = 2, - dslAmat = 4, - dslAngularMomentum = 8, - dslElectroFrame = 16, - dslZAngle = 32, - dslForce = 64, - dslTorque = 128 + dslForce = 4, + dslAmat = 8, + dslAngularMomentum = 16, + dslTorque = 32, + dslParticlePot = 64, + dslDensity = 128, + dslFunctional = 256, + dslFunctionalDerivative = 512, + dslDipole = 1024, + dslQuadrupole = 2048, + dslElectricField = 4096, + dslSkippedCharge = 8192, + dslFlucQPosition = 16384, + dslFlucQVelocity = 32768, + dslFlucQForce = 65536, + dslSitePotential = 131072 }; - DataStorage(); - DataStorage(int size, int storageLayout = 255); + DataStorage(int size, int storageLayout = 0); /** return the size of this DataStorage. */ int getSize(); /** * Changes the size of this DataStorage. - * @param size new size of this DataStorage + * @param newSize new size of this DataStorage */ void resize(int newSize); /** - * Reallocates memory manually. The main reason for using reserve() is efficiency - * if you know the capacity to which your std::vector must eventually grow, then it is usually more - * efficient to allocate that memory all at once. + * Reallocates memory manually. + * + * The main reason for using reserve() is efficiency if you know + * the capacity to which your vector must eventually grow, + * then it is usually more efficient to allocate that memory all + * at once. */ void reserve(int size); /** * Copies data inside DataStorage class. - * Copy function actually call std::copy for every std::vector in DataStorage class. - * One Precondition of std::copy is that target is not within the range [soruce, soruce + num] - * @param souce + * + * Copy function actually calls copy for every vector in + * DataStorage class. One Precondition of copy is that + * target is not within the range [source, soruce + num] + * + * @param source * @param num number of element to be moved * @param target */ @@ -107,24 +124,33 @@ namespace oopse { /** Returns the pointer of internal array */ RealType *getArrayPointer(int whichArray); - std::vector position; /** position array */ - std::vector velocity; /** velocity array */ - std::vector aMat; /** rotation matrix array */ - std::vector angularMomentum;/** angular momentum array (body-fixed) */ - std::vector electroFrame; /** the lab frame unit std::vector array*/ - std::vector zAngle; /** z -angle array */ - std::vector force; /** force array */ - std::vector torque; /** torque array */ + vector position; /** position array */ + vector velocity; /** velocity array */ + vector force; /** force array */ + vector aMat; /** rotation matrix array */ + vector angularMomentum; /** angular momentum array (body-fixed) */ + vector torque; /** torque array */ + vector particlePot; /** particle potential arrray */ + vector density; /** electron density */ + vector functional; /** density functional */ + vector functionalDerivative; /** derivative of functional */ + vector dipole; /** space-frame dipole vector */ + vector quadrupole; /** space-frame quadrupole tensor */ + vector electricField; /** local electric field */ + vector skippedCharge; /** charge skipped during normal pairwise calculation */ + vector flucQPos; /** fluctuating charges */ + vector flucQVel; /** fluctuating charge velocities */ + vector flucQFrc; /** fluctuating charge forces */ + vector sitePotential; /** electrostatic site potentials */ static int getBytesPerStuntDouble(int layout); private: - RealType* internalGetArrayPointer(std::vector& v); + RealType* internalGetArrayPointer(vector& v); + RealType* internalGetArrayPointer(vector& v); + RealType* internalGetArrayPointer(vector& v); - RealType* internalGetArrayPointer(std::vector& v); - RealType* internalGetArrayPointer(std::vector& v); - template void internalResize(std::vector& v, int newSize);