Author Topic: benzene based SET  (Read 3237 times)

0 Members and 1 Guest are viewing this topic.

Offline new to this

  • New QuantumATK user
  • *
  • Posts: 4
  • Country: fr
  • Reputation: 0
    • View Profile
benzene based SET
« on: November 28, 2013, 00:55 »
Hi, I have recently started working with ATK and simply trying to reproduce the benzene based SET example as listed in the tutorial. Thanks for the nice step by step introduction, very helpful for a beginner like me. Unfortunately, I got stuck at the "charging energy as function of the gate voltage" section, while compiling the "gatescan0.py" script. I am copying the code here ...

......................................................
#read in the old configuration
filename = 'benzene_set0.nc'
bulk_configuration = nlread(filename,BulkConfiguration)[0]

# Define gate_voltages
gate_voltage_list=[2, 4, 6, 8, -2, -4, -6, -8]*Volt

metallic_regions = bulk_configuration.metallicRegions()
metallic_region0 = metallic_regions[0]

for gate_voltage in gate_voltage_list:
    print 'Gate Voltage = ', gate_voltage

    bulk_configuration.setMetallicRegions(
        [metallic_region0(value = gate_voltage),
         metallic_regions[1],
         metallic_regions[2] ] )

    calculator = bulk_configuration.calculator()
    # Set the calculator on the configuration
    # and use the old calculation as initial state for the scf loop
    bulk_configuration.setCalculator(calculator(),
                                     initial_state=bulk_configuration)

    #Analysis
    electrostatic_potential = ElectrostaticDifferencePotential(bulk_configuration)
    nlsave(filename, electrostatic_potential, object_id='pot'+str(gate_voltage))

    molecular_energy_spectrum = MolecularEnergySpectrum(
        configuration=bulk_configuration,
        energy_zero_parameter=FermiLevel,
        projection_list=ProjectionList(All)
        )
    nlsave(filename, molecular_energy_spectrum, object_id='spec'+str(gate_voltage))
    nlprint(molecular_energy_spectrum)

    total_energy = TotalEnergy(bulk_configuration)
    nlprint(total_energy)
    nlsave(filename, total_energy, object_id='energy'+str(gate_voltage))

............................................

I am getting this error message while compiling it:

+------------------------------------------------------------------------------+
Traceback (most recent call last):
  File "c:\users\xxxx\appdata\local\temp\2184180173623442.py", line 5, in <module>
    bulk_configuration = nlread(filename,BulkConfiguration)[0]
  File ".\zipdir\NL\IO\NLSaveUtilities.py", line 203, in nlread
NL.ComputerScienceUtilities.Exceptions.NLValueError: The filename, benzene_set0.nc, was not found - please check correct path and name.
NanoLanguageScript execution failure
+------------------------------------------------------------------------------+

I am no expert in python, but surely the file "benzene_set0.nc" is present in the directory. I changed the name of the file to a different one so that no special characters are present, but error still persists. I have no clue. Any help on this will be highly appreciated. Thanks. 

Offline zh

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 1141
  • Reputation: 24
    • View Profile
Re: benzene based SET
« Reply #1 on: November 28, 2013, 02:35 »
A possible solution: put the absolute path of 'benzene_set0.nc' into the value of  filename variable.

Offline new to this

  • New QuantumATK user
  • *
  • Posts: 4
  • Country: fr
  • Reputation: 0
    • View Profile
Re: benzene based SET
« Reply #2 on: November 28, 2013, 11:46 »
Thanks, I checked this. But no changes ... The error message is :

+------------------------------------------------------------------------------+
Traceback (most recent call last):
  File "d:\docume....\temp\4045643936488096.py", line 5, in <module>
    bulk_configuration = nlread(filename,BulkConfiguration)[0]
  File ".\zipdir\NL\IO\NLSaveUtilities.py", line 203, in nlread
NL.ComputerScienceUtilities.Exceptions.NLValueError: The filename, D:\Benzene_SETenzene_set0.nc, was not found - please check correct path and name.
NanoLanguageScript execution failure
+------------------------------------------------------------------------------+

I tried running this file independently using a python compiler, the error message with that is:

.............................
Traceback (most recent call last):
  File "D:\Benzene_SET\gatescan0.py", line 3, in <module>
    bulk_configuration = nlread(filename,BulkConfiguration)[0]
NameError: name 'nlread' is not defined
.......................................................................

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: benzene based SET
« Reply #3 on: November 28, 2013, 18:24 »
Use / instead of \

Offline new to this

  • New QuantumATK user
  • *
  • Posts: 4
  • Country: fr
  • Reputation: 0
    • View Profile
Re: benzene based SET
« Reply #4 on: March 26, 2014, 02:12 »
Thanks very much Andreas.