@@ -615,7 +615,7 @@ Its main functionality is provided by its
615
615
` evaluate ` method, which accepts both a ` Dataset ` as well as a (future of a)
616
616
single ` FlowAtoms ` instance, and performs the single-point calculations.
617
617
Depending on which argument it receives, it returns either a future or a ` Dataset `
618
- which contain the QM energy, forces, and stress.
618
+ which contain the QM energy, forces, and/or stress.
619
619
620
620
``` py
621
621
_, trajectory = walker.propagate(model = model, keep_trajectory = True ) # trajectory of states
@@ -651,24 +651,35 @@ energy_H.result() # about -13.7 eV
651
651
The ` CP2KReference ` expects a traditional CP2K
652
652
[ input file] ( https://github.com/molmod/psiflow/blob/main/examples/data/cp2k_input.txt )
653
653
(again represented as a multi-line string in Python, just like the PLUMED input);
654
- it should only contain the FORCE_EVAL section.
655
- Additional input files which define the basis sets, pseudopotentials, and
656
- dispersion correction parameters have to be added to the calculator after initialization.
654
+ it should only contain the ` FORCE_EVAL ` section, and any ` TOPOLOGY ` or ` CELL ` information
655
+ will be automatically removed since this information may change from structure to structure
656
+ and is automatically taken care of by psiflow internally.
657
+ Do not use absolute filepaths to refer to basis set or pseudopotential input files.
658
+ Instead, you can simply use the corresponding filenames as they appear within the
659
+ [ CP2K data directory] ( https://github.com/cp2k/cp2k/tree/master/data ) .
657
660
``` py
658
661
from psiflow.reference import CP2KReference
659
662
660
663
661
664
cp2k_input = with file (' cp2k_input.txt' , ' r' ) as f: f.read()
662
665
reference = CP2KReference(cp2k_input)
663
666
664
- # register additional input files with the following mapping
665
- # if the corresponding keyword in the CP2K input file is X, use Y as key here:
666
- # X: BASIS_SET_FILE_NAME -> Y: basis_set
667
- # X: POTENTIAL_FILE_NAME -> Y: potential
668
- # X: PARAMETER_FILE_NAME -> Y: dftd3
669
- reference.add_file(' basis_set' , ' BASIS_MOLOPT_UZH' )
670
- reference.add_file(' potential' , ' POTENTIAL_UZH' )
671
- reference.add_file(' dftd3' , ' dftd3.dat' )
667
+ ```
668
+
669
+ Sometimes, you may wish to perform energy-only evaluations. For example, in some implementations
670
+ of post-HF methods such as MP2 or RPA, evaluation of the forces can become much more expensive
671
+ and is generally not efficient.
672
+ In those cases, it is possible to perform energy-only evaluations of atomic structures, provided
673
+ that you have expressed to psiflow that it should not try to parse any forces from the output file.
674
+ This is done by providing a ` properties ` argument during initialization of the ` Reference ` instance.
675
+
676
+ ``` py
677
+ reference_Eonly = CP2KReference(cp2k_input, properties = (' energy' ,))
678
+ reference_Ef = CP2KReference(cp2k_input, properties = (' energy' , ' forces' ))
679
+
680
+ state = reference_Eonly.evaluate(atoms) # only contains the potential energy; not the forces
681
+ state = reference_Ef.evaluate(atoms) # contains both energy and forces (default behavior)
682
+
672
683
```
673
684
674
685
### PySCF
@@ -695,25 +706,3 @@ basis = 'cc-pvtz'
695
706
spin = 0
696
707
reference = PySCFReference(routine, basis, spin)
697
708
```
698
-
699
- ### NWChem (deprecated)
700
- For nonperiodic systems, psiflow provides an interface with [ NWChem] ( https://nwchemgit.github.io/Home.html ) ,
701
- which implements a plethora of DFT and post-HF methods for both periodic and nonperiodic systems.
702
- The ` NWChemReference ` class essentially wraps around the ASE calculator, and is similarly easy to use:
703
- ``` py
704
- calculator_kwargs = {
705
- ' basis' : {e: ' 3-21g' for e in [' H' , ' C' , ' O' , ' N' ]},
706
- ' dft' : {
707
- ' xc' : ' pw91lda' ,
708
- ' mult' : 1 ,
709
- ' convergence' : {
710
- ' energy' : 1e-6 ,
711
- ' density' : 1e-6 ,
712
- ' gradient' : 1e-6 ,
713
- },
714
- },
715
- }
716
- reference = NWChemReference(** calculator_kwargs)
717
-
718
- ```
719
-
0 commit comments