示例#1
0
        private void ApplyForce(ApproximatedAminoAcid aminoAcid,
                                ApproximateAminoAcidForces resultingForces,
                                UnitValue timeStepSize,
                                UnitValue reservoirTemperature)
        {
            var scaling                = 1e0;
            var nitrogenForce          = scaling * resultingForces.NitrogenForce;
            var nitrogenMass           = PeriodicTable.GetSingleAtomMass(ElementName.Nitrogen);
            var nitrogenAcceleration   = nitrogenForce / nitrogenMass;
            var nitrogenVelocityChange = nitrogenAcceleration * timeStepSize;

            aminoAcid.NitrogenVelocity += nitrogenVelocityChange;
            aminoAcid.NitrogenVelocity  = InteractWithReservoir(aminoAcid.NitrogenVelocity, nitrogenMass, reservoirTemperature);
            aminoAcid.NitrogenPosition += aminoAcid.NitrogenVelocity * timeStepSize;
            if (simulationSettings.ResetAtomVelocityAfterEachTimestep)
            {
                aminoAcid.NitrogenVelocity = new UnitVector3D(Unit.MetersPerSecond, 0, 0, 0);
            }

            var carbonAlphaForce          = scaling * resultingForces.CarbonAlphaForce;
            var carbonAlphaMass           = PeriodicTable.GetSingleAtomMass(ElementName.Carbon) + AminoAcidSideChainMassLookup.SideChainMasses[aminoAcid.Name];
            var carbonAlphaAcceleration   = carbonAlphaForce / carbonAlphaMass;
            var carbonAlphaVelocityChange = carbonAlphaAcceleration * timeStepSize;

            aminoAcid.CarbonAlphaVelocity += carbonAlphaVelocityChange;
            aminoAcid.CarbonAlphaVelocity  = InteractWithReservoir(aminoAcid.CarbonAlphaVelocity, carbonAlphaMass, reservoirTemperature);
            aminoAcid.CarbonAlphaPosition += aminoAcid.CarbonAlphaVelocity * timeStepSize;
            if (simulationSettings.ResetAtomVelocityAfterEachTimestep)
            {
                aminoAcid.CarbonAlphaVelocity = new UnitVector3D(Unit.MetersPerSecond, 0, 0, 0);
            }

            var carbonForce          = scaling * resultingForces.CarbonForce;
            var carbonMass           = PeriodicTable.GetSingleAtomMass(ElementName.Carbon);
            var carbonAcceleration   = carbonForce / carbonMass;
            var carbonVelocityChange = carbonAcceleration * timeStepSize;

            aminoAcid.CarbonVelocity += carbonVelocityChange;
            aminoAcid.CarbonVelocity  = InteractWithReservoir(aminoAcid.CarbonVelocity, carbonMass, reservoirTemperature);
            aminoAcid.CarbonPosition += aminoAcid.CarbonVelocity * timeStepSize;
            if (simulationSettings.ResetAtomVelocityAfterEachTimestep)
            {
                aminoAcid.CarbonVelocity = new UnitVector3D(Unit.MetersPerSecond, 0, 0, 0);
            }
        }