pyiron_atomistics icon indicating copy to clipboard operation
pyiron_atomistics copied to clipboard

Overwirte the SPINX input file by pyiron

Open CharlesChenME opened this issue 2 years ago • 5 comments

  1. 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.
  2. 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".
  3. 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.
  4. 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
  5. I would like to set the parameters of Sphinx through PyIron without being automatically overwritten by PyIron. Thank you for any contributions.

CharlesChenME avatar Jul 04 '23 15:07 CharlesChenME

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()

jan-janssen avatar Jul 04 '23 15:07 jan-janssen

I am a bit surprised that you need ham_Sphinx.save() before ham_Sphinx.run() but @samwaseda is the expert for the Sphinx interface.

jan-janssen avatar Jul 04 '23 15:07 jan-janssen

I don't think you need save. Can you try to set job.fix_symmetry = False?

samwaseda avatar Jul 06 '23 07:07 samwaseda

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.

CharlesChenME avatar Jul 07 '23 12:07 CharlesChenME

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()

samwaseda avatar Jul 11 '23 11:07 samwaseda

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

samwaseda avatar Jun 12 '24 12:06 samwaseda