Open stefanbringuier opened 7 months ago
I nevere tried other calculators but it should be possible. The siesta support was implemented by the otside contributor. The problem with LAMMPS is that it is an internal calculator not an external one (like vasp or abinit). You should be able to get around this problem by actually making a new objects for the deformed structures. Please post the error messages. Maybe I will be able to help.
I think I have an approach that will work for LAMMPSlib
and possibly other internal calculators, it would only enable a serial execution thought. The implementation based on https://github.com/jochym/Elastic/blob/6117c9aeff8859a46860a34057e2f59c71c5a841/parcalc/parcalc.py#L578
Would look something like this:
def SerialCalculate(systems,calc,prefix="Calc_"):
if type(systems) != type([]) :
sysl=[systems]
else :
sysl=systems
basedir=os.getcwd()
res=[]
for n,s in enumerate(sysl):
if isinstance(calc, LAMMPSlib):
s.set_calculator(calc)
else:
s.set_calculator(deepcopy(calc))
s.get_calculator().block=False
place=tempfile.mkdtemp(prefix=prefix, dir=basedir)
os.chdir(place)
s.get_calculator().working_dir=place
s.get_potential_energy()
os.chdir(basedir)
time.sleep(0.2)
res.append([n,s])
return [r for ns,s in enumerate(sysl) for nr,r in res if nr==ns]
It seems to work, but I've only tested on a single LAMMPSlib
example, would want to try ASE
internal EMT
and EAM
calculators.
...
systems = get_elementary_deformations(structure, n=10, d=0.1)
result = SerialCalculate(systems, calculator)
cij, _ = get_elastic_tensor(structure, systems=result)
Can create a pull request if you think it makes sense.
Was wondering if you have any guidance on how might be able to proceed with using
ASE LAMMPSlib
. I tried to simply pass theASE LAMMPSlib
calculator object but gotdeepcopy
errors.Heres the source to the
ASE LAMMPSlib
implementation:https://wiki.fysik.dtu.dk/ase/_modules/ase/calculators/lammpslib.html#LAMMPSlib