From 01b95d55958e42419556d41fc6d7cd1368cf6a58 Mon Sep 17 00:00:00 2001 From: Jaron Krogel Date: Wed, 6 Jun 2018 10:53:31 -0400 Subject: [PATCH] nexus: remove generate_only test override and modernize/clean examples --- nexus/examples/qmcpack/H2O/H2O.py | 45 +++++----- nexus/examples/qmcpack/LiH/LiH.py | 84 ++++++++++--------- nexus/examples/qmcpack/c20/c20.py | 30 +++---- nexus/examples/qmcpack/diamond/diamond.py | 17 ++-- .../qmcpack/diamond/diamond_vacancy.py | 9 +- nexus/examples/qmcpack/graphene/graphene.py | 40 ++++----- .../qmcpack/oxygen_dimer/oxygen_dimer.py | 27 +++--- .../relax_vs_kpoints_example.py | 37 +++----- nexus/library/physical_system.py | 8 +- nexus/library/qmcpack_input.py | 3 +- 10 files changed, 134 insertions(+), 166 deletions(-) diff --git a/nexus/examples/qmcpack/H2O/H2O.py b/nexus/examples/qmcpack/H2O/H2O.py index 71bc79c9f..674a028b8 100755 --- a/nexus/examples/qmcpack/H2O/H2O.py +++ b/nexus/examples/qmcpack/H2O/H2O.py @@ -1,8 +1,9 @@ #! /usr/bin/env python # H2O molecule with Quantum ESPRESSO orbitals -from nexus import settings,Job,run_project -from nexus import Structure,PhysicalSystem +from nexus import settings,job,run_project +from nexus import read_structure +from nexus import generate_physical_system from nexus import generate_pwscf from nexus import generate_pw2qmcpack from nexus import generate_qmcpack,vmc,loop,linear,dmc @@ -11,12 +12,9 @@ from nexus import generate_qmcpack,vmc,loop,linear,dmc settings( pseudo_dir = '../pseudopotentials', runs = 'runs', - results = 'results', + results = '', sleep = 3, - #generate_only = False, - # Complicated setting only so examples can be run in test harness. - # For real runs, use the plain setting of 'generate_only' above. - generate_only = globals().get('override_generate_only_setting',False), + generate_only = 0, status_only = 0, machine = 'ws1', ) @@ -30,24 +28,23 @@ qmcpack = 'qmcpack' dft_pps = ['O.BFD.upf','H.BFD.upf'] qmc_pps = ['O.BFD.xml','H.BFD.xml'] -# Job Definitions (MPI Tasks, MP Threading, PBS Queue, Time, etc.) -scf_job = Job(app=pwscf,serial=True) -p2q_job = Job(app=pw2qmcpack,serial=True) -opt_job = Job(threads=4,app=qmcpack,serial=True) -dmc_job = Job(threads=4,app=qmcpack,serial=True) +# job Definitions (MPI Tasks, MP Threading, PBS Queue, Time, etc.) +scf_job = job(app=pwscf,serial=True) +p2q_job = job(app=pw2qmcpack,serial=True) +opt_job = job(threads=4,app=qmcpack,serial=True) +dmc_job = job(threads=4,app=qmcpack,serial=True) # System To Be Simulated -structure = Structure() -structure.read_xyz('H2O.xyz') +structure = read_structure('H2O.xyz') structure.bounding_box( box = 'cubic', scale = 1.5 ) structure.add_kmesh( kgrid = (1,1,1), - kshift = (0,0,0) -) -H2O_molecule = PhysicalSystem( + kshift = (0,0,0), + ) +H2O_molecule = generate_physical_system( structure = structure, net_charge = 0, net_spin = 0, @@ -70,7 +67,7 @@ scf = generate_pwscf( conv_thr = 1.0e-5, mixing_beta = 0.7, mixing_mode = 'local-TF', - degauss = 0.001 + degauss = 0.001, ) sims.append(scf) @@ -80,7 +77,7 @@ p2q = generate_pw2qmcpack( path = '.', job = p2q_job, write_psir = False, - dependencies = (scf,'orbitals') + dependencies = (scf,'orbitals'), ) sims.append(p2q) @@ -107,7 +104,7 @@ linopt1 = linear( alloweddifference = 1e-4, stepsize = 0.2, stabilizerscale = 1.0, - nstabilizers = 3 + nstabilizers = 3, ) # QMC Optimization Parameters - Finer Sampling Set @@ -128,7 +125,7 @@ opt = generate_qmcpack( ('J2','bspline',8,4)], calculations = [loop(max=4,qmc=linopt1), loop(max=4,qmc=linopt2)], - dependencies = (p2q,'orbitals') + dependencies = (p2q,'orbitals'), ) sims.append(opt) @@ -151,7 +148,7 @@ qmc = generate_qmcpack( warmupsteps = 100, blocks = 1, timestep = 1.0, - usedrift = False + usedrift = False, ), dmc( minimumtargetwalkers = 128, @@ -160,10 +157,10 @@ qmc = generate_qmcpack( timestep = 0.005, steps = 10, blocks = 200, - nonlocalmoves = True + nonlocalmoves = True, ) ], - dependencies = [(p2q,'orbitals'),(opt,'jastrow')] + dependencies = [(p2q,'orbitals'),(opt,'jastrow')], ) sims.append(qmc) diff --git a/nexus/examples/qmcpack/LiH/LiH.py b/nexus/examples/qmcpack/LiH/LiH.py index cc40b1e9c..1d0ee5703 100755 --- a/nexus/examples/qmcpack/LiH/LiH.py +++ b/nexus/examples/qmcpack/LiH/LiH.py @@ -1,7 +1,7 @@ #! /usr/bin/env python # LiH crystal with Quantum ESPRESSO orbitals -from nexus import settings,Job,run_project +from nexus import settings,job,run_project from nexus import generate_physical_system from nexus import generate_pwscf from nexus import generate_pw2qmcpack @@ -13,11 +13,7 @@ settings( runs = 'runs', results = 'results', sleep = 3, - #generate_only = False, - # Complicated setting only so examples can be run in test harness. - # For real runs, use the plain setting of 'generate_only' above. - generate_only = globals().get('override_generate_only_setting',False), - + generate_only = 0, status_only = 0, machine = 'ws1', ) @@ -31,12 +27,12 @@ qmcpack = 'qmcpack' dft_pps = ['Li.TN-DF.upf','H.TN-DF.upf'] qmc_pps = ['Li.pp.data','H.pp.data'] -# Job Definitions (MPI Tasks, MP Threading, PBS Queue, Time, etc.) -scf_job = Job(app=pwscf,serial=True) -nscf_job = Job(app=pwscf,serial=True) -p2q_job = Job(app=pw2qmcpack,serial=True) -opt_job = Job(threads=4,app=qmcpack,serial=True) -dmc_job = Job(threads=4,app=qmcpack,serial=True) +# job Definitions (MPI Tasks, MP Threading, PBS Queue, Time, etc.) +scf_job = job(app=pwscf,serial=True) +nscf_job = job(app=pwscf,serial=True) +p2q_job = job(app=pw2qmcpack,serial=True) +opt_job = job(threads=4,app=qmcpack,serial=True) +dmc_job = job(threads=4,app=qmcpack,serial=True) # System To Be Simulated rocksalt_LiH = generate_physical_system( @@ -88,7 +84,7 @@ nscf = generate_pwscf( ecutrho = 1800, conv_thr = 1.0e-10, mixing_beta = 0.7, - dependencies = (scf,'charge-density') + dependencies = (scf,'charge-density'), ) sims.append(nscf) @@ -98,7 +94,7 @@ p2q = generate_pw2qmcpack( path = '.', job = p2q_job, write_psir = False, - dependencies = (nscf,'orbitals') + dependencies = (nscf,'orbitals'), ) sims.append(p2q) @@ -125,8 +121,8 @@ linopt1 = linear( alloweddifference = 1e-4, stepsize = 0.2, stabilizerscale = 1.0, - nstabilizers = 3 -) + nstabilizers = 3, + ) # QMC Optimization Parameters - Finer Sampling Set linopt2 = linopt1.copy() @@ -146,19 +142,23 @@ opt = generate_qmcpack( ('J2','bspline',8)], calculations = [loop(max=4,qmc=linopt1), loop(max=4,qmc=linopt2)], - dependencies = (p2q,'orbitals') + dependencies = (p2q,'orbitals'), ) pp = opt.input.get('pseudos') -pp.Li.format='casino' -pp.Li['l-local']='s' -pp.Li.nrule=2 -pp.Li.lmax=2 -pp.Li.cutoff=2.19 -pp.H.format='casino' -pp.H['l-local']='s' -pp.H.nrule=2 -pp.H.lmax=2 -pp.H.cutoff=0.50 +pp.Li.set( + format = 'casino', + l_local = 's', + nrule = 2, + lmax = 2, + cutoff = 2.19, + ) +pp.H.set( + format = 'casino', + l_local = 's', + nrule = 2, + lmax = 2, + cutoff = 0.50, + ) sims.append(opt) # QMC VMC/DMC With Optimized Jastrow Parameters @@ -180,7 +180,7 @@ qmc = generate_qmcpack( warmupsteps = 100, blocks = 1, timestep = 1.0, - usedrift = False + usedrift = False, ), dmc( minimumtargetwalkers = 128, @@ -189,22 +189,26 @@ qmc = generate_qmcpack( timestep = 0.005, steps = 10, blocks = 200, - nonlocalmoves = True + nonlocalmoves = True, ) ], - dependencies = [(p2q,'orbitals'),(opt,'jastrow')] + dependencies = [(p2q,'orbitals'),(opt,'jastrow')], ) pp = qmc.input.get('pseudos') -pp.Li.format='casino' -pp.Li['l-local']='s' -pp.Li.nrule=2 -pp.Li.lmax=2 -pp.Li.cutoff=2.37 -pp.H.format='casino' -pp.H['l-local']='s' -pp.H.nrule=2 -pp.H.lmax=2 -pp.H.cutoff=0.50 +pp.Li.set( + format = 'casino', + l_local = 's', + nrule = 2, + lmax = 2, + cutoff = 2.37, + ) +pp.H.set( + format = 'casino', + l_local = 's', + nrule = 2, + lmax = 2, + cutoff = 0.50, + ) sims.append(qmc) run_project(sims) diff --git a/nexus/examples/qmcpack/c20/c20.py b/nexus/examples/qmcpack/c20/c20.py index 0005091d2..070cd7da2 100755 --- a/nexus/examples/qmcpack/c20/c20.py +++ b/nexus/examples/qmcpack/c20/c20.py @@ -1,7 +1,8 @@ #! /usr/bin/env python -from nexus import settings,Job,run_project -from nexus import Structure,PhysicalSystem +from nexus import settings,job,run_project +from nexus import read_structure +from nexus import generate_physical_system from nexus import generate_pwscf from nexus import generate_pw2qmcpack from nexus import generate_qmcpack @@ -12,22 +13,15 @@ from nexus import loop,linear,vmc,dmc settings( pseudo_dir = '../pseudopotentials',# directory with all pseudopotentials sleep = 3, # check on runs every 'sleep' seconds - #generate_only = 0, # only make input files - # Complicated setting only so examples can be run in test harness. - # For real runs, use the plain setting of 'generate_only' above. - generate_only = globals().get('override_generate_only_setting',False), + generate_only = 0, # only make input files status_only = 0, # only show status of runs machine = 'ws16', # local machine is 16 core workstation ) #generate the C20 physical system -# specify the xyz file -structure_file = 'c20.cage.xyz' -# make an empty structure object -structure = Structure() # read in the xyz file -structure.read_xyz(structure_file) +structure = read_structure('c20.cage.xyz') # place a bounding box around the structure structure.bounding_box( box = 'cubic', # cube shaped cell @@ -39,11 +33,11 @@ structure.add_kmesh( kshift = (0,0,0) # and shift ) # add electronic information -c20 = PhysicalSystem( - structure = structure, # C20 structure +c20 = generate_physical_system( + structure = structure, # C20 structure net_charge = 0, # net charge in units of e net_spin = 0, # net spin in units of e-spin - C = 4 # C has 4 valence electrons + C = 4, # C has 4 valence electrons ) @@ -55,7 +49,7 @@ scf = generate_pwscf( # nexus inputs identifier = 'scf', # identifier/file prefix path = 'c20/scf', # directory for scf run - job = Job(cores=16), # run on 16 cores + job = job(cores=16), # run on 16 cores pseudos = ['C.BFD.upf'], # pwscf PP file system = c20, # run c20 # input format selector @@ -75,7 +69,7 @@ p2q = generate_pw2qmcpack( # nexus inputs identifier = 'p2q', path = 'c20/nscf', - job = Job(cores=1), + job = job(cores=1), # pw2qmcpack input parameters write_psir = False, # workflow dependencies @@ -89,7 +83,7 @@ opt = generate_qmcpack( # nexus inputs identifier = 'opt', # identifier/file prefix path = 'c20/opt', # directory for opt run - job = Job(cores=16,app='qmcpack'), + job = job(cores=16,app='qmcpack'), pseudos = ['C.BFD.xml'], # qmcpack PP file system = c20, # run c20 # input format selector @@ -126,7 +120,7 @@ qmc = generate_qmcpack( # nexus inputs identifier = 'qmc', # identifier/file prefix path = 'c20/qmc', # directory for dmc run - job = Job(cores=16,app='qmcpack'), + job = job(cores=16,app='qmcpack'), pseudos = ['C.BFD.xml'], # qmcpack PP file system = c20, # run c20 # input format selector diff --git a/nexus/examples/qmcpack/diamond/diamond.py b/nexus/examples/qmcpack/diamond/diamond.py index 979597472..9a98fc673 100755 --- a/nexus/examples/qmcpack/diamond/diamond.py +++ b/nexus/examples/qmcpack/diamond/diamond.py @@ -1,6 +1,6 @@ #! /usr/bin/env python -from nexus import settings,Job,run_project +from nexus import settings,job,run_project from nexus import generate_physical_system from nexus import generate_pwscf from nexus import generate_pw2qmcpack @@ -9,10 +9,7 @@ from nexus import generate_qmcpack,vmc settings( pseudo_dir = '../pseudopotentials', status_only = 0, - #generate_only = False, - # Complicated setting only so examples can be run in test harness. - # For real runs, use the plain setting of 'generate_only' above. - generate_only = globals().get('override_generate_only_setting',False), + generate_only = 0, sleep = 3, machine = 'ws16' ) @@ -34,7 +31,7 @@ dia16 = generate_physical_system( scf = generate_pwscf( identifier = 'scf', path = 'diamond/scf', - job = Job(cores=16,app='pw.x'), + job = job(cores=16,app='pw.x'), input_type = 'generic', calculation = 'scf', input_dft = 'lda', @@ -49,15 +46,15 @@ scf = generate_pwscf( conv = generate_pw2qmcpack( identifier = 'conv', path = 'diamond/scf', - job = Job(cores=1,app='pw2qmcpack.x'), + job = job(cores=1,app='pw2qmcpack.x'), write_psir = False, - dependencies = (scf,'orbitals') + dependencies = (scf,'orbitals'), ) qmc = generate_qmcpack( identifier = 'vmc', path = 'diamond/vmc', - job = Job(cores=16,threads=4,app='qmcpack'), + job = job(cores=16,threads=4,app='qmcpack'), input_type = 'basic', system = dia16, pseudos = ['C.BFD.xml'], @@ -72,7 +69,7 @@ qmc = generate_qmcpack( timestep = .4 ) ], - dependencies = (conv,'orbitals') + dependencies = (conv,'orbitals'), ) run_project(scf,conv,qmc) diff --git a/nexus/examples/qmcpack/diamond/diamond_vacancy.py b/nexus/examples/qmcpack/diamond/diamond_vacancy.py index 068a15389..0bb896037 100755 --- a/nexus/examples/qmcpack/diamond/diamond_vacancy.py +++ b/nexus/examples/qmcpack/diamond/diamond_vacancy.py @@ -5,16 +5,13 @@ from nexus import * settings( pseudo_dir = '../pseudopotentials', status_only = 0, - #generate_only = False, - # Complicated setting only so examples can be run in test harness. - # For real runs, use the plain setting of 'generate_only' above. - generate_only = globals().get('override_generate_only_setting',False), + generate_only = 0, sleep = 3, machine = 'ws16' ) -relax_job = Job(cores=16,app='pw.x') -scf_job = Job(cores=16,app='pw.x') +relax_job = job(cores=16,app='pw.x') +scf_job = job(cores=16,app='pw.x') dia16 = generate_physical_system( structure = './d16vac.POSCAR', diff --git a/nexus/examples/qmcpack/graphene/graphene.py b/nexus/examples/qmcpack/graphene/graphene.py index c95fb4875..ab3f94dae 100755 --- a/nexus/examples/qmcpack/graphene/graphene.py +++ b/nexus/examples/qmcpack/graphene/graphene.py @@ -1,6 +1,6 @@ #! /usr/bin/env python -from nexus import settings,Job,run_project +from nexus import settings,job,run_project from nexus import generate_physical_system from nexus import generate_pwscf from nexus import generate_pw2qmcpack @@ -12,16 +12,12 @@ from nexus import loop,linear,vmc,dmc settings( pseudo_dir = '../pseudopotentials',# directory with all pseudopotentials sleep = 3, # check on runs every 'sleep' seconds - #generate_only = False, - # Complicated setting only so examples can be run in test harness. - # For real runs, use the plain setting of 'generate_only' above. - generate_only = globals().get('override_generate_only_setting',False), + generate_only = 0, # only make input files status_only = 0, # only show status of runs machine = 'ws16', # local machine is 16 core workstation ) - # generate the graphene physical system graphene = generate_physical_system( lattice = 'hexagonal', # hexagonal cell shape @@ -47,7 +43,7 @@ scf = generate_pwscf( # nexus inputs identifier = 'scf', # identifier/file prefix path = 'graphene/scf', # directory for scf run - job = Job(cores=16), # run on 16 cores + job = job(cores=16), # run on 16 cores pseudos = ['C.BFD.upf'], # pwscf PP file system = graphene, # run graphene # input format selector @@ -60,7 +56,7 @@ scf = generate_pwscf( kgrid = (8,8,8), # MP grid of primitive cell kshift = (1,1,1), # to converge charge density wf_collect = False, # don't collect orbitals - use_folded = True # use primitive rep of graphene + use_folded = True, # use primitive rep of graphene ) sims.append(scf) @@ -69,7 +65,7 @@ nscf_opt = generate_pwscf( # nexus inputs identifier = 'nscf', # identifier/file prefix path = 'graphene/nscf_opt', # directory for nscf run - job = Job(cores=16), # run on 16 cores + job = job(cores=16), # run on 16 cores pseudos = ['C.BFD.upf'], # pwscf PP file system = graphene, # run graphene # input format selector @@ -85,7 +81,7 @@ nscf_opt = generate_pwscf( kgrid = (1,1,1), # single k-point for opt kshift = (0,0,0), # gamma point # workflow dependencies - dependencies = (scf,'charge_density') + dependencies = (scf,'charge_density'), ) sims.append(nscf_opt) @@ -94,11 +90,11 @@ p2q_opt = generate_pw2qmcpack( # nexus inputs identifier = 'p2q', path = 'graphene/nscf_opt', - job = Job(cores=1), + job = job(cores=1), # pw2qmcpack input parameters write_psir = False, # workflow dependencies - dependencies = (nscf_opt,'orbitals') + dependencies = (nscf_opt,'orbitals'), ) sims.append(p2q_opt) @@ -107,7 +103,7 @@ opt = generate_qmcpack( # nexus inputs identifier = 'opt', # identifier/file prefix path = 'graphene/opt', # directory for opt run - job = Job(cores=16,app='qmcpack'), + job = job(cores=16,app='qmcpack'), pseudos = ['C.BFD.xml'], # qmcpack PP file system = graphene, # run graphene # input format selector @@ -134,7 +130,7 @@ opt = generate_qmcpack( ) ], # workflow dependencies - dependencies = (p2q_opt,'orbitals') + dependencies = (p2q_opt,'orbitals'), ) sims.append(opt) @@ -144,7 +140,7 @@ nscf = generate_pwscf( # nexus inputs identifier = 'nscf', # identifier/file prefix path = 'graphene/nscf', # directory for nscf run - job = Job(cores=16), # run on 16 cores + job = job(cores=16), # run on 16 cores pseudos = ['C.BFD.upf'], # pwscf PP file system = graphene, # run graphene # input format selector @@ -158,7 +154,7 @@ nscf = generate_pwscf( use_folded = True, # use primitive rep of graphene wf_collect = True, # write out orbitals # workflow dependencies - dependencies = (scf,'charge_density') + dependencies = (scf,'charge_density'), ) sims.append(nscf) @@ -167,11 +163,11 @@ p2q = generate_pw2qmcpack( # nexus inputs identifier = 'p2q', path = 'graphene/nscf', - job = Job(cores=1), + job = job(cores=1), # pw2qmcpack input parameters write_psir = False, # workflow dependencies - dependencies = (nscf,'orbitals') + dependencies = (nscf,'orbitals'), ) sims.append(p2q) @@ -180,7 +176,7 @@ qmc = generate_qmcpack( # nexus inputs identifier = 'qmc', # identifier/file prefix path = 'graphene/qmc', # directory for dmc run - job = Job(cores=16,app='qmcpack'), + job = job(cores=16,app='qmcpack'), pseudos = ['C.BFD.xml'], # qmcpack PP file system = graphene, # run graphene # input format selector @@ -207,16 +203,14 @@ qmc = generate_qmcpack( ], # workflow dependencies dependencies = [(p2q,'orbitals'), - (opt,'jastrow')] + (opt,'jastrow')], ) - # nexus monitors all runs run_project(sims) - # print out the total energy performed_runs = not settings.generate_only and not settings.status_only if performed_runs: @@ -230,5 +224,3 @@ if performed_runs: print ' {0} +/- {1} Ha'.format(le.mean,le.error) #end if - - diff --git a/nexus/examples/qmcpack/oxygen_dimer/oxygen_dimer.py b/nexus/examples/qmcpack/oxygen_dimer/oxygen_dimer.py index 9ea463127..eacf4e07a 100755 --- a/nexus/examples/qmcpack/oxygen_dimer/oxygen_dimer.py +++ b/nexus/examples/qmcpack/oxygen_dimer/oxygen_dimer.py @@ -1,7 +1,7 @@ #! /usr/bin/env python # import nexus functions -from nexus import settings,Job,get_machine,run_project +from nexus import settings,job,run_project from nexus import generate_physical_system from nexus import generate_pwscf from nexus import generate_pw2qmcpack @@ -14,10 +14,7 @@ settings( runs = '', results = '', status_only = 0, - #generate_only = False, - # Complicated setting only so examples can be run in test harness. - # For real runs, use the plain setting of 'generate_only' above. - generate_only = globals().get('override_generate_only_setting',False), + generate_only = 0, sleep = 3, machine = 'ws16', ) @@ -46,7 +43,7 @@ linopt1 = linear( alloweddifference = 1e-4, stepsize = 0.2, stabilizerscale = 1.0, - nstabilizers = 3 + nstabilizers = 3, ) linopt2 = linopt1.copy() @@ -92,7 +89,7 @@ dimer = generate_physical_system( Lbox = 15.0, # box size units = 'A', # Angstrom units net_spin = 2, # Nup-Ndown = 2 - O = 6 # O has 6 val. electrons + O = 6, # pseudo O has 6 val. electrons ) # describe scf run @@ -100,7 +97,7 @@ scf = generate_pwscf( identifier = 'scf', path = directory, system = dimer, - job = Job(cores=16), + job = job(cores=16), input_type = 'scf', pseudos = ['O.BFD.upf'], input_dft = 'lda', @@ -108,7 +105,7 @@ scf = generate_pwscf( conv_thr = 1e-7, mixing_beta = .7, nosym = True, - wf_collect = True + wf_collect = True, ) sims.append(scf) @@ -116,9 +113,9 @@ sims.append(scf) p2q = generate_pw2qmcpack( identifier = 'p2q', path = directory, - job = Job(cores=1), + job = job(cores=1), write_psir = False, - dependencies = (scf,'orbitals') + dependencies = (scf,'orbitals'), ) sims.append(p2q) @@ -127,14 +124,14 @@ opt = generate_qmcpack( identifier = 'opt', path = directory, system = dimer, - job = Job(cores=16,app='qmcpack'), + job = job(cores=16,app='qmcpack'), input_type = 'basic', pseudos = ['O.BFD.xml'], bconds = 'nnn', jastrows = [('J1','bspline',8,4.5), # 1 & 2 body Jastrows ('J2','pade',0.5,0.5)], calculations = opt_calcs, - dependencies = (p2q,'orbitals') + dependencies = (p2q,'orbitals'), ) sims.append(opt) @@ -143,14 +140,14 @@ qmc = generate_qmcpack( identifier = 'qmc', path = directory, system = dimer, - job = Job(cores=16,app='qmcpack'), + job = job(cores=16,app='qmcpack'), input_type = 'basic', pseudos = ['O.BFD.xml'], bconds = 'nnn', jastrows = [], calculations = qmc_calcs, dependencies = [(p2q,'orbitals'), - (opt,'jastrow')] + (opt,'jastrow')], ) sims.append(qmc) diff --git a/nexus/examples/quantum_espresso/relax_Ge_T_vs_kpoints/relax_vs_kpoints_example.py b/nexus/examples/quantum_espresso/relax_Ge_T_vs_kpoints/relax_vs_kpoints_example.py index 94d720d59..c60b0c824 100755 --- a/nexus/examples/quantum_espresso/relax_Ge_T_vs_kpoints/relax_vs_kpoints_example.py +++ b/nexus/examples/quantum_espresso/relax_Ge_T_vs_kpoints/relax_vs_kpoints_example.py @@ -1,39 +1,27 @@ #! /usr/bin/env python from nexus import settings -from nexus import Structure,PhysicalSystem -from nexus import generate_pwscf,Job +from nexus import generate_physical_system +from nexus import generate_pwscf,job from nexus import run_project - # set global parameters of nexus settings( pseudo_dir = '../pseudopotentials',# directory with pseudopotentials - #generate_only = False, - # Complicated setting only so examples can be run in test harness. - # For real runs, use the plain setting of 'generate_only' above. - generate_only = globals().get('override_generate_only_setting',False), - + generate_only = 0, # only write input files, T/F status_only = 0, # only show run status, T/F machine = 'ws16' # local machine is 16 core workstation ) - # describe the physical system -T_structure = Structure() # empty structure -T_structure.read_xyz('./Ge_T_16.xyz') # read in Ge T interstitial structure - -T_structure.reset_axes([ # specify cell axes (in Angstrom) - [ 5.66, 5.66, 0. ], - [ 0. , 5.66, 5.66], - [ 5.66, 0. , 5.66] - ]) - -T_system = PhysicalSystem( # make the physical system - structure = T_structure, # out of the T interstitial structure - Ge = 4 # pseudo-Ge has 4 valence electrons +T_system = generate_physical_system( # make the physical system + structure = './Ge_T_16.xyz', # out of the T interstitial structure + axes = [[ 5.66, 5.66, 0. ], # specify cell axes (in Angstrom) + [ 0. , 5.66, 5.66], + [ 5.66, 0. , 5.66]], + Ge = 4, # pseudo-Ge has 4 valence electrons ) @@ -44,7 +32,6 @@ supercell_kgrids = [(1,1,1), # 1 k-point (6,6,6)] # 216 k-points - # describe the relaxation calculations # and link them together into a simulation cascade relaxations = [] # list of relax simulation objects @@ -53,7 +40,7 @@ for kgrid in supercell_kgrids: # loop over supercell kgrids identifier = 'relax', # file prefix # run directory path = 'relax/kgrid_{0}{1}{2}'.format(*kgrid), - job = Job(cores=16), # will run with mpirun -np 16 + job = job(cores=16), # will run with mpirun -np 16 input_type = 'relax', # this is a relax calculation input_dft = 'pbe', # PBE functional ecut = 50, # 50 Ry planewave cutoff @@ -61,7 +48,7 @@ for kgrid in supercell_kgrids: # loop over supercell kgrids kgrid = kgrid, # supercell k-point grid kshift = (1,1,1), # grid centered at supercell L point pseudos = ['Ge.pbe-kjpaw.UPF'], # PBE pseudopotential - system = T_system # the interstitial system + system = T_system, # the interstitial system ) # link together the simulation cascade # current relax gets structure from previous @@ -72,12 +59,10 @@ for kgrid in supercell_kgrids: # loop over supercell kgrids #end for - # perform the simulations run_project(relaxations) - # analyze the results performed_runs = not settings.generate_only and not settings.status_only if performed_runs: diff --git a/nexus/library/physical_system.py b/nexus/library/physical_system.py index 9105bd42c..cfa3ca2ff 100644 --- a/nexus/library/physical_system.py +++ b/nexus/library/physical_system.py @@ -662,10 +662,14 @@ def generate_physical_system(**kwargs): if is_str: if os.path.exists(s): if 'elem' in kwargs: - kwargs['structure'] = read_structure(s,elem=kwargs['elem']) + s = read_structure(s,elem=kwargs['elem']) else: - kwargs['structure'] = read_structure(s) + s = read_structure(s) #end if + if 'axes' in kwargs: + s.reset_axes(kwargs['axes']) + #end if + kwargs['structure'] = s else: slow = s.lower() format = None diff --git a/nexus/library/qmcpack_input.py b/nexus/library/qmcpack_input.py index 6209a8e85..dd1c760e3 100644 --- a/nexus/library/qmcpack_input.py +++ b/nexus/library/qmcpack_input.py @@ -2044,7 +2044,7 @@ class pseudopotential(QIxml): #end class pseudopotential class pseudo(QIxml): - attributes = ['elementtype','href','format','cutoff','lmax','nrule','l-local'] + attributes = ['elementtype','href','format','cutoff','lmax','nrule','l_local'] elements = ['header','local','grid'] identifier = 'elementtype' #end class pseudo @@ -2578,6 +2578,7 @@ Names.set_expanded_names( pairtype = 'pairType', printeloc = 'printEloc', spindependent = 'spinDependent', + l_local = 'l-local', ) for c in classes: c.init_class()