QuantumWise Forum
May 25, 2013, 06:57 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: dump trajectory as XYZ file (atk newbie question)  (Read 323 times)
0 Members and 1 Guest are viewing this topic.
jrussell
Regular ATK user
**

Reputation: 1
Offline Offline

United States United States

Posts: 10


View Profile
« on: May 29, 2012, 03:59 »

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
Logged
Anders Blom
QuantumWise Staff
Supreme ATK Wizard
*****

Reputation: 36
Offline Offline

Denmark Denmark

Posts: 2820



View Profile WWW
« Reply #1 on: May 29, 2012, 09:54 »

Try this:

Code: (python)
trajectory = nlread('trajectory.nc')[0]

for ix,image in enumerate(trajectory.images()):
    elements = image.elements()
    print len(elements)
    print 'Image %i' % ix
    for elem,coords in zip(elements,image.cartesianCoordinates()):
        print elem.symbol(),
        for i in coords:
            print i.inUnitsOf(Angstrom),
        print


and pipe the output to an XYZ file. There is some confusion, I think, in the world about how to properly separate two configurations in a multi-configuration XYZ file, viz. if there should be an extra blank line between them or not, but the format produced by the above code is acceptable to JMol at least.

In principle you can use nlprint for each image, but it also prints the fractional coordinates, so you would have to clean up the file quite a bit afterwards.
Logged
jrussell
Regular ATK user
**

Reputation: 1
Offline Offline

United States United States

Posts: 10


View Profile
« Reply #2 on: May 29, 2012, 20:05 »

That worked like a charm. Thanks Anders!
Best,
John
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2006-2008, Simple Machines Valid XHTML 1.0! Valid CSS!