|
2 | 2 | This is an example to perform CSP based on the reference crystal. |
3 | 3 | The structures with good matches will be output to *-matched.cif. |
4 | 4 | """ |
5 | | -import warnings |
6 | | -warnings.filterwarnings("ignore", category=UserWarning, module='torchani.aev') |
7 | 5 | from pyxtal.optimize import WFS, DFS, QRS |
8 | 6 | from pyxtal.representation import representation |
| 7 | +from pyxtal.molecule import pyxtal_molecule |
9 | 8 | import argparse |
10 | 9 | import os |
11 | 10 |
|
|
19 | 18 | help="cpu number, default: 1") |
20 | 19 | parser.add_argument("-a", "--algo", dest="algo", default='WFS', |
21 | 20 | help="algorithm, default: WFS") |
| 21 | + parser.add_argument("--preopt", dest='preopt', action='store_true', |
| 22 | + help="preoptimize the lattice and rotation") |
| 23 | + |
22 | 24 | options = parser.parse_args() |
23 | 25 | smiles, sg, wdir = "CC(=O)OC1=CC=CC=C1C(=O)O", [14], "aspirin-simple" |
24 | 26 | # Reconstruct the reference structure |
25 | 27 | x = "81 11.38 6.48 11.24 96.9 1 0 0.23 0.43 0.03 -44.6 25.0 34.4 -76.6 -5.2 171.5 0" |
26 | 28 | rep = representation.from_string(x, [smiles]) |
27 | 29 | xtal = rep.to_pyxtal() |
28 | 30 | pmg = xtal.to_pymatgen() |
29 | | - |
30 | | - # Check if use_mpi is invoked |
31 | | - use_mpi = "OMPI_COMM_WORLD_SIZE" in os.environ or "SLURM_MPI_TYPE" in os.environ |
| 31 | + m1 = pyxtal_molecule('CC(=O)OC1=CC=CC=C1C(=O)O.smi', active_sites=[[11], [12], [20]]) |
32 | 32 |
|
33 | 33 | # Sampling |
34 | 34 | fun = globals().get(options.algo) |
|
40 | 40 | N_pop = options.pop, |
41 | 41 | N_cpu = options.ncpu, |
42 | 42 | ff_style = 'gaff', |
43 | | - use_mpi = use_mpi) |
| 43 | + molecules = [[m1]] if options.preopt else None, |
| 44 | + pre_opt = options.preopt) |
44 | 45 |
|
45 | 46 | go.run(ref_pmg=pmg) |
46 | 47 | go.print_matches(header='Ref_match') |
|
0 commit comments