From b8755c18ae2b7185d3198d3ae6eb357b21bc7719 Mon Sep 17 00:00:00 2001 From: Giovanni La Mura Date: Tue, 31 Oct 2023 16:31:01 +0100 Subject: [PATCH] Create rule to build np_sphere.cpp --- src/Makefile | 19 ++++++++++++++++++- src/include/sph_subs.h | 1 + src/{nptm.cpp => np_sphere.cpp} | 0 src/sphere/sphere.cpp | 28 +++++++++++++++++----------- 4 files changed, 36 insertions(+), 12 deletions(-) rename src/{nptm.cpp => np_sphere.cpp} (100%) diff --git a/src/Makefile b/src/Makefile index ac867ef7..9e7b374b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,11 +1,16 @@ SUBDIRS := cluster sphere trapping -BUILDDIR=../build +SRCDIR=$(PWD) +BUILDDIR=$(SRCDIR)/../build +CC=g++ all: $(SUBDIRS) $(SUBDIRS): $(MAKE) -C $@ +np_sphere: $(BUILLDDIR)/sphere/np_sphere.o $(BUILLDDIR)/sphere/Configuration.o $(BUILLDDIR)/sphere/Parsers.o $(BUILLDDIR)/sphere/sphere.o + $(CC) -o $(BUILDDIR)/sphere/np_sphere $(BUILDDIR)/sphere/np_sphere.o $(BUILDDIR)/sphere/Configuration.o $(BUILDDIR)/sphere/Parsers.o $(BUILDDIR)/sphere/sphere.o + clean: rm -f $(BUILDDIR)/cluster/*.o rm -f $(BUILDDIR)/sphere/*.o @@ -17,3 +22,15 @@ wipe: rm -f $(BUILDDIR)/trapping/* .PHONY: all $(SUBDIRS) + +$(BUILLDDIR)/sphere/np_sphere.o: + $(CC) -c np_sphere.cpp -o $(BUILDDIR)/sphere/np_sphere.o + +$(BUILLDDIR)/sphere/Configuration.o: + $(CC) -c Configuration.cpp -o $(BUILDDIR)/sphere/Configuration.o + +$(BUILLDDIR)/sphere/Parsers.o: + $(CC) -c Parsers.cpp -o $(BUILDDIR)/sphere/Parsers.o + +$(BUILLDDIR)/sphere/sphere.o: + $(CC) -c sphere/sphere.cpp -o $(BUILDDIR)/sphere/sphere.o diff --git a/src/include/sph_subs.h b/src/include/sph_subs.h index 3cdfb083..fffd1085 100644 --- a/src/include/sph_subs.h +++ b/src/include/sph_subs.h @@ -891,6 +891,7 @@ void sscr0(std::complex &tfsas, int nsph, int lm, double vk, double exri c1->sqexs[i12 - 1] = extsec / gcss; c1->sqabs[i12 - 1] = abssec / gcss; c1->fsas[i12 - 1] = sum21 * csam; + //printf("DEBUG: FSAS( %d ) = (%lE,%lE)\n", i12, c1->fsas[i12 - 1].real(), c1->fsas[i12 - 1].imag()); } tfsas += c1->fsas[iogi - 1]; } diff --git a/src/nptm.cpp b/src/np_sphere.cpp similarity index 100% rename from src/nptm.cpp rename to src/np_sphere.cpp diff --git a/src/sphere/sphere.cpp b/src/sphere/sphere.cpp index fbf8bc77..cf037183 100644 --- a/src/sphere/sphere.cpp +++ b/src/sphere/sphere.cpp @@ -80,7 +80,7 @@ void sphere() { fprintf(output, " READ(IR,*)TH,THSTP,THLST,THS,THSSTP,THSLST\n"); fprintf( output, - " %9.3lE %9.3lE %9.3lE %9.3lE %9.3lE %9.3lE\n", + " %9.3lE %9.3lE %9.3lE %9.3lE %9.3lE %9.3lE\n", gconf->in_theta_start, gconf->in_theta_step, gconf->in_theta_end, @@ -91,7 +91,7 @@ void sphere() { fprintf(output, " READ(IR,*)PH,PHSTP,PHLST,PHS,PHSSTP,PHSLST\n"); fprintf( output, - " %9.3lE %9.3lE %9.3lE %9.3lE %9.3lE %9.3lE\n", + " %9.3lE %9.3lE %9.3lE %9.3lE %9.3lE %9.3lE\n", gconf->in_phi_start, gconf->in_phi_step, gconf->in_phi_end, @@ -105,12 +105,12 @@ void sphere() { " %5d\n", gconf->jwtm ); - fprintf(output, " READ(ITIN)NSPHT\n"); - fprintf(output, " READ(ITIN)(IOG(I),I=1,NSPH)\n"); - fprintf(output, " READ(ITIN)EXDC,WP,XIP,IDFC,NXI\n"); - fprintf(output, " READ(ITIN)(XIV(I),I=1,NXI)\n"); - fprintf(output, " READ(ITIN)NSHL(I),ROS(I)\n"); - fprintf(output, " READ(ITIN)(RCF(I,NS),NS=1,NSH)\n \n"); + fprintf(output, " READ(ITIN)NSPHT\n"); + fprintf(output, " READ(ITIN)(IOG(I),I=1,NSPH)\n"); + fprintf(output, " READ(ITIN)EXDC,WP,XIP,IDFC,NXI\n"); + fprintf(output, " READ(ITIN)(XIV(I),I=1,NXI)\n"); + fprintf(output, " READ(ITIN)NSHL(I),ROS(I)\n"); + fprintf(output, " READ(ITIN)(RCF(I,NS),NS=1,NSH)\n \n"); double sml = 1.0e-3; int nth = 0, nph = 0; if (gconf->in_theta_step != 0.0) @@ -271,6 +271,7 @@ void sphere() { } } double cs0 = 0.25 * vk * vk * vk / half_pi; + //printf("DEBUG: cs0 = %lE\n", cs0); sscr0(tfsas, nsph, gconf->l_max, vk, exri, c1); printf("DEBUG: TFSAS = (%lE,%lE)\n", tfsas.real(), tfsas.imag()); double sqk = vk * vk * sconf->exdc; @@ -292,7 +293,7 @@ void sphere() { c1->sqscs[i170 - 1] *= sqsfi; c1->sqabs[i170 - 1] *= sqsfi; c1->sqexs[i170 - 1] *= sqsfi; - fprintf(output, " SPHERE %2d\n", i170); + fprintf(output, " SPHERE %2d\n", i170); if (c1->nshl[i170 - 1] != 1) { fprintf(output, " SIZE=%15.7lE\n", c2->vsz[i170 - 1]); } else { @@ -320,10 +321,15 @@ void sphere() { ); fprintf(output, " FSAS=%15.7lE%15.7lE\n", c1->fsas[i170 - 1].real(), c1->fsas[i170 - 1].imag()); double csch = 2.0 * vk * sqsfi / c1->gcsv[i170 -1]; + //printf("DEBUG: csch = %lE\n", csch); s0 = c1->fsas[i170 - 1] * exri; + //printf("DEBUG: s0 = (%lE,%lE)\n", s0.real(), s0.imag()); double qschu = csch * s0.imag(); + //printf("DEBUG: qschu = %lE\n", qschu); double pschu = csch * s0.real(); + //printf("DEBUG: pschu = %lE\n", pschu); double s0mag = cs0 * sqrt((s0.real() + s0.imag()) * (s0.real() - s0.imag())); + //printf("DEBUG: s0mag = %lE\n", s0mag); fprintf( output, " QSCHU=%15.7lE, PSCHU=%15.7lE, S0MAG=%15.7lE\n", @@ -462,12 +468,12 @@ void sphere() { for (int ns226 = 1; ns226 <= nsph; ns226++) { fprintf(output, " SPHERE %2d\n", ns226); fprintf( - output, " SAS(1,1)=%15.7lE,%15.7lE, SAS(2,1)=%15.7lE,%15.7lE\n", + output, " SAS(1,1)=%15.7lE%15.7lE, SAS(2,1)=%15.7lE%15.7lE\n", c1->sas[ns226 - 1][0][0].real(), c1->sas[ns226 - 1][0][0].imag(), c1->sas[ns226 - 1][1][0].real(), c1->sas[ns226 - 1][1][0].imag() ); fprintf( - output, " SAS(1,2)=%15.7lE,%15.7lE, SAS(2,2)=%15.7lE,%15.7lE\n", + output, " SAS(1,2)=%15.7lE%15.7lE, SAS(2,2)=%15.7lE%15.7lE\n", c1->sas[ns226 - 1][0][1].real(), c1->sas[ns226 - 1][0][1].imag(), c1->sas[ns226 - 1][1][1].real(), c1->sas[ns226 - 1][1][1].imag() ); -- GitLab