Skip to content

Commit

Permalink
feat: support assigning ncpus for qmcalc (#216)
Browse files Browse the repository at this point in the history
Fix #196.

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
njzjz and pre-commit-ci[bot] authored May 25, 2024
1 parent e76b413 commit 5579eff
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions mddatasetbuilder/qmcalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@

import argparse
import os
from typing import Optional

from gaussianrunner import GaussianRunner


def qmcalc(gjfdir, command="g16"):
def qmcalc(gjfdir, command="g16", cpu_num: Optional[int] = None):
"""QM Calculation."""
gjflist = [
os.path.join(gjfdir, filename)
for filename in os.listdir(gjfdir)
if filename.endswith(".gjf")
]
GaussianRunner(command=command).runGaussianInParallel("GJF", gjflist)
GaussianRunner(command=command, cpu_num=cpu_num).runGaussianInParallel(
"GJF", gjflist
)


def _commandline():
Expand All @@ -22,5 +25,11 @@ def _commandline():
parser.add_argument(
"-c", "--command", help="Gaussian command, default is g16", default="g16"
)
parser.add_argument(
"-n",
"--ncpus",
help="Number of CPU cores used, if not set, all CPU cores are used",
default=None,
)
args = parser.parse_args()
qmcalc(gjfdir=args.dir, command=args.command)

0 comments on commit 5579eff

Please sign in to comment.