From 76e61041b11979f3e6dd6eedae017788204857c1 Mon Sep 17 00:00:00 2001
From: Nicolas Essing <n.essing@fz-juelich.de>
Date: Thu, 4 Nov 2021 16:07:21 +0100
Subject: [PATCH] Added a consistency check for the input parameters.

If noncollinear magnetic fields are enabled (noncobfield=t) but
noncollinear magnetism is not (korbit=0), the program will print
an error message and halt.
---
 source/KKRnano/source/CalculationData_mod.F90 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/source/KKRnano/source/CalculationData_mod.F90 b/source/KKRnano/source/CalculationData_mod.F90
index 0ff9ee443..c4ce5b1cf 100644
--- a/source/KKRnano/source/CalculationData_mod.F90
+++ b/source/KKRnano/source/CalculationData_mod.F90
@@ -386,6 +386,12 @@ module CalculationData_mod
     call setup_iguess(self, dims, arrays%nofks, kmesh) ! setup storage for iguess
 
     if (params%noncobfield) then
+
+      ! Check that noncollinear magnetism is enabled
+      if (dims%korbit < 1) then
+        die_here("Noncollinear magnetic fields (noncobfield=t) need noncollinear magnetism. Set korbit=1.")
+      end if
+
       ! Output only as master, in that case copy the input parameter
       verbosity = -1
       if (mp%isMasterRank) verbosity = params%bfield_verbosity
-- 
GitLab