QChASM / SEQCROW

Plug-in for ChimeraX providing features for building and manipulating organic and organometallic molecules as well as displaying output from quantum chemistry computations.
GNU General Public License v3.0
21 stars 6 forks source link

Loading Trajectory Files #7

Closed Cdc95 closed 1 year ago

Cdc95 commented 1 year ago

Would it be possible to allow for .allxyz trajectory files to be loaded? Currently I need to change the extension to .xyz and they load perfectly fine, but it would be nice to directly load the .allxyz file as is (for book keeping purposes). Using the .allxyz extension would also allow for the coordset slider command to be automatically entered upon loading the file.

An additional request (which may take a bit more time to implement) is allowing for ORCA xyz trajectory files to be directly loaded. These are the same as all other xyz trajectory files, but each structure is separated by a line containing the character ">". So the format is: # atoms, title, coordinates, >, # atoms, title, etc...

Thanks a bunch for your time :)

ajs99778 commented 1 year ago

@Cdc95, I've added .allxyz to the dev branch (https://github.com/QChASM/SEQCROW/tree/dev). If you scroll down to the readme, there's instructions on how to install from GitHub. If the extension is .allxyz, the slider will be opened automatically. For regular .xyz files, you will have to run the coordset slider command to open the slider. I've been going back and forth on whether to open the slider by default if there's > 1 structure in the file, but this seems like a nice middle ground. The dev branch also has a completely rewritten xyz file parser, so let me know if you have any issues with it.

As for the ORCA trajectory files, they look just like regular .xyz files to me. I don't have much experience with ORCA's MD, so maybe there's some setting that causes the extra lines? If you could share a sample input file, I'll take a look at it. Here's the input file I tested with ORCA 5.0.2:

#md_test
! wB97X-D3 MD def2-SVP
%pal
    nprocs 4
end
%md
    initvel 300_K
    timestep 0.75_fs
    dump position stride 1 filename "trajectory.xyz"
    run 10
end

*xyz 0 1
C     1.154780  -0.337300   0.829580
C     0.004330  -0.145970   1.574460
C     1.420730   0.535970  -0.233390
C    -1.553030  -0.552140   0.143310
C    -1.029930   0.351450  -0.768390
O     0.052610   0.107010  -1.399500
H     1.625500  -1.323850   0.819950
H    -0.284600  -0.878870   2.333210
H    -0.359200   0.868030   1.764760
H     2.272150   0.353620  -0.894540
H     1.147720   1.588210  -0.135930
H    -1.290340  -1.602920   0.029760
H    -2.488550  -0.322870   0.658740
H    -1.409660   1.393740  -0.758240
*
Cdc95 commented 1 year ago

Thanks a bunch!

The ORCA "trajectory" format is used for their "relaxed scans" (which we use for coptimizing multiple conformers obtained from CREST using a single input file). The only difference between the standard *.allxyz files and these files is that these files include a ">" between structures as shown below.

It would be nice to have these opened the same way as the usual *.allxyz files as I wouldn't need to delete the ">" symbols each time I want to look at the structures. I am not sure if it is feasible to check if the file contains any ">" symbols, and if so, copy the contents to a new tmp file without the ">" symbols and load them as per usual.

Either way, thank you for enabling support for the *.allxyz files. It is greatly appreciated :)

3 -760.80556293 C -1.7216300599 0.8211542254 1.1762818535 H -0.8048660595 1.2004226780 1.6221037688 C -1.9763275870 1.4485571792 -0.1807508162

3 -760.80555997 C -1.6430447061 0.7056293155 1.3426416735 H -0.6961370592 1.0442545612 1.7569965366 C -1.9932775641 1.4616663960 0.0754038938

ajs99778 commented 1 year ago

Ok, I see. - a constrained optimization with ORCA will have ">" between each structure in the .allxyz file. I've changed to xyz/allxyz parser to skip one line if there is a ">" instead of the number of atoms.

I've also changed the ORCA output file parser to only load converged structures for coordinate scans. If you're only scanning one coordinate, this should clean up the energy plot. Here's the plot from my test scan, which before had over 100 points:

Screenshot 2023-01-03 153014

Cdc95 commented 1 year ago

Thanks for all the help!

ajs99778 commented 1 year ago

this was added in the 1.5.11 release