Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Fix to_gpu interface for solvent modules
  • Loading branch information
sunqm committed Sep 18, 2025
commit d2306afd75ca438606fe2ee15eca2e12baef90e4
4 changes: 2 additions & 2 deletions pyscf/solvent/grad/pcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,12 @@ def undo_solvent(self):
return obj

def to_gpu(self):
from gpu4pyscf.solvent.hessian import pcm # type: ignore
from gpu4pyscf.solvent.grad import pcm # type: ignore
from pyscf.tdscf.rhf import TDBase
# Only PCM and SMD are available on GPU.
# FIXME: The SMD class is a child class of PCM now. Additional check for
# SMD should be made if SMD is refactored as an independent class
assert isinstance(self.with_solvent, PCM)
assert isinstance(self.base.with_solvent, PCM)
if isinstance(self, TDBase):
raise NotImplementedError('.to_gpu() for PCM-TDDFT')
return self.base.to_gpu().PCM().Gradients()
Expand Down
2 changes: 2 additions & 0 deletions pyscf/solvent/grad/smd.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,5 @@ def grad_solver(pcmobj, dm):

def get_cds(smdobj):
return smd.get_cds_legacy(smdobj)[1]

make_grad_object = pcm_grad.make_grad_object
3 changes: 1 addition & 2 deletions pyscf/solvent/hessian/pcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,8 +1044,7 @@ def to_gpu(self):
from pyscf.tdscf.rhf import TDBase
if isinstance(self, TDBase):
raise NotImplementedError('.to_gpu() for PCM-TDDFT')
# ground state methods
return self.undo_solvent().to_gpu().Hessian()
return self.base.to_gpu().PCM().Hessian()

def kernel(self, *args, dm=None, atmlst=None, **kwargs):
if dm is None:
Expand Down
Loading