Skip to content

Commit 16421d9

Browse files
committed
Merge remote-tracking branch 'origin/devel'
Merging from 2023.5.0.dev into 2023.5.0 for the release
2 parents 5412f1c + 1e9a6b9 commit 16421d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+4614
-423
lines changed

corelib/src/libs/SireIO/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ set ( SIREIO_HEADERS
4848
netcdffile.h
4949
pdb.h
5050
pdb2.h
51+
pdbx.h
5152
perturbationslibrary.h
5253
protoms.h
5354
sdf.h
@@ -95,6 +96,7 @@ set ( SIREIO_SOURCES
9596
netcdffile.cpp
9697
pdb.cpp
9798
pdb2.cpp
99+
pdbx.cpp
98100
perturbationslibrary.cpp
99101
protoms.cpp
100102
sdf.cpp

corelib/src/libs/SireIO/mol2.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -2380,6 +2380,9 @@ void Mol2::addToSystem(System &system, const PropertyMap &map) const
23802380
// you should loop through each molecule in the system and work out
23812381
// which ones are described in the file, and then add data from the file
23822382
// to thise molecules.
2383+
throw SireError::unsupported(QObject::tr(
2384+
"You cannot add data from a mol2 file to an existing system!"),
2385+
CODELOC);
23832386
}
23842387

23852388
/** Internal function used to get the molecule structure for molecule 'imol'. */

corelib/src/libs/SireIO/moleculeparser.cpp

+53-34
Original file line numberDiff line numberDiff line change
@@ -1929,8 +1929,19 @@ MoleculeParserPtr MoleculeParser::parse(const System &system, const QString &for
19291929
cannot be recognised, or if there is an error in parsing. */
19301930
MoleculeParserPtr MoleculeParser::parse(const QString &filename, const PropertyMap &map)
19311931
{
1932-
MoleculeParserPtr parser = MoleculeParser::_pvt_parse(filename, map);
1933-
getFileCache()->clear();
1932+
MoleculeParserPtr parser;
1933+
1934+
try
1935+
{
1936+
parser = MoleculeParser::_pvt_parse(filename, map);
1937+
getFileCache()->clear();
1938+
}
1939+
catch (...)
1940+
{
1941+
getFileCache()->clear();
1942+
throw;
1943+
}
1944+
19341945
return parser;
19351946
}
19361947

@@ -1939,48 +1950,56 @@ QList<MoleculeParserPtr> MoleculeParser::parse(const QStringList &filenames, con
19391950
{
19401951
QList<MoleculeParserPtr> result;
19411952

1942-
if (filenames.count() == 1)
1943-
{
1944-
result.append(MoleculeParser::_pvt_parse(filenames[0], map));
1945-
}
1946-
else
1953+
try
19471954
{
1948-
QVector<MoleculeParserPtr> parsers(filenames.count());
1949-
1950-
bool run_parallel = true;
1951-
1952-
if (map["parallel"].hasValue())
1955+
if (filenames.count() == 1)
19531956
{
1954-
run_parallel = map["parallel"].value().asA<BooleanProperty>().value();
1955-
}
1956-
1957-
if (run_parallel)
1958-
{
1959-
// parse the files in parallel - we use a grain size of 1
1960-
// as each file can be pretty big, and there won't be many of them
1961-
tbb::parallel_for(
1962-
tbb::blocked_range<int>(0, filenames.count(), 1),
1963-
[&](tbb::blocked_range<int> r)
1964-
{
1965-
for (int i = r.begin(); i < r.end(); ++i)
1966-
{
1967-
parsers[i] = MoleculeParser::_pvt_parse(filenames[i], map);
1968-
}
1969-
},
1970-
tbb::simple_partitioner());
1957+
result.append(MoleculeParser::_pvt_parse(filenames[0], map));
19711958
}
19721959
else
19731960
{
1974-
for (int i = 0; i < filenames.count(); ++i)
1961+
QVector<MoleculeParserPtr> parsers(filenames.count());
1962+
1963+
bool run_parallel = true;
1964+
1965+
if (map["parallel"].hasValue())
1966+
{
1967+
run_parallel = map["parallel"].value().asA<BooleanProperty>().value();
1968+
}
1969+
1970+
if (run_parallel)
19751971
{
1976-
parsers[i] = MoleculeParser::_pvt_parse(filenames[i], map);
1972+
// parse the files in parallel - we use a grain size of 1
1973+
// as each file can be pretty big, and there won't be many of them
1974+
tbb::parallel_for(
1975+
tbb::blocked_range<int>(0, filenames.count(), 1),
1976+
[&](tbb::blocked_range<int> r)
1977+
{
1978+
for (int i = r.begin(); i < r.end(); ++i)
1979+
{
1980+
parsers[i] = MoleculeParser::_pvt_parse(filenames[i], map);
1981+
}
1982+
},
1983+
tbb::simple_partitioner());
19771984
}
1985+
else
1986+
{
1987+
for (int i = 0; i < filenames.count(); ++i)
1988+
{
1989+
parsers[i] = MoleculeParser::_pvt_parse(filenames[i], map);
1990+
}
1991+
}
1992+
1993+
result = parsers.toList();
19781994
}
19791995

1980-
result = parsers.toList();
1996+
getFileCache()->clear();
1997+
}
1998+
catch (...)
1999+
{
2000+
getFileCache()->clear();
2001+
throw;
19812002
}
1982-
1983-
getFileCache()->clear();
19842003

19852004
return result;
19862005
}

0 commit comments

Comments
 (0)