Esempio n. 1
0
def AdjustInitTemp():
    mol = _mdsim_globals['mol']
    _mdsim_globals['kinEnInitSum'] += _mdsim_globals['kinEnergy'].val

    if _mdsim_globals['stepCount'] % _mdsim_globals['stepInitlzTemp'] == 0:
        _mdsim_globals['kinEnInitSum'] /= _mdsim_globals['stepInitlzTemp']
        vFac = \
        _mdsim_globals['velMag'] / math.sqrt(2. * _mdsim_globals['kinEnInitSum'])
        for m in mol:
            rv_scale(m, vFac)
        _mdsim_globals['kinEnInitSum'] = 0.0
Esempio n. 2
0
def InitVels():
    """Initialize the molecular velocities
    """
    mol    = _mdsim_globals['mol']
    nMol   = _mdsim_globals['nMol']
    velMag = _mdsim_globals['velMag']

    vSum = VecR(x=0., y=0., z=0.)
    for m in mol:
        m.rv = VecR()
        rv_rand(m)
        rv_scale(m, velMag)
        rv_add(vSum, m)

    _mdsim_globals['vSum'] = vSum
    # Scale molecular velocities
    for m in mol:
        rv_sadd(m, -1. / nMol, vSum)