Ejemplo n.º 1
0
 def test_flosic_opt(self):
     # FLO-SIC SCF OPT
     vsic_every = 1
     flosic = flosic_optimize('flosic-scf',
                              molecule,
                              0,
                              0,
                              'LDA,PW',
                              get_dfo_basis(sysname),
                              None,
                              opt='FIRE',
                              maxstep=0.1,
                              fmax=0.1,
                              conv_tol=1e-6,
                              grid=7,
                              vsic_every=vsic_every,
                              verbose=4)
     f = open('OPT_FRMORB.log', 'r')
     e_calc = f.readlines()[-1].split()[-2]
     f.close()
     if e_calc.find('*'):
         e_calc = e_calc.split('*')[0]
     e_calc = float(e_calc) / Ha
     e_ref = -40.697563
     self.assertAlmostEqual(e_calc, e_ref, 4)
Ejemplo n.º 2
0
from ase import Atoms
from pyscf import gto, dft
from ase.io import read
from ase_pyflosic_optimizer import flosic_optimize
import time 

# This example might took some time until it is finished. 
# You can use the command 'ase gui OPT_FRMORB.traj' to anlayze the trajectory. 
# Energy and maximum force are written in the OPT_FRMORB.xyz output file. 

# Load Nuclei+FOD starting geometry.
ase_atoms = read("LiH_rattle.xyz")
# Start timing. 
t_start = time.time()
# The acutal pyflosic-os optimization.
# Note: We choose here a smaller basis set and the 2nd order scf cycle to speed up the calculation. 
flosic = flosic_optimize('flosic-os',ase_atoms,0,0,'LDA,PW','cc-pvdz',None,opt='FIRE',maxstep=0.1,use_newton=True,verbose=4)
# End timing. 
t_end = time.time()
run_time = t_end - t_start
print('Run time [s]',run_time)
Ejemplo n.º 3
0
from pyscf import gto, dft
from ase.io import read
from ase_pyflosic_optimizer import flosic_optimize
import time

# This example might took some time until it is finished.
# You can use the command 'ase gui OPT_FRMORB.traj' to anlayze the trajectory.
# Energy and maximum force are written in the OPT_FRMORB.xyz output file.

# Load Nuclei+FOD starting geometry.
ase_atoms = read("LiH_rattle.xyz")
# Start timing.
t_start = time.time()
# The actual pyflosic-scf optimization.
# Note: We choose here a smaller basis set and the 2nd order scf cycle to speed up the calculation.
flosic = flosic_optimize('flosic-scf',
                         ase_atoms,
                         0,
                         0,
                         'LDA,PW',
                         'cc-pvdz',
                         opt='FIRE',
                         maxstep=0.1,
                         use_newton=True,
                         use_chk=False,
                         verbose=4)
# End timing.
t_end = time.time()
run_time = t_end - t_start
print('Run time [s]', run_time)
Ejemplo n.º 4
0
# Energy and maximum force are written in the OPT_FRMORB.xyz output file.

# 1) Standard optimization

# Load Nuclei+FOD starting geometry.
ase_atoms = read("LiH_rattle.xyz")
# Start timing.
t1_start = time.time()
# The actual pyflosic-scf optimization.
# Note: We choose here a smaller basis set and the 2nd order scf cycle to speed up the calculation.
flosic = flosic_optimize('flosic-scf',
                         ase_atoms,
                         0,
                         0,
                         'LDA,PW',
                         'sto3g',
                         opt='FIRE',
                         maxstep=0.1,
                         use_newton=True,
                         use_chk=False,
                         verbose=4,
                         steps=1)
# End timing.
t1_end = time.time()
run_time1 = t1_end - t1_start
f = open('OPT_FRMORB.log', 'r')
e1 = f.readlines()[-1].split()[-2]
f.close()
if e1.find('*'):
    e1 = e1.split('*')[0]
e1 = float(e1) / Ha
from ase.io import read
from ase_pyflosic_calculator import PYFLOSIC
from nrlmol_basis import get_dfo_basis
from ase.optimize import LBFGS, FIRE
from flosic_os import xyz_to_nuclei_fod, ase2pyscf
from ase_pyflosic_optimizer import flosic_optimize

# Set up a structure.
atoms = read('LiH.xyz')
# We want to use the use the NRLMOL DFO basis set.
basis = get_dfo_basis('LiH')
# Set up ase flosic_optimizer for nuclei optimization and performe optimization.
flosic = flosic_optimize('dft',
                         atoms,
                         0,
                         0,
                         'LDA,PW',
                         basis,
                         None,
                         opt='FIRE',
                         maxstep=0.1,
                         label='OPT_NUCLEI')