Using python within nwchem to scan the geometry


Just Got Here
Hello -

I want to use nwchem to calculate an energy gradient as a water molecule is moved away from an ion (ie. calculate the energy at 2.4 angstroms, 2.6, 2.8, etc.). I know I can do this using the 'geometry adjust' block as below:

geometry adjust
zcoord
bond 1 2 2.5 oyb
end
end

I can then import the movecs file from the previous geometry and use 'task dft gradient' to calculate the energy at this distance. However, this approach is extremely tedious for any significant number of points.

I have seen in the nwchem manual that there is a solution to this problem using python within the nwchem input file, but have been unable to get implement it and don't fully understand the example provided in the manual.

How can such a task be accomplished?

Forum Vet
Morgan
The directory
$NWCHEM_TOP/contrib/python
contains the following python script that you could use
pes_scan.py

Here is an example of input file

start kh2o

geometry autosym
  K    0      3       0
  O    0.0    0.0    -0.02
  H   -0.74   0.0    -0.76
  H    0.74   0.0    -0.76
end

charge 1

basis
  * library sto-3g
end

python
  from pes_scan import *

  geom = '''                                                                    
    geometry noprint adjust                                                     
      zcoord                                                                    
        bond  1 2   %f ko_dist   constant                                       
      end                                                                       
    end                                                                         
  '''                                                                           
  results = pes_scan(geom, \                                                    
                      [2.0],                                                    
                      [4.0],                                                    
                      2, 'scf', task_energy)                                    
end

task python

Just Got Here
Thank you!

Would you mind explaining a couple of the parts in greater detail? Specific questions below.

'ko_dist' presumably is the distance to adjust the bond between atoms 1 and 2. What does 'constant' do?

I assume that the [2.0] and [4.0] with the pes_scan function are the distances to adjust to. Is '2' the number of distances?

If I wanted to run these calculations with 'task dft gradient' instead of scf energy, would I replace the last two terms in the pes_scan function with 'dft' and 'task_gradient' ?

Thanks you very much for your help!

- Morgan

Forum Vet
Morgan
You might want to have a look at the NWChem documentation
http://nwchemgit.github.io/index.php/Release65:Geometry
http://nwchemgit.github.io/index.php/Release65:Geometry#ZCOORD_--_Forcing_internal_coordinat...

The Python script has some documentation too,
just open the file $NWCHEM_TOP/contrib/python/pes_scan.py with your favorite editr (or viewer)

Just Got Here
Quote:Edoapra May 7th 11:54 am

The Python script has some documentation too,
just open the file $NWCHEM_TOP/contrib/python/pes_scan.py with your favorite editr (or viewer)


This file does not appear to exist on cascade...? Am I doing something incorrect?

Forum Vet
I can access it
ls -l /home/scicons/cascade/apps/nwchem-6.5/contrib/python/pes_scan.py
-rw-r--r-- 1 svc-scicons scicons 3530 Sep 4 2014 /home/scicons/cascade/apps/nwchem-6.5/contrib/python/pes_scan.py

Let me know if you still can not see it

Just Got Here
PES scan using CASSCF
For SCF PES scans i could use this
python
geometry =
       geometry noprint; symmetry d2h
C 0 0 %f; H 0 0.916 1.224
end

x = 0.6
while (x < 0.721):
 input_parse(geometry % x)
energy = task_energy('scf')
print ' x = %5.2f energy = %10.6f' % (x, energy)
x = x + 0.01
end

basis; C library 6-31g*; H library 6-31g*; end

print none

task python



How to do the same for a mcscf calculation, i.e. specify the active space and other stuff? I couldn't find any proper documentation related to getting a PES in NWChem using MCSCF (Multireference scf)


Forum >> NWChem's corner >> Running NWChem