2
0
mirror of https://github.com/LCPQ/DEHam synced 2024-10-16 04:51:36 +02:00

now compiles but bug in the calculation of s2

This commit is contained in:
vijay gopal chilkuri 2018-01-28 11:16:22 +01:00
parent 62dba9a3c5
commit 55e106f53d
11 changed files with 79 additions and 7 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*bin/*
*/obj/*
*mod.mod*
irpf90.a

View File

@ -1,6 +1,7 @@
include ${SLEPC_DIR}/lib/slepc/conf/slepc_common
#CC=gcc
#FC = ifort
CLINKER = mpicc -fPIC #-wd1572 -O3 -axAVX,SSE4.2 -fno-alias -no-prec-div -no-prec-sqrt -ip
MAKE = /usr/bin/make
MKDIR_P = /bin/mkdir -p
OBJ_DIR := obj
@ -24,14 +25,29 @@ ${BIN_DIR}:
directories: ${OBJ_DIR} ${LIB_DIR} ${BIN_DIR}
${LIB_DIR}/irpf90.a: directories
cd ${SRC_DIR} && irpf90 init && $(MAKE) irpf90.a && cp IRPF90_temp/irpf90.a ../${LIB_DIR}
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}/get_s2.o: ${SRC_DIR}/get_s2.c directories chkopts
${CC} ${SLEPC_INCLUDE} ${PETSC_CC_INCLUDES} -c -o $@ $< ${SLEPC_EPS_LIB}
${OBJ_DIR}/get_s2_cyclic.o: ${SRC_DIR}/get_s2_cyclic.c directories chkopts
${CC} ${SLEPC_INCLUDE} ${PETSC_CC_INCLUDES} -c -o $@ $< ${SLEPC_EPS_LIB}
${OBJ_DIR}/get_s2_mov.o: ${SRC_DIR}/get_s2_mov.c directories chkopts
${CC} ${SLEPC_INCLUDE} ${PETSC_CC_INCLUDES} -c -o $@ $< ${SLEPC_EPS_LIB}
${OBJ_DIR}/get_dmat.o: ${SRC_DIR}/get_dmat.c directories chkopts
${CC} ${SLEPC_INCLUDE} ${PETSC_CC_INCLUDES} -c -o $@ $< ${SLEPC_EPS_LIB}
${OBJ_DIR}/get_val_iaa2.o: ${SRC_DIR}/get_val_iaa2.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
${BIN_DIR}/ex1: ${OBJ_DIR}/read2.o ${OBJ_DIR}/get_s2_mov.o ${OBJ_DIR}/get_s2_cyclic.o ${OBJ_DIR}/get_s2.o ${OBJ_DIR}/get_dmat.o ${OBJ_DIR}/get_val_iaa2.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 ${OBJ_DIR}/get_s2.o ${OBJ_DIR}/get_s2_mov.o ${OBJ_DIR}/get_s2_cyclic.o ${OBJ_DIR}/get_dmat.o ${OBJ_DIR}/get_val_iaa2.o ${LIB_DIR}/irpf90.a ${SLEPC_EPS_LIB}# -lifcore -lirc -lcomposerxe_gen_helpers_core_2.3
# ${RM} ex1.o read2.o

5
src/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
IRPF90_temp/
IRPF90_man/
irpf90.make
irpf90_entities
tags

View File

@ -6,4 +6,4 @@
#include <string.h>
void get_1rdm(PetscScalar *, PetscInt *, PetscInt *, int *, PetscReal *);
void get_2rdm(PetscScalar *, PetscInt *, PetscInt *, int *, PetscReal *, double ****);
void get_2rdm(PetscScalar *valxr, PetscInt *Istart, PetscInt *Iend, int *natom, PetscReal *trace2rdm, double densmat2[*natom][*natom][*natom][*natom]);

View File

@ -676,7 +676,7 @@ void get_s2(Vec xr, PetscInt *Istart, PetscInt *Iend, PetscScalar *valxr, int *n
// if(mpiid==3)printf(" ii = %d norm = %18f %18f 3 = %18f 4 = %18f\n", ii, *norm2, *norm3, *xymat2, *xymat3);
}
ierr = PetscTime(&tt2);CHKERRQ(ierr);
ierr = PetscTime(&tt2);
//printf(" norm = %18f weight = %18f weight/N = %18f tmpwe = %18f\n", *norm2, *weight3, *weight3/(*norm2),tmpwe);
//printf(" norm = %18f %18f xymat = %18f %18f\n", *norm2, *norm3, *xymat2, *xymat3);
//ierr = PetscPrintf(PETSC_COMM_WORLD," Time used for the s2 loop: %f\n",tt2-tt1);CHKERRQ(ierr);

View File

@ -778,7 +778,7 @@ void get_s2_cyclic(Vec xr, PetscInt *Istart, PetscInt *Iend, PetscScalar *valxr,
// if(mpiid==0)printf(" ii = %d xmat3 = %18f xmat4 = %18f diff = %18f\n", ii, xmat3, xmat4, (xmat3-xmat4));
}
ierr = PetscTime(&tt2);CHKERRQ(ierr);
ierr = PetscTime(&tt2);
//if(mpiid==0)printf(" norm3 = %18f norm4 = %18f xymat3= %18f xymat4= %18f\n", *norm3, *norm4, *xymat3, *xymat4);
//ierr = PetscPrintf(PETSC_COMM_WORLD," Time used for the s2 loop: %f\n",tt2-tt1);CHKERRQ(ierr);
}

View File

@ -676,7 +676,7 @@ void get_s2_mov(Vec xr, PetscInt *Istart, PetscInt *Iend, PetscScalar *valxr, in
// if(mpiid==3)printf(" ii = %d norm = %18f %18f 3 = %18f 4 = %18f\n", ii, *norm2, *norm3, *xymat2, *xymat3);
}
ierr = PetscTime(&tt2);CHKERRQ(ierr);
ierr = PetscTime(&tt2);
//printf(" norm = %18f weight = %18f weight/N = %18f tmpwe = %18f\n", *norm2, *weight3, *weight3/(*norm2),tmpwe);
//printf(" norm = %18f %18f xymat = %18f %18f\n", *norm2, *norm3, *xymat2, *xymat3);
//ierr = PetscPrintf(PETSC_COMM_WORLD," Time used for the s2 loop: %f\n",tt2-tt1);CHKERRQ(ierr);

34
src/get_val_iaa2.c Normal file
View File

@ -0,0 +1,34 @@
#include <stdio.h>
#include <petsctime.h>
#include <slepceps.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "get_val_iaa2.h"
/*
* This function gets vector from a different processor
* xr the full vector
* iaa2 adresse to get value from
* getvaliaa2 the value
*/
void get_val_iaa2(Vec xr,long int *iaa2,double *getvaliaa2){
Vec x; /* initial vector, destination vector */
VecScatter scatter; /* scatter context */
IS from, to; /* index sets that define the scatter */
PetscScalar *values;
int idx_from[] = {*iaa2}, idx_to[] = {0};
VecCreateSeq( PETSC_COMM_SELF,1,&x);
ISCreateGeneral(PETSC_COMM_SELF,1,idx_from,PETSC_COPY_VALUES,&from);
ISCreateGeneral(PETSC_COMM_SELF,1,idx_to, PETSC_COPY_VALUES,&to);
printf("in get_val");
VecScatterCreate(xr,from,x,to,&scatter);
VecScatterBegin(scatter,xr,x,INSERT_VALUES,SCATTER_FORWARD);
VecScatterEnd(scatter,xr,x, INSERT_VALUES,SCATTER_FORWARD);
VecGetArray(x,&values);
*getvaliaa2 = values[0];
ISDestroy(&from);
ISDestroy(&to);
VecScatterDestroy(&scatter);
}

8
src/get_val_iaa2.h Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
#include <petsctime.h>
#include <slepceps.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
void get_val_iaa2(Vec, long int *, double *);

View File

@ -1,3 +1,5 @@
#include <petscsys.h>
void unit_l1_(
long int *,
long int *,
@ -11,5 +13,8 @@ void unit_l1_(
long int *,
long int *,
long int *,
long int *,
_Bool *,
long int *,
double *);