コード例 #1
0
def optimize_lammpslib(struc,
                       lmp,
                       parameters=None,
                       path='tmp',
                       calc_type=None,
                       lmp_file=None,
                       molecule=False,
                       strain=np.ones([3, 3]),
                       method='FIRE',
                       fmax=0.01):

    if lmp_file is not None:
        lammps = LAMMPSlib(lmp=lmp, lmp_file=lmp_file, log_file='lammps.log', \
                           molecule=molecule, path=path)
    elif calc_type is not None:
        lammps = LAMMPSlib(lmp=lmp, lmpcmds=parameters, calc_type=calc_type, \
                           log_file='lammps.log', molecule=molecule, path=path)
    else:
        lammps = LAMMPSlib(lmp=lmp, lmpcmds=parameters, log_file='lammps.log', \
                           molecule=molecule, path=path)

    struc.set_calculator(lammps)
    box = mushybox(struc, fixstrain=strain)
    if method == 'FIRE':
        dyn = FIRE(box)
    else:
        dyn = LBFGS(box)
    dyn.run(fmax=fmax, steps=500)
    return struc
コード例 #2
0
def optimize_lammpslib(pbcgb, lmp, parameters, path, method='FIRE', fmax=0.1):
    lammps = LAMMPSlib(lmp=lmp,
                       lmpcmds=parameters,
                       log_file='lammps.log',
                       path=path)
    pbcgb.set_calculator(lammps)
    cell0 = pbcgb.cell
    fixstrain = np.zeros((3, 3))
    fixstrain[2][2] = 1
    box = mushybox(pbcgb, fixstrain=fixstrain)
    if method == 'FIRE':
        dyn = FIRE(box)
    else:
        dyn = BFGS(box)
    dyn.run(fmax=fmax, steps=500)
    return pbcgb
コード例 #3
0
def test_utilities():
    eps = 1e-5

    atoms = Icosahedron('Cu', 3)
    atoms.numbers[[0, 13, 15, 16, 18, 19, 21, 22, 24, 25, 27, 28, 30]] = 79
    atoms.center(vacuum=0.0)
    atoms.calc = EMT()
    with FIRE(atoms, logfile=None) as opt:
        opt.run(fmax=0.05)

    rmax = 8.
    nbins = 5
    rdf, dists = get_rdf(atoms, rmax, nbins)
    calc_dists = np.arange(rmax / (2 * nbins), rmax, rmax / nbins)
    assert all(abs(dists - calc_dists) < eps)
    calc_rdf = [0., 0.84408157, 0.398689, 0.23748934, 0.15398546]
    assert all(abs(rdf - calc_rdf) < eps)

    dm = atoms.get_all_distances()
    s = np.zeros(5)
    for c in [(29, 29), (29, 79), (79, 29), (79, 79)]:
        inv_norm = len(np.where(atoms.numbers == c[0])[0]) / len(atoms)
        s += get_rdf(atoms, rmax, nbins, elements=c,
                     distance_matrix=dm, no_dists=True) * inv_norm
    assert all(abs(s - calc_rdf) < eps)

    AuAu = get_rdf(atoms, rmax, nbins, elements=(79, 79),
                   distance_matrix=dm, no_dists=True)
    assert all(abs(AuAu[-2:] - [0.12126445, 0.]) < eps)

    bulk = L1_2(['Au', 'Cu'], size=(3, 3, 3), latticeconstant=2 * np.sqrt(2))
    rdf = get_rdf(bulk, 4.2, 5)[0]
    calc_rdf = [0., 0., 1.43905094, 0.36948605, 1.34468694]
    assert all(abs(rdf - calc_rdf) < eps)
コード例 #4
0
ファイル: lammpslib.py プロジェクト: zhenhai-wang/PyXtal
def opt_lammpslib(struc,
                  lmp,
                  parameters=None,
                  mask=None,
                  logfile='-',
                  path='tmp',
                  calc_type=None,
                  lmp_file=None,
                  molecule=False,
                  method='FIRE',
                  fmax=0.01,
                  opt_cell=False,
                  a=0.1,
                  steps=500):
    """
    mask: [1, 1, 1, 1, 1, 1], a, b, c, alpha, beta, gamma
          [1, 1, 0, 0, 0, 1]
    """

    if lmp_file is not None:
        lammps = LAMMPSlib(lmp=lmp, lmp_file=lmp_file, log_file='lammps.log', \
                           molecule=molecule, path=path)
    elif calc_type is not None:
        lammps = LAMMPSlib(lmp=lmp, lmpcmds=parameters, calc_type=calc_type, \
                           log_file='lammps.log', molecule=molecule, path=path)
    else:
        lammps = LAMMPSlib(lmp=lmp, lmpcmds=parameters, log_file='lammps.log', \
                           molecule=molecule, path=path)

    #check_symmetry(si, 1.0e-6, verbose=True)
    struc.set_calculator(lammps)
    struc.set_constraint(FixSymmetry(struc))
    if opt_cell:
        ecf = ExpCellFilter(struc, mask)
        if method == 'FIRE':
            dyn = FIRE(ecf, logfile=logfile, a=a)
        else:
            dyn = LBFGS(ecf, logfile=logfile)
    else:
        if method == 'FIRE':
            dyn = FIRE(struc, logfile=logfile)
        else:
            dyn = LBFGS(struc, logfile=logfile)
    dyn.run(fmax=fmax, steps=steps)
    return struc
コード例 #5
0
def optimize(atoms,
             sym=True,
             box=False,
             method='FIRE',
             fmax=0.01,
             steps=1000,
             logfile='ase.log'):
    if sym:
        atoms.set_constraint(FixSymmetry(atoms))
    if box:
        ecf = ExpCellFilter(atoms)
        if method == 'FIRE':
            dyn = FIRE(ecf, logfile=logfile)
        else:
            dyn = LBFGS(ecf, logfile=logfile)
    else:
        if method == 'FIRE':
            dyn = FIRE(atoms, logfile=logfile)
        else:
            dyn = FIRE(atoms, logfile=logfile)

    dyn.run(fmax=fmax, steps=steps)
    atoms.set_constraint()
    return atoms
コード例 #6
0
def test_ethene_rotation(tmpdir):

    tmpdir.chdir()

    # Optimise molecule
    initial = molecule('C2H6')
    smart_cell(initial, vac=4.0, h=0.01)
    initial.set_calculator(iEspresso(pw=300, dw=4000, kpts='gamma'))
    qn = QuasiNewton(initial, 'initial.traj')
    qn.run(fmax=0.01)

    # Create final state
    final = initial.copy()
    final.positions[2:5] = initial.positions[[3, 4, 2]]
    final.set_calculator(iEspresso(pw=300, dw=4000, kpts='gamma'))
    final.get_potential_energy()

    # Generate blank images
    images = [initial]
    nimage = 7

    for i in range(nimage):
        image = initial.copy()
        image.set_calculator(iEspresso(pw=300, dw=4000, kpts='gamma'))
        images.append(image)
    images.append(final)

    # Run IDPP interpolation
    neb = NEBEspresso(images)
    neb.interpolate('idpp')

    # Run NEB calculation
    qn = QuasiNewton(neb, logfile='ethane_linear.log', trajectory='neb.traj')
    qn.run(fmax=0.05)

    nt = NEBTools(neb.images)
    print('fmax: ', nt.get_fmax())
    print('Ef, dE: ', nt.get_barrier())
コード例 #7
0
from ase.optimize.fire import FIRE as QuasiNewton
from ase.io import read

# Read the previous configurations
initial = read('N2.traj')
final = read('2N.traj')

#  Make 9 images (note the use of copy)
configs = [initial.copy() for i in range(8)] + [final]

# As before, fix the Cu atoms
constraint = FixAtoms(mask=[atom.symbol != 'N' for atom in initial])
for config in configs:
    config.calc = EMT()
    config.set_constraint(constraint)

# Make the NEB object, interpolate to guess the intermediate steps
band = NEB(configs)
band.interpolate()

relax = QuasiNewton(band)

# Do the calculation
relax.run()

# Compare intermediate steps to initial energy
e0 = initial.get_potential_energy()
for config in configs:
    d = config[-2].position - config[-1].position
    print(np.linalg.norm(d), config.get_potential_energy() - e0)
コード例 #8
0
write('initial.traj', initial)

# Create final state
final = initial.copy()
final.positions[2:5] = initial.positions[[3, 4, 2]]
write('final.traj', final)

# Generate blank images
images = [initial]
nimage = 7

for i in range(nimage):
    images.append(initial.copy())

images.append(final)

# Run IDPP interpolation
neb = NEB(images)
neb.interpolate()

calcs = NEBEspresso(neb, kpts='gamma', pw=300, dw=4000)

# Run NEB calculation
qn = QuasiNewton(neb, logfile='ethane_linear.log')

for j in range(nimage):
    traj = Trajectory('neb%d.traj' % j, 'w', images[j + 1])
    qn.attach(traj)

qn.run(fmax=0.05)
コード例 #9
0
        sg = randint(2, 230)
        crystal = molecular_crystal(sg, ['H2O'], [randint(1, 4)],
                                    1.0)  #, lattice=para)
        if crystal.valid:
            struc = Atoms(
                crystal.spg_struct[2],
                cell=crystal.spg_struct[0],
                scaled_positions=crystal.spg_struct[1],
            )
            break
    #struc = struc.repeat((2,2,2))
    lammps = LAMMPSlib(lmp=lmp, lmpcmds=parameters, mol=True)
    struc.set_calculator(lammps)
    box = mushybox(struc)

    dyn = FIRE(box)
    dyn.run(fmax=0.00, steps=1100)

    #dyn = BFGS(box)
    #dyn.run(fmax=0.01, steps=200)

    #dyn = BFGS(box)
    #dyn.run(fmax=0.01, steps=200)
    Eng = struc.get_potential_energy() * 96 / len(struc) * 3
    Vol = struc.get_volume() / len(struc) * 3
    stress = np.max(struc.get_stress())
    struc = sort(struc)
    try:
        spg = get_symmetry_dataset(struc, symprec=1e-1)['number']
    except:
        spg = 1
コード例 #10
0
final.positions[2:5] = initial.positions[[3, 4, 2]]
# Generate blank images.
images = [initial]
for i in range(9):
    images.append(initial.copy())
for image in images:
    image.calc = EMT()
images.append(final)

neb = NEB(images, climb=True)
neb.interpolate(method='idpp')  #idpp插值,设置初猜

# set calculator
for atoms in images:
    atoms.calc = EMT()
    atoms.get_potential_energy()

# Optimize:
py_fname = os.path.splitext(sys.argv[0])[0]
traj_fname = "{}.traj".format(py_fname)
log_fname = "{}.log".format(py_fname)
optimizer = FIRE(neb, trajectory=traj_fname, logfile=log_fname)
optimizer.run(fmax=0.04)

neb_result = list(iread(traj_fname))
for i in neb_result:
    #print(i.get_potential_energy())
    pass
neb_result = NEBTools(neb_result)
neb_result.plot_bands(True, True, label=py_fname)
print(neb_result.get_barrier(), neb_result.get_fmax())
コード例 #11
0
from ann import ATOMModel, Ann
from ase.io import read
from ase.optimize.fire import FIRE

p1 = read('au55.xyz', index=0, format='xyz')
model = ATOMModel(restore='atom_model', n=55)
p1.set_calculator(Ann(atoms=p1, ann_model=model))
opt = FIRE(atoms=p1,
           maxmove=1.0,
           dt=0.2,
           dtmax=1.0,
           logfile='geo_opt.dat',
           trajectory='geo_opt.traj')
opt.run(fmax=0.05, steps=1000)
コード例 #12
0
from ase.build import molecule
from ase.neb import NEB
from ase.calculators.emt import EMT
from ase.optimize.fire import FIRE as QuasiNewton

# Optimise molecule.
initial = molecule('C2H6')
initial.calc = EMT()
relax = QuasiNewton(initial)
relax.run(fmax=0.05)

# Create final state.
final = initial.copy()
final.positions[2:5] = initial.positions[[3, 4, 2]]

# Generate blank images.
images = [initial]

for i in range(9):
    images.append(initial.copy())

for image in images:
    image.calc = EMT()
   
images.append(final)

# Run IDPP interpolation.
neb = NEB(images)
neb.interpolate('idpp')

# Run NEB calculation.
コード例 #13
0
ファイル: run_neb.py プロジェクト: cationly/QUIP
        at.set_calculator(SubdirCalculator(quip_pot, opt.chdir, opt.calc_args))

if rank == 0:
    print 'Starting NEB run with %d images' % len(neb.images)
    if not os.path.exists('%s-initial.xyz' % basename):
        neb.write('%s-initial.xyz' % basename)

if opt.eval:
    # actually evaluate end forces as well
    neb.get_forces(all=True)
    neb.write('%s-eval.xyz' % basename)
elif not opt.dry_run:
    # Optimize:
    if opt.optimizer == 'FIRE':
        from ase.optimize.fire import FIRE
        optimizer = FIRE(neb)
    elif opt.optimizer == 'MDMin':
        from ase.optimize import MDMin
        optimizer = MDMin(neb)
    else:
        p.error('Unknown optimizer %s' % opt.optimizer)

    if opt.write_traj is not None:

        def write_traj():
            global neb
            n = 0
            while os.path.exists('%s-band-%d.xyz' % (basename, n)):
                n += 1
            neb.write('%s-band-%d.xyz' % (basename, n))
コード例 #14
0
ファイル: cell_opt.py プロジェクト: HaoLiSky/TSASE
                    'J': 0
                },
                'Ir': {
                    'L': 2,
                    'U': 3.75,
                    'J': 1.0
                },
                'O': {
                    'L': -1,
                    'U': 0,
                    'J': 0
                }
            },
            lmaxmix=4)
p1.set_calculator(calc)

pstress = p1.get_cell() * 0.0
pstress[2][0] = 3.0

p1box = mushybox(p1, express=pstress)

# for ase.3.15 and later
dyn = FIRE(p1box, maxmove=0.1, dt=0.1, dtmax=0.1, force_consistent=False)
#dyn = MDMin(p1box, dt=0.1, force_consistent = False)
# for ase.3.12 and earlier
#dyn = FIRE(p1box,maxmove = 0.1, dt = 0.1, dtmax = 0.1)
#dyn = MDMin(p1box, dt=0.1)
dyn.run(fmax=0.01, steps=100)

write("CONTCAR", p, format='vasp')
コード例 #15
0
from ase.build import molecule
from ase.neb import NEB
from ase.calculators.emt import EMT
from ase.optimize.fire import FIRE

# Optimise molecule
initial = molecule('C2H6')
initial.set_calculator(EMT())
relax = FIRE(initial)
relax.run(fmax=0.05)

# Create final state
final = initial.copy()
final.positions[2:5] = initial.positions[[3, 4, 2]]

# Generate blank images
images = [initial]

for i in range(9):
    images.append(initial.copy())

images.append(final)

for image in images:
    image.set_calculator(EMT())

# Run IDPP interpolation
neb = NEB(images)
neb.interpolate('idpp')

# Run NEB calculation
コード例 #16
0
 def __init__(self, atoms, maxmove=None, trustradius=0.2, **kwargs):
     maxmove = maxmove or trustradius / 10
     FIRE.__init__(self, atoms, maxmove=maxmove, **kwargs)
     self.trustradius = trustradius
     # Reference for the trustradius
     self.start_geo = atoms.get_positions()
コード例 #17
0
from ase.optimize.fire import FIRE as QuasiNewton
from ase.io import read

# Read the previous configurations
initial = read('N2.traj')
final = read('2N.traj')

#  Make 9 images (note the use of copy)
configs = [initial.copy() for i in range(8)] + [final]

# As before, fix the Cu atoms
constraint = FixAtoms(mask=[atom.symbol != 'N' for atom in initial])
for config in configs:
    config.set_calculator(EMT())
    config.set_constraint(constraint)

# Make the NEB object, interpolate to guess the intermediate steps
band = NEB(configs)
band.interpolate()

relax = QuasiNewton(band)

# Do the calculation
relax.run()

# Compare intermediate steps to initial energy
e0 = initial.get_potential_energy()
for config in configs:
    d = config[-2].position - config[-1].position
    print(np.linalg.norm(d), config.get_potential_energy() - e0)
コード例 #18
0
ファイル: utilities.py プロジェクト: rchiechi/QuantumParse
from __future__ import division
import numpy as np

from ase.cluster import Icosahedron
from ase.calculators.emt import EMT
from ase.optimize.fire import FIRE
from ase.lattice.compounds import L1_2

from ase.ga.utilities import get_rdf

eps = 1e-5

atoms = Icosahedron('Cu', 3)
atoms.numbers[[0, 13, 15, 16, 18, 19, 21, 22, 24, 25, 27, 28, 30]] = 79
atoms.set_calculator(EMT())
opt = FIRE(atoms, logfile=None)
opt.run(fmax=0.05)

rmax = 8.
nbins = 5
rdf, dists = get_rdf(atoms, rmax, nbins)
calc_dists = np.arange(rmax / (2 * nbins), rmax, rmax / nbins)
assert all(abs(dists - calc_dists) < eps)
calc_rdf = [0., 0.84408157, 0.398689, 0.23748934, 0.15398546]
assert all(abs(rdf - calc_rdf) < eps)

dm = atoms.get_all_distances()
s = np.zeros(5)
for c in [(29, 29), (29, 79), (79, 29), (79, 79)]:
    inv_norm = len(np.where(atoms.numbers == c[0])[0]) / len(atoms)
    s += get_rdf(atoms, rmax, nbins, elements=c,
コード例 #19
0
s = a0.get_scaled_positions()
s[:, 0] *= 0.995
a0.set_scaled_positions(s)

# perturb the cell
a0.cell[...] += np.random.uniform(-1e-2, 1e-2, size=9).reshape((3, 3))

atoms = a0.copy()
atoms.set_calculator(LennardJones())
ucf = UnitCellFilter(atoms, scalar_pressure=10.0 * GPa)

# test all deritatives
f, fn = gradient_test(ucf)
assert abs(f - fn).max() < 1e-6

opt = FIRE(ucf)
opt.run(1e-3)

# check pressure is within 0.1 GPa of target
sigma = atoms.get_stress() / GPa
pressure = -(sigma[0] + sigma[1] + sigma[2]) / 3.0
assert abs(pressure - 10.0) < 0.1

atoms = a0.copy()
atoms.set_calculator(LennardJones())
ecf = ExpCellFilter(atoms, scalar_pressure=10.0 * GPa)

# test all deritatives
f, fn = gradient_test(ecf)
assert abs(f - fn).max() < 1e-6
コード例 #20
0
for i in range(100):
    while True:
        sg = randint(16, 191)
        crystal = molecular_crystal(sg, ['H2O'], [4], 1.0)  #, lattice=para)
        if crystal.valid:
            struc = Atoms(
                crystal.spg_struct[2],
                cell=crystal.spg_struct[0],
                scaled_positions=crystal.spg_struct[1],
            )
            break
    #struc = struc.repeat((2,2,2))
    lammps = LAMMPSlib(lmp=lmp, lmpcmds=parameters, mol=True)
    struc.set_calculator(lammps)
    box = mushybox(struc)
    dyn = FIRE(box)
    dyn.run(fmax=0.01, steps=200)
    dyn = BFGS(box)
    dyn.run(fmax=0.01, steps=200)
    Eng = struc.get_potential_energy() * 96 / len(struc) * 3
    Vol = struc.get_volume() / len(struc) * 3
    stress = np.max(struc.get_stress())
    struc = sort(struc)
    try:
        spg = get_symmetry_dataset(struc, symprec=1e-1)['number']
    except:
        spg = 1
    struc.write(out_folder + '/' + str(i) + ".vasp", format='vasp', vasp5=True)
    logging.info(
        '{:4d} Spg: {:4d} Eng: {:8.4f} Vol: {:8.4f} Stress: {:5.2f}'.format(
            i, spg, Eng, Vol, stress))
コード例 #21
0
ファイル: N2Ru-Dissociation2.py プロジェクト: PHOTOX/fuase
import numpy as np

from ase.io import read
from ase.constraints import FixAtoms
from ase.calculators.emt import EMT
from ase.neb import NEB
from ase.optimize.fire import FIRE as QuasiNewton

initial = read('N2.traj')
final = read('2N.traj')

configs = [initial.copy() for i in range(8)] + [final]

constraint = FixAtoms(mask=[atom.symbol != 'N' for atom in initial])
for config in configs:
    config.set_calculator(EMT())
    config.set_constraint(constraint)
    
band = NEB(configs)
band.interpolate()

# Create a quickmin object:
relax = QuasiNewton(band)

relax.run(steps=20)

e0 = initial.get_potential_energy()
for config in configs:
    d = config[-2].position - config[-1].position
    print np.linalg.norm(d), config.get_potential_energy() - e0
コード例 #22
0
from ase.build import molecule
from ase.neb import NEB
from ase.calculators.emt import EMT
from ase.optimize.fire import FIRE
from mlpot.mlneb import run_mla_neb
from mlpot.calculators.gprcalculator import GPRCalculator
from mlpot.kernels import RBFKernel

# Optimise molecule
initial = molecule('C2H6')
initial.set_calculator(EMT())
relax = FIRE(initial)
relax.run(fmax=0.05)

# Create final state
final = initial.copy()
final.positions[2:5] = initial.positions[[3, 4, 2]]

# Generate blank images
images = [initial]

for i in range(9):
    images.append(initial.copy())

images.append(final)

for image in images:
    image.set_calculator(EMT())

# Run IDPP interpolation
neb = NEB(images)
コード例 #23
0
from __future__ import division
import numpy as np

from ase.cluster import Icosahedron
from ase.calculators.emt import EMT
from ase.optimize.fire import FIRE
from ase.lattice.compounds import L1_2

from ase.ga.utilities import get_rdf

eps = 1e-5

atoms = Icosahedron('Cu', 3)
atoms.numbers[[0, 13, 15, 16, 18, 19, 21, 22, 24, 25, 27, 28, 30]] = 79
atoms.set_calculator(EMT())
opt = FIRE(atoms, logfile=None)
opt.run(fmax=0.05)

rmax = 8.
nbins = 5
rdf, dists = get_rdf(atoms, rmax, nbins)
calc_dists = np.arange(rmax / (2 * nbins), rmax, rmax / nbins)
assert all(abs(dists - calc_dists) < eps)
calc_rdf = [0., 0.84408157, 0.398689, 0.23748934, 0.15398546]
assert all(abs(rdf - calc_rdf) < eps)

dm = atoms.get_all_distances()
s = np.zeros(5)
for c in [(29, 29), (29, 79), (79, 29), (79, 79)]:
    inv_norm = len(np.where(atoms.numbers == c[0])[0]) / len(atoms)
    s += get_rdf(
コード例 #24
0
ファイル: idpp1.py プロジェクト: jboes/ase
from ase.structure import molecule
from ase.neb import NEB
from ase.calculators.emt import EMT
from ase.optimize.fire import FIRE as QuasiNewton
from ase.visualize import view

#Optimise molecule
initial = molecule('C2H6')
initial.set_calculator(EMT())
relax = QuasiNewton(initial)
relax.run(fmax=0.05)
view(initial)

#Create final state
final = initial.copy()
final.positions[2:5] = initial.positions[[3, 4, 2]]

#Generate blank images
images = [initial]

for i in range(9):
    images.append(initial.copy())

for image in images:
    image.set_calculator(EMT())
   
images.append(final)

#Run IDPP interpolation
neb = NEB(images)
neb.interpolate()
コード例 #25
0
ファイル: N2Ru-Dissociation2.py プロジェクト: fuulish/fuase
import numpy as np

from ase.io import read
from ase.constraints import FixAtoms
from ase.calculators.emt import EMT
from ase.neb import NEB
from ase.optimize.fire import FIRE as QuasiNewton

initial = read('N2.traj')
final = read('2N.traj')

configs = [initial.copy() for i in range(8)] + [final]

constraint = FixAtoms(mask=[atom.symbol != 'N' for atom in initial])
for config in configs:
    config.set_calculator(EMT())
    config.set_constraint(constraint)

band = NEB(configs)
band.interpolate()

# Create a quickmin object:
relax = QuasiNewton(band)

relax.run(steps=20)

e0 = initial.get_potential_energy()
for config in configs:
    d = config[-2].position - config[-1].position
    print np.linalg.norm(d), config.get_potential_energy() - e0
コード例 #26
0
#print(mol.get_chemical_symbols())

# Set NC
aens = ensemblemolecule(cnstfile, saefile, nnfdir, Nn, 5)

# Set ANI calculator
mol.set_calculator(ANIENS(aens, sdmx=20000000.0))

print(mol.get_potential_energy())
print(np.where(mol.get_forces() > 200.0))

print("size: ", len(mol.get_chemical_symbols()))

# Optimize molecule
start_time = time.time()
dyn = QuasiNewton(mol)
dyn.run(fmax=C)
print('[ANI Total time:', time.time() - start_time, 'seconds]')

#print(hdt.evtokcal*mol.get_potential_energy())
#print(hdt.evtokcal*mol.get_forces())

# Save optimized mol
spc = mol.get_chemical_symbols()
pos = mol.get_positions(wrap=False).reshape(1, len(spc), 3)

hdt.writexyzfile(optfile, pos, spc)

# Open MD output
mdcrd = open(xyzfile, 'w')