pyiron_atomistics
pyiron_atomistics copied to clipboard
Overwirte the SPINX input file by pyiron
- I have been trying to do DFT+U calculations using Spinx with Pyiron. And I met a problem when I tried to switch off the symmetry.
- According to the Spinx manual, I can switch off the symmetry of the structure by creating an empty symmetry group. I have successfully done this by "job_Sphinx.input.sphinx.structure.create_group("symmetry")" and can see the group in "job.input".
- But if I save the job by "job_Sphinx.save()" and run the calculation "job_Sphinx.run()", pyiron will automatically overwrite the input file which doesn't contain symmetry anymore.
- I don't know what caused this erroneous overwrite, so in order to conduct a detailed inspection, I have attached my code. DFT+U Spinx.txt
- I would like to set the parameters of Sphinx through PyIron without being automatically overwritten by PyIron. Thank you for any contributions.
for i in np.linspace(0.95,1.05,10):
i_str=str(i).replace('.','_')
basis=feo_primitive_cell.copy()
basis.set_cell(feo_primitive_cell.cell*i, scale_atoms=True)
ham_Sphinx=pr36.create_job(pr35.job_type.Sphinx,'Sphinx_'+i_str)
ham_Sphinx.server.cores=40
ham_Sphinx.server.queue ='cm'
ham_Sphinx.set_encut(500)
ham_Sphinx.set_convergence_precision(electronic_energy=1e-6)
ham_Sphinx.set_exchange_correlation_functional('PBE')
ham_Sphinx.set_occupancy_smearing(smearing='FermiDirac',width=0.05)
ham_Sphinx.set_empty_states(60)
ham_Sphinx.input.Estep = 150
magmon=[4,4,-4,-4,0,0,0,0]
basis.set_initial_magnetic_moments(magmon)
ham_Sphinx.structure=basis
ham_Sphinx.set_kpoints([14,8,8],center_shift=[0,0,0])
ham_Sphinx.calc_static(electronic_steps=150)
aoGroup=ham_Sphinx.input.sphinx.PAWHamiltonian.create_group("HubbardU").create_group("site")
aoGroup["element"]='"Fe"'
aoGroup["projectorType"]=1
aoGroup["U"]=2
ham_Sphinx.input.sphinx.structure.create_group("symmetry")
ham_Sphinx.input.sphinx.structure.symmetry.append(Group({}))
ham_Sphinx.save()
ham_Sphinx.run()
I am a bit surprised that you need ham_Sphinx.save() before ham_Sphinx.run() but @samwaseda is the expert for the Sphinx interface.
I don't think you need save. Can you try to set job.fix_symmetry = False?
Dear Jan and Dear Sam, thanks a lot for your response. I tried to set job.fix_symmetry = False and unfortunately it doesn't work. When I just ran the calculation instead of saving it, I got a warning "job.input.structure != job.structure. The current job.structure will overwrite any changes you may might have made to job.input.structure in the meantime. To disable this overwrite, set job.input.structure.read_only = True. To disable this warning, call job.load_structure_group() after making changes to job.structure."
When I set job.input.structure.read_only = True accordingly, pyiron can correctly write my input file without warnings. I am not sure whether this is a bug but it helps me out.
Thanks again for your kind suggestions.
I tried to set job.fix_symmetry = False and unfortunately it doesn't work.
Can you elaborate on this? For me the following code works perfectly:
from pyiron_atomistics import Project
pr = Project('SPX')
spx = pr.create.job.Sphinx('spx')
spx.structure = pr.create.structure.bulk('Al', cubic=True)
spx.fix_symmetry = False
spx.run()
It’s difficult to believe that a year after the issue was posited I realized that I had posted the same problem three years ago. Ok I’m gonna work on it