Exemple #1
0
  void NormalModeMori::initialize(ProtoMolApp* app){
    MTSIntegrator::initialize(app);
    //
    //point to bottom integrator, for average force
    myBottomNormalMode  = dynamic_cast<NormalModeUtilities*>(bottom());
    //check valid eigenvectors
    //NM initialization if OK
    NormalModeUtilities::initialize((int)app->positions.size(), app, myForces, NO_NM_FLAGS); //last for non-complimentary forces
    //
    //do first force calculation, and remove non sub-space part
    app->energies.clear();	//Need this or initial error, due to inner integrator energy?
    initializeForces();
    //
    //take initial C velocites from system and remove non-subspace part
    if(*Q != NULL) subspaceVelocity(&app->velocities, &app->velocities);
    //	
    //####diagnostics
    if(modeOutput != ""){
        //save initial positions
        ex0 = new Vector3DBlock;
        *ex0 = app->positions;
        ofstream myFile;
        myFile.open(modeOutput.c_str(),ofstream::out);
        //close file
        myFile.close();
    }

  }
  void NormalModeLangLf::doHalfKick() {
    const Real dt = getTimestep() * Constant::INV_TIMEFACTOR; // in fs
    const Real fdt = ( 1.0 - exp( -0.5 * myGamma * dt ) ) / myGamma;
    const Real vdt = exp(-0.5*myGamma*dt);
    const Real ndt = sqrt( ( 1.0 - exp( -myGamma * dt ) ) / (2.0 * myGamma) ); //was sqrt( fdt );
    const Real sqrtFCoverM = sqrt( 2.0 * Constant::BOLTZMANN * myTemp * myGamma );

    for( int i = 0; i < _N; i++ ) {
        // semi-update velocities
        app->velocities[i] = app->velocities[i]*vdt
                                +(*myForces)[i] * fdt / app->topology->atoms[i].scaledMass
                                    +gaussRandCoord1[i]*sqrtFCoverM*ndt;
    }
    subspaceVelocity(&app->velocities, &app->velocities);
    buildMolecularMomentum(&app->velocities, app->topology);
  }
  void NormalModeLangLf::initialize(ProtoMolApp *app){
    MTSIntegrator::initialize(app);
    //check valid eigenvectors
    //NM initialization if OK
    int nm_flags = NO_NM_FLAGS;
    if(genCompNoise) nm_flags |= GEN_COMP_NOISE;
    NormalModeUtilities::initialize((int)app->positions.size(), app, myForces, nm_flags); //last int for no complimentary forces or gen noise: GEN_COMP_NOISE
    //
    //do first force calculation, and remove non sub-space part
    app->energies.clear();	//Need this or initial error, due to inner integrator energy?
    initializeForces();
    //
    //take initial C velocites from system and remove non-subspace part
    if(*Q != NULL) subspaceVelocity(&app->velocities, &app->velocities);
    //

  }