Is extraction of dipole moments from real-time TDDFT a Python command?

From NWChem

Viewed 7180 times, With a total of 30 Posts
Jump to: navigation, search

Jump to page 1Prev 16
Forum Vet
Threads 9
Posts 1489
Try the following

export PYTHONHOME=/Library/Frameworks/Python.framework/Versions/2.7

export PYTHONVERSION=2.7

Forum Regular
Threads 43
Posts 209
Thanks a lot. This time NWCHEM6.5 has been successfully built, but still there is error perhaps associated with the input file

                    NWChem Python program
---------------------

nw_rtparse.py -xdipole -px -tkick_x h2o_abs.nwo > x.dat
nw_rtparse.py -xdipole -py -tkick_y h2o_abs.nwo > y.dat
nw_rtparse.py -xdipole -pz -tkick_z h2o_abs.nwo > z.dat

fft1d -d50 -z -p50000 <x.dat | rotate_fft > xw.dat
fft1d -d50 -z -p50000 <y.dat | rotate_fft > yw.dat
fft1d -d50 -z -p50000 <z.dat | rotate_fft > zw.dat

nw_rtparse -xdipole -tkickx -px | fft1d > xw.dat
nw_rtparse -xdipole -tkicky -py | fft1d > yw.dat
nw_rtparse -xdipole -tkickz -pz | fft1d > zw.dat

paste xw.dat yw.dat zw.dat > sw.dat

gnuplot> plot "sw.dat" u ($1*27.2114) : ($1*abs($3+$7+$11))

------------------------------------------------------------------------
python failed 0
------------------------------------------------------------------------
------------------------------------------------------------------------
current input line :
157: task python
------------------------------------------------------------------------
------------------------------------------------------------------------
This type of error is most commonly associated with calculations not reaching convergence criteria
------------------------------------------------------------------------
For more information see the NWChem manual at http://www.nwchem-sw.org/index.php/NWChem_Documentation

  The bash exhibits
File "nwchem.py", line 1
nw_rtparse.py -xdipole -px -tkick_x h2o_abs.nwo > x.dat
^
SyntaxError: invalid syntax
 File "nwchem.py-1", line 1
nw_rtparse.py -xdipole -px -tkick_x h2o_abs.nwo > x.dat
File "nwchem.py-2", line 1
nw_rtparse.py -xdipole -px -tkick_x h2o_abs.nwo > x.dat
^
SyntaxError: ^
SyntaxError: invalid syntax
invalid syntax
0:python failed:Received an Error in Communication
application called MPI_Abort(comm=0x84000004, -1) - process 0

For further details see manual section:                                                                                                                                                                                                                                                                

=======================================================================
= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
= PID 364 RUNNING AT
= EXIT CODE: 255
= CLEANING UP REMAINING PROCESSES
= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES


The input after the real time TDDFT is

python
nw_rtparse.py -xdipole -px -tkick_x h2o_abs.nwo > x.dat
nw_rtparse.py -xdipole -py -tkick_y h2o_abs.nwo > y.dat
nw_rtparse.py -xdipole -pz -tkick_z h2o_abs.nwo > z.dat

fft1d -d50 -z -p50000 <x.dat | rotate_fft > xw.dat
fft1d -d50 -z -p50000 <y.dat | rotate_fft > yw.dat
fft1d -d50 -z -p50000 <z.dat | rotate_fft > zw.dat

nw_rtparse -xdipole -tkickx -px | fft1d > xw.dat
nw_rtparse -xdipole -tkicky -py | fft1d > yw.dat
nw_rtparse -xdipole -tkickz -pz | fft1d > zw.dat

paste xw.dat yw.dat zw.dat > sw.dat

gnuplot> plot "sw.dat" u ($1*27.2114) : ($1*abs($3+$7+$11))
end
task python
Edited On 3:22:45 AM PDT - Sat, May 16th 2015 by Xiongyan21

Clicked A Few Times
Threads 10
Posts 24
All those commands are to be run from the command line, not inside an nwchem input file python block.

fft1d is a MatLab or octave script and only needs the file name as an argument, i.e.,
 octave -q fft1d.m x.dat > xw.dat
...unless you have explicitly set your desktop environment to execute .m files using octave.

There is more information starting at page 159 in the user manual available at
http://www.nwchem-sw.org/images/NWChem6.5_Documentation.pdf

-drh

Forum Regular
Threads 43
Posts 209
Thanks a lot for your explanation.

If commands nw_rtparse.py -xdipole -px -tkick_x h2o_abs.nwo > x.dat, nw_rtparse.py -xdipole -py -tkick_y h2o_abs.nwo > y.dat, and nw_rtparse.py -xdipole -pz -tkick_z h2o_abs.nwo > z.dat are typed in the bash, the following error message appears although the directory of contrib/parsers is entered:
nw_rtparse.py: command not found
Edited On 5:17:04 AM PDT - Sun, May 17th 2015 by Xiongyan21

Clicked A Few Times
Threads 10
Posts 24
Quote:Xiongyan21 May 17th 5:13 am
If commands ... are typed in the bash, the following error message appears although the directory of contrib/parsers is entered:
nw_rtparse.py: command not found

If you are already in $NWCHEM_TOP/contrib/parsers, the command becomes:

 ./nw_rtparse.py -xdipole -px -tkick_x h2o_abs.nwo > x.dat

Executable files in your current working directory need to be specified with a leading ./,
otherwise the system will only search in the PATH directories.

-drh

Forum Regular
Threads 43
Posts 209
Thanks a lot for your explanation.
The permission of " ./nw_rtparse.py -xdipole -px -tkick_x h2o_abs.nwo > x.dat " is denied
in the bash although the directory of contrib/parsers is entered.

Clicked A Few Times
Threads 10
Posts 24
Quote:Xiongyan21 May 17th 7:11 pm
Thanks a lot for your explanation.
The permission of " ./nw_rtparse.py -xdipole -px -tkick_x h2o_abs.nwo > x.dat " is denied
in the bash although the directory of contrib/parsers is entered.
This issue is beyond the scope of NWChem.

You must study how to set Linux file permissions or flags, and the different ways of invoking python scripts.

-drh

Forum Regular
Threads 43
Posts 209
Does it mean that the commands cannot be carried out on MAC OS X?

Gets Around
Threads 18
Posts 133
No, it means that the Python file is not marked executable.

Try

python nw_rtparse.py -xdipole -px -tkick_x h2o_abs.nwo > x.dat


instead.

Forum Regular
Threads 43
Posts 209
Thanks very much for your guide.

This time the error message becomes

Traceback (most recent call last):
 File "nw_rtparse.py", line 381, in <module>
main()
File "nw_rtparse.py", line 322, in main
raise Exception ('Failed to read in data from file: '+'"'+fname1+'"')
Exception: Failed to read in data from file: "h2o_abs.nwo"
bash-3.2# python nw_rtparse.py -xdipole -px -tkick_x h2o.nwo > x.dat
Traceback (most recent call last):
 File "nw_rtparse.py", line 381, in <module>
main()
File "nw_rtparse.py", line 322, in main
raise Exception ('Failed to read in data from file: '+'"'+fname1+'"')
Exception: Failed to read in data from file: "h2o.nwo"

In fact, my input file is called h2o.nw and h2o_abs.nw is not allowed because of the "_".
The resulting files in nwchem target are water.db, water.movecs, and h2o.log , because the input is based on the file water.nw in QA, and its name is changed.
Furthermore, it seems that there is no file with the extension of nwo produced.
Actually I wish to understand the meaning of ...h2o_abs.nwo >x.dat.
Edited On 5:11:50 AM PDT - Wed, May 27th 2015 by Xiongyan21

Gets Around
Threads 1
Posts 160
python nw_rtparse.py -xdipole -px -tkick_x h2o_abs.nwo > x.dat

"-xdipole" tells the script that you want to extract the dipole moment from the output file
"-px" tells the script that you want to extract the x-component of the dipole moment
"-tkick_x" tells the script that you have set the tag option of the RT-TDDFT input block to kick_x
"h2o_abs.nwo" is the name of your output file
">" is standard Linux for redirecting the output from the script to a file
"x.dat" is the file that you are telling the computer to use for the redirect above

if you used the command

python nw_rtparse.py -xdipole -px -tkick_x h2o_abs.nwo

the output would just print to the screen

You need to modify the options and the name of the output to fit what you actually want/have. So if you based your calculation on the water absorption spectrum example in the QA directory and did not change the tag option from what is in that file and the output file from your calculation is called h2o.log then you would need to execute the command

python nw_rtparse.py -xdipole -px -tkickx h2o.log > x.dat

in order to put the x-component of the dipole into the file x.dat. For the y-component you would do

python nw_rtparse.py -xdipole -py -tkicky h2o.log > y.dat

to put the y-component in the file y.dat, and likewise for the z-component.
As mentioned in another comment above, it would benefit you greatly to do a little reading on basic Linux commands as there are many that can make life much easier when processing the data from your calculations. Mac OS X is a Linux based operating system so almost all Linux commands will work in your terminal.

Best,
Sean

Forum Regular
Threads 43
Posts 209
Thanks very much for your detailed explanation.
Something seems more complicated, because the error also appears in the bash

python nw_rtparse.py -xdipole -px -tkickx h2o.log > x.dat
Traceback (most recent call last):
 File "nw_rtparse.py", line 381, in <module>
main()
File "nw_rtparse.py", line 322, in main
raise Exception ('Failed to read in data from file: '+'"'+fname1+'"')
Exception: Failed to read in data from file: "h2o.log".

The x.dat contains the following
NWChem Real-time TDDFT output parser
  1. ======================================

  2. Runtime options
  3. ---------------
  4. compare = False
  5. target = dipole
  6. tolerance = 1e-05
  7. delim =
  8. polarization = x
  9. header = True
  10. zero = False
  11. tag = kickx
  12. geom = system
  13. spin = closedshell

  14. File 1
  15. ------
  16. Filename: "h2o.log"
Is it complete and correct?
Edited On 7:30:42 PM PDT - Tue, May 19th 2015 by Xiongyan21

Gets Around
Threads 1
Posts 160
The script is most likely unable to find any RT-TDDFT output in your file. Have you verified that your calculation successfully produced the RT-TDDFT output? What is the output from the command

grep 'kickx' h2o.log

Forum Regular
Threads 43
Posts 209
Thanks a lot.

grep 'kickx' h2o.log
...
kickx 199.80000 ### Propagation finished ###

"python nw_rtparse.py -xdipole -px -tkickx h2o.log > x.dat" works.
I will try further.

...
  1. File 1
  2. ------
  3. Filename: "h2o.log"
  4. Number of data points: 999
  5. Time range: [0.0: 199.6]

  6. -----------------------------------------
  7. Time [au] dipole [au]
  8. -----------------------------------------

0.0000000000e+00     2.3000096268e-16
...
Edited On 7:53:10 AM PDT - Thu, May 21st 2015 by Xiongyan21

Forum Regular
Threads 43
Posts 209
Thank you all very much for all your time, considerations and helps for me to put the data from an Nwchem output into a file necessary for further calculations, and I am trying to download and install Octave; nevertheless, for OS X 10.10 Yosemite only Octave server VM installer can be available, and the easiest is the employment of Binary installer for OS X 10.9.1, waiting for a test of whether it is feasible on MAC OS X 10.10.3.
Edited On 8:50:55 PM PDT - Sat, May 23rd 2015 by Xiongyan21


Forum >> NWChem's corner >> Running NWChem
Jump to page 1Prev 16



Who's here now Members 0 Guests 1 Bots/Crawler 0


AWC's: 2.5.10 MediaWiki - Stand Alone Forum Extension
Forum theme style by: AWC