Skip to content

Commit

Permalink
Merge pull request #40 from cote3804/master
Browse files Browse the repository at this point in the history
Merge pull request #1 from cote3804/jdftx-coords
  • Loading branch information
benrich37 authored Jan 13, 2025
2 parents 13c4c3a + a3384e6 commit 299b6ee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/pymatgen/io/jdftx/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ def to_pmg_structure(cls, jdftxinfile: JDFTXInfile, sort_structure: bool = False
"""
# use dict representation so it's easy to get the right column for
# moveScale, rather than checking for velocities
print(jdftxinfile.get_dict_representation(jdftxinfile), "INPUT DICT REP")
jdftxstructure = JDFTXStructure.from_jdftxinfile(
jdftxinfile.get_dict_representation(jdftxinfile),
sort_structure=sort_structure,
Expand Down Expand Up @@ -765,6 +766,7 @@ def from_jdftxinfile(cls, jdftxinfile: JDFTXInfile, sort_structure: bool = False

atomic_symbols = [x["species-id"] for x in jdftxinfile["ion"]]
coords = np.array([[x["x0"], x["x1"], x["x2"]] for x in jdftxinfile["ion"]])
coords *= const.value("Bohr radius") * 10**10 # Bohr radius in Ang; convert to Ang
selective_dynamics = np.array([x["moveScale"] for x in jdftxinfile["ion"]])

coords_are_cartesian = False # is default for JDFTx
Expand Down
8 changes: 6 additions & 2 deletions src/pymatgen/io/jdftx/joutstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ def _parse_ecomp_lines(self, ecomp_lines: list[str]) -> None:
key = lsplit[0].strip()
val = float(lsplit[1].strip())
self.ecomponents[key] = val * Ha_to_eV
if key is not None and (self.etype is None) and (key in ["F", "G"]):
if key is not None and (self.etype is None) and (key in ["F", "G", "Etot"]):
self.etype = key

def _parse_lowdin_lines(self, lowdin_lines: list[str]) -> None:
Expand Down Expand Up @@ -690,7 +690,11 @@ def _collect_generic_line(self, line_text: str, generic_lines: list[str]) -> tup
def _init_structure(self) -> None:
"""Initialize structure attribute."""
self.structure = Structure(
lattice=self.lattice, species=self.species, coords=self.cart_coords, site_properties=self.site_properties
lattice=self.lattice,
species=self.species,
coords=self.cart_coords,
site_properties=self.site_properties,
coords_are_cartesian=True
)

def to_dict(self) -> dict:
Expand Down

0 comments on commit 299b6ee

Please sign in to comment.