modified makefile to seperate into bin and lib dirs also now added neigenvalues option

This commit is contained in:
v1j4y 2016-12-20 16:02:23 +01:00
parent a907d1a5fe
commit ee3afdd71e
4 changed files with 34 additions and 15 deletions

View File

@ -1,23 +1,37 @@
include ${SLEPC_DIR}/lib/slepc/conf/slepc_common include ${SLEPC_DIR}/lib/slepc/conf/slepc_common
CC=gcc #CC=gcc
#FC = ifort
MAKE = /usr/bin/make MAKE = /usr/bin/make
MKDIR_P = mkdir -p MKDIR_P = /bin/mkdir -p
OBJ_DIR = obj OBJ_DIR := obj
LIB_DIR := libs
BIN_DIR := bin
SRC_DIR := src
irpf90.a: .PHONY: ex1
cd src && irpf90 init && $(MAKE) && cp irpf90.a ../
ex1: ${BIN_DIR}/ex1
${OBJ_DIR}: ${OBJ_DIR}:
${MKDIR_P} ${OBJ_DIR} ${MKDIR_P} ${OBJ_DIR}
directories: ${OBJ_DIR} ${LIB_DIR}:
${MKDIR_P} ${LIB_DIR}
obj/read2.o: src/read2.c directories ${BIN_DIR}:
${CC} -c -o $@ $< ${MKDIR_P} ${BIN_DIR}
obj/ex1.o: src/ex1.c directories: ${OBJ_DIR} ${LIB_DIR} ${BIN_DIR}
-${CC} -c -o $@ $< ${SLEPC_EPS_LIB}
ex1: obj/read2.o irpf90.a obj/ex1.o src/read2.h src/stimsyr.h chkopts ${LIB_DIR}/irpf90.a: directories
-${CLINKER} -o ex1 obj/ex1.o obj/read2.o irpf90.a ${SLEPC_EPS_LIB}# -lifcore -lirc -lcomposerxe_gen_helpers_core_2.3 cd ${SRC_DIR} && irpf90 init && $(MAKE) irpf90.a && cp irpf90.a ../${LIB_DIR}
${OBJ_DIR}/read2.o: ${SRC_DIR}/read2.c directories chkopts
${CC} ${SLEPC_INCLUDE} ${PETSC_CC_INCLUDES} -c -o $@ $< ${SLEPC_EPS_LIB}
${OBJ_DIR}/ex1.o: ${SRC_DIR}/ex1.c
-${CC} ${SLEPC_INCLUDE} ${PETSC_CC_INCLUDES} -c -o $@ $< ${SLEPC_EPS_LIB}
${BIN_DIR}/ex1: ${OBJ_DIR}/read2.o ${LIB_DIR}/irpf90.a ${OBJ_DIR}/ex1.o ${SRC_DIR}/read2.h ${SRC_DIR}/stimsyr.h chkopts
-${CLINKER} ${SLEPC_INCLUDE} ${PETSC_CC_INCLUDES} -o ${BIN_DIR}/ex1 ${OBJ_DIR}/ex1.o ${OBJ_DIR}/read2.o ${LIB_DIR}/irpf90.a ${SLEPC_EPS_LIB}# -lifcore -lirc -lcomposerxe_gen_helpers_core_2.3
# ${RM} ex1.o read2.o # ${RM} ex1.o read2.o

View File

@ -124,12 +124,13 @@ int main(int argc,char **argv)
ierr = EPSSetWhichEigenpairs(eps,EPS_SMALLEST_REAL);CHKERRQ(ierr); ierr = EPSSetWhichEigenpairs(eps,EPS_SMALLEST_REAL);CHKERRQ(ierr);
ierr = EPSSetFromOptions(eps);CHKERRQ(ierr); ierr = EPSSetFromOptions(eps);CHKERRQ(ierr);
tol = 1.e-8; tol = 1.e-9;
maxit = 10000000; maxit = 10000000;
ierr = EPSSetTolerances(eps,tol,maxit);CHKERRQ(ierr); ierr = EPSSetTolerances(eps,tol,maxit);CHKERRQ(ierr);
nev = 4; nev = 4;
ncv = 10; ncv = 10;
mpd = 10; mpd = 10;
nev = getdata.nroots;
ierr = EPSSetDimensions(eps,nev,PETSC_DECIDE,PETSC_DECIDE);CHKERRQ(ierr); ierr = EPSSetDimensions(eps,nev,PETSC_DECIDE,PETSC_DECIDE);CHKERRQ(ierr);
ierr = PetscTime(&t1);CHKERRQ(ierr); ierr = PetscTime(&t1);CHKERRQ(ierr);
@ -156,7 +157,7 @@ int main(int argc,char **argv)
" k ||Ax-kx||/||kx||\n" " k ||Ax-kx||/||kx||\n"
" ----------------- ------------------\n");CHKERRQ(ierr); " ----------------- ------------------\n");CHKERRQ(ierr);
for (i=0;i<nconv;i++) { for (i=0;i<nev;i++) {
/* /*
Get converged eigenpairs: i-th eigenvalue is stored in kr (real part) and Get converged eigenpairs: i-th eigenvalue is stored in kr (real part) and
ki (imaginary part) ki (imaginary part)

View File

@ -17,7 +17,7 @@ void Data_new(FILE* file, Data* dat) {
/* note that fgets don't strip the terminating \n, checking its /* note that fgets don't strip the terminating \n, checking its
presence would allow to handle lines longer that sizeof(line) */ presence would allow to handle lines longer that sizeof(line) */
if (count != 11){ if (count != 12){
count++; count++;
switch(count){ switch(count){
case 1: case 1:
@ -179,6 +179,9 @@ void Data_new(FILE* file, Data* dat) {
} }
} }
break; break;
case 12:
dat->nroots=atol(line);
break;
} /* end of switch */ } /* end of switch */
} /* end of the input file */ } /* end of the input file */

View File

@ -14,6 +14,7 @@ typedef struct {
double xjjz[700]; double xjjz[700];
double xjjxy[700]; double xjjxy[700];
double xtt[700]; double xtt[700];
long int nroots;
} Data ; } Data ;