New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to compute torsion value #858

Open
ChayaSt opened this Issue Nov 13, 2017 · 12 comments

Comments

Projects
None yet
4 participants
@ChayaSt

ChayaSt commented Nov 13, 2017

I was running a constrained geometry optimization but the optimizer failed with this error:

Back-transformation to cartesian coordinates...
	The INTCO_EXCEPTion handler:
	TORS::compute_val: unable to compute torsion value
	Dynamic level is 0.
	exc.g_really_quit() is 0.

  **** Optimization has failed! (in 3 steps) ****

Here's the input file and the output file

I ran it again with dynamic_level = 1 but this time I got the following error:

Error occurred in file: /scratch/psilocaluser/conda-builds/psi4_1495011512596/work/psi4/src/psi4/libpsio/error.cc on line: 129
The most recent 5 function calls were:

psi::PsiException::PsiException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*, int)
psi::psio_error(unsigned int, unsigned int)
psi::PSIO::write(unsigned int, char const*, char*, unsigned long, psi::psio_address, psi::psio_address*)
psi::PSIO::write_entry(unsigned int, char const*, char*, unsigned long)
                                                                                                                      7447,46       99%
@loriab

This comment has been minimized.

Show comment
Hide comment
@loriab

loriab Nov 13, 2017

Member

We do hit these errors sometimes. Some special cases have been fixed this year. What version of the code are you running, psi4 --version?

It's failing on the backtransformation in the second opt iter. Dihedrals are near 180 to start but no angles are. If up-to-date, any suggestions, @psi-rking ?

Member

loriab commented Nov 13, 2017

We do hit these errors sometimes. Some special cases have been fixed this year. What version of the code are you running, psi4 --version?

It's failing on the backtransformation in the second opt iter. Dihedrals are near 180 to start but no angles are. If up-to-date, any suggestions, @psi-rking ?

@ChayaSt

This comment has been minimized.

Show comment
Hide comment
@ChayaSt

ChayaSt Nov 13, 2017

I'm using the latest version according to conda update psi4. Is there a dev version for me to use?

ChayaSt commented Nov 13, 2017

I'm using the latest version according to conda update psi4. Is there a dev version for me to use?

@psi-rking

This comment has been minimized.

Show comment
Hide comment
@psi-rking

psi-rking Nov 13, 2017

Contributor

At the bottom of the output, after 3 steps, many of the torsions are very close to 180. Is the structure exactly planar? I'm not surprised if you are not able to converge this tightly. You could try Cartesian coordinates to avoid all these discontinuities (not just in the value of the torsion, but in its derivative too).

 D(7,11,6,18)     =        -3.129372	    -179.299795
 D(8,6,11,10)     =        -3.133590	    -179.541496
 D(8,12,9,21)     =         3.130680	     179.374777
 D(9,7,11,10)     =         3.130802	     179.381713
 D(9,12,8,20)     =         3.137161	     179.746078
 D(10,4,2,14)     =        -3.130400	    -179.358722
Contributor

psi-rking commented Nov 13, 2017

At the bottom of the output, after 3 steps, many of the torsions are very close to 180. Is the structure exactly planar? I'm not surprised if you are not able to converge this tightly. You could try Cartesian coordinates to avoid all these discontinuities (not just in the value of the torsion, but in its derivative too).

 D(7,11,6,18)     =        -3.129372	    -179.299795
 D(8,6,11,10)     =        -3.133590	    -179.541496
 D(8,12,9,21)     =         3.130680	     179.374777
 D(9,7,11,10)     =         3.130802	     179.381713
 D(9,12,8,20)     =         3.137161	     179.746078
 D(10,4,2,14)     =        -3.130400	    -179.358722
@ChayaSt

This comment has been minimized.

Show comment
Hide comment
@ChayaSt

ChayaSt Nov 13, 2017

Yes, this is a planer structure. Should I set opt_coordinates = cartesian? Will that worked with a fixed_dihedral?

ChayaSt commented Nov 13, 2017

Yes, this is a planer structure. Should I set opt_coordinates = cartesian? Will that worked with a fixed_dihedral?

@psi-rking

This comment has been minimized.

Show comment
Hide comment
@psi-rking

psi-rking Nov 13, 2017

Contributor
Contributor

psi-rking commented Nov 13, 2017

@ChayaSt

This comment has been minimized.

Show comment
Hide comment
@ChayaSt

ChayaSt Nov 14, 2017

I tried running it again with opt_coordinates = cartesian with a restrained dihedral and dynamic_level = 1. However, it crashed again, this time when it raises dynamic level to 3 it crashed when it tries to write the optimization data to binary file. Here's the traceback:

	Writing optimization data to binary file.
	
Fatal Error: PSIO Error
Error occurred in file: /scratch/psilocaluser/conda-builds/psi4_1495011512596/work/psi4/src/psi4/libpsio/error.cc on line: 129
The most recent 5 function calls were:

psi::PsiException::PsiException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*, int)
psi::psio_error(unsigned int, unsigned int)
psi::PSIO::write(unsigned int, char const*, char*, unsigned long, psi::psio_address, psi::psio_address*)
psi::PSIO::write_entry(unsigned int, char const*, char*, unsigned long)
psi::psio_write_entry(unsigned int, char const*, char*, unsigned long)

Also, it still seems to be using internal coordinates (unless I'm not understanding the output file).
Here is the new input and output

ChayaSt commented Nov 14, 2017

I tried running it again with opt_coordinates = cartesian with a restrained dihedral and dynamic_level = 1. However, it crashed again, this time when it raises dynamic level to 3 it crashed when it tries to write the optimization data to binary file. Here's the traceback:

	Writing optimization data to binary file.
	
Fatal Error: PSIO Error
Error occurred in file: /scratch/psilocaluser/conda-builds/psi4_1495011512596/work/psi4/src/psi4/libpsio/error.cc on line: 129
The most recent 5 function calls were:

psi::PsiException::PsiException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*, int)
psi::psio_error(unsigned int, unsigned int)
psi::PSIO::write(unsigned int, char const*, char*, unsigned long, psi::psio_address, psi::psio_address*)
psi::PSIO::write_entry(unsigned int, char const*, char*, unsigned long)
psi::psio_write_entry(unsigned int, char const*, char*, unsigned long)

Also, it still seems to be using internal coordinates (unless I'm not understanding the output file).
Here is the new input and output

@psi-rking

This comment has been minimized.

Show comment
Hide comment
@psi-rking

psi-rking Nov 15, 2017

Contributor
Contributor

psi-rking commented Nov 15, 2017

@ChayaSt

This comment has been minimized.

Show comment
Hide comment
@ChayaSt

ChayaSt Nov 15, 2017

I tried freezing the cartesian coordinates of the dihedral atoms and it seems to work. The optimization converged within 10 iterations. I also used consecutive_backsteps = 2. However, since the bonds and angles can't relax, the energy of the converged structure is higher. I'll try your approach of first optimizing with a lower level of theory.

frozen_string = """
4 xyz
10 xyz
11 xyz
6 xyz
"""
set optking { opt_coordinates = cartesian
              frozen_cartesian = $frozen_string
              consecutive_backsteps = 2
              geom_maxiter = 250
              print_trajectory_xyz_file = True }

optimize('MP2/aug-cc-PVTZ')

ChayaSt commented Nov 15, 2017

I tried freezing the cartesian coordinates of the dihedral atoms and it seems to work. The optimization converged within 10 iterations. I also used consecutive_backsteps = 2. However, since the bonds and angles can't relax, the energy of the converged structure is higher. I'll try your approach of first optimizing with a lower level of theory.

frozen_string = """
4 xyz
10 xyz
11 xyz
6 xyz
"""
set optking { opt_coordinates = cartesian
              frozen_cartesian = $frozen_string
              consecutive_backsteps = 2
              geom_maxiter = 250
              print_trajectory_xyz_file = True }

optimize('MP2/aug-cc-PVTZ')
@jchodera

This comment has been minimized.

Show comment
Hide comment
@jchodera

jchodera Nov 15, 2017

@psi-rking : Can you elaborate on what the fundamental issue here is? Is it that the internal-to-cartesian coordinate conversion is numerically unstable? Or that there is some other weird saddle point that the minimization converges to instead? If you could point us to the code that needs to be made more robust, we can take a stab at it, but if there's fundamentally no way to converge these kinds of calculations, that would be helpful to know.

Also, isn't this second error unrelated?

Error occurred in file: /scratch/psilocaluser/conda-builds/psi4_1495011512596/work/psi4/src/psi4/libpsio/error.cc on line: 129
The most recent 5 function calls were:

psi::PsiException::PsiException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*, int)
psi::psio_error(unsigned int, unsigned int)
psi::PSIO::write(unsigned int, char const*, char*, unsigned long, psi::psio_address, psi::psio_address*)
psi::PSIO::write_entry(unsigned int, char const*, char*, unsigned long)

This seems to be an error in writing rather than an error in the constrained optimization, isn't it?

jchodera commented Nov 15, 2017

@psi-rking : Can you elaborate on what the fundamental issue here is? Is it that the internal-to-cartesian coordinate conversion is numerically unstable? Or that there is some other weird saddle point that the minimization converges to instead? If you could point us to the code that needs to be made more robust, we can take a stab at it, but if there's fundamentally no way to converge these kinds of calculations, that would be helpful to know.

Also, isn't this second error unrelated?

Error occurred in file: /scratch/psilocaluser/conda-builds/psi4_1495011512596/work/psi4/src/psi4/libpsio/error.cc on line: 129
The most recent 5 function calls were:

psi::PsiException::PsiException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char const*, int)
psi::psio_error(unsigned int, unsigned int)
psi::PSIO::write(unsigned int, char const*, char*, unsigned long, psi::psio_address, psi::psio_address*)
psi::PSIO::write_entry(unsigned int, char const*, char*, unsigned long)

This seems to be an error in writing rather than an error in the constrained optimization, isn't it?

@ChayaSt

This comment has been minimized.

Show comment
Hide comment
@ChayaSt

ChayaSt Nov 15, 2017

This seems to be an error in writing rather than an error in the constrained optimization, isn't it?

This error shows up when dynamic level is raised to 3 after the first convergence check when it tries to write optimization data to binary file.

ChayaSt commented Nov 15, 2017

This seems to be an error in writing rather than an error in the constrained optimization, isn't it?

This error shows up when dynamic level is raised to 3 after the first convergence check when it tries to write optimization data to binary file.

@psi-rking

This comment has been minimized.

Show comment
Hide comment
@psi-rking

psi-rking Nov 16, 2017

Contributor
Contributor

psi-rking commented Nov 16, 2017

@ChayaSt

This comment has been minimized.

Show comment
Hide comment
@ChayaSt

ChayaSt Nov 17, 2017

When setting dynamic_level = 3 with the same input script initially posted here (where frozen dihedral was used) the geometry converged after 12 iterations with dynamic level 3 and 3 iterations at dynamic level 4.

ChayaSt commented Nov 17, 2017

When setting dynamic_level = 3 with the same input script initially posted here (where frozen dihedral was used) the geometry converged after 12 iterations with dynamic level 3 and 3 iterations at dynamic level 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment