Skip to content

Commit bca347c

Browse files
Merge pull request #120 from Letian88/main
fix(abacus): use --config flag for phonopy 4.1.0 load mode compatibility
2 parents 0b4bdba + cbac2a9 commit bca347c

4 files changed

Lines changed: 11 additions & 8 deletions

File tree

apex/core/property/Gruneisen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ def _ensure_abacus_volume_outputs(
963963
if not os.path.isfile("FORCE_CONSTANTS"):
964964
raise FileNotFoundError(f"FORCE_CONSTANTS was not created in {helper_dir}")
965965
if not os.path.isfile("mesh.yaml"):
966-
subprocess.check_call(Phonon.phonopy_command("band.conf"), shell=True)
966+
subprocess.check_call(Phonon.phonopy_command("phonopy_disp.yaml --config band.conf"), shell=True)
967967
self._write_band_dat()
968968
finally:
969969
os.chdir(cwd)

apex/core/property/Phonon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ def _compute_lower(self, output_file, all_tasks, all_res):
622622
if not os.path.exists("FORCE_SETS"):
623623
raise FileNotFoundError("FORCE_SETS was not created")
624624
print('FORCE_SETS is created')
625-
subprocess.check_call(self.phonopy_command("band.conf"), shell=True)
625+
subprocess.check_call(self.phonopy_command("phonopy_disp.yaml --config band.conf"), shell=True)
626626
self.write_band_dat()
627627

628628
elif self.inter_param["type"] == 'vasp':

tests/test_gruneisen.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ def fake_check_call(command, shell):
408408
Path("FORCE_SETS").write_text("fake force sets\n")
409409
elif command == Phonon.phonopy_setup_command("phonopy_disp.yaml --writefc"):
410410
Path("FORCE_CONSTANTS").write_text("fake force constants\n")
411-
elif command == Phonon.phonopy_command("band.conf"):
411+
elif command == Phonon.phonopy_command("phonopy_disp.yaml --config band.conf"):
412412
strain = loadfn("volume.json")["strain"]
413413
if strain < 0:
414414
frequencies = [4.2, 8.4]
@@ -459,8 +459,11 @@ def fake_run(command, stdout, stderr, text):
459459
]),
460460
3,
461461
)
462-
self.assertEqual(len([cmd for _, cmd in calls if cmd == Phonon.phonopy_command("band.conf")]), 3)
463-
self.assertFalse(any(cmd == "phonopy band.conf --abacus" for _, cmd in calls))
462+
self.assertEqual(
463+
len([cmd for _, cmd in calls if cmd == Phonon.phonopy_command("phonopy_disp.yaml --config band.conf")]),
464+
3,
465+
)
466+
self.assertFalse(any(cmd == "phonopy phonopy_disp.yaml --config band.conf --abacus" for _, cmd in calls))
464467
self.assertTrue((work_dir / "volume.000000" / "mesh.yaml").is_file())
465468
self.assertTrue((work_dir / "volume.000001" / "band.dat").is_file())
466469
self.assertTrue("Temperature(K) SumGammaCv Sign" in ptr)

tests/test_phonon.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def fake_check_call(command, shell):
340340
calls.append(command)
341341
if command.startswith(Phonon.phonopy_setup_command("-f")):
342342
Path("FORCE_SETS").write_text("fake force sets\n")
343-
elif command == Phonon.phonopy_command("band.conf"):
343+
elif command == Phonon.phonopy_command("phonopy_disp.yaml --config band.conf"):
344344
Path("band.yaml").write_text("phonon: []\n")
345345

346346
try:
@@ -349,8 +349,8 @@ def fake_check_call(command, shell):
349349
patch.object(Phonon, "write_band_dat", side_effect=self._write_band_dat_for_compute):
350350
phonon._compute_lower(str(work_dir / "result.json"), [str(task_dir)], [])
351351
self.assertEqual(calls[0], Phonon.phonopy_setup_command("-f task.0*/OUT.ABACUS/running_scf.log"))
352-
self.assertEqual(calls[1], Phonon.phonopy_command("band.conf"))
353-
self.assertFalse(any("--abacus" in command and command.startswith("phonopy band.conf") for command in calls))
352+
self.assertEqual(calls[1], Phonon.phonopy_command("phonopy_disp.yaml --config band.conf"))
353+
self.assertFalse(any("--abacus" in command and "band.conf" in command for command in calls))
354354
finally:
355355
shutil.rmtree(work_dir, ignore_errors=True)
356356

0 commit comments

Comments
 (0)