rmrresearch / GhostFragment

Library focused on fragment-based methods and basis-set superposition corrections
https://rmrresearch.github.io/GhostFragment/
Apache License 2.0
0 stars 4 forks source link

Crash occurs when changing 'n' parameter in 'Fragment Driver' #61

Open jlheflin opened 2 months ago

jlheflin commented 2 months ago

When running the following code in either a Jupyterlab or python script, a crash occurs when 'Fragment Driver' parameter 'n' is changed. After a short time, the code will run, but I am unsure of what is happening in the background that allows for the program to run again.

Here is the input:

#!/usr/bin/env python
# coding: utf-8

import nwchemex as nwx
import parallelzone as pz
import simde
import chemist
import pluginplay
import ghostfragment
import os
import glob
import regex
import time

mm = pluginplay.ModuleManager()
nwx.load_modules(mm)
ghostfragment.load_modules(mm)

mol_pt = simde.MoleculeFromString()
sys_maker_key = 'ChemicalSystem via QCElemental'

mol_str = """
        O          -0.167787    1.645761    0.108747
        H           0.613411    1.102620    0.113724
        H          -0.093821    2.209720   -0.643619
        O           1.517569   -0.667424   -0.080674
        H           1.989645   -1.098799    0.612047
        H           0.668397   -1.091798   -0.139744
        O          -1.350388   -0.964879   -0.092208
        H          -1.908991   -1.211298    0.626207
        H          -1.263787   -0.018107   -0.055536
        """
water3 = mm.run_as(mol_pt, sys_maker_key, mol_str)

mm.change_input('NWChem : SCF', 'basis set', 'sto-3g')
mm.change_input('Fragment Driver', 'n', 2)

sys = chemist.ChemicalSystem(water3)

mm.change_submod('Fragment Based Method', 'Energy method', 'NWChem : SCF')

egy = mm.run_as(simde.TotalEnergy(), 'Fragment Based Method', sys)

print(egy)

The following error:

terminate called after throwing an instance of 'boost::wrapexcept<boost::bad_any_cast>'
  what():  boost::bad_any_cast: failed conversion using boost::any_cast
[jacob-lg-gram:32047] *** Process received signal ***
[jacob-lg-gram:32047] Signal: Aborted (6)
[jacob-lg-gram:32047] Signal code:  (-6)
[jacob-lg-gram:32047] [ 0] /usr/lib/libc.so.6(+0x3cae0)[0x773a46650ae0]
[jacob-lg-gram:32047] [ 1] /usr/lib/libc.so.6(+0x94e44)[0x773a466a8e44]
[jacob-lg-gram:32047] [ 2] /usr/lib/libc.so.6(gsignal+0x20)[0x773a46650a30]
[jacob-lg-gram:32047] [ 3] /usr/lib/libc.so.6(abort+0xdf)[0x773a466384c3]
[jacob-lg-gram:32047] [ 4] /usr/lib/libstdc++.so.6(+0x97b0c)[0x773a41497b0c]
[jacob-lg-gram:32047] [ 5] /usr/lib/libstdc++.so.6(+0xadf1a)[0x773a414adf1a]
[jacob-lg-gram:32047] [ 6] /usr/lib/libstdc++.so.6(__cxa_call_terminate+0x35)[0x773a4149737b]
[jacob-lg-gram:32047] [ 7] /usr/lib/libstdc++.so.6(__gxx_personality_v0+0x303)[0x773a414ad703]
[jacob-lg-gram:32047] [ 8] /usr/lib/libgcc_s.so.1(+0x21ee7)[0x773a45e4dee7]
[jacob-lg-gram:32047] [ 9] /usr/lib/libgcc_s.so.1(_Unwind_Resume+0x12d)[0x773a45e4e9ad]
[jacob-lg-gram:32047] [10] /home/jacob/Projects/GhostFragment/build/libghostfragment.so(+0x737e9)[0x773a35f467e9]
[jacob-lg-gram:32047] [11] /home/jacob/Projects/GhostFragment/build/libghostfragment.so(_ZNK10pluginplay3any7detail_15AnyFieldWrapperItE12value_equal_ERKNS1_12AnyFieldBaseE+0xb3)[0x773a35f46be3]
[jacob-lg-gram:32047] [12] /home/jacob/Applications/NWChemEx/install/lib/libpluginplay.so.1(_ZNK10pluginplay5cache8database10TransposerINS_3any8AnyFieldENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE6count_ERKS4_+0x9b)[0x773a45ee84cb]
[jacob-lg-gram:32047] [13] /home/jacob/Applications/NWChemEx/install/lib/libpluginplay.so.1(_ZN10pluginplay5cache10UUIDMapperINS_11ModuleInputEE6insertES2_+0x65)[0x773a45ef11c5]
[jacob-lg-gram:32047] [14] /home/jacob/Applications/NWChemEx/install/lib/libpluginplay.so.1(_ZN10pluginplay5cache13ProxyMapMakerISt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_11ModuleInputEN9utilities7detail_20CaseInsensitiveLess_ESaISt4pairIKS8_S9_EEEE6insertERKSH_+0x5c)[0x773a45ef5d5c]
[jacob-lg-gram:32047] [15] /home/jacob/Applications/NWChemEx/install/lib/libpluginplay.so.1(_ZN10pluginplay5cache8database14KeyProxyMapperISt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_11ModuleInputEN9utilities7detail_20CaseInsensitiveLess_ESaISt4pairIKS9_SA_EEES3_IS9_NS_12ModuleResultESD_SaISE_ISF_SJ_EEEE7insert_ESI_SM_+0x32)[0x773a45ef5ee2]
[jacob-lg-gram:32047] [16] /home/jacob/Applications/NWChemEx/install/lib/libpluginplay.so.1(_ZN10pluginplay5cache11ModuleCache5cacheESt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_11ModuleInputEN9utilities7detail_20CaseInsensitiveLess_ESaISt4pairIKS8_S9_EEES2_IS8_NS_12ModuleResultESC_SaISD_ISE_SI_EEE+0x1b6)[0x773a45ef8fa6]
[jacob-lg-gram:32047] [17] /home/jacob/Applications/NWChemEx/install/lib/libpluginplay.so.1(_ZN10pluginplay7detail_11ModulePIMPL3runESt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_11ModuleInputEN9utilities7detail_20CaseInsensitiveLess_ESaISt4pairIKS8_S9_EEE+0x1110)[0x773a45f0f930]
[jacob-lg-gram:32047] [18] /home/jacob/Applications/NWChemEx/install/lib/libpluginplay.so.1(_ZN10pluginplay6Module3runESt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_11ModuleInputEN9utilities7detail_20CaseInsensitiveLess_ESaISt4pairIKS7_S8_EEE+0x79)[0x773a45f0a469]
[jacob-lg-gram:32047] [19] /home/jacob/Projects/GhostFragment/build/libghostfragment.so(_ZN10pluginplay6Module6run_asIN13ghostfragment2pt16FragmentedNucleiEJRKN7chemist18ChemicalSystemViewIKNS5_14ChemicalSystemEEEEEEDaDpOT0_+0x1c8)[0x773a35f7fcc8]
[jacob-lg-gram:32047] [20] /home/jacob/Projects/GhostFragment/build/libghostfragment.so(_ZNK13ghostfragment7drivers24FragmentedChemicalSystem4run_ESt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN10pluginplay11ModuleInputEN9utilities7detail_20CaseInsensitiveLess_ESaISt4pairIKS8_SA_EEES2_IS8_NS9_16SubmoduleRequestESD_SaISE_ISF_SJ_EEE+0x1d8)[0x773a35f7ca68]
[jacob-lg-gram:32047] [21] /home/jacob/Applications/NWChemEx/install/lib/libpluginplay.so.1(_ZN10pluginplay7detail_11ModulePIMPL3runESt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_11ModuleInputEN9utilities7detail_20CaseInsensitiveLess_ESaISt4pairIKS8_S9_EEE+0xf15)[0x773a45f0f735]
[jacob-lg-gram:32047] [22] /home/jacob/Applications/NWChemEx/install/lib/libpluginplay.so.1(_ZN10pluginplay6Module3runESt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_11ModuleInputEN9utilities7detail_20CaseInsensitiveLess_ESaISt4pairIKS7_S8_EEE+0x79)[0x773a45f0a469]
[jacob-lg-gram:32047] [23] /home/jacob/Projects/GhostFragment/build/libghostfragment.so(_ZN10pluginplay6Module6run_asIN13ghostfragment2pt24FragmentedChemicalSystemEJRKN7chemist14ChemicalSystemEEEEDaDpOT0_+0x74e)[0x773a35f775be]
[jacob-lg-gram:32047] [24] /home/jacob/Projects/GhostFragment/build/libghostfragment.so(_ZNK13ghostfragment7drivers19FragmentBasedMethod4run_ESt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN10pluginplay11ModuleInputEN9utilities7detail_20CaseInsensitiveLess_ESaISt4pairIKS8_SA_EEES2_IS8_NS9_16SubmoduleRequestESD_SaISE_ISF_SJ_EEE+0x1e4)[0x773a35f6e574]
[jacob-lg-gram:32047] [25] /home/jacob/Applications/NWChemEx/install/lib/libpluginplay.so.1(_ZN10pluginplay7detail_11ModulePIMPL3runESt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_11ModuleInputEN9utilities7detail_20CaseInsensitiveLess_ESaISt4pairIKS8_S9_EEE+0xf15)[0x773a45f0f735]
[jacob-lg-gram:32047] [26] /home/jacob/Applications/NWChemEx/install/lib/libpluginplay.so.1(_ZN10pluginplay6Module3runESt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_11ModuleInputEN9utilities7detail_20CaseInsensitiveLess_ESaISt4pairIKS7_S8_EEE+0x79)[0x773a45f0a469]
[jacob-lg-gram:32047] [27] /home/jacob/Projects/GhostFragment/install/pluginplay.so(+0x64efe)[0x773a412e7efe]
[jacob-lg-gram:32047] [28] /home/jacob/Projects/GhostFragment/install/pluginplay.so(+0x6a3a1)[0x773a412ed3a1]
[jacob-lg-gram:32047] [29] /home/jacob/Projects/GhostFragment/install/pluginplay.so(+0x2f958)[0x773a412b2958]
[jacob-lg-gram:32047] *** End of error message ***
zsh: IOT instruction (core dumped)  python3 Untitled.py
ryanmrichard commented 2 months ago

The problem is the cache doesn't seem to work with Python objects at the moment. As a workaround, create your ModuleManager object like:

mm = pluginplay.ModuleManager(pz.runtime.RuntimeView(), None)