Beispiel #1
0
        public static HessInfo GetHessSsNMA
            (Universe univ
            , IList <Vector> coords
            , double nbondMaxDist       // =double.PositiveInfinity
            , double?maxAbsSpring = null
            //, bool setNanForEmptyAtom   // =true
            )
        {
            IEnumerable <Universe.Nonbonded>   nonbondeds;
            IEnumerable <Universe.Nonbonded14> nonbonded14s;

            {
                Universe.Nonbondeds _nonbondeds = new Universe.Nonbondeds(univ.atoms, univ.size, nbondMaxDist);
                _nonbondeds.UpdateCoords(coords, true);
                nonbondeds   = _nonbondeds.EnumNonbondeds(true);
                nonbonded14s = univ.nonbonded14s.GetEnumerable();
            }

            return(GetHessSsNMA(univ
                                , coords, univ.bonds, univ.angles, univ.impropers
                                , univ.dihedrals, nonbondeds, nonbonded14s
                                , maxAbsSpring
                                //, setNanForEmptyAtom
                                ));
        }
Beispiel #2
0
 public IEnumerable <Nonbonded> EnumNonbondeds(Vector[] coords, double cutoff, bool skip_nulls)
 {
     Universe.Nonbondeds nonbondeds = new Universe.Nonbondeds(atoms, size
                                                              , maxdist: cutoff
                                                              );
     nonbondeds.UpdateCoords(coords, skip_nulls);
     return(nonbondeds.EnumNonbondeds(skip_nulls));
 }
        public static IEnumerable <Universe.Nonbonded> EnumNonbondeds
            (Universe.Atoms atoms
            , IList <Vector> coords
            , int size
            , double maxdist             // = 12
            )
        {
            Universe.Nonbondeds _nonbondeds;
            IEnumerable <Universe.Nonbonded> nonbondeds;

            _nonbondeds = new Universe.Nonbondeds(atoms, size, maxdist);
            _nonbondeds.UpdateCoords(coords, true);
            nonbondeds = _nonbondeds.EnumNonbondeds(true);
            return(nonbondeds);
        }
        public static IEnumerable <Universe.Nonbonded> EnumNonbondeds
            (Universe.Atoms atoms
            , IList <Vector> coords
            , int size
            , double maxdist             // = 12
            , FuncListTip3pHBond func
            , string[] options
            )
        {
            bool[] waters = new bool[coords.Count];
            KDTree.KDTree <Universe.Atom> kdtree_water = new KDTree.KDTree <Universe.Atom>(3);
            foreach (var atom in atoms)
            {
                if (coords[atom.ID] == null)
                {
                    continue;
                }

                bool water = atom.IsWater();
                waters[atom.ID] = water;
                if (water)
                {
                    kdtree_water.insert(coords[atom.ID], atom);
                }
            }

            Universe.Nonbondeds _nonbondeds;
            _nonbondeds = new Universe.Nonbondeds(atoms, size, maxdist);
            _nonbondeds.UpdateCoords(coords, true);
            foreach (var nonbonded in _nonbondeds.EnumNonbondeds(true))
            {
                HDebug.Assert(nonbonded.atoms.Length == 2);
                var atom0 = nonbonded.atoms[0];
                var atom1 = nonbonded.atoms[1];
                if (waters[atom0.ID] && waters[atom1.ID])
                {
                    continue;
                }

                yield return(nonbonded);
            }

            foreach (Universe.Nonbonded nonbonded in func(atoms, coords, waters, kdtree_water, options))
            {
                yield return(nonbonded);
            }
        }
Beispiel #5
0
        public static Nonbonded[] ListWithinNonbondeds(this IList <Atom> atoms, Universe.Nonbondeds nonbondeds)
        {
            HashSet <Atom>   setatoms         = new HashSet <Atom>(atoms);
            List <Nonbonded> withinnonbondeds = new List <Nonbonded>();

            foreach (Nonbonded nbond in nonbondeds.EnumNonbondeds(atoms, false))
            {
                if (setatoms.Contains(nbond.atoms[0]) == false)
                {
                    continue;
                }
                if (setatoms.Contains(nbond.atoms[1]) == false)
                {
                    continue;
                }
                withinnonbondeds.Add(nbond);
            }
            return(withinnonbondeds.ToArray());
        }
Beispiel #6
0
        public static HessInfo GetHessSsNMA
            (Universe univ
            , IList <Vector> coords
            , double nbondMaxDist       // =double.PositiveInfinity
            , double?maxAbsSpring
            , double?K_r     = 340.00
            , double?K_theta = 45.00
            , double?K_ub    = 10.00
            , double?K_psi   = 70.00
            , double?K_chi   = 1.00
            , double?n       = 1
            , string k_vdW   = "Unif"
            //, bool setNanForEmptyAtom                         // =true
            )
        {
            IEnumerable <Universe.Nonbonded>   nonbondeds;
            IEnumerable <Universe.Nonbonded14> nonbonded14s;

            {
                Universe.Nonbondeds _nonbondeds = new Universe.Nonbondeds(univ.atoms, univ.size, nbondMaxDist);
                _nonbondeds.UpdateCoords(coords, true);
                nonbondeds   = _nonbondeds.EnumNonbondeds(true);
                nonbonded14s = univ.nonbonded14s.GetEnumerable();
            }

            return(GetHessSsNMA
                       (univ
                       , coords, univ.bonds, univ.angles, univ.impropers
                       , univ.dihedrals, nonbondeds, nonbonded14s
                       , maxAbsSpring
                       , K_r
                       , K_theta
                       , K_ub
                       , K_psi
                       , K_chi
                       , n
                       , k_vdW
                       ));
        }