diff --git a/ComputeGridGrid.cuh b/ComputeGridGrid.cuh index 8befee02e254edf16e4760c8e05e3afca80be55b..42428413c64651f7c2f401fd202224071ef31e31 100644 --- a/ComputeGridGrid.cuh +++ b/ComputeGridGrid.cuh @@ -36,19 +36,22 @@ void computeGridGridForce(const RigidBodyGrid* rho, const RigidBodyGrid* u, // RBTODO: maybe organize data into compact regions for grid data for better use of shared memory... Vector3 r_ijk = rho->getPosition(r_id); /* i,j,k value of voxel */ Vector3 r_pos = basis_rho.transform( r_ijk ) + origin_rho; - Vector3 u_ijk_float = basis_u.transform( r_pos - origin_u ); + // Vector3 u_ijk_float = basis_u.transform( r_pos - origin_u ); + Matrix3 basis_u_inv = basis_u.inverse(); + Vector3 u_ijk_float = basis_u_inv.transform( r_pos - origin_u ); float r_val = rho->val[r_id]; float energy = r_val * u->interpolatePotential( u_ijk_float ); - + + // RBTODO What about non-unit delta? // RBTODO combine interp methods and reduce repetition! Vector3 f = r_val*u->interpolateForceD( u_ijk_float ); /* in coord frame of u */ - f = basis_u.inverse().transpose().transform( f ); /* transform to lab frame */ + // f = basis_u.inverse().transpose().transform( f ); /* transform to lab frame */ + f = basis_u_inv.transpose().transform( f ); /* transform to lab frame */ // Calculate torque about lab-frame origin Vector3 t = r_pos.cross(f); // RBTODO: test if sign is correct! - force[tid] = f; torque[tid] = t; __syncthreads(); diff --git a/RigidBody.cu b/RigidBody.cu index 1ea6148fd3d4398ca29e6f0797a09d449bc5d1ef..1dd5f53fb6ee76f64d728b5999b8d619d80a342d 100644 --- a/RigidBody.cu +++ b/RigidBody.cu @@ -69,7 +69,6 @@ void RigidBody::addLangevin(Vector3 w1, Vector3 w2) { // w1 and w2 should be standard normal distributions // in RB frame - Vector3 tmp = orientation.transpose()*momentum; Force f = Vector3::element_mult(t->transForceCoeff,w1) - Vector3::element_mult(t->transDamping, orientation.transpose()*momentum); diff --git a/RigidBody.h b/RigidBody.h index 46c827af40093749fbd077c48adbffdfd131a8c4..262fcf2ef328117cb8e1fa9254639049c4cb3f97 100644 --- a/RigidBody.h +++ b/RigidBody.h @@ -86,7 +86,7 @@ private: bool isFirstStep; /*–––––––––––––––––––––––––––––––––––––––––. - | units "kcal_mol/AA * fs" "(AA/fs) * amu" | + | units "kcal_mol/AA * ns" "(AA/ns) * amu" | `–––––––––––––––––––––––––––––––––––––––––*/ BigReal impulse_to_momentum; /* should be const, but copy constructor failed */ diff --git a/RigidBodyController.cu b/RigidBodyController.cu index 7f11643bf6a193c477b5868efc67eb569285ba47..c9419b41cc957880cc487a03224259f272c8c17a 100644 --- a/RigidBodyController.cu +++ b/RigidBodyController.cu @@ -169,6 +169,15 @@ void RigidBodyController::updateForces() { // int numBlocks = 1; /* int numThreads = 256; */ + // clear old forces + for (int i = 0; i < rigidBodyByType.size(); i++) { + for (int j = 0; j < rigidBodyByType[i].size(); j++) { + RigidBody& rb = rigidBodyByType[i][j]; + rb.clearForce(); + rb.clearTorque(); + } + } + for (int i=0; i < forcePairs.size(); i++) { forcePairs[i].updateForces(); } diff --git a/RigidBodyType.cu b/RigidBodyType.cu index 15c892ce71891b2750ed20d0ddfd184d305509ae..2c3965adc8bb3c43de9a3fb70ed0240ab0307ba8 100644 --- a/RigidBodyType.cu +++ b/RigidBodyType.cu @@ -68,7 +68,7 @@ void RigidBodyType::setDampingCoeffs(float timestep) { /* MUST ONLY BE CALLED ON | | | type->DampingCoeff has units of (1/ps) | | | - | f[kcal/mol AA] = - dampingCoeff * momentum[amu AA/fs] | + | f[kcal/mol AA] = - dampingCoeff * momentum[amu AA/ns] | | | | units "(1/ps) * (amu AA/ns)" "kcal_mol/AA" * 2.390e-06 | `–––––––––––––––––––––––––––––––––––––––––––––––––––––––*/ diff --git a/notes.org b/notes.org index a9e9349214cf5c89a31d8a169dd4e1214c0ade9e..7b5c1ced3326fa1401700a8dd33f13198cb60ae2 100644 --- a/notes.org +++ b/notes.org @@ -1,15 +1,19 @@ * TODO active -** make rigid body object device pointer -** branch rb-device: have RBType objects hold device pointers for raw RigidBodyGrids +** fix ComputeGridGrid.cuh to include transformation? + * TODO eventually -** multiple "PMF" grids associated with each RB type +** periodic boundaries? ** read restart file ** throw exception if an RB type uses a grid key multiple times ** improve efficiency of force evaluation kernel ** each RB gets temperature from grid ** optionally don't eval forces every ts +* DONE +** branch rb-device: have RBType objects hold device pointers for raw RigidBodyGrids +** make rigid body object device pointer +** multiple "PMF" grids associated with each RB type * organization