88import pytest
99
1010from pymatgen .core .structure import Site , Structure
11+ from pymatgen .core .units import bohr_to_ang
1112from pymatgen .io .jdftx .inputs import JDFTXInfile , JDFTXStructure , selective_dynamics_site_prop_to_jdftx_interpretable
1213from pymatgen .io .jdftx .jdftxinfile_default_inputs import antoinePvap , default_inputs
1314from pymatgen .io .jdftx .jdftxinfile_master_format import get_tag_object
@@ -571,6 +572,7 @@ def test_lattice_writing(value_str: str):
571572)
572573def test_jdftxstructure_lattice_conversion (value_str : str ):
573574 test_vars = ["a" , "b" , "c" , "alpha" , "beta" , "gamma" ]
575+ conv_vars = ["a" , "b" , "c" ]
574576 mft_lattice_tag = get_tag_object ("lattice" )
575577 assert mft_lattice_tag is not None
576578 i = mft_lattice_tag .get_format_index_for_str_value ("lattice" , value_str )
@@ -584,7 +586,10 @@ def test_jdftxstructure_lattice_conversion(value_str: str):
584586 structure = infile .to_pmg_structure (infile )
585587 for var in test_vars :
586588 if var in parsed_tag :
587- assert_same_value (float (getattr (structure .lattice , var )), float (parsed_tag [var ]))
589+ should_be = parsed_tag [var ]
590+ if var in conv_vars :
591+ should_be *= bohr_to_ang
592+ assert_same_value (float (getattr (structure .lattice , var )), float (should_be ))
588593
589594
590595def test_jdftxinfile_comparison ():
0 commit comments