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:
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
Try this:
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.