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

From NWChem

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

Jump to page 1Prev 16
Forum Regular
Threads 43
Posts 209
Thanks very much for your help.
The following error message appears after the input of "make"

touch include_stamp
gfortran -c -fdefault-integer-8 -Warray-bounds -g -fno-aggressive-loop-optimizations -I. -I/usr/local/PTYTHON-3.4/include/python3.4 -I/usr/local/PTYTHON-3.4/include -I/usr/local/PTYTHON-3.4/Include -I/usr/local/PTYTHON-3.4 -I/$NWCHEM_TOP/src/include -I/users/$NWCHEM_TOP/src/tools/install/include -DMACX -DEXT_INT -DGFORTRAN -DGCC4 -DGCC46 -DPARALLEL_DIAG python_input.F
Warning: Nonexistent include directory "/usr/local/PTYTHON-3.4/include/python3.4"
Warning: Nonexistent include directory "/usr/local/PTYTHON-3.4/include"
Warning: Nonexistent include directory "/usr/local/PTYTHON-3.4/Include"
Warning: Nonexistent include directory "/usr/local/PTYTHON-3.4"
cc -c -I. -I/usr/local/PTYTHON-3.4/include/python3.4 -I/usr/local/PTYTHON-3.4/include -I/usr/local/PTYTHON-3.4/Include -I/usr/local/PTYTHON-3.4 -I/$NWCHEM_TOP/src/include -I/$NWCHEM_TOP/src/tools/install/include -DMACX -DEXT_INT -DGFORTRAN -DGCC4 -DGCC46 -DPARALLEL_DIAG -DMPICH_NO_ATTR_TYPE_TAGS -g -o task_python.o task_python.c
task_python.c:7:10: fatal error: 'Python.h' file not found
  1. include <Python.h>

1 error generated.
make***
Edited On 4:27:51 AM PDT - Wed, May 13th 2015 by Xiongyan21

Clicked A Few Times
Threads 10
Posts 24
Quote:Xiongyan21 May 10th 12:59 am

The Python version is 3.4, and its directory is /usr/bin/PYTHON.

What is the problem here?


The actual python home is /usr/lib/python3.4 or /usr/lib64/python3.4

PYTHONHOME is /usr/local, should be /usr

export PYTHONHOME=/usr
export PYTHONVERSION=3.4
export PYTHONLIBTYPE=so

If this doesn't work, you may need to hand edit the library path in makefile.h following
ifdef USE_PYTHON64

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

This time the error message becomes

Warning: Nonexistent include directory "/usr/include/python3.4"
Warning: Nonexistent include directory "/usr/include"
Warning: Nonexistent include directory "/usr/Include"
cc -c -I. -I/usr/include/python3.4 -I/usr/include -I/usr/Include -I/usr -I/$NWCHEM_TOP/src/include -I-I/$NWCHEM_TOP/src/tools/install/include -DMACX -DEXT_INT -DGFORTRAN -DGCC4 -DGCC46 -DPARALLEL_DIAG -DMPICH_NO_ATTR_TYPE_TAGS -g -o task_python.o task_python.c
task_python.c:7:10: fatal error: 'Python.h' file not found
  1. include <Python.h>
        ^
1 error generated.
make[1]: *** [/$NWCHEM_TOP/src/lib/MACX64/libnwpython.a(task_python.o)] Error 1
Edited On 4:58:07 AM PDT - Fri, May 15th 2015 by Xiongyan21

Forum Vet
Threads 9
Posts 1489
NWChem not compatible with Python 3.x
The Python interface of NWChem is not compatible with Python 3.x.
It only works with Python version 2.x

Forum Regular
Threads 43
Posts 209
Thanks a lot for your help.
The addition of Python2.7 into MAC OS X 10.10.3 still encounters the following error
...
Warning: Nonexistent include directory "/usr/include/python2.7"
Warning: Nonexistent include directory "/usr/include"
Warning: Nonexistent include directory "/usr/Include"
cc -c -I. -I/usr/include/python2.7 -I/usr/include -I/usr/Include -I/usr -I/$NWCHEM_TOP/src/include -I/$NWCHEM_TOP/src/tools/install/include -DMACX -DEXT_INT -DGFORTRAN -DGCC4 -DGCC46 -DPARALLEL_DIAG -DMPICH_NO_ATTR_TYPE_TAGS -g -o task_python.o task_python.c
task_python.c:7:10: fatal error: 'Python.h' file not found
  1. include <Python.h>
        ^
1 error generated.
make[1]: *** [/$NWCHEM_TOP/lib/MACX64/libnwpython.a(task_python.o)] Error 1
make: *** [libraries] Error 1

Forum Regular
Threads 43
Posts 209
There are two errors in the GNUmakefile although I have followed Dr Drhaney' s suggestion

  1. $Id: GNUmakefile 19695 2010-10-29 16:51:02Z d3y133 $


LIBRARY = libnwpython.a

OBJ = python_input.o task_python.o nwchem_wrap.o nw_inp_from_string.o

ifndef PYTHONHOME
error:
@echo Must define PYTHONHOME and PYTHONVERSION to build with Python
@exit 1
endif

  1. Under WIN32 only need to define PYTHONHOME
ifndef PYTHONVERSION
error1:
@echo Must define PYTHONHOME and PYTHONVERSION to build with Python
@exit 1
endif


LIB_INCLUDES = -I$(PYTHONHOME)/include/python$(PYTHONVERSION) -I$(PYTHONHOME)/include -I$(PYTHONHOME)/Include -I$(PYTHONHOME)


include ../config/makefile.h
include ../config/makelib.h
Edited On 5:20:04 AM PDT - Fri, May 15th 2015 by Xiongyan21

Forum Vet
Threads 9
Posts 1489
If the directory
/usr/include/python2.7
is missing, this probably means that python 2.7 is either missing or it was not installed under /usr.

Could you please send the output of the following commands for your python 2.7 installation?

python-config --prefix
python-config --includes
python --version


The output of the commandpython-config --prefix should be used for PYTHONHOME

Quote:Xiongyan21 May 15th 3:55 am
Thanks a lot for your help.
The addition of Python2.7 into MAC OS X 10.10.3 still encounters the following error
...
Warning: Nonexistent include directory "/usr/include/python2.7"
Warning: Nonexistent include directory "/usr/include"
Warning: Nonexistent include directory "/usr/Include"
cc -c -I. -I/usr/include/python2.7 -I/usr/include -I/usr/Include -I/usr -I/$NWCHEM_TOP/src/include -I/$NWCHEM_TOP/src/tools/install/include -DMACX -DEXT_INT -DGFORTRAN -DGCC4 -DGCC46 -DPARALLEL_DIAG -DMPICH_NO_ATTR_TYPE_TAGS -g -o task_python.o task_python.c
task_python.c:7:10: fatal error: 'Python.h' file not found
  1. include <Python.h>
        ^
1 error generated.
make[1]: *** [/$NWCHEM_TOP/lib/MACX64/libnwpython.a(task_python.o)] Error 1
make: *** [libraries] Error 1

Forum Regular
Threads 43
Posts 209
Thanks a lot.

python-config --prefix
/Library/Frameworks/Python.framework/Versions/2.7

python-config --include
-I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7

python --version
Python 2.7.9

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

Just Got Here
Threads 0
Posts 1
plot the spectrum from rt-tddft calculation
Hello, I ran rt-tddft first example (water) in manual. it done successfully. I extracted time dependent dipoles using following command.
python nw_rtparse.py -xdipole -px -tkick_x h2o_abs.nwo > x.dat
python nw_rtparse.py -xdipole -py -tkick_y h2o_abs.nwo > y.dat
python nw_rtparse.py -xdipole -pz -tkick_z h2o_abs.nwo > z.dat

x.dat , y.dat and z.dat file have been maked. also I have executed successfully following command: octave -q fft1d.m ft.dat > fw.dat

but i want to execute exactly that commands in manual, for example when i ran:
fft1d -d50 -z -p50000 < x.dat | rotate_fft > xw.dat

system response is:

fft1d: command not found
rotate_fft: command not found

or when execute commad:
octave fft1d.m -d50 -z -p50000 < x.dat | rotate_fft > xw.dat

system response is:
rotate_fft: command not found
error: load: unable to find file -d50
error: called from:
error: /home/khoda/Downloads/nw_test/fft1d.m at line 42, column 6

who can I solve this problem?

thanks


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