forked from comp-chem/NWChem-C
Moved from C++ to C. Updated Python files.
This commit is contained in:
parent
02608cf25a
commit
8663962fcf
7 changed files with 270 additions and 149 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -1,3 +1,8 @@
|
||||||
|
.vscode
|
||||||
|
bin/
|
||||||
|
build/
|
||||||
|
include/
|
||||||
|
lib/
|
||||||
|
|
||||||
### C ###
|
### C ###
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
|
|
@ -19,7 +24,6 @@
|
||||||
*.gch
|
*.gch
|
||||||
*.pch
|
*.pch
|
||||||
|
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
*.dll
|
*.dll
|
||||||
*.so
|
*.so
|
||||||
|
|
@ -89,6 +93,7 @@ ehthumbs_vista.db
|
||||||
|
|
||||||
# Folder config file
|
# Folder config file
|
||||||
Desktop.ini
|
Desktop.ini
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
# Recycle Bin used on file shares
|
# Recycle Bin used on file shares
|
||||||
$RECYCLE.BIN/
|
$RECYCLE.BIN/
|
||||||
|
|
|
||||||
71
src/basis/getlibr.py
Normal file → Executable file
71
src/basis/getlibr.py
Normal file → Executable file
|
|
@ -1,26 +1,35 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/python3
|
||||||
# This script downloads the basis set library data from www.basissetexchange.org
|
# This script downloads the basis set library data from www.basissetexchange.org
|
||||||
# into the directory $NWCHEM_TOP/src/basis/libraries.bse
|
# into the directory $NWCHEM_TOP/src/basis/libraries.bse
|
||||||
# to use, set the env. variable NWCHEM_BASIS_LIBRARY=$NWCHEM_TOP/src/basis/libraries.bse/
|
# To run, cd $NWCHEM_TOP/src/basis/libraries.bse/ && ../getlibr.py
|
||||||
|
# this will update the content of $NWCHEM_TOP/src/basis/libraries.bse
|
||||||
|
# To use the updates library, set the env. variable NWCHEM_BASIS_LIBRARY=$NWCHEM_TOP/src/basis/libraries.bse/
|
||||||
# Requires the installation of the python env. from
|
# Requires the installation of the python env. from
|
||||||
# https://github.com/MolSSI-BSE/basis_set_exchange
|
# https://github.com/MolSSI-BSE/basis_set_exchange
|
||||||
|
# e.g. python3 -m pip install --user basis_set_exchange
|
||||||
# See https://molssi-bse.github.io/basis_set_exchange/
|
# See https://molssi-bse.github.io/basis_set_exchange/
|
||||||
#
|
#
|
||||||
# names changed
|
# names changed
|
||||||
# def2-universal-jfit was weigend_coulomb_fitting
|
# def2-universal-jfit was weigend_coulomb_fitting
|
||||||
# dgauss-a1-dftjfit was dgauss_a1_dft_coulomb_fitting
|
# dgauss-a1-dftjfit was dgauss_a1_dft_coulomb_fitting
|
||||||
# dgauss-a2-dftjfit was dgauss_a2_dft_coulomb_fitting
|
# dgauss-a2-dftjfit was dgauss_a2_dft_coulomb_fitting
|
||||||
#
|
|
||||||
import basis_set_exchange as bse
|
import basis_set_exchange as bse
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
today = datetime.now().isoformat(timespec='minutes')
|
today = datetime.now().isoformat(timespec='minutes')
|
||||||
print(today)
|
print(today)
|
||||||
all_bs = bse.get_all_basis_names()
|
all_bs = bse.get_all_basis_names()
|
||||||
md = bse.get_metadata()
|
md = bse.get_metadata()
|
||||||
for bas_name in all_bs:
|
summary_file = open('summary.txt','w')
|
||||||
#get version and list of elements
|
|
||||||
version_bs = md[bas_name]['latest_version']
|
def writebs(md, bas_name, summary_file, get_aux=0):
|
||||||
elements_list = md[bas_name]['versions'][version_bs]['elements']
|
md_bas_name = bas_name.lower()
|
||||||
|
md_bas_name = md_bas_name.replace("*","_st_")
|
||||||
|
md_bas_name = md_bas_name.replace("/","_sl_")
|
||||||
|
print(' md_bas_name '+md_bas_name+"\n")
|
||||||
|
print(' bas_name '+bas_name+"\n")
|
||||||
|
version_bs = md[md_bas_name]['latest_version']
|
||||||
|
elements_list = md[md_bas_name]['versions'][version_bs]['elements']
|
||||||
#open file
|
#open file
|
||||||
# get rid of asterisks
|
# get rid of asterisks
|
||||||
file_name = bas_name.replace("*","s")
|
file_name = bas_name.replace("*","s")
|
||||||
|
|
@ -33,19 +42,38 @@ for bas_name in all_bs:
|
||||||
file_name = file_name.replace(" ","_")
|
file_name = file_name.replace(" ","_")
|
||||||
#replace forward slash with underscore
|
#replace forward slash with underscore
|
||||||
file_name = file_name.replace("/","_")
|
file_name = file_name.replace("/","_")
|
||||||
|
#lowercase
|
||||||
|
file_name = file_name.lower()
|
||||||
|
if get_aux==1:
|
||||||
|
file_name = file_name + "-autoaux"
|
||||||
print(' file name is '+file_name+"\n")
|
print(' file name is '+file_name+"\n")
|
||||||
output_file = open(file_name,'w')
|
output_file = open(file_name,'w')
|
||||||
output_file.write('# BSE Version '+bse.version()+'\n')
|
output_file.write('# BSE Version '+bse.version()+'\n')
|
||||||
output_file.write('# Data downloaded at '+today+'\n')
|
output_file.write('# Data downloaded on '+today+'\n')
|
||||||
output_file.write('# '+bas_name+' version number '+version_bs+'\n')
|
|
||||||
output_file.write('# Description: '+md[bas_name]['description']+'\n')
|
if get_aux==0:
|
||||||
output_file.write('# Role: '+md[bas_name]['role']+'\n')
|
output_file.write('# '+bas_name+' version number '+version_bs+'\n')
|
||||||
output_file.write('# '+bse.get_references(bas_name,fmt='txt').replace('\n','\n# '))
|
output_file.write('# Description: '+md[md_bas_name]['description']+'\n')
|
||||||
output_file.write('# \n')
|
output_file.write('# Role: '+md[md_bas_name]['role']+'\n')
|
||||||
|
output_file.write('# '+bse.get_references(bas_name,fmt='txt').replace('\n','\n# '))
|
||||||
|
output_file.write('# \n')
|
||||||
|
elif get_aux==1:
|
||||||
|
output_file.write('# '+bas_name+' version number '+version_bs+' AutoAux \n')
|
||||||
|
output_file.write('# Role: JK Fitting \n')
|
||||||
|
output_file.write('# Stoychev GL, Auer AA, Neese F. \n# Automatic Generation of Auxiliary Basis Sets.\n# J Chem Theory Comput. 2017 Feb 14;13(2):554-562.\n# doi: 10.1021/acs.jctc.6b01041.\n')
|
||||||
|
output_file.write('# \n')
|
||||||
|
|
||||||
|
n_elements=0
|
||||||
|
for element in elements_list:
|
||||||
|
n_elements = n_elements + 1
|
||||||
|
if get_aux==1:
|
||||||
|
summary_file.write('Basis set \"'+bas_name+'-autoaux\" (number of atoms '+str(n_elements)+')\n')
|
||||||
|
else:
|
||||||
|
summary_file.write('Basis set \"'+bas_name+'\" (number of atoms '+str(n_elements)+')\n')
|
||||||
for element in elements_list:
|
for element in elements_list:
|
||||||
#element='h'
|
#element='h'
|
||||||
try:
|
try:
|
||||||
bs_str=bse.get_basis(bas_name, header=False, elements=element, fmt='nwchem', optimize_general=True, uncontract_general=True)
|
bs_str=bse.get_basis(bas_name, header=False, elements=element, fmt='nwchem', optimize_general=True, uncontract_general=True, get_aux=get_aux)
|
||||||
except:
|
except:
|
||||||
# print("failed for"+element)
|
# print("failed for"+element)
|
||||||
pass
|
pass
|
||||||
|
|
@ -54,11 +82,22 @@ for bas_name in all_bs:
|
||||||
bs_str=bs_str.replace("END","end")
|
bs_str=bs_str.replace("END","end")
|
||||||
bs_str=bs_str.replace("PRINT","")
|
bs_str=bs_str.replace("PRINT","")
|
||||||
element_str=bse.misc.compact_elements([element])
|
element_str=bse.misc.compact_elements([element])
|
||||||
bs_str=bs_str.replace("ao basis",element_str+"_"+bas_name)
|
if get_aux==1:
|
||||||
|
bs_str=bs_str.replace("ao basis",element_str+"_"+bas_name+"-autoaux")
|
||||||
|
else:
|
||||||
|
bs_str=bs_str.replace("ao basis",element_str+"_"+bas_name)
|
||||||
#ECP
|
#ECP
|
||||||
bs_str=bs_str.replace("ECP","ecp \""+element_str+"_"+bas_name+"\"")
|
bs_str=bs_str.replace("ECP","ecp \""+element_str+"_"+bas_name+"\"")
|
||||||
output_file.write(bs_str)
|
output_file.write(bs_str)
|
||||||
#
|
#
|
||||||
print(bas_name+" "+element_str)
|
print(bas_name+" "+element_str)
|
||||||
print("end")
|
return
|
||||||
|
|
||||||
|
for bas_name in all_bs:
|
||||||
|
md_bas_name = bas_name.lower()
|
||||||
|
md_bas_name = md_bas_name.replace("*","_st_")
|
||||||
|
md_bas_name = md_bas_name.replace("/","_sl_")
|
||||||
|
writebs(md, bas_name, summary_file)
|
||||||
|
if md[md_bas_name]['role'] == 'orbital':
|
||||||
|
writebs(md, bas_name, summary_file, get_aux=1)
|
||||||
|
print("end")
|
||||||
|
|
@ -265,7 +265,7 @@ int main(){
|
||||||
errquit('start: rtdb_open old failed', 0, RTDB_ERR);
|
errquit('start: rtdb_open old failed', 0, RTDB_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// initialize nxtask
|
// initialize nxtask
|
||||||
nxtask_init(rtdb);
|
nxtask_init(rtdb);
|
||||||
|
|
@ -344,7 +344,7 @@ int main(){
|
||||||
errquit('control: rtdb_print failed', 0, RTDB_ERR);
|
errquit('control: rtdb_print failed', 0, RTDB_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rtdb_close(rtdb, 'keep')){
|
if (!rtdb_close(rtdb, 'keep')){
|
||||||
errquit('nwchem: rtdb_close failed', rtdb, RTDB_ERR);
|
errquit('nwchem: rtdb_close failed', rtdb, RTDB_ERR);
|
||||||
}
|
}
|
||||||
|
|
@ -372,7 +372,7 @@ int main(){
|
||||||
ga_print_stats();
|
ga_print_stats();
|
||||||
write(LuOut,*);
|
write(LuOut,*);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
288
src/rtdb/rtdb.h
288
src/rtdb/rtdb.h
|
|
@ -1,105 +1,183 @@
|
||||||
//
|
#ifndef _RTDB_H
|
||||||
// Header file for intial FORTRAN interface to RTDB
|
#define _RTDB_H
|
||||||
// (see the C header file rtdb.h for more detail)
|
|
||||||
//
|
/*
|
||||||
// All functions return .TRUE. on success, .FALSE. on failure
|
All routines return TRUE (1) on success, FALSE (0) on failure.
|
||||||
//
|
|
||||||
// All functions are also mirrored by routines rtdb_* -> rtdb_par_*
|
int rtdb_parallel(const int mode)
|
||||||
// in which process 0 performs the operation and all other processes
|
|
||||||
// are broadcast the result of a read and discard writes.
|
Set the parallel access mode of all databases to mode and
|
||||||
//
|
return the previous setting
|
||||||
// rtdb_max_key ... an integer parameter that defines the maximum
|
|
||||||
// length of a character string key
|
|
||||||
//
|
int rtdb_open(const char *filename, const char *mode, int *handle)
|
||||||
// rtdb_max_file ... an integer parameter that defines the maximum
|
|
||||||
// length of a file name
|
Filename = path to file associated with the data base
|
||||||
//
|
mode = 'new' Open only if it does not exist already
|
||||||
//
|
'old', Open only if it does exist already
|
||||||
// logical function rtdb_parallel(mode)
|
'unknown' Create new or open existing (preserving contents)
|
||||||
// logical mode [input]
|
'empty' Create new or open existing (deleting contents)
|
||||||
//
|
'scratch' Create new or open existing (deleting contents)
|
||||||
//
|
and automatically delete upon closing. Also, items
|
||||||
// logical function rtdb_open(filename, mode, handle)
|
cached in memory are not written to disk.
|
||||||
// character *(*) filename [input]
|
|
||||||
// character *(*) mode [input]
|
handle = returns handle by which all future references to the
|
||||||
// integer handle [output]
|
data base are made
|
||||||
//
|
|
||||||
// logical function rtdb_clone(handle, suffix)
|
|
||||||
// integer handle [input]
|
|
||||||
// character*(*) suffix [input]
|
int rtdb_clone(const int handle, const char *suffix)
|
||||||
//
|
|
||||||
// logical function rtdb_close(handle, mode)
|
Copy the data base file
|
||||||
// integer handle [input]
|
|
||||||
// character*(*) mode [input]
|
handle = handle to RTDB
|
||||||
//
|
suffix
|
||||||
// logical function rtdb_put(handle, name, ma_type, nelem, array)
|
|
||||||
// integer handle [input]
|
|
||||||
// character *(*) name [input]
|
int rtdb_close(const int handle, const char *mode)
|
||||||
// integer ma_type [input]
|
|
||||||
// integer nelem [input]
|
Close the data base
|
||||||
// <ma_type>array(nelem) [input]
|
|
||||||
//
|
handle = handle to RTDB
|
||||||
// logical function rtdb_get_info(handle, name, ma_type, nelem, date)
|
mode = 'keep' Preserve the data base file to enable restart
|
||||||
// integer handle [input]
|
'delete' Delete the data base file freeing all resources
|
||||||
// character *(*) name [input]
|
|
||||||
// integer ma_type [output]
|
mode is overridden by opening the data base with
|
||||||
// integer nelem [output]
|
mode='scratch' in which instance it is always deleted
|
||||||
// character*26 date [output]
|
upon closing
|
||||||
//
|
|
||||||
// logical function rtdb_get(handle, name, ma_type, nelem, array)
|
|
||||||
// integer handle [input]
|
int rtdb_get_info(const int handle, const char *name, int *ma_type,
|
||||||
// character *(*) name [input]
|
int *nelem, char date[26])
|
||||||
// integer ma_type [input]
|
|
||||||
// integer nelem [input]
|
Get info about an entry from the data base
|
||||||
// <ma_type>array(nelem) [output]
|
|
||||||
//
|
handle = handle to RTDB
|
||||||
// logical function rtdb_ma_get(handle, name, ma_type, nelem, ma_handle)
|
name = entry name (null terminated character string)
|
||||||
// integer handle [input]
|
ma_type = returns MA type of the entry
|
||||||
// character *(*) name [input]
|
nelem = returns no. of elements of the given type
|
||||||
// integer ma_type [output]
|
date = returns date of insertion (null terminated character string)
|
||||||
// integer nelem [output]
|
|
||||||
// integer ma_handle [output]
|
|
||||||
//
|
int rtdb_put(const int handle, const char *name, const int ma_type,
|
||||||
// logical function rtdb_cput(handle, name, nelem, buf)
|
const int nelem, const void *array)
|
||||||
// integer handle [input]
|
|
||||||
// character *(*) name [input]
|
Insert an entry into the data base replacing previous entry
|
||||||
// character *(*) buf [input]
|
|
||||||
//
|
handle = handle to RTDB
|
||||||
// logical function rtdb_cget(handle, name, nelem, buf)
|
name = entry name (null terminated character string)
|
||||||
// integer handle [input]
|
ma_type = MA type of the entry
|
||||||
// character *(*) name [input]
|
nelem = no. of elements of the given type
|
||||||
// character *(*) buf [output]
|
array = data to be inserted
|
||||||
//
|
|
||||||
// logical function rtdb_print(handle, print_values)
|
|
||||||
// integer handle [input]
|
int rtdb_get(const int handle, const char *name, const int ma_type,
|
||||||
// logical print_values [input]
|
const int nelem, void *array)
|
||||||
//
|
|
||||||
// logical function rtdb_first(handle, name)
|
Get an entry from the data base
|
||||||
// integer handle [input]
|
|
||||||
// character *(*) name [output]
|
handle = handle to RTDB
|
||||||
//
|
name = entry name (null terminated character string)
|
||||||
// logical function rtdb_next(handle, name)
|
ma_type = MA type of the entry which must match entry type
|
||||||
// integer handle [input]
|
nelem = size of array in units of ma_type
|
||||||
// character *(*) name [output]
|
array = user provided buffer that returns data
|
||||||
//
|
|
||||||
// logical function rtdb_delete(handle, name)
|
|
||||||
// integer handle [input]
|
int rtdb_ma_get(const int handle, const char *name, int *ma_type,
|
||||||
// character *(*) name [input]
|
int *nelem, int *ma_handle)
|
||||||
//
|
|
||||||
bool rtdb_open, rtdb_close, rtdb_put, rtdb_get, rtdb_ma_get,
|
Get an entry from the data base returning an MA handle
|
||||||
rtdb_cput, rtdb_cget, rtdb_print, rtdb_get_info,
|
|
||||||
rtdb_first, rtdb_next, rtdb_delete, rtdb_parallel,
|
handle = handle to RTDB
|
||||||
rtdb_clone,rtdb_getfname,rtdb_cget_size;
|
name = entry name (null terminated character string)
|
||||||
//$Id$
|
ma_type = returns MA type of the entry
|
||||||
extern rtdb_open, rtdb_close, rtdb_put, rtdb_get, rtdb_ma_get,
|
nelem = returns no. of elements of type ma_type in data
|
||||||
rtdb_cput, rtdb_cget, rtdb_print, rtdb_get_info,
|
ma_handle= returns MA handle to data
|
||||||
rtdb_first, rtdb_next, rtdb_delete, rtdb_parallel,
|
|
||||||
rtdb_clone,rtdb_getfname,rtdb_cget_size;
|
|
||||||
//
|
int rtdb_first(const int handle, const int namelen, char *name)
|
||||||
// Check these values against rtdb_f2c.c
|
|
||||||
//
|
Return the name of the first (user inserted) entry in the data base.
|
||||||
const int rtdb_max_key=255;
|
The order is effectively random.
|
||||||
const int rtdb_max_file=255;
|
|
||||||
//
|
handle = handle to RTDB
|
||||||
const bool rtdb_seq_mode = false;
|
namelen = size of user provided buffer name
|
||||||
const bool rtdb_par_mode = true;
|
name = name of entry is returned in this buffer
|
||||||
|
|
||||||
|
|
||||||
|
int rtdb_next(const int handle, const int namelen, char *name)
|
||||||
|
|
||||||
|
Return the name of the next (user inserted) entry in the data base.
|
||||||
|
The order is effectively random.
|
||||||
|
|
||||||
|
handle = handle to RTDB
|
||||||
|
namelen = size of user provided buffer name
|
||||||
|
name = name of entry is returned in this buffer
|
||||||
|
|
||||||
|
|
||||||
|
int rtdb_print(const int handle, const int print_values)
|
||||||
|
|
||||||
|
Print the contents of the data base to stdout
|
||||||
|
|
||||||
|
handle = handle to RTDB
|
||||||
|
print_values = boolean flag ... if true values as well as
|
||||||
|
keys are printed out.
|
||||||
|
|
||||||
|
|
||||||
|
int rtdb_delete(const int handle, const char *name)
|
||||||
|
|
||||||
|
Delete the entry from the database.
|
||||||
|
Return
|
||||||
|
1 if key was present and successfully deleted
|
||||||
|
|
||||||
|
0 if key was not present, or if an error occured
|
||||||
|
|
||||||
|
handle = handle to RTDB
|
||||||
|
name = name of entry to delete
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
int rtdb_open(const char *, const char *, int *);
|
||||||
|
int rtdb_clone(const int, const char *);
|
||||||
|
int rtdb_getfname(const int, char [36]);
|
||||||
|
int rtdb_close(const int, const char *);
|
||||||
|
int rtdb_put(const int, const char *, const int, const int,
|
||||||
|
const void *);
|
||||||
|
int rtdb_get(const int, const char *, const int, const int,
|
||||||
|
bool);
|
||||||
|
int rtdb_get_info(const int, const char *, int *, int *, char [26]);
|
||||||
|
int rtdb_ma_get(const int, const char *, int *, int *, int *);
|
||||||
|
int rtdb_first(const int, const int, char *);
|
||||||
|
int rtdb_next(const int, const int, char *);
|
||||||
|
int rtdb_print(const int, const int);
|
||||||
|
int rtdb_delete(const int, const char *);
|
||||||
|
int rtdb_parallel(const int);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Following are 'sequential' versions of the above
|
||||||
|
for internal use only
|
||||||
|
*/
|
||||||
|
|
||||||
|
int rtdb_seq_open(const char *, const char *, int *);
|
||||||
|
int rtdb_seq_copy(const int, const char *);
|
||||||
|
int rtdb_seq_getfname(const int, char [36]);
|
||||||
|
int rtdb_seq_close(const int, const char *);
|
||||||
|
int rtdb_seq_put(const int, const char *, const int, const int,
|
||||||
|
const void *);
|
||||||
|
int rtdb_seq_get(const int, const char *, const int, const int,
|
||||||
|
void *);
|
||||||
|
int rtdb_seq_get_info(const int, const char *, int *, int *, char [26]);
|
||||||
|
int rtdb_seq_ma_get(const int, const char *, int *, int *, int *);
|
||||||
|
int rtdb_seq_first(const int, const int, char *);
|
||||||
|
int rtdb_seq_next(const int, const int, char *);
|
||||||
|
int rtdb_seq_print(const int, const int);
|
||||||
|
int rtdb_seq_delete(const int, const char *);
|
||||||
|
|
||||||
|
#define RTDB_SEQ_MODE 0 //* Sequential mode
|
||||||
|
#define RTDB_PAR_MODE 1 //* Parallel mode
|
||||||
|
|
||||||
|
#if (defined(CRAY) || defined(WIN32)) &&!defined(__crayx1) &&!defined(__MINGW32__)
|
||||||
|
#include "rtdb.cray.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,9 @@ def stringtooperatorsequence(expression):
|
||||||
"""Converts a string to an operatorsequence object"""
|
"""Converts a string to an operatorsequence object"""
|
||||||
# Syntax of the string is rather loosely defined as:
|
# Syntax of the string is rather loosely defined as:
|
||||||
# (1) Numerical factor (with no permutation allowed) (optional), summation (optional), amplitudes (optional), normal ordered sequence,
|
# (1) Numerical factor (with no permutation allowed) (optional), summation (optional), amplitudes (optional), normal ordered sequence,
|
||||||
# (2) Numerical factor can be an arithmatic expression such as (1.0/4.0),
|
# (2) Numerical factor can be an arithmetic expression such as (1.0/4.0),
|
||||||
# (3) Summation starts with either "SUM" or "sum" followed by a parenthesis of indexes,
|
# (3) Summation starts with either "SUM" or "sum" followed by a parenthesis of indexes,
|
||||||
# (4) Indexes can be either in one-letter notation (a-h, A-H for virtuals, i-o, I-O for occupieds, p-z, P-Z for either, case matters)
|
# (4) Indexes can be either in one-letter notation (a-h, A-H for virtuals, i-o, I-O for occupieds, p-z, P-Z for either, case matters)
|
||||||
# or in OCE notation (p1,p2 for virtuals, h3,h4 for occupieds, g5,g6 for either, no overlap in numbering)
|
# or in OCE notation (p1,p2 for virtuals, h3,h4 for occupieds, g5,g6 for either, no overlap in numbering)
|
||||||
# (5) Amplitudes start with "t" or any name followed by a dagger ("+") indicating complex conjugate (optional) and a parenthesis of indexes,
|
# (5) Amplitudes start with "t" or any name followed by a dagger ("+") indicating complex conjugate (optional) and a parenthesis of indexes,
|
||||||
# (6) Normal ordered operator sequence must exist even when it is empty "{}".
|
# (6) Normal ordered operator sequence must exist even when it is empty "{}".
|
||||||
|
|
@ -71,8 +71,7 @@ def stringtooperatorsequence(expression):
|
||||||
elif (index[0] == "g"):
|
elif (index[0] == "g"):
|
||||||
newsequence.append(Operator("general",dagger,int(index[1:])))
|
newsequence.append(Operator("general",dagger,int(index[1:])))
|
||||||
else:
|
else:
|
||||||
print("Syntax error: an operator not recognized")
|
raise SyntaxError(" an operator not recognized")
|
||||||
stop
|
|
||||||
operatorlist = operatorlist + newsequence
|
operatorlist = operatorlist + newsequence
|
||||||
newsequences.append(newsequence)
|
newsequences.append(newsequence)
|
||||||
|
|
||||||
|
|
@ -156,8 +155,7 @@ def stringtooperatorsequence(expression):
|
||||||
summation.indexes.append(indexinthelist)
|
summation.indexes.append(indexinthelist)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print("syntax error")
|
raise SyntaxError(" ")
|
||||||
stop
|
|
||||||
|
|
||||||
# get amplitudes
|
# get amplitudes
|
||||||
remainder = string.split(remainder,")")
|
remainder = string.split(remainder,")")
|
||||||
|
|
@ -221,8 +219,7 @@ def stringtooperatorsequence(expression):
|
||||||
newamplitude.indexes.append(indexinthelist)
|
newamplitude.indexes.append(indexinthelist)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print("syntax error")
|
raise SyntaxError(" ")
|
||||||
stop
|
|
||||||
amplitudes.append(newamplitude)
|
amplitudes.append(newamplitude)
|
||||||
|
|
||||||
newoperatorsequence = OperatorSequence(numericalfactor,summation,amplitudes,newsequences)
|
newoperatorsequence = OperatorSequence(numericalfactor,summation,amplitudes,newsequences)
|
||||||
|
|
@ -231,8 +228,7 @@ def stringtooperatorsequence(expression):
|
||||||
def combinepermutations(one,two):
|
def combinepermutations(one,two):
|
||||||
"""Connects two permutations of indexes"""
|
"""Connects two permutations of indexes"""
|
||||||
if (len(one) != len(two)):
|
if (len(one) != len(two)):
|
||||||
print("Internal error")
|
raise SyntaxError(" ")
|
||||||
stop
|
|
||||||
three = []
|
three = []
|
||||||
for n in range(len(one)/2):
|
for n in range(len(one)/2):
|
||||||
three.append(one[n])
|
three.append(one[n])
|
||||||
|
|
@ -749,7 +745,7 @@ class Factor:
|
||||||
raise RuntimeError("unrealistic factor")
|
raise RuntimeError("unrealistic factor")
|
||||||
fraction = abs(int(1.0/coefficient))
|
fraction = abs(int(1.0/coefficient))
|
||||||
if (1.0/float(fraction) != abs(coefficient)):
|
if (1.0/float(fraction) != abs(coefficient)):
|
||||||
print(" !!! WARNING !!! inaccurate arithmatic")
|
print(" !!! WARNING !!! inaccurate arithmetic")
|
||||||
if (fraction == 1):
|
if (fraction == 1):
|
||||||
frac = ""
|
frac = ""
|
||||||
else:
|
else:
|
||||||
|
|
@ -1732,7 +1728,7 @@ class ListOperatorSequences:
|
||||||
print("")
|
print("")
|
||||||
for line in self.show():
|
for line in self.show():
|
||||||
print(line)
|
print(line)
|
||||||
return ""
|
return""
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
"""Returns a human-friendly string of the content"""
|
"""Returns a human-friendly string of the content"""
|
||||||
|
|
@ -1813,7 +1809,7 @@ class ListOperatorSequences:
|
||||||
# pick up a pair of operator sequences
|
# pick up a pair of operator sequences
|
||||||
for nsequencea in range(len(self.list)):
|
for nsequencea in range(len(self.list)):
|
||||||
# if (verbose):
|
# if (verbose):
|
||||||
# print('processing ',nsequencea,' / ',range(len(self.list)))
|
# print 'processing ',nsequencea,' / ',range(len(self.list))
|
||||||
sequencea = self.list[nsequencea]
|
sequencea = self.list[nsequencea]
|
||||||
for nsequenceb in range(len(self.list)):
|
for nsequenceb in range(len(self.list)):
|
||||||
sequenceb = self.list[nsequenceb]
|
sequenceb = self.list[nsequenceb]
|
||||||
|
|
@ -1907,7 +1903,7 @@ class ListOperatorSequences:
|
||||||
print(" ! Warning! a cyclic contraction is found")
|
print(" ! Warning! a cyclic contraction is found")
|
||||||
# self.simplifythree(verbose)
|
# self.simplifythree(verbose)
|
||||||
self.simplifytwo(verbose)
|
self.simplifytwo(verbose)
|
||||||
# the followings do not seem to affect the result, yet it costs enormous memory & time
|
# the following do not seem to affect the result, yet it costs enormous memory & time
|
||||||
# self.simplifyfour(1)
|
# self.simplifyfour(1)
|
||||||
self = copy.deepcopy(self.deletezero())
|
self = copy.deepcopy(self.deletezero())
|
||||||
return self
|
return self
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,31 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
# Usage: python splitfiles.py < inputfile.F
|
# Usage: python splitfiles.py < inputfile.F
|
||||||
# (c) All rights reserved by Battelle & Pacific Northwest Nat'l Lab (2002)
|
# (c) All rights reserved by Battelle & Pacific Northwest Nat'l Lab (2002)
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
import string
|
|
||||||
import copy
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
source = sys.stdin.readlines()
|
source = sys.stdin.readlines()
|
||||||
|
|
||||||
if (not source):
|
if (not source):
|
||||||
print("Usage: python splitfiles.py < inputfile.F")
|
print("Usage: python splitfiles.py < inputfile.F")
|
||||||
|
|
||||||
nfiles = 0
|
nfiles = 0
|
||||||
|
filename = " "
|
||||||
|
filecontent = " "
|
||||||
for line in source:
|
for line in source:
|
||||||
if (string.find(line,"SUBROUTINE") != -1):
|
if (line.find("SUBROUTINE") != -1):
|
||||||
if (nfiles):
|
if (nfiles):
|
||||||
file = open(filename+".F","w")
|
file = open(filename+".F", "w")
|
||||||
for newline in filecontent:
|
for newline in filecontent:
|
||||||
file.write(newline)
|
file.write(newline)
|
||||||
filename = string.split(line[string.find(line,"SUBROUTINE")+11:],"(")[0]
|
filename = line[line.find("SUBROUTINE")+11:].split("(", 99999)[0]
|
||||||
print(filename+".o\\")
|
print(filename+".o\\")
|
||||||
nfiles = nfiles + 1
|
nfiles = nfiles + 1
|
||||||
filecontent = [line]
|
filecontent = [line]
|
||||||
else:
|
else:
|
||||||
filecontent.append(line)
|
filecontent.append(line)
|
||||||
# don't forget to dump the last subroutine
|
# don't forget to dump the last subroutine
|
||||||
file = open(filename+".F","w")
|
file = open(filename+".F", "w")
|
||||||
for newline in filecontent:
|
for newline in filecontent:
|
||||||
file.write(newline)
|
file.write(newline)
|
||||||
print("Number of files generated:",nfiles)
|
print("Number of files generated:", nfiles)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
|
#ifndef _ERRQUIT_H
|
||||||
|
#define _ERRQUIT_H
|
||||||
// UERR - Not yet assigned to a category
|
// UERR - Not yet assigned to a category
|
||||||
// UNKNOWN_ERR - Not yet assigned to a category
|
// UNKNOWN_ERR - Not yet assigned to a category
|
||||||
// MEM_ERROR - Generic Memory error
|
// MEM_ERR - Generic Memory error
|
||||||
// RTDB_ERR - Error in the Runtime Database
|
// RTDB_ERR - Error in the Runtime Database
|
||||||
// INPUT_ERR - Error resulting from inproper user input
|
// INPUT_ERR - Error resulting from inproper user input
|
||||||
// CAPMIS_ERR - Features that have not been implemented yet
|
// CAPMIS_ERR - Features that have not been implemented yet
|
||||||
|
|
@ -31,3 +33,5 @@ const int DISK_ERR = 100;
|
||||||
const int CALC_ERR = 110;
|
const int CALC_ERR = 110;
|
||||||
const int FMM_ERR = 120;
|
const int FMM_ERR = 120;
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue