cryos / avogadro

Avogadro 1 is not under active development, the repository was archived in September 2021. Development of Avogadro 2 is being done at https://github.com/openchemistry/avogadrolibs. Avogadro is an advanced molecular editor designed for cross-platform use in computational chemistry, molecular modeling, bioinformatics, materials science, and related areas.
http://avogadro.cc/
GNU General Public License v2.0
333 stars 155 forks source link

Error running povray from avogadro #832

Open driesvr opened 8 years ago

driesvr commented 8 years ago

Hi

When trying to animate a trajectory I get the error: Could not run povray. I had the same error when using the export > povray functionality, but this was easily fixed by altering the path to /usr/local/bin/povray. Unfortunately, a similar option is not available for the animation menu. Thanks in advance,

Dries

System info: Avogadro 1.1.1 Povray 3.7 Mac OS X 10.11.5

seroot commented 7 years ago

I'm having the same problem... Did you find a solution?

driesvr commented 7 years ago

Unfortunately, I did not find a solution. I ended up using the screen recorder. Quality wasn't great, but it was useable.

wholden commented 5 years ago

I had this same issue and managed to track down your thread.

I think I found the root of the problem in the source code in /libavogadro/src/extensions/trajvideomaker.cpp

The offending line seems to be:

const QString povrayexe = "povray -D ";

In the definition of the call to run povray.

  bool TrajVideoMaker::runPovRay(QString directory, QString povFileName)
  {
    //executable for povray.  -D suppresses the popup image.
    const QString povrayexe = "povray -D ";

    QString povRayCommand = "cd " +  directory +
      " && " + povrayexe + ' ' + povFileName;
    //QMessageBox::warning( NULL, QObject::tr( "Avogadro" ), povRayCommand);
    int ret = system(povRayCommand.toStdString().c_str());
    if (ret)
      return false;
    else
      return true;
  }

I wonder if this is just hard-coded to linux. I'm trying to use it on Windows and maybe that's why it failed.

I'm not sure if I'm motivated enough to try it, but if that line was modified as follows and the program were recompiled, I bet it would work.

const QString povrayexe = "/PATH/TO/YOUR/LOCAL/INSTALL";
wholden commented 5 years ago

So because I was curious and apparently don't care about efficient use of my time, I tried a few tweaks to try to make this work and fixed the povray errors.

Note, this is a windows problem, so this is what fixed the povray issue on windows

  1. Create a windows 'bat' file named povray.bat
  2. Put the povray.bat file somewhere in one of your path locations so that the Command prompt can find it.
  3. The contents of povray.bat are as follows: @START C:\Users\USER\PATHTOEXE\bin\pvengine64.exe %2 /exit
  4. Note the use of %2, because in this case %1 will catch the "-D" flag that avogadro is trying to pass and discard it.
  5. It'll take a few tries to tell POV-Ray to stop opening all those annoying dialog boxes.
  6. POV-Ray tries to throw an error if more than one instance is open. Fix this by turning off Options->Keep Single Instance
  7. Lastly, tell POV-Ray to close on exit: Render->On Completion->Exit POV-Ray

Once you do all that, povray will do it's job successfully and create all the png files.

Then, lucky for you, you'll get an mencoder error because the same problem exists with mencoder, namely that the command is hardcoded to work on linux.

const QString mencoderexe = "mencoder -ovc lavc -lavcopts vcodec=mpeg4 -of avi -o ";

Moral of the story: run it on linux I guess.

cryos commented 5 years ago

We would like to make these things easier to run on Windows, but Linux and macOS tend to have things in the path, and so things like this slip through as that is where a lot of the developers work. Thanks for digging into this, I think we need to add some application globals where you can define the location of important executables like this.

wholden commented 5 years ago

@cryos I appreciate the quick response! Mostly posted to record the results of my own curiosity, but I appreciate knowing someone looked at it.

I think in this particular issue, Windows users are out of luck, since POV-ray doesn't support the same command line interface as on Linux, so even someone as motivated as I am still has to go through a bunch of annoying POV-ray settings to make anything work.

Maybe it'd be worth adding a description under the animation save dialog box just to say "Only works on Linux".

plelelelelelele commented 3 years ago

Hello @cryos , just a quick question wether this has been solved or implemented and i cannot find how to do it or is it not to be expected to work soon. Kind regards, ple