예제 #1
0
            public static void Intxyz(string intpath)
            {
                string command = "";

                command += GetProgramPath("intxyz.exe");
                command += " " + intpath;
                int exitcode = HProcess.StartAsBatchSilent(null, null, null, command);
            }
예제 #2
0
        public static int Run(string command
                              , string[] commandsNext    = null
                              , List <string> lineStderr = null
                              , List <string> lineStdout = null
                              , bool silent_run          = true
                              , bool?pause = null
                              //, string batPathToCopy    = null
                              )
        {
            List <string> lines = new List <string>();
            {
                lines.Add(@"set GMXLIB=C:\Program Files (x86)\Gromacs\share\gromacs\top");
                lines.Add(@"set GMXBIN=C:\Program Files (x86)\Gromacs\bin");
                lines.Add(@"set GMXDATA=C:\Program Files (x86)\Gromacs\share");
                lines.Add(@"set GMXLDLIB=C:\Program Files (x86)\Gromacs\lib");
                lines.Add(@"set GMXMAN=C:\Program Files (x86)\Gromacs\share\man");
                lines.Add(command);
                if (commandsNext != null)
                {
                    lines.AddRange(commandsNext);
                }
            }

            int exitcode;

            //bool silent_run = true;
            if (silent_run)
            {
                // int StartAsBatchSilent(string batpath, List<string> lineStdout, List<string> lineStderr, params string[] commands)
                //exitcode = HProcess.StartAsBatchSilent(batPathToCopy, lineStdout, lineStderr, lines.ToArray());
                exitcode = HProcess.StartAsBatchSilent(null, lineStdout, lineStderr, lines.ToArray());
            }
            else
            {
                // int StartAsBatchInConsole(string batpath, bool pause=false, params string[] commands)
                //exitcode = HProcess.StartAsBatchInConsole(batPathToCopy, (pause == null || pause == true), lines.ToArray());
                exitcode = HProcess.StartAsBatchInConsole(null, (pause == null || pause == true), lines.ToArray());
            }

            return(exitcode);
        }
예제 #3
0
            public static CPdbxyz Pdbxyz
                (Pdb pdb
                , Tinker.Prm prm
                , string tempbase      //=null
                , string parameters    //=null
                , string tinkerversion //="6.2.1"
                , params string[] keys
                )
            {
                var    tmpdir   = HDirectory.CreateTempDirectory(tempbase);
                string currpath = HEnvironment.CurrentDirectory;

                Tinker.Xyz xyz;
                string[]   seq;
                string[]   capture;
                {
                    HEnvironment.CurrentDirectory = tmpdir.FullName;
                    {
                        foreach (var respath_filename in GetResourcePaths("6.2.1", "pdbxyz"))
                        {
                            string respath  = respath_filename.Item1;
                            string filename = respath_filename.Item2;
                            HResource.CopyResourceTo <Tinker>(respath, filename);
                        }
                    }
                    pdb.ToFile("prot.pdb");
                    prm.ToFile("prot.prm");
                    string keypath = null;
                    if ((keys != null) && (keys.Length > 0))
                    {
                        keypath = "prot.key";
                        HFile.WriteAllLines(keypath, keys);
                    }

                    {
                        //bool ComputeAnalyticalGradientVector    = true;
                        //bool ComputeNumericalGradientVector     = false;
                        //bool OutputBreakdownByGradientComponent = false;
                        string command = "";
                        command += "pdbxyz.exe";
                        command += " prot.pdb";
                        command += " prot.prm";
                        if (keypath != null)
                        {
                            command += " -k " + keypath;
                        }
                        command += " > output.txt";
                        List <string> errors   = new List <string>();
                        int           exitcode = HProcess.StartAsBatchSilent(null, null, errors, command);
                        capture = HFile.ReadAllLines("output.txt");
                        capture = capture.HAddRange(errors.ToArray());
                        xyz     = Tinker.Xyz.FromFile("prot.xyz", false);

                        if (HFile.Exists("prot.seq"))
                        {
                            seq = HFile.ReadAllLines("prot.seq");
                        }
                        else
                        {
                            seq = null;
                        }
                    }
                }
                HEnvironment.CurrentDirectory = currpath;
                try{ tmpdir.Delete(true); } catch {}

                return(new CPdbxyz
                {
                    xyz = xyz,
                    seq = seq,
                    capture = capture,
                });
            }