Commit 5acf6d1b authored by Anthony Stone's avatar Anthony Stone
Browse files

Various changes -- see ChangeLog

parent 943fbbae
2020-02-14 Anthony Stone <>
* bin/update_public_repo:
The distributed version now has the same organisation as the main
site, with executables in <arch>/<compiler> directories, so that
users of the source code can just add the source directory and run
* bin/
Minor changes.
2020-02-12 AJM BUG FIX in (Psi4 interface)
* interfaces/psi4/ BUG FIXES: Firstly, the use of fixed format reading
of data from lines containing I and N= (data lines, mainly at start) led to errors
for large systems with large basis sets. This has been fixed though the read is still
done with fixed format (i.e., particular ranges of the line are read into the
data variables) so it is fragile and needs to be completely re-written. Additionally,
when the basis space is truncated (large systems with large basis sets) then there
was an error writing out the energies and MO coefficients. FIXED.
*** Thanks to Devin Mulvey from Ken Jodran's group for spotting this.
2020-02-09 AJM IMPORTANT VERSION 6.0.050
Energy-Scan and Overlap-Model made to work with molecules with off-atomic
CamCASP version 6.0
Alston Misquitta and Anthony Stone
Alston Misquitta and Anthony Stone
Instructions for obtaining and installing the CamCASP program
1. CamCASP is now available from The recommended procedure
is to change to a suitable directory and run the command, e.g.
git clone camcasp-6.0
git clone camcasp-6.0
which will clone the code into a new camcasp-6.0 subdirectory.
If you require the version for Mac OS, the command is slightly
git clone \
--branch CamCASP-6.0-macos camcasp-6.0
git clone --branch CamCASP-6.0-macos camcasp-6.0
2. It is no longer necessary to apply for a licence to use CamCASP,
but your use of the program is subject to the licence that is to be
......@@ -31,27 +30,28 @@ Instructions for obtaining and installing the CamCASP program
Again, this is most conveniently done in your startup directory.
5. CamCASP needs at least one of the SCF codes Dalton or NWChem or
Psi4. For each of these that you wish to use, provide either a
symbolic link dalton or nwchem or psi4 in the CamCASP/bin directory
Psi4. For each of these that you wish to use, provide either
a symbolic link dalton or nwchem or psi4 in the CamCASP/bin directory
that points to the corresponding executable, or a shell script or or There are example files
CamCASP/bin/ etc. that explain what is needed. or or that can be executed to invoke
the program. There are example files CamCASP/bin/
etc. that explain what is needed.
6. Run the command
6. Run the command
(You will need Python, version 3.6 or later, for this and other
CamCASP scripts.) This script will ask for information about the
SCF codes that you have installed. CamCASP needs at least one of
the SCF codes Dalton or NWChem or Psi4. It will also ask for
SCF codes that you have installed. It will also ask for
information about the Orient program, which is needed for some
CamCASP procedures. Orient is also available from; see for details.
`http://gitlab/anthonyjs/orient/-/wikis/home` for details.
The script can be run again at any time, if for example
you install another SCF program.
7. Run the tests in the CamCASP/tests directory. See the README in
that directory for details.
that directory for details, or run --help
Once all this is done, you are ready to submit CamCASP jobs. See the
User's Guide, in $CAMCASP/doc/users_guide.pdf, for full details. There
......@@ -59,174 +59,10 @@ are several examples in $CAMCASP/examples that you can use as tests of
the program and as examples for your own calculations.
Installation from source:
Additional authorisation is required to download and use the source
version. Consult Alton Misquitta, for further
CamCASP uses BLAS and LAPACK libraries which you will
need to provide. Possibilities are:
1) MKL
2) OpenBLAS
We used to not recommend the MKL libraries as these were known to exhibit
memory leaks for large systems that were very difficult to trace. However recent
versions of MKL have been fast and reliable.
An alternative to MKL are the OpenBLAS libraries. These can be obtained from GitHub:
git clone
Building them is fast and easy and we highly recommend these libraries. They are
hand-coded and optimised for a large number of processors. Best check that your processor
is supported before using it. Also note that the built libraries are processor
specific, so they are not portable!
The ALTAS libraries ( reliable but they need to be
built from source to have the best performance on your machine. The system ATLAS libraries
cannot normally be expected to be optimum for all processors.
Note that you will need to build the entire LAPACK library using instructions provided at
Here are the contents of the last page:
Building a full LAPACK library using ATLAS and netlib's LAPACK
ATLAS natively provides only a relative handful of the routines which comprise LAPACK.
However, ATLAS is designed so that its routines can easily be added to
netlib's standard LAPACK in order to get a full LAPACK library.
If you want your final libraries to have all the LAPACK routines,
then you just need to pass the -with-netlib-lapack-tarfile flag to configure,
along with the netlib tarfile that you have previously downloaded.
For instance, assuming you have previously downloaded the lapack tarfile to
/home/whaley/dload/lapack-3.4.1.tgz, you would add the following to your configure flags:
Configure then auto-builds a for LAPACK to use,
and builds netlib LAPACK as part of the ATLAS install process.
ATLAS 3.10.0 was tested tow work with LAPACK v3.4.1 and 3.3.1.
Files to edit:
For a normal build you should need to edit only the file <ARCH>/<COMPILER>/exe/Flags
* ARCH : osx, x86-32, x86-64
* COMPILER : ifort, gfortran, pgf90 (not tested pgf90)
On a Linux machine: ARCH=x86-64
On OSX: ARCH=osx
Windows is not supported, but you should be able to get the code to work with
some effort.
We recommend one of the ifort or gfortran compilers. ifort tends to be faster.
For an AMD machine gfortran or AMD's own AOCC variant (
may be more suitable than gfortran but we have not yet tested this compiler suite.
The Flags file sets various compiler options that you may adjust, and it also
allows you to specify the location of the BLAS/LAPACK libraries for each MACHINE
as follows:
ifeq ($(MACHINE),comanche)
-xSSE4.2 -arch=SSE4.2 -msse4.2 -funroll-loops -opt-matmul
-xSSE4.2 -arch=SSE4.2 -msse4.2 -funroll-loops -opt-matmul
LIBS := -L/home/alston/lib/atlas-3.8.4-gcc4.4.6/lib -llapack -lcblas -lf77blas -latlas \
-L/usr/lib64/ -lgfortran
In this example we have defined the compilation flags relevant for the Intel ifort compiler
in FFLAGS (used for almost all the compilation) and FFLAGS2 (used for special cases).
These will normally be the same.
We have also defined LIBS to point to the ATLAS libraries. As these flags were meant for
the ifort compiler and as ATLAS was compiled using gfortran, we have additionally
specified the location of libgfortran.a
Here MACHINE is an environment variable that is defined in the make process.
Here is an example for the gfortran compiler with OpenBLAS:
ifeq ($(MACHINE),pepito)
LIBDIRS := -L/home/alston/install/lib/
LIBS := -lopenblas \
-L/usr/lib/gcc/x86_64-linux-gnu/7/ -lgfortran \
-lm -ldl -lgfortran -lquadmath -lpthread
For OpenBLAS only -lopenblas need be supplied. If the library is not on the system
library path then the path may need to be supplied using LIBDIRS as shown above.
If OpenBLAS was built with gfortran then you will also need to supply the libraries
listed above. -lpthread is needed for running threaded versions of the library.
Building the code:
Once the flags are defined, you should be able to build the code using:
$ make COMPILER=ifort MACHINE=comanche NAME=camcasp
Here we have specified the compiler, machine and the name of the code to be
built. Options for NAME are:
* camcasp : the main CamCASP code
* cluser
* process
* pfit
* casimir
A simple top-level build code `makeall' is provided to help with this step. Edit it
as needed and execute to build.
Building the interfaces:
The interface programs are located in interfaces/ where we have provided
interfaces to
* NWChem
Each of these must be built. There is a Makefile present for each interface.
You may need to edit these Makefiles. Build them using:
$ make
NOTE: Debug mode
To compile binaries with compiler-level debug flags switched on you have two options:
either simply edit the Flags files to include the debugging flags specific to your
compiler and then re-build, or follow these steps to build the debug version in a
separate directory:
1) First edit the file <ARCH>/<COMPILER>/debug/Flags. Use the instructions given
above. Additional debug flags are provided in the example Flags files.
2) Build the code using
$ make COMPILER=ifort MACHINE=comanche DEBUG=yes NAME=camcasp
End Installation from source
Setup the installation
Next, you will need to run
$ cd bin/
$ ./
Follow the instructions.
Note: You will need to have one of NWChem, DALTON or GAMESS(US) installed.
It would be a good idea to have installed Orient too.
Add the CAMCASP bin directory to your path, e.g. using
$ export PATH=$CAMCASP/bin:$PATH
This is most conveniently done by including the definition to your .bashrc
or .bash_profile files.
Test the installation:
Now test the installation using:
$ bin/ arguments
To see how to use this code use:
$ bin/ --help
All the best!
version. Consult Alton Misquitta,, for further
information, and see INSTALL_SRC for installation details.
......@@ -33,7 +33,11 @@ different:
--branch CamCASP-6.0-macos camcasp6.0
See the User's Guide in the docs directory for further instructions.
See the
file for installation instructions.
See the User's Guide in the docs directory for detailed instructions
on using the program.
Some directory information:
......@@ -55,7 +55,7 @@ global archs, compilers
archs = ["x86-64", "osx"]
compilers = {}
compilers["x86-64"] = ["pgf90", "gfortran", "ifort"]
compilers["x86-64"] = ["gfortran", "ifort"]
compilers["osx"] = ["gfortran"]
scflist = ["dalton","dalton2006","nwchem","psi4"]
installed = {}
......@@ -109,6 +109,24 @@ def base ():
if os.path.join(camcasp,"bin") not in paths:
print(f"{os.path.join(camcasp,'bin')} should be in your PATH")
Before proceeding, please ensure that for each SCF code that you wish to
use (any or all of dalton, dalton2006, nwchem, psi4), either
(i) the directory containing the executable is in your PATH, or
(ii) there is a symbolic link dalton or dalton2006 or nwchem or psi4 in
$CAMCASP/bin to the executable, or
(iii) there is a shell script or or in
$CAMCASP/bin that can be invoked to execute the program.
(See or in $CAMCASP/bin.)
Also ensure that either (i) or (ii) is satisfied for the Orient program.
q = input("Are you ready to proceed? [Yn] ")
if q in ["Y", "y", ""]:
print("Please rerun when you are ready.")
def architecture():
"""Find the machine operating system."""
arch = os.environ.get("ARCH")
......@@ -138,7 +156,10 @@ def architecture():
def binaries(arch):
"""Find the binaries."""
global compilers
compiler = ""
if arch == "osx":
compiler = "gfortran"
compiler = "gfortran,ifort"
ok = False
while not ok:
string = input(f"\nFind binaries from compiler (RETURN to skip this step) [{compiler}]: ")
......@@ -183,6 +204,7 @@ def binaries(arch):
def verify():
"""Verify execution arrangements for scfcodes etc."""
installed = {}
for name in ["dalton","dalton2006","nwchem","psi4","orient","sapt"]:
q = input(f"\nIs the {name} program installed [yN]? ")
......@@ -153,6 +153,10 @@ if verbose:
print("Sites and sitetypes follow: {} ".format(len(site)))
for i in range(len(site)):
print(" site = {} sitetype = {} ".format(site[i], sitetype[i]))
# AJM : This parser needs to be changed. It is fragile and very sensitive to
# formatting of the FCHK file. Either we use reg-exps or pyparsing to
# parse the lines.
# Now read the fchk file
nobeta = 0
......@@ -170,7 +174,7 @@ with open(args.fchk) as IN:
ff = 0.0
nn = 0
if type == "I" or ww == "N=":
nn = int(line[55:61])
nn = int(line[50:61])
elif type == "R":
ff = float(line[48:])
if ww == "N=":
......@@ -203,6 +207,10 @@ with open(args.fchk) as IN:
nbasis = nn
if verbose:
print "{:1d} basis functions".format(nbasis)
elif text == "Number of independent functions":
n_independent_functions = nn
if verbose:
print "{:1d} independent functions".format(n_independent_functions)
elif text == "Number of contracted shells":
nshell = nn
if verbose:
......@@ -314,9 +322,13 @@ with open(args.fchk) as IN:
ealpha = getfloat(nn)
# If this is a closed-shell system, only the Alpha energies will be
# given in the fchk file.
if verbose:
print "{:1d} Alpha Orbital Energies (not printing them)".format(noalpha)
elif text == "Beta Orbital Energies":
nobeta = nn
ebeta = getfloat(nn)
if verbose:
print "{:1d} Beta Orbital Energies (not printing them)".format(nobeta)
elif text == "orbital energies":
# Needed for Psi4 1.2
noalpha = nn
......@@ -326,6 +338,7 @@ with open(args.fchk) as IN:
elif text == "Alpha MO coefficients":
if nn != nbasis*noalpha:
print "Inconsistency in number of alpha coefficients"
print " nbasis = {:1d} noalpha = {:1d} num MO coeffs = {:1d}".format(nbasis,noalpha,nn)
alphamo = []
for j in range(noalpha):
......@@ -457,7 +470,10 @@ Energies {:<6d}
start += 5
for i in range(nbasis):
# Dimensions:
# ealpha[noalpha]
# movecs[noalpha,nbasis]
for i in range(noalpha):
V.write("\nMO {:1d} Energy {:16.8e}\n".format(i+1,ealpha[i]))
start = 0
while start < nbasis:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment