예제 #1
0
r"""
================================
EX1: NCI from wave-function file
================================

Compute NCI and visualize it for water dimer.

"""

from chemtools import NCI

# 1. Build NCI model

nci = NCI.from_file('h2o_dimer.fchk')

# 2. Generate plot, cube file(s) and script for visualizing NCI
#    Files generated are h2o_dimer-dens.cube, h2o_dimer-grad.cube, & h2o_dimer.vmd
#    To visualize the iso-surface, use command: $ vmd -e h2o_dimer.vmd

# nci.generate_plot('h2o_dimer')
nci.generate_scripts('h2o_dimer')

# DISCARD BELOW:
# the code below is for displaying the NCI image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('nci_h2o_dimer.jpg')
"""

from chemtools import LocalConceptualDFT, UniformGrid, print_vmd_script_isosurface

# 1. Make cubic grid for plotting dual descriptor.
#    The cubic grid points are spaced by 0.2 a.u. & extending 5.0 a.u. on each side.

file_path = 'ch2o_q+0.fchk'
cube = UniformGrid.from_file(file_path, spacing=0.2, extension=5.0)

# 2. Build quadratic energy model for Formaldehyde using FMO approach.

tool = LocalConceptualDFT.from_file(file_path, model='quadratic', points=cube.points)

# 3. Dump dual descriptor evaluated on cubic grid.

cube.generate_cube('coh2_dual_fmo.cube', tool.dual_descriptor)

# 4. Generate VMD scripts to plot dual-descriptor iso-surface.
#    To visualize the iso-surface, use command: $ vmd -e coh2_dual_fmo.vmd

print_vmd_script_isosurface('coh2_dual_fmo.vmd', 'coh2_dual_fmo.cube', isosurf=0.005,
                            scalemin=-0.005, scalemax=0.005, colorscheme=[0, 1], negative=True)

# DISCARD BELOW:
# the code below is for displaying the dual descriptor image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('ch2o_dual_fmo.jpg')
예제 #3
0
r"""
===============================
EX1: MO from wave-function file
===============================

Compute MO and visualize it for water.

"""

from chemtools import MOTBasedTool

# 1. Build MO Theory model

mo = MOTBasedTool.from_file('h2o.fchk')

# 2. Generate cube file(s) and script(s) for visualizing all MO
#    Files generated are h2o_mo{index}.cube & h2o_mo{index}.vmd
#    To visualize the iso-surface, use command: $ vmd -e h2o_mo{index}.vmd

mo.generate_scripts('h2o', spin='a', index=None, isosurf=0.0045)

# DISCARD BELOW:
# the code below is for displaying the ELF image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('mo0045_h2o.png')
                                    model='linear',
                                    points=cube.points)

# 3. Dump Fukui functions (f+, f- and f0) evaluated on cubic grid.

cube.generate_cube('coh2_ffp_fd.cube', tool.ff_plus)
cube.generate_cube('coh2_ff0_fd.cube', tool.ff_zero)
cube.generate_cube('coh2_ffm_fd.cube', tool.ff_minus)

# 4. Generate VMD scripts to plot dual-descriptor iso-surface.
#    To visualize the iso-surface, use command: $ vmd -e coh2_ffp_fd.vmd

print_vmd_script_isosurface('coh2_ffp_fd.vmd',
                            'coh2_ffp_fd.cube',
                            isosurf=0.005)
print_vmd_script_isosurface('coh2_ff0_fd.vmd',
                            'coh2_ff0_fd.cube',
                            isosurf=0.005)
print_vmd_script_isosurface('coh2_ffm_fd.vmd',
                            'coh2_ffm_fd.cube',
                            isosurf=0.005,
                            negative=True,
                            colorscheme=[0, 1])

# DISCARD BELOW:
# the code below is for displaying the ff image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('ch2o-ffm_fd.jpg')
예제 #5
0
fname = 'scl2'

mol = Molecule.from_file(fname + '.fchk')
cub = UniformGrid.from_molecule(mol, spacing=1.0, extension=5.0)

# 2. Generate cube files: fname_esp.cube & fname_rho.cube

espname = fname + '_esp.cube'
rhoname = fname + '_rho.cube'

cub.generate_cube(rhoname, mol.compute_density(cub.points))
cub.generate_cube(espname, mol.compute_esp(cub.points))

# 3. Generate vmd script: fname.vmd
#    To visualize the iso-surface, use command: $ vmd -e fname.vmd

print_vmd_script_isosurface(fname + '.vmd',
                            rhoname,
                            colorfile=espname,
                            isosurf=0.002,
                            scalemin=-0.02,
                            scalemax=0.04)

# DISCARD BELOW:
# the code below is for displaying the ELF image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('esp_scl2.png')
예제 #6
0
EX2: NCI from wave-function file and user-defined cube
======================================================

Compute NCI and visualize it for formic acid dimer.

"""

from chemtools import NCI, UniformGrid


# 1. Build UniformGrid and NCI model

cub = UniformGrid.from_file('formic_acid_dimer.fchk', spacing=0.1, extension=2.0)
nci = NCI.from_file('formic_acid_dimer.fchk', grid=cub)

# 2. Generate plot, cube file(s) and script for visualizing NCI
#    Files generated are formic_acid_dimer-dens.cube, formic_acid_dimer-grad.cube,
#    & formic_acid_dimer.vmd
#    To visualize the iso-surface, use command: $ vmd -e formic_acid_dimer.vmd

# nci.generate_plot('formic_acid_dimer', denslim=(-0.15, 0.15))
nci.generate_scripts('formic_acid_dimer')


# DISCARD BELOW:
# the code below is for displaying the NCI image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('nci_formic_acid_dimer.jpg')
예제 #7
0
r"""
======================================================
EX2: ELF from wave-function file and user-defined cube
======================================================

Compute ELF and visualize it for water dimer.

"""

from chemtools import ELF, UniformGrid

# 1. Build UniformGrid and ELF model

cub = UniformGrid.from_file('h2o_dimer.fchk', spacing=0.1, extension=2.0)
elf = ELF.from_file('h2o_dimer.fchk', grid=cub, trans='rational', trans_k=2, trans_a=1)

# 2. Generate cube file(s) and script for visualizing ELF
#    Files generated are h2o_dimer-elf.cube & h2o_dimer.vmd
#    To visualize the iso-surface, use command: $ vmd -e h2o_dimer.vmd

elf.generate_scripts('h2o_dimer', isosurf=0.8)

# DISCARD BELOW:
# the code below is for displaying the ELF image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('elf080_h2o_dimer.jpg')
예제 #8
0
fname = 'dichloropyridine26_q+0'

mol = Molecule.from_file(fname + '.fchk')
cub = UniformGrid.from_molecule(mol, spacing=1.0, extension=5.0)

# 2. Generate cube files: fname_esp.cube & fname_rho.cube

espname = fname + '_esp.cube'
rhoname = fname + '_rho.cube'

cub.generate_cube(rhoname, mol.compute_density(cub.points))
cub.generate_cube(espname, mol.compute_esp(cub.points))

# 3. Generate vmd script: fname.vmd
#    To visualize the iso-surface, use command: $ vmd -e fname.vmd

print_vmd_script_isosurface(fname + '.vmd',
                            rhoname,
                            colorfile=espname,
                            isosurf=0.003,
                            scalemin=-0.02,
                            scalemax=0.02)

# DISCARD BELOW:
# the code below is for displaying the ELF image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('esp_dichloropyridine26_q+0.png')
예제 #9
0
r"""
================================
EX1: ELF from wave-function file
================================

Compute ELF and visualize it for formaldehyde.

"""

from chemtools import ELF

# 1. Build ELF model

elf = ELF.from_file('ch2o_q+0.fchk', trans='rational', trans_k=2, trans_a=1)

# 2. Generate cube file(s) and script for visualizing ELF
#    Files generated are ch2o_q+0-elf.cube & ch2o_q+0.vmd
#    To visualize the iso-surface, use command: $ vmd -e ch2o_q+0.vmd

elf.generate_scripts('ch2o_q+0', isosurf=0.8)

# DISCARD BELOW:
# the code below is for displaying the ELF image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('elf080_ch2o_q+0.jpg')
예제 #10
0
r"""
============================================
EX3: LOL from Molecule and user-defined cube
============================================

Compute LOL and visualize it for formamide, using the inverse hyperbolic transformation.

"""

from chemtools import LOL, UniformGrid, Molecule

# 1. Build Molecule, UnifromGrid and LOL model

mol = Molecule.from_file('formamide_q+0.fchk')
cub = UniformGrid.from_molecule(mol, spacing=0.1, extension=2.0)
lol = LOL.from_molecule(mol, grid=cub, trans='inverse_hyperbolic', trans_k=1, trans_a=1)

# 2. Generate cube file(s) and script for visualizing LOL
#    Files generated are chonh2-lol.cube & chonh2.vmd
#    To visualize the iso-surface, use command: $ vmd -e chonh2.vmd

lol.generate_scripts('chonh2', isosurf=0.55)


# DISCARD BELOW:
# the code below is for displaying the LOL image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('lol055_chonh2_hyperbolic.jpg')
예제 #11
0
EX2: LOL from wave-function file and user-defined cube
======================================================

Compute LOL and visualize it for formamide.

"""

from chemtools import LOL, UniformGrid

# 1. Build UniformGrid and LOL model

cub = UniformGrid.from_file('formamide_q+0.fchk', spacing=0.1, extension=2.0)
lol = LOL.from_file('formamide_q+0.fchk',
                    grid=cub,
                    trans='inverse_rational',
                    trans_k=1,
                    trans_a=1)

# 2. Generate cube file(s) and script for visualizing LOL
#    Files generated are chonh2-lol.cube & chonh2.vmd
#    To visualize the iso-surface, use command: $ vmd -e chonh2.vmd

lol.generate_scripts('chonh2', isosurf=0.55)

# DISCARD BELOW:
# the code below is for displaying the LOL image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('lol055_chonh2.jpg')
예제 #12
0
============================================

Compute ELF and visualize it for formamide.

"""

from chemtools import ELF, UniformGrid, Molecule

# 1. Build Molecule, UnifromGrid and ELF model

mol = Molecule.from_file('formamide_q+0.fchk')
cub = UniformGrid.from_molecule(mol, spacing=0.1, extension=2.0)
elf = ELF.from_molecule(mol,
                        grid=cub,
                        trans='hyperbolic',
                        trans_k=1,
                        trans_a=1)

# 2. Generate cube file(s) and script for visualizing ELF
#    Files generated are chonh2-elf.cube & chonh2.vmd
#    To visualize the iso-surface, use command: $ vmd -e chonh2.vmd

elf.generate_scripts('chonh2', isosurf=0.8)

# DISCARD BELOW:
# the code below is for displaying the ELF image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('elf080_chonh2_hyperbolic.jpg')
예제 #13
0
r"""
================================
EX1: LOL from wave-function file
================================

Compute LOL and visualize it for formaldehyde.

"""

from chemtools import LOL

# 1. Build LOL model

lol = LOL.from_file('ch2o_q+0.fchk', trans='inverse_rational', trans_k=1, trans_a=1)

# 2. Generate cube file(s) and script for visualizing LOL
#    Files generated are ch2o_q+0-lol.cube & ch2o_q+0.vmd
#    To visualize the iso-surface, use command: $ vmd -e ch2o_q+0.vmd

lol.generate_scripts('ch2o_q+0', isosurf=0.55)

# DISCARD BELOW:
# the code below is for displaying the LOL image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('lol055_ch2o_q+0.jpg')
file_path = 'ch2o_q+0.fchk'

# 1. Make a Cubic grid for plotting Fukui functions.
#    The cubic grid points are spaced by 0.2 a.u. & extending 5.0 a.u. on each side.

cube = UniformGrid.from_file(file_path, spacing=0.2, extension=5.0)

# 2. Build linear energy model for Formaldehyde using frontier molecular orbital (FMO) theory.

tool = LocalConceptualDFT.from_file(file_path, model='linear', points=cube.points)

# 3. Dump Fukui functions (f+, f- and f0) evaluated on cubic grid.

cube.generate_cube('coh2_ffm_fmo.cube', tool.ff_minus)
cube.generate_cube('coh2_ffp_fmo.cube', tool.ff_plus)
cube.generate_cube('coh2_ff0_fmo.cube', tool.ff_zero)

# 4. Generate VMD scripts to plot Fukui function iso-surface.
#    To visualize the iso-surface, use command: $ vmd -e coh2_ffp_fmo.vmd

print_vmd_script_isosurface('coh2_ffp_fmo.vmd', 'coh2_ffp_fmo.cube', isosurf=0.005)
print_vmd_script_isosurface('coh2_ff0_fmo.vmd', 'coh2_ff0_fmo.cube', isosurf=0.005)
print_vmd_script_isosurface('coh2_ffm_fmo.vmd', 'coh2_ffm_fmo.cube', isosurf=0.005)

# DISCARD BELOW:
# the code below is for displaying the ff image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('ch2o-ff_fmo.jpg')
예제 #15
0
from chemtools import MOTBasedTool, UniformGrid

# 1. Build MO Theory model

fname = 'dichloropyridine26_q+0'
mo = MOTBasedTool.from_file(fname + '.fchk')

# 2. Generate cube file(s) and script(s) for visualizing H**O/LUMO
#    Files generated are dichloropyridine26_q+0_mo{index}.cube/.vmd
#    To visualize the iso-surface, use command: $ vmd -e dichloropyridine26_q+0_mo{index}.vmd

cub = UniformGrid.from_file(fname + '.fchk', spacing=0.2, extension=5.0)
mo.generate_scripts(fname,
                    spin='a',
                    index=mo.homo_index[0],
                    isosurf=0.025,
                    grid=cub)
mo.generate_scripts(fname,
                    spin='a',
                    index=mo.lumo_index[0],
                    isosurf=0.025,
                    grid=cub)

# DISCARD BELOW:
# the code below is for displaying the ELF image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('mo0037_38_dichloropyridine.jpg')
예제 #16
0
r"""
=================================
EX1: Topology of Electron Density
=================================

Compute critical points and visualize it for cyclobutadiene.

"""

from chemtools import Molecule, UniformGrid, TopologicalTool

# 1. Build Topology model

mol = Molecule.from_file('c4h4.fchk')
cub = UniformGrid.from_molecule(mol, spacing=0.1, extension=0.1, rotate=False)
top = TopologicalTool.from_molecule(mol, points=cub.points)

# 2. Generate vmd script: fname.vmd
#    To visualize the iso-surface, use command: $ vmd -e fname.vmd

top.generate_scripts('c4h4.vmd')

# DISCARD BELOW:
# the code below is for displaying the ELF image on the website, you should remove it
# when running the script on your machine.
from tools.rug import plot_existing_image

plot_existing_image('top_c4h4.jpg')