mirror of
https://gitlab.com/scemama/eplf
synced 2024-12-21 11:53:50 +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
|
||||
tar -zxf EZFIO.tar.gz
|
||||
cd EZFIO ; IRPF90="`echo $(IRPF90) | cut -f 1`" ./configure
|
||||
cd EZFIO
|
||||
if [ -e $@ ] ; then rm $@ ; fi
|
||||
ln -s $$PWD/eplf.config $@
|
||||
touch EZFIO/config/eplf.config
|
||||
|
||||
EZFIO/lib/libezfio.so: EZFIO/config/eplf.config
|
||||
make -C EZFIO/
|
||||
$(MAKE) -C EZFIO/
|
||||
cp EZFIO/Python/ezfio.py scripts/
|
||||
|
||||
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_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
|
||||
|
||||
@ -53,75 +53,18 @@ AC_PROG_CC
|
||||
# Check for 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
|
||||
AC_CHECK_PROGS([PYTHON],[python],[])
|
||||
AC_CHECK_PROGS([PYTHON],[python3],[])
|
||||
if [[ -z $PYTHON ]] ; then
|
||||
AC_MSG_ERROR([Python should be installed:
|
||||
http://www.python.org])
|
||||
AC_MSG_ERROR([Python3 should be installed])
|
||||
fi
|
||||
|
||||
######################################################
|
||||
# IRPF90 compiler
|
||||
AC_CHECK_PROGS([IRPF90],[irpf90],[])
|
||||
if [[ -z $IRPF90 ]] ; then
|
||||
AC_DOWNLOAD([IRPF90],[irpf90.gz],[http://sourceforge.net/projects/irpf90/files/irpf90-1.1.57-noarch.exe.gz/download])
|
||||
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
|
||||
AC_MSG_ERROR([IRPF90 should be installed: python3 -m pip install irpf90])
|
||||
fi
|
||||
|
||||
######################################################
|
||||
@ -165,24 +108,26 @@ AC_FC_FREEFORM
|
||||
|
||||
case $FC in
|
||||
mpif90*)
|
||||
FCFLAGS="-O3"
|
||||
FCFLAGS="-fPIC -O2 -ffree-line-length-none -ffast-math "
|
||||
IRPF90="$IRPF90 -DMPI"
|
||||
;;
|
||||
ifort*)
|
||||
FCFLAGS="-O3 -axSSE2,AVX -ip"
|
||||
FCFLAGS="-O2 -xHost -ip"
|
||||
if test $STATIC == 1 ; then
|
||||
FCFLAGS="$FCFLAGS -static-intel -static-libgcc -static"
|
||||
fi
|
||||
;;
|
||||
gfortran*)
|
||||
FCFLAGS="-fPIC -O3 -ffast-math"
|
||||
FCFLAGS="-fPIC -O2 -ffast-math -ffree-line-length-none"
|
||||
if test $STATIC == 0 ; then
|
||||
FCFLAGS="$FCFLAGS -static-libgcc -static"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(IRPF90)
|
||||
AC_SUBST([FC])
|
||||
AC_SUBST([IRPF90])
|
||||
AC_SUBST([FCFLAGS])
|
||||
|
||||
# Write make.config
|
||||
|
||||
|
10
eplf.config
10
eplf.config
@ -1,7 +1,7 @@
|
||||
electrons
|
||||
elec_alpha_num integer
|
||||
elec_beta_num integer
|
||||
elec_num integer = electrons_elec_alpha_num + electrons_elec_beta_num
|
||||
elec_num integer
|
||||
|
||||
nuclei
|
||||
nucl_num integer
|
||||
@ -18,7 +18,7 @@ ao_basis
|
||||
ao_prim_num integer (ao_basis_ao_num)
|
||||
ao_nucl integer (ao_basis_ao_num)
|
||||
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_expo real (ao_basis_ao_num,ao_basis_ao_prim_num_max)
|
||||
|
||||
@ -26,9 +26,9 @@ mo_basis
|
||||
mo_tot_num integer
|
||||
mo_coef real (ao_basis_ao_num,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_active_num integer =n_count_ch(mo_basis_mo_classif,size(mo_basis_mo_classif),'a')
|
||||
mo_virtual_num integer =n_count_ch(mo_basis_mo_classif,size(mo_basis_mo_classif),'v')
|
||||
mo_closed_num integer
|
||||
mo_active_num integer
|
||||
mo_virtual_num integer
|
||||
mo_energy real (mo_basis_mo_tot_num)
|
||||
mo_occ real (mo_basis_mo_tot_num)
|
||||
|
||||
|
@ -2,3 +2,4 @@ IRPF90 = @IRPF90@
|
||||
FC = @FC@
|
||||
FCFLAGS= @FCFLAGS@
|
||||
LIB = @LIB@
|
||||
export FC FCFLAGS IRPF90
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from math import *
|
||||
|
||||
@ -25,7 +25,7 @@ class Cleaner(object):
|
||||
def action(self):
|
||||
raise TypeError
|
||||
def clean(self):
|
||||
print "Removing "+self.name
|
||||
print("Removing "+self.name)
|
||||
self.action()
|
||||
|
||||
class GridDataCleaner(Cleaner):
|
||||
@ -40,7 +40,7 @@ class AllCleaner(Cleaner):
|
||||
def clear(x,inp):
|
||||
d = { "all": AllCleaner,
|
||||
}
|
||||
if x in d.keys():
|
||||
if x in list(d.keys()):
|
||||
type = d[x]
|
||||
else:
|
||||
type = GridDataCleaner
|
||||
@ -58,7 +58,7 @@ class Editor(object):
|
||||
def action(self):
|
||||
raise TypeError
|
||||
def edit(self):
|
||||
print "Editing "+self.name
|
||||
print("Editing "+self.name)
|
||||
self.action()
|
||||
|
||||
class GeometryEditor(Editor):
|
||||
@ -68,26 +68,26 @@ class GeometryEditor(Editor):
|
||||
edit_temp_file(self.inp,self.write_geom_file,self.read_geom_file)
|
||||
|
||||
def write_geom_file(self,file,inp):
|
||||
print >>file, "###########################"
|
||||
print >>file, "# Geometry : %s"%(inp.name)
|
||||
print >>file, "###########################"
|
||||
print >>file, ""
|
||||
print("###########################", file=file)
|
||||
print("# Geometry : %s"%(inp.name), file=file)
|
||||
print("###########################", file=file)
|
||||
print("", file=file)
|
||||
fields = "Charge X Y Z"
|
||||
format = "%10.1f "+"%10.6f "*3
|
||||
fields = fields.split()
|
||||
print >>file, " ".join(["#"]+map(lambda x: x.center(10),fields))
|
||||
print >>file, "# "+"-"*11*len(fields)+"\n"
|
||||
print(" ".join(["#"]+[x.center(10) for x in fields]), file=file)
|
||||
print("# "+"-"*11*len(fields)+"\n", file=file)
|
||||
charge = self.charge
|
||||
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] ]
|
||||
print >>file, " "+format%tuple(buffer)
|
||||
print(" "+format%tuple(buffer), file=file)
|
||||
|
||||
def read_geom_file(self,file,inp):
|
||||
lines = file.readlines()
|
||||
lines = filter(lambda x: len(x.strip())>0,lines)
|
||||
lines = filter(lambda x: not x.startswith("#"),lines)
|
||||
lines = map(lambda x: x.split(),lines)
|
||||
lines = [x for x in lines if len(x.strip())>0]
|
||||
lines = [x for x in lines if not x.startswith("#")]
|
||||
lines = [x.split() for x in lines]
|
||||
coord = [ [], [], [] ]
|
||||
charge = []
|
||||
for line in lines:
|
||||
@ -106,42 +106,42 @@ class GridEditor(Editor):
|
||||
edit_temp_file(self.inp,self.write_grid_file,self.read_grid_file)
|
||||
|
||||
def write_grid_file(self,file,inp):
|
||||
print >>file, "###########################"
|
||||
print >>file, "# Grid : %s"%(inp.name)
|
||||
print >>file, "###########################"
|
||||
print >>file, ""
|
||||
print >>file, "# Number of points along x, y, z"
|
||||
print("###########################", file=file)
|
||||
print("# Grid : %s"%(inp.name), file=file)
|
||||
print("###########################", file=file)
|
||||
print("", file=file)
|
||||
print("# Number of points along x, y, z", file=file)
|
||||
if self.point_num is None:
|
||||
print >>file, "Default"
|
||||
print("Default", file=file)
|
||||
else:
|
||||
print >>file, "%d %d %d"%tuple(self.point_num)
|
||||
print >>file, ""
|
||||
print >>file, "# Coordinates of the origin (x,y,z)"
|
||||
print("%d %d %d"%tuple(self.point_num), file=file)
|
||||
print("", file=file)
|
||||
print("# Coordinates of the origin (x,y,z)", file=file)
|
||||
if self.origin is None:
|
||||
print >>file, "Default"
|
||||
print("Default", file=file)
|
||||
else:
|
||||
print >>file, "%f %f %f"%tuple(self.origin)
|
||||
print >>file, ""
|
||||
print >>file, "# Coordinates of the opposite point (x,y,z)"
|
||||
print("%f %f %f"%tuple(self.origin), file=file)
|
||||
print("", file=file)
|
||||
print("# Coordinates of the opposite point (x,y,z)", file=file)
|
||||
if self.opposite is None:
|
||||
print >>file, "Default"
|
||||
print("Default", file=file)
|
||||
else:
|
||||
print >>file, "%f %f %f"%tuple(self.opposite)
|
||||
print >>file, ""
|
||||
print >>file, "# Step sizes (x,y,z)"
|
||||
print("%f %f %f"%tuple(self.opposite), file=file)
|
||||
print("", file=file)
|
||||
print("# Step sizes (x,y,z)", file=file)
|
||||
if self.step_size is None:
|
||||
print >>file, "Default"
|
||||
print("Default", file=file)
|
||||
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):
|
||||
lines = file.readlines()
|
||||
lines = filter(lambda x: len(x.strip())>0,lines)
|
||||
lines = filter(lambda x: not x.startswith("#"),lines)
|
||||
lines = [x for x in lines if len(x.strip())>0]
|
||||
lines = [x for x in lines if not x.startswith("#")]
|
||||
|
||||
buffer = lines.pop(0).lower().split()
|
||||
if buffer[0] != "default":
|
||||
self.inp.point_num = map(int,buffer)
|
||||
self.inp.point_num = list(map(int,buffer))
|
||||
else:
|
||||
try:
|
||||
os.remove("%s/grid/point_num.gz"%self.inp.name)
|
||||
@ -150,7 +150,7 @@ class GridEditor(Editor):
|
||||
|
||||
buffer = lines.pop(0).lower().split()
|
||||
if buffer[0] != "default":
|
||||
self.inp.origin = map(float,buffer)
|
||||
self.inp.origin = list(map(float,buffer))
|
||||
else:
|
||||
try:
|
||||
os.remove("%s/grid/origin.gz"%self.inp.name)
|
||||
@ -159,7 +159,7 @@ class GridEditor(Editor):
|
||||
|
||||
buffer = lines.pop(0).lower().split()
|
||||
if buffer[0] != "default":
|
||||
self.inp.opposite = map(float,buffer)
|
||||
self.inp.opposite = list(map(float,buffer))
|
||||
else:
|
||||
try:
|
||||
os.remove("%s/grid/opposite.gz"%self.inp.name)
|
||||
@ -187,31 +187,31 @@ def edit(x,inp):
|
||||
#############################
|
||||
|
||||
def write_main_file(file,inp):
|
||||
print >>file, "####################"
|
||||
print >>file, "# %s"%(inp.name)
|
||||
print >>file, "####################"
|
||||
print >>file, ""
|
||||
compute = filter(lambda x: x.startswith("compute"),rw_data)
|
||||
print >>file, "# Clear"
|
||||
print >>file, "# --------------------\n"
|
||||
print >>file, '# clear(all)'
|
||||
print("####################", file=file)
|
||||
print("# %s"%(inp.name), file=file)
|
||||
print("####################", file=file)
|
||||
print("", file=file)
|
||||
compute = [x for x in rw_data if x.startswith("compute")]
|
||||
print("# Clear", file=file)
|
||||
print("# --------------------\n", file=file)
|
||||
print('# clear(all)', file=file)
|
||||
for p in compute:
|
||||
print >>file, '# clear(%s)'%(p[8:])
|
||||
print >>file, ""
|
||||
print >>file, "# Computation"
|
||||
print >>file, "# --------------------\n"
|
||||
print >>file, "nproc = %d"%(inp.nproc)
|
||||
print >>file, ""
|
||||
print('# clear(%s)'%(p[8:]), file=file)
|
||||
print("", file=file)
|
||||
print("# Computation", file=file)
|
||||
print("# --------------------\n", file=file)
|
||||
print("nproc = %d"%(inp.nproc), file=file)
|
||||
print("", file=file)
|
||||
for p in compute:
|
||||
x = ' '
|
||||
exec "if inp.%s: x = 'X'"%(p)
|
||||
print >>file, "(%s) %s"%(x,p[8:])
|
||||
print >>file, ""
|
||||
print >>file, "# Edit"
|
||||
print >>file, "# --------------------\n"
|
||||
print >>file, '# edit(geometry)'
|
||||
print >>file, '# edit(grid_parameters)'
|
||||
print >>file, ""
|
||||
exec("if inp.%s: x = 'X'"%(p))
|
||||
print("(%s) %s"%(x,p[8:]), file=file)
|
||||
print("", file=file)
|
||||
print("# Edit", file=file)
|
||||
print("# --------------------\n", file=file)
|
||||
print('# edit(geometry)', file=file)
|
||||
print('# edit(grid_parameters)', file=file)
|
||||
print("", file=file)
|
||||
|
||||
|
||||
## Execute temporary input file
|
||||
@ -235,7 +235,7 @@ def read_main_file(file,inp):
|
||||
line = line.replace("(","('").replace(")","',inp)").lower()
|
||||
else:
|
||||
line = "inp."+line
|
||||
exec line
|
||||
exec(line)
|
||||
|
||||
|
||||
def edit_temp_file(input_file,write_file,read_file,saved_file=None):
|
||||
@ -282,14 +282,14 @@ $RUNCOMMAND
|
||||
else:
|
||||
command = "${EPLF_MPIRUN} -np %d "%(inp.nproc)+command
|
||||
buffer = buffer.replace("$RUNCOMMAND",command)
|
||||
print >>file, buffer
|
||||
print(buffer, file=file)
|
||||
file.close()
|
||||
os.chmod(run_script,0744)
|
||||
os.chmod(run_script,0o744)
|
||||
|
||||
|
||||
def main():
|
||||
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)
|
||||
inp = InputFile(sys.argv[1])
|
||||
if len(sys.argv) == 3:
|
||||
|
@ -361,10 +361,10 @@ class InputFile(object):
|
||||
|
||||
# Build the corresponding properties
|
||||
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:
|
||||
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:
|
||||
det_thr=float(sys.argv[2])
|
||||
else:
|
||||
print "usage: "+sys.argv[0]+" file.out det_threshold"
|
||||
print("usage: "+sys.argv[0]+" file.out det_threshold")
|
||||
sys.exit(2)
|
||||
|
||||
def reduce_dets():
|
||||
ezfio.set_file(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
|
||||
norm = sum( map(lambda x: x*x,coef) )
|
||||
print "Norm of the initial wave function: ", sqrt(norm)
|
||||
norm = sum( [x*x for x in coef] )
|
||||
print("Norm of the initial wave function: ", sqrt(norm))
|
||||
dets_a, dets_b = ezfio.determinants_det_occ
|
||||
|
||||
to_remove = []
|
||||
@ -37,9 +37,9 @@ def reduce_dets():
|
||||
coef.pop(i)
|
||||
dets_a.pop(i)
|
||||
dets_b.pop(i)
|
||||
print "New number of determinants: ", len(coef)
|
||||
norm = sum( map(lambda x: x*x,coef) )
|
||||
print "Norm of the new wave function: ", sqrt(norm)
|
||||
print("New number of determinants: ", len(coef))
|
||||
norm = sum( [x*x for x in coef] )
|
||||
print("Norm of the new wave function: ", sqrt(norm))
|
||||
ezfio.determinants_det_num = len(coef)
|
||||
ezfio.determinants_det_coef = coef
|
||||
ezfio.determinants_det_occ = dets_a+dets_b
|
||||
|
@ -8,7 +8,7 @@ import common
|
||||
try:
|
||||
x, filename, grid_type = sys.argv
|
||||
except ValueError:
|
||||
print "usage: "+sys.argv[0]+" filename grid_type"
|
||||
print("usage: "+sys.argv[0]+" filename grid_type")
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
@ -17,28 +17,28 @@ from ezfio import ezfio
|
||||
def main():
|
||||
ezfio.set_file(filename)
|
||||
file = open("%s_%s.cube"%(filename,grid_type),"w")
|
||||
print >>file, " Cube File"
|
||||
print >>file, filename, grid_type
|
||||
print(" Cube File", file=file)
|
||||
print(filename, grid_type, file=file)
|
||||
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. ]
|
||||
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. ]
|
||||
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] ]
|
||||
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
|
||||
coord = ezfio.nuclei_nucl_coord
|
||||
for i in range(ezfio.nuclei_nucl_num):
|
||||
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)
|
||||
for i in xrange(0,ezfio.grid_num_x):
|
||||
for j in xrange(0,ezfio.grid_num_y):
|
||||
for k in xrange(0,ezfio.grid_num_z,6):
|
||||
for l in xrange(k,min(ezfio.grid_num_z,k+6)):
|
||||
for i in range(0,ezfio.grid_num_x):
|
||||
for j in range(0,ezfio.grid_num_y):
|
||||
for k in range(0,ezfio.grid_num_z,6):
|
||||
for l in range(k,min(ezfio.grid_num_z,k+6)):
|
||||
file.write (" %12.5E"%data[l][j][i])
|
||||
file.write ("\n")
|
||||
file.close()
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import common
|
||||
import sys,os,time
|
||||
from functools import reduce
|
||||
|
||||
sys.path = [ "/home/scemama/resultsFile" ]+sys.path
|
||||
from resultsFile import *
|
||||
|
||||
# Check command line
|
||||
@ -14,14 +14,14 @@ if len(sys.argv) == 2:
|
||||
elif len(sys.argv) == 3:
|
||||
State=int(sys.argv[2])
|
||||
else:
|
||||
print "usage: "+sys.argv[0]+" file.out"
|
||||
print("usage: "+sys.argv[0]+" file.out")
|
||||
sys.exit(2)
|
||||
|
||||
firstArg = sys.argv[1]
|
||||
|
||||
file = getFile(firstArg)
|
||||
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
|
||||
|
||||
@ -31,6 +31,7 @@ def write_ezfioFile(res,filename):
|
||||
# Electrons
|
||||
ezfio.electrons_elec_alpha_num = res.num_alpha
|
||||
ezfio.electrons_elec_beta_num = res.num_beta
|
||||
ezfio.electrons_elec_num = res.num_beta + res.num_alpha
|
||||
|
||||
# Nuclei
|
||||
ezfio.nuclei_nucl_num = len(res.geometry)
|
||||
@ -70,16 +71,17 @@ def write_ezfioFile(res,filename):
|
||||
at.append(i+1)
|
||||
num_prim.append(len(b.prim))
|
||||
s = b.sym
|
||||
power_x.append( string.count(s,"x") )
|
||||
power_y.append( string.count(s,"y") )
|
||||
power_z.append( string.count(s,"z") )
|
||||
power_x.append( s.count("x") )
|
||||
power_y.append( s.count("y") )
|
||||
power_z.append( s.count("z") )
|
||||
coefficient.append( b.coef )
|
||||
exponent.append( [ p.expo for p in b.prim ] )
|
||||
ezfio.ao_basis_ao_num = len(res.basis)
|
||||
ezfio.ao_basis_ao_nucl = at
|
||||
ezfio.ao_basis_ao_prim_num = num_prim
|
||||
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)
|
||||
for i in range(len(res.basis)):
|
||||
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,[])
|
||||
|
||||
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:
|
||||
for i in xrange(len(coef),0,-1):
|
||||
for i in range(len(coef),0,-1):
|
||||
i -= 1
|
||||
if abs(coef[i]) < det_thr :
|
||||
dets_a.pop(i)
|
||||
@ -183,7 +189,7 @@ def write_ezfioFile(res,filename):
|
||||
|
||||
ezfio.compute_eplf = True
|
||||
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():
|
||||
|
Loading…
Reference in New Issue
Block a user