Skip to content

Commit

Permalink
replace distutils.version.LooseVersion by `packaging.version.Versio…
Browse files Browse the repository at this point in the history
…n` (#108)

`distutils` will be removed from Python 3.12. See [PEP
632](https://peps.python.org/pep-0632/).

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
  • Loading branch information
njzjz committed Dec 30, 2022
1 parent 9a722c1 commit 62f0a0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions dpgen2/exploration/task/lmp/lmp_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
List,
Optional,
)
from distutils.version import (
LooseVersion,
)
from packaging.version import Version
from dpgen2.constants import (
lmp_traj_name,
)
Expand Down Expand Up @@ -46,7 +44,7 @@ def make_lmp_input(
deepmd_version = '2.0',
trj_seperate_files = True,
) :
if (ele_temp_f is not None or ele_temp_a is not None) and LooseVersion(deepmd_version) < LooseVersion('1'):
if (ele_temp_f is not None or ele_temp_a is not None) and Version(deepmd_version) < Version('1'):
raise RuntimeError('the electron temperature is only supported by deepmd-kit >= 1.0.0, please upgrade your deepmd-kit')
if ele_temp_f is not None and ele_temp_a is not None:
raise RuntimeError('the frame style ele_temp and atom style ele_temp should not be set at the same time')
Expand Down Expand Up @@ -85,7 +83,7 @@ def make_lmp_input(
graph_list = ""
for ii in graphs :
graph_list += ii + " "
if LooseVersion(deepmd_version) < LooseVersion('1'):
if Version(deepmd_version) < Version('1'):
# 0.x
ret+= "pair_style deepmd %s ${THERMO_FREQ} model_devi.out\n" % graph_list
else:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies = [
'dargs>=0.3.1',
'scipy',
'lbg',
'packaging',
]
requires-python = ">=3.7"
readme = "README.md"
Expand Down

0 comments on commit 62f0a0d

Please sign in to comment.