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

Merge pull request #1 from cote3804/jdftx-coords #40

Merged
merged 3 commits into from
Jan 13, 2025
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
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