Skip to content
This repository has been archived by the owner on May 20, 2022. It is now read-only.

Running without Torque #28

Closed
MAHines opened this issue Dec 4, 2016 · 5 comments
Closed

Running without Torque #28

MAHines opened this issue Dec 4, 2016 · 5 comments

Comments

@MAHines
Copy link

MAHines commented Dec 4, 2016

Thank you very much for making this available. It looks like a very worthy successor to jasp and a great complement to your book.

Like zezhong-zhang from a few days ago, I am trying to get this running, ideally in parallel, on a Mac, so I do not have Torque running a queue. I can get it to run serially by changing one line in vasprc.py:

vs = '/Users/mah/VASP/src/vaspSol.5.4.1/bin/vasp_std'
where the path is to my installation of vasp. I also added "Vasp.vasprc(mode='run')" to my script (the suggestion from your answer to zezhong-zhang).

Is there any way for me to run vasp in parallel without Torque? When I use ASE, I just put the following in runvasp.py:

#!/usr/bin/env python
import os

parallel_vasp = '/Users/mah/VASP/src/vaspSol.5.4.1/bin/vasp_std'

parcmd = 'mpirun -np 4 /Users/mah/VASP/src/vaspSol.5.4.1/bin/vasp_std >> mahVASP.out'
exitcode = os.system(parcmd)

My guess is that I am missing something very simple, so thank you for your help.

Melissa

@jkitchin
Copy link
Owner

jkitchin commented Dec 7, 2016

It looks a little trick to get vasp to run in parallel outside of the queue. Here are a few ways you could try it.

  1. You could try this with the runvasp.py script you listed above:
    VASPRC['mode'] = 'run'
    VASPRC['vasp.executable.serial'] = 'runvasp.py'

Another approach is:
2. You can set an environment variable for PBS_NODEFILE that points to a file containing 4 lines.
and VASPRC['mode'] = 'run'

  1. in vasp.py, comment out the line "import runner"
    Then set the environment variable ASE_VASP_COMMAND to runvasp.py as you outlined above.

  2. Make a new python module and import it to monkey patch the calculate function. This is what runner.py does.

from monkeypatch import monkeypatch_class
@monkeypatch_class(vasp.Vasp)
def calculate(self, atoms=None, properties=['energy'],
              system_changes=None):
    # insert code that runs your code here.

@MAHines
Copy link
Author

MAHines commented Dec 7, 2016

Thanks! The solution is indeed easy, and your reply got me off on the right track. The first step is to define the runvasp.py script in my original message. The second step is to use the runvasp.py script as the serial executable. (Duh. Sort of obvious.) For future Mac users, this is easily done by changing one line in the distributed vasprc.py:

vs = '/Users/mah/anaconda/envs/aseNew/bin/runvasp.py'

The calculator now runs the serial program that runs the parallel process.

To avoid having to add the "Vasp.vasprc(mode='run')" line to each script, the default 'mode' setting should be changed in vasprc.py as follows:

VASPRC = {'vasp.executable.serial': vs,
          'vasp.executable.parallel': vp,
          'mode': 'run',  # other value is 'queue'
          'queue.command': 'qsub',
          …

Melissa

@MAHines
Copy link
Author

MAHines commented Dec 8, 2016

Following up on this thread, I think there may be a small naming issue. Suppose you want to switch between different versions of VASP (e.g., std and gam). One logical way to do this would be to change the entry in VASPRC as follows:

Vasp.vasprc(vasp.executable.serial="/Users/mah/anaconda/envs/aseNew/bin/runvasp_gam.py")

Unfortunately, this leads to the following error:

File "Molecular_XPS_Shifts.py", line 54
    Vasp.vasprc(vasp.executable.serial="/Users/mah/anaconda/envs/aseNew/bin/runvasp_gam.py")
SyntaxError: keyword can't be an expression

The issue are the two periods in 'vasp.executable.serial' as described here:

http://stackoverflow.com/questions/17810927/syntaxerror-keyword-cant-be-an-expression-while-creating-a-dictionary

One fix would be to rename the keys to 'vasp_executable_serial' and 'vasp_executable_parallel'.

@jkitchin
Copy link
Owner

jkitchin commented Dec 8, 2016

VASPRC is a dictionary.

so you should do something like this:
from vasp.vasprc import VASPRC
VASPRC["vasp.executable.serial"]="/Users/mah/anaconda/envs/aseNew/bin/runvasp_gam.py"

vasp.vasprc is not callable like you are trying to do.

@MAHines
Copy link
Author

MAHines commented Dec 8, 2016

Thank you for your reply. I know VASPRC is a dictionary. In your reply to zezhong-zhang from a few days ago, you suggested calling Vasp.vasprc directly:

from vasp import Vasp
Vasp.vasprc(mode='run')

This is a minor issue, and your suggestion above also works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants