3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

RadonPy環境構築

3
Posted at

OS: Ubuntu 20.04.6 LTS
CPU: Intel(R) Xeon(R) W-3245 CPU @ 3.20GHz

以下の要領でRadonPyを導入しました。
チュートリアルはエラーなしで終了できました。

①
mamba create -n radonpy python=3.11

②
mamba activate radonpy

③
mamba install -c conda-forge/label/libint_dev -c conda-forge -c psi4 "numpy<2" "pydantic<2" psi4=1.8 resp dftd3-python rdkit mdtraj matplotlib lammps

④
pip install --no-deps radonpy-pypi

ポリスチレンの計算を行いました。
公式チュートリアルとほぼ同じですが、なかなか収束しなかったので1鎖あたりの原子数を1000まで上げました。

main.py
from radonpy.core import utils, poly
from radonpy.ff.gaff2_mod import GAFF2_mod
from radonpy.sim import qm
from radonpy.sim.preset import eq, tc
smiles = '*C(C*)c1ccccc1'
ter_smiles = '*C'
temp = 300
press = 1.0
omp_psi4 = 16
mpi = 16
omp = 1
gpu = 0
mem = 10000
work_dir = './work_dir'
ff = GAFF2_mod()
if __name__ == '__main__':
    # Conformation search
    mol = utils.mol_from_smiles(smiles)
    mol, energy = qm.conformation_search(mol, ff =ff, work_dir =work_dir,
    psi4_omp =omp_psi4, mpi =mpi, omp =omp, memory=mem, log_name ='monomer1')

    # Electronic propety calculation
    qm.assign_charges(mol, charge ='RESP', opt =False, work_dir =work_dir, omp =omp_psi4, memory =mem, log_name ='monomer1')
    qm_data = qm.sp_prop(mol, opt =False, work_dir =work_dir, omp =omp_psi4, memory=mem, log_name ='monomer1')
    polar_data = qm.polarizability(mol, opt =False, work_dir =work_dir, omp =omp_psi4, memory=mem, log_name ='monomer1')

    # RESP charge calculation of a termination unit
    ter = utils.mol_from_smiles(ter_smiles)
    qm.assign_charges(ter, charge ='RESP', opt =True, work_dir =work_dir, omp =omp_psi4, memory=mem, log_name ='ter1')

    # Generate polymer chain
    dp = poly.calc_n_from_num_atoms(mol, 1000, terminal1 =ter)
    homopoly = poly.polymerize_rw(mol, dp, tacticity='atactic')
    homopoly = poly.terminate_rw(homopoly, ter)

    # Force field assignment
    result = ff.ff_assign(homopoly)
    if not result:
        print('[ERROR: Can not assign force field parameters.]')

    # Generate simulation cell
    ac = poly.amorphous_cell(homopoly, 10, density=0.05)

    # Equilibration MD
    eqmd = eq.EQ21step(ac, work_dir =work_dir)
    ac = eqmd.exec(temp =temp, press=1.0, mpi =mpi, omp =omp, gpu =gpu)
    analy = eqmd.analyze()
    prop_data = analy.get_all_prop(temp =temp, press=1.0, save =True)
    result = analy.check_eq()

    # Additional equilibration MD
    for i in range(10):
        if result: break
        eqmd = eq.Additional(ac, work_dir =work_dir)
        ac = eqmd.exec(temp =temp, press =press, mpi =mpi, omp =omp, gpu =gpu)
        analy = eqmd.analyze()
        prop_data = analy.get_all_prop(temp =temp, press=press, save =True)
        result = analy.check_eq()
    if not result:
        print('[ERROR: Did not reach an equilibrium state.]')

    # Non-equilibrium MD for thermal condultivity
    else:
        nemd = tc.NEMD_MP(ac, work_dir =work_dir)
        ac = nemd.exec(decomp =True, temp =temp, mpi =mpi, omp =omp, gpu =gpu)
        nemd_analy = nemd.analyze()
        TC = nemd_analy.calc_tc(decomp =True, save =True)
        if not nemd_analy.Tgrad_data['Tgrad_check']:
            print('[ERROR: Low linearity of temperature gradient.]')

        print('Thermal conductivity: %f' % TC)
出力結果
RadonPy info: Start optimization of 3 conformers by MM level.
RadonPy info: OPENMP package is available.
RadonPy info: OPT package is available.
RadonPy info: Start optimization of 1 conformers by DFT level.
  Threads set to 16 by Python driver.

  Memory set to   9.313 GiB by Python driver.
RadonPy info: Psi4 optimization is running...
Optimizer: Optimization complete!
RadonPy info: Normal termination of psi4 optimization. Elapsed time = 0:01:04.705777
RadonPy info: Psi4 RESP charge calculation is running...
RadonPy info: Normal termination of psi4 RESP charge calculation. Elapsed time = 0:00:21.898559
RadonPy info: Psi4 single point calculation is running...
RadonPy info: Normal termination of psi4 single point calculation. Elapsed time = 0:00:10.434283
RadonPy info: Psi4 polarizability calculation (finite field) is running...
RadonPy info: Normal termination of psi4 polarizability calculation (finite field). Elapsed time = 0:01:54.611951
RadonPy info: Psi4 optimization is running...
Optimizer: Optimization complete!
RadonPy info: Normal termination of psi4 optimization. Elapsed time = 0:00:05.497977
RadonPy info: Psi4 RESP charge calculation is running...
RadonPy info: Normal termination of psi4 RESP charge calculation. Elapsed time = 0:00:01.072533
RadonPy info: Start polymerize_rw.
RadonPy info: Start terminate_rw.
RadonPy info: Start amorphous cell generation.
RadonPy info: Packing simulation (eq1) by LAMMPS is running...
RadonPy info: Complete packing simulation (eq1). Elapsed time = 0:20:57.114959
RadonPy info: Larsen's 21 step compression/decompression equilibration (eq2) by LAMMPS is running...
RadonPy info: Complete Larsen 21 step compression/decompression equilibration (eq2). Elapsed time = 6:14:26.812667
RadonPy info: Sampling simulation (eq3) by LAMMPS is running...
RadonPy info: Complete sampling simulation (eq3). Elapsed time = 9:53:11.216833
RadonPy info: Thermal conductive simulation (kinetic energy exchanging NEMD) by LAMMPS is running...
RadonPy info: Complete thermal conductive simulation (kinetic energy exchanging NEMD). Elapsed time = 1 day, 7:14:52.966120
Thermal conductivity: 0.197177
Done.

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?