Author Topic: Questions about nlread  (Read 3726 times)

0 Members and 1 Guest are viewing this topic.

Offline Lim changmin

  • Heavy QuantumATK user
  • ***
  • Posts: 28
  • Country: kr
  • Reputation: 0
    • View Profile
Questions about nlread
« on: January 1, 2024, 05:17 »
Hello, and happy new year everyone.

Recently, I had a Deviceconfiguration that successfully converged with PLDOS. It took more than 10 hours

I wanted to reuse it with transmission spectrum, but since it consumed a lot of time, I was planning to redo it with 'nlread function'.

Here is my code

# DeviceConfiguration
Device_configuration = nlread('Si80_111_5e19_4040.hdf5',DeviceConfiguration_0)[0]

#Choose the first configuration in the list
Device_configuration = Device_configuration_list[0]

# %% Set Calculator

Device_configuration.setCalculator(calculator)

Device_configuration.update()

nlsave('Si80_111_5e19_5050trans.hdf5', Device_configuration)

# %% TransmissionSpectrum

kpoints = MonkhorstPackGrid(
    na=50,
    nb=50,
    nc=1,
    symmetries=[
        ([[ 1., 0., 0.],
          [ 0., 1., 0.],
          [ 0., 0., 1.]], [ 0., 0., 0.]),
        ([[-1., 0., 0.],
          [ 0.,-1., 0.],
          [ 0., 0.,-1.]], [ 0., 0., 0.]),
    ],
    force_timereversal=True,
    k_point_shift=None,
    shift_to_gamma=[True, True, True]
)

self_energy_calculator = RecursionSelfEnergy(
    storage_strategy=NoStorage()
)

device_transmission_method = GreensFunction(
    processes_per_contour_point=1,
    )

transmission_spectrum = TransmissionSpectrum(
    configuration=Device_configuration,
    energies=numpy.linspace(0.0, 0.0, 1)*eV,
    kpoints=kpoints,
    kpoints_weights=None,
    self_energy_calculator=self_energy_calculator,
    energy_zero_parameter=AverageFermiLevel,
    infinitesimal=1e-06*eV,
    device_transmission_method=device_transmission_method,
    enforce_zero_in_band_gap=True
)
nlsave('Si80_111_5e19_5050trans.hdf5', transmission_spectrum)

However when I ran the calculation nothing appeared on the log file, and the calculation did not run.

Could somebody please help me with how to use 'nlread' properly?

Thank you.

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Questions about nlread
« Reply #1 on: January 5, 2024, 20:43 »
The code is a bit confusing, it shouldn't run actually.

I am assuming that the file Si80_111_5e19_4040.hdf5 contains one DeviceConfiguration, and that is is converged. If so, you do not need to set a calculator on it, and run update. In fact, that will re-run it (at least if any of the calculator setting are different). But in your code, the variable "calculator" is not defined, so that would give an error.

Second, you are already selecting the first object in the list in the line
Device_configuration = nlread('Si80_111_5e19_4040.hdf5',DeviceConfiguration_0)[0]
so the line
Device_configuration = Device_configuration_list[0]
is not needed, and also will give an error since Device_configuration_list is not defined.

And there is no need to have a second nlsave right after you just read the file...

So, all you really need is
Device_configuration = nlread('Si80_111_5e19_4040.hdf5',DeviceConfiguration_0)[0]
and then go straight into the part under
# %% TransmissionSpectrum

Offline Lim changmin

  • Heavy QuantumATK user
  • ***
  • Posts: 28
  • Country: kr
  • Reputation: 0
    • View Profile
Re: Questions about nlread
« Reply #2 on: January 8, 2024, 04:47 »
Thank you for your kind reply.
I had already used nlread method like you said.

This is the code that I used

Device_configuration = nlread('Si80_111_5e19_4040.hdf5',DeviceConfiguration_0)[0]

# %% TransmissionSpectrum

kpoints = MonkhorstPackGrid(
    na=100,
    nb=100,
    nc=1,
    symmetries=[
        ([[ 1., 0., 0.],
          [ 0., 1., 0.],
          [ 0., 0., 1.]], [ 0., 0., 0.]),
        ([[-1., 0., 0.],
          [ 0.,-1., 0.],
          [ 0., 0.,-1.]], [ 0., 0., 0.]),
    ],
    force_timereversal=True,
    k_point_shift=None,
    shift_to_gamma=[True, True, True]
)

self_energy_calculator = RecursionSelfEnergy(
    storage_strategy=NoStorage()
)

device_transmission_method = GreensFunction(
    processes_per_contour_point=1,
    )

transmission_spectrum = TransmissionSpectrum(
    configuration=Device_configuration,
    energies=numpy.linspace(0.0, 0.0, 1)*eV,
    kpoints=kpoints,
    kpoints_weights=None,
    self_energy_calculator=self_energy_calculator,
    energy_zero_parameter=AverageFermiLevel,
    infinitesimal=1e-06*eV,
    device_transmission_method=device_transmission_method,
    enforce_zero_in_band_gap=True
)
nlsave('Si80_111_5e19_nlread.hdf5', transmission_spectrum)

But Still the error occurred

Abort(1) on node 36 (rank 36 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 1) - process 36
  File "Si80_111_1e20_nlread.py", line 1, in <module>
NameError: name 'DeviceConfiguration_0' is not defined
Abort(1) on node 45 (rank 45 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 1) - process 45
    Device_configuration = nlread('Si80_111_1e20_4040.hdf5',DeviceConfiguration_0)[0]
NameError: name 'DeviceConfiguration_0' is not defined
NameError: name 'DeviceConfiguration_0' is not defined
  File "Si80_111_1e20_nlread.py", line 1, in <module>
Abort(1) on node 20 (rank 20 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 1) - process 20
Abort(1) on node 23 (rank 23 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 1) - process 23
                                                            ^^^^^^^^^^^^^^^^^^^^^
NameError: name 'DeviceConfiguration_0' is not defined
Abort(1) on node 30 (rank 30 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 1) - process 30
    Device_configuration = nlread('Si80_111_1e20_4040.hdf5',DeviceConfiguration_0)[0]
                                                            ^^^^^^^^^^^^^^^^^^^^^
NameError: name 'DeviceConfiguration_0' is not defined
Abort(1) on node 35 (rank 35 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 1) - process 35

It said that it cannot read DeviceConfiguration_0

I am using 2023.9 version and the location is Si80_111_5e19_4040.hdf5, type is bulk and the name is DeviceConfiguration_0

I already used other nlread type name.

Is there any other way that I could solve this problem?

Thank you

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5576
  • Country: dk
  • Reputation: 96
    • View Profile
    • QuantumATK at Synopsys
Re: Questions about nlread
« Reply #3 on: January 12, 2024, 21:05 »
Yeah, the second argument to nlread should not be the object id but the class type, so instead of

Device_configuration = nlread('Si80_111_5e19_4040.hdf5',DeviceConfiguration_0)[0]

do

Device_configuration = nlread('Si80_111_5e19_4040.hdf5',DeviceConfiguration)[0]

Sorry, I didn't notice this mistake earlier.

Offline Lim changmin

  • Heavy QuantumATK user
  • ***
  • Posts: 28
  • Country: kr
  • Reputation: 0
    • View Profile
Re: Questions about nlread
« Reply #4 on: January 17, 2024, 01:14 »
Thank you!!