Skip to content

Commit 5e9663f

Browse files
wxj6000Xiaojie Wu
andauthored
Maintain examples (#405)
* maintain examples * Update rsdf_builder.py --------- Co-authored-by: Xiaojie Wu <wxj6000@gmail..com>
1 parent 00a1081 commit 5e9663f

File tree

8 files changed

+15
-13
lines changed

8 files changed

+15
-13
lines changed

examples/10-dft_with_ecp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
'''
2626

2727
# def2-qzvpp contains ecp for heavy atoms
28+
# One needs to specify ecp separately
2829
mol = pyscf.M(atom=atom, basis='def2-qzvpp', ecp='def2-qzvpp')
2930
mf = rks.RKS(mol, xc='b3lyp').density_fit()
3031
mf.grids.level = 6 # more grids are needed for heavy atoms
3132
e_dft = mf.kernel()
3233

33-
# gradient and Hessian of ECP are also supported
34-
# but ECP contributions are still calculated on CPU
34+
# ECP contributions are accelerated with GPU
3535
g = mf.nuc_grad_method()
3636
grad = g.kernel()
3737

examples/11-dft_with_nlc.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
'''
2929

3030
start_time = time.time()
31-
mol = pyscf.M(
32-
atom='Vitamin_C.xyz',
33-
verbose=4)
31+
mol = pyscf.M(atom=atom, verbose=4)
3432

3533
print(f'{mol.nao} atomic orbitals')
3634
mf = rks.RKS(mol, xc='HYB_MGGA_XC_WB97M_V').density_fit()
@@ -42,8 +40,11 @@
4240
end_time = time.time()
4341
print(f'Wallclock time: {end_time-start_time}')
4442

45-
print('calculating gradient')
43+
# Compute gradient
4644
gobj = mf.nuc_grad_method()
4745
gobj.kernel()
4846

49-
# Hessian for nlc is not supported
47+
# Compute Hessian
48+
h = mf.Hessian()
49+
h.auxbasis_response = 2
50+
h_dft = h.kernel()

examples/18-ccsd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626
verbose=1)
2727

2828
mf = mol.RHF().run()
29-
mf.with_df = None
29+
mf.with_df = None # DF CCSD is not supported yet.
3030
e_tot = ccsd_incore.CCSD(mf).kernel()

examples/28-tddft_with_solvent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515

1616
###################################
17-
# Example of TDDFT
17+
# Example of TDDFT with solvent
1818
###################################
1919

2020
import pyscf

gpu4pyscf/dft/gen_grid.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,9 @@ class Grids(lib.StreamObject):
437437
level = getattr(__config__, 'dft_gen_grid_Grids_level', 3)
438438
alignment = ALIGNMENT_UNIT
439439
cutoff = CUTOFF
440-
_keys = gen_grid_cpu.Grids._keys
440+
_keys = gen_grid_cpu.Grids._keys.union({
441+
'grid_sorting_index', 'atm_idx', 'padding'
442+
})
441443

442444
__init__ = gen_grid_cpu.Grids.__init__
443445
dump_flags = gen_grid_cpu.Grids.dump_flags

gpu4pyscf/lib/cutensor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ def contraction(
7878
mode_a = list(str_a)
7979
mode_b = list(str_b)
8080
mode_c = list(str_c)
81+
if len(mode_c) != len(set(mode_c)):
82+
raise ValueError('Output subscripts string includes the same subscript multiple times.')
8183

8284
dtype = np.result_type(a.dtype, b.dtype)
8385
a = cupy.asarray(a, dtype=dtype)

gpu4pyscf/qmmm/pbc/itrf.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ def qmmm_for_scf(method, mm_mol):
9999
method.mm_ewald_pot = None
100100
method.qm_ewald_hess = None
101101
method.e_nuc = None
102-
method.h1_on_cpu = False
103102
return method
104103

105104
cls = QMMMSCF
@@ -128,7 +127,6 @@ def __init__(self, method, mm_mol):
128127
self.mm_ewald_pot = None
129128
self.qm_ewald_hess = None
130129
self.e_nuc = None
131-
self.h1_on_cpu = False
132130

133131
def dump_flags(self, verbose=None):
134132
super().dump_flags(verbose)
@@ -540,7 +538,6 @@ def qmmm_grad_for_scf(scf_grad):
540538

541539
scf_grad.de_ewald_mm = None
542540
scf_grad.de_nuc_mm = None
543-
scf_grad.h1_on_cpu = False
544541
return scf_grad.view(lib.make_class((QMMMGrad, scf_grad.__class__)))
545542

546543
class QMMMGrad:

0 commit comments

Comments
 (0)