Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jrussell

Pages: [1]
1
General Questions and Answers / Re: export CUBE files
« on: April 1, 2013, 22:00 »
Hi Anders,

Thanks for the awesome script! This is very helpful!

I had to make some minor tweaks --
Code
    header = """CUBE FILE. DATA VALUES IN UNITS OF %s, LENGTHS IN BOHR
OUTER LOOP: X, MIDDLE LOOP: Y, INNER LOOP: Z
%5i%18.6e%18.6e%18.6e
%5i%18.6e%18.6e%18.6e
%5i%18.6e%18.6e%18.6e
%5i%18.6e%18.6e%18.6e
"""
Here I changed the number format from %13.6 to %18.6e to prevent numbers from running together.

The second tweak was to add a column to the atom section. There are a total five columns:
atomic number, charge, x, y, and z. Here I just added the fifth column and set the charge to zero as
I am using the electron density to get Bader charges anyways.
Code
    if number_of_atoms:
        coordinates = gridvalues._configuration().cartesianCoordinates().inUnitsOf(Bohr)
        elements = gridvalues._configuration().elements()
        zero = 0.0
        for e,c in zip(elements,coordinates):
            stream.write("%5i%4.1f%18.6e%18.6e%18.6e\n" % (e.atomicNumber(),zero,c[0],c[1],c[2]))
    else:
        stream.write("\n")

But that was really minor stuff that I could figure out :) This is really useful, thanks again
for your help!

Best,
John

2
General Questions and Answers / Re: export CUBE files
« on: March 29, 2013, 18:51 »
Hi Anders,

I also have an extra question -- is it possible to increase the density of grid points in the CUBE file?
For example, it would be helpful to be able to get grid spacing of  12 points/Bohr. I didn't see how
to change the grid density in the ElectronDensity keyword.

Thanks again,
John

3
General Questions and Answers / Re: export CUBE files
« on: March 28, 2013, 20:49 »
Hi Anders, thanks for your help! I am importing the file into the Bader analysis program by G. Henkelman, et. al.
(found here: http://theory.cm.utexas.edu/bader/ ). It needs a Gaussian CUBE file format as an input
(file format here: http://paulbourke.net/dataformats/cube/ ). I am trying to calculate the atomic charges from the
electron density (mulliken charges are too far off for my application).

I also use VMD and Chemcraft visualisation software to render isosurfaces generated from CUBE files for publications,
so it is very useful to be able to export into the CUBE file format.

Thanks again for your help,
John

4
General Questions and Answers / Re: export CUBE files
« on: March 28, 2013, 18:24 »
Please see here:
http://quantumwise.com/forum/index.php?topic=1310.0
http://quantumwise.com/forum/index.php?topic=447.0
http://quantumwise.com/forum/index.php?topic=1216.0

Hi Zh, thanks for your reply. I am still stuck!

I try the solution for this one:
http://quantumwise.com/forum/index.php?topic=1310.0

This is using cube_rev_eng.py script. I get an error:
Code
[jrussell@login1 test]$ atkpython cube_rev_eng.py vnl.cube > out.cube
Traceback (most recent call last):
  File "cube_rev_eng.py", line 20, in <module>
    header_data[0].append(int(line[0:5].strip()))
ValueError: invalid literal for int() with base 10: ''

I don't have any idea why this didn't work.

I tried the next solution for this one:
http://quantumwise.com/forum/index.php?topic=447.0

This is using export_cube.py included with the second forum answer. I had to modify
the script that calls export_cube.py because ATK.TwoProbe is no longer valid. Also
restoreSelfConsistentCalculation() is no longer valid. And also calculateElectronDensity()
is no longer valid.

Code
#!/bin/env atkpython
from NanoLanguage import *
from export_cube import *

#scf = restoreSelfConsistentCalculation('checkpoint.nc')
configuration = nlread("checkpoint.nc")[0]
electron_density = ElectronDensity(
    configuration=configuration,
    spin=Spin.Sum,
    )
export_cube_file(electron_density,'out.cube')

And I got this result:
Code
Traceback (most recent call last):
  File "dump_cube.py", line 11, in <module>
    export_cube_file(electron_density,'out.cube')
  File "/home/jrussell/atk/li2o/LiO/test/export_cube.py", line 37, in export_cube_file
    origin = grid._cell().origin()
AttributeError: 'ElectronDensity' object has no attribute '_cell'

Perhaps this is an old solution no longer valid for ATK 12.8.2? This old stuff is very misleading.

The last forum link didn't seem to apply.

Thanks very much for your help, and any advice is greatly appreciated!
Best,
John


5
General Questions and Answers / export CUBE files
« on: March 28, 2013, 06:36 »
Dear ATK users,

Please pardon my ignorance, as I am a new user! I would like to export electron density
in a CUBE format. I can do this in VNL just fine, and I can also have the data outputted into
my output file. Here's what I do in my job file to ask for the CUBE of electron density:

Code
electron_density = ElectronDensity(
    configuration=bulk_configuration,
    spin=Spin.Sum,
    )
nlsave('density.nc', electron_density)
nlprint(electron_density)

I am having a problem though -- the coordinate information for the atoms is not included
in the cubefile and I have to add it manually. Is there a script, or a way to have to get the
cube file in the proper format?

Here's the problem:
Code
CUBE FILE.
OUTER LOOP: X, MIDDLE LOOP: Y, INNER LOOP: Z
    0 0.000000e+00 0.000000e+00 0.000000e+00
   28 0.000000e+00 1.558687e-01 1.558687e-01
   28 1.558687e-01 0.000000e+00 1.558687e-01
   28 1.558687e-01 1.558687e-01 0.000000e+00

  1.04643e-04  6.94395e-01  1.03695e+00  8.03578e-01  5.12214e-01  3.04839e-01
......(the rest of the file)
In the CUBE FILE, It is saying that there are 0 atoms in my unit cell on line 3. I have to
fix this manually, and then manually insert the missing atomic number & coordinates on
line 7.

Any ideas on how to get this without the extra editing?
Thanks for your help,
John

6
Dear ATK,

I am a little confused about how to perform a geometry optimization where both
cartesian coordinates and lattice vectors are optimized.

Is this method still valid:
http://quantumwise.com/forum/index.php?topic=29.msg77#msg77

Or is optimization of lattice vectors implied when you use disable_stress=false
 in the OptimizeGeometry part of the input file?
Code
bulk_configuration = OptimizeGeometry(
        bulk_configuration,
        max_forces=0.05*eV/Ang,
        max_stress=5.0e-3*Units.eV/Units.Ang**3
        max_steps=2000,
        max_step_length=0.5*Ang,
        trajectory_filename='wire3-5traj.nc',
        disable_stress=False,
        optimizer_method=QuasiNewton(),
        )

I really appreciate the help!
Sincerely,
John

7
That worked like a charm. Thanks Anders!
Best,
John

8
Hi ATK,

I got a parallel job to run which was very exciting, but unfortunately I am not certain
how to dump a XYZ file as a trajectory. I saw in the manual that I can save a trajectory
file as a .nc file:
Code
OptimizeGeometry(
        bulk_configuration,
        max_forces=0.05*eV/Ang,
        max_steps=200,
        max_step_length=0.5*Ang,
        trajectory_filename='traj.nc')
        disable_stress=True,
        optimizer_method=QuasiNewton(),
        )
Is there a way to extract the XYZ coordinates from the .nc file at the command line?
Or is there a way that I can dump the energy, lattice vectors, and cartesian coordinates
as part of the input file? I tried the "nlprint" command with the bulk configuration which
is great, but I can't use that command inside the optimizer section, only after its done.

Thanks for the help,
John

9
General Questions and Answers / Re: nc file versus py file
« on: May 28, 2012, 23:09 »
Ah ha! Thanks very much! It worked when I changed it to  graphite.py.

The parallel isn't working but I will contact my sysadmin for help there.
Thanks again!
John

10
General Questions and Answers / nc file versus py file
« on: May 28, 2012, 22:37 »
Dear ATK,

Sorry for a really dumb question, but I could use some help. OK, I made a simple graphite NC file test
job with VNL. It runs fine when I run it from VNL. Now I want to run the job on a cluster with multiple nodes.

I tried to submit the job to the cluster like this:
$IMPI_HOME/bin/mpiexec.hydra \
        -machinefile  $PBS_NODEFILE \
        -np $(wc -l < $PBS_NODEFILE) \
        atkpython graphite.nc > graphite.out

This crashes and I don't really understand why. I tried to run it interactively using atkpython from the
command line, and it didn't like the grahite.nc job file. But I know the job is ok because it ran fine in
VNL on the login node.

What do I need to do to make a .nc file run with atkpython?

For my project, I just want to be able to optimize a large structure with multiple processors (MPI on
cluster) using DFTB, with an output of a XYZ file, lattice vectors, and a total energy of the optimized structure.
I will do a bigger structure when I can get the test job to run on multiple nodes.

Thanks for the help! Again sorry if this is obvious but its not clear to me.
John

Code
# -------------------------------------------------------------
# Bulk configuration
# -------------------------------------------------------------
# Define A,B directions of lattice
vector_a = [ 2.461599,   0.000000,   0.000000]*Angstrom
vector_b = [-1.230800,   2.131808,   0.000000]*Angstrom
vector_c = [0.0, 0.0, 100.0]*Angstrom

# Define elements
elements = [Carbon, Carbon]

# Define coordinates
cartesian_coordinates= [[-0.615400,  -0.355301,   0.000000],
                        [ 0.615400,   0.355301,   0.000000]]*Angstrom

# Set up configuration
bulk_configuration = BulkConfiguration(
    bravais_lattice=UnitCell(vector_a,vector_b,vector_c),
    elements=elements,
    cartesian_coordinates=cartesian_coordinates
    )

# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#----------------------------------------
# Basis Set
#----------------------------------------
basis_set = DFTBDirectory("cp2k/scc/")

#----------------------------------------
# Pair Potentials
#----------------------------------------
pair_potentials = DFTBDirectory("cp2k/scc/")

numerical_accuracy_parameters = NumericalAccuracyParameters(
    interaction_max_range=10.0*Ang,
    electron_temperature=300.0*Kelvin,
    reciprocal_energy_cutoff=1250.0*Hartree,
    number_of_reciprocal_points=1024,
    grid_mesh_cutoff=10.0*Hartree,
    radial_step_size=0.01*Ang,
    density_cutoff=1e-06,
    k_point_sampling=(1, 1, 1),
    )

iteration_control_parameters = IterationControlParameters(
    damping_factor=0.1,
    linear_dependence_threshold=0.0,
    algorithm=PulayMixer(),
    preconditioner=Preconditioner.Off,
    start_mixing_after_step=0,
    number_of_history_steps=20,
    max_steps=100,
    tolerance=0.0001,
    mixing_variable=HamiltonianVariable,
    )

poisson_solver = FastFourierSolver()

calculator = SlaterKosterCalculator(
    basis_set=basis_set,
    pair_potentials=pair_potentials,
    numerical_accuracy_parameters=numerical_accuracy_parameters,
    iteration_control_parameters=iteration_control_parameters,
    poisson_solver=poisson_solver,
    charge=0.0,
    spin_polarization=False,
    )

bulk_configuration.setCalculator(calculator)
nlprint(bulk_configuration)
bulk_configuration.update()
nlsave('bulk.nc', bulk_configuration)

bulk_configuration = OptimizeGeometry(
        bulk_configuration,
        max_forces=0.05*eV/Ang,
        max_steps=200,
        max_step_length=0.5*Ang,
        trajectory_filename=None,
        disable_stress=True,
        optimizer_method=QuasiNewton(),
        )
nlsave('opt.nc', bulk_configuration)
nlprint(bulk_configuration)
printXYZFile('dump.xyz',bulk_configuration)
# -------------------------------------------------------------
# Total energy
# -------------------------------------------------------------
total_energy = TotalEnergy(bulk_configuration)
nlsave('energy.nc', total_energy)
nlprint(total_energy)

Pages: [1]