CompPhysVienna / n2p2

n2p2 - A Neural Network Potential Package
https://compphysvienna.github.io/n2p2/
GNU General Public License v3.0
217 stars 82 forks source link

error from nnp-scaling due to the size of input.data #146

Closed JJiang-Amoy closed 2 years ago

JJiang-Amoy commented 2 years ago

Hi, I was trying to run nnp-scaling for my system, which contains 4M lines in input.data, about 40K configurations, and the error came up with "terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 0) >= this->size() (which is 0) [c3712:4053200] Process received signal [c3712:4053200] Signal: Aborted (6) [c3712:4053200] Signal code: (-6) [c3712:4053200] [ 0] /lib64/libpthread.so.0(+0x12b20)[0x14f93126ab20] [c3712:4053200] [ 1] /lib64/libc.so.6(gsignal+0x10f)[0x14f93005337f] [c3712:4053200] [ 2] /lib64/libc.so.6(abort+0x127)[0x14f93003ddb5] [c3712:4053200] [ 3] /lib64/libstdc++.so.6(+0x9009b)[0x14f93068909b] [c3712:4053200] [ 4] /lib64/libstdc++.so.6(+0x9653c)[0x14f93068f53c] [c3712:4053200] [ 5] /lib64/libstdc++.so.6(+0x96597)[0x14f93068f597] [c3712:4053200] [ 6] /lib64/libstdc++.so.6(+0x967f8)[0x14f93068f7f8] [c3712:4053200] [ 7] /lib64/libstdc++.so.6(+0x92071)[0x14f93068b071]"

It worked when I down-scaled to 100K lines, 1000 structures.

Is there anything I miss to make it work?

module load compiler/intel/19 GSL/2.6 eigen/3.4 openmpi/4.0 intel-mkl/19 for compiling N2P2

JJiang-Amoy commented 2 years ago

Because of reading empty line in input.data src/libnnptrain/Dataset.cpp: size_t Dataset::getNumStructures(ifstream& dataFile) { size_t count = 0; string line; vector splitLine;

while (getline(dataFile, line))
{
    splitLine = split(reduce(line));
    if (splitLine.at(0) == "begin") count++;             <------ reason
}

return count;

}