-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from matthew-hennefarth/pdft-dip-example
PDFT Dipole Moment Examples
- Loading branch information
Showing
4 changed files
with
95 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,24 @@ | ||
#!/usr/bin/env python | ||
|
||
''' | ||
""" | ||
Response-theory calculation of the permanent dipole moment | ||
''' | ||
""" | ||
|
||
from pyscf import gto, scf, mcpdft | ||
from pyscf.lib import logger | ||
|
||
logger.TIMER_LEVEL = logger.INFO | ||
|
||
# Energy calculation | ||
h2co_xyz = '''C 0.534004 0.000000 0.000000 | ||
h2co_xyz = """C 0.534004 0.000000 0.000000 | ||
O -0.676110 0.000000 0.000000 | ||
H 1.102430 0.000000 0.920125 | ||
H 1.102430 0.000000 -0.920125''' | ||
mol = gto.M (atom = h2co_xyz, basis = 'def2svp', symmetry = False, | ||
verbose = logger.INFO, output = '00-dipole_moment.log') | ||
mf = scf.RHF (mol).run () | ||
mc = mcpdft.CASSCF (mf, 'tPBE', 6, 6) | ||
mc.kernel () | ||
H 1.102430 0.000000 -0.920125""" | ||
mol = gto.M(atom=h2co_xyz, basis="def2svp", symmetry=False) | ||
mf = scf.RHF(mol).run() | ||
mc = mcpdft.CASSCF(mf, "tPBE", 6, 6) | ||
mc.kernel() | ||
|
||
# Electric Dipole calculation | ||
dipole = mc.dip_moment(unit='Debye') | ||
print ("MC-PDFT electric dipole moment Debye") | ||
print (" {:8.5f} {:8.5f} {:8.5f}".format (*dipole)) | ||
print ("Numerical MC-PDFT electric dipole moment from GAMESS [Debye]") | ||
print (" 2.09361 0.00000 0.00000 ") | ||
|
||
dipole = mc.dip_moment(unit="Debye") | ||
print("MC-PDFT electric dipole moment Debye") | ||
print(" {:8.5f} {:8.5f} {:8.5f}".format(*dipole)) | ||
print("Numerical MC-PDFT electric dipole moment from GAMESS [Debye]") | ||
print(" 2.09361 0.00000 0.00000 ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python | ||
|
||
""" | ||
Response-theory calculation of the permanent dipole moment for excited states. | ||
For MC-PDFT, excited state dipole moments can be computed with either | ||
SA-MC-PDFT or CMS-PDFT currently. | ||
""" | ||
|
||
from pyscf import gto, scf, mcpdft | ||
|
||
mol = gto.M( | ||
atom="""O 0 0 0 | ||
H 0 -0.757 0.587 | ||
H 0 0.757 0.587""", | ||
basis="6-31G", | ||
) | ||
mf = scf.RHF(mol).run() | ||
mc = mcpdft.CASSCF(mf, "tPBE", 4, 4) | ||
|
||
mc_sa = mc.state_average( | ||
[ | ||
1.0 / 4, | ||
] | ||
* 4 | ||
) | ||
mc_sa.run() | ||
|
||
for state in range(4): | ||
d_state = mc_sa.dip_moment(unit="Debye", state=state) | ||
print("Electric dipole moment of {} excited state".format(state)) | ||
print(" {:8.5f} {:8.5f} {:8.5f}\n".format(*d_state)) | ||
|
||
|
||
mc_cms = mc.multi_state( | ||
[ | ||
1.0 / 4, | ||
] | ||
* 4, | ||
method="cms", | ||
) | ||
mc_cms.run() | ||
|
||
for state in range(4): | ||
d_state = mc_cms.dip_moment(unit="Debye", state=state) | ||
print("Electric dipole moment of {} excited state".format(state)) | ||
print(" {:8.5f} {:8.5f} {:8.5f}\n".format(*d_state)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env python | ||
|
||
""" | ||
Response-theory calculation of the transition dipole moment. | ||
Can only be used with CMS-PDFT currently. | ||
""" | ||
|
||
from pyscf import gto, scf, mcpdft | ||
|
||
mol = gto.M( | ||
atom="""O 0 0 0 | ||
H 0 -0.757 0.587 | ||
H 0 0.757 0.587""", | ||
basis="6-31G", | ||
) | ||
mf = scf.RHF(mol).run() | ||
mc = mcpdft.CASSCF(mf, "tPBE", 4, 4) | ||
|
||
mc_cms = mc.multi_state( | ||
[ | ||
1.0 / 4, | ||
] | ||
* 4, | ||
method="cms", | ||
) | ||
mc_cms.run() | ||
|
||
td_state = mc_cms.trans_moment(unit="Debye", state=(0, 2)) | ||
print("Transition dipole moment of <{}|mu|{}> excited state".format(0, 2)) | ||
print(" {:8.5f} {:8.5f} {:8.5f}\n".format(*td_state)) | ||
|
||
# Note that the transition dipole moment is symmetric | ||
h_td_state = mc_cms.trans_moment(unit="Debye", state=(2, 0)) | ||
print(max(abs(td_state - h_td_state))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters