Skip to content

Commit 1b82815

Browse files
committed
v13.1.0 seedStructures in CLI; fixed a potential infinite loop in xtal gen; adjusted version variable and docs; removed mol unit leftovers
1 parent 61f61df commit 1b82815

File tree

11 files changed

+61
-52
lines changed

11 files changed

+61
-52
lines changed

CMakeLists.txt

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0...3.27)
22
project(XtalOpt)
33

44
set(XtalOpt_VERSION_MAJOR 13)
5-
set(XtalOpt_VERSION_MINOR 0)
5+
set(XtalOpt_VERSION_MINOR 1)
66
set(XtalOpt_VERSION_PATCH 0)
77
set(XtalOpt_VERSION "${XtalOpt_VERSION_MAJOR}.${XtalOpt_VERSION_MINOR}")
88
set(XtalOpt_VERSION_FULL "${XtalOpt_VERSION}.${XtalOpt_VERSION_PATCH}")
@@ -62,19 +62,6 @@ option( BUILD_TESTS
6262
if(BUILD_TESTS)
6363
enable_testing()
6464

65-
option( RUN_CODE_COV
66-
"If this is true, then code coverage will be ran."
67-
ON )
68-
69-
# We will only run codecov stuff on gcc
70-
if(CMAKE_COMPILER_IS_GNUCXX AND RUN_CODE_COV)
71-
string(CONCAT CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -g -O0 "
72-
"-fprofile-arcs -ftest-coverage")
73-
string(CONCAT CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -g -O0 "
74-
"-fprofile-arcs -ftest-coverage")
75-
string(CONCAT CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} "
76-
"-fprofile-arcs -ftest-coverage")
77-
endif(CMAKE_COMPILER_IS_GNUCXX AND RUN_CODE_COV)
7865
endif(BUILD_TESTS)
7966

8067
option( ENABLE_SSH

ChangeLog

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
==================================
3-
========== Release 13.0 ==========
3+
========== Release 13 ==========
44
==================================
55

66
===== 0) Highlights
@@ -9,6 +9,7 @@
99
0-3) "Scaled volume" option is added for initiating the minimum and maximum limits of volume per FU
1010
0-4) AFLOW-ML entries are removed from CLI and GUI input (it's now a multi-objective objective)
1111
0-5) The "old molecular unit" is removed (no ENABLE_MOLECULAR cmake flag and RDKit/Boost dependencies anymore)
12+
0-6) Adding seed structures in the CLI mode is supported.
1213

1314
===== 1) New features, options, outputs, etc.
1415
1-1) XtalOpt CLI:
@@ -17,8 +18,10 @@
1718
- "localQueue" flag for running code locally on a cluster is added for all remote queue types in CLI
1819
- "softExit" and "hardExit" flags are added for quitting the code in CLI mode
1920
- Support for "hyphen-separated list of space group numbers" in the CLI input file is added
21+
- "seedStructures" flag for space-separated list of full path to seed structures is added
2022
## Output file:
2123
- The "opt_step_#" for optimization step is added to "In progress" status in results.txt file
24+
- Extra Column of "INDX" with the structure index is added to the results.txt file
2225
1-2) XtalOpt GUI:
2326
- "Multiobjective Search" tab is added to GUI, and AFLOW-ML entries are removed from "Search Settings" tab
2427
- "Plot" tab includes the objective entries in x and y labels, and labeling symbol list
@@ -38,6 +41,7 @@
3841
2-2) Fixed the issue of the "Hide" button of the GUI which did nothing or crashed the code on some OS
3942
2-3) A potential issue fixed: existence of POTCAR/PSF files was not checked when run started
4043
2-4) A potential issue fixed: jobs could fail because of a timing issue in checking the queue
44+
2-5) A potential infinite loop in checking suitability of structures for VASP fixed.
4145

4246
===== 3) Technical and code changes
4347
3-1) The remote queues and their use of SSH is re-written
@@ -48,6 +52,7 @@
4852
fileName->Locpath; filePath->locWorkDir; rempath->remWorkDir
4953
Some output patterns in *.state files are changed too.
5054
so, runs performed with older versions can't be resumed unless the *.state files are adjusted.
55+
3-6) CMake definition for string variable "XTALOPT_VER" added; to use anywhere inside the code.
5156

5257
===== 4) Documentation
5358
4-1) XtalOpt repo (https://github.com/xtalopt/XtalOpt):
@@ -69,7 +74,7 @@ so, runs performed with older versions can't be resumed unless the *.state files
6974

7075

7176
==================================
72-
========== Release 12.0 ==========
77+
========== Release 12 ==========
7378
==================================
7479

7580
===== 1) New features, options, outputs, etc.
@@ -85,7 +90,7 @@ so, runs performed with older versions can't be resumed unless the *.state files
8590

8691

8792
==================================
88-
========== Release 11.0 ==========
93+
========== Release 11 ==========
8994
==================================
9095

9196
===== 1) New features, options, outputs, etc.
@@ -101,7 +106,7 @@ so, runs performed with older versions can't be resumed unless the *.state files
101106

102107

103108
==================================
104-
========== Release 10.0 ==========
109+
========== Release 10 ==========
105110
==================================
106111

107112
===== 1) New features, options, outputs, etc.
@@ -112,7 +117,7 @@ so, runs performed with older versions can't be resumed unless the *.state files
112117

113118

114119
==================================
115-
========== Release 9 ==========
120+
========== Release 9 ==========
116121
==================================
117122

118123
===== 1) Enhancements / New features:
@@ -150,7 +155,7 @@ by replicating a unit cell to create a supercell for constructing the starting s
150155

151156

152157
==================================
153-
========== Release 8 ==========
158+
========== Release 8 ==========
154159
==================================
155160

156161
===== 1) Enhancements / New features:
@@ -163,7 +168,7 @@ by replicating a unit cell to create a supercell for constructing the starting s
163168

164169

165170
==================================
166-
========== Release 7 ==========
171+
========== Release 7 ==========
167172
==================================
168173

169174
===== 1) Enhancements / New features:
@@ -182,7 +187,7 @@ by replicating a unit cell to create a supercell for constructing the starting s
182187

183188

184189
==================================
185-
========== Release 6 ==========
190+
========== Release 6 ==========
186191
==================================
187192

188193
===== 1) Enhancements / New features:

docs/doxy-api.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = "GlobalSearch API"
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = "Release 13.0"
51+
PROJECT_NUMBER = "Version 13.1"
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewer a

docs/doxy-guide.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PROJECT_NAME = "XtalOpt User Guide"
4848
# could be handy for archiving the generated documentation or if some version
4949
# control system is used.
5050

51-
PROJECT_NUMBER = "Release 13.0"
51+
PROJECT_NUMBER = "Version 13.1"
5252

5353
# Using the PROJECT_BRIEF tag one can provide an optional one line description
5454
# for a project that appears at the top of each page and should give viewer a

docs/guide/tutorial.dox

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ the user should provide the following information to the XtalOpt code:
10461046

10471047
- <b>optimization type:</b> instruction for the code on how to use the result
10481048
of an objective calculation in determining the fitness function.
1049-
XtalOpt can minimize or maximize a feature, maximize the AFLOW-ML hardness,
1049+
XtalOpt can minimize or maximize an objective, maximize the AFLOW-ML hardness,
10501050
or use the results of objective calculations for filtering the parents' pool.
10511051
- <b>path to the user-defined script:</b> the full path to the script corresponding to
10521052
the introduced objective. The script will be automatically run by the XtalOpt
@@ -1134,9 +1134,9 @@ can be entered in the corresponding fields by:
11341134
-# choosing the optimization type for the objective from a drop-down menu,
11351135
i.e., "Minimization", "Maximization", "Filtration" (see \ref moes-fil), and
11361136
"Hardness" (see \ref moes-har),
1137+
-# entering or setting the weight, and
11371138
-# entering the full path to the external code (or script) that calcualtes the objective,
11381139
-# entering the output file name that the external code generates with the objective value,
1139-
-# entering or setting the weight, and
11401140
-# specifying whether a structure discarded by a filtration feature requires further handling or not
11411141
(see \ref moes-fil for more details).
11421142

@@ -1488,13 +1488,22 @@ and other options may be changed. In addition, if Avogadro2 is open in the
14881488
background and an Avogadro2 RPC server is running, XtalOpt will still also set
14891489
the structure in the Avogadro2 view to the crystals the user selects.
14901490

1491+
As of XtalOpt version 13, the user can add seed structures in the CLI
1492+
mode as well. This can be done by introducing a "space separated" list of
1493+
full path to the seed structures through the following flag in the XtalOpt input
1494+
file:
1495+
<BR>
1496+
\code
1497+
seedStructures = [path/seed1] [path/seed2] ...
1498+
\endcode
1499+
14911500
\subsection moes-cli Multiobjective Runs in the XtalOpt CLI
14921501

14931502
In XtalOpt version 13.0, the multiobjective functionality is implemented,
14941503
as discussed previously in \ref moes section. In order to invoke the multiobjective
1495-
functionality in the CLI mode, for each user-defined feature a line should be added
1496-
to the XtalOpt input file that starts with the keyword features. This line, includes
1497-
the above-mentioned information for the feature and, generally, has the following format:
1504+
functionality in the CLI mode, for each user-defined objective a line should be added
1505+
to the XtalOpt input file that starts with the keyword "objective". This line, includes
1506+
the above-mentioned information for the objective and, generally, has the following format:
14981507
<BR>
14991508
\code
15001509
objective = "optimization_type" "/path_to/script" "script_output_filename" "weight"
@@ -1507,12 +1516,12 @@ It should be noted that in the CLI mode of XtalOpt:
15071516
and only the first three letters are important in identifying the optimization type
15081517
by XtalOpt (i.e., "min", "max", "har", and "fil").
15091518
- Providing the "script output filename" is optional. If this is not specified,
1510-
the default will be "objective#.out" in which "#" is the number of the feature in the
1511-
order that it appears in the XtalOpt input file (excluding the "hardness" feature),
1519+
the default will be "objective#.out" in which "#" is the number of the objective in the
1520+
order that it appears in the XtalOpt input file (excluding the "hardness" objective),
15121521
e.g., "objective1.out", "objective2.out", etc.
1513-
- Specifying the "weight" for the feature is optional, as well. If this field is not
1514-
given for a number of features, it will be determined via the following formula.
1515-
If any weight is provided for any of the features, it will be subtracted from 1.0 and
1522+
- Specifying the "weight" for the objective is optional, as well. If this field is not
1523+
given for a number of objectives, it will be determined via the following formula.
1524+
If any weight is provided for any of the objectives, it will be subtracted from 1.0 and
15161525
the remaining value will be divided between the enthalpy and objectives that don't have
15171526
a specified weight.
15181527

src/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# String version variable "XTALOPT_VER" for the use anywhere inside the source code
2+
add_definitions(-DXTALOPT_VER="${XtalOpt_VERSION_MAJOR}.${XtalOpt_VERSION_MINOR}")
3+
14
add_subdirectory(globalsearch)
25

36
if (ENABLE_EXAMPLESEARCH)

src/globalsearch/optbase.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,6 @@ class OptBase : public QObject
483483
*/
484484
void setUsingGUI(bool b) { m_usingGUI = b; }
485485

486-
/**
487-
* Old molecular unit is removed; so always return false for this function
488-
*/
489-
bool molecularMode() { return false; }
490-
491-
492486
/**
493487
* Set the refresh interval for checking remote jobs.
494488
*

src/xtalopt/cliOptions.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ static const QStringList keywords = { "volumeScaleMin",
4141
"softExit",
4242
"hardExit",
4343
"localQueue",
44+
"seedStructures",
4445
"empiricalFormula",
4546
"formulaUnits",
4647
"aMin",
@@ -156,7 +157,7 @@ QString XtalOptCLIOptions::xtaloptHeaderString()
156157
{
157158
QString out = QString("\n====================================================\n")
158159
+ QString(" XtalOpt Multi-Objective Evolutionary Algorithm \n")
159-
+ QString("\n Version %1.%2").arg(XTALOPT_VER_MAJOR).arg(XTALOPT_VER_MINOR)
160+
+ QString("\n Version %1").arg(XTALOPT_VER)
160161
+ QString("\n Zurek Group, University at Buffalo")
161162
+ QString("\n====================================================\n\n");
162163
return out;
@@ -350,6 +351,12 @@ bool XtalOptCLIOptions::processOptions(const QHash<QString, QString>& options,
350351
if (xtalopt.formulaUnitsList.isEmpty())
351352
xtalopt.formulaUnitsList = { 1 };
352353

354+
// Seed structures
355+
QStringList sl = options.value("seedStructures", "").split(QRegExp("\\s+"), QString::SkipEmptyParts);
356+
for (int i = 0; i < sl.size(); i++) {
357+
xtalopt.seedList.append(sl.at(i));
358+
}
359+
353360
// We put default values in all of these
354361
// Initialization settings
355362
xtalopt.a_min = options.value("aMin", "3.0").toFloat();
@@ -376,8 +383,8 @@ bool XtalOptCLIOptions::processOptions(const QHash<QString, QString>& options,
376383
xtalopt.vol_min, xtalopt.vol_max);
377384
}
378385

386+
// Check for fixed volume
379387
if (fabs(xtalopt.vol_min - xtalopt.vol_max) < ZERO5) {
380-
// Check for fixed volume
381388
xtalopt.using_fixed_volume = true;
382389
xtalopt.vol_fixed = xtalopt.vol_min;
383390
} else {

src/xtalopt/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int main(int argc, char* argv[])
6666
QCoreApplication::setOrganizationName("XtalOpt");
6767
QCoreApplication::setOrganizationDomain("xtalopt.github.io");
6868
QCoreApplication::setApplicationName("XtalOpt");
69-
QCoreApplication::setApplicationVersion(QString("%1.%2").arg(XTALOPT_VER_MAJOR).arg(XTALOPT_VER_MINOR));
69+
QCoreApplication::setApplicationVersion(XTALOPT_VER);
7070

7171
QCommandLineParser parser;
7272
parser.setApplicationDescription("XtalOpt: an open-source multi-objective "

src/xtalopt/xtalopt.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ bool XtalOpt::startSearch()
150150
}
151151

152152
// Do we have a composition?
153-
if (!molecularMode() && comp.isEmpty()) {
153+
if (comp.isEmpty()) {
154154
error("Cannot create structures. Composition is not set.");
155155
return false;
156156
}
@@ -269,7 +269,7 @@ bool XtalOpt::startSearch()
269269
}
270270

271271
// Perform a regular random generation
272-
if (!using_randSpg || molecularMode()) {
272+
if (!using_randSpg) {
273273
// Generation loop...
274274
while (newXtalCount < numInitial) {
275275
updateProgressBar(numInitial, newXtalCount + failed, newXtalCount);
@@ -1404,7 +1404,14 @@ Xtal* XtalOpt::randSpgXtal(uint generation, uint id, uint FU, uint spg,
14041404
Xtal* XtalOpt::generateEmptyXtalWithLattice(uint FU)
14051405
{
14061406
Xtal* xtal = nullptr;
1407+
int maxAttempts = 10000;
1408+
int attemptCount = 0;
14071409
do {
1410+
if (attemptCount >= maxAttempts) {
1411+
qDebug() << "Failed too many times in generateEmptyXtalWithLattice. Giving up";
1412+
return nullptr;
1413+
}
1414+
++attemptCount;
14081415
delete xtal;
14091416
xtal = nullptr;
14101417
double a = getRandDouble() * (a_max - a_min) + a_min;
@@ -1874,7 +1881,7 @@ void XtalOpt::printSubXtal(Xtal* xtal, uint generation, uint id)
18741881
Xtal* XtalOpt::generateRandomXtal(uint generation, uint id)
18751882
{
18761883
QList<uint> tempFormulaUnitsList = formulaUnitsList;
1877-
if (!molecularMode() && using_mitotic_growth && !using_one_pool) {
1884+
if (using_mitotic_growth && !using_one_pool) {
18781885
// Remove formula units on the list for which there is a smaller multiple
18791886
// that may be used to create a super cell.
18801887
for (int i = 0; i < tempFormulaUnitsList.size(); i++) {
@@ -3122,7 +3129,7 @@ bool XtalOpt::checkXtal(Xtal* xtal, QString* err)
31223129
return false;
31233130
}
31243131

3125-
if (!molecularMode() && !checkComposition(xtal, err))
3132+
if (!checkComposition(xtal, err))
31263133
return false;
31273134

31283135
if (!checkLattice(xtal, xtal->getFormulaUnits(), err))
@@ -3149,7 +3156,7 @@ bool XtalOpt::checkXtal(Xtal* xtal, QString* err)
31493156
}
31503157

31513158
// Check interatomic distances
3152-
if (using_interatomicDistanceLimit && !molecularMode()) {
3159+
if (using_interatomicDistanceLimit) {
31533160
int atom1, atom2;
31543161
double IAD;
31553162
if (!xtal->checkInteratomicDistances(this->comp, &atom1, &atom2, &IAD)) {
@@ -3167,7 +3174,7 @@ bool XtalOpt::checkXtal(Xtal* xtal, QString* err)
31673174
}
31683175
}
31693176

3170-
if (using_customIAD && !molecularMode()) {
3177+
if (using_customIAD) {
31713178
int atom1, atom2;
31723179
double IAD;
31733180
if (!xtal->checkMinIAD(this->interComp, &atom1, &atom2, &IAD)) {

src/xtalopt/xtalopt.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
#include <memory>
2525
#include <mutex>
2626

27-
#define XTALOPT_VER_MAJOR 13
28-
#define XTALOPT_VER_MINOR 0
29-
3027
// Forward declarations...
3128
struct latticeStruct;
3229

0 commit comments

Comments
 (0)