-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinterpolate-idpp.py
executable file
·47 lines (35 loc) · 1.42 KB
/
interpolate-idpp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
from ase.neb import NEB, idpp_interpolate
#from ase.calculators.emt import EMT
#from ase.calculators.lj import LennardJones
from ase import io
from xtb.ase.calculator import XTB
def main(startFile, finalFile, outputFile, nImages=5):
# Optimise molecule.
initial = io.read(startFile)
# Create final state.
final = io.read(finalFile)
# Generate blank images.
images = [initial]
for i in range(nImages):
images.append(initial.copy())
for image in images:
#image.calc = LennardJones()
image.calc = XTB(method='GFNFF', max_iterations=1) #GFNFF, GFN0-xTB
images.append(final)
# Run IDPP interpolation.
neb = NEB(images)
#neb.interpolate(mic=True) #'idpp',
idpp_interpolate(neb, mic=True)
with open(outputFile,'w') as f:
for i,frame in enumerate(images):
frame.write(f,format='extxyz')
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='Interpolate between two structures using IDPP')
parser.add_argument('start', type=str, help='start structure')
parser.add_argument('final', type=str, help='final structure')
parser.add_argument('output', type=str, help='output structure')
parser.add_argument('--nimages', type=int, help='Number of images', default='5')
args = parser.parse_args()
main(args.start, args.final, args.output, nImages=args.nimages)