Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add isort to sort imports #1133

Merged
merged 4 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ repos:
rev: 22.12.0
hooks:
- id: black-jupyter
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.253
hooks:
- id: ruff
args: ["--fix"]
# numpydoc
- repo: https://github.com/Carreau/velin
rev: 0.0.12
Expand Down
3 changes: 1 addition & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
import subprocess
import sys
from datetime import date

# import sys
import recommonmark
from recommonmark.transform import AutoStructify


# -- Project information -----------------------------------------------------

project = "DP-GEN"
Expand Down
4 changes: 2 additions & 2 deletions dpgen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import unicode_literals, print_function
from __future__ import print_function, unicode_literals

import logging
import os


ROOT_PATH = __path__[0]
NAME = "dpgen"
SHORT_CMD = "dpgen"
Expand Down
13 changes: 7 additions & 6 deletions dpgen/auto_test/ABACUS.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import os
from dpgen import dlog
from dpgen.util import sepline
import dpgen.auto_test.lib.abacus as abacus
import dpgen.generator.lib.abacus_scf as abacus_scf
from dpgen.auto_test.Task import Task

import numpy as np
from dpdata import LabeledSystem
from monty.serialization import dumpfn
import numpy as np

import dpgen.auto_test.lib.abacus as abacus
import dpgen.generator.lib.abacus_scf as abacus_scf
from dpgen import dlog
from dpgen.auto_test.Task import Task
from dpgen.util import sepline


class ABACUS(Task):
Expand Down
10 changes: 4 additions & 6 deletions dpgen/auto_test/EOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
import re

import numpy as np
from monty.serialization import loadfn, dumpfn
from monty.serialization import dumpfn, loadfn

import dpgen.auto_test.lib.abacus as abacus
import dpgen.auto_test.lib.vasp as vasp
import dpgen.generator.lib.abacus_scf as abacus_scf
from dpgen import dlog
from dpgen.auto_test.Property import Property
from dpgen.auto_test.refine import make_refine
from dpgen.auto_test.reproduce import make_repro
from dpgen.auto_test.reproduce import post_repro

import dpgen.generator.lib.abacus_scf as abacus_scf
import dpgen.auto_test.lib.abacus as abacus
from dpgen.auto_test.reproduce import make_repro, post_repro


class EOS(Property):
Expand Down
9 changes: 4 additions & 5 deletions dpgen/auto_test/Elastic.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import glob
import os
from shutil import copyfile
import re
from shutil import copyfile

from monty.serialization import loadfn, dumpfn
from monty.serialization import dumpfn, loadfn
from pymatgen.analysis.elasticity.elastic import ElasticTensor
from pymatgen.analysis.elasticity.strain import DeformedStructureSet, Strain
from pymatgen.analysis.elasticity.stress import Stress
from pymatgen.core.structure import Structure
from pymatgen.io.vasp import Incar, Kpoints

import dpgen.auto_test.lib.abacus as abacus
import dpgen.auto_test.lib.vasp as vasp
import dpgen.generator.lib.abacus_scf as abacus_scf
from dpgen import dlog
from dpgen.auto_test.Property import Property
from dpgen.auto_test.refine import make_refine
from dpgen.generator.lib.vasp import incar_upper

import dpgen.auto_test.lib.abacus as abacus
import dpgen.generator.lib.abacus_scf as abacus_scf


class Elastic(Property):
def __init__(self, parameter, inter_param=None):
Expand Down
14 changes: 6 additions & 8 deletions dpgen/auto_test/Gamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@

import dpdata
import numpy as np
from monty.serialization import loadfn, dumpfn
from pymatgen.core.structure import Structure
from pymatgen.core.surface import SlabGenerator
from pymatgen.io.ase import AseAtomsAdaptor
from ase.lattice.cubic import BodyCenteredCubic as bcc
from ase.lattice.cubic import FaceCenteredCubic as fcc
from ase.lattice.hexagonal import HexagonalClosedPacked as hcp
from monty.serialization import dumpfn, loadfn
from pymatgen.core.structure import Structure
from pymatgen.core.surface import SlabGenerator
from pymatgen.io.ase import AseAtomsAdaptor

import dpgen.auto_test.lib.abacus as abacus
import dpgen.auto_test.lib.vasp as vasp
from dpgen import dlog
from dpgen.auto_test.Property import Property
from dpgen.auto_test.refine import make_refine
from dpgen.auto_test.reproduce import make_repro
from dpgen.auto_test.reproduce import post_repro

import dpgen.auto_test.lib.abacus as abacus
from dpgen.auto_test.reproduce import make_repro, post_repro


class Gamma(Property):
Expand Down
12 changes: 5 additions & 7 deletions dpgen/auto_test/Interstitial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
import json
import os
import re
import numpy as np

from monty.serialization import loadfn, dumpfn
import numpy as np
from monty.serialization import dumpfn, loadfn
from pymatgen.analysis.defects.generators import InterstitialGenerator
from pymatgen.core.structure import Structure

import dpgen.auto_test.lib.abacus as abacus
import dpgen.auto_test.lib.lammps as lammps
import dpgen.generator.lib.abacus_scf as abacus_scf
from dpgen.auto_test.Property import Property
from dpgen.auto_test.refine import make_refine
from dpgen.auto_test.reproduce import make_repro
from dpgen.auto_test.reproduce import post_repro

import dpgen.auto_test.lib.abacus as abacus
import dpgen.generator.lib.abacus_scf as abacus_scf
from dpgen.auto_test.reproduce import make_repro, post_repro


class Interstitial(Property):
Expand Down
10 changes: 6 additions & 4 deletions dpgen/auto_test/Lammps.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import os
import warnings

from monty.serialization import dumpfn, loadfn

import dpgen.auto_test.lib.lammps as lammps
from dpgen import dlog
from monty.serialization import loadfn, dumpfn
from dpgen.auto_test.Task import Task
from dpgen.auto_test.lib.lammps import (
inter_deepmd,
inter_meam,
inter_eam_fs,
inter_eam_alloy,
inter_eam_fs,
inter_meam,
)
from dpgen.auto_test.Task import Task

supported_inter = ["deepmd", "meam", "eam_fs", "eam_alloy"]

Expand Down
10 changes: 4 additions & 6 deletions dpgen/auto_test/Surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@

import dpdata
import numpy as np
from monty.serialization import loadfn, dumpfn
from monty.serialization import dumpfn, loadfn
from pymatgen.core.structure import Structure
from pymatgen.core.surface import generate_all_slabs

import dpgen.auto_test.lib.abacus as abacus
import dpgen.auto_test.lib.vasp as vasp
import dpgen.generator.lib.abacus_scf as abacus_scf
from dpgen import dlog
from dpgen.auto_test.Property import Property
from dpgen.auto_test.refine import make_refine
from dpgen.auto_test.reproduce import make_repro
from dpgen.auto_test.reproduce import post_repro

import dpgen.auto_test.lib.abacus as abacus
import dpgen.generator.lib.abacus_scf as abacus_scf
from dpgen.auto_test.reproduce import make_repro, post_repro


class Surface(Property):
Expand Down
14 changes: 8 additions & 6 deletions dpgen/auto_test/VASP.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import os
from dpgen import dlog
from dpgen.util import sepline
import dpgen.auto_test.lib.vasp as vasp
from dpgen.auto_test.Task import Task
from dpgen.generator.lib.vasp import incar_upper

from dpdata import LabeledSystem
from monty.serialization import dumpfn
from pymatgen.io.vasp import Incar, Kpoints
from pymatgen.core.structure import Structure
from pymatgen.io.vasp import Incar, Kpoints

import dpgen.auto_test.lib.vasp as vasp
from dpgen import dlog
from dpgen.auto_test.Task import Task
from dpgen.generator.lib.vasp import incar_upper
from dpgen.util import sepline


class VASP(Task):
Expand Down
12 changes: 5 additions & 7 deletions dpgen/auto_test/Vacancy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
import json
import os
import re
import numpy as np

from monty.serialization import loadfn, dumpfn
import numpy as np
from monty.serialization import dumpfn, loadfn
from pymatgen.analysis.defects.generators import VacancyGenerator
from pymatgen.core.structure import Structure

import dpgen.auto_test.lib.abacus as abacus
import dpgen.generator.lib.abacus_scf as abacus_scf
from dpgen import dlog
from dpgen.auto_test.Property import Property
from dpgen.auto_test.refine import make_refine
from dpgen.auto_test.reproduce import make_repro
from dpgen.auto_test.reproduce import post_repro

import dpgen.auto_test.lib.abacus as abacus
import dpgen.generator.lib.abacus_scf as abacus_scf
from dpgen.auto_test.reproduce import make_repro, post_repro


class Vacancy(Property):
Expand Down
2 changes: 1 addition & 1 deletion dpgen/auto_test/calculator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from dpgen.auto_test.VASP import VASP
from dpgen.auto_test.ABACUS import ABACUS
from dpgen.auto_test.Lammps import Lammps
from dpgen.auto_test.VASP import VASP


def make_calculator(inter_parameter, path_to_poscar):
Expand Down
9 changes: 5 additions & 4 deletions dpgen/auto_test/common_equi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
import os
import shutil
import warnings
from monty.serialization import dumpfn
from multiprocessing import Pool

from monty.serialization import dumpfn
from packaging.version import Version

import dpgen.auto_test.lib.abacus as abacus
import dpgen.auto_test.lib.crys as crys
import dpgen.auto_test.lib.util as util
import dpgen.auto_test.lib.abacus as abacus
from dpgen import dlog
from dpgen.auto_test.calculator import make_calculator
from dpgen.auto_test.lib.utils import create_path
from dpgen.auto_test.mpdb import get_structure
from packaging.version import Version
from dpgen.dispatcher.Dispatcher import make_submission
from dpgen.remote.decide_machine import convert_mdata
from dpgen.auto_test.lib.utils import create_path

lammps_task_type = ["deepmd", "meam", "eam_fs", "eam_alloy"]

Expand Down
14 changes: 8 additions & 6 deletions dpgen/auto_test/common_prop.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
from packaging.version import Version
import glob
import os
import warnings
from multiprocessing import Pool

from packaging.version import Version

import dpgen.auto_test.lib.util as util
from dpgen import dlog
from dpgen.util import sepline
from dpgen.auto_test.EOS import EOS
from dpgen.auto_test.calculator import make_calculator
from dpgen.auto_test.Elastic import Elastic
from dpgen.auto_test.EOS import EOS
from dpgen.auto_test.Gamma import Gamma
from dpgen.auto_test.Interstitial import Interstitial
from dpgen.auto_test.lib.utils import create_path
from dpgen.auto_test.Surface import Surface
from dpgen.auto_test.Vacancy import Vacancy
from dpgen.auto_test.Gamma import Gamma
from dpgen.auto_test.calculator import make_calculator
from dpgen.dispatcher.Dispatcher import make_submission
from dpgen.remote.decide_machine import convert_mdata
from dpgen.auto_test.lib.utils import create_path
from dpgen.util import sepline

lammps_task_type = ["deepmd", "meam", "eam_fs", "eam_alloy"]

Expand Down
10 changes: 7 additions & 3 deletions dpgen/auto_test/gen_confs.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#!/usr/bin/env python3

import os, re, argparse
import dpgen.auto_test.lib.crys as crys
from pymatgen.ext.matproj import MPRester, Composition
import argparse
import os
import re

from pymatgen.analysis.structure_matcher import StructureMatcher
from pymatgen.ext.matproj import Composition, MPRester

import dpgen.auto_test.lib.crys as crys

global_std_crystal = {
"fcc": crys.fcc,
Expand Down
7 changes: 5 additions & 2 deletions dpgen/auto_test/lib/abacus.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#!/usr/bin/python3
import os, sys
import os
import sys
from unicodedata import numeric

import dpdata
import dpgen.generator.lib.abacus_scf as abacus_scf
import numpy as np
from pymatgen.core.structure import Structure

import dpgen.generator.lib.abacus_scf as abacus_scf

A2BOHR = 1.8897261254578281
MASS_DICT = {
"H": 1.0079,
Expand Down
12 changes: 8 additions & 4 deletions dpgen/auto_test/lib/lammps.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/usr/bin/env python3

import random, os, sys
import dpdata
import os
import random
import subprocess as sp
import dpgen.auto_test.lib.util as util
from packaging.version import Version
import sys

import dpdata
from dpdata.periodic_table import Element
from packaging.version import Version

import dpgen.auto_test.lib.util as util


def cvt_lammps_conf(fin, fout, type_map, ofmt="lammps/data"):
Expand Down
Loading