Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 11, 2023

Verified

This commit was signed with the committer’s verified signature.
xieyuschen Griffin
1 parent 6303b8a commit f98ad29
Showing 25 changed files with 1 addition and 44 deletions.
3 changes: 0 additions & 3 deletions aiida_lammps/calculations/lammps/__init__.py
Original file line number Diff line number Diff line change
@@ -30,7 +30,6 @@ def get_supercell(structure, supercell_shape):


def get_force_constants(force_constants):

force_constants = force_constants.get_array("force_constants")

fc_shape = force_constants.shape
@@ -45,7 +44,6 @@ def get_force_constants(force_constants):


def structure_to_poscar(structure):

atom_type_unique = np.unique(
[site.kind_name for site in structure.sites], return_index=True
)[1]
@@ -66,7 +64,6 @@ def structure_to_poscar(structure):


def parameters_to_input_file(parameters_object):

parameters = parameters_object.get_dict()
input_file = "STRUCTURE FILE POSCAR\nPOSCAR\n\n"
input_file += "FORCE CONSTANTS\nFORCE_CONSTANTS\n\n"
4 changes: 0 additions & 4 deletions aiida_lammps/calculations/lammps/combinate.py
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@ def generate_dynaphopy_input(
force_sets_filename="FORCE_SETS",
use_sets=False,
):

parameters = parameters_object.get_dict()
input_file = "STRUCTURE FILE POSCAR\n{}\n\n".format(poscar_name)

@@ -43,7 +42,6 @@ def generate_dynaphopy_input(


class CombinateCalculation(BaseLammpsCalculation):

_POSCAR_NAME = "POSCAR"
_INPUT_FORCE_CONSTANTS = "FORCE_CONSTANTS"
_INPUT_FORCE_SETS = "FORCE_SETS"
@@ -80,7 +78,6 @@ def create_main_input_content(
system_filename,
restart_filename,
):

random_number = np.random.randint(10000000)

lammps_input_file = "units {0}\n".format(potential_data.default_units)
@@ -110,7 +107,6 @@ def create_main_input_content(
return lammps_input_file

def prepare_extra_files(self, tempfolder, potential_object):

if "fore_constants" in self.inputs:
force_constants = self.inputs.force_constants
else:
1 change: 0 additions & 1 deletion aiida_lammps/calculations/lammps/force.py
Original file line number Diff line number Diff line change
@@ -35,7 +35,6 @@ def create_main_input_content(
system_filename,
restart_filename,
):

version_date = convert_date_string(
parameter_data.get_attribute("lammps_version", "11 Aug 2017")
)
1 change: 0 additions & 1 deletion aiida_lammps/calculations/lammps/md.py
Original file line number Diff line number Diff line change
@@ -42,7 +42,6 @@ def create_main_input_content(
system_filename,
restart_filename,
):

pdict = parameter_data.get_dict()
version_date = convert_date_string(pdict.get("lammps_version", "11 Aug 2017"))

2 changes: 0 additions & 2 deletions aiida_lammps/calculations/lammps/md_multi.py
Original file line number Diff line number Diff line change
@@ -44,7 +44,6 @@ def create_main_input_content(
system_filename,
restart_filename,
):

pdict = parameter_data.get_dict()
version_date = convert_date_string(pdict.get("lammps_version", "11 Aug 2017"))
lammps_input_file = ""
@@ -109,7 +108,6 @@ def create_main_input_content(
current_computes = []

for stage_id, stage_dict in enumerate(pdict.get("stages")):

stage_name = stage_dict.get("name")
if stage_name in stage_names:
raise ValueError("non-unique stage name: {}".format(stage_name))
1 change: 0 additions & 1 deletion aiida_lammps/calculations/lammps/optimize.py
Original file line number Diff line number Diff line change
@@ -40,7 +40,6 @@ def create_main_input_content(
system_filename,
restart_filename,
):

parameter_data = parameter_data.get_dict()
version_date = convert_date_string(
parameter_data.get("lammps_version", "11 Aug 2017")
2 changes: 0 additions & 2 deletions aiida_lammps/common/generate_input_files.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@


def get_trajectory_txt(trajectory):

cell = trajectory.get_cells()[0]

a = np.linalg.norm(cell[0])
@@ -54,7 +53,6 @@ def get_trajectory_txt(trajectory):


def parameters_to_input_file(parameters_object):

parameters = parameters_object.get_dict()
input_file = "STRUCTURE FILE POSCAR\nPOSCAR\n\n"
input_file += "FORCE CONSTANTS\nFORCE_CONSTANTS\n\n"
1 change: 0 additions & 1 deletion aiida_lammps/common/generate_structure.py
Original file line number Diff line number Diff line change
@@ -107,7 +107,6 @@ def generate_lammps_structure(
filestring += "Atoms\n\n"

for site_index, (pos, site) in enumerate(zip(positions, structure.sites)):

kind_id = kind_name_id_map[site.kind_name]

if atom_style == "atomic":
2 changes: 0 additions & 2 deletions aiida_lammps/common/raw_parsers.py
Original file line number Diff line number Diff line change
@@ -225,7 +225,6 @@ def parse_quasiparticle_data(qp_file):


def parse_dynaphopy_output(file):

thermal_properties = None

with open(file, "r") as handle:
@@ -247,7 +246,6 @@ def parse_dynaphopy_output(file):

phonons = {}
for i, index in enumerate(indices[:-1]):

fragment = data_lines[indices[i] : indices[i + 1]]
if "kipped" in fragment:
continue
1 change: 0 additions & 1 deletion aiida_lammps/data/pot_plugins/eam.py
Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@ def get_external_content(self):
return {self.potential_fname: potential_file}

def get_input_potential_lines(self):

lammps_input_text = "pair_style eam/{}\n".format(self.data["type"])
lammps_input_text += "pair_coeff * * {0} {{kind_symbols}}\n".format(
self.potential_fname
1 change: 0 additions & 1 deletion aiida_lammps/data/pot_plugins/lennard_jones.py
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ def get_external_content(self):
return None

def get_input_potential_lines(self):

cut = np.max([float(i.split()[2]) for i in self.data.values()])

lammps_input_text = "pair_style lj/cut {}\n".format(cut)
2 changes: 0 additions & 2 deletions aiida_lammps/data/pot_plugins/reaxff.py
Original file line number Diff line number Diff line change
@@ -90,15 +90,13 @@ def get_control_file_content(self):
return None

def get_external_content(self):

fmap = {self.potential_fname: self.get_potential_file_content()}
content = self.get_control_file_content()
if content:
fmap[self.control_fname] = content
return fmap

def get_input_potential_lines(self):

control = self.data.get("control", {})

lammps_input_text = "pair_style reax/c {} ".format(
1 change: 0 additions & 1 deletion aiida_lammps/data/pot_plugins/tersoff.py
Original file line number Diff line number Diff line change
@@ -21,7 +21,6 @@ def get_external_content(self):
return {self.potential_fname: potential_file}

def get_input_potential_lines(self):

lammps_input_text = "pair_style tersoff\n"
lammps_input_text += "pair_coeff * * {} {{kind_symbols}}\n".format(
self.potential_fname
1 change: 0 additions & 1 deletion aiida_lammps/data/trajectory.py
Original file line number Diff line number Diff line change
@@ -78,7 +78,6 @@ def set_from_fileobj(self, fileobj, aliases=None):
with tempfile.NamedTemporaryFile() as temp_handle:
with ZipFile(temp_handle, "w", self._compression_method) as zip_file:
for step_id, traj_step in enumerate(iter_trajectories(fileobj)):

# extract data to store in attributes
time_steps.append(traj_step.timestep)
if number_atoms is None:
1 change: 0 additions & 1 deletion aiida_lammps/tests/test_calculations.py
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@ def get_lammps_version(code):


def get_calc_parameters(lammps_version, plugin_name, units, potential_type):

if potential_type == "reaxff":
output_variables = ["temp", "etotal", "c_reax[1]"]
thermo_keywords = ["c_reax[1]"]
5 changes: 0 additions & 5 deletions aiida_lammps/tests/test_parsers.py
Original file line number Diff line number Diff line change
@@ -44,7 +44,6 @@ def get_traj_force():
"plugin_name", ["lammps.force", "lammps.optimize", "lammps.md", "lammps.md.multi"]
)
def test_missing_log(db_test_app, plugin_name):

retrieved = FolderData()

calc_node = db_test_app.generate_calcjob_node(plugin_name, retrieved)
@@ -66,7 +65,6 @@ def test_missing_log(db_test_app, plugin_name):
"plugin_name", ["lammps.force", "lammps.optimize", "lammps.md", "lammps.md.multi"]
)
def test_missing_traj(db_test_app, plugin_name):

retrieved = FolderData()
retrieved.put_object_from_filelike(StringIO(get_log()), "log.lammps")
retrieved.put_object_from_filelike(StringIO(""), "_scheduler-stdout.txt")
@@ -91,7 +89,6 @@ def test_missing_traj(db_test_app, plugin_name):
"plugin_name", ["lammps.force", "lammps.optimize", "lammps.md", "lammps.md.multi"]
)
def test_empty_log(db_test_app, plugin_name):

retrieved = FolderData()
for filename in [
"log.lammps",
@@ -123,7 +120,6 @@ def test_empty_log(db_test_app, plugin_name):
"plugin_name", ["lammps.force", "lammps.optimize", "lammps.md", "lammps.md.multi"]
)
def test_empty_traj(db_test_app, plugin_name):

retrieved = FolderData()
retrieved.put_object_from_filelike(StringIO(get_log()), "log.lammps")
for filename in [
@@ -154,7 +150,6 @@ def test_empty_traj(db_test_app, plugin_name):
"plugin_name", ["lammps.force", "lammps.optimize", "lammps.md", "lammps.md.multi"]
)
def test_run_error(db_test_app, plugin_name):

retrieved = FolderData()
retrieved.put_object_from_filelike(StringIO(get_log()), "log.lammps")
retrieved.put_object_from_filelike(
2 changes: 1 addition & 1 deletion aiida_lammps/tests/utils.py
Original file line number Diff line number Diff line change
@@ -144,7 +144,7 @@ def get_default_metadata(


def recursive_round(ob, dp, apply_lists=False):
""" map a function on to all values of a nested dictionary """
"""map a function on to all values of a nested dictionary"""
if isinstance(ob, Mapping):
return {k: recursive_round(v, dp, apply_lists) for k, v in ob.items()}
elif apply_lists and isinstance(ob, (list, tuple)):
7 changes: 0 additions & 7 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -87,7 +87,6 @@ def get_structure_data():
def _get_structure_data(pkey):
"""return test structure data"""
if pkey == "Fe":

cell = [
[2.848116, 0.000000, 0.000000],
[0.000000, 2.848116, 0.000000],
@@ -104,7 +103,6 @@ def _get_structure_data(pkey):
names = ["Fe1", "Fe2"]

elif pkey == "Ar":

cell = [
[3.987594, 0.000000, 0.000000],
[-1.993797, 3.453358, 0.000000],
@@ -117,7 +115,6 @@ def _get_structure_data(pkey):
fractional = True

elif pkey == "GaN":

cell = [
[3.1900000572, 0, 0],
[-1.5950000286, 2.762621076, 0],
@@ -135,7 +132,6 @@ def _get_structure_data(pkey):
symbols = names = ["Ga", "Ga", "N", "N"]

elif pkey == "pyrite":

cell = [
[5.38, 0.000000, 0.000000],
[0.000000, 5.38, 0.000000],
@@ -241,7 +237,6 @@ def _get_potential_data(pkey):
output_dict = {"initial_energy": -8.2441284, "energy": -8.2448702}

elif pkey == "lennard-jones":

structure = get_structure_data("Ar")

# Example LJ parameters for Argon. These may not be accurate at all
@@ -258,7 +253,6 @@ def _get_potential_data(pkey):
}

elif pkey == "tersoff":

structure = get_structure_data("GaN")

potential_dict = {
@@ -277,7 +271,6 @@ def _get_potential_data(pkey):
output_dict = {"initial_energy": -18.109886, "energy": -18.110852}

elif pkey == "reaxff":

from aiida_lammps.common.reaxff_convert import (
filter_by_species,
read_lammps_format,
1 change: 0 additions & 1 deletion examples/launch_dynaphopy_si.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
import numpy as np

if __name__ == "__main__":

from aiida import load_profile # noqa: F401

load_profile()
1 change: 0 additions & 1 deletion examples/launch_lammps_combinate.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
import numpy as np

if __name__ == "__main__":

from aiida import load_profile # noqa: F401

load_profile()
1 change: 0 additions & 1 deletion examples/launch_lammps_force_gan.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
from aiida_lammps.data.potential import EmpiricalPotential

if __name__ == "__main__":

from aiida import load_profile # noqa: F401

load_profile()
1 change: 0 additions & 1 deletion examples/launch_lammps_md_si.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
from aiida_lammps.data.potential import EmpiricalPotential

if __name__ == "__main__":

load_profile()

codename = "lammps_md@stern"
1 change: 0 additions & 1 deletion examples/launch_lammps_optimization_fe.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
from aiida_lammps.data.potential import EmpiricalPotential

if __name__ == "__main__":

from aiida import load_profile # noqa: F401

load_profile()
1 change: 0 additions & 1 deletion examples/launch_lammps_optimization_gan.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
from aiida_lammps.data.potential import EmpiricalPotential

if __name__ == "__main__":

from aiida import load_profile # noqa: F401

load_profile()
1 change: 0 additions & 1 deletion examples/launch_lammps_optimization_lj.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
from aiida_lammps.data.potential import EmpiricalPotential

if __name__ == "__main__":

from aiida import load_profile # noqa: F401

load_profile()

0 comments on commit f98ad29

Please sign in to comment.