summaryrefslogtreecommitdiff
path: root/lib/fqso_first.f90
diff options
context:
space:
mode:
authorhibby <d@vehibberd.com>2018-02-16 15:17:14 +0000
committerhibby <d@vehibberd.com>2018-02-16 15:17:14 +0000
commit37f727ac0746fd85504aa46c1f023c09b3eff33a (patch)
treec8a7ce04545040a8f161ba279528730bd9a3e6ab /lib/fqso_first.f90
parentd63dd8d081a6fcd0715cd13f26df59fb831769d2 (diff)
New upstream version 1.8.0+repackupstream/1.8.0+repack
Diffstat (limited to 'lib/fqso_first.f90')
-rw-r--r--lib/fqso_first.f9032
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/fqso_first.f90 b/lib/fqso_first.f90
new file mode 100644
index 00000000..e553e3e4
--- /dev/null
+++ b/lib/fqso_first.f90
@@ -0,0 +1,32 @@
+subroutine fqso_first(nfqso,ntol,ca,ncand)
+
+! If a candidate was found within +/- ntol of nfqso, move it into ca(1).
+
+ type candidate
+ real freq
+ real dt
+ real sync
+ real flip
+ end type candidate
+ type(candidate) ca(300),cb
+
+ dmin=1.e30
+ i0=0
+ do i=1,ncand
+ d=abs(ca(i)%freq-nfqso)
+ if(d.lt.dmin) then
+ i0=i
+ dmin=d
+ endif
+ enddo
+
+ if(dmin.lt.float(ntol)) then
+ cb=ca(i0)
+ do i=i0,2,-1
+ ca(i)=ca(i-1)
+ enddo
+ ca(1)=cb
+ endif
+
+ return
+end subroutine fqso_first