Segmentation fault with GCMC

Hello Users,

I am trying to run GCMC simulation of CO2 in MOF. However, I am ending up in getting a segmentation fault. Before posting here, I looked into mailing list but could not get fix the issue.

I am using 23 Oct 17 version of LAMMPS and files are attached for reproducing the error.

Can anyone help me in fixing this error? Thanks in advance.
Thanks,
Karteek

co2.dat (332 Bytes)

in.lammps (1.4 KB)

mof_m_l6_l6_l6.dat (33.2 KB)

There was a recent seg fault (https://github.com/lammps/lammps/issues/751) with molecules using GCMC that was merged into master branch within the last hour:
https://github.com/lammps/lammps/pull/778

This may very well be the same issue you have. You should try to test the latest version (either pull from Github or download source from https://github.com/lammps/lammps/archive/master.zip).

Best,
Anders

Thanks Andres,

I have just tried with 17 Jan 18 just now. But still ran into same error. Do you think I should use later than this version

Thanks,
Karteek

Yes, try with the very latest. As I said, it was merged only 1 hour ago :slight_smile: So that previous link should be sufficient, or pull the latest from Github.

Let me know if it works!

Best,
Anders

Hello Andreas,

I have used latest master version. But still ran into segmentation fault.

I did few changes from the previous file to remove WARNINGS. I have attached new files for reproducing the error.

Thanks,
Karteek

co2.dat (372 Bytes)

in.lammps (1.64 KB)

mof_m_l6_l6_l6.dat (33.2 KB)

I can reproduce the error with the latest master branch (after Aidan’s gcmc fix) and I see why it happens. It might be related to the previous fix, Aidan can comment.

Karteek is using fix gcmc on all, and LAMMPS tries to delete an existing molecule 19 which has 23 atoms. q_tmp has size 3 (natoms_per_molecule), but is accessed by index > 2.

Karteek: you should try to use fix gcmc on the group co2 only, not all. If I replace your gcmc line with

fix mygcmc co2 gcmc 100 100 0 0 23482341 300.0 -8.1 0.5 mol co2 &
tfac_insert 1.5 group co2 rigid myrigidnvt

I no longer get a segfault.

I think LAMMPS should detect this and issue a warning / error?

Best,
Anders

Thanks Anders.

It works now.

Thanks,
Karteek

Aidan

This (unintentionally applying gcmc to the group all) seems to be a common mistake by users. I will change both the examples/gcmc examples to follow Anders’ suggestion and add a note on the doc page and a WARNING to the code.

At the same time, there might be cases where the user wishes to delete a charged molecule other than the exchange molecule (why?), in which case the segfault is a bug. I will fix that too. I also found another similar issue with image flags array for molecule rotation.

Aidan