mirror of
https://gitlab.com/scemama/eplf
synced 2024-12-22 04:14:17 +01:00
Updated for 2020
This commit is contained in:
parent
711c7ce5e3
commit
7e44111935
BIN
EZFIO.2.0.2.tar.gz
Normal file
BIN
EZFIO.2.0.2.tar.gz
Normal file
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
EZFIO.1.0.20.tar.gz
|
|
4
Makefile
4
Makefile
@ -9,13 +9,13 @@ EZFIO.tar.gz:
|
|||||||
|
|
||||||
EZFIO/config/eplf.config: EZFIO.tar.gz
|
EZFIO/config/eplf.config: EZFIO.tar.gz
|
||||||
tar -zxf EZFIO.tar.gz
|
tar -zxf EZFIO.tar.gz
|
||||||
cd EZFIO ; IRPF90="`echo $(IRPF90) | cut -f 1`" ./configure
|
cd EZFIO
|
||||||
if [ -e $@ ] ; then rm $@ ; fi
|
if [ -e $@ ] ; then rm $@ ; fi
|
||||||
ln -s $$PWD/eplf.config $@
|
ln -s $$PWD/eplf.config $@
|
||||||
touch EZFIO/config/eplf.config
|
touch EZFIO/config/eplf.config
|
||||||
|
|
||||||
EZFIO/lib/libezfio.so: EZFIO/config/eplf.config
|
EZFIO/lib/libezfio.so: EZFIO/config/eplf.config
|
||||||
make -C EZFIO/
|
$(MAKE) -C EZFIO/
|
||||||
cp EZFIO/Python/ezfio.py scripts/
|
cp EZFIO/Python/ezfio.py scripts/
|
||||||
|
|
||||||
bin/ezfio.py: EZFIO/lib/libezfio.so
|
bin/ezfio.py: EZFIO/lib/libezfio.so
|
||||||
|
47
README
47
README
@ -1,47 +0,0 @@
|
|||||||
+==============================================================================+
|
|
||||||
| EPLF |
|
|
||||||
+==============================================================================+
|
|
||||||
|
|
||||||
Dependencies:
|
|
||||||
-------------
|
|
||||||
|
|
||||||
- EZFIO library : http://ezfio.sourceforge.net
|
|
||||||
- IRPF90 : http://irpf90.sourceforge.net
|
|
||||||
- Python > 2.3
|
|
||||||
- Any Fortran 90 compiler (gfortran, for example)
|
|
||||||
|
|
||||||
Installing EPLF:
|
|
||||||
------------------
|
|
||||||
|
|
||||||
- As the super-user, run
|
|
||||||
./eplf.install
|
|
||||||
|
|
||||||
|
|
||||||
Using EPLF:
|
|
||||||
-------------
|
|
||||||
|
|
||||||
With Gaussian:
|
|
||||||
--------------
|
|
||||||
|
|
||||||
1 - Add the following keywords to your Gaussian input:
|
|
||||||
# GFPRINT pop=Full 6d 10f
|
|
||||||
|
|
||||||
2 - Run Gaussian. You obtain an output file (x.out)
|
|
||||||
|
|
||||||
3 - Run the eplf_input.py script:
|
|
||||||
eplf_input.py x.out
|
|
||||||
|
|
||||||
4 - You now have a QCIO directory which contains the wave function data.
|
|
||||||
|
|
||||||
5 - Run eplf to get a cube file
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Web Site:
|
|
||||||
http://eplf.sourceforge.net
|
|
||||||
|
|
||||||
Author:
|
|
||||||
Anthony Scemama, LCPQ-IRSAMC, CNRS-Universite Paul Sabatier
|
|
||||||
scemama@irsamc.ups-tlse.fr
|
|
||||||
http://sourceforge.net/userapps/mediawiki/scemama
|
|
||||||
|
|
101
README.org
Normal file
101
README.org
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
#+TITLE: EPLF
|
||||||
|
#+AUTHOR: Anthony Scemama
|
||||||
|
#+EMAIL: scemama@irsamc.ups-tlse.fr
|
||||||
|
#+date: 2020-06-02
|
||||||
|
|
||||||
|
Computes the Electron Pair Localization Function.
|
||||||
|
|
||||||
|
* Dependencies
|
||||||
|
|
||||||
|
- Python3
|
||||||
|
- resultsFile : https://gitlab.com/scemama/resultsFile
|
||||||
|
- IRPF90 : http://irpf90.ups-tlse.fr
|
||||||
|
- GFortran or Intel Fortran
|
||||||
|
|
||||||
|
=resultsFile= and =IRPF90= can both be installed with pip.
|
||||||
|
|
||||||
|
#+begin_src shell
|
||||||
|
python3 -m pip install resultsFile
|
||||||
|
python3 -m pip install irpf90
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
=./configure= should detect suitable defaults for your system. You can
|
||||||
|
update the =make.config= file if you want. It is important to give the
|
||||||
|
Fortran compiler the option to accept infinitely long lines (with
|
||||||
|
gfortran, the option is =-ffree-line-length-none=).
|
||||||
|
The =configure= script will also create a file =$HOME/.eplfrc= that you
|
||||||
|
will need to source before running the program.
|
||||||
|
|
||||||
|
* Using EPLF
|
||||||
|
|
||||||
|
GAMESS or Gaussian can be used to produce the wave function.
|
||||||
|
With Gaussian, the following keywords are required:
|
||||||
|
#+begin_example
|
||||||
|
# GFPRINT pop=Full 6d 10f
|
||||||
|
#+end_example
|
||||||
|
|
||||||
|
Go into the =test= directory and execute the following commands to make
|
||||||
|
a test run with an Gaussian output file.
|
||||||
|
|
||||||
|
1. Run the =eplf_input.py= script to convert the output file into an
|
||||||
|
EZFIO directory containing all the data required for the
|
||||||
|
computation:
|
||||||
|
|
||||||
|
#+begin_src shell
|
||||||
|
eplf_input.py c2h.out
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
The =c2h.out.ezfio= directory is produced.
|
||||||
|
|
||||||
|
2. Edit the parameters by running =eplf_edit.py=
|
||||||
|
|
||||||
|
#+begin_src shell
|
||||||
|
eplf_edit.py c2h.out.ezfio
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
The editor defined with the =$EDITOR= environment variable will open
|
||||||
|
and let you change the parameters. To compute the density and the
|
||||||
|
EPLF, just add an =X= character between the brackets next to =eplf=
|
||||||
|
and =density=:
|
||||||
|
|
||||||
|
#+begin_example
|
||||||
|
( ) density -> (X) density
|
||||||
|
( ) eplf -> (X) eplf
|
||||||
|
#+end_example
|
||||||
|
|
||||||
|
3. Run the program to compute the data and save it in the EZFIO directory
|
||||||
|
|
||||||
|
#+begin_src shell
|
||||||
|
eplf c2h.out.ezfio
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
If the program is compiled with MPI, run
|
||||||
|
|
||||||
|
#+begin_src shell
|
||||||
|
mpirun eplf c2h.out.ezfio
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
4. Now you can convert the data into cube files as:
|
||||||
|
#+begin_src shell
|
||||||
|
to_cube.py c2h.out.ezfio density
|
||||||
|
to_cube.py c2h.out.ezfio eplf
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
The parameters of the grid can be changed by first clearing the
|
||||||
|
data, and the updating the grid parameters. This can be done with
|
||||||
|
=eplf_edit.py= by un-commenting the lines =clear(all)=
|
||||||
|
and =edit(grid_parameters)=.
|
||||||
|
|
||||||
|
* References
|
||||||
|
|
||||||
|
Scemama, A., Chaquin, P., Caffarel, M. (2004).
|
||||||
|
"Electron pair localization function: A practical tool to visualize electron
|
||||||
|
localization in molecules from quantum Monte Carlo data".
|
||||||
|
/J. Chem. Phys./ *121* (4), 1725–1735. doi: 10.1063/1.1765098
|
||||||
|
|
||||||
|
Scemama, A., Caffarel, M., Chaudret, R., & Piquemal, J.-P. (2011),
|
||||||
|
"Electron Pair Localization Function (EPLF) for Density Functional
|
||||||
|
Theory and ab Initio Wave Function-Based Methods: A New Tool for
|
||||||
|
Chemical Interpretation".
|
||||||
|
/J. Chem. Theory Comput./ *7* (3), 618–624. doi: 10.1021/ct1005938
|
||||||
|
|
BIN
bin/to_ezfio.exe
BIN
bin/to_ezfio.exe
Binary file not shown.
75
configure.ac
75
configure.ac
@ -31,7 +31,7 @@ AC_REVISION([$Revision: $VERSION $])
|
|||||||
|
|
||||||
AC_PREREQ([2.50])
|
AC_PREREQ([2.50])
|
||||||
|
|
||||||
AC_INIT([EPLF], [], [scemama@irsamc.ups-tlse.fr],[eplf],[http://eplf.sourceforge.net])
|
AC_INIT([EPLF], [], [scemama@irsamc.ups-tlse.fr],[eplf],[https://gitlab.com/scemama/eplf])
|
||||||
|
|
||||||
AC_SYS_LONG_FILE_NAMES
|
AC_SYS_LONG_FILE_NAMES
|
||||||
|
|
||||||
@ -53,75 +53,18 @@ AC_PROG_CC
|
|||||||
# Check for curl
|
# Check for curl
|
||||||
AC_CHECK_PROGS([CURL],[curl],[])
|
AC_CHECK_PROGS([CURL],[curl],[])
|
||||||
|
|
||||||
######################################################
|
|
||||||
# Define download function
|
|
||||||
AC_DEFUN([AC_DOWNLOAD],[{
|
|
||||||
# AC_DOWNLOAD ( VARIABLE, name, url )
|
|
||||||
WHERE=
|
|
||||||
if [[ ! -z $CURL ]] ; then
|
|
||||||
echo ""
|
|
||||||
echo "**************************"
|
|
||||||
echo $1 is not installed
|
|
||||||
echo "**************************"
|
|
||||||
echo "Do you want to download it?"
|
|
||||||
select x in yes no
|
|
||||||
do
|
|
||||||
if [[ ! -z $x ]] ; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [[ $x == yes ]] ; then
|
|
||||||
if [[ ! -d "Downloads" ]] ; then
|
|
||||||
mkdir $EPLF_PATH/Downloads
|
|
||||||
fi
|
|
||||||
cd $EPLF_PATH/Downloads
|
|
||||||
mkdir $EPLF_PATH/Downloads/tmp
|
|
||||||
cd $EPLF_PATH/Downloads/tmp
|
|
||||||
$CURL -L "$3" -o $2 && mv $2 .. && WHERE=$2
|
|
||||||
cd $EPLF_PATH
|
|
||||||
rm -rf $EPLF_PATH/Downloads/tmp
|
|
||||||
fi
|
|
||||||
if [[ ! -z $WHERE ]] ; then
|
|
||||||
echo $2 was downloaded to Downloads/$WHERE.
|
|
||||||
$1=1
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR([$2 should be installed. You can download it at
|
|
||||||
$3])
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR([Please download $2 at
|
|
||||||
$3])
|
|
||||||
fi
|
|
||||||
}])
|
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
# Check for python
|
# Check for python
|
||||||
AC_CHECK_PROGS([PYTHON],[python],[])
|
AC_CHECK_PROGS([PYTHON],[python3],[])
|
||||||
if [[ -z $PYTHON ]] ; then
|
if [[ -z $PYTHON ]] ; then
|
||||||
AC_MSG_ERROR([Python should be installed:
|
AC_MSG_ERROR([Python3 should be installed])
|
||||||
http://www.python.org])
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
# IRPF90 compiler
|
# IRPF90 compiler
|
||||||
AC_CHECK_PROGS([IRPF90],[irpf90],[])
|
AC_CHECK_PROGS([IRPF90],[irpf90],[])
|
||||||
if [[ -z $IRPF90 ]] ; then
|
if [[ -z $IRPF90 ]] ; then
|
||||||
AC_DOWNLOAD([IRPF90],[irpf90.gz],[http://sourceforge.net/projects/irpf90/files/irpf90-1.1.57-noarch.exe.gz/download])
|
AC_MSG_ERROR([IRPF90 should be installed: python3 -m pip install irpf90])
|
||||||
gunzip Downloads/irpf90.gz
|
|
||||||
mv Downloads/irpf90 bin/
|
|
||||||
chmod +x bin/irpf90
|
|
||||||
IRPF90=$EPLF_PATH/bin/irpf90
|
|
||||||
fi
|
|
||||||
|
|
||||||
######################################################
|
|
||||||
# EZFIO
|
|
||||||
EZFIO=`ls EZFIO*.tar.gz | tail -1`
|
|
||||||
if [[ -z $EZFIO ]] ; then
|
|
||||||
AC_DOWNLOAD([EZFIO],[EZFIO.tar.gz],[http://sourceforge.net/projects/ezfio/files/latest])
|
|
||||||
if [[ -z $EZFIO ]] ; then
|
|
||||||
AC_MSG_ERROR([Download EZFIO.tar.gz into $PWD and run this configure script again.])
|
|
||||||
fi
|
|
||||||
mv Downloads/EZFIO*.tar.gz EZFIO.tar.gz
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
@ -165,24 +108,26 @@ AC_FC_FREEFORM
|
|||||||
|
|
||||||
case $FC in
|
case $FC in
|
||||||
mpif90*)
|
mpif90*)
|
||||||
FCFLAGS="-O3"
|
FCFLAGS="-fPIC -O2 -ffree-line-length-none -ffast-math "
|
||||||
IRPF90="$IRPF90 -DMPI"
|
IRPF90="$IRPF90 -DMPI"
|
||||||
;;
|
;;
|
||||||
ifort*)
|
ifort*)
|
||||||
FCFLAGS="-O3 -axSSE2,AVX -ip"
|
FCFLAGS="-O2 -xHost -ip"
|
||||||
if test $STATIC == 1 ; then
|
if test $STATIC == 1 ; then
|
||||||
FCFLAGS="$FCFLAGS -static-intel -static-libgcc -static"
|
FCFLAGS="$FCFLAGS -static-intel -static-libgcc -static"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
gfortran*)
|
gfortran*)
|
||||||
FCFLAGS="-fPIC -O3 -ffast-math"
|
FCFLAGS="-fPIC -O2 -ffast-math -ffree-line-length-none"
|
||||||
if test $STATIC == 0 ; then
|
if test $STATIC == 0 ; then
|
||||||
FCFLAGS="$FCFLAGS -static-libgcc -static"
|
FCFLAGS="$FCFLAGS -static-libgcc -static"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_SUBST(IRPF90)
|
AC_SUBST([FC])
|
||||||
|
AC_SUBST([IRPF90])
|
||||||
|
AC_SUBST([FCFLAGS])
|
||||||
|
|
||||||
# Write make.config
|
# Write make.config
|
||||||
|
|
||||||
|
10
eplf.config
10
eplf.config
@ -1,7 +1,7 @@
|
|||||||
electrons
|
electrons
|
||||||
elec_alpha_num integer
|
elec_alpha_num integer
|
||||||
elec_beta_num integer
|
elec_beta_num integer
|
||||||
elec_num integer = electrons_elec_alpha_num + electrons_elec_beta_num
|
elec_num integer
|
||||||
|
|
||||||
nuclei
|
nuclei
|
||||||
nucl_num integer
|
nucl_num integer
|
||||||
@ -18,7 +18,7 @@ ao_basis
|
|||||||
ao_prim_num integer (ao_basis_ao_num)
|
ao_prim_num integer (ao_basis_ao_num)
|
||||||
ao_nucl integer (ao_basis_ao_num)
|
ao_nucl integer (ao_basis_ao_num)
|
||||||
ao_power integer (ao_basis_ao_num,3)
|
ao_power integer (ao_basis_ao_num,3)
|
||||||
ao_prim_num_max integer = maxval(ao_basis_ao_prim_num)
|
ao_prim_num_max integer
|
||||||
ao_coef real (ao_basis_ao_num,ao_basis_ao_prim_num_max)
|
ao_coef real (ao_basis_ao_num,ao_basis_ao_prim_num_max)
|
||||||
ao_expo real (ao_basis_ao_num,ao_basis_ao_prim_num_max)
|
ao_expo real (ao_basis_ao_num,ao_basis_ao_prim_num_max)
|
||||||
|
|
||||||
@ -26,9 +26,9 @@ mo_basis
|
|||||||
mo_tot_num integer
|
mo_tot_num integer
|
||||||
mo_coef real (ao_basis_ao_num,mo_basis_mo_tot_num)
|
mo_coef real (ao_basis_ao_num,mo_basis_mo_tot_num)
|
||||||
mo_classif character (mo_basis_mo_tot_num)
|
mo_classif character (mo_basis_mo_tot_num)
|
||||||
mo_closed_num integer =n_count_ch(mo_basis_mo_classif,size(mo_basis_mo_classif),'c')
|
mo_closed_num integer
|
||||||
mo_active_num integer =n_count_ch(mo_basis_mo_classif,size(mo_basis_mo_classif),'a')
|
mo_active_num integer
|
||||||
mo_virtual_num integer =n_count_ch(mo_basis_mo_classif,size(mo_basis_mo_classif),'v')
|
mo_virtual_num integer
|
||||||
mo_energy real (mo_basis_mo_tot_num)
|
mo_energy real (mo_basis_mo_tot_num)
|
||||||
mo_occ real (mo_basis_mo_tot_num)
|
mo_occ real (mo_basis_mo_tot_num)
|
||||||
|
|
||||||
|
@ -2,3 +2,4 @@ IRPF90 = @IRPF90@
|
|||||||
FC = @FC@
|
FC = @FC@
|
||||||
FCFLAGS= @FCFLAGS@
|
FCFLAGS= @FCFLAGS@
|
||||||
LIB = @LIB@
|
LIB = @LIB@
|
||||||
|
export FC FCFLAGS IRPF90
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from math import *
|
from math import *
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ class Cleaner(object):
|
|||||||
def action(self):
|
def action(self):
|
||||||
raise TypeError
|
raise TypeError
|
||||||
def clean(self):
|
def clean(self):
|
||||||
print "Removing "+self.name
|
print("Removing "+self.name)
|
||||||
self.action()
|
self.action()
|
||||||
|
|
||||||
class GridDataCleaner(Cleaner):
|
class GridDataCleaner(Cleaner):
|
||||||
@ -40,7 +40,7 @@ class AllCleaner(Cleaner):
|
|||||||
def clear(x,inp):
|
def clear(x,inp):
|
||||||
d = { "all": AllCleaner,
|
d = { "all": AllCleaner,
|
||||||
}
|
}
|
||||||
if x in d.keys():
|
if x in list(d.keys()):
|
||||||
type = d[x]
|
type = d[x]
|
||||||
else:
|
else:
|
||||||
type = GridDataCleaner
|
type = GridDataCleaner
|
||||||
@ -58,7 +58,7 @@ class Editor(object):
|
|||||||
def action(self):
|
def action(self):
|
||||||
raise TypeError
|
raise TypeError
|
||||||
def edit(self):
|
def edit(self):
|
||||||
print "Editing "+self.name
|
print("Editing "+self.name)
|
||||||
self.action()
|
self.action()
|
||||||
|
|
||||||
class GeometryEditor(Editor):
|
class GeometryEditor(Editor):
|
||||||
@ -68,26 +68,26 @@ class GeometryEditor(Editor):
|
|||||||
edit_temp_file(self.inp,self.write_geom_file,self.read_geom_file)
|
edit_temp_file(self.inp,self.write_geom_file,self.read_geom_file)
|
||||||
|
|
||||||
def write_geom_file(self,file,inp):
|
def write_geom_file(self,file,inp):
|
||||||
print >>file, "###########################"
|
print("###########################", file=file)
|
||||||
print >>file, "# Geometry : %s"%(inp.name)
|
print("# Geometry : %s"%(inp.name), file=file)
|
||||||
print >>file, "###########################"
|
print("###########################", file=file)
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
fields = "Charge X Y Z"
|
fields = "Charge X Y Z"
|
||||||
format = "%10.1f "+"%10.6f "*3
|
format = "%10.1f "+"%10.6f "*3
|
||||||
fields = fields.split()
|
fields = fields.split()
|
||||||
print >>file, " ".join(["#"]+map(lambda x: x.center(10),fields))
|
print(" ".join(["#"]+[x.center(10) for x in fields]), file=file)
|
||||||
print >>file, "# "+"-"*11*len(fields)+"\n"
|
print("# "+"-"*11*len(fields)+"\n", file=file)
|
||||||
charge = self.charge
|
charge = self.charge
|
||||||
coord = self.coord
|
coord = self.coord
|
||||||
for i in xrange(len(charge)):
|
for i in range(len(charge)):
|
||||||
buffer = [ charge[i], coord[0][i], coord[1][i], coord[2][i] ]
|
buffer = [ charge[i], coord[0][i], coord[1][i], coord[2][i] ]
|
||||||
print >>file, " "+format%tuple(buffer)
|
print(" "+format%tuple(buffer), file=file)
|
||||||
|
|
||||||
def read_geom_file(self,file,inp):
|
def read_geom_file(self,file,inp):
|
||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
lines = filter(lambda x: len(x.strip())>0,lines)
|
lines = [x for x in lines if len(x.strip())>0]
|
||||||
lines = filter(lambda x: not x.startswith("#"),lines)
|
lines = [x for x in lines if not x.startswith("#")]
|
||||||
lines = map(lambda x: x.split(),lines)
|
lines = [x.split() for x in lines]
|
||||||
coord = [ [], [], [] ]
|
coord = [ [], [], [] ]
|
||||||
charge = []
|
charge = []
|
||||||
for line in lines:
|
for line in lines:
|
||||||
@ -106,42 +106,42 @@ class GridEditor(Editor):
|
|||||||
edit_temp_file(self.inp,self.write_grid_file,self.read_grid_file)
|
edit_temp_file(self.inp,self.write_grid_file,self.read_grid_file)
|
||||||
|
|
||||||
def write_grid_file(self,file,inp):
|
def write_grid_file(self,file,inp):
|
||||||
print >>file, "###########################"
|
print("###########################", file=file)
|
||||||
print >>file, "# Grid : %s"%(inp.name)
|
print("# Grid : %s"%(inp.name), file=file)
|
||||||
print >>file, "###########################"
|
print("###########################", file=file)
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
print >>file, "# Number of points along x, y, z"
|
print("# Number of points along x, y, z", file=file)
|
||||||
if self.point_num is None:
|
if self.point_num is None:
|
||||||
print >>file, "Default"
|
print("Default", file=file)
|
||||||
else:
|
else:
|
||||||
print >>file, "%d %d %d"%tuple(self.point_num)
|
print("%d %d %d"%tuple(self.point_num), file=file)
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
print >>file, "# Coordinates of the origin (x,y,z)"
|
print("# Coordinates of the origin (x,y,z)", file=file)
|
||||||
if self.origin is None:
|
if self.origin is None:
|
||||||
print >>file, "Default"
|
print("Default", file=file)
|
||||||
else:
|
else:
|
||||||
print >>file, "%f %f %f"%tuple(self.origin)
|
print("%f %f %f"%tuple(self.origin), file=file)
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
print >>file, "# Coordinates of the opposite point (x,y,z)"
|
print("# Coordinates of the opposite point (x,y,z)", file=file)
|
||||||
if self.opposite is None:
|
if self.opposite is None:
|
||||||
print >>file, "Default"
|
print("Default", file=file)
|
||||||
else:
|
else:
|
||||||
print >>file, "%f %f %f"%tuple(self.opposite)
|
print("%f %f %f"%tuple(self.opposite), file=file)
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
print >>file, "# Step sizes (x,y,z)"
|
print("# Step sizes (x,y,z)", file=file)
|
||||||
if self.step_size is None:
|
if self.step_size is None:
|
||||||
print >>file, "Default"
|
print("Default", file=file)
|
||||||
else:
|
else:
|
||||||
print >>file, "%f %f %f"%tuple(self.step_size)
|
print("%f %f %f"%tuple(self.step_size), file=file)
|
||||||
|
|
||||||
def read_grid_file(self,file,inp):
|
def read_grid_file(self,file,inp):
|
||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
lines = filter(lambda x: len(x.strip())>0,lines)
|
lines = [x for x in lines if len(x.strip())>0]
|
||||||
lines = filter(lambda x: not x.startswith("#"),lines)
|
lines = [x for x in lines if not x.startswith("#")]
|
||||||
|
|
||||||
buffer = lines.pop(0).lower().split()
|
buffer = lines.pop(0).lower().split()
|
||||||
if buffer[0] != "default":
|
if buffer[0] != "default":
|
||||||
self.inp.point_num = map(int,buffer)
|
self.inp.point_num = list(map(int,buffer))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
os.remove("%s/grid/point_num.gz"%self.inp.name)
|
os.remove("%s/grid/point_num.gz"%self.inp.name)
|
||||||
@ -150,7 +150,7 @@ class GridEditor(Editor):
|
|||||||
|
|
||||||
buffer = lines.pop(0).lower().split()
|
buffer = lines.pop(0).lower().split()
|
||||||
if buffer[0] != "default":
|
if buffer[0] != "default":
|
||||||
self.inp.origin = map(float,buffer)
|
self.inp.origin = list(map(float,buffer))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
os.remove("%s/grid/origin.gz"%self.inp.name)
|
os.remove("%s/grid/origin.gz"%self.inp.name)
|
||||||
@ -159,7 +159,7 @@ class GridEditor(Editor):
|
|||||||
|
|
||||||
buffer = lines.pop(0).lower().split()
|
buffer = lines.pop(0).lower().split()
|
||||||
if buffer[0] != "default":
|
if buffer[0] != "default":
|
||||||
self.inp.opposite = map(float,buffer)
|
self.inp.opposite = list(map(float,buffer))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
os.remove("%s/grid/opposite.gz"%self.inp.name)
|
os.remove("%s/grid/opposite.gz"%self.inp.name)
|
||||||
@ -187,31 +187,31 @@ def edit(x,inp):
|
|||||||
#############################
|
#############################
|
||||||
|
|
||||||
def write_main_file(file,inp):
|
def write_main_file(file,inp):
|
||||||
print >>file, "####################"
|
print("####################", file=file)
|
||||||
print >>file, "# %s"%(inp.name)
|
print("# %s"%(inp.name), file=file)
|
||||||
print >>file, "####################"
|
print("####################", file=file)
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
compute = filter(lambda x: x.startswith("compute"),rw_data)
|
compute = [x for x in rw_data if x.startswith("compute")]
|
||||||
print >>file, "# Clear"
|
print("# Clear", file=file)
|
||||||
print >>file, "# --------------------\n"
|
print("# --------------------\n", file=file)
|
||||||
print >>file, '# clear(all)'
|
print('# clear(all)', file=file)
|
||||||
for p in compute:
|
for p in compute:
|
||||||
print >>file, '# clear(%s)'%(p[8:])
|
print('# clear(%s)'%(p[8:]), file=file)
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
print >>file, "# Computation"
|
print("# Computation", file=file)
|
||||||
print >>file, "# --------------------\n"
|
print("# --------------------\n", file=file)
|
||||||
print >>file, "nproc = %d"%(inp.nproc)
|
print("nproc = %d"%(inp.nproc), file=file)
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
for p in compute:
|
for p in compute:
|
||||||
x = ' '
|
x = ' '
|
||||||
exec "if inp.%s: x = 'X'"%(p)
|
exec("if inp.%s: x = 'X'"%(p))
|
||||||
print >>file, "(%s) %s"%(x,p[8:])
|
print("(%s) %s"%(x,p[8:]), file=file)
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
print >>file, "# Edit"
|
print("# Edit", file=file)
|
||||||
print >>file, "# --------------------\n"
|
print("# --------------------\n", file=file)
|
||||||
print >>file, '# edit(geometry)'
|
print('# edit(geometry)', file=file)
|
||||||
print >>file, '# edit(grid_parameters)'
|
print('# edit(grid_parameters)', file=file)
|
||||||
print >>file, ""
|
print("", file=file)
|
||||||
|
|
||||||
|
|
||||||
## Execute temporary input file
|
## Execute temporary input file
|
||||||
@ -235,7 +235,7 @@ def read_main_file(file,inp):
|
|||||||
line = line.replace("(","('").replace(")","',inp)").lower()
|
line = line.replace("(","('").replace(")","',inp)").lower()
|
||||||
else:
|
else:
|
||||||
line = "inp."+line
|
line = "inp."+line
|
||||||
exec line
|
exec(line)
|
||||||
|
|
||||||
|
|
||||||
def edit_temp_file(input_file,write_file,read_file,saved_file=None):
|
def edit_temp_file(input_file,write_file,read_file,saved_file=None):
|
||||||
@ -282,14 +282,14 @@ $RUNCOMMAND
|
|||||||
else:
|
else:
|
||||||
command = "${EPLF_MPIRUN} -np %d "%(inp.nproc)+command
|
command = "${EPLF_MPIRUN} -np %d "%(inp.nproc)+command
|
||||||
buffer = buffer.replace("$RUNCOMMAND",command)
|
buffer = buffer.replace("$RUNCOMMAND",command)
|
||||||
print >>file, buffer
|
print(buffer, file=file)
|
||||||
file.close()
|
file.close()
|
||||||
os.chmod(run_script,0744)
|
os.chmod(run_script,0o744)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) not in [2,3]:
|
if len(sys.argv) not in [2,3]:
|
||||||
print "Syntax : %s <EZFIO_File> [input_file]"%(sys.argv[0])
|
print("Syntax : %s <EZFIO_File> [input_file]"%(sys.argv[0]))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
inp = InputFile(sys.argv[1])
|
inp = InputFile(sys.argv[1])
|
||||||
if len(sys.argv) == 3:
|
if len(sys.argv) == 3:
|
||||||
|
@ -361,10 +361,10 @@ class InputFile(object):
|
|||||||
|
|
||||||
# Build the corresponding properties
|
# Build the corresponding properties
|
||||||
for i in ro_data:
|
for i in ro_data:
|
||||||
exec "%s = property(fget=get_%s,fset=None)"%(i,i)
|
exec("%s = property(fget=get_%s,fset=None)"%(i,i))
|
||||||
|
|
||||||
for i in rw_data_full:
|
for i in rw_data_full:
|
||||||
exec "%s = property(fget=get_%s,fset=set_%s)"%(i,i,i)
|
exec("%s = property(fget=get_%s,fset=set_%s)"%(i,i,i))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,16 +14,16 @@ if len(sys.argv) == 2:
|
|||||||
elif len(sys.argv) == 3:
|
elif len(sys.argv) == 3:
|
||||||
det_thr=float(sys.argv[2])
|
det_thr=float(sys.argv[2])
|
||||||
else:
|
else:
|
||||||
print "usage: "+sys.argv[0]+" file.out det_threshold"
|
print("usage: "+sys.argv[0]+" file.out det_threshold")
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
def reduce_dets():
|
def reduce_dets():
|
||||||
ezfio.set_file(firstArg)
|
ezfio.set_file(firstArg)
|
||||||
os.system ("cp -r %s/determinants %s/determinants.bak"%(firstArg,firstArg))
|
os.system ("cp -r %s/determinants %s/determinants.bak"%(firstArg,firstArg))
|
||||||
print "Initial number of determinants: ",ezfio.determinants_det_num
|
print("Initial number of determinants: ",ezfio.determinants_det_num)
|
||||||
coef = ezfio.determinants_det_coef
|
coef = ezfio.determinants_det_coef
|
||||||
norm = sum( map(lambda x: x*x,coef) )
|
norm = sum( [x*x for x in coef] )
|
||||||
print "Norm of the initial wave function: ", sqrt(norm)
|
print("Norm of the initial wave function: ", sqrt(norm))
|
||||||
dets_a, dets_b = ezfio.determinants_det_occ
|
dets_a, dets_b = ezfio.determinants_det_occ
|
||||||
|
|
||||||
to_remove = []
|
to_remove = []
|
||||||
@ -37,9 +37,9 @@ def reduce_dets():
|
|||||||
coef.pop(i)
|
coef.pop(i)
|
||||||
dets_a.pop(i)
|
dets_a.pop(i)
|
||||||
dets_b.pop(i)
|
dets_b.pop(i)
|
||||||
print "New number of determinants: ", len(coef)
|
print("New number of determinants: ", len(coef))
|
||||||
norm = sum( map(lambda x: x*x,coef) )
|
norm = sum( [x*x for x in coef] )
|
||||||
print "Norm of the new wave function: ", sqrt(norm)
|
print("Norm of the new wave function: ", sqrt(norm))
|
||||||
ezfio.determinants_det_num = len(coef)
|
ezfio.determinants_det_num = len(coef)
|
||||||
ezfio.determinants_det_coef = coef
|
ezfio.determinants_det_coef = coef
|
||||||
ezfio.determinants_det_occ = dets_a+dets_b
|
ezfio.determinants_det_occ = dets_a+dets_b
|
||||||
|
@ -8,7 +8,7 @@ import common
|
|||||||
try:
|
try:
|
||||||
x, filename, grid_type = sys.argv
|
x, filename, grid_type = sys.argv
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print "usage: "+sys.argv[0]+" filename grid_type"
|
print("usage: "+sys.argv[0]+" filename grid_type")
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
|
|
||||||
@ -17,28 +17,28 @@ from ezfio import ezfio
|
|||||||
def main():
|
def main():
|
||||||
ezfio.set_file(filename)
|
ezfio.set_file(filename)
|
||||||
file = open("%s_%s.cube"%(filename,grid_type),"w")
|
file = open("%s_%s.cube"%(filename,grid_type),"w")
|
||||||
print >>file, " Cube File"
|
print(" Cube File", file=file)
|
||||||
print >>file, filename, grid_type
|
print(filename, grid_type, file=file)
|
||||||
data = [ ezfio.nuclei_nucl_num ]+ezfio.grid_origin
|
data = [ ezfio.nuclei_nucl_num ]+ezfio.grid_origin
|
||||||
print >>file, "%5d%12.6f%12.6f%12.6f" % tuple(data)
|
print("%5d%12.6f%12.6f%12.6f" % tuple(data), file=file)
|
||||||
data = [ ezfio.grid_num_x, ezfio.grid_step_size[0],0.,0. ]
|
data = [ ezfio.grid_num_x, ezfio.grid_step_size[0],0.,0. ]
|
||||||
print >>file, "%5d%12.6f%12.6f%12.6f" % tuple(data)
|
print("%5d%12.6f%12.6f%12.6f" % tuple(data), file=file)
|
||||||
data = [ ezfio.grid_num_y, 0., ezfio.grid_step_size[1],0. ]
|
data = [ ezfio.grid_num_y, 0., ezfio.grid_step_size[1],0. ]
|
||||||
print >>file, "%5d%12.6f%12.6f%12.6f" % tuple(data)
|
print("%5d%12.6f%12.6f%12.6f" % tuple(data), file=file)
|
||||||
data = [ ezfio.grid_num_z, 0.,0., ezfio.grid_step_size[2] ]
|
data = [ ezfio.grid_num_z, 0.,0., ezfio.grid_step_size[2] ]
|
||||||
print >>file, "%5d%12.6f%12.6f%12.6f" % tuple(data)
|
print("%5d%12.6f%12.6f%12.6f" % tuple(data), file=file)
|
||||||
|
|
||||||
charge = ezfio.nuclei_nucl_charge
|
charge = ezfio.nuclei_nucl_charge
|
||||||
coord = ezfio.nuclei_nucl_coord
|
coord = ezfio.nuclei_nucl_coord
|
||||||
for i in range(ezfio.nuclei_nucl_num):
|
for i in range(ezfio.nuclei_nucl_num):
|
||||||
data = [ charge[i], charge[i], coord[0][i], coord[1][i], coord[2][i] ]
|
data = [ charge[i], charge[i], coord[0][i], coord[1][i], coord[2][i] ]
|
||||||
print >>file, "%5d%12.6f%12.6f%12.6f%12.6f" % tuple(data)
|
print("%5d%12.6f%12.6f%12.6f%12.6f" % tuple(data), file=file)
|
||||||
|
|
||||||
data = getattr(ezfio,"grid_data_%s"%grid_type)
|
data = getattr(ezfio,"grid_data_%s"%grid_type)
|
||||||
for i in xrange(0,ezfio.grid_num_x):
|
for i in range(0,ezfio.grid_num_x):
|
||||||
for j in xrange(0,ezfio.grid_num_y):
|
for j in range(0,ezfio.grid_num_y):
|
||||||
for k in xrange(0,ezfio.grid_num_z,6):
|
for k in range(0,ezfio.grid_num_z,6):
|
||||||
for l in xrange(k,min(ezfio.grid_num_z,k+6)):
|
for l in range(k,min(ezfio.grid_num_z,k+6)):
|
||||||
file.write (" %12.5E"%data[l][j][i])
|
file.write (" %12.5E"%data[l][j][i])
|
||||||
file.write ("\n")
|
file.write ("\n")
|
||||||
file.close()
|
file.close()
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import common
|
import common
|
||||||
import sys,os,time
|
import sys,os,time
|
||||||
|
from functools import reduce
|
||||||
|
|
||||||
sys.path = [ "/home/scemama/resultsFile" ]+sys.path
|
|
||||||
from resultsFile import *
|
from resultsFile import *
|
||||||
|
|
||||||
# Check command line
|
# Check command line
|
||||||
@ -14,14 +14,14 @@ if len(sys.argv) == 2:
|
|||||||
elif len(sys.argv) == 3:
|
elif len(sys.argv) == 3:
|
||||||
State=int(sys.argv[2])
|
State=int(sys.argv[2])
|
||||||
else:
|
else:
|
||||||
print "usage: "+sys.argv[0]+" file.out"
|
print("usage: "+sys.argv[0]+" file.out")
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
firstArg = sys.argv[1]
|
firstArg = sys.argv[1]
|
||||||
|
|
||||||
file = getFile(firstArg)
|
file = getFile(firstArg)
|
||||||
file.convert_to_cartesian()
|
file.convert_to_cartesian()
|
||||||
print firstArg, 'recognized as', str(file).split('.')[-1].split()[0]
|
print(firstArg, 'recognized as', str(file).split('.')[-1].split()[0])
|
||||||
|
|
||||||
from ezfio import ezfio
|
from ezfio import ezfio
|
||||||
|
|
||||||
@ -31,6 +31,7 @@ def write_ezfioFile(res,filename):
|
|||||||
# Electrons
|
# Electrons
|
||||||
ezfio.electrons_elec_alpha_num = res.num_alpha
|
ezfio.electrons_elec_alpha_num = res.num_alpha
|
||||||
ezfio.electrons_elec_beta_num = res.num_beta
|
ezfio.electrons_elec_beta_num = res.num_beta
|
||||||
|
ezfio.electrons_elec_num = res.num_beta + res.num_alpha
|
||||||
|
|
||||||
# Nuclei
|
# Nuclei
|
||||||
ezfio.nuclei_nucl_num = len(res.geometry)
|
ezfio.nuclei_nucl_num = len(res.geometry)
|
||||||
@ -70,16 +71,17 @@ def write_ezfioFile(res,filename):
|
|||||||
at.append(i+1)
|
at.append(i+1)
|
||||||
num_prim.append(len(b.prim))
|
num_prim.append(len(b.prim))
|
||||||
s = b.sym
|
s = b.sym
|
||||||
power_x.append( string.count(s,"x") )
|
power_x.append( s.count("x") )
|
||||||
power_y.append( string.count(s,"y") )
|
power_y.append( s.count("y") )
|
||||||
power_z.append( string.count(s,"z") )
|
power_z.append( s.count("z") )
|
||||||
coefficient.append( b.coef )
|
coefficient.append( b.coef )
|
||||||
exponent.append( [ p.expo for p in b.prim ] )
|
exponent.append( [ p.expo for p in b.prim ] )
|
||||||
ezfio.ao_basis_ao_num = len(res.basis)
|
ezfio.ao_basis_ao_num = len(res.basis)
|
||||||
ezfio.ao_basis_ao_nucl = at
|
ezfio.ao_basis_ao_nucl = at
|
||||||
ezfio.ao_basis_ao_prim_num = num_prim
|
ezfio.ao_basis_ao_prim_num = num_prim
|
||||||
ezfio.ao_basis_ao_power = power_x+power_y+power_z
|
ezfio.ao_basis_ao_power = power_x+power_y+power_z
|
||||||
prim_num_max = ezfio.get_ao_basis_ao_prim_num_max()
|
prim_num_max = max(num_prim)
|
||||||
|
ezfio.ao_basis_ao_prim_num_max = prim_num_max
|
||||||
len_res_basis = len(res.basis)
|
len_res_basis = len(res.basis)
|
||||||
for i in range(len(res.basis)):
|
for i in range(len(res.basis)):
|
||||||
coefficient[i] += [ 0. for j in range(len(coefficient[i]),prim_num_max) ]
|
coefficient[i] += [ 0. for j in range(len(coefficient[i]),prim_num_max) ]
|
||||||
@ -165,8 +167,12 @@ def write_ezfioFile(res,filename):
|
|||||||
|
|
||||||
coef = reduce(lambda x, y: x+y,res.det_coefficients,[])
|
coef = reduce(lambda x, y: x+y,res.det_coefficients,[])
|
||||||
|
|
||||||
|
ezfio.mo_basis_mo_closed_num = len(res.closed_mos)
|
||||||
|
ezfio.mo_basis_mo_active_num = len(res.active_mos)
|
||||||
|
ezfio.mo_basis_mo_virtual_num = len(res.virtual_mos)
|
||||||
|
|
||||||
if len(dets_a[0]) > 0:
|
if len(dets_a[0]) > 0:
|
||||||
for i in xrange(len(coef),0,-1):
|
for i in range(len(coef),0,-1):
|
||||||
i -= 1
|
i -= 1
|
||||||
if abs(coef[i]) < det_thr :
|
if abs(coef[i]) < det_thr :
|
||||||
dets_a.pop(i)
|
dets_a.pop(i)
|
||||||
@ -183,7 +189,7 @@ def write_ezfioFile(res,filename):
|
|||||||
|
|
||||||
ezfio.compute_eplf = True
|
ezfio.compute_eplf = True
|
||||||
for i in "density density_lapl elf elf_grad eplf_lapl density_grad elf_grad elf_lapl eplf_grad".split():
|
for i in "density density_lapl elf elf_grad eplf_lapl density_grad elf_grad elf_lapl eplf_grad".split():
|
||||||
exec "ezfio.compute_%s = False" % i
|
exec("ezfio.compute_%s = False" % i)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Loading…
Reference in New Issue
Block a user