Test script for sprkkr/msspec cooperation.

This commit is contained in:
Sylvain Tricot 2020-04-10 17:41:21 +02:00
parent 8ebfd624e1
commit 1f87c934b6
1 changed files with 58 additions and 0 deletions

58
tests/sprkkr/copper/Cu.py Normal file
View File

@ -0,0 +1,58 @@
#!/usr/bin/env python
import glob
import logging
import sys
from msspec.calculator import MSSPEC
from msspec.utils import get_atom_index
from msspec.utils import hemispherical_cluster
from msspec.utils import SPRKKRPotential
from sprkkr.calculator import SPRKKR
from ase.build import bulk
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
# Create a copper cell
Cu = bulk('Cu')
# ########## SPRKKR part
if 'sprkkr' in sys.argv:
# create a SPRKKR calculator
calc = SPRKKR(label="Cu/Cu")
# attach the atoms to the calculator object
calc.set_atoms(Cu)
# Here is how to modify input file
# calc.input.control_section.set(DATASET="Fe", ADSI="SCF", POTFIL="Fe.pot")
# calc.input.tau_section.set(nktab=250)
# launch kkrscf
calc.get_potential_energy()
# calc2 = SPRKKR(label="Fe/Fe", task="phagen")
# calc2.set_atoms(Fe)
# calc2.input.control_section.set(POTFIL="Fe.pot_new")
# calc2.phagen()
# ######### MsSpec part
if 'msspec' in sys.argv:
nplanes = 3
cluster = hemispherical_cluster(Cu, planes=nplanes,
emitter_plane=nplanes-1)
cluster.absorber = get_atom_index(cluster, 0, 0, 0)
calc = MSSPEC(folder="calc")
calc.set_atoms(cluster)
pot = SPRKKRPotential(Cu, "Cu/Cu.pot", *glob.glob("Cu/*PHAGEN.pot"))
calc.tmatrix_parameters.potential = pot
data = calc.get_theta_scan(level='2p3/2')
data.view()
if len(sys.argv) <= 1:
print("Please specify either 'sprkkr', 'msspec' keywords or both "
"of them on the command line")