Strange segmentation fault
Describe the bug
Failed to run an optimization for a periodic cell by employing method GFN0-xTB with more than 2 adsorbed molecules within the MOF pore. The same run happens to show no error, and converge smoothly when using xTB without the xtb-python API.
To Reproduce
from ase.optimize.bfgslinesearch import BFGSLineSearch
from ase.build import molecule
from ase.atoms import Atoms
from numpy import loadtxt
from xtb.ase.calculator import XTB
from ase.constraints import FixAtoms
from ase.data.pubchem import pubchem_atoms_search
from ase.io import write
def runmole(adsorbate, name, calc):
adsorbate.calc = calc
adsorbateopt = BFGSLineSearch(adsorbate, trajectory = '%sads.trj' % name, logfile = '%sads.log' % name)
adsorbateopt.run(fmax=0.0005)
write('%s.xyz' % name, adsorbate)
return adsorbate.get_potential_energy()
def runopt(name, natom, Eadsorbate, Emof, lattice, calc):
e = 0
for i in range(4):
S = loadtxt('%s.ads.%d.xyz' % (name, i), usecols = [0], dtype = str)
P = loadtxt('%s.ads.%d.xyz' % (name, i), usecols = [1, 2, 3], dtype = float)
ads = Atoms(symbols = S, positions = P, cell = lattice, pbc = [True, True, True])
fixed = list(range(len(ads) - (i+1)*natom))
ads.constraints = [FixAtoms(indices=fixed)]
ads.calc = calc
opt = BFGSLineSearch(ads, trajectory = '%sads%d.trj' % (name, i), logfile = '%sads%d.log' % (name, i))
opt.run(fmax=0.0005)
write('%sads%d.cif' % (name, i), ads)
eads = ads.get_potential_energy() - (i+1)*Eadsorbate - Emof
e = eads - e
print('%sads%d = %10.8f %10.8f' % (name, i, eads, e))
lattice = loadtxt('CELL_PARAMETERS_MOF_4x3x1', usecols = [0, 1, 2], dtype = float)
calc = XTB(method='GFN0-xTB', accuracy = 1.0)
Emof = -10207.074487838794
Edmf = runmole(pubchem_atoms_search(name = 'dmf'), 'dmf', calc)
runopt('dmf', 12, Edmf, Emof, lattice, calc)
-
What is your setup, which version are you running (current master is subject to change) xtb-6.3.2 xtb-python (API_VERSION: 1.0.0) ase 3.19.1.
-
output showing the error Segmentation fault (core dumped)
All input and output file to verify this report.--> test.gz
Expected behaviour
Printing a table of adsorption energy.
I am also having issues with running geometry optimization with xTB and ASE. With the current implementation is it possible to do a relaxation like this?
atoms.calc = XTB(method="GFN2-xTB")
relax = BFGSLineSearch(atoms)
I know it was possible before xtb-python. Now it seems only a single point calculation runs when relax is called.
Thanks for help!
@mvfbarrionuevo Seems like a memory issue on the xtb API side, but the system is a bit to large to test it on a local workstation.
@wood-b it should be still possible using the code your provided.
Try add this in your script:
export OMP_STACKSIZE=5G