Skip to content

Commit

Permalink
v2024.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Feb 1, 2024
1 parent adf5af6 commit 0783846
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 19 deletions.
2 changes: 1 addition & 1 deletion dev_scripts/regen_libxcfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def main():

xc_funcs = parse_libxc_docs(path)

# Generate new json file in pycore
# Generate new JSON file in pycore
pmg_core = os.path.abspath("../pymatgen/core/")
json_path = f"{pmg_core}/libxc_docs.json"
write_libxc_docs_json(xc_funcs, json_path)
Expand Down
28 changes: 28 additions & 0 deletions docs/CHANGES.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def hints(self, hints_info):
"""
if hints_info["csm"] > self.options["csm_max"]:
return []
return object.__getattribute__(self, f"{self.hints_type}_hints")(hints_info)
return getattr(self, f"{self.hints_type}_hints")(hints_info)

def single_cap_hints(self, hints_info):
"""Return hints for an additional neighbors set, i.e. the voronoi indices that
Expand Down
8 changes: 4 additions & 4 deletions pymatgen/command_line/gulp_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def structure_lines(
alpha, beta, gamma = lattice.angles
a, b, c = lattice.lengths
lat_str = f"{a:6f} {b:6f} {c:6f} {alpha:6f} {beta:6f} {gamma:6f}"
gin += lat_str + "\n"
gin += f"{lat_str}\n"

if frac_flg:
gin += "frac\n"
Expand All @@ -308,7 +308,7 @@ def structure_lines(

if symm_flg:
gin += "space\n"
gin += str(SpacegroupAnalyzer(structure).get_space_group_number()) + "\n"
gin += f"{SpacegroupAnalyzer(structure).get_space_group_number()}\n"
return gin

@staticmethod
Expand Down Expand Up @@ -367,7 +367,7 @@ def readable(f):
if readable(fpath):
gin = "library " + file_name
if gin:
return gin + "\n"
return f"{gin}\n"
raise GulpError("GULP library not found")

def buckingham_input(self, structure: Structure, keywords, library=None, uc=True, valence_dict=None):
Expand Down Expand Up @@ -694,7 +694,7 @@ def run(self, gin):

gout = ""
for line in out.split("\n"):
gout = gout + line + "\n"
gout = f"{gout}{line}\n"
return gout


Expand Down
6 changes: 3 additions & 3 deletions pymatgen/io/adf.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ def __str__(self):
for block_key in self.other_directives:
if not isinstance(block_key, AdfKey):
raise ValueError(f"{block_key} is not an AdfKey!")
out += str(block_key) + "\n"
out += f"{block_key}\n"
return out

def as_dict(self):
Expand Down Expand Up @@ -634,8 +634,8 @@ def write_file(self, molecule, inp_file):

with open(inp_file, "w+") as file:
for block in mol_blocks:
file.write(str(block) + "\n")
file.write(str(self.task) + "\n")
file.write(f"{block}\n")
file.write(f"{self.task}\n")
file.write("END INPUT")


Expand Down
2 changes: 1 addition & 1 deletion pymatgen/io/cssr.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def write_file(self, filename):
filename (str): Filename to write to.
"""
with zopen(filename, mode="wt") as file:
file.write(str(self) + "\n")
file.write(f"{self}\n")

@classmethod
def from_str(cls, string):
Expand Down
6 changes: 3 additions & 3 deletions pymatgen/io/feff/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def write_file(self, filename="HEADER"):
filename: Filename and path for file to be written to disk
"""
with open(filename, mode="w") as file:
file.write(str(self) + "\n")
file.write(f"{self}\n")


class Atoms(MSONable):
Expand Down Expand Up @@ -942,7 +942,7 @@ def write_file(self, filename="POTENTIALS"):
filename: filename and path to write potential file to.
"""
with zopen(filename, mode="wt") as file:
file.write(str(self) + "\n")
file.write(f"{self}\n")


class Paths(MSONable):
Expand Down Expand Up @@ -983,7 +983,7 @@ def __str__(self):
def write_file(self, filename="paths.dat"):
"""Write paths.dat."""
with zopen(filename, mode="wt") as file:
file.write(str(self) + "\n")
file.write(f"{self}\n")


class FeffParseError(ParseError):
Expand Down
8 changes: 4 additions & 4 deletions pymatgen/io/shengbte.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,19 @@ def to_file(self, filename: str = "CONTROL"):

alloc_dict = _get_subdict(self, self.allocations_keys)
alloc_nml = f90nml.Namelist({"allocations": alloc_dict})
control_str = str(alloc_nml) + "\n"
control_str = f"{alloc_nml}\n"

crystal_dict = _get_subdict(self, self.crystal_keys)
crystal_nml = f90nml.Namelist({"crystal": crystal_dict})
control_str += str(crystal_nml) + "\n"
control_str += f"{crystal_nml}\n"

params_dict = _get_subdict(self, self.params_keys)
params_nml = f90nml.Namelist({"parameters": params_dict})
control_str += str(params_nml) + "\n"
control_str += f"{params_nml}\n"

flags_dict = _get_subdict(self, self.flags_keys)
flags_nml = f90nml.Namelist({"flags": flags_dict})
control_str += str(flags_nml) + "\n"
control_str += f"{flags_nml}\n"

with open(filename, mode="w") as file:
file.write(control_str)
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/io/xr.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def write_file(self, filename):
filename (str): name of the file to write to.
"""
with zopen(filename, mode="wt") as file:
file.write(str(self) + "\n")
file.write(f"{self}\n")

@classmethod
def from_str(cls, string, use_cores=True, thresh=1.0e-4):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
setup(
name="pymatgen",
packages=find_namespace_packages(include=["pymatgen.*", "pymatgen.**.*", "cmd_line"]),
version="2024.1.27",
version="2024.2.1",
python_requires=">=3.9",
install_requires=[
"matplotlib>=1.5",
Expand Down

0 comments on commit 0783846

Please sign in to comment.