public static IEnumerable <ValueTuple <int, Pdb.Atom> > EnumAtomsInWaterBox (double maxx , double maxy , double maxz , double dist2water = 2.9 //2.8 // 2.7564; , bool randOrient = true , string opt = "water in uniform cube" ) { System.Random rand = null; if (randOrient) { rand = new System.Random(); } //List<Pdb.Atom> atoms = new List<Pdb.Atom>(); int file = 1; int serial = 1; int resSeq = 1; IEnumerable <Vector> enumer = null; switch (opt) { case "water in uniform cube": enumer = Geometry.EnumPointsInVolume_UniformCube(maxx / dist2water, maxy / dist2water, maxz / dist2water); break; case "water in uniform tetrahedron": enumer = Geometry.EnumPointsInVolume_UniformTetrahedron(maxx / dist2water, maxy / dist2water, maxz / dist2water); break; } foreach (Vector pt in enumer) { resSeq++; double x = pt[0] * dist2water; double y = pt[1] * dist2water; double z = pt[2] * dist2water; //var atom = Pdb.Atom.FromData(i+1, "H", "HOH", '1', i+1, pt[0], pt[1], pt[2]); /// ATOM 8221 OH2 TIP32 547 11.474 41.299 26.099 1.00 0.00 O /// ATOM 8222 H1 TIP32 547 12.474 41.299 26.099 0.00 0.00 H /// ATOM 8223 H2 TIP32 547 11.148 42.245 26.099 0.00 0.00 H Vector[] pthoh = new Vector[] { new double[] { 0.000000, 0.000000, 0.000000 }, new double[] { 0.000000, 0.000000, 0.957200 }, new double[] { 0.926627, 0.000000, 0.239987 }, }; if (randOrient != null) { Vector axis = new double[] { (rand.NextDouble() * 10) % 5 , (rand.NextDouble() * 10) % 5 , (rand.NextDouble() * 10) % 5 }; Trans3 trans = Trans3.FromRotate(axis.UnitVector(), rand.NextDouble() * Math.PI * 4); trans.DoTransform(pthoh); } if ((serial >= 99990) || (resSeq >= 9990)) { file++; serial = 1; resSeq = 1; } serial++; Pdb.Atom OH2 = Pdb.Atom.FromData(serial, "OH2", "HOH", '1', resSeq + 1, x + pthoh[0][0], y + pthoh[0][1], z + pthoh[0][2], element: "O"); yield return(new ValueTuple <int, Pdb.Atom>(file, OH2)); //atoms.Add(OH2); serial++; Pdb.Atom H1 = Pdb.Atom.FromData(serial, "H1", "HOH", '1', resSeq + 1, x + pthoh[1][0], y + pthoh[1][1], z + pthoh[1][2], element: "H"); yield return(new ValueTuple <int, Pdb.Atom>(file, H1)); //atoms.Add(H1 ); serial++; Pdb.Atom H2 = Pdb.Atom.FromData(serial, "H2", "HOH", '1', resSeq + 1, x + pthoh[2][0], y + pthoh[2][1], z + pthoh[2][2], element: "H"); yield return(new ValueTuple <int, Pdb.Atom>(file, H2)); //atoms.Add(H2 ); } }