text:
using System;

namespace ChainUtils.BouncyCastle.Utilities.Encoders
{
    /// <summary>
    /// A class that allows encoding of data using a specific encoder to be processed in chunks.
    /// </summary>
    public class BufferedEncoder
    {
        internal byte[]        Buffer;
        internal int           bufOff;

        internal ITranslator   translator;

        /// <summary>
        /// Create.
        /// </summary>
        /// <param name="translator">The translator to use.</param>
        /// <param name="bufferSize">Size of the chunks.</param>
        public BufferedEncoder(
            ITranslator translator,
            int         bufferSize)
        {
            this.translator = translator;

            if ((bufferSize % translator.GetEncodedBlockSize()) != 0)
            {
                throw new ArgumentException("buffer size not multiple of input block size");
            }

            Buffer = new byte[bufferSize];
//            bufOff = 0;
        }

        /// <summary>
        /// Process one byte of data.
        /// </summary>
        /// <param name="input">The byte.</param>
        /// <param name="outBytes">An array to store output in.</param>
        /// <param name="outOff">Offset within output array to start writing from.</param>
        /// <returns></returns>
        public int ProcessByte(
            byte        input,
            byte[]      outBytes,
            int         outOff)
        {
            var         resultLen = 0;

            Buffer[bufOff++] = input;

            if (bufOff == Buffer.Length)
            {
                resultLen = translator.Encode(Buffer, 0, Buffer.Length, outBytes, outOff);
                bufOff = 0;
            }

            return resultLen;
        }

        /// <summary>
        /// Process data from a byte array.
        /// </summary>
        /// <param name="input">Input data Byte array containing data to be processed.</param>
        /// <param name="inOff">Start position within input data array.</param>
        /// <param name="len">Amount of input data to be processed.</param>
        /// <param name="outBytes">Output data array.</param>
        /// <param name="outOff">Offset within output data array to start writing to.</param>
        /// <returns>The amount of data written.</returns>
        public int ProcessBytes(
            byte[]      input,
            int         inOff,
            int         len,
            byte[]      outBytes,
            int         outOff)
        {
            if (len < 0)
            {
            throw new ArgumentException("Can't have a negative input length!");
            }

            var resultLen = 0;
            var gapLen = Buffer.Length - bufOff;

            if (len > gapLen)
            {
                Array.Copy(input, inOff, Buffer, bufOff, gapLen);

                resultLen += translator.Encode(Buffer, 0, Buffer.Length, outBytes, outOff);

                bufOff = 0;

                len -= gapLen;
                inOff += gapLen;
                outOff += resultLen;

                var chunkSize = len - (len % Buffer.Length);

                resultLen += translator.Encode(input, inOff, chunkSize, outBytes, outOff);

                len -= chunkSize;
                inOff += chunkSize;
            }

            if (len != 0)
            {
                Array.Copy(input, inOff, Buffer, bufOff, len);

                bufOff += len;
            }

            return resultLen;
        }
    }

}


text:
import { baseIsEqual } from './_baseIsEqual';
import { get } from './get';
import { hasIn } from './hasIn';
import { isKey } from './_isKey';
import { isStrictComparable } from './_isStrictComparable';
import { matchesStrictComparable } from './_matchesStrictComparable';
import { toKey } from './_toKey';

/** Used to compose bitmasks for value comparisons. */
const COMPARE_PARTIAL_FLAG = 1,
  COMPARE_UNORDERED_FLAG = 2;

/**
 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
 *
 * @param path {string} path The path of the property to get.
 * @param srcValue {*} srcValue The value to match.
 * Returns the new spec function.
 */
export function baseMatchesProperty(path: string, srcValue: any): Function {
  if (isKey(path) && isStrictComparable(srcValue)) {
    return matchesStrictComparable(toKey(path), srcValue);
  }
  return function(object) {
    const objValue = get(object, path);
    return objValue === undefined && objValue === srcValue
      ? hasIn(object, path)
      : // tslint:disable-next-line
        baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  };
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>
<property>
<name>dfs.data.dir</name>
<value>/home/conan/hadoop/data</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
</configuration>


text:
namespace optimization_guide {

namespace {

void DoValidateModel(
    OptimizationGuideModelProvider* optimization_guide_model_provider) {
  DCHECK(switches::ShouldValidateModel());

  // Create the validator object which will get destroyed when the model load is
  // complete.
  new ModelValidatorHandler(
      optimization_guide_model_provider,
      base::ThreadPool::CreateSequencedTaskRunner(
          {base::MayBlock(), base::TaskPriority::BEST_EFFORT}));
}

}  // namespace

class ModelValidatorModelObserverTracker
    : public TestOptimizationGuideModelProvider {
 public:
  void AddObserverForOptimizationTargetModel(
      proto::OptimizationTarget optimization_target,
      const absl::optional<proto::Any>& model_metadata,
      OptimizationTargetModelObserver* observer) override {
    if (optimization_target == proto::OPTIMIZATION_TARGET_MODEL_VALIDATION) {
      EXPECT_FALSE(model_validation_observer_);
      model_validation_observer_ = observer;
    }
  }

  void RemoveObserverForOptimizationTargetModel(
      proto::OptimizationTarget optimization_target,
      OptimizationTargetModelObserver* observer) override {
    if (optimization_target == proto::OPTIMIZATION_TARGET_MODEL_VALIDATION) {
      EXPECT_EQ(observer, model_validation_observer_);
      model_validation_observer_ = nullptr;
    }
  }

  // Notifies the model validation observer about the model file update.
  void NotifyModelFileUpdate(proto::OptimizationTarget optimization_target,
                             const base::FilePath& model_file_path) {
    if (optimization_target == proto::OPTIMIZATION_TARGET_MODEL_VALIDATION) {
      auto model_metadata =
          TestModelInfoBuilder().SetModelFilePath(model_file_path).Build();
      model_validation_observer_->OnModelUpdated(optimization_target,
                                                 *model_metadata);
    }
  }

 private:
  // The observer that is registered to receive model validation optimzation
  // target events.
  raw_ptr<OptimizationTargetModelObserver> model_validation_observer_;
};

class ModelValidatorExecutorTest : public testing::Test {
 public:
  void SetUp() override {
    base::CommandLine::ForCurrentProcess()->AppendSwitch(
        switches::kModelValidate);
    model_observer_tracker_ =
        std::make_unique<ModelValidatorModelObserverTracker>();
  }

  void TearDown() override { task_environment_.RunUntilIdle(); }

  void ValidateModel(const base::FilePath& model_file_path) {
    DoValidateModel(model_observer_tracker_.get());
    model_observer_tracker_->NotifyModelFileUpdate(
        proto::OPTIMIZATION_TARGET_MODEL_VALIDATION, model_file_path);
    task_environment_.RunUntilIdle();
  }

  base::HistogramTester& histogram_tester() { return histogram_tester_; }

 private:
  base::test::TaskEnvironment task_environment_;
  base::HistogramTester histogram_tester_;

  std::unique_ptr<ModelValidatorModelObserverTracker> model_observer_tracker_;
};

TEST_F(ModelValidatorExecutorTest, ValidModel) {
  base::FilePath model_file_path;
  base::PathService::Get(base::DIR_SOURCE_ROOT, &model_file_path);
  model_file_path = model_file_path.AppendASCII("components")
                        .AppendASCII("test")
                        .AppendASCII("data")
                        .AppendASCII("optimization_guide")
                        .AppendASCII("simple_test.tflite");
  ValidateModel(model_file_path);

  // |ModelValidatorExecutor::Preprocess| returns an unimplemented error,
  // resulting in an unknown error in the final execution step.
  histogram_tester().ExpectUniqueSample(
      "OptimizationGuide.ModelExecutor.ExecutionStatus." +
          GetStringNameForOptimizationTarget(
              proto::OptimizationTarget::OPTIMIZATION_TARGET_MODEL_VALIDATION),
      ExecutionStatus::kErrorUnknown, 1);

  histogram_tester().ExpectUniqueSample(
      "OptimizationGuide.ModelExecutor.ModelLoadedSuccessfully." +
          GetStringNameForOptimizationTarget(
              proto::OptimizationTarget::OPTIMIZATION_TARGET_MODEL_VALIDATION),
      true, 1);

  histogram_tester().ExpectTotalCount(
      "OptimizationGuide.ModelExecutor.ModelLoadingDuration2." +
          GetStringNameForOptimizationTarget(
              proto::OptimizationTarget::OPTIMIZATION_TARGET_MODEL_VALIDATION),
      1);
}

// TODO(crbug.com/1240561): Enable this invalid model handling test once tflite
// error reporter msan failure is fixed.
TEST_F(ModelValidatorExecutorTest, DISABLED_InvalidModel) {
  base::ScopedTempDir model_dir;
  EXPECT_TRUE(model_dir.CreateUniqueTempDir());
  base::FilePath invalid_model_file_path =
      model_dir.GetPath().AppendASCII("invalid_model.tflite");
  base::WriteFile(invalid_model_file_path, "INVALID MODEL DATA");
  ValidateModel(invalid_model_file_path);

  histogram_tester().ExpectUniqueSample(
      "OptimizationGuide.ModelExecutor.ExecutionStatus." +
          GetStringNameForOptimizationTarget(
              proto::OptimizationTarget::OPTIMIZATION_TARGET_MODEL_VALIDATION),
      ExecutionStatus::kErrorModelFileNotValid, 1);

  histogram_tester().ExpectUniqueSample(
      "OptimizationGuide.ModelExecutor.ModelLoadedSuccessfully." +
          GetStringNameForOptimizationTarget(
              proto::OptimizationTarget::OPTIMIZATION_TARGET_MODEL_VALIDATION),
      false, 1);

  histogram_tester().ExpectTotalCount(
      "OptimizationGuide.ModelExecutor.ModelLoadingDuration2." +
          GetStringNameForOptimizationTarget(
              proto::OptimizationTarget::OPTIMIZATION_TARGET_MODEL_VALIDATION),
      1);
}

}  // namespace optimization_guide


text:
var connect = require('connect'),
    serveStatic = require('serve-static'),
    path = require("path");

var root = path.join(__dirname, "files");

var server = connect();
var PORT = process.env.PORT || 3000;
server
  .use(serveStatic(root))
  .listen(PORT, function() {
    console.log("Visit http://127.0.0.1:%d/index.html", PORT);
  });


text:
module.exports =
{
	/**
	 * Computes the linear interpolation between two numbers at the specified
	 * time.
	 *
	 * @param a
	 * 		The first number.
	 * @param b
	 * 		The second number.
	 * @param t
	 * 		The time (0 <= t <= 1).
	 * @returns
	 * 		The interpolated value between the two numbers at the specified
	 * 		time.
	 */
	linear: function(a, b, t)
	{
		return a * (1 - t) + b * t;
	}
};


text:
package snippets

import (
	"bytes"
	"strings"
	"testing"
)

func TestPaginationSnippets(t *testing.T) {
	testProjectId := "windows-sql-cloud"
	buf := &bytes.Buffer{}

	if err := printImagesList(buf, testProjectId); err != nil {
		t.Errorf("printImagesList got err: %v", err)
	}

	result := strings.Split(buf.String(), "\n")

	if len(result) < 4 {
		t.Errorf("printImagesList returns incorrect amount of images")
	}

	buf.Reset()

	if err := printImagesListByPage(buf, testProjectId, 3); err != nil {
		t.Errorf("printImagesListByList got err: %v", err)
	}

	expectedResult := "Page 0:"
	expectedResult2 := "Page 1:"
	if got := buf.String(); !strings.Contains(got, expectedResult) {
		t.Errorf("printImagesListByList got %q, want %q", got, expectedResult)
	}
	if got := buf.String(); !strings.Contains(got, expectedResult2) {
		t.Errorf("printImagesListByList got %q, want %q", got, expectedResult2)
	}
}


text:
package org.nanocontainer.persistence.hibernate;

import java.sql.Connection;

import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.nanocontainer.persistence.ExceptionHandler;

/**
 * Session delegator with failover behaviour in case of hibernate exception. Old session is disposed
 * and new one is obtained transparently. Session creation is done lazily.
 *
 * @author Jose Peleteiro <juzepeleteiro@intelli.biz>
 * @version $Revision: 2043 $
 */
public class FailoverSessionDelegator extends SessionDelegator {

    private SessionFactory sessionFactory;
    private Session session = null;
    private Interceptor interceptor = null;

	/**
	 * @param sessionFactory session factory to obtain session from
	 */
    public FailoverSessionDelegator(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

	/**
	 * @param sessionFactory session factory to obtain session from
	 * @param exceptionHandler Exception handler component to use with created session
	 */
    public FailoverSessionDelegator(SessionFactory sessionFactory, ExceptionHandler exceptionHandler) {
    	super(exceptionHandler);
        this.sessionFactory = sessionFactory;
    }

	/**
	 * @param sessionFactory sessionf actory to obtain session from
	 * @param interceptor interceptor to use with created session
	 */
    public FailoverSessionDelegator(SessionFactory sessionFactory, Interceptor interceptor) {
    	this(sessionFactory);
    	setInterceptor(interceptor);
    }

	/**
	 * @param sessionFactory sessionf actory to obtain session from
	 * @param interceptor interceptor to use with created session
	 * @param exceptionHandler Exception handler component to use with created session
	 */
    public FailoverSessionDelegator(SessionFactory sessionFactory, Interceptor interceptor, ExceptionHandler exceptionHandler) {
    	this(sessionFactory, exceptionHandler);
    	setInterceptor(interceptor);
    }

    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    /**
     * Obtain hibernate session in lazy way.
     */
    public Session getDelegatedSession() {
        if (session == null) {
            try {
            	session = interceptor == null ? sessionFactory.openSession() : sessionFactory.openSession(interceptor);
            } catch (RuntimeException ex) {
                throw handleException(ex);
            }
        }

        return session;
    }

    public Connection close() throws HibernateException {
        try {
            return getDelegatedSession().close();
        } catch (HibernateException ex) {
            session = null;
            throw handleException(ex);
        } finally {
            session = null;
        }
    }

    public void invalidateDelegatedSession() throws HibernateException {
        if (this.session != null) {
            try {
                session.clear();
                session.close();
            } catch (HibernateException ex) {
                session = null;
                throw handleException(ex);
            } finally {
                session = null;
            }
        }
    }

	public Interceptor getInterceptor() {
		return interceptor;
	}

	public void setInterceptor(Interceptor interceptor) {
		this.interceptor = interceptor;
	}

}


text:
require 'timeout'

module MediaWikiVagrant
  # Helper methods for simulating command I/O.
  #
  # @see file:hooks.rb
  #
  module OutputHelper
    def stdout(bytes = 4096)
      Timeout.timeout(3) { normalize_output(@stdout_r.readpartial(bytes)) }
    end

    def stderr(bytes = 4096)
      Timeout.timeout(3) { normalize_output(@stderr_r.readpartial(bytes)) }
    end

    def enter(line)
      @stdin_w.puts line
    end

    def output_column(column)
      column = [:first, :second, :third, :forth].index(column.to_sym) if column.is_a?(String)
      stdout.lines.map { |line| line.split[column] }
    end

    def output_table(width)
      stdout.lines.map { |line| line.split(/[ \t]+/, width).map(&:strip) }
    end

    private

    def normalize_output(output)
      output.gsub(/\r?\n/, "\n").gsub(/\e\[(\d+;)?(\d*)m/, '')
    end
  end
end


text:
package org.imirp.imirp.mutation;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

import junit.framework.Assert;

import org.imirp.imirp.data.Nucleotide;
import org.imirp.imirp.mutation.MutationCallback;
import org.imirp.imirp.util.MutantSequenceGenerator;
import org.junit.Test;

public class MutationSequenceGeneratorTest {

	@Test
	public void testGeneratorSingleNucleotide(){
		final AtomicInteger ai = new AtomicInteger(0);
		MutantSequenceGenerator.mutateAndOperate("A", 0, 0, "0", new MutationCallback(){
			@Override
			public void actOnSequence(String mutatedSequence, String regionId) {
				ai.incrementAndGet();
			}
		});

		Assert.assertEquals(4, ai.get());
	}

	@Test
	public void testGeneratorFourT(){
		final AtomicInteger ai = new AtomicInteger(0);
		MutantSequenceGenerator.mutateAndOperate("TTTT", 0, 3, "0", new MutationCallback(){
			@Override
			public void actOnSequence(String mutatedSequence, String regionId) {
				ai.incrementAndGet();
			}
		});

		Assert.assertEquals((int)Math.pow(4, 4), ai.get());
	}

	@Test
	public void testSpecificSequencesAppear(){
		final AtomicInteger ai = new AtomicInteger(0);
		final AtomicBoolean aga = new AtomicBoolean(false);
		final AtomicBoolean act = new AtomicBoolean(false);
		MutantSequenceGenerator.processMutation(
				new Nucleotide[]{Nucleotide.ADENOSINE,Nucleotide.ADENOSINE,Nucleotide.ADENOSINE},
				new Nucleotide[]{Nucleotide.ADENOSINE,Nucleotide.GUANOSINE,Nucleotide.THYMIDINE},
				"0",
				new MutationCallback(){

			@Override
			public void actOnSequence(String mutatedSequence, String regionId) {
				if(mutatedSequence.equals("AGA")){
					aga.set(true);
				}else if(mutatedSequence.equals("ACT")){
					act.set(true);
				}
				ai.incrementAndGet();
			}

		}, 0);

		Assert.assertTrue(aga.get());
		Assert.assertTrue(act.get());
		Assert.assertEquals(12, ai.get());
	}
}


text:
title: Microsoft-power-bi-pro
inshort: undefined
translator: Microsoft Cognitive Services
---


text:
package roc
package postgresql

/** A Request to send a Postgresql Server
  */
case class Request(query: String)


text:
<!DOCTYPE HTML>

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>square-element Demo</title>

        <link rel="import" href="square-element.html">

This is the square-element, a didactic element to show you how to use Polymer properties such as: attrChanged, computed properties, lifecycle methods, and data binding.

        <square-element class="card full" num="4"></square-element>


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Class net.marco01809.primesworkbench.calculators.PrimeCalculator</title>
<meta name="date" content="2013-02-23">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
net.marco01809.primesworkbench.calculators.PrimeCalculator

Packages that use PrimeCalculator

Package
Description

net.marco01809.primesworkbench

net.marco01809.primesworkbench.calculators

Uses of PrimeCalculator in net.marco01809.primesworkbench

Methods in net.marco01809.primesworkbench with parameters of type PrimeCalculator

Modifier and Type
Method and Description

void
UI.addPrimeCalculator(PrimeCalculator primeCalc)

void
PrimesGUI.addPrimeCalculator(PrimeCalculator primeCalc)

Uses of PrimeCalculator in net.marco01809.primesworkbench.calculators

Subclasses of PrimeCalculator in net.marco01809.primesworkbench.calculators

Modifier and Type
Class and Description

class
PrimeBruter

class
SieveOfErathosthenes

class
SieveOfEratosthenesNative

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
<?php declare(strict_types=1);

namespace Aircury\IDEConfiguration\Manipulator;

use Aircury\IDEConfiguration\IDEConfiguration;
use Aircury\Xml\Node;

class IMLManipulator
{
    public function addIML(Node $iml, IDEConfiguration $configuration, string $moduleName): void
    {
        $module = $configuration->getModule($moduleName);
        $iml['type'] = 'WEB_MODULE';
        $iml['version'] = 4;
        $component = $iml->getNamedChild('component', ['name' => 'NewModuleRootManager']);

        $component['inherit-compiler-output'] = 'true';

        $component->getNamedChild('exclude-output');

        $content = $component->getNamedChild('content');
        $content['url'] = 'file://$MODULE_DIR$';

        foreach ($module->getExcluded() as $excludedFolder) {
            $content->getNamedChild('excludeFolder', ['url' => 'file://$MODULE_DIR$/' . $excludedFolder]);
        }

        // Library root means excluded + PHP include_path. See: https://stackoverflow.com/questions/35654320/how-to-configure-directories-when-using-a-symfony-project-in-phpstorm
        foreach ($module->getLibraries() as $libraryFolder) {
            $content->getNamedChild('excludeFolder', ['url' => 'file://$MODULE_DIR$/' . $libraryFolder]);
        }

        foreach ($module->getSources() as $sourceFolder) {
            if ('.' === $sourceFolder) {
                $sourceFolder = '';
            }

            $content->getNamedChild(
                'sourceFolder',
                ['url' => 'file://$MODULE_DIR$/' . $sourceFolder, 'isTestSource' => 'false']
            );
        }

        foreach ($module->getTests() as $sourceFolder) {
            $content->getNamedChild(
                'sourceFolder',
                ['url' => 'file://$MODULE_DIR$/' . $sourceFolder, 'isTestSource' => 'true']
            );
        }

        $component->getNamedChild('orderEntry', ['type' => 'inheritedJdk']);

        $component->getNamedChild('orderEntry', ['type' => 'sourceFolder'])['forTests'] = 'false';
    }
}


text:
package eventlog

import (
	"sync"
)

type Stage struct {
	log Log

	name string

	total         int
	currTaskIndex int

	indexLock sync.Mutex
}

func (s *Stage) BeginTask(name string) Task {
	s.indexLock.Lock()

	index := s.currTaskIndex
	s.currTaskIndex++

	s.indexLock.Unlock()

	task := Task{
		log: s.log,

		stageName: s.name,
		name:      name,

		total: s.total,
		index: index,
	}

	task.Start()

	return task
}


text:
package com.hazelcast.simulator.utils;

import com.hazelcast.simulator.common.SimulatorProperties;
import com.hazelcast.simulator.protocol.registry.ComponentRegistry;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.File;
import java.io.IOException;

import static com.hazelcast.simulator.TestEnvironmentUtils.resetUserDir;
import static com.hazelcast.simulator.TestEnvironmentUtils.setDistributionUserDir;
import static com.hazelcast.simulator.utils.FileUtils.deleteQuiet;
import static com.hazelcast.simulator.utils.FileUtils.writeText;
import static com.hazelcast.simulator.utils.ReflectionUtils.invokePrivateConstructor;
import static com.hazelcast.simulator.utils.SimulatorUtils.getPropertiesFile;
import static com.hazelcast.simulator.utils.SimulatorUtils.loadComponentRegister;
import static com.hazelcast.simulator.utils.SimulatorUtils.loadSimulatorProperties;
import static java.io.File.createTempFile;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class SimulatorUtilsTest {

    private File agentsFile;
    private ComponentRegistry componentRegistry;

    @Before
    public void setUp() throws IOException {
        agentsFile = createTempFile("AgentsFileTest", "txt");
    }

    @After
    public void tearDown() {
        deleteQuiet(agentsFile);
    }

    @Test
    public void testConstructor() throws Exception {
        invokePrivateConstructor(SimulatorUtils.class);
    }

    @Test
    public void testLoadComponentRegister() {
        writeText("192.168.1.1,10.10.10.10", agentsFile);

        componentRegistry = loadComponentRegister(agentsFile);
        assertEquals(1, componentRegistry.agentCount());
    }

    @Test(expected = CommandLineExitException.class)
    public void testLoadComponentRegister_emptyFile_withSizeCheck() {
        componentRegistry = loadComponentRegister(agentsFile, true);
    }

    @Test
    public void testLoadComponentRegister_emptyFile_withoutSizeCheck() {
        componentRegistry = loadComponentRegister(agentsFile, false);
        assertEquals(0, componentRegistry.agentCount());
    }

    @Test
    public void testLoadSimulatorProperties() {
        setDistributionUserDir();
        try {
            OptionSet options = mock(OptionSet.class);
            when(options.has(any(OptionSpec.class))).thenReturn(false);

            SimulatorProperties properties = loadSimulatorProperties(options, null);
            assertNotNull(properties);
        } finally {
            resetUserDir();
        }
    }

    @Test
    public void testGetPropertiesFile() {
        OptionSet options = mock(OptionSet.class);
        when(options.has(any(OptionSpec.class))).thenReturn(true);
        when(options.valueOf(any(OptionSpec.class))).thenReturn("test");

        File expectedFile = new File("test");
        File actualFile = getPropertiesFile(options, null);

        assertEquals(expectedFile, actualFile);
    }

    @Test
    public void testGetPropertiesFile_noPropertiesSpec() {
        OptionSet options = mock(OptionSet.class);
        when(options.has(any(OptionSpec.class))).thenReturn(false);

        File actualFile = getPropertiesFile(options, null);

        assertEquals(null, actualFile);
    }
}


text:
package org.projectspinoza.gephikit.configuration;

import org.projectspinoza.gephikit.datasource.DataSource;
import org.projectspinoza.gephikit.layouts.Layout;

public class Configuration {
	int port;
	String host;
	String selectedDataSource;
	Layout layout;
	DataSource datasource;
	String selectedLayout;
	int tagLimit;
	String nodeSizeBy;
	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	public Layout getLayout() {
		return layout;
	}

	public void setLayout(Layout layout) {
		this.layout = layout;
	}

	public String getSelectedLayout() {
		return selectedLayout;
	}

	public void setSelectedLayout(String selectedLayout) {
		this.selectedLayout = selectedLayout;
	}

	public String getSelectedDataSource() {
		return selectedDataSource;
	}

	public void setSelectedDataSource(String selectedDataSource) {
		this.selectedDataSource = selectedDataSource;
	}

	public DataSource getDatasource() {
		return datasource;
	}

	public void setDatasource(DataSource datasource) {
		this.datasource = datasource;
	}

    public int getTagLimit() {
        return tagLimit;
    }

    public void setTagLimit(int tagLimit) {
        this.tagLimit = tagLimit;
    }

    public String getNodeSizeBy() {
        return nodeSizeBy;
    }

    public void setNodeSizeBy(String nodeSizeBy) {
        this.nodeSizeBy = nodeSizeBy;
    }

}


text:
package org.cagrid.mms.service.globus.resource;

/**
 * The implementation of this MetadataModelServiceResource type.
 *
 * @created by Introduce Toolkit version 1.3
 */
public class MetadataModelServiceResource extends MetadataModelServiceResourceBase {

}


text:
/*
 * reserved comment block
 * DO NOT REMOVE OR ALTER!
 */

/*
 * Copyright  1999-2004 The Apache Software Foundation.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */
package com.sun.org.apache.xml.internal.security.keys.storage.implementations;

import java.security.cert.X509Certificate;
import java.util.Iterator;

import com.sun.org.apache.xml.internal.security.keys.storage.StorageResolverSpi;

/**
 * This {@link StorageResolverSpi} makes a single {@link X509Certificate}
 * available to the {@link com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver}.
 *
 * @author $Author: raul $
 */
public class SingleCertificateResolver extends StorageResolverSpi {

   /** Field _certificate */
   X509Certificate _certificate = null;

   /** Field _iterator */
   Iterator _iterator = null;

   /**
    *
    *
    * @param x509cert the single {@link X509Certificate}
    */
   public SingleCertificateResolver(X509Certificate x509cert) {
      this._certificate = x509cert;
      this._iterator = new InternalIterator(this._certificate);
   }

   /** @inheritDoc */
   public Iterator getIterator() {
      return this._iterator;
   }

   /**
    * Class InternalIterator
    *
    * @author $Author: raul $
    */
   class InternalIterator implements Iterator {

      /** Field _alreadyReturned */
      boolean _alreadyReturned = false;

      /** Field _certificate */
      X509Certificate _certificate = null;

      /**
       * Constructor InternalIterator
       *
       * @param x509cert
       */
      public InternalIterator(X509Certificate x509cert) {
         this._certificate = x509cert;
      }

      /** @inheritDoc */
      public boolean hasNext() {
         return (!this._alreadyReturned);
      }

      /** @inheritDoc */
      public Object next() {

         this._alreadyReturned = true;

         return this._certificate;
      }

      /**
       * Method remove
       *
       */
      public void remove() {
         throw new UnsupportedOperationException(
            "Can't remove keys from KeyStore");
      }
   }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.netapp.generated;

import com.azure.core.util.Context;
import com.azure.resourcemanager.netapp.models.Volume;

/** Samples for Volumes Update. */
public final class VolumesUpdateSamples {
    /*
     * x-ms-original-file: specification/netapp/resource-manager/Microsoft.NetApp/stable/2022-05-01/examples/Volumes_Update.json
     */
    /**
     * Sample code: Volumes_Update.
     *
     * @param manager Entry point to NetAppFilesManager.
     */
    public static void volumesUpdate(com.azure.resourcemanager.netapp.NetAppFilesManager manager) {
        Volume resource =
            manager.volumes().getWithResponse("myRG", "account1", "pool1", "volume1", Context.NONE).getValue();
        resource.update().apply();
    }
}


text:
void CNRGCodeHandler::ModelSwitch(  vector<int> &CommonQNs,
				    vector<int> &totSpos,
				    CNRGarray* pAeig,
				    CNRGbasisarray* pSingleSite,
				    CNRGmatrix* pHN,
				    vector<CNRGmatrix> &STLMatArray,
				    CNRGthermo* ThermoArray,
				    vector<double> &chi_m1){

  // Ok, this can be changed later to reduce the number of parameters
  // Leave as it is for now.

  // List of Non CNRGcodehandler objects that needs to be set/defined

  // ALL of these have to be DEFINED as fields of CNRGCodeHandler
  // STLMatArray -> MatArray (but routines need an STL vector...
  //                          SHOULD DEFINE MatArray as an STL vector in
  //                          CNRGcodehandler
  //                          and adapt in the other routines.
  //                          But leave it for now)
  //                MatArray enters with 4 elements. Add if you need more.
  // CommonQNs   -> (input)
  // totSpos     -> (input)
  // HN          -> (input)
  // NumNRGarrays (not really, just set it as NumNRGmats)
  // ThermoArray -> ThermoSTLArray (ok)

  // Defined here:

  CNRGmatrix auxNRGMat;
  vector <double> Params;

  double chi2_m1=0.0; // Second coupling into the same channel!

  // To do: getrid of ThermoArray and STLMatArray:
  // define them in codehandler class.
  // get rid of all parameters?

  ///////////////////////////////////
  ////   Model specific hamiltonians ///
  ///////////////////////////////////

// SymNo:
//  0 - OneChQS
//  1 - TwoChQS
//  2 - OneChQSz
//  3 - OneChQ
//  4 - TwoChQSP
//  5 - TwoChQSz
//  6 - OneChNupPdn
//  7 - OneChS
//  8 - OneChSz
//  9 - OneChPupPdn

// ModelNo:
//  0 - Anderson
//  1 - Kondo
//  2 - Anderson w Holstein phonons
//  3 - Chain only
//  4 - CM phonons (2ch only)
//  5 - SMM (1chQ only)
//  6 - DQD
//  7 - Anderson+Local Majorana (1ch NupPdn only)
//

// NEW: Add zEQ(z) to SuscepImp names.
//

    char zstring[30];
    char zvalue[8];
    strcpy(zstring,"_zEQ");
    if (dEqual(code_z_twist,1.0))
      strcpy(zvalue,"1");
    else
      sprintf(zvalue,"%4.2f",code_z_twist);
    strcat(zstring,zvalue);
    cout << "Zstring = " << zstring << endl;

    switch(SymNo){
    case 0: // OneChQS
      ////////////////////////////
      /////                   ////
      ///// Symmetry: OneChQS ////
      /////                   ////
      ////////////////////////////
      /// Models so far:       ///
      ///  0 - Anderson        ///
      ///  1 - Kondo           ///
      ///  3 - Chain           ///
      ///  6 - DQD             ///
      ////////////////////////////
      switch(ModelNo){
      case 0: // Single-impurity Anderson model Q,S symmetry

	// Initialize matrices (OneChQ routines work here!)
	// Jul 09: using STMatArray

	//NumThermoMats=2;

	// fN (reduced)
	STLMatArray[0].NeedOld=false;
	STLMatArray[0].UpperTriangular=false;
	STLMatArray[0].CheckForMatEl=OneChQS_cd_check;
	STLMatArray[0].CalcMatEl=OneChQS_fN_MatEl;
	STLMatArray[0].SaveMatYN=false;

	switch (calcdens){
	case 0: // OpAvg: n_d(T), n^2_d(T), S^2(T) - NEW (2012)
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.UpperTriangular=false; // update procedure only works for 'false'
	  auxNRGMat.CalcAvg=true;  // CalcAvg
	  auxNRGMat.CheckForMatEl=Diag_check;
	  auxNRGMat.CalcMatEl=ImpOnly_MatEl;
	  STLMatArray[1]=auxNRGMat; // 1 - ndot (there already)
	  STLMatArray[2]=auxNRGMat; // 2 - ndot^2 (there already)
	  STLMatArray[3]=auxNRGMat; // 3 - Sdot^2 (there already)
	  strcpy(STLMatArray[1].MatName,"Ndot");
	  strcpy(STLMatArray[2].MatName,"NdSq");
	  strcpy(STLMatArray[3].MatName,"SdSq");
	  NumNRGmats=STLMatArray.size();
	  MatArray=&STLMatArray[0]; // Need to do this after
	  // changes in STLMatArray!
	  SaveData=false;
// 	  STLMatArray.pop_back(); // 1 Matrices only
// 	  STLMatArray.pop_back(); // 1 Matrices only
// 	  STLMatArray.pop_back(); // 1 Matrices only
	  // No Thermo
	  NumThermoMats=0;
	  break;
	case 1: //Spectral density
	  STLMatArray.pop_back(); // 2 Matrices
	  STLMatArray.pop_back(); // 2 Matrices
	  NumThermoMats=0;
	  // cd operator
	  STLMatArray[1].NeedOld=true;
	  STLMatArray[1].UpperTriangular=false;
	  STLMatArray[1].CheckForMatEl=OneChQS_cd_check;
	  STLMatArray[1].CalcMatEl=OneChQS_cd_MatEl;
	  STLMatArray[1].SaveMatYN=true;
	  strcpy(STLMatArray[1].MatName,"cdot1");
	  NumNRGmats=STLMatArray.size();
	  // changes in STLMatArray!
	  SaveData=true;
	  strcpy(SaveArraysFileName,"1chQSAnderson");
	  break;
	case 2: // Thermodynamics ONLY
//	  STLMatArray.pop_back(); // 1 Matrix only
//	  STLMatArray.pop_back(); // 1 Matrix only
//	  STLMatArray.pop_back(); // 1 Matrix only
// If you want <n_d>(T), use calcdens=0
// June 2013: I'm changing this. Want to calculate ndot toghether with chi_imp
//

 	  auxNRGMat.NeedOld=true;
 	  auxNRGMat.UpperTriangular=false;
	  // update procedure only works for 'false'
 	  auxNRGMat.CalcAvg=true;  // CalcAvg
 	  auxNRGMat.CheckForMatEl=Diag_check;
 	  auxNRGMat.CalcMatEl=ImpOnly_MatEl;
 	  STLMatArray[1]=auxNRGMat; // 1 - ndot (there already)
 	  STLMatArray[2]=auxNRGMat; // 2 - ndot^2 (not right now)
 	  STLMatArray[3]=auxNRGMat; // 3 - Sdot^2 (not right now)
 	  strcpy(STLMatArray[1].MatName,"Ndot");
 	  strcpy(STLMatArray[2].MatName,"NdSq");
 	  strcpy(STLMatArray[3].MatName,"SdSq");
////////////
	  NumNRGmats=STLMatArray.size();
	  MatArray=&STLMatArray[0]; // Need to do this after
	  // changes in STLMatArray!
	  SaveData=false;
	  // Thermo
	  // Z trick in file name.
	  // Changinf chain arq names for 1chQS too (Sep 2010)
	  strcpy(ThermoArray[0].ArqName,"SuscepImp1ChQS_Anderson");
	  strcat(ThermoArray[0].ArqName,zstring);
	  strcat(ThermoArray[0].ArqName,".dat");
	  //
	  strcpy(ThermoArray[0].ChainArqName,"SuscepChain1Ch_QS");
	  strcat(ThermoArray[0].ChainArqName,zstring);
	  strcat(ThermoArray[0].ChainArqName,".dat");
	  //
	  strcpy(ThermoArray[1].ArqName,"EntropyImp1ChQS_Anderson");
	  strcat(ThermoArray[1].ArqName,zstring);
	  strcat(ThermoArray[1].ArqName,".dat");
	  //
	  strcpy(ThermoArray[1].ChainArqName,"EntropyChain1Ch_QS");
	  strcat(ThermoArray[1].ChainArqName,zstring);
	  strcat(ThermoArray[1].ChainArqName,".dat");
	  ThermoArray[0].Calc=CalcSuscep;
	  ThermoArray[0].dImpValue=1.0/8.0;
	  ThermoArray[1].Calc=CalcEntropy;
	  ThermoArray[1].dImpValue=2.0*log(2.0);
	  NumThermoMats=2;
	  break;
	case 4: // Dynamical spin susceptibility and <Sz> and <Sz^2> (2015)
	  // 5 Matrices
	  STLMatArray.push_back(auxNRGMat);
	  NumThermoMats=0;
	  // <Sz> and <Sz2> operator
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.UpperTriangular=false;
	  // update procedure only works for 'false'
	  auxNRGMat.CalcAvg=true;  // CalcAvg
	  auxNRGMat.CheckForMatEl=Diag_check;
	  auxNRGMat.CalcMatEl=ImpOnly_MatEl;

	  STLMatArray[1]=auxNRGMat; // 1 - Sz dynamical
	  STLMatArray[1].SaveMatYN=true;
	  STLMatArray[1].CalcAvg=false;
	  STLMatArray[1].CalcMatEl=OneChQS_Sz_MatEl;
	  strcpy(STLMatArray[1].MatName,"Szomega");
	  STLMatArray[1].WignerEckartL=1.0; // Needed by DM_NRG later

	  STLMatArray[2]=auxNRGMat; // 2 - Nd dynamical
	  STLMatArray[2].SaveMatYN=true;
	  STLMatArray[2].CalcAvg=false;
	  strcpy(STLMatArray[2].MatName,"Ndomega");

	  STLMatArray[3]=auxNRGMat; // 3 - <Sz2>(T) static
	  STLMatArray[3].SaveMatYN=false;
	  strcpy(STLMatArray[3].MatName,"Sz2dot");

	  STLMatArray[4]=auxNRGMat; // 4 - <Nd2>(T) static
	  STLMatArray[4].SaveMatYN=false;
	  strcpy(STLMatArray[4].MatName,"Nd2dot");

	  NumNRGmats=STLMatArray.size();
	  MatArray=&STLMatArray[0]; // Need to do this after
	  // changes in STLMatArray!
	  SaveData=true;
	  strcpy(SaveArraysFileName,"1chQSAnderson");
	  break;
	default:
	  cout << " calcdens = " << calcdens << " not implemented. Exiting. " << endl;
	  exit(0);

	}
	// end switch calcdens

	// Param for H0
	Params.push_back(Lambda);
	Params.push_back(HalfLambdaFactor);
	Params.push_back(dInitParams[0]); // U
	Params.push_back(dInitParams[2]); // ed
	Params.push_back(chi_m1[0]); // gamma

	OneChQS_SetAnderson_Hm1(Params,pAeig,STLMatArray);

	// BuildBasis params
	CommonQNs.push_back(2); // Q and S and commont QNs
	CommonQNs.push_back(0); // position of Q in old basis
	CommonQNs.push_back(1); // position of S in old basis
	CommonQNs.push_back(0); // position of Q in SingleSite
	CommonQNs.push_back(1); // position of S in SingleSite
	totSpos.push_back(1);   // SU(2) symmetry in position 1
	// HN params
	pHN->CalcHNMatEl=OneChQS_HN_MatEl;
	NumChannels=1;

	break;
	// end OneChQS Anderson model set up

      case 1: // Single-impurity Kondo model Q,S symmetry

	Nsites0=1;

	// fN (reduced)
	STLMatArray[0].NeedOld=false;
	STLMatArray[0].UpperTriangular=false;
	STLMatArray[0].CheckForMatEl=OneChQS_cd_check;
	STLMatArray[0].CalcMatEl=OneChQS_fN_MatEl;
	STLMatArray[0].SaveMatYN=false;

	STLMatArray.pop_back(); // 1 Matrix only
	STLMatArray.pop_back(); // 1 Matrix only
	STLMatArray.pop_back(); // 1 Matrix only

	switch (calcdens){
	case 0: // Levels only
	  NumThermoMats=0;
	  break;
	case 2: // Thermodynamics
	  // Z trick in file name.
	  strcpy(ThermoArray[0].ArqName,"SuscepImp1ChQS_Kondo");
	  strcat(ThermoArray[0].ArqName,zstring);
	  strcat(ThermoArray[0].ArqName,".dat");
	  strcpy(ThermoArray[0].ChainArqName,"SuscepChain1Ch_QS");
	  strcat(ThermoArray[0].ChainArqName,zstring);
	  strcat(ThermoArray[0].ChainArqName,".dat");
	  strcpy(ThermoArray[1].ArqName,"EntropyImp1ChQS_Kondo");
	  strcat(ThermoArray[1].ArqName,zstring);
	  strcat(ThermoArray[1].ArqName,".dat");
	  strcpy(ThermoArray[1].ChainArqName,"EntropyChain1Ch_QS");
	  strcat(ThermoArray[1].ChainArqName,zstring);
	  strcat(ThermoArray[1].ChainArqName,".dat");
	  // Values for the single-impurity Kondo model
	  ThermoArray[0].Calc=CalcSuscep;
	  ThermoArray[0].dImpValue=1.0/4.0;
	  ThermoArray[1].Calc=CalcEntropy;
	  ThermoArray[1].dImpValue=log(2.0);
	  NumThermoMats=2;
	  break;

	default:
	  cout << " Calculating levels only " << endl;

	}
	// end switch calcdens

	// Param for H0
	Params.push_back(Lambda);
	Params.push_back(HalfLambdaFactor);
	Params.push_back(chi_m1[0]); // will become Jtilde

	//"chi_m1[0]"= sqrt(Fsq*rho_0*J_0/pi)/(sqrt(Lambda)*HalfLambdaFactor);

	cout << " Fsq = " << Chains[0].Fsq
	     << " rho0 J0  = " << Lambda*HalfLambdaFactor*HalfLambdaFactor*chi_m1[0]*chi_m1[0]*pi/Chains[0].Fsq << endl;

	OneChQS_SetKondoH0(Params,pAeig,pSingleSite,STLMatArray);

	// BuildBasis params
	CommonQNs.push_back(2); // Q and S and commont QNs
	CommonQNs.push_back(0); // position of Q in old basis
	CommonQNs.push_back(1); // position of S in old basis
	CommonQNs.push_back(0); // position of Q in SingleSite
	CommonQNs.push_back(1); // position of S in SingleSite
	totSpos.push_back(1);   // SU(2) symmetry in position 1
	// HN params
	pHN->CalcHNMatEl=OneChQS_HN_MatEl;
	NumChannels=1;
	// Set chi_0 to enter HN!
	chi_m1[0]=Chains[0].GetChin(0); // Should be EQUAL to chiN(0,Lambda) if Square
	cout << " chi_0= " << chi_m1[0]
	     << " Square band chi_0 : " << chiN(0,Lambda)
	     << endl;

	break;
	// end OneChQS Kondo model set up

      case 3: // Chain only

	ZeroParams();
	Nsites0=1;
	NumThermoMats=2;

	// fN (reduced)
	STLMatArray[0].NeedOld=false;
	STLMatArray[0].UpperTriangular=false;
	STLMatArray[0].CheckForMatEl=OneChQS_cd_check;
	STLMatArray[0].CalcMatEl=OneChQS_fN_MatEl;
	STLMatArray.pop_back(); // Only ONE array
	STLMatArray.pop_back(); // Only ONE array
	STLMatArray.pop_back(); // Only ONE array
	// Set ChainH0: SingleSite is already set, just get Aeig and STLMatArray.
	OneChQS_SetChainH0(pAeig,STLMatArray);
	NumNRGmats=STLMatArray.size();
	MatArray=&STLMatArray[0]; // Need to do this after
	SaveData=false;
	// BuildBasis params
	CommonQNs.push_back(2); // Q and S and commont QNs
	CommonQNs.push_back(0); // position of Q in old basis
	CommonQNs.push_back(1); // position of S in old basis
	CommonQNs.push_back(0); // position of Q in SingleSite
	CommonQNs.push_back(1); // position of S in SingleSite
	totSpos.push_back(1);   // SU(2) symmetry in position 1
	// HN params
	pHN->CalcHNMatEl=OneChQS_HN_MatEl;
	NumChannels=1;
	if (BandNo==0){
	  chi_m1[0]=chiN(0,Lambda); // is actually chi0 // chiN is a codehandler func
	// Valid ONLY for SquareBand, z_twist=1! Check side dot calcs...
	}
	else{chi_m1[0]=Chains[0].GetChin(0);}
	// Need to change chain files for ALL Models!!
	//strcpy(ThermoArray[0].ChainArqName,"SuscepChain1Ch_QS.dat");
	strcpy(ThermoArray[0].ChainArqName,"SuscepChain1Ch_QS");
	strcat(ThermoArray[0].ChainArqName,zstring);
	strcat(ThermoArray[0].ChainArqName,".dat");
	//strcpy(ThermoArray[1].ChainArqName,"EntropyChain1Ch_QS.dat");
	strcpy(ThermoArray[1].ChainArqName,"EntropyChain1Ch_QS");
	strcat(ThermoArray[1].ChainArqName,zstring);
	strcat(ThermoArray[1].ChainArqName,".dat");
	break;

      case 6: // 1chQS Double Quantum dot

	cout << " Implementing DQD case... " << endl;

	chi2_m1=sqrt(2.0*dInitParams[4]/pi)/(sqrt(Lambda)*HalfLambdaFactor);

	Params.push_back(Lambda);
	Params.push_back(HalfLambdaFactor);
	Params.push_back(dInitParams[0]); // U1
	Params.push_back(dInitParams[2]); // ed1
	Params.push_back(chi_m1[0]); // gamma1
	Params.push_back(dInitParams[3]); // U2
	Params.push_back(dInitParams[5]); // ed2
	Params.push_back(chi2_m1); // gamma2

	// Question: Can these things be implemented within the subroutine??

	// fN (reduced)
	STLMatArray[0].NeedOld=false;
	STLMatArray[0].UpperTriangular=false;
	STLMatArray[0].CheckForMatEl=OneChQS_cd_check;
	STLMatArray[0].CalcMatEl=OneChQS_fN_MatEl;

	switch (calcdens){
	case 0: // Calculates Op averages only
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.UpperTriangular=false; // update procedure only works for 'false'
	  auxNRGMat.CalcAvg=true;  // CalcAvg
	  auxNRGMat.CheckForMatEl=Diag_check;
	  auxNRGMat.CalcMatEl=ImpOnly_MatEl;
	  STLMatArray[1]=auxNRGMat; // 1 - ndot (there already)
	  STLMatArray[2]=auxNRGMat; // 2 - ndot^2 (there already)
	  STLMatArray[3]=auxNRGMat; // 3 - Sdot^2 (there already)
	  STLMatArray.push_back(auxNRGMat); // 4 - S1 dot S2
	  strcpy(STLMatArray[1].MatName,"Ndqd");
	  strcpy(STLMatArray[2].MatName,"NdqdSq");
	  strcpy(STLMatArray[3].MatName,"SdqdSq");
	  strcpy(STLMatArray[4].MatName,"S1dotS2");
	  NumNRGmats=STLMatArray.size();
	  MatArray=&STLMatArray[0]; // Need to do this after
	  // changes in STLMatArray!
	  SaveData=false;
	  break;
	case 1: // Calc Spectral functions
	  // All operators have the same Checks/MatEls in |Q> basis
	  // what changes is the initial set-up
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.CheckForMatEl=OneChQS_cd_check;
	  auxNRGMat.CalcMatEl=OneChQS_cd_MatEl;
	  auxNRGMat.SaveMatYN=true;
	  STLMatArray[1]=auxNRGMat; // 1 - cd1
	  STLMatArray[2]=auxNRGMat; // 2 - cd2
	  strcpy(STLMatArray[1].MatName,"cdot1");
	  strcpy(STLMatArray[2].MatName,"cdot2");
	  STLMatArray.pop_back(); // 3 elements only
	  NumNRGmats=STLMatArray.size();
	  MatArray=&STLMatArray[0]; // Need to do this after
	  // changes in STLMatArray!
	  SaveData=true;
	  strcpy(SaveArraysFileName,"DQD");
	  break;
	case 2: // Thermodynamics
	  STLMatArray.pop_back(); // 1 Matrix only
	  STLMatArray.pop_back(); // 1 Matrix only
	  STLMatArray.pop_back(); // 1 Matrix only
	  //strcpy(ThermoArray[0].ArqName,"SuscepImp1ChQS_DQD.dat");
	  //strcpy(ThermoArray[0].ChainArqName,"SuscepChain1Ch_QS.dat");
	  strcpy(ThermoArray[0].ArqName,"SuscepImp1ChQS_DQD");
	  strcat(ThermoArray[0].ArqName,zstring);
	  strcat(ThermoArray[0].ArqName,".dat");
	  strcpy(ThermoArray[0].ChainArqName,"SuscepChain1Ch_QS");
	  strcat(ThermoArray[0].ChainArqName,zstring);
	  strcat(ThermoArray[0].ChainArqName,".dat");
	  //strcpy(ThermoArray[1].ArqName,"EntropyImp1ChQS_DQD.dat");
	  //strcpy(ThermoArray[1].ChainArqName,"EntropyChain1Ch_QS.dat");
	  strcpy(ThermoArray[1].ArqName,"EntropyImp1ChQS_DQD");
	  strcat(ThermoArray[1].ArqName,zstring);
	  strcat(ThermoArray[1].ArqName,".dat");
	  strcpy(ThermoArray[1].ChainArqName,"EntropyChain1Ch_QS");
	  strcat(ThermoArray[1].ChainArqName,zstring);
	  strcat(ThermoArray[1].ChainArqName,".dat");

	  ThermoArray[0].Calc=CalcSuscep;
	  ThermoArray[0].dImpValue=1.0/4.0; // check. Irrelevant, actually.
	  ThermoArray[1].Calc=CalcEntropy;
	  ThermoArray[1].dImpValue=4.0*log(2.0);
	  NumThermoMats=2;
	  break;

	default:
	  cout << " Calculating levels only " << endl;

	}
	// end switch calcdens

	OneChQS_SetH0_DQD(Params,pAeig,pSingleSite,STLMatArray);

	// BuildBasis params
	CommonQNs.push_back(2); // Q and S and commont QNs
	CommonQNs.push_back(0); // position of Q in old basis
	CommonQNs.push_back(1); // position of S in old basis
	CommonQNs.push_back(0); // position of Q in SingleSite
	CommonQNs.push_back(1); // position of S in SingleSite
	totSpos.push_back(1);   // SU(2) symmetry in position 1
	// HN params
	pHN->CalcHNMatEl=OneChQS_HN_MatEl;
	Nsites0=1;
	NumChannels=1;
	chi_m1[0]=chiN(0,Lambda);

	break;

      default:
	cout << " Model not implemented for this symmetry. Exiting... " << endl;
	exit(0);
      }
      // end switch ModelNo
      break;

    case 1: // TwoChQS
      ////////////////////////////
      /////                   ////
      ///// Symmetry: TwoChQS ////
      /////                   ////
      ////////////////////////////
      /// Models so far:       ///
      ///  1 - Kondo           ///
      ///  3 - Chain           ///
      ////////////////////////////
      switch(ModelNo){
      case 1:
	// Single-impurity Kondo model Q,S symmetry
	cout << " Implementing the two-Channel Kondo model " << endl;

	Nsites0=1;
	NumThermoMats=2;

	Params.clear();

	//Params.push_back(Lambda);
	//Params.push_back(HalfLambdaFactor); Do we need this??

	// Coupling to second channel
// 	chi2_m1=sqrt(2.0*dInitParams[4]/pi)/(sqrt(Lambda)*HalfLambdaFactor);
	chi_m1[1]=sqrt(2.0*dInitParams[4]/pi)/(sqrt(Lambda)*HalfLambdaFactor);

	cout << " FOR NOW, not including the Lambda factor in J1,J2 " << endl;

	Params.push_back(dInitParams[1]); // J1
	Params.push_back(dInitParams[4]); // J2

	switch (calcdens){
	case 0: // Levels only
	  NumThermoMats=0;
	  break;
	case 2:
	  // Z trick in file name.
	  strcpy(ThermoArray[0].ArqName,"SuscepImp2ChQS_Kondo");
	  strcat(ThermoArray[0].ArqName,zstring);
	  strcat(ThermoArray[0].ArqName,".dat");
	  strcpy(ThermoArray[0].ChainArqName,"SuscepChain2Ch_QS");
	  strcat(ThermoArray[0].ChainArqName,zstring);
	  strcat(ThermoArray[0].ChainArqName,".dat");
	  strcpy(ThermoArray[1].ArqName,"EntropyImp2ChQS_Kondo");
	  strcat(ThermoArray[1].ArqName,zstring);
	  strcat(ThermoArray[1].ArqName,".dat");
	  strcpy(ThermoArray[1].ChainArqName,"EntropyChain2Ch_QS");
	  strcat(ThermoArray[1].ChainArqName,zstring);
	  strcat(ThermoArray[1].ChainArqName,".dat");
	  // Values for the single-impurity Kondo model
	  ThermoArray[0].Calc=CalcSuscep;
	  ThermoArray[0].dImpValue=1.0/4.0;
	  ThermoArray[1].Calc=CalcEntropy;
	  ThermoArray[1].dImpValue=log(2.0);
	  NumThermoMats=2;
	  break;
// 	case 3:
// 	  break;
	default:
	  cout << " Please select calcdens=0 or 2 for TwoChQS_Kondo " << endl;
	  exit(0);
	}
	// end switch calcdens

	STLMatArray.pop_back(); // 2 Matrices
	STLMatArray.pop_back(); // 2 Matrices

	// fN_ch1 (reduced)
	STLMatArray[0].NeedOld=false;
	STLMatArray[0].UpperTriangular=false; // WHY? Not symmetric
	STLMatArray[0].SaveMatYN=false;
	STLMatArray[0].CheckForMatEl=TwoChQS_cd_check;
	STLMatArray[0].CalcMatEl=TwoChQS_fNch1_MatEl;

	// fN_ch2 (reduced)
	STLMatArray[1].NeedOld=false;
	STLMatArray[1].UpperTriangular=false;  // WHY? Not symmetric
	STLMatArray[1].SaveMatYN=false;
	STLMatArray[1].CheckForMatEl=TwoChQS_cd_check;
	STLMatArray[1].CalcMatEl=TwoChQS_fNch2_MatEl;

	TwoChQS_SetKondoH0(Params,pSingleSite,pAeig,STLMatArray);
	// Do I need pAbasis?? Nope...

	// BuildBasis params
	CommonQNs.push_back(2); // Q and S and commont QNs
	CommonQNs.push_back(0); // position of Q in old basis
	CommonQNs.push_back(1); // position of S in old basis
	CommonQNs.push_back(0); // position of Q in SingleSite
	CommonQNs.push_back(1); // position of S in SingleSite
	totSpos.push_back(1);   // SU(2) symmetry in position 1
	// Hamiltonian/Code params
	// Need to check these things. (May 8/2011)
	pHN->CalcHNMatEl=TwoChQS_HN_MatEl;
	Nsites0=1;
	NumNRGmats=2;
	NumChannels=2; // Not needed...

	// Is this ok? What if there is a pseudogap?? Solved! (2019)
	chi_m1[0]=chiN(0,Lambda);
// 	chi2_m1=chiN(0,Lambda);
	chi_m1[1]=chiN(0,Lambda);
	if (BandNo==0){
	  chi_m1[0]=chiN(0,Lambda); // is actually chi0 // chiN is a codehandler func
// 	  chi2_m1=chiN(0,Lambda);
	  chi_m1[1]=chiN(0,Lambda);
	}
	// Valid ONLY for SquareBand, z_twist=1! Check side dot calcs...
	else{
	  chi_m1[0]=Chains[0].GetChin(0);
// 	  chi2_m1=Chains[1].GetChin(0);
	  chi_m1[1]=Chains[1].GetChin(0);
	}
	///////////

	// Debugging: Print and Exit
	pAeig->PrintEn();
	//exit(0);
	break;
      case 3: // TwoChQS Chain only

	ZeroParams();
	Nsites0=1;
	NumNRGmats=2;
	NumChannels=2;
	NumThermoMats=2;

	strcpy(ThermoArray[0].ChainArqName,"SuscepChain2Ch_QS");
	strcat(ThermoArray[0].ChainArqName,zstring);
	strcat(ThermoArray[0].ChainArqName,".dat");
	strcpy(ThermoArray[1].ChainArqName,"EntropyChain2Ch_QS");
	strcat(ThermoArray[1].ChainArqName,zstring);
	strcat(ThermoArray[1].ChainArqName,".dat");

	STLMatArray.pop_back(); // 2 Matrices
	STLMatArray.pop_back(); // 2 Matrices
	// fN_ch1 (reduced)
	STLMatArray[0].NeedOld=false;
	STLMatArray[0].UpperTriangular=false; // WHY? Not symmetric
	STLMatArray[0].SaveMatYN=false;
	STLMatArray[0].CheckForMatEl=TwoChQS_cd_check;
	STLMatArray[0].CalcMatEl=TwoChQS_fNch1_MatEl;
	// fN_ch2 (reduced)
	STLMatArray[1].NeedOld=false;
	STLMatArray[1].UpperTriangular=false;  // WHY? Not symmetric
	STLMatArray[1].SaveMatYN=false;
	STLMatArray[1].CheckForMatEl=TwoChQS_cd_check;
	STLMatArray[1].CalcMatEl=TwoChQS_fNch2_MatEl;

	TwoChQS_SetH0Chain(pAeig,pSingleSite,STLMatArray);
	// Debugging: Print and Exit
	pAeig->PrintEn();

	// BuildBasis params
	CommonQNs.push_back(2); // Q and S and commont QNs
	CommonQNs.push_back(0); // position of Q in old basis
	CommonQNs.push_back(1); // position of S in old basis
	CommonQNs.push_back(0); // position of Q in SingleSite
	CommonQNs.push_back(1); // position of S in SingleSite
	totSpos.push_back(1);   // SU(2) symmetry in position 1
	// Hamiltonian/Code params
	pHN->CalcHNMatEl=TwoChQS_HN_MatEl;
	if (BandNo==0){
	  chi_m1[0]=chiN(0,Lambda); // is actually chi0 // chiN is a codehandler func
	  chi_m1[1]=chiN(0,Lambda);
	}
	// Valid ONLY for SquareBand, z_twist=1! Check side dot calcs...
	else{
	  chi_m1[0]=Chains[0].GetChin(0);
	  chi_m1[1]=Chains[1].GetChin(0);
	}
	///////////
	break;
      default:
	cout << " Model not implemented for this symmetry. Exiting... " << endl;
	exit(0);
      }
      // end switch ModelNo
      break;

    case 2: // OneChQSz
      ////////////////////////////
      /////                    ////
      ///// Symmetry: OneChQSz ////
      /////                    ////
      //////////////////////////////////////
      /// Models so far:                 ///
      ///  0 - Anderson (Bfield)         ///
      ///  3 - Chain                     ///
      ///  6 - DQD (Zeeman in both dots) ///
      //////////////////////////////////////

      switch(ModelNo){
      case 0: // Anderson

	// Initialize matrices (OneChQ routines work here!)
	// Jul 09: using STMatArray

	STLMatArray[0].NeedOld=false;
	STLMatArray[0].CheckForMatEl=OneChQ_cd_check; //WHY???
	STLMatArray[0].CalcMatEl=OneChQ_fNup_MatEl;
	STLMatArray[0].SaveMatYN=false;

	STLMatArray[1].NeedOld=false;
	STLMatArray[1].CheckForMatEl=OneChQ_cd_check; //WHY???
	STLMatArray[1].CalcMatEl=OneChQ_fNdn_MatEl;
	STLMatArray[1].SaveMatYN=false;

	// Param for H0
	Params.push_back(dInitParams[0]); // U
	Params.push_back(dInitParams[2]); // ed
	Params.push_back(Lambda);
	Params.push_back(HalfLambdaFactor);
	Params.push_back(dInitParams[3]);        // Mag Field

	switch (calcdens){
	case 0: // OpAvg: n_d(T), S_z(T) -(2013)
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.UpperTriangular=false; // update procedure only works for 'false'
	  auxNRGMat.CalcAvg=true;  // CalcAvg
	  auxNRGMat.CheckForMatEl=Diag_check;
	  auxNRGMat.CalcMatEl=ImpOnly_MatEl;
	  STLMatArray[2]=auxNRGMat; // 2 - ndot (there already)
	  STLMatArray[3]=auxNRGMat; // 3 - Sz (there already)
	  strcpy(STLMatArray[2].MatName,"Ndot");
	  strcpy(STLMatArray[3].MatName,"Szdot");
	  // changes in STLMatArray!
	  SaveData=false;
	  // No Thermo
	  NumThermoMats=0;
	  break;
 	case 1: //Spectral density
	  // cd_up and cd_dn (OneChQSz_SetAnderson equals
	  // MatArray[2,3] to MatArray[0,1]
	  STLMatArray[2].NeedOld=true;
	  STLMatArray[2].CheckForMatEl=OneChQSz_cdup_check;
	  STLMatArray[2].CalcMatEl=OneChQSz_cdup_MatEl;
	  STLMatArray[2].SaveMatYN=true;

	  STLMatArray[3].NeedOld=true;
	  STLMatArray[3].CheckForMatEl=OneChQSz_cddn_check;
	  STLMatArray[3].CalcMatEl=OneChQSz_cddn_MatEl;
	  STLMatArray[3].SaveMatYN=true;

	  strcpy(STLMatArray[2].MatName,"cdup");
	  strcpy(STLMatArray[3].MatName,"cddn");

	  cout << " N = -1" << endl;
	  cout << " cdN_up : " << endl;
	  STLMatArray[2].PrintAllBlocks();
	  cout << " cdN_dn : " << endl;
	  STLMatArray[3].PrintAllBlocks();

	  SaveData=true;

 	  break;
 	case 2: // Thermodynamics ONLY

	  STLMatArray.pop_back(); // 2 Matrices only
	  STLMatArray.pop_back(); // 2 Matrices only
	  strcpy(ThermoArray[0].ArqName,"SuscepImp1ChQSz");
	  strcat(ThermoArray[0].ArqName,zstring);
	  strcat(ThermoArray[0].ArqName,".dat");
	  strcpy(ThermoArray[0].ChainArqName,"SuscepChain1Ch_QSz");
	  strcat(ThermoArray[0].ChainArqName,zstring);
	  strcat(ThermoArray[0].ChainArqName,".dat");

	  strcpy(ThermoArray[1].ArqName,"EntropyImp1ChQSz");
	  strcat(ThermoArray[1].ArqName,zstring);
	  strcat(ThermoArray[1].ArqName,".dat");
	  strcpy(ThermoArray[1].ChainArqName,"EntropyChain1Ch_QSz");
	  strcat(ThermoArray[1].ChainArqName,zstring);
	  strcat(ThermoArray[1].ChainArqName,".dat");

	  ThermoArray[0].Calc=CalcSuscep;
	  ThermoArray[0].dImpValue=1.0/8.0; // check
	  ThermoArray[1].Calc=CalcEntropy;
	  ThermoArray[1].dImpValue=2.0*log(2.0);
	  NumThermoMats=2;
	  SaveData=false;

 	  break;

	case 4: // Dynamical spin susceptibility and <Sz> and <Sz^2> (2013)
	  // 6 Matrices
	  STLMatArray.push_back(auxNRGMat);
	  STLMatArray.push_back(auxNRGMat);
	  NumThermoMats=0;
	  // <Sz> and <Sz2> operator
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.UpperTriangular=false;
	  // update procedure only works for 'false'
	  auxNRGMat.CalcAvg=true;  // CalcAvg
	  auxNRGMat.CheckForMatEl=Diag_check;
	  auxNRGMat.CalcMatEl=ImpOnly_MatEl;

	  STLMatArray[2]=auxNRGMat; // 2 - Sz dynamical
	  STLMatArray[2].SaveMatYN=true;
	  STLMatArray[2].CalcAvg=false;

	  STLMatArray[3]=auxNRGMat; // 3 - Nd dynamical
	  STLMatArray[3].SaveMatYN=true;
	  STLMatArray[3].CalcAvg=false;

	  STLMatArray[4]=auxNRGMat; // 4 - <Sz2>(T) static
	  STLMatArray[4].SaveMatYN=false;

	  STLMatArray[5]=auxNRGMat; // 5 - <Nd2>(T) static
	  STLMatArray[5].SaveMatYN=false;

	  strcpy(STLMatArray[2].MatName,"Szomega");
	  strcpy(STLMatArray[3].MatName,"Ndomega");
	  strcpy(STLMatArray[4].MatName,"Sz2dot");
	  strcpy(STLMatArray[5].MatName,"Nd2dot");

	  NumNRGmats=STLMatArray.size();
	  // changes in STLMatArray!
	  SaveData=true;
	  strcpy(SaveArraysFileName,"1chQSzAnderson");
	  break;

 	case 5: //Spectral density with Self-energy trick
	  // 6 Matrices
	  STLMatArray.push_back(auxNRGMat);
	  STLMatArray.push_back(auxNRGMat);
	  // cd_up and cd_dn
	  STLMatArray[2].NeedOld=true;
	  STLMatArray[2].CheckForMatEl=OneChQSz_cdup_check;
	  STLMatArray[2].CalcMatEl=OneChQSz_cdup_MatEl;
	  STLMatArray[2].SaveMatYN=true;

	  STLMatArray[3].NeedOld=true;
	  STLMatArray[3].CheckForMatEl=OneChQSz_cddn_check;
	  STLMatArray[3].CalcMatEl=OneChQSz_cddn_MatEl;
	  STLMatArray[3].SaveMatYN=true;

	  // <cd_up N_dn> and <cd_dn N_up>
	  STLMatArray[4].NeedOld=true;
	  STLMatArray[4].CheckForMatEl=OneChQSz_cdup_check;
	  STLMatArray[4].CalcMatEl=OneChQSz_cdup_MatEl; // Same Fermi Factor
	  STLMatArray[4].SaveMatYN=true;

	  STLMatArray[5].NeedOld=true;
	  STLMatArray[5].CheckForMatEl=OneChQSz_cddn_check;
	  STLMatArray[5].CalcMatEl=OneChQSz_cddn_MatEl; // Same Fermi Factor
	  STLMatArray[5].SaveMatYN=true;

	  strcpy(STLMatArray[2].MatName,"cdup");
	  strcpy(STLMatArray[3].MatName,"cddn");
	  strcpy(STLMatArray[4].MatName,"cdupNdn");
	  strcpy(STLMatArray[5].MatName,"cddnNup");

	  SaveData=true;

 	  break;

	default:
	  cout << " calcdens = " << calcdens << " not implemented. Exiting. " << endl;
	  exit(0);

	}
	// end switch calcdens

	OneChQSz_SetAnderson_Hm1(Params,pAeig,STLMatArray);

	////////////////////////

	// BuildBasis params
	CommonQNs.push_back(2); // No of common QNs
	CommonQNs.push_back(0); // pos of QN 1 in old
	CommonQNs.push_back(1); // pos of QN 2 in old

	CommonQNs.push_back(0); // pos of QN 1 in SingleSite
	CommonQNs.push_back(1); // pos of QN 1 in SingleSite

	// No total S variables. Leave totSpos empty
	pHN->CalcHNMatEl=OneChQSz_HN_MatEl;

	// Wrap up
	NumChannels=1;
	Nsites0=0;
	NumNRGmats=STLMatArray.size();
	MatArray=&STLMatArray[0]; // Need to do this after
	// changes in STLMatArray!

	break;

      case 3: // OneChQSz Chain only

	ZeroParams();
	Nsites0=1;
	NumThermoMats=2;
	NumChannels=1;

	// fN_up and fN_dn
	// fd_up
	STLMatArray[0].NeedOld=false;
	STLMatArray[0].UpperTriangular=false;
	STLMatArray[0].CheckForMatEl=OneChQSz_cdup_check; //This should work
	STLMatArray[0].CalcMatEl=OneChQSz_fNup_MatEl;
	STLMatArray[0].SaveMatYN=false;

	// fd_dn
	STLMatArray[1].NeedOld=false;
	STLMatArray[1].UpperTriangular=false;
	STLMatArray[1].CheckForMatEl=OneChQSz_cddn_check; //This should work
	STLMatArray[1].CalcMatEl=OneChQSz_fNdn_MatEl;
	STLMatArray[1].SaveMatYN=false;

	STLMatArray.pop_back(); // Only TWO mats
	STLMatArray.pop_back(); // Only TWO mats
	// Set ChainH0: SingleSite is already set, just get Aeig and STLMatArray.
	OneChQSz_SetChainH0(pAeig,STLMatArray);
	NumNRGmats=STLMatArray.size();
	MatArray=&STLMatArray[0]; // Need to do this after
	SaveData=false;
	// BuildBasis params
	CommonQNs.push_back(2); // Q and Sz and commont QNs
	CommonQNs.push_back(0); // position of Q in old basis
	CommonQNs.push_back(1); // position of Sz in old basis
	CommonQNs.push_back(0); // position of Q in SingleSite
	CommonQNs.push_back(1); // position of Sz in SingleSite

	// No total S variables. Leave totSpos empty
	pHN->CalcHNMatEl=OneChQSz_HN_MatEl;

	if (BandNo==0){
	  chi_m1[0]=chiN(0,Lambda); // is actually chi0 // chiN is a codehandler func
	// Valid ONLY for SquareBand, z_twist=1! Check side dot calcs...
	}
	else{chi_m1[0]=Chains[0].GetChin(0);}

	NumNRGmats=STLMatArray.size(); // DO I STILL NEED THIS???
	MatArray=&STLMatArray[0]; // Need to do this after
	// changes in STLMatArray!

	// Need to change chain files for ALL Models!!
	strcpy(ThermoArray[0].ChainArqName,"SuscepChain1Ch_QSz");
	strcat(ThermoArray[0].ChainArqName,zstring);
	strcat(ThermoArray[0].ChainArqName,".dat");
	strcpy(ThermoArray[1].ChainArqName,"EntropyChain1Ch_QSz");
	strcat(ThermoArray[1].ChainArqName,zstring);
	strcat(ThermoArray[1].ChainArqName,".dat");
	break;
	// end OneChQSz chain only

      case 6: // OneChQSz DQD (Zeeman in both dots)

	// Initialize matrices (OneChQ routines work here!)
	// Jul 09: using STMatArray
	// fd_up
	STLMatArray[0].NeedOld=false;
	STLMatArray[0].CheckForMatEl=OneChQSz_cdup_check; //This should work
	STLMatArray[0].CalcMatEl=OneChQSz_fNup_MatEl;
	STLMatArray[0].SaveMatYN=false;

	// fd_dn
	STLMatArray[1].NeedOld=false;
	STLMatArray[1].CheckForMatEl=OneChQSz_cddn_check; //This should work
	STLMatArray[1].CalcMatEl=OneChQSz_fNdn_MatEl;
	STLMatArray[1].SaveMatYN=false;

	// Param for H0 (11 parameters)
	Params.push_back(Lambda);
	Params.push_back(HalfLambdaFactor);

	Params.push_back(dInitParams[0]); // U1
	Params.push_back(dInitParams[2]); // ed1
	Params.push_back(chi_m1[0]); // gamma1
	Params.push_back(dInitParams[7]); // Bmag1

	Params.push_back(dInitParams[3]); // U2
	Params.push_back(dInitParams[5]); // ed2
	chi2_m1=sqrt(2.0*dInitParams[4]/pi)/(sqrt(Lambda)*HalfLambdaFactor);
	Params.push_back(chi2_m1); // gamma2
	Params.push_back(dInitParams[8]); // Bmag2

	Params.push_back(dInitParams[6]); // lambda

	switch (calcdens){
	case 1: // Calculates spectral densities
	  // cd_up and cd_dn (OneChQSz_SetAnderson equals
	  // c1_up
	  STLMatArray[2].NeedOld=true;
	  STLMatArray[2].CheckForMatEl=OneChQSz_cdup_check;
	  STLMatArray[2].CalcMatEl=OneChQSz_cdup_MatEl;
	  STLMatArray[2].SaveMatYN=true;
	  strcpy(STLMatArray[2].MatName,"cdot1_up");
	  // c1_dn
	  STLMatArray[3].NeedOld=true;
	  STLMatArray[3].CheckForMatEl=OneChQSz_cddn_check;
	  STLMatArray[3].CalcMatEl=OneChQSz_cddn_MatEl;
	  STLMatArray[3].SaveMatYN=true;
	  strcpy(STLMatArray[3].MatName,"cdot1_dn");
	  // c2_up
	  auxNRGMat=STLMatArray[2];
	  STLMatArray.push_back(auxNRGMat);
	  strcpy(STLMatArray[4].MatName,"cdot2_up");
	  // c2_dn
	  auxNRGMat=STLMatArray[3];
	  STLMatArray.push_back(auxNRGMat);
	  strcpy(STLMatArray[5].MatName,"cdot2_dn");
	  // changes in STLMatArray
	  SaveData=true;
	  strcpy(SaveArraysFileName,"DQD_QSz");

	  break;
	case 2: // Thermodynamics for DQD+Zeeman
	  STLMatArray.pop_back(); // 2 Matrices only
	  STLMatArray.pop_back(); // 2 Matrices only
	  //strcpy(ThermoArray[0].ArqName,"SuscepImp1ChQSz_DQD.dat");
	  strcpy(ThermoArray[0].ArqName,"SuscepImp1ChQSz_DQD");
	  strcat(ThermoArray[0].ArqName,zstring);
	  strcat(ThermoArray[0].ArqName,".dat");
	  strcpy(ThermoArray[0].ChainArqName,"SuscepChain1Ch_QSz");
	  strcat(ThermoArray[0].ChainArqName,zstring);
	  strcat(ThermoArray[0].ChainArqName,".dat");
	  //strcpy(ThermoArray[1].ArqName,"EntropyImp1ChQSz_DQD.dat");
	  strcpy(ThermoArray[1].ArqName,"EntropyImp1ChQSz_DQD");
	  strcat(ThermoArray[1].ArqName,zstring);
	  strcat(ThermoArray[1].ArqName,".dat");
	  strcpy(ThermoArray[1].ChainArqName,"EntropyChain1Ch_QSz");
	  strcat(ThermoArray[1].ChainArqName,zstring);
	  strcat(ThermoArray[1].ChainArqName,".dat");

	  ThermoArray[0].Calc=CalcSuscep;
	  ThermoArray[0].dImpValue=1.0/4.0; // check
	  ThermoArray[1].Calc=CalcEntropy;
	  ThermoArray[1].dImpValue=4.0*log(2.0);
	  NumThermoMats=2;
	  SaveData=false;

	  break;

	default:
	  cout << " Please select calcdens=1,2 or 3 for 1chQSz_DQD " << endl;
	  exit(0);
	}
	// end switch calcdens

	OneChQSz_SetH0_DQD(Params,pAeig,pSingleSite,STLMatArray);

	// Wrap up
	NumChannels=1;
	Nsites0=1;
	NumNRGmats=STLMatArray.size();
	MatArray=&STLMatArray[0]; // Need to do this after
	if (BandNo==0)
	  chi_m1[0]=chiN(0,Lambda); // is actually chi0
	// Valid ONLY for SquareBand, z_twist=1! Check side dot calcs...
	else
	  chi_m1[0]=Chains[0].GetChin(0);
	///////////
	// BuildBasis params
	CommonQNs.push_back(2); // No of common QNs
	CommonQNs.push_back(0); // pos of QN 1 in old
	CommonQNs.push_back(1); // pos of QN 2 in old
	CommonQNs.push_back(0); // pos of QN 1 in SingleSite
	CommonQNs.push_back(1); // pos of QN 1 in SingleSite
	// No total S variables. Leave totSpos empty
	pHN->CalcHNMatEl=OneChQSz_HN_MatEl;

	break;
	// end DQD 1chQSz

      default:
	cout << " Model not implemented for this symmetry. Exiting... " << endl;
	exit(0);
      }
      // end switch ModelNo
      break;
    case 3: // OneChQ
      ///// Symmetry: OneChQ ////
      ////////////////////////////
      /////                  ////
      ///// Symmetry: OneChQ ////
      /////                  ////
      ////////////////////////////
      /// Models so far:       ///
      ///  0 - Anderson        ///
      ///  5 - SMM             ///
      ////////////////////////////

      switch(ModelNo){
      case 0: // Anderson

	// Initialize matrices (uncomment later)

	STLMatArray[0].NeedOld=false;
	STLMatArray[0].CheckForMatEl=OneChQ_cd_check;
	STLMatArray[0].CalcMatEl=OneChQ_fNup_MatEl;

	STLMatArray[1].NeedOld=false;
	STLMatArray[1].CheckForMatEl=OneChQ_cd_check;
	STLMatArray[1].CalcMatEl=OneChQ_fNdn_MatEl;

	// Sz and Sz2
	STLMatArray[2].NeedOld=true;
	STLMatArray[2].UpperTriangular=false;
	STLMatArray[2].CalcAvg=true;  // CalcAvg
	STLMatArray[2].CheckForMatEl=Diag_check;
	STLMatArray[2].CalcMatEl=ImpOnly_MatEl;
	strcpy(STLMatArray[2].MatName,"Sz");

	STLMatArray[3].NeedOld=true;
	STLMatArray[3].UpperTriangular=false;
	STLMatArray[3].CalcAvg=true;  // CalcAvg
	STLMatArray[3].CheckForMatEl=Diag_check;
	STLMatArray[3].CalcMatEl=ImpOnly_MatEl;
	strcpy(STLMatArray[3].MatName,"Sz2");

	if (calcdens==1){
	  // All operators have the same Checks/MatEls in |Q> basis
	  // what changes is the initial set-up
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.UpperTriangular=false;
	  auxNRGMat.CheckForMatEl=OneChQ_cd_check;
	  auxNRGMat.CalcMatEl=OneChQ_cd_MatEl;
	  auxNRGMat.SaveMatYN=true;

	  STLMatArray.push_back(auxNRGMat); // 4 - cd1_up
	  STLMatArray.push_back(auxNRGMat); // 5 - cd1_dn
	  //NumNRGarrays=STLMatArray.size(); // do we need NumNRGarrays later?
	  NumNRGmats=STLMatArray.size();
	  MatArray=&STLMatArray[0]; //
	  // changes in STLMatArray!
	  SaveData=true;
	  strcpy(SaveArraysFileName,"1chQAnd");
	}
	else{
	  // Set Thermodynamics
	  // Entropy calculation only
	  strcpy(ThermoArray[0].ArqName,"EntropyImp1Ch_Anderson_Q.dat");
	  strcpy(ThermoArray[0].ChainArqName,"EntropyChain1Ch_Q.dat");
	  ThermoArray[0].Calc=CalcEntropy;
	  ThermoArray[0].dImpValue=2.0*log(2.0);
	  //ThermoArray[0].CalcChain=false;
	  NumThermoMats=1;
	}
	// calculate spec function or thermo?

	// Param for H0
	Params.push_back(dInitParams[0]); // U
	Params.push_back(dInitParams[2]); // ed
	Params.push_back(Lambda);
	Params.push_back(HalfLambdaFactor);
	OneChQ_SetAnderson_Hm1(Params,pAeig,STLMatArray);
	//OneChQ_SetAnderson_Hm1_old(Params,&Aeig,MatArray);

	////////////////////////

	// BuildBasis params
	CommonQNs.push_back(1); // No of common QNs
	CommonQNs.push_back(0); // pos of QN 1 in old
	CommonQNs.push_back(0); // pos of QN 1 in SingleSite
	// No total S variables. Leave totSpos empty
	pHN->CalcHNMatEl=OneChQ_HN_MatEl;

	NumChannels=1;
	Nsites0=0;

	break;
      case 5: // SMM model

	// Params for H0
	Params.push_back(Lambda);  // Lambda
	Params.push_back(HalfLambdaFactor); // Lambda factor

	if (dInitParams.size()>10){
	  Params.push_back(dInitParams[0]); // U1
	  Params.push_back(dInitParams[2]); // ed1

	  Params.push_back(dInitParams[3]); // U2
	  Params.push_back(dInitParams[5]); // ed2

	  Params.push_back(dInitParams[6]); // J12

	  Params.push_back(dInitParams[7]); // BmagPar
	  Params.push_back(dInitParams[8]); // BmagPerp

	  Params.push_back(dInitParams[9]); // Dz
	  Params.push_back(dInitParams[10]); // B2 anisot

	  double chi2_m1=sqrt(2.0*dInitParams[4]/pi)/(sqrt(Lambda)*HalfLambdaFactor);
	  Params.push_back(chi_m1[0]); // gamma1
	  Params.push_back(chi2_m1); // gamma2
	}
	else{
	  double U=0.5;
	  double ed=-0.5*U;
	  Params.push_back(U); // U1
	  Params.push_back(ed); // ed1

	  Params.push_back(0.0); // U2
	  Params.push_back(0.0); // ed2

	  Params.push_back(0.0); // J12

	  Params.push_back(0.0); // BmagPar
	  Params.push_back(0.0); // BmagPerp

	  Params.push_back(0.0); // Dz
	  Params.push_back(0.0); // B2 anisot

	  Params.push_back(chi_m1[0]); // gamma1
	  Params.push_back(0.0); // gamma2
	}

	// Set rules for MatArray
	// Jul 09: using STMatArray

	// fN_up
	STLMatArray[0].NeedOld=false;
	STLMatArray[0].CheckForMatEl=OneChQ_cd_check;
	STLMatArray[0].CalcMatEl=OneChQ_fNup_MatEl;

	// fN_dn
	STLMatArray[1].NeedOld=false;
	STLMatArray[1].CheckForMatEl=OneChQ_cd_check;
	STLMatArray[1].CalcMatEl=OneChQ_fNdn_MatEl;

	// Sz and Sz2

	STLMatArray[2].NeedOld=true;
	STLMatArray[2].UpperTriangular=false;
	STLMatArray[2].CalcAvg=true;  // CalcAvg
	STLMatArray[2].CheckForMatEl=Diag_check;
	STLMatArray[2].CalcMatEl=ImpOnly_MatEl;
	strcpy(STLMatArray[2].MatName,"Sz");

	STLMatArray[3].NeedOld=true;
	STLMatArray[3].UpperTriangular=false;
	STLMatArray[2].CalcAvg=true;
	STLMatArray[3].CheckForMatEl=Diag_check;
	STLMatArray[3].CalcMatEl=ImpOnly_MatEl;
	strcpy(STLMatArray[3].MatName,"Sz2");

	// cd1_up, cd1_dn, cd2_up, cd2_dn
	// MatArray is an STL vector!!!
	if (calcdens==1){
	  // All operators have the same Checks/MatEls in |Q> basis
	  // what changes is the initial set-up
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.CheckForMatEl=OneChQ_cd_check;
	  auxNRGMat.CalcMatEl=OneChQ_cd_MatEl;
	  auxNRGMat.SaveMatYN=true;

	  STLMatArray.push_back(auxNRGMat); // 4 - cd1_up
	  STLMatArray.push_back(auxNRGMat); // 5 - cd1_dn
	  STLMatArray.push_back(auxNRGMat); // 6 - cd2_up
	  STLMatArray.push_back(auxNRGMat); // 7 - cd2_dn
	  NumNRGmats=STLMatArray.size();
	  MatArray=&STLMatArray[0]; // Need to do this after
	  // changes in STLMatArray!
	  SaveData=true;
	  strcpy(SaveArraysFileName,"SMM");

	}
	else{
	  // Set Thermodynamics

	  // Entropy calculation only

	  strcpy(ThermoArray[0].ArqName,"EntropyImp1Ch_Anderson_Q.dat");
	  strcpy(ThermoArray[0].ChainArqName,"EntropyChain1Ch_Q.dat");
	  ThermoArray[0].Calc=CalcEntropy;
	  ThermoArray[0].dImpValue=4.0*log(2.0); // Seems to be irrelevant...
	  ThermoArray[0].CalcChain=false;
	  NumThermoMats=1;
	}
	// calculate spec function or thermo?

	// Set H0: output pAeig, MatArray

	OneChQ_SetSMM_H0(Params,pAeig,pSingleSite,STLMatArray);

	// BuildBasis params
	CommonQNs.push_back(1); // No of common QNs
	CommonQNs.push_back(0); // pos of QN 1 in old
	CommonQNs.push_back(0); // pos of QN 1 in SingleSite
	// No total S variables. Leave totSpos empty
	pHN->CalcHNMatEl=OneChQ_HN_MatEl;
	Nsites0=1;
	NumChannels=1;

	chi_m1[0]=chiN(0,Lambda);

	break;
      default:
	cout << " Model not implemented for this symmetry. Exiting... " << endl;
	exit(0);
      }
      // end switch ModelNo
      break;

    case 4: // TwoChQSP
      switch(ModelNo){
      ////////////////////////////
      /////                     ///
      ///// Symmetry: TwoChQSP  ///
      /////                     ///
      ////////////////////////////
      /// Models so far:       ///
      ///  4 - CM Phonons (2ch)///
      ////////////////////////////
      case 4: // CM Phonons - 2channel
	Params.push_back(Lambda);  // Lambda
	Params.push_back(HalfLambdaFactor); // Lambda factor

	Params.push_back(dInitParams[0]); // U1
	Params.push_back(dInitParams[2]); // ed1

	Params.push_back(chi_m1[0]); // sqrt(2gamma1/Pi)/sqrt(L)*HalfLambdaFactor

	Params.push_back(dInitParams[3]); // w0
	Params.push_back(dInitParams[4]); // lambda_ph
	Params.push_back(dInitParams[5]); // alpha
	Params.push_back(dInitParams[6]); // Nph

	// Update rules for f_ch1 and fch2

	// Set rules for MatArray

	// fN_ch1 (reduced)
	MatArray[0].NeedOld=false;
	MatArray[0].CheckForMatEl=TwoChQS_cd_check;
	MatArray[0].CalcMatEl=TwoChQS_cd_ich1_Phonon_MatEl;

	// fN_ch2 (reduced)
	MatArray[1].NeedOld=false;
	MatArray[1].CheckForMatEl=TwoChQSP_fA_check; // mixes parities
	MatArray[1].CalcMatEl=TwoChQS_cd_ich2_Phonon_MatEl;

	//CNRGarray MyTest1;

	// Set H0, get pAeig and Update MatArray
	TwoChQSP_SetH0CMphonon(Params, pAeig,pSingleSite,MatArray);

	// No phonons needed from now on
	MatArray[0].CalcMatEl=TwoChQS_fNch1_MatEl;
	MatArray[1].CalcMatEl=TwoChQS_fNch2_MatEl;

	// BuildBasis params
	CommonQNs.push_back(3); // No of common QNs
	CommonQNs.push_back(0); // pos of QN 1 in old
	CommonQNs.push_back(1); // pos of QN 2 in old
	CommonQNs.push_back(2); // pos of QN 3 in old

	CommonQNs.push_back(0); // pos of QN 1 in SingleSite
	CommonQNs.push_back(1); // pos of QN 2 in SingleSite
	CommonQNs.push_back(3); // pos of QN 3 in SingleSite

	CommonQNs.push_back(2); // Pos of parity in old
	totSpos.push_back(1); // Pos of S in old

	// Hamiltonian/Code params
	pHN->CalcHNMatEl=TwoChQS_HN_MatEl;
	Nsites0=1;
	chi_m1[0]=chiN(0,Lambda);
	NumNRGmats=2;
	NumChannels=2;
	NumThermoMats=2;

	ThermoArray[0].dImpValue=0.0;
	ThermoArray[1].dImpValue=0.0; // Check this!!

	// Thermobasics

	strcpy(ThermoArray[0].ArqName,"SuscepImp2Ch_CMphonon_QSP.dat");
	strcpy(ThermoArray[0].ChainArqName,"SuscepChain2Ch.dat");
	ThermoArray[0].Calc=CalcSuscep;

	strcpy(ThermoArray[1].ArqName,"EntropyImp2Ch_CMphonon_QSP.dat");
	strcpy(ThermoArray[1].ChainArqName,"EntropyChain2Ch.dat");
	ThermoArray[1].Calc=CalcEntropy;

	cout << " Implementing this model NOW " << endl;

	cout << " fN_ch1 : " << endl;
	MatArray[0].PrintAllBlocks();
	cout << " fN_ch2 : " << endl;
	MatArray[1].PrintAllBlocks();

	break;
      default:
	cout << " Model not implemented for this symmetry. Exiting... " << endl;
	exit(0);
      }
      // end switch ModelNo
      break;

    case 6: // OneChNupPdn
      ////////////////////////////////
      /////                        ///
      ///// Symmetry: OneChNupPdn  ///
      /////                        ///
      ////////////////////////////////

      // BuildBasis params
      CommonQNs.push_back(2); // No of common QNs
      CommonQNs.push_back(0); // pos of QN 1 in old
      CommonQNs.push_back(1); // pos of QN 2 in old

      CommonQNs.push_back(0); // pos of QN 1 in SingleSite
      CommonQNs.push_back(1); // pos of QN 2 in SingleSite

      CommonQNs.push_back(1); // pos of Parity QN
      // No total S variables. Leave totSpos empty

      switch(ModelNo){
      ///////////////////////////////////
      /// Models so far:              ///
      ///  3 - Chain only             ///
      ///  7 - Anderson+Local Majorana///
      ///////////////////////////////////
      case 3: // Chain only

	ZeroParams();
	Nsites0=1; // IS THIS CORRECT? Yes. H_0 is set so we start NRG from H_1
	NumThermoMats=1; // Entropy only

	// Initialize matrices (real matrices)
	// fd_up
	STLMatArray[0].NeedOld=false;
 	STLMatArray[0].CheckForMatEl=OneChNupPdn_cdup_check;
  	STLMatArray[0].CalcMatEl=OneChNupPdn_fNup_MatEl;
 	//STLMatArray[0].CalcMatElCplx=OneChNupPdn_fNup_MatElCplx;
	STLMatArray[0].SaveMatYN=false;
	STLMatArray[0].IsComplex=false;

	// fd_dn
	STLMatArray[1].NeedOld=false;
 	STLMatArray[1].CheckForMatEl=OneChNupPdn_cddn_check;
  	STLMatArray[1].CalcMatEl=OneChNupPdn_fNdn_MatEl;
	STLMatArray[1].SaveMatYN=false;
	STLMatArray[1].IsComplex=false;

	STLMatArray.pop_back(); // Only TWO arrays
	STLMatArray.pop_back(); // Only TWO arrays

	OneChNupPdn_SetChainH0(pAeig,STLMatArray);

	// Set pHN
	pHN->CalcHNMatEl=OneChNupPdn_HN_MatEl; // REAL
	// Wrap up
	NumChannels=1;
	NumNRGmats=STLMatArray.size();
	MatArray=&STLMatArray[0]; // Need to do this after
	// changes in STLMatArray!

	if (BandNo==0){
	  chi_m1[0]=chiN(0,Lambda); // is actually chi0 // chiN is a codehandler func
	// Valid ONLY for SquareBand, z_twist=1! Check side dot calcs...
	}
	else{chi_m1[0]=Chains[0].GetChin(0);}
	// Need to change chain files for ALL Models!!
	strcpy(ThermoArray[0].ChainArqName,"EntropyChain1Ch_NupPdn");
	strcat(ThermoArray[0].ChainArqName,zstring);
	strcat(ThermoArray[0].ChainArqName,".dat");
	ThermoArray[0].Calc=CalcEntropy;
	ThermoArray[0].CalcChain=true; // Just to make sure

	break;

      case 7:
	cout << " Majorana + QD effective model " << endl;

	Params.push_back(Lambda);  // Lambda
	Params.push_back(HalfLambdaFactor); // Lambda factor

	Params.push_back(dInitParams[0]); // U1
	Params.push_back(dInitParams[2]); // ed1
	Params.push_back(chi_m1[0]); // sqrt(2gamma1/Pi)/sqrt(L)*HalfLambdaFactor

	Params.push_back(dInitParams[3]); // Mag Field

	Params.push_back(dInitParams[4]); // t1
	Params.push_back(dInitParams[5]); // t2
	Params.push_back(dInitParams[6]); // phi_mag
	Params.push_back(dInitParams[7]); // em

	// Initialize matrices
	// fd_up
	STLMatArray[0].NeedOld=false;
 	STLMatArray[0].CheckForMatEl=OneChNupPdn_cdup_check;
//  	STLMatArray[0].CalcMatEl=OneChNupPdn_fNup_MatEl;
 	STLMatArray[0].CalcMatElCplx=OneChNupPdn_fNup_MatElCplx;
	STLMatArray[0].SaveMatYN=false;
	STLMatArray[0].IsComplex=true;

	// fd_dn
	STLMatArray[1].NeedOld=false;
 	STLMatArray[1].CheckForMatEl=OneChNupPdn_cddn_check;
 	STLMatArray[1].CalcMatElCplx=OneChNupPdn_fNdn_MatElCplx;
	STLMatArray[1].SaveMatYN=false;
	STLMatArray[1].IsComplex=true;

	switch (calcdens){
	case 0: // OpAvg: n_d(T), S_z(T) -(2014)
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.UpperTriangular=false; // update procedure only works for 'false'
	  auxNRGMat.CalcAvg=true;  // CalcAvg
	  auxNRGMat.CheckForMatEl=Diag_check;
	  auxNRGMat.CalcMatElCplx=ImpOnly_MatElCplx;
	  auxNRGMat.IsComplex=true;

	  STLMatArray[2]=auxNRGMat; // 2 - ndot (there already)
	  STLMatArray[3]=auxNRGMat; // 3 - Sz (there already)
	  strcpy(STLMatArray[2].MatName,"Ndot");
	  strcpy(STLMatArray[3].MatName,"Szdot");
	  STLMatArray.push_back(auxNRGMat);
	  strcpy(STLMatArray[4].MatName,"Nf"); // 4 -Nf
	  // changes in STLMatArray!
	  SaveData=false;
	  // No Thermo
	  NumThermoMats=0;
	  break;
 	case 1: //Spectral density
	  // cd_up and cd_dn (OneChQSz_SetAnderson equals
	  // MatArray[2,3] to MatArray[0,1]
	  STLMatArray[2].NeedOld=true;
	  STLMatArray[2].CheckForMatEl=OneChNupPdn_cdup_check;
	  STLMatArray[2].CalcMatElCplx=OneChNupPdn_cdup_MatElCplx;
	  STLMatArray[2].SaveMatYN=true;
	  STLMatArray[2].IsComplex=true;
	  strcpy(STLMatArray[2].MatName,"cd_up");

	  STLMatArray[3].NeedOld=true;
	  STLMatArray[3].CheckForMatEl=OneChNupPdn_cddn_check;
	  STLMatArray[3].CalcMatElCplx=OneChNupPdn_cddn_MatElCplx;
	  STLMatArray[3].SaveMatYN=true;
	  STLMatArray[3].IsComplex=true;
	  strcpy(STLMatArray[3].MatName,"cd_dn");

	  // f_Maj (this looks ok)
	  auxNRGMat=STLMatArray[3];
	  STLMatArray.push_back(auxNRGMat);
	  strcpy(STLMatArray[4].MatName,"f_Maj");

	  // TODO: Add other spectral functions??

	  cout << " N = -1: Nothing here" << endl;
// 	  cout << " fdN_up : " << endl;
// 	  STLMatArray[0].PrintAllBlocks();
// 	  cout << " fdN_dn : " << endl;
// 	  STLMatArray[1].PrintAllBlocks();
// 	  cout << " cdN_up : " << endl;
// 	  STLMatArray[2].PrintAllBlocks();
// 	  cout << " cdN_dn : " << endl;
// 	  STLMatArray[3].PrintAllBlocks();
// 	  cout << " f_Maj : " << endl;
// 	  STLMatArray[4].PrintAllBlocks();

	  SaveData=true;

 	  break;
	case 2:
	  cout << "Entropy calculation (implementing it...)" << endl;

	  STLMatArray.pop_back(); // Only TWO arrays
	  STLMatArray.pop_back(); // Only TWO arrays

	  // Need to change chain files for ALL Models!!
	  strcpy(ThermoArray[0].ArqName,"EntropyImp1ChNupPdn_Majorana");
	  strcat(ThermoArray[0].ArqName,zstring);
	  strcat(ThermoArray[0].ArqName,".dat");
	  strcpy(ThermoArray[0].ChainArqName,"EntropyChain1Ch_NupPdn");
	  strcat(ThermoArray[0].ChainArqName,zstring);
	  strcat(ThermoArray[0].ChainArqName,".dat");
	  ThermoArray[0].Calc=CalcEntropy;
	  ThermoArray[0].dImpValue=3.0*log(2.0); // log(8)
	  ThermoArray[0].CalcChain=false;
	  NumThermoMats=1;
	  SaveData=false;

	  break;
	default:
	  cout << " calcdens = " << calcdens << " not implemented. Exiting. " << endl;
	  exit(0);
	}
	// end switch calcdens

	// actually SetHm1 !
	OneChNupPdn_SetH0_AndersonMajorana(Params,pSingleSite,pAeig,STLMatArray);

// 	// BuildBasis params (already out of here)
	// Set pHN
	pHN->IsComplex=true;
	pHN->CalcHNMatElCplx=OneChNupPdn_HN_MatElCplx;

	// Wrap up
	NumChannels=1;
	Nsites0=0;
	NumNRGmats=STLMatArray.size();
	MatArray=&STLMatArray[0]; // Need to do this after
	// changes in STLMatArray!

	cout << " N=-1 ok. Going to N=0... " << endl;

	cout << " pAeig is complex ? " << pAeig->CheckComplex() << endl;

	//exit(0);
	break;
      default:
	cout << " Model not implemented for this symmetry. Exiting... " << endl;
	exit(0);
      }
      // end switch ModelNo for OneChNupPdn
      break;

    case 7: // OneChS
      /////////////////////////////
      /////                    ////
      ///// Symmetry: OneChS   ////
      /////                    ////
      /////////////////////////////
      // BuildBasis params
      CommonQNs.push_back(1); // No of common QNs
      CommonQNs.push_back(0); // pos of QN 1 in old
      CommonQNs.push_back(0); // pos of QN 1 in SingleSite

      totSpos.push_back(0);   // SU(2) symmetry in position 1

      switch(ModelNo){
      //////////////////////////////////////
      /// Models so far:                 ///
      ///  0 - Anderson (SC leads)       ///
      //////////////////////////////////////
      case 0: // Single-impurity Anderson model S symmetry with SC leads

	// Initialize matrices
	// Jul 09: using STMatArray

	// fN (reduced)
	STLMatArray[0].NeedOld=false;
	STLMatArray[0].UpperTriangular=false;
	STLMatArray[0].CheckForMatEl=OneChS_cd_check;
	STLMatArray[0].CalcMatEl=OneChS_fN_MatEl;
	STLMatArray[0].SaveMatYN=false;

	switch (calcdens){
	case 0: // OpAvg: n_d(T), n^2_d(T), S^2(T) - NEW (2012)
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.UpperTriangular=false; // update procedure only works for 'false'
	  auxNRGMat.CalcAvg=true;  // CalcAvg
	  auxNRGMat.CheckForMatEl=Diag_check;
	  auxNRGMat.CalcMatEl=ImpOnly_MatEl;
	  STLMatArray[1]=auxNRGMat; // 1 - ndot (there already)
	  STLMatArray[2]=auxNRGMat; // 2 - ndot^2 (there already)
	  STLMatArray[3]=auxNRGMat; // 3 - Sdot^2 (there already)
	  strcpy(STLMatArray[1].MatName,"Ndot");
	  strcpy(STLMatArray[2].MatName,"NdSq");
	  strcpy(STLMatArray[3].MatName,"SdSq");
	  NumNRGmats=STLMatArray.size();
	  MatArray=&STLMatArray[0]; // Need to do this after
	  // changes in STLMatArray!
	  SaveData=false;
// 	  STLMatArray.pop_back(); // 1 Matrices only
// 	  STLMatArray.pop_back(); // 1 Matrices only
// 	  STLMatArray.pop_back(); // 1 Matrices only
	  // No Thermo
	  NumThermoMats=0;
	  break;
	case 1: //Spectral density
	  STLMatArray.pop_back(); // 2 Matrices
	  STLMatArray.pop_back(); // 2 Matrices
	  NumThermoMats=0;
	  // cd operator
	  STLMatArray[1].NeedOld=true;
	  STLMatArray[1].UpperTriangular=false;
	  STLMatArray[1].CheckForMatEl=OneChS_cd_check;
	  STLMatArray[1].CalcMatEl=OneChS_cd_MatEl;
	  STLMatArray[1].SaveMatYN=true;
	  strcpy(STLMatArray[1].MatName,"cdot1");
	  NumNRGmats=STLMatArray.size();
	  // changes in STLMatArray!
	  SaveData=true;
	  strcpy(SaveArraysFileName,"1chSAndersonSC");
	  break;
	case 4: // Dynamical spin susceptibility and <Sz> and <Sz^2> (2015)
	  // 6 Matrices
	  STLMatArray.push_back(auxNRGMat);
	  STLMatArray.push_back(auxNRGMat);
	  NumThermoMats=0;
	  // <Sz> and <Sz2> operator
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.UpperTriangular=false;
	  // update procedure only works for 'false'
	  auxNRGMat.CalcAvg=true;  // CalcAvg
	  auxNRGMat.CheckForMatEl=Diag_check;
	  auxNRGMat.CalcMatEl=ImpOnly_MatEl;

	  STLMatArray[2]=auxNRGMat; // 2 - Sz dynamical
	  STLMatArray[2].SaveMatYN=true;
	  STLMatArray[2].CalcAvg=false;

	  STLMatArray[3]=auxNRGMat; // 3 - Nd dynamical
	  STLMatArray[3].SaveMatYN=true;
	  STLMatArray[3].CalcAvg=false;

	  STLMatArray[4]=auxNRGMat; // 4 - <Sz2>(T) static
	  STLMatArray[4].SaveMatYN=false;

	  STLMatArray[5]=auxNRGMat; // 5 - <Nd2>(T) static
	  STLMatArray[5].SaveMatYN=false;

	  strcpy(STLMatArray[2].MatName,"Szomega");
	  strcpy(STLMatArray[3].MatName,"Ndomega");
	  strcpy(STLMatArray[4].MatName,"Sz2dot");
	  strcpy(STLMatArray[5].MatName,"Nd2dot");

	  NumNRGmats=STLMatArray.size();
	  // changes in STLMatArray!
	  SaveData=true;
	  strcpy(SaveArraysFileName,"1chSAndersonSC");
	  break;

	default:
	  cout << " calcdens = " << calcdens << " not implemented. Exiting. " << endl;
	  exit(0);

	}
	// end switch calcdens

	// Param for H0
	Params.push_back(Lambda);
	Params.push_back(HalfLambdaFactor);
	Params.push_back(dInitParams[0]); // U
	Params.push_back(dInitParams[2]); // ed

	OneChS_SetAnderson_Hm1(Params,pAeig,STLMatArray);

	// HN params
	pHN->CalcHNMatEl=OneChS_HNsc_MatEl;

	// Wrap up
	NumChannels=1;
	Nsites0=0;
	NumNRGmats=STLMatArray.size();
	MatArray=&STLMatArray[0]; // Need to do this after
	// changes in STLMatArray!

	break;
	// end OneChS Anderson model set up

      default:
	cout << " Model not implemented for OneChS symmetry. Exiting... " << endl;
	exit(0);
      }
      // end switch ModelNo for OneChS
      break;

      ///////////////////////

    case 8: // OneChSz
      /////////////////////////////
      /////                    ////
      ///// Symmetry: OneChSz   ////
      /////                    ////
      /////////////////////////////
      // BuildBasis params
      CommonQNs.push_back(1); // No of common QNs
      CommonQNs.push_back(0); // pos of QN 1 in old
      CommonQNs.push_back(0); // pos of QN 1 in SingleSite

      // No total S variables. Leave totSpos empty

      switch(ModelNo){
      //////////////////////////////////////
      /// Models so far:                 ///
      ///  0 - Anderson (SC leads)       ///
      //////////////////////////////////////
      case 0: // Single-impurity Anderson model S symmetry with SC leads

	// Initialize matrices
	// Jul 09: using STMatArray

	// fNup and fNdn
	STLMatArray[0].NeedOld=false;
	STLMatArray[0].UpperTriangular=false;
// 	STLMatArray[0].CheckForMatEl=OneChS_cd_check; // Should work
	STLMatArray[0].CheckForMatEl=OneChSz_cdup_check; // More efficient
	STLMatArray[0].CalcMatEl=OneChSz_fNup_MatEl;
	STLMatArray[0].SaveMatYN=false;

	STLMatArray[1].NeedOld=false;
	STLMatArray[1].UpperTriangular=false;
// 	STLMatArray[1].CheckForMatEl=OneChS_cd_check; // Should work
	STLMatArray[1].CheckForMatEl=OneChSz_cddn_check; // Should work
	STLMatArray[1].CalcMatEl=OneChSz_fNdn_MatEl;
	STLMatArray[1].SaveMatYN=false;

	switch (calcdens){
	case 0: // OpAvg: n_d(T), Sz(T), Sz(T) - NEW (2012)
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.UpperTriangular=false; // update procedure only works for 'false'
	  auxNRGMat.CalcAvg=true;  // CalcAvg
	  auxNRGMat.CheckForMatEl=Diag_check;
	  auxNRGMat.CalcMatEl=ImpOnly_MatEl;
	  STLMatArray.push_back(auxNRGMat); // 5 matrices
	  STLMatArray[2]=auxNRGMat; // 1 - ndot (there already)
	  STLMatArray[3]=auxNRGMat; // 2 - ndot^2 (there already)
	  STLMatArray[4]=auxNRGMat; // 3 - Sdot^2 (there already)
	  strcpy(STLMatArray[2].MatName,"Ndot");
	  strcpy(STLMatArray[3].MatName,"NdSq");
	  strcpy(STLMatArray[4].MatName,"SdSq");
	  NumNRGmats=STLMatArray.size();
	  MatArray=&STLMatArray[0]; // Need to do this after
	  // changes in STLMatArray!
	  SaveData=false;
	  // No Thermo
	  NumThermoMats=0;
	  break;
	case 1: //Spectral density - 4 matrices (no pop-up)
	  NumThermoMats=0;
	  // cdup operator
	  STLMatArray[2].NeedOld=true;
	  STLMatArray[2].UpperTriangular=false;
// 	  STLMatArray[2].CheckForMatEl=OneChS_cd_check;
	  STLMatArray[2].CheckForMatEl=OneChSz_cdup_check;
	  STLMatArray[2].CalcMatEl=OneChSz_cdup_MatEl;
	  STLMatArray[2].SaveMatYN=true;
	  strcpy(STLMatArray[2].MatName,"cdotup");
	  // cddn operator
	  STLMatArray[3].NeedOld=true;
	  STLMatArray[3].UpperTriangular=false;
// 	  STLMatArray[3].CheckForMatEl=OneChS_cd_check;
	  STLMatArray[3].CheckForMatEl=OneChSz_cddn_check;
	  STLMatArray[3].CalcMatEl=OneChSz_cddn_MatEl;
	  STLMatArray[3].SaveMatYN=true;
	  strcpy(STLMatArray[3].MatName,"cdotdn");

	  NumNRGmats=STLMatArray.size();
	  // changes in STLMatArray!
	  SaveData=true;
	  strcpy(SaveArraysFileName,"1chSzAndersonSC");
	  break;
	case 4: // Dynamical spin susceptibility and <Sz> and <Sz^2> (2015)
	  /// Stopped here
	  // 6 Matrices
	  STLMatArray.push_back(auxNRGMat);
	  STLMatArray.push_back(auxNRGMat);
	  NumThermoMats=0;
	  // <Sz> and <Sz2> operator
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.UpperTriangular=false;
	  // update procedure only works for 'false'
	  auxNRGMat.CalcAvg=true;  // CalcAvg
	  auxNRGMat.CheckForMatEl=Diag_check;
	  auxNRGMat.CalcMatEl=ImpOnly_MatEl;

	  STLMatArray[2]=auxNRGMat; // 2 - Sz dynamical
	  STLMatArray[2].SaveMatYN=true;
	  STLMatArray[2].CalcAvg=false;

	  STLMatArray[3]=auxNRGMat; // 3 - Nd dynamical
	  STLMatArray[3].SaveMatYN=true;
	  STLMatArray[3].CalcAvg=false;

	  STLMatArray[4]=auxNRGMat; // 4 - <Sz2>(T) static
	  STLMatArray[4].SaveMatYN=false;

	  STLMatArray[5]=auxNRGMat; // 5 - <Nd2>(T) static
	  STLMatArray[5].SaveMatYN=false;

	  strcpy(STLMatArray[2].MatName,"Szomega");
	  strcpy(STLMatArray[3].MatName,"Ndomega");
	  strcpy(STLMatArray[4].MatName,"Sz2dot");
	  strcpy(STLMatArray[5].MatName,"Nd2dot");

	  NumNRGmats=STLMatArray.size();
	  // changes in STLMatArray!
	  SaveData=true;
	  strcpy(SaveArraysFileName,"1chSzAndersonSC");
	  break;

	default:
	  cout << " calcdens = " << calcdens << " not implemented. Exiting. " << endl;
	  exit(0);

	}
	// end switch calcdens

	// Param for H0
	Params.push_back(Lambda);
	Params.push_back(HalfLambdaFactor);
	Params.push_back(dInitParams[0]); // U
	Params.push_back(dInitParams[2]); // ed
	Params.push_back(dInitParams[4]); // Mag Field.
       //Note that dInitParams[3] is DeltaSC

	OneChSz_SetAnderson_Hm1(Params,pAeig,STLMatArray);

	// HN params
	pHN->CalcHNMatEl=OneChSz_HNsc_MatEl;

	NumChannels=1;

	// Wrap up
	NumChannels=1;
	Nsites0=0;
	NumNRGmats=STLMatArray.size();
	MatArray=&STLMatArray[0]; // Need to do this after
	// changes in STLMatArray!

	//exit(0);
	break;
	// end OneChSz Anderson model set up

      default:
	cout << " Model not implemented for OneChSz symmetry. Exiting... " << endl;
	exit(0);
      }
      // end switch ModelNo for OneChSz
      break;
    case 9: // OneChPuPdn
      //////////////////////////////////
      /////                         ////
      ///// Symmetry: OneChPupPdn   ////
      /////                         ////
      //////////////////////////////////
      // BuildBasis params
      CommonQNs.push_back(2); // No of common QNs
      CommonQNs.push_back(0); // pos of QN 1 in old
      CommonQNs.push_back(1); // pos of QN 2 in old

      CommonQNs.push_back(0); // pos of QN 1 in SingleSite
      CommonQNs.push_back(1); // pos of QN 2 in SingleSite

      CommonQNs.push_back(0); // pos of Parity QN
      CommonQNs.push_back(1); // pos of Parity QN

      // No total S variables. Leave totSpos empty

      switch(ModelNo){
      ///////////////////////////////////////
      /// Models so far:                  ///
      ///  3 - Chain only                 ///
      ///  7 - Anderson+ 2 Local Majoranas///
      ///////////////////////////////////////
      case 3: // Chain only

	ZeroParams();
	Nsites0=1; // IS THIS CORRECT? Yes. H_0 is set so we start NRG from H_1
	NumThermoMats=1; // Entropy only

	// Initialize matrices (real matrices)
	// fd_up
	STLMatArray[0].NeedOld=false;
 	STLMatArray[0].CheckForMatEl=OneChPupPdn_cdup_check;
  	STLMatArray[0].CalcMatEl=OneChPupPdn_fNup_MatEl;
 	//STLMatArray[0].CalcMatElCplx=OneChNupPdn_fNup_MatElCplx;
	STLMatArray[0].SaveMatYN=false;
	STLMatArray[0].IsComplex=false;

	// fd_dn
	STLMatArray[1].NeedOld=false;
 	STLMatArray[1].CheckForMatEl=OneChPupPdn_cddn_check;
  	STLMatArray[1].CalcMatEl=OneChPupPdn_fNdn_MatEl;
	STLMatArray[1].SaveMatYN=false;
	STLMatArray[1].IsComplex=false;

	STLMatArray.pop_back(); // Only TWO arrays
	STLMatArray.pop_back(); // Only TWO arrays

	OneChPupPdn_SetChainH0(pAeig,STLMatArray);

	// Set pHN
	pHN->CalcHNMatEl=OneChPupPdn_HN_MatEl; // REAL
	// Wrap up
	NumChannels=1;
	NumNRGmats=STLMatArray.size();
	MatArray=&STLMatArray[0]; // Need to do this after
	// changes in STLMatArray!

	if (BandNo==0){
	  chi_m1[0]=chiN(0,Lambda); // is actually chi0 // chiN is a codehandler func
	// Valid ONLY for SquareBand, z_twist=1! Check side dot calcs...
	}
	else{chi_m1[0]=Chains[0].GetChin(0);}
	// Need to change chain files for ALL Models!!
	strcpy(ThermoArray[0].ChainArqName,"EntropyChain1Ch_PupPdn");
	strcat(ThermoArray[0].ChainArqName,zstring);
	strcat(ThermoArray[0].ChainArqName,".dat");
	ThermoArray[0].Calc=CalcEntropy;
	ThermoArray[0].CalcChain=true; // Just to make sure

	break;

// Working on this.
      case 7:
	cout << " 2 Majoranas + QD effective model " << endl;

	Params.push_back(Lambda);  // Lambda
	Params.push_back(HalfLambdaFactor); // Lambda factor

	Params.push_back(dInitParams[0]); // U1
	Params.push_back(dInitParams[2]); // ed1
	Params.push_back(chi_m1[0]); // sqrt(2gamma1/Pi)/sqrt(L)*HalfLambdaFactor

	Params.push_back(dInitParams[3]); // Mag Field

	Params.push_back(dInitParams[4]); // lambdaR (or tR)
	Params.push_back(dInitParams[5]); // lambdaL
	Params.push_back(dInitParams[6]); // phi/pi

	// Initialize matrices
	// fd_up
	STLMatArray[0].NeedOld=false;
 	STLMatArray[0].CheckForMatEl=OneChPupPdn_cdup_check;
 	STLMatArray[0].CalcMatElCplx=OneChPupPdn_fNup_MatElCplx;
	STLMatArray[0].SaveMatYN=false;
	STLMatArray[0].IsComplex=true;

	// fd_dn
	STLMatArray[1].NeedOld=false;
 	STLMatArray[1].CheckForMatEl=OneChPupPdn_cddn_check;
 	STLMatArray[1].CalcMatElCplx=OneChPupPdn_fNdn_MatElCplx;
	STLMatArray[1].SaveMatYN=false;
	STLMatArray[1].IsComplex=true;

	switch (calcdens){
	case 0: // OpAvg: n_d(T), S_z(T) -(2014)
	  auxNRGMat.NeedOld=true;
	  auxNRGMat.UpperTriangular=false; // update procedure only works for 'false'
	  auxNRGMat.CalcAvg=true;  // CalcAvg
	  auxNRGMat.CheckForMatEl=Diag_check;
	  auxNRGMat.CalcMatElCplx=ImpOnly_MatElCplx;
	  auxNRGMat.IsComplex=true;

	  STLMatArray[2]=auxNRGMat; // 2 - ndot (there already)
	  STLMatArray[3]=auxNRGMat; // 3 - Sz (there already)
	  strcpy(STLMatArray[2].MatName,"Ndot");
	  strcpy(STLMatArray[3].MatName,"Szdot");
	  STLMatArray.push_back(auxNRGMat);
	  strcpy(STLMatArray[4].MatName,"Nf"); // 4 -Nf
	  // changes in STLMatArray!
	  SaveData=false;
	  // No Thermo
	  NumThermoMats=0;
	  break;
 	case 1: //Spectral density
	  // cd_up and cd_dn (OneChQSz_SetAnderson equals
	  // MatArray[2,3] to MatArray[0,1]
	  STLMatArray[2].NeedOld=true;
	  STLMatArray[2].CheckForMatEl=OneChPupPdn_cdup_check;
	  STLMatArray[2].CalcMatElCplx=OneChPupPdn_cdup_MatElCplx;
	  STLMatArray[2].SaveMatYN=true;
	  STLMatArray[2].IsComplex=true;
	  strcpy(STLMatArray[2].MatName,"cd_up");

	  STLMatArray[3].NeedOld=true;
	  STLMatArray[3].CheckForMatEl=OneChPupPdn_cddn_check;
	  STLMatArray[3].CalcMatElCplx=OneChPupPdn_cddn_MatElCplx;
	  STLMatArray[3].SaveMatYN=true;
	  STLMatArray[3].IsComplex=true;
	  strcpy(STLMatArray[3].MatName,"cd_dn");

	  // f_Maj_up (this looks ok)
	  auxNRGMat=STLMatArray[2];
	  STLMatArray.push_back(auxNRGMat);
	  strcpy(STLMatArray[4].MatName,"f_MajUp");

	  // f_Maj_dn (this looks ok)
	  auxNRGMat=STLMatArray[3];
	  STLMatArray.push_back(auxNRGMat);
	  strcpy(STLMatArray[5].MatName,"f_MajDn");

	  // TODO: Add other spectral functions??

	  cout << " N = -1: Nothing here" << endl;
// 	  cout << " fdN_up : " << endl;
// 	  STLMatArray[0].PrintAllBlocks();
// 	  cout << " fdN_dn : " << endl;
// 	  STLMatArray[1].PrintAllBlocks();
// 	  cout << " cdN_up : " << endl;
// 	  STLMatArray[2].PrintAllBlocks();
// 	  cout << " cdN_dn : " << endl;
// 	  STLMatArray[3].PrintAllBlocks();
// 	  cout << " f_MajUp : " << endl;
// 	  STLMatArray[4].PrintAllBlocks();
// 	  cout << " f_MajDn : " << endl;
// 	  STLMatArray[5].PrintAllBlocks();

	  SaveData=true;

 	  break;
	case 2:
	  cout << "Entropy calculation (implementing it...)" << endl;

	  STLMatArray.pop_back(); // Only TWO arrays
	  STLMatArray.pop_back(); // Only TWO arrays

	  // Need to change chain files for ALL Models!!
	  strcpy(ThermoArray[0].ArqName,"EntropyImp1ChPupPdn_Majorana");
	  strcat(ThermoArray[0].ArqName,zstring);
	  strcat(ThermoArray[0].ArqName,".dat");
	  strcpy(ThermoArray[0].ChainArqName,"EntropyChain1Ch_PupPdn");
	  strcat(ThermoArray[0].ChainArqName,zstring);
	  strcat(ThermoArray[0].ChainArqName,".dat");
	  ThermoArray[0].Calc=CalcEntropy;
	  ThermoArray[0].dImpValue=4.0*log(2.0); // log(16) (check)
	  ThermoArray[0].CalcChain=false;
	  NumThermoMats=1;
	  SaveData=false;

	  break;
	default:
	  cout << " calcdens = " << calcdens << " not implemented. Exiting. " << endl;
	  exit(0);
	}
	// end switch calcdens

	// actually SetHm1 !
	OneChPupPdn_SetHm1_AndersonMajorana(Params,pSingleSite,pAeig,STLMatArray);

// 	// BuildBasis params (already out of here)
	// Set pHN
	pHN->IsComplex=true;
	pHN->CalcHNMatElCplx=OneChPupPdn_HN_MatElCplx;

	// Wrap up
	NumChannels=1;
	Nsites0=0;
	NumNRGmats=STLMatArray.size();
	MatArray=&STLMatArray[0]; // Need to do this after
	                          // changes in STLMatArray!

	cout << " N=-1 ok. Going to N=0... " << endl;

	cout << " pAeig is complex ? " << pAeig->CheckComplex() << endl;

	//exit(0);
	break;
      default:
	cout << " Model not implemented for this symmetry. Exiting... " << endl;
	exit(0);
      }
      // end switch ModelNo for OneChPupPdn
      break;
/////////////////////////////
    default:
      cout << " Symmetry not implemented. Exiting... " << endl;
      exit(0);
    }
    // end switch SymNo

}
// end ModelSwitch