Esempio n. 1
0
        private bool IsAlphaHelix(
            UnitVector3D firstVector,
            UnitVector3D secondVector,
            UnitVector3D thirdVector)
        {
            var firstDistance  = firstVector.Magnitude();
            var secondDistance = secondVector.Magnitude();
            var thirdDistance  = thirdVector.Magnitude();

            if (secondDistance > firstDistance && secondDistance > thirdDistance)
            {
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        private UnitVector3D InteractWithReservoir(
            UnitVector3D velocity,
            UnitValue mass,
            UnitValue reservoirTemperature)
        {
            var velocityMagnitude = velocity.Magnitude();
            var targetVelocity    = Math.Sqrt(3 * (PhysicalConstants.BoltzmannsConstant * reservoirTemperature / mass).Value).To(Unit.MetersPerSecond);

            if (velocityMagnitude > targetVelocity)
            {
                const double DampingSpeed = 0.5; // Between 0 (no damping) and 1 (full damping)
                var          damping      = 1 - DampingSpeed * (velocityMagnitude - targetVelocity).Value / velocityMagnitude.Value;
                return(damping * velocity);
            }
            return(velocity);
        }