Skip to content

Commit

Permalink
Small formatting changes to make them more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Chico committed Apr 23, 2024
1 parent ed2e490 commit affe42f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
10 changes: 5 additions & 5 deletions src/aiida_lammps/parsers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import glob
import os
import time
from typing import Union
from typing import Any, Dict, List, Union

from aiida import orm
from aiida.common import exceptions
Expand Down Expand Up @@ -178,8 +178,8 @@ def parse(self, **kwargs):

def parse_restartfile(
self,
parameters: dict,
list_of_files: list,
parameters: Dict[str, Any],
list_of_files: List[str],
temp_folder: Union[os.PathLike, str, None],
) -> str:
"""
Expand Down Expand Up @@ -247,8 +247,8 @@ def parse_restartfile(
self.out("restartfile", restart_file)
return restart_filename

def check_convergence(self, global_data: dict):
"""Check for the convergence of the calculaiton in the case of a minimization run"""
def check_convergence(self, global_data: Dict[str, Any]):
"""Check for the convergence of the calculation in the case of a minimization run"""
_etol = global_data.get("minimization", {}).get(
"energy_relative_difference", None
)
Expand Down
46 changes: 23 additions & 23 deletions src/aiida_lammps/parsers/inputfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import json
import os
import re
from typing import Any, Dict, Optional, Union
from typing import Any, Dict, List, Optional, Union

from aiida import orm
import numpy as np
Expand Down Expand Up @@ -173,7 +173,7 @@ def generate_input_file(
return input_file


def write_control_block(parameters_control: dict) -> str:
def write_control_block(parameters_control: Dict[str, Any]) -> str:
"""
Generate the input block with global control options.
Expand Down Expand Up @@ -214,7 +214,7 @@ def write_control_block(parameters_control: dict) -> str:
def write_potential_block(
potential: LammpsPotentialData,
structure: orm.StructureData,
parameters_potential: dict,
parameters_potential: Dict[str, Any],
potential_file: str,
) -> str:
"""
Expand Down Expand Up @@ -341,7 +341,7 @@ def write_structure_block(
return structure_block, group_names


def write_minimize_block(parameters_minimize: dict) -> str:
def write_minimize_block(parameters_minimize: Dict[str, Union[str, float, int]]) -> str:
"""
Generate the input block with the minimization options.
Expand All @@ -367,7 +367,7 @@ def write_minimize_block(parameters_minimize: dict) -> str:
return minimize_block


def write_md_block(parameters_md: dict) -> str:
def write_md_block(parameters_md: Dict[str, Any]) -> str:
"""
Generate the input block with the MD options.
Expand Down Expand Up @@ -416,7 +416,7 @@ def write_md_block(parameters_md: dict) -> str:


def write_final_variables_block(
fixed_thermo: list,
fixed_thermo: List[str],
final_file: str = "aiida_lammps.yaml",
) -> str:
"""
Expand Down Expand Up @@ -455,7 +455,7 @@ def write_final_variables_block(
return variables_block


def generate_velocity_string(parameters_velocity: dict) -> str:
def generate_velocity_string(parameters_velocity: Dict[str, Any]) -> str:
"""
Generate the velocity string for the MD block.
Expand Down Expand Up @@ -497,7 +497,7 @@ def generate_velocity_string(parameters_velocity: dict) -> str:
return options


def generate_velocity_options(options_velocity: dict) -> str:
def generate_velocity_options(options_velocity: Dict[str, Any]) -> str:
"""
Generate the options string for every velocity.
Expand All @@ -520,7 +520,7 @@ def generate_velocity_options(options_velocity: dict) -> str:

def generate_integration_options(
style: str,
integration_parameters: dict,
integration_parameters: Dict[str, Any],
) -> str:
"""
Create a string with the integration options.
Expand Down Expand Up @@ -639,8 +639,8 @@ def generate_integration_options(


def write_fix_block(
parameters_fix: dict,
group_names: list = None,
parameters_fix: Dict[str, Any],
group_names: Optional[List[str]] = None,
) -> str:
"""
Generate the input block with the fix options.
Expand Down Expand Up @@ -683,8 +683,8 @@ def write_fix_block(


def write_compute_block(
parameters_compute: dict,
group_names: list = None,
parameters_compute: Dict[str, Any],
group_names: Optional[List[str]] = None,
) -> str:
"""
Generate the input block with the compute options.
Expand Down Expand Up @@ -719,11 +719,11 @@ def write_compute_block(


def write_dump_block(
parameters_dump: dict,
parameters_dump: Dict[str, Any],
trajectory_filename: str,
atom_style: str,
parameters_compute: dict = None,
kind_symbols: list = None,
parameters_compute: Optional[Dict[str, Any]] = None,
kind_symbols: Optional[List[str]] = None,
) -> str:
"""Generate the block with dumps commands.
Expand Down Expand Up @@ -785,9 +785,9 @@ def write_dump_block(


def write_thermo_block(
parameters_thermo: dict,
parameters_compute: dict = None,
) -> Union[str, list]:
parameters_thermo: Dict[str, Any],
parameters_compute: Optional[Dict[str, Any]] = None,
) -> Union[str, List[str]]:
"""Generate the block with the thermo command.
This will take all the global computes which were generated during the calculation
Expand Down Expand Up @@ -858,8 +858,8 @@ def write_thermo_block(


def write_restart_block(
parameters_restart: dict, restart_filename: str, max_number_steps: int
) -> dict:
parameters_restart: Dict[str, Any], restart_filename: str, max_number_steps: int
) -> Dict[str, Any]:
"""Generate the block to write the restart file.
:param parameters_restart: set of parameters controlling the printing of the restartfile
Expand Down Expand Up @@ -978,7 +978,7 @@ def generate_printing_string(
return " ".join(_string)


def generate_id_tag(name: str = None, group: str = None) -> str:
def generate_id_tag(name: Optional[str] = None, group: Optional[str] = None) -> str:
"""Generate an id tag for fixes and/or computes.
To standardize the naming of computes and/or fixes and to ensure that one
Expand All @@ -998,7 +998,7 @@ def generate_id_tag(name: str = None, group: str = None) -> str:
return f"{name.replace('/','_')}_{group}_aiida"


def join_keywords(value: list) -> str:
def join_keywords(value: List[Any]) -> str:
"""
Generate a string for the compute/fix options.
Expand Down

0 comments on commit affe42f

Please sign in to comment.