Author Topic: how to use COSMO solvent in 1D systems?  (Read 3039 times)

0 Members and 1 Guest are viewing this topic.

Offline karolina

  • New QuantumATK user
  • *
  • Posts: 3
  • Country: es
  • Reputation: 0
    • View Profile
how to use COSMO solvent in 1D systems?
« on: April 10, 2024, 17:34 »
Hi,

I am struggling with adding COSMO solvent to 1D system. I modified the 'COSMO for slab' template available in ATK-V-2023.12 version's workflows templates for my system. My system is periodic in X-direction. I added an additional vacuum in Y- and Z- directions making sure  that there won't be any interactions between images. Unfortunately calculations in V-2023.12-SP1 version crash with the following error:

Traceback (most recent call last):
  File "/u/rscratch/kzm21/codes/QuantumWise/quantumatk/V-2023.12-SP1/atkpython/bin/atkpython", line 8, in <module>
    sys.exit(__run_atkpython())
             ^^^^^^^^^^^^^^^^^
  File "zipdir/ATKExecutables/atkwrappers/__init__.py", line 783, in __run_atkpython
  File "PFON_solvent_dft_UP_corr.py", line 407, in <module>
    pfon_dft_sp_opt.update()
  File "zipdir/NL/CommonConcepts/Configurations/AtomicConfiguration.py", line 3080, in update
  File "zipdir/NL/Calculators/Interfaces/BulkCalculatorInterface.py", line 167, in _update
  File "zipdir/NL/Calculators/Interfaces/BulkCalculatorInterface.py", line 224, in _performUpdate
  File "zipdir/NL/Calculators/DensityFunctionalTheory/LCAOCalculator/LCAOCalculator.py", line 1086, in scfLoop
  File "zipdir/NL/Calculators/DensityFunctionalTheory/LCAOCalculator/SCFLoop.py", line 676, in scfLoopHamiltonian
  File "zipdir/NL/ComputerScienceUtilities/Flowchart.py", line 685, in execute
  File "zipdir/NL/ComputerScienceUtilities/Flowchart.py", line 671, in executeBlock
  File "zipdir/NL/Calculators/DensityFunctionalTheory/LCAOCalculator/Blocks/CosmoSolvationModel.py", line 47, in beforeFirstExecute
  File "zipdir/NL/Calculators/DensityFunctionalTheory/LCAOCalculator/SolvationModel/CosmoFundamentalEquation.py", line 137, in __init__
  File "zipdir/NL/Calculators/DensityFunctionalTheory/LCAOCalculator/SolvationModel/CosmoSolventSurface.py", line 642, in constructSurface
  File "zipdir/NL/Calculators/DensityFunctionalTheory/LCAOCalculator/SolvationModel/CosmoSolventSurface.py", line 1039, in _mapBasisToCosmoGrid
  File "zipdir/NL/CommonConcepts/PhysicalQuantity.py", line 437, in __new__
AttributeError: 'list' object has no attribute 'unit'


Does anyone have idea how to fix that/add properly COSMO solvation model to 1D system?

This is my input:

# %% PFON_dft_SP_opt

# Set up lattice
vector_a = [8.49393, 0.0, 0.0]*Angstrom
vector_b = [0.0, 100.0, 0.0]*Angstrom
vector_c = [0.0, 0.0, 100.0]*Angstrom
lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
elements = [Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Hydrogen, Hydrogen,
            Hydrogen, Carbon, Carbon, Carbon, Carbon, Carbon, Carbon, Hydrogen,
            Hydrogen, Hydrogen, Hydrogen, Carbon, Hydrogen, Hydrogen, Carbon,
            Hydrogen, Hydrogen, Carbon, Hydrogen, Hydrogen, Carbon, Hydrogen,
            Hydrogen, Carbon, Hydrogen, Hydrogen, Carbon, Hydrogen, Hydrogen,
            Carbon, Hydrogen, Hydrogen, Carbon, Hydrogen, Hydrogen, Hydrogen,
            Carbon, Hydrogen, Hydrogen, Carbon, Hydrogen, Hydrogen, Carbon,
            Hydrogen, Hydrogen, Carbon, Hydrogen, Hydrogen, Carbon, Hydrogen,
            Hydrogen, Carbon, Hydrogen, Hydrogen, Carbon, Hydrogen, Hydrogen,
            Carbon, Hydrogen, Hydrogen, Carbon]

# Define coordinates
fractional_coordinates = [[ 0.483852701046,  0.119636242633,  0.10307053107 ],
                          [ 0.626307579003,  0.129516959822,  0.103117489046],
                          [ 0.56882264541 ,  0.142780927709,  0.102392674738],
                          [ 0.667873550708,  0.153678983126,  0.099638993485],
                          [ 0.829389475263,  0.15130457815 ,  0.098914078206],
                          [ 0.791275136104,  0.127511455289,  0.103899709013],
                          [ 0.619339472103,  0.163719720939,  0.097740247574],
                          [ 0.907420249346,  0.159494676852,  0.095829139155],
                          [ 0.840492497578,  0.117543598606,  0.106076276456],
                          [ 0.137872314815,  0.151290334352,  0.107526877178],
                          [ 0.077934105328,  0.138569696117,  0.104999404482],
                          [ 0.175965815584,  0.127481990737,  0.102554893925],
                          [ 0.340966962957,  0.129480732912,  0.103329581382],
                          [ 0.398340538247,  0.142760121151,  0.104048881045],
                          [ 0.29936783279 ,  0.153660843147,  0.106795091046],
                          [ 0.059813620566,  0.159485908572,  0.110590317534],
                          [ 0.126628876245,  0.117522513102,  0.100357003415],
                          [ 0.34796366517 ,  0.163704261185,  0.108667061082],
                          [-0.024823133934,  0.039440720236,  0.169810889627],
                          [-0.020925643797,  0.044243926523,  0.159812428013],
                          [-0.139219516463,  0.048518080954,  0.157777544939],
                          [ 0.000867835392,  0.036280279061,  0.152293947051],
                          [ 0.107453473185,  0.055137217166,  0.159190044084],
                          [ 0.223958664493,  0.050615187103,  0.161538886759],
                          [ 0.084978427468,  0.062722856234,  0.167108666019],
                          [ 0.115921563714,  0.062200108258,  0.145476096404],
                          [-0.001069747721,  0.066679165383,  0.143171096619],
                          [ 0.138389172062,  0.054637246355,  0.1375224722  ],
                          [ 0.243292642395,  0.073213685504,  0.144782927838],
                          [ 0.361352803016,  0.068671434547,  0.146471536072],
                          [ 0.224613422524,  0.080452651366,  0.153097033436],
                          [ 0.242725299815,  0.080840487397,  0.13134564222 ],
                          [ 0.124591664786,  0.085439441256,  0.129842612033],
                          [ 0.258678418908,  0.073594037126,  0.122993135075],
                          [ 0.369889319108,  0.091848562291,  0.130315722375],
                          [ 0.488767110434,  0.087218664903,  0.131121248691],
                          [ 0.358668028787,  0.098792038172,  0.138968585291],
                          [ 0.358393424818,  0.099937900458,  0.117163378208],
                          [ 0.24055780469 ,  0.104739428259,  0.116691341189],
                          [ 0.365371133557,  0.092905440016,  0.108565709313],
                          [ 0.487714375094,  0.110742132705,  0.115947791511],
                          [ 0.604943677477,  0.105832966038,  0.116548599603],
                          [ 0.4808447953  ,  0.1175819344  ,  0.12469697221 ],
                          [ 1.025386268399,  0.046804194892,  0.030189110373],
                          [ 1.034465763821,  0.052377300824,  0.039755337662],
                          [ 1.139219516463,  0.058992679427,  0.039106200887],
                          [ 1.056626413198,  0.044987214425,  0.047830424666],
                          [ 0.883778806144,  0.060527301844,  0.042541184039],
                          [ 0.780498222033,  0.053680572071,  0.042781207652],
                          [ 0.86269145579 ,  0.067584860681,  0.034122444356],
                          [ 0.891633608498,  0.068453885168,  0.05578137744 ],
                          [ 0.995622048808,  0.075237873461,  0.055534736592],
                          [ 0.912275545135,  0.061379976491,  0.064207384102],
                          [ 0.741949915245,  0.076755788806,  0.058616320836],
                          [ 0.637784438396,  0.069996059008,  0.058910537137],
                          [ 0.721481203945,  0.083791299193,  0.050157938645],
                          [ 0.751539754811,  0.084755478467,  0.071800596914],
                          [ 0.85826984398 ,  0.09122344284 ,  0.071576355819],
                          [ 0.768273727959,  0.077708961879,  0.080310438722],
                          [ 0.605605776864,  0.093578324883,  0.074451106147],
                          [ 0.498236051722,  0.08719778431 ,  0.074853695518],
                          [ 0.588683842635,  0.100542348268,  0.065879427161],
                          [ 0.6202843238  ,  0.101736447894,  0.087512469367],
                          [ 0.731605273666,  0.107553132139,  0.087170305935],
                          [ 0.630670319916,  0.094688160725,  0.096075106203],
                          [ 0.481174575507,  0.111439186983,  0.089735997374],
                          [ 0.368600194391,  0.10578612029 ,  0.089260401918],
                          [ 0.477334690635,  0.118748072444,  0.08136160612 ],
                          [ 0.895725710806,  0.138615586328,  0.102302952886]]

# Set up configuration
pfon_dft_sp_opt = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates
    )

# Add tags
pfon_dft_sp_opt.addTags('C_chain', [19, 22, 25, 28, 31, 34, 37, 40, 44, 47, 50, 53, 56,
                                    59, 62, 65])
pfon_dft_sp_opt.addTags('C_ring',  [0, 1, 2, 3, 4, 5, 9, 10, 11, 12, 13, 14, 68])

# Add bonds
bonds = [[ 0,  1],
         [ 0, 12],
         [ 0, 40],
         [ 0, 65],
         [ 1,  2],
         [ 1,  5],
         [ 2,  3],
         [ 2, 13],
         [ 3,  4],
         [ 3,  6],
         [ 4,  7],
         [ 4, 68],
         [ 5,  8],
         [ 5, 68],
         [ 9, 10],
         [ 9, 14],
         [ 9, 15],
         [10, 11],
         [10, 68],
         [11, 12],
         [11, 16],
         [12, 13],
         [13, 14],
         [14, 17],
         [18, 19],
         [19, 20],
         [19, 21],
         [19, 22],
         [22, 23],
         [22, 24],
         [22, 25],
         [25, 26],
         [25, 27],
         [25, 28],
         [28, 29],
         [28, 30],
         [28, 31],
         [31, 32],
         [31, 33],
         [31, 34],
         [34, 35],
         [34, 36],
         [34, 37],
         [37, 38],
         [37, 39],
         [37, 40],
         [40, 41],
         [40, 42],
         [43, 44],
         [44, 45],
         [44, 46],
         [44, 47],
         [47, 48],
         [47, 49],
         [47, 50],
         [50, 51],
         [50, 52],
         [50, 53],
         [53, 54],
         [53, 55],
         [53, 56],
         [56, 57],
         [56, 58],
         [56, 59],
         [59, 60],
         [59, 61],
         [59, 62],
         [62, 63],
         [62, 64],
         [62, 65],
         [65, 66],
         [65, 67]]

pfon_dft_sp_opt.setBonds(bonds)
pfon_dft_sp_opt_name = "pfon_dft_sp_opt"

nlsave('PFON_dft_SP_opt_1_corr.hdf5', pfon_dft_sp_opt)


# %% COSMO for slab

# %% Set LCAOCalculator

# %% LCAOCalculator

#----------------------------------------
# Exchange-Correlation
#----------------------------------------
exchange_correlation = HybridGGA.B3LYP

#----------------------------------------
# Basis Set
#----------------------------------------
basis_set = [
    GGABasis.Hydrogen_DoubleZetaPolarized,
    GGABasis.Carbon_DoubleZetaPolarized,
    ]

poisson_solver = FastFourier2DSolver(
    boundary_conditions=[
        [PeriodicBoundaryCondition(), PeriodicBoundaryCondition()],
        [PeriodicBoundaryCondition(), PeriodicBoundaryCondition()],
        [DirichletBoundaryCondition(), NeumannBoundaryCondition()]
    ]
)

k_point_sampling = MonkhorstPackGrid(
    na=7,
    nb=1,
    nc=1
)

numerical_accuracy_parameters = NumericalAccuracyParameters(
    density_mesh_cutoff=150.0*Hartree,
    k_point_sampling=k_point_sampling
)

solvation_parameters = CosmoSolvationParameters(
    solvent_dielectric_constant=2.3741,
    solvent_surface_tension=27.9*dyne/cm
)

calculator = LCAOCalculator(
    basis_set=basis_set,
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=numerical_accuracy_parameters,
    poisson_solver=poisson_solver,
    checkpoint_handler=NoCheckpointHandler,
    solvation_parameters=solvation_parameters
)

nlsave('PFON_dft_SP_opt_1_corr.hdf5', calculator)


# %% Set Calculator

pfon_dft_sp_opt.setCalculator(calculator)

pfon_dft_sp_opt.update()

nlsave('PFON_dft_SP_opt_1_corr.hdf5', pfon_dft_sp_opt)


# %% OptimizeGeometry

restart_strategy = RestartFromTrajectory(
    trajectory_filename='PFON_dft_SP_opt_1_corr.hdf5',
    object_id='optimize_trajectory'
)

optimized_configuration = OptimizeGeometry(
    configuration=pfon_dft_sp_opt,
    max_forces=0.002*eV/Angstrom,
    constraints=[
        FixStrain(False, True, True)
    ],
    trajectory_filename='PFON_dft_SP_opt_1_corr.hdf5',
    trajectory_object_id='optimize_trajectory',
    optimize_cell=False,
    restart_strategy=restart_strategy
)

nlsave('PFON_dft_SP_opt_1_corr.hdf5', optimized_configuration)


# %% SolventSurface

solvent_surface = SolventSurface(
    configuration=optimized_configuration
)
nlsave('PFON_dft_SP_opt_1_corr.hdf5', solvent_surface)


# %% SolvationEnergy

solvation_energy = SolvationEnergy(
    configuration=optimized_configuration
)
nlsave('PFON_dft_SP_opt_1_corr.hdf5', solvation_energy)
« Last Edit: April 10, 2024, 19:24 by karolina »

Offline Anders Blom

  • QuantumATK Staff
  • Supreme QuantumATK Wizard
  • *****
  • Posts: 5571
  • Country: dk
  • Reputation: 93
    • View Profile
    • QuantumATK at Synopsys
Re: how to use COSMO solvent in 1D systems?
« Reply #1 on: April 24, 2024, 19:45 »
COSMO as a concept, at least as we have implemented it, is just designed to work for molecules, i.e. 0D geometries, without any periodicity in any direction.