Skip to content

Commit

Permalink
Merge pull request #48 from mcocdawc/small_cosmetic_changes
Browse files Browse the repository at this point in the history
Removal of trailing whitespaces & Python Requires Cleanup
  • Loading branch information
mscho527 authored Oct 30, 2024
2 parents 7596d10 + 7361cc7 commit b5cf74a
Show file tree
Hide file tree
Showing 52 changed files with 1,188 additions and 1,189 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ processors.

<sub><sup>##</sup>The modified version of [libDMET](https://github.com/gkclab/libdmet_preview) available
at [here](https://github.com/oimeitei/libdmet_preview) is
recommended to run periodic BE using QuEmb.
recommended to run periodic BE using QuEmb.
<sup>&&</sup>Wannier90 code is interfaced via [libDMET](https://github.com/gkclab/libdmet_preview) in QuEmb</sub>

### Steps
Expand All @@ -43,16 +43,16 @@ recommended to run periodic BE using QuEmb.
```bash
git clone https://github.com/oimeitei/quemb.git
cd quemb

2. Install QuEmb using one of the following approaches:
```bash
pip install .
pip install .
```
or simply add `path/to/quemd` to `PYTHONPATH`
```bash
export PYTHONPATH=/path/to/quemb:$PYTHONPATH
```

For conda (or virtual environment) installations, after creating your environment, specify the path to mol-be source as a path file, as in:
```bash
echo path/to/quemb > $(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/quemb.pth
Expand Down Expand Up @@ -94,6 +94,6 @@ Alternatively, you can view the latest documentation online [here](https://quemb
## References

The methods implemented in this code are described in details in the following papers:
- OR Meitei, T Van Voorhis, Periodic bootstrap embedding, [JCTC 19 3123 2023](https://doi.org/10.1021/acs.jctc.3c00069)
- OR Meitei, T Van Voorhis, Electron correlation in 2D periodic systems, [arXiv:2308.06185](https://arxiv.org/abs/2308.06185)
- OR Meitei, T Van Voorhis, Periodic bootstrap embedding, [JCTC 19 3123 2023](https://doi.org/10.1021/acs.jctc.3c00069)
- OR Meitei, T Van Voorhis, Electron correlation in 2D periodic systems, [arXiv:2308.06185](https://arxiv.org/abs/2308.06185)
- HZ Ye, HK Tran, T Van Voorhis, Bootstrap embedding for large molecular systems, [JCTC 16 5035 2020](https://doi.org/10.1021/acs.jctc.0c00438)
4 changes: 2 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ References
2. OR Meitei, T Van Voorhis, Electron correlation in 2D periodic systems, `arXiv:2308.06185 <https://arxiv.org/abs/2308.06185>`_
3. HZ Ye, HK Tran, T Van Voorhis, Bootstrap embedding for large molecular systems, `JCTC 16 5035 2020 <https://doi.org/10.1021/acs.jctc.0c00438>`_


.. toctree::
:maxdepth: 1

Expand All @@ -37,4 +37,4 @@ References
solvers
misc


6 changes: 3 additions & 3 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ pip install
-----------

::

pip install .

Add to ``PYTHONPATH``
---------------------
Simply add ``path/to/quemb`` to ``PYTHONPATH``
::

export PYTHONPATH=/path/to/quemb:$PYTHONPATH

Conda or virtual environment
----------------------------
For conda (or virtual environment) installations, after creating your environment, specify the path to mol-be source as a path file, as in::

echo path/to/quemb > $(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/quemb.pth
2 changes: 1 addition & 1 deletion docs/source/kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Serial BE Solver
.. toctree::
:maxdepth: 4
.. autofunction:: molbe.solver.be_func


2 changes: 1 addition & 1 deletion docs/source/optimize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Main BE optimization
.. toctree::
:maxdepth: 4
.. autoclass:: molbe._opt.BEOPT
:members:
:members:

Quasi-Newton optimization
=========================
Expand Down
2 changes: 1 addition & 1 deletion docs/source/pfrag.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ Periodic fragments
:maxdepth: 4
.. automodule:: kbe.pfrag
:members:

16 changes: 8 additions & 8 deletions docs/source/solvers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Crystalline orbital localization
--------------------------------

.. autofunction:: kbe.lo.localize

Density Matching Error
======================

Expand All @@ -24,9 +24,9 @@ Interface to Quantum Chemistry Methods
======================================

.. autofunction:: molbe.solver.solve_mp2

.. autofunction:: molbe.solver.solve_ccsd

.. autofunction:: molbe.helper.get_scfObj

Schmidt Decomposition
Expand All @@ -44,15 +44,15 @@ Periodic Schmidt decomposition

Handling Hamiltonian
====================

.. autofunction:: molbe.helper.get_eri

.. autofunction:: molbe.helper.get_core


Build molecular HF potential
----------------------------

.. autofunction:: molbe.helper.get_veff

Build perioidic HF potential
Expand All @@ -63,9 +63,9 @@ Build perioidic HF potential

Handling Energies
=================

.. autofunction:: molbe.helper.get_frag_energy

.. autofunction:: molbe.rdm.compute_energy_full

Handling Densities
Expand Down
10 changes: 5 additions & 5 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Simple example of BE calculation on molecular system::

# Perform pyscf calculations to get mol, mf objects
# See quemb/example/molbe_h8_density_matching.py
# get mol: pyscf.gto.M
# get mf: pyscf.scf.RHF
# get mol: pyscf.gto.M
# get mf: pyscf.scf.RHF

# Define fragments
myFrag = fragpart(be_type='be2', mol=mol)

Expand All @@ -26,7 +26,7 @@ Simple example of BE calculation on molecular system::

# Perform density matching in BE
mybe.optimize(solver='CCSD')


Simple example of periodic BE calculation on 1D periodic system::

Expand All @@ -47,4 +47,4 @@ Simple example of periodic BE calculation on 1D periodic system::

# Perform density matching in BE
mybe.optimize(solver='CCSD')

36 changes: 18 additions & 18 deletions example/data/hexene.xyz
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
18

C -5.6502267899 0.7485927383 -0.0074809907
C -4.5584842828 1.7726977952 -0.0418619714
H -5.5515181382 0.0602177800 -0.8733001951
H -6.6384111226 1.2516490350 -0.0591711493
H -5.5928112720 0.1649656434 0.9355613930
C -3.2701647911 1.4104028701 0.0085107804
C -2.1789947571 2.4456245961 -0.0265301736
C -0.7941361337 1.7933691827 0.0427863465
H -2.3064879754 3.1340763205 0.8376047229
H -2.2652945230 3.0294980525 -0.9691823088
C 0.3121144607 2.8438276122 0.0072105803
H -0.6626010212 1.1042272672 -0.8201573062
H -0.7037327970 1.2086599200 0.9845037688
H 0.2581952957 3.4296615741 -0.9351274363
H 1.3021608456 2.3437050700 0.0587054221
H 0.2170130582 3.5342406229 0.8723087816
H -4.8264911382 2.8238751191 -0.1088423637
H -3.0132059318 0.3554469837 0.0754505007
C -5.6502267899 0.7485927383 -0.0074809907
C -4.5584842828 1.7726977952 -0.0418619714
H -5.5515181382 0.0602177800 -0.8733001951
H -6.6384111226 1.2516490350 -0.0591711493
H -5.5928112720 0.1649656434 0.9355613930
C -3.2701647911 1.4104028701 0.0085107804
C -2.1789947571 2.4456245961 -0.0265301736
C -0.7941361337 1.7933691827 0.0427863465
H -2.3064879754 3.1340763205 0.8376047229
H -2.2652945230 3.0294980525 -0.9691823088
C 0.3121144607 2.8438276122 0.0072105803
H -0.6626010212 1.1042272672 -0.8201573062
H -0.7037327970 1.2086599200 0.9845037688
H 0.2581952957 3.4296615741 -0.9351274363
H 1.3021608456 2.3437050700 0.0587054221
H 0.2170130582 3.5342406229 0.8723087816
H -4.8264911382 2.8238751191 -0.1088423637
H -3.0132059318 0.3554469837 0.0754505007
16 changes: 8 additions & 8 deletions example/kbe_polyacetylene.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
cell.a = lat

cell.atom='''
H 1.4285621630072645 0.0 -0.586173422487319
C 0.3415633681566205 0.0 -0.5879921146011252
H -1.4285621630072645 0.0 0.586173422487319
C -0.3415633681566205 0.0 0.5879921146011252
H 1.4285621630072645 0.0 1.868826577512681
C 0.3415633681566205 0.0 1.867007885398875
H -1.4285621630072645 0.0 3.041173422487319
C -0.3415633681566205 0.0 3.0429921146011254
H 1.4285621630072645 0.0 -0.586173422487319
C 0.3415633681566205 0.0 -0.5879921146011252
H -1.4285621630072645 0.0 0.586173422487319
C -0.3415633681566205 0.0 0.5879921146011252
H 1.4285621630072645 0.0 1.868826577512681
C 0.3415633681566205 0.0 1.867007885398875
H -1.4285621630072645 0.0 3.041173422487319
C -0.3415633681566205 0.0 3.0429921146011254
'''

cell.unit='Angstrom'
Expand Down
40 changes: 20 additions & 20 deletions example/molbe_dmrg_block2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# A run through the `QuEmb` interface with `block2` for performing BE-DMRG.
# `block2` is a DMRG and sparse tensor network library developed by the
# `block2` is a DMRG and sparse tensor network library developed by the
# Garnet-Chan group at Caltech: https://block2.readthedocs.io/en/latest/index.html

import os, numpy, sys
Expand All @@ -13,7 +13,7 @@
fci_ecorr, ccsd_ecorr, ccsdt_ecorr, bedmrg_ecorr = [], [], [], []

# Specify a scratch directory for fragment DMRG files:
scratch = os.getcwd()
scratch = os.getcwd()

for a in seps:
# Hartree-Fock serves as the starting point for all BE calculations:
Expand All @@ -31,42 +31,42 @@
# Exact diagonalization (FCI) will provide the reference:
mc = fci.FCI(mf)
fci_ecorr.append(mc.kernel()[0] - mf.e_tot)

# CCSD and CCSD(T) are good additional points of comparison:
mycc = cc.CCSD(mf).run()
et_correction = mycc.ccsd_t()
ccsd_ecorr.append(mycc.e_tot - mf.e_tot)
ccsdt_ecorr.append(mycc.e_tot + et_correction - mf.e_tot)

# Define BE1 fragments. Prior to DMRG the localization of MOs
# is usually necessary. While there doesn't appear to be
# Define BE1 fragments. Prior to DMRG the localization of MOs
# is usually necessary. While there doesn't appear to be
# any clear advantage to using any one scheme over another,
# the Pipek-Mezey scheme continues to be the most popular. With
# BE-DMRG, localization takes place prior to fragmentation:
fobj = fragpart(be_type='be1', mol=mol)
mybe = BE(
mf,
fobj,
mf,
fobj,
lo_method='pipek-mezey', # or 'lowdin', 'iao', 'boys'
pop_method='lowdin' # or 'meta-lowdin', 'mulliken', 'iao', 'becke'
)

# Next, run BE-DMRG with default parameters and maxM=100.
mybe.oneshot(
solver='block2', # or 'DMRG', 'DMRGSCF', 'DMRGCI'
scratch=scratch, # Scratch dir for fragment DMRG
maxM=100, # Max fragment bond dimension
force_cleanup=True, # Remove all fragment DMRG tmpfiles
)
)

bedmrg_ecorr.append(mybe.ebe_tot - mf.e_tot)
# Setting `force_cleanup=True` will clean the scratch directory after each
# Setting `force_cleanup=True` will clean the scratch directory after each
# fragment DMRG calculation finishes. DMRG tempfiles can be quite large, so
# be sure to keep an eye on them if `force_cleanup=False` (default).

# NOTE: This does *not* delete the log files `dmrg.conf` and `dmrg.out`for each frag,
# which can still be found in `/scratch/`.

# Finally, plot the resulting potential energy curves:
fig, ax = plt.subplots()

Expand All @@ -81,7 +81,7 @@
# (See ../quemb/example/figures/BEDMRG_H8_PES20.png for an example.)

# For larger fragments, you'll want greater control over the fragment
# DMRG calculations. Using the same setup as above for a single geometry:
# DMRG calculations. Using the same setup as above for a single geometry:
mol = gto.M()
mol.atom = [['H', (0.,0.,i*1.2)] for i in range(8)]
mol.basis = 'sto-3g'
Expand All @@ -90,15 +90,15 @@
mol.build()
fobj = fragpart(be_type='be2', mol=mol)
mybe = BE(
mf,
fobj,
mf,
fobj,
lo_method='pipek-mezey',
pop_method='lowdin'
)

# We automatically construct the fragment DMRG schedules based on user keywords. The following
# input, for example, yields a 60 sweep schedule which uses the two-dot algorithm from sweeps 0-49,
# and the one-dot algo from 50-60. The fragment orbitals are also reordered according the Fiedler
# and the one-dot algo from 50-60. The fragment orbitals are also reordered according the Fiedler
# vector procedure, along with a few other tweaks:

mybe.optimize(
Expand All @@ -114,7 +114,7 @@
block_extra_keyword=['fiedler'], # Specify orbital reordering algorithm
force_cleanup=True, # Remove all fragment DMRG tmpfiles
only_chem=True,
)
)

# Or, alternatively, we can construct a full schedule by hand:
schedule={
Expand All @@ -127,16 +127,16 @@
# and pass it to the fragment solver through `schedule_kwargs`:
mybe.optimize(
solver='block2',
scratch=scratch,
scratch=scratch,
schedule_kwargs=schedule,
block_extra_keyword=['fiedler'],
force_cleanup=True,
only_chem=True,
)

# To make sure the calculation is proceeding as expected, make sure to check `[scratch]/dmrg.conf`
# To make sure the calculation is proceeding as expected, make sure to check `[scratch]/dmrg.conf`
# and `[scratch]/dmrg.out`, which are the fragment DMRG inputs and outputs, respectively, used
# by `block2`.
# by `block2`.

#NOTE: Parameters in `schedule_kwargs` will overwrite any other DMRG kwargs.
#NOTE: The DMRG schedule kwargs and related syntax follows the standard notation used in block2.
Loading

0 comments on commit b5cf74a

Please sign in to comment.