Author Topic: "IndentationError: unexpected indent" with ATK 2016  (Read 7407 times)

0 Members and 1 Guest are viewing this topic.

Offline yasheng

  • Heavy QuantumATK user
  • ***
  • Posts: 50
  • Country: us
  • Reputation: 0
    • View Profile
"IndentationError: unexpected indent" with ATK 2016
« on: August 1, 2016, 17:32 »
Dear All,
My first calculation with ATK 2016 version ended with some unexpected error.

IndentationError: unexpected indent
 File "6_Cu111.py", line 149
 element=PeriodicTable.Oxygen,

Does anyone have similar problem? I've never seen this type of error with 2015 version.

I don't know what caused this indentation error. please help me.

Regards,
Yasheng








Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5394
  • Country: dk
  • Reputation: 89
    • View Profile
    • QuantumATK at Synopsys
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #1 on: August 1, 2016, 17:38 »
Simple Python error, but can only be solved by showing your script

Offline yasheng

  • Heavy QuantumATK user
  • ***
  • Posts: 50
  • Country: us
  • Reputation: 0
    • View Profile
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #2 on: August 2, 2016, 10:28 »
Thank you for your reply. I attached the script for your inspection.


Offline yasheng

  • Heavy QuantumATK user
  • ***
  • Posts: 50
  • Country: us
  • Reputation: 0
    • View Profile
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #3 on: August 2, 2016, 15:17 »
Now it is clear that this is because of the bug in VNL 2016 script generator.

VNL 2016 script generator produce the following script for OPENMX basis set

#----------------------------------------
# Basis Set
#----------------------------------------
# Basis set for OxygenOxygenBasis = OpenMXBasisSet(
    element=PeriodicTable.Oxygen,
    filename="openmx/pao/O7.0.pao.zip",
    atomic_species="s2p2d1",
    hubbard_u=[0.0, 0.0, 0.0, 0.0, 0.0]*eV,
    filling_method=SphericalSymmetric,
    onsite_spin_orbit_split=[0.0, 0.0, 0.0, 0.0, 0.0]*eV,
    pseudopotential=NormConservingPseudoPotential("normconserving/upf2/O_CA13.upf.zip"),
    )


# Basis set for CopperCopperBasis = OpenMXBasisSet(
    element=PeriodicTable.Copper,
    filename="openmx/pao/Cu6.0H.pao.zip",
    atomic_species="s3p2d1",
    hubbard_u=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0]*eV,
    filling_method=SphericalSymmetric,
    onsite_spin_orbit_split=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0]*eV,
    pseudopotential=NormConservingPseudoPotential("normconserving/upf2/Cu_CA13H.upf.zip"),
    )




it should be another line after "# Basis set for Oxygen/Copper". e.g:



#----------------------------------------
# Basis Set
#----------------------------------------
# Basis set for Oxygen
OxygenBasis = OpenMXBasisSet(
    element=PeriodicTable.Oxygen,
    filename="openmx/pao/O7.0.pao.zip",
    atomic_species="s2p2d1",
    hubbard_u=[0.0, 0.0, 0.0, 0.0, 0.0]*eV,
    filling_method=SphericalSymmetric,
    onsite_spin_orbit_split=[0.0, 0.0, 0.0, 0.0, 0.0]*eV,
    pseudopotential=NormConservingPseudoPotential("normconserving/upf2/O_CA13.upf.zip"),
    )


# Basis set for Copper
CopperBasis = OpenMXBasisSet(
    element=PeriodicTable.Copper,
    filename="openmx/pao/Cu6.0H.pao.zip",
    atomic_species="s3p2d1",
    hubbard_u=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0]*eV,
    filling_method=SphericalSymmetric,
    onsite_spin_orbit_split=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0]*eV,
    pseudopotential=NormConservingPseudoPotential("normconserving/upf2/Cu_CA13H.upf.zip"),
    )



I hope this bug be fixed as soon as possible.

Regards,
Yasheng





Offline Umberto Martinez

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 479
  • Country: dk
  • Reputation: 26
    • View Profile
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #4 on: August 3, 2016, 10:03 »
Not a bug. the lines should read:
Code
OxygenOxygenBasis = OpenMXBasisSet(
    element=PeriodicTable.Oxygen,
    filename="openmx/pao/O7.0.pao.zip",
    atomic_species="s2p2d1",
    hubbard_u=[0.0, 0.0, 0.0, 0.0, 0.0]*eV,
    filling_method=SphericalSymmetric,
    onsite_spin_orbit_split=[0.0, 0.0, 0.0, 0.0, 0.0]*eV,
    pseudopotential=NormConservingPseudoPotential("normconserving/upf2/O_CA13.upf.zip"),
    )
same for the CopperCopperBasis definition. Also, next time please attach the full script.

Offline asanchez

  • Heavy QuantumATK user
  • ***
  • Posts: 42
  • Country: ie
  • Reputation: 1
    • View Profile
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #5 on: August 3, 2016, 18:03 »
I believe there is a bug.

To reproduce this you need to select the OpenMX basis set and then set "Script detail" to "Show defaults". The resulting script generated by VNL2016 will have that mistake.

It seems to only happen with OpenMX basis sets and only when you select "show defaults" - which introduces the comment "# Basis set for X". There doesn't seem to be a line break after the comment.

Offline yasheng

  • Heavy QuantumATK user
  • ***
  • Posts: 50
  • Country: us
  • Reputation: 0
    • View Profile
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #6 on: August 3, 2016, 21:06 »
Yes,  I have already posted the full script. (just scroll up little bit, and you can see the attachment)

Offline Umberto Martinez

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 479
  • Country: dk
  • Reputation: 26
    • View Profile
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #7 on: August 3, 2016, 21:50 »
missed the part mentioning the script generator!! ?? sorry. my mistake, indeed it seems like a bug. plus I even wrote it wrong, you should break the line after the first Oxygen:
Code
# Basis set for Oxygen
OxygenBasis = OpenMXBasisSet(
    element=PeriodicTable.Oxygen,
    filename="openmx/pao/O7.0.pao.zip",
    atomic_species="s2p2d1",
    hubbard_u=[0.0, 0.0, 0.0, 0.0, 0.0]*eV,
    filling_method=SphericalSymmetric,
    onsite_spin_orbit_split=[0.0, 0.0, 0.0, 0.0, 0.0]*eV,
    pseudopotential=NormConservingPseudoPotential("normconserving/upf2/O_CA13.upf.zip"),
    )
thank you both for reporting it, we'll keep you posted!

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5394
  • Country: dk
  • Reputation: 89
    • View Profile
    • QuantumATK at Synopsys
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #8 on: August 4, 2016, 19:38 »
As a temporary workaround for running calculations with the OMX basis sets and begin able to read back the results, make sure you save the configuration in a separate NC file, different from the analysis objects.

Offline yasheng

  • Heavy QuantumATK user
  • ***
  • Posts: 50
  • Country: us
  • Reputation: 0
    • View Profile
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #9 on: August 16, 2016, 17:12 »
After manually correcting the OMX basis set part of the script and calculating the electrodes separately, I found that the electrodes cannot be re-used to calculate the transmission of the device.

This is because of the same bug and the produced nc file have some problem even if I correct the script. What a waste of time, I should go back to 2015 version. 

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5394
  • Country: dk
  • Reputation: 89
    • View Profile
    • QuantumATK at Synopsys
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #10 on: August 17, 2016, 08:13 »
It's a very unfortunate bug and therefore we are moving fast to release 2016.1 which fixes it. It will hopefully be available within the next few days.

The workarounds do not really work for devices, I admit, since the error is rather fundamental (although, it would work for bulk, to at least get the calculation through and be able to inspect some results).

The problem only occurs for OMX basis sets - maybe you would like to try the new SG15 sets instead? They give very accurate results, are softer than OMX, so you need small cutoffs, and they also support spin-orbit.

Anyway, we apologize for the inconvenience, and hope you will enjoy 2016.1 very soon!

Offline yasheng

  • Heavy QuantumATK user
  • ***
  • Posts: 50
  • Country: us
  • Reputation: 0
    • View Profile
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #11 on: August 17, 2016, 11:45 »
That is a good news! I look forward the release of 2016.1 and fixing all these bugs.

I used OMX basis sets for my previous calculations, and I think I should probably stick to that for the sake of consistency.

Offline Jess Wellendorff

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 933
  • Country: dk
  • Reputation: 29
    • View Profile
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #12 on: August 17, 2016, 11:47 »
Yes, that makes good sense.

Offline Umberto Martinez

  • Supreme QuantumATK Wizard
  • *****
  • Posts: 479
  • Country: dk
  • Reputation: 26
    • View Profile
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #13 on: September 19, 2016, 10:39 »
In case you missed the news, ATK 2016.1 has been released where this issue with OMX basis set is fixed + support has been added for opening broken NC files produced by 2016.0 (in case you manually fixed the script problem).

http://quantumwise.com/products/download

Offline creigelde

  • New QuantumATK user
  • *
  • Posts: 1
  • Country: ae
  • Reputation: 0
    • View Profile
Re: "IndentationError: unexpected indent" with ATK 2016
« Reply #14 on: November 26, 2019, 07:49 »
As the error message indicates, you have an unexpected indent error. This error occurs when a statement is unnecessarily indented or its indentation does not match the indentation of former statements in the same block. Python not only insists on indentation, it insists on consistent indentation . You are free to choose the number of spaces of indentation to use, but you then need to stick with it. If you indent one line by 4 spaces, but then indent the next by 2 (or 5, or 10, or ...), you'll get this error. Whenever you have a situation with code inside of a statement, that inside code must be indented, and must be indented consistently. It is used by the interpreter to know how to delimit blocks of instructions.