Author Topic: NLValueError  (Read 5072 times)

0 Members and 1 Guest are viewing this topic.

Offline Aysha Naurein

  • New QuantumATK user
  • *
  • Posts: 3
  • Country: in
  • Reputation: 0
    • View Profile
NLValueError
« on: March 25, 2019, 13:17 »
Hello! I am trying to find the spin transfer torque of my system. I am a new user of ATK and am following the procedure as mentioned in the tutorial. I've been able to obtain the output of the first part of the process. In the second part there is this program I have to execute which is available on the tutorial. I've slightly modified the codes as per my requirements and tried to execute the job.  But in this part only the calculations for the left electrode is performed after which I get the following text on the logs


+------------------------------------------------------------------------------+
|                                                                              |
| Left Electrode Calculation  [Finished Mon Mar 25 16:17:55 2019]              |
|                                                                              |
+------------------------------------------------------------------------------+

                            |--------------------------------------------------|
Calculating Kinetic Matrix : ==================================================

                            |--------------------------------------------------|
Calculating Nonlocal Part  : ==================================================
+------------------------------------------------------------------------------+
|                                                                              |
| Device DFT Calculation  [Finished Mon Mar 25 16:17:55 2019]                  |
|                                                                              |
+------------------------------------------------------------------------------+
Traceback (most recent call last):
  File "device2dsys90.py", line 31, in <module>
    device_configuration.update()
  File "zipdir/NL/CommonConcepts/Configurations/DeviceConfiguration.py", line 653, in update
  File "zipdir/NL/CommonConcepts/Configurations/AtomicConfiguration.py", line 1675, in update
  File "zipdir/NL/Calculators/Interfaces/DeviceCalculatorInterface.py", line 420, in _update
  File "zipdir/NL/Calculators/Interfaces/DeviceCalculatorInterface.py", line 282, in _updateElectrodes
  File "zipdir/NL/Calculators/DensityFunctionalTheory/LCAOCalculator/BaseLCAOCalculator.py", line 343, in _checkOrbitalsMatch
NL.ComputerScienceUtilities.Exceptions.NLValueError: The number of orbitals must match for initializing the system. 210 != 150 (expected)


Please let me know what I can do to solve this issue. I need to find the spin transfer torque of this device.
I'll put the python file for my device down here as well.



# -*- coding: utf-8 -*-
# -------------------------------------------------------------
# Two-probe Configuration
# -------------------------------------------------------------

# -------------------------------------------------------------
# Left Electrode
# -------------------------------------------------------------

# Set up lattice
vector_a = [28.02575, 0.0, 0.0]*Angstrom
vector_b = [0.0, 28.02575, 0.0]*Angstrom
vector_c = [0.0, 0.0, 15.0]*Angstrom
left_electrode_lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
left_electrode_elements = [Nitrogen, Carbon, Carbon, Nitrogen, Carbon, Carbon, Nitrogen,
                           Carbon, Carbon, Nitrogen]

# Define coordinates
left_electrode_coordinates = [[ 10.89175       ,  17.333092901836,  14.225787552286],
                              [ 10.            ,  16.071986558453,  14.232637054308],
                              [ 10.89175       ,  14.810880215069,  14.239486556329],
                              [ 10.            ,  13.549773871686,  14.246336058351],
                              [ 10.89175       ,  12.288667528302,  14.253185560372],
                              [ 10.            ,  11.027561184919,  14.260035062394],
                              [ 10.89175       ,   9.766454841535,  14.266884564415],
                              [ 10.            ,   8.505348498152,  14.273734066437],
                              [ 10.89175       ,   7.244242154768,  14.280583568459],
                              [ 10.            ,   5.983135811385,  14.28743307048 ]]*Angstrom

# Set up configuration
left_electrode = BulkConfiguration(
    bravais_lattice=left_electrode_lattice,
    elements=left_electrode_elements,
    cartesian_coordinates=left_electrode_coordinates
    )

# -------------------------------------------------------------
# Right Electrode
# -------------------------------------------------------------

# Set up lattice
vector_a = [28.02575, 0.0, 0.0]*Angstrom
vector_b = [0.0, 28.02575, 0.0]*Angstrom
vector_c = [0.0, 0.0, 16.0]*Angstrom
right_electrode_lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
right_electrode_elements = [Nickel, Nickel, Nickel, Nickel, Nickel, Nickel, Nickel, Nickel,
                            Nickel, Nickel]

# Define coordinates
right_electrode_coordinates = [[ 18.02575       ,  22.404916283456,   0.083064917734],
                               [ 17.134         ,  21.143809940073,   0.089914419755],
                               [ 18.02575       ,  19.88270359669 ,   0.096763921777],
                               [ 17.134         ,  18.621597253306,   0.103613423798],
                               [ 18.02575       ,  17.360490909923,   0.11046292582 ],
                               [ 17.134         ,  16.099384566539,   0.117312427842],
                               [ 18.02575       ,  14.838278223156,   0.124161929863],
                               [ 17.134         ,  13.577171879772,   0.131011431885],
                               [ 18.02575       ,  12.316065536389,   0.137860933906],
                               [ 17.134         ,  11.054959193005,   0.144710435928]]*Angstrom

# Set up configuration
right_electrode = BulkConfiguration(
    bravais_lattice=right_electrode_lattice,
    elements=right_electrode_elements,
    cartesian_coordinates=right_electrode_coordinates
    )

# -------------------------------------------------------------
# Central Region
# -------------------------------------------------------------

# Set up lattice
vector_a = [28.02575, 0.0, 0.0]*Angstrom
vector_b = [0.0, 28.02575, 0.0]*Angstrom
vector_c = [0.0, 0.0, 35.15975]*Angstrom
central_region_lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
central_region_elements = [Nitrogen, Carbon, Carbon, Nitrogen, Carbon, Carbon, Nitrogen,
                           Carbon, Carbon, Nitrogen, Carbon, Carbon, Nitrogen, Carbon, Carbon,
                           Nitrogen, Carbon, Carbon, Nitrogen, Carbon, Carbon, Carbon, Carbon,
                           Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Nitrogen,
                           Carbon, Carbon, Nitrogen, Carbon, Carbon, Nitrogen, Carbon, Carbon,
                           Nitrogen, Nickel, Nickel, Nickel, Nickel, Nickel, Nickel, Nickel,
                           Nickel, Nickel, Nickel]

# Define coordinates
central_region_coordinates = [[ 10.89175       ,  17.333092901836,  14.225787552286],
                              [ 10.            ,  16.071986558453,  14.232637054308],
                              [ 10.89175       ,  14.810880215069,  14.239486556329],
                              [ 10.            ,  13.549773871686,  14.246336058351],
                              [ 10.89175       ,  12.288667528302,  14.253185560372],
                              [ 10.            ,  11.027561184919,  14.260035062394],
                              [ 10.89175       ,   9.766454841535,  14.266884564415],
                              [ 10.            ,   8.505348498152,  14.273734066437],
                              [ 10.89175       ,   7.244242154768,  14.280583568459],
                              [ 10.            ,   5.983135811385,  14.28743307048 ],
                              [ 12.67525       ,  18.601048747241,  15.480044393648],
                              [ 11.7835        ,  17.339942403858,  15.48689389567 ],
                              [ 12.67525       ,  16.078836060474,  15.493743397691],
                              [ 11.7835        ,  14.817729717091,  15.500592899713],
                              [ 12.67525       ,  13.556623373707,  15.507442401734],
                              [ 11.7835        ,  12.295517030324,  15.514291903756],
                              [ 12.67525       ,  11.03441068694 ,  15.521141405777],
                              [ 11.7835        ,   9.773304343557,  15.527990907799],
                              [ 12.67525       ,   8.512198000174,  15.53484040982 ],
                              [ 11.7835        ,   7.25109165679 ,  15.541689911842],
                              [ 14.45875       ,  19.869004592646,  16.73430123501 ],
                              [ 13.567         ,  18.607898249263,  16.741150737032],
                              [ 14.45875       ,  17.346791905879,  16.748000239053],
                              [ 13.567         ,  16.085685562496,  16.754849741075],
                              [ 14.45875       ,  14.824579219112,  16.761699243096],
                              [ 13.567         ,  13.563472875729,  16.768548745118],
                              [ 14.45875       ,  12.302366532346,  16.775398247139],
                              [ 13.567         ,  11.041260188962,  16.782247749161],
                              [ 14.45875       ,   9.780153845579,  16.789097251182],
                              [ 13.567         ,   8.519047502195,  16.795946753204],
                              [ 16.24225       ,  21.136960438051,  17.988558076372],
                              [ 15.3505        ,  19.875854094668,  17.995407578393],
                              [ 16.24225       ,  18.614747751284,  18.002257080415],
                              [ 15.3505        ,  17.353641407901,  18.009106582437],
                              [ 16.24225       ,  16.092535064518,  18.015956084458],
                              [ 15.3505        ,  14.831428721134,  18.02280558648 ],
                              [ 16.24225       ,  13.570322377751,  18.029655088501],
                              [ 15.3505        ,  12.309216034367,  18.036504590523],
                              [ 16.24225       ,  11.048109690984,  18.043354092544],
                              [ 15.3505        ,   9.7870033476  ,  18.050203594566],
                              [ 18.02575       ,  22.404916283456,  19.242814917734],
                              [ 17.134         ,  21.143809940073,  19.249664419755],
                              [ 18.02575       ,  19.88270359669 ,  19.256513921777],
                              [ 17.134         ,  18.621597253306,  19.263363423798],
                              [ 18.02575       ,  17.360490909923,  19.27021292582 ],
                              [ 17.134         ,  16.099384566539,  19.277062427842],
                              [ 18.02575       ,  14.838278223156,  19.283911929863],
                              [ 17.134         ,  13.577171879772,  19.290761431885],
                              [ 18.02575       ,  12.316065536389,  19.297610933906],
                              [ 17.134         ,  11.054959193005,  19.304460435928]]*Angstrom

# Set up configuration
central_region = BulkConfiguration(
    bravais_lattice=central_region_lattice,
    elements=central_region_elements,
    cartesian_coordinates=central_region_coordinates
    )

device_configuration = DeviceConfiguration(
    central_region,
    [left_electrode, right_electrode]
    )

# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#----------------------------------------
# Exchange-Correlation
#----------------------------------------
exchange_correlation = NCGGA.PBE

#----------------------------------------
# Numerical Accuracy Settings
#----------------------------------------
left_electrode_k_point_sampling = MonkhorstPackGrid(
    na=3,
    nb=3,
    nc=3,
    force_timereversal=False,
    )
left_electrode_numerical_accuracy_parameters = NumericalAccuracyParameters(
    k_point_sampling=left_electrode_k_point_sampling,
    density_mesh_cutoff=185.0*Hartree,
    )

right_electrode_k_point_sampling = MonkhorstPackGrid(
    na=3,
    nb=3,
    nc=3,
    force_timereversal=False,
    )
right_electrode_numerical_accuracy_parameters = NumericalAccuracyParameters(
    k_point_sampling=right_electrode_k_point_sampling,
    density_mesh_cutoff=185.0*Hartree,
    )

device_k_point_sampling = MonkhorstPackGrid(
    na=3,
    nb=3,
    nc=3,
    force_timereversal=False,
    )
device_numerical_accuracy_parameters = NumericalAccuracyParameters(
    k_point_sampling=device_k_point_sampling,
    density_mesh_cutoff=185.0*Hartree,
    )

#----------------------------------------
# Poisson Solver Settings
#----------------------------------------
left_electrode_poisson_solver = FastFourier2DSolver(
    boundary_conditions=[[PeriodicBoundaryCondition(),PeriodicBoundaryCondition()],
                         [PeriodicBoundaryCondition(),PeriodicBoundaryCondition()],
                         [PeriodicBoundaryCondition(),PeriodicBoundaryCondition()]]
    )

right_electrode_poisson_solver = FastFourier2DSolver(
    boundary_conditions=[[PeriodicBoundaryCondition(),PeriodicBoundaryCondition()],
                         [PeriodicBoundaryCondition(),PeriodicBoundaryCondition()],
                         [PeriodicBoundaryCondition(),PeriodicBoundaryCondition()]]
    )

#----------------------------------------
# Contour Integral Settings
#----------------------------------------
equilibrium_contour = SemiCircleContour(
    integral_lower_bound=4.95748378543*Hartree,
    )
contour_parameters = ContourParameters(
    equilibrium_contour=equilibrium_contour,
    )

#----------------------------------------
# Electrode Calculators
#----------------------------------------
left_electrode_calculator = LCAOCalculator(
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=left_electrode_numerical_accuracy_parameters,
    poisson_solver=left_electrode_poisson_solver,
    )

right_electrode_calculator = LCAOCalculator(
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=right_electrode_numerical_accuracy_parameters,
    poisson_solver=right_electrode_poisson_solver,
    )

#----------------------------------------
# Device Calculator
#----------------------------------------
calculator = DeviceLCAOCalculator(
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=device_numerical_accuracy_parameters,
    contour_parameters=contour_parameters,
    electrode_calculators=
        [left_electrode_calculator, right_electrode_calculator],
    electrode_voltages=( 0.001*Volt, -0.001*Volt),
    )

device_configuration.setCalculator(calculator)

# -------------------------------------------------------------
# Initial State
# -------------------------------------------------------------
initial_spin = InitialSpin(scaled_spins=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0])
device_configuration.setCalculator(
    calculator,
    initial_spin=initial_spin,
)
device_configuration.update()
nlsave('Device 2d sys.hdf5', device_configuration)
nlprint(device_configuration)

Also the program I tried to execute is this.


# Read in the collinear calculation
device_configuration = nlread('/root/Documents/ayesha/march19/Device 2d sys.hdf5', DeviceConfiguration)[0]

# Use the special noncollinear mixing scheme
iteration_control_parameters = IterationControlParameters(
    algorithm=PulayMixer(noncollinear_mixing=True),
)

# Get the calculator and modify it for noncollinear LDA
calculator = device_configuration.calculator()
calculator = calculator(
    exchange_correlation=NCLDA.PZ,
    iteration_control_parameters=iteration_control_parameters,
)

# Define the spin rotation in polar coordinates
theta = 90*Degrees
left_spins  = [(i, 1, 0*Degrees, 0*Degrees) for i in range(29)]
right_spins = [(i, 1, theta,     0*Degrees) for i in range(30,49)]
spin_list   = left_spins + right_spins
initial_spin = InitialSpin(scaled_spins=spin_list)

# Setup the initial state as a rotated collinear state
device_configuration.setCalculator(
    calculator,
    initial_spin=initial_spin,
    initial_state=device_configuration,
)

# Calculate and save
device_configuration.update()
nlsave('device2dsys90.hdf5', device_configuration)

# -------------------------------------------------------------
# Mulliken Population
# -------------------------------------------------------------
mulliken_population = MullikenPopulation(device_configuration)
nlsave('device2dsys90.hdf5', mulliken_population)
nlprint(mulliken_population)

# -------------------------------------------------------------
# Electrostatic Difference Potential
# -------------------------------------------------------------
electrostatic_difference_potential = ElectrostaticDifferencePotential(device_configuration)
nlsave('device2dsys90.hdf5', electrostatic_difference_potential)

# -------------------------------------------------------------
# Transmission Spectrum
# -------------------------------------------------------------
kpoint_grid = MonkhorstPackGrid(
    force_timereversal=False
)

transmission_spectrum = TransmissionSpectrum(
    configuration=device_configuration,
    energies=numpy.linspace(-2,2,101)*eV,
    kpoints=kpoint_grid,
    energy_zero_parameter=AverageFermiLevel,
    infinitesimal=1e-06*eV,
    self_energy_calculator=RecursionSelfEnergy(),
    )
nlsave('device2dsys90.hdf5', transmission_spectrum)


This is very important for the project that I am doing right now. Please help me.
« Last Edit: March 25, 2019, 13:20 by Aysha Naurein »

Offline Ulrik G. Vej-Hansen

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 426
  • Country: dk
  • Reputation: 9
    • View Profile
Re: NLValueError
« Reply #1 on: March 26, 2019, 10:33 »
It seems that you are using different basis sets for the initial and the Spin-Orbit calculations. If you attach both of the scripts I can make a suggestion that should solve the issue.

Offline Aysha Naurein

  • New QuantumATK user
  • *
  • Posts: 3
  • Country: in
  • Reputation: 0
    • View Profile
Re: NLValueError
« Reply #2 on: March 26, 2019, 13:29 »
the script for the initial calculation is this

# -*- coding: utf-8 -*-
# -------------------------------------------------------------
# Two-probe Configuration
# -------------------------------------------------------------

# -------------------------------------------------------------
# Left Electrode
# -------------------------------------------------------------

# Set up lattice
vector_a = [28.02575, 0.0, 0.0]*Angstrom
vector_b = [0.0, 28.02575, 0.0]*Angstrom
vector_c = [0.0, 0.0, 15.0]*Angstrom
left_electrode_lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
left_electrode_elements = [Nitrogen, Carbon, Carbon, Nitrogen, Carbon, Carbon, Nitrogen,
                           Carbon, Carbon, Nitrogen]

# Define coordinates
left_electrode_coordinates = [[ 10.89175       ,  17.333092901836,  14.225787552286],
                              [ 10.            ,  16.071986558453,  14.232637054308],
                              [ 10.89175       ,  14.810880215069,  14.239486556329],
                              [ 10.            ,  13.549773871686,  14.246336058351],
                              [ 10.89175       ,  12.288667528302,  14.253185560372],
                              [ 10.            ,  11.027561184919,  14.260035062394],
                              [ 10.89175       ,   9.766454841535,  14.266884564415],
                              [ 10.            ,   8.505348498152,  14.273734066437],
                              [ 10.89175       ,   7.244242154768,  14.280583568459],
                              [ 10.            ,   5.983135811385,  14.28743307048 ]]*Angstrom

# Set up configuration
left_electrode = BulkConfiguration(
    bravais_lattice=left_electrode_lattice,
    elements=left_electrode_elements,
    cartesian_coordinates=left_electrode_coordinates
    )

# -------------------------------------------------------------
# Right Electrode
# -------------------------------------------------------------

# Set up lattice
vector_a = [28.02575, 0.0, 0.0]*Angstrom
vector_b = [0.0, 28.02575, 0.0]*Angstrom
vector_c = [0.0, 0.0, 16.0]*Angstrom
right_electrode_lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
right_electrode_elements = [Nickel, Nickel, Nickel, Nickel, Nickel, Nickel, Nickel, Nickel,
                            Nickel, Nickel]

# Define coordinates
right_electrode_coordinates = [[ 18.02575       ,  22.404916283456,   0.083064917734],
                               [ 17.134         ,  21.143809940073,   0.089914419755],
                               [ 18.02575       ,  19.88270359669 ,   0.096763921777],
                               [ 17.134         ,  18.621597253306,   0.103613423798],
                               [ 18.02575       ,  17.360490909923,   0.11046292582 ],
                               [ 17.134         ,  16.099384566539,   0.117312427842],
                               [ 18.02575       ,  14.838278223156,   0.124161929863],
                               [ 17.134         ,  13.577171879772,   0.131011431885],
                               [ 18.02575       ,  12.316065536389,   0.137860933906],
                               [ 17.134         ,  11.054959193005,   0.144710435928]]*Angstrom

# Set up configuration
right_electrode = BulkConfiguration(
    bravais_lattice=right_electrode_lattice,
    elements=right_electrode_elements,
    cartesian_coordinates=right_electrode_coordinates
    )

# -------------------------------------------------------------
# Central Region
# -------------------------------------------------------------

# Set up lattice
vector_a = [28.02575, 0.0, 0.0]*Angstrom
vector_b = [0.0, 28.02575, 0.0]*Angstrom
vector_c = [0.0, 0.0, 35.15975]*Angstrom
central_region_lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
central_region_elements = [Nitrogen, Carbon, Carbon, Nitrogen, Carbon, Carbon, Nitrogen,
                           Carbon, Carbon, Nitrogen, Carbon, Carbon, Nitrogen, Carbon, Carbon,
                           Nitrogen, Carbon, Carbon, Nitrogen, Carbon, Carbon, Carbon, Carbon,
                           Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Nitrogen,
                           Carbon, Carbon, Nitrogen, Carbon, Carbon, Nitrogen, Carbon, Carbon,
                           Nitrogen, Nickel, Nickel, Nickel, Nickel, Nickel, Nickel, Nickel,
                           Nickel, Nickel, Nickel]

# Define coordinates
central_region_coordinates = [[ 10.89175       ,  17.333092901836,  14.225787552286],
                              [ 10.            ,  16.071986558453,  14.232637054308],
                              [ 10.89175       ,  14.810880215069,  14.239486556329],
                              [ 10.            ,  13.549773871686,  14.246336058351],
                              [ 10.89175       ,  12.288667528302,  14.253185560372],
                              [ 10.            ,  11.027561184919,  14.260035062394],
                              [ 10.89175       ,   9.766454841535,  14.266884564415],
                              [ 10.            ,   8.505348498152,  14.273734066437],
                              [ 10.89175       ,   7.244242154768,  14.280583568459],
                              [ 10.            ,   5.983135811385,  14.28743307048 ],
                              [ 12.67525       ,  18.601048747241,  15.480044393648],
                              [ 11.7835        ,  17.339942403858,  15.48689389567 ],
                              [ 12.67525       ,  16.078836060474,  15.493743397691],
                              [ 11.7835        ,  14.817729717091,  15.500592899713],
                              [ 12.67525       ,  13.556623373707,  15.507442401734],
                              [ 11.7835        ,  12.295517030324,  15.514291903756],
                              [ 12.67525       ,  11.03441068694 ,  15.521141405777],
                              [ 11.7835        ,   9.773304343557,  15.527990907799],
                              [ 12.67525       ,   8.512198000174,  15.53484040982 ],
                              [ 11.7835        ,   7.25109165679 ,  15.541689911842],
                              [ 14.45875       ,  19.869004592646,  16.73430123501 ],
                              [ 13.567         ,  18.607898249263,  16.741150737032],
                              [ 14.45875       ,  17.346791905879,  16.748000239053],
                              [ 13.567         ,  16.085685562496,  16.754849741075],
                              [ 14.45875       ,  14.824579219112,  16.761699243096],
                              [ 13.567         ,  13.563472875729,  16.768548745118],
                              [ 14.45875       ,  12.302366532346,  16.775398247139],
                              [ 13.567         ,  11.041260188962,  16.782247749161],
                              [ 14.45875       ,   9.780153845579,  16.789097251182],
                              [ 13.567         ,   8.519047502195,  16.795946753204],
                              [ 16.24225       ,  21.136960438051,  17.988558076372],
                              [ 15.3505        ,  19.875854094668,  17.995407578393],
                              [ 16.24225       ,  18.614747751284,  18.002257080415],
                              [ 15.3505        ,  17.353641407901,  18.009106582437],
                              [ 16.24225       ,  16.092535064518,  18.015956084458],
                              [ 15.3505        ,  14.831428721134,  18.02280558648 ],
                              [ 16.24225       ,  13.570322377751,  18.029655088501],
                              [ 15.3505        ,  12.309216034367,  18.036504590523],
                              [ 16.24225       ,  11.048109690984,  18.043354092544],
                              [ 15.3505        ,   9.7870033476  ,  18.050203594566],
                              [ 18.02575       ,  22.404916283456,  19.242814917734],
                              [ 17.134         ,  21.143809940073,  19.249664419755],
                              [ 18.02575       ,  19.88270359669 ,  19.256513921777],
                              [ 17.134         ,  18.621597253306,  19.263363423798],
                              [ 18.02575       ,  17.360490909923,  19.27021292582 ],
                              [ 17.134         ,  16.099384566539,  19.277062427842],
                              [ 18.02575       ,  14.838278223156,  19.283911929863],
                              [ 17.134         ,  13.577171879772,  19.290761431885],
                              [ 18.02575       ,  12.316065536389,  19.297610933906],
                              [ 17.134         ,  11.054959193005,  19.304460435928]]*Angstrom

# Set up configuration
central_region = BulkConfiguration(
    bravais_lattice=central_region_lattice,
    elements=central_region_elements,
    cartesian_coordinates=central_region_coordinates
    )

device_configuration = DeviceConfiguration(
    central_region,
    [left_electrode, right_electrode]
    )

# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#----------------------------------------
# Exchange-Correlation
#----------------------------------------
exchange_correlation = NCGGA.PBE

#----------------------------------------
# Numerical Accuracy Settings
#----------------------------------------
left_electrode_k_point_sampling = MonkhorstPackGrid(
    na=3,
    nb=3,
    nc=3,
    force_timereversal=False,
    )
left_electrode_numerical_accuracy_parameters = NumericalAccuracyParameters(
    k_point_sampling=left_electrode_k_point_sampling,
    density_mesh_cutoff=185.0*Hartree,
    )

right_electrode_k_point_sampling = MonkhorstPackGrid(
    na=3,
    nb=3,
    nc=3,
    force_timereversal=False,
    )
right_electrode_numerical_accuracy_parameters = NumericalAccuracyParameters(
    k_point_sampling=right_electrode_k_point_sampling,
    density_mesh_cutoff=185.0*Hartree,
    )

device_k_point_sampling = MonkhorstPackGrid(
    na=3,
    nb=3,
    nc=3,
    force_timereversal=False,
    )
device_numerical_accuracy_parameters = NumericalAccuracyParameters(
    k_point_sampling=device_k_point_sampling,
    density_mesh_cutoff=185.0*Hartree,
    )

#----------------------------------------
# Poisson Solver Settings
#----------------------------------------
left_electrode_poisson_solver = FastFourier2DSolver(
    boundary_conditions=[[PeriodicBoundaryCondition(),PeriodicBoundaryCondition()],
                         [PeriodicBoundaryCondition(),PeriodicBoundaryCondition()],
                         [PeriodicBoundaryCondition(),PeriodicBoundaryCondition()]]
    )

right_electrode_poisson_solver = FastFourier2DSolver(
    boundary_conditions=[[PeriodicBoundaryCondition(),PeriodicBoundaryCondition()],
                         [PeriodicBoundaryCondition(),PeriodicBoundaryCondition()],
                         [PeriodicBoundaryCondition(),PeriodicBoundaryCondition()]]
    )

#----------------------------------------
# Contour Integral Settings
#----------------------------------------
equilibrium_contour = SemiCircleContour(
    integral_lower_bound=4.95748378543*Hartree,
    )
contour_parameters = ContourParameters(
    equilibrium_contour=equilibrium_contour,
    )

#----------------------------------------
# Electrode Calculators
#----------------------------------------
left_electrode_calculator = LCAOCalculator(
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=left_electrode_numerical_accuracy_parameters,
    poisson_solver=left_electrode_poisson_solver,
    )

right_electrode_calculator = LCAOCalculator(
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=right_electrode_numerical_accuracy_parameters,
    poisson_solver=right_electrode_poisson_solver,
    )

#----------------------------------------
# Device Calculator
#----------------------------------------
calculator = DeviceLCAOCalculator(
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=device_numerical_accuracy_parameters,
    contour_parameters=contour_parameters,
    electrode_calculators=
        [left_electrode_calculator, right_electrode_calculator],
    electrode_voltages=( 0.001*Volt, -0.001*Volt),
    )

device_configuration.setCalculator(calculator)

# -------------------------------------------------------------
# Initial State
# -------------------------------------------------------------
initial_spin = InitialSpin(scaled_spins=[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0])
device_configuration.setCalculator(
    calculator,
    initial_spin=initial_spin,
)
device_configuration.update()
nlsave('Device 2d sys.hdf5', device_configuration)
nlprint(device_configuration)

and the script for the spin orbit calculation is this

thetas = [0,90,180]

for theta in thetas:
    # Output data file
    filename = 'theta-%i.hdf5' % theta

    # Read in the collinear calculation
    device_configuration = nlread('/root/Documents/ayesha/march19/Device 2d sys.hdf5', DeviceConfiguration)[0]

    # Use the special noncollinear mixing scheme
    iteration_control_parameters = IterationControlParameters(
        algorithm=PulayMixer(noncollinear_mixing=True),
    )

    # Get the calculator and modify it for noncollinear LDA
    calculator = device_configuration.calculator()
    calculator = calculator(
        exchange_correlation=NCLDA.PZ,
        iteration_control_parameters=iteration_control_parameters,
    )

    # Define the spin rotation in polar coordinates
    left_spins  = [(i, 1, 0*Degrees,    0*Degrees) for i in range(12)]
    right_spins = [(i, 1, theta*Degrees, 0*Degrees) for i in range(12,24)]
    spin_list   = left_spins + right_spins
    initial_spin = InitialSpin(scaled_spins=spin_list)

    # Setup the initial state as a rotated collinear state
    device_configuration.setCalculator(
        calculator,
        initial_spin=initial_spin,
        initial_state=device_configuration,
    )

    # Calculate and save
    device_configuration.update()
    nlsave(filename, device_configuration)

    # -------------------------------------------------------------
    # Mulliken Population
    # -------------------------------------------------------------
    mulliken_population = MullikenPopulation(device_configuration)
    nlsave(filename, mulliken_population)
    nlprint(mulliken_population)

    # -------------------------------------------------------------
    # Transmission Spectrum
    # -------------------------------------------------------------
    kpoint_grid = MonkhorstPackGrid(
        force_timereversal=False
    )

    transmission_spectrum = TransmissionSpectrum(
        configuration=device_configuration,
        energies=numpy.linspace(-2,2,101)*eV,
        kpoints=kpoint_grid,
        energy_zero_parameter=AverageFermiLevel,
        infinitesimal=1e-06*eV,
        self_energy_calculator=RecursionSelfEnergy(),
        )
    nlsave(filename, transmission_spectrum)

    # -------------------------------------------------------------
    # Spin Transfer Torque
    # -------------------------------------------------------------
    kpoint_grid = MonkhorstPackGrid(
        force_timereversal=False,
        )

    spin_transfer_torque = SpinTransferTorque(
        configuration=device_configuration,
        energy=6*eV,
        kpoints=kpoint_grid,
        contributions=Left,
        energy_zero_parameter=AverageFermiLevel,
        infinitesimal=1e-06*eV,
        self_energy_calculator=RecursionSelfEnergy(),
        )
    nlsave(filename, spin_transfer_torque)


From what you said, I think the problem is with the exchange correlation. The first calculation went smoothly without any errors. Kindly let me know what you think I should do

Offline Ulrik G. Vej-Hansen

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 426
  • Country: dk
  • Reputation: 9
    • View Profile
Re: NLValueError
« Reply #3 on: March 27, 2019, 10:22 »
You are right that you should make sure to use consistent exchange-correlation functionals, not LDA for one and GGA for the other. However, it  is only the indirect reason for the error you see. Because you change the exchange-correlation type, you will get different default basis sets because you have not explicitly defined them, and this mismatch causes the error. The important lines in the tutorial scripts (para.py and angles.py) are these: para.py - lines 116-123
Code
basis_set = [
    LDABasis.Carbon_SingleZetaPolarized,
    ]

#----------------------------------------
# Exchange-Correlation
#----------------------------------------
exchange_correlation = LSDA.PZ
angles.py - lines 16-20
Code
    calculator = device_configuration.calculator()
    calculator = calculator(
        exchange_correlation=NCLDA.PZ,
        iteration_control_parameters=iteration_control_parameters,
    )
Note how the basis set is explicitly defined in the first, spin-polarized, calculation, which is then read in and used as the starting point for defining the noncollinear one. This ensures that the calculation parameters are consistent. P.S. Please attach your scripts instead of including the full text in the post. In that way, it will be much easier to read for everybody.

Offline Aysha Naurein

  • New QuantumATK user
  • *
  • Posts: 3
  • Country: in
  • Reputation: 0
    • View Profile
Re: NLValueError
« Reply #4 on: March 27, 2019, 16:21 »
Thank you very much. I've made the change and the calculations are going on right now.
Also thank you for your advice about posting just the scripts. I will remember to do so.